partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
LockType.acquire
Dummy implementation of acquire(). For blocking calls, self.locked_status is automatically set to True and returned appropriately based on value of ``waitflag``. If it is non-blocking, then the value is actually checked and not set if it is already acquired. This is all done s...
third_party/stdlib/dummy_thread.py
def acquire(self, waitflag=None): """Dummy implementation of acquire(). For blocking calls, self.locked_status is automatically set to True and returned appropriately based on value of ``waitflag``. If it is non-blocking, then the value is actually checked and not set if it is ...
def acquire(self, waitflag=None): """Dummy implementation of acquire(). For blocking calls, self.locked_status is automatically set to True and returned appropriately based on value of ``waitflag``. If it is non-blocking, then the value is actually checked and not set if it is ...
[ "Dummy", "implementation", "of", "acquire", "()", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/dummy_thread.py#L95-L114
[ "def", "acquire", "(", "self", ",", "waitflag", "=", "None", ")", ":", "if", "waitflag", "is", "None", "or", "waitflag", ":", "self", ".", "locked_status", "=", "True", "return", "True", "else", ":", "if", "not", "self", ".", "locked_status", ":", "sel...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
round_to_nearest
Python 3 style round: round a float x to the nearest int, but unlike the builtin Python 2.x round function: - return an int, not a float - do round-half-to-even, not round-half-away-from-zero. We assume that x is finite and nonnegative; except wrong results if you use this for negative x.
third_party/pypy/_struct.py
def round_to_nearest(x): """Python 3 style round: round a float x to the nearest int, but unlike the builtin Python 2.x round function: - return an int, not a float - do round-half-to-even, not round-half-away-from-zero. We assume that x is finite and nonnegative; except wrong results if you use this...
def round_to_nearest(x): """Python 3 style round: round a float x to the nearest int, but unlike the builtin Python 2.x round function: - return an int, not a float - do round-half-to-even, not round-half-away-from-zero. We assume that x is finite and nonnegative; except wrong results if you use this...
[ "Python", "3", "style", "round", ":", "round", "a", "float", "x", "to", "the", "nearest", "int", "but", "unlike", "the", "builtin", "Python", "2", ".", "x", "round", "function", ":" ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/_struct.py#L144-L159
[ "def", "round_to_nearest", "(", "x", ")", ":", "int_part", "=", "int", "(", "x", ")", "frac_part", "=", "x", "-", "int_part", "if", "frac_part", ">", "0.5", "or", "frac_part", "==", "0.5", "and", "int_part", "&", "1", "==", "1", ":", "int_part", "+="...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
float_unpack
Convert a 32-bit or 64-bit integer created by float_pack into a Python float.
third_party/pypy/_struct.py
def float_unpack(Q, size, le): """Convert a 32-bit or 64-bit integer created by float_pack into a Python float.""" if size == 8: MIN_EXP = -1021 # = sys.float_info.min_exp MAX_EXP = 1024 # = sys.float_info.max_exp MANT_DIG = 53 # = sys.float_info.mant_dig BITS = 64 elif size == 4: MIN...
def float_unpack(Q, size, le): """Convert a 32-bit or 64-bit integer created by float_pack into a Python float.""" if size == 8: MIN_EXP = -1021 # = sys.float_info.min_exp MAX_EXP = 1024 # = sys.float_info.max_exp MANT_DIG = 53 # = sys.float_info.mant_dig BITS = 64 elif size == 4: MIN...
[ "Convert", "a", "32", "-", "bit", "or", "64", "-", "bit", "integer", "created", "by", "float_pack", "into", "a", "Python", "float", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/_struct.py#L162-L197
[ "def", "float_unpack", "(", "Q", ",", "size", ",", "le", ")", ":", "if", "size", "==", "8", ":", "MIN_EXP", "=", "-", "1021", "# = sys.float_info.min_exp", "MAX_EXP", "=", "1024", "# = sys.float_info.max_exp", "MANT_DIG", "=", "53", "# = sys.float_info.mant_dig"...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
float_pack
Convert a Python float x into a 64-bit unsigned integer with the same byte representation.
third_party/pypy/_struct.py
def float_pack(x, size): """Convert a Python float x into a 64-bit unsigned integer with the same byte representation.""" if size == 8: MIN_EXP = -1021 # = sys.float_info.min_exp MAX_EXP = 1024 # = sys.float_info.max_exp MANT_DIG = 53 # = sys.float_info.mant_dig BITS = 64 elif size == 4: ...
def float_pack(x, size): """Convert a Python float x into a 64-bit unsigned integer with the same byte representation.""" if size == 8: MIN_EXP = -1021 # = sys.float_info.min_exp MAX_EXP = 1024 # = sys.float_info.max_exp MANT_DIG = 53 # = sys.float_info.mant_dig BITS = 64 elif size == 4: ...
[ "Convert", "a", "Python", "float", "x", "into", "a", "64", "-", "bit", "unsigned", "integer", "with", "the", "same", "byte", "representation", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/_struct.py#L200-L257
[ "def", "float_pack", "(", "x", ",", "size", ")", ":", "if", "size", "==", "8", ":", "MIN_EXP", "=", "-", "1021", "# = sys.float_info.min_exp", "MAX_EXP", "=", "1024", "# = sys.float_info.max_exp", "MANT_DIG", "=", "53", "# = sys.float_info.mant_dig", "BITS", "="...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
calcsize
calcsize(fmt) -> int Return size of C struct described by format string fmt. See struct.__doc__ for more on format strings.
third_party/pypy/_struct.py
def calcsize(fmt): """calcsize(fmt) -> int Return size of C struct described by format string fmt. See struct.__doc__ for more on format strings.""" formatdef, endianness, i = getmode(fmt) num = 0 result = 0 while i < len(fmt): num, i = getNum(fmt, i) cur = fmt[i] try: format = formatde...
def calcsize(fmt): """calcsize(fmt) -> int Return size of C struct described by format string fmt. See struct.__doc__ for more on format strings.""" formatdef, endianness, i = getmode(fmt) num = 0 result = 0 while i < len(fmt): num, i = getNum(fmt, i) cur = fmt[i] try: format = formatde...
[ "calcsize", "(", "fmt", ")", "-", ">", "int", "Return", "size", "of", "C", "struct", "described", "by", "format", "string", "fmt", ".", "See", "struct", ".", "__doc__", "for", "more", "on", "format", "strings", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/_struct.py#L310-L331
[ "def", "calcsize", "(", "fmt", ")", ":", "formatdef", ",", "endianness", ",", "i", "=", "getmode", "(", "fmt", ")", "num", "=", "0", "result", "=", "0", "while", "i", "<", "len", "(", "fmt", ")", ":", "num", ",", "i", "=", "getNum", "(", "fmt",...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
pack
pack(fmt, v1, v2, ...) -> string Return string containing values v1, v2, ... packed according to fmt. See struct.__doc__ for more on format strings.
third_party/pypy/_struct.py
def pack(fmt, *args): """pack(fmt, v1, v2, ...) -> string Return string containing values v1, v2, ... packed according to fmt. See struct.__doc__ for more on format strings.""" formatdef, endianness, i = getmode(fmt) args = list(args) n_args = len(args) result = [] while i < len(fmt): num, i =...
def pack(fmt, *args): """pack(fmt, v1, v2, ...) -> string Return string containing values v1, v2, ... packed according to fmt. See struct.__doc__ for more on format strings.""" formatdef, endianness, i = getmode(fmt) args = list(args) n_args = len(args) result = [] while i < len(fmt): num, i =...
[ "pack", "(", "fmt", "v1", "v2", "...", ")", "-", ">", "string", "Return", "string", "containing", "values", "v1", "v2", "...", "packed", "according", "to", "fmt", ".", "See", "struct", ".", "__doc__", "for", "more", "on", "format", "strings", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/_struct.py#L334-L390
[ "def", "pack", "(", "fmt", ",", "*", "args", ")", ":", "formatdef", ",", "endianness", ",", "i", "=", "getmode", "(", "fmt", ")", "args", "=", "list", "(", "args", ")", "n_args", "=", "len", "(", "args", ")", "result", "=", "[", "]", "while", "...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
unpack
unpack(fmt, string) -> (v1, v2, ...) Unpack the string, containing packed C structure data, according to fmt. Requires len(string)==calcsize(fmt). See struct.__doc__ for more on format strings.
third_party/pypy/_struct.py
def unpack(fmt, data): """unpack(fmt, string) -> (v1, v2, ...) Unpack the string, containing packed C structure data, according to fmt. Requires len(string)==calcsize(fmt). See struct.__doc__ for more on format strings.""" formatdef, endianness, i = getmode(fmt) j = 0 num = 0 result = [] len...
def unpack(fmt, data): """unpack(fmt, string) -> (v1, v2, ...) Unpack the string, containing packed C structure data, according to fmt. Requires len(string)==calcsize(fmt). See struct.__doc__ for more on format strings.""" formatdef, endianness, i = getmode(fmt) j = 0 num = 0 result = [] len...
[ "unpack", "(", "fmt", "string", ")", "-", ">", "(", "v1", "v2", "...", ")", "Unpack", "the", "string", "containing", "packed", "C", "structure", "data", "according", "to", "fmt", ".", "Requires", "len", "(", "string", ")", "==", "calcsize", "(", "fmt",...
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/_struct.py#L393-L433
[ "def", "unpack", "(", "fmt", ",", "data", ")", ":", "formatdef", ",", "endianness", ",", "i", "=", "getmode", "(", "fmt", ")", "j", "=", "0", "num", "=", "0", "result", "=", "[", "]", "length", "=", "calcsize", "(", "fmt", ")", "if", "length", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
Diagnostic.render
Returns the human-readable location of the diagnostic in the source, the formatted message, the source line corresponding to ``location`` and a line emphasizing the problematic locations in the source line using ASCII art, as a list of lines. Appends the result of calling :meth:`render` ...
third_party/pythonparser/diagnostic.py
def render(self, only_line=False, colored=False): """ Returns the human-readable location of the diagnostic in the source, the formatted message, the source line corresponding to ``location`` and a line emphasizing the problematic locations in the source line using ASCII art, as ...
def render(self, only_line=False, colored=False): """ Returns the human-readable location of the diagnostic in the source, the formatted message, the source line corresponding to ``location`` and a line emphasizing the problematic locations in the source line using ASCII art, as ...
[ "Returns", "the", "human", "-", "readable", "location", "of", "the", "diagnostic", "in", "the", "source", "the", "formatted", "message", "the", "source", "line", "corresponding", "to", "location", "and", "a", "line", "emphasizing", "the", "problematic", "locatio...
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pythonparser/diagnostic.py#L66-L129
[ "def", "render", "(", "self", ",", "only_line", "=", "False", ",", "colored", "=", "False", ")", ":", "source_line", "=", "self", ".", "location", ".", "source_line", "(", ")", ".", "rstrip", "(", "\"\\n\"", ")", "highlight_line", "=", "bytearray", "(", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
Engine.process
The default implementation of :meth:`process` renders non-fatal diagnostics to ``sys.stderr``, and raises fatal ones as a :class:`Error`.
third_party/pythonparser/diagnostic.py
def process(self, diagnostic): """ The default implementation of :meth:`process` renders non-fatal diagnostics to ``sys.stderr``, and raises fatal ones as a :class:`Error`. """ diagnostic.notes += self._appended_notes self.render_diagnostic(diagnostic) if diagnost...
def process(self, diagnostic): """ The default implementation of :meth:`process` renders non-fatal diagnostics to ``sys.stderr``, and raises fatal ones as a :class:`Error`. """ diagnostic.notes += self._appended_notes self.render_diagnostic(diagnostic) if diagnost...
[ "The", "default", "implementation", "of", ":", "meth", ":", "process", "renders", "non", "-", "fatal", "diagnostics", "to", "sys", ".", "stderr", "and", "raises", "fatal", "ones", "as", "a", ":", "class", ":", "Error", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pythonparser/diagnostic.py#L156-L165
[ "def", "process", "(", "self", ",", "diagnostic", ")", ":", "diagnostic", ".", "notes", "+=", "self", ".", "_appended_notes", "self", ".", "render_diagnostic", "(", "diagnostic", ")", "if", "diagnostic", ".", "level", "==", "\"fatal\"", "or", "(", "self", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
Engine.context
A context manager that appends ``note`` to every diagnostic processed by this engine.
third_party/pythonparser/diagnostic.py
def context(self, *notes): """ A context manager that appends ``note`` to every diagnostic processed by this engine. """ self._appended_notes += notes yield del self._appended_notes[-len(notes):]
def context(self, *notes): """ A context manager that appends ``note`` to every diagnostic processed by this engine. """ self._appended_notes += notes yield del self._appended_notes[-len(notes):]
[ "A", "context", "manager", "that", "appends", "note", "to", "every", "diagnostic", "processed", "by", "this", "engine", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pythonparser/diagnostic.py#L168-L175
[ "def", "context", "(", "self", ",", "*", "notes", ")", ":", "self", ".", "_appended_notes", "+=", "notes", "yield", "del", "self", ".", "_appended_notes", "[", "-", "len", "(", "notes", ")", ":", "]" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
decode
Decode common content-transfer-encodings (base64, quopri, uuencode).
third_party/stdlib/mimetools.py
def decode(input, output, encoding): """Decode common content-transfer-encodings (base64, quopri, uuencode).""" if encoding == 'base64': import base64 return base64.decode(input, output) if encoding == 'quoted-printable': import quopri return quopri.decode(input, output) ...
def decode(input, output, encoding): """Decode common content-transfer-encodings (base64, quopri, uuencode).""" if encoding == 'base64': import base64 return base64.decode(input, output) if encoding == 'quoted-printable': import quopri return quopri.decode(input, output) ...
[ "Decode", "common", "content", "-", "transfer", "-", "encodings", "(", "base64", "quopri", "uuencode", ")", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/mimetools.py#L157-L174
[ "def", "decode", "(", "input", ",", "output", ",", "encoding", ")", ":", "if", "encoding", "==", "'base64'", ":", "import", "base64", "return", "base64", ".", "decode", "(", "input", ",", "output", ")", "if", "encoding", "==", "'quoted-printable'", ":", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
encode
Encode common content-transfer-encodings (base64, quopri, uuencode).
third_party/stdlib/mimetools.py
def encode(input, output, encoding): """Encode common content-transfer-encodings (base64, quopri, uuencode).""" if encoding == 'base64': import base64 return base64.encode(input, output) if encoding == 'quoted-printable': import quopri return quopri.encode(input, output, 0) ...
def encode(input, output, encoding): """Encode common content-transfer-encodings (base64, quopri, uuencode).""" if encoding == 'base64': import base64 return base64.encode(input, output) if encoding == 'quoted-printable': import quopri return quopri.encode(input, output, 0) ...
[ "Encode", "common", "content", "-", "transfer", "-", "encodings", "(", "base64", "quopri", "uuencode", ")", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/mimetools.py#L176-L193
[ "def", "encode", "(", "input", ",", "output", ",", "encoding", ")", ":", "if", "encoding", "==", "'base64'", ":", "import", "base64", "return", "base64", ".", "encode", "(", "input", ",", "output", ")", "if", "encoding", "==", "'quoted-printable'", ":", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
print_list
Print the list of tuples as returned by extract_tb() or extract_stack() as a formatted stack trace to the given file.
third_party/stdlib/traceback.py
def print_list(extracted_list, file=None): """Print the list of tuples as returned by extract_tb() or extract_stack() as a formatted stack trace to the given file.""" if file is None: file = sys.stderr for filename, lineno, name, line in extracted_list: _print(file, ' Fil...
def print_list(extracted_list, file=None): """Print the list of tuples as returned by extract_tb() or extract_stack() as a formatted stack trace to the given file.""" if file is None: file = sys.stderr for filename, lineno, name, line in extracted_list: _print(file, ' Fil...
[ "Print", "the", "list", "of", "tuples", "as", "returned", "by", "extract_tb", "()", "or", "extract_stack", "()", "as", "a", "formatted", "stack", "trace", "to", "the", "given", "file", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/traceback.py#L16-L25
[ "def", "print_list", "(", "extracted_list", ",", "file", "=", "None", ")", ":", "if", "file", "is", "None", ":", "file", "=", "sys", ".", "stderr", "for", "filename", ",", "lineno", ",", "name", ",", "line", "in", "extracted_list", ":", "_print", "(", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
format_list
Format a list of traceback entry tuples for printing. Given a list of tuples as returned by extract_tb() or extract_stack(), return a list of strings ready for printing. Each string in the resulting list corresponds to the item with the same index in the argument list. Each string ends in a newline; ...
third_party/stdlib/traceback.py
def format_list(extracted_list): """Format a list of traceback entry tuples for printing. Given a list of tuples as returned by extract_tb() or extract_stack(), return a list of strings ready for printing. Each string in the resulting list corresponds to the item with the same index in the argument...
def format_list(extracted_list): """Format a list of traceback entry tuples for printing. Given a list of tuples as returned by extract_tb() or extract_stack(), return a list of strings ready for printing. Each string in the resulting list corresponds to the item with the same index in the argument...
[ "Format", "a", "list", "of", "traceback", "entry", "tuples", "for", "printing", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/traceback.py#L27-L43
[ "def", "format_list", "(", "extracted_list", ")", ":", "list", "=", "[", "]", "for", "filename", ",", "lineno", ",", "name", ",", "line", "in", "extracted_list", ":", "item", "=", "' File \"%s\", line %d, in %s\\n'", "%", "(", "filename", ",", "lineno", ","...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
print_tb
Print up to 'limit' stack trace entries from the traceback 'tb'. If 'limit' is omitted or None, all entries are printed. If 'file' is omitted or None, the output goes to sys.stderr; otherwise 'file' should be an open file or file-like object with a write() method.
third_party/stdlib/traceback.py
def print_tb(tb, limit=None, file=None): """Print up to 'limit' stack trace entries from the traceback 'tb'. If 'limit' is omitted or None, all entries are printed. If 'file' is omitted or None, the output goes to sys.stderr; otherwise 'file' should be an open file or file-like object with a write() ...
def print_tb(tb, limit=None, file=None): """Print up to 'limit' stack trace entries from the traceback 'tb'. If 'limit' is omitted or None, all entries are printed. If 'file' is omitted or None, the output goes to sys.stderr; otherwise 'file' should be an open file or file-like object with a write() ...
[ "Print", "up", "to", "limit", "stack", "trace", "entries", "from", "the", "traceback", "tb", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/traceback.py#L46-L72
[ "def", "print_tb", "(", "tb", ",", "limit", "=", "None", ",", "file", "=", "None", ")", ":", "if", "file", "is", "None", ":", "file", "=", "sys", ".", "stderr", "if", "limit", "is", "None", ":", "if", "hasattr", "(", "sys", ",", "'tracebacklimit'",...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
print_exception
Print exception up to 'limit' stack trace entries from 'tb' to 'file'. This differs from print_tb() in the following ways: (1) if traceback is not None, it prints a header "Traceback (most recent call last):"; (2) it prints the exception type and value after the stack trace; (3) if type is SyntaxError ...
third_party/stdlib/traceback.py
def print_exception(etype, value, tb, limit=None, file=None): """Print exception up to 'limit' stack trace entries from 'tb' to 'file'. This differs from print_tb() in the following ways: (1) if traceback is not None, it prints a header "Traceback (most recent call last):"; (2) it prints the exception ...
def print_exception(etype, value, tb, limit=None, file=None): """Print exception up to 'limit' stack trace entries from 'tb' to 'file'. This differs from print_tb() in the following ways: (1) if traceback is not None, it prints a header "Traceback (most recent call last):"; (2) it prints the exception ...
[ "Print", "exception", "up", "to", "limit", "stack", "trace", "entries", "from", "tb", "to", "file", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/traceback.py#L110-L130
[ "def", "print_exception", "(", "etype", ",", "value", ",", "tb", ",", "limit", "=", "None", ",", "file", "=", "None", ")", ":", "if", "file", "is", "None", ":", "# TODO: Use sys.stderr when that's implemented.", "file", "=", "open", "(", "'/dev/stderr'", ","...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
format_exception
Format a stack trace and the exception information. The arguments have the same meaning as the corresponding arguments to print_exception(). The return value is a list of strings, each ending in a newline and some containing internal newlines. When these lines are concatenated and printed, exactly th...
third_party/stdlib/traceback.py
def format_exception(etype, value, tb, limit = None): """Format a stack trace and the exception information. The arguments have the same meaning as the corresponding arguments to print_exception(). The return value is a list of strings, each ending in a newline and some containing internal newlines. ...
def format_exception(etype, value, tb, limit = None): """Format a stack trace and the exception information. The arguments have the same meaning as the corresponding arguments to print_exception(). The return value is a list of strings, each ending in a newline and some containing internal newlines. ...
[ "Format", "a", "stack", "trace", "and", "the", "exception", "information", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/traceback.py#L132-L147
[ "def", "format_exception", "(", "etype", ",", "value", ",", "tb", ",", "limit", "=", "None", ")", ":", "if", "tb", ":", "list", "=", "[", "'Traceback (most recent call last):\\n'", "]", "list", "=", "list", "+", "format_tb", "(", "tb", ",", "limit", ")",...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
format_exception_only
Format the exception part of a traceback. The arguments are the exception type and value such as given by sys.last_type and sys.last_value. The return value is a list of strings, each ending in a newline. Normally, the list contains a single string; however, for SyntaxError exceptions, it contains...
third_party/stdlib/traceback.py
def format_exception_only(etype, value): """Format the exception part of a traceback. The arguments are the exception type and value such as given by sys.last_type and sys.last_value. The return value is a list of strings, each ending in a newline. Normally, the list contains a single string; howe...
def format_exception_only(etype, value): """Format the exception part of a traceback. The arguments are the exception type and value such as given by sys.last_type and sys.last_value. The return value is a list of strings, each ending in a newline. Normally, the list contains a single string; howe...
[ "Format", "the", "exception", "part", "of", "a", "traceback", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/traceback.py#L149-L203
[ "def", "format_exception_only", "(", "etype", ",", "value", ")", ":", "# An instance should not have a meaningful value parameter, but", "# sometimes does, particularly for string exceptions, such as", "# >>> raise string1, string2 # deprecated", "#", "# Clear these out first because issubt...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
_format_final_exc_line
Return a list of a single line -- normal case for format_exception_only
third_party/stdlib/traceback.py
def _format_final_exc_line(etype, value): """Return a list of a single line -- normal case for format_exception_only""" valuestr = _some_str(value) if value is None or not valuestr: line = "%s\n" % etype else: line = "%s: %s\n" % (etype, valuestr) return line
def _format_final_exc_line(etype, value): """Return a list of a single line -- normal case for format_exception_only""" valuestr = _some_str(value) if value is None or not valuestr: line = "%s\n" % etype else: line = "%s: %s\n" % (etype, valuestr) return line
[ "Return", "a", "list", "of", "a", "single", "line", "--", "normal", "case", "for", "format_exception_only" ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/traceback.py#L205-L212
[ "def", "_format_final_exc_line", "(", "etype", ",", "value", ")", ":", "valuestr", "=", "_some_str", "(", "value", ")", "if", "value", "is", "None", "or", "not", "valuestr", ":", "line", "=", "\"%s\\n\"", "%", "etype", "else", ":", "line", "=", "\"%s: %s...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
print_exc
Shorthand for 'print_exception(sys.exc_type, sys.exc_value, sys.exc_traceback, limit, file)'. (In fact, it uses sys.exc_info() to retrieve the same information in a thread-safe way.)
third_party/stdlib/traceback.py
def print_exc(limit=None, file=None): """Shorthand for 'print_exception(sys.exc_type, sys.exc_value, sys.exc_traceback, limit, file)'. (In fact, it uses sys.exc_info() to retrieve the same information in a thread-safe way.)""" if file is None: # TODO: Use sys.stderr when that's implemented. ...
def print_exc(limit=None, file=None): """Shorthand for 'print_exception(sys.exc_type, sys.exc_value, sys.exc_traceback, limit, file)'. (In fact, it uses sys.exc_info() to retrieve the same information in a thread-safe way.)""" if file is None: # TODO: Use sys.stderr when that's implemented. ...
[ "Shorthand", "for", "print_exception", "(", "sys", ".", "exc_type", "sys", ".", "exc_value", "sys", ".", "exc_traceback", "limit", "file", ")", ".", "(", "In", "fact", "it", "uses", "sys", ".", "exc_info", "()", "to", "retrieve", "the", "same", "informatio...
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/traceback.py#L227-L239
[ "def", "print_exc", "(", "limit", "=", "None", ",", "file", "=", "None", ")", ":", "if", "file", "is", "None", ":", "# TODO: Use sys.stderr when that's implemented.", "file", "=", "open", "(", "'/dev/stderr'", ",", "'w'", ")", "#file = sys.stderr", "try", ":",...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
print_last
This is a shorthand for 'print_exception(sys.last_type, sys.last_value, sys.last_traceback, limit, file)'.
third_party/stdlib/traceback.py
def print_last(limit=None, file=None): """This is a shorthand for 'print_exception(sys.last_type, sys.last_value, sys.last_traceback, limit, file)'.""" if not hasattr(sys, "last_type"): raise ValueError("no last exception") if file is None: file = sys.stderr print_exception(sys.last_...
def print_last(limit=None, file=None): """This is a shorthand for 'print_exception(sys.last_type, sys.last_value, sys.last_traceback, limit, file)'.""" if not hasattr(sys, "last_type"): raise ValueError("no last exception") if file is None: file = sys.stderr print_exception(sys.last_...
[ "This", "is", "a", "shorthand", "for", "print_exception", "(", "sys", ".", "last_type", "sys", ".", "last_value", "sys", ".", "last_traceback", "limit", "file", ")", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/traceback.py#L251-L259
[ "def", "print_last", "(", "limit", "=", "None", ",", "file", "=", "None", ")", ":", "if", "not", "hasattr", "(", "sys", ",", "\"last_type\"", ")", ":", "raise", "ValueError", "(", "\"no last exception\"", ")", "if", "file", "is", "None", ":", "file", "...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
print_stack
Print a stack trace from its invocation point. The optional 'f' argument can be used to specify an alternate stack frame at which to start. The optional 'limit' and 'file' arguments have the same meaning as for print_exception().
third_party/stdlib/traceback.py
def print_stack(f=None, limit=None, file=None): """Print a stack trace from its invocation point. The optional 'f' argument can be used to specify an alternate stack frame at which to start. The optional 'limit' and 'file' arguments have the same meaning as for print_exception(). """ if f is No...
def print_stack(f=None, limit=None, file=None): """Print a stack trace from its invocation point. The optional 'f' argument can be used to specify an alternate stack frame at which to start. The optional 'limit' and 'file' arguments have the same meaning as for print_exception(). """ if f is No...
[ "Print", "a", "stack", "trace", "from", "its", "invocation", "point", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/traceback.py#L262-L274
[ "def", "print_stack", "(", "f", "=", "None", ",", "limit", "=", "None", ",", "file", "=", "None", ")", ":", "if", "f", "is", "None", ":", "try", ":", "raise", "ZeroDivisionError", "except", "ZeroDivisionError", ":", "f", "=", "sys", ".", "exc_info", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
format_stack
Shorthand for 'format_list(extract_stack(f, limit))'.
third_party/stdlib/traceback.py
def format_stack(f=None, limit=None): """Shorthand for 'format_list(extract_stack(f, limit))'.""" if f is None: try: raise ZeroDivisionError except ZeroDivisionError: f = sys.exc_info()[2].tb_frame.f_back return format_list(extract_stack(f, limit))
def format_stack(f=None, limit=None): """Shorthand for 'format_list(extract_stack(f, limit))'.""" if f is None: try: raise ZeroDivisionError except ZeroDivisionError: f = sys.exc_info()[2].tb_frame.f_back return format_list(extract_stack(f, limit))
[ "Shorthand", "for", "format_list", "(", "extract_stack", "(", "f", "limit", "))", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/traceback.py#L276-L283
[ "def", "format_stack", "(", "f", "=", "None", ",", "limit", "=", "None", ")", ":", "if", "f", "is", "None", ":", "try", ":", "raise", "ZeroDivisionError", "except", "ZeroDivisionError", ":", "f", "=", "sys", ".", "exc_info", "(", ")", "[", "2", "]", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
extract_stack
Extract the raw traceback from the current stack frame. The return value has the same format as for extract_tb(). The optional 'f' and 'limit' arguments have the same meaning as for print_stack(). Each item in the list is a quadruple (filename, line number, function name, text), and the entries are i...
third_party/stdlib/traceback.py
def extract_stack(f=None, limit = None): """Extract the raw traceback from the current stack frame. The return value has the same format as for extract_tb(). The optional 'f' and 'limit' arguments have the same meaning as for print_stack(). Each item in the list is a quadruple (filename, line num...
def extract_stack(f=None, limit = None): """Extract the raw traceback from the current stack frame. The return value has the same format as for extract_tb(). The optional 'f' and 'limit' arguments have the same meaning as for print_stack(). Each item in the list is a quadruple (filename, line num...
[ "Extract", "the", "raw", "traceback", "from", "the", "current", "stack", "frame", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/traceback.py#L285-L317
[ "def", "extract_stack", "(", "f", "=", "None", ",", "limit", "=", "None", ")", ":", "if", "f", "is", "None", ":", "try", ":", "raise", "ZeroDivisionError", "except", "ZeroDivisionError", ":", "f", "=", "sys", ".", "exc_info", "(", ")", "[", "2", "]",...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
Random.seed
Initialize internal state of the random number generator. None or no argument seeds from current time or from an operating system specific randomness source if available. If a is not None or is an int or long, hash(a) is used instead. Hash values for some types are nondeterministic whe...
third_party/stdlib/random.py
def seed(self, a=None): """Initialize internal state of the random number generator. None or no argument seeds from current time or from an operating system specific randomness source if available. If a is not None or is an int or long, hash(a) is used instead. Hash values for ...
def seed(self, a=None): """Initialize internal state of the random number generator. None or no argument seeds from current time or from an operating system specific randomness source if available. If a is not None or is an int or long, hash(a) is used instead. Hash values for ...
[ "Initialize", "internal", "state", "of", "the", "random", "number", "generator", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/random.py#L98-L110
[ "def", "seed", "(", "self", ",", "a", "=", "None", ")", ":", "super", "(", "Random", ",", "self", ")", ".", "seed", "(", "a", ")", "self", ".", "gauss_next", "=", "None" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
Random.randrange
Choose a random item from range(start, stop[, step]). This fixes the problem with randint() which includes the endpoint; in Python this is usually not what you want.
third_party/stdlib/random.py
def randrange(self, start, stop=None, step=1, _int=int, _maxwidth=1L<<BPF): """Choose a random item from range(start, stop[, step]). This fixes the problem with randint() which includes the endpoint; in Python this is usually not what you want. """ # This code is a bit messy t...
def randrange(self, start, stop=None, step=1, _int=int, _maxwidth=1L<<BPF): """Choose a random item from range(start, stop[, step]). This fixes the problem with randint() which includes the endpoint; in Python this is usually not what you want. """ # This code is a bit messy t...
[ "Choose", "a", "random", "item", "from", "range", "(", "start", "stop", "[", "step", "]", ")", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/random.py#L117-L178
[ "def", "randrange", "(", "self", ",", "start", ",", "stop", "=", "None", ",", "step", "=", "1", ",", "_int", "=", "int", ",", "_maxwidth", "=", "1L", "<<", "BPF", ")", ":", "# This code is a bit messy to make it fast for the", "# common case while still doing ad...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
Random.shuffle
x, random=random.random -> shuffle list x in place; return None. Optional arg random is a 0-argument function returning a random float in [0.0, 1.0); by default, the standard random.random.
third_party/stdlib/random.py
def shuffle(self, x, random=None): """x, random=random.random -> shuffle list x in place; return None. Optional arg random is a 0-argument function returning a random float in [0.0, 1.0); by default, the standard random.random. """ if random is None: random = self....
def shuffle(self, x, random=None): """x, random=random.random -> shuffle list x in place; return None. Optional arg random is a 0-argument function returning a random float in [0.0, 1.0); by default, the standard random.random. """ if random is None: random = self....
[ "x", "random", "=", "random", ".", "random", "-", ">", "shuffle", "list", "x", "in", "place", ";", "return", "None", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/random.py#L192-L206
[ "def", "shuffle", "(", "self", ",", "x", ",", "random", "=", "None", ")", ":", "if", "random", "is", "None", ":", "random", "=", "self", ".", "random", "_int", "=", "int", "for", "i", "in", "reversed", "(", "xrange", "(", "1", ",", "len", "(", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
_slotnames
Return a list of slot names for a given class. This needs to find slots defined by the class and its bases, so we can't simply return the __slots__ attribute. We must walk down the Method Resolution Order and concatenate the __slots__ of each class found there. (This assumes classes don't modify thei...
third_party/stdlib/copy_reg.py
def _slotnames(cls): """Return a list of slot names for a given class. This needs to find slots defined by the class and its bases, so we can't simply return the __slots__ attribute. We must walk down the Method Resolution Order and concatenate the __slots__ of each class found there. (This assum...
def _slotnames(cls): """Return a list of slot names for a given class. This needs to find slots defined by the class and its bases, so we can't simply return the __slots__ attribute. We must walk down the Method Resolution Order and concatenate the __slots__ of each class found there. (This assum...
[ "Return", "a", "list", "of", "slot", "names", "for", "a", "given", "class", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/copy_reg.py#L95-L140
[ "def", "_slotnames", "(", "cls", ")", ":", "# Get the value from a cache in the class if possible", "names", "=", "cls", ".", "__dict__", ".", "get", "(", "\"__slotnames__\"", ")", "if", "names", "is", "not", "None", ":", "return", "names", "# Not cached -- calculat...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
add_extension
Register an extension code.
third_party/stdlib/copy_reg.py
def add_extension(module, name, code): """Register an extension code.""" code = int(code) if not 1 <= code <= 0x7fffffff: raise ValueError, "code out of range" key = (module, name) if (_extension_registry.get(key) == code and _inverted_registry.get(code) == key): return # Red...
def add_extension(module, name, code): """Register an extension code.""" code = int(code) if not 1 <= code <= 0x7fffffff: raise ValueError, "code out of range" key = (module, name) if (_extension_registry.get(key) == code and _inverted_registry.get(code) == key): return # Red...
[ "Register", "an", "extension", "code", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/copy_reg.py#L157-L173
[ "def", "add_extension", "(", "module", ",", "name", ",", "code", ")", ":", "code", "=", "int", "(", "code", ")", "if", "not", "1", "<=", "code", "<=", "0x7fffffff", ":", "raise", "ValueError", ",", "\"code out of range\"", "key", "=", "(", "module", ",...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
remove_extension
Unregister an extension code. For testing only.
third_party/stdlib/copy_reg.py
def remove_extension(module, name, code): """Unregister an extension code. For testing only.""" key = (module, name) if (_extension_registry.get(key) != code or _inverted_registry.get(code) != key): raise ValueError("key %s is not registered with code %s" % (key, co...
def remove_extension(module, name, code): """Unregister an extension code. For testing only.""" key = (module, name) if (_extension_registry.get(key) != code or _inverted_registry.get(code) != key): raise ValueError("key %s is not registered with code %s" % (key, co...
[ "Unregister", "an", "extension", "code", ".", "For", "testing", "only", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/copy_reg.py#L175-L185
[ "def", "remove_extension", "(", "module", ",", "name", ",", "code", ")", ":", "key", "=", "(", "module", ",", "name", ")", "if", "(", "_extension_registry", ".", "get", "(", "key", ")", "!=", "code", "or", "_inverted_registry", ".", "get", "(", "code",...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
update_wrapper
Update a wrapper function to look like the wrapped function wrapper is the function to be updated wrapped is the original function assigned is a tuple naming the attributes assigned directly from the wrapped function to the wrapper function (defaults to functools.WRAPPER_ASSIGNMENTS)...
third_party/stdlib/functools.py
def update_wrapper(wrapper, wrapped, assigned = WRAPPER_ASSIGNMENTS, updated = WRAPPER_UPDATES): """Update a wrapper function to look like the wrapped function wrapper is the function to be updated wrapped is the original function assign...
def update_wrapper(wrapper, wrapped, assigned = WRAPPER_ASSIGNMENTS, updated = WRAPPER_UPDATES): """Update a wrapper function to look like the wrapped function wrapper is the function to be updated wrapped is the original function assign...
[ "Update", "a", "wrapper", "function", "to", "look", "like", "the", "wrapped", "function" ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/functools.py#L23-L43
[ "def", "update_wrapper", "(", "wrapper", ",", "wrapped", ",", "assigned", "=", "WRAPPER_ASSIGNMENTS", ",", "updated", "=", "WRAPPER_UPDATES", ")", ":", "for", "attr", "in", "assigned", ":", "setattr", "(", "wrapper", ",", "attr", ",", "getattr", "(", "wrappe...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
wraps
Decorator factory to apply update_wrapper() to a wrapper function Returns a decorator that invokes update_wrapper() with the decorated function as the wrapper argument and the arguments to wraps() as the remaining arguments. Default arguments are as for update_wrapper(). This is a convenien...
third_party/stdlib/functools.py
def wraps(wrapped, assigned = WRAPPER_ASSIGNMENTS, updated = WRAPPER_UPDATES): """Decorator factory to apply update_wrapper() to a wrapper function Returns a decorator that invokes update_wrapper() with the decorated function as the wrapper argument and the arguments to wraps() as...
def wraps(wrapped, assigned = WRAPPER_ASSIGNMENTS, updated = WRAPPER_UPDATES): """Decorator factory to apply update_wrapper() to a wrapper function Returns a decorator that invokes update_wrapper() with the decorated function as the wrapper argument and the arguments to wraps() as...
[ "Decorator", "factory", "to", "apply", "update_wrapper", "()", "to", "a", "wrapper", "function" ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/functools.py#L45-L57
[ "def", "wraps", "(", "wrapped", ",", "assigned", "=", "WRAPPER_ASSIGNMENTS", ",", "updated", "=", "WRAPPER_UPDATES", ")", ":", "return", "partial", "(", "update_wrapper", ",", "wrapped", "=", "wrapped", ",", "assigned", "=", "assigned", ",", "updated", "=", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
cmp_to_key
Convert a cmp= function into a key= function
third_party/stdlib/functools.py
def cmp_to_key(mycmp): """Convert a cmp= function into a key= function""" class K(object): __slots__ = ['obj'] def __init__(self, obj, *args): self.obj = obj def __lt__(self, other): return mycmp(self.obj, other.obj) < 0 def __gt__(self, other): ...
def cmp_to_key(mycmp): """Convert a cmp= function into a key= function""" class K(object): __slots__ = ['obj'] def __init__(self, obj, *args): self.obj = obj def __lt__(self, other): return mycmp(self.obj, other.obj) < 0 def __gt__(self, other): ...
[ "Convert", "a", "cmp", "=", "function", "into", "a", "key", "=", "function" ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/functools.py#L86-L106
[ "def", "cmp_to_key", "(", "mycmp", ")", ":", "class", "K", "(", "object", ")", ":", "__slots__", "=", "[", "'obj'", "]", "def", "__init__", "(", "self", ",", "obj", ",", "*", "args", ")", ":", "self", ".", "obj", "=", "obj", "def", "__lt__", "(",...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
unquote
Remove quotes from a string.
third_party/stdlib/rfc822.py
def unquote(s): """Remove quotes from a string.""" if len(s) > 1: if s.startswith('"') and s.endswith('"'): return s[1:-1].replace('\\\\', '\\').replace('\\"', '"') if s.startswith('<') and s.endswith('>'): return s[1:-1] return s
def unquote(s): """Remove quotes from a string.""" if len(s) > 1: if s.startswith('"') and s.endswith('"'): return s[1:-1].replace('\\\\', '\\').replace('\\"', '"') if s.startswith('<') and s.endswith('>'): return s[1:-1] return s
[ "Remove", "quotes", "from", "a", "string", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L477-L484
[ "def", "unquote", "(", "s", ")", ":", "if", "len", "(", "s", ")", ">", "1", ":", "if", "s", ".", "startswith", "(", "'\"'", ")", "and", "s", ".", "endswith", "(", "'\"'", ")", ":", "return", "s", "[", "1", ":", "-", "1", "]", ".", "replace"...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
parseaddr
Parse an address into a (realname, mailaddr) tuple.
third_party/stdlib/rfc822.py
def parseaddr(address): """Parse an address into a (realname, mailaddr) tuple.""" a = AddressList(address) lst = a.addresslist if not lst: return (None, None) return lst[0]
def parseaddr(address): """Parse an address into a (realname, mailaddr) tuple.""" a = AddressList(address) lst = a.addresslist if not lst: return (None, None) return lst[0]
[ "Parse", "an", "address", "into", "a", "(", "realname", "mailaddr", ")", "tuple", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L492-L498
[ "def", "parseaddr", "(", "address", ")", ":", "a", "=", "AddressList", "(", "address", ")", "lst", "=", "a", ".", "addresslist", "if", "not", "lst", ":", "return", "(", "None", ",", "None", ")", "return", "lst", "[", "0", "]" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
mktime_tz
Turn a 10-tuple as returned by parsedate_tz() into a UTC timestamp.
third_party/stdlib/rfc822.py
def mktime_tz(data): """Turn a 10-tuple as returned by parsedate_tz() into a UTC timestamp.""" if data[9] is None: # No zone info, so localtime is better assumption than GMT return time.mktime(data[:8] + (-1,)) else: t = time.mktime(data[:8] + (0,)) return t - data[9] - time....
def mktime_tz(data): """Turn a 10-tuple as returned by parsedate_tz() into a UTC timestamp.""" if data[9] is None: # No zone info, so localtime is better assumption than GMT return time.mktime(data[:8] + (-1,)) else: t = time.mktime(data[:8] + (0,)) return t - data[9] - time....
[ "Turn", "a", "10", "-", "tuple", "as", "returned", "by", "parsedate_tz", "()", "into", "a", "UTC", "timestamp", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L948-L955
[ "def", "mktime_tz", "(", "data", ")", ":", "if", "data", "[", "9", "]", "is", "None", ":", "# No zone info, so localtime is better assumption than GMT", "return", "time", ".", "mktime", "(", "data", "[", ":", "8", "]", "+", "(", "-", "1", ",", ")", ")", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
formatdate
Returns time format preferred for Internet standards. Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 According to RFC 1123, day and month names must always be in English. If not for that, this code could use strftime(). It can't because strftime() honors the locale and could generate ...
third_party/stdlib/rfc822.py
def formatdate(timeval=None): """Returns time format preferred for Internet standards. Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 According to RFC 1123, day and month names must always be in English. If not for that, this code could use strftime(). It can't because strftime() ...
def formatdate(timeval=None): """Returns time format preferred for Internet standards. Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 According to RFC 1123, day and month names must always be in English. If not for that, this code could use strftime(). It can't because strftime() ...
[ "Returns", "time", "format", "preferred", "for", "Internet", "standards", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L957-L975
[ "def", "formatdate", "(", "timeval", "=", "None", ")", ":", "if", "timeval", "is", "None", ":", "timeval", "=", "time", ".", "time", "(", ")", "timeval", "=", "time", ".", "gmtime", "(", "timeval", ")", "return", "\"%s, %02d %s %04d %02d:%02d:%02d GMT\"", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
Message.rewindbody
Rewind the file to the start of the body (if seekable).
third_party/stdlib/rfc822.py
def rewindbody(self): """Rewind the file to the start of the body (if seekable).""" if not self.seekable: raise IOError, "unseekable file" self.fp.seek(self.startofbody)
def rewindbody(self): """Rewind the file to the start of the body (if seekable).""" if not self.seekable: raise IOError, "unseekable file" self.fp.seek(self.startofbody)
[ "Rewind", "the", "file", "to", "the", "start", "of", "the", "body", "(", "if", "seekable", ")", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L116-L120
[ "def", "rewindbody", "(", "self", ")", ":", "if", "not", "self", ".", "seekable", ":", "raise", "IOError", ",", "\"unseekable file\"", "self", ".", "fp", ".", "seek", "(", "self", ".", "startofbody", ")" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
Message.readheaders
Read header lines. Read header lines up to the entirely blank line that terminates them. The (normally blank) line that ends the headers is skipped, but not included in the returned list. If a non-header line ends the headers, (which is an error), an attempt is made to backspace over i...
third_party/stdlib/rfc822.py
def readheaders(self): """Read header lines. Read header lines up to the entirely blank line that terminates them. The (normally blank) line that ends the headers is skipped, but not included in the returned list. If a non-header line ends the headers, (which is an error), an a...
def readheaders(self): """Read header lines. Read header lines up to the entirely blank line that terminates them. The (normally blank) line that ends the headers is skipped, but not included in the returned list. If a non-header line ends the headers, (which is an error), an a...
[ "Read", "header", "lines", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L122-L200
[ "def", "readheaders", "(", "self", ")", ":", "self", ".", "dict", "=", "{", "}", "self", ".", "unixfrom", "=", "''", "self", ".", "headers", "=", "lst", "=", "[", "]", "self", ".", "status", "=", "''", "headerseen", "=", "\"\"", "firstline", "=", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
Message.isheader
Determine whether a given line is a legal header. This method should return the header name, suitably canonicalized. You may override this method in order to use Message parsing on tagged data in RFC 2822-like formats with special header formats.
third_party/stdlib/rfc822.py
def isheader(self, line): """Determine whether a given line is a legal header. This method should return the header name, suitably canonicalized. You may override this method in order to use Message parsing on tagged data in RFC 2822-like formats with special header formats. """...
def isheader(self, line): """Determine whether a given line is a legal header. This method should return the header name, suitably canonicalized. You may override this method in order to use Message parsing on tagged data in RFC 2822-like formats with special header formats. """...
[ "Determine", "whether", "a", "given", "line", "is", "a", "legal", "header", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L202-L212
[ "def", "isheader", "(", "self", ",", "line", ")", ":", "i", "=", "line", ".", "find", "(", "':'", ")", "if", "i", ">", "-", "1", ":", "return", "line", "[", ":", "i", "]", ".", "lower", "(", ")", "return", "None" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
Message.getfirstmatchingheader
Get the first header line matching name. This is similar to getallmatchingheaders, but it returns only the first matching header (and its continuation lines).
third_party/stdlib/rfc822.py
def getfirstmatchingheader(self, name): """Get the first header line matching name. This is similar to getallmatchingheaders, but it returns only the first matching header (and its continuation lines). """ name = name.lower() + ':' n = len(name) lst = [] ...
def getfirstmatchingheader(self, name): """Get the first header line matching name. This is similar to getallmatchingheaders, but it returns only the first matching header (and its continuation lines). """ name = name.lower() + ':' n = len(name) lst = [] ...
[ "Get", "the", "first", "header", "line", "matching", "name", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L255-L273
[ "def", "getfirstmatchingheader", "(", "self", ",", "name", ")", ":", "name", "=", "name", ".", "lower", "(", ")", "+", "':'", "n", "=", "len", "(", "name", ")", "lst", "=", "[", "]", "hit", "=", "0", "for", "line", "in", "self", ".", "headers", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
Message.getrawheader
A higher-level interface to getfirstmatchingheader(). Return a string containing the literal text of the header but with the keyword stripped. All leading, trailing and embedded whitespace is kept in the string, however. Return None if the header does not occur.
third_party/stdlib/rfc822.py
def getrawheader(self, name): """A higher-level interface to getfirstmatchingheader(). Return a string containing the literal text of the header but with the keyword stripped. All leading, trailing and embedded whitespace is kept in the string, however. Return None if the header does ...
def getrawheader(self, name): """A higher-level interface to getfirstmatchingheader(). Return a string containing the literal text of the header but with the keyword stripped. All leading, trailing and embedded whitespace is kept in the string, however. Return None if the header does ...
[ "A", "higher", "-", "level", "interface", "to", "getfirstmatchingheader", "()", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L275-L288
[ "def", "getrawheader", "(", "self", ",", "name", ")", ":", "lst", "=", "self", ".", "getfirstmatchingheader", "(", "name", ")", "if", "not", "lst", ":", "return", "None", "lst", "[", "0", "]", "=", "lst", "[", "0", "]", "[", "len", "(", "name", "...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
Message.getheader
Get the header value for a name. This is the normal interface: it returns a stripped version of the header value for a given header name, or None if it doesn't exist. This uses the dictionary version which finds the *last* such header.
third_party/stdlib/rfc822.py
def getheader(self, name, default=None): """Get the header value for a name. This is the normal interface: it returns a stripped version of the header value for a given header name, or None if it doesn't exist. This uses the dictionary version which finds the *last* such header. ...
def getheader(self, name, default=None): """Get the header value for a name. This is the normal interface: it returns a stripped version of the header value for a given header name, or None if it doesn't exist. This uses the dictionary version which finds the *last* such header. ...
[ "Get", "the", "header", "value", "for", "a", "name", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L290-L297
[ "def", "getheader", "(", "self", ",", "name", ",", "default", "=", "None", ")", ":", "return", "self", ".", "dict", ".", "get", "(", "name", ".", "lower", "(", ")", ",", "default", ")" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
Message.getheaders
Get all values for a header. This returns a list of values for headers given more than once; each value in the result list is stripped in the same way as the result of getheader(). If the header is not given, return an empty list.
third_party/stdlib/rfc822.py
def getheaders(self, name): """Get all values for a header. This returns a list of values for headers given more than once; each value in the result list is stripped in the same way as the result of getheader(). If the header is not given, return an empty list. """ resu...
def getheaders(self, name): """Get all values for a header. This returns a list of values for headers given more than once; each value in the result list is stripped in the same way as the result of getheader(). If the header is not given, return an empty list. """ resu...
[ "Get", "all", "values", "for", "a", "header", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L300-L323
[ "def", "getheaders", "(", "self", ",", "name", ")", ":", "result", "=", "[", "]", "current", "=", "''", "have_header", "=", "0", "for", "s", "in", "self", ".", "getallmatchingheaders", "(", "name", ")", ":", "if", "s", "[", "0", "]", ".", "isspace"...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
Message.getaddrlist
Get a list of addresses from a header. Retrieves a list of addresses from a header, where each address is a tuple as returned by getaddr(). Scans all named headers, so it works properly with multiple To: or Cc: headers for example.
third_party/stdlib/rfc822.py
def getaddrlist(self, name): """Get a list of addresses from a header. Retrieves a list of addresses from a header, where each address is a tuple as returned by getaddr(). Scans all named headers, so it works properly with multiple To: or Cc: headers for example. """ ra...
def getaddrlist(self, name): """Get a list of addresses from a header. Retrieves a list of addresses from a header, where each address is a tuple as returned by getaddr(). Scans all named headers, so it works properly with multiple To: or Cc: headers for example. """ ra...
[ "Get", "a", "list", "of", "addresses", "from", "a", "header", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L338-L358
[ "def", "getaddrlist", "(", "self", ",", "name", ")", ":", "raw", "=", "[", "]", "for", "h", "in", "self", ".", "getallmatchingheaders", "(", "name", ")", ":", "if", "h", "[", "0", "]", "in", "' \\t'", ":", "raw", ".", "append", "(", "h", ")", "...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
AddrlistClass.gotonext
Parse up to the start of the next address.
third_party/stdlib/rfc822.py
def gotonext(self): """Parse up to the start of the next address.""" while self.pos < len(self.field): if self.field[self.pos] in self.LWS + '\n\r': self.pos = self.pos + 1 elif self.field[self.pos] == '(': self.commentlist.append(self.getcomment()...
def gotonext(self): """Parse up to the start of the next address.""" while self.pos < len(self.field): if self.field[self.pos] in self.LWS + '\n\r': self.pos = self.pos + 1 elif self.field[self.pos] == '(': self.commentlist.append(self.getcomment()...
[ "Parse", "up", "to", "the", "start", "of", "the", "next", "address", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L531-L538
[ "def", "gotonext", "(", "self", ")", ":", "while", "self", ".", "pos", "<", "len", "(", "self", ".", "field", ")", ":", "if", "self", ".", "field", "[", "self", ".", "pos", "]", "in", "self", ".", "LWS", "+", "'\\n\\r'", ":", "self", ".", "pos"...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
AddrlistClass.getaddrlist
Parse all addresses. Returns a list containing all of the addresses.
third_party/stdlib/rfc822.py
def getaddrlist(self): """Parse all addresses. Returns a list containing all of the addresses. """ result = [] ad = self.getaddress() while ad: result += ad ad = self.getaddress() return result
def getaddrlist(self): """Parse all addresses. Returns a list containing all of the addresses. """ result = [] ad = self.getaddress() while ad: result += ad ad = self.getaddress() return result
[ "Parse", "all", "addresses", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L540-L550
[ "def", "getaddrlist", "(", "self", ")", ":", "result", "=", "[", "]", "ad", "=", "self", ".", "getaddress", "(", ")", "while", "ad", ":", "result", "+=", "ad", "ad", "=", "self", ".", "getaddress", "(", ")", "return", "result" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
AddrlistClass.getrouteaddr
Parse a route address (Return-path value). This method just skips all the route stuff and returns the addrspec.
third_party/stdlib/rfc822.py
def getrouteaddr(self): """Parse a route address (Return-path value). This method just skips all the route stuff and returns the addrspec. """ if self.field[self.pos] != '<': return expectroute = 0 self.pos += 1 self.gotonext() adlist = "" ...
def getrouteaddr(self): """Parse a route address (Return-path value). This method just skips all the route stuff and returns the addrspec. """ if self.field[self.pos] != '<': return expectroute = 0 self.pos += 1 self.gotonext() adlist = "" ...
[ "Parse", "a", "route", "address", "(", "Return", "-", "path", "value", ")", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L610-L640
[ "def", "getrouteaddr", "(", "self", ")", ":", "if", "self", ".", "field", "[", "self", ".", "pos", "]", "!=", "'<'", ":", "return", "expectroute", "=", "0", "self", ".", "pos", "+=", "1", "self", ".", "gotonext", "(", ")", "adlist", "=", "\"\"", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
AddrlistClass.getaddrspec
Parse an RFC 2822 addr-spec.
third_party/stdlib/rfc822.py
def getaddrspec(self): """Parse an RFC 2822 addr-spec.""" aslist = [] self.gotonext() while self.pos < len(self.field): if self.field[self.pos] == '.': aslist.append('.') self.pos += 1 elif self.field[self.pos] == '"': ...
def getaddrspec(self): """Parse an RFC 2822 addr-spec.""" aslist = [] self.gotonext() while self.pos < len(self.field): if self.field[self.pos] == '.': aslist.append('.') self.pos += 1 elif self.field[self.pos] == '"': ...
[ "Parse", "an", "RFC", "2822", "addr", "-", "spec", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L642-L664
[ "def", "getaddrspec", "(", "self", ")", ":", "aslist", "=", "[", "]", "self", ".", "gotonext", "(", ")", "while", "self", ".", "pos", "<", "len", "(", "self", ".", "field", ")", ":", "if", "self", ".", "field", "[", "self", ".", "pos", "]", "==...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
AddrlistClass.getdomain
Get the complete domain name from an address.
third_party/stdlib/rfc822.py
def getdomain(self): """Get the complete domain name from an address.""" sdlist = [] while self.pos < len(self.field): if self.field[self.pos] in self.LWS: self.pos += 1 elif self.field[self.pos] == '(': self.commentlist.append(self.getcomm...
def getdomain(self): """Get the complete domain name from an address.""" sdlist = [] while self.pos < len(self.field): if self.field[self.pos] in self.LWS: self.pos += 1 elif self.field[self.pos] == '(': self.commentlist.append(self.getcomm...
[ "Get", "the", "complete", "domain", "name", "from", "an", "address", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L666-L682
[ "def", "getdomain", "(", "self", ")", ":", "sdlist", "=", "[", "]", "while", "self", ".", "pos", "<", "len", "(", "self", ".", "field", ")", ":", "if", "self", ".", "field", "[", "self", ".", "pos", "]", "in", "self", ".", "LWS", ":", "self", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
AddrlistClass.getdelimited
Parse a header fragment delimited by special characters. `beginchar' is the start character for the fragment. If self is not looking at an instance of `beginchar' then getdelimited returns the empty string. `endchars' is a sequence of allowable end-delimiting characters. Parsi...
third_party/stdlib/rfc822.py
def getdelimited(self, beginchar, endchars, allowcomments = 1): """Parse a header fragment delimited by special characters. `beginchar' is the start character for the fragment. If self is not looking at an instance of `beginchar' then getdelimited returns the empty string. `en...
def getdelimited(self, beginchar, endchars, allowcomments = 1): """Parse a header fragment delimited by special characters. `beginchar' is the start character for the fragment. If self is not looking at an instance of `beginchar' then getdelimited returns the empty string. `en...
[ "Parse", "a", "header", "fragment", "delimited", "by", "special", "characters", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L684-L719
[ "def", "getdelimited", "(", "self", ",", "beginchar", ",", "endchars", ",", "allowcomments", "=", "1", ")", ":", "if", "self", ".", "field", "[", "self", ".", "pos", "]", "!=", "beginchar", ":", "return", "''", "slist", "=", "[", "''", "]", "quote", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
AddrlistClass.getphraselist
Parse a sequence of RFC 2822 phrases. A phrase is a sequence of words, which are in turn either RFC 2822 atoms or quoted-strings. Phrases are canonicalized by squeezing all runs of continuous whitespace into one space.
third_party/stdlib/rfc822.py
def getphraselist(self): """Parse a sequence of RFC 2822 phrases. A phrase is a sequence of words, which are in turn either RFC 2822 atoms or quoted-strings. Phrases are canonicalized by squeezing all runs of continuous whitespace into one space. """ plist = [] ...
def getphraselist(self): """Parse a sequence of RFC 2822 phrases. A phrase is a sequence of words, which are in turn either RFC 2822 atoms or quoted-strings. Phrases are canonicalized by squeezing all runs of continuous whitespace into one space. """ plist = [] ...
[ "Parse", "a", "sequence", "of", "RFC", "2822", "phrases", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/rfc822.py#L752-L773
[ "def", "getphraselist", "(", "self", ")", ":", "plist", "=", "[", "]", "while", "self", ".", "pos", "<", "len", "(", "self", ".", "field", ")", ":", "if", "self", ".", "field", "[", "self", ".", "pos", "]", "in", "self", ".", "LWS", ":", "self"...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
_days_in_month
year, month -> number of days in that month in that year.
third_party/pypy/datetime.py
def _days_in_month(year, month): "year, month -> number of days in that month in that year." assert 1 <= month <= 12, month if month == 2 and _is_leap(year): return 29 return _DAYS_IN_MONTH[month]
def _days_in_month(year, month): "year, month -> number of days in that month in that year." assert 1 <= month <= 12, month if month == 2 and _is_leap(year): return 29 return _DAYS_IN_MONTH[month]
[ "year", "month", "-", ">", "number", "of", "days", "in", "that", "month", "in", "that", "year", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L70-L75
[ "def", "_days_in_month", "(", "year", ",", "month", ")", ":", "assert", "1", "<=", "month", "<=", "12", ",", "month", "if", "month", "==", "2", "and", "_is_leap", "(", "year", ")", ":", "return", "29", "return", "_DAYS_IN_MONTH", "[", "month", "]" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
_ymd2ord
year, month, day -> ordinal, considering 01-Jan-0001 as day 1.
third_party/pypy/datetime.py
def _ymd2ord(year, month, day): "year, month, day -> ordinal, considering 01-Jan-0001 as day 1." assert 1 <= month <= 12, 'month must be in 1..12' dim = _days_in_month(year, month) assert 1 <= day <= dim, ('day must be in 1..%d' % dim) return (_days_before_year(year) + _days_before_month...
def _ymd2ord(year, month, day): "year, month, day -> ordinal, considering 01-Jan-0001 as day 1." assert 1 <= month <= 12, 'month must be in 1..12' dim = _days_in_month(year, month) assert 1 <= day <= dim, ('day must be in 1..%d' % dim) return (_days_before_year(year) + _days_before_month...
[ "year", "month", "day", "-", ">", "ordinal", "considering", "01", "-", "Jan", "-", "0001", "as", "day", "1", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L82-L89
[ "def", "_ymd2ord", "(", "year", ",", "month", ",", "day", ")", ":", "assert", "1", "<=", "month", "<=", "12", ",", "'month must be in 1..12'", "dim", "=", "_days_in_month", "(", "year", ",", "month", ")", "assert", "1", "<=", "day", "<=", "dim", ",", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
_ord2ymd
ordinal -> (year, month, day), considering 01-Jan-0001 as day 1.
third_party/pypy/datetime.py
def _ord2ymd(n): "ordinal -> (year, month, day), considering 01-Jan-0001 as day 1." # n is a 1-based index, starting at 1-Jan-1. The pattern of leap years # repeats exactly every 400 years. The basic strategy is to find the # closest 400-year boundary at or before n, then work with the offset # f...
def _ord2ymd(n): "ordinal -> (year, month, day), considering 01-Jan-0001 as day 1." # n is a 1-based index, starting at 1-Jan-1. The pattern of leap years # repeats exactly every 400 years. The basic strategy is to find the # closest 400-year boundary at or before n, then work with the offset # f...
[ "ordinal", "-", ">", "(", "year", "month", "day", ")", "considering", "01", "-", "Jan", "-", "0001", "as", "day", "1", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L116-L176
[ "def", "_ord2ymd", "(", "n", ")", ":", "# n is a 1-based index, starting at 1-Jan-1. The pattern of leap years", "# repeats exactly every 400 years. The basic strategy is to find the", "# closest 400-year boundary at or before n, then work with the offset", "# from that boundary to n. Life is m...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
date.fromtimestamp
Construct a date from a POSIX timestamp (like time.time()).
third_party/pypy/datetime.py
def fromtimestamp(cls, t): "Construct a date from a POSIX timestamp (like time.time())." y, m, d, hh, mm, ss, weekday, jday, dst = _time.localtime(t) return cls(y, m, d)
def fromtimestamp(cls, t): "Construct a date from a POSIX timestamp (like time.time())." y, m, d, hh, mm, ss, weekday, jday, dst = _time.localtime(t) return cls(y, m, d)
[ "Construct", "a", "date", "from", "a", "POSIX", "timestamp", "(", "like", "time", ".", "time", "()", ")", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L732-L735
[ "def", "fromtimestamp", "(", "cls", ",", "t", ")", ":", "y", ",", "m", ",", "d", ",", "hh", ",", "mm", ",", "ss", ",", "weekday", ",", "jday", ",", "dst", "=", "_time", ".", "localtime", "(", "t", ")", "return", "cls", "(", "y", ",", "m", "...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
date.fromordinal
Contruct a date from a proleptic Gregorian ordinal. January 1 of year 1 is day 1. Only the year, month and day are non-zero in the result.
third_party/pypy/datetime.py
def fromordinal(cls, n): """Contruct a date from a proleptic Gregorian ordinal. January 1 of year 1 is day 1. Only the year, month and day are non-zero in the result. """ y, m, d = _ord2ymd(n) return cls(y, m, d)
def fromordinal(cls, n): """Contruct a date from a proleptic Gregorian ordinal. January 1 of year 1 is day 1. Only the year, month and day are non-zero in the result. """ y, m, d = _ord2ymd(n) return cls(y, m, d)
[ "Contruct", "a", "date", "from", "a", "proleptic", "Gregorian", "ordinal", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L744-L751
[ "def", "fromordinal", "(", "cls", ",", "n", ")", ":", "y", ",", "m", ",", "d", "=", "_ord2ymd", "(", "n", ")", "return", "cls", "(", "y", ",", "m", ",", "d", ")" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
date.ctime
Return ctime() style string.
third_party/pypy/datetime.py
def ctime(self): "Return ctime() style string." weekday = self.toordinal() % 7 or 7 return "%s %s %2d 00:00:00 %04d" % ( _DAYNAMES[weekday], _MONTHNAMES[self._month], self._day, self._year)
def ctime(self): "Return ctime() style string." weekday = self.toordinal() % 7 or 7 return "%s %s %2d 00:00:00 %04d" % ( _DAYNAMES[weekday], _MONTHNAMES[self._month], self._day, self._year)
[ "Return", "ctime", "()", "style", "string", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L777-L783
[ "def", "ctime", "(", "self", ")", ":", "weekday", "=", "self", ".", "toordinal", "(", ")", "%", "7", "or", "7", "return", "\"%s %s %2d 00:00:00 %04d\"", "%", "(", "_DAYNAMES", "[", "weekday", "]", ",", "_MONTHNAMES", "[", "self", ".", "_month", "]", ",...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
date.isoformat
Return the date formatted according to ISO. This is 'YYYY-MM-DD'. References: - http://www.w3.org/TR/NOTE-datetime - http://www.cl.cam.ac.uk/~mgk25/iso-time.html
third_party/pypy/datetime.py
def isoformat(self): """Return the date formatted according to ISO. This is 'YYYY-MM-DD'. References: - http://www.w3.org/TR/NOTE-datetime - http://www.cl.cam.ac.uk/~mgk25/iso-time.html """ # return "%04d-%02d-%02d" % (self._year, self._month, self._day) ...
def isoformat(self): """Return the date formatted according to ISO. This is 'YYYY-MM-DD'. References: - http://www.w3.org/TR/NOTE-datetime - http://www.cl.cam.ac.uk/~mgk25/iso-time.html """ # return "%04d-%02d-%02d" % (self._year, self._month, self._day) ...
[ "Return", "the", "date", "formatted", "according", "to", "ISO", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L797-L807
[ "def", "isoformat", "(", "self", ")", ":", "# return \"%04d-%02d-%02d\" % (self._year, self._month, self._day)", "return", "\"%s-%s-%s\"", "%", "(", "str", "(", "self", ".", "_year", ")", ".", "zfill", "(", "4", ")", ",", "str", "(", "self", ".", "_month", ")"...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
date.replace
Return a new date with new values for the specified fields.
third_party/pypy/datetime.py
def replace(self, year=None, month=None, day=None): """Return a new date with new values for the specified fields.""" if year is None: year = self._year if month is None: month = self._month if day is None: day = self._day return date.__new__(t...
def replace(self, year=None, month=None, day=None): """Return a new date with new values for the specified fields.""" if year is None: year = self._year if month is None: month = self._month if day is None: day = self._day return date.__new__(t...
[ "Return", "a", "new", "date", "with", "new", "values", "for", "the", "specified", "fields", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L842-L850
[ "def", "replace", "(", "self", ",", "year", "=", "None", ",", "month", "=", "None", ",", "day", "=", "None", ")", ":", "if", "year", "is", "None", ":", "year", "=", "self", ".", "_year", "if", "month", "is", "None", ":", "month", "=", "self", "...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
date.isocalendar
Return a 3-tuple containing ISO year, week number, and weekday. The first ISO week of the year is the (Mon-Sun) week containing the year's first Thursday; everything else derives from that. The first week is 1; Monday is 1 ... Sunday is 7. ISO calendar algorithm taken from ...
third_party/pypy/datetime.py
def isocalendar(self): """Return a 3-tuple containing ISO year, week number, and weekday. The first ISO week of the year is the (Mon-Sun) week containing the year's first Thursday; everything else derives from that. The first week is 1; Monday is 1 ... Sunday is 7. ISO...
def isocalendar(self): """Return a 3-tuple containing ISO year, week number, and weekday. The first ISO week of the year is the (Mon-Sun) week containing the year's first Thursday; everything else derives from that. The first week is 1; Monday is 1 ... Sunday is 7. ISO...
[ "Return", "a", "3", "-", "tuple", "containing", "ISO", "year", "week", "number", "and", "weekday", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L952-L977
[ "def", "isocalendar", "(", "self", ")", ":", "year", "=", "self", ".", "_year", "week1monday", "=", "_isoweek1monday", "(", "year", ")", "today", "=", "_ymd2ord", "(", "self", ".", "_year", ",", "self", ".", "_month", ",", "self", ".", "_day", ")", "...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
time._tzstr
Return formatted timezone offset (+xx:xx) or None.
third_party/pypy/datetime.py
def _tzstr(self, sep=":"): """Return formatted timezone offset (+xx:xx) or None.""" off = self._utcoffset() if off is not None: if off < 0: sign = "-" off = -off else: sign = "+" hh, mm = divmod(off, 60) ...
def _tzstr(self, sep=":"): """Return formatted timezone offset (+xx:xx) or None.""" off = self._utcoffset() if off is not None: if off < 0: sign = "-" off = -off else: sign = "+" hh, mm = divmod(off, 60) ...
[ "Return", "formatted", "timezone", "offset", "(", "+", "xx", ":", "xx", ")", "or", "None", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L1231-L1243
[ "def", "_tzstr", "(", "self", ",", "sep", "=", "\":\"", ")", ":", "off", "=", "self", ".", "_utcoffset", "(", ")", "if", "off", "is", "not", "None", ":", "if", "off", "<", "0", ":", "sign", "=", "\"-\"", "off", "=", "-", "off", "else", ":", "...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
time.isoformat
Return the time formatted according to ISO. This is 'HH:MM:SS.mmmmmm+zz:zz', or 'HH:MM:SS+zz:zz' if self.microsecond == 0.
third_party/pypy/datetime.py
def isoformat(self): """Return the time formatted according to ISO. This is 'HH:MM:SS.mmmmmm+zz:zz', or 'HH:MM:SS+zz:zz' if self.microsecond == 0. """ s = _format_time(self._hour, self._minute, self._second, self._microsecond) tz = self._tzstr() ...
def isoformat(self): """Return the time formatted according to ISO. This is 'HH:MM:SS.mmmmmm+zz:zz', or 'HH:MM:SS+zz:zz' if self.microsecond == 0. """ s = _format_time(self._hour, self._minute, self._second, self._microsecond) tz = self._tzstr() ...
[ "Return", "the", "time", "formatted", "according", "to", "ISO", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L1261-L1272
[ "def", "isoformat", "(", "self", ")", ":", "s", "=", "_format_time", "(", "self", ".", "_hour", ",", "self", ".", "_minute", ",", "self", ".", "_second", ",", "self", ".", "_microsecond", ")", "tz", "=", "self", ".", "_tzstr", "(", ")", "if", "tz",...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
time.tzname
Return the timezone name. Note that the name is 100% informational -- there's no requirement that it mean anything in particular. For example, "GMT", "UTC", "-500", "-5:00", "EDT", "US/Eastern", "America/New York" are all valid replies.
third_party/pypy/datetime.py
def tzname(self): """Return the timezone name. Note that the name is 100% informational -- there's no requirement that it mean anything in particular. For example, "GMT", "UTC", "-500", "-5:00", "EDT", "US/Eastern", "America/New York" are all valid replies. """ if self._...
def tzname(self): """Return the timezone name. Note that the name is 100% informational -- there's no requirement that it mean anything in particular. For example, "GMT", "UTC", "-500", "-5:00", "EDT", "US/Eastern", "America/New York" are all valid replies. """ if self._...
[ "Return", "the", "timezone", "name", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L1316-L1327
[ "def", "tzname", "(", "self", ")", ":", "if", "self", ".", "_tzinfo", "is", "None", ":", "return", "None", "name", "=", "self", ".", "_tzinfo", ".", "tzname", "(", "None", ")", "_check_tzname", "(", "name", ")", "return", "name" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
time.dst
Return 0 if DST is not in effect, or the DST offset (in minutes eastward) if DST is in effect. This is purely informational; the DST offset has already been added to the UTC offset returned by utcoffset() if applicable, so there's no need to consult dst() unless you're interested in dis...
third_party/pypy/datetime.py
def dst(self): """Return 0 if DST is not in effect, or the DST offset (in minutes eastward) if DST is in effect. This is purely informational; the DST offset has already been added to the UTC offset returned by utcoffset() if applicable, so there's no need to consult dst() unles...
def dst(self): """Return 0 if DST is not in effect, or the DST offset (in minutes eastward) if DST is in effect. This is purely informational; the DST offset has already been added to the UTC offset returned by utcoffset() if applicable, so there's no need to consult dst() unles...
[ "Return", "0", "if", "DST", "is", "not", "in", "effect", "or", "the", "DST", "offset", "(", "in", "minutes", "eastward", ")", "if", "DST", "is", "in", "effect", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L1329-L1344
[ "def", "dst", "(", "self", ")", ":", "if", "self", ".", "_tzinfo", "is", "None", ":", "return", "None", "offset", "=", "self", ".", "_tzinfo", ".", "dst", "(", "None", ")", "offset", "=", "_check_utc_offset", "(", "\"dst\"", ",", "offset", ")", "if",...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
time.replace
Return a new time with new values for the specified fields.
third_party/pypy/datetime.py
def replace(self, hour=None, minute=None, second=None, microsecond=None, tzinfo=True): """Return a new time with new values for the specified fields.""" if hour is None: hour = self.hour if minute is None: minute = self.minute if second is None: ...
def replace(self, hour=None, minute=None, second=None, microsecond=None, tzinfo=True): """Return a new time with new values for the specified fields.""" if hour is None: hour = self.hour if minute is None: minute = self.minute if second is None: ...
[ "Return", "a", "new", "time", "with", "new", "values", "for", "the", "specified", "fields", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L1354-L1368
[ "def", "replace", "(", "self", ",", "hour", "=", "None", ",", "minute", "=", "None", ",", "second", "=", "None", ",", "microsecond", "=", "None", ",", "tzinfo", "=", "True", ")", ":", "if", "hour", "is", "None", ":", "hour", "=", "self", ".", "ho...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
datetime.fromtimestamp
Construct a datetime from a POSIX timestamp (like time.time()). A timezone info object may be passed in as well.
third_party/pypy/datetime.py
def fromtimestamp(cls, timestamp, tz=None): """Construct a datetime from a POSIX timestamp (like time.time()). A timezone info object may be passed in as well. """ _check_tzinfo_arg(tz) converter = _time.localtime if tz is None else _time.gmtime self = cls._from_timestam...
def fromtimestamp(cls, timestamp, tz=None): """Construct a datetime from a POSIX timestamp (like time.time()). A timezone info object may be passed in as well. """ _check_tzinfo_arg(tz) converter = _time.localtime if tz is None else _time.gmtime self = cls._from_timestam...
[ "Construct", "a", "datetime", "from", "a", "POSIX", "timestamp", "(", "like", "time", ".", "time", "()", ")", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L1466-L1476
[ "def", "fromtimestamp", "(", "cls", ",", "timestamp", ",", "tz", "=", "None", ")", ":", "_check_tzinfo_arg", "(", "tz", ")", "converter", "=", "_time", ".", "localtime", "if", "tz", "is", "None", "else", "_time", ".", "gmtime", "self", "=", "cls", ".",...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
datetime.now
Construct a datetime from time.time() and optional time zone info.
third_party/pypy/datetime.py
def now(cls, tz=None): "Construct a datetime from time.time() and optional time zone info." t = _time.time() return cls.fromtimestamp(t, tz)
def now(cls, tz=None): "Construct a datetime from time.time() and optional time zone info." t = _time.time() return cls.fromtimestamp(t, tz)
[ "Construct", "a", "datetime", "from", "time", ".", "time", "()", "and", "optional", "time", "zone", "info", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L1502-L1505
[ "def", "now", "(", "cls", ",", "tz", "=", "None", ")", ":", "t", "=", "_time", ".", "time", "(", ")", "return", "cls", ".", "fromtimestamp", "(", "t", ",", "tz", ")" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
datetime.combine
Construct a datetime from a given date and a given time.
third_party/pypy/datetime.py
def combine(cls, date, time): "Construct a datetime from a given date and a given time." if not isinstance(date, _date_class): raise TypeError("date argument must be a date instance") if not isinstance(time, _time_class): raise TypeError("time argument must be a time inst...
def combine(cls, date, time): "Construct a datetime from a given date and a given time." if not isinstance(date, _date_class): raise TypeError("date argument must be a date instance") if not isinstance(time, _time_class): raise TypeError("time argument must be a time inst...
[ "Construct", "a", "datetime", "from", "a", "given", "date", "and", "a", "given", "time", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L1514-L1522
[ "def", "combine", "(", "cls", ",", "date", ",", "time", ")", ":", "if", "not", "isinstance", "(", "date", ",", "_date_class", ")", ":", "raise", "TypeError", "(", "\"date argument must be a date instance\"", ")", "if", "not", "isinstance", "(", "time", ",", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
datetime.utctimetuple
Return UTC time tuple compatible with time.gmtime().
third_party/pypy/datetime.py
def utctimetuple(self): "Return UTC time tuple compatible with time.gmtime()." y, m, d = self.year, self.month, self.day hh, mm, ss = self.hour, self.minute, self.second offset = self._utcoffset() if offset: # neither None nor 0 mm -= offset y, m, d, hh, ...
def utctimetuple(self): "Return UTC time tuple compatible with time.gmtime()." y, m, d = self.year, self.month, self.day hh, mm, ss = self.hour, self.minute, self.second offset = self._utcoffset() if offset: # neither None nor 0 mm -= offset y, m, d, hh, ...
[ "Return", "UTC", "time", "tuple", "compatible", "with", "time", ".", "gmtime", "()", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L1535-L1544
[ "def", "utctimetuple", "(", "self", ")", ":", "y", ",", "m", ",", "d", "=", "self", ".", "year", ",", "self", ".", "month", ",", "self", ".", "day", "hh", ",", "mm", ",", "ss", "=", "self", ".", "hour", ",", "self", ".", "minute", ",", "self"...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
datetime.time
Return the time part, with tzinfo None.
third_party/pypy/datetime.py
def time(self): "Return the time part, with tzinfo None." return time(self.hour, self.minute, self.second, self.microsecond)
def time(self): "Return the time part, with tzinfo None." return time(self.hour, self.minute, self.second, self.microsecond)
[ "Return", "the", "time", "part", "with", "tzinfo", "None", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L1550-L1552
[ "def", "time", "(", "self", ")", ":", "return", "time", "(", "self", ".", "hour", ",", "self", ".", "minute", ",", "self", ".", "second", ",", "self", ".", "microsecond", ")" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
datetime.timetz
Return the time part, with same tzinfo.
third_party/pypy/datetime.py
def timetz(self): "Return the time part, with same tzinfo." return time(self.hour, self.minute, self.second, self.microsecond, self._tzinfo)
def timetz(self): "Return the time part, with same tzinfo." return time(self.hour, self.minute, self.second, self.microsecond, self._tzinfo)
[ "Return", "the", "time", "part", "with", "same", "tzinfo", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L1554-L1557
[ "def", "timetz", "(", "self", ")", ":", "return", "time", "(", "self", ".", "hour", ",", "self", ".", "minute", ",", "self", ".", "second", ",", "self", ".", "microsecond", ",", "self", ".", "_tzinfo", ")" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
datetime.replace
Return a new datetime with new values for the specified fields.
third_party/pypy/datetime.py
def replace(self, year=None, month=None, day=None, hour=None, minute=None, second=None, microsecond=None, tzinfo=True): """Return a new datetime with new values for the specified fields.""" if year is None: year = self.year if month is None: month = self.m...
def replace(self, year=None, month=None, day=None, hour=None, minute=None, second=None, microsecond=None, tzinfo=True): """Return a new datetime with new values for the specified fields.""" if year is None: year = self.year if month is None: month = self.m...
[ "Return", "a", "new", "datetime", "with", "new", "values", "for", "the", "specified", "fields", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L1559-L1580
[ "def", "replace", "(", "self", ",", "year", "=", "None", ",", "month", "=", "None", ",", "day", "=", "None", ",", "hour", "=", "None", ",", "minute", "=", "None", ",", "second", "=", "None", ",", "microsecond", "=", "None", ",", "tzinfo", "=", "T...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
datetime.ctime
Return ctime() style string.
third_party/pypy/datetime.py
def ctime(self): "Return ctime() style string." weekday = self.toordinal() % 7 or 7 return "%s %s %2d %02d:%02d:%02d %04d" % ( _DAYNAMES[weekday], _MONTHNAMES[self._month], self._day, self._hour, self._minute, self._second, self._year)
def ctime(self): "Return ctime() style string." weekday = self.toordinal() % 7 or 7 return "%s %s %2d %02d:%02d:%02d %04d" % ( _DAYNAMES[weekday], _MONTHNAMES[self._month], self._day, self._hour, self._minute, self._second, self._year)
[ "Return", "ctime", "()", "style", "string", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L1604-L1612
[ "def", "ctime", "(", "self", ")", ":", "weekday", "=", "self", ".", "toordinal", "(", ")", "%", "7", "or", "7", "return", "\"%s %s %2d %02d:%02d:%02d %04d\"", "%", "(", "_DAYNAMES", "[", "weekday", "]", ",", "_MONTHNAMES", "[", "self", ".", "_month", "]"...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
datetime.isoformat
Return the time formatted according to ISO. This is 'YYYY-MM-DD HH:MM:SS.mmmmmm', or 'YYYY-MM-DD HH:MM:SS' if self.microsecond == 0. If self.tzinfo is not None, the UTC offset is also attached, giving 'YYYY-MM-DD HH:MM:SS.mmmmmm+HH:MM' or 'YYYY-MM-DD HH:MM:SS+HH:MM'. Optional ...
third_party/pypy/datetime.py
def isoformat(self, sep='T'): """Return the time formatted according to ISO. This is 'YYYY-MM-DD HH:MM:SS.mmmmmm', or 'YYYY-MM-DD HH:MM:SS' if self.microsecond == 0. If self.tzinfo is not None, the UTC offset is also attached, giving 'YYYY-MM-DD HH:MM:SS.mmmmmm+HH:MM' or 'YYYY-...
def isoformat(self, sep='T'): """Return the time formatted according to ISO. This is 'YYYY-MM-DD HH:MM:SS.mmmmmm', or 'YYYY-MM-DD HH:MM:SS' if self.microsecond == 0. If self.tzinfo is not None, the UTC offset is also attached, giving 'YYYY-MM-DD HH:MM:SS.mmmmmm+HH:MM' or 'YYYY-...
[ "Return", "the", "time", "formatted", "according", "to", "ISO", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L1614-L1638
[ "def", "isoformat", "(", "self", ",", "sep", "=", "'T'", ")", ":", "s", "=", "(", "\"%04d-%02d-%02d%c\"", "%", "(", "self", ".", "_year", ",", "self", ".", "_month", ",", "self", ".", "_day", ",", "sep", ")", "+", "_format_time", "(", "self", ".", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
datetime.utcoffset
Return the timezone offset in minutes east of UTC (negative west of UTC).
third_party/pypy/datetime.py
def utcoffset(self): """Return the timezone offset in minutes east of UTC (negative west of UTC).""" if self._tzinfo is None: return None offset = self._tzinfo.utcoffset(self) offset = _check_utc_offset("utcoffset", offset) if offset is not None: o...
def utcoffset(self): """Return the timezone offset in minutes east of UTC (negative west of UTC).""" if self._tzinfo is None: return None offset = self._tzinfo.utcoffset(self) offset = _check_utc_offset("utcoffset", offset) if offset is not None: o...
[ "Return", "the", "timezone", "offset", "in", "minutes", "east", "of", "UTC", "(", "negative", "west", "of", "UTC", ")", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/datetime.py#L1670-L1679
[ "def", "utcoffset", "(", "self", ")", ":", "if", "self", ".", "_tzinfo", "is", "None", ":", "return", "None", "offset", "=", "self", ".", "_tzinfo", ".", "utcoffset", "(", "self", ")", "offset", "=", "_check_utc_offset", "(", "\"utcoffset\"", ",", "offse...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
truediv
Same as a / b.
third_party/ouroboros/operator.py
def truediv(a, b): "Same as a / b." if type(a) == int or type(a) == long: a = float(a) return a / b
def truediv(a, b): "Same as a / b." if type(a) == int or type(a) == long: a = float(a) return a / b
[ "Same", "as", "a", "/", "b", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/ouroboros/operator.py#L130-L134
[ "def", "truediv", "(", "a", ",", "b", ")", ":", "if", "type", "(", "a", ")", "==", "int", "or", "type", "(", "a", ")", "==", "long", ":", "a", "=", "float", "(", "a", ")", "return", "a", "/", "b" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
concat
Same as a + b, for a and b sequences.
third_party/ouroboros/operator.py
def concat(a, b): "Same as a + b, for a and b sequences." if not hasattr(a, '__getitem__'): msg = "'%s' object can't be concatenated" % type(a).__name__ raise TypeError(msg) return a + b
def concat(a, b): "Same as a + b, for a and b sequences." if not hasattr(a, '__getitem__'): msg = "'%s' object can't be concatenated" % type(a).__name__ raise TypeError(msg) return a + b
[ "Same", "as", "a", "+", "b", "for", "a", "and", "b", "sequences", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/ouroboros/operator.py#L142-L147
[ "def", "concat", "(", "a", ",", "b", ")", ":", "if", "not", "hasattr", "(", "a", ",", "'__getitem__'", ")", ":", "msg", "=", "\"'%s' object can't be concatenated\"", "%", "type", "(", "a", ")", ".", "__name__", "raise", "TypeError", "(", "msg", ")", "r...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
countOf
Return the number of times b occurs in a.
third_party/ouroboros/operator.py
def countOf(a, b): "Return the number of times b occurs in a." count = 0 for i in a: if i == b: count += 1 return count
def countOf(a, b): "Return the number of times b occurs in a." count = 0 for i in a: if i == b: count += 1 return count
[ "Return", "the", "number", "of", "times", "b", "occurs", "in", "a", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/ouroboros/operator.py#L153-L159
[ "def", "countOf", "(", "a", ",", "b", ")", ":", "count", "=", "0", "for", "i", "in", "a", ":", "if", "i", "==", "b", ":", "count", "+=", "1", "return", "count" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
indexOf
Return the first index of b in a.
third_party/ouroboros/operator.py
def indexOf(a, b): "Return the first index of b in a." for i, j in enumerate(a): if j == b: return i else: raise ValueError('sequence.index(x): x not in sequence')
def indexOf(a, b): "Return the first index of b in a." for i, j in enumerate(a): if j == b: return i else: raise ValueError('sequence.index(x): x not in sequence')
[ "Return", "the", "first", "index", "of", "b", "in", "a", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/ouroboros/operator.py#L169-L175
[ "def", "indexOf", "(", "a", ",", "b", ")", ":", "for", "i", ",", "j", "in", "enumerate", "(", "a", ")", ":", "if", "j", "==", "b", ":", "return", "i", "else", ":", "raise", "ValueError", "(", "'sequence.index(x): x not in sequence'", ")" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
length_hint
Return an estimate of the number of items in obj. This is useful for presizing containers when building from an iterable. If the object supports len(), the result will be exact. Otherwise, it may over- or under-estimate by an arbitrary amount. The result will be an integer >= 0.
third_party/ouroboros/operator.py
def length_hint(obj, default=0): """ Return an estimate of the number of items in obj. This is useful for presizing containers when building from an iterable. If the object supports len(), the result will be exact. Otherwise, it may over- or under-estimate by an arbitrary amount. The result will be ...
def length_hint(obj, default=0): """ Return an estimate of the number of items in obj. This is useful for presizing containers when building from an iterable. If the object supports len(), the result will be exact. Otherwise, it may over- or under-estimate by an arbitrary amount. The result will be ...
[ "Return", "an", "estimate", "of", "the", "number", "of", "items", "in", "obj", ".", "This", "is", "useful", "for", "presizing", "containers", "when", "building", "from", "an", "iterable", ".", "If", "the", "object", "supports", "len", "()", "the", "result"...
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/ouroboros/operator.py#L181-L217
[ "def", "length_hint", "(", "obj", ",", "default", "=", "0", ")", ":", "if", "not", "isinstance", "(", "default", ",", "int", ")", ":", "msg", "=", "(", "\"'%s' object cannot be interpreted as an integer\"", "%", "type", "(", "default", ")", ".", "__name__", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
iconcat
Same as a += b, for a and b sequences.
third_party/ouroboros/operator.py
def iconcat(a, b): "Same as a += b, for a and b sequences." if not hasattr(a, '__getitem__'): msg = "'%s' object can't be concatenated" % type(a).__name__ raise TypeError(msg) a += b return a
def iconcat(a, b): "Same as a += b, for a and b sequences." if not hasattr(a, '__getitem__'): msg = "'%s' object can't be concatenated" % type(a).__name__ raise TypeError(msg) a += b return a
[ "Same", "as", "a", "+", "=", "b", "for", "a", "and", "b", "sequences", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/ouroboros/operator.py#L303-L309
[ "def", "iconcat", "(", "a", ",", "b", ")", ":", "if", "not", "hasattr", "(", "a", ",", "'__getitem__'", ")", ":", "msg", "=", "\"'%s' object can't be concatenated\"", "%", "type", "(", "a", ")", ".", "__name__", "raise", "TypeError", "(", "msg", ")", "...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
itruediv
Same as a /= b.
third_party/ouroboros/operator.py
def itruediv(a, b): "Same as a /= b." if type(a) == int or type(a) == long: a = float(a) a /= b return a
def itruediv(a, b): "Same as a /= b." if type(a) == int or type(a) == long: a = float(a) a /= b return a
[ "Same", "as", "a", "/", "=", "b", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/ouroboros/operator.py#L351-L356
[ "def", "itruediv", "(", "a", ",", "b", ")", ":", "if", "type", "(", "a", ")", "==", "int", "or", "type", "(", "a", ")", "==", "long", ":", "a", "=", "float", "(", "a", ")", "a", "/=", "b", "return", "a" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
Sniffer.sniff
Returns a dialect (or None) corresponding to the sample
third_party/stdlib/csv.py
def sniff(self, sample, delimiters=None): """ Returns a dialect (or None) corresponding to the sample """ quotechar, doublequote, delimiter, skipinitialspace = \ self._guess_quote_and_delimiter(sample, delimiters) if not delimiter: delimiter, skipi...
def sniff(self, sample, delimiters=None): """ Returns a dialect (or None) corresponding to the sample """ quotechar, doublequote, delimiter, skipinitialspace = \ self._guess_quote_and_delimiter(sample, delimiters) if not delimiter: delimiter, skipi...
[ "Returns", "a", "dialect", "(", "or", "None", ")", "corresponding", "to", "the", "sample" ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/csv.py#L189-L215
[ "def", "sniff", "(", "self", ",", "sample", ",", "delimiters", "=", "None", ")", ":", "quotechar", ",", "doublequote", ",", "delimiter", ",", "skipinitialspace", "=", "self", ".", "_guess_quote_and_delimiter", "(", "sample", ",", "delimiters", ")", "if", "no...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
Sniffer._guess_quote_and_delimiter
Looks for text enclosed between two identical quotes (the probable quotechar) which are preceded and followed by the same character (the probable delimiter). For example: ,'some text', The quote with the most wins, same with the delimiter. If there is no ...
third_party/stdlib/csv.py
def _guess_quote_and_delimiter(self, data, delimiters): """ Looks for text enclosed between two identical quotes (the probable quotechar) which are preceded and followed by the same character (the probable delimiter). For example: ,'some text', Th...
def _guess_quote_and_delimiter(self, data, delimiters): """ Looks for text enclosed between two identical quotes (the probable quotechar) which are preceded and followed by the same character (the probable delimiter). For example: ,'some text', Th...
[ "Looks", "for", "text", "enclosed", "between", "two", "identical", "quotes", "(", "the", "probable", "quotechar", ")", "which", "are", "preceded", "and", "followed", "by", "the", "same", "character", "(", "the", "probable", "delimiter", ")", ".", "For", "exa...
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/csv.py#L218-L292
[ "def", "_guess_quote_and_delimiter", "(", "self", ",", "data", ",", "delimiters", ")", ":", "matches", "=", "[", "]", "for", "restr", "in", "(", "'(?P<delim>[^\\w\\n\"\\'])(?P<space> ?)(?P<quote>[\"\\']).*?(?P=quote)(?P=delim)'", ",", "# ,\".*?\",", "'(?:^|\\n)(?P<quote>[\"...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
Sniffer._guess_delimiter
The delimiter /should/ occur the same number of times on each row. However, due to malformed data, it may not. We don't want an all or nothing approach, so we allow for small variations in this number. 1) build a table of the frequency of each character on every line. 2) buil...
third_party/stdlib/csv.py
def _guess_delimiter(self, data, delimiters): """ The delimiter /should/ occur the same number of times on each row. However, due to malformed data, it may not. We don't want an all or nothing approach, so we allow for small variations in this number. 1) build a table o...
def _guess_delimiter(self, data, delimiters): """ The delimiter /should/ occur the same number of times on each row. However, due to malformed data, it may not. We don't want an all or nothing approach, so we allow for small variations in this number. 1) build a table o...
[ "The", "delimiter", "/", "should", "/", "occur", "the", "same", "number", "of", "times", "on", "each", "row", ".", "However", "due", "to", "malformed", "data", "it", "may", "not", ".", "We", "don", "t", "want", "an", "all", "or", "nothing", "approach",...
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/csv.py#L295-L397
[ "def", "_guess_delimiter", "(", "self", ",", "data", ",", "delimiters", ")", ":", "data", "=", "filter", "(", "None", ",", "data", ".", "split", "(", "'\\n'", ")", ")", "ascii", "=", "[", "chr", "(", "c", ")", "for", "c", "in", "range", "(", "127...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
encode_basestring
Return a JSON representation of a Python string
third_party/stdlib/json/encoder.py
def encode_basestring(s): """Return a JSON representation of a Python string """ def replace(match): return ESCAPE_DCT[match.group(0)] return '"' + ESCAPE.sub(replace, s) + '"'
def encode_basestring(s): """Return a JSON representation of a Python string """ def replace(match): return ESCAPE_DCT[match.group(0)] return '"' + ESCAPE.sub(replace, s) + '"'
[ "Return", "a", "JSON", "representation", "of", "a", "Python", "string" ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/json/encoder.py#L41-L47
[ "def", "encode_basestring", "(", "s", ")", ":", "def", "replace", "(", "match", ")", ":", "return", "ESCAPE_DCT", "[", "match", ".", "group", "(", "0", ")", "]", "return", "'\"'", "+", "ESCAPE", ".", "sub", "(", "replace", ",", "s", ")", "+", "'\"'...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
sub
Return the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in string by the replacement repl. repl can be either a string or a callable; if a string, backslash escapes in it are processed. If it is a callable, it's passed the match object and must return a repl...
third_party/stdlib/re.py
def sub(pattern, repl, string, count=0, flags=0): """Return the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in string by the replacement repl. repl can be either a string or a callable; if a string, backslash escapes in it are processed. If it is a callable...
def sub(pattern, repl, string, count=0, flags=0): """Return the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in string by the replacement repl. repl can be either a string or a callable; if a string, backslash escapes in it are processed. If it is a callable...
[ "Return", "the", "string", "obtained", "by", "replacing", "the", "leftmost", "non", "-", "overlapping", "occurrences", "of", "the", "pattern", "in", "string", "by", "the", "replacement", "repl", ".", "repl", "can", "be", "either", "a", "string", "or", "a", ...
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/re.py#L151-L158
[ "def", "sub", "(", "pattern", ",", "repl", ",", "string", ",", "count", "=", "0", ",", "flags", "=", "0", ")", ":", "return", "_compile", "(", "pattern", ",", "flags", ")", ".", "sub", "(", "repl", ",", "string", ",", "count", ")" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
subn
Return a 2-tuple containing (new_string, number). new_string is the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in the source string by the replacement repl. number is the number of substitutions that were made. repl can be either a string or a callable; if ...
third_party/stdlib/re.py
def subn(pattern, repl, string, count=0, flags=0): """Return a 2-tuple containing (new_string, number). new_string is the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in the source string by the replacement repl. number is the number of substitutions that wer...
def subn(pattern, repl, string, count=0, flags=0): """Return a 2-tuple containing (new_string, number). new_string is the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in the source string by the replacement repl. number is the number of substitutions that wer...
[ "Return", "a", "2", "-", "tuple", "containing", "(", "new_string", "number", ")", ".", "new_string", "is", "the", "string", "obtained", "by", "replacing", "the", "leftmost", "non", "-", "overlapping", "occurrences", "of", "the", "pattern", "in", "the", "sour...
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/re.py#L160-L169
[ "def", "subn", "(", "pattern", ",", "repl", ",", "string", ",", "count", "=", "0", ",", "flags", "=", "0", ")", ":", "return", "_compile", "(", "pattern", ",", "flags", ")", ".", "subn", "(", "repl", ",", "string", ",", "count", ")" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
split
Split the source string by the occurrences of the pattern, returning a list containing the resulting substrings.
third_party/stdlib/re.py
def split(pattern, string, maxsplit=0, flags=0): """Split the source string by the occurrences of the pattern, returning a list containing the resulting substrings.""" return _compile(pattern, flags).split(string, maxsplit)
def split(pattern, string, maxsplit=0, flags=0): """Split the source string by the occurrences of the pattern, returning a list containing the resulting substrings.""" return _compile(pattern, flags).split(string, maxsplit)
[ "Split", "the", "source", "string", "by", "the", "occurrences", "of", "the", "pattern", "returning", "a", "list", "containing", "the", "resulting", "substrings", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/re.py#L171-L174
[ "def", "split", "(", "pattern", ",", "string", ",", "maxsplit", "=", "0", ",", "flags", "=", "0", ")", ":", "return", "_compile", "(", "pattern", ",", "flags", ")", ".", "split", "(", "string", ",", "maxsplit", ")" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
findall
Return a list of all non-overlapping matches in the string. If one or more groups are present in the pattern, return a list of groups; this will be a list of tuples if the pattern has more than one group. Empty matches are included in the result.
third_party/stdlib/re.py
def findall(pattern, string, flags=0): """Return a list of all non-overlapping matches in the string. If one or more groups are present in the pattern, return a list of groups; this will be a list of tuples if the pattern has more than one group. Empty matches are included in the result.""" re...
def findall(pattern, string, flags=0): """Return a list of all non-overlapping matches in the string. If one or more groups are present in the pattern, return a list of groups; this will be a list of tuples if the pattern has more than one group. Empty matches are included in the result.""" re...
[ "Return", "a", "list", "of", "all", "non", "-", "overlapping", "matches", "in", "the", "string", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/re.py#L176-L193
[ "def", "findall", "(", "pattern", ",", "string", ",", "flags", "=", "0", ")", ":", "return", "_compile", "(", "pattern", ",", "flags", ")", ".", "findall", "(", "string", ")", "# if sys.hexversion >= 0x02020000:", "# __all__.append(\"finditer\")", "def", "fi...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
escape
Escape all non-alphanumeric characters in pattern.
third_party/stdlib/re.py
def escape(pattern): "Escape all non-alphanumeric characters in pattern." s = list(pattern) alphanum = _alphanum for i, c in enumerate(pattern): if c not in alphanum: if c == "\000": s[i] = "\\000" else: s[i] = "\\" + c return pattern[:...
def escape(pattern): "Escape all non-alphanumeric characters in pattern." s = list(pattern) alphanum = _alphanum for i, c in enumerate(pattern): if c not in alphanum: if c == "\000": s[i] = "\\000" else: s[i] = "\\" + c return pattern[:...
[ "Escape", "all", "non", "-", "alphanumeric", "characters", "in", "pattern", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/re.py#L211-L221
[ "def", "escape", "(", "pattern", ")", ":", "s", "=", "list", "(", "pattern", ")", "alphanum", "=", "_alphanum", "for", "i", ",", "c", "in", "enumerate", "(", "pattern", ")", ":", "if", "c", "not", "in", "alphanum", ":", "if", "c", "==", "\"\\000\""...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
Block.alloc_temp
Create a new temporary Go variable having type type_ for this block.
compiler/block.py
def alloc_temp(self, type_='*πg.Object'): """Create a new temporary Go variable having type type_ for this block.""" for v in sorted(self.free_temps, key=lambda k: k.name): if v.type_ == type_: self.free_temps.remove(v) self.used_temps.add(v) return v self.temp_index += 1 n...
def alloc_temp(self, type_='*πg.Object'): """Create a new temporary Go variable having type type_ for this block.""" for v in sorted(self.free_temps, key=lambda k: k.name): if v.type_ == type_: self.free_temps.remove(v) self.used_temps.add(v) return v self.temp_index += 1 n...
[ "Create", "a", "new", "temporary", "Go", "variable", "having", "type", "type_", "for", "this", "block", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/compiler/block.py#L108-L119
[ "def", "alloc_temp", "(", "self", ",", "type_", "=", "'*πg.Object')", ":", "", "for", "v", "in", "sorted", "(", "self", ".", "free_temps", ",", "key", "=", "lambda", "k", ":", "k", ".", "name", ")", ":", "if", "v", ".", "type_", "==", "type_", ":...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
Block.free_temp
Release the GeneratedTempVar v so it can be reused.
compiler/block.py
def free_temp(self, v): """Release the GeneratedTempVar v so it can be reused.""" self.used_temps.remove(v) self.free_temps.add(v)
def free_temp(self, v): """Release the GeneratedTempVar v so it can be reused.""" self.used_temps.remove(v) self.free_temps.add(v)
[ "Release", "the", "GeneratedTempVar", "v", "so", "it", "can", "be", "reused", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/compiler/block.py#L121-L124
[ "def", "free_temp", "(", "self", ",", "v", ")", ":", "self", ".", "used_temps", ".", "remove", "(", "v", ")", "self", ".", "free_temps", ".", "add", "(", "v", ")" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
parse_buffer
Like :meth:`parse`, but accepts a :class:`source.Buffer` instead of source and filename, and returns comments as well. :see: :meth:`parse` :return: (:class:`ast.AST`, list of :class:`source.Comment`) Abstract syntax tree and comments
third_party/pythonparser/__init__.py
def parse_buffer(buffer, mode="exec", flags=[], version=None, engine=None): """ Like :meth:`parse`, but accepts a :class:`source.Buffer` instead of source and filename, and returns comments as well. :see: :meth:`parse` :return: (:class:`ast.AST`, list of :class:`source.Comment`) Abstract sy...
def parse_buffer(buffer, mode="exec", flags=[], version=None, engine=None): """ Like :meth:`parse`, but accepts a :class:`source.Buffer` instead of source and filename, and returns comments as well. :see: :meth:`parse` :return: (:class:`ast.AST`, list of :class:`source.Comment`) Abstract sy...
[ "Like", ":", "meth", ":", "parse", "but", "accepts", "a", ":", "class", ":", "source", ".", "Buffer", "instead", "of", "source", "and", "filename", "and", "returns", "comments", "as", "well", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pythonparser/__init__.py#L5-L33
[ "def", "parse_buffer", "(", "buffer", ",", "mode", "=", "\"exec\"", ",", "flags", "=", "[", "]", ",", "version", "=", "None", ",", "engine", "=", "None", ")", ":", "if", "version", "is", "None", ":", "version", "=", "sys", ".", "version_info", "[", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
parse
Parse a string into an abstract syntax tree. This is the replacement for the built-in :meth:`..ast.parse`. :param source: (string) Source code in the correct encoding :param filename: (string) Filename of the source (used in diagnostics) :param mode: (string) Execution mode. Pass ``"exec"`` to parse a ...
third_party/pythonparser/__init__.py
def parse(source, filename="<unknown>", mode="exec", flags=[], version=None, engine=None): """ Parse a string into an abstract syntax tree. This is the replacement for the built-in :meth:`..ast.parse`. :param source: (string) Source code in the correct encoding :param filename: (string) F...
def parse(source, filename="<unknown>", mode="exec", flags=[], version=None, engine=None): """ Parse a string into an abstract syntax tree. This is the replacement for the built-in :meth:`..ast.parse`. :param source: (string) Source code in the correct encoding :param filename: (string) F...
[ "Parse", "a", "string", "into", "an", "abstract", "syntax", "tree", ".", "This", "is", "the", "replacement", "for", "the", "built", "-", "in", ":", "meth", ":", "..", "ast", ".", "parse", "." ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pythonparser/__init__.py#L35-L60
[ "def", "parse", "(", "source", ",", "filename", "=", "\"<unknown>\"", ",", "mode", "=", "\"exec\"", ",", "flags", "=", "[", "]", ",", "version", "=", "None", ",", "engine", "=", "None", ")", ":", "ast", ",", "comments", "=", "parse_buffer", "(", "pyt...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
encode
Uuencode file
third_party/stdlib/uu.py
def encode(in_file, out_file, name=None, mode=None): """Uuencode file""" # # If in_file is a pathname open it and change defaults # opened_files = [] try: if in_file == '-': in_file = sys.stdin elif isinstance(in_file, basestring): if name is None: ...
def encode(in_file, out_file, name=None, mode=None): """Uuencode file""" # # If in_file is a pathname open it and change defaults # opened_files = [] try: if in_file == '-': in_file = sys.stdin elif isinstance(in_file, basestring): if name is None: ...
[ "Uuencode", "file" ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/uu.py#L42-L87
[ "def", "encode", "(", "in_file", ",", "out_file", ",", "name", "=", "None", ",", "mode", "=", "None", ")", ":", "#", "# If in_file is a pathname open it and change defaults", "#", "opened_files", "=", "[", "]", "try", ":", "if", "in_file", "==", "'-'", ":", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
decode
Decode uuencoded file
third_party/stdlib/uu.py
def decode(in_file, out_file=None, mode=None, quiet=0): """Decode uuencoded file""" # # Open the input file, if needed. # opened_files = [] if in_file == '-': in_file = sys.stdin elif isinstance(in_file, basestring): in_file = open(in_file) opened_files.append(in_file...
def decode(in_file, out_file=None, mode=None, quiet=0): """Decode uuencoded file""" # # Open the input file, if needed. # opened_files = [] if in_file == '-': in_file = sys.stdin elif isinstance(in_file, basestring): in_file = open(in_file) opened_files.append(in_file...
[ "Decode", "uuencoded", "file" ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/uu.py#L90-L156
[ "def", "decode", "(", "in_file", ",", "out_file", "=", "None", ",", "mode", "=", "None", ",", "quiet", "=", "0", ")", ":", "#", "# Open the input file, if needed.", "#", "opened_files", "=", "[", "]", "if", "in_file", "==", "'-'", ":", "in_file", "=", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
capwords
capwords(s [,sep]) -> string Split the argument into words using split, capitalize each word using capitalize, and join the capitalized words using join. If the optional second argument sep is absent or None, runs of whitespace characters are replaced by a single space and leading and trailing whi...
third_party/stdlib/string.py
def capwords(s, sep=None): """capwords(s [,sep]) -> string Split the argument into words using split, capitalize each word using capitalize, and join the capitalized words using join. If the optional second argument sep is absent or None, runs of whitespace characters are replaced by a single spac...
def capwords(s, sep=None): """capwords(s [,sep]) -> string Split the argument into words using split, capitalize each word using capitalize, and join the capitalized words using join. If the optional second argument sep is absent or None, runs of whitespace characters are replaced by a single spac...
[ "capwords", "(", "s", "[", "sep", "]", ")", "-", ">", "string" ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/string.py#L47-L58
[ "def", "capwords", "(", "s", ",", "sep", "=", "None", ")", ":", "return", "(", "sep", "or", "' '", ")", ".", "join", "(", "x", ".", "capitalize", "(", ")", "for", "x", "in", "s", ".", "split", "(", "sep", ")", ")" ]
3ec87959189cfcdeae82eb68a47648ac25ceb10b
valid
maketrans
maketrans(frm, to) -> string Return a translation table (a string of 256 bytes long) suitable for use in string.translate. The strings frm and to must be of the same length.
third_party/stdlib/string.py
def maketrans(fromstr, tostr): """maketrans(frm, to) -> string Return a translation table (a string of 256 bytes long) suitable for use in string.translate. The strings frm and to must be of the same length. """ if len(fromstr) != len(tostr): raise ValueError, "maketrans arguments mus...
def maketrans(fromstr, tostr): """maketrans(frm, to) -> string Return a translation table (a string of 256 bytes long) suitable for use in string.translate. The strings frm and to must be of the same length. """ if len(fromstr) != len(tostr): raise ValueError, "maketrans arguments mus...
[ "maketrans", "(", "frm", "to", ")", "-", ">", "string" ]
google/grumpy
python
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/string.py#L63-L80
[ "def", "maketrans", "(", "fromstr", ",", "tostr", ")", ":", "if", "len", "(", "fromstr", ")", "!=", "len", "(", "tostr", ")", ":", "raise", "ValueError", ",", "\"maketrans arguments must have same length\"", "global", "_idmapL", "if", "not", "_idmapL", ":", ...
3ec87959189cfcdeae82eb68a47648ac25ceb10b