dately 3.2.1__tar.gz → 3.2.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.
Files changed (87) hide show
  1. {dately-3.2.1 → dately-3.2.3}/PKG-INFO +3 -3
  2. {dately-3.2.1 → dately-3.2.3}/dately/_datetime_scan.py +62 -37
  3. {dately-3.2.1 → dately-3.2.3}/dately/_version.py +1 -1
  4. {dately-3.2.1 → dately-3.2.3}/dately/core.py +3 -1
  5. {dately-3.2.1 → dately-3.2.3}/dately.egg-info/PKG-INFO +3 -3
  6. {dately-3.2.1 → dately-3.2.3}/MANIFEST.in +0 -0
  7. {dately-3.2.1 → dately-3.2.3}/README.md +0 -0
  8. {dately-3.2.1 → dately-3.2.3}/dately/__envutils.py +0 -0
  9. {dately-3.2.1 → dately-3.2.3}/dately/__init__.py +0 -0
  10. {dately-3.2.1 → dately-3.2.3}/dately/__os_config.py +0 -0
  11. {dately-3.2.1 → dately-3.2.3}/dately/__user_agents_config.py +0 -0
  12. {dately-3.2.1 → dately-3.2.3}/dately/_api.py +0 -0
  13. {dately-3.2.1 → dately-3.2.3}/dately/_connect.py +0 -0
  14. {dately-3.2.1 → dately-3.2.3}/dately/_holiday.py +0 -0
  15. {dately-3.2.1 → dately-3.2.3}/dately/_log.py +0 -0
  16. {dately-3.2.1 → dately-3.2.3}/dately/_mskutils.py +0 -0
  17. {dately-3.2.1 → dately-3.2.3}/dately/_proxy.py +0 -0
  18. {dately-3.2.1 → dately-3.2.3}/dately/_sysutils.py +0 -0
  19. {dately-3.2.1 → dately-3.2.3}/dately/_temporal_scan.py +0 -0
  20. {dately-3.2.1 → dately-3.2.3}/dately/_timeutils.py +0 -0
  21. {dately-3.2.1 → dately-3.2.3}/dately/_timezone.py +0 -0
  22. {dately-3.2.1 → dately-3.2.3}/dately/_utils.py +0 -0
  23. {dately-3.2.1 → dately-3.2.3}/dately/_webutils.py +0 -0
  24. {dately-3.2.1 → dately-3.2.3}/dately/dt_nlp/__init__.py +0 -0
  25. {dately-3.2.1 → dately-3.2.3}/dately/dt_nlp/arithmetic.py +0 -0
  26. {dately-3.2.1 → dately-3.2.3}/dately/dt_nlp/lexical_validation/__init__.py +0 -0
  27. {dately-3.2.1 → dately-3.2.3}/dately/dt_nlp/lexical_validation/vocabulary_checks.py +0 -0
  28. {dately-3.2.1 → dately-3.2.3}/dately/dt_nlp/quantified_time.py +0 -0
  29. {dately-3.2.1 → dately-3.2.3}/dately/dt_nlp/relative_time.py +0 -0
  30. {dately-3.2.1 → dately-3.2.3}/dately/dt_nlp/semantic_validation/__init__.py +0 -0
  31. {dately-3.2.1 → dately-3.2.3}/dately/dt_nlp/semantic_validation/unit_bounds.py +0 -0
  32. {dately-3.2.1 → dately-3.2.3}/dately/dt_nlp/string_similarity/__init__.py +0 -0
  33. {dately-3.2.1 → dately-3.2.3}/dately/dt_nlp/string_similarity/spell_correction.py +0 -0
  34. {dately-3.2.1 → dately-3.2.3}/dately/dt_nlp/syntactic_validation/__init__.py +0 -0
  35. {dately-3.2.1 → dately-3.2.3}/dately/dt_nlp/syntactic_validation/structure_validator.py +0 -0
  36. {dately-3.2.1 → dately-3.2.3}/dately/dt_nlp/syntactic_validation/temporal_structure_rules.py +0 -0
  37. {dately-3.2.1 → dately-3.2.3}/dately/dt_nlp/temporal_core/__init__.py +0 -0
  38. {dately-3.2.1 → dately-3.2.3}/dately/dt_nlp/temporal_core/temporal_units.py +0 -0
  39. {dately-3.2.1 → dately-3.2.3}/dately/dt_nlp/temporal_preprocessing.py +0 -0
  40. {dately-3.2.1 → dately-3.2.3}/dately/files/__init__.py +0 -0
  41. {dately-3.2.1 → dately-3.2.3}/dately/files/country_variants.json +0 -0
  42. {dately-3.2.1 → dately-3.2.3}/dately/files/holiday.json +0 -0
  43. {dately-3.2.1 → dately-3.2.3}/dately/files/os_versions.json +0 -0
  44. {dately-3.2.1 → dately-3.2.3}/dately/files/timezone_data.json +0 -0
  45. {dately-3.2.1 → dately-3.2.3}/dately/files/user_agents.json +0 -0
  46. {dately-3.2.1 → dately-3.2.3}/dately/mold/__init__.py +0 -0
  47. {dately-3.2.1 → dately-3.2.3}/dately/mold/include/clean_str.h +0 -0
  48. {dately-3.2.1 → dately-3.2.3}/dately/mold/include/iso8601T.h +0 -0
  49. {dately-3.2.1 → dately-3.2.3}/dately/mold/include/iso8601Z.h +0 -0
  50. {dately-3.2.1 → dately-3.2.3}/dately/mold/include/root_dir_search.h +0 -0
  51. {dately-3.2.1 → dately-3.2.3}/dately/mold/include/time_zones.h +0 -0
  52. {dately-3.2.1 → dately-3.2.3}/dately/mold/pyd/Compiled.cp38-win_amd64.pyd +0 -0
  53. {dately-3.2.1 → dately-3.2.3}/dately/mold/pyd/__init__.py +0 -0
  54. {dately-3.2.1 → dately-3.2.3}/dately/mold/pyd/cdatetime/UniversalDateFormatter.cp38-win_amd64.pyd +0 -0
  55. {dately-3.2.1 → dately-3.2.3}/dately/mold/pyd/cdatetime/__init__.py +0 -0
  56. {dately-3.2.1 → dately-3.2.3}/dately/mold/pyd/cdatetime/iso8601T.cp38-win_amd64.pyd +0 -0
  57. {dately-3.2.1 → dately-3.2.3}/dately/mold/pyd/cdatetime/iso8601Z.cp38-win_amd64.pyd +0 -0
  58. {dately-3.2.1 → dately-3.2.3}/dately/mold/pyd/cdatetime/whichformat.cp38-win_amd64.pyd +0 -0
  59. {dately-3.2.1 → dately-3.2.3}/dately/mold/pyd/clean_str.cp38-win_amd64.pyd +0 -0
  60. {dately-3.2.1 → dately-3.2.3}/dately/mold/pyd/time_zones.cp38-win_amd64.pyd +0 -0
  61. {dately-3.2.1 → dately-3.2.3}/dately/mold/pyx/Compiled.pyx +0 -0
  62. {dately-3.2.1 → dately-3.2.3}/dately/mold/pyx/UniversalDateFormatter.pyx +0 -0
  63. {dately-3.2.1 → dately-3.2.3}/dately/mold/pyx/clean_str.pyx +0 -0
  64. {dately-3.2.1 → dately-3.2.3}/dately/mold/pyx/iso8601T.pyx +0 -0
  65. {dately-3.2.1 → dately-3.2.3}/dately/mold/pyx/iso8601Z.pyx +0 -0
  66. {dately-3.2.1 → dately-3.2.3}/dately/mold/pyx/time_zones.pyx +0 -0
  67. {dately-3.2.1 → dately-3.2.3}/dately/mold/pyx/whichformat.pyx +0 -0
  68. {dately-3.2.1 → dately-3.2.3}/dately/mold/src/Compiled.c +0 -0
  69. {dately-3.2.1 → dately-3.2.3}/dately/mold/src/UniversalDateFormatter.c +0 -0
  70. {dately-3.2.1 → dately-3.2.3}/dately/mold/src/clean_str.c +0 -0
  71. {dately-3.2.1 → dately-3.2.3}/dately/mold/src/clean_str_impl.c +0 -0
  72. {dately-3.2.1 → dately-3.2.3}/dately/mold/src/iso8601T.c +0 -0
  73. {dately-3.2.1 → dately-3.2.3}/dately/mold/src/iso8601T_impl.c +0 -0
  74. {dately-3.2.1 → dately-3.2.3}/dately/mold/src/iso8601Z.c +0 -0
  75. {dately-3.2.1 → dately-3.2.3}/dately/mold/src/iso8601Z_impl.c +0 -0
  76. {dately-3.2.1 → dately-3.2.3}/dately/mold/src/root_dir_search_impl.c +0 -0
  77. {dately-3.2.1 → dately-3.2.3}/dately/mold/src/time_zones.c +0 -0
  78. {dately-3.2.1 → dately-3.2.3}/dately/mold/src/time_zones_impl.c +0 -0
  79. {dately-3.2.1 → dately-3.2.3}/dately/mold/src/whichformat.c +0 -0
  80. {dately-3.2.1 → dately-3.2.3}/dately/tests/__init__.py +0 -0
  81. {dately-3.2.1 → dately-3.2.3}/dately/tests/test_parse.py +0 -0
  82. {dately-3.2.1 → dately-3.2.3}/dately.egg-info/SOURCES.txt +0 -0
  83. {dately-3.2.1 → dately-3.2.3}/dately.egg-info/dependency_links.txt +0 -0
  84. {dately-3.2.1 → dately-3.2.3}/dately.egg-info/requires.txt +0 -0
  85. {dately-3.2.1 → dately-3.2.3}/dately.egg-info/top_level.txt +0 -0
  86. {dately-3.2.1 → dately-3.2.3}/setup.cfg +0 -0
  87. {dately-3.2.1 → dately-3.2.3}/setup.py +0 -0
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dately
3
- Version: 3.2.1
3
+ Version: 3.2.3
4
4
  Summary: A comprehensive Python library for advanced date and time manipulation.
