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 __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._add_scalars()
self._create_service_field()
self._extend_query_type()
| def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._extend_query_type()
| https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def _extend_query_type(self):
fields = {"_service": self._service_field}
entity_type = _get_entity_type(self.type_map)
if entity_type:
self._schema.type_map[entity_type.name] = entity_type
fields["_entities"] = self._get_entities_field(entity_type)
fields.update(self._schema.query_ty... | def _extend_query_type(self):
@type(name="_Service")
class Service:
sdl: str
Any = GraphQLScalarType("_Any")
fields = {
"_service": GraphQLField(
GraphQLNonNull(Service.graphql_type),
resolve=lambda _, info: Service(sdl=print_schema(info.schema)),
)
... | https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def entities_resolver(self, root, info, representations):
results = []
for representation in representations:
type_name = representation.pop("__typename")
type = self.type_map[type_name]
results.append(type.definition.origin.resolve_reference(**representation))
return results
| def entities_resolver(root, info, representations):
results = []
for representation in representations:
type_name = representation.pop("__typename")
graphql_type = info.schema.get_type(type_name)
result = get_strawberry_type_for_graphql_type(graphql_type).resolve_reference(
... | https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def field(
f=None,
*,
name: Optional[str] = None,
is_subscription: bool = False,
description: Optional[str] = None,
resolver: Optional[Callable] = None,
permission_classes: Optional[List[Type[BasePermission]]] = None,
federation: Optional[FederationFieldParams] = None,
):
"""Annotate... | def field(
wrap=None,
*,
name=None,
description=None,
resolver=None,
is_input=False,
is_subscription=False,
permission_classes=None,
):
"""Annotates a method or property as a GraphQL field.
This is normally used inside a type declaration:
>>> @strawberry.type:
>>> class... | https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def __init__(self, field_definition: FieldDefinition):
self._field_definition = field_definition
super().__init__( # type: ignore
default=dataclasses.MISSING,
default_factory=dataclasses.MISSING,
init=field_definition.base_resolver is None,
repr=True,
hash=None,
... | def __init__(
self,
*,
is_input=False,
is_subscription=False,
resolver=None,
name=None,
description=None,
metadata=None,
permission_classes=None,
):
self.field_name = name
self.field_description = description
self.field_resolver = resolver
self.is_subscription = is_su... | https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def __call__(self, f):
f._field_definition = self._field_definition
f._field_definition.name = f._field_definition.name or to_camel_case(f.__name__)
f._field_definition.base_resolver = f
f._field_definition.origin = f
f._field_definition.arguments = get_arguments_from_resolver(
f, f._field_d... | def __call__(self, wrap):
setattr(wrap, IS_STRAWBERRY_FIELD, True)
self.field_description = self.field_description or wrap.__doc__
return LazyFieldWrapper(
wrap,
is_input=self.is_input,
is_subscription=self.is_subscription,
resolver=self.field_resolver,
name=self.fi... | https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def __init__(
self,
schema: BaseSchema,
graphiql: bool = True,
root_value: Optional[Any] = None,
):
self.graphiql = graphiql
self.schema = schema
self.root_value = root_value
| def __init__(self, schema, graphiql=True):
self.schema = schema
self.graphiql = graphiql
if not self.schema:
raise ValueError("You must pass in a schema to GraphQLView")
if not isinstance(self.schema, GraphQLSchema):
raise ValueError("A valid schema is required to be provided to GraphQ... | https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def dispatch_request(self):
if "text/html" in request.environ.get("HTTP_ACCEPT", ""):
if not self.graphiql:
abort(404)
template = render_graphiql_page()
return self.render_template(request, template=template)
data = request.json
try:
query = data["query"]
... | def dispatch_request(self):
if "text/html" in request.environ.get("HTTP_ACCEPT", ""):
if not self.graphiql:
abort(404)
template = render_graphiql_page()
return self.render_template(request, template=template)
data = request.json
try:
query = data["query"]
... | https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
async def execute(
schema: GraphQLSchema,
query: str,
root_value: typing.Any = None,
context_value: typing.Any = None,
variable_values: typing.Dict[str, typing.Any] = None,
middleware: typing.List[Middleware] = None,
operation_name: str = None,
): # pragma: no cover
schema_validation_er... | async def execute(
schema: GraphQLSchema,
query: str,
root_value: typing.Any = None,
context_value: typing.Any = None,
variable_values: typing.Dict[str, typing.Any] = None,
operation_name: str = None,
):
schema_validation_errors = validate_schema(schema)
if schema_validation_errors:
... | https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
async def subscribe(
schema: GraphQLSchema,
query: str,
root_value: typing.Any = None,
context_value: typing.Any = None,
variable_values: typing.Dict[str, typing.Any] = None,
operation_name: str = None,
) -> typing.Union[
typing.AsyncIterator[ExecutionResult], ExecutionResult
]: # pragma: n... | async def subscribe(
schema: GraphQLSchema,
query: str,
root_value: typing.Any = None,
context_value: typing.Any = None,
variable_values: typing.Dict[str, typing.Any] = None,
operation_name: str = None,
) -> typing.Union[typing.AsyncIterator[ExecutionResult], ExecutionResult]:
document = par... | https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def resolve(self, next_, root, info, **kwargs):
result = next_(root, info, **kwargs)
for directive in info.field_nodes[0].directives:
directive_name = directive.name.value
if directive_name in SPECIFIED_DIRECTIVES:
continue
func = self.directives.get(directive_name).resolv... | def resolve(self, next_, root, info, **kwargs):
result = next_(root, info, **kwargs)
for directive in info.field_nodes[0].directives:
directive_name = directive.name.value
if directive_name in SPECIFIED_DIRECTIVES:
continue
func = DIRECTIVE_REGISTRY.get(directive_name)
... | https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def print_federation_field_directive(field: Optional[FieldDefinition]) -> str:
if not field:
return ""
out = ""
if field.federation.provides:
out += f' @provides(fields: "{field.federation.provides}")'
if field.federation.requires:
out += f' @requires(fields: "{field.federatio... | def print_federation_field_directive(field, metadata):
out = ""
if metadata and "federation" in metadata:
federation = metadata["federation"]
provides = federation.get("provides", "")
requires = federation.get("requires", "")
external = federation.get("external", False)
... | https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def print_fields(type_, schema: BaseSchema) -> str:
strawberry_type = cast(TypeDefinition, schema.get_type_by_name(type_.name))
fields = []
for i, (name, field) in enumerate(type_.fields.items()):
field_definition = strawberry_type.get_field(name) if strawberry_type else None
fields.appen... | def print_fields(type_) -> str:
strawberry_type = get_strawberry_type_for_graphql_type(type_)
strawberry_fields = dataclasses.fields(strawberry_type) if strawberry_type else []
def _get_metadata(field_name):
return next(
(
f.metadata
for f in strawberry_f... | https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def print_federation_key_directive(type_, schema: BaseSchema):
strawberry_type = cast(TypeDefinition, schema.get_type_by_name(type_.name))
if not strawberry_type:
return ""
keys = strawberry_type.federation.keys
parts = []
for key in keys:
parts.append(f'@key(fields: "{key}")')
... | def print_federation_key_directive(type_):
strawberry_type = get_strawberry_type_for_graphql_type(type_)
if not strawberry_type:
return ""
keys = getattr(strawberry_type, "_federation_keys", [])
parts = []
for key in keys:
parts.append(f'@key(fields: "{key}")')
if not parts:... | https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def print_extends(type_, schema: BaseSchema):
strawberry_type = cast(TypeDefinition, schema.get_type_by_name(type_.name))
if strawberry_type and strawberry_type.federation.extend:
return "extend "
return ""
| def print_extends(type_):
strawberry_type = get_strawberry_type_for_graphql_type(type_)
if strawberry_type and getattr(strawberry_type, "_federation_extend", False):
return "extend "
return ""
| https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def print_schema(schema: BaseSchema) -> str:
graphql_core_schema = schema._schema # type: ignore
directives = filter(
lambda n: not is_specified_directive(n), graphql_core_schema.directives
)
type_map = graphql_core_schema.type_map
types = filter(is_defined_type, map(type_map.get, sorted(... | def print_schema(schema: GraphQLSchema) -> str:
return print_filtered_schema(
schema, lambda n: not is_specified_directive(n), is_defined_type
)
| https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def _process_type(
cls,
*,
name: Optional[str] = None,
is_input: bool = False,
is_interface: bool = False,
description: Optional[str] = None,
federation: Optional[FederationTypeParams] = None,
):
name = name or to_camel_case(cls.__name__)
wrapped = dataclasses.dataclass(cls)
in... | def _process_type(
cls, *, name=None, is_input=False, is_interface=False, description=None
):
name = name or cls.__name__
def _get_fields(wrapped, types_replacement_map=None):
class_fields = dataclasses.fields(wrapped)
fields = {}
for class_field in class_fields:
# we ... | https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def type(
cls: Type = None,
*,
name: str = None,
is_input: bool = False,
is_interface: bool = False,
description: str = None,
federation: Optional[FederationTypeParams] = None,
):
"""Annotates a class as a GraphQL type.
Example usage:
>>> @strawberry.type:
>>> class X:
... | def type(cls=None, *, name=None, is_input=False, is_interface=False, description=None):
"""Annotates a class as a GraphQL type.
Example usage:
>>> @strawberry.type:
>>> class X:
>>> field_abc: str = "ABC"
"""
def wrap(cls):
return _process_type(
cls,
na... | https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def wrap(cls):
return _process_type(
cls,
name=name,
is_input=is_input,
is_interface=is_interface,
description=description,
federation=federation,
)
| def wrap(cls):
return _process_type(
cls,
name=name,
is_input=is_input,
is_interface=is_interface,
description=description,
)
| https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def union(name: str, types: Tuple[Type], *, description=None):
"""Creates a new named Union type.
Example usages:
>>> strawberry.union(
>>> "Name",
>>> (A, B),
>>> )
>>> strawberry.union(
>>> "Name",
>>> (A, B),
>>> )
"""
union_definition = UnionDefini... | def union(name: str, types: typing.Tuple[typing.Type], *, description=None):
"""Creates a new named Union type.
Example usages:
>>> strawberry.union(
>>> "Name",
>>> (A, B),
>>> )
>>> strawberry.union(
>>> "Name",
>>> (A, B),
>>> )
"""
from .type_conve... | https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def pretty_print_graphql_operation(
operation_name: str, query: str, variables: typing.Dict["str", typing.Any]
): # pragma: no cover
"""Pretty print a GraphQL operation using pygments.
Won't print introspection operation to prevent noise in the output."""
if operation_name == "IntrospectionQuery":
... | def pretty_print_graphql_operation(
operation_name: str, query: str, variables: typing.Dict["str", typing.Any]
):
"""Pretty print a GraphQL operation using pygments.
Won't print introspection operation to prevent noise in the output."""
if operation_name == "IntrospectionQuery":
return
no... | https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def is_list(annotation: Type) -> bool:
"""Returns True if annotation is a List"""
annotation_origin = getattr(annotation, "__origin__", None)
return annotation_origin == list
| def is_list(annotation):
"""Returns True if annotation is a typing.List"""
annotation_origin = getattr(annotation, "__origin__", None)
return annotation_origin == list
| https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def is_union(annotation: Type) -> bool:
"""Returns True if annotation is a Union"""
annotation_origin = getattr(annotation, "__origin__", None)
return annotation_origin == typing.Union
| def is_union(annotation):
"""Returns True if annotation is a typing.Union"""
annotation_origin = getattr(annotation, "__origin__", None)
return annotation_origin == typing.Union
| https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def is_optional(annotation: Type) -> bool:
"""Returns True if the annotation is Optional[SomeType]"""
# Optionals are represented as unions
if not is_union(annotation):
return False
types = annotation.__args__
# A Union to be optional needs to have at least one None type
return any([... | def is_optional(annotation):
"""Returns True if the annotation is typing.Optional[SomeType]"""
# Optionals are represented as unions
if not is_union(annotation):
return False
types = annotation.__args__
# A Union to be optional needs to have at least one None type
return any([x == No... | https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def get_optional_annotation(annotation: Type) -> Type:
types = annotation.__args__
non_none_types = [x for x in types if x != None.__class__] # noqa:E711
return non_none_types[0]
| def get_optional_annotation(annotation):
types = annotation.__args__
non_none_types = [x for x in types if x != None.__class__] # noqa:E711
return non_none_types[0]
| https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def get_list_annotation(annotation: Type) -> Type:
return annotation.__args__[0]
| def get_list_annotation(annotation):
return annotation.__args__[0]
| https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def is_generic(annotation: Type) -> bool:
"""Returns True if the annotation is or extends a generic."""
return (
isinstance(annotation, type)
and issubclass(annotation, typing.Generic) # type:ignore
or isinstance(annotation, typing._GenericAlias) # type:ignore
and annotation.__... | def is_generic(annotation) -> bool:
"""Returns True if the annotation is or extends a generic."""
return (
isinstance(annotation, type)
and issubclass(annotation, typing.Generic) # type:ignore
or isinstance(annotation, typing._GenericAlias) # type:ignore
and annotation.__origin... | https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def is_type_var(annotation: Type) -> bool:
"""Returns True if the annotation is a TypeVar."""
return isinstance(annotation, TypeVar) # type:ignore
| def is_type_var(annotation) -> bool:
"""Returns True if the annotation is a TypeVar."""
return isinstance(annotation, typing.TypeVar) # type:ignore
| https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def has_type_var(annotation: Type) -> bool:
"""
Returns True if the annotation or any of
its argument have a TypeVar as argument.
"""
return any(
is_type_var(arg) or has_type_var(arg)
for arg in getattr(annotation, "__args__", [])
)
| def has_type_var(annotation) -> bool:
"""
Returns True if the annotation or any of
its argument have a TypeVar as argument.
"""
return any(
is_type_var(arg) or has_type_var(arg)
for arg in getattr(annotation, "__args__", [])
)
| https://github.com/strawberry-graphql/strawberry/issues/349 | Traceback (most recent call last):
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graphql/type/definition.py", line 735, in fields
fields = resolve_thunk(self._fields)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/graph... | AttributeError |
def _get_resolver(cls, field_name):
class_field = getattr(cls, field_name, None)
if class_field and getattr(class_field, "resolver", None):
return class_field.resolver
def _resolver(root, info):
if not root:
return None
field_resolver = getattr(root, field_name, None)
... | def _get_resolver(cls, field_name):
class_field = getattr(cls, field_name, None)
if class_field and getattr(class_field, "resolver", None):
return class_field.resolver
def _resolver(root, info):
if not root:
return None
field_resolver = getattr(root, field_name, None)
... | https://github.com/strawberry-graphql/strawberry/issues/377 | Traceback (most recent call last):
File "/home/ignormies/.config/JetBrains/PyCharm2020.1/scratches/scratch.py", line 28, in <module>
schema = strawberry.Schema(query=CoolType)
File "/home/ignormies/.local/share/virtualenvs/gql-bf-XGX4szKA-py3.8/lib/python3.8/site-packages/strawberry/schema.py", line 25, in __init__
sup... | TypeError |
def _replace_consonants(word: str, consonants: str) -> str:
_HO_HIP = "\u0e2b" # ห
_RO_RUA = "\u0e23" # ร
if not consonants:
return word
if len(consonants) == 1:
return word.replace(consonants[0], _CONSONANTS[consonants[0]][0])
i = 0
len_cons = len(consonants)
while i < ... | def _replace_consonants(word: str, consonants: str) -> str:
_HO_HIP = "\u0e2b" # ห
_RO_RUA = "\u0e23" # ร
if not consonants:
return word
if len(consonants) == 1:
return word.replace(consonants[0], _CONSONANTS[consonants[0]][0])
i = 0
len_cons = len(consonants)
while i < ... | https://github.com/PyThaiNLP/pythainlp/issues/485 | ---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-214-ffa4a144ac59> in <module>
----> 1 romanize('จรวยพร')
~/.env/lib/python3.7/site-packages/pythainlp/transliterate/core.py in romanize(text, engine)
50... | IndexError |
def _doc2features(doc, i) -> Dict:
word = doc[i][0]
postag = doc[i][1]
# Features from current word
features = {
"word.word": word,
"word.stopword": _is_stopword(word),
"word.isthai": isthai(word),
"word.isspace": word.isspace(),
"postag": postag,
"word.i... | def _doc2features(doc, i) -> dict:
word = doc[i][0]
postag = doc[i][1]
# Features from current word
features = {
"word.word": word,
"word.stopword": _is_stopword(word),
"word.isthai": isthai(word),
"word.isspace": word.isspace(),
"postag": postag,
"word.i... | https://github.com/PyThaiNLP/pythainlp/issues/468 | from pythainlp.tag.named_entity import ThaiNameTagger
ner = ThaiNameTagger()
ner.get_ner("ปัตตานียะลาถึงนราธิวาส")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/pythainlp/pythainlp/tag/named_entity.py", line 138, in get_ner
pos_tags = pos_tag(tokens, engine="perceptron", corpus="orchid_u... | ModuleNotFoundError |
def __init__(self) -> None:
"""
Thai named-entity recognizer.
"""
self.crf = CRFTagger()
self.crf.open(get_corpus_path(_CORPUS_NAME))
| def __init__(self):
"""
Thai named-entity recognizer.
"""
self.crf = CRFTagger()
self.crf.open(get_corpus_path(_CORPUS_NAME))
| https://github.com/PyThaiNLP/pythainlp/issues/468 | from pythainlp.tag.named_entity import ThaiNameTagger
ner = ThaiNameTagger()
ner.get_ner("ปัตตานียะลาถึงนราธิวาส")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/pythainlp/pythainlp/tag/named_entity.py", line 138, in get_ner
pos_tags = pos_tag(tokens, engine="perceptron", corpus="orchid_u... | ModuleNotFoundError |
def _orchid_tagger():
global _ORCHID_TAGGER
if not _ORCHID_TAGGER:
_ORCHID_TAGGER = PerceptronTagger(path=_ORCHID_PATH)
return _ORCHID_TAGGER
| def _orchid_tagger():
global _ORCHID_TAGGER
if not _ORCHID_TAGGER:
with open(_ORCHID_PATH, "rb") as fh:
_ORCHID_TAGGER = pickle.load(fh)
return _ORCHID_TAGGER
| https://github.com/PyThaiNLP/pythainlp/issues/468 | from pythainlp.tag.named_entity import ThaiNameTagger
ner = ThaiNameTagger()
ner.get_ner("ปัตตานียะลาถึงนราธิวาส")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/pythainlp/pythainlp/tag/named_entity.py", line 138, in get_ner
pos_tags = pos_tag(tokens, engine="perceptron", corpus="orchid_u... | ModuleNotFoundError |
def _pud_tagger():
global _PUD_TAGGER
if not _PUD_TAGGER:
_PUD_TAGGER = PerceptronTagger(path=_PUD_PATH)
return _PUD_TAGGER
| def _pud_tagger():
global _PUD_TAGGER
if not _PUD_TAGGER:
with open(_PUD_PATH, "rb") as fh:
_PUD_TAGGER = pickle.load(fh)
return _PUD_TAGGER
| https://github.com/PyThaiNLP/pythainlp/issues/468 | from pythainlp.tag.named_entity import ThaiNameTagger
ner = ThaiNameTagger()
ner.get_ner("ปัตตานียะลาถึงนราธิวาส")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/pythainlp/pythainlp/tag/named_entity.py", line 138, in get_ner
pos_tags = pos_tag(tokens, engine="perceptron", corpus="orchid_u... | ModuleNotFoundError |
def _f1(precision: float, recall: float) -> float:
"""
Compute f1.
:param float precision
:param float recall
:return: f1
:rtype: float
"""
if precision == recall == 0:
return 0
return 2 * precision * recall / (precision + recall)
| def _f1(precision: float, recall: float) -> float:
"""
Compute f1
:param float precision
:param float recall
:return: f1
:rtype: float
"""
if precision == recall == 0:
return 0
return 2 * precision * recall / (precision + recall)
| https://github.com/PyThaiNLP/pythainlp/issues/353 | # Install with no extras
pip install pythainlp
python
Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import pythainlp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/m... | ModuleNotFoundError |
def _flatten_result(my_dict: dict, sep: str = ":") -> dict:
"""
Flatten two-level dictionary.
Use keys in the first level as a prefix for keys in the two levels.
For example,
my_dict = { "a": { "b": 7 } }
flatten(my_dict)
{ "a:b": 7 }
:param dict my_dict: contains stats dictionary
... | def _flatten_result(my_dict: dict, sep: str = ":") -> dict:
"""
Flatten two-level dictionary
Use keys in the first level as a prefix for keys in the two levels.
For example,
my_dict = { "a": { "b": 7 } }
flatten(my_dict)
{ "a:b": 7 }
:param dict my_dict: contains stats dictionary
... | https://github.com/PyThaiNLP/pythainlp/issues/353 | # Install with no extras
pip install pythainlp
python
Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import pythainlp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/m... | ModuleNotFoundError |
def benchmark(ref_samples: list, samples: list):
"""
Performace benchmark of samples.
Please see :meth:`pythainlp.benchmarks.word_tokenization.compute_stats` for
metrics being computed.
:param list[str] ref_samples: ground truth samples
:param list[str] samples: samples that we want to evaluat... | def benchmark(ref_samples: list, samples: list):
"""
Performace benchmark of samples
Please see :meth:`pythainlp.benchmarks.word_tokenization.compute_stats` for
metrics being computed.
:param list[str] ref_samples: ground truth samples
:param list[str] samples: samples that we want to evaluate... | https://github.com/PyThaiNLP/pythainlp/issues/353 | # Install with no extras
pip install pythainlp
python
Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import pythainlp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/m... | ModuleNotFoundError |
def preprocessing(txt: str, remove_space: bool = True) -> str:
"""
Clean up text before performing evaluation.
:param str text: text to be preprocessed
:param bool remove_space: whether remove white space
:return: preprocessed text
:rtype: str
"""
txt = re.sub(SURROUNDING_SEPS_RX, "", ... | def preprocessing(txt: str, remove_space: bool = True) -> str:
"""
Clean up text before performing evaluation
:param str text: text to be preprocessed
:param bool remove_space: whether remove white space
:return: preprocessed text
:rtype: str
"""
txt = re.sub(SURROUNDING_SEPS_RX, "", t... | https://github.com/PyThaiNLP/pythainlp/issues/353 | # Install with no extras
pip install pythainlp
python
Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import pythainlp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/m... | ModuleNotFoundError |
def compute_stats(ref_sample: str, raw_sample: str) -> dict:
"""
Compute statistics for tokenization quality
These statistics includes:
**Character-Level**:
True Positive, False Positive, True Negative, False Negative, Precision, Recall, and f1
**Word-Level**:
Precision, Recall, and f1... | def compute_stats(ref_sample: str, raw_sample: str) -> dict:
"""
Compute statistics for tokenization quality
These statistics includes:
**Character-Level**:
True Positive, False Positive, True Negative, False Negative, Precision, Recall, and f1
**Word-Level**:
Precision, Recall, and f1... | https://github.com/PyThaiNLP/pythainlp/issues/353 | # Install with no extras
pip install pythainlp
python
Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import pythainlp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/m... | ModuleNotFoundError |
def _binary_representation(txt: str, verbose: bool = False):
"""
Transform text to {0, 1} sequence.
where (1) indicates that the corresponding character is the beginning of
a word. For example, ผม|ไม่|ชอบ|กิน|ผัก -> 10100...
:param str txt: input text that we want to transform
:param bool verb... | def _binary_representation(txt: str, verbose: bool = False):
"""
Transform text to {0, 1} sequence
where (1) indicates that the corresponding character is the beginning of
a word. For example, ผม|ไม่|ชอบ|กิน|ผัก -> 10100...
:param str txt: input text that we want to transform
:param bool verbo... | https://github.com/PyThaiNLP/pythainlp/issues/353 | # Install with no extras
pip install pythainlp
python
Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import pythainlp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/m... | ModuleNotFoundError |
def _find_word_boudaries(bin_reps) -> list:
"""
Find start and end location of each word.
:param str bin_reps: binary representation of a text
:return: list of tuples (start, end)
:rtype: list[tuple(int, int)]
"""
boundary = np.argwhere(bin_reps == 1).reshape(-1)
start_idx = boundary
... | def _find_word_boudaries(bin_reps) -> list:
"""
Find start and end location of each word
:param str bin_reps: binary representation of a text
:return: list of tuples (start, end)
:rtype: list[tuple(int, int)]
"""
boundary = np.argwhere(bin_reps == 1).reshape(-1)
start_idx = boundary
... | https://github.com/PyThaiNLP/pythainlp/issues/353 | # Install with no extras
pip install pythainlp
python
Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import pythainlp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/m... | ModuleNotFoundError |
def _find_words_correctly_tokenised(
ref_boundaries: list, predicted_boundaries: list
) -> tuple:
"""
Find whether each word is correctly tokenized.
:param list[tuple(int, int)] ref_boundaries: word boundaries of reference tokenization
:param list[tuple(int, int)] predicted_boundaries: word boundar... | def _find_words_correctly_tokenised(
ref_boundaries: list, predicted_boundaries: list
) -> tuple:
"""
Find whether each word is correctly tokenized
:param list[tuple(int, int)] ref_boundaries: word boundaries of reference tokenization
:param list[tuple(int, int)] predicted_boundaries: word boundare... | https://github.com/PyThaiNLP/pythainlp/issues/353 | # Install with no extras
pip install pythainlp
python
Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import pythainlp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/m... | ModuleNotFoundError |
def combine_install_requirements(ireqs):
"""
Return a single install requirement that reflects a combination of
all the inputs.
"""
# We will store the source ireqs in a _source_ireqs attribute;
# if any of the inputs have this, then use those sources directly.
source_ireqs = []
for ireq... | def combine_install_requirements(ireqs):
"""
Return a single install requirement that reflects a combination of
all the inputs.
"""
# We will store the source ireqs in a _source_ireqs attribute;
# if any of the inputs have this, then use those sources directly.
source_ireqs = []
for ireq... | https://github.com/jazzband/pip-tools/issues/851 | $ cat good.in
-e git+https://github.com/edx/django-rest-framework-oauth.git@0a43e8525f1e3048efe4bc70c03de308a277197c#egg=djangorestframework-oauth==1.1.1
edx-enterprise==1.7.2
$ cat bad.in
git+https://github.com/edx/django-rest-framework-oauth.git@0a43e8525f1e3048efe4bc70c03de308a277197c#egg=djangorestframework-oauth=... | pip._internal.exceptions.DistributionNotFound |
def constraints(self):
return set(
self._group_constraints(
chain(
sorted(self.our_constraints, key=str),
sorted(self.their_constraints, key=str),
)
)
)
| def constraints(self):
return set(
self._group_constraints(chain(self.our_constraints, self.their_constraints))
)
| https://github.com/jazzband/pip-tools/issues/851 | $ cat good.in
-e git+https://github.com/edx/django-rest-framework-oauth.git@0a43e8525f1e3048efe4bc70c03de308a277197c#egg=djangorestframework-oauth==1.1.1
edx-enterprise==1.7.2
$ cat bad.in
git+https://github.com/edx/django-rest-framework-oauth.git@0a43e8525f1e3048efe4bc70c03de308a277197c#egg=djangorestframework-oauth=... | pip._internal.exceptions.DistributionNotFound |
def _resolve_one_round(self):
"""
Resolves one level of the current constraints, by finding the best
match for each package in the repository and adding all requirements
for those best package versions. Some of these constraints may be new
or updated.
Returns whether new constraints appeared i... | def _resolve_one_round(self):
"""
Resolves one level of the current constraints, by finding the best
match for each package in the repository and adding all requirements
for those best package versions. Some of these constraints may be new
or updated.
Returns whether new constraints appeared i... | https://github.com/jazzband/pip-tools/issues/851 | $ cat good.in
-e git+https://github.com/edx/django-rest-framework-oauth.git@0a43e8525f1e3048efe4bc70c03de308a277197c#egg=djangorestframework-oauth==1.1.1
edx-enterprise==1.7.2
$ cat bad.in
git+https://github.com/edx/django-rest-framework-oauth.git@0a43e8525f1e3048efe4bc70c03de308a277197c#egg=djangorestframework-oauth=... | pip._internal.exceptions.DistributionNotFound |
def get_hashes(self, ireq):
"""
Given a pinned InstallRequire, returns a set of hashes that represent
all of the files for a given requirement. It is not acceptable for an
editable or unpinned requirement to be passed to this function.
"""
if not is_pinned_requirement(ireq):
raise TypeEr... | def get_hashes(self, ireq):
"""
Given a pinned InstallRequire, returns a set of hashes that represent
all of the files for a given requirement. It is not acceptable for an
editable or unpinned requirement to be passed to this function.
"""
if not is_pinned_requirement(ireq):
raise TypeEr... | https://github.com/jazzband/pip-tools/issues/558 | Collecting python-ldap==2.4.42 (from -r /requirements/dev.txt (line 18))
Downloading python-ldap-2.4.42.tar.gz (297kB)
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-32v49evs/python-ldap/setup.py", line 53
print name + ... | SyntaxError |
def _group_constraints(self, constraints):
"""
Groups constraints (remember, InstallRequirements!) by their key name,
and combining their SpecifierSets into a single InstallRequirement per
package. For example, given the following constraints:
Django<1.9,>=1.4.2
django~=1.5
Fla... | def _group_constraints(self, constraints):
"""
Groups constraints (remember, InstallRequirements!) by their key name,
and combining their SpecifierSets into a single InstallRequirement per
package. For example, given the following constraints:
Django<1.9,>=1.4.2
django~=1.5
Fla... | https://github.com/jazzband/pip-tools/issues/569 | $ venv/bin/pip-sync dev-requirements.txt
Traceback (most recent call last):
File "venv/bin/pip-sync", line 11, in <module>
sys.exit(cli())
File "venv/lib64/python3.6/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "venv/lib64/python3.6/site-packages/click/core.py", line 697, i... | TypeError |
def _resolve_one_round(self):
"""
Resolves one level of the current constraints, by finding the best
match for each package in the repository and adding all requirements
for those best package versions. Some of these constraints may be new
or updated.
Returns whether new constraints appeared i... | def _resolve_one_round(self):
"""
Resolves one level of the current constraints, by finding the best
match for each package in the repository and adding all requirements
for those best package versions. Some of these constraints may be new
or updated.
Returns whether new constraints appeared i... | https://github.com/jazzband/pip-tools/issues/569 | $ venv/bin/pip-sync dev-requirements.txt
Traceback (most recent call last):
File "venv/bin/pip-sync", line 11, in <module>
sys.exit(cli())
File "venv/lib64/python3.6/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "venv/lib64/python3.6/site-packages/click/core.py", line 697, i... | TypeError |
def sync(
to_install,
to_uninstall,
verbose=False,
dry_run=False,
pip_flags=None,
install_flags=None,
):
"""
Install and uninstalls the given sets of modules.
"""
if not to_uninstall and not to_install:
click.echo("Everything up-to-date")
if pip_flags is None:
... | def sync(
to_install,
to_uninstall,
verbose=False,
dry_run=False,
pip_flags=None,
install_flags=None,
):
"""
Install and uninstalls the given sets of modules.
"""
if not to_uninstall and not to_install:
click.echo("Everything up-to-date")
if pip_flags is None:
... | https://github.com/jazzband/pip-tools/issues/569 | $ venv/bin/pip-sync dev-requirements.txt
Traceback (most recent call last):
File "venv/bin/pip-sync", line 11, in <module>
sys.exit(cli())
File "venv/lib64/python3.6/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "venv/lib64/python3.6/site-packages/click/core.py", line 697, i... | TypeError |
def rectangle(img, x, y, h, w):
"""Create a rectangular ROI.
Inputs:
img = An RGB or grayscale image to plot the ROI on in debug mode.
x = The x-coordinate of the upper left corner of the rectangle.
y = The y-coordinate of the upper left corner of the rectangle.
... | def rectangle(img, x, y, h, w):
"""Create a rectangular ROI.
Inputs:
img = An RGB or grayscale image to plot the ROI on in debug mode.
x = The x-coordinate of the upper left corner of the rectangle.
y = The y-coordinate of the upper left corner of the rectangle.
... | https://github.com/danforthcenter/plantcv/issues/481 | ---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-143-af286afe5707> in <module>
4 spacing=(0, 1150),
5 ncols=1,
----> 6 ... | RuntimeError |
def circle(img, x, y, r):
"""Create a circular ROI.
Inputs:
img = An RGB or grayscale image to plot the ROI on in debug mode.
x = The x-coordinate of the center of the circle.
y = The y-coordinate of the center of the circle.
r = The radius of the c... | def circle(img, x, y, r):
"""Create a circular ROI.
Inputs:
img = An RGB or grayscale image to plot the ROI on in debug mode.
x = The x-coordinate of the center of the circle.
y = The y-coordinate of the center of the circle.
r = The radius of the c... | https://github.com/danforthcenter/plantcv/issues/481 | ---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-143-af286afe5707> in <module>
4 spacing=(0, 1150),
5 ncols=1,
----> 6 ... | RuntimeError |
def ellipse(img, x, y, r1, r2, angle):
"""Create an elliptical ROI.
Inputs:
img = An RGB or grayscale image to plot the ROI on in debug mode.
x = The x-coordinate of the center of the ellipse.
y = The y-coordinate of the center of the ellipse.
r1 = T... | def ellipse(img, x, y, r1, r2, angle):
"""Create an elliptical ROI.
Inputs:
img = An RGB or grayscale image to plot the ROI on in debug mode.
x = The x-coordinate of the center of the ellipse.
y = The y-coordinate of the center of the ellipse.
r1 = T... | https://github.com/danforthcenter/plantcv/issues/481 | ---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-143-af286afe5707> in <module>
4 spacing=(0, 1150),
5 ncols=1,
----> 6 ... | RuntimeError |
def multi(img, coord, radius, spacing=None, nrows=None, ncols=None):
"""Create multiple circular ROIs on a single image
Inputs
img = Input image data.
coord = Two-element tuple of the center of the top left object (x,y) or a list of tuples identifying the center of each roi [(x1,y1),... | def multi(img, coord, radius, spacing=None, nrows=None, ncols=None):
"""Create multiple circular ROIs on a single image
Inputs
img = Input image data.
coord = Two-element tuple of the center of the top left object (x,y) or a list of tuples identifying the center of each roi [(x1,y1),... | https://github.com/danforthcenter/plantcv/issues/481 | ---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-143-af286afe5707> in <module>
4 spacing=(0, 1150),
5 ncols=1,
----> 6 ... | RuntimeError |
def custom(img, vertices):
"""Create an custom polygon ROI.
Inputs:
img = An RGB or grayscale image to plot the ROI on in debug mode.
vertices = List of vertices of the desired polygon ROI
Outputs:
roi_contour = An ROI set of points (contour).
roi_hierarchy = The hierarchy... | def custom(img, vertices):
"""Create an custom polygon ROI.
Inputs:
img = An RGB or grayscale image to plot the ROI on in debug mode.
vertices = List of vertices of the desired polygon ROI
Outputs:
roi_contour = An ROI set of points (contour).
roi_hierarchy = The hierarchy... | https://github.com/danforthcenter/plantcv/issues/481 | ---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-143-af286afe5707> in <module>
4 spacing=(0, 1150),
5 ncols=1,
----> 6 ... | RuntimeError |
def options():
"""Parse command line options.
Args:
Returns:
argparse object.
Raises:
IOError: if dir does not exist.
IOError: if pipeline does not exist.
IOError: if the metadata file SnapshotInfo.csv does not exist in dir when flat is False.
ValueError: if ada... | def options():
"""Parse command line options.
Args:
Returns:
argparse object.
Raises:
IOError: if dir does not exist.
IOError: if pipeline does not exist.
IOError: if the metadata file SnapshotInfo.csv does not exist in dir when flat is False.
ValueError: if ada... | https://github.com/danforthcenter/plantcv/issues/51 | OpenCV Error: Assertion failed ((scn == 3 || scn == 4) && (depth == CV_8U || depth == CV_32F)) in cvtColor, file /build/opencv-SviWsf/opencv-2.4.9.1+dfsg/modules/imgproc/src/color.cpp, line 3959
Traceback (most recent call last):
File "/home/jeffrey/Desktop/plantcv_test.py", line 118, in <module>
main()
File "/... | cv2.error |
def job_builder(args, meta):
"""
Build a list of image processing jobs.
Args:
args: (object) argparse object.
meta: metadata data structure.
Returns:
Raises:
"""
# Overall job stack. List of list of jobs
job_stack = []
# Jobs/CPU (INT): divide the number of images... | def job_builder(args, meta):
"""
Build a list of image processing jobs.
Args:
args: (object) argparse object.
meta: metadata data structure.
Returns:
Raises:
"""
# Overall job stack. List of list of jobs
job_stack = []
# Jobs/CPU (INT): divide the number of images... | https://github.com/danforthcenter/plantcv/issues/51 | OpenCV Error: Assertion failed ((scn == 3 || scn == 4) && (depth == CV_8U || depth == CV_32F)) in cvtColor, file /build/opencv-SviWsf/opencv-2.4.9.1+dfsg/modules/imgproc/src/color.cpp, line 3959
Traceback (most recent call last):
File "/home/jeffrey/Desktop/plantcv_test.py", line 118, in <module>
main()
File "/... | cv2.error |
def repo_all_list(self, project_key):
"""
Get all repositories list from project
:param project_key:
:return:
"""
return self.repo_list(project_key, limit=None)
| def repo_all_list(self, project_key):
"""
Get all repositories list from project
:param project_key:
:return:
"""
url = self._url_repos(project_key)
return self.repo_list(url, limit=None)
| https://github.com/atlassian-api/atlassian-python-api/issues/614 | Traceback (most recent call last):
File "[ProjectPath]/task/fetch_from_git.py", line 112, in <module>
repo_all = list_of_repo()
File "[ProjectPath]/task/fetch_from_git.py", line 17, in list_of_repo
list_of_repositories = fetch()
File "[ProjectPath]\tools\bitbucket.py", line 51, in fetch
for repo in bitbucket_api.repo_a... | requests.exceptions.HTTPError |
def build(target_python, requirements):
"""
Builds an APK given a target Python and a set of requirements.
"""
if not requirements:
return
testapp = "setup_testapp_python2.py"
android_sdk_home = os.environ["ANDROID_SDK_HOME"]
android_ndk_home = os.environ["ANDROID_NDK_HOME"]
if t... | def build(target_python, requirements):
"""
Builds an APK given a target Python and a set of requirements.
"""
if not requirements:
return
testapp = "setup_testapp_python2.py"
android_sdk_home = os.environ["ANDROID_SDK_HOME"]
android_ndk_home = os.environ["ANDROID_NDK_HOME"]
crys... | https://github.com/kivy/python-for-android/issues/1485 | Traceback (most recent call last):
File "./ci/rebuild_updated_recipes.py", line 99, in <module>
main()
File "./ci/rebuild_updated_recipes.py", line 95, in main
build(target_python, recipes)
File "./ci/rebuild_updated_recipes.py", line 59, in build
crystax_ndk_home = os.environ['CRYSTAX_NDK_HOME']
File "/home/user/venv/... | KeyError |
def main():
target_python = TargetPython.python3
recipes = modified_recipes()
print("recipes modified:", recipes)
recipes -= CORE_RECIPES
print("recipes to build:", recipes)
context = Context()
build_order, python_modules, bs = get_recipe_order_and_bootstrap(
context, recipes, None
... | def main():
target_python = TargetPython.python3crystax
recipes = modified_recipes()
print("recipes modified:", recipes)
recipes -= CORE_RECIPES
print("recipes to build:", recipes)
context = Context()
build_order, python_modules, bs = get_recipe_order_and_bootstrap(
context, recipes,... | https://github.com/kivy/python-for-android/issues/1485 | Traceback (most recent call last):
File "./ci/rebuild_updated_recipes.py", line 99, in <module>
main()
File "./ci/rebuild_updated_recipes.py", line 95, in main
build(target_python, recipes)
File "./ci/rebuild_updated_recipes.py", line 59, in build
crystax_ndk_home = os.environ['CRYSTAX_NDK_HOME']
File "/home/user/venv/... | KeyError |
def _get_command_to_run(query):
params = shlex_split(query)
__check_query_params(params)
cmd = []
for c in command:
if c == "{{QUERY}}":
cmd.extend(params)
else:
cmd.append(c)
return cmd
| def _get_command_to_run(query):
params = shlex_split(query.decode("utf-8"))
__check_query_params(params)
cmd = []
for c in command:
if c == "{{QUERY}}":
cmd.extend(params)
else:
cmd.append(c)
return cmd
| https://github.com/searx/searx/issues/2355 | : Traceback (most recent call last):
: File "/opt/searx/searx/searx/search.py", line 281, in search_one_offline_request_safe
: search_results = search_one_offline_request(engine, query, request_params)
: File "/opt/searx/searx/searx/search.py", line 274, in search_one_offline_request
: return engine.search(... | AttributeError |
def response(resp):
"""Get response from google's search request"""
results = []
# detect google sorry
resp_url = urlparse(resp.url)
if resp_url.netloc == "sorry.google.com" or resp_url.path == "/sorry/IndexRedirect":
raise RuntimeWarning("sorry.google.com")
if resp_url.path.startswith... | def response(resp):
"""Get response from google's search request"""
results = []
# detect google sorry
resp_url = urlparse(resp.url)
if resp_url.netloc == "sorry.google.com" or resp_url.path == "/sorry/IndexRedirect":
raise RuntimeWarning("sorry.google.com")
if resp_url.path.startswith... | https://github.com/searx/searx/issues/2234 | ERROR:searx.google engine:list index out of range
Traceback (most recent call last):
File "/home/alexandre/code/zz/searx/searx/engines/google.py", line 253, in response
url = eval_xpath(result, href_xpath)[0]
IndexError: list index out of range | IndexError |
def add_unresponsive_engine(self, engine_name, error_type, error_message=None):
self.unresponsive_engines.add((engine_name, error_type, error_message))
| def add_unresponsive_engine(self, engine_error):
self.unresponsive_engines.add(engine_error)
| https://github.com/searx/searx/issues/1920 | Exception in thread aeb1ee8b-0fe7-4e90-8f29-0c487673c1eb:
Traceback (most recent call last):
File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/urllib3/connectionpool.py", line 421, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/home/n/p/searx/venv3.6/lib/python3.6/site-pa... | urllib3.exceptions.ReadTimeoutError |
def search_one_offline_request_safe(
engine_name, query, request_params, result_container, start_time, timeout_limit
):
engine = engines[engine_name]
try:
search_results = search_one_offline_request(engine, query, request_params)
if search_results:
result_container.extend(engin... | def search_one_offline_request_safe(
engine_name, query, request_params, result_container, start_time, timeout_limit
):
engine = engines[engine_name]
try:
search_results = search_one_offline_request(engine, query, request_params)
if search_results:
result_container.extend(engin... | https://github.com/searx/searx/issues/1920 | Exception in thread aeb1ee8b-0fe7-4e90-8f29-0c487673c1eb:
Traceback (most recent call last):
File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/urllib3/connectionpool.py", line 421, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/home/n/p/searx/venv3.6/lib/python3.6/site-pa... | urllib3.exceptions.ReadTimeoutError |
def search_one_http_request_safe(
engine_name, query, request_params, result_container, start_time, timeout_limit
):
# set timeout for all HTTP requests
requests_lib.set_timeout_for_thread(timeout_limit, start_time=start_time)
# reset the HTTP total time
requests_lib.reset_time_for_thread()
#
... | def search_one_http_request_safe(
engine_name, query, request_params, result_container, start_time, timeout_limit
):
# set timeout for all HTTP requests
requests_lib.set_timeout_for_thread(timeout_limit, start_time=start_time)
# reset the HTTP total time
requests_lib.reset_time_for_thread()
#
... | https://github.com/searx/searx/issues/1920 | Exception in thread aeb1ee8b-0fe7-4e90-8f29-0c487673c1eb:
Traceback (most recent call last):
File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/urllib3/connectionpool.py", line 421, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/home/n/p/searx/venv3.6/lib/python3.6/site-pa... | urllib3.exceptions.ReadTimeoutError |
def search_multiple_requests(requests, result_container, start_time, timeout_limit):
search_id = uuid4().__str__()
for engine_name, query, request_params in requests:
th = threading.Thread(
target=search_one_request_safe,
args=(
engine_name,
query... | def search_multiple_requests(requests, result_container, start_time, timeout_limit):
search_id = uuid4().__str__()
for engine_name, query, request_params in requests:
th = threading.Thread(
target=search_one_request_safe,
args=(
engine_name,
query... | https://github.com/searx/searx/issues/1920 | Exception in thread aeb1ee8b-0fe7-4e90-8f29-0c487673c1eb:
Traceback (most recent call last):
File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/urllib3/connectionpool.py", line 421, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/home/n/p/searx/venv3.6/lib/python3.6/site-pa... | urllib3.exceptions.ReadTimeoutError |
def _get_translations():
if has_request_context() and request.form.get("use-translation") == "oc":
babel_ext = flask_babel.current_app.extensions["babel"]
return Translations.load(next(babel_ext.translation_directories), "oc")
return _flask_babel_get_translations()
| def _get_translations():
translation_locale = request.form.get("use-translation")
if translation_locale:
babel_ext = flask_babel.current_app.extensions["babel"]
translation = Translations.load(next(babel_ext.translation_directories), "oc")
else:
translation = _flask_babel_get_transla... | https://github.com/searx/searx/issues/1920 | Exception in thread aeb1ee8b-0fe7-4e90-8f29-0c487673c1eb:
Traceback (most recent call last):
File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/urllib3/connectionpool.py", line 421, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/home/n/p/searx/venv3.6/lib/python3.6/site-pa... | urllib3.exceptions.ReadTimeoutError |
def index():
"""Render index page.
Supported outputs: html, json, csv, rss.
"""
# output_format
output_format = request.form.get("format", "html")
if output_format not in ["html", "csv", "json", "rss"]:
output_format = "html"
# check if there is query
if request.form.get("q") ... | def index():
"""Render index page.
Supported outputs: html, json, csv, rss.
"""
# output_format
output_format = request.form.get("format", "html")
if output_format not in ["html", "csv", "json", "rss"]:
output_format = "html"
# check if there is query
if request.form.get("q") ... | https://github.com/searx/searx/issues/1920 | Exception in thread aeb1ee8b-0fe7-4e90-8f29-0c487673c1eb:
Traceback (most recent call last):
File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/urllib3/connectionpool.py", line 421, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/home/n/p/searx/venv3.6/lib/python3.6/site-pa... | urllib3.exceptions.ReadTimeoutError |
def get_search_query_from_webapp(preferences, form):
# no text for the query ?
if not form.get("q"):
raise SearxParameterException("q", "")
# set blocked engines
disabled_engines = preferences.engines.get_disabled()
# parse query, if tags are set, which change
# the serch engine or sea... | def get_search_query_from_webapp(preferences, form):
# no text for the query ?
if not form.get("q"):
raise SearxParameterException("q", "")
# set blocked engines
disabled_engines = preferences.engines.get_disabled()
# parse query, if tags are set, which change
# the serch engine or sea... | https://github.com/searx/searx/issues/1664 | ERROR:searx.webapp:search error
Traceback (most recent call last):
File "searx/webapp.py", line 510, in index
search_query, raw_text_query = get_search_query_from_webapp(request.preferences, request.form)
File "/home/ave/Projects/searx/searx/search.py", line 285, in get_search_query_from_webapp
raise SearxParameterExce... | SearxParameterException |
def searx_bang(full_query):
"""check if the searchQuery contain a bang, and create fitting autocompleter results"""
# check if there is a query which can be parsed
if len(full_query.getSearchQuery()) == 0:
return []
results = []
# check if current query stats with !bang
first_char = fu... | def searx_bang(full_query):
"""check if the searchQuery contain a bang, and create fitting autocompleter results"""
# check if there is a query which can be parsed
if len(full_query.getSearchQuery()) == 0:
return []
results = []
# check if current query stats with !bang
first_char = fu... | https://github.com/searx/searx/issues/808 | INFO:werkzeug:127.0.0.1 - - [03/Jan/2017 12:02:01] "GET /autocompleter?q=%3Ae HTTP/1.1" 500 -
Traceback (most recent call last):
File "/home/alexandre/code/searx/query2/ve/lib/python2.7/site-packages/flask/app.py", line 1994, in __call__
return self.wsgi_app(environ, start_response)
File "/home/alexandre/code/searx/que... | TypeError |
def run():
app.run(
debug=settings["general"]["debug"],
use_debugger=settings["general"]["debug"],
port=settings["server"]["port"],
host=settings["server"]["bind_address"],
threaded=True,
)
| def run():
app.run(
debug=settings["general"]["debug"],
use_debugger=settings["general"]["debug"],
port=settings["server"]["port"],
host=settings["server"]["bind_address"],
)
| https://github.com/searx/searx/issues/662 | ERROR:searx.search:engine crash: ixquick
Traceback (most recent call last):
File "/root/searx/searx/search.py", line 40, in search_request_wrapper
ret = fn(url, **kwargs)
File "/root/searx/searx/poolrequests.py", line 100, in post
return request('post', url, data=data, **kwargs)
File "/root/searx/searx/poolrequests.py"... | IOError |
def _one_step_forward_per_replica(self, batch):
if self.config["gradient_accumulation_steps"] == 1:
gradients, per_replica_losses = self._calculate_gradient_per_batch(batch)
self._optimizer.apply_gradients(zip(gradients, self._trainable_variables), 1.0)
else:
# gradient acummulation here... | def _one_step_forward_per_replica(self, batch):
if self.config["gradient_accumulation_steps"] == 1:
gradients, per_replica_losses = self._calculate_gradient_per_batch(batch)
self._optimizer.apply_gradients(zip(gradients, self._trainable_variables))
else:
# gradient acummulation here.
... | https://github.com/TensorSpeech/TensorFlowTTS/issues/389 | /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/indexed_slices.py:433: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory.
"Converting sparse IndexedSlices to a dense Tensor of unknown shape. "
Traceback (most recent call last):
... | ValueError |
def fix(base_path: str, dur_path: str, trimmed_dur_path: str, use_norm: str):
for t in ["train", "valid"]:
mfa_longer = []
mfa_shorter = []
big_diff = []
not_fixed = []
pre_path = os.path.join(base_path, t)
os.makedirs(os.path.join(pre_path, "fix_dur"), exist_ok=True)... | def fix(base_path: str, dur_path: str, trimmed_dur_path: str, use_norm: str):
for t in ["train", "valid"]:
mfa_longer = []
mfa_shorter = []
big_diff = []
not_fixed = []
pre_path = os.path.join(base_path, t)
os.makedirs(os.path.join(pre_path, "fix_dur"), exist_ok=True)... | https://github.com/TensorSpeech/TensorFlowTTS/issues/306 | INFO: FIXING train set ...
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 15/15 [00:00<00:00, 770.29it/s]
Traceback (most recent call last):
File "examples/mfa_extraction/fix_mismatch.py", line 121, in <module>
fix()
File "/usr/local/lib/py... | ZeroDivisionError |
def __init__(self, **kwargs):
super().__init__(**kwargs)
Window.bind(on_resize=self.check_position_caller)
Window.bind(on_maximize=self.set_menu_properties)
Window.bind(on_restore=self.set_menu_properties)
self.register_event_type("on_dismiss")
self.register_event_type("on_enter")
self.regis... | def __init__(self, **kwargs):
super().__init__(**kwargs)
Window.bind(on_resize=self.check_position_caller)
self.register_event_type("on_dismiss")
self.register_event_type("on_enter")
self.register_event_type("on_leave")
self.menu = self.ids.md_menu
self.target_height = 0
| https://github.com/kivymd/KivyMD/issues/431 | Traceback (most recent call last):
File "C:/Users/User/PycharmProjects/New MO Inventory System/sigh.py", line 24, in <module>
App().run()
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\kivy\app.py", line 949, in run
self._run_prepare()
File "C:\Users\User\AppData\Local\Programs\Python\Pyth... | TypeError |
def build_show(self, scene):
show_m = window.ShowManager(
scene, size=(1200, 900), order_transparent=True, reset_camera=False
)
show_m.initialize()
if self.cluster and self.tractograms:
lengths = np.array([self.cla[c]["length"] for c in self.cla])
szs = [self.cla[c]["size"] for ... | def build_show(self, scene):
show_m = window.ShowManager(
scene, size=(1200, 900), order_transparent=True, reset_camera=False
)
show_m.initialize()
if self.cluster:
lengths = np.array([self.cla[c]["length"] for c in self.cla])
szs = [self.cla[c]["size"] for c in self.cla]
... | https://github.com/dipy/dipy/issues/1756 | Traceback (most recent call last):
File "/Users/guaj0/.virtualenvs/phd-dipy/bin/dipy_horizon", line 7, in <module>
exec(compile(f.read(), __file__, 'exec'))
File "/Users/guaj0/Work/PhD/dipy/bin/dipy_horizon", line 10, in <module>
run_flow(HorizonFlow())
File "/Users/guaj0/Work/PhD/dipy/dipy/workflows/flow_runner.py", l... | ValueError |
def interp_rbf(
data,
sphere_origin,
sphere_target,
function="multiquadric",
epsilon=None,
smooth=0.1,
norm="angle",
):
"""Interpolate data on the sphere, using radial basis functions.
Parameters
----------
data : (N,) ndarray
Function values on the unit sphere.
... | def interp_rbf(
data,
sphere_origin,
sphere_target,
function="multiquadric",
epsilon=None,
smooth=0.1,
norm="angle",
):
"""Interpolate data on the sphere, using radial basis functions.
Parameters
----------
data : (N,) ndarray
Function values on the unit sphere.
... | https://github.com/dipy/dipy/issues/1698 | ======================================================================
ERROR: dipy.core.tests.test_sphere.test_interp_rbf
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/nipy/dipy/venv/lib/python3.4/site-packages/nose/case.py", line 198,... | TypeError |
def angle(x1, x2):
xx = np.arccos(np.clip((x1 * x2).sum(axis=0), -1, 1))
return np.nan_to_num(xx)
| def angle(x1, x2):
xx = np.arccos((x1 * x2).sum(axis=0))
xx[np.isnan(xx)] = 0
return xx
| https://github.com/dipy/dipy/issues/1698 | ======================================================================
ERROR: dipy.core.tests.test_sphere.test_interp_rbf
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/nipy/dipy/venv/lib/python3.4/site-packages/nose/case.py", line 198,... | TypeError |
def fit(self, data):
data_b0 = data[self.b0s_mask].mean()
data_single_b0 = np.r_[data_b0, data[~self.b0s_mask]] / data_b0
# calculates the mean signal at each b_values
means = find_signal_means(
self.b_unique, data_single_b0, self.one_0_bvals, self.srm, self.lb_matrix_signal
)
# averag... | def fit(self, data):
data_b0 = data[self.b0s_mask].mean()
data_single_b0 = np.r_[data_b0, data[~self.b0s_mask]] / data_b0
# calculates the mean signal at each b_values
means = find_signal_means(
self.b_unique, data_single_b0, self.one_0_bvals, self.srm, self.lb_matrix_signal
)
# averag... | https://github.com/dipy/dipy/issues/1654 | dipy (master)$nosetests dipy/reconst/tests/test_forecast.py
F.....
======================================================================
FAIL: dipy.reconst.tests.test_forecast.test_forecast_positive_constrain
----------------------------------------------------------------------
Traceback (most recent call last):
File... | AssertionError |
def find_signal_means(b_unique, data_norm, bvals, rho, lb_matrix, w=1e-03):
r"""Calculate the mean signal for each shell.
Parameters
----------
b_unique : 1d ndarray,
unique b-values in a vector excluding zero
data_norm : 1d ndarray,
normalized diffusion signal
bvals : 1d ndarra... | def find_signal_means(b_unique, data_norm, bvals, rho, lb_matrix, w=1e-03):
r"""Calculates the mean signal for each shell
Parameters
----------
b_unique : 1d ndarray,
unique b-values in a vector excluding zero
data_norm : 1d ndarray,
normalized diffusion signal
bvals : 1d ndarra... | https://github.com/dipy/dipy/issues/1654 | dipy (master)$nosetests dipy/reconst/tests/test_forecast.py
F.....
======================================================================
FAIL: dipy.reconst.tests.test_forecast.test_forecast_positive_constrain
----------------------------------------------------------------------
Traceback (most recent call last):
File... | AssertionError |
def lb_forecast(sh_order):
r"""Returns the Laplace-Beltrami regularization matrix for FORECAST"""
n_c = int((sh_order + 1) * (sh_order + 2) / 2)
diag_lb = np.zeros(n_c)
counter = 0
for l in range(0, sh_order + 1, 2):
stop = 2 * l + 1 + counter
diag_lb[counter:stop] = (l * (l + 1)) **... | def lb_forecast(sh_order):
r"""Returns the Laplace-Beltrami regularization matrix for FORECAST"""
n_c = int((sh_order + 1) * (sh_order + 2) / 2)
diag_lb = np.zeros(n_c)
counter = 0
for l in range(0, sh_order + 1, 2):
for m in range(-l, l + 1):
diag_lb[counter] = (l * (l + 1)) ** ... | https://github.com/dipy/dipy/issues/1654 | dipy (master)$nosetests dipy/reconst/tests/test_forecast.py
F.....
======================================================================
FAIL: dipy.reconst.tests.test_forecast.test_forecast_positive_constrain
----------------------------------------------------------------------
Traceback (most recent call last):
File... | AssertionError |
def comparator(operator: Comparator) -> Comparator:
"""Wrap a Version binary op method in a type-check."""
@wraps(operator)
def wrapper(self: "Version", other: Comparable) -> bool:
comparable_types = (
Version,
dict,
tuple,
list,
*String._... | def comparator(operator: Comparator) -> Comparator:
"""Wrap a Version binary op method in a type-check."""
@wraps(operator)
def wrapper(self: "Version", other: Comparable) -> bool:
comparable_types = (
Version,
dict,
tuple,
list,
*String._... | https://github.com/python-semver/python-semver/issues/316 | class Foo:
... pass
v1 = semver.version.Version(1, 2, 3)
v1 < Foo()
Traceback (most recent call last)
...
TypeError: other type <class '__main__.Foo'> must be in (<class 'semver.version.Version'>, <class 'dict'>, <class 'tuple'>, <class 'list'>, <class 'str'>, <class 'bytes'>) | TypeError |
def wrapper(self: "Version", other: Comparable) -> bool:
comparable_types = (
Version,
dict,
tuple,
list,
*String.__args__, # type: ignore
)
if not isinstance(other, comparable_types):
return NotImplemented
return operator(self, other)
| def wrapper(self: "Version", other: Comparable) -> bool:
comparable_types = (
Version,
dict,
tuple,
list,
*String.__args__, # type: ignore
)
if not isinstance(other, comparable_types):
raise TypeError("other type %r must be in %r" % (type(other), comparable_t... | https://github.com/python-semver/python-semver/issues/316 | class Foo:
... pass
v1 = semver.version.Version(1, 2, 3)
v1 < Foo()
Traceback (most recent call last)
...
TypeError: other type <class '__main__.Foo'> must be in (<class 'semver.version.Version'>, <class 'dict'>, <class 'tuple'>, <class 'list'>, <class 'str'>, <class 'bytes'>) | TypeError |
def comparator(operator):
"""Wrap a VersionInfo binary op method in a type-check."""
@wraps(operator)
def wrapper(self, other):
comparable_types = (VersionInfo, dict, tuple, list, str)
if not isinstance(other, comparable_types):
raise TypeError(
"other type %r mu... | def comparator(operator):
"""Wrap a VersionInfo binary op method in a type-check."""
@wraps(operator)
def wrapper(self, other):
comparable_types = (VersionInfo, dict, tuple)
if not isinstance(other, comparable_types):
raise TypeError(
"other type %r must be in %r... | https://github.com/python-semver/python-semver/issues/244 | v1 < [1, 2, 4]
Traceback (most recent call last):
...
TypeError: other type <class 'list'> must be in (<class 'semver.VersionInfo'>, <class 'dict'>, <class 'tuple'>)
v1 < "1.2.4"
Traceback (most recent call last):
...
TypeError: other type <class 'str'> must be in (<class 'semver.VersionInfo'>, <class 'dict'>, <class '... | TypeError |
def wrapper(self, other):
comparable_types = (VersionInfo, dict, tuple, list, str)
if not isinstance(other, comparable_types):
raise TypeError("other type %r must be in %r" % (type(other), comparable_types))
return operator(self, other)
| def wrapper(self, other):
comparable_types = (VersionInfo, dict, tuple)
if not isinstance(other, comparable_types):
raise TypeError("other type %r must be in %r" % (type(other), comparable_types))
return operator(self, other)
| https://github.com/python-semver/python-semver/issues/244 | v1 < [1, 2, 4]
Traceback (most recent call last):
...
TypeError: other type <class 'list'> must be in (<class 'semver.VersionInfo'>, <class 'dict'>, <class 'tuple'>)
v1 < "1.2.4"
Traceback (most recent call last):
...
TypeError: other type <class 'str'> must be in (<class 'semver.VersionInfo'>, <class 'dict'>, <class '... | TypeError |
def run(self):
CleanCommand.run(self)
delete_in_root = ["build", ".cache", "dist", ".eggs", "*.egg-info", ".tox"]
delete_everywhere = ["__pycache__", "*.pyc"]
for candidate in delete_in_root:
rmtree_glob(candidate)
for visible_dir in glob("[A-Za-z0-9]*"):
for candidate in delete_ever... | def run(self):
super(CleanCommand, self).run()
delete_in_root = ["build", ".cache", "dist", ".eggs", "*.egg-info", ".tox"]
delete_everywhere = ["__pycache__", "*.pyc"]
for candidate in delete_in_root:
rmtree_glob(candidate)
for visible_dir in glob("[A-Za-z0-9]*"):
for candidate in de... | https://github.com/python-semver/python-semver/issues/224 | ERROR: Execution of '/yocto/build/3.0-zeus/bbb/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/python3-semver/2.9.1-r0/temp/run.do_configure.28554' failed with exit code 1:
running clean
Traceback (most recent call last):
File "setup.py", line 101, in <module>
entry_points={"console_scripts": ["pysemver = semver:main"]},
F... | RuntimeError |
def process(args):
"""Process the input from the CLI
:param args: The parsed arguments
:type args: :class:`argparse.Namespace`
:param parser: the parser instance
:type parser: :class:`argparse.ArgumentParser`
:return: result of the selected action
:rtype: str
"""
if not hasattr(args... | def process(args):
"""Process the input from the CLI
:param args: The parsed arguments
:type args: :class:`argparse.Namespace`
:param parser: the parser instance
:type parser: :class:`argparse.ArgumentParser`
:return: result of the selected action
:rtype: str
"""
if args.which == "b... | https://github.com/python-semver/python-semver/issues/192 | $ tox -e py36
$ .tox/py36/bin/pysemver
Traceback (most recent call last):
File ".tox/py36/bin/pysemver", line 8, in <module>
sys.exit(main())
File ".tox/py36/lib/python3.6/site-packages/semver.py", line 720, in main
result = process(args)
File ".tox/py36/lib/python3.6/site-packages/semver.py", line 693, in process
if a... | AttributeError |
def main(cliargs=None):
"""Entry point for the application script
:param list cliargs: Arguments to parse or None (=use :class:`sys.argv`)
:return: error code
:rtype: int
"""
try:
parser = createparser()
args = parser.parse_args(args=cliargs)
# Save parser instance:
... | def main(cliargs=None):
"""Entry point for the application script
:param list cliargs: Arguments to parse or None (=use :class:`sys.argv`)
:return: error code
:rtype: int
"""
try:
parser = createparser()
args = parser.parse_args(args=cliargs)
# args.parser = parser
... | https://github.com/python-semver/python-semver/issues/192 | $ tox -e py36
$ .tox/py36/bin/pysemver
Traceback (most recent call last):
File ".tox/py36/bin/pysemver", line 8, in <module>
sys.exit(main())
File ".tox/py36/lib/python3.6/site-packages/semver.py", line 720, in main
result = process(args)
File ".tox/py36/lib/python3.6/site-packages/semver.py", line 693, in process
if a... | AttributeError |
def add_trajectory(
self,
positions,
epochs,
groundtrack_show=False,
groundtrack_lead_time=None,
groundtrack_trail_time=None,
groundtrack_width=None,
groundtrack_color=None,
id_name=None,
id_description=None,
path_width=None,
path_show=None,
path_color=None,
label... | def add_trajectory(
self,
positions,
epochs,
groundtrack_show=False,
groundtrack_lead_time=None,
groundtrack_trail_time=None,
groundtrack_width=None,
groundtrack_color=None,
id_name=None,
id_description=None,
path_width=None,
path_show=None,
path_color=None,
label... | https://github.com/poliastro/poliastro/issues/1100 | 2021-02-09T22:42:25.5782954Z check run-test: commands[3] | python -m build .
2021-02-09T22:42:28.6022625Z Found existing installation: setuptools 49.2.1
2021-02-09T22:42:28.6436801Z Uninstalling setuptools-49.2.1:
2021-02-09T22:42:28.6526758Z Successfully uninstalled setuptools-49.2.1
...
2021-02-09T22:42:35.0995738Z... | ModuleNotFoundError |
def build_ephem_interpolant(body, period, t_span, rtol=1e-5):
"""Interpolates ephemerides data
Parameters
----------
body : Body
Source body.
period : ~astropy.units.Quantity
Orbital period.
t_span : list(~astropy.units.Quantity)
Initial and final epochs.
rtol : floa... | def build_ephem_interpolant(body, period, t_span, rtol=1e-5):
"""Interpolates ephemerides data
Parameters
----------
body : Body
Source body.
period : ~astropy.units.Quantity
Orbital period.
t_span : list(~astropy.units.Quantity)
Initial and final epochs.
rtol : floa... | https://github.com/poliastro/poliastro/issues/1100 | 2021-02-09T22:42:25.5782954Z check run-test: commands[3] | python -m build .
2021-02-09T22:42:28.6022625Z Found existing installation: setuptools 49.2.1
2021-02-09T22:42:28.6436801Z Uninstalling setuptools-49.2.1:
2021-02-09T22:42:28.6526758Z Successfully uninstalled setuptools-49.2.1
...
2021-02-09T22:42:35.0995738Z... | ModuleNotFoundError |
def _sample_open(self, values, min_anomaly, max_anomaly):
# Select a sensible limiting value for non-closed orbits
# This corresponds to max(r = 3p, r = self.r)
# We have to wrap nu in [-180, 180) to compare it with the output of
# the arc cosine, which is in the range [0, 180)
# Start from -nu_limi... | def _sample_open(self, values, min_anomaly, max_anomaly):
# Select a sensible limiting value for non-closed orbits
# This corresponds to max(r = 3p, r = self.r)
# We have to wrap nu in [-180, 180) to compare it with the output of
# the arc cosine, which is in the range [0, 180)
# Start from -nu_limi... | https://github.com/poliastro/poliastro/issues/1100 | 2021-02-09T22:42:25.5782954Z check run-test: commands[3] | python -m build .
2021-02-09T22:42:28.6022625Z Found existing installation: setuptools 49.2.1
2021-02-09T22:42:28.6436801Z Uninstalling setuptools-49.2.1:
2021-02-09T22:42:28.6526758Z Successfully uninstalled setuptools-49.2.1
...
2021-02-09T22:42:35.0995738Z... | ModuleNotFoundError |
def plot_ephem(self, ephem, epoch=None, *, label=None, color=None, trail=False):
"""Plots Ephem object over its sampling period.
Parameters
----------
ephem : ~poliastro.ephem.Ephem
Ephemerides to plot.
epoch : astropy.time.Time, optional
Epoch of the current position, none will be ... | def plot_ephem(self, ephem, epoch=None, *, label=None, color=None, trail=False):
"""Plots Ephem object over its sampling period.
Parameters
----------
ephem : ~poliastro.ephem.Ephem
Ephemerides to plot.
epoch : astropy.time.Time, optional
Epoch of the current position, none will be ... | https://github.com/poliastro/poliastro/issues/1021 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-130-a5728741413f> in <module>
2
3 plotter.set_attractor(Sun)
----> 4 plotter.plot_ephem(earth)
~/.pyenv/versions/seminar38/lib/python3.8/site-packages/p... | TypeError |
def newton(regime, x0, args=(), tol=1.48e-08, maxiter=50):
p0 = 1.0 * x0
for iter in range(maxiter):
if regime == "hyperbolic":
fval = _kepler_equation_hyper(p0, *args)
fder = _kepler_equation_prime_hyper(p0, *args)
else:
fval = _kepler_equation(p0, *args)
... | def newton(regime, x0, args=(), tol=1.48e-08, maxiter=50):
p0 = 1.0 * x0
for iter in range(maxiter):
if regime == "hyperbolic":
fval = _kepler_equation_hyper(p0, *args)
fder = _kepler_equation_prime_hyper(p0, *args)
else:
fval = _kepler_equation(p0, *args)
... | https://github.com/poliastro/poliastro/issues/475 | $ NUMBA_DISABLE_JIT=1 ipython --no-banner
In [1]: import numpy as np
In [2]: np.seterr(all="raise")
Out[2]: {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'}
In [3]: import numpy as np
...: import math
...: from astropy import units as u
...: from poliastro.bodies import Earth, Moon
...: from ... | FloatingPointError |
def M_to_E(M, ecc):
"""Eccentric anomaly from mean anomaly.
.. versionadded:: 0.4.0
Parameters
----------
M : float
Mean anomaly in radians.
ecc : float
Eccentricity.
Returns
-------
E : float
Eccentric anomaly.
Notes
-----
This uses a Newton i... | def M_to_E(M, ecc):
"""Eccentric anomaly from mean anomaly.
.. versionadded:: 0.4.0
Parameters
----------
M : float
Mean anomaly in radians.
ecc : float
Eccentricity.
Returns
-------
E : float
Eccentric anomaly.
Notes
-----
This uses a Newton i... | https://github.com/poliastro/poliastro/issues/475 | $ NUMBA_DISABLE_JIT=1 ipython --no-banner
In [1]: import numpy as np
In [2]: np.seterr(all="raise")
Out[2]: {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'}
In [3]: import numpy as np
...: import math
...: from astropy import units as u
...: from poliastro.bodies import Earth, Moon
...: from ... | FloatingPointError |
def _kepler_equation_near_parabolic(D, M, ecc):
return D_to_M_near_parabolic(D, ecc) - M
| def _kepler_equation_near_parabolic(D, M, ecc):
return D_to_M_near_parabolic(ecc, D) - M
| https://github.com/poliastro/poliastro/issues/475 | $ NUMBA_DISABLE_JIT=1 ipython --no-banner
In [1]: import numpy as np
In [2]: np.seterr(all="raise")
Out[2]: {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'}
In [3]: import numpy as np
...: import math
...: from astropy import units as u
...: from poliastro.bodies import Earth, Moon
...: from ... | FloatingPointError |
def D_to_M_near_parabolic(D, ecc):
x = (ecc - 1.0) / (ecc + 1.0) * (D**2)
assert abs(x) < 1
S = S_x(ecc, x)
return np.sqrt(2.0 / (1.0 + ecc)) * D + np.sqrt(2.0 / (1.0 + ecc) ** 3) * (D**3) * S
| def D_to_M_near_parabolic(ecc, D):
x = (ecc - 1.0) / (ecc + 1.0) * (D**2)
assert abs(x) < 1
S = S_x(ecc, x)
return np.sqrt(2.0 / (1.0 + ecc)) * D + np.sqrt(2.0 / (1.0 + ecc) ** 3) * (D**3) * S
| https://github.com/poliastro/poliastro/issues/475 | $ NUMBA_DISABLE_JIT=1 ipython --no-banner
In [1]: import numpy as np
In [2]: np.seterr(all="raise")
Out[2]: {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'}
In [3]: import numpy as np
...: import math
...: from astropy import units as u
...: from poliastro.bodies import Earth, Moon
...: from ... | FloatingPointError |
def farnocchia(k, r0, v0, tof):
r"""Propagates orbit using mean motion.
This algorithm depends on the geometric shape of the orbit.
For the case of the strong elliptic or strong hyperbolic orbits:
.. math::
M = M_{0} + \frac{\mu^{2}}{h^{3}}\left ( 1 -e^{2}\right )^{\frac{3}{2}}t
.. vers... | def farnocchia(k, r0, v0, tof):
r"""Propagates orbit using mean motion.
This algorithm depends on the geometric shape of the orbit.
For the case of the strong elliptic or strong hyperbolic orbits:
.. math::
M = M_{0} + \frac{\mu^{2}}{h^{3}}\left ( 1 -e^{2}\right )^{\frac{3}{2}}t
.. vers... | https://github.com/poliastro/poliastro/issues/475 | $ NUMBA_DISABLE_JIT=1 ipython --no-banner
In [1]: import numpy as np
In [2]: np.seterr(all="raise")
Out[2]: {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'}
In [3]: import numpy as np
...: import math
...: from astropy import units as u
...: from poliastro.bodies import Earth, Moon
...: from ... | FloatingPointError |
def t_p(self):
"""Elapsed time since latest perifocal passage."""
t_p = (
delta_t_from_nu_fast(
self.nu.to_value(u.rad),
self.ecc.value,
self.attractor.k.to_value(u.km**3 / u.s**2),
self.r_p.to_value(u.km),
)
* u.s
)
return t_p
| def t_p(self):
"""Elapsed time since latest perifocal passage."""
M = nu_to_M_fast(self.nu.to_value(u.rad), self.ecc.value) * u.rad
t_p = self.period * M / (360 * u.deg)
return t_p
| https://github.com/poliastro/poliastro/issues/475 | $ NUMBA_DISABLE_JIT=1 ipython --no-banner
In [1]: import numpy as np
In [2]: np.seterr(all="raise")
Out[2]: {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'}
In [3]: import numpy as np
...: import math
...: from astropy import units as u
...: from poliastro.bodies import Earth, Moon
...: from ... | FloatingPointError |
def from_classical(
cls,
attractor,
a,
ecc,
inc,
raan,
argp,
nu,
epoch=J2000,
plane=Planes.EARTH_EQUATOR,
):
"""Return `Orbit` from classical orbital elements.
Parameters
----------
attractor : Body
Main attractor.
a : ~astropy.units.Quantity
... | def from_classical(
cls,
attractor,
a,
ecc,
inc,
raan,
argp,
nu,
epoch=J2000,
plane=Planes.EARTH_EQUATOR,
):
"""Return `Orbit` from classical orbital elements.
Parameters
----------
attractor : Body
Main attractor.
a : ~astropy.units.Quantity
... | https://github.com/poliastro/poliastro/issues/475 | $ NUMBA_DISABLE_JIT=1 ipython --no-banner
In [1]: import numpy as np
In [2]: np.seterr(all="raise")
Out[2]: {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'}
In [3]: import numpy as np
...: import math
...: from astropy import units as u
...: from poliastro.bodies import Earth, Moon
...: from ... | FloatingPointError |
def from_sbdb(cls, name, **kwargs):
"""Return osculating `Orbit` by using `SBDB` from Astroquery.
Parameters
----------
name: string
Name of the body to make the request.
Returns
-------
ss: poliastro.twobody.orbit.Orbit
Orbit corresponding to body_name
Examples
--... | def from_sbdb(cls, name, **kwargs):
"""Return osculating `Orbit` by using `SBDB` from Astroquery.
Parameters
----------
name: string
Name of the body to make the request.
Returns
-------
ss: poliastro.twobody.orbit.Orbit
Orbit corresponding to body_name
Examples
--... | https://github.com/poliastro/poliastro/issues/475 | $ NUMBA_DISABLE_JIT=1 ipython --no-banner
In [1]: import numpy as np
In [2]: np.seterr(all="raise")
Out[2]: {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'}
In [3]: import numpy as np
...: import math
...: from astropy import units as u
...: from poliastro.bodies import Earth, Moon
...: from ... | FloatingPointError |
def time_to_anomaly(self, value):
"""Returns time required to be in a specific true anomaly.
Parameters
----------
value : ~astropy.units.Quantity
Returns
-------
tof: ~astropy.units.Quantity
Time of flight required.
"""
# Silently wrap anomaly
nu = (value + np.pi * u.... | def time_to_anomaly(self, value):
"""Returns time required to be in a specific true anomaly.
Parameters
----------
value : ~astropy.units.Quantity
Returns
-------
tof: ~astropy.units.Quantity
Time of flight required.
"""
# Compute time of flight for correct epoch
M = n... | https://github.com/poliastro/poliastro/issues/475 | $ NUMBA_DISABLE_JIT=1 ipython --no-banner
In [1]: import numpy as np
In [2]: np.seterr(all="raise")
Out[2]: {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'}
In [3]: import numpy as np
...: import math
...: from astropy import units as u
...: from poliastro.bodies import Earth, Moon
...: from ... | FloatingPointError |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.