id int64 1 6.07M | name stringlengths 1 295 | code stringlengths 12 426k | language stringclasses 1
value | source_file stringlengths 5 202 | start_line int64 1 158k | end_line int64 1 158k | repo dict |
|---|---|---|---|---|---|---|---|
6,070,701 | do_types_conflict | def do_types_conflict(type1: GraphQLOutputType, type2: GraphQLOutputType) -> bool:
"""Check whether two types conflict
Two types conflict if both types could not apply to a value simultaneously.
Composite types are ignored as their individual field types will be compared later
recursively. However List... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/overlapping_fields_can_be_merged.py | 595 | 624 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,702 | get_fields_and_fragment_names | def get_fields_and_fragment_names(
context: ValidationContext,
cached_fields_and_fragment_names: Dict,
parent_type: Optional[GraphQLNamedType],
selection_set: SelectionSetNode,
) -> Tuple[NodeAndDefCollection, List[str]]:
"""Get fields and referenced fragment names
Given a selection set, return... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/overlapping_fields_can_be_merged.py | 627 | 648 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,703 | get_referenced_fields_and_fragment_names | def get_referenced_fields_and_fragment_names(
context: ValidationContext,
cached_fields_and_fragment_names: Dict,
fragment: FragmentDefinitionNode,
) -> Tuple[NodeAndDefCollection, List[str]]:
"""Get referenced fields and nested fragment names
Given a reference to a fragment, return the represented... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/overlapping_fields_can_be_merged.py | 651 | 669 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,704 | collect_fields_and_fragment_names | def collect_fields_and_fragment_names(
context: ValidationContext,
parent_type: Optional[GraphQLNamedType],
selection_set: SelectionSetNode,
node_and_defs: NodeAndDefCollection,
fragment_names: Dict[str, bool],
) -> None:
for selection in selection_set.selections:
if isinstance(selection... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/overlapping_fields_can_be_merged.py | 672 | 708 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,705 | subfield_conflicts | def subfield_conflicts(
conflicts: List[Conflict], response_name: str, node1: FieldNode, node2: FieldNode
) -> Optional[Conflict]:
"""Check whether there are conflicts between sub-fields.
Given a series of Conflicts which occurred between two sub-fields, generate a single
Conflict.
"""
if confl... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/overlapping_fields_can_be_merged.py | 711 | 725 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,706 | __init__ | def __init__(self) -> None:
self._data = {} | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/overlapping_fields_can_be_merged.py | 738 | 739 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,707 | has | def has(self, a: str, b: str, are_mutually_exclusive: bool) -> bool:
key1, key2 = (a, b) if a < b else (b, a)
map_ = self._data.get(key1)
if map_ is None:
return False
result = map_.get(key2)
if result is None:
return False
# are_mutually_exclusi... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/overlapping_fields_can_be_merged.py | 741 | 754 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,708 | add | def add(self, a: str, b: str, are_mutually_exclusive: bool) -> None:
key1, key2 = (a, b) if a < b else (b, a)
map_ = self._data.get(key1)
if map_ is None:
self._data[key1] = {key2: are_mutually_exclusive}
else:
map_[key2] = are_mutually_exclusive | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/overlapping_fields_can_be_merged.py | 756 | 763 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,709 | __init__ | def __init__(self, context: ValidationContext):
super().__init__(context)
self.var_def_map: Dict[str, Any] = {} | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/variables_in_allowed_position.py | 26 | 28 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,710 | enter_operation_definition | def enter_operation_definition(self, *_args: Any) -> None:
self.var_def_map.clear() | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/variables_in_allowed_position.py | 30 | 31 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,711 | leave_operation_definition | def leave_operation_definition(
self, operation: OperationDefinitionNode, *_args: Any
) -> None:
var_def_map = self.var_def_map
usages = self.context.get_recursive_variable_usages(operation)
for usage in usages:
node, type_ = usage.node, usage.type
default_va... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/variables_in_allowed_position.py | 33 | 61 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,712 | enter_variable_definition | def enter_variable_definition(
self, node: VariableDefinitionNode, *_args: Any
) -> None:
self.var_def_map[node.variable.name.value] = node | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/variables_in_allowed_position.py | 63 | 66 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,713 | allowed_variable_usage | def allowed_variable_usage(
schema: GraphQLSchema,
var_type: GraphQLType,
var_default_value: Optional[ValueNode],
location_type: GraphQLType,
location_default_value: Any,
) -> bool:
"""Check for allowed variable usage.
Returns True if the variable is allowed in the location it was found, wh... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/variables_in_allowed_position.py | 69 | 93 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,714 | __init__ | def __init__(self, context: ASTValidationContext):
super().__init__(context)
self.known_names_stack: List[Dict[str, NameNode]] = []
self.known_names: Dict[str, NameNode] = {} | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/unique_input_field_names.py | 19 | 22 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,715 | enter_object_value | def enter_object_value(self, *_args: Any) -> None:
self.known_names_stack.append(self.known_names)
self.known_names = {} | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/unique_input_field_names.py | 24 | 26 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,716 | leave_object_value | def leave_object_value(self, *_args: Any) -> None:
self.known_names = self.known_names_stack.pop() | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/unique_input_field_names.py | 28 | 29 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,717 | enter_object_field | def enter_object_field(self, node: ObjectFieldNode, *_args: Any) -> None:
known_names = self.known_names
field_name = node.name.value
if field_name in known_names:
self.report_error(
GraphQLError(
f"There can be only one input field named '{field_n... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/unique_input_field_names.py | 31 | 42 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,718 | __init__ | def __init__(self, context: ASTValidationContext):
super().__init__(context)
# Tracks already visited fragments to maintain O(N) and to ensure that
# cycles are not redundantly reported.
self.visited_frags: Set[str] = set()
# List of AST nodes used to produce meaningful errors
... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/no_fragment_cycles.py | 20 | 28 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,719 | enter_operation_definition | def enter_operation_definition(*_args: Any) -> VisitorAction:
return SKIP | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/no_fragment_cycles.py | 31 | 32 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,720 | enter_fragment_definition | def enter_fragment_definition(
self, node: FragmentDefinitionNode, *_args: Any
) -> VisitorAction:
self.detect_cycle_recursive(node)
return SKIP | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/no_fragment_cycles.py | 34 | 38 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,721 | detect_cycle_recursive | def detect_cycle_recursive(self, fragment: FragmentDefinitionNode) -> None:
# This does a straight-forward DFS to find cycles.
# It does not terminate when a cycle was found but continues to explore
# the graph to find all possible cycles.
if fragment.name.value in self.visited_frags:
... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/no_fragment_cycles.py | 40 | 81 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,722 | enter_field | def enter_field(self, node: FieldNode, *_args: Any) -> None:
type_ = self.context.get_parent_type()
if not type_:
return
field_def = self.context.get_field_def()
if field_def:
return
# This field doesn't exist, lets look for suggestions.
schema = s... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/fields_on_correct_type.py | 32 | 59 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,723 | get_suggested_type_names | def get_suggested_type_names(
schema: GraphQLSchema, type_: GraphQLOutputType, field_name: str
) -> List[str]:
"""
Get a list of suggested type names.
Go through all of the implementations of type, as well as the interfaces
that they implement. If any of those types include the provided field,
... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/fields_on_correct_type.py | 62 | 123 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,724 | cmp | def cmp(
type_a: Union[GraphQLObjectType, GraphQLInterfaceType],
type_b: Union[GraphQLObjectType, GraphQLInterfaceType],
) -> int: # pragma: no cover
# Suggest both interface and object types based on how common they are.
usage_count_diff = usage_count[type_b.name] - usage_count[typ... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/fields_on_correct_type.py | 96 | 121 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,725 | get_suggested_field_names | def get_suggested_field_names(type_: GraphQLOutputType, field_name: str) -> List[str]:
"""Get a list of suggested field names.
For the field name provided, determine if there are any similar field names that may
be the result of a typo.
"""
if is_object_type(type_) or is_interface_type(type_):
... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/fields_on_correct_type.py | 126 | 136 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,726 | __init__ | def __init__(self, context: SDLValidationContext):
super().__init__(context)
schema = context.schema
self.defined_operation_types: Dict[
OperationType, OperationTypeDefinitionNode
] = {}
self.existing_operation_types: Dict[
OperationType, Optional[GraphQLO... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/unique_operation_types.py | 24 | 41 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,727 | check_operation_types | def check_operation_types(
self, node: Union[SchemaDefinitionNode, SchemaExtensionNode], *_args: Any
) -> VisitorAction:
for operation_type in node.operation_types or []:
operation = operation_type.operation
already_defined_operation_type = self.defined_operation_types.get(op... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/unique_operation_types.py | 43 | 67 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,728 | enter_variable_definition | def enter_variable_definition(
self, node: VariableDefinitionNode, *_args: Any
) -> None:
type_ = type_from_ast(self.context.schema, node.type)
# If the variable type is not an input type, return an error.
if type_ is not None and not is_input_type(type_):
variable_name ... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/variables_are_input_types.py | 21 | 36 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,729 | __init__ | def __init__(self, context: SDLValidationContext):
super().__init__(context)
schema = context.schema
self.existing_type_map = schema.type_map if schema else {}
self.known_value_names: Dict[str, Dict[str, NameNode]] = defaultdict(dict) | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/unique_enum_value_names.py | 18 | 22 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,730 | check_value_uniqueness | def check_value_uniqueness(
self, node: EnumTypeDefinitionNode, *_args: Any
) -> VisitorAction:
existing_type_map = self.existing_type_map
type_name = node.name.value
value_names = self.known_value_names[type_name]
for value_def in node.values or []:
value_name =... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/unique_enum_value_names.py | 24 | 58 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,731 | enter_field | def enter_field(self, node: FieldNode, *_args: Any) -> None:
context = self.context
field_def = context.get_field_def()
if field_def:
deprecation_reason = field_def.deprecation_reason
if deprecation_reason is not None:
parent_type = context.get_parent_type... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/custom/no_deprecated.py | 22 | 36 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,732 | enter_argument | def enter_argument(self, node: ArgumentNode, *_args: Any) -> None:
context = self.context
arg_def = context.get_argument()
if arg_def:
deprecation_reason = arg_def.deprecation_reason
if deprecation_reason is not None:
directive_def = context.get_directive(... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/custom/no_deprecated.py | 38 | 65 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,733 | enter_object_field | def enter_object_field(self, node: ObjectFieldNode, *_args: Any) -> None:
context = self.context
input_object_def = get_named_type(context.get_parent_input_type())
if is_input_object_type(input_object_def):
input_field_def = cast(GraphQLInputObjectType, input_object_def).fields.get(
... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/custom/no_deprecated.py | 67 | 85 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,734 | enter_enum_value | def enter_enum_value(self, node: EnumValueNode, *_args: Any) -> None:
context = self.context
enum_value_def = context.get_enum_value()
if enum_value_def:
deprecation_reason = enum_value_def.deprecation_reason
if deprecation_reason is not None: # pragma: no cover else
... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/custom/no_deprecated.py | 87 | 101 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,735 | enter_field | def enter_field(self, node: FieldNode, *_args: Any) -> None:
type_ = get_named_type(self.context.get_type())
if type_ and is_introspection_type(type_):
self.report_error(
GraphQLError(
"GraphQL introspection has been disabled, but the requested query"
... | python | python-3.10.8.amd64/Lib/site-packages/graphql/validation/rules/custom/no_schema_introspection.py | 22 | 31 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,736 | compress | def compress(data, level_or_option=None, zstd_dict=None):
"""Compress a block of data, return a bytes object.
Compressing b'' will get an empty content frame (9 bytes or more).
Parameters
data: A bytes-like object, data to be compressed.
level_or_option: When it's an int object, it repr... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 51 | 64 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,737 | richmem_compress | def richmem_compress(data, level_or_option=None, zstd_dict=None):
"""Compress a block of data, return a bytes object.
Use rich memory mode, it's faster than compress() in some cases, but
allocates more memory.
Compressing b'' will get an empty content frame (9 bytes or more).
Parameters
data:... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 67 | 83 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,738 | _nbytes | def _nbytes(dat):
if isinstance(dat, (bytes, bytearray)):
return len(dat)
return memoryview(dat).nbytes | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 86 | 89 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,739 | train_dict | def train_dict(samples, dict_size):
"""Train a zstd dictionary, return a ZstdDict object.
Parameters
samples: An iterable of samples, a sample is a bytes-like object
represents a file.
dict_size: The dictionary's maximum size, in bytes.
"""
# Check argument's type
if not is... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 92 | 120 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,740 | finalize_dict | def finalize_dict(zstd_dict, samples, dict_size, level):
"""Finalize a zstd dictionary, return a ZstdDict object.
Given a custom content as a basis for dictionary, and a set of samples,
finalize dictionary by adding headers and statistics according to the zstd
dictionary format.
You may compose an... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 123 | 178 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,741 | readall | def readall(self):
chunks = []
while True:
# sys.maxsize means the max length of output buffer is unlimited,
# so that the whole input buffer can be decompressed within one
# .decompress() call.
data = self.read(maxsize)
if not data:
... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 196 | 206 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,742 | read | def read(self, size=-1):
if size < 0:
return self.readall()
if not size or self._eof:
return b""
data = None # Default if EOF is encountered
# Depending on the input data, our call to the decompressor may not
# return any data. In this case, try again af... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 210 | 249 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,743 | seek | def seek(self, offset, whence=io.SEEK_SET):
# Recalculate offset as an absolute file position.
if whence == io.SEEK_SET:
pass
elif whence == io.SEEK_CUR:
offset = self._pos + offset
elif whence == io.SEEK_END:
# Seeking relative to EOF - we need to kno... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 253 | 281 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,744 | __init__ | def __init__(self, filename, mode="r", *,
level_or_option=None, zstd_dict=None):
"""Open a zstd compressed file in binary mode.
filename can be either an actual file name (given as a str, bytes, or
PathLike object), in which case the named file is opened, or it can be
a... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 315 | 383 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,745 | close | def close(self):
"""Flush and close the file.
May be called more than once without error. Once the file is
closed, any other operation on it will raise a ValueError.
"""
if self._mode == _MODE_CLOSED:
return
try:
# In .__init__ method, if fails a... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 385 | 416 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,746 | _check_mode | def _check_mode(self, expected_mode=None):
# If closed, raise ValueError.
if self._mode == _MODE_CLOSED:
raise ValueError("I/O operation on closed file")
# Check _MODE_READ/_MODE_WRITE mode
if expected_mode == _MODE_READ:
if self._mode != _MODE_READ:
... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 419 | 433 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,747 | write | def write(self, data):
"""Write a bytes-like object to the file.
Returns the number of uncompressed bytes written, which is
always the length of data in bytes. Note that due to buffering,
the file on disk may not reflect the data written until close()
is called.
"""
... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 435 | 463 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,748 | flush | def flush(self):
"""Flush remaining data to the underlying stream.
It uses ZstdCompressor.FLUSH_BLOCK mode. Abuse of this method will
reduce compression ratio, use it only when necessary.
If the program is interrupted afterwards, all data can be recovered.
To ensure saving to d... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 465 | 494 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,749 | read | def read(self, size=-1):
"""Read up to size uncompressed bytes from the file.
If size is negative or omitted, read until EOF is reached.
Returns b"" if the file is already at EOF.
"""
try:
return self._buffer.read(size)
except AttributeError:
self... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 496 | 505 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,750 | read1 | def read1(self, size=-1):
"""Read up to size uncompressed bytes, while trying to avoid
making multiple reads from the underlying stream. Reads up to a
buffer's worth of data if size is negative.
Returns b"" if the file is at EOF.
"""
if size < 0:
size = _32_K... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 507 | 520 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,751 | readinto | def readinto(self, b):
"""Read bytes into b.
Returns the number of bytes read (0 for EOF).
"""
try:
return self._buffer.readinto(b)
except AttributeError:
self._check_mode(_MODE_READ) | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 522 | 530 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,752 | readinto1 | def readinto1(self, b):
"""Read bytes into b, while trying to avoid making multiple reads
from the underlying stream.
Returns the number of bytes read (0 for EOF).
"""
try:
return self._buffer.readinto1(b)
except AttributeError:
self._check_mode(_... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 532 | 541 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,753 | readline | def readline(self, size=-1):
"""Read a line of uncompressed bytes from the file.
The terminating newline (if present) is retained. If size is
non-negative, no more than size bytes will be read (in which
case the line may be incomplete). Returns b'' if already at EOF.
"""
... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 543 | 553 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,754 | seek | def seek(self, offset, whence=io.SEEK_SET):
"""Change the file position.
The new position is specified by offset, relative to the
position indicated by whence. Possible values for whence are:
0: start of stream (default): offset must not be negative
1: current stream po... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 555 | 574 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,755 | peek | def peek(self, size=-1):
"""Return buffered data without advancing the file position.
Always returns at least one byte of data, unless at EOF.
The exact number of bytes returned is unspecified.
"""
# Relies on the undocumented fact that BufferedReader.peek() always
# ret... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 576 | 587 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,756 | tell | def tell(self):
"""Return the current file position."""
if self._mode == _MODE_READ:
return self._buffer.tell()
elif self._mode == _MODE_WRITE:
return self._pos
# Closed, raise ValueError.
self._check_mode() | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 589 | 597 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,757 | fileno | def fileno(self):
"""Return the file descriptor for the underlying file."""
try:
return self._fp.fileno()
except AttributeError:
# Closed, raise ValueError.
self._check_mode() | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 599 | 605 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,758 | closed | def closed(self):
"""True if this file is closed."""
return self._mode == _MODE_CLOSED | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 608 | 610 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,759 | writable | def writable(self):
"""Return whether the file was opened for writing."""
if self._mode == _MODE_WRITE:
return True
elif self._mode == _MODE_READ:
return False
# Closed, raise ValueError.
self._check_mode() | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 612 | 620 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,760 | readable | def readable(self):
"""Return whether the file was opened for reading."""
if self._mode == _MODE_READ:
return True
elif self._mode == _MODE_WRITE:
return False
# Closed, raise ValueError.
self._check_mode() | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 622 | 630 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,761 | seekable | def seekable(self):
"""Return whether the file supports seeking."""
if self._mode == _MODE_READ:
return self._buffer.seekable()
elif self._mode == _MODE_WRITE:
return False
# Closed, raise ValueError.
self._check_mode() | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 632 | 640 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,762 | open | def open(filename, mode="rb", *, level_or_option=None, zstd_dict=None,
encoding=None, errors=None, newline=None):
"""Open a zstd compressed file in binary or text mode.
filename can be either an actual file name (given as a str, bytes, or
PathLike object), in which case the named file is opened, o... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/__init__.py | 644 | 689 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,763 | get_frame_info | def get_frame_info(frame_buffer):
"""Get zstd frame infomation from a frame header.
Parameter
frame_buffer: A bytes-like object. It should starts from the beginning of
a frame, and needs to include at least the frame header (6 to
18 bytes).
Return a two-items namedt... | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/c/c_pyzstd.py | 34 | 53 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,764 | bounds | def bounds(self):
"""Return lower and upper bounds of a compression parameter, both inclusive."""
# 1 means compression parameter
return _zstd._get_param_bounds(1, self.value) | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/c/c_pyzstd.py | 82 | 85 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,765 | bounds | def bounds(self):
"""Return lower and upper bounds of a decompression parameter, both inclusive."""
# 0 means decompression parameter
return _zstd._get_param_bounds(0, self.value) | python | python-3.10.8.amd64/Lib/site-packages/pyzstd/c/c_pyzstd.py | 93 | 96 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,766 | _tobool | def _tobool(val: str) -> bool:
if isinstance(val, str):
return val.lower() in ('true', '1', 'yes', 'on')
return bool(val) | python | python-3.10.8.amd64/Lib/site-packages/sphinx/jinja2glue.py | 27 | 30 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,767 | _toint | def _toint(val: str) -> int:
try:
return int(val)
except ValueError:
return 0 | python | python-3.10.8.amd64/Lib/site-packages/sphinx/jinja2glue.py | 33 | 37 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,768 | _todim | def _todim(val: Union[int, str]) -> str:
"""
Make val a css dimension. In particular the following transformations
are performed:
- None -> 'initial' (default CSS value)
- 0 -> '0'
- ints and string representations of ints are interpreted as pixels.
Everything else is returned unchanged.
... | python | python-3.10.8.amd64/Lib/site-packages/sphinx/jinja2glue.py | 40 | 55 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,769 | _slice_index | def _slice_index(values: List, slices: int) -> Iterator[List]:
seq = list(values)
length = 0
for value in values:
length += 1 + len(value[1][1]) # count includes subitems
items_per_slice = length // slices
offset = 0
for slice_number in range(slices):
count = 0
start = o... | python | python-3.10.8.amd64/Lib/site-packages/sphinx/jinja2glue.py | 58 | 76 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,770 | accesskey | def accesskey(context: Any, key: str) -> str:
"""Helper to output each access key only once."""
if '_accesskeys' not in context:
context.vars['_accesskeys'] = {}
if key and key not in context.vars['_accesskeys']:
context.vars['_accesskeys'][key] = 1
return 'accesskey="%s"' % key
... | python | python-3.10.8.amd64/Lib/site-packages/sphinx/jinja2glue.py | 79 | 86 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,771 | __init__ | def __init__(self) -> None:
self.id = 0 | python | python-3.10.8.amd64/Lib/site-packages/sphinx/jinja2glue.py | 90 | 91 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,772 | current | def current(self) -> int:
return self.id | python | python-3.10.8.amd64/Lib/site-packages/sphinx/jinja2glue.py | 93 | 94 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,773 | __next__ | def __next__(self) -> int:
self.id += 1
return self.id | python | python-3.10.8.amd64/Lib/site-packages/sphinx/jinja2glue.py | 96 | 98 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,774 | warning | def warning(context: Dict, message: str, *args: Any, **kwargs: Any) -> str:
if 'pagename' in context:
filename = context.get('pagename') + context.get('file_suffix', '')
message = 'in rendering %s: %s' % (filename, message)
logger = logging.getLogger('sphinx.themes')
logger.warning(message, ... | python | python-3.10.8.amd64/Lib/site-packages/sphinx/jinja2glue.py | 103 | 109 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,775 | get_source | def get_source(self, environment: Environment, template: str) -> Tuple[str, str, Callable]:
for searchpath in self.searchpath:
filename = str(pathlib.Path(searchpath, template))
f = open_if_exists(filename)
if f is None:
continue
with f:
... | python | python-3.10.8.amd64/Lib/site-packages/sphinx/jinja2glue.py | 118 | 135 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,776 | uptodate | def uptodate() -> bool:
try:
return path.getmtime(filename) == mtime
except OSError:
return False | python | python-3.10.8.amd64/Lib/site-packages/sphinx/jinja2glue.py | 129 | 133 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,777 | init | def init(
self,
builder: "Builder",
theme: Optional[Theme] = None,
dirs: Optional[List[str]] = None
) -> None:
# create a chain of paths to search
if theme:
# the theme's own dir and its bases' dirs
pathchain = theme.get_theme_dirs()
... | python | python-3.10.8.amd64/Lib/site-packages/sphinx/jinja2glue.py | 145 | 191 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,778 | render | def render(self, template: str, context: Dict) -> str: # type: ignore
return self.environment.get_template(template).render(context) | python | python-3.10.8.amd64/Lib/site-packages/sphinx/jinja2glue.py | 193 | 194 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,779 | render_string | def render_string(self, source: str, context: Dict) -> str:
return self.environment.from_string(source).render(context) | python | python-3.10.8.amd64/Lib/site-packages/sphinx/jinja2glue.py | 196 | 197 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,780 | newest_template_mtime | def newest_template_mtime(self) -> float:
return max(mtimes_of_files(self.pathchain, '.html')) | python | python-3.10.8.amd64/Lib/site-packages/sphinx/jinja2glue.py | 199 | 200 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,781 | get_source | def get_source(self, environment: Environment, template: str) -> Tuple[str, str, Callable]:
loaders = self.loaders
# exclamation mark starts search from theme
if template.startswith('!'):
loaders = loaders[self.templatepathlen:]
template = template[1:]
for loader ... | python | python-3.10.8.amd64/Lib/site-packages/sphinx/jinja2glue.py | 204 | 215 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,782 | extract_zip | def extract_zip(filename: str, targetdir: str) -> None:
"""Extract zip file to target directory."""
ensuredir(targetdir)
with ZipFile(filename) as archive:
for name in archive.namelist():
if name.endswith('/'):
continue
entry = path.join(targetdir, name)
... | python | python-3.10.8.amd64/Lib/site-packages/sphinx/theming.py | 32 | 43 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,783 | __init__ | def __init__(self, name: str, theme_path: str, factory: "HTMLThemeFactory") -> None:
self.name = name
self.base = None
self.rootdir = None
if path.isdir(theme_path):
# already a directory, do nothing
self.rootdir = None
self.themedir = theme_path
... | python | python-3.10.8.amd64/Lib/site-packages/sphinx/theming.py | 51 | 81 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,784 | get_theme_dirs | def get_theme_dirs(self) -> List[str]:
"""Return a list of theme directories, beginning with this theme's,
then the base theme's, then that one's base theme's, etc.
"""
if self.base is None:
return [self.themedir]
else:
return [self.themedir] + self.base.g... | python | python-3.10.8.amd64/Lib/site-packages/sphinx/theming.py | 83 | 90 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,785 | get_config | def get_config(self, section: str, name: str, default: Any = NODEFAULT) -> Any:
"""Return the value for a theme configuration setting, searching the
base theme chain.
"""
try:
return self.config.get(section, name)
except (configparser.NoOptionError, configparser.NoSec... | python | python-3.10.8.amd64/Lib/site-packages/sphinx/theming.py | 92 | 106 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,786 | get_options | def get_options(self, overrides: Dict[str, Any] = {}) -> Dict[str, Any]:
"""Return a dictionary of theme options and their values."""
if self.base:
options = self.base.get_options()
else:
options = {}
try:
options.update(self.config.items('options'))
... | python | python-3.10.8.amd64/Lib/site-packages/sphinx/theming.py | 108 | 126 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,787 | cleanup | def cleanup(self) -> None:
"""Remove temporary directories."""
if self.rootdir:
try:
shutil.rmtree(self.rootdir)
except Exception:
pass
if self.base:
self.base.cleanup() | python | python-3.10.8.amd64/Lib/site-packages/sphinx/theming.py | 128 | 136 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,788 | is_archived_theme | def is_archived_theme(filename: str) -> bool:
"""Check whether the specified file is an archived theme file or not."""
try:
with ZipFile(filename) as f:
return THEMECONF in f.namelist()
except Exception:
return False | python | python-3.10.8.amd64/Lib/site-packages/sphinx/theming.py | 139 | 145 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,789 | __init__ | def __init__(self, app: "Sphinx") -> None:
self.app = app
self.themes = app.registry.html_themes
self.load_builtin_themes()
if getattr(app.config, 'html_theme_path', None):
self.load_additional_themes(app.config.html_theme_path) | python | python-3.10.8.amd64/Lib/site-packages/sphinx/theming.py | 151 | 156 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,790 | load_builtin_themes | def load_builtin_themes(self) -> None:
"""Load built-in themes."""
themes = self.find_themes(path.join(package_dir, 'themes'))
for name, theme in themes.items():
self.themes[name] = theme | python | python-3.10.8.amd64/Lib/site-packages/sphinx/theming.py | 158 | 162 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,791 | load_additional_themes | def load_additional_themes(self, theme_paths: str) -> None:
"""Load additional themes placed at specified directories."""
for theme_path in theme_paths:
abs_theme_path = path.abspath(path.join(self.app.confdir, theme_path))
themes = self.find_themes(abs_theme_path)
fo... | python | python-3.10.8.amd64/Lib/site-packages/sphinx/theming.py | 164 | 170 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,792 | load_extra_theme | def load_extra_theme(self, name: str) -> None:
"""Try to load a theme with the specified name."""
if name == 'alabaster':
self.load_alabaster_theme()
else:
self.load_external_theme(name) | python | python-3.10.8.amd64/Lib/site-packages/sphinx/theming.py | 172 | 177 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,793 | load_alabaster_theme | def load_alabaster_theme(self) -> None:
"""Load alabaster theme."""
import alabaster
self.themes['alabaster'] = path.join(alabaster.get_path(), 'alabaster') | python | python-3.10.8.amd64/Lib/site-packages/sphinx/theming.py | 179 | 182 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,794 | load_sphinx_rtd_theme | def load_sphinx_rtd_theme(self) -> None:
"""Load sphinx_rtd_theme theme (if installed)."""
try:
import sphinx_rtd_theme
theme_path = sphinx_rtd_theme.get_html_theme_path()
self.themes['sphinx_rtd_theme'] = path.join(theme_path, 'sphinx_rtd_theme')
except Impor... | python | python-3.10.8.amd64/Lib/site-packages/sphinx/theming.py | 184 | 191 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,795 | load_external_theme | def load_external_theme(self, name: str) -> None:
"""Try to load a theme using entry_points.
Sphinx refers to ``sphinx_themes`` entry_points.
"""
# look up for new styled entry_points at first
theme_entry_points = entry_points(group='sphinx.html_themes')
try:
... | python | python-3.10.8.amd64/Lib/site-packages/sphinx/theming.py | 193 | 206 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,796 | find_themes | def find_themes(self, theme_path: str) -> Dict[str, str]:
"""Search themes from specified directory."""
themes: Dict[str, str] = {}
if not path.isdir(theme_path):
return themes
for entry in os.listdir(theme_path):
pathname = path.join(theme_path, entry)
... | python | python-3.10.8.amd64/Lib/site-packages/sphinx/theming.py | 208 | 227 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,797 | create | def create(self, name: str) -> Theme:
"""Create an instance of theme."""
if name not in self.themes:
self.load_extra_theme(name)
if name not in self.themes and name == 'sphinx_rtd_theme':
# sphinx_rtd_theme (< 0.2.5) # RemovedInSphinx60Warning
logger.warning... | python | python-3.10.8.amd64/Lib/site-packages/sphinx/theming.py | 229 | 243 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,798 | is_serializable | def is_serializable(obj: Any) -> bool:
"""Check if object is serializable or not."""
if isinstance(obj, UNSERIALIZABLE_TYPES):
return False
elif isinstance(obj, dict):
for key, value in obj.items():
if not is_serializable(key) or not is_serializable(value):
return... | python | python-3.10.8.amd64/Lib/site-packages/sphinx/config.py | 36 | 47 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,799 | __init__ | def __init__(self, *candidates: str) -> None:
self.candidates = candidates | python | python-3.10.8.amd64/Lib/site-packages/sphinx/config.py | 56 | 57 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
6,070,800 | match | def match(self, value: Union[str, List, Tuple]) -> bool:
if isinstance(value, (list, tuple)):
return all(item in self.candidates for item in value)
else:
return value in self.candidates | python | python-3.10.8.amd64/Lib/site-packages/sphinx/config.py | 59 | 63 | {
"name": "PortablePy/3.10.8.0",
"url": "https://github.com/PortablePy/3.10.8.0.git",
"license": "NOASSERTION",
"stars": 0,
"forks": 0
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.