erddapy 3.3.2__tar.gz → 3.3.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,37 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: erddapy
3
- Version: 3.3.2
3
+ Version: 3.3.3
4
4
  Summary: Python interface for ERDDAP
5
5
  Maintainer-email: Alex Kerney <akerney@gmri.org>, Callum Rollo <c.rollo@outlook.com>, Filipe Fernandes <ocefpaf+erddapy@gmail.com>
6
- License: Copyright 2017 Filipe Fernandes
7
-
8
-
9
- Redistribution and use in source and binary forms,
10
- with or without modification,
11
- are permitted provided that the following conditions are met:
12
-
13
- 1. Redistributions of source code must retain the above copyright notice,
14
- this list of conditions and the following disclaimer.
15
-
16
- 2. Redistributions in binary form must reproduce the above copyright notice,
17
- this list of conditions and the following disclaimer in the documentation
18
- and/or other materials provided with the distribution.
19
-
20
- 3. Neither the name of the copyright holder nor the names of its contributors
21
- may be used to endorse or promote products derived from this software
22
- without specific prior written permission.
23
-
24
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
26
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
28
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
33
- WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
-
6
+ License-Expression: BSD-3-Clause
7
+ Project-URL: documentation, https://ioos.github.io/erddapy
8
+ Project-URL: homepage, https://github.com/ioos/erddapy
9
+ Project-URL: repository, https://github.com/ioos/erddapy
35
10
  Classifier: Programming Language :: Python :: 3 :: Only
36
11
  Classifier: Programming Language :: Python :: 3.11
37
12
  Classifier: Programming Language :: Python :: 3.12
@@ -43,6 +18,15 @@ Description-Content-Type: text/markdown
43
18
  License-File: LICENSE.txt
44
19
  Requires-Dist: pandas
45
20
  Requires-Dist: requests
21
+ Provides-Extra: all
22
+ Requires-Dist: erddapy[extras,objects]; extra == "all"
23
+ Provides-Extra: extras
24
+ Requires-Dist: joblib; extra == "extras"
25
+ Provides-Extra: objects
26
+ Requires-Dist: dask; extra == "objects"
27
+ Requires-Dist: netcdf4; extra == "objects"
28
+ Requires-Dist: scitools-iris>=3.3; extra == "objects"
29
+ Requires-Dist: xarray; extra == "objects"
46
30
  Dynamic: license-file
47
31
 
48
32
  <h1 align="center" style="margin:1em;">
