id int64 1 6.07M | name stringlengths 1 295 | code stringlengths 12 426k | language stringclasses 1
value | source_file stringlengths 5 202 | start_line int64 1 158k | end_line int64 1 158k | repo dict |
|---|---|---|---|---|---|---|---|
15,201 | visit_With | def visit_With(self, node):
self.fill("with ")
self.interleave(lambda: self.write(", "), self.traverse, node.items)
with self.block(extra=self.get_type_comment(node)):
self.traverse(node.body) | python | Lib/ast.py | 1,197 | 1,201 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,202 | visit_AsyncWith | def visit_AsyncWith(self, node):
self.fill("async with ")
self.interleave(lambda: self.write(", "), self.traverse, node.items)
with self.block(extra=self.get_type_comment(node)):
self.traverse(node.body) | python | Lib/ast.py | 1,203 | 1,207 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,203 | _str_literal_helper | def _str_literal_helper(
self, string, *, quote_types=_ALL_QUOTES, escape_special_whitespace=False
):
"""Helper for writing string literals, minimizing escapes.
Returns the tuple (string literal to write, possible quote types).
"""
def escape_char(c):
# \n and \t ... | python | Lib/ast.py | 1,209 | 1,245 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,204 | escape_char | def escape_char(c):
# \n and \t are non-printable, but we only escape them if
# escape_special_whitespace is True
if not escape_special_whitespace and c in "\n\t":
return c
# Always escape backslashes and other non-printable characters
if c == ... | python | Lib/ast.py | 1,215 | 1,223 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,205 | _write_str_avoiding_backslashes | def _write_str_avoiding_backslashes(self, string, *, quote_types=_ALL_QUOTES):
"""Write string literal value with a best effort attempt to avoid backslashes."""
string, quote_types = self._str_literal_helper(string, quote_types=quote_types)
quote_type = quote_types[0]
self.write(f"{quote... | python | Lib/ast.py | 1,247 | 1,251 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,206 | visit_JoinedStr | def visit_JoinedStr(self, node):
self.write("f")
fstring_parts = []
for value in node.values:
with self.buffered() as buffer:
self._write_fstring_inner(value)
fstring_parts.append(
("".join(buffer), isinstance(value, Constant))
... | python | Lib/ast.py | 1,253 | 1,298 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,207 | _write_fstring_inner | def _write_fstring_inner(self, node, is_format_spec=False):
if isinstance(node, JoinedStr):
# for both the f-string itself, and format_spec
for value in node.values:
self._write_fstring_inner(value, is_format_spec=is_format_spec)
elif isinstance(node, Constant) an... | python | Lib/ast.py | 1,300 | 1,317 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,208 | visit_FormattedValue | def visit_FormattedValue(self, node):
def unparse_inner(inner):
unparser = type(self)()
unparser.set_precedence(_Precedence.TEST.next(), inner)
return unparser.visit(inner)
with self.delimit("{", "}"):
expr = unparse_inner(node.value)
if expr.... | python | Lib/ast.py | 1,319 | 1,335 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,209 | unparse_inner | def unparse_inner(inner):
unparser = type(self)()
unparser.set_precedence(_Precedence.TEST.next(), inner)
return unparser.visit(inner) | python | Lib/ast.py | 1,320 | 1,323 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,210 | visit_Name | def visit_Name(self, node):
self.write(node.id) | python | Lib/ast.py | 1,337 | 1,338 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,211 | _write_docstring | def _write_docstring(self, node):
self.fill()
if node.kind == "u":
self.write("u")
self._write_str_avoiding_backslashes(node.value, quote_types=_MULTI_QUOTES) | python | Lib/ast.py | 1,340 | 1,344 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,212 | _write_constant | def _write_constant(self, value):
if isinstance(value, (float, complex)):
# Substitute overflowing decimal literal for AST infinities,
# and inf - inf for NaNs.
self.write(
repr(value)
.replace("inf", _INFSTR)
.replace("nan", f"... | python | Lib/ast.py | 1,346 | 1,356 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,213 | visit_Constant | def visit_Constant(self, node):
value = node.value
if isinstance(value, tuple):
with self.delimit("(", ")"):
self.items_view(self._write_constant, value)
elif value is ...:
self.write("...")
else:
if node.kind == "u":
se... | python | Lib/ast.py | 1,358 | 1,368 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,214 | visit_List | def visit_List(self, node):
with self.delimit("[", "]"):
self.interleave(lambda: self.write(", "), self.traverse, node.elts) | python | Lib/ast.py | 1,370 | 1,372 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,215 | visit_ListComp | def visit_ListComp(self, node):
with self.delimit("[", "]"):
self.traverse(node.elt)
for gen in node.generators:
self.traverse(gen) | python | Lib/ast.py | 1,374 | 1,378 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,216 | visit_GeneratorExp | def visit_GeneratorExp(self, node):
with self.delimit("(", ")"):
self.traverse(node.elt)
for gen in node.generators:
self.traverse(gen) | python | Lib/ast.py | 1,380 | 1,384 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,217 | visit_SetComp | def visit_SetComp(self, node):
with self.delimit("{", "}"):
self.traverse(node.elt)
for gen in node.generators:
self.traverse(gen) | python | Lib/ast.py | 1,386 | 1,390 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,218 | visit_DictComp | def visit_DictComp(self, node):
with self.delimit("{", "}"):
self.traverse(node.key)
self.write(": ")
self.traverse(node.value)
for gen in node.generators:
self.traverse(gen) | python | Lib/ast.py | 1,392 | 1,398 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,219 | visit_comprehension | def visit_comprehension(self, node):
if node.is_async:
self.write(" async for ")
else:
self.write(" for ")
self.set_precedence(_Precedence.TUPLE, node.target)
self.traverse(node.target)
self.write(" in ")
self.set_precedence(_Precedence.TEST.next()... | python | Lib/ast.py | 1,400 | 1,412 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,220 | visit_IfExp | def visit_IfExp(self, node):
with self.require_parens(_Precedence.TEST, node):
self.set_precedence(_Precedence.TEST.next(), node.body, node.test)
self.traverse(node.body)
self.write(" if ")
self.traverse(node.test)
self.write(" else ")
self... | python | Lib/ast.py | 1,414 | 1,422 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,221 | visit_Set | def visit_Set(self, node):
if node.elts:
with self.delimit("{", "}"):
self.interleave(lambda: self.write(", "), self.traverse, node.elts)
else:
# `{}` would be interpreted as a dictionary literal, and
# `set` might be shadowed. Thus:
self.w... | python | Lib/ast.py | 1,424 | 1,431 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,222 | visit_Dict | def visit_Dict(self, node):
def write_key_value_pair(k, v):
self.traverse(k)
self.write(": ")
self.traverse(v)
def write_item(item):
k, v = item
if k is None:
# for dictionary unpacking operator in dicts {**{'y': 2}}
... | python | Lib/ast.py | 1,433 | 1,453 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,223 | write_key_value_pair | def write_key_value_pair(k, v):
self.traverse(k)
self.write(": ")
self.traverse(v) | python | Lib/ast.py | 1,434 | 1,437 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,224 | write_item | def write_item(item):
k, v = item
if k is None:
# for dictionary unpacking operator in dicts {**{'y': 2}}
# see PEP 448 for details
self.write("**")
self.set_precedence(_Precedence.EXPR, v)
self.traverse(v)
... | python | Lib/ast.py | 1,439 | 1,448 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,225 | visit_Tuple | def visit_Tuple(self, node):
with self.delimit_if(
"(",
")",
len(node.elts) == 0 or self.get_precedence(node) > _Precedence.TUPLE
):
self.items_view(self.traverse, node.elts) | python | Lib/ast.py | 1,455 | 1,461 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,226 | visit_UnaryOp | def visit_UnaryOp(self, node):
operator = self.unop[node.op.__class__.__name__]
operator_precedence = self.unop_precedence[operator]
with self.require_parens(operator_precedence, node):
self.write(operator)
# factor prefixes (+, -, ~) shouldn't be separated
# ... | python | Lib/ast.py | 1,471 | 1,481 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,227 | visit_BinOp | def visit_BinOp(self, node):
operator = self.binop[node.op.__class__.__name__]
operator_precedence = self.binop_precedence[operator]
with self.require_parens(operator_precedence, node):
if operator in self.binop_rassoc:
left_precedence = operator_precedence.next()
... | python | Lib/ast.py | 1,516 | 1,531 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,228 | visit_Compare | def visit_Compare(self, node):
with self.require_parens(_Precedence.CMP, node):
self.set_precedence(_Precedence.CMP.next(), node.left, *node.comparators)
self.traverse(node.left)
for o, e in zip(node.ops, node.comparators):
self.write(" " + self.cmpops[o.__cla... | python | Lib/ast.py | 1,546 | 1,552 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,229 | visit_BoolOp | def visit_BoolOp(self, node):
operator = self.boolops[node.op.__class__.__name__]
operator_precedence = self.boolop_precedence[operator]
def increasing_level_traverse(node):
nonlocal operator_precedence
operator_precedence = operator_precedence.next()
self.se... | python | Lib/ast.py | 1,557 | 1,569 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,230 | increasing_level_traverse | def increasing_level_traverse(node):
nonlocal operator_precedence
operator_precedence = operator_precedence.next()
self.set_precedence(operator_precedence, node)
self.traverse(node) | python | Lib/ast.py | 1,561 | 1,565 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,231 | visit_Attribute | def visit_Attribute(self, node):
self.set_precedence(_Precedence.ATOM, node.value)
self.traverse(node.value)
# Special case: 3.__abs__() is a syntax error, so if node.value
# is an integer literal then we need to either parenthesize
# it or add an extra space to get 3 .__abs__().... | python | Lib/ast.py | 1,571 | 1,580 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,232 | visit_Call | def visit_Call(self, node):
self.set_precedence(_Precedence.ATOM, node.func)
self.traverse(node.func)
with self.delimit("(", ")"):
comma = False
for e in node.args:
if comma:
self.write(", ")
else:
co... | python | Lib/ast.py | 1,582 | 1,598 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,233 | visit_Subscript | def visit_Subscript(self, node):
def is_non_empty_tuple(slice_value):
return (
isinstance(slice_value, Tuple)
and slice_value.elts
)
self.set_precedence(_Precedence.ATOM, node.value)
self.traverse(node.value)
with self.delimit("[",... | python | Lib/ast.py | 1,600 | 1,614 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,234 | is_non_empty_tuple | def is_non_empty_tuple(slice_value):
return (
isinstance(slice_value, Tuple)
and slice_value.elts
) | python | Lib/ast.py | 1,601 | 1,605 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,235 | visit_Starred | def visit_Starred(self, node):
self.write("*")
self.set_precedence(_Precedence.EXPR, node.value)
self.traverse(node.value) | python | Lib/ast.py | 1,616 | 1,619 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,236 | visit_Ellipsis | def visit_Ellipsis(self, node):
self.write("...") | python | Lib/ast.py | 1,621 | 1,622 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,237 | visit_Slice | def visit_Slice(self, node):
if node.lower:
self.traverse(node.lower)
self.write(":")
if node.upper:
self.traverse(node.upper)
if node.step:
self.write(":")
self.traverse(node.step) | python | Lib/ast.py | 1,624 | 1,632 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,238 | visit_Match | def visit_Match(self, node):
self.fill("match ")
self.traverse(node.subject)
with self.block():
for case in node.cases:
self.traverse(case) | python | Lib/ast.py | 1,634 | 1,639 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,239 | visit_arg | def visit_arg(self, node):
self.write(node.arg)
if node.annotation:
self.write(": ")
self.traverse(node.annotation) | python | Lib/ast.py | 1,641 | 1,645 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,240 | visit_arguments | def visit_arguments(self, node):
first = True
# normal arguments
all_args = node.posonlyargs + node.args
defaults = [None] * (len(all_args) - len(node.defaults)) + node.defaults
for index, elements in enumerate(zip(all_args, defaults), 1):
a, d = elements
... | python | Lib/ast.py | 1,647 | 1,696 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,241 | visit_keyword | def visit_keyword(self, node):
if node.arg is None:
self.write("**")
else:
self.write(node.arg)
self.write("=")
self.traverse(node.value) | python | Lib/ast.py | 1,698 | 1,704 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,242 | visit_Lambda | def visit_Lambda(self, node):
with self.require_parens(_Precedence.TEST, node):
self.write("lambda")
with self.buffered() as buffer:
self.traverse(node.args)
if buffer:
self.write(" ", *buffer)
self.write(": ")
self.set_... | python | Lib/ast.py | 1,706 | 1,715 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,243 | visit_alias | def visit_alias(self, node):
self.write(node.name)
if node.asname:
self.write(" as " + node.asname) | python | Lib/ast.py | 1,717 | 1,720 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,244 | visit_withitem | def visit_withitem(self, node):
self.traverse(node.context_expr)
if node.optional_vars:
self.write(" as ")
self.traverse(node.optional_vars) | python | Lib/ast.py | 1,722 | 1,726 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,245 | visit_match_case | def visit_match_case(self, node):
self.fill("case ")
self.traverse(node.pattern)
if node.guard:
self.write(" if ")
self.traverse(node.guard)
with self.block():
self.traverse(node.body) | python | Lib/ast.py | 1,728 | 1,735 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,246 | visit_MatchValue | def visit_MatchValue(self, node):
self.traverse(node.value) | python | Lib/ast.py | 1,737 | 1,738 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,247 | visit_MatchSingleton | def visit_MatchSingleton(self, node):
self._write_constant(node.value) | python | Lib/ast.py | 1,740 | 1,741 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,248 | visit_MatchSequence | def visit_MatchSequence(self, node):
with self.delimit("[", "]"):
self.interleave(
lambda: self.write(", "), self.traverse, node.patterns
) | python | Lib/ast.py | 1,743 | 1,747 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,249 | visit_MatchStar | def visit_MatchStar(self, node):
name = node.name
if name is None:
name = "_"
self.write(f"*{name}") | python | Lib/ast.py | 1,749 | 1,753 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,250 | visit_MatchMapping | def visit_MatchMapping(self, node):
def write_key_pattern_pair(pair):
k, p = pair
self.traverse(k)
self.write(": ")
self.traverse(p)
with self.delimit("{", "}"):
keys = node.keys
self.interleave(
lambda: self.write(... | python | Lib/ast.py | 1,755 | 1,773 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,251 | write_key_pattern_pair | def write_key_pattern_pair(pair):
k, p = pair
self.traverse(k)
self.write(": ")
self.traverse(p) | python | Lib/ast.py | 1,756 | 1,760 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,252 | visit_MatchClass | def visit_MatchClass(self, node):
self.set_precedence(_Precedence.ATOM, node.cls)
self.traverse(node.cls)
with self.delimit("(", ")"):
patterns = node.patterns
self.interleave(
lambda: self.write(", "), self.traverse, patterns
)
att... | python | Lib/ast.py | 1,775 | 1,796 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,253 | write_attr_pattern | def write_attr_pattern(pair):
attr, pattern = pair
self.write(f"{attr}=")
self.traverse(pattern) | python | Lib/ast.py | 1,785 | 1,788 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,254 | visit_MatchAs | def visit_MatchAs(self, node):
name = node.name
pattern = node.pattern
if name is None:
self.write("_")
elif pattern is None:
self.write(node.name)
else:
with self.require_parens(_Precedence.TEST, node):
self.set_precedence(_Pre... | python | Lib/ast.py | 1,798 | 1,809 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,255 | visit_MatchOr | def visit_MatchOr(self, node):
with self.require_parens(_Precedence.BOR, node):
self.set_precedence(_Precedence.BOR.next(), *node.patterns)
self.interleave(lambda: self.write(" | "), self.traverse, node.patterns) | python | Lib/ast.py | 1,811 | 1,814 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,256 | unparse | def unparse(ast_obj):
unparser = _Unparser()
return unparser.visit(ast_obj) | python | Lib/ast.py | 1,816 | 1,818 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,257 | __getattr__ | def __getattr__(name):
if name in _deprecated_globals:
globals()[name] = value = _deprecated_globals[name]
import warnings
warnings._deprecated(
f"ast.{name}", message=_DEPRECATED_CLASS_MESSAGE, remove=(3, 14)
)
return value
raise AttributeError(f"module 'ast'... | python | Lib/ast.py | 1,826 | 1,834 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,258 | main | def main():
import argparse
parser = argparse.ArgumentParser(prog='python -m ast')
parser.add_argument('infile', nargs='?', default='-',
help='the file to parse; defaults to stdin')
parser.add_argument('-m', '--mode', default='exec',
choices=('exec', 'sin... | python | Lib/ast.py | 1,837 | 1,863 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,259 | __new__ | def __new__(cls, failed, attempted, *, skipped=0):
results = super().__new__(cls, failed, attempted)
results.skipped = skipped
return results | python | Lib/doctest.py | 112 | 115 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,260 | __repr__ | def __repr__(self):
if self.skipped:
return (f'TestResults(failed={self.failed}, '
f'attempted={self.attempted}, '
f'skipped={self.skipped})')
else:
# Leave the repr() unchanged for backward compatibility
# if skipped is zero
... | python | Lib/doctest.py | 117 | 125 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,261 | register_optionflag | def register_optionflag(name):
# Create a new flag unless `name` is already known.
return OPTIONFLAGS_BY_NAME.setdefault(name, 1 << len(OPTIONFLAGS_BY_NAME)) | python | Lib/doctest.py | 150 | 152 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,262 | _extract_future_flags | def _extract_future_flags(globs):
"""
Return the compiler-flags associated with the future features that
have been imported into the given namespace (globs).
"""
flags = 0
for fname in __future__.all_feature_names:
feature = globs.get(fname, None)
if feature is getattr(__future__... | python | Lib/doctest.py | 201 | 211 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,263 | _normalize_module | def _normalize_module(module, depth=2):
"""
Return the module specified by `module`. In particular:
- If `module` is a module, then return module.
- If `module` is a string, then import and return the
module with that name.
- If `module` is None, then return the calling module.
... | python | Lib/doctest.py | 213 | 236 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,264 | _newline_convert | def _newline_convert(data):
# The IO module provides a handy decoder for universal newline conversion
return IncrementalNewlineDecoder(None, True).decode(data, True) | python | Lib/doctest.py | 238 | 240 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,265 | _load_testfile | def _load_testfile(filename, package, module_relative, encoding):
if module_relative:
package = _normalize_module(package, 3)
filename = _module_relative_path(package, filename)
if (loader := getattr(package, '__loader__', None)) is None:
try:
loader = package.__s... | python | Lib/doctest.py | 242 | 258 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,266 | _indent | def _indent(s, indent=4):
"""
Add the given number of space characters to the beginning of
every non-blank line in `s`, and return the result.
"""
# This regexp matches the start of non-blank lines:
return re.sub('(?m)^(?!$)', indent*' ', s) | python | Lib/doctest.py | 260 | 266 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,267 | _exception_traceback | def _exception_traceback(exc_info):
"""
Return a string containing a traceback message for the given
exc_info tuple (as returned by sys.exc_info()).
"""
# Get a traceback message.
excout = StringIO()
exc_type, exc_val, exc_tb = exc_info
traceback.print_exception(exc_type, exc_val, exc_tb... | python | Lib/doctest.py | 268 | 277 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,268 | getvalue | def getvalue(self):
result = StringIO.getvalue(self)
# If anything at all was written, make sure there's a trailing
# newline. There's no way for the expected output to indicate
# that a trailing newline is missing.
if result and not result.endswith("\n"):
result += ... | python | Lib/doctest.py | 281 | 288 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,269 | truncate | def truncate(self, size=None):
self.seek(size)
StringIO.truncate(self) | python | Lib/doctest.py | 290 | 292 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,270 | _ellipsis_match | def _ellipsis_match(want, got):
"""
Essentially the only subtle case:
>>> _ellipsis_match('aa...aa', 'aaa')
False
"""
if ELLIPSIS_MARKER not in want:
return want == got
# Find "the real" strings.
ws = want.split(ELLIPSIS_MARKER)
assert len(ws) >= 2
# Deal with exact mat... | python | Lib/doctest.py | 295 | 342 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,271 | _comment_line | def _comment_line(line):
"Return a commented form of the given line"
line = line.rstrip()
if line:
return '# '+line
else:
return '#' | python | Lib/doctest.py | 344 | 350 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,272 | _strip_exception_details | def _strip_exception_details(msg):
# Support for IGNORE_EXCEPTION_DETAIL.
# Get rid of everything except the exception name; in particular, drop
# the possibly dotted module path (if any) and the exception message (if
# any). We assume that a colon is never part of a dotted name, or of an
# excepti... | python | Lib/doctest.py | 352 | 376 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,273 | __init__ | def __init__(self, out):
self.__out = out
self.__debugger_used = False
# do not play signal games in the pdb
pdb.Pdb.__init__(self, stdout=out, nosigint=True)
# still use input() to get user input
self.use_rawinput = 1 | python | Lib/doctest.py | 384 | 390 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,274 | set_trace | def set_trace(self, frame=None):
self.__debugger_used = True
if frame is None:
frame = sys._getframe().f_back
pdb.Pdb.set_trace(self, frame) | python | Lib/doctest.py | 392 | 396 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,275 | set_continue | def set_continue(self):
# Calling set_continue unconditionally would break unit test
# coverage reporting, as Bdb.set_continue calls sys.settrace(None).
if self.__debugger_used:
pdb.Pdb.set_continue(self) | python | Lib/doctest.py | 398 | 402 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,276 | trace_dispatch | def trace_dispatch(self, *args):
# Redirect stdout to the given stream.
save_stdout = sys.stdout
sys.stdout = self.__out
# Call Pdb's trace dispatch method.
try:
return pdb.Pdb.trace_dispatch(self, *args)
finally:
sys.stdout = save_stdout | python | Lib/doctest.py | 404 | 412 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,277 | _module_relative_path | def _module_relative_path(module, test_path):
if not inspect.ismodule(module):
raise TypeError('Expected a module: %r' % module)
if test_path.startswith('/'):
raise ValueError('Module-relative files may not have absolute paths')
# Normalize the path. On Windows, replace "/" with "\".
te... | python | Lib/doctest.py | 415 | 447 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,278 | __init__ | def __init__(self, source, want, exc_msg=None, lineno=0, indent=0,
options=None):
# Normalize inputs.
if not source.endswith('\n'):
source += '\n'
if want and not want.endswith('\n'):
want += '\n'
if exc_msg is not None and not exc_msg.endswith('\... | python | Lib/doctest.py | 496 | 512 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,279 | __eq__ | def __eq__(self, other):
if type(self) is not type(other):
return NotImplemented
return self.source == other.source and \
self.want == other.want and \
self.lineno == other.lineno and \
self.indent == other.indent and \
self.option... | python | Lib/doctest.py | 514 | 523 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,280 | __hash__ | def __hash__(self):
return hash((self.source, self.want, self.lineno, self.indent,
self.exc_msg)) | python | Lib/doctest.py | 525 | 527 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,281 | __init__ | def __init__(self, examples, globs, name, filename, lineno, docstring):
"""
Create a new DocTest containing the given examples. The
DocTest's globals are initialized with a copy of `globs`.
"""
assert not isinstance(examples, str), \
"DocTest no longer accepts str... | python | Lib/doctest.py | 553 | 565 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,282 | __repr__ | def __repr__(self):
if len(self.examples) == 0:
examples = 'no examples'
elif len(self.examples) == 1:
examples = '1 example'
else:
examples = '%d examples' % len(self.examples)
return ('<%s %s from %s:%s (%s)>' %
(self.__class__.__name... | python | Lib/doctest.py | 567 | 576 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,283 | __eq__ | def __eq__(self, other):
if type(self) is not type(other):
return NotImplemented
return self.examples == other.examples and \
self.docstring == other.docstring and \
self.globs == other.globs and \
self.name == other.name and \
sel... | python | Lib/doctest.py | 578 | 587 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,284 | __hash__ | def __hash__(self):
return hash((self.docstring, self.name, self.filename, self.lineno)) | python | Lib/doctest.py | 589 | 590 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,285 | __lt__ | def __lt__(self, other):
if not isinstance(other, DocTest):
return NotImplemented
self_lno = self.lineno if self.lineno is not None else -1
other_lno = other.lineno if other.lineno is not None else -1
return ((self.name, self.filename, self_lno, id(self))
<
... | python | Lib/doctest.py | 593 | 600 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,286 | parse | def parse(self, string, name='<string>'):
"""
Divide the given string into examples and intervening text,
and return them as a list of alternating Examples and strings.
Line numbers for the Examples are 0-based. The optional
argument `name` is a name identifying this string, and... | python | Lib/doctest.py | 654 | 691 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,287 | get_doctest | def get_doctest(self, string, globs, name, filename, lineno):
"""
Extract all doctest examples from the given string, and
collect them into a `DocTest` object.
`globs`, `name`, `filename`, and `lineno` are attributes for
the new `DocTest` object. See the documentation for `DocT... | python | Lib/doctest.py | 693 | 703 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,288 | get_examples | def get_examples(self, string, name='<string>'):
"""
Extract all doctest examples from the given string, and return
them as a list of `Example` objects. Line numbers are
0-based, because it's most common in doctests that nothing
interesting appears on the same line as opening tr... | python | Lib/doctest.py | 705 | 717 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,289 | _parse_example | def _parse_example(self, m, name, lineno):
"""
Given a regular expression match from `_EXAMPLE_RE` (`m`),
return a pair `(source, want)`, where `source` is the matched
example's source code (with prompts and indentation stripped);
and `want` is the example's expected output (with... | python | Lib/doctest.py | 719 | 761 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,290 | _find_options | def _find_options(self, source, name, lineno):
"""
Return a dictionary containing option overrides extracted from
option directives in the given source string.
`name` is the string's name, and `lineno` is the line number
where the example starts; both are used for error messages... | python | Lib/doctest.py | 773 | 797 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,291 | _min_indent | def _min_indent(self, s):
"Return the minimum indentation of any non-blank line in `s`"
indents = [len(indent) for indent in self._INDENT_RE.findall(s)]
if len(indents) > 0:
return min(indents)
else:
return 0 | python | Lib/doctest.py | 803 | 809 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,292 | _check_prompt_blank | def _check_prompt_blank(self, lines, indent, name, lineno):
"""
Given the lines of a source string (including prompts and
leading indentation), check to make sure that every prompt is
followed by a space character. If any line is not followed by
a space character, then raise Val... | python | Lib/doctest.py | 811 | 823 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,293 | _check_prefix | def _check_prefix(self, lines, prefix, name, lineno):
"""
Check that every line in the given list starts with the given
prefix; if any line does not, then raise a ValueError.
"""
for i, line in enumerate(lines):
if line and not line.startswith(prefix):
... | python | Lib/doctest.py | 825 | 834 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,294 | __init__ | def __init__(self, verbose=False, parser=DocTestParser(),
recurse=True, exclude_empty=True):
"""
Create a new doctest finder.
The optional argument `parser` specifies a class or
function that should be used to create new DocTest objects (or
objects that implemen... | python | Lib/doctest.py | 850 | 870 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,295 | find | def find(self, obj, name=None, module=None, globs=None, extraglobs=None):
"""
Return a list of the DocTests that are defined by the given
object's docstring, or by any of its contained objects'
docstrings.
The optional parameter `module` is the module that contains
the g... | python | Lib/doctest.py | 872 | 972 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,296 | _from_module | def _from_module(self, module, object):
"""
Return true if the given object is defined in the given
module.
"""
if module is None:
return True
elif inspect.getmodule(object) is not None:
return module is inspect.getmodule(object)
elif inspe... | python | Lib/doctest.py | 974 | 1,001 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,297 | _is_routine | def _is_routine(self, obj):
"""
Safely unwrap objects and determine if they are functions.
"""
maybe_routine = obj
try:
maybe_routine = inspect.unwrap(maybe_routine)
except ValueError:
pass
return inspect.isroutine(maybe_routine) | python | Lib/doctest.py | 1,003 | 1,012 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,298 | _find | def _find(self, tests, obj, name, module, source_lines, globs, seen):
"""
Find tests for the given object and any contained objects, and
add them to `tests`.
"""
if self._verbose:
print('Finding tests in %s' % name)
# If we've already processed this object, t... | python | Lib/doctest.py | 1,014 | 1,073 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,299 | _get_test | def _get_test(self, obj, name, module, globs, source_lines):
"""
Return a DocTest for the given object, if it defines a docstring;
otherwise, return None.
"""
# Extract the object's docstring. If it doesn't have one,
# then return None (no test for this object).
... | python | Lib/doctest.py | 1,075 | 1,111 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
15,300 | _find_lineno | def _find_lineno(self, obj, source_lines):
"""
Return a line number of the given object's docstring.
Returns `None` if the given object does not have a docstring.
"""
lineno = None
docstring = getattr(obj, '__doc__', None)
# Find the line number for modules.
... | python | Lib/doctest.py | 1,113 | 1,172 | {
"name": "PublicHealthInformationTechnology/cpython",
"url": "https://github.com/PublicHealthInformationTechnology/cpython.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.