repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
libyal/dtfabric
dtfabric/runtime/data_maps.py
SemanticDataTypeMap.MapByteStream
def MapByteStream(self, byte_stream, **unused_kwargs): # pylint: disable=redundant-returns-doc """Maps the data type on a byte stream. Args: byte_stream (bytes): byte stream. Returns: object: mapped value. Raises: MappingError: if the data type definition cannot be mapped on ...
python
def MapByteStream(self, byte_stream, **unused_kwargs): # pylint: disable=redundant-returns-doc """Maps the data type on a byte stream. Args: byte_stream (bytes): byte stream. Returns: object: mapped value. Raises: MappingError: if the data type definition cannot be mapped on ...
[ "def", "MapByteStream", "(", "self", ",", "byte_stream", ",", "*", "*", "unused_kwargs", ")", ":", "# pylint: disable=redundant-returns-doc", "raise", "errors", ".", "MappingError", "(", "'Unable to map {0:s} data type to byte stream'", ".", "format", "(", "self", ".", ...
Maps the data type on a byte stream. Args: byte_stream (bytes): byte stream. Returns: object: mapped value. Raises: MappingError: if the data type definition cannot be mapped on the byte stream.
[ "Maps", "the", "data", "type", "on", "a", "byte", "stream", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1961-L1976
libyal/dtfabric
dtfabric/runtime/data_maps.py
EnumerationMap.GetName
def GetName(self, number): """Retrieves the name of an enumeration value by number. Args: number (int): number. Returns: str: name of the enumeration value or None if no corresponding enumeration value was found. """ value = self._data_type_definition.values_per_number.get(nu...
python
def GetName(self, number): """Retrieves the name of an enumeration value by number. Args: number (int): number. Returns: str: name of the enumeration value or None if no corresponding enumeration value was found. """ value = self._data_type_definition.values_per_number.get(nu...
[ "def", "GetName", "(", "self", ",", "number", ")", ":", "value", "=", "self", ".", "_data_type_definition", ".", "values_per_number", ".", "get", "(", "number", ",", "None", ")", "if", "not", "value", ":", "return", "None", "return", "value", ".", "name"...
Retrieves the name of an enumeration value by number. Args: number (int): number. Returns: str: name of the enumeration value or None if no corresponding enumeration value was found.
[ "Retrieves", "the", "name", "of", "an", "enumeration", "value", "by", "number", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1986-L2000
libyal/dtfabric
dtfabric/runtime/data_maps.py
DataTypeMapFactory.CreateDataTypeMap
def CreateDataTypeMap(self, definition_name): """Creates a specific data type map by name. Args: definition_name (str): name of the data type definition. Returns: DataTypeMap: data type map or None if the date type definition is not available. """ data_type_definition = self....
python
def CreateDataTypeMap(self, definition_name): """Creates a specific data type map by name. Args: definition_name (str): name of the data type definition. Returns: DataTypeMap: data type map or None if the date type definition is not available. """ data_type_definition = self....
[ "def", "CreateDataTypeMap", "(", "self", ",", "definition_name", ")", ":", "data_type_definition", "=", "self", ".", "_definitions_registry", ".", "GetDefinitionByName", "(", "definition_name", ")", "if", "not", "data_type_definition", ":", "return", "None", "return",...
Creates a specific data type map by name. Args: definition_name (str): name of the data type definition. Returns: DataTypeMap: data type map or None if the date type definition is not available.
[ "Creates", "a", "specific", "data", "type", "map", "by", "name", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L2032-L2047
libyal/dtfabric
dtfabric/runtime/data_maps.py
DataTypeMapFactory.CreateDataTypeMapByType
def CreateDataTypeMapByType(cls, data_type_definition): """Creates a specific data type map by type indicator. Args: data_type_definition (DataTypeDefinition): data type definition. Returns: DataTypeMap: data type map or None if the date type definition is not available. """ ...
python
def CreateDataTypeMapByType(cls, data_type_definition): """Creates a specific data type map by type indicator. Args: data_type_definition (DataTypeDefinition): data type definition. Returns: DataTypeMap: data type map or None if the date type definition is not available. """ ...
[ "def", "CreateDataTypeMapByType", "(", "cls", ",", "data_type_definition", ")", ":", "data_type_map_class", "=", "cls", ".", "_MAP_PER_DEFINITION", ".", "get", "(", "data_type_definition", ".", "TYPE_INDICATOR", ",", "None", ")", "if", "not", "data_type_map_class", ...
Creates a specific data type map by type indicator. Args: data_type_definition (DataTypeDefinition): data type definition. Returns: DataTypeMap: data type map or None if the date type definition is not available.
[ "Creates", "a", "specific", "data", "type", "map", "by", "type", "indicator", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L2050-L2065
libyal/dtfabric
dtfabric/data_types.py
FixedSizeDataTypeDefinition.GetByteSize
def GetByteSize(self): """Retrieves the byte size of the data type definition. Returns: int: data type size in bytes or None if size cannot be determined. """ if self.size == definitions.SIZE_NATIVE or self.units != 'bytes': return None return self.size
python
def GetByteSize(self): """Retrieves the byte size of the data type definition. Returns: int: data type size in bytes or None if size cannot be determined. """ if self.size == definitions.SIZE_NATIVE or self.units != 'bytes': return None return self.size
[ "def", "GetByteSize", "(", "self", ")", ":", "if", "self", ".", "size", "==", "definitions", ".", "SIZE_NATIVE", "or", "self", ".", "units", "!=", "'bytes'", ":", "return", "None", "return", "self", ".", "size" ]
Retrieves the byte size of the data type definition. Returns: int: data type size in bytes or None if size cannot be determined.
[ "Retrieves", "the", "byte", "size", "of", "the", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/data_types.py#L119-L128
libyal/dtfabric
dtfabric/data_types.py
ElementSequenceDataTypeDefinition.GetByteSize
def GetByteSize(self): """Retrieves the byte size of the data type definition. Returns: int: data type size in bytes or None if size cannot be determined. """ if not self.element_data_type_definition: return None if self.elements_data_size: return self.elements_data_size if ...
python
def GetByteSize(self): """Retrieves the byte size of the data type definition. Returns: int: data type size in bytes or None if size cannot be determined. """ if not self.element_data_type_definition: return None if self.elements_data_size: return self.elements_data_size if ...
[ "def", "GetByteSize", "(", "self", ")", ":", "if", "not", "self", ".", "element_data_type_definition", ":", "return", "None", "if", "self", ".", "elements_data_size", ":", "return", "self", ".", "elements_data_size", "if", "not", "self", ".", "number_of_elements...
Retrieves the byte size of the data type definition. Returns: int: data type size in bytes or None if size cannot be determined.
[ "Retrieves", "the", "byte", "size", "of", "the", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/data_types.py#L306-L325
libyal/dtfabric
dtfabric/data_types.py
DataTypeDefinitionWithMembers.AddMemberDefinition
def AddMemberDefinition(self, member_definition): """Adds a member definition. Args: member_definition (DataTypeDefinition): member data type definition. """ self._byte_size = None self.members.append(member_definition) if self.sections: section_definition = self.sections[-1] ...
python
def AddMemberDefinition(self, member_definition): """Adds a member definition. Args: member_definition (DataTypeDefinition): member data type definition. """ self._byte_size = None self.members.append(member_definition) if self.sections: section_definition = self.sections[-1] ...
[ "def", "AddMemberDefinition", "(", "self", ",", "member_definition", ")", ":", "self", ".", "_byte_size", "=", "None", "self", ".", "members", ".", "append", "(", "member_definition", ")", "if", "self", ".", "sections", ":", "section_definition", "=", "self", ...
Adds a member definition. Args: member_definition (DataTypeDefinition): member data type definition.
[ "Adds", "a", "member", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/data_types.py#L398-L409
libyal/dtfabric
dtfabric/data_types.py
MemberDataTypeDefinition.IsComposite
def IsComposite(self): """Determines if the data type is composite. A composite data type consists of other data types. Returns: bool: True if the data type is composite, False otherwise. """ return bool(self.condition) or ( self.member_data_type_definition and self.member_da...
python
def IsComposite(self): """Determines if the data type is composite. A composite data type consists of other data types. Returns: bool: True if the data type is composite, False otherwise. """ return bool(self.condition) or ( self.member_data_type_definition and self.member_da...
[ "def", "IsComposite", "(", "self", ")", ":", "return", "bool", "(", "self", ".", "condition", ")", "or", "(", "self", ".", "member_data_type_definition", "and", "self", ".", "member_data_type_definition", ".", "IsComposite", "(", ")", ")" ]
Determines if the data type is composite. A composite data type consists of other data types. Returns: bool: True if the data type is composite, False otherwise.
[ "Determines", "if", "the", "data", "type", "is", "composite", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/data_types.py#L476-L486
libyal/dtfabric
dtfabric/data_types.py
StructureDefinition.GetByteSize
def GetByteSize(self): """Retrieves the byte size of the data type definition. Returns: int: data type size in bytes or None if size cannot be determined. """ if self._byte_size is None and self.members: self._byte_size = 0 for member_definition in self.members: if isinstance(...
python
def GetByteSize(self): """Retrieves the byte size of the data type definition. Returns: int: data type size in bytes or None if size cannot be determined. """ if self._byte_size is None and self.members: self._byte_size = 0 for member_definition in self.members: if isinstance(...
[ "def", "GetByteSize", "(", "self", ")", ":", "if", "self", ".", "_byte_size", "is", "None", "and", "self", ".", "members", ":", "self", ".", "_byte_size", "=", "0", "for", "member_definition", "in", "self", ".", "members", ":", "if", "isinstance", "(", ...
Retrieves the byte size of the data type definition. Returns: int: data type size in bytes or None if size cannot be determined.
[ "Retrieves", "the", "byte", "size", "of", "the", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/data_types.py#L531-L554
libyal/dtfabric
dtfabric/data_types.py
UnionDefinition.GetByteSize
def GetByteSize(self): """Retrieves the byte size of the data type definition. Returns: int: data type size in bytes or None if size cannot be determined. """ if self._byte_size is None and self.members: self._byte_size = 0 for member_definition in self.members: byte_size = me...
python
def GetByteSize(self): """Retrieves the byte size of the data type definition. Returns: int: data type size in bytes or None if size cannot be determined. """ if self._byte_size is None and self.members: self._byte_size = 0 for member_definition in self.members: byte_size = me...
[ "def", "GetByteSize", "(", "self", ")", ":", "if", "self", ".", "_byte_size", "is", "None", "and", "self", ".", "members", ":", "self", ".", "_byte_size", "=", "0", "for", "member_definition", "in", "self", ".", "members", ":", "byte_size", "=", "member_...
Retrieves the byte size of the data type definition. Returns: int: data type size in bytes or None if size cannot be determined.
[ "Retrieves", "the", "byte", "size", "of", "the", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/data_types.py#L562-L578
libyal/dtfabric
dtfabric/data_types.py
EnumerationDefinition.AddValue
def AddValue(self, name, number, aliases=None, description=None): """Adds an enumeration value. Args: name (str): name. number (int): number. aliases (Optional[list[str]]): aliases. description (Optional[str]): description. Raises: KeyError: if the enumeration value already e...
python
def AddValue(self, name, number, aliases=None, description=None): """Adds an enumeration value. Args: name (str): name. number (int): number. aliases (Optional[list[str]]): aliases. description (Optional[str]): description. Raises: KeyError: if the enumeration value already e...
[ "def", "AddValue", "(", "self", ",", "name", ",", "number", ",", "aliases", "=", "None", ",", "description", "=", "None", ")", ":", "if", "name", "in", "self", ".", "values_per_name", ":", "raise", "KeyError", "(", "'Value with name: {0:s} already exists.'", ...
Adds an enumeration value. Args: name (str): name. number (int): number. aliases (Optional[list[str]]): aliases. description (Optional[str]): description. Raises: KeyError: if the enumeration value already exists.
[ "Adds", "an", "enumeration", "value", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/data_types.py#L677-L707
libyal/dtfabric
dtfabric/data_types.py
StructureFamilyDefinition.AddMemberDefinition
def AddMemberDefinition(self, member_definition): """Adds a member definition. Args: member_definition (DataTypeDefinition): member data type definition. """ self.members.append(member_definition) member_definition.family_definition = self
python
def AddMemberDefinition(self, member_definition): """Adds a member definition. Args: member_definition (DataTypeDefinition): member data type definition. """ self.members.append(member_definition) member_definition.family_definition = self
[ "def", "AddMemberDefinition", "(", "self", ",", "member_definition", ")", ":", "self", ".", "members", ".", "append", "(", "member_definition", ")", "member_definition", ".", "family_definition", "=", "self" ]
Adds a member definition. Args: member_definition (DataTypeDefinition): member data type definition.
[ "Adds", "a", "member", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/data_types.py#L771-L778
dlanger/inlinestyler
inlinestyler/cssselect.py
parse_series
def parse_series(s): """ Parses things like '1n+2', or 'an+b' generally, returning (a, b) """ if isinstance(s, Element): s = s._format_element() if not s or s == '*': # Happens when there's nothing, which the CSS parser thinks of as * return (0, 0) if isinstance(s, int): ...
python
def parse_series(s): """ Parses things like '1n+2', or 'an+b' generally, returning (a, b) """ if isinstance(s, Element): s = s._format_element() if not s or s == '*': # Happens when there's nothing, which the CSS parser thinks of as * return (0, 0) if isinstance(s, int): ...
[ "def", "parse_series", "(", "s", ")", ":", "if", "isinstance", "(", "s", ",", "Element", ")", ":", "s", "=", "s", ".", "_format_element", "(", ")", "if", "not", "s", "or", "s", "==", "'*'", ":", "# Happens when there's nothing, which the CSS parser thinks of...
Parses things like '1n+2', or 'an+b' generally, returning (a, b)
[ "Parses", "things", "like", "1n", "+", "2", "or", "an", "+", "b", "generally", "returning", "(", "a", "b", ")" ]
train
https://github.com/dlanger/inlinestyler/blob/335c4fbab892f0ed67466a6beaea6a91f395ad12/inlinestyler/cssselect.py#L776-L810
dlanger/inlinestyler
inlinestyler/cssselect.py
XPathExpr.add_star_prefix
def add_star_prefix(self): """ Adds a /* prefix if there is no prefix. This is when you need to keep context's constrained to a single parent. """ if self.path: self.path += '*/' else: self.path = '*/' self.star_prefix = True
python
def add_star_prefix(self): """ Adds a /* prefix if there is no prefix. This is when you need to keep context's constrained to a single parent. """ if self.path: self.path += '*/' else: self.path = '*/' self.star_prefix = True
[ "def", "add_star_prefix", "(", "self", ")", ":", "if", "self", ".", "path", ":", "self", ".", "path", "+=", "'*/'", "else", ":", "self", ".", "path", "=", "'*/'", "self", ".", "star_prefix", "=", "True" ]
Adds a /* prefix if there is no prefix. This is when you need to keep context's constrained to a single parent.
[ "Adds", "a", "/", "*", "prefix", "if", "there", "is", "no", "prefix", ".", "This", "is", "when", "you", "need", "to", "keep", "context", "s", "constrained", "to", "a", "single", "parent", "." ]
train
https://github.com/dlanger/inlinestyler/blob/335c4fbab892f0ed67466a6beaea6a91f395ad12/inlinestyler/cssselect.py#L580-L589
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadBooleanDataTypeDefinition
def _ReadBooleanDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a boolean data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str,...
python
def _ReadBooleanDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a boolean data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str,...
[ "def", "_ReadBooleanDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "definition_name", ",", "is_member", "=", "False", ")", ":", "return", "self", ".", "_ReadFixedSizeDataTypeDefinition", "(", "definitions_registry", ",", "d...
Reads a boolean data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. definition_name (str): name of the definition. is_member (Optional[bool]): True if the data typ...
[ "Reads", "a", "boolean", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L102-L122
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadCharacterDataTypeDefinition
def _ReadCharacterDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a character data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[...
python
def _ReadCharacterDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a character data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[...
[ "def", "_ReadCharacterDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "definition_name", ",", "is_member", "=", "False", ")", ":", "return", "self", ".", "_ReadFixedSizeDataTypeDefinition", "(", "definitions_registry", ",", ...
Reads a character data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. definition_name (str): name of the definition. is_member (Optional[bool]): True if the data t...
[ "Reads", "a", "character", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L124-L144
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadConstantDataTypeDefinition
def _ReadConstantDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a constant data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[st...
python
def _ReadConstantDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a constant data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[st...
[ "def", "_ReadConstantDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "definition_name", ",", "is_member", "=", "False", ")", ":", "if", "is_member", ":", "error_message", "=", "'data type not supported as member'", "raise", ...
Reads a constant data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. definition_name (str): name of the definition. is_member (Optional[bool]): True if the data ty...
[ "Reads", "a", "constant", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L146-L180
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadDataTypeDefinition
def _ReadDataTypeDefinition( self, definitions_registry, definition_values, data_type_definition_class, definition_name, supported_definition_values): """Reads a data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. def...
python
def _ReadDataTypeDefinition( self, definitions_registry, definition_values, data_type_definition_class, definition_name, supported_definition_values): """Reads a data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. def...
[ "def", "_ReadDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "data_type_definition_class", ",", "definition_name", ",", "supported_definition_values", ")", ":", "aliases", "=", "definition_values", ".", "get", "(", "'aliases'"...
Reads a data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. data_type_definition_class (str): data type definition class. definition_name (str): name of the defini...
[ "Reads", "a", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L184-L217
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadDataTypeDefinitionWithMembers
def _ReadDataTypeDefinitionWithMembers( self, definitions_registry, definition_values, data_type_definition_class, definition_name, supports_conditions=False): """Reads a data type definition with members. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions ...
python
def _ReadDataTypeDefinitionWithMembers( self, definitions_registry, definition_values, data_type_definition_class, definition_name, supports_conditions=False): """Reads a data type definition with members. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions ...
[ "def", "_ReadDataTypeDefinitionWithMembers", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "data_type_definition_class", ",", "definition_name", ",", "supports_conditions", "=", "False", ")", ":", "members", "=", "definition_values", ".", "get",...
Reads a data type definition with members. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. data_type_definition_class (str): data type definition class. definition_name (str): name ...
[ "Reads", "a", "data", "type", "definition", "with", "members", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L219-L279
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadEnumerationDataTypeDefinition
def _ReadEnumerationDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads an enumeration data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (...
python
def _ReadEnumerationDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads an enumeration data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (...
[ "def", "_ReadEnumerationDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "definition_name", ",", "is_member", "=", "False", ")", ":", "if", "is_member", ":", "error_message", "=", "'data type not supported as member'", "raise",...
Reads an enumeration data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. definition_name (str): name of the definition. is_member (Optional[bool]): True if the dat...
[ "Reads", "an", "enumeration", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L281-L341
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadElementSequenceDataTypeDefinition
def _ReadElementSequenceDataTypeDefinition( self, definitions_registry, definition_values, data_type_definition_class, definition_name, supported_definition_values): """Reads an element sequence data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definiti...
python
def _ReadElementSequenceDataTypeDefinition( self, definitions_registry, definition_values, data_type_definition_class, definition_name, supported_definition_values): """Reads an element sequence data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definiti...
[ "def", "_ReadElementSequenceDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "data_type_definition_class", ",", "definition_name", ",", "supported_definition_values", ")", ":", "unsupported_definition_values", "=", "set", "(", "def...
Reads an element sequence data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. data_type_definition_class (str): data type definition class. definition_name (str): ...
[ "Reads", "an", "element", "sequence", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L343-L437
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadFixedSizeDataTypeDefinition
def _ReadFixedSizeDataTypeDefinition( self, definitions_registry, definition_values, data_type_definition_class, definition_name, supported_attributes, default_size=definitions.SIZE_NATIVE, default_units='bytes', is_member=False, supported_size_values=None): """Reads a fixed-size data type d...
python
def _ReadFixedSizeDataTypeDefinition( self, definitions_registry, definition_values, data_type_definition_class, definition_name, supported_attributes, default_size=definitions.SIZE_NATIVE, default_units='bytes', is_member=False, supported_size_values=None): """Reads a fixed-size data type d...
[ "def", "_ReadFixedSizeDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "data_type_definition_class", ",", "definition_name", ",", "supported_attributes", ",", "default_size", "=", "definitions", ".", "SIZE_NATIVE", ",", "default_...
Reads a fixed-size data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. data_type_definition_class (str): data type definition class. definition_name (str): name of...
[ "Reads", "a", "fixed", "-", "size", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L439-L488
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadFloatingPointDataTypeDefinition
def _ReadFloatingPointDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a floating-point data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_valu...
python
def _ReadFloatingPointDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a floating-point data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_valu...
[ "def", "_ReadFloatingPointDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "definition_name", ",", "is_member", "=", "False", ")", ":", "return", "self", ".", "_ReadFixedSizeDataTypeDefinition", "(", "definitions_registry", ","...
Reads a floating-point data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. definition_name (str): name of the definition. is_member (Optional[bool]): True if the d...
[ "Reads", "a", "floating", "-", "point", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L490-L510
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadFormatDataTypeDefinition
def _ReadFormatDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a format data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, o...
python
def _ReadFormatDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a format data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, o...
[ "def", "_ReadFormatDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "definition_name", ",", "is_member", "=", "False", ")", ":", "if", "is_member", ":", "error_message", "=", "'data type not supported as member'", "raise", "e...
Reads a format data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. definition_name (str): name of the definition. is_member (Optional[bool]): True if the data type...
[ "Reads", "a", "format", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L512-L565
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadIntegerDataTypeDefinition
def _ReadIntegerDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads an integer data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str...
python
def _ReadIntegerDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads an integer data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str...
[ "def", "_ReadIntegerDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "definition_name", ",", "is_member", "=", "False", ")", ":", "definition_object", "=", "self", ".", "_ReadFixedSizeDataTypeDefinition", "(", "definitions_regi...
Reads an integer data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. definition_name (str): name of the definition. is_member (Optional[bool]): True if the data ty...
[ "Reads", "an", "integer", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L567-L603
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadLayoutDataTypeDefinition
def _ReadLayoutDataTypeDefinition( self, definitions_registry, definition_values, data_type_definition_class, definition_name, supported_definition_values): """Reads a layout data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions regist...
python
def _ReadLayoutDataTypeDefinition( self, definitions_registry, definition_values, data_type_definition_class, definition_name, supported_definition_values): """Reads a layout data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions regist...
[ "def", "_ReadLayoutDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "data_type_definition_class", ",", "definition_name", ",", "supported_definition_values", ")", ":", "return", "self", ".", "_ReadDataTypeDefinition", "(", "defin...
Reads a layout data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. data_type_definition_class (str): data type definition class. definition_name (str): name of the...
[ "Reads", "a", "layout", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L605-L628
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadMemberDataTypeDefinitionMember
def _ReadMemberDataTypeDefinitionMember( self, definitions_registry, definition_values, definition_name, supports_conditions=False): """Reads a member data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_val...
python
def _ReadMemberDataTypeDefinitionMember( self, definitions_registry, definition_values, definition_name, supports_conditions=False): """Reads a member data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_val...
[ "def", "_ReadMemberDataTypeDefinitionMember", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "definition_name", ",", "supports_conditions", "=", "False", ")", ":", "if", "not", "definition_values", ":", "error_message", "=", "'invalid structure m...
Reads a member data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. definition_name (str): name of the definition. supports_conditions (Optional[bool]): True if con...
[ "Reads", "a", "member", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L630-L755
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadPaddingDataTypeDefinition
def _ReadPaddingDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a padding data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str,...
python
def _ReadPaddingDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a padding data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str,...
[ "def", "_ReadPaddingDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "definition_name", ",", "is_member", "=", "False", ")", ":", "if", "not", "is_member", ":", "error_message", "=", "'data type only supported as member'", "r...
Reads a padding data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. definition_name (str): name of the definition. is_member (Optional[bool]): True if the data typ...
[ "Reads", "a", "padding", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L757-L804
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadSemanticDataTypeDefinition
def _ReadSemanticDataTypeDefinition( self, definitions_registry, definition_values, data_type_definition_class, definition_name, supported_definition_values): """Reads a semantic data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions re...
python
def _ReadSemanticDataTypeDefinition( self, definitions_registry, definition_values, data_type_definition_class, definition_name, supported_definition_values): """Reads a semantic data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions re...
[ "def", "_ReadSemanticDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "data_type_definition_class", ",", "definition_name", ",", "supported_definition_values", ")", ":", "return", "self", ".", "_ReadDataTypeDefinition", "(", "def...
Reads a semantic data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. data_type_definition_class (str): data type definition class. definition_name (str): name of t...
[ "Reads", "a", "semantic", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L806-L829
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadSequenceDataTypeDefinition
def _ReadSequenceDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a sequence data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[st...
python
def _ReadSequenceDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a sequence data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[st...
[ "def", "_ReadSequenceDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "definition_name", ",", "is_member", "=", "False", ")", ":", "if", "is_member", ":", "supported_definition_values", "=", "(", "self", ".", "_SUPPORTED_DE...
Reads a sequence data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. definition_name (str): name of the definition. is_member (Optional[bool]): True if the data ty...
[ "Reads", "a", "sequence", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L831-L860
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadStorageDataTypeDefinition
def _ReadStorageDataTypeDefinition( self, definitions_registry, definition_values, data_type_definition_class, definition_name, supported_attributes, is_member=False): """Reads a storage data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions ...
python
def _ReadStorageDataTypeDefinition( self, definitions_registry, definition_values, data_type_definition_class, definition_name, supported_attributes, is_member=False): """Reads a storage data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions ...
[ "def", "_ReadStorageDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "data_type_definition_class", ",", "definition_name", ",", "supported_attributes", ",", "is_member", "=", "False", ")", ":", "if", "is_member", ":", "suppor...
Reads a storage data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. data_type_definition_class (str): data type definition class. definition_name (str): name of th...
[ "Reads", "a", "storage", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L862-L912
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadStreamDataTypeDefinition
def _ReadStreamDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a stream data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, o...
python
def _ReadStreamDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a stream data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, o...
[ "def", "_ReadStreamDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "definition_name", ",", "is_member", "=", "False", ")", ":", "if", "is_member", ":", "supported_definition_values", "=", "(", "self", ".", "_SUPPORTED_DEFI...
Reads a stream data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. definition_name (str): name of the definition. is_member (Optional[bool]): True if the data type...
[ "Reads", "a", "stream", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L914-L943
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadStringDataTypeDefinition
def _ReadStringDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a string data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, o...
python
def _ReadStringDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a string data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, o...
[ "def", "_ReadStringDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "definition_name", ",", "is_member", "=", "False", ")", ":", "if", "is_member", ":", "supported_definition_values", "=", "(", "self", ".", "_SUPPORTED_DEFI...
Reads a string data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. definition_name (str): name of the definition. is_member (Optional[bool]): True if the data type...
[ "Reads", "a", "string", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L945-L982
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadStructureDataTypeDefinition
def _ReadStructureDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a structure data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[...
python
def _ReadStructureDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a structure data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[...
[ "def", "_ReadStructureDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "definition_name", ",", "is_member", "=", "False", ")", ":", "if", "is_member", ":", "error_message", "=", "'data type not supported as member'", "raise", ...
Reads a structure data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. definition_name (str): name of the definition. is_member (Optional[bool]): True if the data t...
[ "Reads", "a", "structure", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L984-L1010
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadStructureFamilyDataTypeDefinition
def _ReadStructureFamilyDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a structure family data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_...
python
def _ReadStructureFamilyDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a structure family data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_...
[ "def", "_ReadStructureFamilyDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "definition_name", ",", "is_member", "=", "False", ")", ":", "if", "is_member", ":", "error_message", "=", "'data type not supported as member'", "rai...
Reads a structure family data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. definition_name (str): name of the definition. is_member (Optional[bool]): True if the...
[ "Reads", "a", "structure", "family", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L1012-L1076
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadUnionDataTypeDefinition
def _ReadUnionDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads an union data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, ob...
python
def _ReadUnionDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads an union data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, ob...
[ "def", "_ReadUnionDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "definition_name", ",", "is_member", "=", "False", ")", ":", "return", "self", ".", "_ReadDataTypeDefinitionWithMembers", "(", "definitions_registry", ",", "d...
Reads an union data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. definition_name (str): name of the definition. is_member (Optional[bool]): True if the data type...
[ "Reads", "an", "union", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L1078-L1100
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsReader._ReadUUIDDataTypeDefinition
def _ReadUUIDDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads an UUID data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, obje...
python
def _ReadUUIDDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads an UUID data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, obje...
[ "def", "_ReadUUIDDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "definition_name", ",", "is_member", "=", "False", ")", ":", "return", "self", ".", "_ReadFixedSizeDataTypeDefinition", "(", "definitions_registry", ",", "defi...
Reads an UUID data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. definition_name (str): name of the definition. is_member (Optional[bool]): True if the data type ...
[ "Reads", "an", "UUID", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L1102-L1126
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsFileReader._ReadDefinition
def _ReadDefinition(self, definitions_registry, definition_values): """Reads a data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. Returns: DataTypeDefinition: ...
python
def _ReadDefinition(self, definitions_registry, definition_values): """Reads a data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. Returns: DataTypeDefinition: ...
[ "def", "_ReadDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ")", ":", "if", "not", "definition_values", ":", "error_message", "=", "'missing definition values'", "raise", "errors", ".", "DefinitionReaderError", "(", "None", ",", "erro...
Reads a data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. Returns: DataTypeDefinition: data type definition or None. Raises: DefinitionReaderError: if ...
[ "Reads", "a", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L1132-L1169
libyal/dtfabric
dtfabric/reader.py
DataTypeDefinitionsFileReader.ReadFile
def ReadFile(self, definitions_registry, path): """Reads data type definitions from a file into the registry. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. path (str): path of the file to read from. """ with open(path, 'r') as file_objec...
python
def ReadFile(self, definitions_registry, path): """Reads data type definitions from a file into the registry. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. path (str): path of the file to read from. """ with open(path, 'r') as file_objec...
[ "def", "ReadFile", "(", "self", ",", "definitions_registry", ",", "path", ")", ":", "with", "open", "(", "path", ",", "'r'", ")", "as", "file_object", ":", "self", ".", "ReadFileObject", "(", "definitions_registry", ",", "file_object", ")" ]
Reads data type definitions from a file into the registry. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. path (str): path of the file to read from.
[ "Reads", "data", "type", "definitions", "from", "a", "file", "into", "the", "registry", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L1171-L1180
libyal/dtfabric
dtfabric/reader.py
YAMLDataTypeDefinitionsFileReader._GetFormatErrorLocation
def _GetFormatErrorLocation( self, yaml_definition, last_definition_object): """Retrieves a format error location. Args: yaml_definition (dict[str, object]): current YAML definition. last_definition_object (DataTypeDefinition): previous data type definition. Returns: str:...
python
def _GetFormatErrorLocation( self, yaml_definition, last_definition_object): """Retrieves a format error location. Args: yaml_definition (dict[str, object]): current YAML definition. last_definition_object (DataTypeDefinition): previous data type definition. Returns: str:...
[ "def", "_GetFormatErrorLocation", "(", "self", ",", "yaml_definition", ",", "last_definition_object", ")", ":", "name", "=", "yaml_definition", ".", "get", "(", "'name'", ",", "None", ")", "if", "name", ":", "error_location", "=", "'in: {0:s}'", ".", "format", ...
Retrieves a format error location. Args: yaml_definition (dict[str, object]): current YAML definition. last_definition_object (DataTypeDefinition): previous data type definition. Returns: str: format error location.
[ "Retrieves", "a", "format", "error", "location", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L1205-L1225
libyal/dtfabric
dtfabric/reader.py
YAMLDataTypeDefinitionsFileReader.ReadFileObject
def ReadFileObject(self, definitions_registry, file_object): """Reads data type definitions from a file-like object into the registry. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. file_object (file): file-like object to read from. Raises: ...
python
def ReadFileObject(self, definitions_registry, file_object): """Reads data type definitions from a file-like object into the registry. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. file_object (file): file-like object to read from. Raises: ...
[ "def", "ReadFileObject", "(", "self", ",", "definitions_registry", ",", "file_object", ")", ":", "last_definition_object", "=", "None", "error_location", "=", "None", "error_message", "=", "None", "try", ":", "yaml_generator", "=", "yaml", ".", "safe_load_all", "(...
Reads data type definitions from a file-like object into the registry. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. file_object (file): file-like object to read from. Raises: FormatError: if the definitions values are missing or if the f...
[ "Reads", "data", "type", "definitions", "from", "a", "file", "-", "like", "object", "into", "the", "registry", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L1227-L1267
jorisroovers/pymarkdownlint
pymarkdownlint/filefinder.py
MarkdownFileFinder.find_files
def find_files(path, filter="*.md"): """ Finds files with an (optional) given extension in a given path. """ if os.path.isfile(path): return [path] if os.path.isdir(path): matches = [] for root, dirnames, filenames in os.walk(path): for filena...
python
def find_files(path, filter="*.md"): """ Finds files with an (optional) given extension in a given path. """ if os.path.isfile(path): return [path] if os.path.isdir(path): matches = [] for root, dirnames, filenames in os.walk(path): for filena...
[ "def", "find_files", "(", "path", ",", "filter", "=", "\"*.md\"", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "return", "[", "path", "]", "if", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "matches", "=", ...
Finds files with an (optional) given extension in a given path.
[ "Finds", "files", "with", "an", "(", "optional", ")", "given", "extension", "in", "a", "given", "path", "." ]
train
https://github.com/jorisroovers/pymarkdownlint/blob/c1044e25e18afd78b3fda8fd9b00a4f67cfbbc65/pymarkdownlint/filefinder.py#L7-L17
OCHA-DAP/hdx-python-api
src/hdx/data/organization.py
Organization.read_from_hdx
def read_from_hdx(identifier, configuration=None): # type: (str, Optional[Configuration]) -> Optional['Organization'] """Reads the organization given by identifier from HDX and returns Organization object Args: identifier (str): Identifier of organization configuration (...
python
def read_from_hdx(identifier, configuration=None): # type: (str, Optional[Configuration]) -> Optional['Organization'] """Reads the organization given by identifier from HDX and returns Organization object Args: identifier (str): Identifier of organization configuration (...
[ "def", "read_from_hdx", "(", "identifier", ",", "configuration", "=", "None", ")", ":", "# type: (str, Optional[Configuration]) -> Optional['Organization']", "organization", "=", "Organization", "(", "configuration", "=", "configuration", ")", "result", "=", "organization",...
Reads the organization given by identifier from HDX and returns Organization object Args: identifier (str): Identifier of organization configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration. Returns: Optional[Organization]: Orga...
[ "Reads", "the", "organization", "given", "by", "identifier", "from", "HDX", "and", "returns", "Organization", "object" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/organization.py#L70-L86
OCHA-DAP/hdx-python-api
src/hdx/data/organization.py
Organization.get_users
def get_users(self, capacity=None): # type: (Optional[str]) -> List[User] """Returns the organization's users. Args: capacity (Optional[str]): Filter by capacity eg. member, admin. Defaults to None. Returns: List[User]: Organization's users. """ u...
python
def get_users(self, capacity=None): # type: (Optional[str]) -> List[User] """Returns the organization's users. Args: capacity (Optional[str]): Filter by capacity eg. member, admin. Defaults to None. Returns: List[User]: Organization's users. """ u...
[ "def", "get_users", "(", "self", ",", "capacity", "=", "None", ")", ":", "# type: (Optional[str]) -> List[User]", "users", "=", "list", "(", ")", "usersdicts", "=", "self", ".", "data", ".", "get", "(", "'users'", ")", "if", "usersdicts", "is", "not", "Non...
Returns the organization's users. Args: capacity (Optional[str]): Filter by capacity eg. member, admin. Defaults to None. Returns: List[User]: Organization's users.
[ "Returns", "the", "organization", "s", "users", "." ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/organization.py#L128-L149
OCHA-DAP/hdx-python-api
src/hdx/data/organization.py
Organization.add_update_user
def add_update_user(self, user, capacity=None): # type: (Union[hdx.data.user.User,Dict,str],Optional[str]) -> None """Add new or update existing user in organization with new metadata. Capacity eg. member, admin must be supplied either within the User object or dictionary or using the capacity a...
python
def add_update_user(self, user, capacity=None): # type: (Union[hdx.data.user.User,Dict,str],Optional[str]) -> None """Add new or update existing user in organization with new metadata. Capacity eg. member, admin must be supplied either within the User object or dictionary or using the capacity a...
[ "def", "add_update_user", "(", "self", ",", "user", ",", "capacity", "=", "None", ")", ":", "# type: (Union[hdx.data.user.User,Dict,str],Optional[str]) -> None", "if", "isinstance", "(", "user", ",", "str", ")", ":", "user", "=", "hdx", ".", "data", ".", "user",...
Add new or update existing user in organization with new metadata. Capacity eg. member, admin must be supplied either within the User object or dictionary or using the capacity argument (which takes precedence). Args: user (Union[User,Dict,str]): Either a user id or user metadata ei...
[ "Add", "new", "or", "update", "existing", "user", "in", "organization", "with", "new", "metadata", ".", "Capacity", "eg", ".", "member", "admin", "must", "be", "supplied", "either", "within", "the", "User", "object", "or", "dictionary", "or", "using", "the",...
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/organization.py#L151-L178
OCHA-DAP/hdx-python-api
src/hdx/data/organization.py
Organization.add_update_users
def add_update_users(self, users, capacity=None): # type: (List[Union[hdx.data.user.User,Dict,str]],Optional[str]) -> None """Add new or update existing users in organization with new metadata. Capacity eg. member, admin must be supplied either within the User object or dictionary or using the c...
python
def add_update_users(self, users, capacity=None): # type: (List[Union[hdx.data.user.User,Dict,str]],Optional[str]) -> None """Add new or update existing users in organization with new metadata. Capacity eg. member, admin must be supplied either within the User object or dictionary or using the c...
[ "def", "add_update_users", "(", "self", ",", "users", ",", "capacity", "=", "None", ")", ":", "# type: (List[Union[hdx.data.user.User,Dict,str]],Optional[str]) -> None", "if", "not", "isinstance", "(", "users", ",", "list", ")", ":", "raise", "HDXError", "(", "'User...
Add new or update existing users in organization with new metadata. Capacity eg. member, admin must be supplied either within the User object or dictionary or using the capacity argument (which takes precedence). Args: users (List[Union[User,Dict,str]]): A list of either user ids or...
[ "Add", "new", "or", "update", "existing", "users", "in", "organization", "with", "new", "metadata", ".", "Capacity", "eg", ".", "member", "admin", "must", "be", "supplied", "either", "within", "the", "User", "object", "or", "dictionary", "or", "using", "the"...
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/organization.py#L180-L196
OCHA-DAP/hdx-python-api
src/hdx/data/organization.py
Organization.get_datasets
def get_datasets(self, query='*:*', **kwargs): # type: (str, Any) -> List[hdx.data.dataset.Dataset] """Get list of datasets in organization Args: query (str): Restrict datasets returned to this query (in Solr format). Defaults to '*:*'. **kwargs: See below so...
python
def get_datasets(self, query='*:*', **kwargs): # type: (str, Any) -> List[hdx.data.dataset.Dataset] """Get list of datasets in organization Args: query (str): Restrict datasets returned to this query (in Solr format). Defaults to '*:*'. **kwargs: See below so...
[ "def", "get_datasets", "(", "self", ",", "query", "=", "'*:*'", ",", "*", "*", "kwargs", ")", ":", "# type: (str, Any) -> List[hdx.data.dataset.Dataset]", "return", "hdx", ".", "data", ".", "dataset", ".", "Dataset", ".", "search_in_hdx", "(", "query", "=", "q...
Get list of datasets in organization Args: query (str): Restrict datasets returned to this query (in Solr format). Defaults to '*:*'. **kwargs: See below sort (string): Sorting of the search results. Defaults to 'relevance asc, metadata_modified desc'. rows (int)...
[ "Get", "list", "of", "datasets", "in", "organization" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/organization.py#L210-L231
OCHA-DAP/hdx-python-api
src/hdx/data/organization.py
Organization.get_all_organization_names
def get_all_organization_names(configuration=None, **kwargs): # type: (Optional[Configuration], Any) -> List[str] """Get all organization names in HDX Args: configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration. **kwargs: See below ...
python
def get_all_organization_names(configuration=None, **kwargs): # type: (Optional[Configuration], Any) -> List[str] """Get all organization names in HDX Args: configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration. **kwargs: See below ...
[ "def", "get_all_organization_names", "(", "configuration", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# type: (Optional[Configuration], Any) -> List[str]", "organization", "=", "Organization", "(", "configuration", "=", "configuration", ")", "organization", "[", "...
Get all organization names in HDX Args: configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration. **kwargs: See below sort (str): Sort the search results according to field name and sort-order. Allowed fields are ‘name’, ‘package_count’ an...
[ "Get", "all", "organization", "names", "in", "HDX" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/organization.py#L234-L253
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._read_from_hdx
def _read_from_hdx(self, object_type, value, fieldname='id', action=None, **kwargs): # type: (str, str, str, Optional[str], Any) -> Tuple[bool, Union[Dict, str]] """Makes a read call to HDX passing in given parameter. Args: object_type (str): Description of HD...
python
def _read_from_hdx(self, object_type, value, fieldname='id', action=None, **kwargs): # type: (str, str, str, Optional[str], Any) -> Tuple[bool, Union[Dict, str]] """Makes a read call to HDX passing in given parameter. Args: object_type (str): Description of HD...
[ "def", "_read_from_hdx", "(", "self", ",", "object_type", ",", "value", ",", "fieldname", "=", "'id'", ",", "action", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# type: (str, str, str, Optional[str], Any) -> Tuple[bool, Union[Dict, str]]", "if", "not", "fieldn...
Makes a read call to HDX passing in given parameter. Args: object_type (str): Description of HDX object type (for messages) value (str): Value of HDX field fieldname (str): HDX field name. Defaults to id. action (Optional[str]): Replacement CKAN action url to use...
[ "Makes", "a", "read", "call", "to", "HDX", "passing", "in", "given", "parameter", "." ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L95-L122
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._load_from_hdx
def _load_from_hdx(self, object_type, id_field): # type: (str, str) -> bool """Helper method to load the HDX object given by identifier from HDX Args: object_type (str): Description of HDX object type (for messages) id_field (str): HDX object identifier Returns:...
python
def _load_from_hdx(self, object_type, id_field): # type: (str, str) -> bool """Helper method to load the HDX object given by identifier from HDX Args: object_type (str): Description of HDX object type (for messages) id_field (str): HDX object identifier Returns:...
[ "def", "_load_from_hdx", "(", "self", ",", "object_type", ",", "id_field", ")", ":", "# type: (str, str) -> bool", "success", ",", "result", "=", "self", ".", "_read_from_hdx", "(", "object_type", ",", "id_field", ")", "if", "success", ":", "self", ".", "old_d...
Helper method to load the HDX object given by identifier from HDX Args: object_type (str): Description of HDX object type (for messages) id_field (str): HDX object identifier Returns: bool: True if loaded, False if not
[ "Helper", "method", "to", "load", "the", "HDX", "object", "given", "by", "identifier", "from", "HDX" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L124-L141
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._check_load_existing_object
def _check_load_existing_object(self, object_type, id_field_name, operation='update'): # type: (str, str, str) -> None """Check metadata exists and contains HDX object identifier, and if so load HDX object Args: object_type (str): Description of HDX object type (for messages) ...
python
def _check_load_existing_object(self, object_type, id_field_name, operation='update'): # type: (str, str, str) -> None """Check metadata exists and contains HDX object identifier, and if so load HDX object Args: object_type (str): Description of HDX object type (for messages) ...
[ "def", "_check_load_existing_object", "(", "self", ",", "object_type", ",", "id_field_name", ",", "operation", "=", "'update'", ")", ":", "# type: (str, str, str) -> None", "self", ".", "_check_existing_object", "(", "object_type", ",", "id_field_name", ")", "if", "no...
Check metadata exists and contains HDX object identifier, and if so load HDX object Args: object_type (str): Description of HDX object type (for messages) id_field_name (str): Name of field containing HDX object identifier operation (str): Operation to report if error. Defau...
[ "Check", "metadata", "exists", "and", "contains", "HDX", "object", "identifier", "and", "if", "so", "load", "HDX", "object" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L165-L179
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._check_required_fields
def _check_required_fields(self, object_type, ignore_fields): # type: (str, List[str]) -> None """Helper method to check that metadata for HDX object is complete Args: ignore_fields (List[str]): Any fields to ignore in the check Returns: None """ ...
python
def _check_required_fields(self, object_type, ignore_fields): # type: (str, List[str]) -> None """Helper method to check that metadata for HDX object is complete Args: ignore_fields (List[str]): Any fields to ignore in the check Returns: None """ ...
[ "def", "_check_required_fields", "(", "self", ",", "object_type", ",", "ignore_fields", ")", ":", "# type: (str, List[str]) -> None", "for", "field", "in", "self", ".", "configuration", "[", "object_type", "]", "[", "'required_fields'", "]", ":", "if", "field", "n...
Helper method to check that metadata for HDX object is complete Args: ignore_fields (List[str]): Any fields to ignore in the check Returns: None
[ "Helper", "method", "to", "check", "that", "metadata", "for", "HDX", "object", "is", "complete" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L195-L207
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._merge_hdx_update
def _merge_hdx_update(self, object_type, id_field_name, file_to_upload=None, **kwargs): # type: (str, str, Optional[str], Any) -> None """Helper method to check if HDX object exists and update it Args: object_type (str): Description of HDX object type (for messages) id_f...
python
def _merge_hdx_update(self, object_type, id_field_name, file_to_upload=None, **kwargs): # type: (str, str, Optional[str], Any) -> None """Helper method to check if HDX object exists and update it Args: object_type (str): Description of HDX object type (for messages) id_f...
[ "def", "_merge_hdx_update", "(", "self", ",", "object_type", ",", "id_field_name", ",", "file_to_upload", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# type: (str, str, Optional[str], Any) -> None", "merge_two_dictionaries", "(", "self", ".", "data", ",", "self...
Helper method to check if HDX object exists and update it Args: object_type (str): Description of HDX object type (for messages) id_field_name (str): Name of field containing HDX object identifier file_to_upload (Optional[str]): File to upload to HDX **kwargs: Se...
[ "Helper", "method", "to", "check", "if", "HDX", "object", "exists", "and", "update", "it" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L209-L231
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._update_in_hdx
def _update_in_hdx(self, object_type, id_field_name, file_to_upload=None, **kwargs): # type: (str, str, Optional[str], Any) -> None """Helper method to check if HDX object exists in HDX and if so, update it Args: object_type (str): Description of HDX object type (for messages) ...
python
def _update_in_hdx(self, object_type, id_field_name, file_to_upload=None, **kwargs): # type: (str, str, Optional[str], Any) -> None """Helper method to check if HDX object exists in HDX and if so, update it Args: object_type (str): Description of HDX object type (for messages) ...
[ "def", "_update_in_hdx", "(", "self", ",", "object_type", ",", "id_field_name", ",", "file_to_upload", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# type: (str, str, Optional[str], Any) -> None", "self", ".", "_check_load_existing_object", "(", "object_type", ","...
Helper method to check if HDX object exists in HDX and if so, update it Args: object_type (str): Description of HDX object type (for messages) id_field_name (str): Name of field containing HDX object identifier file_to_upload (Optional[str]): File to upload to HDX ...
[ "Helper", "method", "to", "check", "if", "HDX", "object", "exists", "in", "HDX", "and", "if", "so", "update", "it" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L243-L262
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._write_to_hdx
def _write_to_hdx(self, action, data, id_field_name, file_to_upload=None): # type: (str, Dict, str, Optional[str]) -> Dict """Creates or updates an HDX object in HDX and return HDX object metadata dict Args: action (str): Action to perform eg. 'create', 'update' data (Di...
python
def _write_to_hdx(self, action, data, id_field_name, file_to_upload=None): # type: (str, Dict, str, Optional[str]) -> Dict """Creates or updates an HDX object in HDX and return HDX object metadata dict Args: action (str): Action to perform eg. 'create', 'update' data (Di...
[ "def", "_write_to_hdx", "(", "self", ",", "action", ",", "data", ",", "id_field_name", ",", "file_to_upload", "=", "None", ")", ":", "# type: (str, Dict, str, Optional[str]) -> Dict", "file", "=", "None", "try", ":", "if", "file_to_upload", ":", "file", "=", "op...
Creates or updates an HDX object in HDX and return HDX object metadata dict Args: action (str): Action to perform eg. 'create', 'update' data (Dict): Data to write to HDX id_field_name (str): Name of field containing HDX object identifier or None file_to_upload (...
[ "Creates", "or", "updates", "an", "HDX", "object", "in", "HDX", "and", "return", "HDX", "object", "metadata", "dict" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L264-L289
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._save_to_hdx
def _save_to_hdx(self, action, id_field_name, file_to_upload=None): # type: (str, str, Optional[str]) -> None """Creates or updates an HDX object in HDX, saving current data and replacing with returned HDX object data from HDX Args: action (str): Action to perform: 'create' ...
python
def _save_to_hdx(self, action, id_field_name, file_to_upload=None): # type: (str, str, Optional[str]) -> None """Creates or updates an HDX object in HDX, saving current data and replacing with returned HDX object data from HDX Args: action (str): Action to perform: 'create' ...
[ "def", "_save_to_hdx", "(", "self", ",", "action", ",", "id_field_name", ",", "file_to_upload", "=", "None", ")", ":", "# type: (str, str, Optional[str]) -> None", "result", "=", "self", ".", "_write_to_hdx", "(", "action", ",", "self", ".", "data", ",", "id_fie...
Creates or updates an HDX object in HDX, saving current data and replacing with returned HDX object data from HDX Args: action (str): Action to perform: 'create' or 'update' id_field_name (str): Name of field containing HDX object identifier file_to_upload (Optional[...
[ "Creates", "or", "updates", "an", "HDX", "object", "in", "HDX", "saving", "current", "data", "and", "replacing", "with", "returned", "HDX", "object", "data", "from", "HDX" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L291-L306
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._create_in_hdx
def _create_in_hdx(self, object_type, id_field_name, name_field_name, file_to_upload=None): # type: (str, str, str, Optional[str]) -> None """Helper method to check if resource exists in HDX and if so, update it, otherwise create it Args: object_type (str): D...
python
def _create_in_hdx(self, object_type, id_field_name, name_field_name, file_to_upload=None): # type: (str, str, str, Optional[str]) -> None """Helper method to check if resource exists in HDX and if so, update it, otherwise create it Args: object_type (str): D...
[ "def", "_create_in_hdx", "(", "self", ",", "object_type", ",", "id_field_name", ",", "name_field_name", ",", "file_to_upload", "=", "None", ")", ":", "# type: (str, str, str, Optional[str]) -> None", "self", ".", "check_required_fields", "(", ")", "if", "id_field_name",...
Helper method to check if resource exists in HDX and if so, update it, otherwise create it Args: object_type (str): Description of HDX object type (for messages) id_field_name (str): Name of field containing HDX object identifier name_field_name (str): Name of field contain...
[ "Helper", "method", "to", "check", "if", "resource", "exists", "in", "HDX", "and", "if", "so", "update", "it", "otherwise", "create", "it" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L318-L338
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._delete_from_hdx
def _delete_from_hdx(self, object_type, id_field_name): # type: (str, str) -> None """Helper method to deletes a resource from HDX Args: object_type (str): Description of HDX object type (for messages) id_field_name (str): Name of field containing HDX object identifier ...
python
def _delete_from_hdx(self, object_type, id_field_name): # type: (str, str) -> None """Helper method to deletes a resource from HDX Args: object_type (str): Description of HDX object type (for messages) id_field_name (str): Name of field containing HDX object identifier ...
[ "def", "_delete_from_hdx", "(", "self", ",", "object_type", ",", "id_field_name", ")", ":", "# type: (str, str) -> None", "if", "id_field_name", "not", "in", "self", ".", "data", ":", "raise", "HDXError", "(", "'No %s field (mandatory) in %s!'", "%", "(", "id_field_...
Helper method to deletes a resource from HDX Args: object_type (str): Description of HDX object type (for messages) id_field_name (str): Name of field containing HDX object identifier Returns: None
[ "Helper", "method", "to", "deletes", "a", "resource", "from", "HDX" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L350-L363
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._addupdate_hdxobject
def _addupdate_hdxobject(self, hdxobjects, id_field, new_hdxobject): # type: (List[HDXObjectUpperBound], str, HDXObjectUpperBound) -> HDXObjectUpperBound """Helper function to add a new HDX object to a supplied list of HDX objects or update existing metadata if the object already exists in the l...
python
def _addupdate_hdxobject(self, hdxobjects, id_field, new_hdxobject): # type: (List[HDXObjectUpperBound], str, HDXObjectUpperBound) -> HDXObjectUpperBound """Helper function to add a new HDX object to a supplied list of HDX objects or update existing metadata if the object already exists in the l...
[ "def", "_addupdate_hdxobject", "(", "self", ",", "hdxobjects", ",", "id_field", ",", "new_hdxobject", ")", ":", "# type: (List[HDXObjectUpperBound], str, HDXObjectUpperBound) -> HDXObjectUpperBound", "for", "hdxobject", "in", "hdxobjects", ":", "if", "hdxobject", "[", "id_f...
Helper function to add a new HDX object to a supplied list of HDX objects or update existing metadata if the object already exists in the list Args: hdxobjects (List[T <= HDXObject]): list of HDX objects to which to add new objects or update existing ones id_field (str): Field o...
[ "Helper", "function", "to", "add", "a", "new", "HDX", "object", "to", "a", "supplied", "list", "of", "HDX", "objects", "or", "update", "existing", "metadata", "if", "the", "object", "already", "exists", "in", "the", "list" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L365-L383
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._remove_hdxobject
def _remove_hdxobject(self, objlist, obj, matchon='id', delete=False): # type: (List[Union[HDXObjectUpperBound,Dict]], Union[HDXObjectUpperBound,Dict,str], str, bool) -> bool """Remove an HDX object from a list within the parent HDX object Args: objlist (List[Union[T <= HDXObject,Di...
python
def _remove_hdxobject(self, objlist, obj, matchon='id', delete=False): # type: (List[Union[HDXObjectUpperBound,Dict]], Union[HDXObjectUpperBound,Dict,str], str, bool) -> bool """Remove an HDX object from a list within the parent HDX object Args: objlist (List[Union[T <= HDXObject,Di...
[ "def", "_remove_hdxobject", "(", "self", ",", "objlist", ",", "obj", ",", "matchon", "=", "'id'", ",", "delete", "=", "False", ")", ":", "# type: (List[Union[HDXObjectUpperBound,Dict]], Union[HDXObjectUpperBound,Dict,str], str, bool) -> bool", "if", "objlist", "is", "None...
Remove an HDX object from a list within the parent HDX object Args: objlist (List[Union[T <= HDXObject,Dict]]): list of HDX objects obj (Union[T <= HDXObject,Dict,str]): Either an id or hdx object metadata either from an HDX object or a dictionary matchon (str): Field to mat...
[ "Remove", "an", "HDX", "object", "from", "a", "list", "within", "the", "parent", "HDX", "object" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L385-L415
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._convert_hdxobjects
def _convert_hdxobjects(self, hdxobjects): # type: (List[HDXObjectUpperBound]) -> List[HDXObjectUpperBound] """Helper function to convert supplied list of HDX objects to a list of dict Args: hdxobjects (List[T <= HDXObject]): List of HDX objects to convert Returns: ...
python
def _convert_hdxobjects(self, hdxobjects): # type: (List[HDXObjectUpperBound]) -> List[HDXObjectUpperBound] """Helper function to convert supplied list of HDX objects to a list of dict Args: hdxobjects (List[T <= HDXObject]): List of HDX objects to convert Returns: ...
[ "def", "_convert_hdxobjects", "(", "self", ",", "hdxobjects", ")", ":", "# type: (List[HDXObjectUpperBound]) -> List[HDXObjectUpperBound]", "newhdxobjects", "=", "list", "(", ")", "for", "hdxobject", "in", "hdxobjects", ":", "newhdxobjects", ".", "append", "(", "hdxobje...
Helper function to convert supplied list of HDX objects to a list of dict Args: hdxobjects (List[T <= HDXObject]): List of HDX objects to convert Returns: List[Dict]: List of HDX objects converted to simple dictionaries
[ "Helper", "function", "to", "convert", "supplied", "list", "of", "HDX", "objects", "to", "a", "list", "of", "dict" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L417-L430
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._copy_hdxobjects
def _copy_hdxobjects(self, hdxobjects, hdxobjectclass, attribute_to_copy=None): # type: (List[HDXObjectUpperBound], type, Optional[str]) -> List[HDXObjectUpperBound] """Helper function to make a deep copy of a supplied list of HDX objects Args: hdxobjects (List[T <= HDXObject]): lis...
python
def _copy_hdxobjects(self, hdxobjects, hdxobjectclass, attribute_to_copy=None): # type: (List[HDXObjectUpperBound], type, Optional[str]) -> List[HDXObjectUpperBound] """Helper function to make a deep copy of a supplied list of HDX objects Args: hdxobjects (List[T <= HDXObject]): lis...
[ "def", "_copy_hdxobjects", "(", "self", ",", "hdxobjects", ",", "hdxobjectclass", ",", "attribute_to_copy", "=", "None", ")", ":", "# type: (List[HDXObjectUpperBound], type, Optional[str]) -> List[HDXObjectUpperBound]", "newhdxobjects", "=", "list", "(", ")", "for", "hdxobj...
Helper function to make a deep copy of a supplied list of HDX objects Args: hdxobjects (List[T <= HDXObject]): list of HDX objects to copy hdxobjectclass (type): Type of the HDX Objects to be copied attribute_to_copy (Optional[str]): An attribute to copy over from the HDX ob...
[ "Helper", "function", "to", "make", "a", "deep", "copy", "of", "a", "supplied", "list", "of", "HDX", "objects" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L432-L452
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._separate_hdxobjects
def _separate_hdxobjects(self, hdxobjects, hdxobjects_name, id_field, hdxobjectclass): # type: (List[HDXObjectUpperBound], str, str, type) -> None """Helper function to take a list of HDX objects contained in the internal dictionary and add them to a supplied list of HDX objects or update existi...
python
def _separate_hdxobjects(self, hdxobjects, hdxobjects_name, id_field, hdxobjectclass): # type: (List[HDXObjectUpperBound], str, str, type) -> None """Helper function to take a list of HDX objects contained in the internal dictionary and add them to a supplied list of HDX objects or update existi...
[ "def", "_separate_hdxobjects", "(", "self", ",", "hdxobjects", ",", "hdxobjects_name", ",", "id_field", ",", "hdxobjectclass", ")", ":", "# type: (List[HDXObjectUpperBound], str, str, type) -> None", "new_hdxobjects", "=", "self", ".", "data", ".", "get", "(", "hdxobjec...
Helper function to take a list of HDX objects contained in the internal dictionary and add them to a supplied list of HDX objects or update existing metadata if any objects already exist in the list. The list in the internal dictionary is then deleted. Args: hdxobjects (List[T <= HD...
[ "Helper", "function", "to", "take", "a", "list", "of", "HDX", "objects", "contained", "in", "the", "internal", "dictionary", "and", "add", "them", "to", "a", "supplied", "list", "of", "HDX", "objects", "or", "update", "existing", "metadata", "if", "any", "...
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L454-L483
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._get_tags
def _get_tags(self): # type: () -> List[str] """Return the dataset's list of tags Returns: List[str]: list of tags or [] if there are none """ tags = self.data.get('tags', None) if not tags: return list() return [x['name'] for x in tags]
python
def _get_tags(self): # type: () -> List[str] """Return the dataset's list of tags Returns: List[str]: list of tags or [] if there are none """ tags = self.data.get('tags', None) if not tags: return list() return [x['name'] for x in tags]
[ "def", "_get_tags", "(", "self", ")", ":", "# type: () -> List[str]", "tags", "=", "self", ".", "data", ".", "get", "(", "'tags'", ",", "None", ")", "if", "not", "tags", ":", "return", "list", "(", ")", "return", "[", "x", "[", "'name'", "]", "for", ...
Return the dataset's list of tags Returns: List[str]: list of tags or [] if there are none
[ "Return", "the", "dataset", "s", "list", "of", "tags" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L485-L495
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._add_tag
def _add_tag(self, tag): # type: (str) -> bool """Add a tag Args: tag (str): Tag to add Returns: bool: True if tag added or False if tag already present """ tags = self.data.get('tags', None) if tags: if tag in [x['name'] for ...
python
def _add_tag(self, tag): # type: (str) -> bool """Add a tag Args: tag (str): Tag to add Returns: bool: True if tag added or False if tag already present """ tags = self.data.get('tags', None) if tags: if tag in [x['name'] for ...
[ "def", "_add_tag", "(", "self", ",", "tag", ")", ":", "# type: (str) -> bool", "tags", "=", "self", ".", "data", ".", "get", "(", "'tags'", ",", "None", ")", "if", "tags", ":", "if", "tag", "in", "[", "x", "[", "'name'", "]", "for", "x", "in", "t...
Add a tag Args: tag (str): Tag to add Returns: bool: True if tag added or False if tag already present
[ "Add", "a", "tag" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L497-L515
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._add_tags
def _add_tags(self, tags): # type: (List[str]) -> bool """Add a list of tag Args: tags (List[str]): list of tags to add Returns: bool: True if all tags added or False if any already present. """ alltagsadded = True for tag in tags: ...
python
def _add_tags(self, tags): # type: (List[str]) -> bool """Add a list of tag Args: tags (List[str]): list of tags to add Returns: bool: True if all tags added or False if any already present. """ alltagsadded = True for tag in tags: ...
[ "def", "_add_tags", "(", "self", ",", "tags", ")", ":", "# type: (List[str]) -> bool", "alltagsadded", "=", "True", "for", "tag", "in", "tags", ":", "if", "not", "self", ".", "_add_tag", "(", "tag", ")", ":", "alltagsadded", "=", "False", "return", "alltag...
Add a list of tag Args: tags (List[str]): list of tags to add Returns: bool: True if all tags added or False if any already present.
[ "Add", "a", "list", "of", "tag" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L517-L531
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._get_stringlist_from_commastring
def _get_stringlist_from_commastring(self, field): # type: (str) -> List[str] """Return list of strings from comma separated list Args: field (str): Field containing comma separated list Returns: List[str]: List of strings """ strings = self.data...
python
def _get_stringlist_from_commastring(self, field): # type: (str) -> List[str] """Return list of strings from comma separated list Args: field (str): Field containing comma separated list Returns: List[str]: List of strings """ strings = self.data...
[ "def", "_get_stringlist_from_commastring", "(", "self", ",", "field", ")", ":", "# type: (str) -> List[str]", "strings", "=", "self", ".", "data", ".", "get", "(", "field", ")", "if", "strings", ":", "return", "strings", ".", "split", "(", "','", ")", "else"...
Return list of strings from comma separated list Args: field (str): Field containing comma separated list Returns: List[str]: List of strings
[ "Return", "list", "of", "strings", "from", "comma", "separated", "list" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L533-L547
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._add_string_to_commastring
def _add_string_to_commastring(self, field, string): # type: (str, str) -> bool """Add a string to a comma separated list of strings Args: field (str): Field containing comma separated list string (str): String to add Returns: bool: True if string ad...
python
def _add_string_to_commastring(self, field, string): # type: (str, str) -> bool """Add a string to a comma separated list of strings Args: field (str): Field containing comma separated list string (str): String to add Returns: bool: True if string ad...
[ "def", "_add_string_to_commastring", "(", "self", ",", "field", ",", "string", ")", ":", "# type: (str, str) -> bool", "if", "string", "in", "self", ".", "_get_stringlist_from_commastring", "(", "field", ")", ":", "return", "False", "strings", "=", "'%s,%s'", "%",...
Add a string to a comma separated list of strings Args: field (str): Field containing comma separated list string (str): String to add Returns: bool: True if string added or False if string already present
[ "Add", "a", "string", "to", "a", "comma", "separated", "list", "of", "strings" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L549-L566
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._add_strings_to_commastring
def _add_strings_to_commastring(self, field, strings): # type: (str, List[str]) -> bool """Add a list of strings to a comma separated list of strings Args: field (str): Field containing comma separated list strings (List[str]): list of strings to add Returns: ...
python
def _add_strings_to_commastring(self, field, strings): # type: (str, List[str]) -> bool """Add a list of strings to a comma separated list of strings Args: field (str): Field containing comma separated list strings (List[str]): list of strings to add Returns: ...
[ "def", "_add_strings_to_commastring", "(", "self", ",", "field", ",", "strings", ")", ":", "# type: (str, List[str]) -> bool", "allstringsadded", "=", "True", "for", "string", "in", "strings", ":", "if", "not", "self", ".", "_add_string_to_commastring", "(", "field"...
Add a list of strings to a comma separated list of strings Args: field (str): Field containing comma separated list strings (List[str]): list of strings to add Returns: bool: True if all strings added or False if any already present.
[ "Add", "a", "list", "of", "strings", "to", "a", "comma", "separated", "list", "of", "strings" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L568-L583
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._remove_string_from_commastring
def _remove_string_from_commastring(self, field, string): # type: (str, str) -> bool """Remove a string from a comma separated list of strings Args: field (str): Field containing comma separated list string (str): String to remove Returns: bool: True...
python
def _remove_string_from_commastring(self, field, string): # type: (str, str) -> bool """Remove a string from a comma separated list of strings Args: field (str): Field containing comma separated list string (str): String to remove Returns: bool: True...
[ "def", "_remove_string_from_commastring", "(", "self", ",", "field", ",", "string", ")", ":", "# type: (str, str) -> bool", "commastring", "=", "self", ".", "data", ".", "get", "(", "field", ",", "''", ")", "if", "string", "in", "commastring", ":", "self", "...
Remove a string from a comma separated list of strings Args: field (str): Field containing comma separated list string (str): String to remove Returns: bool: True if string removed or False if not
[ "Remove", "a", "string", "from", "a", "comma", "separated", "list", "of", "strings" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L585-L600
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.read_from_hdx
def read_from_hdx(identifier, configuration=None): # type: (str, Optional[Configuration]) -> Optional['Resource'] """Reads the resource given by identifier from HDX and returns Resource object Args: identifier (str): Identifier of resource configuration (Optional[Configu...
python
def read_from_hdx(identifier, configuration=None): # type: (str, Optional[Configuration]) -> Optional['Resource'] """Reads the resource given by identifier from HDX and returns Resource object Args: identifier (str): Identifier of resource configuration (Optional[Configu...
[ "def", "read_from_hdx", "(", "identifier", ",", "configuration", "=", "None", ")", ":", "# type: (str, Optional[Configuration]) -> Optional['Resource']", "if", "is_valid_uuid", "(", "identifier", ")", "is", "False", ":", "raise", "HDXError", "(", "'%s is not a valid resou...
Reads the resource given by identifier from HDX and returns Resource object Args: identifier (str): Identifier of resource configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration. Returns: Optional[Resource]: Resource object if s...
[ "Reads", "the", "resource", "given", "by", "identifier", "from", "HDX", "and", "returns", "Resource", "object" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L83-L101
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.set_file_to_upload
def set_file_to_upload(self, file_to_upload): # type: (str) -> None """Delete any existing url and set the file uploaded to the local path provided Args: file_to_upload (str): Local path to file to upload Returns: None """ if 'url' in self.data: ...
python
def set_file_to_upload(self, file_to_upload): # type: (str) -> None """Delete any existing url and set the file uploaded to the local path provided Args: file_to_upload (str): Local path to file to upload Returns: None """ if 'url' in self.data: ...
[ "def", "set_file_to_upload", "(", "self", ",", "file_to_upload", ")", ":", "# type: (str) -> None", "if", "'url'", "in", "self", ".", "data", ":", "del", "self", ".", "data", "[", "'url'", "]", "self", ".", "file_to_upload", "=", "file_to_upload" ]
Delete any existing url and set the file uploaded to the local path provided Args: file_to_upload (str): Local path to file to upload Returns: None
[ "Delete", "any", "existing", "url", "and", "set", "the", "file", "uploaded", "to", "the", "local", "path", "provided" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L133-L145
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.check_url_filetoupload
def check_url_filetoupload(self): # type: () -> None """Check if url or file to upload provided for resource and add resource_type and url_type if not supplied Returns: None """ if self.file_to_upload is None: if 'url' in self.data: if 're...
python
def check_url_filetoupload(self): # type: () -> None """Check if url or file to upload provided for resource and add resource_type and url_type if not supplied Returns: None """ if self.file_to_upload is None: if 'url' in self.data: if 're...
[ "def", "check_url_filetoupload", "(", "self", ")", ":", "# type: () -> None", "if", "self", ".", "file_to_upload", "is", "None", ":", "if", "'url'", "in", "self", ".", "data", ":", "if", "'resource_type'", "not", "in", "self", ".", "data", ":", "self", "."...
Check if url or file to upload provided for resource and add resource_type and url_type if not supplied Returns: None
[ "Check", "if", "url", "or", "file", "to", "upload", "provided", "for", "resource", "and", "add", "resource_type", "and", "url_type", "if", "not", "supplied" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L147-L171
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.update_in_hdx
def update_in_hdx(self, **kwargs): # type: (Any) -> None """Check if resource exists in HDX and if so, update it Args: **kwargs: See below operation (string): Operation to perform eg. patch. Defaults to update. Returns: None """ self....
python
def update_in_hdx(self, **kwargs): # type: (Any) -> None """Check if resource exists in HDX and if so, update it Args: **kwargs: See below operation (string): Operation to perform eg. patch. Defaults to update. Returns: None """ self....
[ "def", "update_in_hdx", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# type: (Any) -> None", "self", ".", "_check_load_existing_object", "(", "'resource'", ",", "'id'", ")", "if", "self", ".", "file_to_upload", "and", "'url'", "in", "self", ".", "data", ...
Check if resource exists in HDX and if so, update it Args: **kwargs: See below operation (string): Operation to perform eg. patch. Defaults to update. Returns: None
[ "Check", "if", "resource", "exists", "in", "HDX", "and", "if", "so", "update", "it" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L187-L201
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.create_in_hdx
def create_in_hdx(self): # type: () -> None """Check if resource exists in HDX and if so, update it, otherwise create it Returns: None """ self.check_required_fields() id = self.data.get('id') if id and self._load_from_hdx('resource', id): ...
python
def create_in_hdx(self): # type: () -> None """Check if resource exists in HDX and if so, update it, otherwise create it Returns: None """ self.check_required_fields() id = self.data.get('id') if id and self._load_from_hdx('resource', id): ...
[ "def", "create_in_hdx", "(", "self", ")", ":", "# type: () -> None", "self", ".", "check_required_fields", "(", ")", "id", "=", "self", ".", "data", ".", "get", "(", "'id'", ")", "if", "id", "and", "self", ".", "_load_from_hdx", "(", "'resource'", ",", "...
Check if resource exists in HDX and if so, update it, otherwise create it Returns: None
[ "Check", "if", "resource", "exists", "in", "HDX", "and", "if", "so", "update", "it", "otherwise", "create", "it" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L203-L218
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.get_dataset
def get_dataset(self): # type: () -> hdx.data.dataset.Dataset """Return dataset containing this resource Returns: hdx.data.dataset.Dataset: Dataset containing this resource """ package_id = self.data.get('package_id') if package_id is None: raise ...
python
def get_dataset(self): # type: () -> hdx.data.dataset.Dataset """Return dataset containing this resource Returns: hdx.data.dataset.Dataset: Dataset containing this resource """ package_id = self.data.get('package_id') if package_id is None: raise ...
[ "def", "get_dataset", "(", "self", ")", ":", "# type: () -> hdx.data.dataset.Dataset", "package_id", "=", "self", ".", "data", ".", "get", "(", "'package_id'", ")", "if", "package_id", "is", "None", ":", "raise", "HDXError", "(", "'Resource has no package id!'", "...
Return dataset containing this resource Returns: hdx.data.dataset.Dataset: Dataset containing this resource
[ "Return", "dataset", "containing", "this", "resource" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L229-L239
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.search_in_hdx
def search_in_hdx(query, configuration=None, **kwargs): # type: (str, Optional[Configuration], Any) -> List['Resource'] """Searches for resources in HDX. NOTE: Does not search dataset metadata! Args: query (str): Query configuration (Optional[Configuration]): HDX configu...
python
def search_in_hdx(query, configuration=None, **kwargs): # type: (str, Optional[Configuration], Any) -> List['Resource'] """Searches for resources in HDX. NOTE: Does not search dataset metadata! Args: query (str): Query configuration (Optional[Configuration]): HDX configu...
[ "def", "search_in_hdx", "(", "query", ",", "configuration", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# type: (str, Optional[Configuration], Any) -> List['Resource']", "resources", "=", "[", "]", "resource", "=", "Resource", "(", "configuration", "=", "config...
Searches for resources in HDX. NOTE: Does not search dataset metadata! Args: query (str): Query configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration. **kwargs: See below order_by (str): A field on the Resource model that or...
[ "Searches", "for", "resources", "in", "HDX", ".", "NOTE", ":", "Does", "not", "search", "dataset", "metadata!" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L242-L268
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.download
def download(self, folder=None): # type: (Optional[str]) -> Tuple[str, str] """Download resource store to provided folder or temporary folder if no folder supplied Args: folder (Optional[str]): Folder to download resource to. Defaults to None. Returns: Tuple[str...
python
def download(self, folder=None): # type: (Optional[str]) -> Tuple[str, str] """Download resource store to provided folder or temporary folder if no folder supplied Args: folder (Optional[str]): Folder to download resource to. Defaults to None. Returns: Tuple[str...
[ "def", "download", "(", "self", ",", "folder", "=", "None", ")", ":", "# type: (Optional[str]) -> Tuple[str, str]", "# Download the resource", "url", "=", "self", ".", "data", ".", "get", "(", "'url'", ",", "None", ")", "if", "not", "url", ":", "raise", "HDX...
Download resource store to provided folder or temporary folder if no folder supplied Args: folder (Optional[str]): Folder to download resource to. Defaults to None. Returns: Tuple[str, str]: (URL downloaded, Path to downloaded file)
[ "Download", "resource", "store", "to", "provided", "folder", "or", "temporary", "folder", "if", "no", "folder", "supplied" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L270-L292
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.get_all_resource_ids_in_datastore
def get_all_resource_ids_in_datastore(configuration=None): # type: (Optional[Configuration]) -> List[str] """Get list of resources that have a datastore returning their ids. Args: configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration. ...
python
def get_all_resource_ids_in_datastore(configuration=None): # type: (Optional[Configuration]) -> List[str] """Get list of resources that have a datastore returning their ids. Args: configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration. ...
[ "def", "get_all_resource_ids_in_datastore", "(", "configuration", "=", "None", ")", ":", "# type: (Optional[Configuration]) -> List[str]", "resource", "=", "Resource", "(", "configuration", "=", "configuration", ")", "success", ",", "result", "=", "resource", ".", "_rea...
Get list of resources that have a datastore returning their ids. Args: configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration. Returns: List[str]: List of resource ids that are in the datastore
[ "Get", "list", "of", "resources", "that", "have", "a", "datastore", "returning", "their", "ids", "." ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L295-L314
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.has_datastore
def has_datastore(self): # type: () -> bool """Check if the resource has a datastore. Returns: bool: Whether the resource has a datastore or not """ success, result = self._read_from_hdx('datastore', self.data['id'], 'resource_id', ...
python
def has_datastore(self): # type: () -> bool """Check if the resource has a datastore. Returns: bool: Whether the resource has a datastore or not """ success, result = self._read_from_hdx('datastore', self.data['id'], 'resource_id', ...
[ "def", "has_datastore", "(", "self", ")", ":", "# type: () -> bool", "success", ",", "result", "=", "self", ".", "_read_from_hdx", "(", "'datastore'", ",", "self", ".", "data", "[", "'id'", "]", ",", "'resource_id'", ",", "self", ".", "actions", "(", ")", ...
Check if the resource has a datastore. Returns: bool: Whether the resource has a datastore or not
[ "Check", "if", "the", "resource", "has", "a", "datastore", "." ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L316-L330
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.delete_datastore
def delete_datastore(self): # type: () -> None """Delete a resource from the HDX datastore Returns: None """ success, result = self._read_from_hdx('datastore', self.data['id'], 'resource_id', self.actions()['datastore_del...
python
def delete_datastore(self): # type: () -> None """Delete a resource from the HDX datastore Returns: None """ success, result = self._read_from_hdx('datastore', self.data['id'], 'resource_id', self.actions()['datastore_del...
[ "def", "delete_datastore", "(", "self", ")", ":", "# type: () -> None", "success", ",", "result", "=", "self", ".", "_read_from_hdx", "(", "'datastore'", ",", "self", ".", "data", "[", "'id'", "]", ",", "'resource_id'", ",", "self", ".", "actions", "(", ")...
Delete a resource from the HDX datastore Returns: None
[ "Delete", "a", "resource", "from", "the", "HDX", "datastore" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L332-L343
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.create_datastore
def create_datastore(self, schema=None, primary_key=None, delete_first=0, path=None): # type: (Optional[List[Dict]], Optional[str], int, Optional[str]) -> None """For tabular data, create a resource in the HDX datastore which enables data preview in HDX. If no schema is provided...
python
def create_datastore(self, schema=None, primary_key=None, delete_first=0, path=None): # type: (Optional[List[Dict]], Optional[str], int, Optional[str]) -> None """For tabular data, create a resource in the HDX datastore which enables data preview in HDX. If no schema is provided...
[ "def", "create_datastore", "(", "self", ",", "schema", "=", "None", ",", "primary_key", "=", "None", ",", "delete_first", "=", "0", ",", "path", "=", "None", ")", ":", "# type: (Optional[List[Dict]], Optional[str], int, Optional[str]) -> None", "if", "delete_first", ...
For tabular data, create a resource in the HDX datastore which enables data preview in HDX. If no schema is provided all fields are assumed to be text. If path is not supplied, the file is first downloaded from HDX. Args: schema (List[Dict]): List of fields and types of form {'id': 'FIELD',...
[ "For", "tabular", "data", "create", "a", "resource", "in", "the", "HDX", "datastore", "which", "enables", "data", "preview", "in", "HDX", ".", "If", "no", "schema", "is", "provided", "all", "fields", "are", "assumed", "to", "be", "text", ".", "If", "path...
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L345-L418
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.create_datastore_from_dict_schema
def create_datastore_from_dict_schema(self, data, delete_first=0, path=None): # type: (dict, int, Optional[str]) -> None """For tabular data, create a resource in the HDX datastore which enables data preview in HDX from a dictionary containing a list of fields and types of form {'id': 'FIELD', '...
python
def create_datastore_from_dict_schema(self, data, delete_first=0, path=None): # type: (dict, int, Optional[str]) -> None """For tabular data, create a resource in the HDX datastore which enables data preview in HDX from a dictionary containing a list of fields and types of form {'id': 'FIELD', '...
[ "def", "create_datastore_from_dict_schema", "(", "self", ",", "data", ",", "delete_first", "=", "0", ",", "path", "=", "None", ")", ":", "# type: (dict, int, Optional[str]) -> None", "schema", "=", "data", "[", "'schema'", "]", "primary_key", "=", "data", ".", "...
For tabular data, create a resource in the HDX datastore which enables data preview in HDX from a dictionary containing a list of fields and types of form {'id': 'FIELD', 'type': 'TYPE'} and optionally a primary key. If path is not supplied, the file is first downloaded from HDX. Args: ...
[ "For", "tabular", "data", "create", "a", "resource", "in", "the", "HDX", "datastore", "which", "enables", "data", "preview", "in", "HDX", "from", "a", "dictionary", "containing", "a", "list", "of", "fields", "and", "types", "of", "form", "{", "id", ":", ...
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L420-L436
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.create_datastore_from_yaml_schema
def create_datastore_from_yaml_schema(self, yaml_path, delete_first=0, path=None): # type: (str, Optional[int], Optional[str]) -> None """For tabular data, create a resource in the HDX datastore which enables data preview in HDX from a YAML file containi...
python
def create_datastore_from_yaml_schema(self, yaml_path, delete_first=0, path=None): # type: (str, Optional[int], Optional[str]) -> None """For tabular data, create a resource in the HDX datastore which enables data preview in HDX from a YAML file containi...
[ "def", "create_datastore_from_yaml_schema", "(", "self", ",", "yaml_path", ",", "delete_first", "=", "0", ",", "path", "=", "None", ")", ":", "# type: (str, Optional[int], Optional[str]) -> None", "data", "=", "load_yaml", "(", "yaml_path", ")", "self", ".", "create...
For tabular data, create a resource in the HDX datastore which enables data preview in HDX from a YAML file containing a list of fields and types of form {'id': 'FIELD', 'type': 'TYPE'} and optionally a primary key. If path is not supplied, the file is first downloaded from HDX. Args: ...
[ "For", "tabular", "data", "create", "a", "resource", "in", "the", "HDX", "datastore", "which", "enables", "data", "preview", "in", "HDX", "from", "a", "YAML", "file", "containing", "a", "list", "of", "fields", "and", "types", "of", "form", "{", "id", ":"...
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L438-L454
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.create_datastore_from_json_schema
def create_datastore_from_json_schema(self, json_path, delete_first=0, path=None): # type: (str, int, Optional[str]) -> None """For tabular data, create a resource in the HDX datastore which enables data preview in HDX from a JSON file containing a list of fields and types of form {'id': 'FIELD'...
python
def create_datastore_from_json_schema(self, json_path, delete_first=0, path=None): # type: (str, int, Optional[str]) -> None """For tabular data, create a resource in the HDX datastore which enables data preview in HDX from a JSON file containing a list of fields and types of form {'id': 'FIELD'...
[ "def", "create_datastore_from_json_schema", "(", "self", ",", "json_path", ",", "delete_first", "=", "0", ",", "path", "=", "None", ")", ":", "# type: (str, int, Optional[str]) -> None", "data", "=", "load_json", "(", "json_path", ")", "self", ".", "create_datastore...
For tabular data, create a resource in the HDX datastore which enables data preview in HDX from a JSON file containing a list of fields and types of form {'id': 'FIELD', 'type': 'TYPE'} and optionally a primary key. If path is not supplied, the file is first downloaded from HDX. Args: ...
[ "For", "tabular", "data", "create", "a", "resource", "in", "the", "HDX", "datastore", "which", "enables", "data", "preview", "in", "HDX", "from", "a", "JSON", "file", "containing", "a", "list", "of", "fields", "and", "types", "of", "form", "{", "id", ":"...
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L456-L471
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.create_datastore_for_topline
def create_datastore_for_topline(self, delete_first=0, path=None): # type: (int, Optional[str]) -> None """For tabular data, create a resource in the HDX datastore which enables data preview in HDX using the built in YAML definition for a topline. If path is not supplied, the file is first downl...
python
def create_datastore_for_topline(self, delete_first=0, path=None): # type: (int, Optional[str]) -> None """For tabular data, create a resource in the HDX datastore which enables data preview in HDX using the built in YAML definition for a topline. If path is not supplied, the file is first downl...
[ "def", "create_datastore_for_topline", "(", "self", ",", "delete_first", "=", "0", ",", "path", "=", "None", ")", ":", "# type: (int, Optional[str]) -> None", "data", "=", "load_yaml", "(", "script_dir_plus_file", "(", "join", "(", "'..'", ",", "'hdx_datasource_topl...
For tabular data, create a resource in the HDX datastore which enables data preview in HDX using the built in YAML definition for a topline. If path is not supplied, the file is first downloaded from HDX. Args: delete_first (int): Delete datastore before creation. 0 = No, 1 = Yes, 2 = If no...
[ "For", "tabular", "data", "create", "a", "resource", "in", "the", "HDX", "datastore", "which", "enables", "data", "preview", "in", "HDX", "using", "the", "built", "in", "YAML", "definition", "for", "a", "topline", ".", "If", "path", "is", "not", "supplied"...
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L473-L486
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.update_datastore
def update_datastore(self, schema=None, primary_key=None, path=None): # type: (Optional[List[Dict]], Optional[str], Optional[str]) -> None """For tabular data, update a resource in the HDX datastore which enables data preview in HDX. If no schema is provided all fields a...
python
def update_datastore(self, schema=None, primary_key=None, path=None): # type: (Optional[List[Dict]], Optional[str], Optional[str]) -> None """For tabular data, update a resource in the HDX datastore which enables data preview in HDX. If no schema is provided all fields a...
[ "def", "update_datastore", "(", "self", ",", "schema", "=", "None", ",", "primary_key", "=", "None", ",", "path", "=", "None", ")", ":", "# type: (Optional[List[Dict]], Optional[str], Optional[str]) -> None", "self", ".", "create_datastore", "(", "schema", ",", "pri...
For tabular data, update a resource in the HDX datastore which enables data preview in HDX. If no schema is provided all fields are assumed to be text. If path is not supplied, the file is first downloaded from HDX. Args: schema (List[Dict]): List of fields and types of form {'id': 'FIELD',...
[ "For", "tabular", "data", "update", "a", "resource", "in", "the", "HDX", "datastore", "which", "enables", "data", "preview", "in", "HDX", ".", "If", "no", "schema", "is", "provided", "all", "fields", "are", "assumed", "to", "be", "text", ".", "If", "path...
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L488-L502
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource._get_resource_view
def _get_resource_view(self, resource_view): # type: (Union[ResourceView,Dict]) -> ResourceView """Get resource view id Args: resource_view (Union[ResourceView,Dict]): ResourceView metadata from a ResourceView object or dictionary Returns: ResourceView: Resource...
python
def _get_resource_view(self, resource_view): # type: (Union[ResourceView,Dict]) -> ResourceView """Get resource view id Args: resource_view (Union[ResourceView,Dict]): ResourceView metadata from a ResourceView object or dictionary Returns: ResourceView: Resource...
[ "def", "_get_resource_view", "(", "self", ",", "resource_view", ")", ":", "# type: (Union[ResourceView,Dict]) -> ResourceView", "if", "isinstance", "(", "resource_view", ",", "dict", ")", ":", "resource_view", "=", "ResourceView", "(", "resource_view", ",", "configurati...
Get resource view id Args: resource_view (Union[ResourceView,Dict]): ResourceView metadata from a ResourceView object or dictionary Returns: ResourceView: ResourceView object
[ "Get", "resource", "view", "id" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L571-L585
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.add_update_resource_views
def add_update_resource_views(self, resource_views): # type: (List[Union[ResourceView,Dict]]) -> None """Add new or update existing resource views in resource with new metadata. Args: resource_views (List[Union[ResourceView,Dict]]): A list of resource views metadata from ResourceVie...
python
def add_update_resource_views(self, resource_views): # type: (List[Union[ResourceView,Dict]]) -> None """Add new or update existing resource views in resource with new metadata. Args: resource_views (List[Union[ResourceView,Dict]]): A list of resource views metadata from ResourceVie...
[ "def", "add_update_resource_views", "(", "self", ",", "resource_views", ")", ":", "# type: (List[Union[ResourceView,Dict]]) -> None", "if", "not", "isinstance", "(", "resource_views", ",", "list", ")", ":", "raise", "HDXError", "(", "'ResourceViews should be a list!'", ")...
Add new or update existing resource views in resource with new metadata. Args: resource_views (List[Union[ResourceView,Dict]]): A list of resource views metadata from ResourceView objects or dictionaries Returns: None
[ "Add", "new", "or", "update", "existing", "resource", "views", "in", "resource", "with", "new", "metadata", "." ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L601-L614
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.reorder_resource_views
def reorder_resource_views(self, resource_views): # type: (List[Union[ResourceView,Dict,str]]) -> None """Order resource views in resource. Args: resource_views (List[Union[ResourceView,Dict,str]]): A list of either resource view ids or resource views metadata from ResourceView obje...
python
def reorder_resource_views(self, resource_views): # type: (List[Union[ResourceView,Dict,str]]) -> None """Order resource views in resource. Args: resource_views (List[Union[ResourceView,Dict,str]]): A list of either resource view ids or resource views metadata from ResourceView obje...
[ "def", "reorder_resource_views", "(", "self", ",", "resource_views", ")", ":", "# type: (List[Union[ResourceView,Dict,str]]) -> None", "if", "not", "isinstance", "(", "resource_views", ",", "list", ")", ":", "raise", "HDXError", "(", "'ResourceViews should be a list!'", "...
Order resource views in resource. Args: resource_views (List[Union[ResourceView,Dict,str]]): A list of either resource view ids or resource views metadata from ResourceView objects or dictionaries Returns: None
[ "Order", "resource", "views", "in", "resource", "." ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L616-L638
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
Resource.delete_resource_view
def delete_resource_view(self, resource_view): # type: (Union[ResourceView,Dict,str]) -> None """Delete a resource view from the resource and HDX Args: resource_view (Union[ResourceView,Dict,str]): Either a resource view id or resource view metadata either from a ResourceView object...
python
def delete_resource_view(self, resource_view): # type: (Union[ResourceView,Dict,str]) -> None """Delete a resource view from the resource and HDX Args: resource_view (Union[ResourceView,Dict,str]): Either a resource view id or resource view metadata either from a ResourceView object...
[ "def", "delete_resource_view", "(", "self", ",", "resource_view", ")", ":", "# type: (Union[ResourceView,Dict,str]) -> None", "if", "isinstance", "(", "resource_view", ",", "str", ")", ":", "if", "is_valid_uuid", "(", "resource_view", ")", "is", "False", ":", "raise...
Delete a resource view from the resource and HDX Args: resource_view (Union[ResourceView,Dict,str]): Either a resource view id or resource view metadata either from a ResourceView object or a dictionary Returns: None
[ "Delete", "a", "resource", "view", "from", "the", "resource", "and", "HDX" ]
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L640-L666
dmirecki/pyMorfologik
pymorfologik/output_parser.py
parse_for_simple_stems
def parse_for_simple_stems(output, skip_empty=False, skip_same_stems=True): """ Parses the output stem lines to produce a list with possible stems for each word in the output. :param skip_empty: set True to skip lines without stems (default is False) :returns: a list of tuples, each containing an o...
python
def parse_for_simple_stems(output, skip_empty=False, skip_same_stems=True): """ Parses the output stem lines to produce a list with possible stems for each word in the output. :param skip_empty: set True to skip lines without stems (default is False) :returns: a list of tuples, each containing an o...
[ "def", "parse_for_simple_stems", "(", "output", ",", "skip_empty", "=", "False", ",", "skip_same_stems", "=", "True", ")", ":", "lines_with_stems", "=", "_get_lines_with_stems", "(", "output", ")", "stems", "=", "list", "(", ")", "last_word", "=", "None", "for...
Parses the output stem lines to produce a list with possible stems for each word in the output. :param skip_empty: set True to skip lines without stems (default is False) :returns: a list of tuples, each containing an original text word and a list of stems for the given word
[ "Parses", "the", "output", "stem", "lines", "to", "produce", "a", "list", "with", "possible", "stems", "for", "each", "word", "in", "the", "output", "." ]
train
https://github.com/dmirecki/pyMorfologik/blob/e4d93a82e8b4c7a108f01e0456fbeb8024df0259/pymorfologik/output_parser.py#L19-L49
libyal/dtfabric
dtfabric/runtime/runtime.py
StructureValuesClassFactory._CreateClassTemplate
def _CreateClassTemplate(cls, data_type_definition): """Creates the class template. Args: data_type_definition (DataTypeDefinition): data type definition. Returns: str: class template. """ type_name = data_type_definition.name type_description = data_type_definition.description or...
python
def _CreateClassTemplate(cls, data_type_definition): """Creates the class template. Args: data_type_definition (DataTypeDefinition): data type definition. Returns: str: class template. """ type_name = data_type_definition.name type_description = data_type_definition.description or...
[ "def", "_CreateClassTemplate", "(", "cls", ",", "data_type_definition", ")", ":", "type_name", "=", "data_type_definition", ".", "name", "type_description", "=", "data_type_definition", ".", "description", "or", "type_name", "while", "type_description", ".", "endswith",...
Creates the class template. Args: data_type_definition (DataTypeDefinition): data type definition. Returns: str: class template.
[ "Creates", "the", "class", "template", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/runtime.py#L45-L106
libyal/dtfabric
dtfabric/runtime/runtime.py
StructureValuesClassFactory._IsIdentifier
def _IsIdentifier(cls, string): """Checks if a string contains an identifier. Args: string (str): string to check. Returns: bool: True if the string contains an identifier, False otherwise. """ return ( string and not string[0].isdigit() and all(character.isalnum() or c...
python
def _IsIdentifier(cls, string): """Checks if a string contains an identifier. Args: string (str): string to check. Returns: bool: True if the string contains an identifier, False otherwise. """ return ( string and not string[0].isdigit() and all(character.isalnum() or c...
[ "def", "_IsIdentifier", "(", "cls", ",", "string", ")", ":", "return", "(", "string", "and", "not", "string", "[", "0", "]", ".", "isdigit", "(", ")", "and", "all", "(", "character", ".", "isalnum", "(", ")", "or", "character", "==", "'_'", "for", ...
Checks if a string contains an identifier. Args: string (str): string to check. Returns: bool: True if the string contains an identifier, False otherwise.
[ "Checks", "if", "a", "string", "contains", "an", "identifier", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/runtime.py#L109-L120
libyal/dtfabric
dtfabric/runtime/runtime.py
StructureValuesClassFactory._ValidateDataTypeDefinition
def _ValidateDataTypeDefinition(cls, data_type_definition): """Validates the data type definition. Args: data_type_definition (DataTypeDefinition): data type definition. Raises: ValueError: if the data type definition is not considered valid. """ if not cls._IsIdentifier(data_type_defi...
python
def _ValidateDataTypeDefinition(cls, data_type_definition): """Validates the data type definition. Args: data_type_definition (DataTypeDefinition): data type definition. Raises: ValueError: if the data type definition is not considered valid. """ if not cls._IsIdentifier(data_type_defi...
[ "def", "_ValidateDataTypeDefinition", "(", "cls", ",", "data_type_definition", ")", ":", "if", "not", "cls", ".", "_IsIdentifier", "(", "data_type_definition", ".", "name", ")", ":", "raise", "ValueError", "(", "'Data type definition name: {0!s} not a valid identifier'", ...
Validates the data type definition. Args: data_type_definition (DataTypeDefinition): data type definition. Raises: ValueError: if the data type definition is not considered valid.
[ "Validates", "the", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/runtime.py#L123-L169
libyal/dtfabric
dtfabric/runtime/runtime.py
StructureValuesClassFactory.CreateClass
def CreateClass(cls, data_type_definition): """Creates a new structure values class. Args: data_type_definition (DataTypeDefinition): data type definition. Returns: class: structure values class. """ cls._ValidateDataTypeDefinition(data_type_definition) class_definition = cls._Cre...
python
def CreateClass(cls, data_type_definition): """Creates a new structure values class. Args: data_type_definition (DataTypeDefinition): data type definition. Returns: class: structure values class. """ cls._ValidateDataTypeDefinition(data_type_definition) class_definition = cls._Cre...
[ "def", "CreateClass", "(", "cls", ",", "data_type_definition", ")", ":", "cls", ".", "_ValidateDataTypeDefinition", "(", "data_type_definition", ")", "class_definition", "=", "cls", ".", "_CreateClassTemplate", "(", "data_type_definition", ")", "namespace", "=", "{", ...
Creates a new structure values class. Args: data_type_definition (DataTypeDefinition): data type definition. Returns: class: structure values class.
[ "Creates", "a", "new", "structure", "values", "class", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/runtime.py#L172-L197
libyal/dtfabric
dtfabric/registry.py
DataTypeDefinitionsRegistry.DeregisterDefinition
def DeregisterDefinition(self, data_type_definition): """Deregisters a data type definition. The data type definitions are identified based on their lower case name. Args: data_type_definition (DataTypeDefinition): data type definition. Raises: KeyError: if a data type definition is not s...
python
def DeregisterDefinition(self, data_type_definition): """Deregisters a data type definition. The data type definitions are identified based on their lower case name. Args: data_type_definition (DataTypeDefinition): data type definition. Raises: KeyError: if a data type definition is not s...
[ "def", "DeregisterDefinition", "(", "self", ",", "data_type_definition", ")", ":", "name", "=", "data_type_definition", ".", "name", ".", "lower", "(", ")", "if", "name", "not", "in", "self", ".", "_definitions", ":", "raise", "KeyError", "(", "'Definition not...
Deregisters a data type definition. The data type definitions are identified based on their lower case name. Args: data_type_definition (DataTypeDefinition): data type definition. Raises: KeyError: if a data type definition is not set for the corresponding name.
[ "Deregisters", "a", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/registry.py#L19-L36
libyal/dtfabric
dtfabric/registry.py
DataTypeDefinitionsRegistry.GetDefinitionByName
def GetDefinitionByName(self, name): """Retrieves a specific data type definition by name. Args: name (str): name of the data type definition. Returns: DataTypeDefinition: data type definition or None if not available. """ lookup_name = name.lower() if lookup_name not in self._defi...
python
def GetDefinitionByName(self, name): """Retrieves a specific data type definition by name. Args: name (str): name of the data type definition. Returns: DataTypeDefinition: data type definition or None if not available. """ lookup_name = name.lower() if lookup_name not in self._defi...
[ "def", "GetDefinitionByName", "(", "self", ",", "name", ")", ":", "lookup_name", "=", "name", ".", "lower", "(", ")", "if", "lookup_name", "not", "in", "self", ".", "_definitions", ":", "lookup_name", "=", "self", ".", "_aliases", ".", "get", "(", "name"...
Retrieves a specific data type definition by name. Args: name (str): name of the data type definition. Returns: DataTypeDefinition: data type definition or None if not available.
[ "Retrieves", "a", "specific", "data", "type", "definition", "by", "name", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/registry.py#L38-L51
libyal/dtfabric
dtfabric/registry.py
DataTypeDefinitionsRegistry.RegisterDefinition
def RegisterDefinition(self, data_type_definition): """Registers a data type definition. The data type definitions are identified based on their lower case name. Args: data_type_definition (DataTypeDefinition): data type definitions. Raises: KeyError: if data type definition is already se...
python
def RegisterDefinition(self, data_type_definition): """Registers a data type definition. The data type definitions are identified based on their lower case name. Args: data_type_definition (DataTypeDefinition): data type definitions. Raises: KeyError: if data type definition is already se...
[ "def", "RegisterDefinition", "(", "self", ",", "data_type_definition", ")", ":", "name_lower", "=", "data_type_definition", ".", "name", ".", "lower", "(", ")", "if", "name_lower", "in", "self", ".", "_definitions", ":", "raise", "KeyError", "(", "'Definition al...
Registers a data type definition. The data type definitions are identified based on their lower case name. Args: data_type_definition (DataTypeDefinition): data type definitions. Raises: KeyError: if data type definition is already set for the corresponding name.
[ "Registers", "a", "data", "type", "definition", "." ]
train
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/registry.py#L61-L92
jorisroovers/pymarkdownlint
pymarkdownlint/config.py
LintConfig.apply_on_csv_string
def apply_on_csv_string(rules_str, func): """ Splits a given string by comma, trims whitespace on the resulting strings and applies a given ```func``` to each item. """ splitted = rules_str.split(",") for str in splitted: func(str.strip())
python
def apply_on_csv_string(rules_str, func): """ Splits a given string by comma, trims whitespace on the resulting strings and applies a given ```func``` to each item. """ splitted = rules_str.split(",") for str in splitted: func(str.strip())
[ "def", "apply_on_csv_string", "(", "rules_str", ",", "func", ")", ":", "splitted", "=", "rules_str", ".", "split", "(", "\",\"", ")", "for", "str", "in", "splitted", ":", "func", "(", "str", ".", "strip", "(", ")", ")" ]
Splits a given string by comma, trims whitespace on the resulting strings and applies a given ```func``` to each item.
[ "Splits", "a", "given", "string", "by", "comma", "trims", "whitespace", "on", "the", "resulting", "strings", "and", "applies", "a", "given", "func", "to", "each", "item", "." ]
train
https://github.com/jorisroovers/pymarkdownlint/blob/c1044e25e18afd78b3fda8fd9b00a4f67cfbbc65/pymarkdownlint/config.py#L41-L46