@@ -20,8 +20,7 @@ def _griddap_get_constraints(
20
20
  xmlns = "https://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"
21
21
 
22
22
  ncml_url = f"{dataset_url}.ncml"
23
- res = urlopen(ncml_url)
24
- xml = res.read().decode("utf-8")
23
+ xml = urlopen(ncml_url).read().decode("utf-8")
25
24
  root = ET.fromstring(xml) # noqa: S314
26
25
 
27
26
  variables = root.findall(f"{{{xmlns}}}variable")
@@ -232,9 +232,7 @@ def _check_substrings(constraint: str) -> bool:
232
232
  """Extend the OPeNDAP with extra strings."""
233
233
  # The `now` doesn't need this check, it works both quoted and unquoted.
234
234
  substrings = ["now+", "now-", "min(", "max("]
235
- return any(
236
- True for substring in substrings if substring in str(constraint)
237
- )
235
+ return any(True for substring in substrings if substring in constraint)
238
236
 
239
237
 
240
238
  def _is_quoted(url: str) -> bool:
@@ -570,7 +568,7 @@ def get_download_url( # noqa: PLR0913
570
568
  if constraints:
571
569
  _constraints = copy.copy(constraints)
572
570
  for k, v in _constraints.items():
573
- if _check_substrings(v):
571
+ if _check_substrings(str(v)):
574
572
  continue
575
573
  # The valid operators are =, != (not equals),
576
574
  # =~ (a regular expression test), <, <=, >, and >=
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import copy
5
6
  import functools
6
7
  import hashlib
7
8
  import re
@@ -147,9 +148,9 @@ class ERDDAP:
147
148
  self._build_info_uncached,
148
149
  )
149
150
 
150
- def _build_info_uncached(self) -> tuple[str | None, str | None]:
151
+ def _build_info_uncached(self) -> tuple[str, str]:
151
152
  """ERDDAP server build_info."""
152
- build_info: tuple[str | None, str | None] = (None, None)
153
+ build_info: tuple[str, str] = ("", "")
153
154
  metrics = f"{self.server}/metrics"
154
155
  try:
155
156
  ret = urlopen(metrics)
@@ -157,12 +158,12 @@ class ERDDAP:
157
158
  for line in text.decode().splitlines():
158
159
  if line.strip().startswith("ERDDAP_build_info"):
159
160
  break
160
- match = re.search(
161
- r'deployment_info="([^"]+)".*?version_full="([^"]+)"',
161
+ version_full = re.findall(r'version_full="([^"]+)"|$', line)[0]
162
+ deployment_info = re.findall(
163
+ r'deployment_info="([^"]+)".*?|$',
162
164
  line,
163
- )
164
- if match:
165
- build_info = match.group(2), match.group(1)
165
+ )[0]
166
+ build_info = version_full, deployment_info
166
167
  except (
167
168
  requests.exceptions.HTTPError,
168
169
  requests.exceptions.ConnectionError,
@@ -562,7 +563,7 @@ class ERDDAP:
562
563
  var = variables[vname]
563
564
  for k, v in kwargs.items():
564
565
  # Attributes must always be a string.
565
- _k = str(k)
566
+ _k = copy.copy(k)
566
567
  if callable(v):
567
568
  has_value_flag = v(var.get(_k, None))
568
569
  if not has_value_flag:
@@ -6,7 +6,8 @@ requires = [ "setuptools>=42", "setuptools-scm" ]
6
6
  name = "erddapy"
7
7
  description = "Python interface for ERDDAP"
8
8
  readme = "README.md"
9
- license = { file = "LICENSE.txt" }
9
+ license = "BSD-3-Clause"
10
+ license-files = [ "LICENSE.txt" ]
10
11
  maintainers = [
11
12
  { name = "Alex Kerney", email = "akerney@gmri.org" },
12
13
  { name = "Callum Rollo", email = "c.rollo@outlook.com" },
@@ -26,6 +27,19 @@ dependencies = [
26
27
  "pandas",
27
28
  "requests",
28
29
  ]
30
+ optional-dependencies.all = [ "erddapy[extras,objects]" ]
31
+ optional-dependencies.extras = [
32
+ "joblib",
33
+ ]
34
+ optional-dependencies.objects = [
35
+ "dask",
36
+ "netcdf4",
37
+ "scitools-iris>=3.3",
38
+ "xarray",
39
+ ]
40
+ urls.documentation = "https://ioos.github.io/erddapy"
41
+ urls.homepage = "https://github.com/ioos/erddapy"
42
+ urls.repository = "https://github.com/ioos/erddapy"
29
43
  entry-points."xarray.backends".erddapy = "erddapy.xarray_erddap:ERDDAPyBackendEntrypoint"
30
44
 
31
45
  [dependency-groups]
@@ -47,17 +61,6 @@ docs = [
47
61
  "regionmask>=0.9",
48
62
  "sphinx",
49
63
  { include-group = "dev" },
50
- { include-group = "objects" },
51
- { include-group = "extras" },
52
- ]
53
- extras = [
54
- "joblib",
55
- ]
56
- objects = [
57
- "dask",
58
- "netcdf4",
59
- "scitools-iris>=3.3",
60
- "xarray",
61
64
  ]
62
65
  urls.documentation = "https://ioos.github.io/erddapy"
63
66
  urls.homepage = "https://github.com/ioos/erddapy"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes