repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
hubo1016/vlcp
vlcp/utils/dhcp.py
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/dhcp.py#L291-L424
def build_options(payload, options, maxsize = 576, overload = OVERLOAD_FILE | OVERLOAD_SNAME, allowpartial = True): ''' Split a list of options This is the reverse operation of `reassemble_options`, it splits `dhcp_option` into `dhcp_option_partial` if necessary, and set overload option if field ov...
[ "def", "build_options", "(", "payload", ",", "options", ",", "maxsize", "=", "576", ",", "overload", "=", "OVERLOAD_FILE", "|", "OVERLOAD_SNAME", ",", "allowpartial", "=", "True", ")", ":", "if", "maxsize", "<", "576", ":", "maxsize", "=", "576", "max_opti...
Split a list of options This is the reverse operation of `reassemble_options`, it splits `dhcp_option` into `dhcp_option_partial` if necessary, and set overload option if field overloading is used. :param options: a list of `dhcp_option` :param maxsize: Limit the maximum DHCP message ...
[ "Split", "a", "list", "of", "options", "This", "is", "the", "reverse", "operation", "of", "reassemble_options", "it", "splits", "dhcp_option", "into", "dhcp_option_partial", "if", "necessary", "and", "set", "overload", "option", "if", "field", "overloading", "is",...
python
train
46.962687
Fuyukai/ConfigMaster
configmaster/INIConfigFile.py
https://github.com/Fuyukai/ConfigMaster/blob/8018aa415da55c84edaa8a49664f674758a14edd/configmaster/INIConfigFile.py#L40-L60
def ini_dump_hook(cfg, text: bool=False): """ Dumps all the data into a INI file. This will automatically kill anything with a '_' in the keyname, replacing it with a dot. You have been warned. """ data = cfg.config.dump() # Load data back into the goddamned ini file. ndict = {} for ke...
[ "def", "ini_dump_hook", "(", "cfg", ",", "text", ":", "bool", "=", "False", ")", ":", "data", "=", "cfg", ".", "config", ".", "dump", "(", ")", "# Load data back into the goddamned ini file.", "ndict", "=", "{", "}", "for", "key", ",", "item", "in", "dat...
Dumps all the data into a INI file. This will automatically kill anything with a '_' in the keyname, replacing it with a dot. You have been warned.
[ "Dumps", "all", "the", "data", "into", "a", "INI", "file", "." ]
python
train
26.428571
rwl/godot
godot/run.py
https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/run.py#L25-L35
def main(): """ Runs Godot. """ application = GodotApplication( id="godot", plugins=[CorePlugin(), PuddlePlugin(), WorkbenchPlugin(), ResourcePlugin(), GodotPlugin()] ) application.run()
[ "def", "main", "(", ")", ":", "application", "=", "GodotApplication", "(", "id", "=", "\"godot\"", ",", "plugins", "=", "[", "CorePlugin", "(", ")", ",", "PuddlePlugin", "(", ")", ",", "WorkbenchPlugin", "(", ")", ",", "ResourcePlugin", "(", ")", ",", ...
Runs Godot.
[ "Runs", "Godot", "." ]
python
test
24.454545
kubernetes-client/python
kubernetes/client/apis/rbac_authorization_v1_api.py
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/rbac_authorization_v1_api.py#L3208-L3231
def replace_cluster_role(self, name, body, **kwargs): """ replace the specified ClusterRole This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.replace_cluster_role(name, body, async_req=True) ...
[ "def", "replace_cluster_role", "(", "self", ",", "name", ",", "body", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", "replac...
replace the specified ClusterRole This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.replace_cluster_role(name, body, async_req=True) >>> result = thread.get() :param async_req bool :...
[ "replace", "the", "specified", "ClusterRole", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=", "True", ">>>", "thread", "=", "api"...
python
train
63.291667
mitsei/dlkit
dlkit/runtime/impls/osid/metadata.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/runtime/impls/osid/metadata.py#L303-L320
def supports_coordinate_type(self, coordinate_type=None): """Tests if the given coordinate type is supported. arg: coordinate_type (osid.type.Type): a coordinate Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syn...
[ "def", "supports_coordinate_type", "(", "self", ",", "coordinate_type", "=", "None", ")", ":", "# Implemented from template for osid.Metadata.supports_coordinate_type", "from", ".", "osid_errors", "import", "IllegalState", ",", "NullArgument", "if", "not", "coordinate_type", ...
Tests if the given coordinate type is supported. arg: coordinate_type (osid.type.Type): a coordinate Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``COORDINATE`` raise: NullArgument - ``coordina...
[ "Tests", "if", "the", "given", "coordinate", "type", "is", "supported", "." ]
python
train
49.388889
michael-lazar/rtv
rtv/page.py
https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/page.py#L321-L371
def reply(self): """ Reply to the selected item. This is a utility method and should not be bound to a key directly. Item type: Submission - add a top level comment Comment - add a comment reply Message - reply to a private message """ ...
[ "def", "reply", "(", "self", ")", ":", "data", "=", "self", ".", "get_selected_item", "(", ")", "if", "data", "[", "'type'", "]", "==", "'Submission'", ":", "body", "=", "data", "[", "'text'", "]", "description", "=", "'submission'", "reply", "=", "dat...
Reply to the selected item. This is a utility method and should not be bound to a key directly. Item type: Submission - add a top level comment Comment - add a comment reply Message - reply to a private message
[ "Reply", "to", "the", "selected", "item", ".", "This", "is", "a", "utility", "method", "and", "should", "not", "be", "bound", "to", "a", "key", "directly", "." ]
python
train
34.27451
fhcrc/taxtastic
taxtastic/taxonomy.py
https://github.com/fhcrc/taxtastic/blob/4e874b7f2cc146178828bfba386314f8c342722b/taxtastic/taxonomy.py#L136-L151
def _node(self, tax_id): """ Returns parent_id, rank FIXME: expand return rank to include custom 'below' ranks built when get_lineage is caled """ s = select([self.nodes.c.parent_id, self.nodes.c.rank], self.nodes.c.tax_id == tax_id) res...
[ "def", "_node", "(", "self", ",", "tax_id", ")", ":", "s", "=", "select", "(", "[", "self", ".", "nodes", ".", "c", ".", "parent_id", ",", "self", ".", "nodes", ".", "c", ".", "rank", "]", ",", "self", ".", "nodes", ".", "c", ".", "tax_id", "...
Returns parent_id, rank FIXME: expand return rank to include custom 'below' ranks built when get_lineage is caled
[ "Returns", "parent_id", "rank" ]
python
train
32.5
mdavidsaver/p4p
src/p4p/client/thread.py
https://github.com/mdavidsaver/p4p/blob/c5e45eac01edfdad9cc2857bc283c7f2695802b8/src/p4p/client/thread.py#L207-L218
def close(self): """Force close all Channels and cancel all Operations """ if self._Q is not None: for T in self._T: self._Q.interrupt() for n, T in enumerate(self._T): _log.debug('Join Context worker %d', n) T.join() ...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_Q", "is", "not", "None", ":", "for", "T", "in", "self", ".", "_T", ":", "self", ".", "_Q", ".", "interrupt", "(", ")", "for", "n", ",", "T", "in", "enumerate", "(", "self", ".", "_T"...
Force close all Channels and cancel all Operations
[ "Force", "close", "all", "Channels", "and", "cancel", "all", "Operations" ]
python
train
35.833333
geophysics-ubonn/crtomo_tools
lib/crtomo/tdManager.py
https://github.com/geophysics-ubonn/crtomo_tools/blob/27c3e21a557f8df1c12455b96c4c2e00e08a5b4a/lib/crtomo/tdManager.py#L260-L281
def create_tomodir(self, directory): """Create a tomodir subdirectory structure in the given directory """ pwd = os.getcwd() if not os.path.isdir(directory): os.makedirs(directory) os.chdir(directory) directories = ( 'config', 'exe', ...
[ "def", "create_tomodir", "(", "self", ",", "directory", ")", ":", "pwd", "=", "os", ".", "getcwd", "(", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "directory", ")", ":", "os", ".", "makedirs", "(", "directory", ")", "os", ".", "chdir",...
Create a tomodir subdirectory structure in the given directory
[ "Create", "a", "tomodir", "subdirectory", "structure", "in", "the", "given", "directory" ]
python
train
25.318182
indico/indico-plugins
chat/indico_chat/models/chatrooms.py
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/models/chatrooms.py#L187-L201
def delete(self, reason=''): """Deletes the event chatroom and if necessary the chatroom, too. :param reason: reason for the deletion :return: True if the associated chatroom was also deleted, otherwise False """ db.session.delete(self) db.session.flush(...
[ "def", "delete", "(", "self", ",", "reason", "=", "''", ")", ":", "db", ".", "session", ".", "delete", "(", "self", ")", "db", ".", "session", ".", "flush", "(", ")", "if", "not", "self", ".", "chatroom", ".", "events", ":", "db", ".", "session",...
Deletes the event chatroom and if necessary the chatroom, too. :param reason: reason for the deletion :return: True if the associated chatroom was also deleted, otherwise False
[ "Deletes", "the", "event", "chatroom", "and", "if", "necessary", "the", "chatroom", "too", "." ]
python
train
34.133333
bwohlberg/sporco
sporco/admm/admm.py
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/admm/admm.py#L749-L762
def rsdl_rn(self, AX, Y): """Compute primal residual normalisation term. Overriding this method is required if methods :meth:`cnst_A`, :meth:`cnst_AT`, :meth:`cnst_B`, and :meth:`cnst_c` are not overridden. """ # Avoid computing the norm of the value returned by cnst_c(...
[ "def", "rsdl_rn", "(", "self", ",", "AX", ",", "Y", ")", ":", "# Avoid computing the norm of the value returned by cnst_c()", "# more than once", "if", "not", "hasattr", "(", "self", ",", "'_nrm_cnst_c'", ")", ":", "self", ".", "_nrm_cnst_c", "=", "np", ".", "li...
Compute primal residual normalisation term. Overriding this method is required if methods :meth:`cnst_A`, :meth:`cnst_AT`, :meth:`cnst_B`, and :meth:`cnst_c` are not overridden.
[ "Compute", "primal", "residual", "normalisation", "term", "." ]
python
train
39.285714
ansible/tower-cli
tower_cli/resources/role.py
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/role.py#L203-L209
def set_display_columns(self, set_true=[], set_false=[]): """Add or remove columns from the output.""" for i in range(len(self.fields)): if self.fields[i].name in set_true: self.fields[i].display = True elif self.fields[i].name in set_false: self.f...
[ "def", "set_display_columns", "(", "self", ",", "set_true", "=", "[", "]", ",", "set_false", "=", "[", "]", ")", ":", "for", "i", "in", "range", "(", "len", "(", "self", ".", "fields", ")", ")", ":", "if", "self", ".", "fields", "[", "i", "]", ...
Add or remove columns from the output.
[ "Add", "or", "remove", "columns", "from", "the", "output", "." ]
python
valid
48.285714
woocommerce/wc-api-python
woocommerce/api.py
https://github.com/woocommerce/wc-api-python/blob/dee5065eaff2d200ef9883c25799ff605fe5e667/woocommerce/api.py#L54-L65
def __get_oauth_url(self, url, method, **kwargs): """ Generate oAuth1.0a URL """ oauth = OAuth( url=url, consumer_key=self.consumer_key, consumer_secret=self.consumer_secret, version=self.version, method=method, oauth_timestamp=kwar...
[ "def", "__get_oauth_url", "(", "self", ",", "url", ",", "method", ",", "*", "*", "kwargs", ")", ":", "oauth", "=", "OAuth", "(", "url", "=", "url", ",", "consumer_key", "=", "self", ".", "consumer_key", ",", "consumer_secret", "=", "self", ".", "consum...
Generate oAuth1.0a URL
[ "Generate", "oAuth1", ".", "0a", "URL" ]
python
train
32.916667
cloudtools/stacker
stacker/hooks/aws_lambda.py
https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/hooks/aws_lambda.py#L137-L169
def _zip_from_file_patterns(root, includes, excludes, follow_symlinks): """Generates a ZIP file in-memory from file search patterns. Args: root (str): base directory to list files from. includes (list[str]): inclusion patterns. Only files matching those patterns will be included in...
[ "def", "_zip_from_file_patterns", "(", "root", ",", "includes", ",", "excludes", ",", "follow_symlinks", ")", ":", "logger", ".", "info", "(", "'lambda: base directory: %s'", ",", "root", ")", "files", "=", "list", "(", "_find_files", "(", "root", ",", "includ...
Generates a ZIP file in-memory from file search patterns. Args: root (str): base directory to list files from. includes (list[str]): inclusion patterns. Only files matching those patterns will be included in the result. excludes (list[str]): exclusion patterns. Files matching t...
[ "Generates", "a", "ZIP", "file", "in", "-", "memory", "from", "file", "search", "patterns", "." ]
python
train
36.090909
cloud-custodian/cloud-custodian
tools/c7n_azure/c7n_azure/utils.py
https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_azure/c7n_azure/utils.py#L200-L237
def get_principal_dictionary(graph_client, object_ids, raise_on_graph_call_error=False): """Retrieves Azure AD Objects for corresponding object ids passed. :param graph_client: A client for Microsoft Graph. :param object_ids: The object ids to retrieve Azure AD objects for. :param raise_...
[ "def", "get_principal_dictionary", "(", "graph_client", ",", "object_ids", ",", "raise_on_graph_call_error", "=", "False", ")", ":", "if", "not", "object_ids", ":", "return", "{", "}", "object_params", "=", "GetObjectsParameters", "(", "include_directory_object_referenc...
Retrieves Azure AD Objects for corresponding object ids passed. :param graph_client: A client for Microsoft Graph. :param object_ids: The object ids to retrieve Azure AD objects for. :param raise_on_graph_call_error: A boolean indicate whether an error should be raised if the underlying ...
[ "Retrieves", "Azure", "AD", "Objects", "for", "corresponding", "object", "ids", "passed", ".", ":", "param", "graph_client", ":", "A", "client", "for", "Microsoft", "Graph", ".", ":", "param", "object_ids", ":", "The", "object", "ids", "to", "retrieve", "Azu...
python
train
44.921053
tensorflow/tensor2tensor
tensor2tensor/models/video/savp_params.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/video/savp_params.py#L27-L56
def next_frame_savp(): """SAVP model hparams.""" hparams = sv2p_params.next_frame_sv2p() hparams.add_hparam("z_dim", 8) hparams.add_hparam("num_discriminator_filters", 32) hparams.add_hparam("use_vae", True) hparams.add_hparam("use_gan", False) hparams.add_hparam("use_spectral_norm", True) hparams.add_h...
[ "def", "next_frame_savp", "(", ")", ":", "hparams", "=", "sv2p_params", ".", "next_frame_sv2p", "(", ")", "hparams", ".", "add_hparam", "(", "\"z_dim\"", ",", "8", ")", "hparams", ".", "add_hparam", "(", "\"num_discriminator_filters\"", ",", "32", ")", "hparam...
SAVP model hparams.
[ "SAVP", "model", "hparams", "." ]
python
train
34.7
mozilla-releng/scriptworker
scriptworker/utils.py
https://github.com/mozilla-releng/scriptworker/blob/8e97bbd83b9b578565ec57904c966dd6ae4ef0ae/scriptworker/utils.py#L724-L744
def remove_empty_keys(values, remove=({}, None, [], 'null')): """Recursively remove key/value pairs where the value is in ``remove``. This is targeted at comparing json-e rebuilt task definitions, since json-e drops key/value pairs with empty values. Args: values (dict/list): the dict or list ...
[ "def", "remove_empty_keys", "(", "values", ",", "remove", "=", "(", "{", "}", ",", "None", ",", "[", "]", ",", "'null'", ")", ")", ":", "if", "isinstance", "(", "values", ",", "dict", ")", ":", "return", "{", "key", ":", "remove_empty_keys", "(", "...
Recursively remove key/value pairs where the value is in ``remove``. This is targeted at comparing json-e rebuilt task definitions, since json-e drops key/value pairs with empty values. Args: values (dict/list): the dict or list to remove empty keys from. Returns: values (dict/list): ...
[ "Recursively", "remove", "key", "/", "value", "pairs", "where", "the", "value", "is", "in", "remove", "." ]
python
train
37.047619
pypa/pipenv
pipenv/vendor/distlib/locators.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L551-L576
def links(self): """ Return the URLs of all the links on a page together with information about their "rel" attribute, for determining which ones to treat as downloads and which ones to queue for further scraping. """ def clean(url): "Tidy up an URL." ...
[ "def", "links", "(", "self", ")", ":", "def", "clean", "(", "url", ")", ":", "\"Tidy up an URL.\"", "scheme", ",", "netloc", ",", "path", ",", "params", ",", "query", ",", "frag", "=", "urlparse", "(", "url", ")", "return", "urlunparse", "(", "(", "s...
Return the URLs of all the links on a page together with information about their "rel" attribute, for determining which ones to treat as downloads and which ones to queue for further scraping.
[ "Return", "the", "URLs", "of", "all", "the", "links", "on", "a", "page", "together", "with", "information", "about", "their", "rel", "attribute", "for", "determining", "which", "ones", "to", "treat", "as", "downloads", "and", "which", "ones", "to", "queue", ...
python
train
43.230769
SUSE-Enceladus/ipa
ipa/scripts/cli.py
https://github.com/SUSE-Enceladus/ipa/blob/0845eed0ea25a27dbb059ad1016105fa60002228/ipa/scripts/cli.py#L73-L81
def main(context, no_color): """ Ipa provides a Python API and command line utility for testing images. It can be used to test images in the Public Cloud (AWS, Azure, GCE, etc.). """ if context.obj is None: context.obj = {} context.obj['no_color'] = no_color
[ "def", "main", "(", "context", ",", "no_color", ")", ":", "if", "context", ".", "obj", "is", "None", ":", "context", ".", "obj", "=", "{", "}", "context", ".", "obj", "[", "'no_color'", "]", "=", "no_color" ]
Ipa provides a Python API and command line utility for testing images. It can be used to test images in the Public Cloud (AWS, Azure, GCE, etc.).
[ "Ipa", "provides", "a", "Python", "API", "and", "command", "line", "utility", "for", "testing", "images", "." ]
python
train
31.444444
openego/eDisGo
edisgo/grid/connect.py
https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/connect.py#L120-L348
def connect_lv_generators(network, allow_multiple_genos_per_load=True): """Connect LV generators to existing grids. This function searches for unconnected generators in all LV grids and connects them. It connects * generators of voltage level 6 * to MV-LV station * genera...
[ "def", "connect_lv_generators", "(", "network", ",", "allow_multiple_genos_per_load", "=", "True", ")", ":", "# get predefined random seed and initialize random generator", "seed", "=", "int", "(", "network", ".", "config", "[", "'grid_connection'", "]", "[", "'random_see...
Connect LV generators to existing grids. This function searches for unconnected generators in all LV grids and connects them. It connects * generators of voltage level 6 * to MV-LV station * generators of voltage level 7 * with a nom. capacity of <=30 kW to LV loa...
[ "Connect", "LV", "generators", "to", "existing", "grids", "." ]
python
train
45.672489
booktype/python-ooxml
ooxml/parse.py
https://github.com/booktype/python-ooxml/blob/b56990a5bee2e1bc46839cec5161ff3726dc4d87/ooxml/parse.py#L361-L371
def parse_table_properties(doc, table, prop): "Parse table properties." if not table: return style = prop.find(_name('{{{w}}}tblStyle')) if style is not None: table.style_id = style.attrib[_name('{{{w}}}val')] doc.add_style_as_used(table.style_id)
[ "def", "parse_table_properties", "(", "doc", ",", "table", ",", "prop", ")", ":", "if", "not", "table", ":", "return", "style", "=", "prop", ".", "find", "(", "_name", "(", "'{{{w}}}tblStyle'", ")", ")", "if", "style", "is", "not", "None", ":", "table"...
Parse table properties.
[ "Parse", "table", "properties", "." ]
python
train
25.454545
googleapis/oauth2client
oauth2client/_helpers.py
https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/_helpers.py#L182-L202
def parse_unique_urlencoded(content): """Parses unique key-value parameters from urlencoded content. Args: content: string, URL-encoded key-value pairs. Returns: dict, The key-value pairs from ``content``. Raises: ValueError: if one of the keys is repeated. """ urlenco...
[ "def", "parse_unique_urlencoded", "(", "content", ")", ":", "urlencoded_params", "=", "urllib", ".", "parse", ".", "parse_qs", "(", "content", ")", "params", "=", "{", "}", "for", "key", ",", "value", "in", "six", ".", "iteritems", "(", "urlencoded_params", ...
Parses unique key-value parameters from urlencoded content. Args: content: string, URL-encoded key-value pairs. Returns: dict, The key-value pairs from ``content``. Raises: ValueError: if one of the keys is repeated.
[ "Parses", "unique", "key", "-", "value", "parameters", "from", "urlencoded", "content", "." ]
python
valid
31
SetBased/py-etlt
etlt/helper/Type2JoinHelper.py
https://github.com/SetBased/py-etlt/blob/1c5b8ea60293c14f54d7845a9fe5c595021f66f2/etlt/helper/Type2JoinHelper.py#L93-L110
def merge(self, keys): """ Merges the join on pseudo keys of two or more reference data sets. :param list[tuple[str,str]] keys: For each data set the keys of the start and end date. """ deletes = [] for pseudo_key, rows in self._rows.items(): self._additional...
[ "def", "merge", "(", "self", ",", "keys", ")", ":", "deletes", "=", "[", "]", "for", "pseudo_key", ",", "rows", "in", "self", ".", "_rows", ".", "items", "(", ")", ":", "self", ".", "_additional_rows_date2int", "(", "keys", ",", "rows", ")", "rows", ...
Merges the join on pseudo keys of two or more reference data sets. :param list[tuple[str,str]] keys: For each data set the keys of the start and end date.
[ "Merges", "the", "join", "on", "pseudo", "keys", "of", "two", "or", "more", "reference", "data", "sets", "." ]
python
train
36.333333
PureStorage-OpenConnect/rest-client
purestorage/purestorage.py
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L2335-L2353
def create_snmp_manager(self, manager, host, **kwargs): """Create an SNMP manager. :param manager: Name of manager to be created. :type manager: str :param host: IP address or DNS name of SNMP server to be used. :type host: str :param \*\*kwargs: See the REST API Guide o...
[ "def", "create_snmp_manager", "(", "self", ",", "manager", ",", "host", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "\"host\"", ":", "host", "}", "data", ".", "update", "(", "kwargs", ")", "return", "self", ".", "_request", "(", "\"POST\"", ...
Create an SNMP manager. :param manager: Name of manager to be created. :type manager: str :param host: IP address or DNS name of SNMP server to be used. :type host: str :param \*\*kwargs: See the REST API Guide on your array for the documentation on th...
[ "Create", "an", "SNMP", "manager", "." ]
python
train
37.052632
benoitkugler/abstractDataLibrary
pyDLib/Core/data_model.py
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/data_model.py#L285-L287
def dumps(self): """Return a dictionnary of current tables""" return {table_name: getattr(self, table_name).dumps() for table_name in self.TABLES}
[ "def", "dumps", "(", "self", ")", ":", "return", "{", "table_name", ":", "getattr", "(", "self", ",", "table_name", ")", ".", "dumps", "(", ")", "for", "table_name", "in", "self", ".", "TABLES", "}" ]
Return a dictionnary of current tables
[ "Return", "a", "dictionnary", "of", "current", "tables" ]
python
train
53.333333
rigetti/grove
grove/bernstein_vazirani/bernstein_vazirani.py
https://github.com/rigetti/grove/blob/dc6bf6ec63e8c435fe52b1e00f707d5ce4cdb9b3/grove/bernstein_vazirani/bernstein_vazirani.py#L87-L131
def _compute_unitary_oracle_matrix(bitstring_map: Dict[str, str]) -> Tuple[np.ndarray, Dict[str, str]]: """ Computes the unitary matrix that encodes the oracle function used in the Bernstein-Vazirani algorithm. It ge...
[ "def", "_compute_unitary_oracle_matrix", "(", "bitstring_map", ":", "Dict", "[", "str", ",", "str", "]", ")", "->", "Tuple", "[", "np", ".", "ndarray", ",", "Dict", "[", "str", ",", "str", "]", "]", ":", "n_bits", "=", "len", "(", "list", "(", "bitst...
Computes the unitary matrix that encodes the oracle function used in the Bernstein-Vazirani algorithm. It generates a dense matrix for a function :math:`f` .. math:: f:\\{0,1\\}^n\\rightarrow \\{0,1\\} \\mathbf{x}\\rightarrow \\mathbf{a}\\cdot\\mathbf{x}+b\\pmod{2} ...
[ "Computes", "the", "unitary", "matrix", "that", "encodes", "the", "oracle", "function", "used", "in", "the", "Bernstein", "-", "Vazirani", "algorithm", ".", "It", "generates", "a", "dense", "matrix", "for", "a", "function", ":", "math", ":", "f" ]
python
train
52.311111
cisco-sas/kitty
kitty/model/low_level/field.py
https://github.com/cisco-sas/kitty/blob/cb0760989dcdfe079e43ac574d872d0b18953a32/kitty/model/low_level/field.py#L639-L645
def hash(self): ''' :rtype: int :return: hash of the field ''' hashed = super(String, self).hash() return khash(hashed, self._max_size)
[ "def", "hash", "(", "self", ")", ":", "hashed", "=", "super", "(", "String", ",", "self", ")", ".", "hash", "(", ")", "return", "khash", "(", "hashed", ",", "self", ".", "_max_size", ")" ]
:rtype: int :return: hash of the field
[ ":", "rtype", ":", "int", ":", "return", ":", "hash", "of", "the", "field" ]
python
train
25.285714
RudolfCardinal/pythonlib
cardinal_pythonlib/lists.py
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/lists.py#L104-L118
def flatten_list(x: List[Any]) -> List[Any]: """ Converts a list of lists into a flat list. Args: x: list of lists Returns: flat list As per http://stackoverflow.com/questions/952914/making-a-flat-list-out-of-list-of-lists-in-python """ # noqa return [it...
[ "def", "flatten_list", "(", "x", ":", "List", "[", "Any", "]", ")", "->", "List", "[", "Any", "]", ":", "# noqa", "return", "[", "item", "for", "sublist", "in", "x", "for", "item", "in", "sublist", "]" ]
Converts a list of lists into a flat list. Args: x: list of lists Returns: flat list As per http://stackoverflow.com/questions/952914/making-a-flat-list-out-of-list-of-lists-in-python
[ "Converts", "a", "list", "of", "lists", "into", "a", "flat", "list", ".", "Args", ":", "x", ":", "list", "of", "lists" ]
python
train
23.066667
inasafe/inasafe
safe/gui/tools/multi_exposure_dialog.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/multi_exposure_dialog.py#L219-L236
def _add_layer_clicked(self): """Add layer clicked.""" layer = self.tree.selectedItems()[0] origin = layer.data(0, LAYER_ORIGIN_ROLE) if origin == FROM_ANALYSIS['key']: parent = layer.data(0, LAYER_PARENT_ANALYSIS_ROLE) key = layer.data(0, LAYER_PURPOSE_KEY_OR_ID_...
[ "def", "_add_layer_clicked", "(", "self", ")", ":", "layer", "=", "self", ".", "tree", ".", "selectedItems", "(", ")", "[", "0", "]", "origin", "=", "layer", ".", "data", "(", "0", ",", "LAYER_ORIGIN_ROLE", ")", "if", "origin", "==", "FROM_ANALYSIS", "...
Add layer clicked.
[ "Add", "layer", "clicked", "." ]
python
train
49.444444
wonambi-python/wonambi
wonambi/trans/analyze.py
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/analyze.py#L25-L167
def event_params(segments, params, band=None, n_fft=None, slopes=None, prep=None, parent=None): """Compute event parameters. Parameters ---------- segments : instance of wonambi.trans.select.Segments list of segments, with time series and metadata params : dict of bool...
[ "def", "event_params", "(", "segments", ",", "params", ",", "band", "=", "None", ",", "n_fft", "=", "None", ",", "slopes", "=", "None", ",", "prep", "=", "None", ",", "parent", "=", "None", ")", ":", "if", "parent", "is", "not", "None", ":", "progr...
Compute event parameters. Parameters ---------- segments : instance of wonambi.trans.select.Segments list of segments, with time series and metadata params : dict of bool, or str 'dur', 'minamp', 'maxamp', 'ptp', 'rms', 'power', 'peakf', 'energy', 'peakef'. If 'all', a dict...
[ "Compute", "event", "parameters", ".", "Parameters", "----------", "segments", ":", "instance", "of", "wonambi", ".", "trans", ".", "select", ".", "Segments", "list", "of", "segments", "with", "time", "series", "and", "metadata", "params", ":", "dict", "of", ...
python
train
31.972028
ktsstudio/tornkts
tornkts/modules/verification/verification_handler.py
https://github.com/ktsstudio/tornkts/blob/db47e4550426282960a7e4486dcc4399c8d52e02/tornkts/modules/verification/verification_handler.py#L59-L74
def verify(verified_entity, verification_key): """ Метод должен райзить ошибки :param verified_entity: сущность :param verification_key: ключ :return: """ verification = get_object_or_none(Verification, verified_entity=verified_entity) if verification is ...
[ "def", "verify", "(", "verified_entity", ",", "verification_key", ")", ":", "verification", "=", "get_object_or_none", "(", "Verification", ",", "verified_entity", "=", "verified_entity", ")", "if", "verification", "is", "None", ":", "raise", "ServerError", "(", "...
Метод должен райзить ошибки :param verified_entity: сущность :param verification_key: ключ :return:
[ "Метод", "должен", "райзить", "ошибки", ":", "param", "verified_entity", ":", "сущность", ":", "param", "verification_key", ":", "ключ", ":", "return", ":" ]
python
train
37.125
pypa/pipenv
pipenv/vendor/requests/cookies.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/cookies.py#L270-L276
def list_domains(self): """Utility method to list all the domains in the jar.""" domains = [] for cookie in iter(self): if cookie.domain not in domains: domains.append(cookie.domain) return domains
[ "def", "list_domains", "(", "self", ")", ":", "domains", "=", "[", "]", "for", "cookie", "in", "iter", "(", "self", ")", ":", "if", "cookie", ".", "domain", "not", "in", "domains", ":", "domains", ".", "append", "(", "cookie", ".", "domain", ")", "...
Utility method to list all the domains in the jar.
[ "Utility", "method", "to", "list", "all", "the", "domains", "in", "the", "jar", "." ]
python
train
35.857143
wbond/asn1crypto
asn1crypto/_teletex_codec.py
https://github.com/wbond/asn1crypto/blob/ecda20176f55d37021cbca1f6da9083a8e491197/asn1crypto/_teletex_codec.py#L45-L61
def teletex_search_function(name): """ Search function for teletex codec that is passed to codecs.register() """ if name != 'teletex': return None return codecs.CodecInfo( name='teletex', encode=TeletexCodec().encode, decode=TeletexCodec().decode, incrementa...
[ "def", "teletex_search_function", "(", "name", ")", ":", "if", "name", "!=", "'teletex'", ":", "return", "None", "return", "codecs", ".", "CodecInfo", "(", "name", "=", "'teletex'", ",", "encode", "=", "TeletexCodec", "(", ")", ".", "encode", ",", "decode"...
Search function for teletex codec that is passed to codecs.register()
[ "Search", "function", "for", "teletex", "codec", "that", "is", "passed", "to", "codecs", ".", "register", "()" ]
python
train
28.411765
mmp2/megaman
megaman/utils/eigendecomp.py
https://github.com/mmp2/megaman/blob/faccaf267aad0a8b18ec8a705735fd9dd838ca1e/megaman/utils/eigendecomp.py#L228-L352
def null_space(M, k, k_skip=1, eigen_solver='arpack', random_state=None, solver_kwds=None): """ Find the null space of a matrix M: eigenvectors associated with 0 eigenvalues Parameters ---------- M : {array, matrix, sparse matrix, LinearOperator} Input covariance matrix: shou...
[ "def", "null_space", "(", "M", ",", "k", ",", "k_skip", "=", "1", ",", "eigen_solver", "=", "'arpack'", ",", "random_state", "=", "None", ",", "solver_kwds", "=", "None", ")", ":", "eigen_solver", ",", "solver_kwds", "=", "check_eigen_solver", "(", "eigen_...
Find the null space of a matrix M: eigenvectors associated with 0 eigenvalues Parameters ---------- M : {array, matrix, sparse matrix, LinearOperator} Input covariance matrix: should be symmetric positive semi-definite k : integer Number of eigenvalues/vectors to return k_skip : int...
[ "Find", "the", "null", "space", "of", "a", "matrix", "M", ":", "eigenvectors", "associated", "with", "0", "eigenvalues" ]
python
train
54.936
spotify/luigi
luigi/contrib/batch.py
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/batch.py#L176-L185
def register_job_definition(self, json_fpath): """Register a job definition with AWS Batch, using a JSON""" with open(json_fpath) as f: job_def = json.load(f) response = self._client.register_job_definition(**job_def) status_code = response['ResponseMetadata']['HTTPStatusCode...
[ "def", "register_job_definition", "(", "self", ",", "json_fpath", ")", ":", "with", "open", "(", "json_fpath", ")", "as", "f", ":", "job_def", "=", "json", ".", "load", "(", "f", ")", "response", "=", "self", ".", "_client", ".", "register_job_definition",...
Register a job definition with AWS Batch, using a JSON
[ "Register", "a", "job", "definition", "with", "AWS", "Batch", "using", "a", "JSON" ]
python
train
51.4
pmelchior/proxmin
proxmin/operators.py
https://github.com/pmelchior/proxmin/blob/60e49d90c67c46329cc1d3b5c484951dc8bd2c3f/proxmin/operators.py#L44-L50
def prox_min(X, step, thresh=0): """Projection onto numbers above `thresh` """ thresh_ = _step_gamma(step, thresh) below = X - thresh_ < 0 X[below] = thresh_ return X
[ "def", "prox_min", "(", "X", ",", "step", ",", "thresh", "=", "0", ")", ":", "thresh_", "=", "_step_gamma", "(", "step", ",", "thresh", ")", "below", "=", "X", "-", "thresh_", "<", "0", "X", "[", "below", "]", "=", "thresh_", "return", "X" ]
Projection onto numbers above `thresh`
[ "Projection", "onto", "numbers", "above", "thresh" ]
python
train
26.285714
bsolomon1124/pyfinance
pyfinance/ols.py
https://github.com/bsolomon1124/pyfinance/blob/c95925209a809b4e648e79cbeaf7711d8e5ff1a6/pyfinance/ols.py#L516-L524
def _se_all(self): """Standard errors (SE) for all parameters, including the intercept.""" err = np.expand_dims(self._ms_err, axis=1) t1 = np.diagonal( np.linalg.inv(np.matmul(self.xwins.swapaxes(1, 2), self.xwins)), axis1=1, axis2=2, ) ...
[ "def", "_se_all", "(", "self", ")", ":", "err", "=", "np", ".", "expand_dims", "(", "self", ".", "_ms_err", ",", "axis", "=", "1", ")", "t1", "=", "np", ".", "diagonal", "(", "np", ".", "linalg", ".", "inv", "(", "np", ".", "matmul", "(", "self...
Standard errors (SE) for all parameters, including the intercept.
[ "Standard", "errors", "(", "SE", ")", "for", "all", "parameters", "including", "the", "intercept", "." ]
python
train
38.777778
google/openhtf
bin/units_from_xls.py
https://github.com/google/openhtf/blob/655e85df7134db7bdf8f8fdd6ff9a6bf932e7b09/bin/units_from_xls.py#L245-L255
def unit_key_from_name(name): """Return a legal python name for the given name for use as a unit key.""" result = name for old, new in six.iteritems(UNIT_KEY_REPLACEMENTS): result = result.replace(old, new) # Collapse redundant underscores and convert to uppercase. result = re.sub(r'_+', '_', result.upp...
[ "def", "unit_key_from_name", "(", "name", ")", ":", "result", "=", "name", "for", "old", ",", "new", "in", "six", ".", "iteritems", "(", "UNIT_KEY_REPLACEMENTS", ")", ":", "result", "=", "result", ".", "replace", "(", "old", ",", "new", ")", "# Collapse ...
Return a legal python name for the given name for use as a unit key.
[ "Return", "a", "legal", "python", "name", "for", "the", "given", "name", "for", "use", "as", "a", "unit", "key", "." ]
python
train
30.181818
gsi-upm/soil
soil/history.py
https://github.com/gsi-upm/soil/blob/a3ea434f237f039c3cadbc2e0a83ae626d77b818/soil/history.py#L105-L111
def recover(self, key, value): """Get the deserialized value for a given key, and the serialized version.""" if key not in self._dtypes: self.read_types() if key not in self._dtypes: raise ValueError("Unknown datatype for {} and {}".format(key, value)) return self...
[ "def", "recover", "(", "self", ",", "key", ",", "value", ")", ":", "if", "key", "not", "in", "self", ".", "_dtypes", ":", "self", ".", "read_types", "(", ")", "if", "key", "not", "in", "self", ".", "_dtypes", ":", "raise", "ValueError", "(", "\"Unk...
Get the deserialized value for a given key, and the serialized version.
[ "Get", "the", "deserialized", "value", "for", "a", "given", "key", "and", "the", "serialized", "version", "." ]
python
train
48.142857
UDST/orca
orca/orca.py
https://github.com/UDST/orca/blob/07b34aeef13cc87c966b2e30cbe7e76cc9d3622c/orca/orca.py#L1505-L1526
def step(step_name=None): """ Decorates functions that will be called by the `run` function. Decorator version of `add_step`. step name defaults to name of function. The function's argument names and keyword argument values will be matched to registered variables when the function needs to...
[ "def", "step", "(", "step_name", "=", "None", ")", ":", "def", "decorator", "(", "func", ")", ":", "if", "step_name", ":", "name", "=", "step_name", "else", ":", "name", "=", "func", ".", "__name__", "add_step", "(", "name", ",", "func", ")", "return...
Decorates functions that will be called by the `run` function. Decorator version of `add_step`. step name defaults to name of function. The function's argument names and keyword argument values will be matched to registered variables when the function needs to be evaluated by Orca. The argumen...
[ "Decorates", "functions", "that", "will", "be", "called", "by", "the", "run", "function", "." ]
python
train
28.227273
softlayer/softlayer-python
SoftLayer/CLI/loadbal/create.py
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/loadbal/create.py#L17-L25
def cli(env, billing_id, datacenter): """Adds a load balancer given the id returned from create-options.""" mgr = SoftLayer.LoadBalancerManager(env.client) if not formatting.confirm("This action will incur charges on your " "account. Continue?"): raise exceptions.CLIAb...
[ "def", "cli", "(", "env", ",", "billing_id", ",", "datacenter", ")", ":", "mgr", "=", "SoftLayer", ".", "LoadBalancerManager", "(", "env", ".", "client", ")", "if", "not", "formatting", ".", "confirm", "(", "\"This action will incur charges on your \"", "\"accou...
Adds a load balancer given the id returned from create-options.
[ "Adds", "a", "load", "balancer", "given", "the", "id", "returned", "from", "create", "-", "options", "." ]
python
train
47.888889
mitsei/dlkit
dlkit/json_/learning/objects.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/objects.py#L824-L834
def get_assets_metadata(self): """Gets the metadata for the assets. return: (osid.Metadata) - metadata for the assets *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.learning.ActivityForm.get_assets_metadata_template ...
[ "def", "get_assets_metadata", "(", "self", ")", ":", "# Implemented from template for osid.learning.ActivityForm.get_assets_metadata_template", "metadata", "=", "dict", "(", "self", ".", "_mdata", "[", "'assets'", "]", ")", "metadata", ".", "update", "(", "{", "'existin...
Gets the metadata for the assets. return: (osid.Metadata) - metadata for the assets *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "metadata", "for", "the", "assets", "." ]
python
train
42
kpdyer/regex2dfa
third_party/re2/re2/make_unicode_groups.py
https://github.com/kpdyer/regex2dfa/blob/109f877e60ef0dfcb430f11516d215930b7b9936/third_party/re2/re2/make_unicode_groups.py#L30-L40
def MakeRanges(codes): """Turn a list like [1,2,3,7,8,9] into a range list [[1,3], [7,9]]""" ranges = [] last = -100 for c in codes: if c == last+1: ranges[-1][1] = c else: ranges.append([c, c]) last = c return ranges
[ "def", "MakeRanges", "(", "codes", ")", ":", "ranges", "=", "[", "]", "last", "=", "-", "100", "for", "c", "in", "codes", ":", "if", "c", "==", "last", "+", "1", ":", "ranges", "[", "-", "1", "]", "[", "1", "]", "=", "c", "else", ":", "rang...
Turn a list like [1,2,3,7,8,9] into a range list [[1,3], [7,9]]
[ "Turn", "a", "list", "like", "[", "1", "2", "3", "7", "8", "9", "]", "into", "a", "range", "list", "[[", "1", "3", "]", "[", "7", "9", "]]" ]
python
train
21.909091
hotdoc/hotdoc
hotdoc/core/project.py
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/project.py#L82-L106
def include_file_cb(include_path, line_ranges, symbol): """ Banana banana """ lang = '' if include_path.endswith((".md", ".markdown")): lang = 'markdown' else: split = os.path.splitext(include_path) if len(split) == 2: e...
[ "def", "include_file_cb", "(", "include_path", ",", "line_ranges", ",", "symbol", ")", ":", "lang", "=", "''", "if", "include_path", ".", "endswith", "(", "(", "\".md\"", ",", "\".markdown\"", ")", ")", ":", "lang", "=", "'markdown'", "else", ":", "split",...
Banana banana
[ "Banana", "banana" ]
python
train
33.84
ajenhl/tacl
tacl/data_store.py
https://github.com/ajenhl/tacl/blob/b8a343248e77f1c07a5a4ac133a9ad6e0b4781c2/tacl/data_store.py#L321-L343
def _diff(self, cursor, tokenizer, output_fh): """Returns output_fh with diff results that have been reduced. Uses a temporary file to store the results from `cursor` before being reduced, in order to not have the results stored in memory twice. :param cursor: database cursor c...
[ "def", "_diff", "(", "self", ",", "cursor", ",", "tokenizer", ",", "output_fh", ")", ":", "temp_path", "=", "self", ".", "_csv_temp", "(", "cursor", ",", "constants", ".", "QUERY_FIELDNAMES", ")", "output_fh", "=", "self", ".", "_reduce_diff_results", "(", ...
Returns output_fh with diff results that have been reduced. Uses a temporary file to store the results from `cursor` before being reduced, in order to not have the results stored in memory twice. :param cursor: database cursor containing raw diff data :type cursor: `sqlite3.Cur...
[ "Returns", "output_fh", "with", "diff", "results", "that", "have", "been", "reduced", "." ]
python
train
40.434783
profitbricks/profitbricks-sdk-python
profitbricks/client.py
https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L900-L915
def delete_loadbalancer(self, datacenter_id, loadbalancer_id): """ Removes the load balancer from the data center. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param loadbalancer_id: The unique ID of the load balancer. ...
[ "def", "delete_loadbalancer", "(", "self", ",", "datacenter_id", ",", "loadbalancer_id", ")", ":", "response", "=", "self", ".", "_perform_request", "(", "url", "=", "'/datacenters/%s/loadbalancers/%s'", "%", "(", "datacenter_id", ",", "loadbalancer_id", ")", ",", ...
Removes the load balancer from the data center. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param loadbalancer_id: The unique ID of the load balancer. :type loadbalancer_id: ``str``
[ "Removes", "the", "load", "balancer", "from", "the", "data", "center", "." ]
python
valid
34.25
KnowledgeLinks/rdfframework
rdfframework/framework.py
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/framework.py#L105-L114
def get_rml(self, rml_name): """ returns the rml mapping RdfDataset rml_name(str): Name of the rml mapping to retrieve """ try: return getattr(self, rml_name) except AttributeError: return self.load_rml(rml_name)
[ "def", "get_rml", "(", "self", ",", "rml_name", ")", ":", "try", ":", "return", "getattr", "(", "self", ",", "rml_name", ")", "except", "AttributeError", ":", "return", "self", ".", "load_rml", "(", "rml_name", ")" ]
returns the rml mapping RdfDataset rml_name(str): Name of the rml mapping to retrieve
[ "returns", "the", "rml", "mapping", "RdfDataset" ]
python
train
26.9
ucsb-cs/submit
submit/models.py
https://github.com/ucsb-cs/submit/blob/92810c81255a4fc6bbebac1ac8aae856fd576ffe/submit/models.py#L965-L970
def classes_can_admin(self): """Return all the classes (sorted) that this user can admin.""" if self.is_admin: return sorted(Session.query(Class).all()) else: return sorted(self.admin_for)
[ "def", "classes_can_admin", "(", "self", ")", ":", "if", "self", ".", "is_admin", ":", "return", "sorted", "(", "Session", ".", "query", "(", "Class", ")", ".", "all", "(", ")", ")", "else", ":", "return", "sorted", "(", "self", ".", "admin_for", ")"...
Return all the classes (sorted) that this user can admin.
[ "Return", "all", "the", "classes", "(", "sorted", ")", "that", "this", "user", "can", "admin", "." ]
python
train
38.5
iotile/coretools
iotilesensorgraph/iotile/sg/engine/in_memory.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/engine/in_memory.py#L159-L181
def get(self, buffer_type, offset): """Get a reading from the buffer at offset. Offset is specified relative to the start of the data buffer. This means that if the buffer rolls over, the offset for a given item will appear to change. Anyone holding an offset outside of this en...
[ "def", "get", "(", "self", ",", "buffer_type", ",", "offset", ")", ":", "if", "buffer_type", "==", "u'streaming'", ":", "chosen_buffer", "=", "self", ".", "streaming_data", "else", ":", "chosen_buffer", "=", "self", ".", "storage_data", "if", "offset", ">=",...
Get a reading from the buffer at offset. Offset is specified relative to the start of the data buffer. This means that if the buffer rolls over, the offset for a given item will appear to change. Anyone holding an offset outside of this engine object will need to be notified when rollo...
[ "Get", "a", "reading", "from", "the", "buffer", "at", "offset", "." ]
python
train
42.347826
hyperledger/sawtooth-core
validator/sawtooth_validator/database/database.py
https://github.com/hyperledger/sawtooth-core/blob/8cf473bc2207e51f02bd182d825158a57d72b098/validator/sawtooth_validator/database/database.py#L53-L64
def get(self, key, index=None): """Retrieves a value associated with a key from the database Args: key (str): The key to retrieve """ records = self.get_multi([key], index=index) try: return records[0][1] # return the value from the key/value tuple ...
[ "def", "get", "(", "self", ",", "key", ",", "index", "=", "None", ")", ":", "records", "=", "self", ".", "get_multi", "(", "[", "key", "]", ",", "index", "=", "index", ")", "try", ":", "return", "records", "[", "0", "]", "[", "1", "]", "# retur...
Retrieves a value associated with a key from the database Args: key (str): The key to retrieve
[ "Retrieves", "a", "value", "associated", "with", "a", "key", "from", "the", "database" ]
python
train
29.583333
xtuml/pyxtuml
xtuml/load.py
https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/xtuml/load.py#L497-L500
def t_SEMICOLON(self, t): r';' t.endlexpos = t.lexpos + len(t.value) return t
[ "def", "t_SEMICOLON", "(", "self", ",", "t", ")", ":", "t", ".", "endlexpos", "=", "t", ".", "lexpos", "+", "len", "(", "t", ".", "value", ")", "return", "t" ]
r';
[ "r", ";" ]
python
test
24.5
consbio/gis-metadata-parser
gis_metadata/iso_metadata_parser.py
https://github.com/consbio/gis-metadata-parser/blob/59eefb2e51cd4d8cc3e94623a2167499ca9ef70f/gis_metadata/iso_metadata_parser.py#L369-L392
def _parse_attribute_details_file(self, prop=ATTRIBUTES): """ Concatenates a list of Attribute Details data structures parsed from a remote file """ # Parse content from remote file URL, which may be stored in one of two places: # Starting at: contentInfo/MD_FeatureCatalogueDescription/featu...
[ "def", "_parse_attribute_details_file", "(", "self", ",", "prop", "=", "ATTRIBUTES", ")", ":", "# Parse content from remote file URL, which may be stored in one of two places:", "# Starting at: contentInfo/MD_FeatureCatalogueDescription/featureCatalogueCitation", "# ATTRIBUTE: href", ...
Concatenates a list of Attribute Details data structures parsed from a remote file
[ "Concatenates", "a", "list", "of", "Attribute", "Details", "data", "structures", "parsed", "from", "a", "remote", "file" ]
python
train
42.083333
saltstack/salt
salt/states/cloud.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cloud.py#L316-L347
def volume_present(name, provider=None, **kwargs): ''' Check that a block volume exists. ''' ret = _check_name(name) if not ret['result']: return ret volumes = __salt__['cloud.volume_list'](provider=provider) if name in volumes: ret['comment'] = 'Volume exists: {0}'.format(...
[ "def", "volume_present", "(", "name", ",", "provider", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "_check_name", "(", "name", ")", "if", "not", "ret", "[", "'result'", "]", ":", "return", "ret", "volumes", "=", "__salt__", "[", "'clo...
Check that a block volume exists.
[ "Check", "that", "a", "block", "volume", "exists", "." ]
python
train
27.90625
6809/MC6809
MC6809/components/mc6809_ops_branches.py
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_branches.py#L302-L319
def instruction_BMI(self, opcode, ea): """ Tests the state of the N (negative) bit and causes a branch if set. That is, branch if the sign of the twos complement result is negative. When used after an operation on signed binary values, this instruction will branch if the result ...
[ "def", "instruction_BMI", "(", "self", ",", "opcode", ",", "ea", ")", ":", "if", "self", ".", "N", "==", "1", ":", "# log.info(\"$%x BMI branch to $%x, because N==1 \\t| %s\" % (", "# self.program_counter, ea, self.cfg.mem_info.get_shortest(ea)", "# ...
Tests the state of the N (negative) bit and causes a branch if set. That is, branch if the sign of the twos complement result is negative. When used after an operation on signed binary values, this instruction will branch if the result is minus. It is generally preferred to use the LBLT...
[ "Tests", "the", "state", "of", "the", "N", "(", "negative", ")", "bit", "and", "causes", "a", "branch", "if", "set", ".", "That", "is", "branch", "if", "the", "sign", "of", "the", "twos", "complement", "result", "is", "negative", "." ]
python
train
39.944444
darkfeline/animanager
animanager/db/query/files.py
https://github.com/darkfeline/animanager/blob/55d92e4cbdc12aac8ebe302420d2cff3fa9fa148/animanager/db/query/files.py#L33-L38
def get_priority_rules(db) -> Iterable[PriorityRule]: """Get file priority rules.""" cur = db.cursor() cur.execute('SELECT id, regexp, priority FROM file_priority') for row in cur: yield PriorityRule(*row)
[ "def", "get_priority_rules", "(", "db", ")", "->", "Iterable", "[", "PriorityRule", "]", ":", "cur", "=", "db", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "'SELECT id, regexp, priority FROM file_priority'", ")", "for", "row", "in", "cur", ":", "yie...
Get file priority rules.
[ "Get", "file", "priority", "rules", "." ]
python
train
37.333333
tensorflow/tensorboard
tensorboard/plugins/image/images_plugin.py
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/image/images_plugin.py#L321-L330
def _serve_individual_image(self, request): """Serves an individual image.""" run = request.args.get('run') tag = request.args.get('tag') index = int(request.args.get('index')) sample = int(request.args.get('sample', 0)) data = self._get_individual_image(run, tag, index, sample) image_type =...
[ "def", "_serve_individual_image", "(", "self", ",", "request", ")", ":", "run", "=", "request", ".", "args", ".", "get", "(", "'run'", ")", "tag", "=", "request", ".", "args", ".", "get", "(", "'tag'", ")", "index", "=", "int", "(", "request", ".", ...
Serves an individual image.
[ "Serves", "an", "individual", "image", "." ]
python
train
47.3
sixty-north/cosmic-ray
src/cosmic_ray/tools/survival_rate.py
https://github.com/sixty-north/cosmic-ray/blob/c654e074afbb7b7fcbc23359083c1287c0d3e991/src/cosmic_ray/tools/survival_rate.py#L8-L20
def format_survival_rate(): """cr-rate Usage: cr-rate <session-file> Calculate the survival rate of a session. """ arguments = docopt.docopt( format_survival_rate.__doc__, version='cr-rate 1.0') with use_db(arguments['<session-file>'], WorkDB.Mode.open) as db: rate = survival_r...
[ "def", "format_survival_rate", "(", ")", ":", "arguments", "=", "docopt", ".", "docopt", "(", "format_survival_rate", ".", "__doc__", ",", "version", "=", "'cr-rate 1.0'", ")", "with", "use_db", "(", "arguments", "[", "'<session-file>'", "]", ",", "WorkDB", "....
cr-rate Usage: cr-rate <session-file> Calculate the survival rate of a session.
[ "cr", "-", "rate" ]
python
train
26.846154
CartoDB/cartoframes
cartoframes/context.py
https://github.com/CartoDB/cartoframes/blob/c94238a545f3dec45963dac3892540942b6f0df8/cartoframes/context.py#L1580-L1601
def _check_query(self, query, style_cols=None): """Checks if query from Layer or QueryLayer is valid""" try: self.sql_client.send( utils.minify_sql(( 'EXPLAIN', 'SELECT', ' {style_cols}{comma}', ...
[ "def", "_check_query", "(", "self", ",", "query", ",", "style_cols", "=", "None", ")", ":", "try", ":", "self", ".", "sql_client", ".", "send", "(", "utils", ".", "minify_sql", "(", "(", "'EXPLAIN'", ",", "'SELECT'", ",", "' {style_cols}{comma}'", ",", ...
Checks if query from Layer or QueryLayer is valid
[ "Checks", "if", "query", "from", "Layer", "or", "QueryLayer", "is", "valid" ]
python
train
48.227273
jeffrimko/Auxly
lib/auxly/stringy.py
https://github.com/jeffrimko/Auxly/blob/5aae876bcb6ca117c81d904f9455764cdc78cd48/lib/auxly/stringy.py#L22-L27
def randomize(length=6, choices=None): """Returns a random string of the given length.""" if type(choices) == str: choices = list(choices) choices = choices or ascii_lowercase return "".join(choice(choices) for _ in range(length))
[ "def", "randomize", "(", "length", "=", "6", ",", "choices", "=", "None", ")", ":", "if", "type", "(", "choices", ")", "==", "str", ":", "choices", "=", "list", "(", "choices", ")", "choices", "=", "choices", "or", "ascii_lowercase", "return", "\"\"", ...
Returns a random string of the given length.
[ "Returns", "a", "random", "string", "of", "the", "given", "length", "." ]
python
train
41.5
Alignak-monitoring/alignak
alignak/objects/hostdependency.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/hostdependency.py#L271-L304
def linkify_h_by_hd(self, hosts): """Add dependency in host objects :param hosts: hosts list :type hosts: alignak.objects.host.Hosts :return: None """ for hostdep in self: # Only used for debugging purpose when loops are detected setattr(hostdep, ...
[ "def", "linkify_h_by_hd", "(", "self", ",", "hosts", ")", ":", "for", "hostdep", "in", "self", ":", "# Only used for debugging purpose when loops are detected", "setattr", "(", "hostdep", ",", "\"host_name_string\"", ",", "\"undefined\"", ")", "setattr", "(", "hostdep...
Add dependency in host objects :param hosts: hosts list :type hosts: alignak.objects.host.Hosts :return: None
[ "Add", "dependency", "in", "host", "objects", ":", "param", "hosts", ":", "hosts", "list", ":", "type", "hosts", ":", "alignak", ".", "objects", ".", "host", ".", "Hosts" ]
python
train
47.558824
vrtsystems/hszinc
hszinc/zoneinfo.py
https://github.com/vrtsystems/hszinc/blob/d52a7c6b5bc466f3c1a77b71814c8c0776aba995/hszinc/zoneinfo.py#L473-L506
def timezone_name(dt, version=LATEST_VER): """ Determine an appropriate timezone for the given date/time object """ tz_rmap = get_tz_rmap(version=version) if dt.tzinfo is None: raise ValueError('%r has no timezone' % dt) # Easy case: pytz timezone. try: tz_name = dt.tzinfo.z...
[ "def", "timezone_name", "(", "dt", ",", "version", "=", "LATEST_VER", ")", ":", "tz_rmap", "=", "get_tz_rmap", "(", "version", "=", "version", ")", "if", "dt", ".", "tzinfo", "is", "None", ":", "raise", "ValueError", "(", "'%r has no timezone'", "%", "dt",...
Determine an appropriate timezone for the given date/time object
[ "Determine", "an", "appropriate", "timezone", "for", "the", "given", "date", "/", "time", "object" ]
python
valid
30.117647
clalancette/pycdlib
pycdlib/eltorito.py
https://github.com/clalancette/pycdlib/blob/1e7b77a809e905d67dc71e12d70e850be26b6233/pycdlib/eltorito.py#L712-L743
def new(self, br, ino, sector_count, load_seg, media_name, system_type, platform_id, bootable): # type: (headervd.BootRecord, inode.Inode, int, int, str, int, int, bool) -> None ''' A method to create a new El Torito Boot Catalog. Parameters: br - The boot record th...
[ "def", "new", "(", "self", ",", "br", ",", "ino", ",", "sector_count", ",", "load_seg", ",", "media_name", ",", "system_type", ",", "platform_id", ",", "bootable", ")", ":", "# type: (headervd.BootRecord, inode.Inode, int, int, str, int, int, bool) -> None", "if", "se...
A method to create a new El Torito Boot Catalog. Parameters: br - The boot record that this El Torito Boot Catalog is associated with. ino - The Inode to associate with the initial entry. sector_count - The number of sectors for the initial entry. load_seg - The load segment...
[ "A", "method", "to", "create", "a", "new", "El", "Torito", "Boot", "Catalog", "." ]
python
train
42.6875
joeferraro/mm
mm/sforce/base.py
https://github.com/joeferraro/mm/blob/43dce48a2249faab4d872c228ada9fbdbeec147b/mm/sforce/base.py#L169-L177
def generateHeader(self, sObjectType): ''' Generate a SOAP header as defined in: http://www.salesforce.com/us/developer/docs/api/Content/soap_headers.htm ''' try: return self._sforce.factory.create(sObjectType) except: print 'There is not a SOAP header of type %s' % sObjectType
[ "def", "generateHeader", "(", "self", ",", "sObjectType", ")", ":", "try", ":", "return", "self", ".", "_sforce", ".", "factory", ".", "create", "(", "sObjectType", ")", "except", ":", "print", "'There is not a SOAP header of type %s'", "%", "sObjectType" ]
Generate a SOAP header as defined in: http://www.salesforce.com/us/developer/docs/api/Content/soap_headers.htm
[ "Generate", "a", "SOAP", "header", "as", "defined", "in", ":", "http", ":", "//", "www", ".", "salesforce", ".", "com", "/", "us", "/", "developer", "/", "docs", "/", "api", "/", "Content", "/", "soap_headers", ".", "htm" ]
python
train
34
pneff/wsgiservice
wsgiservice/resource.py
https://github.com/pneff/wsgiservice/blob/03c064ac2e8c53a1aac9c7b99970f23cf79e20f4/wsgiservice/resource.py#L279-L290
def assert_condition_md5(self): """If the ``Content-MD5`` request header is present in the request it's verified against the MD5 hash of the request body. If they don't match, a 400 HTTP response is returned. :raises: :class:`webob.exceptions.ResponseException` of status 400 if ...
[ "def", "assert_condition_md5", "(", "self", ")", ":", "if", "'Content-MD5'", "in", "self", ".", "request", ".", "headers", ":", "body_md5", "=", "hashlib", ".", "md5", "(", "self", ".", "request", ".", "body", ")", ".", "hexdigest", "(", ")", "if", "bo...
If the ``Content-MD5`` request header is present in the request it's verified against the MD5 hash of the request body. If they don't match, a 400 HTTP response is returned. :raises: :class:`webob.exceptions.ResponseException` of status 400 if the MD5 hash does not match the bo...
[ "If", "the", "Content", "-", "MD5", "request", "header", "is", "present", "in", "the", "request", "it", "s", "verified", "against", "the", "MD5", "hash", "of", "the", "request", "body", ".", "If", "they", "don", "t", "match", "a", "400", "HTTP", "respo...
python
train
51.833333
ungarj/mapchete
mapchete/formats/base.py
https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/base.py#L216-L239
def tiles_exist(self, process_tile=None, output_tile=None): """ Check whether output tiles of a tile (either process or output) exists. Parameters ---------- process_tile : ``BufferedTile`` must be member of process ``TilePyramid`` output_tile : ``BufferedTil...
[ "def", "tiles_exist", "(", "self", ",", "process_tile", "=", "None", ",", "output_tile", "=", "None", ")", ":", "if", "process_tile", "and", "output_tile", ":", "raise", "ValueError", "(", "\"just one of 'process_tile' and 'output_tile' allowed\"", ")", "if", "proce...
Check whether output tiles of a tile (either process or output) exists. Parameters ---------- process_tile : ``BufferedTile`` must be member of process ``TilePyramid`` output_tile : ``BufferedTile`` must be member of output ``TilePyramid`` Returns ...
[ "Check", "whether", "output", "tiles", "of", "a", "tile", "(", "either", "process", "or", "output", ")", "exists", "." ]
python
valid
33.708333
dls-controls/pymalcolm
malcolm/modules/pandablocks/pandablocksclient.py
https://github.com/dls-controls/pymalcolm/blob/80ea667e4da26365a6cebc0249f52fdc744bd983/malcolm/modules/pandablocks/pandablocksclient.py#L180-L194
def parameterized_send(self, request, parameter_list): """Send batched requests for a list of parameters Args: request (str): Request to send, like "%s.*?\n" parameter_list (list): parameters to format with, like ["TTLIN", "TTLOUT"] Returns: ...
[ "def", "parameterized_send", "(", "self", ",", "request", ",", "parameter_list", ")", ":", "response_queues", "=", "OrderedDict", "(", ")", "for", "parameter", "in", "parameter_list", ":", "response_queues", "[", "parameter", "]", "=", "self", ".", "send", "("...
Send batched requests for a list of parameters Args: request (str): Request to send, like "%s.*?\n" parameter_list (list): parameters to format with, like ["TTLIN", "TTLOUT"] Returns: dict: {parameter: response_queue}
[ "Send", "batched", "requests", "for", "a", "list", "of", "parameters" ]
python
train
35.666667
saltstack/salt
salt/modules/vsphere.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vsphere.py#L3880-L3911
def _apply_dvs_infrastructure_traffic_resources(infra_traffic_resources, resource_dicts): ''' Applies the values of the resource dictionaries to infra traffic resources, creating the infra traffic resource if required (vim.DistributedVirtualSwitchProductSp...
[ "def", "_apply_dvs_infrastructure_traffic_resources", "(", "infra_traffic_resources", ",", "resource_dicts", ")", ":", "for", "res_dict", "in", "resource_dicts", ":", "filtered_traffic_resources", "=", "[", "r", "for", "r", "in", "infra_traffic_resources", "if", "r", "....
Applies the values of the resource dictionaries to infra traffic resources, creating the infra traffic resource if required (vim.DistributedVirtualSwitchProductSpec)
[ "Applies", "the", "values", "of", "the", "resource", "dictionaries", "to", "infra", "traffic", "resources", "creating", "the", "infra", "traffic", "resource", "if", "required", "(", "vim", ".", "DistributedVirtualSwitchProductSpec", ")" ]
python
train
52.75
googledatalab/pydatalab
google/datalab/contrib/mlworkbench/_local_predict.py
https://github.com/googledatalab/pydatalab/blob/d9031901d5bca22fe0d5925d204e6698df9852e1/google/datalab/contrib/mlworkbench/_local_predict.py#L90-L108
def _download_images(data, img_cols): """Download images given image columns.""" images = collections.defaultdict(list) for d in data: for img_col in img_cols: if d.get(img_col, None): if isinstance(d[img_col], Image.Image): # If it is already an Image, just copy and continue. ...
[ "def", "_download_images", "(", "data", ",", "img_cols", ")", ":", "images", "=", "collections", ".", "defaultdict", "(", "list", ")", "for", "d", "in", "data", ":", "for", "img_col", "in", "img_cols", ":", "if", "d", ".", "get", "(", "img_col", ",", ...
Download images given image columns.
[ "Download", "images", "given", "image", "columns", "." ]
python
train
31.368421
bartromgens/geojsoncontour
geojsoncontour/contour.py
https://github.com/bartromgens/geojsoncontour/blob/79e30718fa0c1d96a2459eb1f45d06d699d240ed/geojsoncontour/contour.py#L43-L65
def contourf_to_geojson_overlap(contourf, geojson_filepath=None, min_angle_deg=None, ndigits=5, unit='', stroke_width=1, fill_opacity=.9, geojson_properties=None, strdump=False, serialize=True): """Transform matplotlib.contourf to geojson with overlapp...
[ "def", "contourf_to_geojson_overlap", "(", "contourf", ",", "geojson_filepath", "=", "None", ",", "min_angle_deg", "=", "None", ",", "ndigits", "=", "5", ",", "unit", "=", "''", ",", "stroke_width", "=", "1", ",", "fill_opacity", "=", ".9", ",", "geojson_pro...
Transform matplotlib.contourf to geojson with overlapping filled contours.
[ "Transform", "matplotlib", ".", "contourf", "to", "geojson", "with", "overlapping", "filled", "contours", "." ]
python
train
58.826087
konikvranik/pyCEC
pycec/tcp.py
https://github.com/konikvranik/pyCEC/blob/acf42a842d8a912ed68d63d8d6b653e6c405b29b/pycec/tcp.py#L143-L152
def main(): """For testing purpose""" tcp_adapter = TcpAdapter("192.168.1.3", name="HASS", activate_source=False) hdmi_network = HDMINetwork(tcp_adapter) hdmi_network.start() while True: for d in hdmi_network.devices: _LOGGER.info("Device: %s", d) time.sleep(7)
[ "def", "main", "(", ")", ":", "tcp_adapter", "=", "TcpAdapter", "(", "\"192.168.1.3\"", ",", "name", "=", "\"HASS\"", ",", "activate_source", "=", "False", ")", "hdmi_network", "=", "HDMINetwork", "(", "tcp_adapter", ")", "hdmi_network", ".", "start", "(", "...
For testing purpose
[ "For", "testing", "purpose" ]
python
train
30.1
ericjang/tdb
tdb/debug_session.py
https://github.com/ericjang/tdb/blob/5e78b5dbecf78b6d28eb2f5b67decf8d1f1eb17d/tdb/debug_session.py#L33-L61
def run(self, evals, feed_dict=None, breakpoints=None, break_immediately=False): """ starts the debug session """ if not isinstance(evals,list): evals=[evals] if feed_dict is None: feed_dict={} if breakpoints is None: breakpoints=[] self.state=RUNNING self._original_evals=evals self._origina...
[ "def", "run", "(", "self", ",", "evals", ",", "feed_dict", "=", "None", ",", "breakpoints", "=", "None", ",", "break_immediately", "=", "False", ")", ":", "if", "not", "isinstance", "(", "evals", ",", "list", ")", ":", "evals", "=", "[", "evals", "]"...
starts the debug session
[ "starts", "the", "debug", "session" ]
python
train
22.413793
google/grr
grr/server/grr_response_server/hunts/implementation.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L1120-L1123
def CreateRunner(self, **kw): """Make a new runner.""" self.runner = HuntRunner(self, token=self.token, **kw) return self.runner
[ "def", "CreateRunner", "(", "self", ",", "*", "*", "kw", ")", ":", "self", ".", "runner", "=", "HuntRunner", "(", "self", ",", "token", "=", "self", ".", "token", ",", "*", "*", "kw", ")", "return", "self", ".", "runner" ]
Make a new runner.
[ "Make", "a", "new", "runner", "." ]
python
train
34.25
pmacosta/ptrie
ptrie/ptrie.py
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L1205-L1243
def search_tree(self, name): # noqa: D302 r""" Search tree for all nodes with a specific name. :param name: Node name to search for :type name: :ref:`NodeName` :raises: RuntimeError (Argument \`name\` is not valid) For example: >>> from __future__ import...
[ "def", "search_tree", "(", "self", ",", "name", ")", ":", "# noqa: D302", "if", "self", ".", "_validate_node_name", "(", "name", ")", ":", "raise", "RuntimeError", "(", "\"Argument `name` is not valid\"", ")", "return", "self", ".", "_search_tree", "(", "name", ...
r""" Search tree for all nodes with a specific name. :param name: Node name to search for :type name: :ref:`NodeName` :raises: RuntimeError (Argument \`name\` is not valid) For example: >>> from __future__ import print_function >>> import pprint, ptri...
[ "r", "Search", "tree", "for", "all", "nodes", "with", "a", "specific", "name", "." ]
python
train
33.384615
bryanwweber/thermohw
thermohw/filters.py
https://github.com/bryanwweber/thermohw/blob/b6be276c14f8adf6ae23f5498065de74f868ccaa/thermohw/filters.py#L25-L54
def div_filter(key: str, value: list, format: str, meta: Any) -> Optional[list]: """Filter the JSON ``value`` for alert divs. Arguments --------- key Key of the structure value Values in the structure format Output format of the processing meta Meta informati...
[ "def", "div_filter", "(", "key", ":", "str", ",", "value", ":", "list", ",", "format", ":", "str", ",", "meta", ":", "Any", ")", "->", "Optional", "[", "list", "]", ":", "if", "key", "!=", "\"Div\"", "or", "format", "!=", "\"latex\"", ":", "return"...
Filter the JSON ``value`` for alert divs. Arguments --------- key Key of the structure value Values in the structure format Output format of the processing meta Meta information
[ "Filter", "the", "JSON", "value", "for", "alert", "divs", "." ]
python
train
26.666667
bwohlberg/sporco
sporco/admm/admm.py
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/admm/admm.py#L461-L485
def compute_residuals(self): """Compute residuals and stopping thresholds.""" if self.opt['AutoRho', 'StdResiduals']: r = np.linalg.norm(self.rsdl_r(self.AXnr, self.Y)) s = np.linalg.norm(self.rsdl_s(self.Yprev, self.Y)) epri = np.sqrt(self.Nc) * self.opt['AbsStopTol...
[ "def", "compute_residuals", "(", "self", ")", ":", "if", "self", ".", "opt", "[", "'AutoRho'", ",", "'StdResiduals'", "]", ":", "r", "=", "np", ".", "linalg", ".", "norm", "(", "self", ".", "rsdl_r", "(", "self", ".", "AXnr", ",", "self", ".", "Y",...
Compute residuals and stopping thresholds.
[ "Compute", "residuals", "and", "stopping", "thresholds", "." ]
python
train
43.72
JCharante/padr
padr/padr.py
https://github.com/JCharante/padr/blob/1deb66263fb92919a4025ef49e504cb33af05662/padr/padr.py#L1-L41
def pad(lines, delim): """ Right Pads text split by their delim. :param lines: :param delim: :return: """ """ Populates text into chunks. If the delim was & then ['12 & 344', '344 & 8', '8 & 88'] would be stored in chunks as [['12', '344', '8'], ['344', '8', '88']] """ chunks = [] for i in range(len(lin...
[ "def", "pad", "(", "lines", ",", "delim", ")", ":", "\"\"\"\n\tPopulates text into chunks. If the delim was & then\n\t['12 & 344', '344 & 8', '8 & 88'] would be stored in chunks as\n\t[['12', '344', '8'], ['344', '8', '88']]\n\t\"\"\"", "chunks", "=", "[", "]", "for", "i", "in", "ran...
Right Pads text split by their delim. :param lines: :param delim: :return:
[ "Right", "Pads", "text", "split", "by", "their", "delim", ".", ":", "param", "lines", ":", ":", "param", "delim", ":", ":", "return", ":" ]
python
train
24.02439
aws/sagemaker-python-sdk
src/sagemaker/estimator.py
https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L175-L202
def _prepare_for_training(self, job_name=None): """Set any values in the estimator that need to be set before training. Args: * job_name (str): Name of the training job to be created. If not specified, one is generated, using the base name given to the constructor if applica...
[ "def", "_prepare_for_training", "(", "self", ",", "job_name", "=", "None", ")", ":", "if", "job_name", "is", "not", "None", ":", "self", ".", "_current_job_name", "=", "job_name", "else", ":", "# honor supplied base_job_name or generate it", "if", "self", ".", "...
Set any values in the estimator that need to be set before training. Args: * job_name (str): Name of the training job to be created. If not specified, one is generated, using the base name given to the constructor if applicable.
[ "Set", "any", "values", "in", "the", "estimator", "that", "need", "to", "be", "set", "before", "training", "." ]
python
train
48.75
gwastro/pycbc
pycbc/io/hdf.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/io/hdf.py#L897-L914
def recursively_save_dict_contents_to_group(h5file, path, dic): """ Parameters ---------- h5file: h5py file to be written to path: path within h5py file to saved dictionary dic: python dictionary to be converted to hdf5 format """ for key, item in dic.items(): ...
[ "def", "recursively_save_dict_contents_to_group", "(", "h5file", ",", "path", ",", "dic", ")", ":", "for", "key", ",", "item", "in", "dic", ".", "items", "(", ")", ":", "if", "isinstance", "(", "item", ",", "(", "np", ".", "ndarray", ",", "np", ".", ...
Parameters ---------- h5file: h5py file to be written to path: path within h5py file to saved dictionary dic: python dictionary to be converted to hdf5 format
[ "Parameters", "----------", "h5file", ":", "h5py", "file", "to", "be", "written", "to", "path", ":", "path", "within", "h5py", "file", "to", "saved", "dictionary", "dic", ":", "python", "dictionary", "to", "be", "converted", "to", "hdf5", "format" ]
python
train
35.111111
10gen/mongo-orchestration
mongo_orchestration/replica_sets.py
https://github.com/10gen/mongo-orchestration/blob/81fd2224205922ea2178b08190b53a33aec47261/mongo_orchestration/replica_sets.py#L499-L510
def hidden(self): """return list of hidden members""" members = [self.member_info(item["_id"]) for item in self.members()] result = [] for member in members: if member['rsInfo'].get('hidden'): server_id = member['server_id'] result.append({ ...
[ "def", "hidden", "(", "self", ")", ":", "members", "=", "[", "self", ".", "member_info", "(", "item", "[", "\"_id\"", "]", ")", "for", "item", "in", "self", ".", "members", "(", ")", "]", "result", "=", "[", "]", "for", "member", "in", "members", ...
return list of hidden members
[ "return", "list", "of", "hidden", "members" ]
python
train
39.75
krukas/Trionyx
trionyx/trionyx/views/core.py
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/trionyx/views/core.py#L742-L748
def render_to_string(self, template_file, context): """Render given template to string and add object to context""" context = context if context else {} if self.object: context['object'] = self.object context[self.object.__class__.__name__.lower()] = self.object r...
[ "def", "render_to_string", "(", "self", ",", "template_file", ",", "context", ")", ":", "context", "=", "context", "if", "context", "else", "{", "}", "if", "self", ".", "object", ":", "context", "[", "'object'", "]", "=", "self", ".", "object", "context"...
Render given template to string and add object to context
[ "Render", "given", "template", "to", "string", "and", "add", "object", "to", "context" ]
python
train
53.428571
woolfson-group/isambard
isambard/ampal/protein.py
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/protein.py#L686-L719
def tag_secondary_structure(self, force=False): """Tags each `Residue` of the `Polypeptide` with secondary structure. Notes ----- DSSP must be available to call. Check by running `isambard.external_programs.dssp.test_dssp`. If DSSP is not available, please follow instruc...
[ "def", "tag_secondary_structure", "(", "self", ",", "force", "=", "False", ")", ":", "tagged", "=", "[", "'secondary_structure'", "in", "x", ".", "tags", ".", "keys", "(", ")", "for", "x", "in", "self", ".", "_monomers", "]", "if", "(", "not", "all", ...
Tags each `Residue` of the `Polypeptide` with secondary structure. Notes ----- DSSP must be available to call. Check by running `isambard.external_programs.dssp.test_dssp`. If DSSP is not available, please follow instruction here to add it: https://github.com/woolfson-gr...
[ "Tags", "each", "Residue", "of", "the", "Polypeptide", "with", "secondary", "structure", "." ]
python
train
38.411765
pywbem/pywbem
pywbem_mock/_resolvermixin.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_resolvermixin.py#L129-L147
def _init_qualifier(qualifier, qual_repo): """ Initialize the flavors of a qualifier from the qualifier repo and initialize propagated. """ qual_dict_entry = qual_repo[qualifier.name] qualifier.propagated = False if qualifier.tosubclass is None: if qua...
[ "def", "_init_qualifier", "(", "qualifier", ",", "qual_repo", ")", ":", "qual_dict_entry", "=", "qual_repo", "[", "qualifier", ".", "name", "]", "qualifier", ".", "propagated", "=", "False", "if", "qualifier", ".", "tosubclass", "is", "None", ":", "if", "qua...
Initialize the flavors of a qualifier from the qualifier repo and initialize propagated.
[ "Initialize", "the", "flavors", "of", "a", "qualifier", "from", "the", "qualifier", "repo", "and", "initialize", "propagated", "." ]
python
train
41.894737
joealcorn/xbox
xbox/resource.py
https://github.com/joealcorn/xbox/blob/3d2aeba10244dcb58d714d76fc88487c74bd1510/xbox/resource.py#L33-L51
def from_xuid(cls, xuid): ''' Instantiates an instance of ``GamerProfile`` from an xuid :param xuid: Xuid to look up :raises: :class:`~xbox.exceptions.GamertagNotFound` :returns: :class:`~xbox.GamerProfile` instance ''' url = 'https://profile.xboxlive....
[ "def", "from_xuid", "(", "cls", ",", "xuid", ")", ":", "url", "=", "'https://profile.xboxlive.com/users/xuid(%s)/profile/settings'", "%", "xuid", "try", ":", "return", "cls", ".", "_fetch", "(", "url", ")", "except", "(", "GamertagNotFound", ",", "InvalidRequest",...
Instantiates an instance of ``GamerProfile`` from an xuid :param xuid: Xuid to look up :raises: :class:`~xbox.exceptions.GamertagNotFound` :returns: :class:`~xbox.GamerProfile` instance
[ "Instantiates", "an", "instance", "of", "GamerProfile", "from", "an", "xuid" ]
python
train
31.631579
tanghaibao/jcvi
jcvi/compara/fractionation.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/compara/fractionation.py#L145-L219
def segment(args): """ %prog segment loss.ids bedfile Merge adjacent gene loss into segmental loss. Then based on the segmental loss, estimate amount of DNA loss in base pairs. Two estimates can be given: - conservative: just within the start and end of a single gene - aggressive: extend t...
[ "def", "segment", "(", "args", ")", ":", "from", "jcvi", ".", "formats", ".", "base", "import", "SetFile", "p", "=", "OptionParser", "(", "segment", ".", "__doc__", ")", "p", ".", "add_option", "(", "\"--chain\"", ",", "default", "=", "1", ",", "type",...
%prog segment loss.ids bedfile Merge adjacent gene loss into segmental loss. Then based on the segmental loss, estimate amount of DNA loss in base pairs. Two estimates can be given: - conservative: just within the start and end of a single gene - aggressive: extend the deletion track to the next g...
[ "%prog", "segment", "loss", ".", "ids", "bedfile" ]
python
train
37.266667
brian-rose/climlab
climlab/solar/orbital/table.py
https://github.com/brian-rose/climlab/blob/eae188a2ae9308229b8cbb8fe0b65f51b50ee1e6/climlab/solar/orbital/table.py#L14-L36
def _get_Berger_data(verbose=True): '''Read in the Berger and Loutre orbital table as a pandas dataframe, convert to xarray ''' # The first column of the data file is used as the row index, and represents kyr from present orbit91_pd, path = load_data_source(local_path = local_path, r...
[ "def", "_get_Berger_data", "(", "verbose", "=", "True", ")", ":", "# The first column of the data file is used as the row index, and represents kyr from present", "orbit91_pd", ",", "path", "=", "load_data_source", "(", "local_path", "=", "local_path", ",", "remote_source_list"...
Read in the Berger and Loutre orbital table as a pandas dataframe, convert to xarray
[ "Read", "in", "the", "Berger", "and", "Loutre", "orbital", "table", "as", "a", "pandas", "dataframe", "convert", "to", "xarray" ]
python
train
56.608696
uuazed/numerapi
numerapi/numerapi.py
https://github.com/uuazed/numerapi/blob/fc9dcc53b32ede95bfda1ceeb62aec1d67d26697/numerapi/numerapi.py#L76-L88
def _unzip_file(self, src_path, dest_path, filename): """unzips file located at src_path into destination_path""" self.logger.info("unzipping file...") # construct full path (including file name) for unzipping unzip_path = os.path.join(dest_path, filename) utils.ensure_directory...
[ "def", "_unzip_file", "(", "self", ",", "src_path", ",", "dest_path", ",", "filename", ")", ":", "self", ".", "logger", ".", "info", "(", "\"unzipping file...\"", ")", "# construct full path (including file name) for unzipping", "unzip_path", "=", "os", ".", "path",...
unzips file located at src_path into destination_path
[ "unzips", "file", "located", "at", "src_path", "into", "destination_path" ]
python
train
35.307692
narenchoudhary/django-iitg-auth
iitgauth/auth.py
https://github.com/narenchoudhary/django-iitg-auth/blob/632c51643017acadb66cd6c0b6577cd85cf3ca0b/iitgauth/auth.py#L18-L28
def get_user(self, user_id): """ Return user object. :param user_id: primary key of user object :return: user object """ user_model = get_user_model() try: return user_model.objects.get(id=user_id) except user_model.DoesNotExist: re...
[ "def", "get_user", "(", "self", ",", "user_id", ")", ":", "user_model", "=", "get_user_model", "(", ")", "try", ":", "return", "user_model", ".", "objects", ".", "get", "(", "id", "=", "user_id", ")", "except", "user_model", ".", "DoesNotExist", ":", "re...
Return user object. :param user_id: primary key of user object :return: user object
[ "Return", "user", "object", ".", ":", "param", "user_id", ":", "primary", "key", "of", "user", "object", ":", "return", ":", "user", "object" ]
python
train
29
MKLab-ITI/reveal-graph-embedding
reveal_graph_embedding/learning/holdout.py
https://github.com/MKLab-ITI/reveal-graph-embedding/blob/eda862687aa5a64b79c6b12de1b4dca6ce986dc8/reveal_graph_embedding/learning/holdout.py#L202-L270
def iterative_stratification(node_label_matrix, training_set_size, number_of_categories, random_seed=0): """ Iterative data fold stratification/balancing for two folds. Based on: Sechidis, K., Tsoumakas, G., & Vlahavas, I. (2011). On the stratification of multi-label data. In Ma...
[ "def", "iterative_stratification", "(", "node_label_matrix", ",", "training_set_size", ",", "number_of_categories", ",", "random_seed", "=", "0", ")", ":", "number_of_labelled_nodes", "=", "node_label_matrix", ".", "shape", "[", "0", "]", "testing_set_size", "=", "num...
Iterative data fold stratification/balancing for two folds. Based on: Sechidis, K., Tsoumakas, G., & Vlahavas, I. (2011). On the stratification of multi-label data. In Machine Learning and Knowledge Discovery in Databases (pp. 145-158). Springer Berlin Heidelberg. Inp...
[ "Iterative", "data", "fold", "stratification", "/", "balancing", "for", "two", "folds", "." ]
python
train
52.449275
quantopian/trading_calendars
trading_calendars/trading_calendar.py
https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L1016-L1049
def _overwrite_special_dates(midnight_utcs, opens_or_closes, special_opens_or_closes): """ Overwrite dates in open_or_closes with corresponding dates in special_opens_or_closes, using midnight_utcs for alignment. """ # Short circuit when noth...
[ "def", "_overwrite_special_dates", "(", "midnight_utcs", ",", "opens_or_closes", ",", "special_opens_or_closes", ")", ":", "# Short circuit when nothing to apply.", "if", "not", "len", "(", "special_opens_or_closes", ")", ":", "return", "len_m", ",", "len_oc", "=", "len...
Overwrite dates in open_or_closes with corresponding dates in special_opens_or_closes, using midnight_utcs for alignment.
[ "Overwrite", "dates", "in", "open_or_closes", "with", "corresponding", "dates", "in", "special_opens_or_closes", "using", "midnight_utcs", "for", "alignment", "." ]
python
train
45.5
prompt-toolkit/pymux
pymux/main.py
https://github.com/prompt-toolkit/pymux/blob/3f66e62b9de4b2251c7f9afad6c516dc5a30ec67/pymux/main.py#L109-L118
def _handle_command(self, buffer): " When text is accepted in the command line. " text = buffer.text # First leave command mode. We want to make sure that the working # pane is focused again before executing the command handers. self.pymux.leave_command_mode(append_to_history=Tr...
[ "def", "_handle_command", "(", "self", ",", "buffer", ")", ":", "text", "=", "buffer", ".", "text", "# First leave command mode. We want to make sure that the working", "# pane is focused again before executing the command handers.", "self", ".", "pymux", ".", "leave_command_mo...
When text is accepted in the command line.
[ "When", "text", "is", "accepted", "in", "the", "command", "line", "." ]
python
train
38.2
caktus/django-timepiece
timepiece/entries/views.py
https://github.com/caktus/django-timepiece/blob/52515dec027664890efbc535429e1ba1ee152f40/timepiece/entries/views.py#L255-L282
def reject_entry(request, entry_id): """ Admins can reject an entry that has been verified or approved but not invoiced to set its status to 'unverified' for the user to fix. """ return_url = request.GET.get('next', reverse('dashboard')) try: entry = Entry.no_join.get(pk=entry_id) ex...
[ "def", "reject_entry", "(", "request", ",", "entry_id", ")", ":", "return_url", "=", "request", ".", "GET", ".", "get", "(", "'next'", ",", "reverse", "(", "'dashboard'", ")", ")", "try", ":", "entry", "=", "Entry", ".", "no_join", ".", "get", "(", "...
Admins can reject an entry that has been verified or approved but not invoiced to set its status to 'unverified' for the user to fix.
[ "Admins", "can", "reject", "an", "entry", "that", "has", "been", "verified", "or", "approved", "but", "not", "invoiced", "to", "set", "its", "status", "to", "unverified", "for", "the", "user", "to", "fix", "." ]
python
train
35.892857
MAVENSDC/cdflib
cdflib/cdfwrite.py
https://github.com/MAVENSDC/cdflib/blob/d237c60e5db67db0f92d96054209c25c4042465c/cdflib/cdfwrite.py#L1965-L1985
def _write_cpr(self, f, cType, parameter) -> int: ''' Write compression info to the end of the file in a CPR. ''' f.seek(0, 2) byte_loc = f.tell() block_size = CDF.CPR_BASE_SIZE64 + 4 section_type = CDF.CPR_ rfuA = 0 pCount = 1 cpr = bytea...
[ "def", "_write_cpr", "(", "self", ",", "f", ",", "cType", ",", "parameter", ")", "->", "int", ":", "f", ".", "seek", "(", "0", ",", "2", ")", "byte_loc", "=", "f", ".", "tell", "(", ")", "block_size", "=", "CDF", ".", "CPR_BASE_SIZE64", "+", "4",...
Write compression info to the end of the file in a CPR.
[ "Write", "compression", "info", "to", "the", "end", "of", "the", "file", "in", "a", "CPR", "." ]
python
train
31
nerdvegas/rez
src/build_utils/virtualenv/virtualenv.py
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/build_utils/virtualenv/virtualenv.py#L1670-L1683
def relative_script(lines): "Return a script that'll work in a relocatable environment." activate = "import os; activate_this=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'activate_this.py'); exec(compile(open(activate_this).read(), activate_this, 'exec'), dict(__file__=activate_this)); del os, act...
[ "def", "relative_script", "(", "lines", ")", ":", "activate", "=", "\"import os; activate_this=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'activate_this.py'); exec(compile(open(activate_this).read(), activate_this, 'exec'), dict(__file__=activate_this)); del os, activate_this\"", "#...
Return a script that'll work in a relocatable environment.
[ "Return", "a", "script", "that", "ll", "work", "in", "a", "relocatable", "environment", "." ]
python
train
59.142857
glitchassassin/lackey
lackey/PlatformManagerWindows.py
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/PlatformManagerWindows.py#L230-L238
def getScreenBounds(self, screenId): """ Returns the screen size of the specified monitor (0 being the main monitor). """ screen_details = self.getScreenDetails() if not isinstance(screenId, int) or screenId < -1 or screenId >= len(screen_details): raise ValueError("Invalid screen ID...
[ "def", "getScreenBounds", "(", "self", ",", "screenId", ")", ":", "screen_details", "=", "self", ".", "getScreenDetails", "(", ")", "if", "not", "isinstance", "(", "screenId", ",", "int", ")", "or", "screenId", "<", "-", "1", "or", "screenId", ">=", "len...
Returns the screen size of the specified monitor (0 being the main monitor).
[ "Returns", "the", "screen", "size", "of", "the", "specified", "monitor", "(", "0", "being", "the", "main", "monitor", ")", "." ]
python
train
54.555556
pandas-dev/pandas
pandas/io/formats/style.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/style.py#L1019-L1075
def _bar(s, align, colors, width=100, vmin=None, vmax=None): """ Draw bar chart in dataframe cells. """ # Get input value range. smin = s.min() if vmin is None else vmin if isinstance(smin, ABCSeries): smin = smin.min() smax = s.max() if vmax is None e...
[ "def", "_bar", "(", "s", ",", "align", ",", "colors", ",", "width", "=", "100", ",", "vmin", "=", "None", ",", "vmax", "=", "None", ")", ":", "# Get input value range.", "smin", "=", "s", ".", "min", "(", ")", "if", "vmin", "is", "None", "else", ...
Draw bar chart in dataframe cells.
[ "Draw", "bar", "chart", "in", "dataframe", "cells", "." ]
python
train
34.649123
bitesofcode/projexui
projexui/widgets/xorbbrowserwidget/xorbbrowserwidget.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbbrowserwidget/xorbbrowserwidget.py#L476-L494
def refreshRecords( self ): """ Refreshes the records being loaded by this browser. """ table_type = self.tableType() if ( not table_type ): self._records = RecordSet() return False search = nativestring(self.uiSearchTXT.text()) ...
[ "def", "refreshRecords", "(", "self", ")", ":", "table_type", "=", "self", ".", "tableType", "(", ")", "if", "(", "not", "table_type", ")", ":", "self", ".", "_records", "=", "RecordSet", "(", ")", "return", "False", "search", "=", "nativestring", "(", ...
Refreshes the records being loaded by this browser.
[ "Refreshes", "the", "records", "being", "loaded", "by", "this", "browser", "." ]
python
train
30.368421
pyviz/holoviews
holoviews/core/data/__init__.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/data/__init__.py#L791-L811
def dframe(self, dimensions=None, multi_index=False): """Convert dimension values to DataFrame. Returns a pandas dataframe of columns along each dimension, either completely flat or indexed by key dimensions. Args: dimensions: Dimensions to return as columns mul...
[ "def", "dframe", "(", "self", ",", "dimensions", "=", "None", ",", "multi_index", "=", "False", ")", ":", "if", "dimensions", "is", "None", ":", "dimensions", "=", "[", "d", ".", "name", "for", "d", "in", "self", ".", "dimensions", "(", ")", "]", "...
Convert dimension values to DataFrame. Returns a pandas dataframe of columns along each dimension, either completely flat or indexed by key dimensions. Args: dimensions: Dimensions to return as columns multi_index: Convert key dimensions to (multi-)index Return...
[ "Convert", "dimension", "values", "to", "DataFrame", "." ]
python
train
38.380952
saltstack/salt
salt/modules/syslog_ng.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/syslog_ng.py#L583-L598
def _add_junction(item): ''' Adds a junction to the _current_statement. ''' type_, channels = _expand_one_key_dictionary(item) junction = UnnamedStatement(type='junction') for item in channels: type_, value = _expand_one_key_dictionary(item) channel = UnnamedStatement(type='chann...
[ "def", "_add_junction", "(", "item", ")", ":", "type_", ",", "channels", "=", "_expand_one_key_dictionary", "(", "item", ")", "junction", "=", "UnnamedStatement", "(", "type", "=", "'junction'", ")", "for", "item", "in", "channels", ":", "type_", ",", "value...
Adds a junction to the _current_statement.
[ "Adds", "a", "junction", "to", "the", "_current_statement", "." ]
python
train
37
nephila/python-taiga
taiga/models/base.py
https://github.com/nephila/python-taiga/blob/5b471d6b8b59e5d410162a6f1c2f0d4188445a56/taiga/models/base.py#L210-L218
def to_dict(self): """ Get a dictionary representation of :class:`InstanceResource` """ self_dict = {} for key, value in six.iteritems(self.__dict__): if self.allowed_params and key in self.allowed_params: self_dict[key] = value return self_dic...
[ "def", "to_dict", "(", "self", ")", ":", "self_dict", "=", "{", "}", "for", "key", ",", "value", "in", "six", ".", "iteritems", "(", "self", ".", "__dict__", ")", ":", "if", "self", ".", "allowed_params", "and", "key", "in", "self", ".", "allowed_par...
Get a dictionary representation of :class:`InstanceResource`
[ "Get", "a", "dictionary", "representation", "of", ":", "class", ":", "InstanceResource" ]
python
train
34.777778
gccxml/pygccxml
pygccxml/declarations/templates.py
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/templates.py#L81-L93
def normalize_name(decl): """ Cached variant of normalize Args: decl (declaration.declaration_t): the declaration Returns: str: normalized name """ if decl.cache.normalized_name is None: decl.cache.normalized_name = normalize(decl.name) return decl.cache.normalized_...
[ "def", "normalize_name", "(", "decl", ")", ":", "if", "decl", ".", "cache", ".", "normalized_name", "is", "None", ":", "decl", ".", "cache", ".", "normalized_name", "=", "normalize", "(", "decl", ".", "name", ")", "return", "decl", ".", "cache", ".", "...
Cached variant of normalize Args: decl (declaration.declaration_t): the declaration Returns: str: normalized name
[ "Cached", "variant", "of", "normalize" ]
python
train
24