repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_documentation_string stringlengths 1 47.2k | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|
networks-lab/metaknowledge | metaknowledge/mkCollection.py | CollectionWithIDs.dropBadEntries | def dropBadEntries(self):
"""Removes all the bad entries from the collection
"""
self._collection = set((i for i in self if not i.bad))
self.bad = False
self.errors = {} | python | def dropBadEntries(self):
"""Removes all the bad entries from the collection
"""
self._collection = set((i for i in self if not i.bad))
self.bad = False
self.errors = {} | Removes all the bad entries from the collection | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkCollection.py#L504-L509 |
networks-lab/metaknowledge | metaknowledge/mkCollection.py | CollectionWithIDs.tags | def tags(self):
"""Creates a list of all the tags of the contained items
# Returns
`list [str]`
> A list of all the tags
"""
tags = set()
for i in self:
tags |= set(i.keys())
return tags | python | def tags(self):
"""Creates a list of all the tags of the contained items
# Returns
`list [str]`
> A list of all the tags
"""
tags = set()
for i in self:
tags |= set(i.keys())
return tags | Creates a list of all the tags of the contained items
# Returns
`list [str]`
> A list of all the tags | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkCollection.py#L511-L523 |
networks-lab/metaknowledge | metaknowledge/mkCollection.py | CollectionWithIDs.glimpse | def glimpse(self, *tags, compact = False):
"""Creates a printable table with the most frequently occurring values of each of the requested _tags_, or if none are provided the top authors, journals and citations. The table will be as wide and as tall as the terminal (or 80x24 if there is no terminal) so `print(R... | python | def glimpse(self, *tags, compact = False):
"""Creates a printable table with the most frequently occurring values of each of the requested _tags_, or if none are provided the top authors, journals and citations. The table will be as wide and as tall as the terminal (or 80x24 if there is no terminal) so `print(R... | Creates a printable table with the most frequently occurring values of each of the requested _tags_, or if none are provided the top authors, journals and citations. The table will be as wide and as tall as the terminal (or 80x24 if there is no terminal) so `print(RC.glimpse())`should always create a nice looking table... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkCollection.py#L525-L567 |
networks-lab/metaknowledge | metaknowledge/mkCollection.py | CollectionWithIDs.rankedSeries | def rankedSeries(self, tag, outputFile = None, giveCounts = True, giveRanks = False, greatestFirst = True, pandasMode = True, limitTo = None):
"""Creates an pandas dict of the ordered list of all the values of _tag_, with and ranked by their number of occurrences. A list can also be returned with the the counts... | python | def rankedSeries(self, tag, outputFile = None, giveCounts = True, giveRanks = False, greatestFirst = True, pandasMode = True, limitTo = None):
"""Creates an pandas dict of the ordered list of all the values of _tag_, with and ranked by their number of occurrences. A list can also be returned with the the counts... | Creates an pandas dict of the ordered list of all the values of _tag_, with and ranked by their number of occurrences. A list can also be returned with the the counts or ranks added or it can be written to a file.
# Parameters
_tag_ : `str`
> The tag to be ranked
_outputFile_ : `opti... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkCollection.py#L569-L663 |
networks-lab/metaknowledge | metaknowledge/mkCollection.py | CollectionWithIDs.timeSeries | def timeSeries(self, tag = None, outputFile = None, giveYears = True, greatestFirst = True, limitTo = False, pandasMode = True):
"""Creates an pandas dict of the ordered list of all the values of _tag_, with and ranked by the year the occurred in, multiple year occurrences will create multiple entries. A list c... | python | def timeSeries(self, tag = None, outputFile = None, giveYears = True, greatestFirst = True, limitTo = False, pandasMode = True):
"""Creates an pandas dict of the ordered list of all the values of _tag_, with and ranked by the year the occurred in, multiple year occurrences will create multiple entries. A list c... | Creates an pandas dict of the ordered list of all the values of _tag_, with and ranked by the year the occurred in, multiple year occurrences will create multiple entries. A list can also be returned with the the counts or years added or it can be written to a file.
If no _tag_ is given the `Records` in the co... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkCollection.py#L665-L747 |
networks-lab/metaknowledge | metaknowledge/mkCollection.py | CollectionWithIDs.cooccurrenceCounts | def cooccurrenceCounts(self, keyTag, *countedTags):
"""Counts the number of times values from any of the _countedTags_ occurs with _keyTag_. The counts are retuned as a dictionary with the values of _keyTag_ mapping to dictionaries with each of the _countedTags_ values mapping to thier counts.
# Parame... | python | def cooccurrenceCounts(self, keyTag, *countedTags):
"""Counts the number of times values from any of the _countedTags_ occurs with _keyTag_. The counts are retuned as a dictionary with the values of _keyTag_ mapping to dictionaries with each of the _countedTags_ values mapping to thier counts.
# Parame... | Counts the number of times values from any of the _countedTags_ occurs with _keyTag_. The counts are retuned as a dictionary with the values of _keyTag_ mapping to dictionaries with each of the _countedTags_ values mapping to thier counts.
# Parameters
_keyTag_ : `str`
> The tag used as the k... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkCollection.py#L749-L806 |
networks-lab/metaknowledge | metaknowledge/mkCollection.py | CollectionWithIDs.networkMultiLevel | def networkMultiLevel(self, *modes, nodeCount = True, edgeWeight = True, stemmer = None, edgeAttribute = None, nodeAttribute = None, _networkTypeString = 'n-level network'):
"""Creates a network of the objects found by any number of tags _modes_, with edges between all co-occurring values. IF you only want edge... | python | def networkMultiLevel(self, *modes, nodeCount = True, edgeWeight = True, stemmer = None, edgeAttribute = None, nodeAttribute = None, _networkTypeString = 'n-level network'):
"""Creates a network of the objects found by any number of tags _modes_, with edges between all co-occurring values. IF you only want edge... | Creates a network of the objects found by any number of tags _modes_, with edges between all co-occurring values. IF you only want edges between co-occurring values from different tags use [networkMultiMode()](#metaknowledge.CollectionWithIDs.networkMultiMode).
A **networkMultiLevel**() looks are each entry in... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkCollection.py#L808-L963 |
networks-lab/metaknowledge | metaknowledge/mkCollection.py | CollectionWithIDs.networkOneMode | def networkOneMode(self, mode, nodeCount = True, edgeWeight = True, stemmer = None, edgeAttribute = None, nodeAttribute = None):
"""Creates a network of the objects found by one tag _mode_. This is the same as [networkMultiLevel()](#metaknowledge.CollectionWithIDs.networkMultiLevel) with only one tag.
... | python | def networkOneMode(self, mode, nodeCount = True, edgeWeight = True, stemmer = None, edgeAttribute = None, nodeAttribute = None):
"""Creates a network of the objects found by one tag _mode_. This is the same as [networkMultiLevel()](#metaknowledge.CollectionWithIDs.networkMultiLevel) with only one tag.
... | Creates a network of the objects found by one tag _mode_. This is the same as [networkMultiLevel()](#metaknowledge.CollectionWithIDs.networkMultiLevel) with only one tag.
A **networkOneMode**() looks are each entry in the collection and extracts its values for the tag given by _mode_, e.g. the `'authorsFull'` ... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkCollection.py#L966-L1001 |
networks-lab/metaknowledge | metaknowledge/mkCollection.py | CollectionWithIDs.networkTwoMode | def networkTwoMode(self, tag1, tag2, directed = False, recordType = True, nodeCount = True, edgeWeight = True, stemmerTag1 = None, stemmerTag2 = None, edgeAttribute = None):
"""Creates a network of the objects found by two WOS tags _tag1_ and _tag2_, each node marked by which tag spawned it making the resultant... | python | def networkTwoMode(self, tag1, tag2, directed = False, recordType = True, nodeCount = True, edgeWeight = True, stemmerTag1 = None, stemmerTag2 = None, edgeAttribute = None):
"""Creates a network of the objects found by two WOS tags _tag1_ and _tag2_, each node marked by which tag spawned it making the resultant... | Creates a network of the objects found by two WOS tags _tag1_ and _tag2_, each node marked by which tag spawned it making the resultant graph bipartite.
A **networkTwoMode()** looks at each Record in the `RecordCollection` and extracts its values for the tags given by _tag1_ and _tag2_, e.g. the `'WC'` and `'L... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkCollection.py#L1003-L1175 |
networks-lab/metaknowledge | metaknowledge/mkCollection.py | CollectionWithIDs.networkMultiMode | def networkMultiMode(self, *tags, recordType = True, nodeCount = True, edgeWeight = True, stemmer = None, edgeAttribute = None):
"""Creates a network of the objects found by all tags in _tags_, each node is marked by which tag spawned it making the resultant graph n-partite.
A **networkMultiMode()** lo... | python | def networkMultiMode(self, *tags, recordType = True, nodeCount = True, edgeWeight = True, stemmer = None, edgeAttribute = None):
"""Creates a network of the objects found by all tags in _tags_, each node is marked by which tag spawned it making the resultant graph n-partite.
A **networkMultiMode()** lo... | Creates a network of the objects found by all tags in _tags_, each node is marked by which tag spawned it making the resultant graph n-partite.
A **networkMultiMode()** looks are each item in the collection and extracts its values for the tags given by _tags_. Then for all objects returned an edge is created b... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkCollection.py#L1177-L1308 |
networks-lab/metaknowledge | metaknowledge/diffusion.py | diffusionGraph | def diffusionGraph(source, target, weighted = True, sourceType = "raw", targetType = "raw", labelEdgesBy = None):
"""Takes in two [RecordCollections](../classes/RecordCollection.html#metaknowledge.RecordCollection) and produces a graph of the citations of _source_ by the [Records](../classes/Record.html#metaknowled... | python | def diffusionGraph(source, target, weighted = True, sourceType = "raw", targetType = "raw", labelEdgesBy = None):
"""Takes in two [RecordCollections](../classes/RecordCollection.html#metaknowledge.RecordCollection) and produces a graph of the citations of _source_ by the [Records](../classes/Record.html#metaknowled... | Takes in two [RecordCollections](../classes/RecordCollection.html#metaknowledge.RecordCollection) and produces a graph of the citations of _source_ by the [Records](../classes/Record.html#metaknowledge.Record) in _target_. By default the nodes in the are `Record` objects but this can be changed with the _sourceType_ an... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/diffusion.py#L11-L137 |
networks-lab/metaknowledge | metaknowledge/diffusion.py | diffusionCount | def diffusionCount(source, target, sourceType = "raw", extraValue = None, pandasFriendly = False, compareCounts = False, numAuthors = True, useAllAuthors = True, _ProgBar = None, extraMapping = None):
"""Takes in two [RecordCollections](../classes/RecordCollection.html#metaknowledge.RecordCollection) and produces ... | python | def diffusionCount(source, target, sourceType = "raw", extraValue = None, pandasFriendly = False, compareCounts = False, numAuthors = True, useAllAuthors = True, _ProgBar = None, extraMapping = None):
"""Takes in two [RecordCollections](../classes/RecordCollection.html#metaknowledge.RecordCollection) and produces ... | Takes in two [RecordCollections](../classes/RecordCollection.html#metaknowledge.RecordCollection) and produces a `dict` counting the citations of _source_ by the [Records](../classes/Record.html#metaknowledge.Record) of _target_. By default the `dict` uses `Record` objects as keys but this can be changed with the _sour... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/diffusion.py#L139-L349 |
networks-lab/metaknowledge | metaknowledge/diffusion.py | makeNodeID | def makeNodeID(Rec, ndType, extras = None):
"""Helper to make a node ID, extras is currently not used"""
if ndType == 'raw':
recID = Rec
else:
recID = Rec.get(ndType)
if recID is None:
pass
elif isinstance(recID, list):
recID = tuple(recID)
else:
recID = r... | python | def makeNodeID(Rec, ndType, extras = None):
"""Helper to make a node ID, extras is currently not used"""
if ndType == 'raw':
recID = Rec
else:
recID = Rec.get(ndType)
if recID is None:
pass
elif isinstance(recID, list):
recID = tuple(recID)
else:
recID = r... | Helper to make a node ID, extras is currently not used | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/diffusion.py#L351-L370 |
networks-lab/metaknowledge | metaknowledge/diffusion.py | diffusionAddCountsFromSource | def diffusionAddCountsFromSource(grph, source, target, nodeType = 'citations', extraType = None, diffusionLabel = 'DiffusionCount', extraKeys = None, countsDict = None, extraMapping = None):
"""Does a diffusion using [diffusionCount()](#metaknowledge.diffusion.diffusionCount) and updates _grph_ with it, using the n... | python | def diffusionAddCountsFromSource(grph, source, target, nodeType = 'citations', extraType = None, diffusionLabel = 'DiffusionCount', extraKeys = None, countsDict = None, extraMapping = None):
"""Does a diffusion using [diffusionCount()](#metaknowledge.diffusion.diffusionCount) and updates _grph_ with it, using the n... | Does a diffusion using [diffusionCount()](#metaknowledge.diffusion.diffusionCount) and updates _grph_ with it, using the nodes in the graph as keys in the diffusion, i.e. the source. The name of the attribute the counts are added to is given by _diffusionLabel_. If the graph is not composed of citations from the source... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/diffusion.py#L372-L442 |
networks-lab/metaknowledge | docs/mkdsupport.py | pandoc_process | def pandoc_process(app, what, name, obj, options, lines):
""""Convert docstrings in Markdown into reStructureText using pandoc
"""
if not lines:
return None
input_format = app.config.mkdsupport_use_parser
output_format = 'rst'
# Since default encoding for sphinx.ext.autodoc is unicode... | python | def pandoc_process(app, what, name, obj, options, lines):
""""Convert docstrings in Markdown into reStructureText using pandoc
"""
if not lines:
return None
input_format = app.config.mkdsupport_use_parser
output_format = 'rst'
# Since default encoding for sphinx.ext.autodoc is unicode... | Convert docstrings in Markdown into reStructureText using pandoc | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/docs/mkdsupport.py#L26-L43 |
networks-lab/metaknowledge | metaknowledge/medline/tagProcessing/specialFunctions.py | beginningPage | def beginningPage(R):
"""As pages may not be given as numbers this is the most accurate this function can be"""
p = R['PG']
if p.startswith('suppl '):
p = p[6:]
return p.split(' ')[0].split('-')[0].replace(';', '') | python | def beginningPage(R):
"""As pages may not be given as numbers this is the most accurate this function can be"""
p = R['PG']
if p.startswith('suppl '):
p = p[6:]
return p.split(' ')[0].split('-')[0].replace(';', '') | As pages may not be given as numbers this is the most accurate this function can be | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/medline/tagProcessing/specialFunctions.py#L27-L32 |
networks-lab/metaknowledge | metaknowledge/mkRecord.py | _bibFormatter | def _bibFormatter(s, maxLength):
"""Formats a string, list or number to make it good for a bib file by:
* if too long splits up the string correctly
* tries to use the best quoting characters
* expands lists into ' and ' seperated values, as per spec for authors field
Note, this does not... | python | def _bibFormatter(s, maxLength):
"""Formats a string, list or number to make it good for a bib file by:
* if too long splits up the string correctly
* tries to use the best quoting characters
* expands lists into ' and ' seperated values, as per spec for authors field
Note, this does not... | Formats a string, list or number to make it good for a bib file by:
* if too long splits up the string correctly
* tries to use the best quoting characters
* expands lists into ' and ' seperated values, as per spec for authors field
Note, this does not escape characters. LaTeX may have issue... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkRecord.py#L769-L790 |
networks-lab/metaknowledge | metaknowledge/mkRecord.py | Record.copy | def copy(self):
"""Correctly copies the `Record`
# Returns
`Record`
> A completely decoupled copy of the original
"""
c = copy.copy(self)
c._fieldDict = c._fieldDict.copy()
return c | python | def copy(self):
"""Correctly copies the `Record`
# Returns
`Record`
> A completely decoupled copy of the original
"""
c = copy.copy(self)
c._fieldDict = c._fieldDict.copy()
return c | Correctly copies the `Record`
# Returns
`Record`
> A completely decoupled copy of the original | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkRecord.py#L202-L213 |
networks-lab/metaknowledge | metaknowledge/mkRecord.py | ExtendedRecord.get | def get(self, tag, default = None, raw = False):
"""Allows access to the raw values or is an Exception safe wrapper to `__getitem__`.
# Parameters
_tag_ : `str`
> The requested tag
_default_ : `optional [Object]`
> Default `None`, the object returned when _tag_ is no... | python | def get(self, tag, default = None, raw = False):
"""Allows access to the raw values or is an Exception safe wrapper to `__getitem__`.
# Parameters
_tag_ : `str`
> The requested tag
_default_ : `optional [Object]`
> Default `None`, the object returned when _tag_ is no... | Allows access to the raw values or is an Exception safe wrapper to `__getitem__`.
# Parameters
_tag_ : `str`
> The requested tag
_default_ : `optional [Object]`
> Default `None`, the object returned when _tag_ is not found
_raw_ : `optional [bool]`
> Defaul... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkRecord.py#L366-L400 |
networks-lab/metaknowledge | metaknowledge/mkRecord.py | ExtendedRecord.values | def values(self, raw = False):
"""Like `values` for dicts but with a `raw` option
# Parameters
_raw_ : `optional [bool]`
> Default `False`, if `True` the `ValuesView` contains the raw values
# Returns
`ValuesView`
> The values of the record
"""
... | python | def values(self, raw = False):
"""Like `values` for dicts but with a `raw` option
# Parameters
_raw_ : `optional [bool]`
> Default `False`, if `True` the `ValuesView` contains the raw values
# Returns
`ValuesView`
> The values of the record
"""
... | Like `values` for dicts but with a `raw` option
# Parameters
_raw_ : `optional [bool]`
> Default `False`, if `True` the `ValuesView` contains the raw values
# Returns
`ValuesView`
> The values of the record | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkRecord.py#L402-L420 |
networks-lab/metaknowledge | metaknowledge/mkRecord.py | ExtendedRecord.items | def items(self, raw = False):
"""Like `items` for dicts but with a `raw` option
# Parameters
_raw_ : `optional [bool]`
> Default `False`, if `True` the `KeysView` contains the raw values as the values
# Returns
`KeysView`
> The key-value pairs of the record
... | python | def items(self, raw = False):
"""Like `items` for dicts but with a `raw` option
# Parameters
_raw_ : `optional [bool]`
> Default `False`, if `True` the `KeysView` contains the raw values as the values
# Returns
`KeysView`
> The key-value pairs of the record
... | Like `items` for dicts but with a `raw` option
# Parameters
_raw_ : `optional [bool]`
> Default `False`, if `True` the `KeysView` contains the raw values as the values
# Returns
`KeysView`
> The key-value pairs of the record | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkRecord.py#L424-L442 |
networks-lab/metaknowledge | metaknowledge/mkRecord.py | ExtendedRecord.getCitations | def getCitations(self, field = None, values = None, pandasFriendly = True):
"""Creates a pandas ready dict with each row a different citation and columns containing the original string, year, journal and author's name.
There are also options to filter the output citations with _field_ and _values_
... | python | def getCitations(self, field = None, values = None, pandasFriendly = True):
"""Creates a pandas ready dict with each row a different citation and columns containing the original string, year, journal and author's name.
There are also options to filter the output citations with _field_ and _values_
... | Creates a pandas ready dict with each row a different citation and columns containing the original string, year, journal and author's name.
There are also options to filter the output citations with _field_ and _values_
# Parameters
_field_ : `optional str`
> Default `None`, if given... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkRecord.py#L546-L589 |
networks-lab/metaknowledge | metaknowledge/mkRecord.py | ExtendedRecord.subDict | def subDict(self, tags, raw = False):
"""Creates a dict of values of _tags_ from the Record. The tags are the keys and the values are the values. If the tag is missing the value will be `None`.
# Parameters
_tags_ : `list[str]`
> The list of tags requested
_raw_ : `optional [... | python | def subDict(self, tags, raw = False):
"""Creates a dict of values of _tags_ from the Record. The tags are the keys and the values are the values. If the tag is missing the value will be `None`.
# Parameters
_tags_ : `list[str]`
> The list of tags requested
_raw_ : `optional [... | Creates a dict of values of _tags_ from the Record. The tags are the keys and the values are the values. If the tag is missing the value will be `None`.
# Parameters
_tags_ : `list[str]`
> The list of tags requested
_raw_ : `optional [bool]`
>default `False` if `True` the re... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkRecord.py#L591-L613 |
networks-lab/metaknowledge | metaknowledge/mkRecord.py | ExtendedRecord.createCitation | def createCitation(self, multiCite = False):
"""Creates a citation string, using the same format as other WOS citations, for the [Record](./Record.html#metaknowledge.Record) by reading the relevant special tags (`'year'`, `'J9'`, `'volume'`, `'beginningPage'`, `'DOI'`) and using it to create a [Citation](./Cita... | python | def createCitation(self, multiCite = False):
"""Creates a citation string, using the same format as other WOS citations, for the [Record](./Record.html#metaknowledge.Record) by reading the relevant special tags (`'year'`, `'J9'`, `'volume'`, `'beginningPage'`, `'DOI'`) and using it to create a [Citation](./Cita... | Creates a citation string, using the same format as other WOS citations, for the [Record](./Record.html#metaknowledge.Record) by reading the relevant special tags (`'year'`, `'J9'`, `'volume'`, `'beginningPage'`, `'DOI'`) and using it to create a [Citation](./Citation.html#metaknowledge.citation.Citation) object.
... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkRecord.py#L615-L658 |
networks-lab/metaknowledge | metaknowledge/mkRecord.py | ExtendedRecord.authGenders | def authGenders(self, countsOnly = False, fractionsMode = False, _countsTuple = False):
"""Creates a dict mapping `'Male'`, `'Female'` and `'Unknown'` to lists of the names of all the authors.
# Parameters
_countsOnly_ : `optional bool`
> Default `False`, if `True` the counts (lengths... | python | def authGenders(self, countsOnly = False, fractionsMode = False, _countsTuple = False):
"""Creates a dict mapping `'Male'`, `'Female'` and `'Unknown'` to lists of the names of all the authors.
# Parameters
_countsOnly_ : `optional bool`
> Default `False`, if `True` the counts (lengths... | Creates a dict mapping `'Male'`, `'Female'` and `'Unknown'` to lists of the names of all the authors.
# Parameters
_countsOnly_ : `optional bool`
> Default `False`, if `True` the counts (lengths of the lists) will be given instead of the lists of names
_fractionsMode_ : `optional boo... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkRecord.py#L660-L695 |
networks-lab/metaknowledge | metaknowledge/mkRecord.py | ExtendedRecord.bibString | def bibString(self, maxLength = 1000, WOSMode = False, restrictedOutput = False, niceID = True):
"""Makes a string giving the Record as a bibTex entry. If the Record is of a journal article (`PT J`) the bibtext type is set to `'article'`, otherwise it is set to `'misc'`. The ID of the entry is the WOS number an... | python | def bibString(self, maxLength = 1000, WOSMode = False, restrictedOutput = False, niceID = True):
"""Makes a string giving the Record as a bibTex entry. If the Record is of a journal article (`PT J`) the bibtext type is set to `'article'`, otherwise it is set to `'misc'`. The ID of the entry is the WOS number an... | Makes a string giving the Record as a bibTex entry. If the Record is of a journal article (`PT J`) the bibtext type is set to `'article'`, otherwise it is set to `'misc'`. The ID of the entry is the WOS number and all the Record's fields are given as entries with their long names.
**Note** This is not meant to... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/mkRecord.py#L697-L767 |
networks-lab/metaknowledge | metaknowledge/proquest/proQuestHandlers.py | proQuestParser | def proQuestParser(proFile):
"""Parses a ProQuest file, _proFile_, to extract the individual entries.
A ProQuest file has three sections, first a list of the contained entries, second the full metadata and finally a bibtex formatted entry for the record. This parser only uses the first two as the bibtex contai... | python | def proQuestParser(proFile):
"""Parses a ProQuest file, _proFile_, to extract the individual entries.
A ProQuest file has three sections, first a list of the contained entries, second the full metadata and finally a bibtex formatted entry for the record. This parser only uses the first two as the bibtex contai... | Parses a ProQuest file, _proFile_, to extract the individual entries.
A ProQuest file has three sections, first a list of the contained entries, second the full metadata and finally a bibtex formatted entry for the record. This parser only uses the first two as the bibtex contains no information the second section... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/proquest/proQuestHandlers.py#L42-L100 |
networks-lab/metaknowledge | metaknowledge/grants/nsfGrant.py | NSFGrant.getInvestigators | def getInvestigators(self, tags = None, seperator = ";", _getTag = False):
"""Returns a list of the names of investigators. The optional arguments are ignored.
# Returns
`list [str]`
> A list of all the found investigator's names
"""
if tags is None:
tags =... | python | def getInvestigators(self, tags = None, seperator = ";", _getTag = False):
"""Returns a list of the names of investigators. The optional arguments are ignored.
# Returns
`list [str]`
> A list of all the found investigator's names
"""
if tags is None:
tags =... | Returns a list of the names of investigators. The optional arguments are ignored.
# Returns
`list [str]`
> A list of all the found investigator's names | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/grants/nsfGrant.py#L22-L37 |
networks-lab/metaknowledge | metaknowledge/medline/medlineHandlers.py | medlineParser | def medlineParser(pubFile):
"""Parses a medline file, _pubFile_, to extract the individual entries as [MedlineRecords](#metaknowledge.medline.recordMedline.MedlineRecord).
A medline file is a series of entries, each entry is a series of tags. A tag is a 2 to 4 character string each tag is padded with spaces on... | python | def medlineParser(pubFile):
"""Parses a medline file, _pubFile_, to extract the individual entries as [MedlineRecords](#metaknowledge.medline.recordMedline.MedlineRecord).
A medline file is a series of entries, each entry is a series of tags. A tag is a 2 to 4 character string each tag is padded with spaces on... | Parses a medline file, _pubFile_, to extract the individual entries as [MedlineRecords](#metaknowledge.medline.recordMedline.MedlineRecord).
A medline file is a series of entries, each entry is a series of tags. A tag is a 2 to 4 character string each tag is padded with spaces on the left to make it 4 characters w... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/medline/medlineHandlers.py#L38-L89 |
networks-lab/metaknowledge | metaknowledge/genders/nameGender.py | nameStringGender | def nameStringGender(s, noExcept = False):
"""Expects `first, last`"""
global mappingDict
try:
first = s.split(', ')[1].split(' ')[0].title()
except IndexError:
if noExcept:
return 'Unknown'
else:
return GenderException("The given String: '{}' does not hav... | python | def nameStringGender(s, noExcept = False):
"""Expects `first, last`"""
global mappingDict
try:
first = s.split(', ')[1].split(' ')[0].title()
except IndexError:
if noExcept:
return 'Unknown'
else:
return GenderException("The given String: '{}' does not hav... | Expects `first, last` | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/genders/nameGender.py#L54-L66 |
networks-lab/metaknowledge | metaknowledge/journalAbbreviations/backend.py | j9urlGenerator | def j9urlGenerator(nameDict = False):
"""How to get all the urls for the WOS Journal Title Abbreviations. Each is varies by only a few characters. These are the currently in use urls they may change.
They are of the form:
> "https://images.webofknowledge.com/images/help/WOS/{VAL}_abrvjt.html"
> Where ... | python | def j9urlGenerator(nameDict = False):
"""How to get all the urls for the WOS Journal Title Abbreviations. Each is varies by only a few characters. These are the currently in use urls they may change.
They are of the form:
> "https://images.webofknowledge.com/images/help/WOS/{VAL}_abrvjt.html"
> Where ... | How to get all the urls for the WOS Journal Title Abbreviations. Each is varies by only a few characters. These are the currently in use urls they may change.
They are of the form:
> "https://images.webofknowledge.com/images/help/WOS/{VAL}_abrvjt.html"
> Where {VAL} is a capital letter or the string "0-9"... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/journalAbbreviations/backend.py#L14-L38 |
networks-lab/metaknowledge | metaknowledge/journalAbbreviations/backend.py | _j9SaveCurrent | def _j9SaveCurrent(sDir = '.'):
"""Downloads and saves all the webpages
For Backend
"""
dname = os.path.normpath(sDir + '/' + datetime.datetime.now().strftime("%Y-%m-%d_J9_AbbreviationDocs"))
if not os.path.isdir(dname):
os.mkdir(dname)
os.chdir(dname)
else:
os.chdir(dn... | python | def _j9SaveCurrent(sDir = '.'):
"""Downloads and saves all the webpages
For Backend
"""
dname = os.path.normpath(sDir + '/' + datetime.datetime.now().strftime("%Y-%m-%d_J9_AbbreviationDocs"))
if not os.path.isdir(dname):
os.mkdir(dname)
os.chdir(dname)
else:
os.chdir(dn... | Downloads and saves all the webpages
For Backend | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/journalAbbreviations/backend.py#L40-L54 |
networks-lab/metaknowledge | metaknowledge/journalAbbreviations/backend.py | _getDict | def _getDict(j9Page):
"""Parses a Journal Title Abbreviations page
Note the pages are not well formatted html as the <DT> tags are not closes so html parses (Beautiful Soup) do not work. This is a simple parser that only works on the webpages and may fail if they are changed
For Backend
"""
slines... | python | def _getDict(j9Page):
"""Parses a Journal Title Abbreviations page
Note the pages are not well formatted html as the <DT> tags are not closes so html parses (Beautiful Soup) do not work. This is a simple parser that only works on the webpages and may fail if they are changed
For Backend
"""
slines... | Parses a Journal Title Abbreviations page
Note the pages are not well formatted html as the <DT> tags are not closes so html parses (Beautiful Soup) do not work. This is a simple parser that only works on the webpages and may fail if they are changed
For Backend | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/journalAbbreviations/backend.py#L56-L79 |
networks-lab/metaknowledge | metaknowledge/journalAbbreviations/backend.py | _getCurrentj9Dict | def _getCurrentj9Dict():
"""Downloads and parses all the webpages
For Backend
"""
urls = j9urlGenerator()
j9Dict = {}
for url in urls:
d = _getDict(urllib.request.urlopen(url))
if len(d) == 0:
raise RuntimeError("Parsing failed, this is could require an update of the... | python | def _getCurrentj9Dict():
"""Downloads and parses all the webpages
For Backend
"""
urls = j9urlGenerator()
j9Dict = {}
for url in urls:
d = _getDict(urllib.request.urlopen(url))
if len(d) == 0:
raise RuntimeError("Parsing failed, this is could require an update of the... | Downloads and parses all the webpages
For Backend | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/journalAbbreviations/backend.py#L81-L93 |
networks-lab/metaknowledge | metaknowledge/journalAbbreviations/backend.py | updatej9DB | def updatej9DB(dbname = abrevDBname, saveRawHTML = False):
"""Updates the database of Journal Title Abbreviations. Requires an internet connection. The data base is saved relative to the source file not the working directory.
# Parameters
_dbname_ : `optional [str]`
> The name of the database file, d... | python | def updatej9DB(dbname = abrevDBname, saveRawHTML = False):
"""Updates the database of Journal Title Abbreviations. Requires an internet connection. The data base is saved relative to the source file not the working directory.
# Parameters
_dbname_ : `optional [str]`
> The name of the database file, d... | Updates the database of Journal Title Abbreviations. Requires an internet connection. The data base is saved relative to the source file not the working directory.
# Parameters
_dbname_ : `optional [str]`
> The name of the database file, default is "j9Abbreviations.db"
_saveRawHTML_ : `optional [boo... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/journalAbbreviations/backend.py#L95-L128 |
networks-lab/metaknowledge | metaknowledge/journalAbbreviations/backend.py | getj9dict | def getj9dict(dbname = abrevDBname, manualDB = manualDBname, returnDict ='both'):
"""Returns the dictionary of journal abbreviations mapping to a list of the associated journal names. By default the local database is used. The database is in the file _dbname_ in the same directory as this source file
# Paramet... | python | def getj9dict(dbname = abrevDBname, manualDB = manualDBname, returnDict ='both'):
"""Returns the dictionary of journal abbreviations mapping to a list of the associated journal names. By default the local database is used. The database is in the file _dbname_ in the same directory as this source file
# Paramet... | Returns the dictionary of journal abbreviations mapping to a list of the associated journal names. By default the local database is used. The database is in the file _dbname_ in the same directory as this source file
# Parameters
_dbname_ : `optional [str]`
> The name of the downloaded database file, the... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/journalAbbreviations/backend.py#L130-L172 |
networks-lab/metaknowledge | metaknowledge/journalAbbreviations/backend.py | addToDB | def addToDB(abbr = None, dbname = manualDBname):
"""Adds _abbr_ to the database of journals. The database is kept separate from the one scraped from WOS, this supersedes it. The database by default is stored with the WOS one and the name is given by `metaknowledge.journalAbbreviations.manualDBname`. To create an em... | python | def addToDB(abbr = None, dbname = manualDBname):
"""Adds _abbr_ to the database of journals. The database is kept separate from the one scraped from WOS, this supersedes it. The database by default is stored with the WOS one and the name is given by `metaknowledge.journalAbbreviations.manualDBname`. To create an em... | Adds _abbr_ to the database of journals. The database is kept separate from the one scraped from WOS, this supersedes it. The database by default is stored with the WOS one and the name is given by `metaknowledge.journalAbbreviations.manualDBname`. To create an empty database run **addToDB** without an _abbr_ argument.... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/journalAbbreviations/backend.py#L174-L199 |
networks-lab/metaknowledge | metaknowledge/journalAbbreviations/backend.py | excludeFromDB | def excludeFromDB(abbr = None, dbname = manualDBname):
"""Marks _abbr_ to be excluded the database of journals. The database is kept separate from the one scraped from WOS, this supersedes it. The database by default is stored with the WOS one and the name is given by `metaknowledge.journalAbbreviations.manualDBnam... | python | def excludeFromDB(abbr = None, dbname = manualDBname):
"""Marks _abbr_ to be excluded the database of journals. The database is kept separate from the one scraped from WOS, this supersedes it. The database by default is stored with the WOS one and the name is given by `metaknowledge.journalAbbreviations.manualDBnam... | Marks _abbr_ to be excluded the database of journals. The database is kept separate from the one scraped from WOS, this supersedes it. The database by default is stored with the WOS one and the name is given by `metaknowledge.journalAbbreviations.manualDBname`. To create an empty database run [addToDB()](#metaknowledge... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/journalAbbreviations/backend.py#L201-L226 |
networks-lab/metaknowledge | metaknowledge/WOS/tagProcessing/funcDicts.py | normalizeToTag | def normalizeToTag(val):
"""Converts tags or full names to 2 character tags, case insensitive
# Parameters
_val_: `str`
> A two character string giving the tag or its full name
# Returns
`str`
> The short name of _val_
"""
try:
val = val.upper()
except AttributeErro... | python | def normalizeToTag(val):
"""Converts tags or full names to 2 character tags, case insensitive
# Parameters
_val_: `str`
> A two character string giving the tag or its full name
# Returns
`str`
> The short name of _val_
"""
try:
val = val.upper()
except AttributeErro... | Converts tags or full names to 2 character tags, case insensitive
# Parameters
_val_: `str`
> A two character string giving the tag or its full name
# Returns
`str`
> The short name of _val_ | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/WOS/tagProcessing/funcDicts.py#L41-L66 |
networks-lab/metaknowledge | metaknowledge/WOS/tagProcessing/funcDicts.py | normalizeToName | def normalizeToName(val):
"""Converts tags or full names to full names, case sensitive
# Parameters
_val_: `str`
> A two character string giving the tag or its full name
# Returns
`str`
> The full name of _val_
"""
if val not in tagsAndNameSet:
raise KeyError("{} is not... | python | def normalizeToName(val):
"""Converts tags or full names to full names, case sensitive
# Parameters
_val_: `str`
> A two character string giving the tag or its full name
# Returns
`str`
> The full name of _val_
"""
if val not in tagsAndNameSet:
raise KeyError("{} is not... | Converts tags or full names to full names, case sensitive
# Parameters
_val_: `str`
> A two character string giving the tag or its full name
# Returns
`str`
> The full name of _val_ | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/WOS/tagProcessing/funcDicts.py#L68-L89 |
networks-lab/metaknowledge | metaknowledge/WOS/tagProcessing/tagFunctions.py | authAddress | def authAddress(val):
"""
# The C1 Tag
extracts the address of the authors as given by WOS. **Warning** the mapping of author to address is not very good and is given in multiple ways.
# Parameters
_val_: `list[str]`
> The raw data from a WOS file
# Returns
`list[str]`
> A lis... | python | def authAddress(val):
"""
# The C1 Tag
extracts the address of the authors as given by WOS. **Warning** the mapping of author to address is not very good and is given in multiple ways.
# Parameters
_val_: `list[str]`
> The raw data from a WOS file
# Returns
`list[str]`
> A lis... | # The C1 Tag
extracts the address of the authors as given by WOS. **Warning** the mapping of author to address is not very good and is given in multiple ways.
# Parameters
_val_: `list[str]`
> The raw data from a WOS file
# Returns
`list[str]`
> A list of addresses | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/WOS/tagProcessing/tagFunctions.py#L394-L419 |
networks-lab/metaknowledge | metaknowledge/WOS/tagProcessing/tagFunctions.py | citations | def citations(val):
"""
# The CR Tag
extracts a list of all the citations in the record, the citations are the [metaknowledge.Citation](../classes/Citation.html#metaknowledge.citation.Citation) class.
# Parameters
_val_: `list[str]`
> The raw data from a WOS file
# Returns
` list[m... | python | def citations(val):
"""
# The CR Tag
extracts a list of all the citations in the record, the citations are the [metaknowledge.Citation](../classes/Citation.html#metaknowledge.citation.Citation) class.
# Parameters
_val_: `list[str]`
> The raw data from a WOS file
# Returns
` list[m... | # The CR Tag
extracts a list of all the citations in the record, the citations are the [metaknowledge.Citation](../classes/Citation.html#metaknowledge.citation.Citation) class.
# Parameters
_val_: `list[str]`
> The raw data from a WOS file
# Returns
` list[metaknowledge.Citation]`
> A... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/WOS/tagProcessing/tagFunctions.py#L505-L527 |
networks-lab/metaknowledge | metaknowledge/grants/baseGrant.py | Grant.getInvestigators | def getInvestigators(self, tags = None, seperator = ";", _getTag = False):
"""Returns a list of the names of investigators. This is done by looking (in order) for any of fields in _tags_ and splitting the strings on _seperator_. If no strings are found an empty list will be returned.
*Note* for some Gr... | python | def getInvestigators(self, tags = None, seperator = ";", _getTag = False):
"""Returns a list of the names of investigators. This is done by looking (in order) for any of fields in _tags_ and splitting the strings on _seperator_. If no strings are found an empty list will be returned.
*Note* for some Gr... | Returns a list of the names of investigators. This is done by looking (in order) for any of fields in _tags_ and splitting the strings on _seperator_. If no strings are found an empty list will be returned.
*Note* for some Grants `getInvestigators` has been overwritten and will ignore the arguments and simply ... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/grants/baseGrant.py#L32-L74 |
networks-lab/metaknowledge | metaknowledge/grants/baseGrant.py | Grant.getInstitutions | def getInstitutions(self, tags = None, seperator = ";", _getTag = False):
"""Returns a list of the names of institutions. This is done by looking (in order) for any of fields in _tags_ and splitting the strings on _seperator_ (in case of multiple institutions). If no strings are found an empty list will be retu... | python | def getInstitutions(self, tags = None, seperator = ";", _getTag = False):
"""Returns a list of the names of institutions. This is done by looking (in order) for any of fields in _tags_ and splitting the strings on _seperator_ (in case of multiple institutions). If no strings are found an empty list will be retu... | Returns a list of the names of institutions. This is done by looking (in order) for any of fields in _tags_ and splitting the strings on _seperator_ (in case of multiple institutions). If no strings are found an empty list will be returned.
*Note* for some Grants `getInstitutions` has been overwritten and will... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/grants/baseGrant.py#L76-L97 |
networks-lab/metaknowledge | metaknowledge/grants/baseGrant.py | Grant.update | def update(self, other):
"""Adds all the tag-entry pairs from _other_ to the `Grant`. If there is a conflict _other_ takes precedence.
# Parameters
_other_ : `Grant`
> Another `Grant` of the same type as _self_
"""
if type(self) != type(other):
return NotIm... | python | def update(self, other):
"""Adds all the tag-entry pairs from _other_ to the `Grant`. If there is a conflict _other_ takes precedence.
# Parameters
_other_ : `Grant`
> Another `Grant` of the same type as _self_
"""
if type(self) != type(other):
return NotIm... | Adds all the tag-entry pairs from _other_ to the `Grant`. If there is a conflict _other_ takes precedence.
# Parameters
_other_ : `Grant`
> Another `Grant` of the same type as _self_ | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/grants/baseGrant.py#L99-L114 |
networks-lab/metaknowledge | metaknowledge/grantCollection.py | GrantCollection.networkCoInvestigatorInstitution | def networkCoInvestigatorInstitution(self, targetTags = None, tagSeperator = ';', count = True, weighted = True):
"""This works the same as [networkCoInvestigator()](#metaknowledge.GrantCollection.networkCoInvestigator) see it for details."""
return self.networkCoInvestigator(targetTags = targetTags, ta... | python | def networkCoInvestigatorInstitution(self, targetTags = None, tagSeperator = ';', count = True, weighted = True):
"""This works the same as [networkCoInvestigator()](#metaknowledge.GrantCollection.networkCoInvestigator) see it for details."""
return self.networkCoInvestigator(targetTags = targetTags, ta... | This works the same as [networkCoInvestigator()](#metaknowledge.GrantCollection.networkCoInvestigator) see it for details. | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/grantCollection.py#L141-L143 |
networks-lab/metaknowledge | metaknowledge/grantCollection.py | GrantCollection.networkCoInvestigator | def networkCoInvestigator(self, targetTags = None, tagSeperator = ';', count = True, weighted = True, _institutionLevel = False):
"""Creates a co-investigator from the collection
Most grants do not have a known investigator tag so it must be provided by the user in _targetTags_ and the separator charac... | python | def networkCoInvestigator(self, targetTags = None, tagSeperator = ';', count = True, weighted = True, _institutionLevel = False):
"""Creates a co-investigator from the collection
Most grants do not have a known investigator tag so it must be provided by the user in _targetTags_ and the separator charac... | Creates a co-investigator from the collection
Most grants do not have a known investigator tag so it must be provided by the user in _targetTags_ and the separator character if it is not a semicolon should also be given.
# Parameters
> _targetTags_ : `optional list[str]`
> A list of ... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/grantCollection.py#L145-L229 |
networks-lab/metaknowledge | metaknowledge/proquest/tagProcessing/tagFunctions.py | proQuestTagToFunc | def proQuestTagToFunc(tag):
"""Takes a tag string, _tag_, and returns the processing function for its data. If their is not a predefined function returns the identity function (`lambda x : x`).
# Parameters
_tag_ : `str`
> The requested tag
# Returns
`function`
> A function to process ... | python | def proQuestTagToFunc(tag):
"""Takes a tag string, _tag_, and returns the processing function for its data. If their is not a predefined function returns the identity function (`lambda x : x`).
# Parameters
_tag_ : `str`
> The requested tag
# Returns
`function`
> A function to process ... | Takes a tag string, _tag_, and returns the processing function for its data. If their is not a predefined function returns the identity function (`lambda x : x`).
# Parameters
_tag_ : `str`
> The requested tag
# Returns
`function`
> A function to process the tag's data | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/proquest/tagProcessing/tagFunctions.py#L45-L65 |
networks-lab/metaknowledge | metaknowledge/scopus/recordScopus.py | scopusRecordParser | def scopusRecordParser(record, header = None):
"""The parser [ScopusRecords](../classes/ScopusRecord.html#metaknowledge.scopus.ScopusRecord) use. This takes a line from [scopusParser()](#metaknowledge.scopus.scopusHandlers.scopusParser) and parses it as a part of the creation of a `ScopusRecord`.
**Note** this... | python | def scopusRecordParser(record, header = None):
"""The parser [ScopusRecords](../classes/ScopusRecord.html#metaknowledge.scopus.ScopusRecord) use. This takes a line from [scopusParser()](#metaknowledge.scopus.scopusHandlers.scopusParser) and parses it as a part of the creation of a `ScopusRecord`.
**Note** this... | The parser [ScopusRecords](../classes/ScopusRecord.html#metaknowledge.scopus.ScopusRecord) use. This takes a line from [scopusParser()](#metaknowledge.scopus.scopusHandlers.scopusParser) and parses it as a part of the creation of a `ScopusRecord`.
**Note** this is for csv files downloaded from scopus _not_ the tex... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/scopus/recordScopus.py#L169-L221 |
networks-lab/metaknowledge | metaknowledge/scopus/recordScopus.py | ScopusRecord.createCitation | def createCitation(self, multiCite = False):
"""Overwriting the general [citation creator](./ExtendedRecord.html#metaknowledge.ExtendedRecord.createCitation) to deal with scopus weirdness.
Creates a citation string, using the same format as other WOS citations, for the [Record](./Record.html#metaknowle... | python | def createCitation(self, multiCite = False):
"""Overwriting the general [citation creator](./ExtendedRecord.html#metaknowledge.ExtendedRecord.createCitation) to deal with scopus weirdness.
Creates a citation string, using the same format as other WOS citations, for the [Record](./Record.html#metaknowle... | Overwriting the general [citation creator](./ExtendedRecord.html#metaknowledge.ExtendedRecord.createCitation) to deal with scopus weirdness.
Creates a citation string, using the same format as other WOS citations, for the [Record](./Record.html#metaknowledge.Record) by reading the relevant special tags (`'year... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/scopus/recordScopus.py#L107-L164 |
networks-lab/metaknowledge | metaknowledge/WOS/wosHandlers.py | isWOSFile | def isWOSFile(infile, checkedLines = 3):
"""Determines if _infile_ is the path to a WOS file. A file is considerd to be a WOS file if it has the correct encoding (`utf-8` with a BOM) and within the first _checkedLines_ a line starts with `"VR 1.0"`.
# Parameters
_infile_ : `str`
> The path to the tar... | python | def isWOSFile(infile, checkedLines = 3):
"""Determines if _infile_ is the path to a WOS file. A file is considerd to be a WOS file if it has the correct encoding (`utf-8` with a BOM) and within the first _checkedLines_ a line starts with `"VR 1.0"`.
# Parameters
_infile_ : `str`
> The path to the tar... | Determines if _infile_ is the path to a WOS file. A file is considerd to be a WOS file if it has the correct encoding (`utf-8` with a BOM) and within the first _checkedLines_ a line starts with `"VR 1.0"`.
# Parameters
_infile_ : `str`
> The path to the targets file
_checkedLines_ : `optional [int]`... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/WOS/wosHandlers.py#L6-L34 |
networks-lab/metaknowledge | metaknowledge/WOS/wosHandlers.py | wosParser | def wosParser(isifile):
"""This is a function that is used to create [RecordCollections](../classes/RecordCollection.html#metaknowledge.RecordCollection) from files.
**wosParser**() reads the file given by the path isifile, checks that the header is correct then reads until it reaches EF. All WOS records it en... | python | def wosParser(isifile):
"""This is a function that is used to create [RecordCollections](../classes/RecordCollection.html#metaknowledge.RecordCollection) from files.
**wosParser**() reads the file given by the path isifile, checks that the header is correct then reads until it reaches EF. All WOS records it en... | This is a function that is used to create [RecordCollections](../classes/RecordCollection.html#metaknowledge.RecordCollection) from files.
**wosParser**() reads the file given by the path isifile, checks that the header is correct then reads until it reaches EF. All WOS records it encounters are parsed with [recor... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/WOS/wosHandlers.py#L36-L101 |
networks-lab/metaknowledge | metaknowledge/scopus/scopusHandlers.py | isScopusFile | def isScopusFile(infile, checkedLines = 2, maxHeaderDiff = 3):
"""Determines if _infile_ is the path to a Scopus csv file. A file is considerd to be a Scopus file if it has the correct encoding (`utf-8` with BOM (Byte Order Mark)) and within the first _checkedLines_ a line contains the complete header, the list of ... | python | def isScopusFile(infile, checkedLines = 2, maxHeaderDiff = 3):
"""Determines if _infile_ is the path to a Scopus csv file. A file is considerd to be a Scopus file if it has the correct encoding (`utf-8` with BOM (Byte Order Mark)) and within the first _checkedLines_ a line contains the complete header, the list of ... | Determines if _infile_ is the path to a Scopus csv file. A file is considerd to be a Scopus file if it has the correct encoding (`utf-8` with BOM (Byte Order Mark)) and within the first _checkedLines_ a line contains the complete header, the list of all header entries in order is found in [`scopus.scopusHeader`](#metak... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/scopus/scopusHandlers.py#L9-L44 |
networks-lab/metaknowledge | metaknowledge/scopus/scopusHandlers.py | scopusParser | def scopusParser(scopusFile):
"""Parses a scopus file, _scopusFile_, to extract the individual lines as [ScopusRecords](../classes/ScopusRecord.html#metaknowledge.scopus.ScopusRecord).
A Scopus file is a csv (Comma-separated values) with a complete header, see [`scopus.scopusHeader`](#metaknowledge.scopus) for... | python | def scopusParser(scopusFile):
"""Parses a scopus file, _scopusFile_, to extract the individual lines as [ScopusRecords](../classes/ScopusRecord.html#metaknowledge.scopus.ScopusRecord).
A Scopus file is a csv (Comma-separated values) with a complete header, see [`scopus.scopusHeader`](#metaknowledge.scopus) for... | Parses a scopus file, _scopusFile_, to extract the individual lines as [ScopusRecords](../classes/ScopusRecord.html#metaknowledge.scopus.ScopusRecord).
A Scopus file is a csv (Comma-separated values) with a complete header, see [`scopus.scopusHeader`](#metaknowledge.scopus) for the entries, and each line after it ... | https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/scopus/scopusHandlers.py#L46-L85 |
kxgames/glooey | glooey/drawing/grid.py | make_grid | def make_grid(rect, cells={}, num_rows=0, num_cols=0, padding=None,
inner_padding=None, outer_padding=None, row_heights={}, col_widths={},
default_row_height='expand', default_col_width='expand'):
"""
Return rectangles for each cell in the specified grid. The rectangles are
returned in a ... | python | def make_grid(rect, cells={}, num_rows=0, num_cols=0, padding=None,
inner_padding=None, outer_padding=None, row_heights={}, col_widths={},
default_row_height='expand', default_col_width='expand'):
"""
Return rectangles for each cell in the specified grid. The rectangles are
returned in a ... | Return rectangles for each cell in the specified grid. The rectangles are
returned in a dictionary where the keys are (row, col) tuples. | https://github.com/kxgames/glooey/blob/f0125c1f218b05cfb2efb52a88d80f54eae007a0/glooey/drawing/grid.py#L531-L551 |
kxgames/glooey | glooey/drawing/text.py | lorem_ipsum | def lorem_ipsum(num_sentences=None, num_paragraphs=None):
"""
Return the given amount of "Lorem ipsum..." text.
"""
paragraphs = [
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam justo sem, malesuada ut ultricies ac, bibendum eu neque. Lorem ipsum dolor sit amet, consectetur adipis... | python | def lorem_ipsum(num_sentences=None, num_paragraphs=None):
"""
Return the given amount of "Lorem ipsum..." text.
"""
paragraphs = [
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam justo sem, malesuada ut ultricies ac, bibendum eu neque. Lorem ipsum dolor sit amet, consectetur adipis... | Return the given amount of "Lorem ipsum..." text. | https://github.com/kxgames/glooey/blob/f0125c1f218b05cfb2efb52a88d80f54eae007a0/glooey/drawing/text.py#L3-L43 |
kxgames/glooey | glooey/widget.py | EventDispatcher.relay_events_from | def relay_events_from(self, originator, event_type, *more_event_types):
"""
Configure this handler to re-dispatch events from another handler.
This method configures this handler dispatch an event of type
*event_type* whenever *originator* dispatches events of the same type
or... | python | def relay_events_from(self, originator, event_type, *more_event_types):
"""
Configure this handler to re-dispatch events from another handler.
This method configures this handler dispatch an event of type
*event_type* whenever *originator* dispatches events of the same type
or... | Configure this handler to re-dispatch events from another handler.
This method configures this handler dispatch an event of type
*event_type* whenever *originator* dispatches events of the same type
or any of the types in *more_event_types*. Any arguments passed to the
original even... | https://github.com/kxgames/glooey/blob/f0125c1f218b05cfb2efb52a88d80f54eae007a0/glooey/widget.py#L25-L44 |
kxgames/glooey | glooey/widget.py | EventDispatcher.start_event | def start_event(self, event_type, *args, dt=1/60):
"""
Begin dispatching the given event at the given frequency.
Calling this method will cause an event of type *event_type* with
arguments *args* to be dispatched every *dt* seconds. This will
continue until `stop_event()` is ... | python | def start_event(self, event_type, *args, dt=1/60):
"""
Begin dispatching the given event at the given frequency.
Calling this method will cause an event of type *event_type* with
arguments *args* to be dispatched every *dt* seconds. This will
continue until `stop_event()` is ... | Begin dispatching the given event at the given frequency.
Calling this method will cause an event of type *event_type* with
arguments *args* to be dispatched every *dt* seconds. This will
continue until `stop_event()` is called for the same event.
These continuously firing events ar... | https://github.com/kxgames/glooey/blob/f0125c1f218b05cfb2efb52a88d80f54eae007a0/glooey/widget.py#L46-L72 |
kxgames/glooey | glooey/widget.py | EventDispatcher.stop_event | def stop_event(self, event_type):
"""
Stop dispatching the given event.
It is not an error to attempt to stop an event that was never started,
the request will just be silently ignored.
"""
if event_type in self.__timers:
pyglet.clock.unschedule(self.__timer... | python | def stop_event(self, event_type):
"""
Stop dispatching the given event.
It is not an error to attempt to stop an event that was never started,
the request will just be silently ignored.
"""
if event_type in self.__timers:
pyglet.clock.unschedule(self.__timer... | Stop dispatching the given event.
It is not an error to attempt to stop an event that was never started,
the request will just be silently ignored. | https://github.com/kxgames/glooey/blob/f0125c1f218b05cfb2efb52a88d80f54eae007a0/glooey/widget.py#L74-L82 |
kxgames/glooey | glooey/widget.py | EventDispatcher.__yield_handlers | def __yield_handlers(self, event_type):
"""
Yield all the handlers registered for the given event type.
"""
if event_type not in self.event_types:
raise ValueError("%r not found in %r.event_types == %r" % (event_type, self, self.event_types))
# Search handler stack f... | python | def __yield_handlers(self, event_type):
"""
Yield all the handlers registered for the given event type.
"""
if event_type not in self.event_types:
raise ValueError("%r not found in %r.event_types == %r" % (event_type, self, self.event_types))
# Search handler stack f... | Yield all the handlers registered for the given event type. | https://github.com/kxgames/glooey/blob/f0125c1f218b05cfb2efb52a88d80f54eae007a0/glooey/widget.py#L84-L98 |
kxgames/glooey | glooey/helpers.py | HoldUpdatesMixin._filter_pending_updates | def _filter_pending_updates(self):
"""
Return all the updates that need to be applied, from a list of all the
updates that were called while the hold was active. This method is
meant to be overridden by subclasses that want to customize how held
updates are applied.
... | python | def _filter_pending_updates(self):
"""
Return all the updates that need to be applied, from a list of all the
updates that were called while the hold was active. This method is
meant to be overridden by subclasses that want to customize how held
updates are applied.
... | Return all the updates that need to be applied, from a list of all the
updates that were called while the hold was active. This method is
meant to be overridden by subclasses that want to customize how held
updates are applied.
The `self._pending_updates` member variable is a list c... | https://github.com/kxgames/glooey/blob/f0125c1f218b05cfb2efb52a88d80f54eae007a0/glooey/helpers.py#L59-L79 |
csurfer/gitsuggest | gitsuggest/commandline.py | main | def main():
"""Starting point for the program execution."""
# Create command line parser.
parser = argparse.ArgumentParser()
# Adding command line arguments.
parser.add_argument("username", help="Github Username", default=None)
parser.add_argument(
"--deep_dive",
help=" ".join... | python | def main():
"""Starting point for the program execution."""
# Create command line parser.
parser = argparse.ArgumentParser()
# Adding command line arguments.
parser.add_argument("username", help="Github Username", default=None)
parser.add_argument(
"--deep_dive",
help=" ".join... | Starting point for the program execution. | https://github.com/csurfer/gitsuggest/blob/02efdbf50acb094e502aef9c139dde62676455ee/gitsuggest/commandline.py#L40-L129 |
csurfer/gitsuggest | gitsuggest/utilities.py | ReposToHTML.get_html | def get_html(self):
"""Method to convert the repository list to a search results page."""
here = path.abspath(path.dirname(__file__))
env = Environment(loader=FileSystemLoader(path.join(here, "res/")))
suggest = env.get_template("suggest.htm.j2")
return suggest.render(
... | python | def get_html(self):
"""Method to convert the repository list to a search results page."""
here = path.abspath(path.dirname(__file__))
env = Environment(loader=FileSystemLoader(path.join(here, "res/")))
suggest = env.get_template("suggest.htm.j2")
return suggest.render(
... | Method to convert the repository list to a search results page. | https://github.com/csurfer/gitsuggest/blob/02efdbf50acb094e502aef9c139dde62676455ee/gitsuggest/utilities.py#L26-L37 |
csurfer/gitsuggest | gitsuggest/utilities.py | ReposToHTML.to_html | def to_html(self, write_to):
"""Method to convert the repository list to a search results page and
write it to a HTML file.
:param write_to: File/Path to write the html file to.
"""
page_html = self.get_html()
with open(write_to, "wb") as writefile:
writefil... | python | def to_html(self, write_to):
"""Method to convert the repository list to a search results page and
write it to a HTML file.
:param write_to: File/Path to write the html file to.
"""
page_html = self.get_html()
with open(write_to, "wb") as writefile:
writefil... | Method to convert the repository list to a search results page and
write it to a HTML file.
:param write_to: File/Path to write the html file to. | https://github.com/csurfer/gitsuggest/blob/02efdbf50acb094e502aef9c139dde62676455ee/gitsuggest/utilities.py#L39-L48 |
csurfer/gitsuggest | gitsuggest/suggest.py | GitSuggest.get_unique_repositories | def get_unique_repositories(repo_list):
"""Method to create unique list of repositories from the list of
repositories given.
:param repo_list: List of repositories which might contain duplicates.
:return: List of repositories with no duplicate in them.
"""
unique_list = ... | python | def get_unique_repositories(repo_list):
"""Method to create unique list of repositories from the list of
repositories given.
:param repo_list: List of repositories which might contain duplicates.
:return: List of repositories with no duplicate in them.
"""
unique_list = ... | Method to create unique list of repositories from the list of
repositories given.
:param repo_list: List of repositories which might contain duplicates.
:return: List of repositories with no duplicate in them. | https://github.com/csurfer/gitsuggest/blob/02efdbf50acb094e502aef9c139dde62676455ee/gitsuggest/suggest.py#L74-L87 |
csurfer/gitsuggest | gitsuggest/suggest.py | GitSuggest.minus | def minus(repo_list_a, repo_list_b):
"""Method to create a list of repositories such that the repository
belongs to repo list a but not repo list b.
In an ideal scenario we should be able to do this by set(a) - set(b)
but as GithubRepositories have shown that set() on them is not reliab... | python | def minus(repo_list_a, repo_list_b):
"""Method to create a list of repositories such that the repository
belongs to repo list a but not repo list b.
In an ideal scenario we should be able to do this by set(a) - set(b)
but as GithubRepositories have shown that set() on them is not reliab... | Method to create a list of repositories such that the repository
belongs to repo list a but not repo list b.
In an ideal scenario we should be able to do this by set(a) - set(b)
but as GithubRepositories have shown that set() on them is not reliable
resort to this until it is all sorted... | https://github.com/csurfer/gitsuggest/blob/02efdbf50acb094e502aef9c139dde62676455ee/gitsuggest/suggest.py#L90-L112 |
csurfer/gitsuggest | gitsuggest/suggest.py | GitSuggest.__populate_repositories_of_interest | def __populate_repositories_of_interest(self, username):
"""Method to populate repositories which will be used to suggest
repositories for the user. For this purpose we use two kinds of
repositories.
1. Repositories starred by user him/herself.
2. Repositories starred by the use... | python | def __populate_repositories_of_interest(self, username):
"""Method to populate repositories which will be used to suggest
repositories for the user. For this purpose we use two kinds of
repositories.
1. Repositories starred by user him/herself.
2. Repositories starred by the use... | Method to populate repositories which will be used to suggest
repositories for the user. For this purpose we use two kinds of
repositories.
1. Repositories starred by user him/herself.
2. Repositories starred by the users followed by the user.
:param username: Username for the ... | https://github.com/csurfer/gitsuggest/blob/02efdbf50acb094e502aef9c139dde62676455ee/gitsuggest/suggest.py#L114-L136 |
csurfer/gitsuggest | gitsuggest/suggest.py | GitSuggest.__get_interests | def __get_interests(self):
"""Method to procure description of repositories the authenticated user
is interested in.
We currently attribute interest to:
1. The repositories the authenticated user has starred.
2. The repositories the users the authenticated user follows have
... | python | def __get_interests(self):
"""Method to procure description of repositories the authenticated user
is interested in.
We currently attribute interest to:
1. The repositories the authenticated user has starred.
2. The repositories the users the authenticated user follows have
... | Method to procure description of repositories the authenticated user
is interested in.
We currently attribute interest to:
1. The repositories the authenticated user has starred.
2. The repositories the users the authenticated user follows have
starred.
:return: List of... | https://github.com/csurfer/gitsuggest/blob/02efdbf50acb094e502aef9c139dde62676455ee/gitsuggest/suggest.py#L138-L157 |
csurfer/gitsuggest | gitsuggest/suggest.py | GitSuggest.__get_words_to_ignore | def __get_words_to_ignore(self):
"""Compiles list of all words to ignore.
:return: List of words to ignore.
"""
# Stop words in English.
english_stopwords = stopwords.words("english")
here = path.abspath(path.dirname(__file__))
# Languages in git repositories.
... | python | def __get_words_to_ignore(self):
"""Compiles list of all words to ignore.
:return: List of words to ignore.
"""
# Stop words in English.
english_stopwords = stopwords.words("english")
here = path.abspath(path.dirname(__file__))
# Languages in git repositories.
... | Compiles list of all words to ignore.
:return: List of words to ignore. | https://github.com/csurfer/gitsuggest/blob/02efdbf50acb094e502aef9c139dde62676455ee/gitsuggest/suggest.py#L159-L181 |
csurfer/gitsuggest | gitsuggest/suggest.py | GitSuggest.__clean_and_tokenize | def __clean_and_tokenize(self, doc_list):
"""Method to clean and tokenize the document list.
:param doc_list: Document list to clean and tokenize.
:return: Cleaned and tokenized document list.
"""
# Some repositories fill entire documentation in description. We ignore
# ... | python | def __clean_and_tokenize(self, doc_list):
"""Method to clean and tokenize the document list.
:param doc_list: Document list to clean and tokenize.
:return: Cleaned and tokenized document list.
"""
# Some repositories fill entire documentation in description. We ignore
# ... | Method to clean and tokenize the document list.
:param doc_list: Document list to clean and tokenize.
:return: Cleaned and tokenized document list. | https://github.com/csurfer/gitsuggest/blob/02efdbf50acb094e502aef9c139dde62676455ee/gitsuggest/suggest.py#L190-L233 |
csurfer/gitsuggest | gitsuggest/suggest.py | GitSuggest.__construct_lda_model | def __construct_lda_model(self):
"""Method to create LDA model to procure list of topics from.
We do that by first fetching the descriptions of repositories user has
shown interest in. We tokenize the hence fetched descriptions to
procure list of cleaned tokens by dropping all the stop ... | python | def __construct_lda_model(self):
"""Method to create LDA model to procure list of topics from.
We do that by first fetching the descriptions of repositories user has
shown interest in. We tokenize the hence fetched descriptions to
procure list of cleaned tokens by dropping all the stop ... | Method to create LDA model to procure list of topics from.
We do that by first fetching the descriptions of repositories user has
shown interest in. We tokenize the hence fetched descriptions to
procure list of cleaned tokens by dropping all the stop words and
language names from it.
... | https://github.com/csurfer/gitsuggest/blob/02efdbf50acb094e502aef9c139dde62676455ee/gitsuggest/suggest.py#L235-L267 |
csurfer/gitsuggest | gitsuggest/suggest.py | GitSuggest.__get_query_for_repos | def __get_query_for_repos(self, term_count=5):
"""Method to procure query based on topics authenticated user is
interested in.
:param term_count: Count of terms in query.
:return: Query string.
"""
repo_query_terms = list()
for term in self.lda_model.get_topic_te... | python | def __get_query_for_repos(self, term_count=5):
"""Method to procure query based on topics authenticated user is
interested in.
:param term_count: Count of terms in query.
:return: Query string.
"""
repo_query_terms = list()
for term in self.lda_model.get_topic_te... | Method to procure query based on topics authenticated user is
interested in.
:param term_count: Count of terms in query.
:return: Query string. | https://github.com/csurfer/gitsuggest/blob/02efdbf50acb094e502aef9c139dde62676455ee/gitsuggest/suggest.py#L269-L279 |
csurfer/gitsuggest | gitsuggest/suggest.py | GitSuggest.get_suggested_repositories | def get_suggested_repositories(self):
"""Method to procure suggested repositories for the user.
:return: Iterator to procure suggested repositories for the user.
"""
if self.suggested_repositories is None:
# Procure repositories to suggest to user.
repository_set... | python | def get_suggested_repositories(self):
"""Method to procure suggested repositories for the user.
:return: Iterator to procure suggested repositories for the user.
"""
if self.suggested_repositories is None:
# Procure repositories to suggest to user.
repository_set... | Method to procure suggested repositories for the user.
:return: Iterator to procure suggested repositories for the user. | https://github.com/csurfer/gitsuggest/blob/02efdbf50acb094e502aef9c139dde62676455ee/gitsuggest/suggest.py#L296-L339 |
bcicen/wikitables | wikitables/util.py | guess_type | def guess_type(s):
""" attempt to convert string value into numeric type """
sc = s.replace(',', '') # remove comma from potential numbers
try:
return int(sc)
except ValueError:
pass
try:
return float(sc)
except ValueError:
pass
return s | python | def guess_type(s):
""" attempt to convert string value into numeric type """
sc = s.replace(',', '') # remove comma from potential numbers
try:
return int(sc)
except ValueError:
pass
try:
return float(sc)
except ValueError:
pass
return s | attempt to convert string value into numeric type | https://github.com/bcicen/wikitables/blob/055cbabaa60762edbab78bf6a76ba19875f328f7/wikitables/util.py#L15-L29 |
bcicen/wikitables | wikitables/readers.py | FieldReader.parse | def parse(self, node):
"""
Return generator yielding Field objects for a given node
"""
self._attrs = {}
vals = []
yielded = False
for x in self._read_parts(node):
if isinstance(x, Field):
yielded = True
x.attrs = self.... | python | def parse(self, node):
"""
Return generator yielding Field objects for a given node
"""
self._attrs = {}
vals = []
yielded = False
for x in self._read_parts(node):
if isinstance(x, Field):
yielded = True
x.attrs = self.... | Return generator yielding Field objects for a given node | https://github.com/bcicen/wikitables/blob/055cbabaa60762edbab78bf6a76ba19875f328f7/wikitables/readers.py#L21-L43 |
bcicen/wikitables | wikitables/readers.py | RowReader.parse | def parse(self, *nodes):
"""
Parse one or more `tr` nodes, yielding wikitables.Row objects
"""
for n in nodes:
if not n.contents:
continue
row = self._parse(n)
if not row.is_null:
yield row | python | def parse(self, *nodes):
"""
Parse one or more `tr` nodes, yielding wikitables.Row objects
"""
for n in nodes:
if not n.contents:
continue
row = self._parse(n)
if not row.is_null:
yield row | Parse one or more `tr` nodes, yielding wikitables.Row objects | https://github.com/bcicen/wikitables/blob/055cbabaa60762edbab78bf6a76ba19875f328f7/wikitables/readers.py#L102-L111 |
bcicen/wikitables | wikitables/__init__.py | WikiTable._find_header_flat | def _find_header_flat(self):
"""
Find header elements in a table, if possible. This case handles
situations where '<th>' elements are not within a row('<tr>')
"""
nodes = self._node.contents.filter_tags(
matches=ftag('th'), recursive=False)
if not node... | python | def _find_header_flat(self):
"""
Find header elements in a table, if possible. This case handles
situations where '<th>' elements are not within a row('<tr>')
"""
nodes = self._node.contents.filter_tags(
matches=ftag('th'), recursive=False)
if not node... | Find header elements in a table, if possible. This case handles
situations where '<th>' elements are not within a row('<tr>') | https://github.com/bcicen/wikitables/blob/055cbabaa60762edbab78bf6a76ba19875f328f7/wikitables/__init__.py#L80-L90 |
bcicen/wikitables | wikitables/__init__.py | WikiTable._find_header_row | def _find_header_row(self):
"""
Evaluate all rows and determine header position, based on
greatest number of 'th' tagged elements
"""
th_max = 0
header_idx = 0
for idx, tr in enumerate(self._tr_nodes):
th_count = len(tr.contents.filter_tags(matches=fta... | python | def _find_header_row(self):
"""
Evaluate all rows and determine header position, based on
greatest number of 'th' tagged elements
"""
th_max = 0
header_idx = 0
for idx, tr in enumerate(self._tr_nodes):
th_count = len(tr.contents.filter_tags(matches=fta... | Evaluate all rows and determine header position, based on
greatest number of 'th' tagged elements | https://github.com/bcicen/wikitables/blob/055cbabaa60762edbab78bf6a76ba19875f328f7/wikitables/__init__.py#L92-L112 |
bcicen/wikitables | wikitables/__init__.py | WikiTable._make_default_header | def _make_default_header(self):
"""
Return a generic placeholder header based on the tables column count
"""
td_max = 0
for idx, tr in enumerate(self._tr_nodes):
td_count = len(tr.contents.filter_tags(matches=ftag('td')))
if td_count > td_max:
... | python | def _make_default_header(self):
"""
Return a generic placeholder header based on the tables column count
"""
td_max = 0
for idx, tr in enumerate(self._tr_nodes):
td_count = len(tr.contents.filter_tags(matches=ftag('td')))
if td_count > td_max:
... | Return a generic placeholder header based on the tables column count | https://github.com/bcicen/wikitables/blob/055cbabaa60762edbab78bf6a76ba19875f328f7/wikitables/__init__.py#L114-L126 |
bcicen/wikitables | wikitables/client.py | Client.fetch_page | def fetch_page(self, title, method='GET'):
""" Query for page by title """
params = { 'prop': 'revisions',
'format': 'json',
'action': 'query',
'explaintext': '',
'titles': title,
'rvprop': 'content' }
... | python | def fetch_page(self, title, method='GET'):
""" Query for page by title """
params = { 'prop': 'revisions',
'format': 'json',
'action': 'query',
'explaintext': '',
'titles': title,
'rvprop': 'content' }
... | Query for page by title | https://github.com/bcicen/wikitables/blob/055cbabaa60762edbab78bf6a76ba19875f328f7/wikitables/client.py#L16-L32 |
wooparadog/pystack | pystack.py | print_stack | def print_stack(pid, include_greenlet=False, debugger=None, verbose=False):
"""Executes a file in a running Python process."""
# TextIOWrapper of Python 3 is so strange.
sys_stdout = getattr(sys.stdout, 'buffer', sys.stdout)
sys_stderr = getattr(sys.stderr, 'buffer', sys.stderr)
make_args = make_gd... | python | def print_stack(pid, include_greenlet=False, debugger=None, verbose=False):
"""Executes a file in a running Python process."""
# TextIOWrapper of Python 3 is so strange.
sys_stdout = getattr(sys.stdout, 'buffer', sys.stdout)
sys_stderr = getattr(sys.stderr, 'buffer', sys.stderr)
make_args = make_gd... | Executes a file in a running Python process. | https://github.com/wooparadog/pystack/blob/1ee5bb0ab516f60dd407d7b18d2faa752a8e289c/pystack.py#L77-L116 |
wooparadog/pystack | pystack.py | cli_main | def cli_main(pid, include_greenlet, debugger, verbose):
'''Print stack of python process.
$ pystack <pid>
'''
try:
print_stack(pid, include_greenlet, debugger, verbose)
except DebuggerNotFound as e:
click.echo('DebuggerNotFound: %s' % e.args[0], err=True)
click.get_current_c... | python | def cli_main(pid, include_greenlet, debugger, verbose):
'''Print stack of python process.
$ pystack <pid>
'''
try:
print_stack(pid, include_greenlet, debugger, verbose)
except DebuggerNotFound as e:
click.echo('DebuggerNotFound: %s' % e.args[0], err=True)
click.get_current_c... | Print stack of python process.
$ pystack <pid> | https://github.com/wooparadog/pystack/blob/1ee5bb0ab516f60dd407d7b18d2faa752a8e289c/pystack.py#L131-L140 |
rahul13ramesh/hidden_markov | hidden_markov/hmm_class.py | hmm.forward_algo | def forward_algo(self,observations):
""" Finds the probability of an observation sequence for given model parameters
**Arguments**:
:param observations: The observation sequence, where each element belongs to 'observations' variable declared with __init__ object.
:type observations: A... | python | def forward_algo(self,observations):
""" Finds the probability of an observation sequence for given model parameters
**Arguments**:
:param observations: The observation sequence, where each element belongs to 'observations' variable declared with __init__ object.
:type observations: A... | Finds the probability of an observation sequence for given model parameters
**Arguments**:
:param observations: The observation sequence, where each element belongs to 'observations' variable declared with __init__ object.
:type observations: A list or tuple
:return: The probability ... | https://github.com/rahul13ramesh/hidden_markov/blob/6ba6012665f9e09c980ff70901604d051ba57dcc/hidden_markov/hmm_class.py#L144-L190 |
rahul13ramesh/hidden_markov | hidden_markov/hmm_class.py | hmm.viterbi | def viterbi(self,observations):
""" The probability of occurence of the observation sequence
**Arguments**:
:param observations: The observation sequence, where each element belongs to 'observations' variable declared with __init__ object.
:type observations: A list or tuple
... | python | def viterbi(self,observations):
""" The probability of occurence of the observation sequence
**Arguments**:
:param observations: The observation sequence, where each element belongs to 'observations' variable declared with __init__ object.
:type observations: A list or tuple
... | The probability of occurence of the observation sequence
**Arguments**:
:param observations: The observation sequence, where each element belongs to 'observations' variable declared with __init__ object.
:type observations: A list or tuple
:return: Returns a list of hidden states.
... | https://github.com/rahul13ramesh/hidden_markov/blob/6ba6012665f9e09c980ff70901604d051ba57dcc/hidden_markov/hmm_class.py#L194-L277 |
rahul13ramesh/hidden_markov | hidden_markov/hmm_class.py | hmm.train_hmm | def train_hmm(self,observation_list, iterations, quantities):
""" Runs the Baum Welch Algorithm and finds the new model parameters
**Arguments**:
:param observation_list: A nested list, or a list of lists
:type observation_list: Contains a list multiple observation sequences.
... | python | def train_hmm(self,observation_list, iterations, quantities):
""" Runs the Baum Welch Algorithm and finds the new model parameters
**Arguments**:
:param observation_list: A nested list, or a list of lists
:type observation_list: Contains a list multiple observation sequences.
... | Runs the Baum Welch Algorithm and finds the new model parameters
**Arguments**:
:param observation_list: A nested list, or a list of lists
:type observation_list: Contains a list multiple observation sequences.
:param iterations: Maximum number of iterations for the algorithm
... | https://github.com/rahul13ramesh/hidden_markov/blob/6ba6012665f9e09c980ff70901604d051ba57dcc/hidden_markov/hmm_class.py#L281-L363 |
rahul13ramesh/hidden_markov | hidden_markov/hmm_class.py | hmm.log_prob | def log_prob(self,observations_list, quantities):
""" Finds Weighted log probability of a list of observation sequences
**Arguments**:
:param observation_list: A nested list, or a list of lists
:type observation_list: Contains a list multiple observation sequences.
:param ... | python | def log_prob(self,observations_list, quantities):
""" Finds Weighted log probability of a list of observation sequences
**Arguments**:
:param observation_list: A nested list, or a list of lists
:type observation_list: Contains a list multiple observation sequences.
:param ... | Finds Weighted log probability of a list of observation sequences
**Arguments**:
:param observation_list: A nested list, or a list of lists
:type observation_list: Contains a list multiple observation sequences.
:param quantities: Number of times, each corresponding item in 'obser... | https://github.com/rahul13ramesh/hidden_markov/blob/6ba6012665f9e09c980ff70901604d051ba57dcc/hidden_markov/hmm_class.py#L513-L555 |
mortada/fredapi | fredapi/fred.py | Fred.__fetch_data | def __fetch_data(self, url):
"""
helper function for fetching data given a request URL
"""
url += '&api_key=' + self.api_key
try:
response = urlopen(url)
root = ET.fromstring(response.read())
except HTTPError as exc:
root = ET.fromstrin... | python | def __fetch_data(self, url):
"""
helper function for fetching data given a request URL
"""
url += '&api_key=' + self.api_key
try:
response = urlopen(url)
root = ET.fromstring(response.read())
except HTTPError as exc:
root = ET.fromstrin... | helper function for fetching data given a request URL | https://github.com/mortada/fredapi/blob/d3ca79efccb9525f2752a0d6da90e793e87c3fd8/fredapi/fred.py#L58-L69 |
mortada/fredapi | fredapi/fred.py | Fred._parse | def _parse(self, date_str, format='%Y-%m-%d'):
"""
helper function for parsing FRED date string into datetime
"""
rv = pd.to_datetime(date_str, format=format)
if hasattr(rv, 'to_pydatetime'):
rv = rv.to_pydatetime()
return rv | python | def _parse(self, date_str, format='%Y-%m-%d'):
"""
helper function for parsing FRED date string into datetime
"""
rv = pd.to_datetime(date_str, format=format)
if hasattr(rv, 'to_pydatetime'):
rv = rv.to_pydatetime()
return rv | helper function for parsing FRED date string into datetime | https://github.com/mortada/fredapi/blob/d3ca79efccb9525f2752a0d6da90e793e87c3fd8/fredapi/fred.py#L71-L78 |
mortada/fredapi | fredapi/fred.py | Fred.get_series_info | def get_series_info(self, series_id):
"""
Get information about a series such as its title, frequency, observation start/end dates, units, notes, etc.
Parameters
----------
series_id : str
Fred series id such as 'CPIAUCSL'
Returns
-------
inf... | python | def get_series_info(self, series_id):
"""
Get information about a series such as its title, frequency, observation start/end dates, units, notes, etc.
Parameters
----------
series_id : str
Fred series id such as 'CPIAUCSL'
Returns
-------
inf... | Get information about a series such as its title, frequency, observation start/end dates, units, notes, etc.
Parameters
----------
series_id : str
Fred series id such as 'CPIAUCSL'
Returns
-------
info : Series
a pandas Series containing informat... | https://github.com/mortada/fredapi/blob/d3ca79efccb9525f2752a0d6da90e793e87c3fd8/fredapi/fred.py#L80-L99 |
mortada/fredapi | fredapi/fred.py | Fred.get_series | def get_series(self, series_id, observation_start=None, observation_end=None, **kwargs):
"""
Get data for a Fred series id. This fetches the latest known data, and is equivalent to get_series_latest_release()
Parameters
----------
series_id : str
Fred series id such ... | python | def get_series(self, series_id, observation_start=None, observation_end=None, **kwargs):
"""
Get data for a Fred series id. This fetches the latest known data, and is equivalent to get_series_latest_release()
Parameters
----------
series_id : str
Fred series id such ... | Get data for a Fred series id. This fetches the latest known data, and is equivalent to get_series_latest_release()
Parameters
----------
series_id : str
Fred series id such as 'CPIAUCSL'
observation_start : datetime or datetime-like str such as '7/1/2014', optional
... | https://github.com/mortada/fredapi/blob/d3ca79efccb9525f2752a0d6da90e793e87c3fd8/fredapi/fred.py#L101-L142 |
mortada/fredapi | fredapi/fred.py | Fred.get_series_first_release | def get_series_first_release(self, series_id):
"""
Get first-release data for a Fred series id. This ignores any revision to the data series. For instance,
The US GDP for Q1 2014 was first released to be 17149.6, and then later revised to 17101.3, and 17016.0.
This will ignore revisions ... | python | def get_series_first_release(self, series_id):
"""
Get first-release data for a Fred series id. This ignores any revision to the data series. For instance,
The US GDP for Q1 2014 was first released to be 17149.6, and then later revised to 17101.3, and 17016.0.
This will ignore revisions ... | Get first-release data for a Fred series id. This ignores any revision to the data series. For instance,
The US GDP for Q1 2014 was first released to be 17149.6, and then later revised to 17101.3, and 17016.0.
This will ignore revisions after the first release.
Parameters
----------
... | https://github.com/mortada/fredapi/blob/d3ca79efccb9525f2752a0d6da90e793e87c3fd8/fredapi/fred.py#L160-L179 |
mortada/fredapi | fredapi/fred.py | Fred.get_series_as_of_date | def get_series_as_of_date(self, series_id, as_of_date):
"""
Get latest data for a Fred series id as known on a particular date. This includes any revision to the data series
before or on as_of_date, but ignores any revision on dates after as_of_date.
Parameters
----------
... | python | def get_series_as_of_date(self, series_id, as_of_date):
"""
Get latest data for a Fred series id as known on a particular date. This includes any revision to the data series
before or on as_of_date, but ignores any revision on dates after as_of_date.
Parameters
----------
... | Get latest data for a Fred series id as known on a particular date. This includes any revision to the data series
before or on as_of_date, but ignores any revision on dates after as_of_date.
Parameters
----------
series_id : str
Fred series id such as 'GDP'
as_of_dat... | https://github.com/mortada/fredapi/blob/d3ca79efccb9525f2752a0d6da90e793e87c3fd8/fredapi/fred.py#L181-L201 |
mortada/fredapi | fredapi/fred.py | Fred.get_series_all_releases | def get_series_all_releases(self, series_id):
"""
Get all data for a Fred series id including first releases and all revisions. This returns a DataFrame
with three columns: 'date', 'realtime_start', and 'value'. For instance, the US GDP for Q4 2013 was first released
to be 17102.5 on 201... | python | def get_series_all_releases(self, series_id):
"""
Get all data for a Fred series id including first releases and all revisions. This returns a DataFrame
with three columns: 'date', 'realtime_start', and 'value'. For instance, the US GDP for Q4 2013 was first released
to be 17102.5 on 201... | Get all data for a Fred series id including first releases and all revisions. This returns a DataFrame
with three columns: 'date', 'realtime_start', and 'value'. For instance, the US GDP for Q4 2013 was first released
to be 17102.5 on 2014-01-30, and then revised to 17080.7 on 2014-02-28, and then revis... | https://github.com/mortada/fredapi/blob/d3ca79efccb9525f2752a0d6da90e793e87c3fd8/fredapi/fred.py#L203-L248 |
mortada/fredapi | fredapi/fred.py | Fred.get_series_vintage_dates | def get_series_vintage_dates(self, series_id):
"""
Get a list of vintage dates for a series. Vintage dates are the dates in history when a
series' data values were revised or new data values were released.
Parameters
----------
series_id : str
Fred series id ... | python | def get_series_vintage_dates(self, series_id):
"""
Get a list of vintage dates for a series. Vintage dates are the dates in history when a
series' data values were revised or new data values were released.
Parameters
----------
series_id : str
Fred series id ... | Get a list of vintage dates for a series. Vintage dates are the dates in history when a
series' data values were revised or new data values were released.
Parameters
----------
series_id : str
Fred series id such as 'CPIAUCSL'
Returns
-------
dates :... | https://github.com/mortada/fredapi/blob/d3ca79efccb9525f2752a0d6da90e793e87c3fd8/fredapi/fred.py#L250-L272 |
mortada/fredapi | fredapi/fred.py | Fred.__do_series_search | def __do_series_search(self, url):
"""
helper function for making one HTTP request for data, and parsing the returned results into a DataFrame
"""
root = self.__fetch_data(url)
series_ids = []
data = {}
num_results_returned = 0 # number of results returned in t... | python | def __do_series_search(self, url):
"""
helper function for making one HTTP request for data, and parsing the returned results into a DataFrame
"""
root = self.__fetch_data(url)
series_ids = []
data = {}
num_results_returned = 0 # number of results returned in t... | helper function for making one HTTP request for data, and parsing the returned results into a DataFrame | https://github.com/mortada/fredapi/blob/d3ca79efccb9525f2752a0d6da90e793e87c3fd8/fredapi/fred.py#L274-L305 |
mortada/fredapi | fredapi/fred.py | Fred.__get_search_results | def __get_search_results(self, url, limit, order_by, sort_order, filter):
"""
helper function for getting search results up to specified limit on the number of results. The Fred HTTP API
truncates to 1000 results per request, so this may issue multiple HTTP requests to obtain more available data... | python | def __get_search_results(self, url, limit, order_by, sort_order, filter):
"""
helper function for getting search results up to specified limit on the number of results. The Fred HTTP API
truncates to 1000 results per request, so this may issue multiple HTTP requests to obtain more available data... | helper function for getting search results up to specified limit on the number of results. The Fred HTTP API
truncates to 1000 results per request, so this may issue multiple HTTP requests to obtain more available data. | https://github.com/mortada/fredapi/blob/d3ca79efccb9525f2752a0d6da90e793e87c3fd8/fredapi/fred.py#L307-L349 |
mortada/fredapi | fredapi/fred.py | Fred.search | def search(self, text, limit=1000, order_by=None, sort_order=None, filter=None):
"""
Do a fulltext search for series in the Fred dataset. Returns information about matching series in a DataFrame.
Parameters
----------
text : str
text to do fulltext search on, e.g., '... | python | def search(self, text, limit=1000, order_by=None, sort_order=None, filter=None):
"""
Do a fulltext search for series in the Fred dataset. Returns information about matching series in a DataFrame.
Parameters
----------
text : str
text to do fulltext search on, e.g., '... | Do a fulltext search for series in the Fred dataset. Returns information about matching series in a DataFrame.
Parameters
----------
text : str
text to do fulltext search on, e.g., 'Real GDP'
limit : int, optional
limit the number of results to this value. If lim... | https://github.com/mortada/fredapi/blob/d3ca79efccb9525f2752a0d6da90e793e87c3fd8/fredapi/fred.py#L351-L379 |
mortada/fredapi | fredapi/fred.py | Fred.search_by_release | def search_by_release(self, release_id, limit=0, order_by=None, sort_order=None, filter=None):
"""
Search for series that belongs to a release id. Returns information about matching series in a DataFrame.
Parameters
----------
release_id : int
release id, e.g., 151
... | python | def search_by_release(self, release_id, limit=0, order_by=None, sort_order=None, filter=None):
"""
Search for series that belongs to a release id. Returns information about matching series in a DataFrame.
Parameters
----------
release_id : int
release id, e.g., 151
... | Search for series that belongs to a release id. Returns information about matching series in a DataFrame.
Parameters
----------
release_id : int
release id, e.g., 151
limit : int, optional
limit the number of results to this value. If limit is 0, it means fetchin... | https://github.com/mortada/fredapi/blob/d3ca79efccb9525f2752a0d6da90e793e87c3fd8/fredapi/fred.py#L381-L410 |
mortada/fredapi | fredapi/fred.py | Fred.search_by_category | def search_by_category(self, category_id, limit=0, order_by=None, sort_order=None, filter=None):
"""
Search for series that belongs to a category id. Returns information about matching series in a DataFrame.
Parameters
----------
category_id : int
category id, e.g., ... | python | def search_by_category(self, category_id, limit=0, order_by=None, sort_order=None, filter=None):
"""
Search for series that belongs to a category id. Returns information about matching series in a DataFrame.
Parameters
----------
category_id : int
category id, e.g., ... | Search for series that belongs to a category id. Returns information about matching series in a DataFrame.
Parameters
----------
category_id : int
category id, e.g., 32145
limit : int, optional
limit the number of results to this value. If limit is 0, it means fe... | https://github.com/mortada/fredapi/blob/d3ca79efccb9525f2752a0d6da90e793e87c3fd8/fredapi/fred.py#L412-L442 |
mathiasertl/django-ca | ca/django_ca/managers.py | CertificateAuthorityManager.init | def init(self, name, subject, expires=None, algorithm=None, parent=None, pathlen=None,
issuer_url=None, issuer_alt_name='', crl_url=None, ocsp_url=None,
ca_issuer_url=None, ca_crl_url=None, ca_ocsp_url=None, name_constraints=None,
password=None, parent_password=None, ecc_curve=Non... | python | def init(self, name, subject, expires=None, algorithm=None, parent=None, pathlen=None,
issuer_url=None, issuer_alt_name='', crl_url=None, ocsp_url=None,
ca_issuer_url=None, ca_crl_url=None, ca_ocsp_url=None, name_constraints=None,
password=None, parent_password=None, ecc_curve=Non... | Create a new certificate authority.
Parameters
----------
name : str
The name of the CA. This is a human-readable string and is used for administrative purposes only.
subject : dict or str or :py:class:`~django_ca.subject.Subject`
Subject string, e.g. ``"/CN=exa... | https://github.com/mathiasertl/django-ca/blob/976d7ea05276320f20daed2a6d59c8f5660fe976/ca/django_ca/managers.py#L91-L266 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.