5
- Home-page: https://github.com/cedricmoorejr/dately/tree/v3.2.1
5
+ Home-page: https://github.com/cedricmoorejr/dately/tree/v3.2.3
6
6
  Author: Cedric Moore Jr.
7
7
  Author-email: cedricmoorejunior5@gmail.com
8
8
  License: MIT
9
- Project-URL: Source Code, https://github.com/cedricmoorejr/dately/releases/tag/v3.2.1
9
+ Project-URL: Source Code, https://github.com/cedricmoorejr/dately/releases/tag/v3.2.3
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: License :: OSI Approved :: MIT License
12
12
  Classifier: Operating System :: Microsoft :: Windows
@@ -52,52 +52,77 @@ import pandas as panda
52
52
 
53
53
  # ────────── Project-specific imports (directly from this project's source code) ─────────────────────────────
54
54
  from .mold.pyd.time_zones import time_zones_dict as tz_dict
55
-
55
+ from .dt_nlp.arithmetic import timeline
56
56
 
57
57
 
58
58
 
59
59
  #────────────────────────────────────────────────────────────────────────────
60
60
  # REGEX FOR DETECTING TIME COMPONENTS IN STRINGS
61
61
  #────────────────────────────────────────────────────────────────────────────
62
- # This regex pattern is used to detect time-related components in a string. It
63
- # supports various time formats, including standard clock times, fractional
64
- # seconds, AM/PM markers, and optional time zones.
65
- #
62
+ # This regex pattern detects time-related components in a string. It supports
63
+ # a wide range of time formats and time zone expressions, using a **whitelist**
64
+ # of valid timezone abbreviations (from `tz_dict`) instead of a generic pattern.
65
+ #
66
66
  # ### Pattern Details:
