MCPcopy Create free account
hub / github.com/getsentry/sentry / _wall_clock_year_from_datetime_call

Function _wall_clock_year_from_datetime_call

tools/flake8_plugin.py:220–235  ·  view source on GitHub ↗
(node: ast.Call)

Source from the content-addressed store, hash-verified

218
219# Returns the literal year when this is a datetime(...) call shape we lint for.
220def _wall_clock_year_from_datetime_call(node: ast.Call) -> int | None:
221 if not node.args:
222 return None
223 y = node.args[0]
224 if not isinstance(y, ast.Constant) or not isinstance(y.value, int):
225 return None
226 if isinstance(node.func, ast.Name) and node.func.id == "datetime":
227 return y.value
228 if (
229 isinstance(node.func, ast.Attribute)
230 and node.func.attr == "datetime"
231 and isinstance(node.func.value, ast.Name)
232 and node.func.value.id == "datetime"
233 ):
234 return y.value
235 return None
236
237
238def _is_eap_events_endpoint_test_path(filename: str) -> bool:

Callers 2

visit_AssignMethod · 0.85
visit_CallMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected