PyLinks 0.0.0.dev25__tar.gz → 0.0.0.dev26__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.
Files changed (33) hide show
  1. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/PKG-INFO +1 -1
  2. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/pyproject.toml +1 -1
  3. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/PyLinks.egg-info/PKG-INFO +1 -1
  4. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/PyLinks.egg-info/SOURCES.txt +1 -0
  5. pylinks-0.0.0.dev26/src/pylinks/string.py +39 -0
  6. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/url.py +2 -2
  7. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/setup.cfg +0 -0
  8. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/PyLinks.egg-info/dependency_links.txt +0 -0
  9. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/PyLinks.egg-info/not-zip-safe +0 -0
  10. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/PyLinks.egg-info/requires.txt +0 -0
  11. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/PyLinks.egg-info/top_level.txt +0 -0
  12. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/__init__.py +0 -0
  13. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/_settings.py +0 -0
  14. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/api/__init__.py +0 -0
  15. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/api/doi.py +0 -0
  16. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/api/github.py +0 -0
  17. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/api/orcid.py +0 -0
  18. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/exception/__init__.py +0 -0
  19. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/exception/base.py +0 -0
  20. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/exception/media_type.py +0 -0
  21. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/exception/uri.py +0 -0
  22. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/exceptions.py +0 -0
  23. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/http.py +0 -0
  24. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/media_type.py +0 -0
  25. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/site/__init__.py +0 -0
  26. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/site/binder.py +0 -0
  27. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/site/conda.py +0 -0
  28. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/site/github.py +0 -0
  29. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/site/lib_io.py +0 -0
  30. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/site/pypi.py +0 -0
  31. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/site/readthedocs.py +0 -0
  32. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/uri/__init__.py +0 -0
  33. {pylinks-0.0.0.dev25 → pylinks-0.0.0.dev26}/src/pylinks/uri/data.py +0 -0
@@ -1,5 +1,5 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyLinks
3
- Version: 0.0.0.dev25
3
+ Version: 0.0.0.dev26
4
4
  Requires-Python: >=3.10
5
5
  Requires-Dist: requests<3,>=2.31.0
@@ -17,7 +17,7 @@ namespaces = true
17
17
  # ----------------------------------------- Project Metadata -------------------------------------
18
18
  #
19
19
  [project]
20
- version = "0.0.0.dev25"
20
+ version = "0.0.0.dev26"
21
21
  name = "PyLinks"
22
22
  dependencies = [
23
23
  "requests >= 2.31.0, < 3",
@@ -1,5 +1,5 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyLinks
3
- Version: 0.0.0.dev25
3
+ Version: 0.0.0.dev26
4
4
  Requires-Python: >=3.10
5
5
  Requires-Dist: requests<3,>=2.31.0
@@ -10,6 +10,7 @@ src/pylinks/_settings.py
10
10
  src/pylinks/exceptions.py
11
11
  src/pylinks/http.py
12
12
  src/pylinks/media_type.py
13
+ src/pylinks/string.py
13
14
  src/pylinks/url.py
14
15
  src/pylinks/api/__init__.py
15
16
  src/pylinks/api/doi.py
@@ -0,0 +1,39 @@
1
+ import re as _re
2
+ import unicodedata as _unicodedata
3
+
4
+
5
+ def to_slug(string: str) -> str:
6
+ """Convert a string to a URL-friendly slug.
7
+
8
+ This function performs unicode-normalization on the string,
9
+ converts it to lowercase,
10
+ replaces any non-alphanumeric characters with hyphens, and
11
+ removes leading and trailing hyphens.
12
+ """
13
+ # Normalize the string to decompose special characters
14
+ normalized_string = _unicodedata.normalize('NFKD', string)
15
+ # Encode the string to ASCII bytes, ignoring non-ASCII characters
16
+ ascii_bytes = normalized_string.encode('ascii', 'ignore')
17
+ # Decode back to a string
18
+ ascii_string = ascii_bytes.decode('ascii')
19
+ lower_case_string = ascii_string.lower()
20
+ return _re.sub(r'[^a-z0-9]+', '-', lower_case_string).strip('-')
21
+
22
+
23
+ def camel_to_title(string: str) -> str:
24
+ """Convert a 'CamelCase' string to a 'Title Case' string.
25
+
26
+ This function inserts spaces before each uppercase letter (except the first letter)
27
+ and capitalizes the first letter of each word.
28
+ """
29
+ # Insert spaces before each uppercase letter (except the first letter)
30
+ spaced_str = _re.sub(r'(?<!^)(?=[A-Z])', ' ', string)
31
+ # Convert to title-case
32
+ title_str = spaced_str.title()
33
+ return title_str
34
+
35
+
36
+ def snake_to_camel(string):
37
+ components = string.split('_')
38
+ return ''.join([components[0]] + [x.title() for x in components[1:]])
39
+
@@ -93,14 +93,14 @@ class URL:
93
93
  for key, val in self.queries.items():
94
94
  if val is None:
95
95
  continue
96
- q_key = urllib.parse.quote(str(key), safe=self.quote_safe)
96
+ q_key = urllib.parse.quote(urllib.parse.unquote(str(key)), safe=self.quote_safe)
97
97
  if isinstance(val, bool) and val is True:
98
98
  queries.append(q_key)
99
99
  else:
100
100
  q_val = (
101
101
  val.decode("utf8")
102
102
  if isinstance(val, bytes)
103
- else urllib.parse.quote(str(val), safe=self.quote_safe)
103
+ else urllib.parse.quote(urllib.parse.unquote(str(val)), safe=self.quote_safe)
104
104
  )
105
105
  queries.append(f"{q_key}={q_val}")
106
106
  return self.query_delimiter.join(queries)
File without changes