67
- # - Prevention of False Matches:
68
- # - Ensures the detected pattern is not preceded by a digit (`(?<!\d)`) to
69
- # avoid misinterpreting numbers as times.
70
- #
71
- # - Option 1: Standard Time Formats
72
- # - Matches times written as:
73
- # - `HH:MM`, `HH:MM:SS`, or compact form `HHMMSS`
74
- # - Supports fractional seconds (e.g., `12:30:45.123456`)
75
- # - Recognizes AM/PM markers (e.g., `3:45 PM`)
76
- # - Optionally detects time zones (e.g., `UTC`, `+02:00`, `Z`)
77
- #
78
- # - Option 2: Standalone Timezones
79
- # - Matches timezone-only strings if preceded by whitespace or start-of-string:
80
- # - `+02:00`, `-0400`, `EST`, `UTC`, `Z`
81
- #
82
- # - Lookahead (`(?=\s|$)`)
83
- # - Ensures the match must be followed by whitespace or end-of-string to
84
- # prevent partial matches inside words.
85
- #
67
+ #
68
+ # - **False Match Prevention:**
69
+ # - Ensures the match is not **preceded by a digit** (`(?<!\d)`) to avoid
70
+ # interpreting numbers like "1230" in "AB1230CD" as a time.
71
+ #
72
+ # - **Option 1: Standard Clock Times**
73
+ # - Matches time formats like:
74
+ # - `HH:MM`, `HH:MM:SS`, or `HHMMSS`
75
+ # - Optional fractional seconds (e.g., `.123456`)
76
+ # - Optional 12-hour markers (`AM`, `PM`)
77
+ # - Optional time zone suffixes, which may be:
78
+ # ▪ UTC offset: `+02:00`, `-0400`
79
+ # ▪ Time zone abbreviation from `tz_dict`: e.g., `EST`, `PST`, `UTC`
80
+ # ▪ The literal `Z` for Zulu/UTC
81
+ #
82
+ # - **Option 2: Standalone Timezones**
83
+ # - Matches a standalone timezone if it is:
84
+ # ▪ preceded by whitespace or the beginning of the string
85
+ # ▪ and matches one of the following:
86
+ # - UTC offsets (`+HH:MM`, `-HHMM`)
87
+ # - Approved abbreviations (from `tz_dict`)
88
+ # - `Z`
89
+ #
90
+ # - **Lookahead Requirement:**
91
+ # - A match must be **followed by whitespace or end-of-string** (`(?=\s|$)`)
92
+ # to avoid matching time inside words or identifiers.
93
+ #
94
+ # ### Key Enhancement:
95
+ # - Replaces open-ended `[A-Z]{3,4}` with a strict whitelist from `tz_dict`
96
+ # to avoid false positives (e.g., interpreting "Jan" as a timezone).
97
+ #
86
98
  # ### Use Case:
