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 parse_array(self, name: str, obj: JsonSchemaObject, path: List[str]) -> DataModel:
field, item_obj_names = self.parse_array_fields(name, obj, [*path, name])
self.model_resolver.add(path, name)
data_model_root = self.data_model_root_type(
name,
[field],
custom_base_class=self.base... | def parse_array(self, name: str, obj: JsonSchemaObject, path: List[str]) -> None:
field, item_obj_names = self.parse_array_fields(name, obj, [*path, name])
self.model_resolver.add(path, name)
data_model_root = self.data_model_root_type(
name,
[field],
custom_base_class=self.base_clas... | https://github.com/koxudaxi/datamodel-code-generator/issues/216 | Traceback (most recent call last):
File "<input>", line 1, in <module>
File "pydantic\main.py", line 346, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 2 validation errors for FileSetUpload
tags -> tag1
value is not a valid dict (type=type_error.dict)
tags -> tag2
value is not a valid dic... | pydantic.error_wrappers.ValidationError |
def get_data_type(self, obj: JsonSchemaObject) -> List[DataType]:
if obj.type is None:
return [
self.data_type(type="Any", version_compatible=True, imports_=[IMPORT_ANY])
]
if isinstance(obj.type, list):
types: List[str] = [t for t in obj.type if t != "null"]
format_ ... | def get_data_type(self, obj: JsonSchemaObject) -> List[DataType]:
if obj.type is None:
raise ValueError(f"invalid schema object {obj}")
if isinstance(obj.type, list):
types: List[str] = [t for t in obj.type if t != "null"]
format_ = "default"
else:
types = [obj.type]
... | https://github.com/koxudaxi/datamodel-code-generator/issues/205 | Traceback (most recent call last):
File "/home/docker/venv3.6/lib/python3.6/site-packages/datamodel_code_generator/__main__.py", line 230, in main
aliases=aliases,
File "/home/docker/venv3.6/lib/python3.6/site-packages/datamodel_code_generator/__init__.py", line 180, in generate
result = parser.parse()
File "/home/dock... | ValueError |
def get_data_type(self, obj: JsonSchemaObject) -> List[DataType]:
if obj.type is None:
raise ValueError(f"invalid schema object {obj}")
if isinstance(obj.type, list):
types: List[str] = [t for t in obj.type if t != "null"]
format_ = "default"
else:
types = [obj.type]
... | def get_data_type(self, obj: JsonSchemaObject) -> DataType:
format_ = obj.format or "default"
if obj.type is None:
raise ValueError(f"invalid schema object {obj}")
return self.data_model_type.get_data_type(
json_schema_data_formats[obj.type][format_], **obj.dict()
)
| https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def parse_any_of(self, name: str, obj: JsonSchemaObject) -> List[DataType]:
any_of_data_types: List[DataType] = []
for any_of_item in obj.anyOf:
if any_of_item.ref: # $ref
any_of_data_types.append(
self.data_type(
type=any_of_item.ref_object_name,
... | def parse_any_of(self, name: str, obj: JsonSchemaObject) -> List[DataType]:
any_of_data_types: List[DataType] = []
for any_of_item in obj.anyOf:
if any_of_item.ref: # $ref
any_of_data_types.append(
self.data_type(
type=any_of_item.ref_object_name,
... | https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def parse_object_fields(self, obj: JsonSchemaObject) -> List[DataModelField]:
properties: Dict[str, JsonSchemaObject] = (
obj.properties if obj.properties is not None else {}
)
requires: Set[str] = {*obj.required} if obj.required is not None else {*()}
fields: List[DataModelField] = []
for ... | def parse_object_fields(self, obj: JsonSchemaObject) -> List[DataModelField]:
properties: Dict[str, JsonSchemaObject] = (
obj.properties if obj.properties is not None else {}
)
requires: Set[str] = {*obj.required} if obj.required is not None else {*()}
fields: List[DataModelField] = []
for ... | https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def parse_array_fields(
self, name: str, obj: JsonSchemaObject
) -> Tuple[List[DataModelField], List[DataType]]:
if isinstance(obj.items, JsonSchemaObject):
items: List[JsonSchemaObject] = [obj.items]
else:
items = obj.items # type: ignore
item_obj_data_types: List[DataType] = []
is... | def parse_array_fields(
self, name: str, obj: JsonSchemaObject
) -> Tuple[List[DataModelField], List[DataType]]:
if isinstance(obj.items, JsonSchemaObject):
items: List[JsonSchemaObject] = [obj.items]
else:
items = obj.items # type: ignore
item_obj_data_types: List[DataType] = []
is... | https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def parse_root_type(self, name: str, obj: JsonSchemaObject) -> None:
if obj.type:
types: List[DataType] = self.get_data_type(obj)
elif obj.anyOf:
types = self.parse_any_of(name, obj)
else:
types = [
self.data_type(type=obj.ref_object_name, ref=True, version_compatible=Tru... | def parse_root_type(self, name: str, obj: JsonSchemaObject) -> None:
if obj.type:
types: List[DataType] = [self.get_data_type(obj)]
elif obj.anyOf:
types = self.parse_any_of(name, obj)
else:
types = [
self.data_type(type=obj.ref_object_name, ref=True, version_compatible=T... | https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def create_line(cls, from_: Optional[str], imports: Set[str]) -> str:
if from_:
line = f"from {from_} "
line += f"import {', '.join(sorted(imports))}"
return line
return "\n".join(f"import {i}\n" for i in sorted(imports))
| def create_line(cls, from_: Optional[str], imports: Set[str]) -> str:
line: str = ""
if from_: # pragma: no cover
line = f"from {from_} "
line += f"import {', '.join(sorted(imports))}"
return line
| https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def append(self, imports: Union[Import, List[Import], None]) -> None:
if imports:
if isinstance(imports, Import):
imports = [imports]
for import_ in imports:
if import_.import_.count(".") >= 1:
self[None].add(import_.import_)
else:
... | def append(self, imports: Union[Import, List[Import], None]) -> None:
if imports:
if isinstance(imports, Import):
imports = [imports]
for import_ in imports:
self[import_.from_].add(import_.import_)
| https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def sort_data_models(
unsorted_data_models: List[DataModel],
sorted_data_models: Optional[SortedDataModels] = None,
require_update_action_models: Optional[List[str]] = None,
) -> Tuple[List[DataModel], SortedDataModels, List[str]]:
if sorted_data_models is None:
sorted_data_models = OrderedDict(... | def sort_data_models(
unsorted_data_models: List[DataModel],
sorted_data_models: Optional[SortedDataModels] = None,
require_update_action_models: Optional[List[str]] = None,
) -> Tuple[List[DataModel], SortedDataModels, List[str]]:
if sorted_data_models is None:
sorted_data_models = OrderedDict(... | https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def get_model_by_path(schema: Dict[str, Any], keys: List[str]) -> Dict:
if len(keys) == 0:
return schema
elif len(keys) == 1:
return schema[keys[0]]
return get_model_by_path(schema[keys[0]], keys[1:])
| def get_model_by_path(schema: Dict[str, Any], keys: List[str]) -> Dict:
if len(keys) == 1:
return schema[keys[0]]
return get_model_by_path(schema[keys[0]], keys[1:])
| https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def parse_ref(self, obj: JsonSchemaObject) -> None:
if obj.ref:
ref: str = obj.ref
# https://swagger.io/docs/specification/using-ref/
if obj.ref.startswith("#"):
# Local Reference – $ref: '#/definitions/myElement'
pass
elif "://" in ref:
# URL Refe... | def parse_ref(self, obj: JsonSchemaObject) -> None:
if obj.ref:
ref: str = obj.ref
# https://swagger.io/docs/specification/using-ref/
if obj.ref.startswith("#"):
# Local Reference – $ref: '#/definitions/myElement'
pass
elif "://" in ref:
# URL Refe... | https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def parse_raw(self) -> None:
raw_obj: Dict[str, Any] = json.loads(self.text) # type: ignore
obj_name = raw_obj.get("title", "Model")
self.parse_raw_obj(obj_name, raw_obj)
definitions = raw_obj.get("definitions", {})
for key, model in definitions.items():
self.parse_raw_obj(key, model)
| def parse_raw(self) -> None:
raw_obj: Dict[str, Any] = json.loads(self.text) # type: ignore
obj_name = raw_obj.get("title", "Model")
self.parse_raw_obj(obj_name, raw_obj)
| https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def parse_root_type(self, name: str, obj: JsonSchemaObject) -> None:
if obj.type:
types: List[DataType] = self.get_data_type(obj)
elif obj.anyOf:
types = self.parse_any_of(name, obj)
elif obj.ref:
types = [
self.data_type(type=obj.ref_object_name, ref=True, version_compat... | def parse_root_type(self, name: str, obj: JsonSchemaObject) -> None:
if obj.type:
types: List[DataType] = self.get_data_type(obj)
elif obj.anyOf:
types = self.parse_any_of(name, obj)
else:
types = [
self.data_type(type=obj.ref_object_name, ref=True, version_compatible=Tru... | https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def main(args: Optional[Sequence[str]] = None) -> Exit:
"""Main function."""
# add cli completion support
argcomplete.autocomplete(arg_parser)
if args is None:
args = sys.argv[1:]
namespace: Namespace = arg_parser.parse_args(args)
if namespace.version: # pragma: no cover
fro... | def main(args: Optional[Sequence[str]] = None) -> Exit:
"""Main function."""
# add cli completion support
argcomplete.autocomplete(arg_parser)
if args is None:
args = sys.argv[1:]
namespace: Namespace = arg_parser.parse_args(args)
if namespace.version: # pragma: no cover
fro... | https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def __init__(self) -> None:
super().__init__(set)
self.alias: DefaultDict[Optional[str], Dict[str, str]] = defaultdict(dict)
| def __init__(self) -> None:
super().__init__(set)
| https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def create_line(self, from_: Optional[str], imports: Set[str]) -> str:
if from_:
line = f"from {from_} "
line += f"import {', '.join(self._set_alias(from_, imports))}"
return line
return "\n".join(f"import {i}" for i in self._set_alias(from_, imports))
| def create_line(cls, from_: Optional[str], imports: Set[str]) -> str:
if from_:
line = f"from {from_} "
line += f"import {', '.join(sorted(imports))}"
return line
return "\n".join(f"import {i}" for i in sorted(imports))
| https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def append(self, imports: Union[Import, List[Import], None]) -> None:
if imports:
if isinstance(imports, Import):
imports = [imports]
for import_ in imports:
if import_.import_.count(".") >= 1:
self[None].add(import_.import_)
else:
... | def append(self, imports: Union[Import, List[Import], None]) -> None:
if imports:
if isinstance(imports, Import):
imports = [imports]
for import_ in imports:
if import_.import_.count(".") >= 1:
self[None].add(import_.import_)
else:
... | https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def get_uniq_name(name: str, excludes: Set[str]) -> str:
uniq_name: str = name
count: int = 1
while uniq_name in excludes:
uniq_name = f"{name}_{count}"
count += 1
return uniq_name
| def get_uniq_name(self, name: str) -> str:
uniq_name: str = name
count: int = 1
while uniq_name in self.created_model_names:
uniq_name = f"{name}_{count}"
count += 1
return uniq_name
| https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def get_class_name(self, field_name: str) -> str:
upper_camel_name = snake_to_upper_camel(field_name)
return get_uniq_name(upper_camel_name, self.created_model_names)
| def get_class_name(self, field_name: str) -> str:
upper_camel_name = snake_to_upper_camel(field_name)
return self.get_uniq_name(upper_camel_name)
| https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def parse(
self, with_import: Optional[bool] = True, format_: Optional[bool] = True
) -> Union[str, Dict[Tuple[str, ...], str]]:
self.parse_raw()
if with_import:
if self.target_python_version == PythonVersion.PY_37:
self.imports.append(IMPORT_ANNOTATIONS)
_, sorted_data_models, req... | def parse(
self, with_import: Optional[bool] = True, format_: Optional[bool] = True
) -> Union[str, Dict[Tuple[str, ...], str]]:
self.parse_raw()
if with_import:
if self.target_python_version == PythonVersion.PY_37:
self.imports.append(IMPORT_ANNOTATIONS)
_, sorted_data_models, req... | https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def get_uniq_name(name: str, excludes: Set[str], camel: bool = False) -> str:
uniq_name: str = name
count: int = 1
while uniq_name in excludes:
if camel:
uniq_name = f"{name}{count}"
else:
uniq_name = f"{name}_{count}"
count += 1
return uniq_name
| def get_uniq_name(name: str, excludes: Set[str]) -> str:
uniq_name: str = name
count: int = 1
while uniq_name in excludes:
uniq_name = f"{name}_{count}"
count += 1
return uniq_name
| https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def get_class_name(self, field_name: str) -> str:
upper_camel_name = snake_to_upper_camel(field_name)
return get_uniq_name(upper_camel_name, self.created_model_names, camel=True)
| def get_class_name(self, field_name: str) -> str:
upper_camel_name = snake_to_upper_camel(field_name)
return get_uniq_name(upper_camel_name, self.created_model_names)
| https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def parse(
self, with_import: Optional[bool] = True, format_: Optional[bool] = True
) -> Union[str, Dict[Tuple[str, ...], str]]:
self.parse_raw()
if with_import:
if self.target_python_version == PythonVersion.PY_37:
self.imports.append(IMPORT_ANNOTATIONS)
_, sorted_data_models, req... | def parse(
self, with_import: Optional[bool] = True, format_: Optional[bool] = True
) -> Union[str, Dict[Tuple[str, ...], str]]:
self.parse_raw()
if with_import:
if self.target_python_version == PythonVersion.PY_37:
self.imports.append(IMPORT_ANNOTATIONS)
_, sorted_data_models, req... | https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def parse_enum(self, name: str, obj: JsonSchemaObject) -> DataModel:
enum_fields = []
for i, enum_part in enumerate(obj.enum): # type: ignore
if obj.type == "string" or (
isinstance(obj.type, list) and "string" in obj.type
):
default = f"'{enum_part}'"
field... | def parse_enum(self, name: str, obj: JsonSchemaObject) -> DataModel:
enum_fields = []
for i, enum_part in enumerate(obj.enum): # type: ignore
if obj.type == "string":
default = f"'{enum_part}'"
field_name = enum_part
else:
default = enum_part
if ... | https://github.com/koxudaxi/datamodel-code-generator/issues/102 | Traceback (most recent call last):
File "/proj/.venv/bin/datamodel-codegen", line 8, in <module>
sys.exit(main())
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/__main__.py", line 168, in main
result = parser.parse()
File "/proj/.venv/lib/python3.7/site-packages/datamodel_code_generator/parser/b... | pydantic.error_wrappers.ValidationError |
def new_load_metric_vars(self, metric_vars_file):
"""
Load the metric variables for a check from a metric check variables file
:param metric_vars_file: the path and filename to the metric variables files
:type metric_vars_file: str
:return: the metric_vars module object or ``False``
:rtype: lis... | def new_load_metric_vars(metric_vars_file):
"""
Load the metric variables for a check from a metric check variables file
:param metric_vars_file: the path and filename to the metric variables files
:type metric_vars_file: str
:return: the metric_vars module object or ``False``
:rtype: list
... | https://github.com/earthgecko/skyline/issues/24 | 2016-08-22 16:42:05 :: 7874 :: Traceback (most recent call last):
File "/opt/skyline/github/skyline/skyline/panorama/panorama.py", line 297, in spin_process
metric_vars.from_timestamp
AttributeError: 'module' object has no attribute 'from_timestamp'
2016-08-22 16:42:05 :: 7874 :: error :: failed to read from_timestamp... | AttributeError |
def spin_process(self, i, metric_check_file):
"""
Assign a metric anomaly to process.
:param i: python process id
:param metric_check_file: full path to the metric check file
:return: returns True
"""
def get_an_engine():
try:
engine, log_msg, trace = get_engine(skyli... | def spin_process(self, i, metric_check_file):
"""
Assign a metric anomaly to process.
:param i: python process id
:param metric_check_file: full path to the metric check file
:return: returns True
"""
def get_an_engine():
try:
engine, log_msg, trace = get_engine(skyli... | https://github.com/earthgecko/skyline/issues/24 | 2016-08-22 16:42:05 :: 7874 :: Traceback (most recent call last):
File "/opt/skyline/github/skyline/skyline/panorama/panorama.py", line 297, in spin_process
metric_vars.from_timestamp
AttributeError: 'module' object has no attribute 'from_timestamp'
2016-08-22 16:42:05 :: 7874 :: error :: failed to read from_timestamp... | AttributeError |
def spin_process(self, i, metric_check_file):
"""
Assign a metric anomaly to process.
:param i: python process id
:param metric_check_file: full path to the metric check file
:return: returns True
"""
child_process_pid = os.getpid()
if settings.ENABLE_PANORAMA_DEBUG:
logger.i... | def spin_process(self, i, metric_check_file):
"""
Assign a metric anomaly to process.
:param i: python process id
:param metric_check_file: full path to the metric check file
:return: returns True
"""
child_process_pid = os.getpid()
if settings.ENABLE_PANORAMA_DEBUG:
logger.i... | https://github.com/earthgecko/skyline/issues/24 | 2016-08-22 16:42:05 :: 7874 :: Traceback (most recent call last):
File "/opt/skyline/github/skyline/skyline/panorama/panorama.py", line 297, in spin_process
metric_vars.from_timestamp
AttributeError: 'module' object has no attribute 'from_timestamp'
2016-08-22 16:42:05 :: 7874 :: error :: failed to read from_timestamp... | AttributeError |
def ionosphere_metric_data(requested_timestamp, data_for_metric, context):
"""
Get a list of all training data folders and metrics
"""
# @added 20170104 - Feature #1842: Ionosphere - Graphite now graphs
# Feature #1830: Ionosphere alerts
# Use the new_load_metric_vars method
... | def ionosphere_metric_data(requested_timestamp, data_for_metric, context):
"""
Get a list of all training data folders and metrics
"""
base_name = data_for_metric.replace(settings.FULL_NAMESPACE, "", 1)
if context == "training_data":
log_context = "training data"
if context == "features_... | https://github.com/earthgecko/skyline/issues/24 | 2016-08-22 16:42:05 :: 7874 :: Traceback (most recent call last):
File "/opt/skyline/github/skyline/skyline/panorama/panorama.py", line 297, in spin_process
metric_vars.from_timestamp
AttributeError: 'module' object has no attribute 'from_timestamp'
2016-08-22 16:42:05 :: 7874 :: error :: failed to read from_timestamp... | AttributeError |
def fetch_production(
zone_key="CR",
session=None,
target_datetime=None,
logger=logging.getLogger(__name__),
):
# ensure we have an arrow object.
# if no target_datetime is specified, this defaults to now.
target_datetime = arrow.get(target_datetime).to(TIMEZONE)
# if before 01:30am on ... | def fetch_production(
zone_key="CR",
session=None,
target_datetime=None,
logger=logging.getLogger(__name__),
):
# ensure we have an arrow object. if no target_datetime is specified, this defaults to now.
target_datetime = arrow.get(target_datetime).to(TIMEZONE)
if target_datetime < arrow.ge... | https://github.com/tmrowco/electricitymap-contrib/issues/1477 | Traceback (most recent call last):
File "/home/feeder/lib/fetch_data.py", line 130, in launch_parsers
**parser_kwargs)
File "/home/electricitymap/parsers/CR.py", line 191, in fetch_production
df = pd.read_html(response.text, match=CHARACTERISTIC_NAME, skiprows=1, index_col=0)[0]
File "/usr/local/lib/python3.6/site-pack... | ValueError |
def df_to_data(zone_key, day, df, logger):
df = df.dropna(axis=1, how="any")
# Check for empty dataframe
if df.shape == (1, 1):
return []
df = df.drop(["Intercambio Sur", "Intercambio Norte", "Total"], errors="ignore")
df = df.iloc[:, :-1]
results = []
unknown_plants = set()
hou... | def df_to_data(zone_key, day, df, logger):
df = df.dropna(axis=1, how="any")
# Check for empty dataframe
if df.shape == (1, 1):
return []
df = df.drop(["Intercambio Sur", "Intercambio Norte", "Total"], errors="ignore")
df = df.iloc[:, :-1]
results = []
unknown_plants = set()
hou... | https://github.com/tmrowco/electricitymap-contrib/issues/1561 | Traceback (most recent call last):
File "/home/feeder/lib/fetch_data.py", line 131, in launch_parsers
**parser_kwargs)
File "/home/contrib/parsers/CR.py", line 178, in fetch_production
jsf_view_state = soup.select('#javax.faces.ViewState')[0]['value']
IndexError: list index out of range | IndexError |
def fetch_production(
zone_key="CR",
session=None,
target_datetime=None,
logger=logging.getLogger(__name__),
):
# ensure we have an arrow object. if no target_datetime is specified, this defaults to now.
target_datetime = arrow.get(target_datetime).to(TIMEZONE)
if target_datetime < arrow.ge... | def fetch_production(
zone_key="CR",
session=None,
target_datetime=None,
logger=logging.getLogger(__name__),
):
# ensure we have an arrow object. if no target_datetime is specified, this defaults to now.
target_datetime = arrow.get(target_datetime).to(TIMEZONE)
if target_datetime < arrow.ge... | https://github.com/tmrowco/electricitymap-contrib/issues/1561 | Traceback (most recent call last):
File "/home/feeder/lib/fetch_data.py", line 131, in launch_parsers
**parser_kwargs)
File "/home/contrib/parsers/CR.py", line 178, in fetch_production
jsf_view_state = soup.select('#javax.faces.ViewState')[0]['value']
IndexError: list index out of range | IndexError |
def get_data(session=None):
"""
Makes two requests for the current generation total and fuel mix.
Parses the data into raw form and reads time string associated with it.
Checks that fuel mix sum is equal to generation total.
Returns a tuple.
"""
s = session or requests.Session()
mixreq ... | def get_data(session=None):
"""
Makes two requests for the current generation total and fuel mix.
Parses the data into raw form and reads time string associated with it.
Checks that fuel mix sum is equal to generation total.
Returns a tuple.
"""
s = session or requests.Session()
mixreq ... | https://github.com/tmrowco/electricitymap-contrib/issues/1473 | Traceback (most recent call last):
File "/home/feeder/lib/fetch_data.py", line 130, in launch_parsers
**parser_kwargs)
File "/home/electricitymap/parsers/MY_WM.py", line 309, in fetch_exchange
hvdc_hidden_values = extract_hidden_values(hvdc_switch_req)
File "/home/electricitymap/parsers/MY_WM.py", line 176, in extract_... | TypeError |
def extract_hidden_values(req):
"""
Gets current aspx page values to enable post requests to be sent.
Returns a dictionary.
"""
soup = BeautifulSoup(req.content, "html.parser")
# Find and define parameters needed to send a POST request.
try:
viewstategenerator = soup.find("input", ... | def extract_hidden_values(req):
"""
Gets current aspx page values to enable post requests to be sent.
Returns a dictionary.
"""
soup = BeautifulSoup(req.content, "html.parser")
# Find and define parameters needed to send a POST request.
viewstategenerator = soup.find("input", attrs={"id": ... | https://github.com/tmrowco/electricitymap-contrib/issues/1473 | Traceback (most recent call last):
File "/home/feeder/lib/fetch_data.py", line 130, in launch_parsers
**parser_kwargs)
File "/home/electricitymap/parsers/MY_WM.py", line 309, in fetch_exchange
hvdc_hidden_values = extract_hidden_values(hvdc_switch_req)
File "/home/electricitymap/parsers/MY_WM.py", line 176, in extract_... | TypeError |
def data_processor(df, logger):
"""
Takes a dataframe and logging instance as input.
Checks for new generation types and logs awarning if any are found.
Parses the dataframe row by row removing unneeded keys.
Returns a list of 2 element tuples, each containing a datetime object
and production di... | def data_processor(df, logger):
"""
Takes a dataframe and logging instance as input.
Checks for new generation types and logs awarning if any are found.
Parses the dataframe row by row removing unneeded keys.
Returns a list of 2 element tuples, each containing a datetime object
and production di... | https://github.com/tmrowco/electricitymap-contrib/issues/1528 | Traceback (most recent call last):
File "/home/feeder/lib/fetch_data.py", line 131, in launch_parsers
**parser_kwargs)
File "/home/contrib/parsers/US_SPP.py", line 122, in fetch_production
processed_data = data_processor(raw_data, logger)
File "/home/contrib/parsers/US_SPP.py", line 71, in data_processor
production['co... | KeyError |
def data_processer(raw_data, logger):
"""
Groups dictionaries by datetime key.
Removes unneeded keys and logs any new ones.
Returns a list of tuples containing (datetime object, dictionary).
"""
dt_key = lambda x: x["datetime"]
grouped = groupby(raw_data, dt_key)
keys_to_ignore = {"Loa... | def data_processer(raw_data, logger):
"""
Groups dictionaries by datetime key.
Removes unneeded keys and logs any new ones.
Returns a list of tuples containing (datetime object, dictionary).
"""
dt_key = lambda x: x["datetime"]
grouped = groupby(raw_data, dt_key)
keys_to_ignore = {"Loa... | https://github.com/tmrowco/electricitymap-contrib/issues/1478 | Traceback (most recent call last):
File "/home/feeder/lib/fetch_data.py", line 130, in launch_parsers
**parser_kwargs)
File "/home/electricitymap/parsers/US_IPC.py", line 129, in fetch_production
processed_data = data_processer(raw_data, logger)
File "/home/electricitymap/parsers/US_IPC.py", line 83, in data_processer
... | KeyError |
def get_data(session=None):
"""Returns generation data as a list of floats."""
s = session or requests.Session()
# In order for the data url to return data, cookies from the display url must be obtained then reused.
response = s.get(display_url)
data_response = s.get(data_url)
raw_data = data_... | def get_data(session=None):
"""Returns generation data as a list of floats."""
s = session or requests.Session()
data_response = s.get(data_url)
raw_data = data_response.text
data = [float(i) for i in raw_data.split(",")]
return data
| https://github.com/tmrowco/electricitymap-contrib/issues/1195 | Traceback (most recent call last):
File "feeder_electricity.py", line 176, in fetch_exchange
objs = parser(country_code1, country_code2, session, logger=public_logger)
File "/home/electricitymap/parsers/MD.py", line 113, in fetch_exchange
exchange_status = get_data(session=session)
File "/home/electricitymap/parsers/MD... | ValueError |
def fetch_SA_battery(session=None):
"""
Makes a request to the nemlog api for South Australia battery data.
Returns a float or None.
"""
today = arrow.now("Australia/Adelaide")
current = today.format("YYYYMMDD")
old = today.shift(days=-2).format("YYYYMMDD")
nemlog_url = "http://nemlog.c... | def fetch_SA_battery(session=None):
"""
Makes a request to the nemlog api for South Australia battery data.
Returns a float or None.
"""
today = arrow.now("Australia/Adelaide")
current = today.format("YYYYMMDD")
old = today.shift(days=-2).format("YYYYMMDD")
nemlog_url = "http://nemlog.c... | https://github.com/tmrowco/electricitymap-contrib/issues/1150 | fetch_production("AUS-SA") ->
Traceback (most recent call last):
File "AU.py", line 558, in <module>
print(fetch_production('AUS-SA'))
File "AU.py", line 422, in fetch_production
data['storage']['battery'] = AU_battery.fetch_SA_battery()
File "/home/chris/electricitymap/parsers/lib/AU_battery.py", line 30, in fetch_SA_... | TypeError |
def fetch_FI(session=None):
url = "http://driftsdata.statnett.no/restapi/ProductionConsumption/GetLatestDetailedOverview"
data = (session or requests).get(url).json()
countries = map(lambda x: x["value"], data["Headers"])
i = countries.index(COUNTRY_CODE)
obj = {
"countryCode": COUNTRY_CODE... | def fetch_FI():
url = "http://driftsdata.statnett.no/restapi/ProductionConsumption/GetLatestDetailedOverview"
data = requests.get(url).json()
countries = map(lambda x: x["value"], data["Headers"])
i = countries.index(COUNTRY_CODE)
obj = {
"countryCode": COUNTRY_CODE,
"datetime": arr... | https://github.com/tmrowco/electricitymap-contrib/issues/95 | Traceback (most recent call last):
File "feeder.py", line 51, in fetch_countries
obj = parser()
File "/home/parsers/PL.py", line 29, in fetch_PL
output_array = map(fetchValue, parameters)
File "/home/parsers/PL.py", line 21, in fetchValue
last = soup.find_all('point')[-1].find_all('quantity')[-1]
IndexError: list index... | IndexError |
def fetch_GB(session=None):
url = "http://www.bmreports.com/bsp/additional/soapfunctions.php?element=generationbyfueltypetable"
response = (session or requests).get(url)
root = ET.fromstring(response.content)
data = root[0]
parsed = {}
for item in data:
parsed[item.get("TYPE")] = float... | def fetch_GB():
url = "http://www.bmreports.com/bsp/additional/soapfunctions.php?element=generationbyfueltypetable"
response = requests.get(url)
root = ET.fromstring(response.content)
data = root[0]
parsed = {}
for item in data:
parsed[item.get("TYPE")] = float(item.get("VAL"))
ob... | https://github.com/tmrowco/electricitymap-contrib/issues/95 | Traceback (most recent call last):
File "feeder.py", line 51, in fetch_countries
obj = parser()
File "/home/parsers/PL.py", line 29, in fetch_PL
output_array = map(fetchValue, parameters)
File "/home/parsers/PL.py", line 21, in fetchValue
last = soup.find_all('point')[-1].find_all('quantity')[-1]
IndexError: list index... | IndexError |
def fetch_LV(session=None):
url = "http://driftsdata.statnett.no/restapi/ProductionConsumption/GetLatestDetailedOverview"
data = (session or requests).get(url).json()
countries = map(lambda x: x["value"], data["Headers"])
i = countries.index(COUNTRY_CODE)
obj = {
"countryCode": COUNTRY_COD... | def fetch_LV():
url = "http://driftsdata.statnett.no/restapi/ProductionConsumption/GetLatestDetailedOverview"
data = requests.get(url).json()
countries = map(lambda x: x["value"], data["Headers"])
i = countries.index(COUNTRY_CODE)
obj = {
"countryCode": COUNTRY_CODE,
"datetime": ar... | https://github.com/tmrowco/electricitymap-contrib/issues/95 | Traceback (most recent call last):
File "feeder.py", line 51, in fetch_countries
obj = parser()
File "/home/parsers/PL.py", line 29, in fetch_PL
output_array = map(fetchValue, parameters)
File "/home/parsers/PL.py", line 21, in fetchValue
last = soup.find_all('point')[-1].find_all('quantity')[-1]
IndexError: list index... | IndexError |
def fetch_NO(session=None):
url = "http://driftsdata.statnett.no/restapi/ProductionConsumption/GetLatestDetailedOverview"
data = (session or requests).get(url).json()
countries = map(lambda x: x["value"], data["Headers"])
i = countries.index(COUNTRY_CODE)
obj = {
"countryCode": COUNTRY_COD... | def fetch_NO():
url = "http://driftsdata.statnett.no/restapi/ProductionConsumption/GetLatestDetailedOverview"
data = requests.get(url).json()
countries = map(lambda x: x["value"], data["Headers"])
i = countries.index(COUNTRY_CODE)
obj = {
"countryCode": COUNTRY_CODE,
"datetime": ar... | https://github.com/tmrowco/electricitymap-contrib/issues/95 | Traceback (most recent call last):
File "feeder.py", line 51, in fetch_countries
obj = parser()
File "/home/parsers/PL.py", line 29, in fetch_PL
output_array = map(fetchValue, parameters)
File "/home/parsers/PL.py", line 21, in fetchValue
last = soup.find_all('point')[-1].find_all('quantity')[-1]
IndexError: list index... | IndexError |
def fetch_PL(session=None):
return fetch_ENTSOE(ENTSOE_DOMAIN, COUNTRY_CODE, session)
| def fetch_PL():
parameters = ["B01", "B02", "B03", "B04", "B05", "B06", "B10", "B11", "B12", "B19"]
output_array = map(fetchValue, parameters)
data = {
"countryCode": COUNTRY_CODE,
"production": {
"wind": output_array[9],
"solar": 0,
"hydro": output_array... | https://github.com/tmrowco/electricitymap-contrib/issues/95 | Traceback (most recent call last):
File "feeder.py", line 51, in fetch_countries
obj = parser()
File "/home/parsers/PL.py", line 29, in fetch_PL
output_array = map(fetchValue, parameters)
File "/home/parsers/PL.py", line 21, in fetchValue
last = soup.find_all('point')[-1].find_all('quantity')[-1]
IndexError: list index... | IndexError |
def visit_for(self, node):
"""Emit a convention whenever range and len are used for indexing."""
# Verify that we have a `range([start], len(...), [stop])` call and
# that the object which is iterated is used as a subscript in the
# body of the for.
# Is it a proper range call?
if not isinstanc... | def visit_for(self, node):
"""Emit a convention whenever range and len are used for indexing."""
# Verify that we have a `range([start], len(...), [stop])` call and
# that the object which is iterated is used as a subscript in the
# body of the for.
# Is it a proper range call?
if not isinstanc... | https://github.com/PyCQA/pylint/issues/3735 | ************* Module alectryon.test
test:1:0: C0114: Missing module docstring (missing-module-docstring)
Traceback (most recent call last):
File "/home/clement/.local/bin/pylint", line 8, in <module>
sys.exit(run_pylint())
File "/home/clement/.local/lib/python3.8/site-packages/pylint/__init__.py", line 22, in run_pylin... | IndexError |
def is_default_argument(
node: astroid.node_classes.NodeNG,
scope: Optional[astroid.node_classes.NodeNG] = None,
) -> bool:
"""return true if the given Name node is used in function or lambda
default argument's value
"""
if not scope:
scope = node.scope()
if isinstance(scope, (astroi... | def is_default_argument(node: astroid.node_classes.NodeNG) -> bool:
"""return true if the given Name node is used in function or lambda
default argument's value
"""
parent = node.scope()
if isinstance(parent, (astroid.FunctionDef, astroid.Lambda)):
for default_node in parent.args.defaults:
... | https://github.com/PyCQA/pylint/issues/3461 | Traceback (most recent call last):
File "tmp.py", line 11, in <module>
class Wrong:
File "tmp.py", line 14, in Wrong
def work(self) -> self.Result2:
NameError: name 'self' is not defined | NameError |
def __init__(self, node, scope_type):
self._atomic = ScopeConsumer(copy.copy(node.locals), {}, scope_type)
self.node = node
| def __init__(self, node, scope_type):
self._atomic = ScopeConsumer(copy.copy(node.locals), {}, scope_type)
| https://github.com/PyCQA/pylint/issues/3461 | Traceback (most recent call last):
File "tmp.py", line 11, in <module>
class Wrong:
File "tmp.py", line 14, in Wrong
def work(self) -> self.Result2:
NameError: name 'self' is not defined | NameError |
def visit_name(self, node):
"""Check that a name is defined in the current scope"""
stmt = node.statement()
if stmt.fromlineno is None:
# name node from an astroid built from live code, skip
assert not stmt.root().file.endswith(".py")
return
name = node.name
frame = stmt.sco... | def visit_name(self, node):
"""Check that a name is defined in the current scope"""
stmt = node.statement()
if stmt.fromlineno is None:
# name node from an astroid built from live code, skip
assert not stmt.root().file.endswith(".py")
return
name = node.name
frame = stmt.sco... | https://github.com/PyCQA/pylint/issues/3461 | Traceback (most recent call last):
File "tmp.py", line 11, in <module>
class Wrong:
File "tmp.py", line 14, in Wrong
def work(self) -> self.Result2:
NameError: name 'self' is not defined | NameError |
def _ignore_class_scope(self, node):
"""
Return True if the node is in a local class scope, as an assignment.
:param node: Node considered
:type node: astroid.Node
:return: True if the node is in a local class scope, as an assignment. False otherwise.
:rtype: bool
"""
# Detect if we are... | def _ignore_class_scope(self, node):
"""
Return True if the node is in a local class scope, as an assignment.
:param node: Node considered
:type node: astroid.Node
:return: True if the node is in a local class scope, as an assignment. False otherwise.
:rtype: bool
"""
# Detect if we are... | https://github.com/PyCQA/pylint/issues/3461 | Traceback (most recent call last):
File "tmp.py", line 11, in <module>
class Wrong:
File "tmp.py", line 14, in Wrong
def work(self) -> self.Result2:
NameError: name 'self' is not defined | NameError |
def _worker_check_single_file(file_item):
name, filepath, modname = file_item
_worker_linter.open()
_worker_linter.check_single_file(name, filepath, modname)
msgs = [_get_new_args(m) for m in _worker_linter.reporter.messages]
return (
_worker_linter.current_name,
filepath,
... | def _worker_check_single_file(file_item):
name, filepath, modname = file_item
_worker_linter.open()
_worker_linter.check_single_file(name, filepath, modname)
msgs = [_get_new_args(m) for m in _worker_linter.reporter.messages]
return (
_worker_linter.current_name,
_worker_linter.fil... | https://github.com/PyCQA/pylint/issues/3564 | Traceback (most recent call last):
File "/opt/gitlab-runner/NCiG8AGt/0/<path>/.tox/pylint/bin/pylint", line 8, in <module>
sys.exit(run_pylint())
File "/opt/gitlab-runner/NCiG8AGt/0/<path>/.tox/pylint/lib/python3.6/site-packages/pylint/__init__.py", line 22, in run_pylint
PylintRun(sys.argv[1:])
File "/opt/gitlab-runne... | AttributeError |
def check_parallel(linter, jobs, files, arguments=None):
"""Use the given linter to lint the files with given amount of workers (jobs)"""
# The reporter does not need to be passed to worker processess, i.e. the reporter does
# not need to be pickleable
original_reporter = linter.reporter
linter.repo... | def check_parallel(linter, jobs, files, arguments=None):
"""Use the given linter to lint the files with given amount of workers (jobs)"""
# The reporter does not need to be passed to worker processess, i.e. the reporter does
# not need to be pickleable
original_reporter = linter.reporter
linter.repo... | https://github.com/PyCQA/pylint/issues/3564 | Traceback (most recent call last):
File "/opt/gitlab-runner/NCiG8AGt/0/<path>/.tox/pylint/bin/pylint", line 8, in <module>
sys.exit(run_pylint())
File "/opt/gitlab-runner/NCiG8AGt/0/<path>/.tox/pylint/lib/python3.6/site-packages/pylint/__init__.py", line 22, in run_pylint
PylintRun(sys.argv[1:])
File "/opt/gitlab-runne... | AttributeError |
def _check_late_binding_closure(self, node, assignment_node):
if not self.linter.is_message_enabled("cell-var-from-loop"):
return
def _is_direct_lambda_call():
return (
isinstance(node_scope.parent, astroid.Call)
and node_scope.parent.func is node_scope
)
no... | def _check_late_binding_closure(self, node, assignment_node):
if not self.linter.is_message_enabled("cell-var-from-loop"):
return
def _is_direct_lambda_call():
return (
isinstance(node_scope.parent, astroid.Call)
and node_scope.parent.func is node_scope
)
no... | https://github.com/PyCQA/pylint/issues/3646 | Traceback (most recent call last):
File "/Users/user/.local/share/virtualenvs/my_project/bin/pylint", line 8, in <module>
sys.exit(run_pylint())
File "/Users/user/.local/share/virtualenvs/my_project/lib/python3.6/site-packages/pylint/__init__.py", line 22, in run_pylint
PylintRun(sys.argv[1:])
File "/Users/user/.local/... | AttributeError |
def run_pylint():
"""run pylint"""
from pylint.lint import Run as PylintRun
try:
PylintRun(sys.argv[1:])
except KeyboardInterrupt:
sys.exit(1)
| def run_pylint():
"""run pylint"""
try:
PylintRun(sys.argv[1:])
except KeyboardInterrupt:
sys.exit(1)
| https://github.com/PyCQA/pylint/issues/3386 | Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/jeppe/.pyenv/versions/3.8.1/lib/python3.8/multiprocessing/spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "/Users/jeppe/.pyenv/versions/3.8.1/lib/python3.8/multiprocessing/spawn.py", line 125, in _main
pre... | ModuleNotFoundError |
def run_epylint():
"""run pylint"""
from pylint.epylint import Run as EpylintRun
EpylintRun()
| def run_epylint():
"""run pylint"""
EpylintRun()
| https://github.com/PyCQA/pylint/issues/3386 | Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/jeppe/.pyenv/versions/3.8.1/lib/python3.8/multiprocessing/spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "/Users/jeppe/.pyenv/versions/3.8.1/lib/python3.8/multiprocessing/spawn.py", line 125, in _main
pre... | ModuleNotFoundError |
def run_pyreverse():
"""run pyreverse"""
from pylint.pyreverse.main import Run as PyreverseRun
PyreverseRun(sys.argv[1:])
| def run_pyreverse():
"""run pyreverse"""
PyreverseRun(sys.argv[1:])
| https://github.com/PyCQA/pylint/issues/3386 | Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/jeppe/.pyenv/versions/3.8.1/lib/python3.8/multiprocessing/spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "/Users/jeppe/.pyenv/versions/3.8.1/lib/python3.8/multiprocessing/spawn.py", line 125, in _main
pre... | ModuleNotFoundError |
def run_symilar():
"""run symilar"""
from pylint.checkers.similar import Run as SimilarRun
SimilarRun(sys.argv[1:])
| def run_symilar():
"""run symilar"""
SimilarRun(sys.argv[1:])
| https://github.com/PyCQA/pylint/issues/3386 | Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/jeppe/.pyenv/versions/3.8.1/lib/python3.8/multiprocessing/spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "/Users/jeppe/.pyenv/versions/3.8.1/lib/python3.8/multiprocessing/spawn.py", line 125, in _main
pre... | ModuleNotFoundError |
def get_values(self, obj):
"""get label and shape for classes.
The label contains all attributes and methods
"""
label = obj.title
if obj.shape == "interface":
label = "«interface»\\n%s" % label
if not self.config.only_classnames:
label = r"%s|%s\l|" % (label, r"\l".join(obj.att... | def get_values(self, obj):
"""get label and shape for classes.
The label contains all attributes and methods
"""
label = obj.title
if obj.shape == "interface":
label = "«interface»\\n%s" % label
if not self.config.only_classnames:
label = r"%s|%s\l|" % (label, r"\l".join(obj.att... | https://github.com/PyCQA/pylint/issues/3351 | pyreverse -o png -my -f OTHER -S -A -p testuml ~/pyreverse_error.py
...
Traceback (most recent call last):
File "/home/ervthon/venv357/bin/pyreverse", line 11, in <module>
sys.exit(run_pyreverse())
File "/home/ervthon/venv357/lib/python3.5/site-packages/pylint/__init__.py", line 37, in run_pyreverse
PyreverseRun(sys.ar... | TypeError |
def visit_classdef(self, node):
"""visit an astroid.Class node
* set the locals_type and instance_attrs_type mappings
* set the implements list and build it
* optionally tag the node with a unique id
"""
if hasattr(node, "locals_type"):
return
node.locals_type = collections.defaultd... | def visit_classdef(self, node):
"""visit an astroid.Class node
* set the locals_type and instance_attrs_type mappings
* set the implements list and build it
* optionally tag the node with a unique id
"""
if hasattr(node, "locals_type"):
return
node.locals_type = collections.defaultd... | https://github.com/PyCQA/pylint/issues/3256 | parsing tests/test_simple.py...
Traceback (most recent call last):
File "/home/enkidulan/.cache/pypoetry/virtualenvs/pylintdev-py3.7/bin/pyreverse", line 7, in <module>
exec(compile(f.read(), __file__, 'exec'))
File "/home/enkidulan/projects/pylint/pylint/bin/pyreverse", line 4, in <module>
run_pyreverse()
File "/home/... | AttributeError |
def _load_reporter(self):
name = self._reporter_name.lower()
if name in self._reporters:
self.set_reporter(self._reporters[name]())
else:
try:
reporter_class = self._load_reporter_class()
except (ImportError, AttributeError):
raise exceptions.InvalidReporterEr... | def _load_reporter(self):
name = self._reporter_name.lower()
if name in self._reporters:
self.set_reporter(self._reporters[name]())
else:
qname = self._reporter_name
module = modutils.load_module_from_name(modutils.get_module_part(qname))
class_name = qname.split(".")[-1]
... | https://github.com/PyCQA/pylint/issues/1388 | ubuntu@ip-0000:~/scripts/pooja/ext-code/pylint$ pip list | grep astroid
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
astroid (1.5.0)
ubuntu@ip-0000:~/sc... | RuntimeError |
def _parallel_task(self, files_or_modules):
# Prepare configuration for child linters.
child_config = self._get_jobs_config()
children = []
manager = multiprocessing.Manager()
tasks_queue = manager.Queue()
results_queue = manager.Queue()
# Send files to child linters.
expanded_files = ... | def _parallel_task(self, files_or_modules):
# Prepare configuration for child linters.
child_config = self._get_jobs_config()
children = []
manager = multiprocessing.Manager()
tasks_queue = manager.Queue()
results_queue = manager.Queue()
# Send files to child linters.
expanded_files = ... | https://github.com/PyCQA/pylint/issues/1885 | ~/devel/openage % pylint --jobs=2 openage
No config file found, using default configuration
************* Module openage.__init__
W: 20, 0: TODO pylint: disable=wrong-import-position (fixme)
************* Module openage.__main__
W: 11, 0: TODO remove this once all multiprocessing has been eliminated: (fixme)
**********... | UnicodeDecodeError |
def _check_consider_get(self, node):
def type_and_name_are_equal(node_a, node_b):
for _type in [astroid.Name, astroid.AssignName]:
if all(isinstance(_node, _type) for _node in [node_a, node_b]):
return node_a.name == node_b.name
if all(isinstance(_node, astroid.Const) for... | def _check_consider_get(self, node):
def type_and_name_are_equal(node_a, node_b):
for _type in [astroid.Name, astroid.AssignName]:
if all(isinstance(_node, _type) for _node in [node_a, node_b]):
return node_a.name == node_b.name
if all(isinstance(_node, astroid.Const) for... | https://github.com/PyCQA/pylint/issues/2252 | Traceback (most recent call last):
File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/user/pylint/pylint/__main__.py", line 7, in <module>
pylint.run_pylint()
File "/home/user/pylint... | AttributeError |
def _is_node_return_ended(node):
"""Check if the node ends with an explicit return statement.
Args:
node (astroid.NodeNG): node to be checked.
Returns:
bool: True if the node ends with an explicit statement, False otherwise.
"""
# Recursion base case
if isinstance(node, astroi... | def _is_node_return_ended(node):
"""Check if the node ends with an explicit return statement.
Args:
node (astroid.NodeNG): node to be checked.
Returns:
bool: True if the node ends with an explicit statement, False otherwise.
"""
# Recursion base case
if isinstance(node, astroi... | https://github.com/PyCQA/pylint/issues/1773 | $ pylint pylint_test.py
No config file found, using default configuration
************* Module pylint_test
C: 1, 0: Missing module docstring (missing-docstring)
C: 1, 0: Missing class docstring (missing-docstring)
C: 4, 0: Missing function docstring (missing-docstring)
W: 6, 8: Using a conditional statement with a ... | AttributeError |
def _check_redefinition(self, redeftype, node):
"""check for redefinition of a function / method / class name"""
defined_self = node.parent.frame()[node.name]
if defined_self is not node and not astroid.are_exclusive(node, defined_self):
dummy_variables_rgx = lint_utils.get_global_option(
... | def _check_redefinition(self, redeftype, node):
"""check for redefinition of a function / method / class name"""
defined_self = node.parent.frame()[node.name]
if defined_self is not node and not astroid.are_exclusive(node, defined_self):
dummy_variables_rgx = lint_utils.get_global_option(
... | https://github.com/PyCQA/pylint/issues/1774 | Traceback (most recent call last):
File "/Users/jacques/miniconda/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/Users/jacques/miniconda/lib/python3.6/site-packages/pylint/__init__.py", line 16, in run_pylint
Run(sys.argv[1:])
File "/Users/jacques/miniconda/lib/python3.6/site-packages/pylint/lint.py", ... | AttributeError |
def _check_stop_iteration_inside_generator(self, node):
"""Check if an exception of type StopIteration is raised inside a generator"""
frame = node.frame()
if not isinstance(frame, astroid.FunctionDef) or not frame.is_generator():
return
if utils.node_ignores_exception(node, StopIteration):
... | def _check_stop_iteration_inside_generator(self, node):
"""Check if an exception of type StopIteration is raised inside a generator"""
frame = node.frame()
if not isinstance(frame, astroid.FunctionDef) or not frame.is_generator():
return
if utils.node_ignores_exception(node, StopIteration):
... | https://github.com/PyCQA/pylint/issues/1779 | # pylint test.py
No config file found, using default configuration
Traceback (most recent call last):
File "/usr/local/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/usr/local/lib/python3.6/dist-packages/pylint/__init__.py", line 16, in run_pylint
Run(sys.argv[1:])
File "/usr/local/lib/python3.6/dist-p... | TypeError |
def __init__(self, linter=None):
BaseChecker.__init__(self, linter)
self._accessed = ScopeAccessMap()
self._first_attrs = []
self._meth_could_be_func = None
| def __init__(self, linter=None):
BaseChecker.__init__(self, linter)
self._accessed = []
self._first_attrs = []
self._meth_could_be_func = None
| https://github.com/PyCQA/pylint/issues/1126 | No config file found, using default configuration
************* Module pylint_bug
C: 1, 0: Missing module docstring (missing-docstring)
C: 1, 0: Missing class docstring (missing-docstring)
C: 2,10: Missing method docstring (missing-docstring)
R: 1, 0: Too few public methods (1/2) (too-few-public-methods)
C: 6, 0: ... | IndexError |
def visit_classdef(self, node):
"""init visit variable _accessed"""
self._check_bases_classes(node)
# if not an exception or a metaclass
if node.type == "class" and has_known_bases(node):
try:
node.local_attr("__init__")
except astroid.NotFoundError:
self.add_mess... | def visit_classdef(self, node):
"""init visit variable _accessed"""
self._accessed.append(defaultdict(list))
self._check_bases_classes(node)
# if not an exception or a metaclass
if node.type == "class" and has_known_bases(node):
try:
node.local_attr("__init__")
except ast... | https://github.com/PyCQA/pylint/issues/1126 | No config file found, using default configuration
************* Module pylint_bug
C: 1, 0: Missing module docstring (missing-docstring)
C: 1, 0: Missing class docstring (missing-docstring)
C: 2,10: Missing method docstring (missing-docstring)
R: 1, 0: Too few public methods (1/2) (too-few-public-methods)
C: 6, 0: ... | IndexError |
def leave_classdef(self, cnode):
"""close a class node:
check that instance attributes are defined in __init__ and check
access to existent members
"""
# check access to existent members on non metaclass classes
ignore_mixins = get_global_option(self, "ignore-mixin-members", default=True)
if... | def leave_classdef(self, cnode):
"""close a class node:
check that instance attributes are defined in __init__ and check
access to existent members
"""
# check access to existent members on non metaclass classes
ignore_mixins = get_global_option(self, "ignore-mixin-members", default=True)
if... | https://github.com/PyCQA/pylint/issues/1126 | No config file found, using default configuration
************* Module pylint_bug
C: 1, 0: Missing module docstring (missing-docstring)
C: 1, 0: Missing class docstring (missing-docstring)
C: 2,10: Missing method docstring (missing-docstring)
R: 1, 0: Too few public methods (1/2) (too-few-public-methods)
C: 6, 0: ... | IndexError |
def visit_attribute(self, node):
"""check if the getattr is an access to a class member
if so, register it. Also check for access to protected
class member from outside its class (but ignore __special__
methods)
"""
# Check self
if self.is_first_attr(node):
self._accessed.set_accesse... | def visit_attribute(self, node):
"""check if the getattr is an access to a class member
if so, register it. Also check for access to protected
class member from outside its class (but ignore __special__
methods)
"""
attrname = node.attrname
# Check self
if self.is_first_attr(node):
... | https://github.com/PyCQA/pylint/issues/1126 | No config file found, using default configuration
************* Module pylint_bug
C: 1, 0: Missing module docstring (missing-docstring)
C: 1, 0: Missing class docstring (missing-docstring)
C: 2,10: Missing method docstring (missing-docstring)
R: 1, 0: Too few public methods (1/2) (too-few-public-methods)
C: 6, 0: ... | IndexError |
def visit_assignattr(self, node):
if isinstance(node.assign_type(), astroid.AugAssign) and self.is_first_attr(node):
self._accessed.set_accessed(node)
self._check_in_slots(node)
| def visit_assignattr(self, node):
if isinstance(node.assign_type(), astroid.AugAssign) and self.is_first_attr(node):
self._accessed[-1][node.attrname].append(node)
self._check_in_slots(node)
| https://github.com/PyCQA/pylint/issues/1126 | No config file found, using default configuration
************* Module pylint_bug
C: 1, 0: Missing module docstring (missing-docstring)
C: 1, 0: Missing class docstring (missing-docstring)
C: 2,10: Missing method docstring (missing-docstring)
R: 1, 0: Too few public methods (1/2) (too-few-public-methods)
C: 6, 0: ... | IndexError |
def _format_option_value(optdict, value):
"""return the user input's value from a 'compiled' value"""
if isinstance(value, (list, tuple)):
value = ",".join(_format_option_value(optdict, item) for item in value)
elif isinstance(value, dict):
value = ",".join("%s:%s" % (k, v) for k, v in value... | def _format_option_value(optdict, value):
"""return the user input's value from a 'compiled' value"""
if isinstance(value, (list, tuple)):
value = ",".join(value)
elif isinstance(value, dict):
value = ",".join("%s:%s" % (k, v) for k, v in value.items())
elif hasattr(value, "match"): # o... | https://github.com/PyCQA/pylint/issues/990 | $ pylint
[working help output]
$ pylint --ignore-patterns=.*_pb2.py
No config file found, using default configuration
Traceback (most recent call last):
File "/home/rcardona/.virtualenvs/tmp-4658876925714861/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/home/rcardona/.virtualenvs/tmp-4658876925714861/... | TypeError |
def _parse_token(self, token, value, parts):
if token == "YYYY":
parts["year"] = int(value)
elif token == "YY":
value = int(value)
parts["year"] = 1900 + value if value > 68 else 2000 + value
elif token in ["MMMM", "MMM"]:
parts["month"] = self.locale.month_number(value.low... | def _parse_token(self, token, value, parts):
if token == "YYYY":
parts["year"] = int(value)
elif token == "YY":
value = int(value)
parts["year"] = 1900 + value if value > 68 else 2000 + value
elif token in ["MMMM", "MMM"]:
parts["month"] = self.locale.month_number(value.low... | https://github.com/arrow-py/arrow/issues/851 | Traceback (most recent call last):
File "mytest.py", line 5, in <module>
print(arrow.get(date_en, f))
File "/bla/env/lib/python3.7/site-packages/arrow/api.py", line 21, in get
return _factory.get(*args, **kwargs)
File "/bla/env/lib/python3.7/site-packages/arrow/factory.py", line 243, in get
dt = parser.DateTimeParser(l... | ValueError |
def fromtimestamp(cls, timestamp, tzinfo=None):
"""Constructs an :class:`Arrow <arrow.arrow.Arrow>` object from a timestamp, converted to
the given timezone.
:param timestamp: an ``int`` or ``float`` timestamp, or a ``str`` that converts to either.
:param tzinfo: (optional) a ``tzinfo`` object. Defaul... | def fromtimestamp(cls, timestamp, tzinfo=None):
"""Constructs an :class:`Arrow <arrow.arrow.Arrow>` object from a timestamp, converted to
the given timezone.
:param timestamp: an ``int`` or ``float`` timestamp, or a ``str`` that converts to either.
:param tzinfo: (optional) a ``tzinfo`` object. Defaul... | https://github.com/arrow-py/arrow/issues/795 | arrow.get(1590889920000.0).timestamp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/charlie/Library/Python/3.7/lib/python/site-packages/arrow/api.py", line 21, in get
return _factory.get(*args, **kwargs)
File "/Users/charlie/Library/Python/3.7/lib/python/site-packages/arrow/factory.... | ValueError |
def utcfromtimestamp(cls, timestamp):
"""Constructs an :class:`Arrow <arrow.arrow.Arrow>` object from a timestamp, in UTC time.
:param timestamp: an ``int`` or ``float`` timestamp, or a ``str`` that converts to either.
"""
if not util.is_timestamp(timestamp):
raise ValueError("The provided ti... | def utcfromtimestamp(cls, timestamp):
"""Constructs an :class:`Arrow <arrow.arrow.Arrow>` object from a timestamp, in UTC time.
:param timestamp: an ``int`` or ``float`` timestamp, or a ``str`` that converts to either.
"""
if not util.is_timestamp(timestamp):
raise ValueError("The provided ti... | https://github.com/arrow-py/arrow/issues/795 | arrow.get(1590889920000.0).timestamp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/charlie/Library/Python/3.7/lib/python/site-packages/arrow/api.py", line 21, in get
return _factory.get(*args, **kwargs)
File "/Users/charlie/Library/Python/3.7/lib/python/site-packages/arrow/factory.... | ValueError |
def _build_datetime(parts):
weekdate = parts.get("weekdate")
if weekdate is not None:
# we can use strptime (%G, %V, %u) in python 3.6 but these tokens aren't available before that
year, week = int(weekdate[0]), int(weekdate[1])
if weekdate[2] is not None:
day = int(weekdat... | def _build_datetime(parts):
weekdate = parts.get("weekdate")
if weekdate is not None:
# we can use strptime (%G, %V, %u) in python 3.6 but these tokens aren't available before that
year, week = int(weekdate[0]), int(weekdate[1])
if weekdate[2] is not None:
day = int(weekdat... | https://github.com/arrow-py/arrow/issues/795 | arrow.get(1590889920000.0).timestamp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/charlie/Library/Python/3.7/lib/python/site-packages/arrow/api.py", line 21, in get
return _factory.get(*args, **kwargs)
File "/Users/charlie/Library/Python/3.7/lib/python/site-packages/arrow/factory.... | ValueError |
def is_timestamp(value):
"""Check if value is a valid timestamp."""
if isinstance(value, bool):
return False
if not (
isinstance(value, numbers.Integral)
or isinstance(value, float)
or isinstance(value, str)
):
return False
try:
float(value)
re... | def is_timestamp(value):
"""Check if value is a valid timestamp."""
if isinstance(value, bool):
return False
if not (
isinstance(value, int) or isinstance(value, float) or isinstance(value, str)
):
return False
try:
float(value)
return True
except ValueErr... | https://github.com/arrow-py/arrow/issues/795 | arrow.get(1590889920000.0).timestamp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/charlie/Library/Python/3.7/lib/python/site-packages/arrow/api.py", line 21, in get
return _factory.get(*args, **kwargs)
File "/Users/charlie/Library/Python/3.7/lib/python/site-packages/arrow/factory.... | ValueError |
def humanize(self, other=None, locale="en_us", only_distance=False, granularity="auto"):
"""Returns a localized, humanized representation of a relative difference in time.
:param other: (optional) an :class:`Arrow <arrow.arrow.Arrow>` or ``datetime`` object.
Defaults to now in the current :class:`Arrow... | def humanize(self, other=None, locale="en_us", only_distance=False, granularity="auto"):
"""Returns a localized, humanized representation of a relative difference in time.
:param other: (optional) an :class:`Arrow <arrow.arrow.Arrow>` or ``datetime`` object.
Defaults to now in the current :class:`Arrow... | https://github.com/arrow-py/arrow/issues/524 | Traceback (most recent call last):
File "dates_test.py", line 4, in <module>
print arrow.get('2018-01-12T00:00:00.000-07:00').humanize(locale='en', granularity='week')
File "/Users/nathanzylbersztejn/miniconda2/envs/rasa/lib/python2.7/site-packages/arrow/arrow.py", line 805, in humanize
"second", "minute", "hour", "day... | AttributeError |
def get(self, *args, **kwargs):
"""Returns an :class:`Arrow <arrow.arrow.Arrow>` object based on flexible inputs.
:param locale: (optional) a ``str`` specifying a locale for the parser. Defaults to
'en_us'.
:param tzinfo: (optional) a :ref:`timezone expression <tz-expr>` or tzinfo object.
R... | def get(self, *args, **kwargs):
"""Returns an :class:`Arrow <arrow.arrow.Arrow>` object based on flexible inputs.
:param locale: (optional) a ``str`` specifying a locale for the parser. Defaults to
'en_us'.
:param tzinfo: (optional) a :ref:`timezone expression <tz-expr>` or tzinfo object.
R... | https://github.com/arrow-py/arrow/issues/630 | In [1]: import arrow
In [2]: arrow.get("2010", "YYYY", locale="fr_FR")
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-2-a09819f3b7b0> in <module>
----> 1 arrow.get("2010", "YYYY", locale="fr_FR")
li... | TypeError |
def build_embeddings(opt, word_field, feat_fields, for_encoder=True):
"""
Args:
opt: the option in current environment.
word_dict(Vocab): words dictionary.
feature_dicts([Vocab], optional): a list of feature dictionary.
for_encoder(bool): build Embeddings for encoder or decoder?
... | def build_embeddings(opt, word_field, feat_fields, for_encoder=True):
"""
Args:
opt: the option in current environment.
word_dict(Vocab): words dictionary.
feature_dicts([Vocab], optional): a list of feature dictionary.
for_encoder(bool): build Embeddings for encoder or decoder?
... | https://github.com/OpenNMT/OpenNMT-py/issues/950 | Traceback (most recent call last):
File "train.py", line 40, in <module>
main(opt)
File "train.py", line 27, in main
single_main(opt)
File "/home/rudra/OpenNMT-py/onmt/train_single.py", line 113, in main
optim = build_optim(model, opt, checkpoint)
File "/home/rudra/OpenNMT-py/onmt/utils/optimizers.py", line 62, in buil... | ValueError |
def build_base_model(model_opt, fields, gpu, checkpoint=None):
"""
Args:
model_opt: the option loaded from checkpoint.
fields: `Field` objects for the model.
gpu(bool): whether to use gpu.
checkpoint: the model gnerated by train phase, or a resumed snapshot
mo... | def build_base_model(model_opt, fields, gpu, checkpoint=None):
"""
Args:
model_opt: the option loaded from checkpoint.
fields: `Field` objects for the model.
gpu(bool): whether to use gpu.
checkpoint: the model gnerated by train phase, or a resumed snapshot
mo... | https://github.com/OpenNMT/OpenNMT-py/issues/950 | Traceback (most recent call last):
File "train.py", line 40, in <module>
main(opt)
File "train.py", line 27, in main
single_main(opt)
File "/home/rudra/OpenNMT-py/onmt/train_single.py", line 113, in main
optim = build_optim(model, opt, checkpoint)
File "/home/rudra/OpenNMT-py/onmt/utils/optimizers.py", line 62, in buil... | ValueError |
def __init__(
self,
word_vec_size,
word_vocab_size,
word_padding_idx,
position_encoding=False,
feat_merge="concat",
feat_vec_exponent=0.7,
feat_vec_size=-1,
feat_padding_idx=[],
feat_vocab_sizes=[],
dropout=0,
sparse=False,
fix_word_vecs=False,
):
if feat_padding_... | def __init__(
self,
word_vec_size,
word_vocab_size,
word_padding_idx,
position_encoding=False,
feat_merge="concat",
feat_vec_exponent=0.7,
feat_vec_size=-1,
feat_padding_idx=[],
feat_vocab_sizes=[],
dropout=0,
sparse=False,
):
if feat_padding_idx is None:
feat... | https://github.com/OpenNMT/OpenNMT-py/issues/950 | Traceback (most recent call last):
File "train.py", line 40, in <module>
main(opt)
File "train.py", line 27, in main
single_main(opt)
File "/home/rudra/OpenNMT-py/onmt/train_single.py", line 113, in main
optim = build_optim(model, opt, checkpoint)
File "/home/rudra/OpenNMT-py/onmt/utils/optimizers.py", line 62, in buil... | ValueError |
def load_pretrained_vectors(self, emb_file):
"""Load in pretrained embeddings.
Args:
emb_file (str) : path to torch serialized embeddings
fixed (bool) : if true, embeddings are not updated
"""
if emb_file:
pretrained = torch.load(emb_file)
pretrained_vec_size = pretrained.si... | def load_pretrained_vectors(self, emb_file, fixed):
"""Load in pretrained embeddings.
Args:
emb_file (str) : path to torch serialized embeddings
fixed (bool) : if true, embeddings are not updated
"""
if emb_file:
pretrained = torch.load(emb_file)
pretrained_vec_size = pretra... | https://github.com/OpenNMT/OpenNMT-py/issues/950 | Traceback (most recent call last):
File "train.py", line 40, in <module>
main(opt)
File "train.py", line 27, in main
single_main(opt)
File "/home/rudra/OpenNMT-py/onmt/train_single.py", line 113, in main
optim = build_optim(model, opt, checkpoint)
File "/home/rudra/OpenNMT-py/onmt/utils/optimizers.py", line 62, in buil... | ValueError |
def __iter__(self):
"""
Iterator of (example_dict, nfeats).
On each call, it iterates over as many (example_dict, nfeats) tuples
until this shard's size equals to or approximates `self.shard_size`.
"""
iteration_index = -1
if self.assoc_iter is not None:
# We have associate iterator,... | def __iter__(self):
"""
Iterator of (example_dict, nfeats).
On each call, it iterates over as many (example_dict, nfeats) tuples
until this shard's size equals to or approximates `self.shard_size`.
"""
iteration_index = -1
if self.assoc_iter is not None:
# We have associate iterator,... | https://github.com/OpenNMT/OpenNMT-py/issues/911 | Traceback (most recent call last):
File "/mnt/cephfs2/asr/users/zewei.chu/SQuAD/round-trip-translation/OpenNMT-py/onmt/inputters/text_dataset.py", line 384, in __iter__
raise StopIteration
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "prepr... | RuntimeError |
def make_base_model(model_opt, fields, gpu, checkpoint=None):
"""
Args:
model_opt: the option loaded from checkpoint.
fields: `Field` objects for the model.
gpu(bool): whether to use gpu.
checkpoint: the model gnerated by train phase, or a resumed snapshot
mod... | def make_base_model(model_opt, fields, gpu, checkpoint=None):
"""
Args:
model_opt: the option loaded from checkpoint.
fields: `Field` objects for the model.
gpu(bool): whether to use gpu.
checkpoint: the model gnerated by train phase, or a resumed snapshot
mod... | https://github.com/OpenNMT/OpenNMT-py/issues/394 | ./run.sh translate
[...]
Loading model parameters.
While copying the parameter named encoder.embeddings.make_embedding.emb_luts.0.weight, whose dimensions in the model are torch.Size([22, 500]) and whose dimensions in the checkpoint are torch.Size([22, 100]), ...
Traceback (most recent call last):
File "translate.py",... | RuntimeError |
def train_model(model, train_data, valid_data, fields, optim):
train_iter = make_train_data_iter(train_data, opt)
valid_iter = make_valid_data_iter(valid_data, opt)
train_loss = make_loss_compute(model, fields["tgt"].vocab, train_data, opt)
valid_loss = make_loss_compute(model, fields["tgt"].vocab, val... | def train_model(model, train_data, valid_data, fields, optim):
train_iter = make_train_data_iter(train_data, opt)
valid_iter = make_valid_data_iter(valid_data, opt)
train_loss = make_loss_compute(model, fields["tgt"].vocab, train_data, opt)
valid_loss = make_loss_compute(model, fields["tgt"].vocab, val... | https://github.com/OpenNMT/OpenNMT-py/issues/394 | ./run.sh translate
[...]
Loading model parameters.
While copying the parameter named encoder.embeddings.make_embedding.emb_luts.0.weight, whose dimensions in the model are torch.Size([22, 500]) and whose dimensions in the checkpoint are torch.Size([22, 100]), ...
Traceback (most recent call last):
File "translate.py",... | RuntimeError |
def train_model(model, train, valid, fields, optim, model_opt):
train_iter = make_train_data_iter(train, opt)
valid_iter = make_valid_data_iter(valid, opt)
train_loss = make_loss_compute(model, fields["tgt"].vocab, train, opt)
valid_loss = make_loss_compute(model, fields["tgt"].vocab, valid, opt)
... | def train_model(model, train, valid, fields, optim):
train_iter = make_train_data_iter(train, opt)
valid_iter = make_valid_data_iter(valid, opt)
train_loss = make_loss_compute(model, fields["tgt"].vocab, train, opt)
valid_loss = make_loss_compute(model, fields["tgt"].vocab, valid, opt)
trunc_size ... | https://github.com/OpenNMT/OpenNMT-py/issues/394 | ./run.sh translate
[...]
Loading model parameters.
While copying the parameter named encoder.embeddings.make_embedding.emb_luts.0.weight, whose dimensions in the model are torch.Size([22, 500]) and whose dimensions in the checkpoint are torch.Size([22, 100]), ...
Traceback (most recent call last):
File "translate.py",... | RuntimeError |
def main():
# Load train and validate data.
print("Loading train and validate data from '%s'" % opt.data)
train = torch.load(opt.data + ".train.pt")
valid = torch.load(opt.data + ".valid.pt")
print(" * number of training sentences: %d" % len(train))
print(" * maximum batch size: %d" % opt.batch_... | def main():
# Load train and validate data.
print("Loading train and validate data from '%s'" % opt.data)
train = torch.load(opt.data + ".train.pt")
valid = torch.load(opt.data + ".valid.pt")
print(" * number of training sentences: %d" % len(train))
print(" * maximum batch size: %d" % opt.batch_... | https://github.com/OpenNMT/OpenNMT-py/issues/394 | ./run.sh translate
[...]
Loading model parameters.
While copying the parameter named encoder.embeddings.make_embedding.emb_luts.0.weight, whose dimensions in the model are torch.Size([22, 500]) and whose dimensions in the checkpoint are torch.Size([22, 100]), ...
Traceback (most recent call last):
File "translate.py",... | RuntimeError |
def generate(
self,
input_ids=None,
max_length=None,
min_length=None,
do_sample=None,
early_stopping=None,
num_beams=None,
temperature=None,
top_k=None,
top_p=None,
repetition_penalty=None,
bad_words_ids=None,
bos_token_id=None,
pad_token_id=None,
eos_token_id... | def generate(
self,
input_ids=None,
max_length=None,
min_length=None,
do_sample=None,
early_stopping=None,
num_beams=None,
temperature=None,
top_k=None,
top_p=None,
repetition_penalty=None,
bad_words_ids=None,
bos_token_id=None,
pad_token_id=None,
eos_token_id... | https://github.com/huggingface/transformers/issues/8361 | import transformers
model = transformers.TFT5ForConditionalGeneration.from_pretrained('t5-small', output_hidden_states=True, output_attentions=True)
tokenizer = transformers.T5Tokenizer.from_pretrained('t5-small')
input_ids = tokenizer.batch_encode_plus(['test 1', 'test 2', 'test 3'], return_tensors="tf", padding='long... | AssertionError |
def _tf_glue_convert_examples_to_features(
examples: tf.data.Dataset,
tokenizer: PreTrainedTokenizer,
task=str,
max_length: Optional[int] = None,
) -> tf.data.Dataset:
"""
Returns:
A ``tf.data.Dataset`` containing the task-specific features.
"""
processor = glue_processors[task]... | def _tf_glue_convert_examples_to_features(
examples: tf.data.Dataset,
tokenizer: PreTrainedTokenizer,
task=str,
max_length: Optional[int] = None,
) -> tf.data.Dataset:
"""
Returns:
A ``tf.data.Dataset`` containing the task-specific features.
"""
processor = glue_processors[task]... | https://github.com/huggingface/transformers/issues/4856 | Traceback (most recent call last):
File "run_glue.py", line 229, in <module>
main()
File "run_glue.py", line 199, in main
compute_metrics=compute_metrics,
File "/home/ubuntu/anaconda3/envs/tensorflow2_p36/lib/python3.6/site-packages/transformers/trainer_tf.py", line 48, in __init__
self._setup_training()
File "/home/ub... | tensorflow.python.framework.errors_impl.InvalidArgumentError |
def gen():
for ex in features:
d = {k: v for k, v in asdict(ex).items() if v is not None}
label = d.pop("label")
yield (d, label)
| def gen():
for ex in features:
yield (
{
"input_ids": ex.input_ids,
"attention_mask": ex.attention_mask,
"token_type_ids": ex.token_type_ids,
},
ex.label,
)
| https://github.com/huggingface/transformers/issues/4856 | Traceback (most recent call last):
File "run_glue.py", line 229, in <module>
main()
File "run_glue.py", line 199, in main
compute_metrics=compute_metrics,
File "/home/ubuntu/anaconda3/envs/tensorflow2_p36/lib/python3.6/site-packages/transformers/trainer_tf.py", line 48, in __init__
self._setup_training()
File "/home/ub... | tensorflow.python.framework.errors_impl.InvalidArgumentError |
def squad_convert_examples_to_features(
examples,
tokenizer,
max_seq_length,
doc_stride,
max_query_length,
is_training,
return_dataset=False,
threads=1,
tqdm_enabled=True,
):
"""
Converts a list of examples into a list of features that can be directly given as input to a mode... | def squad_convert_examples_to_features(
examples,
tokenizer,
max_seq_length,
doc_stride,
max_query_length,
is_training,
return_dataset=False,
threads=1,
tqdm_enabled=True,
):
"""
Converts a list of examples into a list of features that can be directly given as input to a mode... | https://github.com/huggingface/transformers/issues/4856 | Traceback (most recent call last):
File "run_glue.py", line 229, in <module>
main()
File "run_glue.py", line 199, in main
compute_metrics=compute_metrics,
File "/home/ubuntu/anaconda3/envs/tensorflow2_p36/lib/python3.6/site-packages/transformers/trainer_tf.py", line 48, in __init__
self._setup_training()
File "/home/ub... | tensorflow.python.framework.errors_impl.InvalidArgumentError |
def gen():
for i, ex in enumerate(features):
if ex.token_type_ids is None:
yield (
{
"input_ids": ex.input_ids,
"attention_mask": ex.attention_mask,
"feature_index": i,
"qas_id": ex.qas_id,
... | def gen():
for i, ex in enumerate(features):
yield (
{
"input_ids": ex.input_ids,
"attention_mask": ex.attention_mask,
"token_type_ids": ex.token_type_ids,
"feature_index": i,
"qas_id": ex.qas_id,
},
... | https://github.com/huggingface/transformers/issues/4856 | Traceback (most recent call last):
File "run_glue.py", line 229, in <module>
main()
File "run_glue.py", line 199, in main
compute_metrics=compute_metrics,
File "/home/ubuntu/anaconda3/envs/tensorflow2_p36/lib/python3.6/site-packages/transformers/trainer_tf.py", line 48, in __init__
self._setup_training()
File "/home/ub... | tensorflow.python.framework.errors_impl.InvalidArgumentError |
def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""Instantiates one of the base model classes of the library
from a pre-trained model configuration.
The `from_pretrained()` method takes care of returning the correct model class instance
based on the `model_type` propert... | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""Instantiates one of the base model classes of the library
from a pre-trained model configuration.
The `from_pretrained()` method takes care of returning the correct model class instance
based on the `model_type` propert... | https://github.com/huggingface/transformers/issues/2985 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "[...]/transformers/src/transformers/modeling_auto.py", line 384, in from_pretrained
return model_class.from_pretrained(pretrained_model_name_or_path, *model_args, config=config, **kwargs)
File "[...]/transformers/src/transformers/modeling_util... | TypeError |
def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""Instantiates one of the model classes of the library -with the architecture used for pretraining this model– from a pre-trained model configuration.
The `from_pretrained()` method takes care of returning the correct model class... | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""Instantiates one of the model classes of the library -with the architecture used for pretraining this model– from a pre-trained model configuration.
The `from_pretrained()` method takes care of returning the correct model class... | https://github.com/huggingface/transformers/issues/2985 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "[...]/transformers/src/transformers/modeling_auto.py", line 384, in from_pretrained
return model_class.from_pretrained(pretrained_model_name_or_path, *model_args, config=config, **kwargs)
File "[...]/transformers/src/transformers/modeling_util... | TypeError |
def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""Instantiates one of the language modeling model classes of the library
from a pre-trained model configuration.
The `from_pretrained()` method takes care of returning the correct model class instance
based on the `model_... | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""Instantiates one of the language modeling model classes of the library
from a pre-trained model configuration.
The `from_pretrained()` method takes care of returning the correct model class instance
based on the `model_... | https://github.com/huggingface/transformers/issues/2985 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "[...]/transformers/src/transformers/modeling_auto.py", line 384, in from_pretrained
return model_class.from_pretrained(pretrained_model_name_or_path, *model_args, config=config, **kwargs)
File "[...]/transformers/src/transformers/modeling_util... | TypeError |
def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""Instantiates one of the sequence classification model classes of the library
from a pre-trained model configuration.
The `from_pretrained()` method takes care of returning the correct model class instance
based on the `... | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""Instantiates one of the sequence classification model classes of the library
from a pre-trained model configuration.
The `from_pretrained()` method takes care of returning the correct model class instance
based on the `... | https://github.com/huggingface/transformers/issues/2985 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "[...]/transformers/src/transformers/modeling_auto.py", line 384, in from_pretrained
return model_class.from_pretrained(pretrained_model_name_or_path, *model_args, config=config, **kwargs)
File "[...]/transformers/src/transformers/modeling_util... | TypeError |
def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""Instantiates one of the question answering model classes of the library
from a pre-trained model configuration.
The `from_pretrained()` method takes care of returning the correct model class instance
based on the `model... | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""Instantiates one of the question answering model classes of the library
from a pre-trained model configuration.
The `from_pretrained()` method takes care of returning the correct model class instance
based on the `model... | https://github.com/huggingface/transformers/issues/2985 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "[...]/transformers/src/transformers/modeling_auto.py", line 384, in from_pretrained
return model_class.from_pretrained(pretrained_model_name_or_path, *model_args, config=config, **kwargs)
File "[...]/transformers/src/transformers/modeling_util... | TypeError |
def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""Instantiates one of the question answering model classes of the library
from a pre-trained model configuration.
The `from_pretrained()` method takes care of returning the correct model class instance
based on the `model... | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""Instantiates one of the question answering model classes of the library
from a pre-trained model configuration.
The `from_pretrained()` method takes care of returning the correct model class instance
based on the `model... | https://github.com/huggingface/transformers/issues/2985 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "[...]/transformers/src/transformers/modeling_auto.py", line 384, in from_pretrained
return model_class.from_pretrained(pretrained_model_name_or_path, *model_args, config=config, **kwargs)
File "[...]/transformers/src/transformers/modeling_util... | TypeError |
def start(self, wait=60, *, server_settings={}, **opts):
"""Start the cluster."""
status = self.get_status()
if status == "running":
return
elif status == "not-initialized":
raise ClusterError(
"cluster in {!r} has not been initialized".format(self._data_dir)
)
p... | def start(self, wait=60, *, server_settings={}, **opts):
"""Start the cluster."""
status = self.get_status()
if status == "running":
return
elif status == "not-initialized":
raise ClusterError(
"cluster in {!r} has not been initialized".format(self._data_dir)
)
p... | https://github.com/MagicStack/asyncpg/issues/220 | [2017-11-01 00:09:25,800] (ERROR) asyncio: Task was destroyed but it is pending!
task: <Task pending coro=<Pool.release.<locals>._release_impl() running at /usr/local/lib/python3.6/site-packages/asyncpg/pool.py:465> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f830f109d68>()]> cb=[shield.<locals>._d... | AttributeError |
def __init__(
self,
protocol,
transport,
loop,
addr: (str, int) or str,
config: connect_utils._ClientConfiguration,
params: connect_utils._ConnectionParameters,
):
self._protocol = protocol
self._transport = transport
self._loop = loop
self._top_xact = None
self._aborted ... | def __init__(
self,
protocol,
transport,
loop,
addr: (str, int) or str,
config: connect_utils._ClientConfiguration,
params: connect_utils._ConnectionParameters,
):
self._protocol = protocol
self._transport = transport
self._loop = loop
self._top_xact = None
self._aborted ... | https://github.com/MagicStack/asyncpg/issues/220 | [2017-11-01 00:09:25,800] (ERROR) asyncio: Task was destroyed but it is pending!
task: <Task pending coro=<Pool.release.<locals>._release_impl() running at /usr/local/lib/python3.6/site-packages/asyncpg/pool.py:465> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f830f109d68>()]> cb=[shield.<locals>._d... | AttributeError |
async def close(self, *, timeout=None):
"""Close the connection gracefully.
:param float timeout:
Optional timeout value in seconds.
.. versionchanged:: 0.14.0
Added the *timeout* parameter.
"""
if self.is_closed():
return
self._mark_stmts_as_closed()
self._listeners... | async def close(self):
"""Close the connection gracefully."""
if self.is_closed():
return
self._mark_stmts_as_closed()
self._listeners.clear()
self._log_listeners.clear()
self._aborted = True
await self._protocol.close()
| https://github.com/MagicStack/asyncpg/issues/220 | [2017-11-01 00:09:25,800] (ERROR) asyncio: Task was destroyed but it is pending!
task: <Task pending coro=<Pool.release.<locals>._release_impl() running at /usr/local/lib/python3.6/site-packages/asyncpg/pool.py:465> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f830f109d68>()]> cb=[shield.<locals>._d... | AttributeError |
def terminate(self):
"""Terminate the connection without waiting for pending data."""
self._mark_stmts_as_closed()
self._listeners.clear()
self._log_listeners.clear()
self._aborted = True
self._protocol.abort()
self._clean_tasks()
| def terminate(self):
"""Terminate the connection without waiting for pending data."""
self._mark_stmts_as_closed()
self._listeners.clear()
self._log_listeners.clear()
self._aborted = True
self._protocol.abort()
| https://github.com/MagicStack/asyncpg/issues/220 | [2017-11-01 00:09:25,800] (ERROR) asyncio: Task was destroyed but it is pending!
task: <Task pending coro=<Pool.release.<locals>._release_impl() running at /usr/local/lib/python3.6/site-packages/asyncpg/pool.py:465> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f830f109d68>()]> cb=[shield.<locals>._d... | AttributeError |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.