body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
def get_nm_node_yaml(nm_host, node_name, ssl_verify=False, verbose=False):
'\n Get the raw ENC YAML for a given node\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param node_name: name of the node to get YAML for\n :type node_name: string\n :param ssl_verify: whether or... | 6,246,137,961,526,569,000 | Get the raw ENC YAML for a given node
:param nm_host: NodeMeister hostname or IP
:type nm_host: string
:param node_name: name of the node to get YAML for
:type node_name: string
:param ssl_verify: whether or not to verify SSL certificate, default False
:type ssl_verify: boolean
:rtype: string
:returns: raw YAML string... | contrib/cli_scripts/nodemeisterlib.py | get_nm_node_yaml | coxmediagroup/nodemeister | python | def get_nm_node_yaml(nm_host, node_name, ssl_verify=False, verbose=False):
'\n Get the raw ENC YAML for a given node\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param node_name: name of the node to get YAML for\n :type node_name: string\n :param ssl_verify: whether or... |
def get_dashboard_node_yaml(url, ssl_verify=False, verbose=False):
'\n Given the full URL to a Puppet Dashboard node YAML file,\n return the content of the YAML file as a string.\n\n :param url: full URL to Dashboard node yaml\n :type url: string\n :param ssl_verify: whether or not to verify SSL cert... | 1,135,490,431,877,605,600 | Given the full URL to a Puppet Dashboard node YAML file,
return the content of the YAML file as a string.
:param url: full URL to Dashboard node yaml
:type url: string
:param ssl_verify: whether or not to verify SSL certificate, default False
:type ssl_verify: boolean
:rtype: string
:returns: raw YAML string, or None | contrib/cli_scripts/nodemeisterlib.py | get_dashboard_node_yaml | coxmediagroup/nodemeister | python | def get_dashboard_node_yaml(url, ssl_verify=False, verbose=False):
'\n Given the full URL to a Puppet Dashboard node YAML file,\n return the content of the YAML file as a string.\n\n :param url: full URL to Dashboard node yaml\n :type url: string\n :param ssl_verify: whether or not to verify SSL cert... |
def get_json(url):
"\n uses requests to GET and return deserialized json\n\n uses anyjson if the Response object doesn't have .json()\n\n :param url: the URL to get\n :type url: string\n :rtype: dict/mixed or None\n :returns: unserialized JSON, or None\n "
r = requests.get(url)
if ('jso... | -8,498,332,083,392,072,000 | uses requests to GET and return deserialized json
uses anyjson if the Response object doesn't have .json()
:param url: the URL to get
:type url: string
:rtype: dict/mixed or None
:returns: unserialized JSON, or None | contrib/cli_scripts/nodemeisterlib.py | get_json | coxmediagroup/nodemeister | python | def get_json(url):
"\n uses requests to GET and return deserialized json\n\n uses anyjson if the Response object doesn't have .json()\n\n :param url: the URL to get\n :type url: string\n :rtype: dict/mixed or None\n :returns: unserialized JSON, or None\n "
r = requests.get(url)
if ('jso... |
def get_group_names(nm_host):
'\n Return a dict of groups in the NM instance,\n id => name\n\n :param nm_host: NodeMeister hostname/IP\n :type nm_host: string\n :rtype: dict\n :returns: NM groups, dict of the form {id<int>: name<string>}\n '
j = get_json(('http://%s/enc/groups/' % nm_host))... | 2,884,852,824,760,734,000 | Return a dict of groups in the NM instance,
id => name
:param nm_host: NodeMeister hostname/IP
:type nm_host: string
:rtype: dict
:returns: NM groups, dict of the form {id<int>: name<string>} | contrib/cli_scripts/nodemeisterlib.py | get_group_names | coxmediagroup/nodemeister | python | def get_group_names(nm_host):
'\n Return a dict of groups in the NM instance,\n id => name\n\n :param nm_host: NodeMeister hostname/IP\n :type nm_host: string\n :rtype: dict\n :returns: NM groups, dict of the form {id<int>: name<string>}\n '
j = get_json(('http://%s/enc/groups/' % nm_host))... |
def get_nm_group_classes(nm_host):
"\n Return a dict of all group classes in NM,\n with their id as the dict key.\n\n :param nm_host: NodeMeister hostname/IP\n :type nm_host: string\n :rtype: dict\n :returns: NM group classes, dict of the form:\n {id<int>: {'classname': <string>, 'classparams... | 1,286,843,342,070,683,100 | Return a dict of all group classes in NM,
with their id as the dict key.
:param nm_host: NodeMeister hostname/IP
:type nm_host: string
:rtype: dict
:returns: NM group classes, dict of the form:
{id<int>: {'classname': <string>, 'classparams': <string or None>, 'group': <int>, 'id': <int>} | contrib/cli_scripts/nodemeisterlib.py | get_nm_group_classes | coxmediagroup/nodemeister | python | def get_nm_group_classes(nm_host):
"\n Return a dict of all group classes in NM,\n with their id as the dict key.\n\n :param nm_host: NodeMeister hostname/IP\n :type nm_host: string\n :rtype: dict\n :returns: NM group classes, dict of the form:\n {id<int>: {'classname': <string>, 'classparams... |
def get_nm_group_params(nm_host):
"\n Return a dict of all group params in NM,\n with their id as the dict key.\n\n :param nm_host: NodeMeister hostname/IP\n :type nm_host: string\n :rtype: dict\n :returns: NM group params, dict of the form:\n {id<int>: {'paramkey': <string>, 'paramvalue': <s... | -6,756,621,771,376,389,000 | Return a dict of all group params in NM,
with their id as the dict key.
:param nm_host: NodeMeister hostname/IP
:type nm_host: string
:rtype: dict
:returns: NM group params, dict of the form:
{id<int>: {'paramkey': <string>, 'paramvalue': <string or None>, 'group': <int>, 'id': <int>} | contrib/cli_scripts/nodemeisterlib.py | get_nm_group_params | coxmediagroup/nodemeister | python | def get_nm_group_params(nm_host):
"\n Return a dict of all group params in NM,\n with their id as the dict key.\n\n :param nm_host: NodeMeister hostname/IP\n :type nm_host: string\n :rtype: dict\n :returns: NM group params, dict of the form:\n {id<int>: {'paramkey': <string>, 'paramvalue': <s... |
def get_nm_group(nm_host, gname=None, gid=None, groupnames=None):
"\n Return a dict of information about a group\n in NM, by either name or ID. If gname is specified,\n it will be resolved to the id.\n\n groupnames, if specified, is the output dict from get_group_names();\n if it is not specified, ge... | -2,901,903,478,772,705,000 | Return a dict of information about a group
in NM, by either name or ID. If gname is specified,
it will be resolved to the id.
groupnames, if specified, is the output dict from get_group_names();
if it is not specified, get_group_names() will be called internally.
:param nm_host: NodeMeister hostname/IP
:type nm_host:... | contrib/cli_scripts/nodemeisterlib.py | get_nm_group | coxmediagroup/nodemeister | python | def get_nm_group(nm_host, gname=None, gid=None, groupnames=None):
"\n Return a dict of information about a group\n in NM, by either name or ID. If gname is specified,\n it will be resolved to the id.\n\n groupnames, if specified, is the output dict from get_group_names();\n if it is not specified, ge... |
def interpolate_group(group, classes, params, group_names):
'\n In the dict returned by get_nm_group, replace class\n and parameter IDs, and other group IDs, with their\n appropriate string or dict representations.\n\n :param group: the Group dict returned by get_nm_group()\n :type group: dict\n :... | -3,105,283,020,348,467,700 | In the dict returned by get_nm_group, replace class
and parameter IDs, and other group IDs, with their
appropriate string or dict representations.
:param group: the Group dict returned by get_nm_group()
:type group: dict
:param classes: the dict of classes returned by get_nm_group_classes()
:type classes: dict
:param ... | contrib/cli_scripts/nodemeisterlib.py | interpolate_group | coxmediagroup/nodemeister | python | def interpolate_group(group, classes, params, group_names):
'\n In the dict returned by get_nm_group, replace class\n and parameter IDs, and other group IDs, with their\n appropriate string or dict representations.\n\n :param group: the Group dict returned by get_nm_group()\n :type group: dict\n :... |
def add_group(nm_host, name, description, parents=None, groups=None, dry_run=False):
'\n add a group to NodeMeister\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param name: name of the new group\n :type name: string\n :param description: description of the new group\n ... | 6,958,710,027,952,785,000 | add a group to NodeMeister
:param nm_host: NodeMeister hostname or IP
:type nm_host: string
:param name: name of the new group
:type name: string
:param description: description of the new group
:type description: string
:param parents: parents of this group
:type parents: list of int IDs
:param groups: child groups o... | contrib/cli_scripts/nodemeisterlib.py | add_group | coxmediagroup/nodemeister | python | def add_group(nm_host, name, description, parents=None, groups=None, dry_run=False):
'\n add a group to NodeMeister\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param name: name of the new group\n :type name: string\n :param description: description of the new group\n ... |
def get_nm_group_id(nm_host, name, groups=None, dry_run=False):
'\n Get the group ID of a group specified by name\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param name: name of the new group\n :type name: string\n :param groups: dict of groups as returned by get_grou... | 6,712,355,395,058,232,000 | Get the group ID of a group specified by name
:param nm_host: NodeMeister hostname or IP
:type nm_host: string
:param name: name of the new group
:type name: string
:param groups: dict of groups as returned by get_group_names()
:type groups: dict
:returns: int ID of the group or False on failure
:rtype: int or False | contrib/cli_scripts/nodemeisterlib.py | get_nm_group_id | coxmediagroup/nodemeister | python | def get_nm_group_id(nm_host, name, groups=None, dry_run=False):
'\n Get the group ID of a group specified by name\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param name: name of the new group\n :type name: string\n :param groups: dict of groups as returned by get_grou... |
def add_param_to_group(nm_host, gid, pname, pval, dry_run=False):
'\n add a parameter to a group in NodeMeister\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param gid: numeric ID of the group to add param to\n :type gid: int\n :param pname: parameter name\n :type pn... | 7,117,024,628,070,776,000 | add a parameter to a group in NodeMeister
:param nm_host: NodeMeister hostname or IP
:type nm_host: string
:param gid: numeric ID of the group to add param to
:type gid: int
:param pname: parameter name
:type pname: string
:param pval: parameter value
:type pval: string
:param dry_run: if True, only print what would b... | contrib/cli_scripts/nodemeisterlib.py | add_param_to_group | coxmediagroup/nodemeister | python | def add_param_to_group(nm_host, gid, pname, pval, dry_run=False):
'\n add a parameter to a group in NodeMeister\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param gid: numeric ID of the group to add param to\n :type gid: int\n :param pname: parameter name\n :type pn... |
def add_class_to_group(nm_host, gid, classname, classparams=None, dry_run=False):
'\n add a class to a group in NodeMeister\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param gid: numeric ID of the group to add param to\n :type gid: int\n :param classname: class name\n... | -6,649,117,288,331,533,000 | add a class to a group in NodeMeister
:param nm_host: NodeMeister hostname or IP
:type nm_host: string
:param gid: numeric ID of the group to add param to
:type gid: int
:param classname: class name
:type classname: string
:param classparams: class parameters, default None
:type classparams: string or None
:param dry_... | contrib/cli_scripts/nodemeisterlib.py | add_class_to_group | coxmediagroup/nodemeister | python | def add_class_to_group(nm_host, gid, classname, classparams=None, dry_run=False):
'\n add a class to a group in NodeMeister\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param gid: numeric ID of the group to add param to\n :type gid: int\n :param classname: class name\n... |
def get_node_names(nm_host):
'\n Return a dict of nodes in the NM instance,\n id => hostname\n\n :param nm_host: NodeMeister hostname/IP\n :type nm_host: string\n :rtype: dict\n :returns: NM nodes, dict of the form {id<int>: hostname<string>}\n '
j = get_json(('http://%s/enc/nodes/' % nm_ho... | -3,141,816,096,082,172,400 | Return a dict of nodes in the NM instance,
id => hostname
:param nm_host: NodeMeister hostname/IP
:type nm_host: string
:rtype: dict
:returns: NM nodes, dict of the form {id<int>: hostname<string>} | contrib/cli_scripts/nodemeisterlib.py | get_node_names | coxmediagroup/nodemeister | python | def get_node_names(nm_host):
'\n Return a dict of nodes in the NM instance,\n id => hostname\n\n :param nm_host: NodeMeister hostname/IP\n :type nm_host: string\n :rtype: dict\n :returns: NM nodes, dict of the form {id<int>: hostname<string>}\n '
j = get_json(('http://%s/enc/nodes/' % nm_ho... |
def get_nm_node_id(nm_host, hostname, nodenames=None, dry_run=False):
'\n Get the node ID of a node specified by hostname\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param hostname: hostname of the node\n :type hostname: string\n :param nodenames: dict of nodes as ret... | -3,084,336,057,350,448,000 | Get the node ID of a node specified by hostname
:param nm_host: NodeMeister hostname or IP
:type nm_host: string
:param hostname: hostname of the node
:type hostname: string
:param nodenames: dict of nodes as returned by get_node_names()
:type nodenames: dict
:returns: int ID of the group or False on failure
:rtype: i... | contrib/cli_scripts/nodemeisterlib.py | get_nm_node_id | coxmediagroup/nodemeister | python | def get_nm_node_id(nm_host, hostname, nodenames=None, dry_run=False):
'\n Get the node ID of a node specified by hostname\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param hostname: hostname of the node\n :type hostname: string\n :param nodenames: dict of nodes as ret... |
def get_nm_node(nm_host, hostname=None, node_id=None, nodenames=None):
"\n Return a dict of information about a node\n in NM, by either name or ID. If nodename is specified,\n it will be resolved to the id.\n\n nodenames, if specified, is the output dict from get_node_names();\n if it is not specifie... | -935,066,461,939,325,300 | Return a dict of information about a node
in NM, by either name or ID. If nodename is specified,
it will be resolved to the id.
nodenames, if specified, is the output dict from get_node_names();
if it is not specified, get_node_names() will be called internally.
:param nm_host: NodeMeister hostname/IP
:type nm_host: ... | contrib/cli_scripts/nodemeisterlib.py | get_nm_node | coxmediagroup/nodemeister | python | def get_nm_node(nm_host, hostname=None, node_id=None, nodenames=None):
"\n Return a dict of information about a node\n in NM, by either name or ID. If nodename is specified,\n it will be resolved to the id.\n\n nodenames, if specified, is the output dict from get_node_names();\n if it is not specifie... |
def get_nm_node_classes(nm_host):
"\n Return a dict of all node classes in NM,\n with their id as the dict key.\n\n :param nm_host: NodeMeister hostname/IP\n :type nm_host: string\n :rtype: dict\n :returns: NM node classes, dict of the form:\n {id<int>: {'classname': <string>, 'classparams': ... | 2,523,380,446,720,163,000 | Return a dict of all node classes in NM,
with their id as the dict key.
:param nm_host: NodeMeister hostname/IP
:type nm_host: string
:rtype: dict
:returns: NM node classes, dict of the form:
{id<int>: {'classname': <string>, 'classparams': <string or None>, 'node': <int>, 'id': <int>} | contrib/cli_scripts/nodemeisterlib.py | get_nm_node_classes | coxmediagroup/nodemeister | python | def get_nm_node_classes(nm_host):
"\n Return a dict of all node classes in NM,\n with their id as the dict key.\n\n :param nm_host: NodeMeister hostname/IP\n :type nm_host: string\n :rtype: dict\n :returns: NM node classes, dict of the form:\n {id<int>: {'classname': <string>, 'classparams': ... |
def get_nm_node_params(nm_host):
"\n Return a dict of all node params in NM,\n with their id as the dict key.\n\n :param nm_host: NodeMeister hostname/IP\n :type nm_host: string\n :rtype: dict\n :returns: NM node params, dict of the form:\n {id<int>: {'paramkey': <string>, 'paramvalue': <stri... | 5,518,445,424,977,798,000 | Return a dict of all node params in NM,
with their id as the dict key.
:param nm_host: NodeMeister hostname/IP
:type nm_host: string
:rtype: dict
:returns: NM node params, dict of the form:
{id<int>: {'paramkey': <string>, 'paramvalue': <string or None>, 'node': <int>, 'id': <int>} | contrib/cli_scripts/nodemeisterlib.py | get_nm_node_params | coxmediagroup/nodemeister | python | def get_nm_node_params(nm_host):
"\n Return a dict of all node params in NM,\n with their id as the dict key.\n\n :param nm_host: NodeMeister hostname/IP\n :type nm_host: string\n :rtype: dict\n :returns: NM node params, dict of the form:\n {id<int>: {'paramkey': <string>, 'paramvalue': <stri... |
def add_node(nm_host, hostname, description, groups=None, dry_run=False):
'\n add a node to NodeMeister\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param hostname: hostname of the new node\n :type hostname: string\n :param description: description of the new node\n ... | 5,612,093,654,777,876,000 | add a node to NodeMeister
:param nm_host: NodeMeister hostname or IP
:type nm_host: string
:param hostname: hostname of the new node
:type hostname: string
:param description: description of the new node
:type description: string
:param groups: groups that this node is in
:type groups: list of int IDs
:param dry_run: ... | contrib/cli_scripts/nodemeisterlib.py | add_node | coxmediagroup/nodemeister | python | def add_node(nm_host, hostname, description, groups=None, dry_run=False):
'\n add a node to NodeMeister\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param hostname: hostname of the new node\n :type hostname: string\n :param description: description of the new node\n ... |
def add_param_to_node(nm_host, node_id, pname, pval, dry_run=False):
'\n add a parameter to a node in NodeMeister\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param node_id: numeric ID of the node to add param to\n :type node_id: int\n :param pname: parameter name\n ... | 8,472,072,113,677,377,000 | add a parameter to a node in NodeMeister
:param nm_host: NodeMeister hostname or IP
:type nm_host: string
:param node_id: numeric ID of the node to add param to
:type node_id: int
:param pname: parameter name
:type pname: string
:param pval: parameter value
:type pval: string
:param dry_run: if True, only print what w... | contrib/cli_scripts/nodemeisterlib.py | add_param_to_node | coxmediagroup/nodemeister | python | def add_param_to_node(nm_host, node_id, pname, pval, dry_run=False):
'\n add a parameter to a node in NodeMeister\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param node_id: numeric ID of the node to add param to\n :type node_id: int\n :param pname: parameter name\n ... |
def add_class_to_node(nm_host, node_id, classname, classparams=None, dry_run=False):
'\n add a class to a node in NodeMeister\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param node_id: numeric ID of the node to add param to\n :type node_id: int\n :param classname: cla... | -8,682,323,673,473,580,000 | add a class to a node in NodeMeister
:param nm_host: NodeMeister hostname or IP
:type nm_host: string
:param node_id: numeric ID of the node to add param to
:type node_id: int
:param classname: class name
:type classname: string
:param classparams: class parameters, default None
:type classparams: string or None
:para... | contrib/cli_scripts/nodemeisterlib.py | add_class_to_node | coxmediagroup/nodemeister | python | def add_class_to_node(nm_host, node_id, classname, classparams=None, dry_run=False):
'\n add a class to a node in NodeMeister\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param node_id: numeric ID of the node to add param to\n :type node_id: int\n :param classname: cla... |
def get_name_for_class_exclusion(nm_host, class_exclusion_id, verbose):
'\n Get the excluded class name for a given ClassExclusion ID.\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param class_exclusion_id: numeric ID of the class exclusion\n :type class_exclusion_id: int\... | 5,429,085,462,293,692,000 | Get the excluded class name for a given ClassExclusion ID.
:param nm_host: NodeMeister hostname or IP
:type nm_host: string
:param class_exclusion_id: numeric ID of the class exclusion
:type class_exclusion_id: int
:returns: string name of class, or False on faliure
:rtype: string or False | contrib/cli_scripts/nodemeisterlib.py | get_name_for_class_exclusion | coxmediagroup/nodemeister | python | def get_name_for_class_exclusion(nm_host, class_exclusion_id, verbose):
'\n Get the excluded class name for a given ClassExclusion ID.\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param class_exclusion_id: numeric ID of the class exclusion\n :type class_exclusion_id: int\... |
def add_node_class_exclusion(nm_host, node_id, classname, dry_run=False, verbose=False):
'\n add a class exclusion to a node in NodeMeister\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param node_id: numeric ID of the node to add param to\n :type node_id: int\n :param ... | 9,084,398,723,056,467,000 | add a class exclusion to a node in NodeMeister
:param nm_host: NodeMeister hostname or IP
:type nm_host: string
:param node_id: numeric ID of the node to add param to
:type node_id: int
:param classname: class name to exclude
:type classname: string
:param dry_run: if True, only print what would be done, do not make a... | contrib/cli_scripts/nodemeisterlib.py | add_node_class_exclusion | coxmediagroup/nodemeister | python | def add_node_class_exclusion(nm_host, node_id, classname, dry_run=False, verbose=False):
'\n add a class exclusion to a node in NodeMeister\n\n :param nm_host: NodeMeister hostname or IP\n :type nm_host: string\n :param node_id: numeric ID of the node to add param to\n :type node_id: int\n :param ... |
def clean_value(v, debug=False):
'\n Strip bad characters off of values\n '
if debug:
print(("clean_value '%s'" % v))
if ((type(v) == type('')) or (type(v) == type(u''))):
v = v.strip('"\\')
return v | -7,613,022,941,749,971,000 | Strip bad characters off of values | contrib/cli_scripts/nodemeisterlib.py | clean_value | coxmediagroup/nodemeister | python | def clean_value(v, debug=False):
'\n \n '
if debug:
print(("clean_value '%s'" % v))
if ((type(v) == type()) or (type(v) == type(u))):
v = v.strip('"\\')
return v |
def do_post(url, payload, dry_run=False):
'\n Do a POST request with Requests, return the status code.\n\n :param url: URL to POST to\n :type nm_host: string\n :param payload: the payload data, to be JSON encoded\n :type name: dict\n :param dry_run: if True, only print what would be done, do not m... | 7,076,742,732,408,014,000 | Do a POST request with Requests, return the status code.
:param url: URL to POST to
:type nm_host: string
:param payload: the payload data, to be JSON encoded
:type name: dict
:param dry_run: if True, only print what would be done, do not make any changes
:type dry_run: boolean
:returns: HTTP status code from the requ... | contrib/cli_scripts/nodemeisterlib.py | do_post | coxmediagroup/nodemeister | python | def do_post(url, payload, dry_run=False):
'\n Do a POST request with Requests, return the status code.\n\n :param url: URL to POST to\n :type nm_host: string\n :param payload: the payload data, to be JSON encoded\n :type name: dict\n :param dry_run: if True, only print what would be done, do not m... |
def clone_nodemeister_node(nm_host, dst_name, src_name, munge_res, group_replace=None, noop=False, verbose=False):
'\n Clone a node in nodemeister, munging all parameters and class params through munge_re,\n a list of lists, each having 2 elements, a regex and a string to replace matches with.\n\n group_re... | -3,694,976,738,779,596,000 | Clone a node in nodemeister, munging all parameters and class params through munge_re,
a list of lists, each having 2 elements, a regex and a string to replace matches with.
group_replace is a hash of old_group_id => new_group_id to replace when creating the new node | contrib/cli_scripts/nodemeisterlib.py | clone_nodemeister_node | coxmediagroup/nodemeister | python | def clone_nodemeister_node(nm_host, dst_name, src_name, munge_res, group_replace=None, noop=False, verbose=False):
'\n Clone a node in nodemeister, munging all parameters and class params through munge_re,\n a list of lists, each having 2 elements, a regex and a string to replace matches with.\n\n group_re... |
def clone_nodemeister_group(nm_host, dst_gname, src_gname, munge_re=None, noop=False, verbose=False):
'\n Clone a group in nodemeister, munging all parameters and class params through munge_re,\n a list of lists, each having 2 elements, a regex and a string to replace matches with.\n '
group_names = ge... | 321,454,846,756,746,200 | Clone a group in nodemeister, munging all parameters and class params through munge_re,
a list of lists, each having 2 elements, a regex and a string to replace matches with. | contrib/cli_scripts/nodemeisterlib.py | clone_nodemeister_group | coxmediagroup/nodemeister | python | def clone_nodemeister_group(nm_host, dst_gname, src_gname, munge_re=None, noop=False, verbose=False):
'\n Clone a group in nodemeister, munging all parameters and class params through munge_re,\n a list of lists, each having 2 elements, a regex and a string to replace matches with.\n '
group_names = ge... |
def DetectGae():
"Determine whether or not we're running on GAE.\n\n This is based on:\n https://developers.google.com/appengine/docs/python/#The_Environment\n\n Returns:\n True iff we're running on GAE.\n "
server_software = os.environ.get('SERVER_SOFTWARE', '')
return (server_software.startswith(... | 6,583,939,300,005,637,000 | Determine whether or not we're running on GAE.
This is based on:
https://developers.google.com/appengine/docs/python/#The_Environment
Returns:
True iff we're running on GAE. | .install/.backup/lib/apitools/base/py/util.py | DetectGae | Technology-Hatchery/google-cloud-sdk | python | def DetectGae():
"Determine whether or not we're running on GAE.\n\n This is based on:\n https://developers.google.com/appengine/docs/python/#The_Environment\n\n Returns:\n True iff we're running on GAE.\n "
server_software = os.environ.get('SERVER_SOFTWARE', )
return (server_software.startswith('D... |
def DetectGce():
"Determine whether or not we're running on GCE.\n\n This is based on:\n https://developers.google.com/compute/docs/instances#dmi\n\n Returns:\n True iff we're running on a GCE instance.\n "
try:
o = urllib2.urlopen('http://metadata.google.internal')
except urllib2.URLError:... | -1,671,743,839,594,448,400 | Determine whether or not we're running on GCE.
This is based on:
https://developers.google.com/compute/docs/instances#dmi
Returns:
True iff we're running on a GCE instance. | .install/.backup/lib/apitools/base/py/util.py | DetectGce | Technology-Hatchery/google-cloud-sdk | python | def DetectGce():
"Determine whether or not we're running on GCE.\n\n This is based on:\n https://developers.google.com/compute/docs/instances#dmi\n\n Returns:\n True iff we're running on a GCE instance.\n "
try:
o = urllib2.urlopen('http://metadata.google.internal')
except urllib2.URLError:... |
def NormalizeScopes(scope_spec):
'Normalize scope_spec to a set of strings.'
if isinstance(scope_spec, types.StringTypes):
return set(scope_spec.split(' '))
elif isinstance(scope_spec, collections.Iterable):
return set(scope_spec)
raise exceptions.TypecheckError(('NormalizeScopes expecte... | 7,627,925,049,917,214,000 | Normalize scope_spec to a set of strings. | .install/.backup/lib/apitools/base/py/util.py | NormalizeScopes | Technology-Hatchery/google-cloud-sdk | python | def NormalizeScopes(scope_spec):
if isinstance(scope_spec, types.StringTypes):
return set(scope_spec.split(' '))
elif isinstance(scope_spec, collections.Iterable):
return set(scope_spec)
raise exceptions.TypecheckError(('NormalizeScopes expected string or iterable, found %s' % (type(sco... |
def __init__(self, model: Model, sampler: Optional[MCSampler]=None, objective: Optional[MCAcquisitionObjective]=None, X_pending: Optional[Tensor]=None) -> None:
'Constructor for the MCAcquisitionFunction base class.\n\n Args:\n model: A fitted model.\n sampler: The sampler used to draw ... | -5,483,613,012,783,740,000 | Constructor for the MCAcquisitionFunction base class.
Args:
model: A fitted model.
sampler: The sampler used to draw base samples. Defaults to
`SobolQMCNormalSampler(num_samples=512, collapse_batch_dims=True)`.
objective: The MCAcquisitionObjective under which the samples are
evaluated. Def... | botorch/acquisition/monte_carlo.py | __init__ | BradyBromley/botorch | python | def __init__(self, model: Model, sampler: Optional[MCSampler]=None, objective: Optional[MCAcquisitionObjective]=None, X_pending: Optional[Tensor]=None) -> None:
'Constructor for the MCAcquisitionFunction base class.\n\n Args:\n model: A fitted model.\n sampler: The sampler used to draw ... |
@abstractmethod
def forward(self, X: Tensor) -> Tensor:
'Takes in a `(b) x q x d` X Tensor of `(b)` t-batches with `q` `d`-dim\n design points each, and returns a one-dimensional Tensor with\n `(b)` elements. Should utilize the result of set_X_pending as needed\n to account for pending functio... | 216,779,565,676,812,380 | Takes in a `(b) x q x d` X Tensor of `(b)` t-batches with `q` `d`-dim
design points each, and returns a one-dimensional Tensor with
`(b)` elements. Should utilize the result of set_X_pending as needed
to account for pending function evaluations. | botorch/acquisition/monte_carlo.py | forward | BradyBromley/botorch | python | @abstractmethod
def forward(self, X: Tensor) -> Tensor:
'Takes in a `(b) x q x d` X Tensor of `(b)` t-batches with `q` `d`-dim\n design points each, and returns a one-dimensional Tensor with\n `(b)` elements. Should utilize the result of set_X_pending as needed\n to account for pending functio... |
def __init__(self, model: Model, best_f: Union[(float, Tensor)], sampler: Optional[MCSampler]=None, objective: Optional[MCAcquisitionObjective]=None, X_pending: Optional[Tensor]=None) -> None:
'q-Expected Improvement.\n\n Args:\n model: A fitted model.\n best_f: The best objective value... | 821,717,853,403,361,700 | q-Expected Improvement.
Args:
model: A fitted model.
best_f: The best objective value observed so far (assumed noiseless).
sampler: The sampler used to draw base samples. Defaults to
`SobolQMCNormalSampler(num_samples=500, collapse_batch_dims=True)`
objective: The MCAcquisitionObjective under w... | botorch/acquisition/monte_carlo.py | __init__ | BradyBromley/botorch | python | def __init__(self, model: Model, best_f: Union[(float, Tensor)], sampler: Optional[MCSampler]=None, objective: Optional[MCAcquisitionObjective]=None, X_pending: Optional[Tensor]=None) -> None:
'q-Expected Improvement.\n\n Args:\n model: A fitted model.\n best_f: The best objective value... |
@concatenate_pending_points
@t_batch_mode_transform()
def forward(self, X: Tensor) -> Tensor:
'Evaluate qExpectedImprovement on the candidate set `X`.\n\n Args:\n X: A `(b) x q x d`-dim Tensor of `(b)` t-batches with `q` `d`-dim\n design points each.\n\n Returns:\n ... | 1,334,818,452,204,513,800 | Evaluate qExpectedImprovement on the candidate set `X`.
Args:
X: A `(b) x q x d`-dim Tensor of `(b)` t-batches with `q` `d`-dim
design points each.
Returns:
A `(b)`-dim Tensor of Expected Improvement values at the given
design points `X`. | botorch/acquisition/monte_carlo.py | forward | BradyBromley/botorch | python | @concatenate_pending_points
@t_batch_mode_transform()
def forward(self, X: Tensor) -> Tensor:
'Evaluate qExpectedImprovement on the candidate set `X`.\n\n Args:\n X: A `(b) x q x d`-dim Tensor of `(b)` t-batches with `q` `d`-dim\n design points each.\n\n Returns:\n ... |
def __init__(self, model: Model, X_baseline: Tensor, sampler: Optional[MCSampler]=None, objective: Optional[MCAcquisitionObjective]=None, X_pending: Optional[Tensor]=None, prune_baseline: bool=False) -> None:
'q-Noisy Expected Improvement.\n\n Args:\n model: A fitted model.\n X_baseline... | 7,793,565,535,815,692,000 | q-Noisy Expected Improvement.
Args:
model: A fitted model.
X_baseline: A `r x d`-dim Tensor of `r` design points that have
already been observed. These points are considered as the
potential best design point.
sampler: The sampler used to draw base samples. Defaults to
`SobolQMCNorm... | botorch/acquisition/monte_carlo.py | __init__ | BradyBromley/botorch | python | def __init__(self, model: Model, X_baseline: Tensor, sampler: Optional[MCSampler]=None, objective: Optional[MCAcquisitionObjective]=None, X_pending: Optional[Tensor]=None, prune_baseline: bool=False) -> None:
'q-Noisy Expected Improvement.\n\n Args:\n model: A fitted model.\n X_baseline... |
@concatenate_pending_points
@t_batch_mode_transform()
def forward(self, X: Tensor) -> Tensor:
'Evaluate qNoisyExpectedImprovement on the candidate set `X`.\n\n Args:\n X: A `(b) x q x d`-dim Tensor of `(b)` t-batches with `q` `d`-dim\n design points each.\n\n Returns:\n ... | 2,343,125,599,921,369,600 | Evaluate qNoisyExpectedImprovement on the candidate set `X`.
Args:
X: A `(b) x q x d`-dim Tensor of `(b)` t-batches with `q` `d`-dim
design points each.
Returns:
A `(b)`-dim Tensor of Noisy Expected Improvement values at the given
design points `X`. | botorch/acquisition/monte_carlo.py | forward | BradyBromley/botorch | python | @concatenate_pending_points
@t_batch_mode_transform()
def forward(self, X: Tensor) -> Tensor:
'Evaluate qNoisyExpectedImprovement on the candidate set `X`.\n\n Args:\n X: A `(b) x q x d`-dim Tensor of `(b)` t-batches with `q` `d`-dim\n design points each.\n\n Returns:\n ... |
def __init__(self, model: Model, best_f: Union[(float, Tensor)], sampler: Optional[MCSampler]=None, objective: Optional[MCAcquisitionObjective]=None, X_pending: Optional[Tensor]=None, tau: float=0.001) -> None:
'q-Probability of Improvement.\n\n Args:\n model: A fitted model.\n best_f: ... | -4,439,551,676,147,822,000 | q-Probability of Improvement.
Args:
model: A fitted model.
best_f: The best objective value observed so far (assumed noiseless).
sampler: The sampler used to draw base samples. Defaults to
`SobolQMCNormalSampler(num_samples=500, collapse_batch_dims=True)`
objective: The MCAcquisitionObjective u... | botorch/acquisition/monte_carlo.py | __init__ | BradyBromley/botorch | python | def __init__(self, model: Model, best_f: Union[(float, Tensor)], sampler: Optional[MCSampler]=None, objective: Optional[MCAcquisitionObjective]=None, X_pending: Optional[Tensor]=None, tau: float=0.001) -> None:
'q-Probability of Improvement.\n\n Args:\n model: A fitted model.\n best_f: ... |
@concatenate_pending_points
@t_batch_mode_transform()
def forward(self, X: Tensor) -> Tensor:
'Evaluate qProbabilityOfImprovement on the candidate set `X`.\n\n Args:\n X: A `(b) x q x d`-dim Tensor of `(b)` t-batches with `q` `d`-dim\n design points each.\n\n Returns:\n ... | -2,381,835,318,596,340,700 | Evaluate qProbabilityOfImprovement on the candidate set `X`.
Args:
X: A `(b) x q x d`-dim Tensor of `(b)` t-batches with `q` `d`-dim
design points each.
Returns:
A `(b)`-dim Tensor of Probability of Improvement values at the given
design points `X`. | botorch/acquisition/monte_carlo.py | forward | BradyBromley/botorch | python | @concatenate_pending_points
@t_batch_mode_transform()
def forward(self, X: Tensor) -> Tensor:
'Evaluate qProbabilityOfImprovement on the candidate set `X`.\n\n Args:\n X: A `(b) x q x d`-dim Tensor of `(b)` t-batches with `q` `d`-dim\n design points each.\n\n Returns:\n ... |
@concatenate_pending_points
@t_batch_mode_transform()
def forward(self, X: Tensor) -> Tensor:
'Evaluate qSimpleRegret on the candidate set `X`.\n\n Args:\n X: A `(b) x q x d`-dim Tensor of `(b)` t-batches with `q` `d`-dim\n design points each.\n\n Returns:\n A `(b)... | -2,640,521,809,605,749,000 | Evaluate qSimpleRegret on the candidate set `X`.
Args:
X: A `(b) x q x d`-dim Tensor of `(b)` t-batches with `q` `d`-dim
design points each.
Returns:
A `(b)`-dim Tensor of Simple Regret values at the given design
points `X`. | botorch/acquisition/monte_carlo.py | forward | BradyBromley/botorch | python | @concatenate_pending_points
@t_batch_mode_transform()
def forward(self, X: Tensor) -> Tensor:
'Evaluate qSimpleRegret on the candidate set `X`.\n\n Args:\n X: A `(b) x q x d`-dim Tensor of `(b)` t-batches with `q` `d`-dim\n design points each.\n\n Returns:\n A `(b)... |
def __init__(self, model: Model, beta: float, sampler: Optional[MCSampler]=None, objective: Optional[MCAcquisitionObjective]=None, X_pending: Optional[Tensor]=None) -> None:
'q-Upper Confidence Bound.\n\n Args:\n model: A fitted model.\n beta: Controls tradeoff between mean and standard... | -9,073,965,729,121,521,000 | q-Upper Confidence Bound.
Args:
model: A fitted model.
beta: Controls tradeoff between mean and standard deviation in UCB.
sampler: The sampler used to draw base samples. Defaults to
`SobolQMCNormalSampler(num_samples=500, collapse_batch_dims=True)`
objective: The MCAcquisitionObjective under w... | botorch/acquisition/monte_carlo.py | __init__ | BradyBromley/botorch | python | def __init__(self, model: Model, beta: float, sampler: Optional[MCSampler]=None, objective: Optional[MCAcquisitionObjective]=None, X_pending: Optional[Tensor]=None) -> None:
'q-Upper Confidence Bound.\n\n Args:\n model: A fitted model.\n beta: Controls tradeoff between mean and standard... |
@concatenate_pending_points
@t_batch_mode_transform()
def forward(self, X: Tensor) -> Tensor:
'Evaluate qUpperConfidenceBound on the candidate set `X`.\n\n Args:\n X: A `(b) x q x d`-dim Tensor of `(b)` t-batches with `q` `d`-dim\n design points each.\n\n Returns:\n ... | 4,111,730,714,202,724,000 | Evaluate qUpperConfidenceBound on the candidate set `X`.
Args:
X: A `(b) x q x d`-dim Tensor of `(b)` t-batches with `q` `d`-dim
design points each.
Returns:
A `(b)`-dim Tensor of Upper Confidence Bound values at the given
design points `X`. | botorch/acquisition/monte_carlo.py | forward | BradyBromley/botorch | python | @concatenate_pending_points
@t_batch_mode_transform()
def forward(self, X: Tensor) -> Tensor:
'Evaluate qUpperConfidenceBound on the candidate set `X`.\n\n Args:\n X: A `(b) x q x d`-dim Tensor of `(b)` t-batches with `q` `d`-dim\n design points each.\n\n Returns:\n ... |
def resize_img(img, input_size=600):
'\n resize img and limit the longest side of the image to input_size\n '
img = np.array(img)
im_shape = img.shape
im_size_max = np.max(im_shape[0:2])
im_scale = (float(input_size) / float(im_size_max))
img = cv2.resize(img, None, None, fx=im_scale, fy=i... | 2,730,486,028,993,369,000 | resize img and limit the longest side of the image to input_size | tools/infer/utility.py | resize_img | OcrOrg/PaddleOCR | python | def resize_img(img, input_size=600):
'\n \n '
img = np.array(img)
im_shape = img.shape
im_size_max = np.max(im_shape[0:2])
im_scale = (float(input_size) / float(im_size_max))
img = cv2.resize(img, None, None, fx=im_scale, fy=im_scale)
return img |
def draw_ocr(image, boxes, txts=None, scores=None, drop_score=0.5, font_path='./doc/simfang.ttf'):
'\n Visualize the results of OCR detection and recognition\n args:\n image(Image|array): RGB image\n boxes(list): boxes with shape(N, 4, 2)\n txts(list): the texts\n scores(list): txx... | 5,244,719,996,499,496,000 | Visualize the results of OCR detection and recognition
args:
image(Image|array): RGB image
boxes(list): boxes with shape(N, 4, 2)
txts(list): the texts
scores(list): txxs corresponding scores
drop_score(float): only scores greater than drop_threshold will be visualized
font_path: the path of fon... | tools/infer/utility.py | draw_ocr | OcrOrg/PaddleOCR | python | def draw_ocr(image, boxes, txts=None, scores=None, drop_score=0.5, font_path='./doc/simfang.ttf'):
'\n Visualize the results of OCR detection and recognition\n args:\n image(Image|array): RGB image\n boxes(list): boxes with shape(N, 4, 2)\n txts(list): the texts\n scores(list): txx... |
def str_count(s):
'\n Count the number of Chinese characters,\n a single English character and a single number\n equal to half the length of Chinese characters.\n args:\n s(string): the input of string\n return(int):\n the number of Chinese characters\n '
import string
count_... | -4,828,038,653,253,307,000 | Count the number of Chinese characters,
a single English character and a single number
equal to half the length of Chinese characters.
args:
s(string): the input of string
return(int):
the number of Chinese characters | tools/infer/utility.py | str_count | OcrOrg/PaddleOCR | python | def str_count(s):
'\n Count the number of Chinese characters,\n a single English character and a single number\n equal to half the length of Chinese characters.\n args:\n s(string): the input of string\n return(int):\n the number of Chinese characters\n '
import string
count_... |
def text_visual(texts, scores, img_h=400, img_w=600, threshold=0.0, font_path='./doc/simfang.ttf'):
'\n create new blank img and draw txt on it\n args:\n texts(list): the text will be draw\n scores(list|None): corresponding score of each txt\n img_h(int): the height of blank img\n ... | -803,037,385,994,058,100 | create new blank img and draw txt on it
args:
texts(list): the text will be draw
scores(list|None): corresponding score of each txt
img_h(int): the height of blank img
img_w(int): the width of blank img
font_path: the path of font which is used to draw text
return(array): | tools/infer/utility.py | text_visual | OcrOrg/PaddleOCR | python | def text_visual(texts, scores, img_h=400, img_w=600, threshold=0.0, font_path='./doc/simfang.ttf'):
'\n create new blank img and draw txt on it\n args:\n texts(list): the text will be draw\n scores(list|None): corresponding score of each txt\n img_h(int): the height of blank img\n ... |
def __init__(self, report, metrics, destination_uuid, destination):
'Initialise the Notification with the required info.'
self.report_title = report['title']
self.url = report.get('url')
self.metrics: list[MetricNotificationData] = metrics
self.destination_uuid = destination_uuid
self.destinatio... | -5,459,359,732,503,704,000 | Initialise the Notification with the required info. | components/notifier/src/models/notification.py | __init__ | m-zakeri/quality-time | python | def __init__(self, report, metrics, destination_uuid, destination):
self.report_title = report['title']
self.url = report.get('url')
self.metrics: list[MetricNotificationData] = metrics
self.destination_uuid = destination_uuid
self.destination = destination |
def __eq__(self, other):
'Check if the notification itself is the same, regardless of its metric content.'
return ((self.report_title == other.report_title) and (self.destination_uuid == other.destination_uuid) and (self.destination == other.destination)) | -6,105,355,902,732,706,000 | Check if the notification itself is the same, regardless of its metric content. | components/notifier/src/models/notification.py | __eq__ | m-zakeri/quality-time | python | def __eq__(self, other):
return ((self.report_title == other.report_title) and (self.destination_uuid == other.destination_uuid) and (self.destination == other.destination)) |
def merge_notification(self, new_metrics):
'Merge new metrics into this notification.'
self.metrics.extend(new_metrics) | -4,852,404,083,510,270,000 | Merge new metrics into this notification. | components/notifier/src/models/notification.py | merge_notification | m-zakeri/quality-time | python | def merge_notification(self, new_metrics):
self.metrics.extend(new_metrics) |
def get_express_route_gateway(express_route_gateway_name: Optional[str]=None, resource_group_name: Optional[str]=None, opts: Optional[pulumi.InvokeOptions]=None) -> AwaitableGetExpressRouteGatewayResult:
'\n ExpressRoute gateway resource.\n API Version: 2020-08-01.\n\n\n :param str express_route_gateway_na... | -1,198,269,896,106,264,000 | ExpressRoute gateway resource.
API Version: 2020-08-01.
:param str express_route_gateway_name: The name of the ExpressRoute gateway.
:param str resource_group_name: The name of the resource group. | sdk/python/pulumi_azure_nextgen/network/get_express_route_gateway.py | get_express_route_gateway | pulumi/pulumi-azure-nextgen | python | def get_express_route_gateway(express_route_gateway_name: Optional[str]=None, resource_group_name: Optional[str]=None, opts: Optional[pulumi.InvokeOptions]=None) -> AwaitableGetExpressRouteGatewayResult:
'\n ExpressRoute gateway resource.\n API Version: 2020-08-01.\n\n\n :param str express_route_gateway_na... |
@property
@pulumi.getter(name='autoScaleConfiguration')
def auto_scale_configuration(self) -> Optional['outputs.ExpressRouteGatewayPropertiesResponseAutoScaleConfiguration']:
'\n Configuration for auto scaling.\n '
return pulumi.get(self, 'auto_scale_configuration') | -8,462,896,628,956,177,000 | Configuration for auto scaling. | sdk/python/pulumi_azure_nextgen/network/get_express_route_gateway.py | auto_scale_configuration | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='autoScaleConfiguration')
def auto_scale_configuration(self) -> Optional['outputs.ExpressRouteGatewayPropertiesResponseAutoScaleConfiguration']:
'\n \n '
return pulumi.get(self, 'auto_scale_configuration') |
@property
@pulumi.getter
def etag(self) -> str:
'\n A unique read-only string that changes whenever the resource is updated.\n '
return pulumi.get(self, 'etag') | -4,757,010,955,465,940,000 | A unique read-only string that changes whenever the resource is updated. | sdk/python/pulumi_azure_nextgen/network/get_express_route_gateway.py | etag | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter
def etag(self) -> str:
'\n \n '
return pulumi.get(self, 'etag') |
@property
@pulumi.getter(name='expressRouteConnections')
def express_route_connections(self) -> Sequence['outputs.ExpressRouteConnectionResponse']:
'\n List of ExpressRoute connections to the ExpressRoute gateway.\n '
return pulumi.get(self, 'express_route_connections') | 7,243,677,662,968,671,000 | List of ExpressRoute connections to the ExpressRoute gateway. | sdk/python/pulumi_azure_nextgen/network/get_express_route_gateway.py | express_route_connections | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='expressRouteConnections')
def express_route_connections(self) -> Sequence['outputs.ExpressRouteConnectionResponse']:
'\n \n '
return pulumi.get(self, 'express_route_connections') |
@property
@pulumi.getter
def id(self) -> Optional[str]:
'\n Resource ID.\n '
return pulumi.get(self, 'id') | 6,887,155,523,158,811,000 | Resource ID. | sdk/python/pulumi_azure_nextgen/network/get_express_route_gateway.py | id | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter
def id(self) -> Optional[str]:
'\n \n '
return pulumi.get(self, 'id') |
@property
@pulumi.getter
def location(self) -> Optional[str]:
'\n Resource location.\n '
return pulumi.get(self, 'location') | 8,841,543,228,718,414,000 | Resource location. | sdk/python/pulumi_azure_nextgen/network/get_express_route_gateway.py | location | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter
def location(self) -> Optional[str]:
'\n \n '
return pulumi.get(self, 'location') |
@property
@pulumi.getter
def name(self) -> str:
'\n Resource name.\n '
return pulumi.get(self, 'name') | -2,625,941,459,458,898,000 | Resource name. | sdk/python/pulumi_azure_nextgen/network/get_express_route_gateway.py | name | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter
def name(self) -> str:
'\n \n '
return pulumi.get(self, 'name') |
@property
@pulumi.getter(name='provisioningState')
def provisioning_state(self) -> str:
'\n The provisioning state of the express route gateway resource.\n '
return pulumi.get(self, 'provisioning_state') | -3,724,907,156,352,075,000 | The provisioning state of the express route gateway resource. | sdk/python/pulumi_azure_nextgen/network/get_express_route_gateway.py | provisioning_state | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='provisioningState')
def provisioning_state(self) -> str:
'\n \n '
return pulumi.get(self, 'provisioning_state') |
@property
@pulumi.getter
def tags(self) -> Optional[Mapping[(str, str)]]:
'\n Resource tags.\n '
return pulumi.get(self, 'tags') | 562,229,697,900,116,900 | Resource tags. | sdk/python/pulumi_azure_nextgen/network/get_express_route_gateway.py | tags | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter
def tags(self) -> Optional[Mapping[(str, str)]]:
'\n \n '
return pulumi.get(self, 'tags') |
@property
@pulumi.getter
def type(self) -> str:
'\n Resource type.\n '
return pulumi.get(self, 'type') | -5,079,398,349,541,291,000 | Resource type. | sdk/python/pulumi_azure_nextgen/network/get_express_route_gateway.py | type | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter
def type(self) -> str:
'\n \n '
return pulumi.get(self, 'type') |
@property
@pulumi.getter(name='virtualHub')
def virtual_hub(self) -> 'outputs.VirtualHubIdResponse':
'\n The Virtual Hub where the ExpressRoute gateway is or will be deployed.\n '
return pulumi.get(self, 'virtual_hub') | -8,851,470,528,751,838,000 | The Virtual Hub where the ExpressRoute gateway is or will be deployed. | sdk/python/pulumi_azure_nextgen/network/get_express_route_gateway.py | virtual_hub | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='virtualHub')
def virtual_hub(self) -> 'outputs.VirtualHubIdResponse':
'\n \n '
return pulumi.get(self, 'virtual_hub') |
def _fix_conf_defaults(config):
'Update some configuration defaults.'
config['sid'] = config.pop(CONF_MAC, None)
if (config.get(CONF_KEY) is None):
_LOGGER.warning('Key is not provided for gateway %s. Controlling the gateway will not be possible', config['sid'])
if (config.get(CONF_HOST) is None... | -4,031,799,852,486,938,600 | Update some configuration defaults. | homeassistant/components/xiaomi_aqara.py | _fix_conf_defaults | phispi/home-assistant | python | def _fix_conf_defaults(config):
config['sid'] = config.pop(CONF_MAC, None)
if (config.get(CONF_KEY) is None):
_LOGGER.warning('Key is not provided for gateway %s. Controlling the gateway will not be possible', config['sid'])
if (config.get(CONF_HOST) is None):
config.pop(CONF_PORT)
... |
def setup(hass, config):
'Set up the Xiaomi component.'
gateways = []
interface = 'any'
discovery_retry = 3
if (DOMAIN in config):
gateways = config[DOMAIN][CONF_GATEWAYS]
interface = config[DOMAIN][CONF_INTERFACE]
discovery_retry = config[DOMAIN][CONF_DISCOVERY_RETRY]
a... | 5,895,890,946,076,640,000 | Set up the Xiaomi component. | homeassistant/components/xiaomi_aqara.py | setup | phispi/home-assistant | python | def setup(hass, config):
gateways = []
interface = 'any'
discovery_retry = 3
if (DOMAIN in config):
gateways = config[DOMAIN][CONF_GATEWAYS]
interface = config[DOMAIN][CONF_INTERFACE]
discovery_retry = config[DOMAIN][CONF_DISCOVERY_RETRY]
async def xiaomi_gw_discovered(... |
def _add_gateway_to_schema(xiaomi, schema):
'Extend a voluptuous schema with a gateway validator.'
def gateway(sid):
'Convert sid to a gateway.'
sid = str(sid).replace(':', '').lower()
for gateway in xiaomi.gateways.values():
if (gateway.sid == sid):
return g... | -9,154,849,926,144,047,000 | Extend a voluptuous schema with a gateway validator. | homeassistant/components/xiaomi_aqara.py | _add_gateway_to_schema | phispi/home-assistant | python | def _add_gateway_to_schema(xiaomi, schema):
def gateway(sid):
'Convert sid to a gateway.'
sid = str(sid).replace(':', ).lower()
for gateway in xiaomi.gateways.values():
if (gateway.sid == sid):
return gateway
raise vol.Invalid('Unknown gateway sid {}... |
async def xiaomi_gw_discovered(service, discovery_info):
'Perform action when Xiaomi Gateway device(s) has been found.' | -155,846,655,710,240,350 | Perform action when Xiaomi Gateway device(s) has been found. | homeassistant/components/xiaomi_aqara.py | xiaomi_gw_discovered | phispi/home-assistant | python | async def xiaomi_gw_discovered(service, discovery_info):
|
def stop_xiaomi(event):
'Stop Xiaomi Socket.'
_LOGGER.info('Shutting down Xiaomi Hub')
xiaomi.stop_listen() | -8,394,709,030,353,044,000 | Stop Xiaomi Socket. | homeassistant/components/xiaomi_aqara.py | stop_xiaomi | phispi/home-assistant | python | def stop_xiaomi(event):
_LOGGER.info('Shutting down Xiaomi Hub')
xiaomi.stop_listen() |
def play_ringtone_service(call):
'Service to play ringtone through Gateway.'
ring_id = call.data.get(ATTR_RINGTONE_ID)
gateway = call.data.get(ATTR_GW_MAC)
kwargs = {'mid': ring_id}
ring_vol = call.data.get(ATTR_RINGTONE_VOL)
if (ring_vol is not None):
kwargs['vol'] = ring_vol
gatewa... | 6,053,461,574,489,661,000 | Service to play ringtone through Gateway. | homeassistant/components/xiaomi_aqara.py | play_ringtone_service | phispi/home-assistant | python | def play_ringtone_service(call):
ring_id = call.data.get(ATTR_RINGTONE_ID)
gateway = call.data.get(ATTR_GW_MAC)
kwargs = {'mid': ring_id}
ring_vol = call.data.get(ATTR_RINGTONE_VOL)
if (ring_vol is not None):
kwargs['vol'] = ring_vol
gateway.write_to_hub(gateway.sid, **kwargs) |
def stop_ringtone_service(call):
'Service to stop playing ringtone on Gateway.'
gateway = call.data.get(ATTR_GW_MAC)
gateway.write_to_hub(gateway.sid, mid=10000) | 6,169,792,271,970,421,000 | Service to stop playing ringtone on Gateway. | homeassistant/components/xiaomi_aqara.py | stop_ringtone_service | phispi/home-assistant | python | def stop_ringtone_service(call):
gateway = call.data.get(ATTR_GW_MAC)
gateway.write_to_hub(gateway.sid, mid=10000) |
def add_device_service(call):
'Service to add a new sub-device within the next 30 seconds.'
gateway = call.data.get(ATTR_GW_MAC)
gateway.write_to_hub(gateway.sid, join_permission='yes')
hass.components.persistent_notification.async_create('Join permission enabled for 30 seconds! Please press the pairing... | -6,641,737,974,181,730,000 | Service to add a new sub-device within the next 30 seconds. | homeassistant/components/xiaomi_aqara.py | add_device_service | phispi/home-assistant | python | def add_device_service(call):
gateway = call.data.get(ATTR_GW_MAC)
gateway.write_to_hub(gateway.sid, join_permission='yes')
hass.components.persistent_notification.async_create('Join permission enabled for 30 seconds! Please press the pairing button of the new device once.', title='Xiaomi Aqara Gateway... |
def remove_device_service(call):
'Service to remove a sub-device from the gateway.'
device_id = call.data.get(ATTR_DEVICE_ID)
gateway = call.data.get(ATTR_GW_MAC)
gateway.write_to_hub(gateway.sid, remove_device=device_id) | 4,640,170,528,080,460,000 | Service to remove a sub-device from the gateway. | homeassistant/components/xiaomi_aqara.py | remove_device_service | phispi/home-assistant | python | def remove_device_service(call):
device_id = call.data.get(ATTR_DEVICE_ID)
gateway = call.data.get(ATTR_GW_MAC)
gateway.write_to_hub(gateway.sid, remove_device=device_id) |
def __init__(self, device, device_type, xiaomi_hub):
'Initialize the Xiaomi device.'
self._state = None
self._is_available = True
self._sid = device['sid']
self._name = '{}_{}'.format(device_type, self._sid)
self._type = device_type
self._write_to_hub = xiaomi_hub.write_to_hub
self._get_... | 2,500,651,193,361,393,700 | Initialize the Xiaomi device. | homeassistant/components/xiaomi_aqara.py | __init__ | phispi/home-assistant | python | def __init__(self, device, device_type, xiaomi_hub):
self._state = None
self._is_available = True
self._sid = device['sid']
self._name = '{}_{}'.format(device_type, self._sid)
self._type = device_type
self._write_to_hub = xiaomi_hub.write_to_hub
self._get_from_hub = xiaomi_hub.get_from_... |
async def async_added_to_hass(self):
'Start unavailability tracking.'
self._xiaomi_hub.callbacks[self._sid].append(self._add_push_data_job)
self._async_track_unavailable() | -9,045,418,221,189,626,000 | Start unavailability tracking. | homeassistant/components/xiaomi_aqara.py | async_added_to_hass | phispi/home-assistant | python | async def async_added_to_hass(self):
self._xiaomi_hub.callbacks[self._sid].append(self._add_push_data_job)
self._async_track_unavailable() |
@property
def name(self):
'Return the name of the device.'
return self._name | -4,231,536,673,663,769,600 | Return the name of the device. | homeassistant/components/xiaomi_aqara.py | name | phispi/home-assistant | python | @property
def name(self):
return self._name |
@property
def unique_id(self) -> str:
'Return a unique ID.'
return self._unique_id | -4,749,013,748,456,637,000 | Return a unique ID. | homeassistant/components/xiaomi_aqara.py | unique_id | phispi/home-assistant | python | @property
def unique_id(self) -> str:
return self._unique_id |
@property
def available(self):
'Return True if entity is available.'
return self._is_available | -7,264,764,334,597,754,000 | Return True if entity is available. | homeassistant/components/xiaomi_aqara.py | available | phispi/home-assistant | python | @property
def available(self):
return self._is_available |
@property
def should_poll(self):
'Return the polling state. No polling needed.'
return False | -8,466,736,641,829,833,000 | Return the polling state. No polling needed. | homeassistant/components/xiaomi_aqara.py | should_poll | phispi/home-assistant | python | @property
def should_poll(self):
return False |
@property
def device_state_attributes(self):
'Return the state attributes.'
return self._device_state_attributes | 7,697,970,802,956,560,000 | Return the state attributes. | homeassistant/components/xiaomi_aqara.py | device_state_attributes | phispi/home-assistant | python | @property
def device_state_attributes(self):
return self._device_state_attributes |
@callback
def _async_set_unavailable(self, now):
'Set state to UNAVAILABLE.'
self._remove_unavailability_tracker = None
self._is_available = False
self.async_schedule_update_ha_state() | 2,169,749,372,944,836,600 | Set state to UNAVAILABLE. | homeassistant/components/xiaomi_aqara.py | _async_set_unavailable | phispi/home-assistant | python | @callback
def _async_set_unavailable(self, now):
self._remove_unavailability_tracker = None
self._is_available = False
self.async_schedule_update_ha_state() |
@callback
def push_data(self, data, raw_data):
'Push from Hub.'
_LOGGER.debug('PUSH >> %s: %s', self, data)
was_unavailable = self._async_track_unavailable()
is_data = self.parse_data(data, raw_data)
is_voltage = self.parse_voltage(data)
if (is_data or is_voltage or was_unavailable):
sel... | 4,364,394,288,379,428,400 | Push from Hub. | homeassistant/components/xiaomi_aqara.py | push_data | phispi/home-assistant | python | @callback
def push_data(self, data, raw_data):
_LOGGER.debug('PUSH >> %s: %s', self, data)
was_unavailable = self._async_track_unavailable()
is_data = self.parse_data(data, raw_data)
is_voltage = self.parse_voltage(data)
if (is_data or is_voltage or was_unavailable):
self.async_schedule... |
def parse_voltage(self, data):
'Parse battery level data sent by gateway.'
if ('voltage' not in data):
return False
max_volt = 3300
min_volt = 2800
voltage = data['voltage']
voltage = min(voltage, max_volt)
voltage = max(voltage, min_volt)
percent = (((voltage - min_volt) / (max_... | 5,407,283,607,935,144,000 | Parse battery level data sent by gateway. | homeassistant/components/xiaomi_aqara.py | parse_voltage | phispi/home-assistant | python | def parse_voltage(self, data):
if ('voltage' not in data):
return False
max_volt = 3300
min_volt = 2800
voltage = data['voltage']
voltage = min(voltage, max_volt)
voltage = max(voltage, min_volt)
percent = (((voltage - min_volt) / (max_volt - min_volt)) * 100)
self._device_s... |
def parse_data(self, data, raw_data):
'Parse data sent by gateway.'
raise NotImplementedError() | -2,793,087,297,486,568,400 | Parse data sent by gateway. | homeassistant/components/xiaomi_aqara.py | parse_data | phispi/home-assistant | python | def parse_data(self, data, raw_data):
raise NotImplementedError() |
def gateway(sid):
'Convert sid to a gateway.'
sid = str(sid).replace(':', '').lower()
for gateway in xiaomi.gateways.values():
if (gateway.sid == sid):
return gateway
raise vol.Invalid('Unknown gateway sid {}'.format(sid)) | 7,615,367,604,917,559,000 | Convert sid to a gateway. | homeassistant/components/xiaomi_aqara.py | gateway | phispi/home-assistant | python | def gateway(sid):
sid = str(sid).replace(':', ).lower()
for gateway in xiaomi.gateways.values():
if (gateway.sid == sid):
return gateway
raise vol.Invalid('Unknown gateway sid {}'.format(sid)) |
def fake_method(self, name):
"This doesn't do anything.\n\n Args:\n name: str. Means nothing.\n\n Yields:\n tuple(str, str). The argument passed in but twice in a tuple.\n "
(yield (name, name)) | 1,632,981,890,375,594,500 | This doesn't do anything.
Args:
name: str. Means nothing.
Yields:
tuple(str, str). The argument passed in but twice in a tuple. | scripts/linters/test_files/invalid_python_three.py | fake_method | Aarjav-Jain/oppia | python | def fake_method(self, name):
"This doesn't do anything.\n\n Args:\n name: str. Means nothing.\n\n Yields:\n tuple(str, str). The argument passed in but twice in a tuple.\n "
(yield (name, name)) |
def calc_fall_flush_durations_2(filter_data, date):
'Left side sharp'
der_percent_threshold_left = 50
flow_percent_threshold_left = 80
'Right side mellow'
der_percent_threshold_right = 30
flow_percent_threshold_right = 80
duration = None
left = 0
right = 0
if (date or (date == 0)... | 8,728,510,604,129,855,000 | Left side sharp | utils/calc_fall_flush.py | calc_fall_flush_durations_2 | NoellePatterson/func-flow-plot | python | def calc_fall_flush_durations_2(filter_data, date):
der_percent_threshold_left = 50
flow_percent_threshold_left = 80
'Right side mellow'
der_percent_threshold_right = 30
flow_percent_threshold_right = 80
duration = None
left = 0
right = 0
if (date or (date == 0)):
date =... |
def wait_until_upload_url_changed(self, uploadproxy_url, timeout=TIMEOUT):
'\n Wait until upload proxy url is changed\n\n Args:\n timeout (int): Time to wait for CDI Config.\n\n Returns:\n bool: True if url is equal to uploadProxyURL.\n '
LOGGER.info(f'Wait for ... | -8,378,396,817,678,230,000 | Wait until upload proxy url is changed
Args:
timeout (int): Time to wait for CDI Config.
Returns:
bool: True if url is equal to uploadProxyURL. | ocp_resources/cdi_config.py | wait_until_upload_url_changed | amastbau/openshift-python-wrapper | python | def wait_until_upload_url_changed(self, uploadproxy_url, timeout=TIMEOUT):
'\n Wait until upload proxy url is changed\n\n Args:\n timeout (int): Time to wait for CDI Config.\n\n Returns:\n bool: True if url is equal to uploadProxyURL.\n '
LOGGER.info(f'Wait for ... |
def validate(coll, record, schemas):
'Validate a record for a given db\n\n Parameters\n ----------\n coll : str\n The name of the db in question\n record : dict\n The record to be validated\n schemas : dict\n The schema to validate against\n\n Returns\n -------\n rtn : b... | 1,143,343,369,521,928,200 | Validate a record for a given db
Parameters
----------
coll : str
The name of the db in question
record : dict
The record to be validated
schemas : dict
The schema to validate against
Returns
-------
rtn : bool
True is valid
errors: dict
The errors encountered (if any) | regolith/schemas.py | validate | priyankaanehra/regolith | python | def validate(coll, record, schemas):
'Validate a record for a given db\n\n Parameters\n ----------\n coll : str\n The name of the db in question\n record : dict\n The record to be validated\n schemas : dict\n The schema to validate against\n\n Returns\n -------\n rtn : b... |
def _validate_description(self, description, field, value):
"Don't validate descriptions\n\n The rule's arguments are validated against this schema:\n {'type': 'string'}"
if False:
pass | 6,530,752,815,826,422,000 | Don't validate descriptions
The rule's arguments are validated against this schema:
{'type': 'string'} | regolith/schemas.py | _validate_description | priyankaanehra/regolith | python | def _validate_description(self, description, field, value):
"Don't validate descriptions\n\n The rule's arguments are validated against this schema:\n {'type': 'string'}"
if False:
pass |
def _validate_eallowed(self, eallowed, field, value):
"Test if value is in list\n The rule's arguments are validated against this schema:\n {'type': 'list'}\n "
if (value not in eallowed):
warn('"{}" is not in the preferred entries for "{}", please consider changing this entry to co... | 1,803,606,705,388,359,200 | Test if value is in list
The rule's arguments are validated against this schema:
{'type': 'list'} | regolith/schemas.py | _validate_eallowed | priyankaanehra/regolith | python | def _validate_eallowed(self, eallowed, field, value):
"Test if value is in list\n The rule's arguments are validated against this schema:\n {'type': 'list'}\n "
if (value not in eallowed):
warn('"{}" is not in the preferred entries for "{}", please consider changing this entry to co... |
def count_vocab_items(self, token: Token, counter: Dict[(str, Dict[(str, int)])]):
'\n The :class:`Vocabulary` needs to assign indices to whatever strings we see in the training\n data (possibly doing some frequency filtering and using an OOV, or out of vocabulary,\n token). This method takes ... | 7,749,317,807,429,429,000 | The :class:`Vocabulary` needs to assign indices to whatever strings we see in the training
data (possibly doing some frequency filtering and using an OOV, or out of vocabulary,
token). This method takes a token and a dictionary of counts and increments counts for
whatever vocabulary items are present in the token. If... | allennlp/data/token_indexers/token_indexer.py | count_vocab_items | loopylangur/allennlp | python | def count_vocab_items(self, token: Token, counter: Dict[(str, Dict[(str, int)])]):
'\n The :class:`Vocabulary` needs to assign indices to whatever strings we see in the training\n data (possibly doing some frequency filtering and using an OOV, or out of vocabulary,\n token). This method takes ... |
def tokens_to_indices(self, tokens: List[Token], vocabulary: Vocabulary, index_name: str) -> Dict[(str, List[TokenType])]:
'\n Takes a list of tokens and converts them to one or more sets of indices.\n This could be just an ID for each token from the vocabulary.\n Or it could split each token i... | 2,723,525,293,100,898,300 | Takes a list of tokens and converts them to one or more sets of indices.
This could be just an ID for each token from the vocabulary.
Or it could split each token into characters and return one ID per character.
Or (for instance, in the case of byte-pair encoding) there might not be a clean
mapping from individual toke... | allennlp/data/token_indexers/token_indexer.py | tokens_to_indices | loopylangur/allennlp | python | def tokens_to_indices(self, tokens: List[Token], vocabulary: Vocabulary, index_name: str) -> Dict[(str, List[TokenType])]:
'\n Takes a list of tokens and converts them to one or more sets of indices.\n This could be just an ID for each token from the vocabulary.\n Or it could split each token i... |
def get_padding_token(self) -> TokenType:
'\n Deprecated. Please just implement the padding token in `as_padded_tensor` instead.\n TODO(Mark): remove in 1.0 release. This is only a concrete implementation to preserve\n backward compatability, otherwise it would be abstract.\n\n When we n... | 9,106,309,190,863,320,000 | Deprecated. Please just implement the padding token in `as_padded_tensor` instead.
TODO(Mark): remove in 1.0 release. This is only a concrete implementation to preserve
backward compatability, otherwise it would be abstract.
When we need to add padding tokens, what should they look like? This method returns a
"blank"... | allennlp/data/token_indexers/token_indexer.py | get_padding_token | loopylangur/allennlp | python | def get_padding_token(self) -> TokenType:
'\n Deprecated. Please just implement the padding token in `as_padded_tensor` instead.\n TODO(Mark): remove in 1.0 release. This is only a concrete implementation to preserve\n backward compatability, otherwise it would be abstract.\n\n When we n... |
def get_padding_lengths(self, token: TokenType) -> Dict[(str, int)]:
'\n This method returns a padding dictionary for the given token that specifies lengths for\n all arrays that need padding. For example, for single ID tokens the returned dictionary\n will be empty, but for a token characters... | -3,874,557,666,197,784,600 | This method returns a padding dictionary for the given token that specifies lengths for
all arrays that need padding. For example, for single ID tokens the returned dictionary
will be empty, but for a token characters representation, this will return the number
of characters in the token. | allennlp/data/token_indexers/token_indexer.py | get_padding_lengths | loopylangur/allennlp | python | def get_padding_lengths(self, token: TokenType) -> Dict[(str, int)]:
'\n This method returns a padding dictionary for the given token that specifies lengths for\n all arrays that need padding. For example, for single ID tokens the returned dictionary\n will be empty, but for a token characters... |
def get_token_min_padding_length(self) -> int:
'\n This method returns the minimum padding length required for this TokenIndexer.\n For example, the minimum padding length of `SingleIdTokenIndexer` is the largest\n size of filter when using `CnnEncoder`.\n '
return self._token_min_pa... | 5,854,117,235,276,605,000 | This method returns the minimum padding length required for this TokenIndexer.
For example, the minimum padding length of `SingleIdTokenIndexer` is the largest
size of filter when using `CnnEncoder`. | allennlp/data/token_indexers/token_indexer.py | get_token_min_padding_length | loopylangur/allennlp | python | def get_token_min_padding_length(self) -> int:
'\n This method returns the minimum padding length required for this TokenIndexer.\n For example, the minimum padding length of `SingleIdTokenIndexer` is the largest\n size of filter when using `CnnEncoder`.\n '
return self._token_min_pa... |
def as_padded_tensor(self, tokens: Dict[(str, List[TokenType])], desired_num_tokens: Dict[(str, int)], padding_lengths: Dict[(str, int)]) -> Dict[(str, torch.Tensor)]:
'\n This method pads a list of tokens to ``desired_num_tokens`` and returns that padded list\n of input tokens as a torch Tensor. If t... | 6,763,238,428,948,606,000 | This method pads a list of tokens to ``desired_num_tokens`` and returns that padded list
of input tokens as a torch Tensor. If the input token list is longer than ``desired_num_tokens``
then it will be truncated.
``padding_lengths`` is used to provide supplemental padding parameters which are needed
in some cases. Fo... | allennlp/data/token_indexers/token_indexer.py | as_padded_tensor | loopylangur/allennlp | python | def as_padded_tensor(self, tokens: Dict[(str, List[TokenType])], desired_num_tokens: Dict[(str, int)], padding_lengths: Dict[(str, int)]) -> Dict[(str, torch.Tensor)]:
'\n This method pads a list of tokens to ``desired_num_tokens`` and returns that padded list\n of input tokens as a torch Tensor. If t... |
def pad_token_sequence(self, tokens: Dict[(str, List[TokenType])], desired_num_tokens: Dict[(str, int)], padding_lengths: Dict[(str, int)]) -> Dict[(str, TokenType)]:
'\n Deprecated. Please use `as_padded_tensor` instead.\n TODO(Mark): remove in 1.0 release.\n '
raise NotImplementedError | 4,965,965,602,543,824,000 | Deprecated. Please use `as_padded_tensor` instead.
TODO(Mark): remove in 1.0 release. | allennlp/data/token_indexers/token_indexer.py | pad_token_sequence | loopylangur/allennlp | python | def pad_token_sequence(self, tokens: Dict[(str, List[TokenType])], desired_num_tokens: Dict[(str, int)], padding_lengths: Dict[(str, int)]) -> Dict[(str, TokenType)]:
'\n Deprecated. Please use `as_padded_tensor` instead.\n TODO(Mark): remove in 1.0 release.\n '
raise NotImplementedError |
def get_keys(self, index_name: str) -> List[str]:
'\n Return a list of the keys this indexer return from ``tokens_to_indices``.\n '
return [index_name] | -478,031,282,990,556,700 | Return a list of the keys this indexer return from ``tokens_to_indices``. | allennlp/data/token_indexers/token_indexer.py | get_keys | loopylangur/allennlp | python | def get_keys(self, index_name: str) -> List[str]:
'\n \n '
return [index_name] |
def run_executer(params, train_input_shapes=None, eval_input_shapes=None, train_input_fn=None, eval_input_fn=None):
'Runs Mask RCNN model on distribution strategy defined by the user.'
executer = tpu_executor.TPUEstimatorExecuter(unet_model.unet_model_fn, params, train_input_shapes=train_input_shapes, eval_inpu... | -3,124,367,094,866,476,500 | Runs Mask RCNN model on distribution strategy defined by the user. | models/official/unet3d/unet_main.py | run_executer | tensorflow/tpu-demos | python | def run_executer(params, train_input_shapes=None, eval_input_shapes=None, train_input_fn=None, eval_input_fn=None):
executer = tpu_executor.TPUEstimatorExecuter(unet_model.unet_model_fn, params, train_input_shapes=train_input_shapes, eval_input_shapes=eval_input_shapes)
if (FLAGS.mode == 'train'):
... |
@staticmethod
def add_args(parser):
'Add model-specific arguments to the parser.'
parser.add_argument('--activation-fn', choices=utils.get_available_activation_fns(), help='activation function to use')
parser.add_argument('--dropout', type=float, metavar='D', help='dropout probability')
parser.add_argum... | -7,860,622,762,592,880,000 | Add model-specific arguments to the parser. | models/transformer.py | add_args | NCTUMLlab/Adversarial-Masking-Transformers-for-Language-Understanding | python | @staticmethod
def add_args(parser):
parser.add_argument('--activation-fn', choices=utils.get_available_activation_fns(), help='activation function to use')
parser.add_argument('--dropout', type=float, metavar='D', help='dropout probability')
parser.add_argument('--attention-dropout', type=float, metava... |
@classmethod
def build_model(cls, args, task):
'Build a new model instance.'
base_architecture(args)
if (not hasattr(args, 'max_source_positions')):
args.max_source_positions = DEFAULT_MAX_SOURCE_POSITIONS
if (not hasattr(args, 'max_target_positions')):
args.max_target_positions = DEFAUL... | -8,093,440,201,363,817,000 | Build a new model instance. | models/transformer.py | build_model | NCTUMLlab/Adversarial-Masking-Transformers-for-Language-Understanding | python | @classmethod
def build_model(cls, args, task):
base_architecture(args)
if (not hasattr(args, 'max_source_positions')):
args.max_source_positions = DEFAULT_MAX_SOURCE_POSITIONS
if (not hasattr(args, 'max_target_positions')):
args.max_target_positions = DEFAULT_MAX_TARGET_POSITIONS
(s... |
@staticmethod
def add_args(parser):
'Add model-specific arguments to the parser.'
parser.add_argument('--activation-fn', choices=utils.get_available_activation_fns(), help='activation function to use')
parser.add_argument('--dropout', type=float, metavar='D', help='dropout probability')
parser.add_argum... | -7,860,622,762,592,880,000 | Add model-specific arguments to the parser. | models/transformer.py | add_args | NCTUMLlab/Adversarial-Masking-Transformers-for-Language-Understanding | python | @staticmethod
def add_args(parser):
parser.add_argument('--activation-fn', choices=utils.get_available_activation_fns(), help='activation function to use')
parser.add_argument('--dropout', type=float, metavar='D', help='dropout probability')
parser.add_argument('--attention-dropout', type=float, metava... |
@classmethod
def build_model(cls, args, task):
'Build a new model instance.'
base_architecture(args)
if (not hasattr(args, 'max_source_positions')):
args.max_source_positions = DEFAULT_MAX_SOURCE_POSITIONS
if (not hasattr(args, 'max_target_positions')):
args.max_target_positions = DEFAUL... | 2,629,639,965,958,634,000 | Build a new model instance. | models/transformer.py | build_model | NCTUMLlab/Adversarial-Masking-Transformers-for-Language-Understanding | python | @classmethod
def build_model(cls, args, task):
base_architecture(args)
if (not hasattr(args, 'max_source_positions')):
args.max_source_positions = DEFAULT_MAX_SOURCE_POSITIONS
if (not hasattr(args, 'max_target_positions')):
args.max_target_positions = DEFAULT_MAX_TARGET_POSITIONS
(s... |
def forward(self, src_tokens, src_lengths, prev_output_tokens, bert_input, **kwargs):
"\n Run the forward pass for an encoder-decoder model.\n\n First feed a batch of source tokens through the encoder. Then, feed the\n encoder output and previous decoder outputs (i.e., input feeding/teacher\n ... | -2,871,094,157,983,944,700 | Run the forward pass for an encoder-decoder model.
First feed a batch of source tokens through the encoder. Then, feed the
encoder output and previous decoder outputs (i.e., input feeding/teacher
forcing) to the decoder to produce the next outputs::
encoder_out = self.encoder(src_tokens, src_lengths)
return s... | models/transformer.py | forward | NCTUMLlab/Adversarial-Masking-Transformers-for-Language-Understanding | python | def forward(self, src_tokens, src_lengths, prev_output_tokens, bert_input, **kwargs):
"\n Run the forward pass for an encoder-decoder model.\n\n First feed a batch of source tokens through the encoder. Then, feed the\n encoder output and previous decoder outputs (i.e., input feeding/teacher\n ... |
@staticmethod
def add_args(parser):
'Add model-specific arguments to the parser.'
parser.add_argument('--activation-fn', choices=utils.get_available_activation_fns(), help='activation function to use')
parser.add_argument('--dropout', type=float, metavar='D', help='dropout probability')
parser.add_argum... | -7,860,622,762,592,880,000 | Add model-specific arguments to the parser. | models/transformer.py | add_args | NCTUMLlab/Adversarial-Masking-Transformers-for-Language-Understanding | python | @staticmethod
def add_args(parser):
parser.add_argument('--activation-fn', choices=utils.get_available_activation_fns(), help='activation function to use')
parser.add_argument('--dropout', type=float, metavar='D', help='dropout probability')
parser.add_argument('--attention-dropout', type=float, metava... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.