body_hash
stringlengths
64
64
body
stringlengths
23
109k
docstring
stringlengths
1
57k
path
stringlengths
4
198
name
stringlengths
1
115
repository_name
stringlengths
7
111
repository_stars
float64
0
191k
lang
stringclasses
1 value
body_without_docstring
stringlengths
14
108k
unified
stringlengths
45
133k
b2cc944e1a37eb004d38e2d09e53aea80d2f28f155c9411b04ab53541e4a9c4f
def traverse(self, word, first, last): '\n\n :param word: the text string where to look for the\n :param first: the fist index in the lists of the patterns and scores\n :param last: the last index in the lists of the patterns and scores\n :return: a Counter (dict) with cum...
:param word: the text string where to look for the :param first: the fist index in the lists of the patterns and scores :param last: the last index in the lists of the patterns and scores :return: a Counter (dict) with cumulative scores of each patterns of the sublist of patterns between ...
exoticst/ac_automation.py
traverse
valginer0/exotic-structures
0
python
def traverse(self, word, first, last): '\n\n :param word: the text string where to look for the\n :param first: the fist index in the lists of the patterns and scores\n :param last: the last index in the lists of the patterns and scores\n :return: a Counter (dict) with cum...
def traverse(self, word, first, last): '\n\n :param word: the text string where to look for the\n :param first: the fist index in the lists of the patterns and scores\n :param last: the last index in the lists of the patterns and scores\n :return: a Counter (dict) with cum...
35f37236a69f0a97f0fbae2ed2d0ee6bc8ff984618d8ebdabff4406e0893a157
def main(): 'Main script function.' site = pywikibot.Site() for pagename in load_page_list(NUMBER): page = pywikibot.Page(site, pagename) error = False for line in page.text.split('\n'): match = re.search('==+$', line) if (not match): continue ...
Main script function.
scripts/markers/mark_error_105.py
main
Facenapalm/NapalmBot
4
python
def main(): site = pywikibot.Site() for pagename in load_page_list(NUMBER): page = pywikibot.Page(site, pagename) error = False for line in page.text.split('\n'): match = re.search('==+$', line) if (not match): continue if line.sta...
def main(): site = pywikibot.Site() for pagename in load_page_list(NUMBER): page = pywikibot.Page(site, pagename) error = False for line in page.text.split('\n'): match = re.search('==+$', line) if (not match): continue if line.sta...
9f3ee29446578564a764197150b242ceb98cecf89f8db81f8f1d8e214426b540
def __init__(self, database: DatabaseAccessionMetabase, acs_refrep: str='tid', acs_sub_nodes: bool=False, acs_filter_method: Optional[str]=None, acs_filter_value: Optional[str]=None, **kwargs: Any): 'Mixin class constructor for :class:`.MediatorLocalAccessionMixin`\n\n Parameters\n ----------\n ...
Mixin class constructor for :class:`.MediatorLocalAccessionMixin` Parameters ---------- database Instance of :class:`~pmaf.database._core._base.DatabaseBase` and :class:`~pmaf.database._core._acs_base.DatabaseAccessionMixin` acs_refrep Taxonomy lookup level. Can be either "tid" for :term:`tids` or "rid" for :t...
pmaf/pipe/agents/mediators/_local/_components/_acs_mixin.py
__init__
mmtechslv/PhyloMAF
1
python
def __init__(self, database: DatabaseAccessionMetabase, acs_refrep: str='tid', acs_sub_nodes: bool=False, acs_filter_method: Optional[str]=None, acs_filter_value: Optional[str]=None, **kwargs: Any): 'Mixin class constructor for :class:`.MediatorLocalAccessionMixin`\n\n Parameters\n ----------\n ...
def __init__(self, database: DatabaseAccessionMetabase, acs_refrep: str='tid', acs_sub_nodes: bool=False, acs_filter_method: Optional[str]=None, acs_filter_value: Optional[str]=None, **kwargs: Any): 'Mixin class constructor for :class:`.MediatorLocalAccessionMixin`\n\n Parameters\n ----------\n ...
e7ab987f2550198a2f4bb5fac9ae8975532f3085c69797c5657f5bffa59dac9d
def get_accession_by_identifier(self, docker: DockerIdentifierMedium, factor: FactorBase, **kwargs: Any) -> DockerAccessionMedium: 'Get accession data that matches identifiers in `docker` within local\n database client.\n\n Parameters\n ----------\n docker\n A :term:`docker` :...
Get accession data that matches identifiers in `docker` within local database client. Parameters ---------- docker A :term:`docker` :term:`singleton` identifier instance factor A :term:`factor` to accommodate matching process kwargs Compatibility Returns ------- An instance of :class:`.DockerAccession...
pmaf/pipe/agents/mediators/_local/_components/_acs_mixin.py
get_accession_by_identifier
mmtechslv/PhyloMAF
1
python
def get_accession_by_identifier(self, docker: DockerIdentifierMedium, factor: FactorBase, **kwargs: Any) -> DockerAccessionMedium: 'Get accession data that matches identifiers in `docker` within local\n database client.\n\n Parameters\n ----------\n docker\n A :term:`docker` :...
def get_accession_by_identifier(self, docker: DockerIdentifierMedium, factor: FactorBase, **kwargs: Any) -> DockerAccessionMedium: 'Get accession data that matches identifiers in `docker` within local\n database client.\n\n Parameters\n ----------\n docker\n A :term:`docker` :...
2a5639cb85cba204fecd22aaaf5150c5d409073c24fe5296882d348dd169d59f
def __retrieve_accessions_by_identifier(self, docker, **kwargs): 'Actual method to retrieve accession data from identifiers.' id_array = docker.to_array(exclude_missing=True) tmp_accessions = dict.fromkeys(id_array, None) tmp_metadata = dict.fromkeys(id_array, None) if (self.configs['acs_refrep'] ==...
Actual method to retrieve accession data from identifiers.
pmaf/pipe/agents/mediators/_local/_components/_acs_mixin.py
__retrieve_accessions_by_identifier
mmtechslv/PhyloMAF
1
python
def __retrieve_accessions_by_identifier(self, docker, **kwargs): id_array = docker.to_array(exclude_missing=True) tmp_accessions = dict.fromkeys(id_array, None) tmp_metadata = dict.fromkeys(id_array, None) if (self.configs['acs_refrep'] == 'tid'): tmp_db_accessions = self.client.get_accessi...
def __retrieve_accessions_by_identifier(self, docker, **kwargs): id_array = docker.to_array(exclude_missing=True) tmp_accessions = dict.fromkeys(id_array, None) tmp_metadata = dict.fromkeys(id_array, None) if (self.configs['acs_refrep'] == 'tid'): tmp_db_accessions = self.client.get_accessi...
0cdde3744d23e5cc77e2921cbd3bbcbf5a1699a2f8518f4bb4570ceac071cbc2
def __filter_rids_from_tids_accessions(self, accs_dict): 'Filter matched accessions based on filtering configuration.' tmp_accs_dict = defaultdict(list) if ((self.configs['acs_filter_method'] == 'random') and isinstance(self.configs['acs_filter_value'], int)): if (len(accs_dict) > self.configs['acs_...
Filter matched accessions based on filtering configuration.
pmaf/pipe/agents/mediators/_local/_components/_acs_mixin.py
__filter_rids_from_tids_accessions
mmtechslv/PhyloMAF
1
python
def __filter_rids_from_tids_accessions(self, accs_dict): tmp_accs_dict = defaultdict(list) if ((self.configs['acs_filter_method'] == 'random') and isinstance(self.configs['acs_filter_value'], int)): if (len(accs_dict) > self.configs['acs_filter_value']): tmp_target_ids = np.random.choic...
def __filter_rids_from_tids_accessions(self, accs_dict): tmp_accs_dict = defaultdict(list) if ((self.configs['acs_filter_method'] == 'random') and isinstance(self.configs['acs_filter_value'], int)): if (len(accs_dict) > self.configs['acs_filter_value']): tmp_target_ids = np.random.choic...
c2d9834747ed6cd89e6dd1c0e5c107bdc50e691141e6e9e2063b77f2f249be1b
def get_identifier_by_accession(self, docker, factor, **kwargs): 'Get local database identifiers that match target accession numbers\n in `docker` within local database client.\n\n :meta private:\n\n Parameters\n ----------\n docker\n A :term:`docker` :term:`singleton` ...
Get local database identifiers that match target accession numbers in `docker` within local database client. :meta private: Parameters ---------- docker A :term:`docker` :term:`singleton` accession instance factor A :term:`factor` to accommodate matching process kwargs Compatibility Returns ------- A...
pmaf/pipe/agents/mediators/_local/_components/_acs_mixin.py
get_identifier_by_accession
mmtechslv/PhyloMAF
1
python
def get_identifier_by_accession(self, docker, factor, **kwargs): 'Get local database identifiers that match target accession numbers\n in `docker` within local database client.\n\n :meta private:\n\n Parameters\n ----------\n docker\n A :term:`docker` :term:`singleton` ...
def get_identifier_by_accession(self, docker, factor, **kwargs): 'Get local database identifiers that match target accession numbers\n in `docker` within local database client.\n\n :meta private:\n\n Parameters\n ----------\n docker\n A :term:`docker` :term:`singleton` ...
08bab5ee5b1501a63a39c8453ccb5128d61902dc5515a425fbfb372533eaefbb
def form_string(content): '\n Take a string or BufferedReader as argument and transform the string into a ProvDocument\n\n :param content: Takes a sting or BufferedReader\n :return: ProvDocument\n ' if isinstance(content, ProvDocument): return content elif isinstance(content, BufferedRea...
Take a string or BufferedReader as argument and transform the string into a ProvDocument :param content: Takes a sting or BufferedReader :return: ProvDocument
provdbconnector/utils/converter.py
form_string
Ama-Gi/prov-neo4j-covid19-track
15
python
def form_string(content): '\n Take a string or BufferedReader as argument and transform the string into a ProvDocument\n\n :param content: Takes a sting or BufferedReader\n :return: ProvDocument\n ' if isinstance(content, ProvDocument): return content elif isinstance(content, BufferedRea...
def form_string(content): '\n Take a string or BufferedReader as argument and transform the string into a ProvDocument\n\n :param content: Takes a sting or BufferedReader\n :return: ProvDocument\n ' if isinstance(content, ProvDocument): return content elif isinstance(content, BufferedRea...
6ab4009bf955ede754c829f25f6cd70c572609391172fb904119653ad5433846
def to_json(document=None): '\n Try to convert a ProvDocument into the json representation\n\n :param document:\n :type document: prov.model.ProvDocument\n :return: Json string of the document\n :rtype: str\n ' if (document is None): raise NoDocumentException() return document.seri...
Try to convert a ProvDocument into the json representation :param document: :type document: prov.model.ProvDocument :return: Json string of the document :rtype: str
provdbconnector/utils/converter.py
to_json
Ama-Gi/prov-neo4j-covid19-track
15
python
def to_json(document=None): '\n Try to convert a ProvDocument into the json representation\n\n :param document:\n :type document: prov.model.ProvDocument\n :return: Json string of the document\n :rtype: str\n ' if (document is None): raise NoDocumentException() return document.seri...
def to_json(document=None): '\n Try to convert a ProvDocument into the json representation\n\n :param document:\n :type document: prov.model.ProvDocument\n :return: Json string of the document\n :rtype: str\n ' if (document is None): raise NoDocumentException() return document.seri...
941cbafc53c0581abfeb2c386cd9ce3cae3af4ec80bbb54e95354b89d0911d2c
def from_json(json=None): '\n Try to convert a json string into a document\n\n :param json: The json str\n :type json: str\n :return: Prov Document\n :rtype: prov.model.ProvDocument\n :raise: NoDocumentException\n ' if (json is None): raise NoDocumentException() return ProvDocum...
Try to convert a json string into a document :param json: The json str :type json: str :return: Prov Document :rtype: prov.model.ProvDocument :raise: NoDocumentException
provdbconnector/utils/converter.py
from_json
Ama-Gi/prov-neo4j-covid19-track
15
python
def from_json(json=None): '\n Try to convert a json string into a document\n\n :param json: The json str\n :type json: str\n :return: Prov Document\n :rtype: prov.model.ProvDocument\n :raise: NoDocumentException\n ' if (json is None): raise NoDocumentException() return ProvDocum...
def from_json(json=None): '\n Try to convert a json string into a document\n\n :param json: The json str\n :type json: str\n :return: Prov Document\n :rtype: prov.model.ProvDocument\n :raise: NoDocumentException\n ' if (json is None): raise NoDocumentException() return ProvDocum...
5835841b3c8f88f8ee7086aae248e7aa96fb12dd30a96cfaa484172c7a443fdd
def to_provn(document=None): '\n Try to convert a document into a provn representation\n\n :param document: Prov document to convert\n :type document: prov.model.ProvDocument\n :return: The prov-n str\n :rtype: str\n :raise: NoDocumentException\n ' if (document is None): raise NoDoc...
Try to convert a document into a provn representation :param document: Prov document to convert :type document: prov.model.ProvDocument :return: The prov-n str :rtype: str :raise: NoDocumentException
provdbconnector/utils/converter.py
to_provn
Ama-Gi/prov-neo4j-covid19-track
15
python
def to_provn(document=None): '\n Try to convert a document into a provn representation\n\n :param document: Prov document to convert\n :type document: prov.model.ProvDocument\n :return: The prov-n str\n :rtype: str\n :raise: NoDocumentException\n ' if (document is None): raise NoDoc...
def to_provn(document=None): '\n Try to convert a document into a provn representation\n\n :param document: Prov document to convert\n :type document: prov.model.ProvDocument\n :return: The prov-n str\n :rtype: str\n :raise: NoDocumentException\n ' if (document is None): raise NoDoc...
91270a59ef33d647e5c08a467459e93aa25c7a3b7ddd785a58ba480d6678e25e
def from_provn(provn_str=None): '\n Try to convert a provn string into a ProvDocument\n\n :param provn_str: The string to convert\n :type provn_str: str\n :return: The Prov document\n :rtype: ProvDocument\n :raises: NoDocumentException\n ' if (provn_str is None): raise NoDocumentExc...
Try to convert a provn string into a ProvDocument :param provn_str: The string to convert :type provn_str: str :return: The Prov document :rtype: ProvDocument :raises: NoDocumentException
provdbconnector/utils/converter.py
from_provn
Ama-Gi/prov-neo4j-covid19-track
15
python
def from_provn(provn_str=None): '\n Try to convert a provn string into a ProvDocument\n\n :param provn_str: The string to convert\n :type provn_str: str\n :return: The Prov document\n :rtype: ProvDocument\n :raises: NoDocumentException\n ' if (provn_str is None): raise NoDocumentExc...
def from_provn(provn_str=None): '\n Try to convert a provn string into a ProvDocument\n\n :param provn_str: The string to convert\n :type provn_str: str\n :return: The Prov document\n :rtype: ProvDocument\n :raises: NoDocumentException\n ' if (provn_str is None): raise NoDocumentExc...
f832a7391525d90718d9bb20990d058ff0cda7acb919e0c02d4f0a584dff167d
def to_xml(document=None): '\n Try to convert a document into an xml string\n\n :param document: The ProvDocument to convert\n :param document: ProvDocument\n :return: The xml string\n :rtype: str\n ' if (document is None): raise NoDocumentException() return document.serialize(form...
Try to convert a document into an xml string :param document: The ProvDocument to convert :param document: ProvDocument :return: The xml string :rtype: str
provdbconnector/utils/converter.py
to_xml
Ama-Gi/prov-neo4j-covid19-track
15
python
def to_xml(document=None): '\n Try to convert a document into an xml string\n\n :param document: The ProvDocument to convert\n :param document: ProvDocument\n :return: The xml string\n :rtype: str\n ' if (document is None): raise NoDocumentException() return document.serialize(form...
def to_xml(document=None): '\n Try to convert a document into an xml string\n\n :param document: The ProvDocument to convert\n :param document: ProvDocument\n :return: The xml string\n :rtype: str\n ' if (document is None): raise NoDocumentException() return document.serialize(form...
6981adc01a247d0ee6d5dd9b9b32cc22c10f7412f408cbf33a9a42873eafe65d
def from_xml(xml_str=None): '\n Try to convert a xml string into a ProvDocument\n\n :param xml_str: The xml string\n :type xml_str: str\n :return: The Prov document\n :rtype: ProvDocument\n ' if (xml_str is None): raise NoDocumentException() return ProvDocument.deserialize(source=x...
Try to convert a xml string into a ProvDocument :param xml_str: The xml string :type xml_str: str :return: The Prov document :rtype: ProvDocument
provdbconnector/utils/converter.py
from_xml
Ama-Gi/prov-neo4j-covid19-track
15
python
def from_xml(xml_str=None): '\n Try to convert a xml string into a ProvDocument\n\n :param xml_str: The xml string\n :type xml_str: str\n :return: The Prov document\n :rtype: ProvDocument\n ' if (xml_str is None): raise NoDocumentException() return ProvDocument.deserialize(source=x...
def from_xml(xml_str=None): '\n Try to convert a xml string into a ProvDocument\n\n :param xml_str: The xml string\n :type xml_str: str\n :return: The Prov document\n :rtype: ProvDocument\n ' if (xml_str is None): raise NoDocumentException() return ProvDocument.deserialize(source=x...
08943a0e44e3d7d69ab14369d9aca0e4c6e70a5a26b1827d62bbe80ae8eedf89
def createDegreeMethod(self, refvertices, refpoints, dofs): ' Returns a method that will create degrees of freedom' if (len(dofs) == 0): return (lambda vertices: None) def createExternalDegree(vertices): if (len(refvertices) == 0): pullback = Pullback((lambda p: vertices[numpy.i...
Returns a method that will create degrees of freedom
src/pypyr/elements.py
createDegreeMethod
joelphillips/pypyramid
1
python
def createDegreeMethod(self, refvertices, refpoints, dofs): ' ' if (len(dofs) == 0): return (lambda vertices: None) def createExternalDegree(vertices): if (len(refvertices) == 0): pullback = Pullback((lambda p: vertices[numpy.ix_([0])])) else: map = buildaffi...
def createDegreeMethod(self, refvertices, refpoints, dofs): ' ' if (len(dofs) == 0): return (lambda vertices: None) def createExternalDegree(vertices): if (len(refvertices) == 0): pullback = Pullback((lambda p: vertices[numpy.ix_([0])])) else: map = buildaffi...
771e3bd4c82b0e83106c4036317686195b5ef85e5b3aa74ad88ccc4da4e3dd03
@app.task def run(event_type, data): 'Everything starts here.' installation_id = data['installation']['id'] owner = data['repository']['owner']['login'] repo = data['repository']['name'] client = github.get_client(owner, repo, installation_id) raw_pull = get_github_pull_from_event(client, event_...
Everything starts here.
mergify_engine/tasks/engine/__init__.py
run
Madhu-1/mergify-engine
0
python
@app.task def run(event_type, data): installation_id = data['installation']['id'] owner = data['repository']['owner']['login'] repo = data['repository']['name'] client = github.get_client(owner, repo, installation_id) raw_pull = get_github_pull_from_event(client, event_type, data) if (not r...
@app.task def run(event_type, data): installation_id = data['installation']['id'] owner = data['repository']['owner']['login'] repo = data['repository']['name'] client = github.get_client(owner, repo, installation_id) raw_pull = get_github_pull_from_event(client, event_type, data) if (not r...
b7e4a4dfd776ad2c322aba80ddd271683b742ea5bdbd8020dab252ec9caa8dec
def error(text): '\n Log error `text` and produce a RuntimeError exception\n ' if (not text.startswith('Too many queries')): print(text) logging.error('ERROR %s', text) raise RuntimeError(text)
Log error `text` and produce a RuntimeError exception
lib/globals.py
error
Guitar420/cheat.sh
2
python
def error(text): '\n \n ' if (not text.startswith('Too many queries')): print(text) logging.error('ERROR %s', text) raise RuntimeError(text)
def error(text): '\n \n ' if (not text.startswith('Too many queries')): print(text) logging.error('ERROR %s', text) raise RuntimeError(text)<|docstring|>Log error `text` and produce a RuntimeError exception<|endoftext|>
9838cf67a063d4426ab87904c332db7c1fe9b81dfe60537e2033a0412b80c54c
def log(text): "\n Log error `text` (if it does not start with 'Too many queries')\n " if (not text.startswith('Too many queries')): print(text) logging.info(text)
Log error `text` (if it does not start with 'Too many queries')
lib/globals.py
log
Guitar420/cheat.sh
2
python
def log(text): "\n \n " if (not text.startswith('Too many queries')): print(text) logging.info(text)
def log(text): "\n \n " if (not text.startswith('Too many queries')): print(text) logging.info(text)<|docstring|>Log error `text` (if it does not start with 'Too many queries')<|endoftext|>
9ab5a4a110c9ce60ef894fdd6cc24197be5f962c0a3690a67f90b6f63e30b2d9
def parse_vit(self, data): '\n Vit, mV * 25 -> 0x00 - 0xff\n e.g. data = 0xff -> 10.2 mV\n data = 0x01 -> 0.04 mV\n ' return (self.parse_number(data) * 25)
Vit, mV * 25 -> 0x00 - 0xff e.g. data = 0xff -> 10.2 mV data = 0x01 -> 0.04 mV
parsers/parser_naltec.py
parse_vit
tanupoo/lorawan-ss-as
1
python
def parse_vit(self, data): '\n Vit, mV * 25 -> 0x00 - 0xff\n e.g. data = 0xff -> 10.2 mV\n data = 0x01 -> 0.04 mV\n ' return (self.parse_number(data) * 25)
def parse_vit(self, data): '\n Vit, mV * 25 -> 0x00 - 0xff\n e.g. data = 0xff -> 10.2 mV\n data = 0x01 -> 0.04 mV\n ' return (self.parse_number(data) * 25)<|docstring|>Vit, mV * 25 -> 0x00 - 0xff e.g. data = 0xff -> 10.2 mV data = 0x01 -> 0.04 mV<|endoftext|>
04aeea922d904ae344ebbae05ea78e8e91ae46693f1f2ae2930bab2339aeddd1
def parse_temp(self, data): '\n Temp, -40 to -1 -> 0xd8 - 0xff, 0 to 125 -> 0x00 - 0x7d\n ' return self.parse_signed_number(data)
Temp, -40 to -1 -> 0xd8 - 0xff, 0 to 125 -> 0x00 - 0x7d
parsers/parser_naltec.py
parse_temp
tanupoo/lorawan-ss-as
1
python
def parse_temp(self, data): '\n \n ' return self.parse_signed_number(data)
def parse_temp(self, data): '\n \n ' return self.parse_signed_number(data)<|docstring|>Temp, -40 to -1 -> 0xd8 - 0xff, 0 to 125 -> 0x00 - 0x7d<|endoftext|>
fb7de2491bf7b0ee9370671891ed5a962528b6e5855c94406a9205f413ce1933
def parse_current_20mA(self, data): '\n 0x0000 - 0xffff -> 0mA - 20mA\n ' return round(((float(self.parse_number_le(data)) / 65535) * 20), 2)
0x0000 - 0xffff -> 0mA - 20mA
parsers/parser_naltec.py
parse_current_20mA
tanupoo/lorawan-ss-as
1
python
def parse_current_20mA(self, data): '\n \n ' return round(((float(self.parse_number_le(data)) / 65535) * 20), 2)
def parse_current_20mA(self, data): '\n \n ' return round(((float(self.parse_number_le(data)) / 65535) * 20), 2)<|docstring|>0x0000 - 0xffff -> 0mA - 20mA<|endoftext|>
38a95698fde6126325acbdf601dc989e58f3650eee74acebdd41214fc1e557b0
def parse_voltage_10V(self, data): '\n 0x0000 - 0xffff -> 0V - 10V\n ' return round(((float(self.parse_number_le(data)) / 65535) * 10), 2)
0x0000 - 0xffff -> 0V - 10V
parsers/parser_naltec.py
parse_voltage_10V
tanupoo/lorawan-ss-as
1
python
def parse_voltage_10V(self, data): '\n \n ' return round(((float(self.parse_number_le(data)) / 65535) * 10), 2)
def parse_voltage_10V(self, data): '\n \n ' return round(((float(self.parse_number_le(data)) / 65535) * 10), 2)<|docstring|>0x0000 - 0xffff -> 0V - 10V<|endoftext|>
463bc96cfc8597c880dbf5cf33b618eec0a1ae4e9035ec742a799e9c30b48dd8
def parse_thermocouple(self, data): '\n from -200 to 1820, unit 0.0625 C\n 0xf380 ... 0xfff, 0x000 ... 0x71c0\n i.e.\n int.from_bytes(data, "big", signed=True) * 0.0625\n ' return (self.parse_signed_number(data) * 0.0625)
from -200 to 1820, unit 0.0625 C 0xf380 ... 0xfff, 0x000 ... 0x71c0 i.e. int.from_bytes(data, "big", signed=True) * 0.0625
parsers/parser_naltec.py
parse_thermocouple
tanupoo/lorawan-ss-as
1
python
def parse_thermocouple(self, data): '\n from -200 to 1820, unit 0.0625 C\n 0xf380 ... 0xfff, 0x000 ... 0x71c0\n i.e.\n int.from_bytes(data, "big", signed=True) * 0.0625\n ' return (self.parse_signed_number(data) * 0.0625)
def parse_thermocouple(self, data): '\n from -200 to 1820, unit 0.0625 C\n 0xf380 ... 0xfff, 0x000 ... 0x71c0\n i.e.\n int.from_bytes(data, "big", signed=True) * 0.0625\n ' return (self.parse_signed_number(data) * 0.0625)<|docstring|>from -200 to 1820, unit 0.0625 C 0xf380 ......
2e2df48e9c59fe22c04dad7cc6213e2dafcff76532a86aa90e386c9d3439951d
def parse_payload_7f(self, byte_data): '\n Hdr, Vit, Temp\n ' if (len(byte_data) != 3): return False return self.parse_by_format(byte_data, [('hdr', self.parse_number, 0, 1), ('vit', self.parse_vit, 1, 2), ('temp', self.parse_temp, 2, 3)])
Hdr, Vit, Temp
parsers/parser_naltec.py
parse_payload_7f
tanupoo/lorawan-ss-as
1
python
def parse_payload_7f(self, byte_data): '\n \n ' if (len(byte_data) != 3): return False return self.parse_by_format(byte_data, [('hdr', self.parse_number, 0, 1), ('vit', self.parse_vit, 1, 2), ('temp', self.parse_temp, 2, 3)])
def parse_payload_7f(self, byte_data): '\n \n ' if (len(byte_data) != 3): return False return self.parse_by_format(byte_data, [('hdr', self.parse_number, 0, 1), ('vit', self.parse_vit, 1, 2), ('temp', self.parse_temp, 2, 3)])<|docstring|>Hdr, Vit, Temp<|endoftext|>
18435302fc29b0dc38e5c1b904734486bc2bfedbd20cabdfa18658fae40b3857
def parse_payload_23(self, byte_data): '\n Hdr, Vit, Temp, C-IN1, C-IN2, Vo-IN1, Vo-IN2\n ' if (len(byte_data) != 11): return False return self.parse_by_format(byte_data, [('hdr', self.parse_number, 0, 1), ('vit', self.parse_vit, 1, 2), ('temp', self.parse_temp, 2, 3), ('current_input_...
Hdr, Vit, Temp, C-IN1, C-IN2, Vo-IN1, Vo-IN2
parsers/parser_naltec.py
parse_payload_23
tanupoo/lorawan-ss-as
1
python
def parse_payload_23(self, byte_data): '\n \n ' if (len(byte_data) != 11): return False return self.parse_by_format(byte_data, [('hdr', self.parse_number, 0, 1), ('vit', self.parse_vit, 1, 2), ('temp', self.parse_temp, 2, 3), ('current_input_1', self.parse_current_20mA, 3, 5), ('curren...
def parse_payload_23(self, byte_data): '\n \n ' if (len(byte_data) != 11): return False return self.parse_by_format(byte_data, [('hdr', self.parse_number, 0, 1), ('vit', self.parse_vit, 1, 2), ('temp', self.parse_temp, 2, 3), ('current_input_1', self.parse_current_20mA, 3, 5), ('curren...
13db7b880c8fa7744846702b705b3ab79cac9ee3564adbbf8cdb208b34478d50
def parse_thermocouple_nope(self, data): '\n it means that the terminal is not used.\n ' return 32768
it means that the terminal is not used.
parsers/parser_naltec.py
parse_thermocouple_nope
tanupoo/lorawan-ss-as
1
python
def parse_thermocouple_nope(self, data): '\n \n ' return 32768
def parse_thermocouple_nope(self, data): '\n \n ' return 32768<|docstring|>it means that the terminal is not used.<|endoftext|>
fe79399d1ff967c1630b6ba9b4a8507b841a9b06835b2b06b8d8c4d891b9a628
def parse_payload_24(self, byte_data): '\n Hdr, Vit, Temp, TC1, TC2, TC3, TC4\n ' if (len(byte_data) != 11): return False return self.parse_by_format(byte_data, [('hdr', self.parse_number, 0, 1), ('vit', self.parse_vit, 1, 2), ('temp', self.parse_temp, 2, 3), ('thermocouple_1', self.pa...
Hdr, Vit, Temp, TC1, TC2, TC3, TC4
parsers/parser_naltec.py
parse_payload_24
tanupoo/lorawan-ss-as
1
python
def parse_payload_24(self, byte_data): '\n \n ' if (len(byte_data) != 11): return False return self.parse_by_format(byte_data, [('hdr', self.parse_number, 0, 1), ('vit', self.parse_vit, 1, 2), ('temp', self.parse_temp, 2, 3), ('thermocouple_1', self.parse_thermocouple, 3, 5), ('thermoc...
def parse_payload_24(self, byte_data): '\n \n ' if (len(byte_data) != 11): return False return self.parse_by_format(byte_data, [('hdr', self.parse_number, 0, 1), ('vit', self.parse_vit, 1, 2), ('temp', self.parse_temp, 2, 3), ('thermocouple_1', self.parse_thermocouple, 3, 5), ('thermoc...
58515d49dbb0412f915709bd91229748ad12fd970d61969d273e15a64485c389
def parse_payload_24x(self, byte_data): '\n Hdr, Vit, Temp, TC1, [TC2, [TC3, [TC4]]]\n ' if (len(byte_data) not in [3, 5, 7, 9, 11]): return False base_format = [('hdr', self.parse_number, 0, 1), ('vit', self.parse_vit, 1, 2), ('temp', self.parse_temp, 2, 3)] z = len(byte_data) ...
Hdr, Vit, Temp, TC1, [TC2, [TC3, [TC4]]]
parsers/parser_naltec.py
parse_payload_24x
tanupoo/lorawan-ss-as
1
python
def parse_payload_24x(self, byte_data): '\n \n ' if (len(byte_data) not in [3, 5, 7, 9, 11]): return False base_format = [('hdr', self.parse_number, 0, 1), ('vit', self.parse_vit, 1, 2), ('temp', self.parse_temp, 2, 3)] z = len(byte_data) for i in range(3, z, 2): j = (i...
def parse_payload_24x(self, byte_data): '\n \n ' if (len(byte_data) not in [3, 5, 7, 9, 11]): return False base_format = [('hdr', self.parse_number, 0, 1), ('vit', self.parse_vit, 1, 2), ('temp', self.parse_temp, 2, 3)] z = len(byte_data) for i in range(3, z, 2): j = (i...
666c82ef8f1c3082f3d36d78d4a99f7d30066972b3677627b73daf52de03ab9b
def parse_bytes(self, byte_data): '\n byte_data: payload in bytes\n return a dict object.\n ' format_tab = [{'hdr': 127, 'parser': self.parse_payload_7f}, {'hdr': 0, 'parser': self.parse_payload_00}, {'hdr': 35, 'parser': self.parse_payload_23}, {'hdr': 36, 'parser': self.parse_payload_24x}...
byte_data: payload in bytes return a dict object.
parsers/parser_naltec.py
parse_bytes
tanupoo/lorawan-ss-as
1
python
def parse_bytes(self, byte_data): '\n byte_data: payload in bytes\n return a dict object.\n ' format_tab = [{'hdr': 127, 'parser': self.parse_payload_7f}, {'hdr': 0, 'parser': self.parse_payload_00}, {'hdr': 35, 'parser': self.parse_payload_23}, {'hdr': 36, 'parser': self.parse_payload_24x}...
def parse_bytes(self, byte_data): '\n byte_data: payload in bytes\n return a dict object.\n ' format_tab = [{'hdr': 127, 'parser': self.parse_payload_7f}, {'hdr': 0, 'parser': self.parse_payload_00}, {'hdr': 35, 'parser': self.parse_payload_23}, {'hdr': 36, 'parser': self.parse_payload_24x}...
83206a2575f8db3278c7e477cac0e0580c8149fcc9ab37a5676d6e56e069cfa6
def nice(v, digits=4): 'Fix v to a value with a given number of digits of precision' if ((v == 0.0) or (not np.isfinite(v))): return v else: sign = (v / abs(v)) place = floor(log10(abs(v))) scale = (10 ** (place - (digits - 1))) return ((sign * floor(((abs(v) / scale)...
Fix v to a value with a given number of digits of precision
bumps/gui/util.py
nice
vishalbelsare/bumps
44
python
def nice(v, digits=4): if ((v == 0.0) or (not np.isfinite(v))): return v else: sign = (v / abs(v)) place = floor(log10(abs(v))) scale = (10 ** (place - (digits - 1))) return ((sign * floor(((abs(v) / scale) + 0.5))) * scale)
def nice(v, digits=4): if ((v == 0.0) or (not np.isfinite(v))): return v else: sign = (v / abs(v)) place = floor(log10(abs(v))) scale = (10 ** (place - (digits - 1))) return ((sign * floor(((abs(v) / scale) + 0.5))) * scale)<|docstring|>Fix v to a value with a given ...
d5bfe12a477cc39e69688bf7812494f007a4f9a351c8d37c9978e8358e4b4b5e
def timeout(func, args=(), kwargs={}, timeout_duration=1, default=None): 'This function will spawn a thread and run the given function using the args, kwargs and \n return the given default value if the timeout_duration is exceeded \n ' import threading class PlayerThread(threading.Thread): ...
This function will spawn a thread and run the given function using the args, kwargs and return the given default value if the timeout_duration is exceeded
Baroque_Chess_starter_V1.3/BaroqueGameMaster.py
timeout
aamiller/Rookoko
0
python
def timeout(func, args=(), kwargs={}, timeout_duration=1, default=None): 'This function will spawn a thread and run the given function using the args, kwargs and \n return the given default value if the timeout_duration is exceeded \n ' import threading class PlayerThread(threading.Thread): ...
def timeout(func, args=(), kwargs={}, timeout_duration=1, default=None): 'This function will spawn a thread and run the given function using the args, kwargs and \n return the given default value if the timeout_duration is exceeded \n ' import threading class PlayerThread(threading.Thread): ...
b37edfec5a30667893a58a4383b8c928eadfd75f7c77cde9a4bbecd3da2a87f4
def get_base_clock(self): 'Get the clock with the finest time unit, i.e. ticks the most cycles in a given time, or the highest clock_speed' fastest_env = ps.max_by(self.envs, (lambda env: env.clock_speed)) clock = fastest_env.clock return clock
Get the clock with the finest time unit, i.e. ticks the most cycles in a given time, or the highest clock_speed
slm_lab/env/__init__.py
get_base_clock
rhaps0dy/SLM-Lab
1
python
def get_base_clock(self): fastest_env = ps.max_by(self.envs, (lambda env: env.clock_speed)) clock = fastest_env.clock return clock
def get_base_clock(self): fastest_env = ps.max_by(self.envs, (lambda env: env.clock_speed)) clock = fastest_env.clock return clock<|docstring|>Get the clock with the finest time unit, i.e. ticks the most cycles in a given time, or the highest clock_speed<|endoftext|>
e8c6443ce2fcb4f59cf03e0b590f538a4ce27bf3a46bf7129a02ffaf4769b6a3
def preprocess(image, scale=2, max_rgb=1, to_y=True): 'Preprocess data.' if ((image.get_shape()[(- 1)] != 1) and (image.get_shape()[(- 1)] != 3)): image = tf.transpose(image, [0, 2, 3, 1]) (img_height, img_width) = image.get_shape()[1:3] (crop_height, crop_width) = ((img_height - (2 * scale)), (...
Preprocess data.
vega/metrics/tensorflow/sr_metric.py
preprocess
zjzh/vega
0
python
def preprocess(image, scale=2, max_rgb=1, to_y=True): if ((image.get_shape()[(- 1)] != 1) and (image.get_shape()[(- 1)] != 3)): image = tf.transpose(image, [0, 2, 3, 1]) (img_height, img_width) = image.get_shape()[1:3] (crop_height, crop_width) = ((img_height - (2 * scale)), (img_width - (2 * s...
def preprocess(image, scale=2, max_rgb=1, to_y=True): if ((image.get_shape()[(- 1)] != 1) and (image.get_shape()[(- 1)] != 3)): image = tf.transpose(image, [0, 2, 3, 1]) (img_height, img_width) = image.get_shape()[1:3] (crop_height, crop_width) = ((img_height - (2 * scale)), (img_width - (2 * s...
0e255188b6ade3f0e14c9185a49504480d448b6aae0cd2357e2c44861d2bf9fc
def __call__(self, output, target): 'Calculate sr metric.\n\n :param output: output of SR network\n :param target: ground truth from dataset\n :return: sr metric value\n ' shape_list = output.get_shape().as_list() if (len(shape_list) == 5): result = 0.0 for index ...
Calculate sr metric. :param output: output of SR network :param target: ground truth from dataset :return: sr metric value
vega/metrics/tensorflow/sr_metric.py
__call__
zjzh/vega
0
python
def __call__(self, output, target): 'Calculate sr metric.\n\n :param output: output of SR network\n :param target: ground truth from dataset\n :return: sr metric value\n ' shape_list = output.get_shape().as_list() if (len(shape_list) == 5): result = 0.0 for index ...
def __call__(self, output, target): 'Calculate sr metric.\n\n :param output: output of SR network\n :param target: ground truth from dataset\n :return: sr metric value\n ' shape_list = output.get_shape().as_list() if (len(shape_list) == 5): result = 0.0 for index ...
b71a376804cee0caa335f2b5392d84d79aa2fcab6728137407624cd9e8305f02
def __call__(self, output, target): 'Calculate sr metric.\n\n :param output: output of SR network\n :param target: ground truth from dataset\n :return: sr metric value\n ' shape_list = output.get_shape().as_list() if (len(shape_list) == 5): result = 0.0 for index ...
Calculate sr metric. :param output: output of SR network :param target: ground truth from dataset :return: sr metric value
vega/metrics/tensorflow/sr_metric.py
__call__
zjzh/vega
0
python
def __call__(self, output, target): 'Calculate sr metric.\n\n :param output: output of SR network\n :param target: ground truth from dataset\n :return: sr metric value\n ' shape_list = output.get_shape().as_list() if (len(shape_list) == 5): result = 0.0 for index ...
def __call__(self, output, target): 'Calculate sr metric.\n\n :param output: output of SR network\n :param target: ground truth from dataset\n :return: sr metric value\n ' shape_list = output.get_shape().as_list() if (len(shape_list) == 5): result = 0.0 for index ...
9ab777ccc08b0f422008f03694853bc189059d978885c9404d1fd654eac14330
def increase_size(sizes): " Increase each sheep's size by 50" for (idx, val) in enumerate(sizes): sizes[idx] = (val + 50)
Increase each sheep's size by 50
ss3/SE 2.py
increase_size
DuongVu39/C4E10_Duong
0
python
def increase_size(sizes): " " for (idx, val) in enumerate(sizes): sizes[idx] = (val + 50)
def increase_size(sizes): " " for (idx, val) in enumerate(sizes): sizes[idx] = (val + 50)<|docstring|>Increase each sheep's size by 50<|endoftext|>
61e647776d5da258ffc64661ca89924627c39d9e14dc8c4b406ae0c7b47d82a8
def initialize_analyticsreporting(): 'Initializes an Analytics Reporting API V4 service object.\n\n Returns:\n An authorized Analytics Reporting API V4 service object.\n ' credentials = ServiceAccountCredentials.from_json_keyfile_name(KEY_FILE_LOCATION, SCOPES) analytics = build('analyticsreporting', '...
Initializes an Analytics Reporting API V4 service object. Returns: An authorized Analytics Reporting API V4 service object.
stop_starting_start_stopping/google_analytics_api_pandas_reporting/005_google_analytics_api_pandas_reporting.py
initialize_analyticsreporting
bflaven/BlogArticlesExamples
5
python
def initialize_analyticsreporting(): 'Initializes an Analytics Reporting API V4 service object.\n\n Returns:\n An authorized Analytics Reporting API V4 service object.\n ' credentials = ServiceAccountCredentials.from_json_keyfile_name(KEY_FILE_LOCATION, SCOPES) analytics = build('analyticsreporting', '...
def initialize_analyticsreporting(): 'Initializes an Analytics Reporting API V4 service object.\n\n Returns:\n An authorized Analytics Reporting API V4 service object.\n ' credentials = ServiceAccountCredentials.from_json_keyfile_name(KEY_FILE_LOCATION, SCOPES) analytics = build('analyticsreporting', '...
04da9df9e16e4024d0444f3705e1c353062de105b6c163ccba80bb9855371b37
def get_report(analytics): 'Queries the Analytics Reporting API V4.\n\n Args:\n analytics: An authorized Analytics Reporting API V4 service object.\n Returns:\n The Analytics Reporting API V4 response.\n ' return analytics.reports().batchGet(body={'reportRequests': [{'viewId': VIEW_ID, 'dateRanges': [{...
Queries the Analytics Reporting API V4. Args: analytics: An authorized Analytics Reporting API V4 service object. Returns: The Analytics Reporting API V4 response.
stop_starting_start_stopping/google_analytics_api_pandas_reporting/005_google_analytics_api_pandas_reporting.py
get_report
bflaven/BlogArticlesExamples
5
python
def get_report(analytics): 'Queries the Analytics Reporting API V4.\n\n Args:\n analytics: An authorized Analytics Reporting API V4 service object.\n Returns:\n The Analytics Reporting API V4 response.\n ' return analytics.reports().batchGet(body={'reportRequests': [{'viewId': VIEW_ID, 'dateRanges': [{...
def get_report(analytics): 'Queries the Analytics Reporting API V4.\n\n Args:\n analytics: An authorized Analytics Reporting API V4 service object.\n Returns:\n The Analytics Reporting API V4 response.\n ' return analytics.reports().batchGet(body={'reportRequests': [{'viewId': VIEW_ID, 'dateRanges': [{...
74a4591989de53d077f1637db4a0f3b2f4bf97d9495a444d2992912982ffe9df
def print_response(response): 'Parses and prints the Analytics Reporting API V4 response.\n\n Args:\n response: An Analytics Reporting API V4 response.\n ' for report in response.get('reports', []): columnHeader = report.get('columnHeader', {}) dimensionHeaders = columnHeader.get('dimension...
Parses and prints the Analytics Reporting API V4 response. Args: response: An Analytics Reporting API V4 response.
stop_starting_start_stopping/google_analytics_api_pandas_reporting/005_google_analytics_api_pandas_reporting.py
print_response
bflaven/BlogArticlesExamples
5
python
def print_response(response): 'Parses and prints the Analytics Reporting API V4 response.\n\n Args:\n response: An Analytics Reporting API V4 response.\n ' for report in response.get('reports', []): columnHeader = report.get('columnHeader', {}) dimensionHeaders = columnHeader.get('dimension...
def print_response(response): 'Parses and prints the Analytics Reporting API V4 response.\n\n Args:\n response: An Analytics Reporting API V4 response.\n ' for report in response.get('reports', []): columnHeader = report.get('columnHeader', {}) dimensionHeaders = columnHeader.get('dimension...
a5b28106c0740fef22abef50545d241857d1e6bf4afbb17fd1bd2b6554769b59
def should_set_tablename(cls): '\n Determine whether ``__tablename__`` should be automatically generated\n for a model.\n\n * If no class in the MRO sets a name, one should be generated.\n * If a declared attr is found, it should be used instead.\n * If a name is found, it should be used if the class...
Determine whether ``__tablename__`` should be automatically generated for a model. * If no class in the MRO sets a name, one should be generated. * If a declared attr is found, it should be used instead. * If a name is found, it should be used if the class is a mixin, otherwise one should be generated. * Abstract mo...
sqlalchemy_unchained/base_model_metaclass.py
should_set_tablename
barseghyanartur/sqlalchemy-unchained
6
python
def should_set_tablename(cls): '\n Determine whether ``__tablename__`` should be automatically generated\n for a model.\n\n * If no class in the MRO sets a name, one should be generated.\n * If a declared attr is found, it should be used instead.\n * If a name is found, it should be used if the class...
def should_set_tablename(cls): '\n Determine whether ``__tablename__`` should be automatically generated\n for a model.\n\n * If no class in the MRO sets a name, one should be generated.\n * If a declared attr is found, it should be used instead.\n * If a name is found, it should be used if the class...
28061dd04b9ffa30160285eeb527339336045e9fb2380876ab267bb9de6154a4
def __table_cls__(cls, *args, **kwargs): 'This is called by SQLAlchemy during mapper setup. It determines the\n final table object that the model will use.\n\n If no primary key is found, that indicates single-table inheritance,\n so no table will be created and ``__tablename__`` will be unset....
This is called by SQLAlchemy during mapper setup. It determines the final table object that the model will use. If no primary key is found, that indicates single-table inheritance, so no table will be created and ``__tablename__`` will be unset.
sqlalchemy_unchained/base_model_metaclass.py
__table_cls__
barseghyanartur/sqlalchemy-unchained
6
python
def __table_cls__(cls, *args, **kwargs): 'This is called by SQLAlchemy during mapper setup. It determines the\n final table object that the model will use.\n\n If no primary key is found, that indicates single-table inheritance,\n so no table will be created and ``__tablename__`` will be unset....
def __table_cls__(cls, *args, **kwargs): 'This is called by SQLAlchemy during mapper setup. It determines the\n final table object that the model will use.\n\n If no primary key is found, that indicates single-table inheritance,\n so no table will be created and ``__tablename__`` will be unset....
01e8196b4e3995f955db2802b9951a262141c3b201c360e36f9df1d7279cb99e
def _pre_mcs_init(cls): '\n Callback for BaseModelMetaclass subclasses to run code just before a\n concrete Model class gets registered with SQLAlchemy.\n\n This is intended to be used for advanced meta options implementations.\n '
Callback for BaseModelMetaclass subclasses to run code just before a concrete Model class gets registered with SQLAlchemy. This is intended to be used for advanced meta options implementations.
sqlalchemy_unchained/base_model_metaclass.py
_pre_mcs_init
barseghyanartur/sqlalchemy-unchained
6
python
def _pre_mcs_init(cls): '\n Callback for BaseModelMetaclass subclasses to run code just before a\n concrete Model class gets registered with SQLAlchemy.\n\n This is intended to be used for advanced meta options implementations.\n '
def _pre_mcs_init(cls): '\n Callback for BaseModelMetaclass subclasses to run code just before a\n concrete Model class gets registered with SQLAlchemy.\n\n This is intended to be used for advanced meta options implementations.\n '<|docstring|>Callback for BaseModelMetaclass subclasses t...
542d0b3e0eb0311e463ce0968945f59945441c105b8753207f659ea1a30a927c
def _post_mcs_init(cls): '\n Callback for BaseModelMetaclass subclasses to run code just after a\n concrete Model class gets registered with SQLAlchemy.\n\n This is intended to be used for advanced meta options implementations.\n '
Callback for BaseModelMetaclass subclasses to run code just after a concrete Model class gets registered with SQLAlchemy. This is intended to be used for advanced meta options implementations.
sqlalchemy_unchained/base_model_metaclass.py
_post_mcs_init
barseghyanartur/sqlalchemy-unchained
6
python
def _post_mcs_init(cls): '\n Callback for BaseModelMetaclass subclasses to run code just after a\n concrete Model class gets registered with SQLAlchemy.\n\n This is intended to be used for advanced meta options implementations.\n '
def _post_mcs_init(cls): '\n Callback for BaseModelMetaclass subclasses to run code just after a\n concrete Model class gets registered with SQLAlchemy.\n\n This is intended to be used for advanced meta options implementations.\n '<|docstring|>Callback for BaseModelMetaclass subclasses t...
b6e2c49464a3b485d4ed5c3fc7634069e717981b4ac7ebdb1d8db1e0537c81ec
def get_upload_time_str(assignment, user): "Returns a datetime object with upload time user's last submission" location = vmcheckerpaths.dir_user(assignment, user) config_file = os.path.join(location, 'config') if (not os.path.isdir(location)): return None if (not os.path.isfile(config_file)...
Returns a datetime object with upload time user's last submission
bin/submissions.py
get_upload_time_str
ironmissy/vmchecker
1
python
def get_upload_time_str(assignment, user): location = vmcheckerpaths.dir_user(assignment, user) config_file = os.path.join(location, 'config') if (not os.path.isdir(location)): return None if (not os.path.isfile(config_file)): _logger.warn('%s found, but config (%s) is missing', loc...
def get_upload_time_str(assignment, user): location = vmcheckerpaths.dir_user(assignment, user) config_file = os.path.join(location, 'config') if (not os.path.isdir(location)): return None if (not os.path.isfile(config_file)): _logger.warn('%s found, but config (%s) is missing', loc...
b48c12a3d556c404b32562b8b2403628fd3a0e472d9208a445f552c0d92625c9
def __init__(self, tmp_dir: TmpDir, organizer: Organizer, username: Optional[str], password: Optional[str]): 'Create a new http downloader.' self._organizer = organizer self._tmp_dir = tmp_dir self._username = username self._password = password self._session = self._build_session()
Create a new http downloader.
PFERD/downloaders.py
__init__
pavelzw/PFERD
0
python
def __init__(self, tmp_dir: TmpDir, organizer: Organizer, username: Optional[str], password: Optional[str]): self._organizer = organizer self._tmp_dir = tmp_dir self._username = username self._password = password self._session = self._build_session()
def __init__(self, tmp_dir: TmpDir, organizer: Organizer, username: Optional[str], password: Optional[str]): self._organizer = organizer self._tmp_dir = tmp_dir self._username = username self._password = password self._session = self._build_session()<|docstring|>Create a new http downloader.<|e...
9d0e476fe5bc1cb1fc8900b8eb226375931c67770e0c47876a002ce87e43a78b
def download_all(self, infos: List[HttpDownloadInfo]) -> None: '\n Download multiple files one after the other.\n ' for info in infos: self.download(info)
Download multiple files one after the other.
PFERD/downloaders.py
download_all
pavelzw/PFERD
0
python
def download_all(self, infos: List[HttpDownloadInfo]) -> None: '\n \n ' for info in infos: self.download(info)
def download_all(self, infos: List[HttpDownloadInfo]) -> None: '\n \n ' for info in infos: self.download(info)<|docstring|>Download multiple files one after the other.<|endoftext|>
5a1b7bfe971a760b5cb97a77837306db4823be31d1b8870bbdb50ad665f21b52
def download(self, info: HttpDownloadInfo) -> None: '\n Download a single file.\n ' with self._session.get(info.url, params=info.parameters, stream=True) as response: if (response.status_code == 200): tmp_file = self._tmp_dir.new_path() stream_to_path(response, tmp_...
Download a single file.
PFERD/downloaders.py
download
pavelzw/PFERD
0
python
def download(self, info: HttpDownloadInfo) -> None: '\n \n ' with self._session.get(info.url, params=info.parameters, stream=True) as response: if (response.status_code == 200): tmp_file = self._tmp_dir.new_path() stream_to_path(response, tmp_file, info.path.name) ...
def download(self, info: HttpDownloadInfo) -> None: '\n \n ' with self._session.get(info.url, params=info.parameters, stream=True) as response: if (response.status_code == 200): tmp_file = self._tmp_dir.new_path() stream_to_path(response, tmp_file, info.path.name) ...
3684202c3c5c1cf67a04dfcb477b1e350cfacfaf8f4ebf21c46c9f50a02a72ef
def scraping_mg_initial_period(masp, senha, stop_period, headless, pdf): '\n Função responsável pela busca de informações dos contracheques dos servidores do Estado de Minas Gerais até o período desejado.\n Parâmetros:\n -------\n masp: string\n Masp do servidor do Estado de Minas Gerais\n senha: string\n ...
Função responsável pela busca de informações dos contracheques dos servidores do Estado de Minas Gerais até o período desejado. Parâmetros: ------- masp: string Masp do servidor do Estado de Minas Gerais senha: string Senha de acesso ao Portal do servidor do Estado de Minas Gerais stop-period: string Período fina...
meu_contracheque/mg_initial_period.py
scraping_mg_initial_period
gabrielbdornas/meu-contracheque
0
python
def scraping_mg_initial_period(masp, senha, stop_period, headless, pdf): '\n Função responsável pela busca de informações dos contracheques dos servidores do Estado de Minas Gerais até o período desejado.\n Parâmetros:\n -------\n masp: string\n Masp do servidor do Estado de Minas Gerais\n senha: string\n ...
def scraping_mg_initial_period(masp, senha, stop_period, headless, pdf): '\n Função responsável pela busca de informações dos contracheques dos servidores do Estado de Minas Gerais até o período desejado.\n Parâmetros:\n -------\n masp: string\n Masp do servidor do Estado de Minas Gerais\n senha: string\n ...
d24f7c4e6f10936f8906c9350267b3f336f4e529229a355b87d59a15f112979b
@click.command(name='ate-periodo-inicial') @click.pass_context @click.option('--stop-period', '-sp', required=True, help='Último período a ser pesquisado. Exemplo: 02/2008') def scraping_mg_initial_period_cli(ctx, stop_period): '\n Função CLI responsável pela busca de informações dos contracheques dos servidores d...
Função CLI responsável pela busca de informações dos contracheques dos servidores do Estado de Minas Gerais até o período desejado. Por padrão, função buscará masp e senha nas variáveis de ambiente MASP e PORTAL_PWD cadastradas na máquina ou em arquivo .env. Parâmetros: ---------- masp: string Masp do servidor do E...
meu_contracheque/mg_initial_period.py
scraping_mg_initial_period_cli
gabrielbdornas/meu-contracheque
0
python
@click.command(name='ate-periodo-inicial') @click.pass_context @click.option('--stop-period', '-sp', required=True, help='Último período a ser pesquisado. Exemplo: 02/2008') def scraping_mg_initial_period_cli(ctx, stop_period): '\n Função CLI responsável pela busca de informações dos contracheques dos servidores d...
@click.command(name='ate-periodo-inicial') @click.pass_context @click.option('--stop-period', '-sp', required=True, help='Último período a ser pesquisado. Exemplo: 02/2008') def scraping_mg_initial_period_cli(ctx, stop_period): '\n Função CLI responsável pela busca de informações dos contracheques dos servidores d...
5ea7edf25257aabfbd20a0e01a48b756ad0b33b6bdaa2380f2480952469bc44c
def __init__(self, id=None, url=None, links=None): 'BatchWebhook - a model defined in Swagger' self._id = None self._url = None self._links = None self.discriminator = None if (id is not None): self.id = id if (url is not None): self.url = url if (links is not None): ...
BatchWebhook - a model defined in Swagger
mailchimp_marketing_asyncio/models/batch_webhook.py
__init__
john-parton/mailchimp-asyncio
0
python
def __init__(self, id=None, url=None, links=None): self._id = None self._url = None self._links = None self.discriminator = None if (id is not None): self.id = id if (url is not None): self.url = url if (links is not None): self.links = links
def __init__(self, id=None, url=None, links=None): self._id = None self._url = None self._links = None self.discriminator = None if (id is not None): self.id = id if (url is not None): self.url = url if (links is not None): self.links = links<|docstring|>BatchWeb...
b18eac0b77304fbcb9c2f79e9a082c48bd50026eaddb8a5e2baadd872b36c35c
@property def id(self): 'Gets the id of this BatchWebhook. # noqa: E501\n\n A string that uniquely identifies this Batch Webhook. # noqa: E501\n\n :return: The id of this BatchWebhook. # noqa: E501\n :rtype: str\n ' return self._id
Gets the id of this BatchWebhook. # noqa: E501 A string that uniquely identifies this Batch Webhook. # noqa: E501 :return: The id of this BatchWebhook. # noqa: E501 :rtype: str
mailchimp_marketing_asyncio/models/batch_webhook.py
id
john-parton/mailchimp-asyncio
0
python
@property def id(self): 'Gets the id of this BatchWebhook. # noqa: E501\n\n A string that uniquely identifies this Batch Webhook. # noqa: E501\n\n :return: The id of this BatchWebhook. # noqa: E501\n :rtype: str\n ' return self._id
@property def id(self): 'Gets the id of this BatchWebhook. # noqa: E501\n\n A string that uniquely identifies this Batch Webhook. # noqa: E501\n\n :return: The id of this BatchWebhook. # noqa: E501\n :rtype: str\n ' return self._id<|docstring|>Gets the id of this BatchWebhook. # ...
95c8a4f4880f4139c0552c874313b528bf454e0d1ff5309bc68b8a41c7e5999d
@id.setter def id(self, id): 'Sets the id of this BatchWebhook.\n\n A string that uniquely identifies this Batch Webhook. # noqa: E501\n\n :param id: The id of this BatchWebhook. # noqa: E501\n :type: str\n ' self._id = id
Sets the id of this BatchWebhook. A string that uniquely identifies this Batch Webhook. # noqa: E501 :param id: The id of this BatchWebhook. # noqa: E501 :type: str
mailchimp_marketing_asyncio/models/batch_webhook.py
id
john-parton/mailchimp-asyncio
0
python
@id.setter def id(self, id): 'Sets the id of this BatchWebhook.\n\n A string that uniquely identifies this Batch Webhook. # noqa: E501\n\n :param id: The id of this BatchWebhook. # noqa: E501\n :type: str\n ' self._id = id
@id.setter def id(self, id): 'Sets the id of this BatchWebhook.\n\n A string that uniquely identifies this Batch Webhook. # noqa: E501\n\n :param id: The id of this BatchWebhook. # noqa: E501\n :type: str\n ' self._id = id<|docstring|>Sets the id of this BatchWebhook. A string tha...
379e580dfd5a225d467cf9e54313150604836a65fe434c2477527830a1111a8f
@property def url(self): 'Gets the url of this BatchWebhook. # noqa: E501\n\n A valid URL for the Webhook. # noqa: E501\n\n :return: The url of this BatchWebhook. # noqa: E501\n :rtype: str\n ' return self._url
Gets the url of this BatchWebhook. # noqa: E501 A valid URL for the Webhook. # noqa: E501 :return: The url of this BatchWebhook. # noqa: E501 :rtype: str
mailchimp_marketing_asyncio/models/batch_webhook.py
url
john-parton/mailchimp-asyncio
0
python
@property def url(self): 'Gets the url of this BatchWebhook. # noqa: E501\n\n A valid URL for the Webhook. # noqa: E501\n\n :return: The url of this BatchWebhook. # noqa: E501\n :rtype: str\n ' return self._url
@property def url(self): 'Gets the url of this BatchWebhook. # noqa: E501\n\n A valid URL for the Webhook. # noqa: E501\n\n :return: The url of this BatchWebhook. # noqa: E501\n :rtype: str\n ' return self._url<|docstring|>Gets the url of this BatchWebhook. # noqa: E501 A valid ...
f80e817d5d23feb7be47159d998dfdaea3e09493615631c71048efe636413f4b
@url.setter def url(self, url): 'Sets the url of this BatchWebhook.\n\n A valid URL for the Webhook. # noqa: E501\n\n :param url: The url of this BatchWebhook. # noqa: E501\n :type: str\n ' self._url = url
Sets the url of this BatchWebhook. A valid URL for the Webhook. # noqa: E501 :param url: The url of this BatchWebhook. # noqa: E501 :type: str
mailchimp_marketing_asyncio/models/batch_webhook.py
url
john-parton/mailchimp-asyncio
0
python
@url.setter def url(self, url): 'Sets the url of this BatchWebhook.\n\n A valid URL for the Webhook. # noqa: E501\n\n :param url: The url of this BatchWebhook. # noqa: E501\n :type: str\n ' self._url = url
@url.setter def url(self, url): 'Sets the url of this BatchWebhook.\n\n A valid URL for the Webhook. # noqa: E501\n\n :param url: The url of this BatchWebhook. # noqa: E501\n :type: str\n ' self._url = url<|docstring|>Sets the url of this BatchWebhook. A valid URL for the Webhook....
2b24d940032510de2981cd7b4f18b90a0569430ac44c4c493bc2c484ff5d2925
@property def links(self): 'Gets the links of this BatchWebhook. # noqa: E501\n\n A list of link types and descriptions for the API schema documents. # noqa: E501\n\n :return: The links of this BatchWebhook. # noqa: E501\n :rtype: list[ResourceLink]\n ' return self._links
Gets the links of this BatchWebhook. # noqa: E501 A list of link types and descriptions for the API schema documents. # noqa: E501 :return: The links of this BatchWebhook. # noqa: E501 :rtype: list[ResourceLink]
mailchimp_marketing_asyncio/models/batch_webhook.py
links
john-parton/mailchimp-asyncio
0
python
@property def links(self): 'Gets the links of this BatchWebhook. # noqa: E501\n\n A list of link types and descriptions for the API schema documents. # noqa: E501\n\n :return: The links of this BatchWebhook. # noqa: E501\n :rtype: list[ResourceLink]\n ' return self._links
@property def links(self): 'Gets the links of this BatchWebhook. # noqa: E501\n\n A list of link types and descriptions for the API schema documents. # noqa: E501\n\n :return: The links of this BatchWebhook. # noqa: E501\n :rtype: list[ResourceLink]\n ' return self._links<|docstri...
576e24cd3ace855f682aab9cb85bb8ec15ff384d4d4a2b8b46119e5e3f12a554
@links.setter def links(self, links): 'Sets the links of this BatchWebhook.\n\n A list of link types and descriptions for the API schema documents. # noqa: E501\n\n :param links: The links of this BatchWebhook. # noqa: E501\n :type: list[ResourceLink]\n ' self._links = links
Sets the links of this BatchWebhook. A list of link types and descriptions for the API schema documents. # noqa: E501 :param links: The links of this BatchWebhook. # noqa: E501 :type: list[ResourceLink]
mailchimp_marketing_asyncio/models/batch_webhook.py
links
john-parton/mailchimp-asyncio
0
python
@links.setter def links(self, links): 'Sets the links of this BatchWebhook.\n\n A list of link types and descriptions for the API schema documents. # noqa: E501\n\n :param links: The links of this BatchWebhook. # noqa: E501\n :type: list[ResourceLink]\n ' self._links = links
@links.setter def links(self, links): 'Sets the links of this BatchWebhook.\n\n A list of link types and descriptions for the API schema documents. # noqa: E501\n\n :param links: The links of this BatchWebhook. # noqa: E501\n :type: list[ResourceLink]\n ' self._links = links<|docst...
35f2145ce70e6111ab658e06b69b2a58db1e250fae53ae5766deccf3b7131c41
def to_dict(self): 'Returns the model properties as a dict' result = {} for (attr, _) in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value)) e...
Returns the model properties as a dict
mailchimp_marketing_asyncio/models/batch_webhook.py
to_dict
john-parton/mailchimp-asyncio
0
python
def to_dict(self): result = {} for (attr, _) in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value)) elif hasattr(value, 'to_dict'): ...
def to_dict(self): result = {} for (attr, _) in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value)) elif hasattr(value, 'to_dict'): ...
cbb19eaa2fc8a113d9e32f924ef280a7e97563f8915f94f65dab438997af2e99
def to_str(self): 'Returns the string representation of the model' return pprint.pformat(self.to_dict())
Returns the string representation of the model
mailchimp_marketing_asyncio/models/batch_webhook.py
to_str
john-parton/mailchimp-asyncio
0
python
def to_str(self): return pprint.pformat(self.to_dict())
def to_str(self): return pprint.pformat(self.to_dict())<|docstring|>Returns the string representation of the model<|endoftext|>
772243a2c2b3261a9b954d07aaf295e3c1242a579a495e2d6a5679c677861703
def __repr__(self): 'For `print` and `pprint`' return self.to_str()
For `print` and `pprint`
mailchimp_marketing_asyncio/models/batch_webhook.py
__repr__
john-parton/mailchimp-asyncio
0
python
def __repr__(self): return self.to_str()
def __repr__(self): return self.to_str()<|docstring|>For `print` and `pprint`<|endoftext|>
f2b4b8f2cf64966388213fa2d6d3d50a84976aaf5e7d902dec624670887680a6
def __eq__(self, other): 'Returns true if both objects are equal' if (not isinstance(other, BatchWebhook)): return False return (self.__dict__ == other.__dict__)
Returns true if both objects are equal
mailchimp_marketing_asyncio/models/batch_webhook.py
__eq__
john-parton/mailchimp-asyncio
0
python
def __eq__(self, other): if (not isinstance(other, BatchWebhook)): return False return (self.__dict__ == other.__dict__)
def __eq__(self, other): if (not isinstance(other, BatchWebhook)): return False return (self.__dict__ == other.__dict__)<|docstring|>Returns true if both objects are equal<|endoftext|>
43dc6740163eb9fc1161d09cb2208a64c7ad0cc8d9c8637ac3264522d3ec7e42
def __ne__(self, other): 'Returns true if both objects are not equal' return (not (self == other))
Returns true if both objects are not equal
mailchimp_marketing_asyncio/models/batch_webhook.py
__ne__
john-parton/mailchimp-asyncio
0
python
def __ne__(self, other): return (not (self == other))
def __ne__(self, other): return (not (self == other))<|docstring|>Returns true if both objects are not equal<|endoftext|>
2f87d754d95e5109330f278f03d38ad595abffbf450cb892611fce17477f9c99
def equalValue(self, size): '\n x 等间距划分分箱 -> (0-0.1,0.1-0.2...)\n :param size:\n :return:\n ' self.range_dict = {} self.bins = np.linspace(min(self.x), max(self.x), (size + 1)) for i in range((len(self.bins) - 1)): self.range_dict[(self.bins[i], self.bins[(i + 1)])] ...
x 等间距划分分箱 -> (0-0.1,0.1-0.2...) :param size: :return:
lapras/utils/simpleMethods.py
equalValue
yhangang/Lapras
13
python
def equalValue(self, size): '\n x 等间距划分分箱 -> (0-0.1,0.1-0.2...)\n :param size:\n :return:\n ' self.range_dict = {} self.bins = np.linspace(min(self.x), max(self.x), (size + 1)) for i in range((len(self.bins) - 1)): self.range_dict[(self.bins[i], self.bins[(i + 1)])] ...
def equalValue(self, size): '\n x 等间距划分分箱 -> (0-0.1,0.1-0.2...)\n :param size:\n :return:\n ' self.range_dict = {} self.bins = np.linspace(min(self.x), max(self.x), (size + 1)) for i in range((len(self.bins) - 1)): self.range_dict[(self.bins[i], self.bins[(i + 1)])] ...
9ff3fe928c0b465e88d8872d7bbcdc63eab9a43081e928a1907789667e2bd5ad
def equalHist(self, size): '\n 基于np.histogram分箱\n :param size: bin数目\n :return:\n ' self.down = {} (self.hist, self.bins) = np.histogram(self.x, bins=size) for i in range((len(self.bins) - 1)): start = self.bins[i] end = self.bins[(i + 1)] self.range_d...
基于np.histogram分箱 :param size: bin数目 :return:
lapras/utils/simpleMethods.py
equalHist
yhangang/Lapras
13
python
def equalHist(self, size): '\n 基于np.histogram分箱\n :param size: bin数目\n :return:\n ' self.down = {} (self.hist, self.bins) = np.histogram(self.x, bins=size) for i in range((len(self.bins) - 1)): start = self.bins[i] end = self.bins[(i + 1)] self.range_d...
def equalHist(self, size): '\n 基于np.histogram分箱\n :param size: bin数目\n :return:\n ' self.down = {} (self.hist, self.bins) = np.histogram(self.x, bins=size) for i in range((len(self.bins) - 1)): start = self.bins[i] end = self.bins[(i + 1)] self.range_d...
6198a08e39ed5e258a8735b96824ee7a683ded8c3a2d4465185041bc9bdbb2b8
def equalSize(self, size): '\n 每个分箱样本数平均\n :param size:\n :return:\n ' self.range_dict = {} breakpoints = ((np.arange(0, (size + 1)) / size) * 100) self.bins = [np.percentile(self.x, b) for b in breakpoints] for i in range((len(self.bins) - 1)): start = self.bins[...
每个分箱样本数平均 :param size: :return:
lapras/utils/simpleMethods.py
equalSize
yhangang/Lapras
13
python
def equalSize(self, size): '\n 每个分箱样本数平均\n :param size:\n :return:\n ' self.range_dict = {} breakpoints = ((np.arange(0, (size + 1)) / size) * 100) self.bins = [np.percentile(self.x, b) for b in breakpoints] for i in range((len(self.bins) - 1)): start = self.bins[...
def equalSize(self, size): '\n 每个分箱样本数平均\n :param size:\n :return:\n ' self.range_dict = {} breakpoints = ((np.arange(0, (size + 1)) / size) * 100) self.bins = [np.percentile(self.x, b) for b in breakpoints] for i in range((len(self.bins) - 1)): start = self.bins[...
e7a9e45e233e602cd6ddd3c5b3932532f496a48fa0935b639ad637d7264d347b
def everysplit(self): '\n 最细粒度切分\n :return:\n ' if ((len(set(self.x)) <= 10) and (not self.force)): self.bins = np.array(list(self.x)) else: x_sort = sorted(list(set(self.x)), reverse=False) bins = [x_sort[0]] for i in range((len(x_sort) - 1)): ...
最细粒度切分 :return:
lapras/utils/simpleMethods.py
everysplit
yhangang/Lapras
13
python
def everysplit(self): '\n 最细粒度切分\n :return:\n ' if ((len(set(self.x)) <= 10) and (not self.force)): self.bins = np.array(list(self.x)) else: x_sort = sorted(list(set(self.x)), reverse=False) bins = [x_sort[0]] for i in range((len(x_sort) - 1)): ...
def everysplit(self): '\n 最细粒度切分\n :return:\n ' if ((len(set(self.x)) <= 10) and (not self.force)): self.bins = np.array(list(self.x)) else: x_sort = sorted(list(set(self.x)), reverse=False) bins = [x_sort[0]] for i in range((len(x_sort) - 1)): ...
0845ee0a7d594cd25492604286418432869017bfe011625ddb8e35cb03eaf790
def __init__(self, logger): '\n Create a :class:`Kmeans_model` instance.\n\n Parameters\n ----------\n logger: :class:`mylogging.Logger`\n Logging object instance.\n ' self.logger = logger self.is_trained = False self.supported_formats = ['pkl', 'onnx', 'pmm...
Create a :class:`Kmeans_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance.
MMLL/models/POM1/Kmeans/Kmeans.py
__init__
Musketeer-H2020/MMLL-Robust
0
python
def __init__(self, logger): '\n Create a :class:`Kmeans_model` instance.\n\n Parameters\n ----------\n logger: :class:`mylogging.Logger`\n Logging object instance.\n ' self.logger = logger self.is_trained = False self.supported_formats = ['pkl', 'onnx', 'pmm...
def __init__(self, logger): '\n Create a :class:`Kmeans_model` instance.\n\n Parameters\n ----------\n logger: :class:`mylogging.Logger`\n Logging object instance.\n ' self.logger = logger self.is_trained = False self.supported_formats = ['pkl', 'onnx', 'pmm...
43464c7b3631948aa81ffd9ea8dd73ee8964706f6b8577308232f6f70fedf22c
def predict(self, X_b): '\n Uses the Kmeans model to predict new outputs given the inputs.\n\n Parameters\n ----------\n X_b: ndarray\n Array containing the input patterns.\n\n Returns\n -------\n preds: ndarray\n Array containing the prediction...
Uses the Kmeans model to predict new outputs given the inputs. Parameters ---------- X_b: ndarray Array containing the input patterns. Returns ------- preds: ndarray Array containing the predictions.
MMLL/models/POM1/Kmeans/Kmeans.py
predict
Musketeer-H2020/MMLL-Robust
0
python
def predict(self, X_b): '\n Uses the Kmeans model to predict new outputs given the inputs.\n\n Parameters\n ----------\n X_b: ndarray\n Array containing the input patterns.\n\n Returns\n -------\n preds: ndarray\n Array containing the prediction...
def predict(self, X_b): '\n Uses the Kmeans model to predict new outputs given the inputs.\n\n Parameters\n ----------\n X_b: ndarray\n Array containing the input patterns.\n\n Returns\n -------\n preds: ndarray\n Array containing the prediction...
2ebda6fb93b4607450d46ce4e435b54bb7ceb98c760a23a4e49c27ebe1509aff
def __init__(self, comms, logger, verbose=False, NC=None, Nmaxiter=None, tolerance=None): '\n Create a :class:`Kmeans_Master` instance.\n\n Parameters\n ----------\n comms: :class:`Comms_master`\n Object providing communication functionalities.\n\n logger: :class:`mylog...
Create a :class:`Kmeans_Master` instance. Parameters ---------- comms: :class:`Comms_master` Object providing communication functionalities. logger: :class:`mylogging.Logger` Logging object instance. verbose: boolean Indicates whether to print messages on screen nor not. NC: int Number of clusters. ...
MMLL/models/POM1/Kmeans/Kmeans.py
__init__
Musketeer-H2020/MMLL-Robust
0
python
def __init__(self, comms, logger, verbose=False, NC=None, Nmaxiter=None, tolerance=None): '\n Create a :class:`Kmeans_Master` instance.\n\n Parameters\n ----------\n comms: :class:`Comms_master`\n Object providing communication functionalities.\n\n logger: :class:`mylog...
def __init__(self, comms, logger, verbose=False, NC=None, Nmaxiter=None, tolerance=None): '\n Create a :class:`Kmeans_Master` instance.\n\n Parameters\n ----------\n comms: :class:`Comms_master`\n Object providing communication functionalities.\n\n logger: :class:`mylog...
cd6cdac46b8b652c8dd83b9932bcd6a71f8e6b89dafb8813987d8e37ddb57a21
def Update_State_Master(self): '\n Function to control the state of the execution.\n\n Parameters\n ----------\n None\n ' if (self.state_dict['CN'] == 'START_TRAIN'): self.state_dict['CN'] = 'SEND_CENTROIDS' if self.checkAllStates('INIT_CENTROIDS', self.state_dict)...
Function to control the state of the execution. Parameters ---------- None
MMLL/models/POM1/Kmeans/Kmeans.py
Update_State_Master
Musketeer-H2020/MMLL-Robust
0
python
def Update_State_Master(self): '\n Function to control the state of the execution.\n\n Parameters\n ----------\n None\n ' if (self.state_dict['CN'] == 'START_TRAIN'): self.state_dict['CN'] = 'SEND_CENTROIDS' if self.checkAllStates('INIT_CENTROIDS', self.state_dict)...
def Update_State_Master(self): '\n Function to control the state of the execution.\n\n Parameters\n ----------\n None\n ' if (self.state_dict['CN'] == 'START_TRAIN'): self.state_dict['CN'] = 'SEND_CENTROIDS' if self.checkAllStates('INIT_CENTROIDS', self.state_dict)...
9290b7015a18dea49ff1169b456516301a58e445e504d612becdf80fc6f06f52
def TakeAction_Master(self): '\n Function to take actions according to the state.\n\n Parameters\n ----------\n None\n ' to = 'MLmodel' if (self.state_dict['CN'] == 'SEND_CENTROIDS'): action = 'SEND_CENTROIDS' data = {'num_centroids': self.num_centroids} ...
Function to take actions according to the state. Parameters ---------- None
MMLL/models/POM1/Kmeans/Kmeans.py
TakeAction_Master
Musketeer-H2020/MMLL-Robust
0
python
def TakeAction_Master(self): '\n Function to take actions according to the state.\n\n Parameters\n ----------\n None\n ' to = 'MLmodel' if (self.state_dict['CN'] == 'SEND_CENTROIDS'): action = 'SEND_CENTROIDS' data = {'num_centroids': self.num_centroids} ...
def TakeAction_Master(self): '\n Function to take actions according to the state.\n\n Parameters\n ----------\n None\n ' to = 'MLmodel' if (self.state_dict['CN'] == 'SEND_CENTROIDS'): action = 'SEND_CENTROIDS' data = {'num_centroids': self.num_centroids} ...
2686a0ad2a637332430d325935ebb52a17cc150186f935df054caa69329e8ef1
def ProcessReceivedPacket_Master_(self, packet, sender): '\n Process the received packet at master.\n\n Parameters\n ----------\n packet: dictionary\n Packet received from a worker.\n\n sender: string\n Identification of the sender.\n ' if (packet[...
Process the received packet at master. Parameters ---------- packet: dictionary Packet received from a worker. sender: string Identification of the sender.
MMLL/models/POM1/Kmeans/Kmeans.py
ProcessReceivedPacket_Master_
Musketeer-H2020/MMLL-Robust
0
python
def ProcessReceivedPacket_Master_(self, packet, sender): '\n Process the received packet at master.\n\n Parameters\n ----------\n packet: dictionary\n Packet received from a worker.\n\n sender: string\n Identification of the sender.\n ' if (packet[...
def ProcessReceivedPacket_Master_(self, packet, sender): '\n Process the received packet at master.\n\n Parameters\n ----------\n packet: dictionary\n Packet received from a worker.\n\n sender: string\n Identification of the sender.\n ' if (packet[...
5b86c58c0d9e4f7cff1693a84714d7c27cfb9fdb20cdb57ee52cc4b0c213157c
def check_empty_clusters(self, array): '\n Function to check if there are empty clusters in array.\n \n Parameters\n ----------\n array: numpy array\n Array with centroids.\n\n Returns\n -------\n flag: boolean\n Flag indicating whether t...
Function to check if there are empty clusters in array. Parameters ---------- array: numpy array Array with centroids. Returns ------- flag: boolean Flag indicating whether there are empty clusters.
MMLL/models/POM1/Kmeans/Kmeans.py
check_empty_clusters
Musketeer-H2020/MMLL-Robust
0
python
def check_empty_clusters(self, array): '\n Function to check if there are empty clusters in array.\n \n Parameters\n ----------\n array: numpy array\n Array with centroids.\n\n Returns\n -------\n flag: boolean\n Flag indicating whether t...
def check_empty_clusters(self, array): '\n Function to check if there are empty clusters in array.\n \n Parameters\n ----------\n array: numpy array\n Array with centroids.\n\n Returns\n -------\n flag: boolean\n Flag indicating whether t...
50db99f2415aa404a602f0cc212f064bfd51da096708d40563869025ac0d5ae2
def __init__(self, master_address, comms, logger, verbose=False, Xtr_b=None): '\n Create a :class:`Kmeans_Worker` instance.\n\n Parameters\n ----------\n master_address: string\n Identifier of the master instance.\n\n comms: :class:`Comms_worker`\n Object pro...
Create a :class:`Kmeans_Worker` instance. Parameters ---------- master_address: string Identifier of the master instance. comms: :class:`Comms_worker` Object providing communication functionalities. logger: :class:`mylogging.Logger` Logging object instance. verbose: boolean Indicates whether to prin...
MMLL/models/POM1/Kmeans/Kmeans.py
__init__
Musketeer-H2020/MMLL-Robust
0
python
def __init__(self, master_address, comms, logger, verbose=False, Xtr_b=None): '\n Create a :class:`Kmeans_Worker` instance.\n\n Parameters\n ----------\n master_address: string\n Identifier of the master instance.\n\n comms: :class:`Comms_worker`\n Object pro...
def __init__(self, master_address, comms, logger, verbose=False, Xtr_b=None): '\n Create a :class:`Kmeans_Worker` instance.\n\n Parameters\n ----------\n master_address: string\n Identifier of the master instance.\n\n comms: :class:`Comms_worker`\n Object pro...
e6eceaea742da58c6bc436eae0899d2db274774ced44028cb2a45bb2ce80a339
def ProcessReceivedPacket_Worker(self, packet): '\n Process the received packet at worker.\n\n Parameters\n ----------\n packet: dictionary\n Packet received from the master.\n ' if (packet['action'] == 'SEND_CENTROIDS'): self.display((self.name + (' %s: Ini...
Process the received packet at worker. Parameters ---------- packet: dictionary Packet received from the master.
MMLL/models/POM1/Kmeans/Kmeans.py
ProcessReceivedPacket_Worker
Musketeer-H2020/MMLL-Robust
0
python
def ProcessReceivedPacket_Worker(self, packet): '\n Process the received packet at worker.\n\n Parameters\n ----------\n packet: dictionary\n Packet received from the master.\n ' if (packet['action'] == 'SEND_CENTROIDS'): self.display((self.name + (' %s: Ini...
def ProcessReceivedPacket_Worker(self, packet): '\n Process the received packet at worker.\n\n Parameters\n ----------\n packet: dictionary\n Packet received from the master.\n ' if (packet['action'] == 'SEND_CENTROIDS'): self.display((self.name + (' %s: Ini...
426f866b17e5d87c6d2ac8ba44c70d5922814e7fb956188227aed088007fee24
def naive_sharding(self, ds, k): '\n Initialize cluster centroids using deterministic naive sharding algorithm.\n \n Parameters\n ----------\n ds: numpy array\n The dataset to be used for centroid initialization.\n k: int\n The desired number of clusters f...
Initialize cluster centroids using deterministic naive sharding algorithm. Parameters ---------- ds: numpy array The dataset to be used for centroid initialization. k: int The desired number of clusters for which centroids are required. Returns ------- centroids : numpy array Collection of k centroids as ...
MMLL/models/POM1/Kmeans/Kmeans.py
naive_sharding
Musketeer-H2020/MMLL-Robust
0
python
def naive_sharding(self, ds, k): '\n Initialize cluster centroids using deterministic naive sharding algorithm.\n \n Parameters\n ----------\n ds: numpy array\n The dataset to be used for centroid initialization.\n k: int\n The desired number of clusters f...
def naive_sharding(self, ds, k): '\n Initialize cluster centroids using deterministic naive sharding algorithm.\n \n Parameters\n ----------\n ds: numpy array\n The dataset to be used for centroid initialization.\n k: int\n The desired number of clusters f...
88ed7a633db1a14f07fcc52eb3c7c9a555c6fbe792e4679e787f1dfccd0721ce
def _get_mean(self, sums, step): '\n Vectorizable ufunc for getting means of summed shard columns.\n \n Parameters\n ----------\n sums: float\n The summed shard columns.\n step: int\n The number of instances per shard.\n\n Returns\n -----...
Vectorizable ufunc for getting means of summed shard columns. Parameters ---------- sums: float The summed shard columns. step: int The number of instances per shard. Returns ------- sums/step (means): numpy array The means of the shard columns.
MMLL/models/POM1/Kmeans/Kmeans.py
_get_mean
Musketeer-H2020/MMLL-Robust
0
python
def _get_mean(self, sums, step): '\n Vectorizable ufunc for getting means of summed shard columns.\n \n Parameters\n ----------\n sums: float\n The summed shard columns.\n step: int\n The number of instances per shard.\n\n Returns\n -----...
def _get_mean(self, sums, step): '\n Vectorizable ufunc for getting means of summed shard columns.\n \n Parameters\n ----------\n sums: float\n The summed shard columns.\n step: int\n The number of instances per shard.\n\n Returns\n -----...
bd06a346d1d30b7aa02de6e8f917d120057581213ef3704c4d235a36860ef97c
def client(self, name: str) -> records.Database: '\n \n :param name: \n :return:\n ' if (name in self.__instance.__dict__.keys()): return self.__instance.__getattribute__(name) else: logging.debug(f'database client {name} do not exist!')
:param name: :return:
itest2/core/database_client.py
client
hzhang123/Itest2
0
python
def client(self, name: str) -> records.Database: '\n \n :param name: \n :return:\n ' if (name in self.__instance.__dict__.keys()): return self.__instance.__getattribute__(name) else: logging.debug(f'database client {name} do not exist!')
def client(self, name: str) -> records.Database: '\n \n :param name: \n :return:\n ' if (name in self.__instance.__dict__.keys()): return self.__instance.__getattribute__(name) else: logging.debug(f'database client {name} do not exist!')<|docstring|>:param name: ...
3b3e9fea530a115f5f926006fabbe375e9113530237afdb81dca64ba751ff9e3
def create_clients(self, conn_config: list=None): '\n 根据传入的配置创建records.Database\n :param conn_config: (\n {\n "name": "pg",\n "uri": "postgresql://user:password@host:port/database"\n }\n )\n :return:\n ' if (conn_config is no...
根据传入的配置创建records.Database :param conn_config: ( { "name": "pg", "uri": "postgresql://user:password@host:port/database" } ) :return:
itest2/core/database_client.py
create_clients
hzhang123/Itest2
0
python
def create_clients(self, conn_config: list=None): '\n 根据传入的配置创建records.Database\n :param conn_config: (\n {\n "name": "pg",\n "uri": "postgresql://user:password@host:port/database"\n }\n )\n :return:\n ' if (conn_config is no...
def create_clients(self, conn_config: list=None): '\n 根据传入的配置创建records.Database\n :param conn_config: (\n {\n "name": "pg",\n "uri": "postgresql://user:password@host:port/database"\n }\n )\n :return:\n ' if (conn_config is no...
d173b042d64eb6a64ddf51544d3432edfecb0e25b291f17fc6abcc0a67c66779
def create_client(self, name: str, uri: str): '\n 指定名称和连接串创建records.Database\n :param name: records.Database对象名称\n :param uri: 数据库连接串\n :return:\n ' if (name in self.__instance.__dict__.values()): if self.__instance.__getattribute__(name).open: return self....
指定名称和连接串创建records.Database :param name: records.Database对象名称 :param uri: 数据库连接串 :return:
itest2/core/database_client.py
create_client
hzhang123/Itest2
0
python
def create_client(self, name: str, uri: str): '\n 指定名称和连接串创建records.Database\n :param name: records.Database对象名称\n :param uri: 数据库连接串\n :return:\n ' if (name in self.__instance.__dict__.values()): if self.__instance.__getattribute__(name).open: return self....
def create_client(self, name: str, uri: str): '\n 指定名称和连接串创建records.Database\n :param name: records.Database对象名称\n :param uri: 数据库连接串\n :return:\n ' if (name in self.__instance.__dict__.values()): if self.__instance.__getattribute__(name).open: return self....
afd9a2a2bdccd99eed4a95b57c181efb0182921efa8fd0d972a1ac98f3aaa1ca
def np_euclidean_distance(p, q=0): ' Euclidean distance, useful for plotting results.' return np.sqrt(np.sum(np.square((p - q)), axis=(- 1)))
Euclidean distance, useful for plotting results.
sample_code/utils_nn.py
np_euclidean_distance
tkrivachy/neural-network-for-nonlocality-in-networks
6
python
def np_euclidean_distance(p, q=0): ' ' return np.sqrt(np.sum(np.square((p - q)), axis=(- 1)))
def np_euclidean_distance(p, q=0): ' ' return np.sqrt(np.sum(np.square((p - q)), axis=(- 1)))<|docstring|>Euclidean distance, useful for plotting results.<|endoftext|>
ee666960e7aa5bf520a3d3f00ce6205e41e242b01d9919b8ba123d67c6185261
def np_distance(p, q=0): ' Same as the distance used in the loss function, just written for numpy arrays.' if (cf.pnn.loss.lower() == 'l2'): return np.sum(np.square((p - q)), axis=(- 1)) elif (cf.pnn.loss.lower() == 'l1'): return (0.5 * np.sum(np.abs((p - q)), axis=(- 1))) elif (cf.pnn.l...
Same as the distance used in the loss function, just written for numpy arrays.
sample_code/utils_nn.py
np_distance
tkrivachy/neural-network-for-nonlocality-in-networks
6
python
def np_distance(p, q=0): ' ' if (cf.pnn.loss.lower() == 'l2'): return np.sum(np.square((p - q)), axis=(- 1)) elif (cf.pnn.loss.lower() == 'l1'): return (0.5 * np.sum(np.abs((p - q)), axis=(- 1))) elif (cf.pnn.loss.lower() == 'kl'): p = np.clip(p, K.epsilon(), 1) q = np.cl...
def np_distance(p, q=0): ' ' if (cf.pnn.loss.lower() == 'l2'): return np.sum(np.square((p - q)), axis=(- 1)) elif (cf.pnn.loss.lower() == 'l1'): return (0.5 * np.sum(np.abs((p - q)), axis=(- 1))) elif (cf.pnn.loss.lower() == 'kl'): p = np.clip(p, K.epsilon(), 1) q = np.cl...
f185898511380c4a2b84b78645a2efdf9608273dd27a17ea11a0186d6a5bf0b1
def keras_distance(p, q): ' Distance used in loss function. ' if (cf.pnn.loss.lower() == 'l2'): return K.sum(K.square((p - q)), axis=(- 1)) elif (cf.pnn.loss.lower() == 'l1'): return (0.5 * K.sum(K.abs((p - q)), axis=(- 1))) elif (cf.pnn.loss.lower() == 'kl'): p = K.clip(p, K.eps...
Distance used in loss function.
sample_code/utils_nn.py
keras_distance
tkrivachy/neural-network-for-nonlocality-in-networks
6
python
def keras_distance(p, q): ' ' if (cf.pnn.loss.lower() == 'l2'): return K.sum(K.square((p - q)), axis=(- 1)) elif (cf.pnn.loss.lower() == 'l1'): return (0.5 * K.sum(K.abs((p - q)), axis=(- 1))) elif (cf.pnn.loss.lower() == 'kl'): p = K.clip(p, K.epsilon(), 1) q = K.clip(q...
def keras_distance(p, q): ' ' if (cf.pnn.loss.lower() == 'l2'): return K.sum(K.square((p - q)), axis=(- 1)) elif (cf.pnn.loss.lower() == 'l1'): return (0.5 * K.sum(K.abs((p - q)), axis=(- 1))) elif (cf.pnn.loss.lower() == 'kl'): p = K.clip(p, K.epsilon(), 1) q = K.clip(q...
5d161ef35b115232db5d88b878e82ff1165792fc0a7e1c945015381cd243aa82
def customLoss_distr(y_pred): ' Converts the output of the neural network to a probability vector.\n That is from a shape of (batch_size, a_outputsize + b_outputsize + c_outputsize) to a shape of (a_outputsize * b_outputsize * c_outputsize,)\n ' a_probs = y_pred[(:, 0:cf.pnn.a_outputsize)] b_probs = y...
Converts the output of the neural network to a probability vector. That is from a shape of (batch_size, a_outputsize + b_outputsize + c_outputsize) to a shape of (a_outputsize * b_outputsize * c_outputsize,)
sample_code/utils_nn.py
customLoss_distr
tkrivachy/neural-network-for-nonlocality-in-networks
6
python
def customLoss_distr(y_pred): ' Converts the output of the neural network to a probability vector.\n That is from a shape of (batch_size, a_outputsize + b_outputsize + c_outputsize) to a shape of (a_outputsize * b_outputsize * c_outputsize,)\n ' a_probs = y_pred[(:, 0:cf.pnn.a_outputsize)] b_probs = y...
def customLoss_distr(y_pred): ' Converts the output of the neural network to a probability vector.\n That is from a shape of (batch_size, a_outputsize + b_outputsize + c_outputsize) to a shape of (a_outputsize * b_outputsize * c_outputsize,)\n ' a_probs = y_pred[(:, 0:cf.pnn.a_outputsize)] b_probs = y...
34259cb0add42747062583d6748a33a9b5213d76adda182c57af19cdf7416371
def customLoss(y_true, y_pred): ' Custom loss function.' return keras_distance(y_true[(0, :)], customLoss_distr(y_pred))
Custom loss function.
sample_code/utils_nn.py
customLoss
tkrivachy/neural-network-for-nonlocality-in-networks
6
python
def customLoss(y_true, y_pred): ' ' return keras_distance(y_true[(0, :)], customLoss_distr(y_pred))
def customLoss(y_true, y_pred): ' ' return keras_distance(y_true[(0, :)], customLoss_distr(y_pred))<|docstring|>Custom loss function.<|endoftext|>
56e19d9fa9475af28556c34efdf852217ce0c7f84ddb9c08bbf25be33692e57a
def single_evaluation(model): ' Evaluates the model and returns the resulting distribution as a numpy array. ' test_pred = model.predict_generator(generate_x_test(), steps=1, max_queue_size=10, workers=1, use_multiprocessing=False, verbose=0) result = K.eval(customLoss_distr(test_pred)) return result
Evaluates the model and returns the resulting distribution as a numpy array.
sample_code/utils_nn.py
single_evaluation
tkrivachy/neural-network-for-nonlocality-in-networks
6
python
def single_evaluation(model): ' ' test_pred = model.predict_generator(generate_x_test(), steps=1, max_queue_size=10, workers=1, use_multiprocessing=False, verbose=0) result = K.eval(customLoss_distr(test_pred)) return result
def single_evaluation(model): ' ' test_pred = model.predict_generator(generate_x_test(), steps=1, max_queue_size=10, workers=1, use_multiprocessing=False, verbose=0) result = K.eval(customLoss_distr(test_pred)) return result<|docstring|>Evaluates the model and returns the resulting distribution as a nu...
948b8d91ba7a99ac090d36bca962089f74e2f8e67fb27930d547ecef8c4ef707
def single_run(): ' Runs training algorithm for a single target distribution. Returns model.' K.clear_session() model = build_model() if (cf.pnn.start_from is not None): print('LOADING MODEL WEIGHTS FROM', cf.pnn.start_from) model = load_model(cf.pnn.start_from, custom_objects={'customLo...
Runs training algorithm for a single target distribution. Returns model.
sample_code/utils_nn.py
single_run
tkrivachy/neural-network-for-nonlocality-in-networks
6
python
def single_run(): ' ' K.clear_session() model = build_model() if (cf.pnn.start_from is not None): print('LOADING MODEL WEIGHTS FROM', cf.pnn.start_from) model = load_model(cf.pnn.start_from, custom_objects={'customLoss': customLoss}) if (cf.pnn.optimizer.lower() == 'adadelta'): ...
def single_run(): ' ' K.clear_session() model = build_model() if (cf.pnn.start_from is not None): print('LOADING MODEL WEIGHTS FROM', cf.pnn.start_from) model = load_model(cf.pnn.start_from, custom_objects={'customLoss': customLoss}) if (cf.pnn.optimizer.lower() == 'adadelta'): ...
074058ae2288a99a5c8eb8e4b88d5f32385b49973d53df4a3ea9274b24e8019c
def compare_models(model1, model2): ' Evaluates two models for p_target distribution and return one which is closer to it.' result1 = single_evaluation(model1) result2 = single_evaluation(model2) if (np_distance(result1, cf.pnn.p_target) < np_distance(result2, cf.pnn.p_target)): return (model1, ...
Evaluates two models for p_target distribution and return one which is closer to it.
sample_code/utils_nn.py
compare_models
tkrivachy/neural-network-for-nonlocality-in-networks
6
python
def compare_models(model1, model2): ' ' result1 = single_evaluation(model1) result2 = single_evaluation(model2) if (np_distance(result1, cf.pnn.p_target) < np_distance(result2, cf.pnn.p_target)): return (model1, 1) else: return (model2, 2)
def compare_models(model1, model2): ' ' result1 = single_evaluation(model1) result2 = single_evaluation(model2) if (np_distance(result1, cf.pnn.p_target) < np_distance(result2, cf.pnn.p_target)): return (model1, 1) else: return (model2, 2)<|docstring|>Evaluates two models for p_targe...
33ee43416d801bd8e493dc3b9895912f0e49f78134786115163b3872715847b3
def update_results(model_new, i): ' Updates plots and results if better than the one I loaded the model from in this round.\n If I am in last sample of the sweep I will plot no matter one, so that there is at least one plot per sweep.\n ' result_new = single_evaluation(model_new) distance_new = np_dis...
Updates plots and results if better than the one I loaded the model from in this round. If I am in last sample of the sweep I will plot no matter one, so that there is at least one plot per sweep.
sample_code/utils_nn.py
update_results
tkrivachy/neural-network-for-nonlocality-in-networks
6
python
def update_results(model_new, i): ' Updates plots and results if better than the one I loaded the model from in this round.\n If I am in last sample of the sweep I will plot no matter one, so that there is at least one plot per sweep.\n ' result_new = single_evaluation(model_new) distance_new = np_dis...
def update_results(model_new, i): ' Updates plots and results if better than the one I loaded the model from in this round.\n If I am in last sample of the sweep I will plot no matter one, so that there is at least one plot per sweep.\n ' result_new = single_evaluation(model_new) distance_new = np_dis...
3d252545edcad8aa25655328270be8e440794d7ff5c95b805ad0c35ddc088b6a
def __init__(self, function_space, depth, options, test_function=None): '\n :arg function_space: :class:`FunctionSpace` where the solution belongs\n :arg depth: :class: `DepthExpression` containing depth info\n :arg options: :class`ModelOptions2d` containing parameters\n ' super(Cons...
:arg function_space: :class:`FunctionSpace` where the solution belongs :arg depth: :class: `DepthExpression` containing depth info :arg options: :class`ModelOptions2d` containing parameters
thetis/conservative_tracer_eq_2d.py
__init__
connorjward/thetis
45
python
def __init__(self, function_space, depth, options, test_function=None): '\n :arg function_space: :class:`FunctionSpace` where the solution belongs\n :arg depth: :class: `DepthExpression` containing depth info\n :arg options: :class`ModelOptions2d` containing parameters\n ' super(Cons...
def __init__(self, function_space, depth, options, test_function=None): '\n :arg function_space: :class:`FunctionSpace` where the solution belongs\n :arg depth: :class: `DepthExpression` containing depth info\n :arg options: :class`ModelOptions2d` containing parameters\n ' super(Cons...
28f9c212ed47d8671c69b715860d0442791b744e3d9cd28a7a43ed96c9815fdd
def init(self, target_rule, x='x', y='y'): "Initializes the grammar.\n\n A grammar can only be used for sampling after initialization.\n The initialization takes time linear in the size of the grammar.\n\n Parameters\n ----------\n target_rule : str\n Rule to be sampled...
Initializes the grammar. A grammar can only be used for sampling after initialization. The initialization takes time linear in the size of the grammar. Parameters ---------- target_rule : str Rule to be sampled from (sampling will also be possible for all rules the target depends on). x : str, optional (defau...
pyboltzmann/decomposition_grammar.py
init
towink/boltzmann-planar-graph
0
python
def init(self, target_rule, x='x', y='y'): "Initializes the grammar.\n\n A grammar can only be used for sampling after initialization.\n The initialization takes time linear in the size of the grammar.\n\n Parameters\n ----------\n target_rule : str\n Rule to be sampled...
def init(self, target_rule, x='x', y='y'): "Initializes the grammar.\n\n A grammar can only be used for sampling after initialization.\n The initialization takes time linear in the size of the grammar.\n\n Parameters\n ----------\n target_rule : str\n Rule to be sampled...
234ab42c58fa9536186aa2351b2d6c2d3faa41c4225e3f281878ef82ad4f803b
def _init_alias_samplers(self): 'Sets the grammar in the alias samplers.' def apply_to_each(sampler): if isinstance(sampler, pybo.AliasSampler): sampler.grammar = self sampler._referenced_sampler = self[sampler.sampled_class] sampler.children = (sampler._referenced_s...
Sets the grammar in the alias samplers.
pyboltzmann/decomposition_grammar.py
_init_alias_samplers
towink/boltzmann-planar-graph
0
python
def _init_alias_samplers(self): def apply_to_each(sampler): if isinstance(sampler, pybo.AliasSampler): sampler.grammar = self sampler._referenced_sampler = self[sampler.sampled_class] sampler.children = (sampler._referenced_sampler,) for alias in self._rules: ...
def _init_alias_samplers(self): def apply_to_each(sampler): if isinstance(sampler, pybo.AliasSampler): sampler.grammar = self sampler._referenced_sampler = self[sampler.sampled_class] sampler.children = (sampler._referenced_sampler,) for alias in self._rules: ...
34787d3ff52556bc42d3dd5fca6b48e72132d30a2b05fdaa27aa5a2c66e92947
def _find_recursive_rules(self): 'Analyses the grammar to find out which rules are recursive and saves\n them.\n ' rec_rules = [] for alias in self.rules: sampler = self[alias] def apply_to_each(s): if (isinstance(s, pybo.AliasSampler) and (s.sampled_class == alias...
Analyses the grammar to find out which rules are recursive and saves them.
pyboltzmann/decomposition_grammar.py
_find_recursive_rules
towink/boltzmann-planar-graph
0
python
def _find_recursive_rules(self): 'Analyses the grammar to find out which rules are recursive and saves\n them.\n ' rec_rules = [] for alias in self.rules: sampler = self[alias] def apply_to_each(s): if (isinstance(s, pybo.AliasSampler) and (s.sampled_class == alias...
def _find_recursive_rules(self): 'Analyses the grammar to find out which rules are recursive and saves\n them.\n ' rec_rules = [] for alias in self.rules: sampler = self[alias] def apply_to_each(s): if (isinstance(s, pybo.AliasSampler) and (s.sampled_class == alias...
4fba5c435b0ca8a6755c648ca7eb2c96321ecf68f615df314ef23fed7aca7ee1
def _infer_target_class_labels(self): 'Automatically tries to infer class labels if they are not given\n explicitly.\n ' for alias in self.rules: sampler = self[alias] while isinstance(sampler, pybo.BijectionSampler): sampler = sampler.get_children()[0] if isins...
Automatically tries to infer class labels if they are not given explicitly.
pyboltzmann/decomposition_grammar.py
_infer_target_class_labels
towink/boltzmann-planar-graph
0
python
def _infer_target_class_labels(self): 'Automatically tries to infer class labels if they are not given\n explicitly.\n ' for alias in self.rules: sampler = self[alias] while isinstance(sampler, pybo.BijectionSampler): sampler = sampler.get_children()[0] if isins...
def _infer_target_class_labels(self): 'Automatically tries to infer class labels if they are not given\n explicitly.\n ' for alias in self.rules: sampler = self[alias] while isinstance(sampler, pybo.BijectionSampler): sampler = sampler.get_children()[0] if isins...
2a1076a2cb6e893f940a85f43120e5e136612ecfcbb3b198dbbaccaea9d5b5c3
def _collect_oracle_queries(self): 'Returns all oracle queries that may be needed when sampling from\n the rule identified by alias.\n ' visitor = self._CollectOracleQueriesVisitor(self._target_x, self._target_y) self[self._target_rule].accept(visitor) return sorted(visitor.result)
Returns all oracle queries that may be needed when sampling from the rule identified by alias.
pyboltzmann/decomposition_grammar.py
_collect_oracle_queries
towink/boltzmann-planar-graph
0
python
def _collect_oracle_queries(self): 'Returns all oracle queries that may be needed when sampling from\n the rule identified by alias.\n ' visitor = self._CollectOracleQueriesVisitor(self._target_x, self._target_y) self[self._target_rule].accept(visitor) return sorted(visitor.result)
def _collect_oracle_queries(self): 'Returns all oracle queries that may be needed when sampling from\n the rule identified by alias.\n ' visitor = self._CollectOracleQueriesVisitor(self._target_x, self._target_y) self[self._target_rule].accept(visitor) return sorted(visitor.result)<|docstr...
abab91e3ed9ae5d055dc10664bb617887bf230d40180aa6e3d856719d5c26943
def _precompute_evals(self): 'Precomputes all evaluations needed for sampling from the given\n class with the symbolic x and y values.\n ' visitor = self._PrecomputeEvaluationsVisitor(self._target_x, self._target_y) self[self._target_rule].accept(visitor)
Precomputes all evaluations needed for sampling from the given class with the symbolic x and y values.
pyboltzmann/decomposition_grammar.py
_precompute_evals
towink/boltzmann-planar-graph
0
python
def _precompute_evals(self): 'Precomputes all evaluations needed for sampling from the given\n class with the symbolic x and y values.\n ' visitor = self._PrecomputeEvaluationsVisitor(self._target_x, self._target_y) self[self._target_rule].accept(visitor)
def _precompute_evals(self): 'Precomputes all evaluations needed for sampling from the given\n class with the symbolic x and y values.\n ' visitor = self._PrecomputeEvaluationsVisitor(self._target_x, self._target_y) self[self._target_rule].accept(visitor)<|docstring|>Precomputes all evaluation...
c8f8010200e9f225501a782d2de17c7f96cd860783abcddd3b4119e52a33e394
def restart_sampler(self): 'Restarts the iterative sampler.' self._restart_flag = True
Restarts the iterative sampler.
pyboltzmann/decomposition_grammar.py
restart_sampler
towink/boltzmann-planar-graph
0
python
def restart_sampler(self): self._restart_flag = True
def restart_sampler(self): self._restart_flag = True<|docstring|>Restarts the iterative sampler.<|endoftext|>
f0cd66af226b7d3c6c388b2166f2314aeb5705f600511563e37687400e58bd37
def set_builder(self, rules=None, builder=pybo.DefaultBuilder()): 'Sets a builder for a given set of rules.\n\n Parameters\n ----------\n rules : str or iterable, optional (default=all rules in the grammar)\n Rules for which the builder should be set.\n builder : Combinatorial...
Sets a builder for a given set of rules. Parameters ---------- rules : str or iterable, optional (default=all rules in the grammar) Rules for which the builder should be set. builder : CombinatorialClassBuilder, optional (default=DefaultBuilder) The builder object itself. Returns ------- v : SetBuilderVisitor
pyboltzmann/decomposition_grammar.py
set_builder
towink/boltzmann-planar-graph
0
python
def set_builder(self, rules=None, builder=pybo.DefaultBuilder()): 'Sets a builder for a given set of rules.\n\n Parameters\n ----------\n rules : str or iterable, optional (default=all rules in the grammar)\n Rules for which the builder should be set.\n builder : Combinatorial...
def set_builder(self, rules=None, builder=pybo.DefaultBuilder()): 'Sets a builder for a given set of rules.\n\n Parameters\n ----------\n rules : str or iterable, optional (default=all rules in the grammar)\n Rules for which the builder should be set.\n builder : Combinatorial...
13fb210208ec1c04fa211a6c04b0a95f441cb22a871eabda3750e03a11971af4
def add_rule(self, alias, sampler): 'Adds a decomposition rule to this grammar.\n\n Parameters\n ----------\n alias : str\n sampler : BoltzmannSamplerBase\n ' self._rules[alias] = sampler
Adds a decomposition rule to this grammar. Parameters ---------- alias : str sampler : BoltzmannSamplerBase
pyboltzmann/decomposition_grammar.py
add_rule
towink/boltzmann-planar-graph
0
python
def add_rule(self, alias, sampler): 'Adds a decomposition rule to this grammar.\n\n Parameters\n ----------\n alias : str\n sampler : BoltzmannSamplerBase\n ' self._rules[alias] = sampler
def add_rule(self, alias, sampler): 'Adds a decomposition rule to this grammar.\n\n Parameters\n ----------\n alias : str\n sampler : BoltzmannSamplerBase\n ' self._rules[alias] = sampler<|docstring|>Adds a decomposition rule to this grammar. Parameters ---------- alias : str...
50fc32e429fed6fdc44cf9c3cc5fec43f355c245ee3c156a46a4bc41e33d3873
def __setitem__(self, key, value): 'Shorthand for add_rule.' self.add_rule(key, value)
Shorthand for add_rule.
pyboltzmann/decomposition_grammar.py
__setitem__
towink/boltzmann-planar-graph
0
python
def __setitem__(self, key, value): self.add_rule(key, value)
def __setitem__(self, key, value): self.add_rule(key, value)<|docstring|>Shorthand for add_rule.<|endoftext|>
35ff6b266aa18f036078b8797956fcef6440c24c39d072e61f4211c2d2efb19d
def get_rule(self, alias): 'Returns the rule corresponding to the given alias.\n\n Parameters\n ----------\n alias : str\n\n Returns\n -------\n BoltzmannSamplerBase\n ' return self._rules[alias]
Returns the rule corresponding to the given alias. Parameters ---------- alias : str Returns ------- BoltzmannSamplerBase
pyboltzmann/decomposition_grammar.py
get_rule
towink/boltzmann-planar-graph
0
python
def get_rule(self, alias): 'Returns the rule corresponding to the given alias.\n\n Parameters\n ----------\n alias : str\n\n Returns\n -------\n BoltzmannSamplerBase\n ' return self._rules[alias]
def get_rule(self, alias): 'Returns the rule corresponding to the given alias.\n\n Parameters\n ----------\n alias : str\n\n Returns\n -------\n BoltzmannSamplerBase\n ' return self._rules[alias]<|docstring|>Returns the rule corresponding to the given alias. Par...