after_merge stringlengths 28 79.6k | before_merge stringlengths 20 79.6k | url stringlengths 38 71 | full_traceback stringlengths 43 922k | traceback_type stringclasses 555
values |
|---|---|---|---|---|
def dump(db, f, **options): # type: (canmatrix.CanMatrix, typing.IO, **typing.Any) -> None
"""
export canmatrix-object as .sym file (compatible to PEAK-Systems)
"""
sym_encoding = options.get("symExportEncoding", "iso-8859-1")
ignore_encoding_errors = options.get("ignoreEncodingErrors", "")
en... | def dump(db, f, **options): # type: (canmatrix.CanMatrix, typing.IO, **typing.Any) -> None
"""
export canmatrix-object as .sym file (compatible to PEAK-Systems)
"""
sym_encoding = options.get("symExportEncoding", "iso-8859-1")
ignore_encoding_errors = options.get("ignoreExportEncodingErrors", "")
... | https://github.com/ebroecker/canmatrix/issues/496 | canconvert --deleteZeroSignals --ignoreEncodingErrors --cutLongFrames=8 -vv file.arxml file.dbf
...
...
Traceback (most recent call last):
File "/usr/local/bin/canconvert", line 11, in <module>
load_entry_point('canmatrix==0.9.1', 'console_scripts', 'canconvert')()
File "/usr/local/lib/python3.8/site-packages/click/cor... | LookupError |
def cli_convert(infile, outfile, silent, verbosity, **options):
"""
canmatrix.cli.convert [options] import-file export-file
import-file: *.dbc|*.dbf|*.kcd|*.arxml|*.json|*.xls(x)|*.sym
export-file: *.dbc|*.dbf|*.kcd|*.arxml|*.json|*.xls(x)|*.sym|*.py
\n"""
root_logger = canmatrix.log.setup_lo... | def cli_convert(infile, outfile, silent, verbosity, **options):
"""
canmatrix.cli.convert [options] import-file export-file
import-file: *.dbc|*.dbf|*.kcd|*.arxml|*.json|*.xls(x)|*.sym
export-file: *.dbc|*.dbf|*.kcd|*.arxml|*.json|*.xls(x)|*.sym|*.py
\n"""
root_logger = canmatrix.log.setup_lo... | https://github.com/ebroecker/canmatrix/issues/496 | canconvert --deleteZeroSignals --ignoreEncodingErrors --cutLongFrames=8 -vv file.arxml file.dbf
...
...
Traceback (most recent call last):
File "/usr/local/bin/canconvert", line 11, in <module>
load_entry_point('canmatrix==0.9.1', 'console_scripts', 'canconvert')()
File "/usr/local/lib/python3.8/site-packages/click/cor... | LookupError |
def decode_can_helper(ea, float_factory, ignore_cluster_info):
found_matrixes = {}
if ignore_cluster_info is True:
ccs = [lxml.etree.Element("ignoreClusterInfo")] # type: typing.Sequence[_Element]
else:
ccs = ea.findall("CAN-CLUSTER")
for cc in ccs: # type: _Element
db = canmat... | def decode_can_helper(ea, float_factory, ignore_cluster_info):
found_matrixes = {}
if ignore_cluster_info is True:
ccs = [lxml.etree.Element("ignoreClusterInfo")] # type: typing.Sequence[_Element]
else:
ccs = ea.findall("CAN-CLUSTER")
for cc in ccs: # type: _Element
db = canmat... | https://github.com/ebroecker/canmatrix/issues/496 | canconvert --deleteZeroSignals --ignoreEncodingErrors --cutLongFrames=8 -vv file.arxml file.dbf
...
...
Traceback (most recent call last):
File "/usr/local/bin/canconvert", line 11, in <module>
load_entry_point('canmatrix==0.9.1', 'console_scripts', 'canconvert')()
File "/usr/local/lib/python3.8/site-packages/click/cor... | LookupError |
def dump(mydb, f, **options):
# type: (canmatrix.CanMatrix, typing.IO, **typing.Any) -> None
# create copy because export changes database
db = copy.deepcopy(mydb)
dbf_export_encoding = options.get("dbfExportEncoding", "iso-8859-1")
ignore_encoding_errors = options.get("ignoreEncodingErrors", "stric... | def dump(mydb, f, **options):
# type: (canmatrix.CanMatrix, typing.IO, **typing.Any) -> None
# create copy because export changes database
db = copy.deepcopy(mydb)
dbf_export_encoding = options.get("dbfExportEncoding", "iso-8859-1")
ignore_encoding_errors = options.get("ignoreEncodingErrors", "")
... | https://github.com/ebroecker/canmatrix/issues/496 | canconvert --deleteZeroSignals --ignoreEncodingErrors --cutLongFrames=8 -vv file.arxml file.dbf
...
...
Traceback (most recent call last):
File "/usr/local/bin/canconvert", line 11, in <module>
load_entry_point('canmatrix==0.9.1', 'console_scripts', 'canconvert')()
File "/usr/local/lib/python3.8/site-packages/click/cor... | LookupError |
def dump(db, f, **options): # type: (canmatrix.CanMatrix, typing.IO, **typing.Any) -> None
"""
export canmatrix-object as .sym file (compatible to PEAK-Systems)
"""
sym_encoding = options.get("symExportEncoding", "iso-8859-1")
ignore_encoding_errors = options.get("ignoreEncodingErrors", "strict")
... | def dump(db, f, **options): # type: (canmatrix.CanMatrix, typing.IO, **typing.Any) -> None
"""
export canmatrix-object as .sym file (compatible to PEAK-Systems)
"""
sym_encoding = options.get("symExportEncoding", "iso-8859-1")
ignore_encoding_errors = options.get("ignoreEncodingErrors", "")
en... | https://github.com/ebroecker/canmatrix/issues/496 | canconvert --deleteZeroSignals --ignoreEncodingErrors --cutLongFrames=8 -vv file.arxml file.dbf
...
...
Traceback (most recent call last):
File "/usr/local/bin/canconvert", line 11, in <module>
load_entry_point('canmatrix==0.9.1', 'console_scripts', 'canconvert')()
File "/usr/local/lib/python3.8/site-packages/click/cor... | LookupError |
def decode_compu_method(compu_method, ea, float_factory):
# type: (_Element, _DocRoot, str, _FloatFactory) -> typing.Tuple
values = {}
factor = float_factory(1.0)
offset = float_factory(0)
unit = ea.follow_ref(compu_method, "UNIT-REF")
const = None
compu_scales = ea.find_children_by_path(
... | def decode_compu_method(compu_method, ea, float_factory):
# type: (_Element, _DocRoot, str, _FloatFactory) -> typing.Tuple
values = {}
factor = float_factory(1.0)
offset = float_factory(0)
unit = ea.follow_ref(compu_method, "UNIT-REF")
const = None
compu_scales = ea.find_children_by_path(
... | https://github.com/ebroecker/canmatrix/issues/499 | Traceback (most recent call last):
File "/home/nostar/.local/bin/canconvert", line 11, in <module>
load_entry_point('canmatrix==0.9.1', 'console_scripts', 'canconvert')()
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.8/s... | ValueError |
def get_signals(signal_array, frame, ea, multiplex_id, float_factory, bit_offset=0):
# type: (typing.Sequence[_Element], canmatrix.Frame, _DocRoot, str, _MultiplexId, typing.Callable, int) -> None
"""Add signals from xml to the Frame."""
global signal_rxs
group_id = 1
if signal_array is None: # Emp... | def get_signals(signal_array, frame, ea, multiplex_id, float_factory, bit_offset=0):
# type: (typing.Sequence[_Element], canmatrix.Frame, _DocRoot, str, _MultiplexId, typing.Callable, int) -> None
"""Add signals from xml to the Frame."""
global signal_rxs
group_id = 1
if signal_array is None: # Emp... | https://github.com/ebroecker/canmatrix/issues/499 | Traceback (most recent call last):
File "/home/nostar/.local/bin/canconvert", line 11, in <module>
load_entry_point('canmatrix==0.9.1', 'console_scripts', 'canconvert')()
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.8/s... | ValueError |
def decode_can_helper(ea, float_factory, ignore_cluster_info):
found_matrixes = {}
if ignore_cluster_info is True:
ccs = [lxml.etree.Element("ignoreClusterInfo")] # type: typing.Sequence[_Element]
else:
ccs = ea.findall("CAN-CLUSTER")
for cc in ccs: # type: _Element
db = canmat... | def decode_can_helper(ea, float_factory, ignore_cluster_info):
found_matrixes = {}
if ignore_cluster_info is True:
ccs = [lxml.etree.Element("ignoreClusterInfo")] # type: typing.Sequence[_Element]
else:
ccs = ea.findall("CAN-CLUSTER")
for cc in ccs: # type: _Element
db = canmat... | https://github.com/ebroecker/canmatrix/issues/499 | Traceback (most recent call last):
File "/home/nostar/.local/bin/canconvert", line 11, in <module>
load_entry_point('canmatrix==0.9.1', 'console_scripts', 'canconvert')()
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.8/s... | ValueError |
def decode_number(value, float_factory): # type(string) -> (int)
"""
Decode string to integer and guess correct base
:param value: string input value
:return: integer
"""
value = value.strip()
if "." in value:
return float_factory(value)
base = 10
if len(value) > 1 and va... | def decode_number(value): # type(string) -> (int)
"""
Decode string to integer and guess correct base
:param value: string input value
:return: integer
"""
value = value.strip()
base = 10
if len(value) > 1 and value[1] == "b": # bin coded
base = 2
value = value[2:]
... | https://github.com/ebroecker/canmatrix/issues/499 | Traceback (most recent call last):
File "/home/nostar/.local/bin/canconvert", line 11, in <module>
load_entry_point('canmatrix==0.9.1', 'console_scripts', 'canconvert')()
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.8/s... | ValueError |
def load(filename, **options):
from sys import modules
# use xlrd excel reader if available, because its more robust
try:
import canmatrix.xls
return canmatrix.xls.load(filename, **options)
except:
logger.error(
"xlsx: using legacy xlsx-reader - please get xlrd work... | def load(filename, **options):
from sys import modules
# use xlrd excel reader if available, because its more robust
try:
import canmatrix.xls
return canmatrix.xls.load(filename, **options)
except:
logger.error(
"xlsx: using legacy xlsx-reader - please get xlrd work... | https://github.com/ebroecker/canmatrix/issues/178 | D:\test>python convert.py input.xlsx aa.dbc
ERROR - formats - This file format is not supported for reading
Traceback (most recent call last):
File "convert.py", line 6, in <module>
canmatrix.convert.main()
File "C:\Users\khoa\AppData\Local\Programs\Python\Python36\lib\site-packages\canmatrix-0+unknown-py3.6.egg\canmat... | TypeError |
def load(filename, **options):
from sys import modules
# use xlrd excel reader if available, because its more robust
if "xlsxLegacy" in options and options["xlsxLegacy"] == True:
logger.error(
"xlsx: using legacy xlsx-reader - please get xlrd working for better results!"
)
e... | def load(filename, **options):
from sys import modules
# use xlrd excel reader if available, because its more robust
# try:
# import canmatrix.xls
# return canmatrix.xls.load(filename, **options)
# except:
# logger.error("xlsx: using legacy xlsx-reader - please ge... | https://github.com/ebroecker/canmatrix/issues/178 | D:\test>python convert.py input.xlsx aa.dbc
ERROR - formats - This file format is not supported for reading
Traceback (most recent call last):
File "convert.py", line 6, in <module>
canmatrix.convert.main()
File "C:\Users\khoa\AppData\Local\Programs\Python\Python36\lib\site-packages\canmatrix-0+unknown-py3.6.egg\canmat... | TypeError |
def dump(dbs, f, **options):
if "arVersion" in options:
arVersion = options["arVersion"]
else:
arVersion = "3.2.3"
for name in dbs:
db = dbs[name]
for frame in db.frames:
for signal in frame.signals:
for rec in signal.receiver:
... | def dump(dbs, f, **options):
if "arVersion" in options:
arVersion = options["arVersion"]
else:
arVersion = "3.2.3"
for name in dbs:
db = dbs[name]
for frame in db.frames:
for signal in frame.signals:
for rec in signal.receiver:
... | https://github.com/ebroecker/canmatrix/issues/108 | C:\Users\abartz\Desktop\CAN Test Grounds>canconvert --merge=test.dbc j1939.dbc target.dbc
Traceback (most recent call last):
File "C:\Users\abartz\AppData\Local\Programs\Python\Python36-32\Scripts\canconvert-script.py", line 11, in <module>
load_entry_point('canmatrix==0.6.1rc0', 'console_scripts', 'canconvert')()
File... | ValueError |
def dump(db, thefile, delimiter=",", **options):
head_top = [
"ID",
"Frame Name",
"Cycle Time [ms]",
"Launch Type",
"Launch Parameter",
"Signal Byte No.",
"Signal Bit No.",
"Signal Name",
"Signal Function",
"Signal Length [Bit]",
... | def dump(db, thefile, delimiter=",", **options):
head_top = [
"ID",
"Frame Name",
"Cycle Time [ms]",
"Launch Type",
"Launch Parameter",
"Signal Byte No.",
"Signal Bit No.",
"Signal Name",
"Signal Function",
"Signal Length [Bit]",
... | https://github.com/ebroecker/canmatrix/issues/108 | C:\Users\abartz\Desktop\CAN Test Grounds>canconvert --merge=test.dbc j1939.dbc target.dbc
Traceback (most recent call last):
File "C:\Users\abartz\AppData\Local\Programs\Python\Python36-32\Scripts\canconvert-script.py", line 11, in <module>
load_entry_point('canmatrix==0.6.1rc0', 'console_scripts', 'canconvert')()
File... | ValueError |
def dump(db, f, **options):
if "dbfExportEncoding" in options:
dbfExportEncoding = options["dbfExportEncoding"]
else:
dbfExportEncoding = "iso-8859-1"
outstr = """//******************************BUSMASTER Messages and signals Database ******************************//
[DATABASE_VERSION] 1.3... | def dump(db, f, **options):
if "dbfExportEncoding" in options:
dbfExportEncoding = options["dbfExportEncoding"]
else:
dbfExportEncoding = "iso-8859-1"
outstr = """//******************************BUSMASTER Messages and signals Database ******************************//
[DATABASE_VERSION] 1.3... | https://github.com/ebroecker/canmatrix/issues/108 | C:\Users\abartz\Desktop\CAN Test Grounds>canconvert --merge=test.dbc j1939.dbc target.dbc
Traceback (most recent call last):
File "C:\Users\abartz\AppData\Local\Programs\Python\Python36-32\Scripts\canconvert-script.py", line 11, in <module>
load_entry_point('canmatrix==0.6.1rc0', 'console_scripts', 'canconvert')()
File... | ValueError |
def dump(db, file, **options):
head_top = [
"ID",
"Frame Name",
"Cycle Time [ms]",
"Launch Type",
"Launch Parameter",
"Signal Byte No.",
"Signal Bit No.",
"Signal Name",
"Signal Function",
"Signal Length [Bit]",
"Signal Default"... | def dump(db, file, **options):
head_top = [
"ID",
"Frame Name",
"Cycle Time [ms]",
"Launch Type",
"Launch Parameter",
"Signal Byte No.",
"Signal Bit No.",
"Signal Name",
"Signal Function",
"Signal Length [Bit]",
"Signal Default"... | https://github.com/ebroecker/canmatrix/issues/108 | C:\Users\abartz\Desktop\CAN Test Grounds>canconvert --merge=test.dbc j1939.dbc target.dbc
Traceback (most recent call last):
File "C:\Users\abartz\AppData\Local\Programs\Python\Python36-32\Scripts\canconvert-script.py", line 11, in <module>
load_entry_point('canmatrix==0.6.1rc0', 'console_scripts', 'canconvert')()
File... | ValueError |
def dump(db, filename, **options):
if "xlsMotorolaBitFormat" in options:
motorolaBitFormat = options["xlsMotorolaBitFormat"]
else:
motorolaBitFormat = "msbreverse"
head_top = [
"ID",
"Frame Name",
"Cycle Time [ms]",
"Launch Type",
"Launch Parameter",
... | def dump(db, filename, **options):
if "xlsMotorolaBitFormat" in options:
motorolaBitFormat = options["xlsMotorolaBitFormat"]
else:
motorolaBitFormat = "msbreverse"
head_top = [
"ID",
"Frame Name",
"Cycle Time [ms]",
"Launch Type",
"Launch Parameter",
... | https://github.com/ebroecker/canmatrix/issues/108 | C:\Users\abartz\Desktop\CAN Test Grounds>canconvert --merge=test.dbc j1939.dbc target.dbc
Traceback (most recent call last):
File "C:\Users\abartz\AppData\Local\Programs\Python\Python36-32\Scripts\canconvert-script.py", line 11, in <module>
load_entry_point('canmatrix==0.6.1rc0', 'console_scripts', 'canconvert')()
File... | ValueError |
def dump(db, f, **options):
if "dbcExportEncoding" in options:
dbcExportEncoding = options["dbcExportEncoding"]
else:
dbcExportEncoding = "iso-8859-1"
if "dbcExportCommentEncoding" in options:
dbcExportCommentEncoding = options["dbcExportCommentEncoding"]
else:
dbcExportC... | def dump(db, f, **options):
if "dbcExportEncoding" in options:
dbcExportEncoding = options["dbcExportEncoding"]
else:
dbcExportEncoding = "iso-8859-1"
if "dbcExportCommentEncoding" in options:
dbcExportCommentEncoding = options["dbcExportCommentEncoding"]
else:
dbcExportC... | https://github.com/ebroecker/canmatrix/issues/108 | C:\Users\abartz\Desktop\CAN Test Grounds>canconvert --merge=test.dbc j1939.dbc target.dbc
Traceback (most recent call last):
File "C:\Users\abartz\AppData\Local\Programs\Python\Python36-32\Scripts\canconvert-script.py", line 11, in <module>
load_entry_point('canmatrix==0.6.1rc0', 'console_scripts', 'canconvert')()
File... | ValueError |
def getSignals(signalarray, Bo, arDict, ns, multiplexId):
GroupId = 1
if signalarray is None: # Empty signalarray - nothing to do
return
for signal in signalarray:
values = {}
motorolla = arGetChild(signal, "PACKING-BYTE-ORDER", arDict, ns)
startBit = arGetChild(signal, "STA... | def getSignals(signalarray, Bo, arDict, ns, multiplexId):
GroupId = 1
if signalarray is None: # Empty signalarray - nothing to do
return
for signal in signalarray:
values = {}
motorolla = arGetChild(signal, "PACKING-BYTE-ORDER", arDict, ns)
startBit = arGetChild(signal, "STA... | https://github.com/ebroecker/canmatrix/issues/104 | canconvert --deleteZeroSignals -vv file.arxml file.dbc
INFO - formats - xlsx is not supported
INFO - formats - yaml is not supported
INFO - convert - Importing file.arxml ...
DEBUG - arxml - Read arxml ...
DEBUG - arxml - Done
DEBUG - arxml - Build arTree ...
DEBUG - arxml - Done
DEBUG - arxml - DEBUG 160 frames in... | AttributeError |
def _parse_import_alias(cls, leaves):
assert leaves[-2].value == "as"
name = "".join(leaf.value for leaf in leaves[:-2])
return (name, leaves[-1].value)
| def _parse_import_alias(cls, leaves):
assert [leaf.type for leaf in leaves] == [token.NAME] * 3
assert leaves[1].value == "as"
return (leaves[0].value, leaves[2].value)
| https://github.com/google/pytype/issues/706 | $ cat import-bug.py
import collections.abc as abc
$ cat import-bug.pyi
import collections.abc as abc
$ pytype --version
2020.10.08
$ merge-pyi import-bug.py import-bug.pyi
Traceback (most recent call last):
File "/Users/shane/pymongo-pycharm-3.8/bin/merge-pyi", line 8, in <module>
sys.exit(main())
File "/Users/shane/py... | AssertionError |
def parse_top_import(cls, results):
"""Splits the result of import_pattern into component strings.
Examples:
'from pkg import a,b,c' gives
(('pkg', None), [('a', None), ('b', None), ('c', None)])
'import pkg' gives
(('pkg', None), [])
'from pkg import a as b' gives
(('pkg', None), [(... | def parse_top_import(cls, results):
"""Splits the result of import_pattern into component strings.
Examples:
'from pkg import a,b,c' gives
(('pkg', None), [('a', None), ('b', None), ('c', None)])
'import pkg' gives
(('pkg', None), [])
'from pkg import a as b' gives
(('pkg', None), [(... | https://github.com/google/pytype/issues/706 | $ cat import-bug.py
import collections.abc as abc
$ cat import-bug.pyi
import collections.abc as abc
$ pytype --version
2020.10.08
$ merge-pyi import-bug.py import-bug.pyi
Traceback (most recent call last):
File "/Users/shane/pymongo-pycharm-3.8/bin/merge-pyi", line 8, in <module>
sys.exit(main())
File "/Users/shane/py... | AssertionError |
def Bindings(self, viewpoint, strict=True):
"""Filters down the possibilities of bindings for this variable.
It determines this by analyzing the control flow graph. Any definition for
this variable that is invisible from the current point in the CFG is
filtered out. This function differs from Filter() ... | def Bindings(self, viewpoint, strict=True):
"""Filters down the possibilities of bindings for this variable.
It determines this by analyzing the control flow graph. Any definition for
this variable that is invisible from the current point in the CFG is
filtered out. This function differs from Filter() ... | https://github.com/google/pytype/issues/669 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'set' object has no attribute 'extend'
# Traceback (most recent call last):
# File "/home/manu/.local/lib/python3.8/site-packages/pytype/io.py", line 156, in check_or_generate_pyi
# errorlog, result, ast = generate_pyi(
# Fi... | AttributeError |
def __enter__(self):
self._start_time = get_cpu_clock()
| def __enter__(self):
self._start_time = time.clock()
| https://github.com/google/pytype/issues/466 | $ pytype --config ./setup.cfg -V 3.7 ./*.py ./gramhopper ./tests
Computing dependencies
Analyzing 44 sources with 0 local dependencies
ninja: Entering directory `/code/python/gramhopper/.pytype'
[1/44] check gramhopper.gramhopper.responses.response_helper
FAILED: /code/python/gramhopper/.pytype/pyi/gramhopper/gramhopp... | AttributeError |
def __exit__(self, exc_type, exc_value, traceback):
self._total = get_cpu_clock() - self._start_time
del self._start_time
| def __exit__(self, exc_type, exc_value, traceback):
self._total = time.clock() - self._start_time
del self._start_time
| https://github.com/google/pytype/issues/466 | $ pytype --config ./setup.cfg -V 3.7 ./*.py ./gramhopper ./tests
Computing dependencies
Analyzing 44 sources with 0 local dependencies
ninja: Entering directory `/code/python/gramhopper/.pytype'
[1/44] check gramhopper.gramhopper.responses.response_helper
FAILED: /code/python/gramhopper/.pytype/pyi/gramhopper/gramhopp... | AttributeError |
def __enter__(self):
if not self._calls:
self._start_time = get_cpu_clock()
self._calls += 1
| def __enter__(self):
if not self._calls:
self._start_time = time.clock()
self._calls += 1
| https://github.com/google/pytype/issues/466 | $ pytype --config ./setup.cfg -V 3.7 ./*.py ./gramhopper ./tests
Computing dependencies
Analyzing 44 sources with 0 local dependencies
ninja: Entering directory `/code/python/gramhopper/.pytype'
[1/44] check gramhopper.gramhopper.responses.response_helper
FAILED: /code/python/gramhopper/.pytype/pyi/gramhopper/gramhopp... | AttributeError |
def __exit__(self, exc_type, exc_value, traceback):
self._calls -= 1
if not self._calls:
self._time += get_cpu_clock() - self._start_time
del self._start_time
| def __exit__(self, exc_type, exc_value, traceback):
self._calls -= 1
if not self._calls:
self._time += time.clock() - self._start_time
del self._start_time
| https://github.com/google/pytype/issues/466 | $ pytype --config ./setup.cfg -V 3.7 ./*.py ./gramhopper ./tests
Computing dependencies
Analyzing 44 sources with 0 local dependencies
ninja: Entering directory `/code/python/gramhopper/.pytype'
[1/44] check gramhopper.gramhopper.responses.response_helper
FAILED: /code/python/gramhopper/.pytype/pyi/gramhopper/gramhopp... | AttributeError |
def _Visit(node, visitor, *args, **kwargs):
"""Visit the node."""
name = type(visitor).__name__
recursive = name in _visiting
_visiting.add(name)
start = metrics.get_cpu_clock()
try:
return _VisitNode(node, visitor, *args, **kwargs)
finally:
if not recursive:
_vi... | def _Visit(node, visitor, *args, **kwargs):
"""Visit the node."""
name = type(visitor).__name__
recursive = name in _visiting
_visiting.add(name)
start = time.clock()
try:
return _VisitNode(node, visitor, *args, **kwargs)
finally:
if not recursive:
_visiting.remo... | https://github.com/google/pytype/issues/466 | $ pytype --config ./setup.cfg -V 3.7 ./*.py ./gramhopper ./tests
Computing dependencies
Analyzing 44 sources with 0 local dependencies
ninja: Entering directory `/code/python/gramhopper/.pytype'
[1/44] check gramhopper.gramhopper.responses.response_helper
FAILED: /code/python/gramhopper/.pytype/pyi/gramhopper/gramhopp... | AttributeError |
def __init__(self, name, vm):
"""Basic initializer for all AtomicAbstractValues."""
super(AtomicAbstractValue, self).__init__(vm)
assert hasattr(vm, "program"), type(self)
self.cls = None
self.name = name
self.mro = self.compute_mro()
self.module = None
self.official_name = None
self... | def __init__(self, name, vm):
"""Basic initializer for all AtomicAbstractValues."""
super(AtomicAbstractValue, self).__init__(vm)
assert hasattr(vm, "program"), type(self)
self.cls = None
self.name = name
self.mro = self.compute_mro()
self.module = None
self.official_name = None
self... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def instantiate(self, node, container=None):
var = self.vm.program.NewVariable()
if container and (
not isinstance(container, SimpleAbstractValue)
or self.full_name in container.all_template_names
):
instance = TypeParameterInstance(self, container, self.vm)
return instance.t... | def instantiate(self, node, container=None):
if self.has_late_types():
frame = self.vm.frame
self.resolve_late_types(node, frame.f_globals, frame.f_locals)
var = self.vm.program.NewVariable()
if container and (
not isinstance(container, SimpleAbstractValue)
or self.full_name ... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def _build_value(self, node, raw_inner, ellipses):
if self.base_cls.is_late_annotation():
# A parameterized LateAnnotation should be converted to another
# LateAnnotation to delay evaluation until the first late annotation is
# resolved. We don't want to create a ParameterizedClass immediate... | def _build_value(self, node, raw_inner, ellipses):
template, inner, abstract_class = self._get_value_info(raw_inner, ellipses)
if self.base_cls.full_name == "typing.Generic":
# Generic is unique in that parameterizing it defines a new template;
# usually, the parameterized class inherits the bas... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def _load_formal_type_parameters(self):
if self._formal_type_parameters_loaded:
return
if isinstance(
self._formal_type_parameters, abstract_utils.LazyFormalTypeParameters
):
formal_type_parameters = {}
for name, param in self._raw_formal_type_parameters():
if par... | def _load_formal_type_parameters(self):
if self._formal_type_parameters_loaded:
return
if isinstance(
self._formal_type_parameters, abstract_utils.LazyFormalTypeParameters
):
formal_type_parameters = {}
for name, param in self._raw_formal_type_parameters():
if par... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def make(
cls,
name,
code,
f_locals,
f_globals,
defaults,
kw_defaults,
closure,
annotations,
vm,
):
"""Get an InterpreterFunction.
Things like anonymous functions and generator expressions are created
every time the corresponding code executes. Caching them makes it ... | def make(
cls,
name,
code,
f_locals,
f_globals,
defaults,
kw_defaults,
closure,
annotations,
late_annotations,
vm,
):
"""Get an InterpreterFunction.
Things like anonymous functions and generator expressions are created
every time the corresponding code executes. ... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def __init__(
self,
name,
code,
f_locals,
f_globals,
defaults,
kw_defaults,
closure,
annotations,
overloads,
vm,
):
log.debug("Creating InterpreterFunction %r for %r", name, code.co_name)
self.bound_class = BoundInterpreterFunction
self.doc = code.co_consts[0] if ... | def __init__(
self,
name,
code,
f_locals,
f_globals,
defaults,
kw_defaults,
closure,
annotations,
late_annotations,
overloads,
vm,
):
log.debug("Creating InterpreterFunction %r for %r", name, code.co_name)
self.bound_class = BoundInterpreterFunction
self.doc =... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def _build_signature(self, name, annotations):
"""Build a function.Signature object representing this function."""
vararg_name = None
kwarg_name = None
kwonly = set(self.code.co_varnames[self.code.co_argcount : self.nonstararg_count])
arg_pos = self.nonstararg_count
if self.has_varargs():
... | def _build_signature(self, name, annotations, late_annotations):
"""Build a function.Signature object representing this function."""
vararg_name = None
kwarg_name = None
kwonly = set(self.code.co_varnames[self.code.co_argcount : self.nonstararg_count])
arg_pos = self.nonstararg_count
if self.has... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def __init__(
self,
name,
param_names,
varargs_name,
kwonly_params,
kwargs_name,
defaults,
annotations,
vm,
):
"""Create a SimpleFunction.
Args:
name: Name of the function as a string
param_names: Tuple of parameter names as strings.
varargs_name: The "args... | def __init__(
self,
name,
param_names,
varargs_name,
kwonly_params,
kwargs_name,
defaults,
annotations,
late_annotations,
vm,
):
"""Create a SimpleFunction.
Args:
name: Name of the function as a string
param_names: Tuple of parameter names as strings.
v... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def call_init(self, node, instance):
# Call __init__ on each binding.
# TODO(kramm): This should do join_cfg_nodes, instead of concatenating them.
for b in instance.bindings:
if b.data in self._initialized_instances:
continue
self._initialized_instances.add(b.data)
node =... | def call_init(self, node, instance):
# Call __init__ on each binding.
# TODO(kramm): This should do join_cfg_nodes, instead of concatenating them.
for b in instance.bindings:
if b.data in self._initialized_instances:
continue
self._initialized_instances.add(b.data)
if isi... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def sub_one_annotation(self, node, annot, substs, instantiate_unbound=True):
"""Apply type parameter substitutions to an annotation."""
if isinstance(annot, abstract.TypeParameter):
def contains(subst, annot):
return (
annot.full_name in subst
and subst[annot... | def sub_one_annotation(self, node, annot, substs, instantiate_unbound=True):
"""Apply type parameter substitutions to an annotation."""
if isinstance(annot, abstract.TypeParameter):
def contains(subst, annot):
return (
annot.full_name in subst
and subst[annot... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def convert_function_annotations(self, node, raw_annotations):
"""Convert raw annotations to a {name: annotation} dict."""
if raw_annotations:
# {"i": int, "return": str} is stored as (int, str, ("i", "return"))
names = abstract_utils.get_atomic_python_constant(raw_annotations[-1])
type_... | def convert_function_annotations(self, node, raw_annotations):
"""Convert raw annotations to dicts of annotations and late annotations."""
if raw_annotations:
# {"i": int, "return": str} is stored as (int, str, ("i", "return"))
names = abstract_utils.get_atomic_python_constant(raw_annotations[-1... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def convert_annotations_list(self, node, annotations_list):
"""Convert a (name, raw_annot) list to a {name: annotation} dict."""
annotations = {}
for name, t in annotations_list:
if t is None:
continue
annot = self._process_one_annotation(node, t, name, self.vm.simple_stack())
... | def convert_annotations_list(self, node, annotations_list):
"""Convert a (name, raw_annot) list to annotations and late annotations."""
annotations = {}
late_annotations = {}
for name, t in annotations_list:
if t is None:
continue
try:
annot = self._process_one_an... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def convert_class_annotations(self, node, raw_annotations):
"""Convert a name -> raw_annot dict to annotations."""
annotations = {}
for name, t in raw_annotations.items():
# Don't use the parameter name, since it's often something unhelpful
# like `0`.
annot = self._process_one_annot... | def convert_class_annotations(self, node, raw_annotations):
"""Convert a name -> raw_annot dict to annotations."""
annotations = {}
for name, t in raw_annotations.items():
try:
# Don't use the parameter name, since it's often something unhelpful
# like `0`.
annot ... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def init_annotation_var(self, node, name, var):
"""Instantiate a variable of an annotation, calling __init__."""
try:
typ = abstract_utils.get_atomic_value(var)
except abstract_utils.ConversionError:
error = "Type must be constant for variable annotation"
self.vm.errorlog.invalid_ann... | def init_annotation_var(self, node, name, var):
"""Instantiate a variable of an annotation, calling __init__."""
try:
typ = abstract_utils.get_atomic_value(var)
except abstract_utils.ConversionError:
error = "Type must be constant for variable annotation"
self.vm.errorlog.invalid_ann... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def apply_type_comment(self, state, op, name, value):
"""If there is a type comment for the op, return its value."""
assert op is self.vm.frame.current_opcode
if op.code.co_filename != self.vm.filename:
return value
if not op.type_comment:
return value
comment = op.type_comment
f... | def apply_type_comment(self, state, op, name, value):
"""If there is a type comment for the op, return its value."""
assert op is self.vm.frame.current_opcode
if op.code.co_filename != self.vm.filename:
return value
if not op.type_comment:
return value
comment = op.type_comment
f... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def _process_one_annotation(self, node, annotation, name, stack, seen=None):
"""Change annotation / record errors where required."""
# Make sure we pass in a frozen snapshot of the frame stack, rather than the
# actual stack, since late annotations need to snapshot the stack at time of
# creation in ord... | def _process_one_annotation(
self, node, annotation, name, stack, f_globals=None, f_locals=None, seen=None
):
"""Change annotation / record errors where required."""
# Check for recursive type annotations so we can emit an error message
# rather than crashing.
if seen is None:
seen = set()
... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def _eval_expr_as_tuple(self, node, expr):
"""Evaluate an expression as a tuple."""
if not expr:
return ()
f_globals, f_locals = self.vm.frame.f_globals, self.vm.frame.f_locals
result = abstract_utils.get_atomic_value(
abstract_utils.eval_expr(self.vm, node, f_globals, f_locals, expr)
... | def _eval_expr_as_tuple(self, node, f_globals, f_locals, expr):
"""Evaluate an expression as a tuple."""
if not expr:
return ()
result = abstract_utils.get_atomic_value(
abstract_utils.eval_expr(self.vm, node, f_globals, f_locals, expr)
)
# If the result is a tuple, expand it.
i... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def get_attribute(self, node, obj, name, valself=None):
"""Get the named attribute from the given object.
Args:
node: The current CFG node.
obj: The object.
name: The name of the attribute to retrieve.
valself: A cfg.Binding to a self reference to include in the attribute's
orig... | def get_attribute(self, node, obj, name, valself=None):
"""Get the named attribute from the given object.
Args:
node: The current CFG node.
obj: The object.
name: The name of the attribute to retrieve.
valself: A cfg.Binding to a self reference to include in the attribute's
orig... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def set_attribute(self, node, obj, name, value):
"""Set an attribute on an object.
The attribute might already have a Variable in it and in that case we cannot
overwrite it and instead need to add the elements of the new variable to the
old variable.
Args:
node: The current CFG node.
o... | def set_attribute(self, node, obj, name, value):
"""Set an attribute on an object.
The attribute might already have a Variable in it and in that case we cannot
overwrite it and instead need to add the elements of the new variable to the
old variable.
Args:
node: The current CFG node.
o... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def _print_as_expected_type(self, t, instance=None):
"""Print abstract value t as a pytd type."""
if t.is_late_annotation():
return t.expr
elif isinstance(
t, (abstract.Unknown, abstract.Unsolvable, mixin.Class, abstract.Union)
):
with t.vm.convert.pytd_convert.produce_detailed_o... | def _print_as_expected_type(self, t, instance=None):
"""Print abstract value t as a pytd type."""
if isinstance(
t, (abstract.Unknown, abstract.Unsolvable, mixin.Class, abstract.Union)
):
with t.vm.convert.pytd_convert.produce_detailed_output():
return self._pytd_print(t.get_inst... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def __init__(
self,
name,
param_names,
varargs_name,
kwonly_params,
kwargs_name,
defaults,
annotations,
postprocess_annotations=True,
):
self.name = name
self.param_names = param_names
self.varargs_name = varargs_name
self.kwonly_params = kwonly_params
self.kwargs... | def __init__(
self,
name,
param_names,
varargs_name,
kwonly_params,
kwargs_name,
defaults,
annotations,
late_annotations,
postprocess_annotations=True,
):
self.name = name
self.param_names = param_names
self.varargs_name = varargs_name
self.kwonly_params = kwonly_... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def from_pytd(cls, vm, name, sig):
"""Construct an abstract signature from a pytd signature."""
# TODO(kramm): templates
pytd_annotations = [
(p.name, p.type)
for p in sig.params + (sig.starargs, sig.starstarargs)
if p is not None
]
pytd_annotations.append(("return", sig.retu... | def from_pytd(cls, vm, name, sig):
"""Construct an abstract signature from a pytd signature."""
# TODO(kramm): templates
pytd_annotations = [
(p.name, p.type)
for p in sig.params + (sig.starargs, sig.starstarargs)
if p is not None
]
pytd_annotations.append(("return", sig.retu... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def from_callable(cls, val):
annotations = {
argname(i): val.formal_type_parameters[i] for i in range(val.num_args)
}
return cls(
name="<callable>",
param_names=tuple(sorted(annotations)),
varargs_name=None,
kwonly_params=set(),
kwargs_name=None,
defau... | def from_callable(cls, val):
annotations = {
argname(i): val.formal_type_parameters[i] for i in range(val.num_args)
}
return cls(
name="<callable>",
param_names=tuple(sorted(annotations)),
varargs_name=None,
kwonly_params=set(),
kwargs_name=None,
defau... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def from_param_names(cls, name, param_names):
"""Construct a minimal signature from a name and a list of param names."""
return cls(
name=name,
param_names=tuple(param_names),
varargs_name=None,
kwonly_params=set(),
kwargs_name=None,
defaults={},
annotatio... | def from_param_names(cls, name, param_names):
"""Construct a minimal signature from a name and a list of param names."""
return cls(
name=name,
param_names=tuple(param_names),
varargs_name=None,
kwonly_params=set(),
kwargs_name=None,
defaults={},
annotatio... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def _print_annot(self, name):
return _print(self.annotations[name]) if name in self.annotations else None
| def _print_annot(self, name):
if name in self.annotations:
return _print(self.annotations[name])
elif name in self.late_annotations:
return repr(self.late_annotations[name].expr)
else:
return None
| https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def make_method(
vm,
node,
name,
params=None,
kwonly_params=None,
return_type=None,
self_param=None,
varargs=None,
kwargs=None,
):
"""Make a method from params.
Args:
vm: vm
node: Node to create the method variable at
name: The method name
params: Pos... | def make_method(
vm,
node,
name,
params=None,
kwonly_params=None,
return_type=None,
self_param=None,
varargs=None,
kwargs=None,
):
"""Make a method from params.
Args:
vm: vm
node: Node to create the method variable at
name: The method name
params: Pos... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def _process_annotation(param):
"""Process a single param into annotations."""
if not param.typ:
return
elif isinstance(param.typ, cfg.Variable):
if all(t.cls for t in param.typ.data):
types = param.typ.data
if len(types) == 1:
annotations[param.name] ... | def _process_annotation(param):
"""Process a single param into either annotations or late_annotations."""
if not param.typ:
return
elif isinstance(param.typ, cfg.Variable):
if all(t.cls for t in param.typ.data):
types = param.typ.data
if len(types) == 1:
... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def decorate(self, node, cls):
"""Processes the attrib members of a class."""
# Collect classvars to convert them to attrs.
if self.args[cls]["auto_attribs"]:
ordering = classgen.Ordering.FIRST_ANNOTATE
else:
ordering = classgen.Ordering.LAST_ASSIGN
ordered_locals = self.get_class_lo... | def decorate(self, node, cls):
"""Processes the attrib members of a class."""
# Collect classvars to convert them to attrs.
if self.args[cls]["auto_attribs"]:
ordering = classgen.Ordering.FIRST_ANNOTATE
else:
ordering = classgen.Ordering.LAST_ASSIGN
ordered_locals = self.get_class_lo... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def _instantiate_type(self, node, args, type_var):
cls = self.vm.annotations_util.process_annotation_var(
node, type_var, "attr.ib", self.vm.simple_stack()
)
_, instance = self.vm.init_class(node, cls.data[0])
return instance
| def _instantiate_type(self, node, args, type_var):
cls = type_var.data[0]
try:
return self.vm.annotations_util.init_annotation(
node, cls, "attr.ib", self.vm.frames
)
except self.vm.annotations_util.LateAnnotationError:
return abstract.LateAnnotation(cls, "attr.ib", self.... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def is_attrib(var):
return var and isinstance(var.data[0], AttribInstance)
| def is_attrib(var):
if var is None or classgen.is_late_annotation(var):
return False
return isinstance(var.data[0], AttribInstance)
| https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def is_method(var):
if var is None:
return False
return isinstance(
var.data[0],
(
abstract.INTERPRETER_FUNCTION_TYPES,
special_builtins.ClassMethodInstance,
special_builtins.PropertyInstance,
special_builtins.StaticMethodInstance,
... | def is_method(var):
if var is None or is_late_annotation(var):
return False
return isinstance(
var.data[0],
(
abstract.INTERPRETER_FUNCTION_TYPES,
special_builtins.ClassMethodInstance,
special_builtins.PropertyInstance,
special_builtins.Sta... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def decorate(self, node, cls):
"""Processes class members."""
# Collect classvars to convert them to attrs. @dataclass collects vars with
# an explicit type annotation, in order of annotation, so that e.g.
# class A:
# x: int
# y: str = 'hello'
# x = 10
# would have init(x:int = 1... | def decorate(self, node, cls):
"""Processes class members."""
# Collect classvars to convert them to attrs. @dataclass collects vars with
# an explicit type annotation, in order of annotation, so that e.g.
# class A:
# x: int
# y: str = 'hello'
# x = 10
# would have init(x:int = 1... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def is_field(var):
return var and isinstance(var.data[0], FieldInstance)
| def is_field(var):
if var is None or classgen.is_late_annotation(var):
return False
return isinstance(var.data[0], FieldInstance)
| https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def _get_annotation(self, node, var, name):
with self.vm.errorlog.checkpoint() as record:
retvar = self.vm.annotations_util.process_annotation_var(
node, var, name, self.vm.simple_stack()
)
if record.errors:
raise TypeVarError("\n".join(error.message for error in record.error... | def _get_annotation(self, var, name):
try:
ret = abstract_utils.get_atomic_value(var, self._CLASS_TYPE)
if isinstance(ret, abstract.AbstractOrConcreteValue):
ret = abstract_utils.get_atomic_python_constant(var, six.string_types)
except abstract_utils.ConversionError:
raise Ty... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def _get_namedarg(self, node, args, name, default_value):
if name not in args.namedargs:
return default_value
if name == "bound":
return self._get_annotation(node, args.namedargs[name], name)
else:
ret = self._get_constant(args.namedargs[name], name, bool)
# This error is log... | def _get_namedarg(self, args, name, default_value):
if name not in args.namedargs:
return default_value
if name == "bound":
return self._get_annotation(args.namedargs[name], name)
else:
ret = self._get_constant(args.namedargs[name], name, bool)
# This error is logged only if ... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def _get_typeparam(self, node, args):
args = args.simplify(node, self.vm)
try:
self.match_args(node, args)
except function.InvalidParameters as e:
raise TypeVarError("wrong arguments", e.bad_call)
except function.FailedFunctionCall:
# It is currently impossible to get here, since... | def _get_typeparam(self, node, args):
args = args.simplify(node, self.vm)
try:
self.match_args(node, args)
except function.InvalidParameters as e:
raise TypeVarError("wrong arguments", e.bad_call)
except function.FailedFunctionCall:
# It is currently impossible to get here, since... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def call(self, node, _, args):
"""Call typing.TypeVar()."""
try:
param = self._get_typeparam(node, args)
except TypeVarError as e:
self.vm.errorlog.invalid_typevar(self.vm.frames, utils.message(e), e.bad_call)
return node, self.vm.new_unsolvable(node)
return node, param.to_variab... | def call(self, node, _, args):
"""Call typing.TypeVar()."""
try:
param = self._get_typeparam(node, args)
except TypeVarError as e:
self.vm.errorlog.invalid_typevar(self.vm.frames, utils.message(e), e.bad_call)
return node, self.vm.new_unsolvable(node)
if param.has_late_types():
... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def call(self, node, func, args):
if args.posargs:
annot = self.vm.annotations_util.process_annotation_var(
node, args.posargs[0], "typing.cast", self.vm.simple_stack()
)
if any(t.formal for t in annot.data):
self.vm.errorlog.invalid_typevar(
self.vm.f... | def call(self, node, func, args):
if args.posargs:
try:
annot = self.vm.annotations_util.process_annotation_var(
node, args.posargs[0], "typing.cast", self.vm.frames
)
except self.vm.annotations_util.LateAnnotationError:
self.vm.errorlog.invalid_an... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def _build_namedtuple(self, name, field_names, field_types, node):
# Build an InterpreterClass representing the namedtuple.
if field_types:
# TODO(mdemello): Fix this to support late types.
field_types_union = abstract.Union(field_types, self.vm)
else:
field_types_union = self.vm.con... | def _build_namedtuple(self, name, field_names, field_types, late_annots, node):
# Build an InterpreterClass representing the namedtuple.
if field_types:
# TODO(mdemello): Fix this to support late types.
field_types_union = abstract.Union(field_types, self.vm)
else:
field_types_union ... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def call(self, node, _, args):
try:
name_var, field_names, field_types = self._getargs(node, args)
except abstract_utils.ConversionError:
return node, self.vm.new_unsolvable(node)
try:
name = abstract_utils.get_atomic_python_constant(name_var)
except abstract_utils.ConversionErr... | def call(self, node, _, args):
try:
name_var, field_names, field_types = self._getargs(node, args)
except abstract_utils.ConversionError:
return node, self.vm.new_unsolvable(node)
try:
name = abstract_utils.get_atomic_python_constant(name_var)
except abstract_utils.ConversionErr... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def __init__(
self, errorlog, options, loader, generate_unknowns=False, store_all_calls=False
):
"""Construct a TypegraphVirtualMachine."""
self.maximum_depth = None # set by run_program() and analyze()
self.errorlog = errorlog
self.options = options
self.python_version = options.python_version... | def __init__(
self, errorlog, options, loader, generate_unknowns=False, store_all_calls=False
):
"""Construct a TypegraphVirtualMachine."""
self.maximum_depth = None # set by run_program() and analyze()
self.errorlog = errorlog
self.options = options
self.python_version = options.python_version... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def trace_opcode(self, op, symbol, val):
"""Record trace data for other tools to use."""
if not self._trace_opcodes:
return
if self.frame and not op:
op = self.frame.current_opcode
if not op:
# If we don't have a current opcode, don't emit a trace.
return
def get_da... | def trace_opcode(self, op, symbol, val):
"""Record trace data for other tools to use."""
if not self._trace_opcodes:
return
if self.frame and not op:
op = self.frame.current_opcode
if not op:
# If we don't have a current opcode, don't emit a trace.
return
def get_da... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def _process_base_class(self, node, base):
"""Process a base class for InterpreterClass creation."""
new_base = self.program.NewVariable()
for b in base.bindings:
base_val = b.data
if isinstance(b.data, abstract.AnnotationContainer):
base_val = base_val.base_cls
# A class... | def _process_base_class(self, node, base):
"""Process a base class for InterpreterClass creation."""
new_base = self.program.NewVariable()
for b in base.bindings:
if isinstance(b.data, abstract.AnnotationContainer):
new_base.AddBinding(b.data.base_cls, {b}, node)
elif isinstance(... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def make_class(
self, node, name_var, bases, class_dict_var, cls_var, new_class_var=None
):
"""Create a class with the name, bases and methods given.
Args:
node: The current CFG node.
name_var: Class name.
bases: Base classes.
class_dict_var: Members of the class, as a Variable cont... | def make_class(
self, node, name_var, bases, class_dict_var, cls_var, new_class_var=None
):
"""Create a class with the name, bases and methods given.
Args:
node: The current CFG node.
name_var: Class name.
bases: Base classes.
class_dict_var: Members of the class, as a Variable cont... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def _make_function(
self, name, node, code, globs, defaults, kw_defaults, closure=None, annotations=None
):
"""Create a function or closure given the arguments."""
if closure:
closure = tuple(c for c in abstract_utils.get_atomic_python_constant(closure))
log.info("closure: %r", closure)
... | def _make_function(
self,
name,
node,
code,
globs,
defaults,
kw_defaults,
closure=None,
annotations=None,
late_annotations=None,
):
"""Create a function or closure given the arguments."""
if closure:
closure = tuple(c for c in abstract_utils.get_atomic_python_cons... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def simple_stack(self, opcode=None):
"""Get a stack of simple frames.
Args:
opcode: Optionally, an opcode to create a stack for.
Returns:
If an opcode is provided, a stack with a single frame at that opcode.
Otherwise, the VM's current stack converted to simple frames.
"""
if opc... | def simple_stack(self, opcode=None):
"""Get a stack of simple frames.
Args:
opcode: Optionally, an opcode to create a stack for.
Returns:
If an opcode is provided, a stack with a single frame at that opcode.
Otherwise, the VM's current stack converted to simple frames.
"""
if opc... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def run_program(self, src, filename, maximum_depth):
"""Run the code and return the CFG nodes.
Args:
src: The program source code.
filename: The filename the source is from.
maximum_depth: Maximum depth to follow call chains.
Returns:
A tuple (CFGNode, set) containing the last CFGNo... | def run_program(self, src, filename, maximum_depth):
"""Run the code and return the CFG nodes.
Args:
src: The program source code.
filename: The filename the source is from.
maximum_depth: Maximum depth to follow call chains.
Returns:
A tuple (CFGNode, set) containing the last CFGNo... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def load_from(self, state, store, name, discard_concrete_values=False):
"""Load an item out of locals, globals, or builtins."""
assert isinstance(store, abstract.SimpleAbstractValue)
assert store.is_lazy
store.load_lazy_attribute(name)
bindings = store.members[name].Bindings(state.node)
if not b... | def load_from(self, state, store, name, discard_concrete_values=False):
"""Load an item out of locals, globals, or builtins."""
assert isinstance(store, abstract.SimpleAbstractValue)
assert store.is_lazy
if name in store.late_annotations:
# Unresolved late annotation. See attribute.py:get_attrib... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def _store_value(self, state, name, value, local):
if local:
target = self.frame.f_locals
else:
target = self.frame.f_globals
node = self.attribute_handler.set_attribute(state.node, target, name, value)
if target is self.frame.f_globals and self.late_annotations:
for annot in sel... | def _store_value(self, state, name, value, local):
if local:
target = self.frame.f_locals
else:
target = self.frame.f_globals
node = self.attribute_handler.set_attribute(state.node, target, name, value)
return state.change_cfg_node(node)
| https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def byte_LOAD_NAME(self, state, op):
"""Load a name. Can be a local, global, or builtin."""
name = self.frame.f_code.co_names[op.arg]
try:
state, val = self.load_local(state, name)
except KeyError:
try:
state, val = self.load_global(state, name)
except KeyError:
... | def byte_LOAD_NAME(self, state, op):
"""Load a name. Can be a local, global, or builtin."""
name = self.frame.f_code.co_names[op.arg]
try:
state, val = self.load_local(state, name)
except KeyError:
try:
state, val = self.load_global(state, name)
except KeyError:
... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def byte_LOAD_FAST(self, state, op):
"""Load a local. Unlike LOAD_NAME, it doesn't fall back to globals."""
name = self.frame.f_code.co_varnames[op.arg]
try:
state, val = self.load_local(state, name)
except KeyError:
val = self._name_error_or_late_annotation(name).to_variable(state.node)... | def byte_LOAD_FAST(self, state, op):
"""Load a local. Unlike LOAD_NAME, it doesn't fall back to globals."""
name = self.frame.f_code.co_varnames[op.arg]
try:
state, val = self.load_local(state, name)
except KeyError:
self.errorlog.name_error(self.frames, name)
val = self.new_unso... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def byte_LOAD_GLOBAL(self, state, op):
"""Load a global variable, or fall back to trying to load a builtin."""
name = self.frame.f_code.co_names[op.arg]
if name == "None":
# Load None itself as a constant to avoid the None filtering done on
# variables. This workaround is safe because assign... | def byte_LOAD_GLOBAL(self, state, op):
"""Load a global variable, or fall back to trying to load a builtin."""
name = self.frame.f_code.co_names[op.arg]
if name == "None":
# Load None itself as a constant to avoid the None filtering done on
# variables. This workaround is safe because assign... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def byte_STORE_SUBSCR(self, state, op):
"""Implement obj[subscr] = val."""
state, (val, obj, subscr) = state.popn(3)
state = state.forward_cfg_node()
if self._is_annotations_dict(obj):
try:
name = abstract_utils.get_atomic_python_constant(subscr, six.string_types)
except abst... | def byte_STORE_SUBSCR(self, state, op):
"""Implement obj[subscr] = val."""
state, (val, obj, subscr) = state.popn(3)
state = state.forward_cfg_node()
if self._is_annotations_dict(obj):
try:
name = abstract_utils.get_atomic_python_constant(subscr, six.string_types)
except abst... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def _get_extra_function_args(self, state, arg):
"""Get function annotations and defaults from the stack. (Python3.5-)."""
if self.PY2:
num_pos_defaults = arg & 0xFFFF
num_kw_defaults = 0
else:
assert self.PY3
num_pos_defaults = arg & 0xFF
num_kw_defaults = (arg >> 8) ... | def _get_extra_function_args(self, state, arg):
"""Get function annotations and defaults from the stack. (Python3.5-)."""
if self.PY2:
num_pos_defaults = arg & 0xFFFF
num_kw_defaults = 0
else:
assert self.PY3
num_pos_defaults = arg & 0xFF
num_kw_defaults = (arg >> 8) ... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def _get_extra_function_args_3_6(self, state, arg):
"""Get function annotations and defaults from the stack (Python3.6+)."""
free_vars = None
pos_defaults = ()
kw_defaults = {}
annot = {}
if arg & loadmarshal.MAKE_FUNCTION_HAS_FREE_VARS:
state, free_vars = state.pop()
if arg & loadma... | def _get_extra_function_args_3_6(self, state, arg):
"""Get function annotations and defaults from the stack (Python3.6+)."""
free_vars = None
pos_defaults = ()
kw_defaults = {}
annot = {}
if arg & loadmarshal.MAKE_FUNCTION_HAS_FREE_VARS:
state, free_vars = state.pop()
if arg & loadma... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def _process_function_type_comment(self, node, op, func):
"""Modifies annotations from a function type comment.
Checks if a type comment is present for the function. If so, the type
comment is used to populate annotations. It is an error to have
a type comment when annotations is not empty.
Args... | def _process_function_type_comment(self, op, annotations, late_annotations):
"""Modifies annotations/late_annotations from a function type comment.
Checks if a type comment is present for the function. If so, the type
comment is used to populate late_annotations. It is an error to have
a type comment... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def byte_MAKE_FUNCTION(self, state, op):
"""Create a function and push it onto the stack."""
if self.PY2:
name = None
else:
assert self.PY3
state, name_var = state.pop()
name = abstract_utils.get_atomic_python_constant(name_var)
state, code = state.pop()
if self.pytho... | def byte_MAKE_FUNCTION(self, state, op):
"""Create a function and push it onto the stack."""
if self.PY2:
name = None
else:
assert self.PY3
state, name_var = state.pop()
name = abstract_utils.get_atomic_python_constant(name_var)
state, code = state.pop()
if self.pytho... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def byte_MAKE_CLOSURE(self, state, op):
"""Make a function that binds local variables."""
if self.PY2:
# The py3 docs don't mention this change.
name = None
else:
assert self.PY3
state, name_var = state.pop()
name = abstract_utils.get_atomic_python_constant(name_var)
... | def byte_MAKE_CLOSURE(self, state, op):
"""Make a function that binds local variables."""
if self.PY2:
# The py3 docs don't mention this change.
name = None
else:
assert self.PY3
state, name_var = state.pop()
name = abstract_utils.get_atomic_python_constant(name_var)
... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def byte_STORE_ANNOTATION(self, state, op):
"""Implementation of the STORE_ANNOTATION opcode."""
state, annotations_var = self.load_local(state, "__annotations__")
name = self.frame.f_code.co_names[op.arg]
state, value = state.pop()
value = self.annotations_util.process_annotation_var(
state... | def byte_STORE_ANNOTATION(self, state, op):
"""Implementation of the STORE_ANNOTATION opcode."""
state, annotations_var = self.load_local(state, "__annotations__")
name = self.frame.f_code.co_names[op.arg]
state, value = state.pop()
state = self._store_annotation(state, name, value)
name_var = s... | https://github.com/google/pytype/issues/420 | from typing import Any
def __getattr__(name: Any) -> Any: ...
# Caught error in pytype: 'LateAnnotation' object has no attribute 'Bindings'
# Traceback (most recent call last):
# File "/Users/name/.pyenv/versions/3.7.3/envs/venv/lib/python3.7/site-packages/pytype/io.py", line 131, in check_or_generate_pyi
# input... | AttributeError |
def get_type_key(self, seen=None):
cached_changestamps, saved_key = self._cached_type_key
if saved_key and cached_changestamps == (
self.members.changestamp,
self.instance_type_parameters.changestamp,
):
return saved_key
if not seen:
seen = set()
seen.add(self)
ke... | def get_type_key(self, seen=None):
cached_changestamps, saved_key = self._cached_type_key
if saved_key and cached_changestamps == (
self.members.changestamp,
self.instance_type_parameters.changestamp,
):
return saved_key
if not seen:
seen = set()
seen.add(self)
ke... | https://github.com/google/pytype/issues/208 | FAIL: pytype.tests.test_dict.DictTest.testPop_py3
Traceback (most recent call last):
File "/root/pytype/out/pytype/tests/test_base.py", line 536, in Replacement
return actual_method(self, *args, **kwargs)
File "/root/pytype/out/pytype/tests/test_dict.py", line 22, in testPop
""")
File "/root/pytype/out/pytype/tests/tes... | AssertionError |
def call(self, node, _, args, alias_map=None):
funcvar, name = args.posargs[0:2]
if isinstance(args.namedargs, dict):
kwargs = args.namedargs
else:
kwargs = self.vm.convert.value_to_constant(args.namedargs, dict)
# TODO(mdemello): Check if there are any changes between python2 and
# ... | def call(self, node, _, args, alias_map=None):
funcvar, name = args.posargs[0:2]
kwargs = args.namedargs.pyval
# TODO(mdemello): Check if there are any changes between python2 and
# python3 in the final metaclass computation.
# TODO(mdemello): Any remaining kwargs need to be passed to the metaclass.... | https://github.com/google/pytype/issues/208 | FAIL: pytype.tests.test_dict.DictTest.testPop_py3
Traceback (most recent call last):
File "/root/pytype/out/pytype/tests/test_base.py", line 536, in Replacement
return actual_method(self, *args, **kwargs)
File "/root/pytype/out/pytype/tests/test_dict.py", line 22, in testPop
""")
File "/root/pytype/out/pytype/tests/tes... | AssertionError |
def call(self, node, _, args):
posargs = args.posargs
if isinstance(args.namedargs, dict):
namedargs = args.namedargs
else:
namedargs = self.vm.convert.value_to_constant(args.namedargs, dict)
if namedargs and self.vm.python_version < (3, 6):
errmsg = "Keyword syntax for NamedTupl... | def call(self, node, _, args):
posargs = args.posargs
namedargs = self.vm.convert.value_to_constant(args.namedargs, dict)
if namedargs and self.vm.python_version < (3, 6):
errmsg = "Keyword syntax for NamedTuple is only supported in Python 3.6+"
self.vm.errorlog.invalid_namedtuple_arg(self.v... | https://github.com/google/pytype/issues/208 | FAIL: pytype.tests.test_dict.DictTest.testPop_py3
Traceback (most recent call last):
File "/root/pytype/out/pytype/tests/test_base.py", line 536, in Replacement
return actual_method(self, *args, **kwargs)
File "/root/pytype/out/pytype/tests/test_dict.py", line 22, in testPop
""")
File "/root/pytype/out/pytype/tests/tes... | AssertionError |
def byte_LOAD_METHOD(self, state, op):
name = self.frame.f_code.co_names[op.arg]
state, self_obj = state.pop()
state, result = self.load_attr(state, self_obj, name)
# https://docs.python.org/3/library/dis.html#opcode-LOAD_METHOD says that
# this opcode should push two values onto the stack: either t... | def byte_LOAD_METHOD(self, state, op):
# We don't support this 3.7 opcode yet; simply don't crash.
# TODO(rechen): Implement
# https://docs.python.org/3/library/dis.html#opcode-LOAD_METHOD.
unused_name = self.frame.f_code.co_names[op.arg]
state, unused_self_obj = state.pop()
return state
| https://github.com/google/pytype/issues/208 | FAIL: pytype.tests.test_dict.DictTest.testPop_py3
Traceback (most recent call last):
File "/root/pytype/out/pytype/tests/test_base.py", line 536, in Replacement
return actual_method(self, *args, **kwargs)
File "/root/pytype/out/pytype/tests/test_dict.py", line 22, in testPop
""")
File "/root/pytype/out/pytype/tests/tes... | AssertionError |
def byte_CALL_METHOD(self, state, op):
state, args = state.popn(op.arg)
state, func = state.pop()
state, result = self.call_function_with_state(state, func, args)
return state.push(result)
| def byte_CALL_METHOD(self, state, op):
# We don't support this 3.7 opcode yet; simply don't crash.
# TODO(rechen): Implement
# https://docs.python.org/3/library/dis.html#opcode-CALL_METHOD.
for _ in range(op.arg):
state = state.pop_and_discard()
return state.push(self.new_unsolvable(state.no... | https://github.com/google/pytype/issues/208 | FAIL: pytype.tests.test_dict.DictTest.testPop_py3
Traceback (most recent call last):
File "/root/pytype/out/pytype/tests/test_base.py", line 536, in Replacement
return actual_method(self, *args, **kwargs)
File "/root/pytype/out/pytype/tests/test_dict.py", line 22, in testPop
""")
File "/root/pytype/out/pytype/tests/tes... | AssertionError |
def __init__(
self,
base_module,
python_version,
pythonpath=(),
imports_map=None,
use_typeshed=True,
modules=None,
):
self._modules = modules or self._base_modules(python_version)
if self._modules["__builtin__"].needs_unpickling():
self._unpickle_module(self._modules["__built... | def __init__(
self,
base_module,
python_version,
pythonpath=(),
imports_map=None,
use_typeshed=True,
modules=None,
):
self._modules = modules or self._base_modules(python_version)
if self._modules["__builtin__"].needs_unpickling():
self._unpickle_module(self._modules["__built... | https://github.com/google/pytype/issues/175 | Command: `PYTHONPATH=.. python3.6 main.py`
Output:
Traceback (most recent call last):
File "main.py", line 3, in <module>
y = test2.far.b.B(2)
AttributeError: module 'test2' has no attribute 'far' | AttributeError |
def _process_module(self, module_name, filename, ast):
"""Create a module from a loaded ast and save it to the loader cache.
Args:
module_name: The fully qualified name of the module being imported.
filename: The file the ast was generated from.
ast: The pytd.TypeDeclUnit representing the mod... | def _process_module(self, module_name, filename, ast):
"""Create a module from a loaded ast and save it to the loader cache.
Args:
module_name: The fully qualified name of the module being imported.
filename: The file the ast was generated from.
ast: The pytd.TypeDeclUnit representing the mod... | https://github.com/google/pytype/issues/175 | Command: `PYTHONPATH=.. python3.6 main.py`
Output:
Traceback (most recent call last):
File "main.py", line 3, in <module>
y = test2.far.b.B(2)
AttributeError: module 'test2' has no attribute 'far' | AttributeError |
def __init__(
self, errorlog, options, loader, generate_unknowns=False, store_all_calls=False
):
"""Construct a TypegraphVirtualMachine."""
self.maximum_depth = None # set by run_program() and analyze()
self.errorlog = errorlog
self.options = options
self.python_version = options.python_version... | def __init__(
self, errorlog, options, loader, generate_unknowns=False, store_all_calls=False
):
"""Construct a TypegraphVirtualMachine."""
self.maximum_depth = None # set by run_program() and analyze()
self.errorlog = errorlog
self.options = options
self.python_version = options.python_version... | https://github.com/google/pytype/issues/175 | Command: `PYTHONPATH=.. python3.6 main.py`
Output:
Traceback (most recent call last):
File "main.py", line 3, in <module>
y = test2.far.b.B(2)
AttributeError: module 'test2' has no attribute 'far' | AttributeError |
def run_instruction(self, op, state):
"""Run a single bytecode instruction.
Args:
op: An opcode, instance of pyc.opcodes.Opcode
state: An instance of state.FrameState, the state just before running
this instruction.
Returns:
A tuple (why, state). "why" is the reason (if any) that ... | def run_instruction(self, op, state):
"""Run a single bytecode instruction.
Args:
op: An opcode, instance of pyc.opcodes.Opcode
state: An instance of state.FrameState, the state just before running
this instruction.
Returns:
A tuple (why, state). "why" is the reason (if any) that ... | https://github.com/google/pytype/issues/175 | Command: `PYTHONPATH=.. python3.6 main.py`
Output:
Traceback (most recent call last):
File "main.py", line 3, in <module>
y = test2.far.b.B(2)
AttributeError: module 'test2' has no attribute 'far' | AttributeError |
def import_module(self, name, full_name, level):
"""Import a module and return the module object or None."""
# Do not import new modules if we aren't in an IMPORT statement.
# The exception is if we have an implicit "package" module (e.g.
# `import a.b.c` adds `a.b` to the list of instantiable modules.)... | def import_module(self, name, full_name, level):
try:
module = self._import_module(name, level)
except (
parser.ParseError,
load_pytd.BadDependencyError,
visitors.ContainerError,
visitors.SymbolLookupError,
) as e:
self.errorlog.pyi_error(self.frames, full_nam... | https://github.com/google/pytype/issues/175 | Command: `PYTHONPATH=.. python3.6 main.py`
Output:
Traceback (most recent call last):
File "main.py", line 3, in <module>
y = test2.far.b.B(2)
AttributeError: module 'test2' has no attribute 'far' | AttributeError |
def fix(
self, tree: BaseSegment, config: Optional[FluffConfig] = None
) -> Tuple[BaseSegment, List[SQLLintError]]:
"""Return the fixed tree and violations from lintfix when we're fixing."""
fixed_tree, violations = self.lint_fix(tree, config, fix=True)
return fixed_tree, violations
| def fix(self, parsed: BaseSegment, config: Optional[FluffConfig] = None):
"""Fix a parsed file object."""
# Set up our config
config = config or self.config
# If we're in fix mode, then we need to progressively call and reconstruct
working = parsed
# Keep a set of previous versions to catch infi... | https://github.com/sqlfluff/sqlfluff/issues/600 | Traceback (most recent call last):
File "/Users/niallwoodward/dev/pull_requests/dbt_sqlfluff_venv/bin/sqlfluff", line 11, in <module>
load_entry_point('sqlfluff', 'console_scripts', 'sqlfluff')()
File "/Users/niallwoodward/dev/pull_requests/dbt_sqlfluff_venv/lib/python3.6/site-packages/click/core.py", line 829, in __ca... | IndexError |
def lint(
self, tree: BaseSegment, config: Optional[FluffConfig] = None
) -> List[SQLLintError]:
"""Return just the violations from lintfix when we're only linting."""
_, violations = self.lint_fix(tree, config, fix=False)
return violations
| def lint(
self, parsed: BaseSegment, config: Optional[FluffConfig] = None
) -> List[SQLLintError]:
"""Lint a parsed file object."""
config = config or self.config
linting_errors = []
for crawler in self.get_ruleset(config=config):
lerrs, _, _, _ = crawler.crawl(parsed, dialect=config.get("di... | https://github.com/sqlfluff/sqlfluff/issues/600 | Traceback (most recent call last):
File "/Users/niallwoodward/dev/pull_requests/dbt_sqlfluff_venv/bin/sqlfluff", line 11, in <module>
load_entry_point('sqlfluff', 'console_scripts', 'sqlfluff')()
File "/Users/niallwoodward/dev/pull_requests/dbt_sqlfluff_venv/lib/python3.6/site-packages/click/core.py", line 829, in __ca... | IndexError |
def lint_string(
self,
in_str: str = "",
fname: str = "<string input>",
fix: bool = False,
config: Optional[FluffConfig] = None,
) -> LintedFile:
"""Lint a string.
Returns:
:obj:`LintedFile`: an object representing that linted file.
"""
# Sort out config, defaulting to the ... | def lint_string(
self,
in_str: str,
fname: str = "<string input>",
fix: bool = False,
config: Optional[FluffConfig] = None,
) -> LintedFile:
"""Lint a string.
Returns:
:obj:`LintedFile`: an object representing that linted file.
"""
# Sort out config, defaulting to the built... | https://github.com/sqlfluff/sqlfluff/issues/600 | Traceback (most recent call last):
File "/Users/niallwoodward/dev/pull_requests/dbt_sqlfluff_venv/bin/sqlfluff", line 11, in <module>
load_entry_point('sqlfluff', 'console_scripts', 'sqlfluff')()
File "/Users/niallwoodward/dev/pull_requests/dbt_sqlfluff_venv/lib/python3.6/site-packages/click/core.py", line 829, in __ca... | IndexError |
def crawl(
self,
segment,
dialect,
parent_stack=None,
siblings_pre=None,
siblings_post=None,
raw_stack=None,
memory=None,
):
"""Recursively perform the crawl operation on a given segment.
Returns:
A tuple of (vs, raw_stack, fixes, memory)
"""
# parent stack shou... | def crawl(
self,
segment,
dialect,
parent_stack=None,
siblings_pre=None,
siblings_post=None,
raw_stack=None,
fix=False,
memory=None,
):
"""Recursively perform the crawl operation on a given segment.
Returns:
A tuple of (vs, raw_stack, fixes, memory)
"""
# pa... | https://github.com/sqlfluff/sqlfluff/issues/600 | Traceback (most recent call last):
File "/Users/niallwoodward/dev/pull_requests/dbt_sqlfluff_venv/bin/sqlfluff", line 11, in <module>
load_entry_point('sqlfluff', 'console_scripts', 'sqlfluff')()
File "/Users/niallwoodward/dev/pull_requests/dbt_sqlfluff_venv/lib/python3.6/site-packages/click/core.py", line 829, in __ca... | IndexError |
def _unsafe_process(self, fname, in_str=None, config=None):
if not config:
raise ValueError(
"For the dbt templater, the `process()` method requires a config object."
)
if not fname:
raise ValueError(
"For the dbt templater, the `process()` method requires a file ... | def _unsafe_process(self, fname, in_str=None, config=None):
if not config:
raise ValueError(
"For the dbt templater, the `process()` method requires a config object."
)
if not fname:
raise ValueError(
"For the dbt templater, the `process()` method requires a file ... | https://github.com/sqlfluff/sqlfluff/issues/600 | Traceback (most recent call last):
File "/Users/niallwoodward/dev/pull_requests/dbt_sqlfluff_venv/bin/sqlfluff", line 11, in <module>
load_entry_point('sqlfluff', 'console_scripts', 'sqlfluff')()
File "/Users/niallwoodward/dev/pull_requests/dbt_sqlfluff_venv/lib/python3.6/site-packages/click/core.py", line 829, in __ca... | IndexError |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.