Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._vendor.tomli._re Namespace Reference

Functions

datetime|date match_to_datetime (re.Match match)
 
timezone cached_tz (str hour_str, str minute_str, str sign_str)
 
time match_to_localtime (re.Match match)
 
Any match_to_number (re.Match match, ParseFloat parse_float)
 

Variables

str _TIME_RE_STR = r"([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(?:\.([0-9]{1,6})[0-9]*)?"
 
 RE_NUMBER
 
 RE_LOCALTIME = re.compile(_TIME_RE_STR)
 
 RE_DATETIME
 

Function Documentation

◆ cached_tz()

timezone cached_tz ( str  hour_str,
str  minute_str,
str  sign_str 
)

Definition at line 88 of file _re.py.

88def cached_tz(hour_str: str, minute_str: str, sign_str: str) -> timezone:
89 sign = 1 if sign_str == "+" else -1
90 return timezone(
91 timedelta(
92 hours=sign * int(hour_str),
93 minutes=sign * int(minute_str),
94 )
95 )
96
97

Referenced by pip._vendor.tomli._re.match_to_datetime().

Here is the caller graph for this function:

◆ match_to_datetime()

datetime | date match_to_datetime ( re.Match  match)
Convert a `RE_DATETIME` match to `datetime.datetime` or `datetime.date`.

Raises ValueError if the match does not correspond to a valid date
or datetime.

Definition at line 52 of file _re.py.

52def match_to_datetime(match: re.Match) -> datetime | date:
53 """Convert a `RE_DATETIME` match to `datetime.datetime` or `datetime.date`.
54
55 Raises ValueError if the match does not correspond to a valid date
56 or datetime.
57 """
58 (
59 year_str,
60 month_str,
61 day_str,
62 hour_str,
63 minute_str,
64 sec_str,
65 micros_str,
66 zulu_time,
67 offset_sign_str,
68 offset_hour_str,
69 offset_minute_str,
70 ) = match.groups()
71 year, month, day = int(year_str), int(month_str), int(day_str)
72 if hour_str is None:
73 return date(year, month, day)
74 hour, minute, sec = int(hour_str), int(minute_str), int(sec_str)
75 micros = int(micros_str.ljust(6, "0")) if micros_str else 0
76 if offset_sign_str:
77 tz: tzinfo | None = cached_tz(
78 offset_hour_str, offset_minute_str, offset_sign_str
79 )
80 elif zulu_time:
81 tz = timezone.utc
82 else: # local date-time
83 tz = None
84 return datetime(year, month, day, hour, minute, sec, micros, tzinfo=tz)
85
86
87@lru_cache(maxsize=None)
for i

References pip._vendor.tomli._re.cached_tz(), and i.

Here is the call graph for this function:

◆ match_to_localtime()

time match_to_localtime ( re.Match  match)

Definition at line 98 of file _re.py.

98def match_to_localtime(match: re.Match) -> time:
99 hour_str, minute_str, sec_str, micros_str = match.groups()
100 micros = int(micros_str.ljust(6, "0")) if micros_str else 0
101 return time(int(hour_str), int(minute_str), int(sec_str), micros)
102
103

References i.

◆ match_to_number()

Any match_to_number ( re.Match  match,
ParseFloat  parse_float 
)

Definition at line 104 of file _re.py.

104def match_to_number(match: re.Match, parse_float: ParseFloat) -> Any:
105 if match.group("floatpart"):
106 return parse_float(match.group())
107 return int(match.group(), 0)

References i.

Variable Documentation

◆ _TIME_RE_STR

str _TIME_RE_STR = r"([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(?:\.([0-9]{1,6})[0-9]*)?"
protected

Definition at line 17 of file _re.py.

◆ RE_DATETIME

RE_DATETIME
Initial value:
2 rf,
3 flags=re.VERBOSE,
4)

Definition at line 39 of file _re.py.

◆ RE_LOCALTIME

RE_LOCALTIME = re.compile(_TIME_RE_STR)

Definition at line 38 of file _re.py.

◆ RE_NUMBER

RE_NUMBER
Initial value:
2 ,
3 flags=re.VERBOSE,
4)

Definition at line 19 of file _re.py.