87
- # - Primarily used in date format detection to extract time components
88
- # from mixed datetime strings.
89
- # - Works in conjunction with the DateFormatFinder class.
99
+ # - Used by `DateFormatFinder` to extract and isolate time components from
100
+ # strings during format detection. This helps distinguish whether the
101
+ # string represents a full datetime or a date-only value.
102
+ # Collect the keys, drop the 12 month abbreviations just in case
103
+ _month_abbrs = {f.upper() for f in timeline.months if len(f) == 3}
104
+ _tz_abbrs = sorted({k.upper() for k in tz_dict.keys()} - _month_abbrs,
105
+ key=len, reverse=True) # longest first → greedy match
106
+ _tz_pattern = "|".join(map(re.escape, _tz_abbrs)) # escapes + joins with |
107
+
90
108
  _TIME_DETECTION_RE = re.compile(
91
- r"(?<!\d)(?:" # Ensure not preceded by a digit.
92
- r"(?:(?:\d{1,2}:\d{2}(?::\d{2})?|\d{6})" # Option 1: time formats (HH:MM, HH:MM:SS, or HHMMSS)
93
- r"(?:\.\d{1,6})?" # Optional fractional seconds.
94
- r"(?:\s*[AP]M)?" # Optional AM/PM marker.
95
- r"(?:\s*(?:[+-]\d{2}:?\d{2}|[+-]\d{4}|[A-Z]{3,4}|Z))?" # Optional timezone.
96
- r")"
97
- r"|" # OR
98
- r"(?:(?<=\s)|^)(?:[+-]\d{2}:?\d{2}|[+-]\d{4}|[A-Z]{3,4}|Z)" # Option 2: timezone-only; must be preceded by whitespace or start-of-string.
99
- r")(?=\s|$)", # Lookahead: must be followed by whitespace or end-of-string.
100
- re.IGNORECASE
109
+ rf"""
110
+ (?<!\d) # not preceded by a digit
111
+ (?: # ──────────────────────────────
112
+ # Option 1 — clock time, with optional zone
113
+ (?:
114
+ (?:\d{{1,2}}:\d{{2}}(?: :\d{{2}})? | \d{{6}})
115
+ (?:\.\d{{1,6}})? # fractional seconds
116
+ (?:\s*[AP]M)? # AM/PM
117
+ (?:\s*(?:[+-]\d{{2}}:?\d{{2}} | [+-]\d{{4}} | (?:{_tz_pattern}) | Z))?
118
+ )
119
+ |
120
+ # Option 2 — standalone timezone
121
+ (?:(?<=\s)|^) (?:[+-]\d{{2}}:?\d{{2}} | [+-]\d{{4}} | (?:{_tz_pattern}) | Z)
122
+ )
123
+ (?=\s|$) # must be followed by space or end
124
+ """,
125
+ re.IGNORECASE | re.VERBOSE
101
126
  )
