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
minhhoit/yacms
yacms/core/templatetags/yacms_tags.py
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/core/templatetags/yacms_tags.py#L121-L133
def sort_by(items, attr): """ General sort filter - sorts by either attribute or key. """ def key_func(item): try: return getattr(item, attr) except AttributeError: try: return item[attr] except TypeError: getattr(item, ...
[ "def", "sort_by", "(", "items", ",", "attr", ")", ":", "def", "key_func", "(", "item", ")", ":", "try", ":", "return", "getattr", "(", "item", ",", "attr", ")", "except", "AttributeError", ":", "try", ":", "return", "item", "[", "attr", "]", "except"...
General sort filter - sorts by either attribute or key.
[ "General", "sort", "filter", "-", "sorts", "by", "either", "attribute", "or", "key", "." ]
python
train
29.076923
apple/turicreate
src/unity/python/turicreate/util/__init__.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L394-L405
def _make_temp_filename(prefix): ''' Generate a temporary file that would not live beyond the lifetime of unity_server. Caller is expected to clean up the temp file as soon as the file is no longer needed. But temp files created using this method will be cleaned up when unity_server restarts ...
[ "def", "_make_temp_filename", "(", "prefix", ")", ":", "temp_location", "=", "_get_temp_file_location", "(", ")", "temp_file_name", "=", "'/'", ".", "join", "(", "[", "temp_location", ",", "str", "(", "prefix", ")", "+", "str", "(", "_uuid", ".", "uuid4", ...
Generate a temporary file that would not live beyond the lifetime of unity_server. Caller is expected to clean up the temp file as soon as the file is no longer needed. But temp files created using this method will be cleaned up when unity_server restarts
[ "Generate", "a", "temporary", "file", "that", "would", "not", "live", "beyond", "the", "lifetime", "of", "unity_server", "." ]
python
train
38.75
django-parler/django-parler
parler/views.py
https://github.com/django-parler/django-parler/blob/11ae4af5e8faddb74c69c848870122df4006a54e/parler/views.py#L243-L253
def get_language_tabs(self): """ Determine the language tabs to show. """ current_language = self.get_current_language() if self.object: available_languages = list(self.object.get_available_languages()) else: available_languages = [] retur...
[ "def", "get_language_tabs", "(", "self", ")", ":", "current_language", "=", "self", ".", "get_current_language", "(", ")", "if", "self", ".", "object", ":", "available_languages", "=", "list", "(", "self", ".", "object", ".", "get_available_languages", "(", ")...
Determine the language tabs to show.
[ "Determine", "the", "language", "tabs", "to", "show", "." ]
python
train
34.727273
zhmcclient/python-zhmcclient
zhmcclient/_user_role.py
https://github.com/zhmcclient/python-zhmcclient/blob/9657563e5d9184c51d3c903442a58b9725fdf335/zhmcclient/_user_role.py#L148-L186
def create(self, properties): """ Create a new (user-defined) User Role in this HMC. Authorization requirements: * Task permission to the "Manage User Roles" task. Parameters: properties (dict): Initial property values. Allowable properties are defined i...
[ "def", "create", "(", "self", ",", "properties", ")", ":", "result", "=", "self", ".", "session", ".", "post", "(", "self", ".", "console", ".", "uri", "+", "'/user-roles'", ",", "body", "=", "properties", ")", "# There should not be overlaps, but just in case...
Create a new (user-defined) User Role in this HMC. Authorization requirements: * Task permission to the "Manage User Roles" task. Parameters: properties (dict): Initial property values. Allowable properties are defined in section 'Request body contents' in s...
[ "Create", "a", "new", "(", "user", "-", "defined", ")", "User", "Role", "in", "this", "HMC", "." ]
python
train
34.589744
tensorflow/tensor2tensor
tensor2tensor/data_generators/wikitext103.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/wikitext103.py#L62-L104
def _maybe_download_corpus(tmp_dir, vocab_type): """Download and unpack the corpus. Args: tmp_dir: directory containing dataset. vocab_type: which vocabulary are we using. Returns: The list of names of files. """ if vocab_type == text_problems.VocabType.CHARACTER: dataset_url = ("https://s3...
[ "def", "_maybe_download_corpus", "(", "tmp_dir", ",", "vocab_type", ")", ":", "if", "vocab_type", "==", "text_problems", ".", "VocabType", ".", "CHARACTER", ":", "dataset_url", "=", "(", "\"https://s3.amazonaws.com/research.metamind.io/wikitext\"", "\"/wikitext-103-raw-v1.z...
Download and unpack the corpus. Args: tmp_dir: directory containing dataset. vocab_type: which vocabulary are we using. Returns: The list of names of files.
[ "Download", "and", "unpack", "the", "corpus", "." ]
python
train
31.093023
ets-labs/python-dependency-injector
examples/providers/dependency.py
https://github.com/ets-labs/python-dependency-injector/blob/d04fe41eb17f667da38b97525e2d16c8f2d272fe/examples/providers/dependency.py#L34-L38
def create(self, name): """Create user with provided name and return his id.""" with contextlib.closing(self.database.cursor()) as cursor: cursor.execute('INSERT INTO users(name) VALUES (?)', (name,)) return cursor.lastrowid
[ "def", "create", "(", "self", ",", "name", ")", ":", "with", "contextlib", ".", "closing", "(", "self", ".", "database", ".", "cursor", "(", ")", ")", "as", "cursor", ":", "cursor", ".", "execute", "(", "'INSERT INTO users(name) VALUES (?)'", ",", "(", "...
Create user with provided name and return his id.
[ "Create", "user", "with", "provided", "name", "and", "return", "his", "id", "." ]
python
train
52
sorgerlab/indra
indra/literature/pubmed_client.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/pubmed_client.py#L106-L127
def get_id_count(search_term): """Get the number of citations in Pubmed for a search query. Parameters ---------- search_term : str A term for which the PubMed search should be performed. Returns ------- int or None The number of citations for the query, or None if the quer...
[ "def", "get_id_count", "(", "search_term", ")", ":", "params", "=", "{", "'term'", ":", "search_term", ",", "'rettype'", ":", "'count'", ",", "'db'", ":", "'pubmed'", "}", "tree", "=", "send_request", "(", "pubmed_search", ",", "params", ")", "if", "tree",...
Get the number of citations in Pubmed for a search query. Parameters ---------- search_term : str A term for which the PubMed search should be performed. Returns ------- int or None The number of citations for the query, or None if the query fails.
[ "Get", "the", "number", "of", "citations", "in", "Pubmed", "for", "a", "search", "query", "." ]
python
train
26.409091
jic-dtool/dtoolcore
dtoolcore/storagebroker.py
https://github.com/jic-dtool/dtoolcore/blob/eeb9a924dc8fcf543340653748a7877be1f98e0f/dtoolcore/storagebroker.py#L245-L250
def put_manifest(self, manifest): """Store the manifest.""" logger.debug("Putting manifest") text = json.dumps(manifest, indent=2, sort_keys=True) key = self.get_manifest_key() self.put_text(key, text)
[ "def", "put_manifest", "(", "self", ",", "manifest", ")", ":", "logger", ".", "debug", "(", "\"Putting manifest\"", ")", "text", "=", "json", ".", "dumps", "(", "manifest", ",", "indent", "=", "2", ",", "sort_keys", "=", "True", ")", "key", "=", "self"...
Store the manifest.
[ "Store", "the", "manifest", "." ]
python
train
39.333333
0compute/xtraceback
xtraceback/xtraceback.py
https://github.com/0compute/xtraceback/blob/5f4ae11cf21e6eea830d79aed66d3cd91bd013cd/xtraceback/xtraceback.py#L115-L120
def color(self): """ Whether or not color should be output """ return self.tty_stream if self.options.color is None \ else self.options.color
[ "def", "color", "(", "self", ")", ":", "return", "self", ".", "tty_stream", "if", "self", ".", "options", ".", "color", "is", "None", "else", "self", ".", "options", ".", "color" ]
Whether or not color should be output
[ "Whether", "or", "not", "color", "should", "be", "output" ]
python
train
30
codenerix/django-codenerix
codenerix/views.py
https://github.com/codenerix/django-codenerix/blob/1f5527b352141caaee902b37b2648791a06bd57d/codenerix/views.py#L3532-L3668
def get_filled_structure(self, subgroup=None): ''' method in charged of filling an structure containing the object fields values taking into account the 'group' attribute from the corresponding form object, which is necesary to fill the details form as it is configured in the 'gr...
[ "def", "get_filled_structure", "(", "self", ",", "subgroup", "=", "None", ")", ":", "# initilize the result structure", "result", "=", "[", "]", "# the object corresponding model content is taken into a dictionary", "object_content", "=", "model_to_dict", "(", "self", ".", ...
method in charged of filling an structure containing the object fields values taking into account the 'group' attribute from the corresponding form object, which is necesary to fill the details form as it is configured in the 'group' attribute
[ "method", "in", "charged", "of", "filling", "an", "structure", "containing", "the", "object", "fields", "values", "taking", "into", "account", "the", "group", "attribute", "from", "the", "corresponding", "form", "object", "which", "is", "necesary", "to", "fill",...
python
train
40.80292
IntegralDefense/vxstreamlib
bin/vxstreamlib.py
https://github.com/IntegralDefense/vxstreamlib/blob/cd82e3975215085cf929c5976f37083b9a3ac869/bin/vxstreamlib.py#L185-L189
def wait(self): """Waits for all submitted jobs to complete.""" logging.info("waiting for {} jobs to complete".format(len(self.submissions))) while not self.shutdown: time.sleep(1)
[ "def", "wait", "(", "self", ")", ":", "logging", ".", "info", "(", "\"waiting for {} jobs to complete\"", ".", "format", "(", "len", "(", "self", ".", "submissions", ")", ")", ")", "while", "not", "self", ".", "shutdown", ":", "time", ".", "sleep", "(", ...
Waits for all submitted jobs to complete.
[ "Waits", "for", "all", "submitted", "jobs", "to", "complete", "." ]
python
train
42.4
xu2243051/easyui-menu
easyui/utils.py
https://github.com/xu2243051/easyui-menu/blob/4da0b50cf2d3ddb0f1ec7a4da65fd3c4339f8dfb/easyui/utils.py#L21-L48
def register_views(app_name, view_filename, urlpatterns=None): """ app_name APP名 view_filename views 所在的文件 urlpatterns url中已经存在的urlpatterns return urlpatterns 只导入View结尾的,是类的视图 """ app_module = __import__(app_name) view_module = getattr(app_module, view_filename) v...
[ "def", "register_views", "(", "app_name", ",", "view_filename", ",", "urlpatterns", "=", "None", ")", ":", "app_module", "=", "__import__", "(", "app_name", ")", "view_module", "=", "getattr", "(", "app_module", ",", "view_filename", ")", "views", "=", "dir", ...
app_name APP名 view_filename views 所在的文件 urlpatterns url中已经存在的urlpatterns return urlpatterns 只导入View结尾的,是类的视图
[ "app_name", "APP名", "view_filename", "views", "所在的文件", "urlpatterns", "url中已经存在的urlpatterns" ]
python
valid
33.25
5j9/wikitextparser
wikitextparser/_parser_function.py
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_parser_function.py#L66-L71
def name(self) -> str: """Return template's name (includes whitespace).""" h = self._atomic_partition(self._first_arg_sep)[0] if len(h) == len(self.string): return h[2:-2] return h[2:]
[ "def", "name", "(", "self", ")", "->", "str", ":", "h", "=", "self", ".", "_atomic_partition", "(", "self", ".", "_first_arg_sep", ")", "[", "0", "]", "if", "len", "(", "h", ")", "==", "len", "(", "self", ".", "string", ")", ":", "return", "h", ...
Return template's name (includes whitespace).
[ "Return", "template", "s", "name", "(", "includes", "whitespace", ")", "." ]
python
test
37.166667
samirelanduk/quickplots
quickplots/charts.py
https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/charts.py#L427-L458
def x_upper_limit(self, limit=None): """Returns or sets (if a value is provided) the value at which the x-axis should end. By default this is the highest x value in the associated series. :param limit: If given, the chart's x_upper_limit will be set to this. :raises ValueError: ...
[ "def", "x_upper_limit", "(", "self", ",", "limit", "=", "None", ")", ":", "if", "limit", "is", "None", ":", "if", "self", ".", "_x_upper_limit", "is", "None", ":", "if", "self", ".", "smallest_x", "(", ")", "==", "self", ".", "largest_x", "(", ")", ...
Returns or sets (if a value is provided) the value at which the x-axis should end. By default this is the highest x value in the associated series. :param limit: If given, the chart's x_upper_limit will be set to this. :raises ValueError: if you try to make the upper limit smaller than ...
[ "Returns", "or", "sets", "(", "if", "a", "value", "is", "provided", ")", "the", "value", "at", "which", "the", "x", "-", "axis", "should", "end", ".", "By", "default", "this", "is", "the", "highest", "x", "value", "in", "the", "associated", "series", ...
python
train
40.5
p3trus/slave
slave/quantum_design/ppms.py
https://github.com/p3trus/slave/blob/bdc74e73bd0f47b74a090c43aa2283c469cde3be/slave/quantum_design/ppms.py#L444-L452
def beep(self, duration, frequency): """Generates a beep. :param duration: The duration in seconds, in the range 0.1 to 5. :param frequency: The frequency in Hz, in the range 500 to 5000. """ cmd = 'BEEP', [Float(min=0.1, max=5.0), Integer(min=500, max=5000)] self._writ...
[ "def", "beep", "(", "self", ",", "duration", ",", "frequency", ")", ":", "cmd", "=", "'BEEP'", ",", "[", "Float", "(", "min", "=", "0.1", ",", "max", "=", "5.0", ")", ",", "Integer", "(", "min", "=", "500", ",", "max", "=", "5000", ")", "]", ...
Generates a beep. :param duration: The duration in seconds, in the range 0.1 to 5. :param frequency: The frequency in Hz, in the range 500 to 5000.
[ "Generates", "a", "beep", "." ]
python
train
37.666667
saltstack/salt
salt/modules/vsphere.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vsphere.py#L9493-L9529
def power_on_vm(name, datacenter=None, service_instance=None): ''' Powers on a virtual machine specified by it's name. name Name of the virtual machine datacenter Datacenter of the virtual machine service_instance Service instance (vim.ServiceInstance) of the vCenter. ...
[ "def", "power_on_vm", "(", "name", ",", "datacenter", "=", "None", ",", "service_instance", "=", "None", ")", ":", "log", ".", "trace", "(", "'Powering on virtual machine %s'", ",", "name", ")", "vm_properties", "=", "[", "'name'", ",", "'summary.runtime.powerSt...
Powers on a virtual machine specified by it's name. name Name of the virtual machine datacenter Datacenter of the virtual machine service_instance Service instance (vim.ServiceInstance) of the vCenter. Default is None. .. code-block:: bash salt '*' vsphere.po...
[ "Powers", "on", "a", "virtual", "machine", "specified", "by", "it", "s", "name", "." ]
python
train
30.027027
i3visio/deepify
deepify/tor.py
https://github.com/i3visio/deepify/blob/2af04e0bea3eaabe96b0565e10f7eeb29b042a2b/deepify/tor.py#L53-L93
def _grabContentFromUrl(self, url): """ Function that abstracts capturing a URL. This method rewrites the one from Wrapper. :param url: The URL to be processed. :return: The response in a Json format. """ # Defining an empty object for the res...
[ "def", "_grabContentFromUrl", "(", "self", ",", "url", ")", ":", "# Defining an empty object for the response", "response", "=", "{", "}", "# This part has to be modified... ", "try", ":", "# Configuring the socket", "socks", ".", "setdefaultproxy", "(", "socks", "...
Function that abstracts capturing a URL. This method rewrites the one from Wrapper. :param url: The URL to be processed. :return: The response in a Json format.
[ "Function", "that", "abstracts", "capturing", "a", "URL", ".", "This", "method", "rewrites", "the", "one", "from", "Wrapper", ".", ":", "param", "url", ":", "The", "URL", "to", "be", "processed", ".", ":", "return", ":", "The", "response", "in", "a", "...
python
train
36.121951
msoulier/tftpy
tftpy/TftpStates.py
https://github.com/msoulier/tftpy/blob/af2f2fe89a3bf45748b78703820efb0986a8207a/tftpy/TftpStates.py#L55-L80
def returnSupportedOptions(self, options): """This method takes a requested options list from a client, and returns the ones that are supported.""" # We support the options blksize and tsize right now. # FIXME - put this somewhere else? accepted_options = {} for option in...
[ "def", "returnSupportedOptions", "(", "self", ",", "options", ")", ":", "# We support the options blksize and tsize right now.", "# FIXME - put this somewhere else?", "accepted_options", "=", "{", "}", "for", "option", "in", "options", ":", "if", "option", "==", "'blksize...
This method takes a requested options list from a client, and returns the ones that are supported.
[ "This", "method", "takes", "a", "requested", "options", "list", "from", "a", "client", "and", "returns", "the", "ones", "that", "are", "supported", "." ]
python
train
49.807692
csparpa/pyowm
pyowm/commons/tile.py
https://github.com/csparpa/pyowm/blob/cdd59eb72f32f7238624ceef9b2e2329a5ebd472/pyowm/commons/tile.py#L71-L87
def geoocoords_to_tile_coords(cls, lon, lat, zoom): """ Calculates the tile numbers corresponding to the specified geocoordinates at the specified zoom level Coordinates shall be provided in degrees and using the Mercator Projection (http://en.wikipedia.org/wiki/Mercator_projection) :pa...
[ "def", "geoocoords_to_tile_coords", "(", "cls", ",", "lon", ",", "lat", ",", "zoom", ")", ":", "n", "=", "2.0", "**", "zoom", "x", "=", "int", "(", "(", "lon", "+", "180.0", ")", "/", "360.0", "*", "n", ")", "y", "=", "int", "(", "(", "1.0", ...
Calculates the tile numbers corresponding to the specified geocoordinates at the specified zoom level Coordinates shall be provided in degrees and using the Mercator Projection (http://en.wikipedia.org/wiki/Mercator_projection) :param lon: longitude :type lon: int or float :param lat: l...
[ "Calculates", "the", "tile", "numbers", "corresponding", "to", "the", "specified", "geocoordinates", "at", "the", "specified", "zoom", "level", "Coordinates", "shall", "be", "provided", "in", "degrees", "and", "using", "the", "Mercator", "Projection", "(", "http",...
python
train
44.294118
RedHatInsights/insights-core
insights/parsers/oracle.py
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/insights/parsers/oracle.py#L18-L41
def _parse_oracle(lines): """ Performs the actual file parsing, returning a dict of the config values in a given Oracle DB config file. Despite their differences, the two filetypes are similar enough to allow idential parsing. """ config = {} for line in get_active_lines(lines): ...
[ "def", "_parse_oracle", "(", "lines", ")", ":", "config", "=", "{", "}", "for", "line", "in", "get_active_lines", "(", "lines", ")", ":", "# Check for NULL in line to begin control char removal", "if", "'\\00'", "in", "line", ":", "line", "=", "cleanup", ".", ...
Performs the actual file parsing, returning a dict of the config values in a given Oracle DB config file. Despite their differences, the two filetypes are similar enough to allow idential parsing.
[ "Performs", "the", "actual", "file", "parsing", "returning", "a", "dict", "of", "the", "config", "values", "in", "a", "given", "Oracle", "DB", "config", "file", "." ]
python
train
33.125
openstack/networking-cisco
networking_cisco/apps/saf/agent/vdp/ovs_vdp.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/vdp/ovs_vdp.py#L205-L236
def _flow_check_handler_internal(self): """Periodic handler to check if installed flows are present. This handler runs periodically to check if installed flows are present. This function cannot detect and delete the stale flows, if present. It requires more complexity to delete stale fl...
[ "def", "_flow_check_handler_internal", "(", "self", ")", ":", "integ_flow", "=", "self", ".", "integ_br_obj", ".", "dump_flows_for", "(", "in_port", "=", "self", ".", "int_peer_port_num", ")", "ext_flow", "=", "self", ".", "ext_br_obj", ".", "dump_flows_for", "(...
Periodic handler to check if installed flows are present. This handler runs periodically to check if installed flows are present. This function cannot detect and delete the stale flows, if present. It requires more complexity to delete stale flows. Generally, stale flows are not present...
[ "Periodic", "handler", "to", "check", "if", "installed", "flows", "are", "present", "." ]
python
train
53.9375
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2029-L2061
def com_google_fonts_check_metadata_italic_style(ttFont, font_metadata): """METADATA.pb font.style "italic" matches font internals?""" from fontbakery.utils import get_name_entry_strings from fontbakery.constants import MacStyle if font_metadata.style != "italic": yield SKIP, "This check only applies to it...
[ "def", "com_google_fonts_check_metadata_italic_style", "(", "ttFont", ",", "font_metadata", ")", ":", "from", "fontbakery", ".", "utils", "import", "get_name_entry_strings", "from", "fontbakery", ".", "constants", "import", "MacStyle", "if", "font_metadata", ".", "style...
METADATA.pb font.style "italic" matches font internals?
[ "METADATA", ".", "pb", "font", ".", "style", "italic", "matches", "font", "internals?" ]
python
train
49.272727
alerta/python-alerta-client
alertaclient/commands/cmd_top.py
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_top.py#L9-L15
def cli(obj): """Display alerts like unix "top" command.""" client = obj['client'] timezone = obj['timezone'] screen = Screen(client, timezone) screen.run()
[ "def", "cli", "(", "obj", ")", ":", "client", "=", "obj", "[", "'client'", "]", "timezone", "=", "obj", "[", "'timezone'", "]", "screen", "=", "Screen", "(", "client", ",", "timezone", ")", "screen", ".", "run", "(", ")" ]
Display alerts like unix "top" command.
[ "Display", "alerts", "like", "unix", "top", "command", "." ]
python
train
24.428571
watchforstock/evohome-client
evohomeclient2/__init__.py
https://github.com/watchforstock/evohome-client/blob/f1cb9273e97946d79c0651f00a218abbf7ada53a/evohomeclient2/__init__.py#L236-L243
def gateway(self): """Return the detail of the gateway.""" url = 'https://tccna.honeywell.com/WebAPI/emea/api/v1/gateway' response = requests.get(url, headers=self._headers()) response.raise_for_status() return response.json()
[ "def", "gateway", "(", "self", ")", ":", "url", "=", "'https://tccna.honeywell.com/WebAPI/emea/api/v1/gateway'", "response", "=", "requests", ".", "get", "(", "url", ",", "headers", "=", "self", ".", "_headers", "(", ")", ")", "response", ".", "raise_for_status"...
Return the detail of the gateway.
[ "Return", "the", "detail", "of", "the", "gateway", "." ]
python
train
32.625
Becksteinlab/GromacsWrapper
gromacs/setup.py
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/setup.py#L761-L822
def em_schedule(**kwargs): """Run multiple energy minimizations one after each other. :Keywords: *integrators* list of integrators (from 'l-bfgs', 'cg', 'steep') [['bfgs', 'steep']] *nsteps* list of maximum number of steps; one for each integrator in in t...
[ "def", "em_schedule", "(", "*", "*", "kwargs", ")", ":", "mdrunner", "=", "kwargs", ".", "pop", "(", "'mdrunner'", ",", "None", ")", "integrators", "=", "kwargs", ".", "pop", "(", "'integrators'", ",", "[", "'l-bfgs'", ",", "'steep'", "]", ")", "kwargs...
Run multiple energy minimizations one after each other. :Keywords: *integrators* list of integrators (from 'l-bfgs', 'cg', 'steep') [['bfgs', 'steep']] *nsteps* list of maximum number of steps; one for each integrator in in the *integrators* list [[100,1000]]...
[ "Run", "multiple", "energy", "minimizations", "one", "after", "each", "other", "." ]
python
valid
41.145161
h2oai/h2o-3
h2o-py/h2o/frame.py
https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L2924-L2930
def toupper(self): """ Translate characters from lower to upper case for a particular column. :returns: new H2OFrame with all strings in the current frame converted to the uppercase. """ return H2OFrame._expr(expr=ExprNode("toupper", self), cache=self._ex._cache)
[ "def", "toupper", "(", "self", ")", ":", "return", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"toupper\"", ",", "self", ")", ",", "cache", "=", "self", ".", "_ex", ".", "_cache", ")" ]
Translate characters from lower to upper case for a particular column. :returns: new H2OFrame with all strings in the current frame converted to the uppercase.
[ "Translate", "characters", "from", "lower", "to", "upper", "case", "for", "a", "particular", "column", "." ]
python
test
42.571429
caffeinehit/django-oauth2-provider
provider/views.py
https://github.com/caffeinehit/django-oauth2-provider/blob/6b5bc0d3ad706d2aaa47fa476f38406cddd01236/provider/views.py#L60-L68
def cache_data(self, request, data, key='params'): """ Cache data in the session store. :param request: :attr:`django.http.HttpRequest` :param data: Arbitrary data to store. :param key: `str` The key under which to store the data. """ request.session['%s:%s' % (c...
[ "def", "cache_data", "(", "self", ",", "request", ",", "data", ",", "key", "=", "'params'", ")", ":", "request", ".", "session", "[", "'%s:%s'", "%", "(", "constants", ".", "SESSION_KEY", ",", "key", ")", "]", "=", "data" ]
Cache data in the session store. :param request: :attr:`django.http.HttpRequest` :param data: Arbitrary data to store. :param key: `str` The key under which to store the data.
[ "Cache", "data", "in", "the", "session", "store", "." ]
python
train
38.444444
bykof/billomapy
billomapy/billomapy.py
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L2187-L2198
def mark_offer_as_lose(self, offer_id): """ Mark offer as lose :param offer_id: the offer id :return Response """ return self._create_put_request( resource=OFFERS, billomat_id=offer_id, command=LOSE, )
[ "def", "mark_offer_as_lose", "(", "self", ",", "offer_id", ")", ":", "return", "self", ".", "_create_put_request", "(", "resource", "=", "OFFERS", ",", "billomat_id", "=", "offer_id", ",", "command", "=", "LOSE", ",", ")" ]
Mark offer as lose :param offer_id: the offer id :return Response
[ "Mark", "offer", "as", "lose" ]
python
train
23.583333
tensorflow/tensor2tensor
tensor2tensor/trax/trax.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/trax.py#L336-L348
def _reshape_by_device_single(x, num_devices): """Reshape x into a shape [num_devices, ...].""" x_shape = list(x.shape) batch_size = x_shape[0] batch_size_per_device = batch_size // num_devices # We require that num_devices divides batch_size evenly. if batch_size_per_device * num_devices != batch_size: ...
[ "def", "_reshape_by_device_single", "(", "x", ",", "num_devices", ")", ":", "x_shape", "=", "list", "(", "x", ".", "shape", ")", "batch_size", "=", "x_shape", "[", "0", "]", "batch_size_per_device", "=", "batch_size", "//", "num_devices", "# We require that num_...
Reshape x into a shape [num_devices, ...].
[ "Reshape", "x", "into", "a", "shape", "[", "num_devices", "...", "]", "." ]
python
train
42.923077
jonathf/chaospy
chaospy/descriptives/expected.py
https://github.com/jonathf/chaospy/blob/25ecfa7bf5608dc10c0b31d142ded0e3755f5d74/chaospy/descriptives/expected.py#L7-L69
def E(poly, dist=None, **kws): """ Expected value operator. 1st order statistics of a probability distribution or polynomial on a given probability space. Args: poly (Poly, Dist): Input to take expected value on. dist (Dist): Defines the space the expected v...
[ "def", "E", "(", "poly", ",", "dist", "=", "None", ",", "*", "*", "kws", ")", ":", "if", "not", "isinstance", "(", "poly", ",", "(", "distributions", ".", "Dist", ",", "polynomials", ".", "Poly", ")", ")", ":", "print", "(", "type", "(", "poly", ...
Expected value operator. 1st order statistics of a probability distribution or polynomial on a given probability space. Args: poly (Poly, Dist): Input to take expected value on. dist (Dist): Defines the space the expected value is taken on. It is ignored if ...
[ "Expected", "value", "operator", "." ]
python
train
27.634921
bwhite/hadoopy
hadoopy/thirdparty/pyinstaller/PyInstaller/lib/pefile.py
https://github.com/bwhite/hadoopy/blob/ff39b4e6d4e6efaf1f571cf0f2c0e0d7ab28c2d6/hadoopy/thirdparty/pyinstaller/PyInstaller/lib/pefile.py#L663-L676
def ask_pascal_16(self, next_rva_ptr): """The next RVA is taken to be the one immediately following this one. Such RVA could indicate the natural end of the string and will be checked with the possible length contained in the first word. """ length = self.__get_...
[ "def", "ask_pascal_16", "(", "self", ",", "next_rva_ptr", ")", ":", "length", "=", "self", ".", "__get_pascal_16_length", "(", ")", "if", "length", "==", "(", "next_rva_ptr", "-", "(", "self", ".", "rva_ptr", "+", "2", ")", ")", "/", "2", ":", "self", ...
The next RVA is taken to be the one immediately following this one. Such RVA could indicate the natural end of the string and will be checked with the possible length contained in the first word.
[ "The", "next", "RVA", "is", "taken", "to", "be", "the", "one", "immediately", "following", "this", "one", ".", "Such", "RVA", "could", "indicate", "the", "natural", "end", "of", "the", "string", "and", "will", "be", "checked", "with", "the", "possible", ...
python
train
34.357143
senaite/senaite.core
bika/lims/exportimport/instruments/sysmex/xt/i1800.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/exportimport/instruments/sysmex/xt/i1800.py#L142-L155
def _handle_result_line(self, sline): """ Parses the data line and adds to the dictionary. :param sline: a split data line to parse :returns: the number of rows to jump and parse the next data line or return the code error -1 """ as_kw = sline[3] a_result ...
[ "def", "_handle_result_line", "(", "self", ",", "sline", ")", ":", "as_kw", "=", "sline", "[", "3", "]", "a_result", "=", "str", "(", "sline", "[", "5", "]", ".", "split", "(", "'^'", ")", "[", "0", "]", ")", "self", ".", "_cur_values", "[", "as_...
Parses the data line and adds to the dictionary. :param sline: a split data line to parse :returns: the number of rows to jump and parse the next data line or return the code error -1
[ "Parses", "the", "data", "line", "and", "adds", "to", "the", "dictionary", ".", ":", "param", "sline", ":", "a", "split", "data", "line", "to", "parse", ":", "returns", ":", "the", "number", "of", "rows", "to", "jump", "and", "parse", "the", "next", ...
python
train
33.5
micha030201/aionationstates
aionationstates/nation_.py
https://github.com/micha030201/aionationstates/blob/dc86b86d994cbab830b69ab8023601c73e778b3a/aionationstates/nation_.py#L502-L519
async def freedomscores(self, root): """Nation's `Freedoms`: three basic indicators of the nation's Civil Rights, Economy, and Political Freedom, as percentages. Returns ------- an :class:`ApiQuery` of :class:`collections.OrderedDict` with \ keys of str and values of int...
[ "async", "def", "freedomscores", "(", "self", ",", "root", ")", ":", "elem", "=", "root", ".", "find", "(", "'FREEDOMSCORES'", ")", "result", "=", "OrderedDict", "(", ")", "result", "[", "'Civil Rights'", "]", "=", "int", "(", "elem", ".", "find", "(",...
Nation's `Freedoms`: three basic indicators of the nation's Civil Rights, Economy, and Political Freedom, as percentages. Returns ------- an :class:`ApiQuery` of :class:`collections.OrderedDict` with \ keys of str and values of int Keys being, in order: ``Civil Right...
[ "Nation", "s", "Freedoms", ":", "three", "basic", "indicators", "of", "the", "nation", "s", "Civil", "Rights", "Economy", "and", "Political", "Freedom", "as", "percentages", "." ]
python
train
40
EnergieID/smappy
smappy/smappy.py
https://github.com/EnergieID/smappy/blob/1ada3abc9a51c76205c072369258f6f4f4e8fd0f/smappy/smappy.py#L276-L311
def get_events(self, service_location_id, appliance_id, start, end, max_number=None): """ Request events for a given appliance Parameters ---------- service_location_id : int appliance_id : int start : int | dt.datetime | pd.Timestamp e...
[ "def", "get_events", "(", "self", ",", "service_location_id", ",", "appliance_id", ",", "start", ",", "end", ",", "max_number", "=", "None", ")", ":", "start", "=", "self", ".", "_to_milliseconds", "(", "start", ")", "end", "=", "self", ".", "_to_milliseco...
Request events for a given appliance Parameters ---------- service_location_id : int appliance_id : int start : int | dt.datetime | pd.Timestamp end : int | dt.datetime | pd.Timestamp start and end support epoch (in milliseconds), datetime and Pan...
[ "Request", "events", "for", "a", "given", "appliance" ]
python
train
34.166667
tanghaibao/jcvi
jcvi/assembly/bambus.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/assembly/bambus.py#L22-L99
def scaffold(args): """ %prog scaffold ctgfasta reads1.fasta mapping1.bed reads2.fasta mapping2.bed ... Run BAMBUS on set of contigs, reads and read mappings. """ from jcvi.formats.base import FileMerger from jcvi.formats.bed import mates from jcvi.formats.conti...
[ "def", "scaffold", "(", "args", ")", ":", "from", "jcvi", ".", "formats", ".", "base", "import", "FileMerger", "from", "jcvi", ".", "formats", ".", "bed", "import", "mates", "from", "jcvi", ".", "formats", ".", "contig", "import", "frombed", "from", "jcv...
%prog scaffold ctgfasta reads1.fasta mapping1.bed reads2.fasta mapping2.bed ... Run BAMBUS on set of contigs, reads and read mappings.
[ "%prog", "scaffold", "ctgfasta", "reads1", ".", "fasta", "mapping1", ".", "bed", "reads2", ".", "fasta", "mapping2", ".", "bed", "..." ]
python
train
33.961538
majerteam/sqla_inspect
sqla_inspect/py3o.py
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/py3o.py#L205-L226
def gen_xml_doc(self): """ Generate the text tags that should be inserted in the content.xml of a full model """ res = self.make_doc() var_tag = """ <text:user-field-decl office:value-type="string" office:string-value="%s" text:name="py3o.%s"/>""" ...
[ "def", "gen_xml_doc", "(", "self", ")", ":", "res", "=", "self", ".", "make_doc", "(", ")", "var_tag", "=", "\"\"\"\n <text:user-field-decl office:value-type=\"string\"\n office:string-value=\"%s\" text:name=\"py3o.%s\"/>\"\"\"", "text_tag", "=", "\"\"\"<text:p text...
Generate the text tags that should be inserted in the content.xml of a full model
[ "Generate", "the", "text", "tags", "that", "should", "be", "inserted", "in", "the", "content", ".", "xml", "of", "a", "full", "model" ]
python
train
32.681818
isambard-uob/ampal
src/ampal/dssp.py
https://github.com/isambard-uob/ampal/blob/906e2afacb435ffb129b381f262ff8e7bfb324c5/src/ampal/dssp.py#L111-L163
def find_ss_regions(dssp_residues, loop_assignments=(' ', 'B', 'S', 'T')): """Separates parsed DSSP data into groups of secondary structure. Notes ----- Example: all residues in a single helix/loop/strand will be gathered into a list, then the next secondary structure element will be gathered i...
[ "def", "find_ss_regions", "(", "dssp_residues", ",", "loop_assignments", "=", "(", "' '", ",", "'B'", ",", "'S'", ",", "'T'", ")", ")", ":", "loops", "=", "loop_assignments", "previous_ele", "=", "None", "fragment", "=", "[", "]", "fragments", "=", "[", ...
Separates parsed DSSP data into groups of secondary structure. Notes ----- Example: all residues in a single helix/loop/strand will be gathered into a list, then the next secondary structure element will be gathered into a separate list, and so on. Parameters ---------- dssp_residues :...
[ "Separates", "parsed", "DSSP", "data", "into", "groups", "of", "secondary", "structure", "." ]
python
train
30.45283
alphatwirl/alphatwirl
alphatwirl/selection/factories/expand.py
https://github.com/alphatwirl/alphatwirl/blob/5138eeba6cd8a334ba52d6c2c022b33c61e3ba38/alphatwirl/selection/factories/expand.py#L4-L20
def expand_path_cfg(path_cfg, alias_dict={ }, overriding_kargs={ }): """expand a path config Args: path_cfg (str, tuple, dict): a config for path alias_dict (dict): a dict for aliases overriding_kargs (dict): to be used for recursive call """ if isinstance(path_cfg, str): ...
[ "def", "expand_path_cfg", "(", "path_cfg", ",", "alias_dict", "=", "{", "}", ",", "overriding_kargs", "=", "{", "}", ")", ":", "if", "isinstance", "(", "path_cfg", ",", "str", ")", ":", "return", "_expand_str", "(", "path_cfg", ",", "alias_dict", ",", "o...
expand a path config Args: path_cfg (str, tuple, dict): a config for path alias_dict (dict): a dict for aliases overriding_kargs (dict): to be used for recursive call
[ "expand", "a", "path", "config" ]
python
valid
32
jxtech/wechatpy
wechatpy/client/api/customservice.py
https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/customservice.py#L92-L110
def upload_headimg(self, account, media_file): """ 上传客服账号头像 详情请参考 http://mp.weixin.qq.com/wiki/1/70a29afed17f56d537c833f89be979c9.html :param account: 完整客服账号 :param media_file: 要上传的头像文件,一个 File-Object :return: 返回的 JSON 数据包 """ return self._post( ...
[ "def", "upload_headimg", "(", "self", ",", "account", ",", "media_file", ")", ":", "return", "self", ".", "_post", "(", "'https://api.weixin.qq.com/customservice/kfaccount/uploadheadimg'", ",", "params", "=", "{", "'kf_account'", ":", "account", "}", ",", "files", ...
上传客服账号头像 详情请参考 http://mp.weixin.qq.com/wiki/1/70a29afed17f56d537c833f89be979c9.html :param account: 完整客服账号 :param media_file: 要上传的头像文件,一个 File-Object :return: 返回的 JSON 数据包
[ "上传客服账号头像", "详情请参考", "http", ":", "//", "mp", ".", "weixin", ".", "qq", ".", "com", "/", "wiki", "/", "1", "/", "70a29afed17f56d537c833f89be979c9", ".", "html" ]
python
train
28.052632
numenta/nupic
src/nupic/algorithms/utils.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/utils.py#L86-L103
def transferCoincidences(network, fromElementName, toElementName): """ Gets the coincidence matrix from one element and sets it on another element (using locked handles, a la nupic.bindings.research.lockHandle). TODO: Generalize to more node types, parameter name pairs, etc. Does not work across processes...
[ "def", "transferCoincidences", "(", "network", ",", "fromElementName", ",", "toElementName", ")", ":", "coincidenceHandle", "=", "getLockedHandle", "(", "runtimeElement", "=", "network", ".", "getElement", "(", "fromElementName", ")", ",", "# TODO: Re-purpose for use wi...
Gets the coincidence matrix from one element and sets it on another element (using locked handles, a la nupic.bindings.research.lockHandle). TODO: Generalize to more node types, parameter name pairs, etc. Does not work across processes.
[ "Gets", "the", "coincidence", "matrix", "from", "one", "element", "and", "sets", "it", "on", "another", "element", "(", "using", "locked", "handles", "a", "la", "nupic", ".", "bindings", ".", "research", ".", "lockHandle", ")", "." ]
python
valid
34.111111
chromy/essence
src/essence/world.py
https://github.com/chromy/essence/blob/6cd18821ec91edf022619d9f0c0878f38c22a763/src/essence/world.py#L56-L72
def add_component(self, entity, component): """Add component to entity. Long-hand for :func:`essence.Entity.add`. :param entity: entity to associate :type entity: :class:`essence.Entity` :param component: component to add to the entity :type component: :class:`essence.C...
[ "def", "add_component", "(", "self", ",", "entity", ",", "component", ")", ":", "component_type", "=", "type", "(", "component", ")", "relation", "=", "self", ".", "_get_relation", "(", "component_type", ")", "if", "entity", "in", "relation", ":", "# PYTHON2...
Add component to entity. Long-hand for :func:`essence.Entity.add`. :param entity: entity to associate :type entity: :class:`essence.Entity` :param component: component to add to the entity :type component: :class:`essence.Component`
[ "Add", "component", "to", "entity", "." ]
python
train
46.647059
hazelcast/hazelcast-python-client
hazelcast/protocol/codec/multi_map_add_entry_listener_codec.py
https://github.com/hazelcast/hazelcast-python-client/blob/3f6639443c23d6d036aa343f8e094f052250d2c1/hazelcast/protocol/codec/multi_map_add_entry_listener_codec.py#L11-L17
def calculate_size(name, include_value, local_only): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += BOOLEAN_SIZE_IN_BYTES data_size += BOOLEAN_SIZE_IN_BYTES return data_size
[ "def", "calculate_size", "(", "name", ",", "include_value", ",", "local_only", ")", ":", "data_size", "=", "0", "data_size", "+=", "calculate_size_str", "(", "name", ")", "data_size", "+=", "BOOLEAN_SIZE_IN_BYTES", "data_size", "+=", "BOOLEAN_SIZE_IN_BYTES", "return...
Calculates the request payload size
[ "Calculates", "the", "request", "payload", "size" ]
python
train
36
ejeschke/ginga
ginga/rv/plugins/PlotTable.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/PlotTable.py#L292-L329
def _get_plot_data(self): """Extract only good data point for plotting.""" _marker_type = self.settings.get('markerstyle', 'o') if self.x_col == self._idxname: x_data = self._idx else: x_data = self.tab[self.x_col].data if self.y_col == self._idxname: ...
[ "def", "_get_plot_data", "(", "self", ")", ":", "_marker_type", "=", "self", ".", "settings", ".", "get", "(", "'markerstyle'", ",", "'o'", ")", "if", "self", ".", "x_col", "==", "self", ".", "_idxname", ":", "x_data", "=", "self", ".", "_idx", "else",...
Extract only good data point for plotting.
[ "Extract", "only", "good", "data", "point", "for", "plotting", "." ]
python
train
30.552632
spyder-ide/spyder
spyder/plugins/editor/widgets/editor.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/editor.py#L1734-L1750
def file_saved_in_other_editorstack(self, original_filename, filename): """ File was just saved in another editorstack, let's synchronize! This avoids file being automatically reloaded. The original filename is passed instead of an index in case the tabs on the editor stac...
[ "def", "file_saved_in_other_editorstack", "(", "self", ",", "original_filename", ",", "filename", ")", ":", "index", "=", "self", ".", "has_filename", "(", "original_filename", ")", "if", "index", "is", "None", ":", "return", "finfo", "=", "self", ".", "data",...
File was just saved in another editorstack, let's synchronize! This avoids file being automatically reloaded. The original filename is passed instead of an index in case the tabs on the editor stacks were moved and are now in a different order - see issue 5703. Filename is...
[ "File", "was", "just", "saved", "in", "another", "editorstack", "let", "s", "synchronize!", "This", "avoids", "file", "being", "automatically", "reloaded", ".", "The", "original", "filename", "is", "passed", "instead", "of", "an", "index", "in", "case", "the",...
python
train
44.529412
OSSOS/MOP
src/ossos/core/ossos/wcs.py
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/wcs.py#L389-L425
def parse_pv(header): """ Parses the PV array from an astropy FITS header. Args: header: astropy.io.fits.header.Header The header containing the PV values. Returns: cd: 2d array (list(list(float)) [[PV1_0, PV1_1, ... PV1_N], [PV2_0, PV2_1, ... PV2_N]] Note that N de...
[ "def", "parse_pv", "(", "header", ")", ":", "order_fit", "=", "parse_order_fit", "(", "header", ")", "def", "parse_with_base", "(", "i", ")", ":", "key_base", "=", "\"PV%d_\"", "%", "i", "pvi_x", "=", "[", "header", "[", "key_base", "+", "\"0\"", "]", ...
Parses the PV array from an astropy FITS header. Args: header: astropy.io.fits.header.Header The header containing the PV values. Returns: cd: 2d array (list(list(float)) [[PV1_0, PV1_1, ... PV1_N], [PV2_0, PV2_1, ... PV2_N]] Note that N depends on the order of the fit. Fo...
[ "Parses", "the", "PV", "array", "from", "an", "astropy", "FITS", "header", "." ]
python
train
24.648649
wummel/dosage
scripts/comicgenesis.py
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/scripts/comicgenesis.py#L371-L407
def handle_url(url, session, res): """Parse one search result page.""" print("Parsing", url, file=sys.stderr) try: data = getPageContent(url, session) except IOError as msg: print("ERROR:", msg, file=sys.stderr) return for match in url_matcher.finditer(data): url = ma...
[ "def", "handle_url", "(", "url", ",", "session", ",", "res", ")", ":", "print", "(", "\"Parsing\"", ",", "url", ",", "file", "=", "sys", ".", "stderr", ")", "try", ":", "data", "=", "getPageContent", "(", "url", ",", "session", ")", "except", "IOErro...
Parse one search result page.
[ "Parse", "one", "search", "result", "page", "." ]
python
train
36.486486
angr/angr
angr/state_plugins/posix.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/posix.py#L553-L569
def dumps(self, fd, **kwargs): """ Returns the concrete content for a file descriptor. BACKWARD COMPATIBILITY: if you ask for file descriptors 0 1 or 2, it will return the data from stdin, stdout, or stderr as a flat string. :param fd: A file descriptor. :return: Th...
[ "def", "dumps", "(", "self", ",", "fd", ",", "*", "*", "kwargs", ")", ":", "if", "0", "<=", "fd", "<=", "2", ":", "data", "=", "[", "self", ".", "stdin", ",", "self", ".", "stdout", ",", "self", ".", "stderr", "]", "[", "fd", "]", ".", "con...
Returns the concrete content for a file descriptor. BACKWARD COMPATIBILITY: if you ask for file descriptors 0 1 or 2, it will return the data from stdin, stdout, or stderr as a flat string. :param fd: A file descriptor. :return: The concrete content. :rtype: str
[ "Returns", "the", "concrete", "content", "for", "a", "file", "descriptor", "." ]
python
train
36.235294
hydpy-dev/hydpy
hydpy/models/hland/hland_model.py
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/hland/hland_model.py#L2184-L2231
def calc_qt_v1(self): """Calculate the total discharge after possible abstractions. Required control parameter: |Abstr| Required flux sequence: |OutUH| Calculated flux sequence: |QT| Basic equation: :math:`QT = max(OutUH - Abstr, 0)` Examples: Trying to ab...
[ "def", "calc_qt_v1", "(", "self", ")", ":", "con", "=", "self", ".", "parameters", ".", "control", ".", "fastaccess", "flu", "=", "self", ".", "sequences", ".", "fluxes", ".", "fastaccess", "flu", ".", "qt", "=", "max", "(", "flu", ".", "outuh", "-",...
Calculate the total discharge after possible abstractions. Required control parameter: |Abstr| Required flux sequence: |OutUH| Calculated flux sequence: |QT| Basic equation: :math:`QT = max(OutUH - Abstr, 0)` Examples: Trying to abstract less then available, a...
[ "Calculate", "the", "total", "discharge", "after", "possible", "abstractions", "." ]
python
train
23.3125
BernardFW/bernard
src/bernard/layers/stack.py
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/layers/stack.py#L77-L89
def _make_index(self): """ Perform the index computation. It groups layers by type into a dictionary, to allow quick access. """ out = {} for layer in self._layers: cls = layer.__class__ out[cls] = out.get(cls, []) + [layer] return out
[ "def", "_make_index", "(", "self", ")", ":", "out", "=", "{", "}", "for", "layer", "in", "self", ".", "_layers", ":", "cls", "=", "layer", ".", "__class__", "out", "[", "cls", "]", "=", "out", ".", "get", "(", "cls", ",", "[", "]", ")", "+", ...
Perform the index computation. It groups layers by type into a dictionary, to allow quick access.
[ "Perform", "the", "index", "computation", ".", "It", "groups", "layers", "by", "type", "into", "a", "dictionary", "to", "allow", "quick", "access", "." ]
python
train
23.538462
Carreau/telemetry
telemetry/__init__.py
https://github.com/Carreau/telemetry/blob/6d456e982e3d7fd4eb6a8f43cd94925bb69ab855/telemetry/__init__.py#L47-L55
def collect_basic_info(): """ collect basic info about the system, os, python version... """ s = sys.version_info _collect(json.dumps({'sys.version_info':tuple(s)})) _collect(sys.version) return sys.version
[ "def", "collect_basic_info", "(", ")", ":", "s", "=", "sys", ".", "version_info", "_collect", "(", "json", ".", "dumps", "(", "{", "'sys.version_info'", ":", "tuple", "(", "s", ")", "}", ")", ")", "_collect", "(", "sys", ".", "version", ")", "return", ...
collect basic info about the system, os, python version...
[ "collect", "basic", "info", "about", "the", "system", "os", "python", "version", "..." ]
python
train
25.222222
wglass/zoonado
zoonado/connection.py
https://github.com/wglass/zoonado/blob/8f143b3dd26be88131356f731e7ca51809bc69cb/zoonado/connection.py#L196-L215
def abort(self, exception=exc.ConnectError): """ Aborts a connection and puts all pending futures into an error state. If ``sys.exc_info()`` is set (i.e. this is being called in an exception handler) then pending futures will have that exc info set. Otherwise the given ``except...
[ "def", "abort", "(", "self", ",", "exception", "=", "exc", ".", "ConnectError", ")", ":", "log", ".", "warn", "(", "\"Aborting connection to %s:%s\"", ",", "self", ".", "host", ",", "self", ".", "port", ")", "def", "abort_pending", "(", "f", ")", ":", ...
Aborts a connection and puts all pending futures into an error state. If ``sys.exc_info()`` is set (i.e. this is being called in an exception handler) then pending futures will have that exc info set. Otherwise the given ``exception`` parameter is used (defaults to ``ConnectError``).
[ "Aborts", "a", "connection", "and", "puts", "all", "pending", "futures", "into", "an", "error", "state", "." ]
python
train
37.75
hammerlab/cohorts
cohorts/cohort.py
https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L538-L570
def _hash_filter_fn(self, filter_fn, **kwargs): """ Construct string representing state of filter_fn Used to cache filtered variants or effects uniquely depending on filter fn values """ filter_fn_name = self._get_function_name(filter_fn, default="filter-none") logger.debug("...
[ "def", "_hash_filter_fn", "(", "self", ",", "filter_fn", ",", "*", "*", "kwargs", ")", ":", "filter_fn_name", "=", "self", ".", "_get_function_name", "(", "filter_fn", ",", "default", "=", "\"filter-none\"", ")", "logger", ".", "debug", "(", "\"Computing hash ...
Construct string representing state of filter_fn Used to cache filtered variants or effects uniquely depending on filter fn values
[ "Construct", "string", "representing", "state", "of", "filter_fn", "Used", "to", "cache", "filtered", "variants", "or", "effects", "uniquely", "depending", "on", "filter", "fn", "values" ]
python
train
52.69697
mweb/appconfig
appconfig/appconfig.py
https://github.com/mweb/appconfig/blob/780c1fe3b2f537463a46e335186b7741add88a1e/appconfig/appconfig.py#L370-L407
def _format_message(value, line_length, indent="", first_indent=None): ''' Return a string with newlines so that the given string fits into this line length. At the start of the line the indent is added. This can be used for commenting the message out within a file or to indent your text. ...
[ "def", "_format_message", "(", "value", ",", "line_length", ",", "indent", "=", "\"\"", ",", "first_indent", "=", "None", ")", ":", "if", "indent", ".", "find", "(", "'\\t'", ")", ":", "indent", "=", "indent", ".", "replace", "(", "'\\t'", ",", "' '...
Return a string with newlines so that the given string fits into this line length. At the start of the line the indent is added. This can be used for commenting the message out within a file or to indent your text. All \\t will be replaced with 4 spaces. @param value: The strin...
[ "Return", "a", "string", "with", "newlines", "so", "that", "the", "given", "string", "fits", "into", "this", "line", "length", ".", "At", "the", "start", "of", "the", "line", "the", "indent", "is", "added", ".", "This", "can", "be", "used", "for", "com...
python
train
36.605263
HolmesNL/confidence
confidence/models.py
https://github.com/HolmesNL/confidence/blob/e14d2d8769a01fa55676716f7a2f22714c2616d3/confidence/models.py#L113-L161
def get(self, path, default=_NoDefault, as_type=None, resolve_references=True): """ Gets a value for the specified path. :param path: the configuration key to fetch a value for, steps separated by the separator supplied to the constructor (default ``.``) :param d...
[ "def", "get", "(", "self", ",", "path", ",", "default", "=", "_NoDefault", ",", "as_type", "=", "None", ",", "resolve_references", "=", "True", ")", ":", "value", "=", "self", ".", "_source", "steps_taken", "=", "[", "]", "try", ":", "# walk through the ...
Gets a value for the specified path. :param path: the configuration key to fetch a value for, steps separated by the separator supplied to the constructor (default ``.``) :param default: a value to return if no value is found for the supplied path (``None`` is allowe...
[ "Gets", "a", "value", "for", "the", "specified", "path", "." ]
python
train
49.673469
jldantas/libmft
libmft/attribute.py
https://github.com/jldantas/libmft/blob/65a988605fe7663b788bd81dcb52c0a4eaad1549/libmft/attribute.py#L1909-L1920
def _from_binary_ace_header(cls, binary_stream): """See base class.""" ''' ACE Type - 1 ACE Control flags - 1 Size - 2 (includes header size) ''' type, control_flags, size = cls._REPR.unpack(binary_stream) nw_obj = cls((ACEType(type), ACEControlFlags(control_flags), size)) _MOD_...
[ "def", "_from_binary_ace_header", "(", "cls", ",", "binary_stream", ")", ":", "''' ACE Type - 1\n ACE Control flags - 1\n Size - 2 (includes header size)\n '''", "type", ",", "control_flags", ",", "size", "=", "cls", ".", "_REPR", ".", "unpack", "(", "binar...
See base class.
[ "See", "base", "class", "." ]
python
train
35.916667
mozillazg/python-pinyin
pypinyin/core.py
https://github.com/mozillazg/python-pinyin/blob/b44756c852e0d2f50f251e3098cbbfef51774979/pypinyin/core.py#L155-L179
def phrase_pinyin(phrase, style, heteronym, errors='default', strict=True): """词语拼音转换. :param phrase: 词语 :param errors: 指定如何处理没有拼音的字符 :param strict: 是否严格遵照《汉语拼音方案》来处理声母和韵母 :return: 拼音列表 :rtype: list """ py = [] if phrase in PHRASES_DICT: py = deepcopy(PHRASES_DICT[phrase]) ...
[ "def", "phrase_pinyin", "(", "phrase", ",", "style", ",", "heteronym", ",", "errors", "=", "'default'", ",", "strict", "=", "True", ")", ":", "py", "=", "[", "]", "if", "phrase", "in", "PHRASES_DICT", ":", "py", "=", "deepcopy", "(", "PHRASES_DICT", "[...
词语拼音转换. :param phrase: 词语 :param errors: 指定如何处理没有拼音的字符 :param strict: 是否严格遵照《汉语拼音方案》来处理声母和韵母 :return: 拼音列表 :rtype: list
[ "词语拼音转换", "." ]
python
train
32.76
pandas-dev/pandas
pandas/core/dtypes/cast.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/cast.py#L486-L516
def maybe_infer_dtype_type(element): """Try to infer an object's dtype, for use in arithmetic ops Uses `element.dtype` if that's available. Objects implementing the iterator protocol are cast to a NumPy array, and from there the array's type is used. Parameters ---------- element : object ...
[ "def", "maybe_infer_dtype_type", "(", "element", ")", ":", "tipo", "=", "None", "if", "hasattr", "(", "element", ",", "'dtype'", ")", ":", "tipo", "=", "element", ".", "dtype", "elif", "is_list_like", "(", "element", ")", ":", "element", "=", "np", ".", ...
Try to infer an object's dtype, for use in arithmetic ops Uses `element.dtype` if that's available. Objects implementing the iterator protocol are cast to a NumPy array, and from there the array's type is used. Parameters ---------- element : object Possibly has a `.dtype` attribute, a...
[ "Try", "to", "infer", "an", "object", "s", "dtype", "for", "use", "in", "arithmetic", "ops" ]
python
train
25.741935
razor-x/scipy-data_fitting
scipy_data_fitting/figure/plot.py
https://github.com/razor-x/scipy-data_fitting/blob/c756a645da8629699b3f22244bfb7d5d4d88b179/scipy_data_fitting/figure/plot.py#L103-L110
def add_ylabel(self, text=None): """ Add a label to the y-axis. """ y = self.fit.meta['dependent'] if not text: text = '$' + y['tex_symbol'] + r'$ $(\si{' + y['siunitx'] + r'})$' self.plt.set_ylabel(text)
[ "def", "add_ylabel", "(", "self", ",", "text", "=", "None", ")", ":", "y", "=", "self", ".", "fit", ".", "meta", "[", "'dependent'", "]", "if", "not", "text", ":", "text", "=", "'$'", "+", "y", "[", "'tex_symbol'", "]", "+", "r'$ $(\\si{'", "+", ...
Add a label to the y-axis.
[ "Add", "a", "label", "to", "the", "y", "-", "axis", "." ]
python
train
32.25
wtolson/gnsq
gnsq/nsqd.py
https://github.com/wtolson/gnsq/blob/0fd02578b2c9c5fa30626d78579db2a46c10edac/gnsq/nsqd.py#L682-L687
def publish_tcp(self, topic, data, **kwargs): """Use :meth:`NsqdTCPClient.publish` instead. .. deprecated:: 1.0.0 """ return self.__tcp_client.publish(topic, data, **kwargs)
[ "def", "publish_tcp", "(", "self", ",", "topic", ",", "data", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "__tcp_client", ".", "publish", "(", "topic", ",", "data", ",", "*", "*", "kwargs", ")" ]
Use :meth:`NsqdTCPClient.publish` instead. .. deprecated:: 1.0.0
[ "Use", ":", "meth", ":", "NsqdTCPClient", ".", "publish", "instead", "." ]
python
train
33.5
zagaran/mongolia
mongolia/mongo_connection.py
https://github.com/zagaran/mongolia/blob/82c499345f0a8610c7289545e19f5f633e8a81c0/mongolia/mongo_connection.py#L64-L71
def connect(self, host=None, port=None, connect=False, **kwargs): """ Explicitly creates the MongoClient; this method must be used in order to specify a non-default host or port to the MongoClient. Takes arguments identical to MongoClient.__init__""" try: self.__conne...
[ "def", "connect", "(", "self", ",", "host", "=", "None", ",", "port", "=", "None", ",", "connect", "=", "False", ",", "*", "*", "kwargs", ")", ":", "try", ":", "self", ".", "__connection", "=", "MongoClient", "(", "host", "=", "host", ",", "port", ...
Explicitly creates the MongoClient; this method must be used in order to specify a non-default host or port to the MongoClient. Takes arguments identical to MongoClient.__init__
[ "Explicitly", "creates", "the", "MongoClient", ";", "this", "method", "must", "be", "used", "in", "order", "to", "specify", "a", "non", "-", "default", "host", "or", "port", "to", "the", "MongoClient", ".", "Takes", "arguments", "identical", "to", "MongoClie...
python
train
66.5
hydraplatform/hydra-base
hydra_base/lib/template.py
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/lib/template.py#L71-L102
def get_types_by_attr(resource, template_id=None): """ Using the attributes of the resource, get all the types that this resource matches. @returns a dictionary, keyed on the template name, with the value being the list of type names which match the resources attributes. ...
[ "def", "get_types_by_attr", "(", "resource", ",", "template_id", "=", "None", ")", ":", "resource_type_templates", "=", "[", "]", "#Create a list of all of this resources attributes.", "attr_ids", "=", "[", "]", "for", "res_attr", "in", "resource", ".", "attributes", ...
Using the attributes of the resource, get all the types that this resource matches. @returns a dictionary, keyed on the template name, with the value being the list of type names which match the resources attributes.
[ "Using", "the", "attributes", "of", "the", "resource", "get", "all", "the", "types", "that", "this", "resource", "matches", "." ]
python
train
36.4375
joke2k/faker
faker/providers/address/__init__.py
https://github.com/joke2k/faker/blob/965824b61132e52d92d1a6ce470396dbbe01c96c/faker/providers/address/__init__.py#L52-L57
def street_name(self): """ :example 'Crist Parks' """ pattern = self.random_element(self.street_name_formats) return self.generator.parse(pattern)
[ "def", "street_name", "(", "self", ")", ":", "pattern", "=", "self", ".", "random_element", "(", "self", ".", "street_name_formats", ")", "return", "self", ".", "generator", ".", "parse", "(", "pattern", ")" ]
:example 'Crist Parks'
[ ":", "example", "Crist", "Parks" ]
python
train
30.166667
hsolbrig/PyShEx
pyshex/shape_expressions_language/p5_2_validation_definition.py
https://github.com/hsolbrig/PyShEx/blob/9d659cc36e808afd66d4a6d60e8ea21cb12eb744/pyshex/shape_expressions_language/p5_2_validation_definition.py#L14-L53
def isValid(cntxt: Context, m: FixedShapeMap) -> Tuple[bool, List[str]]: """`5.2 Validation Definition <http://shex.io/shex-semantics/#validation>`_ The expression isValid(G, m) indicates that for every nodeSelector/shapeLabel pair (n, s) in m, s has a corresponding shape expression se and satisfies(n,...
[ "def", "isValid", "(", "cntxt", ":", "Context", ",", "m", ":", "FixedShapeMap", ")", "->", "Tuple", "[", "bool", ",", "List", "[", "str", "]", "]", ":", "if", "not", "cntxt", ".", "is_valid", ":", "return", "False", ",", "cntxt", ".", "error_list", ...
`5.2 Validation Definition <http://shex.io/shex-semantics/#validation>`_ The expression isValid(G, m) indicates that for every nodeSelector/shapeLabel pair (n, s) in m, s has a corresponding shape expression se and satisfies(n, se, G, m). satisfies is defined below for each form of shape expression...
[ "5", ".", "2", "Validation", "Definition", "<http", ":", "//", "shex", ".", "io", "/", "shex", "-", "semantics", "/", "#validation", ">", "_" ]
python
train
54.875
galactics/beyond
beyond/utils/ccsds.py
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/utils/ccsds.py#L105-L167
def _read_oem(string): """ Args: string (str): String containing the OEM Return: Ephem: """ ephems = [] required = ('REF_FRAME', 'CENTER_NAME', 'TIME_SYSTEM', 'OBJECT_ID', 'OBJECT_NAME') mode = None for line in string.splitlines(): if not line or line.startswit...
[ "def", "_read_oem", "(", "string", ")", ":", "ephems", "=", "[", "]", "required", "=", "(", "'REF_FRAME'", ",", "'CENTER_NAME'", ",", "'TIME_SYSTEM'", ",", "'OBJECT_ID'", ",", "'OBJECT_NAME'", ")", "mode", "=", "None", "for", "line", "in", "string", ".", ...
Args: string (str): String containing the OEM Return: Ephem:
[ "Args", ":", "string", "(", "str", ")", ":", "String", "containing", "the", "OEM", "Return", ":", "Ephem", ":" ]
python
train
34.492063
NASA-AMMOS/AIT-Core
ait/core/bsc.py
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/bsc.py#L229-L238
def socket_monitor_loop(self): ''' Monitor the socket and log captured data. ''' try: while True: gevent.socket.wait_read(self.socket.fileno()) self._handle_log_rotations() self.capture_packet() finally: self.clean_up()
[ "def", "socket_monitor_loop", "(", "self", ")", ":", "try", ":", "while", "True", ":", "gevent", ".", "socket", ".", "wait_read", "(", "self", ".", "socket", ".", "fileno", "(", ")", ")", "self", ".", "_handle_log_rotations", "(", ")", "self", ".", "ca...
Monitor the socket and log captured data.
[ "Monitor", "the", "socket", "and", "log", "captured", "data", "." ]
python
train
30.7
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L705-L710
def setValidityErrorHandler(self, err_func, warn_func, arg=None): """ Register error and warning handlers for RelaxNG validation. These will be called back as f(msg,arg) """ libxml2mod.xmlRelaxNGSetValidErrors(self._o, err_func, warn_func, arg)
[ "def", "setValidityErrorHandler", "(", "self", ",", "err_func", ",", "warn_func", ",", "arg", "=", "None", ")", ":", "libxml2mod", ".", "xmlRelaxNGSetValidErrors", "(", "self", ".", "_o", ",", "err_func", ",", "warn_func", ",", "arg", ")" ]
Register error and warning handlers for RelaxNG validation. These will be called back as f(msg,arg)
[ "Register", "error", "and", "warning", "handlers", "for", "RelaxNG", "validation", ".", "These", "will", "be", "called", "back", "as", "f", "(", "msg", "arg", ")" ]
python
train
46.5
echinopsii/net.echinopsii.ariane.community.cli.python3
ariane_clip3/natsd/driver.py
https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/natsd/driver.py#L243-L308
def on_response(self, msg): """ setup response if correlation id is the good one """ LOGGER.debug("natsd.Requester.on_response: " + str(sys.getsizeof(msg)) + " bytes received") working_response = json.loads(msg.data.decode()) working_properties = DriverTools.json2properti...
[ "def", "on_response", "(", "self", ",", "msg", ")", ":", "LOGGER", ".", "debug", "(", "\"natsd.Requester.on_response: \"", "+", "str", "(", "sys", ".", "getsizeof", "(", "msg", ")", ")", "+", "\" bytes received\"", ")", "working_response", "=", "json", ".", ...
setup response if correlation id is the good one
[ "setup", "response", "if", "correlation", "id", "is", "the", "good", "one" ]
python
train
60.363636
codeforamerica/three
three/core.py
https://github.com/codeforamerica/three/blob/67b4a4b233a57aa7995d01f6b0f69c2e85aea6c0/three/core.py#L142-L146
def _format_dates(self, start, end): """Format start and end dates.""" start = self._split_date(start) end = self._split_date(end) return start, end
[ "def", "_format_dates", "(", "self", ",", "start", ",", "end", ")", ":", "start", "=", "self", ".", "_split_date", "(", "start", ")", "end", "=", "self", ".", "_split_date", "(", "end", ")", "return", "start", ",", "end" ]
Format start and end dates.
[ "Format", "start", "and", "end", "dates", "." ]
python
train
35.2
KeplerGO/K2fov
K2fov/greatcircle.py
https://github.com/KeplerGO/K2fov/blob/fb122b35687340e0357cba9e0dd47b3be0760693/K2fov/greatcircle.py#L10-L42
def sphericalAngSep(ra0, dec0, ra1, dec1, radians=False): """ Compute the spherical angular separation between two points on the sky. //Taken from http://www.movable-type.co.uk/scripts/gis-faq-5.1.html NB: For small distances you can probably use sqrt( dDec**2 + cos^2(dec)*...
[ "def", "sphericalAngSep", "(", "ra0", ",", "dec0", ",", "ra1", ",", "dec1", ",", "radians", "=", "False", ")", ":", "if", "radians", "==", "False", ":", "ra0", "=", "np", ".", "radians", "(", "ra0", ")", "dec0", "=", "np", ".", "radians", "(", "d...
Compute the spherical angular separation between two points on the sky. //Taken from http://www.movable-type.co.uk/scripts/gis-faq-5.1.html NB: For small distances you can probably use sqrt( dDec**2 + cos^2(dec)*dRa) where dDec = dec1 - dec0 and dRa = ra1 - ra0 ...
[ "Compute", "the", "spherical", "angular", "separation", "between", "two", "points", "on", "the", "sky", "." ]
python
train
27.515152
mitsei/dlkit
dlkit/json_/assessment_authoring/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/sessions.py#L1079-L1114
def delete_assessment_part(self, assessment_part_id): """Removes an asessment part and all mapped items. arg: assessment_part_id (osid.id.Id): the ``Id`` of the ``AssessmentPart`` raise: NotFound - ``assessment_part_id`` not found raise: NullArgument - ``assessment_...
[ "def", "delete_assessment_part", "(", "self", ",", "assessment_part_id", ")", ":", "# Should be implemented from template for", "# osid.learning.ObjectiveAdminSession.delete_objective_template", "# but need to handle magic part delete ...", "if", "not", "isinstance", "(", "assessment_p...
Removes an asessment part and all mapped items. arg: assessment_part_id (osid.id.Id): the ``Id`` of the ``AssessmentPart`` raise: NotFound - ``assessment_part_id`` not found raise: NullArgument - ``assessment_part_id`` is ``null`` raise: OperationFailed - unable to...
[ "Removes", "an", "asessment", "part", "and", "all", "mapped", "items", "." ]
python
train
52.583333
ska-sa/katcp-python
katcp/resource.py
https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/resource.py#L824-L828
def set_value(self, value, status=Sensor.NOMINAL, timestamp=None): """Set sensor value with optinal specification of status and timestamp""" if timestamp is None: timestamp = self._manager.time() self.set(timestamp, status, value)
[ "def", "set_value", "(", "self", ",", "value", ",", "status", "=", "Sensor", ".", "NOMINAL", ",", "timestamp", "=", "None", ")", ":", "if", "timestamp", "is", "None", ":", "timestamp", "=", "self", ".", "_manager", ".", "time", "(", ")", "self", ".",...
Set sensor value with optinal specification of status and timestamp
[ "Set", "sensor", "value", "with", "optinal", "specification", "of", "status", "and", "timestamp" ]
python
train
52.4
ianmiell/shutit
shutit_setup.py
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_setup.py#L170-L184
def build(self, shutit): """Initializes target ready for build and updating package management if in container. """ if shutit.build['delivery'] in ('docker','dockerfile'): if shutit.get_current_shutit_pexpect_session_environment().install_type == 'apt': shutit.add_to_bashrc('export DEBIAN_FRONTEND=noninter...
[ "def", "build", "(", "self", ",", "shutit", ")", ":", "if", "shutit", ".", "build", "[", "'delivery'", "]", "in", "(", "'docker'", ",", "'dockerfile'", ")", ":", "if", "shutit", ".", "get_current_shutit_pexpect_session_environment", "(", ")", ".", "install_t...
Initializes target ready for build and updating package management if in container.
[ "Initializes", "target", "ready", "for", "build", "and", "updating", "package", "management", "if", "in", "container", "." ]
python
train
54.666667
DLR-RM/RAFCON
source/rafcon/gui/controllers/state_editor/outcomes.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/outcomes.py#L225-L232
def remove_core_element(self, model): """Remove respective core element of handed outcome model :param OutcomeModel model: Outcome model which core element should be removed :return: """ assert model.outcome.parent is self.model.state gui_helper_state_machine.delete_core...
[ "def", "remove_core_element", "(", "self", ",", "model", ")", ":", "assert", "model", ".", "outcome", ".", "parent", "is", "self", ".", "model", ".", "state", "gui_helper_state_machine", ".", "delete_core_element_of_model", "(", "model", ")" ]
Remove respective core element of handed outcome model :param OutcomeModel model: Outcome model which core element should be removed :return:
[ "Remove", "respective", "core", "element", "of", "handed", "outcome", "model" ]
python
train
42.125
bitlabstudio/django-dashboard-app
dashboard_app/widget_pool.py
https://github.com/bitlabstudio/django-dashboard-app/blob/ed98f2bca91a4ced36d0dd1aa1baee78e989cf64/dashboard_app/widget_pool.py#L69-L91
def register_widget(self, widget_cls, **widget_kwargs): """ Registers the given widget. Widgets must inherit ``DashboardWidgetBase`` and you cannot register the same widget twice. :widget_cls: A class that inherits ``DashboardWidgetBase``. """ if not issubclass...
[ "def", "register_widget", "(", "self", ",", "widget_cls", ",", "*", "*", "widget_kwargs", ")", ":", "if", "not", "issubclass", "(", "widget_cls", ",", "DashboardWidgetBase", ")", ":", "raise", "ImproperlyConfigured", "(", "'DashboardWidgets must be subclasses of Dashb...
Registers the given widget. Widgets must inherit ``DashboardWidgetBase`` and you cannot register the same widget twice. :widget_cls: A class that inherits ``DashboardWidgetBase``.
[ "Registers", "the", "given", "widget", "." ]
python
test
37.217391
draperjames/qtpandas
qtpandas/utils.py
https://github.com/draperjames/qtpandas/blob/64294fb69f1839e53dee5ea453337266bfaf24f4/qtpandas/utils.py#L208-L218
def dedupe_cols(frame): """ Need to dedupe columns that have the same name. """ cols = list(frame.columns) for i, item in enumerate(frame.columns): if item in frame.columns[:i]: cols[i] = "toDROP" frame.columns = cols return frame.drop("toDROP", 1, errors='ignore')
[ "def", "dedupe_cols", "(", "frame", ")", ":", "cols", "=", "list", "(", "frame", ".", "columns", ")", "for", "i", ",", "item", "in", "enumerate", "(", "frame", ".", "columns", ")", ":", "if", "item", "in", "frame", ".", "columns", "[", ":", "i", ...
Need to dedupe columns that have the same name.
[ "Need", "to", "dedupe", "columns", "that", "have", "the", "same", "name", "." ]
python
train
27.636364
manahl/arctic
arctic/chunkstore/chunkstore.py
https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/chunkstore.py#L119-L168
def delete(self, symbol, chunk_range=None, audit=None): """ Delete all chunks for a symbol, or optionally, chunks within a range Parameters ---------- symbol : str symbol name for the item chunk_range: range object a date range to delete a...
[ "def", "delete", "(", "self", ",", "symbol", ",", "chunk_range", "=", "None", ",", "audit", "=", "None", ")", ":", "if", "chunk_range", "is", "not", "None", ":", "sym", "=", "self", ".", "_get_symbol_info", "(", "symbol", ")", "# read out chunks that fall ...
Delete all chunks for a symbol, or optionally, chunks within a range Parameters ---------- symbol : str symbol name for the item chunk_range: range object a date range to delete audit: dict dict to store in the audit log
[ "Delete", "all", "chunks", "for", "a", "symbol", "or", "optionally", "chunks", "within", "a", "range" ]
python
train
37.62
CxAalto/gtfspy
gtfspy/routing/profile_block_analyzer.py
https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/routing/profile_block_analyzer.py#L185-L213
def _temporal_distance_pdf(self): """ Temporal distance probability density function. Returns ------- non_delta_peak_split_points: numpy.array non_delta_peak_densities: numpy.array len(density) == len(temporal_distance_split_points_ordered) -1 delta_p...
[ "def", "_temporal_distance_pdf", "(", "self", ")", ":", "temporal_distance_split_points_ordered", ",", "norm_cdf", "=", "self", ".", "_temporal_distance_cdf", "(", ")", "delta_peak_loc_to_probability_mass", "=", "{", "}", "non_delta_peak_split_points", "=", "[", "temporal...
Temporal distance probability density function. Returns ------- non_delta_peak_split_points: numpy.array non_delta_peak_densities: numpy.array len(density) == len(temporal_distance_split_points_ordered) -1 delta_peak_loc_to_probability_mass : dict
[ "Temporal", "distance", "probability", "density", "function", "." ]
python
valid
47.206897
andela-sjames/paystack-python
paystackapi/base.py
https://github.com/andela-sjames/paystack-python/blob/c9e4bddcb76e1490fefc362e71a21486400dccd4/paystackapi/base.py#L45-L60
def _request(self, method, resource_uri, **kwargs): """Perform a method on a resource. Args: method: requests.`method` resource_uri: resource endpoint Raises: HTTPError Returns: JSON Response """ data = kwargs.get('data') ...
[ "def", "_request", "(", "self", ",", "method", ",", "resource_uri", ",", "*", "*", "kwargs", ")", ":", "data", "=", "kwargs", ".", "get", "(", "'data'", ")", "response", "=", "method", "(", "self", ".", "API_BASE_URL", "+", "resource_uri", ",", "json",...
Perform a method on a resource. Args: method: requests.`method` resource_uri: resource endpoint Raises: HTTPError Returns: JSON Response
[ "Perform", "a", "method", "on", "a", "resource", "." ]
python
train
30.5625
MisterY/gnucash-portfolio
reports/report_vanguard_prices/report_vanguard_prices.py
https://github.com/MisterY/gnucash-portfolio/blob/bfaad8345a5479d1cd111acee1939e25c2a638c2/reports/report_vanguard_prices/report_vanguard_prices.py#L18-L27
def generate_report( book_url, fund_ids: StringOption( section="Funds", sort_tag="c", documentation_string="Comma-separated list of fund ids.", default_value="8123,8146,8148,8147") ): """Generates the report output""" return render_report(book_...
[ "def", "generate_report", "(", "book_url", ",", "fund_ids", ":", "StringOption", "(", "section", "=", "\"Funds\"", ",", "sort_tag", "=", "\"c\"", ",", "documentation_string", "=", "\"Comma-separated list of fund ids.\"", ",", "default_value", "=", "\"8123,8146,8148,8147...
Generates the report output
[ "Generates", "the", "report", "output" ]
python
train
32.5
pymupdf/PyMuPDF
fitz/fitz.py
https://github.com/pymupdf/PyMuPDF/blob/917f2d83482510e26ba0ff01fd2392c26f3a8e90/fitz/fitz.py#L2894-L2906
def MediaBoxSize(self): """Retrieve width, height of /MediaBox.""" CheckParent(self) val = _fitz.Page_MediaBoxSize(self) val = Point(val) if not bool(val): r = self.rect val = Point(r.width, r.height) return val
[ "def", "MediaBoxSize", "(", "self", ")", ":", "CheckParent", "(", "self", ")", "val", "=", "_fitz", ".", "Page_MediaBoxSize", "(", "self", ")", "val", "=", "Point", "(", "val", ")", "if", "not", "bool", "(", "val", ")", ":", "r", "=", "self", ".", ...
Retrieve width, height of /MediaBox.
[ "Retrieve", "width", "height", "of", "/", "MediaBox", "." ]
python
train
21.153846
nugget/python-insteonplm
insteonplm/states/onOff.py
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/onOff.py#L365-L369
def close(self): """Send CLOSE command to device.""" close_command = StandardSend(self._address, COMMAND_LIGHT_OFF_0X13_0X00) self._send_method(close_command, self._close_message_received)
[ "def", "close", "(", "self", ")", ":", "close_command", "=", "StandardSend", "(", "self", ".", "_address", ",", "COMMAND_LIGHT_OFF_0X13_0X00", ")", "self", ".", "_send_method", "(", "close_command", ",", "self", ".", "_close_message_received", ")" ]
Send CLOSE command to device.
[ "Send", "CLOSE", "command", "to", "device", "." ]
python
train
49
apple/turicreate
deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L233-L235
def out_filename(template, n_val, mode): """Determine the output filename""" return '{0}_{1}_{2}.cpp'.format(template.name, n_val, mode.identifier)
[ "def", "out_filename", "(", "template", ",", "n_val", ",", "mode", ")", ":", "return", "'{0}_{1}_{2}.cpp'", ".", "format", "(", "template", ".", "name", ",", "n_val", ",", "mode", ".", "identifier", ")" ]
Determine the output filename
[ "Determine", "the", "output", "filename" ]
python
train
51
pycontribs/jira
jira/resources.py
https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L251-L347
def update(self, fields=None, async_=None, jira=None, notify=True, **kwargs): """Update this resource on the server. Keyword arguments are marshalled into a dict before being sent. If this resource doesn't support ``PUT``, a :py:exc:`.JIRAError` will be raised; subclasses that specialize this m...
[ "def", "update", "(", "self", ",", "fields", "=", "None", ",", "async_", "=", "None", ",", "jira", "=", "None", ",", "notify", "=", "True", ",", "*", "*", "kwargs", ")", ":", "if", "async_", "is", "None", ":", "async_", "=", "self", ".", "_option...
Update this resource on the server. Keyword arguments are marshalled into a dict before being sent. If this resource doesn't support ``PUT``, a :py:exc:`.JIRAError` will be raised; subclasses that specialize this method will only raise errors in case of user error. :param fields: Field...
[ "Update", "this", "resource", "on", "the", "server", "." ]
python
train
46.876289
etesync/radicale_storage_etesync
radicale_storage_etesync/__init__.py
https://github.com/etesync/radicale_storage_etesync/blob/73d549bad7a37f060ece65c653c18a859a9962f2/radicale_storage_etesync/__init__.py#L321-L332
def sync(self, old_token=None): """Get the current sync token and changed items for synchronization. ``old_token`` an old sync token which is used as the base of the delta update. If sync token is missing, all items are returned. ValueError is raised for invalid or old tokens. "...
[ "def", "sync", "(", "self", ",", "old_token", "=", "None", ")", ":", "# FIXME: Actually implement", "token", "=", "\"http://radicale.org/ns/sync/%s\"", "%", "self", ".", "etag", ".", "strip", "(", "\"\\\"\"", ")", "if", "old_token", ":", "raise", "ValueError", ...
Get the current sync token and changed items for synchronization. ``old_token`` an old sync token which is used as the base of the delta update. If sync token is missing, all items are returned. ValueError is raised for invalid or old tokens.
[ "Get", "the", "current", "sync", "token", "and", "changed", "items", "for", "synchronization", "." ]
python
train
47.25
erijo/tellcore-py
tellcore/telldus.py
https://github.com/erijo/tellcore-py/blob/7a1eb53e12ef039a2350933e502633df7560f6a8/tellcore/telldus.py#L48-L62
def process_callback(self, block=True): """Dispatch a single callback in the current thread. :param boolean block: If True, blocks waiting for a callback to come. :return: True if a callback was processed; otherwise False. """ try: (callback, args) = self._queue.get(...
[ "def", "process_callback", "(", "self", ",", "block", "=", "True", ")", ":", "try", ":", "(", "callback", ",", "args", ")", "=", "self", ".", "_queue", ".", "get", "(", "block", "=", "block", ")", "try", ":", "callback", "(", "*", "args", ")", "f...
Dispatch a single callback in the current thread. :param boolean block: If True, blocks waiting for a callback to come. :return: True if a callback was processed; otherwise False.
[ "Dispatch", "a", "single", "callback", "in", "the", "current", "thread", "." ]
python
train
33.4
aetros/aetros-cli
aetros/git.py
https://github.com/aetros/aetros-cli/blob/a2a1f38d6af1660e1e2680c7d413ec2aef45faab/aetros/git.py#L582-L651
def stream_file(self, path, fast_lane=True): """ Create a temp file, stream it to the server if online and append its content using the write() method. This makes sure that we have all newest data of this file on the server directly. At the end of the job, the content the serve...
[ "def", "stream_file", "(", "self", ",", "path", ",", "fast_lane", "=", "True", ")", ":", "# create temp file", "# open temp file", "# register stream file and write locally", "# on end() git_commit that file locally", "# create socket connection to server", "# stream file to server...
Create a temp file, stream it to the server if online and append its content using the write() method. This makes sure that we have all newest data of this file on the server directly. At the end of the job, the content the server received is stored as git blob on the server. It is then commit...
[ "Create", "a", "temp", "file", "stream", "it", "to", "the", "server", "if", "online", "and", "append", "its", "content", "using", "the", "write", "()", "method", ".", "This", "makes", "sure", "that", "we", "have", "all", "newest", "data", "of", "this", ...
python
train
40.557143
UDST/urbansim
urbansim/models/regression.py
https://github.com/UDST/urbansim/blob/79f815a6503e109f50be270cee92d0f4a34f49ef/urbansim/models/regression.py#L546-L559
def add_model(self, model): """ Add a `RegressionModel` instance. Parameters ---------- model : `RegressionModel` Should have a ``.name`` attribute matching one of the groupby segments. """ logger.debug( 'adding model {} to gr...
[ "def", "add_model", "(", "self", ",", "model", ")", ":", "logger", ".", "debug", "(", "'adding model {} to group {}'", ".", "format", "(", "model", ".", "name", ",", "self", ".", "name", ")", ")", "self", ".", "models", "[", "model", ".", "name", "]", ...
Add a `RegressionModel` instance. Parameters ---------- model : `RegressionModel` Should have a ``.name`` attribute matching one of the groupby segments.
[ "Add", "a", "RegressionModel", "instance", "." ]
python
train
27.5
intuition-io/intuition
intuition/api/portfolio.py
https://github.com/intuition-io/intuition/blob/cd517e6b3b315a743eb4d0d0dc294e264ab913ce/intuition/api/portfolio.py#L77-L84
def update(self, portfolio, date, perfs=None): ''' Actualizes the portfolio universe with the alog state ''' # Make the manager aware of current simulation self.portfolio = portfolio self.perfs = perfs self.date = date
[ "def", "update", "(", "self", ",", "portfolio", ",", "date", ",", "perfs", "=", "None", ")", ":", "# Make the manager aware of current simulation", "self", ".", "portfolio", "=", "portfolio", "self", ".", "perfs", "=", "perfs", "self", ".", "date", "=", "dat...
Actualizes the portfolio universe with the alog state
[ "Actualizes", "the", "portfolio", "universe", "with", "the", "alog", "state" ]
python
train
33.375
robotools/fontMath
Lib/fontMath/mathGlyph.py
https://github.com/robotools/fontMath/blob/6abcb9d5a1ca19788fbde4418d7b5630c60990d8/Lib/fontMath/mathGlyph.py#L276-L286
def drawPoints(self, pointPen, filterRedundantPoints=False): """draw self using pointPen""" if filterRedundantPoints: pointPen = FilterRedundantPointPen(pointPen) for contour in self.contours: pointPen.beginPath(identifier=contour["identifier"]) for segmentTyp...
[ "def", "drawPoints", "(", "self", ",", "pointPen", ",", "filterRedundantPoints", "=", "False", ")", ":", "if", "filterRedundantPoints", ":", "pointPen", "=", "FilterRedundantPointPen", "(", "pointPen", ")", "for", "contour", "in", "self", ".", "contours", ":", ...
draw self using pointPen
[ "draw", "self", "using", "pointPen" ]
python
train
61.272727
ethereum/py-evm
eth/chains/base.py
https://github.com/ethereum/py-evm/blob/58346848f076116381d3274bbcea96b9e2cfcbdf/eth/chains/base.py#L545-L551
def get_block_by_hash(self, block_hash: Hash32) -> BaseBlock: """ Returns the requested block as specified by block hash. """ validate_word(block_hash, title="Block Hash") block_header = self.get_block_header_by_hash(block_hash) return self.get_block_by_header(block_heade...
[ "def", "get_block_by_hash", "(", "self", ",", "block_hash", ":", "Hash32", ")", "->", "BaseBlock", ":", "validate_word", "(", "block_hash", ",", "title", "=", "\"Block Hash\"", ")", "block_header", "=", "self", ".", "get_block_header_by_hash", "(", "block_hash", ...
Returns the requested block as specified by block hash.
[ "Returns", "the", "requested", "block", "as", "specified", "by", "block", "hash", "." ]
python
train
45.142857
SoCo/SoCo
dev_tools/analyse_ws.py
https://github.com/SoCo/SoCo/blob/671937e07d7973b78c0cbee153d4f3ad68ec48c6/dev_tools/analyse_ws.py#L268-L310
def __update_window(self, width, height, message_no, page_no): """ Update the window with the menu and the new text """ file_exists_label = '-F-ILE' if not os.path.exists(self.__create_file_name(message_no)): file_exists_label = '(f)ile' # Clear the screen if PLATFOR...
[ "def", "__update_window", "(", "self", ",", "width", ",", "height", ",", "message_no", ",", "page_no", ")", ":", "file_exists_label", "=", "'-F-ILE'", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "__create_file_name", "(", "message_no", ...
Update the window with the menu and the new text
[ "Update", "the", "window", "with", "the", "menu", "and", "the", "new", "text" ]
python
train
41.348837
tensorflow/datasets
tensorflow_datasets/translate/wmt.py
https://github.com/tensorflow/datasets/blob/46ceb0cf7b4690f38ecbbc689e4d659a903d08dc/tensorflow_datasets/translate/wmt.py#L838-L858
def _parse_tmx(path): """Generates examples from TMX file.""" def _get_tuv_lang(tuv): for k, v in tuv.items(): if k.endswith("}lang"): return v raise AssertionError("Language not found in `tuv` attributes.") def _get_tuv_seg(tuv): segs = tuv.findall("seg") assert len(segs) == 1, "In...
[ "def", "_parse_tmx", "(", "path", ")", ":", "def", "_get_tuv_lang", "(", "tuv", ")", ":", "for", "k", ",", "v", "in", "tuv", ".", "items", "(", ")", ":", "if", "k", ".", "endswith", "(", "\"}lang\"", ")", ":", "return", "v", "raise", "AssertionErro...
Generates examples from TMX file.
[ "Generates", "examples", "from", "TMX", "file", "." ]
python
train
29.52381
gregreen/dustmaps
dustmaps/iphas.py
https://github.com/gregreen/dustmaps/blob/c8f571a71da0d951bf8ea865621bee14492bdfd9/dustmaps/iphas.py#L76-L212
def query(self, coords, mode='random_sample'): """ Returns A0 at the given coordinates. There are several different query modes, which handle the probabilistic nature of the map differently. Args: coords (:obj:`astropy.coordinates.SkyCoord`): The coordinates to query. ...
[ "def", "query", "(", "self", ",", "coords", ",", "mode", "=", "'random_sample'", ")", ":", "# Check that the query mode is supported", "valid_modes", "=", "[", "'random_sample'", ",", "'random_sample_per_pix'", ",", "'samples'", ",", "'median'", ",", "'mean'", "]", ...
Returns A0 at the given coordinates. There are several different query modes, which handle the probabilistic nature of the map differently. Args: coords (:obj:`astropy.coordinates.SkyCoord`): The coordinates to query. mode (Optional[:obj:`str`]): Five different query modes are a...
[ "Returns", "A0", "at", "the", "given", "coordinates", ".", "There", "are", "several", "different", "query", "modes", "which", "handle", "the", "probabilistic", "nature", "of", "the", "map", "differently", "." ]
python
train
41.518248
inveniosoftware-contrib/invenio-workflows
invenio_workflows/engine.py
https://github.com/inveniosoftware-contrib/invenio-workflows/blob/9c09fd29509a3db975ac2aba337e6760d8cfd3c2/invenio_workflows/engine.py#L161-L164
def running_objects(self): """Return the objects associated with this workflow.""" return [obj for obj in self.database_objects if obj.status in [obj.known_statuses.RUNNING]]
[ "def", "running_objects", "(", "self", ")", ":", "return", "[", "obj", "for", "obj", "in", "self", ".", "database_objects", "if", "obj", ".", "status", "in", "[", "obj", ".", "known_statuses", ".", "RUNNING", "]", "]" ]
Return the objects associated with this workflow.
[ "Return", "the", "objects", "associated", "with", "this", "workflow", "." ]
python
train
50.75
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_sensors.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_sensors.py#L82-L93
def report(self, name, ok, msg=None, deltat=20): '''report a sensor error''' r = self.reports[name] if time.time() < r.last_report + deltat: r.ok = ok return r.last_report = time.time() if ok and not r.ok: self.say("%s OK" % name) r.ok ...
[ "def", "report", "(", "self", ",", "name", ",", "ok", ",", "msg", "=", "None", ",", "deltat", "=", "20", ")", ":", "r", "=", "self", ".", "reports", "[", "name", "]", "if", "time", ".", "time", "(", ")", "<", "r", ".", "last_report", "+", "de...
report a sensor error
[ "report", "a", "sensor", "error" ]
python
train
30
juju/charm-helpers
charmhelpers/core/hookenv.py
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/core/hookenv.py#L394-L425
def config(scope=None): """ Get the juju charm configuration (scope==None) or individual key, (scope=str). The returned value is a Python data structure loaded as JSON from the Juju config command. :param scope: If set, return the value for the specified key. :type scope: Optional[str] :re...
[ "def", "config", "(", "scope", "=", "None", ")", ":", "global", "_cache_config", "config_cmd_line", "=", "[", "'config-get'", ",", "'--all'", ",", "'--format=json'", "]", "try", ":", "# JSON Decode Exception for Python3.5+", "exc_json", "=", "json", ".", "decoder"...
Get the juju charm configuration (scope==None) or individual key, (scope=str). The returned value is a Python data structure loaded as JSON from the Juju config command. :param scope: If set, return the value for the specified key. :type scope: Optional[str] :returns: Either the whole config as a ...
[ "Get", "the", "juju", "charm", "configuration", "(", "scope", "==", "None", ")", "or", "individual", "key", "(", "scope", "=", "str", ")", ".", "The", "returned", "value", "is", "a", "Python", "data", "structure", "loaded", "as", "JSON", "from", "the", ...
python
train
38.21875
pypa/pipenv
pipenv/patched/notpip/_internal/req/req_uninstall.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L337-L366
def remove(self, auto_confirm=False, verbose=False): """Remove paths in ``self.paths`` with confirmation (unless ``auto_confirm`` is True).""" if not self.paths: logger.info( "Can't uninstall '%s'. No files were found to uninstall.", self.dist.project...
[ "def", "remove", "(", "self", ",", "auto_confirm", "=", "False", ",", "verbose", "=", "False", ")", ":", "if", "not", "self", ".", "paths", ":", "logger", ".", "info", "(", "\"Can't uninstall '%s'. No files were found to uninstall.\"", ",", "self", ".", "dist"...
Remove paths in ``self.paths`` with confirmation (unless ``auto_confirm`` is True).
[ "Remove", "paths", "in", "self", ".", "paths", "with", "confirmation", "(", "unless", "auto_confirm", "is", "True", ")", "." ]
python
train
33.866667
nteract/papermill
papermill/preprocess.py
https://github.com/nteract/papermill/blob/7423a303f3fa22ec6d03edf5fd9700d659b5a6fa/papermill/preprocess.py#L14-L26
def preprocess(self, nb_man, resources, km=None): """ Wraps the parent class process call slightly """ with self.setup_preprocessor(nb_man.nb, resources, km=km): if self.log_output: self.log.info("Executing notebook with kernel: {}".format(self.kernel_name)) ...
[ "def", "preprocess", "(", "self", ",", "nb_man", ",", "resources", ",", "km", "=", "None", ")", ":", "with", "self", ".", "setup_preprocessor", "(", "nb_man", ".", "nb", ",", "resources", ",", "km", "=", "km", ")", ":", "if", "self", ".", "log_output...
Wraps the parent class process call slightly
[ "Wraps", "the", "parent", "class", "process", "call", "slightly" ]
python
train
45.615385
wilson-eft/wilson
wilson/match/smeft.py
https://github.com/wilson-eft/wilson/blob/4164f55ff663d4f668c6e2b4575fd41562662cc9/wilson/match/smeft.py#L206-L221
def match_all(d_SMEFT, parameters=None): """Match the SMEFT Warsaw basis onto the WET JMS basis.""" p = default_parameters.copy() if parameters is not None: # if parameters are passed in, overwrite the default values p.update(parameters) C = wilson.util.smeftutil.wcxf2arrays_symmetrized(...
[ "def", "match_all", "(", "d_SMEFT", ",", "parameters", "=", "None", ")", ":", "p", "=", "default_parameters", ".", "copy", "(", ")", "if", "parameters", "is", "not", "None", ":", "# if parameters are passed in, overwrite the default values", "p", ".", "update", ...
Match the SMEFT Warsaw basis onto the WET JMS basis.
[ "Match", "the", "SMEFT", "Warsaw", "basis", "onto", "the", "WET", "JMS", "basis", "." ]
python
train
41.5
riga/tfdeploy
tfdeploy.py
https://github.com/riga/tfdeploy/blob/8481f657d6e3a51d76185a195b993e45f448828a/tfdeploy.py#L863-L877
def print_tensor(td_tensor, indent="| ", max_depth=-1, depth=0): """ print_tensor(td_tensor, indent=" ", max_depth=-1) Prints the dependency graph of a :py:class:`Tensor` *td_tensor*, where each new level is indented by *indent*. When *max_depth* is positive, the graph is truncated at that depth, where...
[ "def", "print_tensor", "(", "td_tensor", ",", "indent", "=", "\"| \"", ",", "max_depth", "=", "-", "1", ",", "depth", "=", "0", ")", ":", "offset", "=", "depth", "*", "indent", "line", "=", "\"td tensor: %s\"", "%", "td_tensor", ".", "name", "if", "t...
print_tensor(td_tensor, indent=" ", max_depth=-1) Prints the dependency graph of a :py:class:`Tensor` *td_tensor*, where each new level is indented by *indent*. When *max_depth* is positive, the graph is truncated at that depth, where each tensor and each op count as a level.
[ "print_tensor", "(", "td_tensor", "indent", "=", "max_depth", "=", "-", "1", ")", "Prints", "the", "dependency", "graph", "of", "a", ":", "py", ":", "class", ":", "Tensor", "*", "td_tensor", "*", "where", "each", "new", "level", "is", "indented", "by", ...
python
train
47.733333