partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
record_move_fields
Move some fields to the position specified by 'field_position_local'. :param rec: a record structure as returned by create_record() :param tag: the tag of the fields to be moved :param field_positions_local: the positions of the fields to move :param field_position_local: insert the field before that ...
harvestingkit/bibrecord.py
def record_move_fields(rec, tag, field_positions_local, field_position_local=None): """ Move some fields to the position specified by 'field_position_local'. :param rec: a record structure as returned by create_record() :param tag: the tag of the fields to be moved :param fie...
def record_move_fields(rec, tag, field_positions_local, field_position_local=None): """ Move some fields to the position specified by 'field_position_local'. :param rec: a record structure as returned by create_record() :param tag: the tag of the fields to be moved :param fie...
[ "Move", "some", "fields", "to", "the", "position", "specified", "by", "field_position_local", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L761-L779
[ "def", "record_move_fields", "(", "rec", ",", "tag", ",", "field_positions_local", ",", "field_position_local", "=", "None", ")", ":", "fields", "=", "record_delete_fields", "(", "rec", ",", "tag", ",", "field_positions_local", "=", "field_positions_local", ")", "...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_delete_subfield
Delete all subfields with subfield_code in the record.
harvestingkit/bibrecord.py
def record_delete_subfield(rec, tag, subfield_code, ind1=' ', ind2=' '): """Delete all subfields with subfield_code in the record.""" ind1, ind2 = _wash_indicators(ind1, ind2) for field in rec.get(tag, []): if field[1] == ind1 and field[2] == ind2: field[0][:] = [subfield for subfield i...
def record_delete_subfield(rec, tag, subfield_code, ind1=' ', ind2=' '): """Delete all subfields with subfield_code in the record.""" ind1, ind2 = _wash_indicators(ind1, ind2) for field in rec.get(tag, []): if field[1] == ind1 and field[2] == ind2: field[0][:] = [subfield for subfield i...
[ "Delete", "all", "subfields", "with", "subfield_code", "in", "the", "record", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L782-L789
[ "def", "record_delete_subfield", "(", "rec", ",", "tag", ",", "subfield_code", ",", "ind1", "=", "' '", ",", "ind2", "=", "' '", ")", ":", "ind1", ",", "ind2", "=", "_wash_indicators", "(", "ind1", ",", "ind2", ")", "for", "field", "in", "rec", ".", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_get_field
Return the the matching field. One has to enter either a global field position or a local field position. :return: a list of subfield tuples (subfield code, value). :rtype: list
harvestingkit/bibrecord.py
def record_get_field(rec, tag, field_position_global=None, field_position_local=None): """ Return the the matching field. One has to enter either a global field position or a local field position. :return: a list of subfield tuples (subfield code, value). :rtype: list """ ...
def record_get_field(rec, tag, field_position_global=None, field_position_local=None): """ Return the the matching field. One has to enter either a global field position or a local field position. :return: a list of subfield tuples (subfield code, value). :rtype: list """ ...
[ "Return", "the", "the", "matching", "field", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L792-L829
[ "def", "record_get_field", "(", "rec", ",", "tag", ",", "field_position_global", "=", "None", ",", "field_position_local", "=", "None", ")", ":", "if", "field_position_global", "is", "None", "and", "field_position_local", "is", "None", ":", "raise", "InvenioBibRec...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_replace_field
Replace a field with a new field.
harvestingkit/bibrecord.py
def record_replace_field(rec, tag, new_field, field_position_global=None, field_position_local=None): """Replace a field with a new field.""" if field_position_global is None and field_position_local is None: raise InvenioBibRecordFieldError( "A field position is req...
def record_replace_field(rec, tag, new_field, field_position_global=None, field_position_local=None): """Replace a field with a new field.""" if field_position_global is None and field_position_local is None: raise InvenioBibRecordFieldError( "A field position is req...
[ "Replace", "a", "field", "with", "a", "new", "field", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L832-L867
[ "def", "record_replace_field", "(", "rec", ",", "tag", ",", "new_field", ",", "field_position_global", "=", "None", ",", "field_position_local", "=", "None", ")", ":", "if", "field_position_global", "is", "None", "and", "field_position_local", "is", "None", ":", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_get_subfields
Return the subfield of the matching field. One has to enter either a global field position or a local field position. :return: a list of subfield tuples (subfield code, value). :rtype: list
harvestingkit/bibrecord.py
def record_get_subfields(rec, tag, field_position_global=None, field_position_local=None): """ Return the subfield of the matching field. One has to enter either a global field position or a local field position. :return: a list of subfield tuples (subfield code, value). :...
def record_get_subfields(rec, tag, field_position_global=None, field_position_local=None): """ Return the subfield of the matching field. One has to enter either a global field position or a local field position. :return: a list of subfield tuples (subfield code, value). :...
[ "Return", "the", "subfield", "of", "the", "matching", "field", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L870-L885
[ "def", "record_get_subfields", "(", "rec", ",", "tag", ",", "field_position_global", "=", "None", ",", "field_position_local", "=", "None", ")", ":", "field", "=", "record_get_field", "(", "rec", ",", "tag", ",", "field_position_global", "=", "field_position_globa...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_delete_subfield_from
Delete subfield from position specified. Specify the subfield by tag, field number and subfield position.
harvestingkit/bibrecord.py
def record_delete_subfield_from(rec, tag, subfield_position, field_position_global=None, field_position_local=None): """ Delete subfield from position specified. Specify the subfield by tag, field number and subfield position. """ subf...
def record_delete_subfield_from(rec, tag, subfield_position, field_position_global=None, field_position_local=None): """ Delete subfield from position specified. Specify the subfield by tag, field number and subfield position. """ subf...
[ "Delete", "subfield", "from", "position", "specified", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L888-L922
[ "def", "record_delete_subfield_from", "(", "rec", ",", "tag", ",", "subfield_position", ",", "field_position_global", "=", "None", ",", "field_position_local", "=", "None", ")", ":", "subfields", "=", "record_get_subfields", "(", "rec", ",", "tag", ",", "field_pos...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_add_subfield_into
Add subfield into specified position. Specify the subfield by tag, field number and optionally by subfield position.
harvestingkit/bibrecord.py
def record_add_subfield_into(rec, tag, subfield_code, value, subfield_position=None, field_position_global=None, field_position_local=None): """Add subfield into specified position. Specify the subfield by tag, field number ...
def record_add_subfield_into(rec, tag, subfield_code, value, subfield_position=None, field_position_global=None, field_position_local=None): """Add subfield into specified position. Specify the subfield by tag, field number ...
[ "Add", "subfield", "into", "specified", "position", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L925-L942
[ "def", "record_add_subfield_into", "(", "rec", ",", "tag", ",", "subfield_code", ",", "value", ",", "subfield_position", "=", "None", ",", "field_position_global", "=", "None", ",", "field_position_local", "=", "None", ")", ":", "subfields", "=", "record_get_subfi...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_modify_controlfield
Modify controlfield at position specified by tag and field number.
harvestingkit/bibrecord.py
def record_modify_controlfield(rec, tag, controlfield_value, field_position_global=None, field_position_local=None): """Modify controlfield at position specified by tag and field number.""" field = record_get_field( rec, tag, field_po...
def record_modify_controlfield(rec, tag, controlfield_value, field_position_global=None, field_position_local=None): """Modify controlfield at position specified by tag and field number.""" field = record_get_field( rec, tag, field_po...
[ "Modify", "controlfield", "at", "position", "specified", "by", "tag", "and", "field", "number", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L945-L959
[ "def", "record_modify_controlfield", "(", "rec", ",", "tag", ",", "controlfield_value", ",", "field_position_global", "=", "None", ",", "field_position_local", "=", "None", ")", ":", "field", "=", "record_get_field", "(", "rec", ",", "tag", ",", "field_position_gl...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_modify_subfield
Modify subfield at specified position. Specify the subfield by tag, field number and subfield position.
harvestingkit/bibrecord.py
def record_modify_subfield(rec, tag, subfield_code, value, subfield_position, field_position_global=None, field_position_local=None): """Modify subfield at specified position. Specify the subfield by tag, field number and subfield position. """ subf...
def record_modify_subfield(rec, tag, subfield_code, value, subfield_position, field_position_global=None, field_position_local=None): """Modify subfield at specified position. Specify the subfield by tag, field number and subfield position. """ subf...
[ "Modify", "subfield", "at", "specified", "position", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L962-L978
[ "def", "record_modify_subfield", "(", "rec", ",", "tag", ",", "subfield_code", ",", "value", ",", "subfield_position", ",", "field_position_global", "=", "None", ",", "field_position_local", "=", "None", ")", ":", "subfields", "=", "record_get_subfields", "(", "re...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_move_subfield
Move subfield at specified position. Sspecify the subfield by tag, field number and subfield position to new subfield position.
harvestingkit/bibrecord.py
def record_move_subfield(rec, tag, subfield_position, new_subfield_position, field_position_global=None, field_position_local=None): """Move subfield at specified position. Sspecify the subfield by tag, field number and subfield position to new subfield pos...
def record_move_subfield(rec, tag, subfield_position, new_subfield_position, field_position_global=None, field_position_local=None): """Move subfield at specified position. Sspecify the subfield by tag, field number and subfield position to new subfield pos...
[ "Move", "subfield", "at", "specified", "position", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L981-L1000
[ "def", "record_move_subfield", "(", "rec", ",", "tag", ",", "subfield_position", ",", "new_subfield_position", ",", "field_position_global", "=", "None", ",", "field_position_local", "=", "None", ")", ":", "subfields", "=", "record_get_subfields", "(", "rec", ",", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_get_field_value
Return first (string) value that matches specified field of the record. Returns empty string if not found. Parameters (tag, ind1, ind2, code) can contain wildcard %. Difference between wildcard % and empty '': - Empty char specifies that we are not interested in a field which has one of the in...
harvestingkit/bibrecord.py
def record_get_field_value(rec, tag, ind1=" ", ind2=" ", code=""): """Return first (string) value that matches specified field of the record. Returns empty string if not found. Parameters (tag, ind1, ind2, code) can contain wildcard %. Difference between wildcard % and empty '': - Empty char spe...
def record_get_field_value(rec, tag, ind1=" ", ind2=" ", code=""): """Return first (string) value that matches specified field of the record. Returns empty string if not found. Parameters (tag, ind1, ind2, code) can contain wildcard %. Difference between wildcard % and empty '': - Empty char spe...
[ "Return", "first", "(", "string", ")", "value", "that", "matches", "specified", "field", "of", "the", "record", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1003-L1111
[ "def", "record_get_field_value", "(", "rec", ",", "tag", ",", "ind1", "=", "\" \"", ",", "ind2", "=", "\" \"", ",", "code", "=", "\"\"", ")", ":", "# Note: the code is quite redundant for speed reasons (avoid calling", "# functions or doing tests inside loops)", "ind1", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_get_field_values
Return the list of values for the specified field of the record. List can be filtered. Use filter_subfield_code and filter_subfield_value to search only in fields that have these values inside them as a subfield. filter_subfield_mode can have 3 different values: 'e' for exact search 's' for sub...
harvestingkit/bibrecord.py
def record_get_field_values(rec, tag, ind1=" ", ind2=" ", code="", filter_subfield_code="", filter_subfield_value="", filter_subfield_mode="e"): """Return the list of values for the specified field of the record. List can be fi...
def record_get_field_values(rec, tag, ind1=" ", ind2=" ", code="", filter_subfield_code="", filter_subfield_value="", filter_subfield_mode="e"): """Return the list of values for the specified field of the record. List can be fi...
[ "Return", "the", "list", "of", "values", "for", "the", "specified", "field", "of", "the", "record", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1114-L1216
[ "def", "record_get_field_values", "(", "rec", ",", "tag", ",", "ind1", "=", "\" \"", ",", "ind2", "=", "\" \"", ",", "code", "=", "\"\"", ",", "filter_subfield_code", "=", "\"\"", ",", "filter_subfield_value", "=", "\"\"", ",", "filter_subfield_mode", "=", "...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_xml_output
Generate the XML for record 'rec'. :param rec: record :param tags: list of tags to be printed :return: string
harvestingkit/bibrecord.py
def record_xml_output(rec, tags=None, order_fn=None): """Generate the XML for record 'rec'. :param rec: record :param tags: list of tags to be printed :return: string """ if tags is None: tags = [] if isinstance(tags, str): tags = [tags] if tags and '001' not in tags: ...
def record_xml_output(rec, tags=None, order_fn=None): """Generate the XML for record 'rec'. :param rec: record :param tags: list of tags to be printed :return: string """ if tags is None: tags = [] if isinstance(tags, str): tags = [tags] if tags and '001' not in tags: ...
[ "Generate", "the", "XML", "for", "record", "rec", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1219-L1250
[ "def", "record_xml_output", "(", "rec", ",", "tags", "=", "None", ",", "order_fn", "=", "None", ")", ":", "if", "tags", "is", "None", ":", "tags", "=", "[", "]", "if", "isinstance", "(", "tags", ",", "str", ")", ":", "tags", "=", "[", "tags", "]"...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
field_xml_output
Generate the XML for field 'field' and returns it as a string.
harvestingkit/bibrecord.py
def field_xml_output(field, tag): """Generate the XML for field 'field' and returns it as a string.""" marcxml = [] if field[3]: marcxml.append(' <controlfield tag="%s">%s</controlfield>' % (tag, MathMLParser.html_to_text(field[3]))) else: marcxml.append(' <dataf...
def field_xml_output(field, tag): """Generate the XML for field 'field' and returns it as a string.""" marcxml = [] if field[3]: marcxml.append(' <controlfield tag="%s">%s</controlfield>' % (tag, MathMLParser.html_to_text(field[3]))) else: marcxml.append(' <dataf...
[ "Generate", "the", "XML", "for", "field", "field", "and", "returns", "it", "as", "a", "string", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1281-L1292
[ "def", "field_xml_output", "(", "field", ",", "tag", ")", ":", "marcxml", "=", "[", "]", "if", "field", "[", "3", "]", ":", "marcxml", ".", "append", "(", "' <controlfield tag=\"%s\">%s</controlfield>'", "%", "(", "tag", ",", "MathMLParser", ".", "html_to_t...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_extract_dois
Return the DOI(s) of the record.
harvestingkit/bibrecord.py
def record_extract_dois(record): """Return the DOI(s) of the record.""" record_dois = [] tag = "024" ind1 = "7" ind2 = "_" subfield_source_code = "2" subfield_value_code = "a" identifiers_fields = record_get_field_instances(record, tag, ind1, ind2) for identifer_field in identifiers_...
def record_extract_dois(record): """Return the DOI(s) of the record.""" record_dois = [] tag = "024" ind1 = "7" ind2 = "_" subfield_source_code = "2" subfield_value_code = "a" identifiers_fields = record_get_field_instances(record, tag, ind1, ind2) for identifer_field in identifiers_...
[ "Return", "the", "DOI", "(", "s", ")", "of", "the", "record", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1295-L1312
[ "def", "record_extract_dois", "(", "record", ")", ":", "record_dois", "=", "[", "]", "tag", "=", "\"024\"", "ind1", "=", "\"7\"", "ind2", "=", "\"_\"", "subfield_source_code", "=", "\"2\"", "subfield_value_code", "=", "\"a\"", "identifiers_fields", "=", "record_...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
print_rec
Print a record. :param format: 1 XML, 2 HTML (not implemented) :param tags: list of tags to be printed
harvestingkit/bibrecord.py
def print_rec(rec, format=1, tags=None): """ Print a record. :param format: 1 XML, 2 HTML (not implemented) :param tags: list of tags to be printed """ if tags is None: tags = [] if format == 1: text = record_xml_output(rec, tags) else: return '' return text
def print_rec(rec, format=1, tags=None): """ Print a record. :param format: 1 XML, 2 HTML (not implemented) :param tags: list of tags to be printed """ if tags is None: tags = [] if format == 1: text = record_xml_output(rec, tags) else: return '' return text
[ "Print", "a", "record", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1315-L1329
[ "def", "print_rec", "(", "rec", ",", "format", "=", "1", ",", "tags", "=", "None", ")", ":", "if", "tags", "is", "None", ":", "tags", "=", "[", "]", "if", "format", "==", "1", ":", "text", "=", "record_xml_output", "(", "rec", ",", "tags", ")", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
print_recs
Print a list of records. :param format: 1 XML, 2 HTML (not implemented) :param tags: list of tags to be printed if 'listofrec' is not a list it returns empty string
harvestingkit/bibrecord.py
def print_recs(listofrec, format=1, tags=None): """ Print a list of records. :param format: 1 XML, 2 HTML (not implemented) :param tags: list of tags to be printed if 'listofrec' is not a list it returns empty string """ if tags is None: tags = [] text = "" if type(l...
def print_recs(listofrec, format=1, tags=None): """ Print a list of records. :param format: 1 XML, 2 HTML (not implemented) :param tags: list of tags to be printed if 'listofrec' is not a list it returns empty string """ if tags is None: tags = [] text = "" if type(l...
[ "Print", "a", "list", "of", "records", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1332-L1349
[ "def", "print_recs", "(", "listofrec", ",", "format", "=", "1", ",", "tags", "=", "None", ")", ":", "if", "tags", "is", "None", ":", "tags", "=", "[", "]", "text", "=", "\"\"", "if", "type", "(", "listofrec", ")", ".", "__name__", "!=", "'list'", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_find_field
Return the global and local positions of the first occurrence of the field. :param rec: A record dictionary structure :type rec: dictionary :param tag: The tag of the field to search for :type tag: string :param field: A field tuple as returned by create_field() :type field: tu...
harvestingkit/bibrecord.py
def record_find_field(rec, tag, field, strict=False): """ Return the global and local positions of the first occurrence of the field. :param rec: A record dictionary structure :type rec: dictionary :param tag: The tag of the field to search for :type tag: string :param field: ...
def record_find_field(rec, tag, field, strict=False): """ Return the global and local positions of the first occurrence of the field. :param rec: A record dictionary structure :type rec: dictionary :param tag: The tag of the field to search for :type tag: string :param field: ...
[ "Return", "the", "global", "and", "local", "positions", "of", "the", "first", "occurrence", "of", "the", "field", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1360-L1388
[ "def", "record_find_field", "(", "rec", ",", "tag", ",", "field", ",", "strict", "=", "False", ")", ":", "try", ":", "_check_field_validity", "(", "field", ")", "except", "InvenioBibRecordFieldError", ":", "raise", "for", "local_position", ",", "field1", "in",...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_match_subfields
Find subfield instances in a particular field. It tests values in 1 of 3 possible ways: - Does a subfield code exist? (ie does 773__a exist?) - Does a subfield have a particular value? (ie 773__a == 'PhysX') - Do a pair of subfields have particular values? (ie 035__2 == 'CDS' and 035__a == '...
harvestingkit/bibrecord.py
def record_match_subfields(rec, tag, ind1=" ", ind2=" ", sub_key=None, sub_value='', sub_key2=None, sub_value2='', case_sensitive=True): """ Find subfield instances in a particular field. It tests values in 1 of 3 possible ways: - Does a subfield c...
def record_match_subfields(rec, tag, ind1=" ", ind2=" ", sub_key=None, sub_value='', sub_key2=None, sub_value2='', case_sensitive=True): """ Find subfield instances in a particular field. It tests values in 1 of 3 possible ways: - Does a subfield c...
[ "Find", "subfield", "instances", "in", "a", "particular", "field", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1391-L1444
[ "def", "record_match_subfields", "(", "rec", ",", "tag", ",", "ind1", "=", "\" \"", ",", "ind2", "=", "\" \"", ",", "sub_key", "=", "None", ",", "sub_value", "=", "''", ",", "sub_key2", "=", "None", ",", "sub_value2", "=", "''", ",", "case_sensitive", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_strip_empty_volatile_subfields
Remove unchanged volatile subfields from the record.
harvestingkit/bibrecord.py
def record_strip_empty_volatile_subfields(rec): """Remove unchanged volatile subfields from the record.""" for tag in rec.keys(): for field in rec[tag]: field[0][:] = [subfield for subfield in field[0] if subfield[1][:9] != "VOLATILE:"]
def record_strip_empty_volatile_subfields(rec): """Remove unchanged volatile subfields from the record.""" for tag in rec.keys(): for field in rec[tag]: field[0][:] = [subfield for subfield in field[0] if subfield[1][:9] != "VOLATILE:"]
[ "Remove", "unchanged", "volatile", "subfields", "from", "the", "record", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1447-L1452
[ "def", "record_strip_empty_volatile_subfields", "(", "rec", ")", ":", "for", "tag", "in", "rec", ".", "keys", "(", ")", ":", "for", "field", "in", "rec", "[", "tag", "]", ":", "field", "[", "0", "]", "[", ":", "]", "=", "[", "subfield", "for", "sub...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_make_all_subfields_volatile
Turns all subfields to volatile
harvestingkit/bibrecord.py
def record_make_all_subfields_volatile(rec): """ Turns all subfields to volatile """ for tag in rec.keys(): for field_position, field in enumerate(rec[tag]): for subfield_position, subfield in enumerate(field[0]): if subfield[1][:9] != "VOLATILE:": ...
def record_make_all_subfields_volatile(rec): """ Turns all subfields to volatile """ for tag in rec.keys(): for field_position, field in enumerate(rec[tag]): for subfield_position, subfield in enumerate(field[0]): if subfield[1][:9] != "VOLATILE:": ...
[ "Turns", "all", "subfields", "to", "volatile" ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1455-L1464
[ "def", "record_make_all_subfields_volatile", "(", "rec", ")", ":", "for", "tag", "in", "rec", ".", "keys", "(", ")", ":", "for", "field_position", ",", "field", "in", "enumerate", "(", "rec", "[", "tag", "]", ")", ":", "for", "subfield_position", ",", "s...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_strip_empty_fields
Remove empty subfields and fields from the record. If 'tag' is not None, only a specific tag of the record will be stripped, otherwise the whole record. :param rec: A record dictionary structure :type rec: dictionary :param tag: The tag of the field to strip empty fields from :type tag: ...
harvestingkit/bibrecord.py
def record_strip_empty_fields(rec, tag=None): """ Remove empty subfields and fields from the record. If 'tag' is not None, only a specific tag of the record will be stripped, otherwise the whole record. :param rec: A record dictionary structure :type rec: dictionary :param tag: The tag...
def record_strip_empty_fields(rec, tag=None): """ Remove empty subfields and fields from the record. If 'tag' is not None, only a specific tag of the record will be stripped, otherwise the whole record. :param rec: A record dictionary structure :type rec: dictionary :param tag: The tag...
[ "Remove", "empty", "subfields", "and", "fields", "from", "the", "record", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1466-L1509
[ "def", "record_strip_empty_fields", "(", "rec", ",", "tag", "=", "None", ")", ":", "# Check whole record", "if", "tag", "is", "None", ":", "tags", "=", "rec", ".", "keys", "(", ")", "for", "tag", "in", "tags", ":", "record_strip_empty_fields", "(", "rec", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_strip_controlfields
Remove all non-empty controlfields from the record. :param rec: A record dictionary structure :type rec: dictionary
harvestingkit/bibrecord.py
def record_strip_controlfields(rec): """ Remove all non-empty controlfields from the record. :param rec: A record dictionary structure :type rec: dictionary """ for tag in rec.keys(): if tag[:2] == '00' and rec[tag][0][3]: del rec[tag]
def record_strip_controlfields(rec): """ Remove all non-empty controlfields from the record. :param rec: A record dictionary structure :type rec: dictionary """ for tag in rec.keys(): if tag[:2] == '00' and rec[tag][0][3]: del rec[tag]
[ "Remove", "all", "non", "-", "empty", "controlfields", "from", "the", "record", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1512-L1521
[ "def", "record_strip_controlfields", "(", "rec", ")", ":", "for", "tag", "in", "rec", ".", "keys", "(", ")", ":", "if", "tag", "[", ":", "2", "]", "==", "'00'", "and", "rec", "[", "tag", "]", "[", "0", "]", "[", "3", "]", ":", "del", "rec", "...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
record_order_subfields
Order subfields from a record alphabetically based on subfield code. If 'tag' is not None, only a specific tag of the record will be reordered, otherwise the whole record. :param rec: bibrecord :type rec: bibrec :param tag: tag where the subfields will be ordered :type tag: str
harvestingkit/bibrecord.py
def record_order_subfields(rec, tag=None): """ Order subfields from a record alphabetically based on subfield code. If 'tag' is not None, only a specific tag of the record will be reordered, otherwise the whole record. :param rec: bibrecord :type rec: bibrec :param tag: tag where the subfi...
def record_order_subfields(rec, tag=None): """ Order subfields from a record alphabetically based on subfield code. If 'tag' is not None, only a specific tag of the record will be reordered, otherwise the whole record. :param rec: bibrecord :type rec: bibrec :param tag: tag where the subfi...
[ "Order", "subfields", "from", "a", "record", "alphabetically", "based", "on", "subfield", "code", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1524-L1549
[ "def", "record_order_subfields", "(", "rec", ",", "tag", "=", "None", ")", ":", "if", "rec", "is", "None", ":", "return", "rec", "if", "tag", "is", "None", ":", "tags", "=", "rec", ".", "keys", "(", ")", "for", "tag", "in", "tags", ":", "record_ord...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
field_get_subfields
Given a field, will place all subfields into a dictionary Parameters: * field - tuple: The field to get subfields for Returns: a dictionary, codes as keys and a list of values as the value
harvestingkit/bibrecord.py
def field_get_subfields(field): """ Given a field, will place all subfields into a dictionary Parameters: * field - tuple: The field to get subfields for Returns: a dictionary, codes as keys and a list of values as the value """ pairs = {} for key, value in field[0]: if key in pairs and...
def field_get_subfields(field): """ Given a field, will place all subfields into a dictionary Parameters: * field - tuple: The field to get subfields for Returns: a dictionary, codes as keys and a list of values as the value """ pairs = {} for key, value in field[0]: if key in pairs and...
[ "Given", "a", "field", "will", "place", "all", "subfields", "into", "a", "dictionary", "Parameters", ":", "*", "field", "-", "tuple", ":", "The", "field", "to", "get", "subfields", "for", "Returns", ":", "a", "dictionary", "codes", "as", "keys", "and", "...
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1560-L1571
[ "def", "field_get_subfields", "(", "field", ")", ":", "pairs", "=", "{", "}", "for", "key", ",", "value", "in", "field", "[", "0", "]", ":", "if", "key", "in", "pairs", "and", "pairs", "[", "key", "]", "!=", "value", ":", "pairs", "[", "key", "]"...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
_compare_fields
Compare 2 fields. If strict is True, then the order of the subfield will be taken care of, if not then the order of the subfields doesn't matter. :return: True if the field are equivalent, False otherwise.
harvestingkit/bibrecord.py
def _compare_fields(field1, field2, strict=True): """ Compare 2 fields. If strict is True, then the order of the subfield will be taken care of, if not then the order of the subfields doesn't matter. :return: True if the field are equivalent, False otherwise. """ if strict: # Retur...
def _compare_fields(field1, field2, strict=True): """ Compare 2 fields. If strict is True, then the order of the subfield will be taken care of, if not then the order of the subfields doesn't matter. :return: True if the field are equivalent, False otherwise. """ if strict: # Retur...
[ "Compare", "2", "fields", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1579-L1597
[ "def", "_compare_fields", "(", "field1", ",", "field2", ",", "strict", "=", "True", ")", ":", "if", "strict", ":", "# Return a simple equal test on the field minus the position.", "return", "field1", "[", ":", "4", "]", "==", "field2", "[", ":", "4", "]", "els...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
_check_field_validity
Check if a field is well-formed. :param field: A field tuple as returned by create_field() :type field: tuple :raise InvenioBibRecordFieldError: If the field is invalid.
harvestingkit/bibrecord.py
def _check_field_validity(field): """ Check if a field is well-formed. :param field: A field tuple as returned by create_field() :type field: tuple :raise InvenioBibRecordFieldError: If the field is invalid. """ if type(field) not in (list, tuple): raise InvenioBibRecordFieldError(...
def _check_field_validity(field): """ Check if a field is well-formed. :param field: A field tuple as returned by create_field() :type field: tuple :raise InvenioBibRecordFieldError: If the field is invalid. """ if type(field) not in (list, tuple): raise InvenioBibRecordFieldError(...
[ "Check", "if", "a", "field", "is", "well", "-", "formed", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1600-L1649
[ "def", "_check_field_validity", "(", "field", ")", ":", "if", "type", "(", "field", ")", "not", "in", "(", "list", ",", "tuple", ")", ":", "raise", "InvenioBibRecordFieldError", "(", "\"Field of type '%s' should be either \"", "\"a list or a tuple.\"", "%", "type", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
_shift_field_positions_global
Shift all global field positions. Shift all global field positions with global field positions higher or equal to 'start' from the value 'delta'.
harvestingkit/bibrecord.py
def _shift_field_positions_global(record, start, delta=1): """ Shift all global field positions. Shift all global field positions with global field positions higher or equal to 'start' from the value 'delta'. """ if not delta: return for tag, fields in record.items(): newfi...
def _shift_field_positions_global(record, start, delta=1): """ Shift all global field positions. Shift all global field positions with global field positions higher or equal to 'start' from the value 'delta'. """ if not delta: return for tag, fields in record.items(): newfi...
[ "Shift", "all", "global", "field", "positions", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1652-L1670
[ "def", "_shift_field_positions_global", "(", "record", ",", "start", ",", "delta", "=", "1", ")", ":", "if", "not", "delta", ":", "return", "for", "tag", ",", "fields", "in", "record", ".", "items", "(", ")", ":", "newfields", "=", "[", "]", "for", "...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
_tag_matches_pattern
Return true if MARC 'tag' matches a 'pattern'. 'pattern' is plain text, with % as wildcard Both parameters must be 3 characters long strings. .. doctest:: >>> _tag_matches_pattern("909", "909") True >>> _tag_matches_pattern("909", "9%9") True >>> _tag_matches_patt...
harvestingkit/bibrecord.py
def _tag_matches_pattern(tag, pattern): """Return true if MARC 'tag' matches a 'pattern'. 'pattern' is plain text, with % as wildcard Both parameters must be 3 characters long strings. .. doctest:: >>> _tag_matches_pattern("909", "909") True >>> _tag_matches_pattern("909", "9...
def _tag_matches_pattern(tag, pattern): """Return true if MARC 'tag' matches a 'pattern'. 'pattern' is plain text, with % as wildcard Both parameters must be 3 characters long strings. .. doctest:: >>> _tag_matches_pattern("909", "909") True >>> _tag_matches_pattern("909", "9...
[ "Return", "true", "if", "MARC", "tag", "matches", "a", "pattern", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1673-L1696
[ "def", "_tag_matches_pattern", "(", "tag", ",", "pattern", ")", ":", "for", "char1", ",", "char2", "in", "zip", "(", "tag", ",", "pattern", ")", ":", "if", "char2", "not", "in", "(", "'%'", ",", "char1", ")", ":", "return", "False", "return", "True" ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
_validate_record_field_positions_global
Check if the global field positions in the record are valid. I.e., no duplicate global field positions and local field positions in the list of fields are ascending. :param record: the record data structure :return: the first error found as a string or None if no error was found
harvestingkit/bibrecord.py
def _validate_record_field_positions_global(record): """ Check if the global field positions in the record are valid. I.e., no duplicate global field positions and local field positions in the list of fields are ascending. :param record: the record data structure :return: the first error found...
def _validate_record_field_positions_global(record): """ Check if the global field positions in the record are valid. I.e., no duplicate global field positions and local field positions in the list of fields are ascending. :param record: the record data structure :return: the first error found...
[ "Check", "if", "the", "global", "field", "positions", "in", "the", "record", "are", "valid", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1699-L1719
[ "def", "_validate_record_field_positions_global", "(", "record", ")", ":", "all_fields", "=", "[", "]", "for", "tag", ",", "fields", "in", "record", ".", "items", "(", ")", ":", "previous_field_position_global", "=", "-", "1", "for", "field", "in", "fields", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
_record_sort_by_indicators
Sort the fields inside the record by indicators.
harvestingkit/bibrecord.py
def _record_sort_by_indicators(record): """Sort the fields inside the record by indicators.""" for tag, fields in record.items(): record[tag] = _fields_sort_by_indicators(fields)
def _record_sort_by_indicators(record): """Sort the fields inside the record by indicators.""" for tag, fields in record.items(): record[tag] = _fields_sort_by_indicators(fields)
[ "Sort", "the", "fields", "inside", "the", "record", "by", "indicators", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1722-L1725
[ "def", "_record_sort_by_indicators", "(", "record", ")", ":", "for", "tag", ",", "fields", "in", "record", ".", "items", "(", ")", ":", "record", "[", "tag", "]", "=", "_fields_sort_by_indicators", "(", "fields", ")" ]
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
_fields_sort_by_indicators
Sort a set of fields by their indicators. Return a sorted list with correct global field positions.
harvestingkit/bibrecord.py
def _fields_sort_by_indicators(fields): """Sort a set of fields by their indicators. Return a sorted list with correct global field positions. """ field_dict = {} field_positions_global = [] for field in fields: field_dict.setdefault(field[1:3], []).append(field) field_positions...
def _fields_sort_by_indicators(fields): """Sort a set of fields by their indicators. Return a sorted list with correct global field positions. """ field_dict = {} field_positions_global = [] for field in fields: field_dict.setdefault(field[1:3], []).append(field) field_positions...
[ "Sort", "a", "set", "of", "fields", "by", "their", "indicators", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1728-L1747
[ "def", "_fields_sort_by_indicators", "(", "fields", ")", ":", "field_dict", "=", "{", "}", "field_positions_global", "=", "[", "]", "for", "field", "in", "fields", ":", "field_dict", ".", "setdefault", "(", "field", "[", "1", ":", "3", "]", ",", "[", "]"...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
_create_record_lxml
Create a record object using the LXML parser. If correct == 1, then perform DTD validation If correct == 0, then do not perform DTD validation If verbose == 0, the parser will not give warnings. If 1 <= verbose <= 3, the parser will not give errors, but will warn the user about possible mistak...
harvestingkit/bibrecord.py
def _create_record_lxml(marcxml, verbose=CFG_BIBRECORD_DEFAULT_VERBOSE_LEVEL, correct=CFG_BIBRECORD_DEFAULT_CORRECT, keep_singletons=CFG_BIBRECORD_KEEP_SINGLETONS): """ Create a record object using the LXML parser. If correct == 1, the...
def _create_record_lxml(marcxml, verbose=CFG_BIBRECORD_DEFAULT_VERBOSE_LEVEL, correct=CFG_BIBRECORD_DEFAULT_CORRECT, keep_singletons=CFG_BIBRECORD_KEEP_SINGLETONS): """ Create a record object using the LXML parser. If correct == 1, the...
[ "Create", "a", "record", "object", "using", "the", "LXML", "parser", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1750-L1826
[ "def", "_create_record_lxml", "(", "marcxml", ",", "verbose", "=", "CFG_BIBRECORD_DEFAULT_VERBOSE_LEVEL", ",", "correct", "=", "CFG_BIBRECORD_DEFAULT_CORRECT", ",", "keep_singletons", "=", "CFG_BIBRECORD_KEEP_SINGLETONS", ")", ":", "parser", "=", "etree", ".", "XMLParser"...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
_get_children_by_tag_name
Retrieve all children from node 'node' with name 'name'.
harvestingkit/bibrecord.py
def _get_children_by_tag_name(node, name): """Retrieve all children from node 'node' with name 'name'.""" try: return [child for child in node.childNodes if child.nodeName == name] except TypeError: return []
def _get_children_by_tag_name(node, name): """Retrieve all children from node 'node' with name 'name'.""" try: return [child for child in node.childNodes if child.nodeName == name] except TypeError: return []
[ "Retrieve", "all", "children", "from", "node", "node", "with", "name", "name", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1850-L1855
[ "def", "_get_children_by_tag_name", "(", "node", ",", "name", ")", ":", "try", ":", "return", "[", "child", "for", "child", "in", "node", ".", "childNodes", "if", "child", ".", "nodeName", "==", "name", "]", "except", "TypeError", ":", "return", "[", "]"...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
_get_children_as_string
Iterate through all the children of a node. Returns one string containing the values from all the text-nodes recursively.
harvestingkit/bibrecord.py
def _get_children_as_string(node): """Iterate through all the children of a node. Returns one string containing the values from all the text-nodes recursively. """ out = [] if node: for child in node: if child.nodeType == child.TEXT_NODE: out.append(child.dat...
def _get_children_as_string(node): """Iterate through all the children of a node. Returns one string containing the values from all the text-nodes recursively. """ out = [] if node: for child in node: if child.nodeType == child.TEXT_NODE: out.append(child.dat...
[ "Iterate", "through", "all", "the", "children", "of", "a", "node", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1858-L1871
[ "def", "_get_children_as_string", "(", "node", ")", ":", "out", "=", "[", "]", "if", "node", ":", "for", "child", "in", "node", ":", "if", "child", ".", "nodeType", "==", "child", ".", "TEXT_NODE", ":", "out", ".", "append", "(", "child", ".", "data"...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
_correct_record
Check and correct the structure of the record. :param record: the record data structure :return: a list of errors found
harvestingkit/bibrecord.py
def _correct_record(record): """ Check and correct the structure of the record. :param record: the record data structure :return: a list of errors found """ errors = [] for tag in record.keys(): upper_bound = '999' n = len(tag) if n > 3: i = n - 3 ...
def _correct_record(record): """ Check and correct the structure of the record. :param record: the record data structure :return: a list of errors found """ errors = [] for tag in record.keys(): upper_bound = '999' n = len(tag) if n > 3: i = n - 3 ...
[ "Check", "and", "correct", "the", "structure", "of", "the", "record", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1887-L1949
[ "def", "_correct_record", "(", "record", ")", ":", "errors", "=", "[", "]", "for", "tag", "in", "record", ".", "keys", "(", ")", ":", "upper_bound", "=", "'999'", "n", "=", "len", "(", "tag", ")", "if", "n", ">", "3", ":", "i", "=", "n", "-", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
_warning
Return a warning message of code 'code'. If code = (cd, str) it returns the warning message of code 'cd' and appends str at the end
harvestingkit/bibrecord.py
def _warning(code): """ Return a warning message of code 'code'. If code = (cd, str) it returns the warning message of code 'cd' and appends str at the end """ if isinstance(code, str): return code message = '' if isinstance(code, tuple): if isinstance(code[0], str): ...
def _warning(code): """ Return a warning message of code 'code'. If code = (cd, str) it returns the warning message of code 'cd' and appends str at the end """ if isinstance(code, str): return code message = '' if isinstance(code, tuple): if isinstance(code[0], str): ...
[ "Return", "a", "warning", "message", "of", "code", "code", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1952-L1967
[ "def", "_warning", "(", "code", ")", ":", "if", "isinstance", "(", "code", ",", "str", ")", ":", "return", "code", "message", "=", "''", "if", "isinstance", "(", "code", ",", "tuple", ")", ":", "if", "isinstance", "(", "code", "[", "0", "]", ",", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
_compare_lists
Compare twolists using given comparing function. :param list1: first list to compare :param list2: second list to compare :param custom_cmp: a function taking two arguments (element of list 1, element of list 2) and :return: True or False depending if the values are the same
harvestingkit/bibrecord.py
def _compare_lists(list1, list2, custom_cmp): """Compare twolists using given comparing function. :param list1: first list to compare :param list2: second list to compare :param custom_cmp: a function taking two arguments (element of list 1, element of list 2) and :return: True or False dep...
def _compare_lists(list1, list2, custom_cmp): """Compare twolists using given comparing function. :param list1: first list to compare :param list2: second list to compare :param custom_cmp: a function taking two arguments (element of list 1, element of list 2) and :return: True or False dep...
[ "Compare", "twolists", "using", "given", "comparing", "function", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L1975-L1989
[ "def", "_compare_lists", "(", "list1", ",", "list2", ",", "custom_cmp", ")", ":", "if", "len", "(", "list1", ")", "!=", "len", "(", "list2", ")", ":", "return", "False", "for", "element1", ",", "element2", "in", "zip", "(", "list1", ",", "list2", ")"...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
BibRecordPackage.parse
Parse an XML document and clean any namespaces.
harvestingkit/bibrecord.py
def parse(self, path_to_xml=None): """Parse an XML document and clean any namespaces.""" if not path_to_xml: if not self.path: self.logger.error("No path defined!") return path_to_xml = self.path root = self._clean_xml(path_to_xml) ...
def parse(self, path_to_xml=None): """Parse an XML document and clean any namespaces.""" if not path_to_xml: if not self.path: self.logger.error("No path defined!") return path_to_xml = self.path root = self._clean_xml(path_to_xml) ...
[ "Parse", "an", "XML", "document", "and", "clean", "any", "namespaces", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L114-L149
[ "def", "parse", "(", "self", ",", "path_to_xml", "=", "None", ")", ":", "if", "not", "path_to_xml", ":", "if", "not", "self", ".", "path", ":", "self", ".", "logger", ".", "error", "(", "\"No path defined!\"", ")", "return", "path_to_xml", "=", "self", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
BibRecordPackage._clean_xml
Clean MARCXML harvested from OAI. Allows the xml to be used with BibUpload or BibRecord. :param xml: either XML as a string or path to an XML file :return: ElementTree of clean data
harvestingkit/bibrecord.py
def _clean_xml(self, path_to_xml): """Clean MARCXML harvested from OAI. Allows the xml to be used with BibUpload or BibRecord. :param xml: either XML as a string or path to an XML file :return: ElementTree of clean data """ try: if os.path.isfile(path_to_xm...
def _clean_xml(self, path_to_xml): """Clean MARCXML harvested from OAI. Allows the xml to be used with BibUpload or BibRecord. :param xml: either XML as a string or path to an XML file :return: ElementTree of clean data """ try: if os.path.isfile(path_to_xm...
[ "Clean", "MARCXML", "harvested", "from", "OAI", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L151-L170
[ "def", "_clean_xml", "(", "self", ",", "path_to_xml", ")", ":", "try", ":", "if", "os", ".", "path", ".", "isfile", "(", "path_to_xml", ")", ":", "tree", "=", "ET", ".", "parse", "(", "path_to_xml", ")", "root", "=", "tree", ".", "getroot", "(", ")...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
BibRecordPackage.create_deleted_record
Generate the record deletion if deleted form OAI-PMH.
harvestingkit/bibrecord.py
def create_deleted_record(self, record): """Generate the record deletion if deleted form OAI-PMH.""" identifier = record_get_field_value(record, tag="037", code="a") recid = identifier.split(":")[-1] ...
def create_deleted_record(self, record): """Generate the record deletion if deleted form OAI-PMH.""" identifier = record_get_field_value(record, tag="037", code="a") recid = identifier.split(":")[-1] ...
[ "Generate", "the", "record", "deletion", "if", "deleted", "form", "OAI", "-", "PMH", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L172-L186
[ "def", "create_deleted_record", "(", "self", ",", "record", ")", ":", "identifier", "=", "record_get_field_value", "(", "record", ",", "tag", "=", "\"037\"", ",", "code", "=", "\"a\"", ")", "recid", "=", "identifier", ".", "split", "(", "\":\"", ")", "[", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
YesssSMS._login
Return a session for yesss.at.
YesssSMS/YesssSMS.py
def _login(self, session, get_request=False): """Return a session for yesss.at.""" req = session.post(self._login_url, data=self._logindata) if _LOGIN_ERROR_STRING in req.text or \ req.status_code == 403 or \ req.url == _LOGIN_URL: err_mess = "YesssSMS...
def _login(self, session, get_request=False): """Return a session for yesss.at.""" req = session.post(self._login_url, data=self._logindata) if _LOGIN_ERROR_STRING in req.text or \ req.status_code == 403 or \ req.url == _LOGIN_URL: err_mess = "YesssSMS...
[ "Return", "a", "session", "for", "yesss", ".", "at", "." ]
flowolf/yessssms
python
https://github.com/flowolf/yessssms/blob/2324fd9a31d5fd3a3dfbef7e76404809b85aa169/YesssSMS/YesssSMS.py#L82-L98
[ "def", "_login", "(", "self", ",", "session", ",", "get_request", "=", "False", ")", ":", "req", "=", "session", ".", "post", "(", "self", ".", "_login_url", ",", "data", "=", "self", ".", "_logindata", ")", "if", "_LOGIN_ERROR_STRING", "in", "req", "....
2324fd9a31d5fd3a3dfbef7e76404809b85aa169
valid
YesssSMS.login_data_valid
Check for working login data.
YesssSMS/YesssSMS.py
def login_data_valid(self): """Check for working login data.""" login_working = False try: with self._login(requests.Session()) as sess: sess.get(self._logout_url) except self.LoginError: pass else: login_working = True ...
def login_data_valid(self): """Check for working login data.""" login_working = False try: with self._login(requests.Session()) as sess: sess.get(self._logout_url) except self.LoginError: pass else: login_working = True ...
[ "Check", "for", "working", "login", "data", "." ]
flowolf/yessssms
python
https://github.com/flowolf/yessssms/blob/2324fd9a31d5fd3a3dfbef7e76404809b85aa169/YesssSMS/YesssSMS.py#L104-L114
[ "def", "login_data_valid", "(", "self", ")", ":", "login_working", "=", "False", "try", ":", "with", "self", ".", "_login", "(", "requests", ".", "Session", "(", ")", ")", "as", "sess", ":", "sess", ".", "get", "(", "self", ".", "_logout_url", ")", "...
2324fd9a31d5fd3a3dfbef7e76404809b85aa169
valid
YesssSMS.send
Send an SMS.
YesssSMS/YesssSMS.py
def send(self, recipient, message): """Send an SMS.""" if self._logindata['login_rufnummer'] is None or \ self._logindata['login_passwort'] is None: err_mess = "YesssSMS: Login data required" raise self.LoginError(err_mess) if not recipient: ra...
def send(self, recipient, message): """Send an SMS.""" if self._logindata['login_rufnummer'] is None or \ self._logindata['login_passwort'] is None: err_mess = "YesssSMS: Login data required" raise self.LoginError(err_mess) if not recipient: ra...
[ "Send", "an", "SMS", "." ]
flowolf/yessssms
python
https://github.com/flowolf/yessssms/blob/2324fd9a31d5fd3a3dfbef7e76404809b85aa169/YesssSMS/YesssSMS.py#L116-L144
[ "def", "send", "(", "self", ",", "recipient", ",", "message", ")", ":", "if", "self", ".", "_logindata", "[", "'login_rufnummer'", "]", "is", "None", "or", "self", ".", "_logindata", "[", "'login_passwort'", "]", "is", "None", ":", "err_mess", "=", "\"Ye...
2324fd9a31d5fd3a3dfbef7e76404809b85aa169
valid
WorldScientific.get_date
Return the date of the article in file.
harvestingkit/world_scientific_package.py
def get_date(self, filename): """Return the date of the article in file.""" try: self.document = parse(filename) return self._get_date() except DateNotFoundException: print("Date problem found in {0}".format(filename)) return datetime.datetime.strf...
def get_date(self, filename): """Return the date of the article in file.""" try: self.document = parse(filename) return self._get_date() except DateNotFoundException: print("Date problem found in {0}".format(filename)) return datetime.datetime.strf...
[ "Return", "the", "date", "of", "the", "article", "in", "file", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/world_scientific_package.py#L83-L91
[ "def", "get_date", "(", "self", ",", "filename", ")", ":", "try", ":", "self", ".", "document", "=", "parse", "(", "filename", ")", "return", "self", ".", "_get_date", "(", ")", "except", "DateNotFoundException", ":", "print", "(", "\"Date problem found in {...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
WorldScientific.get_collection
Return this articles' collection.
harvestingkit/world_scientific_package.py
def get_collection(self, journal): """Return this articles' collection.""" conference = '' for tag in self.document.getElementsByTagName('conference'): conference = xml_to_text(tag) if conference or journal == "International Journal of Modern Physics: Conference Series": ...
def get_collection(self, journal): """Return this articles' collection.""" conference = '' for tag in self.document.getElementsByTagName('conference'): conference = xml_to_text(tag) if conference or journal == "International Journal of Modern Physics: Conference Series": ...
[ "Return", "this", "articles", "collection", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/world_scientific_package.py#L149-L159
[ "def", "get_collection", "(", "self", ",", "journal", ")", ":", "conference", "=", "''", "for", "tag", "in", "self", ".", "document", ".", "getElementsByTagName", "(", "'conference'", ")", ":", "conference", "=", "xml_to_text", "(", "tag", ")", "if", "conf...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
WorldScientific.get_record
Get the MARCXML of the files in xaml_jp directory. :param filename: the name of the file to parse. :type filename: string :param refextract_callback: callback to be used to extract unstructured references. It should return ...
harvestingkit/world_scientific_package.py
def get_record(self, filename, ref_extract_callback=None): """Get the MARCXML of the files in xaml_jp directory. :param filename: the name of the file to parse. :type filename: string :param refextract_callback: callback to be used to extract unstruct...
def get_record(self, filename, ref_extract_callback=None): """Get the MARCXML of the files in xaml_jp directory. :param filename: the name of the file to parse. :type filename: string :param refextract_callback: callback to be used to extract unstruct...
[ "Get", "the", "MARCXML", "of", "the", "files", "in", "xaml_jp", "directory", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/world_scientific_package.py#L161-L275
[ "def", "get_record", "(", "self", ",", "filename", ",", "ref_extract_callback", "=", "None", ")", ":", "self", ".", "document", "=", "parse", "(", "filename", ")", "article_type", "=", "self", ".", "_get_article_type", "(", ")", "if", "article_type", "not", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
WorldScientific._attach_fulltext
Attach fulltext FFT.
harvestingkit/world_scientific_package.py
def _attach_fulltext(self, rec, doi): """Attach fulltext FFT.""" url = os.path.join(self.url_prefix, doi) record_add_field(rec, 'FFT', subfields=[('a', url), ('t', 'INSPIRE-PUBLIC'), ('d', 'Fulltext'...
def _attach_fulltext(self, rec, doi): """Attach fulltext FFT.""" url = os.path.join(self.url_prefix, doi) record_add_field(rec, 'FFT', subfields=[('a', url), ('t', 'INSPIRE-PUBLIC'), ('d', 'Fulltext'...
[ "Attach", "fulltext", "FFT", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/world_scientific_package.py#L277-L283
[ "def", "_attach_fulltext", "(", "self", ",", "rec", ",", "doi", ")", ":", "url", "=", "os", ".", "path", ".", "join", "(", "self", ".", "url_prefix", ",", "doi", ")", "record_add_field", "(", "rec", ",", "'FFT'", ",", "subfields", "=", "[", "(", "'...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
MARCXMLConversion.convert_all
Convert the list of bibrecs into one MARCXML. >>> from harvestingkit.bibrecord import BibRecordPackage >>> from harvestingkit.inspire_cds_package import Inspire2CDS >>> bibrecs = BibRecordPackage("inspire.xml") >>> bibrecs.parse() >>> xml = Inspire2CDS.convert_all(bibrecs.get_re...
harvestingkit/inspire_cds_package/base.py
def convert_all(cls, records): """Convert the list of bibrecs into one MARCXML. >>> from harvestingkit.bibrecord import BibRecordPackage >>> from harvestingkit.inspire_cds_package import Inspire2CDS >>> bibrecs = BibRecordPackage("inspire.xml") >>> bibrecs.parse() >>> xm...
def convert_all(cls, records): """Convert the list of bibrecs into one MARCXML. >>> from harvestingkit.bibrecord import BibRecordPackage >>> from harvestingkit.inspire_cds_package import Inspire2CDS >>> bibrecs = BibRecordPackage("inspire.xml") >>> bibrecs.parse() >>> xm...
[ "Convert", "the", "list", "of", "bibrecs", "into", "one", "MARCXML", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/base.py#L51-L70
[ "def", "convert_all", "(", "cls", ",", "records", ")", ":", "out", "=", "[", "\"<collection>\"", "]", "for", "rec", "in", "records", ":", "conversion", "=", "cls", "(", "rec", ")", "out", ".", "append", "(", "conversion", ".", "convert", "(", ")", ")...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
MARCXMLConversion.from_source
Yield single conversion objects from a MARCXML file or string. >>> from harvestingkit.inspire_cds_package import Inspire2CDS >>> for record in Inspire2CDS.from_source("inspire.xml"): >>> xml = record.convert()
harvestingkit/inspire_cds_package/base.py
def from_source(cls, source): """Yield single conversion objects from a MARCXML file or string. >>> from harvestingkit.inspire_cds_package import Inspire2CDS >>> for record in Inspire2CDS.from_source("inspire.xml"): >>> xml = record.convert() """ bibrecs = BibRecord...
def from_source(cls, source): """Yield single conversion objects from a MARCXML file or string. >>> from harvestingkit.inspire_cds_package import Inspire2CDS >>> for record in Inspire2CDS.from_source("inspire.xml"): >>> xml = record.convert() """ bibrecs = BibRecord...
[ "Yield", "single", "conversion", "objects", "from", "a", "MARCXML", "file", "or", "string", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/base.py#L73-L84
[ "def", "from_source", "(", "cls", ",", "source", ")", ":", "bibrecs", "=", "BibRecordPackage", "(", "source", ")", "bibrecs", ".", "parse", "(", ")", "for", "bibrec", "in", "bibrecs", ".", "get_records", "(", ")", ":", "yield", "cls", "(", "bibrec", ")...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
MARCXMLConversion.get_config_item
Return the opposite mapping by searching the imported KB.
harvestingkit/inspire_cds_package/base.py
def get_config_item(cls, key, kb_name, allow_substring=True): """Return the opposite mapping by searching the imported KB.""" config_dict = cls.kbs.get(kb_name, None) if config_dict: if key in config_dict: return config_dict[key] elif allow_substring: ...
def get_config_item(cls, key, kb_name, allow_substring=True): """Return the opposite mapping by searching the imported KB.""" config_dict = cls.kbs.get(kb_name, None) if config_dict: if key in config_dict: return config_dict[key] elif allow_substring: ...
[ "Return", "the", "opposite", "mapping", "by", "searching", "the", "imported", "KB", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/base.py#L87-L97
[ "def", "get_config_item", "(", "cls", ",", "key", ",", "kb_name", ",", "allow_substring", "=", "True", ")", ":", "config_dict", "=", "cls", ".", "kbs", ".", "get", "(", "kb_name", ",", "None", ")", "if", "config_dict", ":", "if", "key", "in", "config_d...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
MARCXMLConversion.load_config
Load configuration from config. Meant to run only once per system process as class variable in subclasses.
harvestingkit/inspire_cds_package/base.py
def load_config(from_key, to_key): """Load configuration from config. Meant to run only once per system process as class variable in subclasses.""" from .mappings import mappings kbs = {} for key, values in mappings['config'].iteritems(): parse_dict = {} ...
def load_config(from_key, to_key): """Load configuration from config. Meant to run only once per system process as class variable in subclasses.""" from .mappings import mappings kbs = {} for key, values in mappings['config'].iteritems(): parse_dict = {} ...
[ "Load", "configuration", "from", "config", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/base.py#L100-L114
[ "def", "load_config", "(", "from_key", ",", "to_key", ")", ":", "from", ".", "mappings", "import", "mappings", "kbs", "=", "{", "}", "for", "key", ",", "values", "in", "mappings", "[", "'config'", "]", ".", "iteritems", "(", ")", ":", "parse_dict", "="...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
MARCXMLConversion.match
Try to match the current record to the database.
harvestingkit/inspire_cds_package/base.py
def match(self, query=None, **kwargs): """Try to match the current record to the database.""" from invenio.search_engine import perform_request_search if not query: # We use default setup recid = self.record["001"][0][3] return perform_request_search(p="035:%s...
def match(self, query=None, **kwargs): """Try to match the current record to the database.""" from invenio.search_engine import perform_request_search if not query: # We use default setup recid = self.record["001"][0][3] return perform_request_search(p="035:%s...
[ "Try", "to", "match", "the", "current", "record", "to", "the", "database", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/base.py#L153-L165
[ "def", "match", "(", "self", ",", "query", "=", "None", ",", "*", "*", "kwargs", ")", ":", "from", "invenio", ".", "search_engine", "import", "perform_request_search", "if", "not", "query", ":", "# We use default setup", "recid", "=", "self", ".", "record", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
MARCXMLConversion.keep_only_fields
Keep only fields listed in field_list.
harvestingkit/inspire_cds_package/base.py
def keep_only_fields(self): """Keep only fields listed in field_list.""" for tag in self.record.keys(): if tag not in self.fields_list: record_delete_fields(self.record, tag)
def keep_only_fields(self): """Keep only fields listed in field_list.""" for tag in self.record.keys(): if tag not in self.fields_list: record_delete_fields(self.record, tag)
[ "Keep", "only", "fields", "listed", "in", "field_list", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/base.py#L171-L175
[ "def", "keep_only_fields", "(", "self", ")", ":", "for", "tag", "in", "self", ".", "record", ".", "keys", "(", ")", ":", "if", "tag", "not", "in", "self", ".", "fields_list", ":", "record_delete_fields", "(", "self", ".", "record", ",", "tag", ")" ]
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
MARCXMLConversion.strip_fields
Clear any fields listed in field_list.
harvestingkit/inspire_cds_package/base.py
def strip_fields(self): """Clear any fields listed in field_list.""" for tag in self.record.keys(): if tag in self.fields_list: record_delete_fields(self.record, tag)
def strip_fields(self): """Clear any fields listed in field_list.""" for tag in self.record.keys(): if tag in self.fields_list: record_delete_fields(self.record, tag)
[ "Clear", "any", "fields", "listed", "in", "field_list", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/base.py#L177-L181
[ "def", "strip_fields", "(", "self", ")", ":", "for", "tag", "in", "self", ".", "record", ".", "keys", "(", ")", ":", "if", "tag", "in", "self", ".", "fields_list", ":", "record_delete_fields", "(", "self", ".", "record", ",", "tag", ")" ]
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
MARCXMLConversion.add_systemnumber
Add 035 number from 001 recid with given source.
harvestingkit/inspire_cds_package/base.py
def add_systemnumber(self, source, recid=None): """Add 035 number from 001 recid with given source.""" if not recid: recid = self.get_recid() if not self.hidden and recid: record_add_field( self.record, tag='035', subfields=...
def add_systemnumber(self, source, recid=None): """Add 035 number from 001 recid with given source.""" if not recid: recid = self.get_recid() if not self.hidden and recid: record_add_field( self.record, tag='035', subfields=...
[ "Add", "035", "number", "from", "001", "recid", "with", "given", "source", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/base.py#L183-L192
[ "def", "add_systemnumber", "(", "self", ",", "source", ",", "recid", "=", "None", ")", ":", "if", "not", "recid", ":", "recid", "=", "self", ".", "get_recid", "(", ")", "if", "not", "self", ".", "hidden", "and", "recid", ":", "record_add_field", "(", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
MARCXMLConversion.add_control_number
Add a control-number 00x for given tag with value.
harvestingkit/inspire_cds_package/base.py
def add_control_number(self, tag, value): """Add a control-number 00x for given tag with value.""" record_add_field(self.record, tag, controlfield_value=value)
def add_control_number(self, tag, value): """Add a control-number 00x for given tag with value.""" record_add_field(self.record, tag, controlfield_value=value)
[ "Add", "a", "control", "-", "number", "00x", "for", "given", "tag", "with", "value", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/base.py#L194-L198
[ "def", "add_control_number", "(", "self", ",", "tag", ",", "value", ")", ":", "record_add_field", "(", "self", ".", "record", ",", "tag", ",", "controlfield_value", "=", "value", ")" ]
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
MARCXMLConversion.update_subject_categories
650 Translate Categories.
harvestingkit/inspire_cds_package/base.py
def update_subject_categories(self, primary, secondary, kb): """650 Translate Categories.""" category_fields = record_get_field_instances(self.record, tag='650', ind1='1', ...
def update_subject_categories(self, primary, secondary, kb): """650 Translate Categories.""" category_fields = record_get_field_instances(self.record, tag='650', ind1='1', ...
[ "650", "Translate", "Categories", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/base.py#L200-L217
[ "def", "update_subject_categories", "(", "self", ",", "primary", ",", "secondary", ",", "kb", ")", ":", "category_fields", "=", "record_get_field_instances", "(", "self", ".", "record", ",", "tag", "=", "'650'", ",", "ind1", "=", "'1'", ",", "ind2", "=", "...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
ApsPackage._get_reference
Retrieve the data for a reference.
harvestingkit/aps_package.py
def _get_reference(self, ref): """Retrieve the data for a reference.""" label = get_value_in_tag(ref, 'label') label = re.sub('\D', '', label) for innerref in ref.getElementsByTagName('mixed-citation'): ref_type = innerref.getAttribute('publication-type') institut...
def _get_reference(self, ref): """Retrieve the data for a reference.""" label = get_value_in_tag(ref, 'label') label = re.sub('\D', '', label) for innerref in ref.getElementsByTagName('mixed-citation'): ref_type = innerref.getAttribute('publication-type') institut...
[ "Retrieve", "the", "data", "for", "a", "reference", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/aps_package.py#L49-L141
[ "def", "_get_reference", "(", "self", ",", "ref", ")", ":", "label", "=", "get_value_in_tag", "(", "ref", ",", "'label'", ")", "label", "=", "re", ".", "sub", "(", "'\\D'", ",", "''", ",", "label", ")", "for", "innerref", "in", "ref", ".", "getElemen...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
ApsPackage._add_references
Adds the reference to the record
harvestingkit/aps_package.py
def _add_references(self, rec): """ Adds the reference to the record """ for ref in self.document.getElementsByTagName('ref'): for ref_type, doi, authors, collaboration, journal, volume, page, year,\ label, arxiv, publisher, institution, unstructured_text,\ ...
def _add_references(self, rec): """ Adds the reference to the record """ for ref in self.document.getElementsByTagName('ref'): for ref_type, doi, authors, collaboration, journal, volume, page, year,\ label, arxiv, publisher, institution, unstructured_text,\ ...
[ "Adds", "the", "reference", "to", "the", "record" ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/aps_package.py#L143-L211
[ "def", "_add_references", "(", "self", ",", "rec", ")", ":", "for", "ref", "in", "self", ".", "document", ".", "getElementsByTagName", "(", "'ref'", ")", ":", "for", "ref_type", ",", "doi", ",", "authors", ",", "collaboration", ",", "journal", ",", "volu...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
ApsPackage.get_record
Reads a xml file in JATS format and returns a xml string in marc format
harvestingkit/aps_package.py
def get_record(self, xml_file): """ Reads a xml file in JATS format and returns a xml string in marc format """ self.document = parse(xml_file) if get_value_in_tag(self.document, "meta"): raise ApsPackageXMLError("The XML format of %s is not correct" ...
def get_record(self, xml_file): """ Reads a xml file in JATS format and returns a xml string in marc format """ self.document = parse(xml_file) if get_value_in_tag(self.document, "meta"): raise ApsPackageXMLError("The XML format of %s is not correct" ...
[ "Reads", "a", "xml", "file", "in", "JATS", "format", "and", "returns", "a", "xml", "string", "in", "marc", "format" ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/aps_package.py#L213-L288
[ "def", "get_record", "(", "self", ",", "xml_file", ")", ":", "self", ".", "document", "=", "parse", "(", "xml_file", ")", "if", "get_value_in_tag", "(", "self", ".", "document", ",", "\"meta\"", ")", ":", "raise", "ApsPackageXMLError", "(", "\"The XML format...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
FtpHandler.connect
Connects and logins to the server.
harvestingkit/ftp_utils.py
def connect(self): """ Connects and logins to the server. """ self._ftp.connect() self._ftp.login(user=self._username, passwd=self._passwd)
def connect(self): """ Connects and logins to the server. """ self._ftp.connect() self._ftp.login(user=self._username, passwd=self._passwd)
[ "Connects", "and", "logins", "to", "the", "server", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/ftp_utils.py#L62-L65
[ "def", "connect", "(", "self", ")", ":", "self", ".", "_ftp", ".", "connect", "(", ")", "self", ".", "_ftp", ".", "login", "(", "user", "=", "self", ".", "_username", ",", "passwd", "=", "self", ".", "_passwd", ")" ]
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
FtpHandler.download_folder
Downloads a whole folder from the server. FtpHandler.download_folder() will download all the files from the server in the working directory. :param folder: the absolute path for the folder on the server. :type folder: string :param target_folder: absolute or relative path for t...
harvestingkit/ftp_utils.py
def download_folder(self, folder='', target_folder=''): """ Downloads a whole folder from the server. FtpHandler.download_folder() will download all the files from the server in the working directory. :param folder: the absolute path for the folder on the server. :type folder: ...
def download_folder(self, folder='', target_folder=''): """ Downloads a whole folder from the server. FtpHandler.download_folder() will download all the files from the server in the working directory. :param folder: the absolute path for the folder on the server. :type folder: ...
[ "Downloads", "a", "whole", "folder", "from", "the", "server", ".", "FtpHandler", ".", "download_folder", "()", "will", "download", "all", "the", "files", "from", "the", "server", "in", "the", "working", "directory", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/ftp_utils.py#L71-L88
[ "def", "download_folder", "(", "self", ",", "folder", "=", "''", ",", "target_folder", "=", "''", ")", ":", "files", ",", "folders", "=", "self", ".", "ls", "(", "folder", ")", "for", "fl", "in", "files", ":", "self", ".", "download", "(", "join", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
FtpHandler.download
Downloads a file from the FTP server to target folder :param source_file: the absolute path for the file on the server it can be the one of the files coming from FtpHandler.dir(). :type source_file: string :param target_folder: relative or absolute path of ...
harvestingkit/ftp_utils.py
def download(self, source_file, target_folder=''): """ Downloads a file from the FTP server to target folder :param source_file: the absolute path for the file on the server it can be the one of the files coming from FtpHandler.dir(). :type source_file: str...
def download(self, source_file, target_folder=''): """ Downloads a file from the FTP server to target folder :param source_file: the absolute path for the file on the server it can be the one of the files coming from FtpHandler.dir(). :type source_file: str...
[ "Downloads", "a", "file", "from", "the", "FTP", "server", "to", "target", "folder" ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/ftp_utils.py#L90-L128
[ "def", "download", "(", "self", ",", "source_file", ",", "target_folder", "=", "''", ")", ":", "current_folder", "=", "self", ".", "_ftp", ".", "pwd", "(", ")", "if", "not", "target_folder", ".", "startswith", "(", "'/'", ")", ":", "# relative path", "ta...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
FtpHandler.cd
Changes the working directory on the server. :param folder: the desired directory. :type folder: string
harvestingkit/ftp_utils.py
def cd(self, folder): """ Changes the working directory on the server. :param folder: the desired directory. :type folder: string """ if folder.startswith('/'): self._ftp.cwd(folder) else: for subfolder in folder.split('/'): if sub...
def cd(self, folder): """ Changes the working directory on the server. :param folder: the desired directory. :type folder: string """ if folder.startswith('/'): self._ftp.cwd(folder) else: for subfolder in folder.split('/'): if sub...
[ "Changes", "the", "working", "directory", "on", "the", "server", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/ftp_utils.py#L130-L141
[ "def", "cd", "(", "self", ",", "folder", ")", ":", "if", "folder", ".", "startswith", "(", "'/'", ")", ":", "self", ".", "_ftp", ".", "cwd", "(", "folder", ")", "else", ":", "for", "subfolder", "in", "folder", ".", "split", "(", "'/'", ")", ":", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
FtpHandler.ls
Lists the files and folders of a specific directory default is the current working directory. :param folder: the folder to be listed. :type folder: string :returns: a tuple with the list of files in the folder and the list of subfolders in the folder.
harvestingkit/ftp_utils.py
def ls(self, folder=''): """ Lists the files and folders of a specific directory default is the current working directory. :param folder: the folder to be listed. :type folder: string :returns: a tuple with the list of files in the folder and the list of subfo...
def ls(self, folder=''): """ Lists the files and folders of a specific directory default is the current working directory. :param folder: the folder to be listed. :type folder: string :returns: a tuple with the list of files in the folder and the list of subfo...
[ "Lists", "the", "files", "and", "folders", "of", "a", "specific", "directory", "default", "is", "the", "current", "working", "directory", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/ftp_utils.py#L143-L162
[ "def", "ls", "(", "self", ",", "folder", "=", "''", ")", ":", "current_folder", "=", "self", ".", "_ftp", ".", "pwd", "(", ")", "self", ".", "cd", "(", "folder", ")", "contents", "=", "[", "]", "self", ".", "_ftp", ".", "retrlines", "(", "'LIST'"...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
FtpHandler.dir
Lists all the files on the folder given as parameter. FtpHandler.dir() lists all the files on the server. :para folder: the folder to be listed. :type folder: string :param prefix: it does not belong to the interface, it is used to recursively list the subfolders...
harvestingkit/ftp_utils.py
def dir(self, folder='', prefix=''): """ Lists all the files on the folder given as parameter. FtpHandler.dir() lists all the files on the server. :para folder: the folder to be listed. :type folder: string :param prefix: it does not belong to the interface, ...
def dir(self, folder='', prefix=''): """ Lists all the files on the folder given as parameter. FtpHandler.dir() lists all the files on the server. :para folder: the folder to be listed. :type folder: string :param prefix: it does not belong to the interface, ...
[ "Lists", "all", "the", "files", "on", "the", "folder", "given", "as", "parameter", ".", "FtpHandler", ".", "dir", "()", "lists", "all", "the", "files", "on", "the", "server", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/ftp_utils.py#L164-L187
[ "def", "dir", "(", "self", ",", "folder", "=", "''", ",", "prefix", "=", "''", ")", ":", "files", ",", "folders", "=", "self", ".", "ls", "(", "folder", ")", "result", "=", "files", "inner", "=", "[", "]", "for", "fld", "in", "folders", ":", "t...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
FtpHandler.mkdir
Creates a folder in the server :param folder: the folder to be created. :type folder: string
harvestingkit/ftp_utils.py
def mkdir(self, folder): """ Creates a folder in the server :param folder: the folder to be created. :type folder: string """ current_folder = self._ftp.pwd() #creates the necessary folders on #the server if they don't exist folders = folder.split('/') ...
def mkdir(self, folder): """ Creates a folder in the server :param folder: the folder to be created. :type folder: string """ current_folder = self._ftp.pwd() #creates the necessary folders on #the server if they don't exist folders = folder.split('/') ...
[ "Creates", "a", "folder", "in", "the", "server" ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/ftp_utils.py#L189-L205
[ "def", "mkdir", "(", "self", ",", "folder", ")", ":", "current_folder", "=", "self", ".", "_ftp", ".", "pwd", "(", ")", "#creates the necessary folders on", "#the server if they don't exist", "folders", "=", "folder", ".", "split", "(", "'/'", ")", "for", "fld...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
FtpHandler.rm
Delete a file from the server. :param filename: the file to be deleted. :type filename: string
harvestingkit/ftp_utils.py
def rm(self, filename): """ Delete a file from the server. :param filename: the file to be deleted. :type filename: string """ try: self._ftp.delete(filename) except error_perm: # target is either a directory # either it does not ...
def rm(self, filename): """ Delete a file from the server. :param filename: the file to be deleted. :type filename: string """ try: self._ftp.delete(filename) except error_perm: # target is either a directory # either it does not ...
[ "Delete", "a", "file", "from", "the", "server", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/ftp_utils.py#L207-L227
[ "def", "rm", "(", "self", ",", "filename", ")", ":", "try", ":", "self", ".", "_ftp", ".", "delete", "(", "filename", ")", "except", "error_perm", ":", "# target is either a directory", "# either it does not exist", "try", ":", "current_folder", "=", "self", "...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
FtpHandler.rmdir
Delete a folder from the server. :param foldername: the folder to be deleted. :type foldername: string
harvestingkit/ftp_utils.py
def rmdir(self, foldername): """ Delete a folder from the server. :param foldername: the folder to be deleted. :type foldername: string """ current_folder = self._ftp.pwd() try: self.cd(foldername) except error_perm: print('550 Delete oper...
def rmdir(self, foldername): """ Delete a folder from the server. :param foldername: the folder to be deleted. :type foldername: string """ current_folder = self._ftp.pwd() try: self.cd(foldername) except error_perm: print('550 Delete oper...
[ "Delete", "a", "folder", "from", "the", "server", "." ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/ftp_utils.py#L229-L253
[ "def", "rmdir", "(", "self", ",", "foldername", ")", ":", "current_folder", "=", "self", ".", "_ftp", ".", "pwd", "(", ")", "try", ":", "self", ".", "cd", "(", "foldername", ")", "except", "error_perm", ":", "print", "(", "'550 Delete operation failed fold...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
FtpHandler.get_filesize
Returns the filesize of a file :param filename: the full path to the file on the server. :type filename: string :returns: string representation of the filesize.
harvestingkit/ftp_utils.py
def get_filesize(self, filename): """ Returns the filesize of a file :param filename: the full path to the file on the server. :type filename: string :returns: string representation of the filesize. """ result = [] def dir_callback(val): result.appe...
def get_filesize(self, filename): """ Returns the filesize of a file :param filename: the full path to the file on the server. :type filename: string :returns: string representation of the filesize. """ result = [] def dir_callback(val): result.appe...
[ "Returns", "the", "filesize", "of", "a", "file" ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/ftp_utils.py#L255-L269
[ "def", "get_filesize", "(", "self", ",", "filename", ")", ":", "result", "=", "[", "]", "def", "dir_callback", "(", "val", ")", ":", "result", ".", "append", "(", "val", ".", "split", "(", ")", "[", "4", "]", ")", "self", ".", "_ftp", ".", "dir",...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
FtpHandler.upload
Uploads a file on the server to the desired location :param filename: the name of the file to be uploaded. :type filename: string :param location: the directory in which the file will be stored. :type location: string
harvestingkit/ftp_utils.py
def upload(self, filename, location=''): """ Uploads a file on the server to the desired location :param filename: the name of the file to be uploaded. :type filename: string :param location: the directory in which the file will be stored. :type location...
def upload(self, filename, location=''): """ Uploads a file on the server to the desired location :param filename: the name of the file to be uploaded. :type filename: string :param location: the directory in which the file will be stored. :type location...
[ "Uploads", "a", "file", "on", "the", "server", "to", "the", "desired", "location" ]
inspirehep/harvesting-kit
python
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/ftp_utils.py#L318-L334
[ "def", "upload", "(", "self", ",", "filename", ",", "location", "=", "''", ")", ":", "current_folder", "=", "self", ".", "_ftp", ".", "pwd", "(", ")", "self", ".", "mkdir", "(", "location", ")", "self", ".", "cd", "(", "location", ")", "fl", "=", ...
33a7f8aa9dade1d863110c6d8b27dfd955cb471f
valid
TextBlockParser.parse_data
Parses a block of text indiscriminately
oembed/parsers/text.py
def parse_data(self, text, maxwidth, maxheight, template_dir, context, urlize_all_links): """ Parses a block of text indiscriminately """ # create a dictionary of user urls -> rendered responses replacements = {} user_urls = set(re.findall(URL_RE, text)...
def parse_data(self, text, maxwidth, maxheight, template_dir, context, urlize_all_links): """ Parses a block of text indiscriminately """ # create a dictionary of user urls -> rendered responses replacements = {} user_urls = set(re.findall(URL_RE, text)...
[ "Parses", "a", "block", "of", "text", "indiscriminately" ]
worldcompany/djangoembed
python
https://github.com/worldcompany/djangoembed/blob/f3f2be283441d91d1f89db780444dc75f7b51902/oembed/parsers/text.py#L12-L61
[ "def", "parse_data", "(", "self", ",", "text", ",", "maxwidth", ",", "maxheight", ",", "template_dir", ",", "context", ",", "urlize_all_links", ")", ":", "# create a dictionary of user urls -> rendered responses", "replacements", "=", "{", "}", "user_urls", "=", "se...
f3f2be283441d91d1f89db780444dc75f7b51902
valid
TextParser.parse_data
Parses a block of text rendering links that occur on their own line normally but rendering inline links using a special template dir
oembed/parsers/text.py
def parse_data(self, text, maxwidth, maxheight, template_dir, context, urlize_all_links): """ Parses a block of text rendering links that occur on their own line normally but rendering inline links using a special template dir """ block_parser = TextBlockParse...
def parse_data(self, text, maxwidth, maxheight, template_dir, context, urlize_all_links): """ Parses a block of text rendering links that occur on their own line normally but rendering inline links using a special template dir """ block_parser = TextBlockParse...
[ "Parses", "a", "block", "of", "text", "rendering", "links", "that", "occur", "on", "their", "own", "line", "normally", "but", "rendering", "inline", "links", "using", "a", "special", "template", "dir" ]
worldcompany/djangoembed
python
https://github.com/worldcompany/djangoembed/blob/f3f2be283441d91d1f89db780444dc75f7b51902/oembed/parsers/text.py#L75-L111
[ "def", "parse_data", "(", "self", ",", "text", ",", "maxwidth", ",", "maxheight", ",", "template_dir", ",", "context", ",", "urlize_all_links", ")", ":", "block_parser", "=", "TextBlockParser", "(", ")", "lines", "=", "text", ".", "splitlines", "(", ")", "...
f3f2be283441d91d1f89db780444dc75f7b51902
valid
login
Do the legwork of logging into the Midas Server instance, storing the API key and token. :param email: (optional) Email address to login with. If not set, the console will be prompted. :type email: None | string :param password: (optional) User password to login with. If not set and no ...
pydas/api.py
def login(email=None, password=None, api_key=None, application='Default', url=None, verify_ssl_certificate=True): """ Do the legwork of logging into the Midas Server instance, storing the API key and token. :param email: (optional) Email address to login with. If not set, the console ...
def login(email=None, password=None, api_key=None, application='Default', url=None, verify_ssl_certificate=True): """ Do the legwork of logging into the Midas Server instance, storing the API key and token. :param email: (optional) Email address to login with. If not set, the console ...
[ "Do", "the", "legwork", "of", "logging", "into", "the", "Midas", "Server", "instance", "storing", "the", "API", "key", "and", "token", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L38-L93
[ "def", "login", "(", "email", "=", "None", ",", "password", "=", "None", ",", "api_key", "=", "None", ",", "application", "=", "'Default'", ",", "url", "=", "None", ",", "verify_ssl_certificate", "=", "True", ")", ":", "try", ":", "input_", "=", "raw_i...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
renew_token
Renew or get a token to use for transactions with the Midas Server instance. :returns: API token. :rtype: string
pydas/api.py
def renew_token(): """ Renew or get a token to use for transactions with the Midas Server instance. :returns: API token. :rtype: string """ session.token = session.communicator.login_with_api_key( session.email, session.api_key, application=session.application) if len(session.to...
def renew_token(): """ Renew or get a token to use for transactions with the Midas Server instance. :returns: API token. :rtype: string """ session.token = session.communicator.login_with_api_key( session.email, session.api_key, application=session.application) if len(session.to...
[ "Renew", "or", "get", "a", "token", "to", "use", "for", "transactions", "with", "the", "Midas", "Server", "instance", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L96-L110
[ "def", "renew_token", "(", ")", ":", "session", ".", "token", "=", "session", ".", "communicator", ".", "login_with_api_key", "(", "session", ".", "email", ",", "session", ".", "api_key", ",", "application", "=", "session", ".", "application", ")", "if", "...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
_create_or_reuse_item
Create an item from the local file in the Midas Server folder corresponding to the parent folder id. :param local_file: full path to a file on the local file system :type local_file: string :param parent_folder_id: id of parent folder on the Midas Server instance, where the item will be added ...
pydas/api.py
def _create_or_reuse_item(local_file, parent_folder_id, reuse_existing=False): """ Create an item from the local file in the Midas Server folder corresponding to the parent folder id. :param local_file: full path to a file on the local file system :type local_file: string :param parent_folder_i...
def _create_or_reuse_item(local_file, parent_folder_id, reuse_existing=False): """ Create an item from the local file in the Midas Server folder corresponding to the parent folder id. :param local_file: full path to a file on the local file system :type local_file: string :param parent_folder_i...
[ "Create", "an", "item", "from", "the", "local", "file", "in", "the", "Midas", "Server", "folder", "corresponding", "to", "the", "parent", "folder", "id", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L183-L216
[ "def", "_create_or_reuse_item", "(", "local_file", ",", "parent_folder_id", ",", "reuse_existing", "=", "False", ")", ":", "local_item_name", "=", "os", ".", "path", ".", "basename", "(", "local_file", ")", "item_id", "=", "None", "if", "reuse_existing", ":", ...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
_create_or_reuse_folder
Create a folder from the local file in the midas folder corresponding to the parent folder id. :param local_folder: full path to a directory on the local file system :type local_folder: string :param parent_folder_id: id of parent folder on the Midas Server instance, where the folder will be ad...
pydas/api.py
def _create_or_reuse_folder(local_folder, parent_folder_id, reuse_existing=False): """ Create a folder from the local file in the midas folder corresponding to the parent folder id. :param local_folder: full path to a directory on the local file system :type local_folder...
def _create_or_reuse_folder(local_folder, parent_folder_id, reuse_existing=False): """ Create a folder from the local file in the midas folder corresponding to the parent folder id. :param local_folder: full path to a directory on the local file system :type local_folder...
[ "Create", "a", "folder", "from", "the", "local", "file", "in", "the", "midas", "folder", "corresponding", "to", "the", "parent", "folder", "id", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L219-L254
[ "def", "_create_or_reuse_folder", "(", "local_folder", ",", "parent_folder_id", ",", "reuse_existing", "=", "False", ")", ":", "local_folder_name", "=", "os", ".", "path", ".", "basename", "(", "local_folder", ")", "folder_id", "=", "None", "if", "reuse_existing",...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
_streaming_file_md5
Create and return a hex checksum using the MD5 sum of the passed in file. This will stream the file, rather than load it all into memory. :param file_path: full path to the file :type file_path: string :returns: a hex checksum :rtype: string
pydas/api.py
def _streaming_file_md5(file_path): """ Create and return a hex checksum using the MD5 sum of the passed in file. This will stream the file, rather than load it all into memory. :param file_path: full path to the file :type file_path: string :returns: a hex checksum :rtype: string """ ...
def _streaming_file_md5(file_path): """ Create and return a hex checksum using the MD5 sum of the passed in file. This will stream the file, rather than load it all into memory. :param file_path: full path to the file :type file_path: string :returns: a hex checksum :rtype: string """ ...
[ "Create", "and", "return", "a", "hex", "checksum", "using", "the", "MD5", "sum", "of", "the", "passed", "in", "file", ".", "This", "will", "stream", "the", "file", "rather", "than", "load", "it", "all", "into", "memory", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L257-L273
[ "def", "_streaming_file_md5", "(", "file_path", ")", ":", "md5", "=", "hashlib", ".", "md5", "(", ")", "with", "open", "(", "file_path", ",", "'rb'", ")", "as", "f", ":", "# iter needs an empty byte string for the returned iterator to halt at", "# EOF", "for", "ch...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
_create_bitstream
Create a bitstream in the given item. :param file_path: full path to the local file :type file_path: string :param local_file: name of the local file :type local_file: string :param log_ind: (optional) any additional message to log upon creation of the bitstream :type log_ind: None | st...
pydas/api.py
def _create_bitstream(file_path, local_file, item_id, log_ind=None): """ Create a bitstream in the given item. :param file_path: full path to the local file :type file_path: string :param local_file: name of the local file :type local_file: string :param log_ind: (optional) any additional m...
def _create_bitstream(file_path, local_file, item_id, log_ind=None): """ Create a bitstream in the given item. :param file_path: full path to the local file :type file_path: string :param local_file: name of the local file :type local_file: string :param log_ind: (optional) any additional m...
[ "Create", "a", "bitstream", "in", "the", "given", "item", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L276-L304
[ "def", "_create_bitstream", "(", "file_path", ",", "local_file", ",", "item_id", ",", "log_ind", "=", "None", ")", ":", "checksum", "=", "_streaming_file_md5", "(", "file_path", ")", "upload_token", "=", "session", ".", "communicator", ".", "generate_upload_token"...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
_upload_as_item
Function for doing an upload of a file as an item. This should be a building block for user-level functions. :param local_file: name of local file to upload :type local_file: string :param parent_folder_id: id of parent folder on the Midas Server instance, where the item will be added :type...
pydas/api.py
def _upload_as_item(local_file, parent_folder_id, file_path, reuse_existing=False): """ Function for doing an upload of a file as an item. This should be a building block for user-level functions. :param local_file: name of local file to upload :type local_file: string :para...
def _upload_as_item(local_file, parent_folder_id, file_path, reuse_existing=False): """ Function for doing an upload of a file as an item. This should be a building block for user-level functions. :param local_file: name of local file to upload :type local_file: string :para...
[ "Function", "for", "doing", "an", "upload", "of", "a", "file", "as", "an", "item", ".", "This", "should", "be", "a", "building", "block", "for", "user", "-", "level", "functions", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L307-L328
[ "def", "_upload_as_item", "(", "local_file", ",", "parent_folder_id", ",", "file_path", ",", "reuse_existing", "=", "False", ")", ":", "current_item_id", "=", "_create_or_reuse_item", "(", "local_file", ",", "parent_folder_id", ",", "reuse_existing", ")", "_create_bit...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
_create_folder
Function for creating a remote folder and returning the id. This should be a building block for user-level functions. :param local_folder: full path to a local folder :type local_folder: string :param parent_folder_id: id of parent folder on the Midas Server instance, where the new folder will ...
pydas/api.py
def _create_folder(local_folder, parent_folder_id): """ Function for creating a remote folder and returning the id. This should be a building block for user-level functions. :param local_folder: full path to a local folder :type local_folder: string :param parent_folder_id: id of parent folder ...
def _create_folder(local_folder, parent_folder_id): """ Function for creating a remote folder and returning the id. This should be a building block for user-level functions. :param local_folder: full path to a local folder :type local_folder: string :param parent_folder_id: id of parent folder ...
[ "Function", "for", "creating", "a", "remote", "folder", "and", "returning", "the", "id", ".", "This", "should", "be", "a", "building", "block", "for", "user", "-", "level", "functions", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L331-L346
[ "def", "_create_folder", "(", "local_folder", ",", "parent_folder_id", ")", ":", "new_folder", "=", "session", ".", "communicator", ".", "create_folder", "(", "session", ".", "token", ",", "os", ".", "path", ".", "basename", "(", "local_folder", ")", ",", "p...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
_upload_folder_recursive
Function to recursively upload a folder and all of its descendants. :param local_folder: full path to local folder to be uploaded :type local_folder: string :param parent_folder_id: id of parent folder on the Midas Server instance, where the new folder will be added :type parent_folder_id: int ...
pydas/api.py
def _upload_folder_recursive(local_folder, parent_folder_id, leaf_folders_as_items=False, reuse_existing=False): """ Function to recursively upload a folder and all of its descendants. :param local_folder: full path to l...
def _upload_folder_recursive(local_folder, parent_folder_id, leaf_folders_as_items=False, reuse_existing=False): """ Function to recursively upload a folder and all of its descendants. :param local_folder: full path to l...
[ "Function", "to", "recursively", "upload", "a", "folder", "and", "all", "of", "its", "descendants", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L349-L394
[ "def", "_upload_folder_recursive", "(", "local_folder", ",", "parent_folder_id", ",", "leaf_folders_as_items", "=", "False", ",", "reuse_existing", "=", "False", ")", ":", "if", "leaf_folders_as_items", "and", "_has_only_files", "(", "local_folder", ")", ":", "print",...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
_has_only_files
Return whether a folder contains only files. This will be False if the folder contains any subdirectories. :param local_folder: full path to the local folder :type local_folder: string :returns: True if the folder contains only files :rtype: bool
pydas/api.py
def _has_only_files(local_folder): """ Return whether a folder contains only files. This will be False if the folder contains any subdirectories. :param local_folder: full path to the local folder :type local_folder: string :returns: True if the folder contains only files :rtype: bool "...
def _has_only_files(local_folder): """ Return whether a folder contains only files. This will be False if the folder contains any subdirectories. :param local_folder: full path to the local folder :type local_folder: string :returns: True if the folder contains only files :rtype: bool "...
[ "Return", "whether", "a", "folder", "contains", "only", "files", ".", "This", "will", "be", "False", "if", "the", "folder", "contains", "any", "subdirectories", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L397-L408
[ "def", "_has_only_files", "(", "local_folder", ")", ":", "return", "not", "any", "(", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", "join", "(", "local_folder", ",", "entry", ")", ")", "for", "entry", "in", "os", ".", "listdir", "(", ...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
_upload_folder_as_item
Upload a folder as a new item. Take a folder and use its base name as the name of a new item. Then, upload its containing files into the new item as bitstreams. :param local_folder: The path to the folder to be uploaded :type local_folder: string :param parent_folder_id: The id of the destination f...
pydas/api.py
def _upload_folder_as_item(local_folder, parent_folder_id, reuse_existing=False): """ Upload a folder as a new item. Take a folder and use its base name as the name of a new item. Then, upload its containing files into the new item as bitstreams. :param local_folder: The ...
def _upload_folder_as_item(local_folder, parent_folder_id, reuse_existing=False): """ Upload a folder as a new item. Take a folder and use its base name as the name of a new item. Then, upload its containing files into the new item as bitstreams. :param local_folder: The ...
[ "Upload", "a", "folder", "as", "a", "new", "item", ".", "Take", "a", "folder", "and", "use", "its", "base", "name", "as", "the", "name", "of", "a", "new", "item", ".", "Then", "upload", "its", "containing", "files", "into", "the", "new", "item", "as"...
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L411-L438
[ "def", "_upload_folder_as_item", "(", "local_folder", ",", "parent_folder_id", ",", "reuse_existing", "=", "False", ")", ":", "item_id", "=", "_create_or_reuse_item", "(", "local_folder", ",", "parent_folder_id", ",", "reuse_existing", ")", "subdir_contents", "=", "so...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
upload
Upload a pattern of files. This will recursively walk down every tree in the file pattern to create a hierarchy on the server. As of right now, this places the file into the currently logged in user's home directory. :param file_pattern: a glob type pattern for files :type file_pattern: string :par...
pydas/api.py
def upload(file_pattern, destination='Private', leaf_folders_as_items=False, reuse_existing=False): """ Upload a pattern of files. This will recursively walk down every tree in the file pattern to create a hierarchy on the server. As of right now, this places the file into the currently logge...
def upload(file_pattern, destination='Private', leaf_folders_as_items=False, reuse_existing=False): """ Upload a pattern of files. This will recursively walk down every tree in the file pattern to create a hierarchy on the server. As of right now, this places the file into the currently logge...
[ "Upload", "a", "pattern", "of", "files", ".", "This", "will", "recursively", "walk", "down", "every", "tree", "in", "the", "file", "pattern", "to", "create", "a", "hierarchy", "on", "the", "server", ".", "As", "of", "right", "now", "this", "places", "the...
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L441-L488
[ "def", "upload", "(", "file_pattern", ",", "destination", "=", "'Private'", ",", "leaf_folders_as_items", "=", "False", ",", "reuse_existing", "=", "False", ")", ":", "session", ".", "token", "=", "verify_credentials", "(", ")", "# Logic for finding the proper folde...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
_descend_folder_for_id
Descend a path to return a folder id starting from the given folder id. :param parsed_path: a list of folders from top to bottom of a hierarchy :type parsed_path: list[string] :param folder_id: The id of the folder from which to start the descent :type folder_id: int | long :returns: The id of the ...
pydas/api.py
def _descend_folder_for_id(parsed_path, folder_id): """ Descend a path to return a folder id starting from the given folder id. :param parsed_path: a list of folders from top to bottom of a hierarchy :type parsed_path: list[string] :param folder_id: The id of the folder from which to start the desc...
def _descend_folder_for_id(parsed_path, folder_id): """ Descend a path to return a folder id starting from the given folder id. :param parsed_path: a list of folders from top to bottom of a hierarchy :type parsed_path: list[string] :param folder_id: The id of the folder from which to start the desc...
[ "Descend", "a", "path", "to", "return", "a", "folder", "id", "starting", "from", "the", "given", "folder", "id", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L491-L522
[ "def", "_descend_folder_for_id", "(", "parsed_path", ",", "folder_id", ")", ":", "if", "len", "(", "parsed_path", ")", "==", "0", ":", "return", "folder_id", "session", ".", "token", "=", "verify_credentials", "(", ")", "base_folder", "=", "session", ".", "c...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
_search_folder_for_item_or_folder
Find an item or folder matching the name. A folder will be found first if both are present. :param name: The name of the resource :type name: string :param folder_id: The folder to search within :type folder_id: int | long :returns: A tuple indicating whether the resource is an item an the id o...
pydas/api.py
def _search_folder_for_item_or_folder(name, folder_id): """ Find an item or folder matching the name. A folder will be found first if both are present. :param name: The name of the resource :type name: string :param folder_id: The folder to search within :type folder_id: int | long :ret...
def _search_folder_for_item_or_folder(name, folder_id): """ Find an item or folder matching the name. A folder will be found first if both are present. :param name: The name of the resource :type name: string :param folder_id: The folder to search within :type folder_id: int | long :ret...
[ "Find", "an", "item", "or", "folder", "matching", "the", "name", ".", "A", "folder", "will", "be", "found", "first", "if", "both", "are", "present", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L525-L548
[ "def", "_search_folder_for_item_or_folder", "(", "name", ",", "folder_id", ")", ":", "session", ".", "token", "=", "verify_credentials", "(", ")", "children", "=", "session", ".", "communicator", ".", "folder_children", "(", "session", ".", "token", ",", "folder...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
_find_resource_id_from_path
Get a folder id from a path on the server. Warning: This is NOT efficient at all. The schema for this path is: path := "/users/<name>/" | "/communities/<name>" , {<subfolder>/} name := <firstname> , "_" , <lastname> :param path: The virtual path on the server. :type path: string :returns:...
pydas/api.py
def _find_resource_id_from_path(path): """ Get a folder id from a path on the server. Warning: This is NOT efficient at all. The schema for this path is: path := "/users/<name>/" | "/communities/<name>" , {<subfolder>/} name := <firstname> , "_" , <lastname> :param path: The virtual path ...
def _find_resource_id_from_path(path): """ Get a folder id from a path on the server. Warning: This is NOT efficient at all. The schema for this path is: path := "/users/<name>/" | "/communities/<name>" , {<subfolder>/} name := <firstname> , "_" , <lastname> :param path: The virtual path ...
[ "Get", "a", "folder", "id", "from", "a", "path", "on", "the", "server", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L551-L592
[ "def", "_find_resource_id_from_path", "(", "path", ")", ":", "session", ".", "token", "=", "verify_credentials", "(", ")", "parsed_path", "=", "path", ".", "split", "(", "'/'", ")", "if", "parsed_path", "[", "-", "1", "]", "==", "''", ":", "parsed_path", ...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
_download_folder_recursive
Download a folder to the specified path along with any children. :param folder_id: The id of the target folder :type folder_id: int | long :param path: (optional) the location to download the folder :type path: string
pydas/api.py
def _download_folder_recursive(folder_id, path='.'): """ Download a folder to the specified path along with any children. :param folder_id: The id of the target folder :type folder_id: int | long :param path: (optional) the location to download the folder :type path: string """ session....
def _download_folder_recursive(folder_id, path='.'): """ Download a folder to the specified path along with any children. :param folder_id: The id of the target folder :type folder_id: int | long :param path: (optional) the location to download the folder :type path: string """ session....
[ "Download", "a", "folder", "to", "the", "specified", "path", "along", "with", "any", "children", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L595-L624
[ "def", "_download_folder_recursive", "(", "folder_id", ",", "path", "=", "'.'", ")", ":", "session", ".", "token", "=", "verify_credentials", "(", ")", "cur_folder", "=", "session", ".", "communicator", ".", "folder_get", "(", "session", ".", "token", ",", "...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
_download_item
Download the requested item to the specified path. :param item_id: The id of the item to be downloaded :type item_id: int | long :param path: (optional) the location to download the item :type path: string :param item: The dict of item info :type item: dict | None
pydas/api.py
def _download_item(item_id, path='.', item=None): """ Download the requested item to the specified path. :param item_id: The id of the item to be downloaded :type item_id: int | long :param path: (optional) the location to download the item :type path: string :param item: The dict of item i...
def _download_item(item_id, path='.', item=None): """ Download the requested item to the specified path. :param item_id: The id of the item to be downloaded :type item_id: int | long :param path: (optional) the location to download the item :type path: string :param item: The dict of item i...
[ "Download", "the", "requested", "item", "to", "the", "specified", "path", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L639-L663
[ "def", "_download_item", "(", "item_id", ",", "path", "=", "'.'", ",", "item", "=", "None", ")", ":", "session", ".", "token", "=", "verify_credentials", "(", ")", "filename", ",", "content_iter", "=", "session", ".", "communicator", ".", "download_item", ...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
download
Recursively download a file or item from the Midas Server instance. :param server_path: The location on the server to find the resource to download :type server_path: string :param local_path: The location on the client to store the downloaded data :type local_path: string
pydas/api.py
def download(server_path, local_path='.'): """ Recursively download a file or item from the Midas Server instance. :param server_path: The location on the server to find the resource to download :type server_path: string :param local_path: The location on the client to store the downloaded ...
def download(server_path, local_path='.'): """ Recursively download a file or item from the Midas Server instance. :param server_path: The location on the server to find the resource to download :type server_path: string :param local_path: The location on the client to store the downloaded ...
[ "Recursively", "download", "a", "file", "or", "item", "from", "the", "Midas", "Server", "instance", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L666-L685
[ "def", "download", "(", "server_path", ",", "local_path", "=", "'.'", ")", ":", "session", ".", "token", "=", "verify_credentials", "(", ")", "is_item", ",", "resource_id", "=", "_find_resource_id_from_path", "(", "server_path", ")", "if", "resource_id", "==", ...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
BaseDriver.request
Do the generic processing of a request to the server. If file_payload is specified, it will be PUT to the server. :param method: Desired API method :type method: string :param parameters: (optional) Parameters to pass in the HTTP body :type parameters: None | dict[string, strin...
pydas/drivers.py
def request(self, method, parameters=None, file_payload=None): """ Do the generic processing of a request to the server. If file_payload is specified, it will be PUT to the server. :param method: Desired API method :type method: string :param parameters: (optional) Para...
def request(self, method, parameters=None, file_payload=None): """ Do the generic processing of a request to the server. If file_payload is specified, it will be PUT to the server. :param method: Desired API method :type method: string :param parameters: (optional) Para...
[ "Do", "the", "generic", "processing", "of", "a", "request", "to", "the", "server", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L136-L263
[ "def", "request", "(", "self", ",", "method", ",", "parameters", "=", "None", ",", "file_payload", "=", "None", ")", ":", "method_url", "=", "self", ".", "full_url", "+", "method", "response", "=", "None", "try", ":", "if", "file_payload", ":", "response...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
BaseDriver.login_with_api_key
Login and get a token. If you do not specify a specific application, 'Default' will be used. :param email: Email address of the user :type email: string :param api_key: API key assigned to the user :type api_key: string :param application: (optional) Application designat...
pydas/drivers.py
def login_with_api_key(self, email, api_key, application='Default'): """ Login and get a token. If you do not specify a specific application, 'Default' will be used. :param email: Email address of the user :type email: string :param api_key: API key assigned to the user ...
def login_with_api_key(self, email, api_key, application='Default'): """ Login and get a token. If you do not specify a specific application, 'Default' will be used. :param email: Email address of the user :type email: string :param api_key: API key assigned to the user ...
[ "Login", "and", "get", "a", "token", ".", "If", "you", "do", "not", "specify", "a", "specific", "application", "Default", "will", "be", "used", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L265-L288
[ "def", "login_with_api_key", "(", "self", ",", "email", ",", "api_key", ",", "application", "=", "'Default'", ")", ":", "parameters", "=", "dict", "(", ")", "parameters", "[", "'email'", "]", "=", "BaseDriver", ".", "email", "=", "email", "# Cache email", ...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
CoreDriver.list_user_folders
List the folders in the users home area. :param token: A valid token for the user in question. :type token: string :returns: List of dictionaries containing folder information. :rtype: list[dict]
pydas/drivers.py
def list_user_folders(self, token): """ List the folders in the users home area. :param token: A valid token for the user in question. :type token: string :returns: List of dictionaries containing folder information. :rtype: list[dict] """ parameters = di...
def list_user_folders(self, token): """ List the folders in the users home area. :param token: A valid token for the user in question. :type token: string :returns: List of dictionaries containing folder information. :rtype: list[dict] """ parameters = di...
[ "List", "the", "folders", "in", "the", "users", "home", "area", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L331-L343
[ "def", "list_user_folders", "(", "self", ",", "token", ")", ":", "parameters", "=", "dict", "(", ")", "parameters", "[", "'token'", "]", "=", "token", "response", "=", "self", ".", "request", "(", "'midas.user.folders'", ",", "parameters", ")", "return", "...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
CoreDriver.get_default_api_key
Get the default API key for a user. :param email: The email of the user. :type email: string :param password: The user's password. :type password: string :returns: API key to confirm that it was fetched successfully. :rtype: string
pydas/drivers.py
def get_default_api_key(self, email, password): """ Get the default API key for a user. :param email: The email of the user. :type email: string :param password: The user's password. :type password: string :returns: API key to confirm that it was fetched successf...
def get_default_api_key(self, email, password): """ Get the default API key for a user. :param email: The email of the user. :type email: string :param password: The user's password. :type password: string :returns: API key to confirm that it was fetched successf...
[ "Get", "the", "default", "API", "key", "for", "a", "user", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L345-L360
[ "def", "get_default_api_key", "(", "self", ",", "email", ",", "password", ")", ":", "parameters", "=", "dict", "(", ")", "parameters", "[", "'email'", "]", "=", "email", "parameters", "[", "'password'", "]", "=", "password", "response", "=", "self", ".", ...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
CoreDriver.list_users
List the public users in the system. :param limit: (optional) The number of users to fetch. :type limit: int | long :returns: The list of users. :rtype: list[dict]
pydas/drivers.py
def list_users(self, limit=20): """ List the public users in the system. :param limit: (optional) The number of users to fetch. :type limit: int | long :returns: The list of users. :rtype: list[dict] """ parameters = dict() parameters['limit'] = l...
def list_users(self, limit=20): """ List the public users in the system. :param limit: (optional) The number of users to fetch. :type limit: int | long :returns: The list of users. :rtype: list[dict] """ parameters = dict() parameters['limit'] = l...
[ "List", "the", "public", "users", "in", "the", "system", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L362-L374
[ "def", "list_users", "(", "self", ",", "limit", "=", "20", ")", ":", "parameters", "=", "dict", "(", ")", "parameters", "[", "'limit'", "]", "=", "limit", "response", "=", "self", ".", "request", "(", "'midas.user.list'", ",", "parameters", ")", "return"...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
CoreDriver.get_user_by_name
Get a user by the first and last name of that user. :param firstname: The first name of the user. :type firstname: string :param lastname: The last name of the user. :type lastname: string :returns: The user requested. :rtype: dict
pydas/drivers.py
def get_user_by_name(self, firstname, lastname): """ Get a user by the first and last name of that user. :param firstname: The first name of the user. :type firstname: string :param lastname: The last name of the user. :type lastname: string :returns: The user re...
def get_user_by_name(self, firstname, lastname): """ Get a user by the first and last name of that user. :param firstname: The first name of the user. :type firstname: string :param lastname: The last name of the user. :type lastname: string :returns: The user re...
[ "Get", "a", "user", "by", "the", "first", "and", "last", "name", "of", "that", "user", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L376-L391
[ "def", "get_user_by_name", "(", "self", ",", "firstname", ",", "lastname", ")", ":", "parameters", "=", "dict", "(", ")", "parameters", "[", "'firstname'", "]", "=", "firstname", "parameters", "[", "'lastname'", "]", "=", "lastname", "response", "=", "self",...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
CoreDriver.get_user_by_id
Get a user by the first and last name of that user. :param user_id: The id of the desired user. :type user_id: int | long :returns: The user requested. :rtype: dict
pydas/drivers.py
def get_user_by_id(self, user_id): """ Get a user by the first and last name of that user. :param user_id: The id of the desired user. :type user_id: int | long :returns: The user requested. :rtype: dict """ parameters = dict() parameters['user_id...
def get_user_by_id(self, user_id): """ Get a user by the first and last name of that user. :param user_id: The id of the desired user. :type user_id: int | long :returns: The user requested. :rtype: dict """ parameters = dict() parameters['user_id...
[ "Get", "a", "user", "by", "the", "first", "and", "last", "name", "of", "that", "user", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L393-L405
[ "def", "get_user_by_id", "(", "self", ",", "user_id", ")", ":", "parameters", "=", "dict", "(", ")", "parameters", "[", "'user_id'", "]", "=", "user_id", "response", "=", "self", ".", "request", "(", "'midas.user.get'", ",", "parameters", ")", "return", "r...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd
valid
CoreDriver.get_user_by_email
Get a user by the email of that user. :param email: The email of the desired user. :type email: string :returns: The user requested. :rtype: dict
pydas/drivers.py
def get_user_by_email(self, email): """ Get a user by the email of that user. :param email: The email of the desired user. :type email: string :returns: The user requested. :rtype: dict """ parameters = dict() parameters['email'] = email r...
def get_user_by_email(self, email): """ Get a user by the email of that user. :param email: The email of the desired user. :type email: string :returns: The user requested. :rtype: dict """ parameters = dict() parameters['email'] = email r...
[ "Get", "a", "user", "by", "the", "email", "of", "that", "user", "." ]
midasplatform/pydas
python
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L407-L419
[ "def", "get_user_by_email", "(", "self", ",", "email", ")", ":", "parameters", "=", "dict", "(", ")", "parameters", "[", "'email'", "]", "=", "email", "response", "=", "self", ".", "request", "(", "'midas.user.get'", ",", "parameters", ")", "return", "resp...
e5f9e96e754fb2dc5da187b05e4abc77a9b2affd