102
127
 
103
128
  #────────────────────────────────────────────────────────────────────────────
@@ -6,7 +6,7 @@
6
6
  # execution—if applicable—encapsulated in class and function constructs.
7
7
  # In minimal implementations, this may simply define constants, metadata,
8
8
  # or serve as an interface placeholder.
9
- __version__ = "3.2.1"
9
+ __version__ = "3.2.3"
10
10
 
11
11
 
12
12
  __all__ = ['__version__']
@@ -420,7 +420,9 @@ def convert_date(dates, to_format=None, delta=0, dict_keys=None, dict_inplace=Fa
420
420
  input_format = replace_non_padded_with_padded(input_format)
421
421
  parsed_date = dt.strptime(date, input_format) + td(days=int(delta))
422
422
 
423
- if to_format and isinstance(parsed_date, dt):
423
+ if to_format:
424
+ if isinstance(parsed_date, d) and not isinstance(parsed_date, dt):
425
+ parsed_date = dt.combine(parsed_date, dt.min.time())
424
426
  return date_format_leading_zero(parsed_date, to_format)
425
427
  else:
426
428
  return parsed_date
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dately
3
- Version: 3.2.1
3
+ Version: 3.2.3
4
4
  Summary: A comprehensive Python library for advanced date and time manipulation.
5
- Home-page: https://github.com/cedricmoorejr/dately/tree/v3.2.1
5
+ Home-page: https://github.com/cedricmoorejr/dately/tree/v3.2.3
6
6
  Author: Cedric Moore Jr.
7
7
  Author-email: cedricmoorejunior5@gmail.com
8
8
  License: MIT
9
- Project-URL: Source Code, https://github.com/cedricmoorejr/dately/releases/tag/v3.2.1
9
+ Project-URL: Source Code, https://github.com/cedricmoorejr/dately/releases/tag/v3.2.3
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: License :: OSI Approved :: MIT License
12
12
  Classifier: Operating System :: Microsoft :: Windows
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes