diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 09744b8..2749d96 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -51,8 +51,16 @@ jobs: run: poetry install - name: Run tests run: poetry run pytest - + - name: Run black uses: psf/black@stable + + - name: Run isort + uses: isort/isort-action@v1 + with : + configuration : "--profile black" + + - name : Ruff Check + uses: jpetrucciani/ruff-check@main with: - black_args: "." + flags: '--fix' \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index 452341b..c4f2686 100644 --- a/poetry.lock +++ b/poetry.lock @@ -84,50 +84,61 @@ dev = ["freezegun (>=1.0,<2.0)", "pytest (>=6.0)", "pytest-cov"] [[package]] name = "black" -version = "22.12.0" +version = "24.8.0" description = "The uncompromising code formatter." category = "dev" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "black-22.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9eedd20838bd5d75b80c9f5487dbcb06836a43833a37846cf1d8c1cc01cef59d"}, - {file = "black-22.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:159a46a4947f73387b4d83e87ea006dbb2337eab6c879620a3ba52699b1f4351"}, - {file = "black-22.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d30b212bffeb1e252b31dd269dfae69dd17e06d92b87ad26e23890f3efea366f"}, - {file = "black-22.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:7412e75863aa5c5411886804678b7d083c7c28421210180d67dfd8cf1221e1f4"}, - {file = "black-22.12.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c116eed0efb9ff870ded8b62fe9f28dd61ef6e9ddd28d83d7d264a38417dcee2"}, - {file = "black-22.12.0-cp37-cp37m-win_amd64.whl", hash = "sha256:1f58cbe16dfe8c12b7434e50ff889fa479072096d79f0a7f25e4ab8e94cd8350"}, - {file = "black-22.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:77d86c9f3db9b1bf6761244bc0b3572a546f5fe37917a044e02f3166d5aafa7d"}, - {file = "black-22.12.0-cp38-cp38-win_amd64.whl", hash = "sha256:82d9fe8fee3401e02e79767016b4907820a7dc28d70d137eb397b92ef3cc5bfc"}, - {file = "black-22.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:101c69b23df9b44247bd88e1d7e90154336ac4992502d4197bdac35dd7ee3320"}, - {file = "black-22.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:559c7a1ba9a006226f09e4916060982fd27334ae1998e7a38b3f33a37f7a2148"}, - {file = "black-22.12.0-py3-none-any.whl", hash = "sha256:436cc9167dd28040ad90d3b404aec22cedf24a6e4d7de221bec2730ec0c97bcf"}, - {file = "black-22.12.0.tar.gz", hash = "sha256:229351e5a18ca30f447bf724d007f890f97e13af070bb6ad4c0a441cd7596a2f"}, + {file = "black-24.8.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:09cdeb74d494ec023ded657f7092ba518e8cf78fa8386155e4a03fdcc44679e6"}, + {file = "black-24.8.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:81c6742da39f33b08e791da38410f32e27d632260e599df7245cccee2064afeb"}, + {file = "black-24.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:707a1ca89221bc8a1a64fb5e15ef39cd755633daa672a9db7498d1c19de66a42"}, + {file = "black-24.8.0-cp310-cp310-win_amd64.whl", hash = "sha256:d6417535d99c37cee4091a2f24eb2b6d5ec42b144d50f1f2e436d9fe1916fe1a"}, + {file = "black-24.8.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:fb6e2c0b86bbd43dee042e48059c9ad7830abd5c94b0bc518c0eeec57c3eddc1"}, + {file = "black-24.8.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:837fd281f1908d0076844bc2b801ad2d369c78c45cf800cad7b61686051041af"}, + {file = "black-24.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:62e8730977f0b77998029da7971fa896ceefa2c4c4933fcd593fa599ecbf97a4"}, + {file = "black-24.8.0-cp311-cp311-win_amd64.whl", hash = "sha256:72901b4913cbac8972ad911dc4098d5753704d1f3c56e44ae8dce99eecb0e3af"}, + {file = "black-24.8.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:7c046c1d1eeb7aea9335da62472481d3bbf3fd986e093cffd35f4385c94ae368"}, + {file = "black-24.8.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:649f6d84ccbae73ab767e206772cc2d7a393a001070a4c814a546afd0d423aed"}, + {file = "black-24.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2b59b250fdba5f9a9cd9d0ece6e6d993d91ce877d121d161e4698af3eb9c1018"}, + {file = "black-24.8.0-cp312-cp312-win_amd64.whl", hash = "sha256:6e55d30d44bed36593c3163b9bc63bf58b3b30e4611e4d88a0c3c239930ed5b2"}, + {file = "black-24.8.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:505289f17ceda596658ae81b61ebbe2d9b25aa78067035184ed0a9d855d18afd"}, + {file = "black-24.8.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:b19c9ad992c7883ad84c9b22aaa73562a16b819c1d8db7a1a1a49fb7ec13c7d2"}, + {file = "black-24.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1f13f7f386f86f8121d76599114bb8c17b69d962137fc70efe56137727c7047e"}, + {file = "black-24.8.0-cp38-cp38-win_amd64.whl", hash = "sha256:f490dbd59680d809ca31efdae20e634f3fae27fba3ce0ba3208333b713bc3920"}, + {file = "black-24.8.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:eab4dd44ce80dea27dc69db40dab62d4ca96112f87996bca68cd75639aeb2e4c"}, + {file = "black-24.8.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3c4285573d4897a7610054af5a890bde7c65cb466040c5f0c8b732812d7f0e5e"}, + {file = "black-24.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9e84e33b37be070ba135176c123ae52a51f82306def9f7d063ee302ecab2cf47"}, + {file = "black-24.8.0-cp39-cp39-win_amd64.whl", hash = "sha256:73bbf84ed136e45d451a260c6b73ed674652f90a2b3211d6a35e78054563a9bb"}, + {file = "black-24.8.0-py3-none-any.whl", hash = "sha256:972085c618ee94f402da1af548a4f218c754ea7e5dc70acb168bfaca4c2542ed"}, + {file = "black-24.8.0.tar.gz", hash = "sha256:2500945420b6784c38b9ee885af039f5e7471ef284ab03fa35ecdde4688cd83f"}, ] [package.dependencies] click = ">=8.0.0" mypy-extensions = ">=0.4.3" +packaging = ">=22.0" pathspec = ">=0.9.0" platformdirs = ">=2" -tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0a7\""} -typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""} +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""} [package.extras] colorama = ["colorama (>=0.4.3)"] -d = ["aiohttp (>=3.7.4)"] +d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] uvloop = ["uvloop (>=0.15.2)"] [[package]] name = "certifi" -version = "2024.7.4" +version = "2024.8.30" description = "Python package for providing Mozilla's CA Bundle." category = "main" optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2024.7.4-py3-none-any.whl", hash = "sha256:c198e21b1289c2ab85ee4e67bb4b4ef3ead0892059901a8d5b622f24a1101e90"}, - {file = "certifi-2024.7.4.tar.gz", hash = "sha256:5a1e7645bc0ec61a09e26c36f6106dd4cf40c6db3a1fb6352b0244e7fb057c7b"}, + {file = "certifi-2024.8.30-py3-none-any.whl", hash = "sha256:922820b53db7a7257ffbda3f597266d435245903d80737e34f8a45ff3e3230d8"}, + {file = "certifi-2024.8.30.tar.gz", hash = "sha256:bec941d2aa8195e248a60b31ff9f0558284cf01a52591ceda73ea9afffd69fd9"}, ] [[package]] @@ -445,26 +456,26 @@ socks = ["socksio (>=1.0.0,<2.0.0)"] [[package]] name = "idna" -version = "3.7" +version = "3.8" description = "Internationalized Domain Names in Applications (IDNA)" category = "main" optional = false -python-versions = ">=3.5" +python-versions = ">=3.6" files = [ - {file = "idna-3.7-py3-none-any.whl", hash = "sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0"}, - {file = "idna-3.7.tar.gz", hash = "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc"}, + {file = "idna-3.8-py3-none-any.whl", hash = "sha256:050b4e5baadcd44d760cedbd2b8e639f2ff89bbc7a5730fcc662954303377aac"}, + {file = "idna-3.8.tar.gz", hash = "sha256:d838c2c0ed6fced7693d5e8ab8e734d5f8fda53a039c0164afb0b82e771e3603"}, ] [[package]] name = "importlib-metadata" -version = "8.3.0" +version = "8.4.0" description = "Read metadata from Python packages" category = "main" optional = false python-versions = ">=3.8" files = [ - {file = "importlib_metadata-8.3.0-py3-none-any.whl", hash = "sha256:42817a4a0be5845d22c6e212db66a94ad261e2318d80b3e0d363894a79df2b67"}, - {file = "importlib_metadata-8.3.0.tar.gz", hash = "sha256:9c8fa6e8ea0f9516ad5c8db9246a731c948193c7754d3babb0114a05b27dd364"}, + {file = "importlib_metadata-8.4.0-py3-none-any.whl", hash = "sha256:66f342cc6ac9818fc6ff340576acd24d65ba0b3efabb2b4ac08b598965a4a2f1"}, + {file = "importlib_metadata-8.4.0.tar.gz", hash = "sha256:9a547d3bc3608b025f93d403fdd1aae741c24fbb8314df4b155675742ce303c5"}, ] [package.dependencies] @@ -623,14 +634,14 @@ files = [ [[package]] name = "mkdocs" -version = "1.6.0" +version = "1.6.1" description = "Project documentation with Markdown." category = "main" optional = false python-versions = ">=3.8" files = [ - {file = "mkdocs-1.6.0-py3-none-any.whl", hash = "sha256:1eb5cb7676b7d89323e62b56235010216319217d4af5ddc543a91beb8d125ea7"}, - {file = "mkdocs-1.6.0.tar.gz", hash = "sha256:a73f735824ef83a4f3bcb7a231dcab23f5a838f88b7efc54a0eef5fbdbc3c512"}, + {file = "mkdocs-1.6.1-py3-none-any.whl", hash = "sha256:db91759624d1647f3f34aa0c3f327dd2601beae39a366d6e064c03468d35c20e"}, + {file = "mkdocs-1.6.1.tar.gz", hash = "sha256:7b432f01d928c084353ab39c57282f29f92136665bdd6abf7c1ec8d822ef86f2"}, ] [package.dependencies] @@ -673,14 +684,14 @@ pyyaml = ">=5.1" [[package]] name = "mkdocs-material" -version = "9.5.32" +version = "9.5.34" description = "Documentation that simply works" category = "main" optional = false python-versions = ">=3.8" files = [ - {file = "mkdocs_material-9.5.32-py3-none-any.whl", hash = "sha256:f3704f46b63d31b3cd35c0055a72280bed825786eccaf19c655b44e0cd2c6b3f"}, - {file = "mkdocs_material-9.5.32.tar.gz", hash = "sha256:38ed66e6d6768dde4edde022554553e48b2db0d26d1320b19e2e2b9da0be1120"}, + {file = "mkdocs_material-9.5.34-py3-none-any.whl", hash = "sha256:54caa8be708de2b75167fd4d3b9f3d949579294f49cb242515d4653dbee9227e"}, + {file = "mkdocs_material-9.5.34.tar.gz", hash = "sha256:1e60ddf716cfb5679dfd65900b8a25d277064ed82d9a53cd5190e3f894df7840"}, ] [package.dependencies] @@ -797,15 +808,20 @@ files = [ [[package]] name = "paginate" -version = "0.5.6" +version = "0.5.7" description = "Divides large result sets into pages for easier browsing" category = "main" optional = false python-versions = "*" files = [ - {file = "paginate-0.5.6.tar.gz", hash = "sha256:5e6007b6a9398177a7e1648d04fdd9f8c9766a1a945bceac82f1929e8c78af2d"}, + {file = "paginate-0.5.7-py2.py3-none-any.whl", hash = "sha256:b885e2af73abcf01d9559fd5216b57ef722f8c42affbb63942377668e35c7591"}, + {file = "paginate-0.5.7.tar.gz", hash = "sha256:22bd083ab41e1a8b4f3690544afb2c60c25e5c9a63a30fa2f483f6c60c8e5945"}, ] +[package.extras] +dev = ["pytest", "tox"] +lint = ["black"] + [[package]] name = "pathspec" version = "0.12.1" @@ -1304,30 +1320,30 @@ jupyter = ["ipywidgets (>=7.5.1,<8.0.0)"] [[package]] name = "ruff" -version = "0.6.1" +version = "0.6.3" description = "An extremely fast Python linter and code formatter, written in Rust." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.6.1-py3-none-linux_armv6l.whl", hash = "sha256:b4bb7de6a24169dc023f992718a9417380301b0c2da0fe85919f47264fb8add9"}, - {file = "ruff-0.6.1-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:45efaae53b360c81043e311cdec8a7696420b3d3e8935202c2846e7a97d4edae"}, - {file = "ruff-0.6.1-py3-none-macosx_11_0_arm64.whl", hash = "sha256:bc60c7d71b732c8fa73cf995efc0c836a2fd8b9810e115be8babb24ae87e0850"}, - {file = "ruff-0.6.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2c7477c3b9da822e2db0b4e0b59e61b8a23e87886e727b327e7dcaf06213c5cf"}, - {file = "ruff-0.6.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3a0af7ab3f86e3dc9f157a928e08e26c4b40707d0612b01cd577cc84b8905cc9"}, - {file = "ruff-0.6.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:392688dbb50fecf1bf7126731c90c11a9df1c3a4cdc3f481b53e851da5634fa5"}, - {file = "ruff-0.6.1-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:5278d3e095ccc8c30430bcc9bc550f778790acc211865520f3041910a28d0024"}, - {file = "ruff-0.6.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:fe6d5f65d6f276ee7a0fc50a0cecaccb362d30ef98a110f99cac1c7872df2f18"}, - {file = "ruff-0.6.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b2e0dd11e2ae553ee5c92a81731d88a9883af8db7408db47fc81887c1f8b672e"}, - {file = "ruff-0.6.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d812615525a34ecfc07fd93f906ef5b93656be01dfae9a819e31caa6cfe758a1"}, - {file = "ruff-0.6.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:faaa4060f4064c3b7aaaa27328080c932fa142786f8142aff095b42b6a2eb631"}, - {file = "ruff-0.6.1-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:99d7ae0df47c62729d58765c593ea54c2546d5de213f2af2a19442d50a10cec9"}, - {file = "ruff-0.6.1-py3-none-musllinux_1_2_i686.whl", hash = "sha256:9eb18dfd7b613eec000e3738b3f0e4398bf0153cb80bfa3e351b3c1c2f6d7b15"}, - {file = "ruff-0.6.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:c62bc04c6723a81e25e71715aa59489f15034d69bf641df88cb38bdc32fd1dbb"}, - {file = "ruff-0.6.1-py3-none-win32.whl", hash = "sha256:9fb4c4e8b83f19c9477a8745e56d2eeef07a7ff50b68a6998f7d9e2e3887bdc4"}, - {file = "ruff-0.6.1-py3-none-win_amd64.whl", hash = "sha256:c2ebfc8f51ef4aca05dad4552bbcf6fe8d1f75b2f6af546cc47cc1c1ca916b5b"}, - {file = "ruff-0.6.1-py3-none-win_arm64.whl", hash = "sha256:3bc81074971b0ffad1bd0c52284b22411f02a11a012082a76ac6da153536e014"}, - {file = "ruff-0.6.1.tar.gz", hash = "sha256:af3ffd8c6563acb8848d33cd19a69b9bfe943667f0419ca083f8ebe4224a3436"}, + {file = "ruff-0.6.3-py3-none-linux_armv6l.whl", hash = "sha256:97f58fda4e309382ad30ede7f30e2791d70dd29ea17f41970119f55bdb7a45c3"}, + {file = "ruff-0.6.3-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:3b061e49b5cf3a297b4d1c27ac5587954ccb4ff601160d3d6b2f70b1622194dc"}, + {file = "ruff-0.6.3-py3-none-macosx_11_0_arm64.whl", hash = "sha256:34e2824a13bb8c668c71c1760a6ac7d795ccbd8d38ff4a0d8471fdb15de910b1"}, + {file = "ruff-0.6.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bddfbb8d63c460f4b4128b6a506e7052bad4d6f3ff607ebbb41b0aa19c2770d1"}, + {file = "ruff-0.6.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ced3eeb44df75353e08ab3b6a9e113b5f3f996bea48d4f7c027bc528ba87b672"}, + {file = "ruff-0.6.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:47021dff5445d549be954eb275156dfd7c37222acc1e8014311badcb9b4ec8c1"}, + {file = "ruff-0.6.3-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:7d7bd20dc07cebd68cc8bc7b3f5ada6d637f42d947c85264f94b0d1cd9d87384"}, + {file = "ruff-0.6.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:500f166d03fc6d0e61c8e40a3ff853fa8a43d938f5d14c183c612df1b0d6c58a"}, + {file = "ruff-0.6.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:42844ff678f9b976366b262fa2d1d1a3fe76f6e145bd92c84e27d172e3c34500"}, + {file = "ruff-0.6.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:70452a10eb2d66549de8e75f89ae82462159855e983ddff91bc0bce6511d0470"}, + {file = "ruff-0.6.3-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:65a533235ed55f767d1fc62193a21cbf9e3329cf26d427b800fdeacfb77d296f"}, + {file = "ruff-0.6.3-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:d2e2c23cef30dc3cbe9cc5d04f2899e7f5e478c40d2e0a633513ad081f7361b5"}, + {file = "ruff-0.6.3-py3-none-musllinux_1_2_i686.whl", hash = "sha256:d8a136aa7d228975a6aee3dd8bea9b28e2b43e9444aa678fb62aeb1956ff2351"}, + {file = "ruff-0.6.3-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:f92fe93bc72e262b7b3f2bba9879897e2d58a989b4714ba6a5a7273e842ad2f8"}, + {file = "ruff-0.6.3-py3-none-win32.whl", hash = "sha256:7a62d3b5b0d7f9143d94893f8ba43aa5a5c51a0ffc4a401aa97a81ed76930521"}, + {file = "ruff-0.6.3-py3-none-win_amd64.whl", hash = "sha256:746af39356fee2b89aada06c7376e1aa274a23493d7016059c3a72e3b296befb"}, + {file = "ruff-0.6.3-py3-none-win_arm64.whl", hash = "sha256:14a9528a8b70ccc7a847637c29e56fd1f9183a9db743bbc5b8e0c4ad60592a82"}, + {file = "ruff-0.6.3.tar.gz", hash = "sha256:183b99e9edd1ef63be34a3b51fee0a9f4ab95add123dbf89a71f7b1f0c991983"}, ] [[package]] @@ -1452,47 +1468,42 @@ zstd = ["zstandard (>=0.18.0)"] [[package]] name = "watchdog" -version = "4.0.2" +version = "5.0.1" description = "Filesystem events monitoring" category = "main" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "watchdog-4.0.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:ede7f010f2239b97cc79e6cb3c249e72962404ae3865860855d5cbe708b0fd22"}, - {file = "watchdog-4.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a2cffa171445b0efa0726c561eca9a27d00a1f2b83846dbd5a4f639c4f8ca8e1"}, - {file = "watchdog-4.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c50f148b31b03fbadd6d0b5980e38b558046b127dc483e5e4505fcef250f9503"}, - {file = "watchdog-4.0.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:7c7d4bf585ad501c5f6c980e7be9c4f15604c7cc150e942d82083b31a7548930"}, - {file = "watchdog-4.0.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:914285126ad0b6eb2258bbbcb7b288d9dfd655ae88fa28945be05a7b475a800b"}, - {file = "watchdog-4.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:984306dc4720da5498b16fc037b36ac443816125a3705dfde4fd90652d8028ef"}, - {file = "watchdog-4.0.2-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:1cdcfd8142f604630deef34722d695fb455d04ab7cfe9963055df1fc69e6727a"}, - {file = "watchdog-4.0.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:d7ab624ff2f663f98cd03c8b7eedc09375a911794dfea6bf2a359fcc266bff29"}, - {file = "watchdog-4.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:132937547a716027bd5714383dfc40dc66c26769f1ce8a72a859d6a48f371f3a"}, - {file = "watchdog-4.0.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:cd67c7df93eb58f360c43802acc945fa8da70c675b6fa37a241e17ca698ca49b"}, - {file = "watchdog-4.0.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:bcfd02377be80ef3b6bc4ce481ef3959640458d6feaae0bd43dd90a43da90a7d"}, - {file = "watchdog-4.0.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:980b71510f59c884d684b3663d46e7a14b457c9611c481e5cef08f4dd022eed7"}, - {file = "watchdog-4.0.2-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:aa160781cafff2719b663c8a506156e9289d111d80f3387cf3af49cedee1f040"}, - {file = "watchdog-4.0.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:f6ee8dedd255087bc7fe82adf046f0b75479b989185fb0bdf9a98b612170eac7"}, - {file = "watchdog-4.0.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:0b4359067d30d5b864e09c8597b112fe0a0a59321a0f331498b013fb097406b4"}, - {file = "watchdog-4.0.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:770eef5372f146997638d737c9a3c597a3b41037cfbc5c41538fc27c09c3a3f9"}, - {file = "watchdog-4.0.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:eeea812f38536a0aa859972d50c76e37f4456474b02bd93674d1947cf1e39578"}, - {file = "watchdog-4.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:b2c45f6e1e57ebb4687690c05bc3a2c1fb6ab260550c4290b8abb1335e0fd08b"}, - {file = "watchdog-4.0.2-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:10b6683df70d340ac3279eff0b2766813f00f35a1d37515d2c99959ada8f05fa"}, - {file = "watchdog-4.0.2-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:f7c739888c20f99824f7aa9d31ac8a97353e22d0c0e54703a547a218f6637eb3"}, - {file = "watchdog-4.0.2-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:c100d09ac72a8a08ddbf0629ddfa0b8ee41740f9051429baa8e31bb903ad7508"}, - {file = "watchdog-4.0.2-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:f5315a8c8dd6dd9425b974515081fc0aadca1d1d61e078d2246509fd756141ee"}, - {file = "watchdog-4.0.2-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:2d468028a77b42cc685ed694a7a550a8d1771bb05193ba7b24006b8241a571a1"}, - {file = "watchdog-4.0.2-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:f15edcae3830ff20e55d1f4e743e92970c847bcddc8b7509bcd172aa04de506e"}, - {file = "watchdog-4.0.2-py3-none-manylinux2014_aarch64.whl", hash = "sha256:936acba76d636f70db8f3c66e76aa6cb5136a936fc2a5088b9ce1c7a3508fc83"}, - {file = "watchdog-4.0.2-py3-none-manylinux2014_armv7l.whl", hash = "sha256:e252f8ca942a870f38cf785aef420285431311652d871409a64e2a0a52a2174c"}, - {file = "watchdog-4.0.2-py3-none-manylinux2014_i686.whl", hash = "sha256:0e83619a2d5d436a7e58a1aea957a3c1ccbf9782c43c0b4fed80580e5e4acd1a"}, - {file = "watchdog-4.0.2-py3-none-manylinux2014_ppc64.whl", hash = "sha256:88456d65f207b39f1981bf772e473799fcdc10801062c36fd5ad9f9d1d463a73"}, - {file = "watchdog-4.0.2-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:32be97f3b75693a93c683787a87a0dc8db98bb84701539954eef991fb35f5fbc"}, - {file = "watchdog-4.0.2-py3-none-manylinux2014_s390x.whl", hash = "sha256:c82253cfc9be68e3e49282831afad2c1f6593af80c0daf1287f6a92657986757"}, - {file = "watchdog-4.0.2-py3-none-manylinux2014_x86_64.whl", hash = "sha256:c0b14488bd336c5b1845cee83d3e631a1f8b4e9c5091ec539406e4a324f882d8"}, - {file = "watchdog-4.0.2-py3-none-win32.whl", hash = "sha256:0d8a7e523ef03757a5aa29f591437d64d0d894635f8a50f370fe37f913ce4e19"}, - {file = "watchdog-4.0.2-py3-none-win_amd64.whl", hash = "sha256:c344453ef3bf875a535b0488e3ad28e341adbd5a9ffb0f7d62cefacc8824ef2b"}, - {file = "watchdog-4.0.2-py3-none-win_ia64.whl", hash = "sha256:baececaa8edff42cd16558a639a9b0ddf425f93d892e8392a56bf904f5eff22c"}, - {file = "watchdog-4.0.2.tar.gz", hash = "sha256:b4dfbb6c49221be4535623ea4474a4d6ee0a9cef4a80b20c28db4d858b64e270"}, + {file = "watchdog-5.0.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:a6b8c6c82ada78479a0df568d27d69aa07105aba9301ac66d1ae162645f4ba34"}, + {file = "watchdog-5.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:1e8ca9b7f5f03d2f0556a43db1e9adf1e5af6adf52e0890f781324514b67a612"}, + {file = "watchdog-5.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c92812a358eabebe92b12b9290d16dc95c8003654658f6b2676c9a2103a73ceb"}, + {file = "watchdog-5.0.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:a03a6ccb846ead406a25a0b702d0a6b88fdfa77becaf907cfcfce7737ebbda1f"}, + {file = "watchdog-5.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:39f0de161a822402f0f00c68b82349a4d71c9814e749148ca2b083a25606dbf9"}, + {file = "watchdog-5.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5541a8765c4090decb4dba55d3dceb57724748a717ceaba8dc4f213edb0026e0"}, + {file = "watchdog-5.0.1-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:e321f1561adea30e447130882efe451af519646178d04189d6ba91a8cd7d88a5"}, + {file = "watchdog-5.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:c4ae0b3e95455fa9d959aa3b253c87845ad454ef188a4bf5a69cab287c131216"}, + {file = "watchdog-5.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:b2d56425dfa0c1e6f8a510f21d3d54ef7fe50bbc29638943c2cb1394b7b49156"}, + {file = "watchdog-5.0.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:70e30116849f4ec52240eb1fad83d27e525eae179bfe1c09b3bf120163d731b6"}, + {file = "watchdog-5.0.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f66df2c152edf5a2fe472bb2f8a5d562165bcf6cf9686cee5d75e524c21ca895"}, + {file = "watchdog-5.0.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:6bb68d9adb9c45f0dc1c2b12f4fb6eab0463a8f9741e371e4ede6769064e0785"}, + {file = "watchdog-5.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:6fbb4dd5ace074a2969825fde10034b35b31efcb6973defb22eb945b1d3acc37"}, + {file = "watchdog-5.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:753c6a4c1eea9d3b96cd58159b49103e66cb288216a414ab9ad234ccc7642ec2"}, + {file = "watchdog-5.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:20a28c8b0b3edf4ea2b27fb3527fc0a348e983f22a4317d316bb561524391932"}, + {file = "watchdog-5.0.1-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:a1cd7c919940b15f253db8279a579fb81e4e4e434b39b11a1cb7f54fe3fa46a6"}, + {file = "watchdog-5.0.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:a791dfc050ed24b82f7f100ae794192594fe863a7e9bdafcdfa5c6e405a981e5"}, + {file = "watchdog-5.0.1-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:8ba1472b5fa7c644e49641f70d7ccc567f70b54d776defa5d6f755dc2edc3fbb"}, + {file = "watchdog-5.0.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:b21e6601efe8453514c2fc21aca57fb5413c3d8b157bfe520b05b57b1788a167"}, + {file = "watchdog-5.0.1-py3-none-manylinux2014_aarch64.whl", hash = "sha256:763c6f82bb65504b47d4aea268462b2fb662676676356e04787f332a11f03eb0"}, + {file = "watchdog-5.0.1-py3-none-manylinux2014_armv7l.whl", hash = "sha256:664917cd513538728875a42d5654584b533da88cf06680452c98e73b45466968"}, + {file = "watchdog-5.0.1-py3-none-manylinux2014_i686.whl", hash = "sha256:39e828c4270452b966bc9d814911a3c7e24c62d726d2a3245f5841664ff56b5e"}, + {file = "watchdog-5.0.1-py3-none-manylinux2014_ppc64.whl", hash = "sha256:59ec6111f3750772badae3403ef17263489ed6f27ac01ec50c0244b2afa258fb"}, + {file = "watchdog-5.0.1-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:f3006361dba2005552cc8aa49c44d16a10e0a1939bb3286e888a14f722122808"}, + {file = "watchdog-5.0.1-py3-none-manylinux2014_s390x.whl", hash = "sha256:72dbdffe4aa0c36c59f4a5190bceeb7fdfdf849ab98a562b3a783a64cc6dacdd"}, + {file = "watchdog-5.0.1-py3-none-manylinux2014_x86_64.whl", hash = "sha256:c93aa24899cb4e8a51492c7ccc420bea45ced502fe9ef2e83f9ab1107e5a13b5"}, + {file = "watchdog-5.0.1-py3-none-win32.whl", hash = "sha256:2b8cd627b76194e725ed6f48d9524b1ad93a51a0dc3bd0225c56023716245091"}, + {file = "watchdog-5.0.1-py3-none-win_amd64.whl", hash = "sha256:4eaebff2f938f5325788cef26521891b2d8ecc8e7852aa123a9b458815f93875"}, + {file = "watchdog-5.0.1-py3-none-win_ia64.whl", hash = "sha256:9b1b32f89f95162f09aea6e15d9384f6e0490152f10d7ed241f8a85cddc50658"}, + {file = "watchdog-5.0.1.tar.gz", hash = "sha256:f0180e84e6493ef7c82e051334e8c9b00ffd89fa9de5e0613d3c267f6ccf2d38"}, ] [package.extras] @@ -1500,21 +1511,25 @@ watchmedo = ["PyYAML (>=3.10)"] [[package]] name = "zipp" -version = "3.20.0" +version = "3.20.1" description = "Backport of pathlib-compatible object wrapper for zip files" category = "main" optional = false python-versions = ">=3.8" files = [ - {file = "zipp-3.20.0-py3-none-any.whl", hash = "sha256:58da6168be89f0be59beb194da1250516fdaa062ccebd30127ac65d30045e10d"}, - {file = "zipp-3.20.0.tar.gz", hash = "sha256:0145e43d89664cfe1a2e533adc75adafed82fe2da404b4bbb6b026c0157bdb31"}, + {file = "zipp-3.20.1-py3-none-any.whl", hash = "sha256:9960cd8967c8f85a56f920d5d507274e74f9ff813a0ab8889a5b5be2daf44064"}, + {file = "zipp-3.20.1.tar.gz", hash = "sha256:c22b14cc4763c5a5b04134207736c107db42e9d3ef2d9779d465f5f1bcba572b"}, ] [package.extras] +check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)"] +cover = ["pytest-cov"] doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-itertools", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ignore-flaky", "pytest-mypy", "pytest-ruff (>=0.2.1)"] +enabler = ["pytest-enabler (>=2.2)"] +test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-itertools", "pytest (>=6,!=8.1.*)", "pytest-ignore-flaky"] +type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "33847bfdaf6f6c1faf2645a7917bc24127a5bfc609296e6424b5780d67163cdd" +content-hash = "a6b55e8736cd5e7c85d70dbba83dab0f4015b49c31c8285678bc18202bbdc2da" diff --git a/pyproject.toml b/pyproject.toml index e57d3d3..9bae9bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,8 +19,8 @@ mkdocs-material = "^9.0.14" pytest = "^7.1.2" respx = "^0.20.1" mypy = "^0.960" -ruff = "^0.6.1" -black = "^22.3.0" +ruff = "^0.6.3" +black = "^24.8.0" isort = "^5.10.1" pytest-asyncio = "^0.21.0" anyio = {extras = ["trio"], version = "^3.3.4"} diff --git a/src/geoserverx/__init__.py b/src/geoserverx/__init__.py index 6df592d..f2af82d 100644 --- a/src/geoserverx/__init__.py +++ b/src/geoserverx/__init__.py @@ -1,5 +1,4 @@ -from . import _sync, _async, utils, models - +from . import _async, _sync, models, utils __version__ = "0.1.0" __author__ = "krishnaglodha " diff --git a/src/geoserverx/_async/gsx.py b/src/geoserverx/_async/gsx.py index 86e35c1..3eec230 100644 --- a/src/geoserverx/_async/gsx.py +++ b/src/geoserverx/_async/gsx.py @@ -1,33 +1,34 @@ from dataclasses import dataclass -from typing import Union, Optional -from geoserverx.utils.logger import std_out_logger -from geoserverx.utils.enums import GSResponseEnum +from typing import Optional, Union + +from geoserverx.models.coverages_store import CoveragesStoreModel, CoveragesStoresModel +from geoserverx.models.data_store import ( + CreateDataStoreModel, + CreateStoreItem, + DataStoreModel, + DataStoresModel, + MainCreateDataStoreModel, +) from geoserverx.models.gs_response import GSResponse -from geoserverx.utils.errors import GeoServerXError -from geoserverx.models.style import StyleModel, AllStylesModel -from geoserverx.utils.http_client import AsyncClient -from geoserverx.utils.auth import GeoServerXAuth +from geoserverx.models.layer_group import LayerGroupsModel +from geoserverx.models.layers import LayerModel, LayersModel +from geoserverx.models.style import AllStylesModel, StyleModel from geoserverx.models.workspace import ( NewWorkspace, NewWorkspaceInfo, WorkspaceModel, WorkspacesModel, ) -from geoserverx.models.data_store import ( - DataStoreModel, - DataStoresModel, - CreateDataStoreModel, - CreateStoreItem, - MainCreateDataStoreModel, -) -from geoserverx.models.layer_group import LayerGroupsModel -from geoserverx.models.layers import LayersModel, LayerModel -from geoserverx.models.coverages_store import CoveragesStoreModel, CoveragesStoresModel +from geoserverx.utils.auth import GeoServerXAuth +from geoserverx.utils.enums import GSResponseEnum +from geoserverx.utils.errors import GeoServerXError +from geoserverx.utils.http_client import AsyncClient +from geoserverx.utils.logger import std_out_logger from geoserverx.utils.services.async_datastore import ( AddDataStoreProtocol, CreateFileStore, - ShapefileStore, GPKGfileStore, + ShapefileStore, ) @@ -294,16 +295,17 @@ async def delete_layer(self, workspace: str, layer: str) -> GSResponse: results = self.response_recognise(responses.status_code) return results - # Get all layer groups - async def get_all_layer_groups(self,workspace: Optional[str] = None) -> Union[LayerGroupsModel, GSResponse]: + async def get_all_layer_groups( + self, workspace: Optional[str] = None + ) -> Union[LayerGroupsModel, GSResponse]: Client = self.http_client if workspace: responses = await Client.get(f"workspaces/{workspace}/layergroups") - else : + else: responses = await Client.get("layergroups") if responses.status_code == 200: return LayerGroupsModel.model_validate(responses.json()) else: results = self.response_recognise(responses.status_code) - return results \ No newline at end of file + return results diff --git a/src/geoserverx/_sync/gsx.py b/src/geoserverx/_sync/gsx.py index 410cd60..ee7665e 100644 --- a/src/geoserverx/_sync/gsx.py +++ b/src/geoserverx/_sync/gsx.py @@ -1,40 +1,40 @@ from dataclasses import dataclass -from typing import Union, Optional -from geoserverx.utils.logger import std_out_logger +from typing import Optional, Union -from geoserverx.utils.errors import GeoServerXError -from geoserverx.utils.enums import GSResponseEnum +import httpx +from pydantic import ValidationError -from geoserverx.models.style import StyleModel, AllStylesModel -from geoserverx.models.workspace import ( - NewWorkspace, - NewWorkspaceInfo, - WorkspaceModel, - WorkspacesModel, -) +from geoserverx.models.coverages_layer import CoverageModel +from geoserverx.models.coverages_store import CoveragesStoreModel, CoveragesStoresModel from geoserverx.models.data_store import ( - DataStoreModel, - DataStoresModel, CreateDataStoreModel, CreateStoreItem, + DataStoreModel, + DataStoresModel, MainCreateDataStoreModel, ) from geoserverx.models.featuretypes_layer import FeatureTypesModel -from geoserverx.models.layers import LayersModel, LayerModel -from geoserverx.models.coverages_store import CoveragesStoreModel, CoveragesStoresModel -from geoserverx.models.layer_group import LayerGroupsModel -from geoserverx.models.coverages_layer import CoverageModel from geoserverx.models.gs_response import GSResponse +from geoserverx.models.layer_group import LayerGroupsModel +from geoserverx.models.layers import LayerModel, LayersModel +from geoserverx.models.style import AllStylesModel, StyleModel +from geoserverx.models.workspace import ( + NewWorkspace, + NewWorkspaceInfo, + WorkspaceModel, + WorkspacesModel, +) +from geoserverx.utils.auth import GeoServerXAuth +from geoserverx.utils.enums import GSResponseEnum +from geoserverx.utils.errors import GeoServerXError +from geoserverx.utils.http_client import SyncClient +from geoserverx.utils.logger import std_out_logger from geoserverx.utils.services.datastore import ( AddDataStoreProtocol, CreateFileStore, - ShapefileStore, GPKGfileStore, + ShapefileStore, ) -from geoserverx.utils.http_client import SyncClient -from geoserverx.utils.auth import GeoServerXAuth -import httpx -from pydantic import ValidationError @dataclass @@ -418,14 +418,15 @@ def delete_layer(self, workspace: str, layer: str) -> GSResponse: results = self.response_recognise(responses.status_code) return results - # Get all layer groups @exception_handler - def get_all_layer_groups(self,workspace: Optional[str] = None) -> Union[LayerGroupsModel, GSResponse]: + def get_all_layer_groups( + self, workspace: Optional[str] = None + ) -> Union[LayerGroupsModel, GSResponse]: Client = self.http_client if workspace: responses = Client.get(f"workspaces/{workspace}/layergroups") - else : + else: responses = Client.get("layergroups") if responses.status_code == 200: return LayerGroupsModel.model_validate(responses.json()) diff --git a/src/geoserverx/cli/cli.py b/src/geoserverx/cli/cli.py index c74ee92..4a9b5b1 100644 --- a/src/geoserverx/cli/cli.py +++ b/src/geoserverx/cli/cli.py @@ -1,10 +1,12 @@ -import typer -from enum import Enum -from geoserverx._sync.gsx import SyncGeoServerX -from rich import print import json +from enum import Enum from pathlib import Path +import typer +from rich import print + +from geoserverx._sync.gsx import SyncGeoServerX + app = typer.Typer() @@ -373,7 +375,7 @@ def layer( request: requestEnum = requestEnum._sync, workspace: str = typer.Option(..., help="Workspace name"), layer: str = typer.Option(..., help="Layer name"), - detail:bool = typer.Option(False, help="Detail Info"), + detail: bool = typer.Option(False, help="Detail Info"), url: str = typer.Option( "http://127.0.0.1:8080/geoserver/rest/", help="Geoserver REST URL" ), @@ -399,7 +401,7 @@ def layer( @app.command(help="Get layer groups in the Geoserver") def layer_groups( request: requestEnum = requestEnum._sync, - workspace: str = typer.Option( default=None,help="Workspace name"), + workspace: str = typer.Option(default=None, help="Workspace name"), url: str = typer.Option( "http://127.0.0.1:8080/geoserver/rest/", help="Geoserver REST URL" ), diff --git a/src/geoserverx/models/coverages_layer.py b/src/geoserverx/models/coverages_layer.py index e124cd8..1708f6c 100644 --- a/src/geoserverx/models/coverages_layer.py +++ b/src/geoserverx/models/coverages_layer.py @@ -1,119 +1,123 @@ -from typing import List, Optional,Union +from typing import List, Optional, Union + from pydantic import BaseModel, Field class NativeCRS(BaseModel): class Config: populate_by_name = True + crsclass: Optional[str] = Field(..., alias="@class") dollar: Optional[str] = Field(..., alias="$") + class Namespace(BaseModel): - name: Optional[str] = Field(None, description='The name of the namespace.') - href: Optional[str] = Field(None, description='URL to the namespace.') + name: Optional[str] = Field(None, description="The name of the namespace.") + href: Optional[str] = Field(None, description="URL to the namespace.") class Keywords(BaseModel): string: Optional[List[str]] = Field( None, - description='List of keyword values with internationalization and vocabulary', + description="List of keyword values with internationalization and vocabulary", ) class MetadataLinkItem(BaseModel): - type: Optional[str] = Field(None, description='The MIME type') + type: Optional[str] = Field(None, description="The MIME type") metadataType: Optional[str] = Field( None, description='The type of metadata, e.g. "FGDC"' ) - content: Optional[str] = Field(None, description='The link URL') + content: Optional[str] = Field(None, description="The link URL") class Metadatalinks(BaseModel): metadataLink: Optional[List[MetadataLinkItem]] = Field( - None, description='A collection of metadata links for the resource.' + None, description="A collection of metadata links for the resource." ) class MetadataLinkItem1(BaseModel): - type: Optional[str] = Field(None, description='The MIME type') - content: Optional[str] = Field(None, description='The link URL') + type: Optional[str] = Field(None, description="The MIME type") + content: Optional[str] = Field(None, description="The link URL") class DataLinks(BaseModel): metadataLink: Optional[List[MetadataLinkItem1]] = Field( - None, description='A collection of data links for the resource.' + None, description="A collection of data links for the resource." ) class NativeBoundingBox(BaseModel): - minx: Optional[float] = Field(None, description='The min x coordinate') - maxx: Optional[float] = Field(None, description='The max x coordinate') - miny: Optional[float] = Field(None, description='The min y coordinate') - maxy: Optional[float] = Field(None, description='The max y coordinate') - crs: Optional[NativeCRS] + minx: Optional[float] = Field(None, description="The min x coordinate") + maxx: Optional[float] = Field(None, description="The max x coordinate") + miny: Optional[float] = Field(None, description="The min y coordinate") + maxy: Optional[float] = Field(None, description="The max y coordinate") + crs: Optional[NativeCRS] class LatLonBoundingBox(BaseModel): - minx: Optional[float] = Field(None, description='The min x coordinate') - maxx: Optional[float] = Field(None, description='The max x coordinate') - miny: Optional[float] = Field(None, description='The min y coordinate') - maxy: Optional[float] = Field(None, description='The max y coordinate') + minx: Optional[float] = Field(None, description="The min x coordinate") + maxx: Optional[float] = Field(None, description="The max x coordinate") + miny: Optional[float] = Field(None, description="The min y coordinate") + maxy: Optional[float] = Field(None, description="The max y coordinate") crs: Optional[str] = Field( - None, description='The coordinate reference system object of the bounding box.' + None, description="The coordinate reference system object of the bounding box." ) class Store(BaseModel): class Config: populate_by_name = True + storeclass: Optional[str] = Field(alias="@class") - name: Optional[str] = Field(None, description='The name of the store') - href: Optional[str] = Field(None, description='URL to the data store') + name: Optional[str] = Field(None, description="The name of the store") + href: Optional[str] = Field(None, description="URL to the data store") class ResponseSRS(BaseModel): - string: Optional[List[str]] = Field(None, description='The value of the srs') + string: Optional[List[str]] = Field(None, description="The value of the srs") class AttributeItem(BaseModel): - name: Optional[str] = Field(None, description='Name of the attribute.') + name: Optional[str] = Field(None, description="Name of the attribute.") minOccurs: Optional[int] = Field( - None, description='Minimum number of occurrences of the attribute.' + None, description="Minimum number of occurrences of the attribute." ) maxOccurs: Optional[int] = Field( - None, description='Maximum number of occurrences of the attribute.' + None, description="Maximum number of occurrences of the attribute." ) nillable: Optional[bool] = Field( None, - description='Flag indicating if null is an acceptable value for the attribute.', + description="Flag indicating if null is an acceptable value for the attribute.", ) binding: Optional[str] = Field( - None, description='The java class that values of this attribute are bound to.' + None, description="The java class that values of this attribute are bound to." ) length: Optional[int] = Field( None, - description='Returns the length of this attribute. It\'s usually non null only for string and numeric types"', + description="Returns the length of this attribute. It's usually non null only for string and numeric types\"", ) class Attributes(BaseModel): attribute: Optional[List[AttributeItem]] = Field( - None, description='The derived set of attributes for the feature type.' + None, description="The derived set of attributes for the feature type." ) class Range(BaseModel): - max: Optional[Union[str, float]] = Field(None, description='max range value') - min: Optional[Union[str, float]] = Field(None, description='min range value') + max: Optional[Union[str, float]] = Field(None, description="max range value") + min: Optional[Union[str, float]] = Field(None, description="min range value") class CoverageDimensionItem(BaseModel): description: Optional[str] = Field( - None, description='description of the raster dimension' + None, description="description of the raster dimension" ) - name: Optional[str] = Field(None, description='name of the dimension') - range: Optional[Range] = Field(None, description='dimension range') + name: Optional[str] = Field(None, description="name of the dimension") + range: Optional[Range] = Field(None, description="dimension range") class Dimensions(BaseModel): @@ -121,61 +125,72 @@ class Dimensions(BaseModel): class Range1(BaseModel): - high: Optional[str] = Field(None, description='max range values') - low: Optional[str] = Field(None, description='min range values') + high: Optional[str] = Field(None, description="max range values") + low: Optional[str] = Field(None, description="min range values") class Transform(BaseModel): - scaleX: Optional[float] = Field(None, description='scale value to apply in X') - scaleY: Optional[float] = Field(None, description='scale value to apply in Y') - shearX: Optional[float] = Field(None, description='shear value to apply in X') - shearY: Optional[float] = Field(None, description='shear value to apply in Y') - translateX: Optional[float] = Field(None, description='translation to apply in X') - translateY: Optional[float] = Field(None, description='translation to apply in Y') + scaleX: Optional[float] = Field(None, description="scale value to apply in X") + scaleY: Optional[float] = Field(None, description="scale value to apply in Y") + shearX: Optional[float] = Field(None, description="shear value to apply in X") + shearY: Optional[float] = Field(None, description="shear value to apply in Y") + translateX: Optional[float] = Field(None, description="translation to apply in X") + translateY: Optional[float] = Field(None, description="translation to apply in Y") class InterpolationMethods(BaseModel): string: Optional[List[str]] = None + class SupportedFormatsString(BaseModel): string: Optional[List[str]] = None + class RequestSRSString(BaseModel): string: Optional[List[str]] = None + class InterpolationMethodsString(BaseModel): string: Optional[List[str]] = None + class Grid(BaseModel): class Config: populate_by_name = True + dimension: Optional[str] = Field(alias="@dimension") - crs: Optional[str] = Field(None, description='target coordinate system') - range: Optional[Range1] = Field(None, description='range of the raster plan') + crs: Optional[str] = Field(None, description="target coordinate system") + range: Optional[Range1] = Field(None, description="range of the raster plan") transform: Optional[Transform] = Field( - None, description='transformation definition' + None, description="transformation definition" ) interpolationMethods: Optional[InterpolationMethods] = Field( - None, description='available interpolations methods for this coverage' + None, description="available interpolations methods for this coverage" ) + class DimensionInfo(BaseModel): - defaultValue : Optional[str] - enabled : Optional[bool] + defaultValue: Optional[str] + enabled: Optional[bool] + class MetadataEntry(BaseModel): class Config: populate_by_name = True + key: Optional[str] = Field(alias="@key") dollar: Optional[str] = Field(..., alias="$") - dimensionInfo : Optional[DimensionInfo] + dimensionInfo: Optional[DimensionInfo] + class EntryParameters(BaseModel): entry: List + class MetadataEntryList(BaseModel): entry: MetadataEntry + class CoverageInfo(BaseModel): name: Optional[str] = Field( None, @@ -183,40 +198,40 @@ class CoverageInfo(BaseModel): ) nativeName: Optional[str] = Field( None, - description='The native name of the resource. This name corresponds to the physical resource that feature type is derived from -- a shapefile name, a database table, etc...', + description="The native name of the resource. This name corresponds to the physical resource that feature type is derived from -- a shapefile name, a database table, etc...", ) namespace: Optional[Namespace] = Field( None, - description='The namespace URI of the resource. Example would be an application schema namespace URI.', + description="The namespace URI of the resource. Example would be an application schema namespace URI.", ) title: Optional[str] = Field( None, - description='The title of the resource. This is usually something that is meant to be displayed in a user interface.', + description="The title of the resource. This is usually something that is meant to be displayed in a user interface.", ) abstract: Optional[str] = Field( None, - description='A description of the resource. This is usually something that is meant to be displayed in a user interface.', + description="A description of the resource. This is usually something that is meant to be displayed in a user interface.", ) defaultInterpolationMethod: Optional[str] = Field( None, - description='Default resampling (interpolation) method that will be used for this coverage.', + description="Default resampling (interpolation) method that will be used for this coverage.", ) keywords: Optional[Keywords] = Field( - None, description='A collection of keywords associated with the resource.' + None, description="A collection of keywords associated with the resource." ) metadatalinks: Optional[Metadatalinks] = Field( - None, description='Wraps a collection of metadata links for the resource.' + None, description="Wraps a collection of metadata links for the resource." ) dataLinks: Optional[DataLinks] = Field( - None, description='Wraps a collection of data links for the resource.' + None, description="Wraps a collection of data links for the resource." ) nativeCRS: Optional[NativeCRS] srs: Optional[str] = Field( None, - description='Returns the identifier of coordinate reference system of the resource.', + description="Returns the identifier of coordinate reference system of the resource.", ) nativeBoundingBox: Optional[NativeBoundingBox] = Field( - None, description='Returns the bounds of the resource in its declared CRS.' + None, description="Returns the bounds of the resource in its declared CRS." ) latLonBoundingBox: Optional[LatLonBoundingBox] = Field( None, @@ -226,64 +241,66 @@ class CoverageInfo(BaseModel): advertised: Optional[bool] = True projectionPolicy: Optional[str] metadata: Optional[MetadataEntryList] = Field( - None, description='A list of key/value metadata pairs.' + None, description="A list of key/value metadata pairs." ) - store: Optional[Store] + store: Optional[Store] cqlFilter: Optional[str] = Field( - None, description='The ECQL string used as default feature type filter' + None, description="The ECQL string used as default feature type filter" ) maxFeatures: Optional[int] = Field( None, - description='A cap on the number of features that a query against this type can return.', + description="A cap on the number of features that a query against this type can return.", ) numDecimals: Optional[float] = Field( None, - description='The number of decimal places to use when encoding floating point numbers from data of this feature type.', + description="The number of decimal places to use when encoding floating point numbers from data of this feature type.", ) responseSRS: Optional[ResponseSRS] = Field( None, - description='The SRSs that the WFS service will advertise in the capabilities document for this feature type (overriding the global WFS settings).', + description="The SRSs that the WFS service will advertise in the capabilities document for this feature type (overriding the global WFS settings).", ) overridingServiceSRS: Optional[bool] = Field( None, - description='True if this feature type info is overriding the WFS global SRS list', + description="True if this feature type info is overriding the WFS global SRS list", ) skipNumberMatched: Optional[bool] = Field( None, - description='True if this feature type info is overriding the counting of numberMatched.', + description="True if this feature type info is overriding the counting of numberMatched.", ) circularArcPresent: Optional[bool] = None linearizationTolerance: Optional[float] = Field( None, - description='Tolerance used to linearize this feature type, as an absolute value expressed in the geometries own CRS', + description="Tolerance used to linearize this feature type, as an absolute value expressed in the geometries own CRS", ) attributes: Optional[Attributes] = Field( None, - description='Wrapper for the derived set of attributes for the feature type.', + description="Wrapper for the derived set of attributes for the feature type.", ) - dimensions: Optional[Dimensions] = Field(None, description='raster dimensions') + dimensions: Optional[Dimensions] = Field(None, description="raster dimensions") grid: Optional[Grid] = Field( None, - description='contains information about how to translate from the raster plan to a coordinate reference system', + description="contains information about how to translate from the raster plan to a coordinate reference system", ) supportedFormats: Optional[SupportedFormatsString] interpolationMethods: Optional[InterpolationMethodsString] requestSRS: Optional[RequestSRSString] - parameters: EntryParameters + parameters: EntryParameters serviceConfiguration: Optional[bool] simpleConversionEnabled: Optional[bool] + class CoverageModel(BaseModel): coverage: CoverageInfo + class UpdateCoverage: def __init__(self) -> None: pass - - def update_coverage_info(self, coverage_info: CoverageInfo, advertised: Optional[bool]=True) -> CoverageInfo: - if advertised : + def update_coverage_info( + self, coverage_info: CoverageInfo, advertised: Optional[bool] = True + ) -> CoverageInfo: + if advertised: coverage_info.advertised = advertised - - return coverage_info \ No newline at end of file + return coverage_info diff --git a/src/geoserverx/models/coverages_store.py b/src/geoserverx/models/coverages_store.py index d0ae667..41c97f7 100644 --- a/src/geoserverx/models/coverages_store.py +++ b/src/geoserverx/models/coverages_store.py @@ -1,4 +1,5 @@ -from typing import Dict, List, Optional, Union, Literal +from typing import Dict, List, Literal, Optional, Union + from pydantic import BaseModel from geoserverx.models.workspace import WorkspaceInBulk diff --git a/src/geoserverx/models/data_store.py b/src/geoserverx/models/data_store.py index bc6dbd5..93ac484 100644 --- a/src/geoserverx/models/data_store.py +++ b/src/geoserverx/models/data_store.py @@ -1,4 +1,5 @@ from typing import List, Literal, Optional, Union + from pydantic import BaseModel, Field from .workspace import WorkspaceInBulk diff --git a/src/geoserverx/models/featuretypes_layer.py b/src/geoserverx/models/featuretypes_layer.py index d7da2b8..039f040 100644 --- a/src/geoserverx/models/featuretypes_layer.py +++ b/src/geoserverx/models/featuretypes_layer.py @@ -1,47 +1,49 @@ - from typing import List, Optional, Union from pydantic import BaseModel, Field class Namespace(BaseModel): - name: Optional[str] = Field(None, description='The name of the namespace.') - href: Optional[str] = Field(None, description='URL to the namespace.') + name: Optional[str] = Field(None, description="The name of the namespace.") + href: Optional[str] = Field(None, description="URL to the namespace.") class Keywords(BaseModel): string: Optional[List[str]] = Field( None, - description='List of keyword values with internationalization and vocabulary', + description="List of keyword values with internationalization and vocabulary", ) class MetadataLinkItem(BaseModel): - type: Optional[str] = Field(None, description='The MIME type') + type: Optional[str] = Field(None, description="The MIME type") metadataType: Optional[str] = Field( None, description='The type of metadata, e.g. "FGDC"' ) - content: Optional[str] = Field(None, description='The link URL') + content: Optional[str] = Field(None, description="The link URL") class Metadatalinks(BaseModel): metadataLink: Optional[List[MetadataLinkItem]] = Field( - None, description='A collection of metadata links for the resource.' + None, description="A collection of metadata links for the resource." ) class MetadataLinkItem1(BaseModel): - type: Optional[str] = Field(None, description='The MIME type') - content: Optional[str] = Field(None, description='The link URL') + type: Optional[str] = Field(None, description="The MIME type") + content: Optional[str] = Field(None, description="The link URL") class DataLinks(BaseModel): metadataLink: Optional[List[MetadataLinkItem1]] = Field( - None, description='A collection of data links for the resource.' + None, description="A collection of data links for the resource." ) + + class CRSentry(BaseModel): class Config: populate_by_name = True + key: Optional[str] = Field(alias="@class") dollar: Optional[str] = Field(..., alias="$") @@ -49,63 +51,68 @@ class Config: class CRSetnryDict(BaseModel): entry: CRSentry + class NativeBoundingBox(BaseModel): - minx: Optional[float] = Field(None, description='The min x coordinate') - maxx: Optional[float] = Field(None, description='The max x coordinate') - miny: Optional[float] = Field(None, description='The min y coordinate') - maxy: Optional[float] = Field(None, description='The max y coordinate') + minx: Optional[float] = Field(None, description="The min x coordinate") + maxx: Optional[float] = Field(None, description="The max x coordinate") + miny: Optional[float] = Field(None, description="The min y coordinate") + maxy: Optional[float] = Field(None, description="The max y coordinate") crs: Optional[Union[str, CRSentry]] = Field( - None, description='The coordinate reference system object of the bounding box.' + None, description="The coordinate reference system object of the bounding box." ) class LatLonBoundingBox(BaseModel): - minx: Optional[float] = Field(None, description='The min x coordinate') - maxx: Optional[float] = Field(None, description='The max x coordinate') - miny: Optional[float] = Field(None, description='The min y coordinate') - maxy: Optional[float] = Field(None, description='The max y coordinate') + minx: Optional[float] = Field(None, description="The min x coordinate") + maxx: Optional[float] = Field(None, description="The max x coordinate") + miny: Optional[float] = Field(None, description="The min y coordinate") + maxy: Optional[float] = Field(None, description="The max y coordinate") crs: Optional[str] = Field( - None, description='The coordinate reference system object of the bounding box.' + None, description="The coordinate reference system object of the bounding box." ) class Store(BaseModel): class Config: populate_by_name = True + key: Optional[str] = Field(alias="@class") - name: Optional[str] = Field(None, description='The name of the store') - href: Optional[str] = Field(None, description='URL to the data store') + name: Optional[str] = Field(None, description="The name of the store") + href: Optional[str] = Field(None, description="URL to the data store") class ResponseSRS(BaseModel): - string: Optional[str] = Field(None, description='The value of the srs') + string: Optional[str] = Field(None, description="The value of the srs") class AttributeItem(BaseModel): - name: Optional[str] = Field(None, description='Name of the attribute.') + name: Optional[str] = Field(None, description="Name of the attribute.") minOccurs: Optional[int] = Field( - None, description='Minimum number of occurrences of the attribute.' + None, description="Minimum number of occurrences of the attribute." ) maxOccurs: Optional[int] = Field( - None, description='Maximum number of occurrences of the attribute.' + None, description="Maximum number of occurrences of the attribute." ) nillable: Optional[bool] = Field( None, - description='Flag indicating if null is an acceptable value for the attribute.', + description="Flag indicating if null is an acceptable value for the attribute.", ) binding: Optional[str] = Field( - None, description='The java class that values of this attribute are bound to.' + None, description="The java class that values of this attribute are bound to." ) - length: Optional[int] + length: Optional[int] + class Attributes(BaseModel): attribute: Optional[List[AttributeItem]] = Field( - None, description='The derived set of attributes for the feature type.' + None, description="The derived set of attributes for the feature type." ) + class MetadataEntryItem(BaseModel): class Config: populate_by_name = True + key: Optional[str] = Field(alias="@key") dollar: Optional[str] = Field(..., alias="$") @@ -121,89 +128,90 @@ class FeatureTypeInfo(BaseModel): ) nativeName: Optional[str] = Field( None, - description='The native name of the resource. This name corresponds to the physical resource that feature type is derived from -- a shapefile name, a database table, etc...', + description="The native name of the resource. This name corresponds to the physical resource that feature type is derived from -- a shapefile name, a database table, etc...", ) namespace: Optional[Namespace] = Field( None, - description='The namespace URI of the resource. Example would be an application schema namespace URI.', + description="The namespace URI of the resource. Example would be an application schema namespace URI.", ) title: Optional[str] = Field( None, - description='The title of the resource. This is usually something that is meant to be displayed in a user interface.', + description="The title of the resource. This is usually something that is meant to be displayed in a user interface.", ) abstract: Optional[str] = Field( None, - description='A description of the resource. This is usually something that is meant to be displayed in a user interface.', + description="A description of the resource. This is usually something that is meant to be displayed in a user interface.", ) keywords: Optional[Keywords] = Field( - None, description='A collection of keywords associated with the resource.' + None, description="A collection of keywords associated with the resource." ) srs: Optional[str] = Field( None, - description='Returns the identifier of coordinate reference system of the resource.', + description="Returns the identifier of coordinate reference system of the resource.", ) - metadatalinks: Optional[Metadatalinks] - dataLinks: Optional[DataLinks] - + metadatalinks: Optional[Metadatalinks] + dataLinks: Optional[DataLinks] + nativeBoundingBox: Optional[NativeBoundingBox] = Field( - None, description='Returns the bounds of the resource in its declared CRS.' + None, description="Returns the bounds of the resource in its declared CRS." ) latLonBoundingBox: Optional[LatLonBoundingBox] = Field( None, description='The bounds of the resource in lat / lon. This value represents a "fixed value" and is not calculated on the underlying dataset.', ) - projectionPolicy:str + projectionPolicy: str metadata: Optional[MetadataEntryList] = Field( - None, description='A list of key/value metadata pairs.' + None, description="A list of key/value metadata pairs." ) store: Optional[Store] = Field( - None, description='The store the resource is a part of.' + None, description="The store the resource is a part of." ) - nativeCRS:Optional[Union[str, CRSentry]] = Field( - None, description='String for Native CRS' + nativeCRS: Optional[Union[str, CRSentry]] = Field( + None, description="String for Native CRS" ) cqlFilter: Optional[str] = Field( - None, description='The ECQL string used as default feature type filter' + None, description="The ECQL string used as default feature type filter" ) maxFeatures: Optional[int] = Field( None, - description='A cap on the number of features that a query against this type can return.', + description="A cap on the number of features that a query against this type can return.", ) numDecimals: Optional[int] = Field( None, - description='The number of decimal places to use when encoding floating point numbers from data of this feature type.', + description="The number of decimal places to use when encoding floating point numbers from data of this feature type.", ) responseSRS: Optional[ResponseSRS] = Field( None, - description='The SRSs that the WFS service will advertise in the capabilities document for this feature type (overriding the global WFS settings).', + description="The SRSs that the WFS service will advertise in the capabilities document for this feature type (overriding the global WFS settings).", ) overridingServiceSRS: Optional[bool] = Field( None, - description='True if this feature type info is overriding the WFS global SRS list', + description="True if this feature type info is overriding the WFS global SRS list", ) skipNumberMatched: Optional[bool] = Field( None, - description='True if this feature type info is overriding the counting of numberMatched.', + description="True if this feature type info is overriding the counting of numberMatched.", ) circularArcPresent: Optional[bool] = None linearizationTolerance: Optional[float] = Field( None, - description='Tolerance used to linearize this feature type, as an absolute value expressed in the geometries own CRS', + description="Tolerance used to linearize this feature type, as an absolute value expressed in the geometries own CRS", ) attributes: Optional[Attributes] = Field( None, - description='Wrapper for the derived set of attributes for the feature type.', + description="Wrapper for the derived set of attributes for the feature type.", ) - enabled:Optional[bool] - advertised:Optional[bool] - serviceConfiguration:Optional[bool] - simpleConversionEnabled:Optional[bool] - padWithZeros:Optional[bool] - forcedDecimal:Optional[bool] - overridingServiceSRS:Optional[bool] - skipNumberMatched:Optional[bool] - circularArcPresent:Optional[bool] - encodeMeasures:Optional[bool] + enabled: Optional[bool] + advertised: Optional[bool] + serviceConfiguration: Optional[bool] + simpleConversionEnabled: Optional[bool] + padWithZeros: Optional[bool] + forcedDecimal: Optional[bool] + overridingServiceSRS: Optional[bool] + skipNumberMatched: Optional[bool] + circularArcPresent: Optional[bool] + encodeMeasures: Optional[bool] + class FeatureTypesModel(BaseModel): - featureType : FeatureTypeInfo \ No newline at end of file + featureType: FeatureTypeInfo diff --git a/src/geoserverx/models/gs_response.py b/src/geoserverx/models/gs_response.py index 0870dfb..1ffeae2 100644 --- a/src/geoserverx/models/gs_response.py +++ b/src/geoserverx/models/gs_response.py @@ -1,4 +1,5 @@ from typing import Optional + from pydantic import BaseModel diff --git a/src/geoserverx/models/layer_group.py b/src/geoserverx/models/layer_group.py index 425064d..10287e4 100644 --- a/src/geoserverx/models/layer_group.py +++ b/src/geoserverx/models/layer_group.py @@ -1,5 +1,6 @@ from enum import Enum -from typing import List, Literal, Union, Optional +from typing import List, Literal, Optional, Union + from pydantic import BaseModel, Field @@ -7,27 +8,34 @@ class LayerGroupElement(BaseModel): name: str = ... href: str = ... + class LayerGroupList(BaseModel): layerGroup: List[LayerGroupElement] = ... + class LayerGroupsModel(BaseModel): layerGroups: Union[LayerGroupList, Literal[""]] + class Published(BaseModel): type: str = Field(..., alias="@type") name: str = ... href: str = ... + class Publishables(BaseModel): published: Published = ... + class Style(BaseModel): name: str = ... href: str = ... + class Styles(BaseModel): style: Style = ... + class Bounds(BaseModel): minx: float = ... miny: float = ... @@ -35,6 +43,7 @@ class Bounds(BaseModel): maxy: float = ... crs: str = ... + class ModeEnum(Enum): single = "SINGLE" opaque_container = "OPAQUE_CONTAINER" @@ -42,12 +51,15 @@ class ModeEnum(Enum): container = "CONTAINER" eo = "EO" + class WorkspaceModel(BaseModel): name: str = None + class BaseLayerGroup(BaseModel): name: str = ... + class SingleLayerGroup(BaseLayerGroup): mode: ModeEnum internationalTitle: str = "" @@ -57,12 +69,15 @@ class SingleLayerGroup(BaseLayerGroup): bounds: Bounds dateCreated: str = ... + class SingleLayerGroupModel(BaseModel): layerGroup: SingleLayerGroup + class LayerListModel(BaseModel): layer: List[str] = [] + class LayerGroupModel(BaseModel): name: str mode: ModeEnum @@ -71,11 +86,14 @@ class LayerGroupModel(BaseModel): abstractTxt: Optional[str] = None workspace: Optional[WorkspaceModel] = None + class LayerGroupPayload(BaseModel): layerGroup: LayerGroupModel + class LayerGroupStylesModel(BaseModel): style: List[str] = [] + class LayerGroupKeywordsModel(BaseModel): keyword: List[str] = [] diff --git a/src/geoserverx/models/layers.py b/src/geoserverx/models/layers.py index 021e8b3..9b3860e 100644 --- a/src/geoserverx/models/layers.py +++ b/src/geoserverx/models/layers.py @@ -1,4 +1,5 @@ from typing import List, Optional, Union + from pydantic import BaseModel, Field diff --git a/src/geoserverx/models/style.py b/src/geoserverx/models/style.py index 60e921f..1418af3 100644 --- a/src/geoserverx/models/style.py +++ b/src/geoserverx/models/style.py @@ -1,4 +1,5 @@ from typing import List + from pydantic import BaseModel diff --git a/src/geoserverx/models/workspace.py b/src/geoserverx/models/workspace.py index e800562..9edd5de 100644 --- a/src/geoserverx/models/workspace.py +++ b/src/geoserverx/models/workspace.py @@ -1,4 +1,5 @@ from typing import List, Optional + from pydantic import BaseModel diff --git a/src/geoserverx/utils/enums.py b/src/geoserverx/utils/enums.py index b02fa15..b1fdd55 100644 --- a/src/geoserverx/utils/enums.py +++ b/src/geoserverx/utils/enums.py @@ -1,4 +1,5 @@ from enum import Enum + from geoserverx.models.gs_response import GSResponse diff --git a/src/geoserverx/utils/services/async_datastore.py b/src/geoserverx/utils/services/async_datastore.py index efbbf59..6205689 100644 --- a/src/geoserverx/utils/services/async_datastore.py +++ b/src/geoserverx/utils/services/async_datastore.py @@ -18,8 +18,7 @@ async def addFile( layer_payload, store_header, layer_header, - ): - ... + ): ... class CreateFileStore: diff --git a/src/geoserverx/utils/services/datastore.py b/src/geoserverx/utils/services/datastore.py index deda60b..f36d4a8 100644 --- a/src/geoserverx/utils/services/datastore.py +++ b/src/geoserverx/utils/services/datastore.py @@ -18,8 +18,7 @@ def addFile( layer_payload, store_header, layer_header, - ): - ... + ): ... class CreateFileStore: diff --git a/tests/_async/test_gsx.py b/tests/_async/test_gsx.py index 9529a92..f674243 100644 --- a/tests/_async/test_gsx.py +++ b/tests/_async/test_gsx.py @@ -1,11 +1,12 @@ import httpx +import pytest +import pytest_asyncio import respx from pytest import mark as pytest_mark -from geoserverx._async.gsx import AsyncGeoServerX, GeoServerXAuth, GeoServerXError -import pytest_asyncio -import pytest from respx.fixtures import session_event_loop as event_loop # noqa: F401 +from geoserverx._async.gsx import AsyncGeoServerX, GeoServerXAuth, GeoServerXError + baseUrl = "http://127.0.0.1:8080/geoserver/rest/" @@ -458,7 +459,9 @@ async def test_get_all_layer_groups_success( @pytest.mark.asyncio async def test_get_all_layer_groups_NetworkError(create_a_client, respx_mock): - respx.get(f"{baseUrl}workspaces/ne/layergroups").mock(side_effect=httpx.ConnectError) + respx.get(f"{baseUrl}workspaces/ne/layergroups").mock( + side_effect=httpx.ConnectError + ) with pytest.raises(httpx.ConnectError): response = await create_a_client.get_all_layer_groups(workspace="ne") - assert response.response == "Error in connecting to Geoserver" \ No newline at end of file + assert response.response == "Error in connecting to Geoserver" diff --git a/tests/_sync/test_gsx.py b/tests/_sync/test_gsx.py index bf3aa12..d7c171f 100644 --- a/tests/_sync/test_gsx.py +++ b/tests/_sync/test_gsx.py @@ -1,7 +1,8 @@ import httpx -from pytest import fixture, mark as pytest_mark -from geoserverx._sync.gsx import SyncGeoServerX, GeoServerXAuth, GeoServerXError +from pytest import fixture +from pytest import mark as pytest_mark +from geoserverx._sync.gsx import GeoServerXAuth, GeoServerXError, SyncGeoServerX baseUrl = "http://127.0.0.1:8080/geoserver/rest/" @@ -383,7 +384,9 @@ def test_get_layer_ConnectError(client: SyncGeoServerX, respx_mock): # Test - get_all_layer_groups -def test_get_all_layer_groups_validation(client: SyncGeoServerX, bad_layer_groups_connection, respx_mock): +def test_get_all_layer_groups_validation( + client: SyncGeoServerX, bad_layer_groups_connection, respx_mock +): respx_mock.get(f"{baseUrl}workspaces/ne/layergroups").mock( return_value=httpx.Response(404, json=bad_layer_groups_connection) ) @@ -391,7 +394,9 @@ def test_get_all_layer_groups_validation(client: SyncGeoServerX, bad_layer_group assert response.response == "Result not found" -def test_get_all_layer_groups_success(client: SyncGeoServerX, good_layer_groups_connection, respx_mock): +def test_get_all_layer_groups_success( + client: SyncGeoServerX, good_layer_groups_connection, respx_mock +): respx_mock.get(f"{baseUrl}workspaces/ne/layergroups").mock( return_value=httpx.Response(200, json=good_layer_groups_connection) ) @@ -400,6 +405,8 @@ def test_get_all_layer_groups_success(client: SyncGeoServerX, good_layer_groups_ def test_get_all_layer_groups_ConnectError(client: SyncGeoServerX, respx_mock): - respx_mock.get(f"{baseUrl}workspaces/ne/layergroups").mock(side_effect=httpx.ConnectError) + respx_mock.get(f"{baseUrl}workspaces/ne/layergroups").mock( + side_effect=httpx.ConnectError + ) response = client.get_all_layer_groups(workspace="ne") - assert response.response == "Error in connecting to Geoserver" \ No newline at end of file + assert response.response == "Error in connecting to Geoserver" diff --git a/tests/cli/test_cli.py b/tests/cli/test_cli.py index 298e0cc..e786eb4 100644 --- a/tests/cli/test_cli.py +++ b/tests/cli/test_cli.py @@ -1,6 +1,7 @@ +import httpx from typer.testing import CliRunner + from geoserverx.cli.cli import app -import httpx runner = CliRunner() @@ -382,6 +383,8 @@ def test_get_all_layer_groups_success(good_layer_groups_connection, respx_mock): def test_get_all_layer_groups_NetworkError(respx_mock): - respx_mock.get(f"{baseUrl}workspaces/ne/layergroups").mock(side_effect=httpx.ConnectError) + respx_mock.get(f"{baseUrl}workspaces/ne/layergroups").mock( + side_effect=httpx.ConnectError + ) result = runner.invoke(app, ["layer-groups", "--workspace", "ne"]) assert "Error in connecting to Geoserver" in result.stdout diff --git a/tests/conftest.py b/tests/conftest.py index 967d44e..9825d27 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -626,9 +626,8 @@ def good_layer_connection() -> dict: "href": "http://localhost:8080/geoserver/rest/workspaces/tiger/datastores/nyc/featuretypes/poi.json", }, "attribution": {"logoWidth": 0, "logoHeight": 0}, - "opaque" : False, - "queryable" : True - + "opaque": False, + "queryable": True, } } return item diff --git a/tests/test_models.py b/tests/test_models.py index d5e33f9..bcfbca5 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -1,35 +1,37 @@ import pytest from pydantic import ValidationError -from geoserverx.models.data_store import ( - DataStoreInBulk, - DataStoreDict, - DatastoreConnection, - EntryItem, - DatastoreItem, - DataStoreModel, - DataStoresModel, -) + from geoserverx.models.coverages_store import ( CoveragesStoreInBulk, CoveragesStoreModel, CoveragesStoresDict, CoveragesStoresModel, ) +from geoserverx.models.data_store import ( + DatastoreConnection, + DataStoreDict, + DataStoreInBulk, + DatastoreItem, + DataStoreModel, + DataStoresModel, + EntryItem, +) +from geoserverx.models.layer_group import LayerGroupsModel from geoserverx.models.style import ( + AllStylesModel, SingleStyle, StyleModel, - allStyleList, allStyle, - AllStylesModel, + allStyleList, ) from geoserverx.models.workspace import ( + NewWorkspace, WorkspaceInBulk, - workspaceDict, WorkspaceModel, WorkspacesModel, - NewWorkspace, + workspaceDict, ) -from geoserverx.models.layer_group import LayerGroupsModel + # Testing DataStoreInBulk def test_datastoreinbulk_connection(good_datastore_in_bulk_connection): @@ -269,6 +271,7 @@ def test_layergroupsmodel_connection(good_layer_groups_connection): ds_connection = LayerGroupsModel(**good_layer_groups_connection) assert ds_connection.layerGroups.layerGroup[0].name == "tg" + def test_layergroupsmodel_failure(bad_layer_groups_connection): with pytest.raises(ValidationError): - LayerGroupsModel(**bad_layer_groups_connection) \ No newline at end of file + LayerGroupsModel(**bad_layer_groups_connection)