Coverage for gws-app/gws/lib/__init__.py: 100%

0 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-10-05 13:35 +0200

1"""General purpose libraries. 

2 

3This package holds the libraries that the rest of GBD WebSuite builds on. 

4They wrap third-party packages and implement common formats and algorithms, 

5and are meant to be independent of the configurable objects in ``gws.base``: 

6in the intended import hierarchy, ``lib`` imports only from ``gws.core`` and 

7from other ``lib`` packages. Some libraries declare types in a ``types.pyinc`` file, 

8which are exported as ``gws.*`` types (for example ``gws.Crs``, 

9``gws.Image``, ``gws.MapGrid``, ``gws.XmlElement``). 

10 

11Subpackages: 

12 

13Geometry and coordinates 

14 

15- ``bounds``: bounds (an extent with a CRS) utilities. 

16- ``crs``: coordinate reference systems and transformations. 

17- ``extent``: extent utilities. 

18- ``gdalx``: GDAL/OGR wrapper for raster and vector files. 

19- ``gml``: reading and writing GML geometries. 

20- ``grid``: map grids and tile pyramid math. 

21- ``shape``: shapes, geometries with a CRS. 

22- ``uom``: units of measure and conversions. 

23 

24Rendering and formats 

25 

26- ``font``: fonts for server-side rendering. 

27- ``image``: raster images. 

28- ``mapserver``: MapServer support. 

29- ``pdf``: PDF utilities. 

30- ``style``: feature styles. 

31- ``svg``: SVG drawing and sanitizing. 

32 

33Data formats and text 

34 

35- ``cql``: CQL2 support. 

36- ``datetimex``: date and time utilities. 

37- ``htmlx``: HTML utilities. 

38- ``inifile``: reading and writing ini files. 

39- ``intl``: locales and locale-aware formatting. 

40- ``jsonx``: JSON utilities. 

41- ``mime``: MIME types. 

42- ``xmlx``: XML parsing, building and serialization. 

43- ``zipx``: zip archive utilities. 

44 

45System, network and security 

46 

47- ``cli``: utilities for command line scripts. 

48- ``dynimport``: dynamic imports of Python code. 

49- ``net``: URL utilities and an HTTP client. 

50- ``osx``: operating system and shell utilities. 

51- ``otp``: HOTP and TOTP one-time passwords. 

52- ``password``: password hashing, checking and generation. 

53- ``sa``: convenience wrapper for SQLAlchemy imports. 

54- ``sqlitex``: convenience wrapper for the SQLite driver. 

55- ``watcher``: file system watcher. 

56 

57Third-party code 

58 

59- ``vendor``: vendored third-party packages. 

60 

61Example:: 

62 

63 import gws.lib.crs 

64 import gws.lib.extent 

65 import gws.lib.net 

66 import gws.lib.xmlx 

67 

68 crs = gws.lib.crs.get(25832) 

69 ext = gws.lib.extent.transform( 

70 (500000, 5700000, 510000, 5710000), crs, gws.lib.crs.WEBMERCATOR) 

71 

72 res = gws.lib.net.http_request('https://example.com/wms?request=GetCapabilities') 

73 root = gws.lib.xmlx.from_string(res.text) 

74"""