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
deepmind/pysc2
pysc2/lib/features.py
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/features.py#L774-L832
def observation_spec(self): """The observation spec for the SC2 environment. It's worth noting that the image-like observations are in y,x/row,column order which is different than the actions which are in x,y order. This is due to conflicting conventions, and to facilitate printing of the images. ...
[ "def", "observation_spec", "(", "self", ")", ":", "obs_spec", "=", "named_array", ".", "NamedDict", "(", "{", "\"action_result\"", ":", "(", "0", ",", ")", ",", "# See error.proto: ActionResult.", "\"alerts\"", ":", "(", "0", ",", ")", ",", "# See sc2api.proto...
The observation spec for the SC2 environment. It's worth noting that the image-like observations are in y,x/row,column order which is different than the actions which are in x,y order. This is due to conflicting conventions, and to facilitate printing of the images. Returns: The dict of observat...
[ "The", "observation", "spec", "for", "the", "SC2", "environment", "." ]
python
train
45.79661
leandroarndt/djangospam
djangospam/logger.py
https://github.com/leandroarndt/djangospam/blob/57fa9cfbf54a40f0e0652d0155dbb3451c14b69d/djangospam/logger.py#L46-L62
def log(ltype, method, page, user_agent): """Writes to the log a message in the following format:: "<datetime>: <exception> method <HTTP method> page <path> \ user agent <user_agent>" """ try: f = open(settings.DJANGOSPAM_LOG, "a") f.write("%s: %s method %s pag...
[ "def", "log", "(", "ltype", ",", "method", ",", "page", ",", "user_agent", ")", ":", "try", ":", "f", "=", "open", "(", "settings", ".", "DJANGOSPAM_LOG", ",", "\"a\"", ")", "f", ".", "write", "(", "\"%s: %s method %s page %s user agent %s\\n\"", "%", "(",...
Writes to the log a message in the following format:: "<datetime>: <exception> method <HTTP method> page <path> \ user agent <user_agent>"
[ "Writes", "to", "the", "log", "a", "message", "in", "the", "following", "format", "::", "<datetime", ">", ":", "<exception", ">", "method", "<HTTP", "method", ">", "page", "<path", ">", "\\", "user", "agent", "<user_agent", ">" ]
python
train
34.117647
pudo/jsongraph
jsongraph/query.py
https://github.com/pudo/jsongraph/blob/35e4f397dbe69cd5553cf9cb9ab98859c3620f03/jsongraph/query.py#L132-L152
def query(self, parents=None): """ Compose the query and generate SPARQL. """ # TODO: benchmark single-query strategy q = Select([]) q = self.project(q, parent=True) q = self.filter(q, parents=parents) if self.parent is None: subq = Select([self.var]) ...
[ "def", "query", "(", "self", ",", "parents", "=", "None", ")", ":", "# TODO: benchmark single-query strategy", "q", "=", "Select", "(", "[", "]", ")", "q", "=", "self", ".", "project", "(", "q", ",", "parent", "=", "True", ")", "q", "=", "self", ".",...
Compose the query and generate SPARQL.
[ "Compose", "the", "query", "and", "generate", "SPARQL", "." ]
python
train
36.761905
qualisys/qualisys_python_sdk
qtm/qrt.py
https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/qtm/qrt.py#L195-L202
async def release_control(self): """Release control of QTM. """ cmd = "releasecontrol" return await asyncio.wait_for( self._protocol.send_command(cmd), timeout=self._timeout )
[ "async", "def", "release_control", "(", "self", ")", ":", "cmd", "=", "\"releasecontrol\"", "return", "await", "asyncio", ".", "wait_for", "(", "self", ".", "_protocol", ".", "send_command", "(", "cmd", ")", ",", "timeout", "=", "self", ".", "_timeout", ")...
Release control of QTM.
[ "Release", "control", "of", "QTM", "." ]
python
valid
27.625
IGBC/PySketch
sketches/__init__.py
https://github.com/IGBC/PySketch/blob/3b39410a85693b46704e75739e70301cfea33523/sketches/__init__.py#L44-L65
def __register_library(self, module_name: str, attr: str, fallback: str = None): """Inserts Interpreter Library of imports into sketch in a very non-consensual way""" # Import the module Named in the string try: module = importlib.import_module(module_name) # If module is n...
[ "def", "__register_library", "(", "self", ",", "module_name", ":", "str", ",", "attr", ":", "str", ",", "fallback", ":", "str", "=", "None", ")", ":", "# Import the module Named in the string", "try", ":", "module", "=", "importlib", ".", "import_module", "(",...
Inserts Interpreter Library of imports into sketch in a very non-consensual way
[ "Inserts", "Interpreter", "Library", "of", "imports", "into", "sketch", "in", "a", "very", "non", "-", "consensual", "way" ]
python
valid
49.545455
hvac/hvac
hvac/api/system_backend/auth.py
https://github.com/hvac/hvac/blob/cce5b86889193f622c2a72a4a1b7e1c9c8aff1ce/hvac/api/system_backend/auth.py#L96-L117
def read_auth_method_tuning(self, path): """Read the given auth path's configuration. This endpoint requires sudo capability on the final path, but the same functionality can be achieved without sudo via sys/mounts/auth/[auth-path]/tune. Supported methods: GET: /sys/auth/{p...
[ "def", "read_auth_method_tuning", "(", "self", ",", "path", ")", ":", "api_path", "=", "'/v1/sys/auth/{path}/tune'", ".", "format", "(", "path", "=", "path", ",", ")", "response", "=", "self", ".", "_adapter", ".", "get", "(", "url", "=", "api_path", ",", ...
Read the given auth path's configuration. This endpoint requires sudo capability on the final path, but the same functionality can be achieved without sudo via sys/mounts/auth/[auth-path]/tune. Supported methods: GET: /sys/auth/{path}/tune. Produces: 200 application/json :...
[ "Read", "the", "given", "auth", "path", "s", "configuration", "." ]
python
train
35.909091
gabstopper/smc-python
smc/elements/user.py
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/user.py#L120-L135
def permissions(self): """ Return each permission role mapping for this Admin User. A permission role will have 3 fields: * Domain * Role (Viewer, Operator, etc) * Elements (Engines, Policies, or ACLs) :return: permissions as list :rtype:...
[ "def", "permissions", "(", "self", ")", ":", "if", "'permissions'", "in", "self", ".", "data", ":", "_permissions", "=", "self", ".", "data", "[", "'permissions'", "]", "[", "'permission'", "]", "return", "[", "Permission", "(", "*", "*", "perm", ")", ...
Return each permission role mapping for this Admin User. A permission role will have 3 fields: * Domain * Role (Viewer, Operator, etc) * Elements (Engines, Policies, or ACLs) :return: permissions as list :rtype: list(Permission)
[ "Return", "each", "permission", "role", "mapping", "for", "this", "Admin", "User", ".", "A", "permission", "role", "will", "have", "3", "fields", ":", "*", "Domain", "*", "Role", "(", "Viewer", "Operator", "etc", ")", "*", "Elements", "(", "Engines", "Po...
python
train
32.625
MisterY/gnucash-portfolio
gnucash_portfolio/lib/templates.py
https://github.com/MisterY/gnucash-portfolio/blob/bfaad8345a5479d1cd111acee1939e25c2a638c2/gnucash_portfolio/lib/templates.py#L7-L23
def load_jinja_template(file_name): """ Loads the jinja2 HTML template from the given file. Assumes that the file is in the same directory as the script. """ original_script_path = sys.argv[0] #script_path = os.path.dirname(os.path.realpath(__file__)) script_dir = os.path.dirname(original_sc...
[ "def", "load_jinja_template", "(", "file_name", ")", ":", "original_script_path", "=", "sys", ".", "argv", "[", "0", "]", "#script_path = os.path.dirname(os.path.realpath(__file__))", "script_dir", "=", "os", ".", "path", ".", "dirname", "(", "original_script_path", "...
Loads the jinja2 HTML template from the given file. Assumes that the file is in the same directory as the script.
[ "Loads", "the", "jinja2", "HTML", "template", "from", "the", "given", "file", ".", "Assumes", "that", "the", "file", "is", "in", "the", "same", "directory", "as", "the", "script", "." ]
python
train
37.294118
peterbrittain/asciimatics
asciimatics/screen.py
https://github.com/peterbrittain/asciimatics/blob/f471427d7786ce2d5f1eeb2dae0e67d19e46e085/asciimatics/screen.py#L59-L70
def clear(self, fg, attr, bg): """ Clear the double-buffer. This does not clear the screen buffer and so the next call to deltas will still show all changes. :param fg: The foreground colour to use for the new buffer. :param attr: The attribute value to use for the new buffer. ...
[ "def", "clear", "(", "self", ",", "fg", ",", "attr", ",", "bg", ")", ":", "line", "=", "[", "(", "ord", "(", "u\" \"", ")", ",", "fg", ",", "attr", ",", "bg", ",", "1", ")", "for", "_", "in", "range", "(", "self", ".", "_width", ")", "]", ...
Clear the double-buffer. This does not clear the screen buffer and so the next call to deltas will still show all changes. :param fg: The foreground colour to use for the new buffer. :param attr: The attribute value to use for the new buffer. :param bg: The background colour to use for...
[ "Clear", "the", "double", "-", "buffer", "." ]
python
train
44.25
DataBiosphere/toil
src/toil/serviceManager.py
https://github.com/DataBiosphere/toil/blob/a8252277ff814e7bee0971139c2344f88e44b644/src/toil/serviceManager.py#L121-L129
def killServices(self, services, error=False): """ :param dict services: Maps service jobStoreIDs to the communication flags for the service """ for serviceJobStoreID in services: serviceJob = services[serviceJobStoreID] if error: self.jobStore.del...
[ "def", "killServices", "(", "self", ",", "services", ",", "error", "=", "False", ")", ":", "for", "serviceJobStoreID", "in", "services", ":", "serviceJob", "=", "services", "[", "serviceJobStoreID", "]", "if", "error", ":", "self", ".", "jobStore", ".", "d...
:param dict services: Maps service jobStoreIDs to the communication flags for the service
[ ":", "param", "dict", "services", ":", "Maps", "service", "jobStoreIDs", "to", "the", "communication", "flags", "for", "the", "service" ]
python
train
46.222222
BlueBrain/NeuroM
examples/features_graph_table.py
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/examples/features_graph_table.py#L94-L106
def plot_feature(feature, cell): '''Plot a feature ''' fig = pl.figure() ax = fig.add_subplot(111) if cell is not None: try: histogram(cell, feature, ax) except ValueError: pass stylize(ax, cell.name, feature) return fig
[ "def", "plot_feature", "(", "feature", ",", "cell", ")", ":", "fig", "=", "pl", ".", "figure", "(", ")", "ax", "=", "fig", ".", "add_subplot", "(", "111", ")", "if", "cell", "is", "not", "None", ":", "try", ":", "histogram", "(", "cell", ",", "fe...
Plot a feature
[ "Plot", "a", "feature" ]
python
train
21.615385
tgalal/python-axolotl
axolotl/groups/groupcipher.py
https://github.com/tgalal/python-axolotl/blob/0c681af4b756f556e23a9bf961abfbc6f82800cc/axolotl/groups/groupcipher.py#L110-L117
def getCipherText(self, iv, key, plaintext): """ :type iv: bytearray :type key: bytearray :type plaintext: bytearray """ cipher = AESCipher(key, iv) return cipher.encrypt(bytes(plaintext))
[ "def", "getCipherText", "(", "self", ",", "iv", ",", "key", ",", "plaintext", ")", ":", "cipher", "=", "AESCipher", "(", "key", ",", "iv", ")", "return", "cipher", ".", "encrypt", "(", "bytes", "(", "plaintext", ")", ")" ]
:type iv: bytearray :type key: bytearray :type plaintext: bytearray
[ ":", "type", "iv", ":", "bytearray", ":", "type", "key", ":", "bytearray", ":", "type", "plaintext", ":", "bytearray" ]
python
train
29.625
mollie/mollie-api-python
mollie/api/objects/list.py
https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/objects/list.py#L49-L54
def get_next(self): """Return the next set of objects in a list""" url = self._get_link('next') resource = self.object_type.get_resource_class(self.client) resp = resource.perform_api_call(resource.REST_READ, url) return List(resp, self.object_type, self.client)
[ "def", "get_next", "(", "self", ")", ":", "url", "=", "self", ".", "_get_link", "(", "'next'", ")", "resource", "=", "self", ".", "object_type", ".", "get_resource_class", "(", "self", ".", "client", ")", "resp", "=", "resource", ".", "perform_api_call", ...
Return the next set of objects in a list
[ "Return", "the", "next", "set", "of", "objects", "in", "a", "list" ]
python
train
49.5
deep-compute/deeputil
deeputil/misc.py
https://github.com/deep-compute/deeputil/blob/9af5702bc3fd990688bf2aed16c20fa104be66df/deeputil/misc.py#L111-L132
def parse_location(loc, default_port): ''' loc can be of the format http://<ip/domain>[:<port>] eg: http://localhost:8888 http://localhost/ return ip (str), port (int) >>> parse_location('http://localhost/', 6379) ('localhost', 6379) >>> parse_location('http://localhost:8888'...
[ "def", "parse_location", "(", "loc", ",", "default_port", ")", ":", "parsed", "=", "urlparse", "(", "loc", ")", "if", "':'", "in", "parsed", ".", "netloc", ":", "ip", ",", "port", "=", "parsed", ".", "netloc", ".", "split", "(", "':'", ")", "port", ...
loc can be of the format http://<ip/domain>[:<port>] eg: http://localhost:8888 http://localhost/ return ip (str), port (int) >>> parse_location('http://localhost/', 6379) ('localhost', 6379) >>> parse_location('http://localhost:8888', 6379) ('localhost', 8888)
[ "loc", "can", "be", "of", "the", "format", "http", ":", "//", "<ip", "/", "domain", ">", "[", ":", "<port", ">", "]", "eg", ":", "http", ":", "//", "localhost", ":", "8888", "http", ":", "//", "localhost", "/", "return", "ip", "(", "str", ")", ...
python
train
24.681818
google/grr
grr/server/grr_response_server/rdfvalues/objects.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/rdfvalues/objects.py#L106-L115
def GetIPAddresses(self): """IP addresses from all interfaces.""" result = [] filtered_ips = ["127.0.0.1", "::1", "fe80::1"] for interface in self.interfaces: for address in interface.addresses: if address.human_readable_address not in filtered_ips: result.append(Text(address.hu...
[ "def", "GetIPAddresses", "(", "self", ")", ":", "result", "=", "[", "]", "filtered_ips", "=", "[", "\"127.0.0.1\"", ",", "\"::1\"", ",", "\"fe80::1\"", "]", "for", "interface", "in", "self", ".", "interfaces", ":", "for", "address", "in", "interface", ".",...
IP addresses from all interfaces.
[ "IP", "addresses", "from", "all", "interfaces", "." ]
python
train
35.9
opendatateam/udata
udata/commands/__init__.py
https://github.com/opendatateam/udata/blob/f016585af94b0ff6bd73738c700324adc8ba7f8f/udata/commands/__init__.py#L207-L238
def load_udata_commands(self, ctx): ''' Load udata commands from: - `udata.commands.*` module - known internal modules with commands - plugins exporting a `udata.commands` entrypoint ''' if self._udata_commands_loaded: return # Load all comman...
[ "def", "load_udata_commands", "(", "self", ",", "ctx", ")", ":", "if", "self", ".", "_udata_commands_loaded", ":", "return", "# Load all commands submodules", "pattern", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__fil...
Load udata commands from: - `udata.commands.*` module - known internal modules with commands - plugins exporting a `udata.commands` entrypoint
[ "Load", "udata", "commands", "from", ":", "-", "udata", ".", "commands", ".", "*", "module", "-", "known", "internal", "modules", "with", "commands", "-", "plugins", "exporting", "a", "udata", ".", "commands", "entrypoint" ]
python
train
37
joferkington/mplstereonet
mplstereonet/utilities.py
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/utilities.py#L223-L249
def parse_azimuth(azimuth): """ Parses an azimuth measurement in azimuth or quadrant format. Parameters ----------- azimuth : string or number An azimuth measurement in degrees or a quadrant measurement of azimuth. Returns ------- azi : float The azimuth in degrees cloc...
[ "def", "parse_azimuth", "(", "azimuth", ")", ":", "try", ":", "azimuth", "=", "float", "(", "azimuth", ")", "except", "ValueError", ":", "if", "not", "azimuth", "[", "0", "]", ".", "isalpha", "(", ")", ":", "raise", "ValueError", "(", "'Ambiguous azimuth...
Parses an azimuth measurement in azimuth or quadrant format. Parameters ----------- azimuth : string or number An azimuth measurement in degrees or a quadrant measurement of azimuth. Returns ------- azi : float The azimuth in degrees clockwise from north (range: 0-360) See...
[ "Parses", "an", "azimuth", "measurement", "in", "azimuth", "or", "quadrant", "format", "." ]
python
train
25.259259
saltstack/salt
salt/cli/daemons.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L534-L568
def prepare(self): ''' Run the preparation sequence required to start a salt syndic minion. If sub-classed, don't **ever** forget to run: super(YourSubClass, self).prepare() ''' super(Syndic, self).prepare() try: if self.config['verify_env']: ...
[ "def", "prepare", "(", "self", ")", ":", "super", "(", "Syndic", ",", "self", ")", ".", "prepare", "(", ")", "try", ":", "if", "self", ".", "config", "[", "'verify_env'", "]", ":", "verify_env", "(", "[", "self", ".", "config", "[", "'pki_dir'", "]...
Run the preparation sequence required to start a salt syndic minion. If sub-classed, don't **ever** forget to run: super(YourSubClass, self).prepare()
[ "Run", "the", "preparation", "sequence", "required", "to", "start", "a", "salt", "syndic", "minion", "." ]
python
train
34.742857
python-hyper/wsproto
example/synchronous_client.py
https://github.com/python-hyper/wsproto/blob/a7abcc5a9f7ad126668afb0cc9932da08c87f40f/example/synchronous_client.py#L33-L103
def wsproto_demo(host, port): ''' Demonstrate wsproto: 0) Open TCP connection 1) Negotiate WebSocket opening handshake 2) Send a message and display response 3) Send ping and display pong 4) Negotiate WebSocket closing handshake :param stream: a socket stream ''' # 0) Open TCP...
[ "def", "wsproto_demo", "(", "host", ",", "port", ")", ":", "# 0) Open TCP connection", "print", "(", "'Connecting to {}:{}'", ".", "format", "(", "host", ",", "port", ")", ")", "conn", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "sock...
Demonstrate wsproto: 0) Open TCP connection 1) Negotiate WebSocket opening handshake 2) Send a message and display response 3) Send ping and display pong 4) Negotiate WebSocket closing handshake :param stream: a socket stream
[ "Demonstrate", "wsproto", ":" ]
python
train
36.661972
pytroll/satpy
satpy/readers/aapp_l1b.py
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/readers/aapp_l1b.py#L158-L191
def get_angles(self, angle_id): """Get sun-satellite viewing angles""" tic = datetime.now() sunz40km = self._data["ang"][:, :, 0] * 1e-2 satz40km = self._data["ang"][:, :, 1] * 1e-2 azidiff40km = self._data["ang"][:, :, 2] * 1e-2 try: from geotiepoints.inte...
[ "def", "get_angles", "(", "self", ",", "angle_id", ")", ":", "tic", "=", "datetime", ".", "now", "(", ")", "sunz40km", "=", "self", ".", "_data", "[", "\"ang\"", "]", "[", ":", ",", ":", ",", "0", "]", "*", "1e-2", "satz40km", "=", "self", ".", ...
Get sun-satellite viewing angles
[ "Get", "sun", "-", "satellite", "viewing", "angles" ]
python
train
37.323529
openstack/proliantutils
proliantutils/ilo/ris.py
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/ris.py#L817-L834
def _press_pwr_btn(self, pushType="Press"): """Simulates a physical press of the server power button. :param pushType: Type of power button press to simulate Supported values are: 'Press' and 'PressAndHold' :raises: IloError, on an error from iLO. """ po...
[ "def", "_press_pwr_btn", "(", "self", ",", "pushType", "=", "\"Press\"", ")", ":", "power_settings", "=", "{", "\"Action\"", ":", "\"PowerButton\"", ",", "\"Target\"", ":", "\"/Oem/Hp\"", ",", "\"PushType\"", ":", "pushType", "}", "systems_uri", "=", "\"/rest/v1...
Simulates a physical press of the server power button. :param pushType: Type of power button press to simulate Supported values are: 'Press' and 'PressAndHold' :raises: IloError, on an error from iLO.
[ "Simulates", "a", "physical", "press", "of", "the", "server", "power", "button", "." ]
python
train
41.277778
hubo1016/vlcp
vlcp/utils/http.py
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/http.py#L690-L708
def route(self, path, routinemethod, container = None, host = None, vhost = None, method = [b'GET', b'HEAD']): ''' Route specified path to a WSGI-styled routine factory :param path: path to match, can be a regular expression :param routinemethod: factory function routi...
[ "def", "route", "(", "self", ",", "path", ",", "routinemethod", ",", "container", "=", "None", ",", "host", "=", "None", ",", "vhost", "=", "None", ",", "method", "=", "[", "b'GET'", ",", "b'HEAD'", "]", ")", ":", "self", ".", "routeevent", "(", "p...
Route specified path to a WSGI-styled routine factory :param path: path to match, can be a regular expression :param routinemethod: factory function routinemethod(env), env is an Environment object see also utils.http.Environment :param container: rout...
[ "Route", "specified", "path", "to", "a", "WSGI", "-", "styled", "routine", "factory", ":", "param", "path", ":", "path", "to", "match", "can", "be", "a", "regular", "expression", ":", "param", "routinemethod", ":", "factory", "function", "routinemethod", "("...
python
train
46.789474
LasLabs/python-five9
five9/environment.py
https://github.com/LasLabs/python-five9/blob/ef53160d6658604524a2577391280d2b4501a7ce/five9/environment.py#L12-L21
def model(method): """Use this to decorate methods that expect a model.""" def wrapper(self, *args, **kwargs): if self.__model__ is None: raise ValidationError( 'You cannot perform CRUD operations without selecting a ' 'model first.', ...
[ "def", "model", "(", "method", ")", ":", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "__model__", "is", "None", ":", "raise", "ValidationError", "(", "'You cannot perform CRUD operations without sele...
Use this to decorate methods that expect a model.
[ "Use", "this", "to", "decorate", "methods", "that", "expect", "a", "model", "." ]
python
train
39.9
etesync/radicale_storage_etesync
radicale_storage_etesync/__init__.py
https://github.com/etesync/radicale_storage_etesync/blob/73d549bad7a37f060ece65c653c18a859a9962f2/radicale_storage_etesync/__init__.py#L433-L444
def set_meta_all(self, props): """Set metadata values for collection. ``props`` a dict with values for properties. """ delta_props = self.get_meta() for key in delta_props.keys(): if key not in props: delta_props[key] = None delta_props.updat...
[ "def", "set_meta_all", "(", "self", ",", "props", ")", ":", "delta_props", "=", "self", ".", "get_meta", "(", ")", "for", "key", "in", "delta_props", ".", "keys", "(", ")", ":", "if", "key", "not", "in", "props", ":", "delta_props", "[", "key", "]", ...
Set metadata values for collection. ``props`` a dict with values for properties.
[ "Set", "metadata", "values", "for", "collection", "." ]
python
train
29.333333
bmweiner/skillful
skillful/validate.py
https://github.com/bmweiner/skillful/blob/8646f54faf62cb63f165f7699b8ace5b4a08233c/skillful/validate.py#L123-L159
def cert_chain(certs): """Validate PEM-encoded X.509 certificate chain. See `validate.request` for additional info. Args: certs: list. The certificate chain as a list of cryptography.hazmat.backends.openssl.x509._Certificate certificates. See `validate.retrieve` to create c...
[ "def", "cert_chain", "(", "certs", ")", ":", "if", "len", "(", "certs", ")", "<", "2", ":", "warnings", ".", "warn", "(", "'Certificate chain contains < 3 certificates.'", ")", "return", "False", "cert", "=", "certs", "[", "0", "]", "today", "=", "datetime...
Validate PEM-encoded X.509 certificate chain. See `validate.request` for additional info. Args: certs: list. The certificate chain as a list of cryptography.hazmat.backends.openssl.x509._Certificate certificates. See `validate.retrieve` to create certs obj. Returns: ...
[ "Validate", "PEM", "-", "encoded", "X", ".", "509", "certificate", "chain", "." ]
python
train
31.351351
antevens/listen
listen/signal_handler.py
https://github.com/antevens/listen/blob/d3ddff8e7fbfb672c5bd7f6f4febeb5e921d8c67/listen/signal_handler.py#L65-L92
def default_handler(self, signum, frame): """ Default handler, a generic callback method for signal processing""" self.log.debug("Signal handler called with signal: {0}".format(signum)) # 1. If signal is HUP restart the python process # 2. If signal is TERM, INT or QUIT we try to cleanup...
[ "def", "default_handler", "(", "self", ",", "signum", ",", "frame", ")", ":", "self", ".", "log", ".", "debug", "(", "\"Signal handler called with signal: {0}\"", ".", "format", "(", "signum", ")", ")", "# 1. If signal is HUP restart the python process", "# 2. If sign...
Default handler, a generic callback method for signal processing
[ "Default", "handler", "a", "generic", "callback", "method", "for", "signal", "processing" ]
python
test
46.535714
asyrjasalo/RESTinstance
src/REST/keywords.py
https://github.com/asyrjasalo/RESTinstance/blob/9b003ffc6a89ec4b8b6f05eeb6cc8e56aad4be4e/src/REST/keywords.py#L1053-L1130
def output_schema( self, what="", file_path=None, append=False, sort_keys=False ): """*Outputs JSON Schema to terminal or a file.* By default, the schema is output for the last request and response. The output can be limited further by: - The property of the last instance,...
[ "def", "output_schema", "(", "self", ",", "what", "=", "\"\"", ",", "file_path", "=", "None", ",", "append", "=", "False", ",", "sort_keys", "=", "False", ")", ":", "if", "isinstance", "(", "what", ",", "(", "STRING_TYPES", ")", ")", ":", "if", "what...
*Outputs JSON Schema to terminal or a file.* By default, the schema is output for the last request and response. The output can be limited further by: - The property of the last instance, e.g. ``request`` or ``response`` - Any nested property that exists, similarly as for assertion ke...
[ "*", "Outputs", "JSON", "Schema", "to", "terminal", "or", "a", "file", ".", "*" ]
python
train
40.230769
mfcloud/python-zvm-sdk
zvmsdk/vmops.py
https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/vmops.py#L108-L112
def guest_start(self, userid): """"Power on z/VM instance.""" LOG.info("Begin to power on vm %s", userid) self._smtclient.guest_start(userid) LOG.info("Complete power on vm %s", userid)
[ "def", "guest_start", "(", "self", ",", "userid", ")", ":", "LOG", ".", "info", "(", "\"Begin to power on vm %s\"", ",", "userid", ")", "self", ".", "_smtclient", ".", "guest_start", "(", "userid", ")", "LOG", ".", "info", "(", "\"Complete power on vm %s\"", ...
Power on z/VM instance.
[ "Power", "on", "z", "/", "VM", "instance", "." ]
python
train
42.6
angr/angr
angr/analyses/cfg/cfg_emulated.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L3276-L3290
def _is_indirect_jump(_, sim_successors): """ Determine if this SimIRSB has an indirect jump as its exit """ if sim_successors.artifacts['irsb_direct_next']: # It's a direct jump return False default_jumpkind = sim_successors.artifacts['irsb_default_jump...
[ "def", "_is_indirect_jump", "(", "_", ",", "sim_successors", ")", ":", "if", "sim_successors", ".", "artifacts", "[", "'irsb_direct_next'", "]", ":", "# It's a direct jump", "return", "False", "default_jumpkind", "=", "sim_successors", ".", "artifacts", "[", "'irsb_...
Determine if this SimIRSB has an indirect jump as its exit
[ "Determine", "if", "this", "SimIRSB", "has", "an", "indirect", "jump", "as", "its", "exit" ]
python
train
35
widdowquinn/pyani
pyani/pyani_graphics.py
https://github.com/widdowquinn/pyani/blob/2b24ec971401e04024bba896e4011984fe3f53f0/pyani/pyani_graphics.py#L312-L375
def heatmap_mpl(dfr, outfilename=None, title=None, params=None): """Returns matplotlib heatmap with cluster dendrograms. - dfr - pandas DataFrame with relevant data - outfilename - path to output file (indicates output format) - params - a list of parameters for plotting: [colormap, vmin, vmax] - l...
[ "def", "heatmap_mpl", "(", "dfr", ",", "outfilename", "=", "None", ",", "title", "=", "None", ",", "params", "=", "None", ")", ":", "# Layout figure grid and add title", "# Set figure size by the number of rows in the dataframe", "figsize", "=", "max", "(", "8", ","...
Returns matplotlib heatmap with cluster dendrograms. - dfr - pandas DataFrame with relevant data - outfilename - path to output file (indicates output format) - params - a list of parameters for plotting: [colormap, vmin, vmax] - labels - dictionary of alternative labels, keyed by default sequence ...
[ "Returns", "matplotlib", "heatmap", "with", "cluster", "dendrograms", "." ]
python
train
37.953125
saltstack/salt
salt/returners/influxdb_return.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/influxdb_return.py#L272-L291
def get_fun(fun): ''' Return a dict of the last function called for all minions ''' serv = _get_serv(ret=None) sql = '''select first(id) as fid, first(full_ret) as fret from returns where fun = '{0}' group by fun, id '''.format(fun) data = serv.que...
[ "def", "get_fun", "(", "fun", ")", ":", "serv", "=", "_get_serv", "(", "ret", "=", "None", ")", "sql", "=", "'''select first(id) as fid, first(full_ret) as fret\n from returns\n where fun = '{0}'\n group by fun, id\n '''", ".", "format", ...
Return a dict of the last function called for all minions
[ "Return", "a", "dict", "of", "the", "last", "function", "called", "for", "all", "minions" ]
python
train
23.7
PythonicNinja/pydrill
pydrill/client/__init__.py
https://github.com/PythonicNinja/pydrill/blob/0713e78c84d44cd438018e4ba1588a8e242f78c4/pydrill/client/__init__.py#L157-L172
def storage_detail(self, name, timeout=10): """ Get the definition of the named storage plugin. :param name: The assigned name in the storage plugin definition. :param timeout: int :return: pydrill.client.Result """ result = Result(*self.perform_request(**{ ...
[ "def", "storage_detail", "(", "self", ",", "name", ",", "timeout", "=", "10", ")", ":", "result", "=", "Result", "(", "*", "self", ".", "perform_request", "(", "*", "*", "{", "'method'", ":", "'GET'", ",", "'url'", ":", "'/storage/{0}.json'", ".", "for...
Get the definition of the named storage plugin. :param name: The assigned name in the storage plugin definition. :param timeout: int :return: pydrill.client.Result
[ "Get", "the", "definition", "of", "the", "named", "storage", "plugin", "." ]
python
train
31
rosshamish/hexgrid
hexgrid.py
https://github.com/rosshamish/hexgrid/blob/16abb1822dc2789cb355f54fb06c7774eea1d9f2/hexgrid.py#L386-L398
def nodes_touching_edge(edge_coord): """ Returns the two node coordinates which are on the given edge coordinate. :return: list of 2 node coordinates which are on the given edge coordinate, list(int) """ a, b = hex_digit(edge_coord, 1), hex_digit(edge_coord, 2) if a % 2 == 0 and b % 2 == 0: ...
[ "def", "nodes_touching_edge", "(", "edge_coord", ")", ":", "a", ",", "b", "=", "hex_digit", "(", "edge_coord", ",", "1", ")", ",", "hex_digit", "(", "edge_coord", ",", "2", ")", "if", "a", "%", "2", "==", "0", "and", "b", "%", "2", "==", "0", ":"...
Returns the two node coordinates which are on the given edge coordinate. :return: list of 2 node coordinates which are on the given edge coordinate, list(int)
[ "Returns", "the", "two", "node", "coordinates", "which", "are", "on", "the", "given", "edge", "coordinate", "." ]
python
train
39.230769
serhatbolsu/robotframework-appiumlibrary
AppiumLibrary/keywords/_applicationmanagement.py
https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/91c808cf0602af6be8135ac529fa488fded04a85/AppiumLibrary/keywords/_applicationmanagement.py#L39-L56
def open_application(self, remote_url, alias=None, **kwargs): """Opens a new application to given Appium server. Capabilities of appium server, Android and iOS, Please check https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/server-args.md | *Option* ...
[ "def", "open_application", "(", "self", ",", "remote_url", ",", "alias", "=", "None", ",", "*", "*", "kwargs", ")", ":", "desired_caps", "=", "kwargs", "application", "=", "webdriver", ".", "Remote", "(", "str", "(", "remote_url", ")", ",", "desired_caps",...
Opens a new application to given Appium server. Capabilities of appium server, Android and iOS, Please check https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/server-args.md | *Option* | *Man.* | *Description* | | remote_url | Yes ...
[ "Opens", "a", "new", "application", "to", "given", "Appium", "server", ".", "Capabilities", "of", "appium", "server", "Android", "and", "iOS", "Please", "check", "https", ":", "//", "github", ".", "com", "/", "appium", "/", "appium", "/", "blob", "/", "m...
python
train
67.5
quora/qcore
qcore/caching.py
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/caching.py#L383-L445
def memoize_with_ttl(ttl_secs=60 * 60 * 24): """Memoizes return values of the decorated function for a given time-to-live. Similar to l0cache, but the cache persists for the duration of the process, unless clear_cache() is called on the function or the time-to-live expires. By default, the time-to-live is ...
[ "def", "memoize_with_ttl", "(", "ttl_secs", "=", "60", "*", "60", "*", "24", ")", ":", "error_msg", "=", "(", "\"Incorrect usage of qcore.caching.memoize_with_ttl: \"", "\"ttl_secs must be a positive integer.\"", ")", "assert_is_instance", "(", "ttl_secs", ",", "six", "...
Memoizes return values of the decorated function for a given time-to-live. Similar to l0cache, but the cache persists for the duration of the process, unless clear_cache() is called on the function or the time-to-live expires. By default, the time-to-live is set to 24 hours.
[ "Memoizes", "return", "values", "of", "the", "decorated", "function", "for", "a", "given", "time", "-", "to", "-", "live", "." ]
python
train
36.68254
Parquery/icontract
icontract/_recompute.py
https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L396-L404
def visit_DictComp(self, node: ast.DictComp) -> Any: """Compile the dictionary comprehension as a function and call it.""" result = self._execute_comprehension(node=node) for generator in node.generators: self.visit(generator.iter) self.recomputed_values[node] = result ...
[ "def", "visit_DictComp", "(", "self", ",", "node", ":", "ast", ".", "DictComp", ")", "->", "Any", ":", "result", "=", "self", ".", "_execute_comprehension", "(", "node", "=", "node", ")", "for", "generator", "in", "node", ".", "generators", ":", "self", ...
Compile the dictionary comprehension as a function and call it.
[ "Compile", "the", "dictionary", "comprehension", "as", "a", "function", "and", "call", "it", "." ]
python
train
36.555556
noahbenson/neuropythy
neuropythy/io/core.py
https://github.com/noahbenson/neuropythy/blob/b588889f6db36ddb9602ae4a72c1c0d3f41586b2/neuropythy/io/core.py#L110-L123
def forget_importer(name): ''' forget_importer(name) yields True if an importer of type name was successfully forgotten from the neuropythy importers list and false otherwise. This function must be called before an importer can be replaced. ''' global importers name = name.lower() if...
[ "def", "forget_importer", "(", "name", ")", ":", "global", "importers", "name", "=", "name", ".", "lower", "(", ")", "if", "name", "in", "importers", ":", "importers", "=", "importers", ".", "discard", "(", "name", ")", "delattr", "(", "load", ",", "na...
forget_importer(name) yields True if an importer of type name was successfully forgotten from the neuropythy importers list and false otherwise. This function must be called before an importer can be replaced.
[ "forget_importer", "(", "name", ")", "yields", "True", "if", "an", "importer", "of", "type", "name", "was", "successfully", "forgotten", "from", "the", "neuropythy", "importers", "list", "and", "false", "otherwise", ".", "This", "function", "must", "be", "call...
python
train
32.071429
jaraco/keyring
keyring/util/platform_.py
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/util/platform_.py#L51-L60
def _config_root_Linux(): """ Use freedesktop.org Base Dir Specfication to determine config location. """ _check_old_config_root() fallback = os.path.expanduser('~/.local/share') key = 'XDG_CONFIG_HOME' root = os.environ.get(key, None) or fallback return os.path.join(root, 'python_ke...
[ "def", "_config_root_Linux", "(", ")", ":", "_check_old_config_root", "(", ")", "fallback", "=", "os", ".", "path", ".", "expanduser", "(", "'~/.local/share'", ")", "key", "=", "'XDG_CONFIG_HOME'", "root", "=", "os", ".", "environ", ".", "get", "(", "key", ...
Use freedesktop.org Base Dir Specfication to determine config location.
[ "Use", "freedesktop", ".", "org", "Base", "Dir", "Specfication", "to", "determine", "config", "location", "." ]
python
valid
31.8
tensorflow/tensor2tensor
tensor2tensor/insights/server.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/insights/server.py#L79-L84
def load_config(self): """Loads the configuration.""" config = dict([(key, value) for key, value in iteritems(self.options) if key in self.cfg.settings and value is not None]) for key, value in iteritems(config): self.cfg.set(key.lower(), value)
[ "def", "load_config", "(", "self", ")", ":", "config", "=", "dict", "(", "[", "(", "key", ",", "value", ")", "for", "key", ",", "value", "in", "iteritems", "(", "self", ".", "options", ")", "if", "key", "in", "self", ".", "cfg", ".", "settings", ...
Loads the configuration.
[ "Loads", "the", "configuration", "." ]
python
train
46.166667
bblfsh/client-python
bblfsh/compat.py
https://github.com/bblfsh/client-python/blob/815835d191d5e385973f3c685849cc3b46aa20a5/bblfsh/compat.py#L230-L237
def properties(self) -> dict: """ Returns the properties of the current node in the iteration. """ if isinstance(self._last_node, dict): return self._last_node.keys() else: return {}
[ "def", "properties", "(", "self", ")", "->", "dict", ":", "if", "isinstance", "(", "self", ".", "_last_node", ",", "dict", ")", ":", "return", "self", ".", "_last_node", ".", "keys", "(", ")", "else", ":", "return", "{", "}" ]
Returns the properties of the current node in the iteration.
[ "Returns", "the", "properties", "of", "the", "current", "node", "in", "the", "iteration", "." ]
python
train
29.875
IBM-Cloud/gp-python-client
gpclient/gpclient.py
https://github.com/IBM-Cloud/gp-python-client/blob/082c6cdc250fb61bea99cba8ac3ee855ee77a410/gpclient/gpclient.py#L335-L348
def __get_bundle_data(self, bundleId): """``GET /{serviceInstanceId}/v2/bundles/{bundleId}`` Gets the bundle's information. """ url = self.__get_base_bundle_url() + '/' + bundleId response = self.__perform_rest_call(requestURL=url) if not response: ...
[ "def", "__get_bundle_data", "(", "self", ",", "bundleId", ")", ":", "url", "=", "self", ".", "__get_base_bundle_url", "(", ")", "+", "'/'", "+", "bundleId", "response", "=", "self", ".", "__perform_rest_call", "(", "requestURL", "=", "url", ")", "if", "not...
``GET /{serviceInstanceId}/v2/bundles/{bundleId}`` Gets the bundle's information.
[ "GET", "/", "{", "serviceInstanceId", "}", "/", "v2", "/", "bundles", "/", "{", "bundleId", "}", "Gets", "the", "bundle", "s", "information", "." ]
python
train
29.428571
edx/edx-enterprise
enterprise/api/v1/serializers.py
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/serializers.py#L694-L707
def validate(self, data): # pylint: disable=arguments-differ """ Validate that at least one of the user identifier fields has been passed in. """ lms_user_id = data.get('lms_user_id') tpa_user_id = data.get('tpa_user_id') user_email = data.get('user_email') if no...
[ "def", "validate", "(", "self", ",", "data", ")", ":", "# pylint: disable=arguments-differ", "lms_user_id", "=", "data", ".", "get", "(", "'lms_user_id'", ")", "tpa_user_id", "=", "data", ".", "get", "(", "'tpa_user_id'", ")", "user_email", "=", "data", ".", ...
Validate that at least one of the user identifier fields has been passed in.
[ "Validate", "that", "at", "least", "one", "of", "the", "user", "identifier", "fields", "has", "been", "passed", "in", "." ]
python
valid
43.5
aeroxis/sultan
src/sultan/result.py
https://github.com/aeroxis/sultan/blob/65b4271a161d6c19a9eb0170b5a95832a139ab7f/src/sultan/result.py#L245-L253
def print_traceback(self, always_print=False): """ Prints the traceback to console - if there is any traceback, otherwise does nothing. :param always_print: print the traceback, even if there is nothing in the buffer (default: false) """ if self._exception or always_print: ...
[ "def", "print_traceback", "(", "self", ",", "always_print", "=", "False", ")", ":", "if", "self", ".", "_exception", "or", "always_print", ":", "self", ".", "__echo", ".", "critical", "(", "\"--{ TRACEBACK }\"", "+", "\"-\"", "*", "100", ")", "self", ".", ...
Prints the traceback to console - if there is any traceback, otherwise does nothing. :param always_print: print the traceback, even if there is nothing in the buffer (default: false)
[ "Prints", "the", "traceback", "to", "console", "-", "if", "there", "is", "any", "traceback", "otherwise", "does", "nothing", ".", ":", "param", "always_print", ":", "print", "the", "traceback", "even", "if", "there", "is", "nothing", "in", "the", "buffer", ...
python
valid
54.333333
yinkaisheng/Python-UIAutomation-for-Windows
uiautomation/uiautomation.py
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4919-L4930
def Zoom(self, zoomLevel: float, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationTransformPattern2::Zoom. Zoom the viewport of the control. zoomLevel: float for int. waitTime: float. Return bool, True if succeed otherwise False. Refer https:/...
[ "def", "Zoom", "(", "self", ",", "zoomLevel", ":", "float", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "ret", "=", "self", ".", "pattern", ".", "Zoom", "(", "zoomLevel", ")", "==", "S_OK", "time", ".", "sleep", ...
Call IUIAutomationTransformPattern2::Zoom. Zoom the viewport of the control. zoomLevel: float for int. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationt...
[ "Call", "IUIAutomationTransformPattern2", "::", "Zoom", ".", "Zoom", "the", "viewport", "of", "the", "control", ".", "zoomLevel", ":", "float", "for", "int", ".", "waitTime", ":", "float", ".", "Return", "bool", "True", "if", "succeed", "otherwise", "False", ...
python
valid
45.166667
numenta/nupic
src/nupic/swarming/hypersearch_v2.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch_v2.py#L1700-L2016
def _getCandidateParticleAndSwarm (self, exhaustedSwarmId=None): """Find or create a candidate particle to produce a new model. At any one time, there is an active set of swarms in the current sprint, where each swarm in the sprint represents a particular combination of fields. Ideally, we should try t...
[ "def", "_getCandidateParticleAndSwarm", "(", "self", ",", "exhaustedSwarmId", "=", "None", ")", ":", "# Cancel search?", "jobCancel", "=", "self", ".", "_cjDAO", ".", "jobGetFields", "(", "self", ".", "_jobID", ",", "[", "'cancel'", "]", ")", "[", "0", "]", ...
Find or create a candidate particle to produce a new model. At any one time, there is an active set of swarms in the current sprint, where each swarm in the sprint represents a particular combination of fields. Ideally, we should try to balance the number of models we have evaluated for each swarm at a...
[ "Find", "or", "create", "a", "candidate", "particle", "to", "produce", "a", "new", "model", "." ]
python
valid
48.091483
zhanglab/psamm
psamm/metabolicmodel.py
https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/metabolicmodel.py#L352-L356
def lower(self): """Lower bound""" if self._reaction in self._view._flipped: return -super(FlipableFluxBounds, self).upper return super(FlipableFluxBounds, self).lower
[ "def", "lower", "(", "self", ")", ":", "if", "self", ".", "_reaction", "in", "self", ".", "_view", ".", "_flipped", ":", "return", "-", "super", "(", "FlipableFluxBounds", ",", "self", ")", ".", "upper", "return", "super", "(", "FlipableFluxBounds", ",",...
Lower bound
[ "Lower", "bound" ]
python
train
39.8
ArduPilot/MAVProxy
MAVProxy/modules/lib/mp_image.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/mp_image.py#L348-L390
def on_redraw_timer(self, event): '''the redraw timer ensures we show new map tiles as they are downloaded''' state = self.state while state.in_queue.qsize(): try: obj = state.in_queue.get() except Exception: time.sleep(0.05) ...
[ "def", "on_redraw_timer", "(", "self", ",", "event", ")", ":", "state", "=", "self", ".", "state", "while", "state", ".", "in_queue", ".", "qsize", "(", ")", ":", "try", ":", "obj", "=", "state", ".", "in_queue", ".", "get", "(", ")", "except", "Ex...
the redraw timer ensures we show new map tiles as they are downloaded
[ "the", "redraw", "timer", "ensures", "we", "show", "new", "map", "tiles", "as", "they", "are", "downloaded" ]
python
train
42.767442
blue-yonder/tsfresh
tsfresh/feature_extraction/feature_calculators.py
https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_extraction/feature_calculators.py#L183-L194
def variance_larger_than_standard_deviation(x): """ Boolean variable denoting if the variance of x is greater than its standard deviation. Is equal to variance of x being larger than 1 :param x: the time series to calculate the feature of :type x: numpy.ndarray :return: the value of this featur...
[ "def", "variance_larger_than_standard_deviation", "(", "x", ")", ":", "y", "=", "np", ".", "var", "(", "x", ")", "return", "y", ">", "np", ".", "sqrt", "(", "y", ")" ]
Boolean variable denoting if the variance of x is greater than its standard deviation. Is equal to variance of x being larger than 1 :param x: the time series to calculate the feature of :type x: numpy.ndarray :return: the value of this feature :return type: bool
[ "Boolean", "variable", "denoting", "if", "the", "variance", "of", "x", "is", "greater", "than", "its", "standard", "deviation", ".", "Is", "equal", "to", "variance", "of", "x", "being", "larger", "than", "1" ]
python
train
32.083333
apache/incubator-heron
heron/common/src/python/pex_loader.py
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/common/src/python/pex_loader.py#L60-L96
def resolve_heron_suffix_issue(abs_pex_path, class_path): """Resolves duplicate package suffix problems When dynamically loading a pex file and a corresponding python class (bolt/spout/topology), if the top level package in which to-be-loaded classes reside is named 'heron', the path conflicts with this Heron ...
[ "def", "resolve_heron_suffix_issue", "(", "abs_pex_path", ",", "class_path", ")", ":", "# import top-level package named `heron` of a given pex file", "importer", "=", "zipimport", ".", "zipimporter", "(", "abs_pex_path", ")", "importer", ".", "load_module", "(", "\"heron\"...
Resolves duplicate package suffix problems When dynamically loading a pex file and a corresponding python class (bolt/spout/topology), if the top level package in which to-be-loaded classes reside is named 'heron', the path conflicts with this Heron Instance pex package (heron.instance.src.python...), making the...
[ "Resolves", "duplicate", "package", "suffix", "problems" ]
python
valid
55.594595
closeio/quotequail
quotequail/_html.py
https://github.com/closeio/quotequail/blob/8a3960c033d595b25a8bbc2c340be898e3065b5f/quotequail/_html.py#L374-L387
def indented_tree_line_generator(el, max_lines=None): """ Like tree_line_generator, but yields tuples (start_ref, end_ref, line), where the line already takes the indentation into account by having "> " prepended. If a line already starts with ">", it is escaped ("\\>"). This makes it possible to re...
[ "def", "indented_tree_line_generator", "(", "el", ",", "max_lines", "=", "None", ")", ":", "gen", "=", "tree_line_generator", "(", "el", ",", "max_lines", ")", "for", "start_ref", ",", "end_ref", ",", "indentation_level", ",", "line", "in", "gen", ":", "# Es...
Like tree_line_generator, but yields tuples (start_ref, end_ref, line), where the line already takes the indentation into account by having "> " prepended. If a line already starts with ">", it is escaped ("\\>"). This makes it possible to reliably use methods that analyze plain text to detect quoting.
[ "Like", "tree_line_generator", "but", "yields", "tuples", "(", "start_ref", "end_ref", "line", ")", "where", "the", "line", "already", "takes", "the", "indentation", "into", "account", "by", "having", ">", "prepended", ".", "If", "a", "line", "already", "start...
python
train
45.357143
resync/resync
resync/mapper.py
https://github.com/resync/resync/blob/98292c17b2c00f2d6f5191c6ab51fef8c292a018/resync/mapper.py#L100-L109
def dst_to_src(self, dst_file): """Map destination path to source URI.""" for map in self.mappings: src_uri = map.dst_to_src(dst_file) if (src_uri is not None): return(src_uri) # Must have failed if loop exited raise MapperError( "Unabl...
[ "def", "dst_to_src", "(", "self", ",", "dst_file", ")", ":", "for", "map", "in", "self", ".", "mappings", ":", "src_uri", "=", "map", ".", "dst_to_src", "(", "dst_file", ")", "if", "(", "src_uri", "is", "not", "None", ")", ":", "return", "(", "src_ur...
Map destination path to source URI.
[ "Map", "destination", "path", "to", "source", "URI", "." ]
python
train
39.6
senaite/senaite.core
bika/lims/upgrade/v01_01_006.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/upgrade/v01_01_006.py#L462-L483
def migrateFileFields(portal): """ This function walks over all attachment types and migrates their FileField fields. """ portal_types = [ "Attachment", "ARImport", "Instrument", "InstrumentCertification", "Method", "Multifile", "Report", ...
[ "def", "migrateFileFields", "(", "portal", ")", ":", "portal_types", "=", "[", "\"Attachment\"", ",", "\"ARImport\"", ",", "\"Instrument\"", ",", "\"InstrumentCertification\"", ",", "\"Method\"", ",", "\"Multifile\"", ",", "\"Report\"", ",", "\"ARReport\"", ",", "\"...
This function walks over all attachment types and migrates their FileField fields.
[ "This", "function", "walks", "over", "all", "attachment", "types", "and", "migrates", "their", "FileField", "fields", "." ]
python
train
23.545455
OLC-Bioinformatics/sipprverse
pointsippr/pointsippr.py
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L345-L403
def write_table_report(summary_dict, seqid, genus): """ Parse the PointFinder table output, and write a summary report :param summary_dict: nested dictionary containing data such as header strings, and paths to reports :param seqid: name of the strain, :param genus: MASH-calculat...
[ "def", "write_table_report", "(", "summary_dict", ",", "seqid", ",", "genus", ")", ":", "# Set the header string if the summary report doesn't already exist", "if", "not", "os", ".", "path", ".", "isfile", "(", "summary_dict", "[", "genus", "]", "[", "'table'", "]",...
Parse the PointFinder table output, and write a summary report :param summary_dict: nested dictionary containing data such as header strings, and paths to reports :param seqid: name of the strain, :param genus: MASH-calculated genus of current isolate
[ "Parse", "the", "PointFinder", "table", "output", "and", "write", "a", "summary", "report", ":", "param", "summary_dict", ":", "nested", "dictionary", "containing", "data", "such", "as", "header", "strings", "and", "paths", "to", "reports", ":", "param", "seqi...
python
train
57.644068
saltstack/salt
salt/states/ipset.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ipset.py#L239-L309
def absent(name, entry=None, entries=None, family='ipv4', **kwargs): ''' .. versionadded:: 2014.7.0 Remove a entry or entries from a chain name A user-defined name to call this entry by in another part of a state or formula. This should not be an actual entry. family Netwo...
[ "def", "absent", "(", "name", ",", "entry", "=", "None", ",", "entries", "=", "None", ",", "family", "=", "'ipv4'", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", ...
.. versionadded:: 2014.7.0 Remove a entry or entries from a chain name A user-defined name to call this entry by in another part of a state or formula. This should not be an actual entry. family Network family, ipv4 or ipv6.
[ "..", "versionadded", "::", "2014", ".", "7", ".", "0" ]
python
train
36.394366
dw/mitogen
mitogen/core.py
https://github.com/dw/mitogen/blob/a7fdb55e1300a7e0a5e404b09eb730cf9a525da7/mitogen/core.py#L2627-L2697
def add_handler(self, fn, handle=None, persist=True, policy=None, respondent=None, overwrite=False): """ Invoke `fn(msg)` on the :class:`Broker` thread for each Message sent to `handle` from this context. Unregister after one invocation if `persist...
[ "def", "add_handler", "(", "self", ",", "fn", ",", "handle", "=", "None", ",", "persist", "=", "True", ",", "policy", "=", "None", ",", "respondent", "=", "None", ",", "overwrite", "=", "False", ")", ":", "handle", "=", "handle", "or", "next", "(", ...
Invoke `fn(msg)` on the :class:`Broker` thread for each Message sent to `handle` from this context. Unregister after one invocation if `persist` is :data:`False`. If `handle` is :data:`None`, a new handle is allocated and returned. :param int handle: If not :data:`None`, an ...
[ "Invoke", "fn", "(", "msg", ")", "on", "the", ":", "class", ":", "Broker", "thread", "for", "each", "Message", "sent", "to", "handle", "from", "this", "context", ".", "Unregister", "after", "one", "invocation", "if", "persist", "is", ":", "data", ":", ...
python
train
45.15493
ungarj/mapchete
mapchete/commons/contours.py
https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/commons/contours.py#L6-L55
def extract_contours(array, tile, interval=100, field='elev', base=0): """ Extract contour lines from an array. Parameters ---------- array : array input elevation data tile : Tile tile covering the array interval : integer elevation value interval when drawing conto...
[ "def", "extract_contours", "(", "array", ",", "tile", ",", "interval", "=", "100", ",", "field", "=", "'elev'", ",", "base", "=", "0", ")", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "levels", "=", "_get_contour_values", "(", "array", ".", ...
Extract contour lines from an array. Parameters ---------- array : array input elevation data tile : Tile tile covering the array interval : integer elevation value interval when drawing contour lines field : string output field name containing elevation value ...
[ "Extract", "contour", "lines", "from", "an", "array", "." ]
python
valid
30.76
MIT-LCP/wfdb-python
wfdb/processing/evaluate.py
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/evaluate.py#L118-L197
def compare(self): """ Main comparison function """ """ Note: Make sure to be able to handle these ref/test scenarios: A: o----o---o---o x-------x----x B: o----o-----o---o x--------x--x--x C: o------o-----o---o ...
[ "def", "compare", "(", "self", ")", ":", "\"\"\"\n Note: Make sure to be able to handle these ref/test scenarios:\n\n A:\n o----o---o---o\n x-------x----x\n\n B:\n o----o-----o---o\n x--------x--x--x\n\n C:\n o------o-----o---o\n x-x-...
Main comparison function
[ "Main", "comparison", "function" ]
python
train
42.75
Azure/azure-sdk-for-python
azure-common/azure/common/credentials.py
https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-common/azure/common/credentials.py#L31-L52
def get_azure_cli_credentials(resource=None, with_tenant=False): """Return Credentials and default SubscriptionID of current loaded profile of the CLI. Credentials will be the "az login" command: https://docs.microsoft.com/cli/azure/authenticate-azure-cli Default subscription ID is either the only one...
[ "def", "get_azure_cli_credentials", "(", "resource", "=", "None", ",", "with_tenant", "=", "False", ")", ":", "profile", "=", "get_cli_profile", "(", ")", "cred", ",", "subscription_id", ",", "tenant_id", "=", "profile", ".", "get_login_credentials", "(", "resou...
Return Credentials and default SubscriptionID of current loaded profile of the CLI. Credentials will be the "az login" command: https://docs.microsoft.com/cli/azure/authenticate-azure-cli Default subscription ID is either the only one you have, or you can define it: https://docs.microsoft.com/cli/azur...
[ "Return", "Credentials", "and", "default", "SubscriptionID", "of", "current", "loaded", "profile", "of", "the", "CLI", "." ]
python
test
43.681818
jasonrbriggs/stomp.py
stomp/transport.py
https://github.com/jasonrbriggs/stomp.py/blob/643843c5fbf25fd24339dd0e69a9411c3d8b94c7/stomp/transport.py#L149-L158
def set_listener(self, name, listener): """ Set a named listener to use with this connection. See :py:class:`stomp.listener.ConnectionListener` :param str name: the name of the listener :param ConnectionListener listener: the listener object """ with self.__liste...
[ "def", "set_listener", "(", "self", ",", "name", ",", "listener", ")", ":", "with", "self", ".", "__listeners_change_condition", ":", "self", ".", "listeners", "[", "name", "]", "=", "listener" ]
Set a named listener to use with this connection. See :py:class:`stomp.listener.ConnectionListener` :param str name: the name of the listener :param ConnectionListener listener: the listener object
[ "Set", "a", "named", "listener", "to", "use", "with", "this", "connection", ".", "See", ":", "py", ":", "class", ":", "stomp", ".", "listener", ".", "ConnectionListener" ]
python
train
37.7
pgmpy/pgmpy
pgmpy/factors/discrete/DiscreteFactor.py
https://github.com/pgmpy/pgmpy/blob/9381a66aba3c3871d3ccd00672b148d17d63239e/pgmpy/factors/discrete/DiscreteFactor.py#L333-L380
def normalize(self, inplace=True): """ Normalizes the values of factor so that they sum to 1. Parameters ---------- inplace: boolean If inplace=True it will modify the factor itself, else would return a new factor Returns ------- ...
[ "def", "normalize", "(", "self", ",", "inplace", "=", "True", ")", ":", "phi", "=", "self", "if", "inplace", "else", "self", ".", "copy", "(", ")", "phi", ".", "values", "=", "phi", ".", "values", "/", "phi", ".", "values", ".", "sum", "(", ")", ...
Normalizes the values of factor so that they sum to 1. Parameters ---------- inplace: boolean If inplace=True it will modify the factor itself, else would return a new factor Returns ------- DiscreteFactor or None: if inplace=True (default) retur...
[ "Normalizes", "the", "values", "of", "factor", "so", "that", "they", "sum", "to", "1", "." ]
python
train
28.270833
AndrewIngram/django-extra-views
extra_views/dates.py
https://github.com/AndrewIngram/django-extra-views/blob/188e1bf1f15a44d9a599028d020083af9fb43ea7/extra_views/dates.py#L80-L90
def get_first_of_week(self): """ Returns an integer representing the first day of the week. 0 represents Monday, 6 represents Sunday. """ if self.first_of_week is None: raise ImproperlyConfigured("%s.first_of_week is required." % self.__class__.__name__) if s...
[ "def", "get_first_of_week", "(", "self", ")", ":", "if", "self", ".", "first_of_week", "is", "None", ":", "raise", "ImproperlyConfigured", "(", "\"%s.first_of_week is required.\"", "%", "self", ".", "__class__", ".", "__name__", ")", "if", "self", ".", "first_of...
Returns an integer representing the first day of the week. 0 represents Monday, 6 represents Sunday.
[ "Returns", "an", "integer", "representing", "the", "first", "day", "of", "the", "week", "." ]
python
valid
45.363636
Toilal/rebulk
rebulk/match.py
https://github.com/Toilal/rebulk/blob/7511a4671f2fd9493e3df1e5177b7656789069e8/rebulk/match.py#L639-L645
def children(self): """ Children matches. """ if self._children is None: self._children = Matches(None, self.input_string) return self._children
[ "def", "children", "(", "self", ")", ":", "if", "self", ".", "_children", "is", "None", ":", "self", ".", "_children", "=", "Matches", "(", "None", ",", "self", ".", "input_string", ")", "return", "self", ".", "_children" ]
Children matches.
[ "Children", "matches", "." ]
python
train
27.142857
tanghaibao/goatools
goatools/grouper/aart_geneproducts_one.py
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/aart_geneproducts_one.py#L68-L72
def str_summaryline(self): """Print: 47 GOs, 262 genes described by 10 of 19 sections consistent_increase.""" return "{N} GOs, {M} genes described by {X} of {Y} sections {NM}".format( N=len(self.go2nt), M=len(self.gene2gos), X=len(self.sec2chr), Y=len(self.datobj.sec2chr), NM=sel...
[ "def", "str_summaryline", "(", "self", ")", ":", "return", "\"{N} GOs, {M} genes described by {X} of {Y} sections {NM}\"", ".", "format", "(", "N", "=", "len", "(", "self", ".", "go2nt", ")", ",", "M", "=", "len", "(", "self", ".", "gene2gos", ")", ",", "X",...
Print: 47 GOs, 262 genes described by 10 of 19 sections consistent_increase.
[ "Print", ":", "47", "GOs", "262", "genes", "described", "by", "10", "of", "19", "sections", "consistent_increase", "." ]
python
train
64.6
MostAwesomeDude/gentleman
gentleman/base.py
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L113-L131
def AddClusterTags(r, tags, dry_run=False): """ Adds tags to the cluster. @type tags: list of str @param tags: tags to add to the cluster @type dry_run: bool @param dry_run: whether to perform a dry run @rtype: int @return: job id """ query = { "dry-run": dry_run, ...
[ "def", "AddClusterTags", "(", "r", ",", "tags", ",", "dry_run", "=", "False", ")", ":", "query", "=", "{", "\"dry-run\"", ":", "dry_run", ",", "\"tag\"", ":", "tags", ",", "}", "return", "r", ".", "request", "(", "\"put\"", ",", "\"/2/tags\"", ",", "...
Adds tags to the cluster. @type tags: list of str @param tags: tags to add to the cluster @type dry_run: bool @param dry_run: whether to perform a dry run @rtype: int @return: job id
[ "Adds", "tags", "to", "the", "cluster", "." ]
python
train
19.842105
CitrineInformatics/python-citrination-client
citrination_client/views/client.py
https://github.com/CitrineInformatics/python-citrination-client/blob/409984fc65ce101a620f069263f155303492465c/citrination_client/views/client.py#L86-L96
def get(self, data_view_id): """ Gets basic information about a view :param data_view_id: Identifier of the data view :return: Metadata about the view as JSON """ failure_message = "Dataview get failed" return self._get_success_json(self._get( 'v1/da...
[ "def", "get", "(", "self", ",", "data_view_id", ")", ":", "failure_message", "=", "\"Dataview get failed\"", "return", "self", ".", "_get_success_json", "(", "self", ".", "_get", "(", "'v1/data_views/'", "+", "data_view_id", ",", "None", ",", "failure_message", ...
Gets basic information about a view :param data_view_id: Identifier of the data view :return: Metadata about the view as JSON
[ "Gets", "basic", "information", "about", "a", "view" ]
python
valid
36.090909
myint/autoflake
autoflake.py
https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L696-L703
def _detect_encoding(readline): """Return file encoding.""" try: from lib2to3.pgen2 import tokenize as lib2to3_tokenize encoding = lib2to3_tokenize.detect_encoding(readline)[0] return encoding except (LookupError, SyntaxError, UnicodeDecodeError): return 'latin-1'
[ "def", "_detect_encoding", "(", "readline", ")", ":", "try", ":", "from", "lib2to3", ".", "pgen2", "import", "tokenize", "as", "lib2to3_tokenize", "encoding", "=", "lib2to3_tokenize", ".", "detect_encoding", "(", "readline", ")", "[", "0", "]", "return", "enco...
Return file encoding.
[ "Return", "file", "encoding", "." ]
python
test
37.625
aiven/pghoard
pghoard/restore.py
https://github.com/aiven/pghoard/blob/2994165d4ef3ff7a5669a2527346bcbfb5b3bd8a/pghoard/restore.py#L194-L199
def list_basebackups(self, arg): """List basebackups from an object store""" self.config = config.read_json_config_file(arg.config, check_commands=False, check_pgdata=False) site = config.get_site_from_config(self.config, arg.site) self.storage = self._get_object_storage(site, pgdata=Non...
[ "def", "list_basebackups", "(", "self", ",", "arg", ")", ":", "self", ".", "config", "=", "config", ".", "read_json_config_file", "(", "arg", ".", "config", ",", "check_commands", "=", "False", ",", "check_pgdata", "=", "False", ")", "site", "=", "config",...
List basebackups from an object store
[ "List", "basebackups", "from", "an", "object", "store" ]
python
train
63.333333
blackecho/Deep-Learning-TensorFlow
yadlt/core/layers.py
https://github.com/blackecho/Deep-Learning-TensorFlow/blob/ddeb1f2848da7b7bee166ad2152b4afc46bb2086/yadlt/core/layers.py#L80-L106
def accuracy(mod_y, ref_y, summary=True, name="accuracy"): """Accuracy computation op. Parameters ---------- mod_y : tf.Tensor Model output tensor. ref_y : tf.Tensor Reference input tensor. summary : bool, optional (default = True) ...
[ "def", "accuracy", "(", "mod_y", ",", "ref_y", ",", "summary", "=", "True", ",", "name", "=", "\"accuracy\"", ")", ":", "with", "tf", ".", "name_scope", "(", "name", ")", ":", "mod_pred", "=", "tf", ".", "argmax", "(", "mod_y", ",", "1", ")", "corr...
Accuracy computation op. Parameters ---------- mod_y : tf.Tensor Model output tensor. ref_y : tf.Tensor Reference input tensor. summary : bool, optional (default = True) Whether to save tf summary for the op. Returns ------...
[ "Accuracy", "computation", "op", "." ]
python
train
27.518519
jtpaasch/simplygithub
simplygithub/files.py
https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/files.py#L115-L144
def add_file_to_tree(tree, file_path, file_contents, is_executable=False): """Add a file to a tree. Args: tree A list of dicts containing info about each blob in a tree. file_path The path of the new file in the tree. file_contents The (UTF-8 encod...
[ "def", "add_file_to_tree", "(", "tree", ",", "file_path", ",", "file_contents", ",", "is_executable", "=", "False", ")", ":", "record", "=", "{", "\"path\"", ":", "file_path", ",", "\"mode\"", ":", "\"100755\"", "if", "is_executable", "else", "\"100644\"", ","...
Add a file to a tree. Args: tree A list of dicts containing info about each blob in a tree. file_path The path of the new file in the tree. file_contents The (UTF-8 encoded) contents of the new file. is_executable If ``True``, the ...
[ "Add", "a", "file", "to", "a", "tree", "." ]
python
train
25.333333
LonamiWebs/Telethon
telethon/tl/custom/inlinebuilder.py
https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/inlinebuilder.py#L59-L108
async def article( self, title, description=None, *, url=None, thumb=None, content=None, id=None, text=None, parse_mode=(), link_preview=True, geo=None, period=60, contact=None, game=False, buttons=None ): """ Creates new inline result of article type....
[ "async", "def", "article", "(", "self", ",", "title", ",", "description", "=", "None", ",", "*", ",", "url", "=", "None", ",", "thumb", "=", "None", ",", "content", "=", "None", ",", "id", "=", "None", ",", "text", "=", "None", ",", "parse_mode", ...
Creates new inline result of article type. Args: title (`str`): The title to be shown for this result. description (`str`, optional): Further explanation of what this result means. url (`str`, optional): The URL to be shown f...
[ "Creates", "new", "inline", "result", "of", "article", "type", "." ]
python
train
34.7
ofw/curlify
curlify.py
https://github.com/ofw/curlify/blob/5a464218431f979ac78d089682d36860b57420ce/curlify.py#L4-L42
def to_curl(request, compressed=False, verify=True): """ Returns string with curl command by provided request object Parameters ---------- compressed : bool If `True` then `--compressed` argument will be added to result """ parts = [ ('curl', None), ('-X', request.me...
[ "def", "to_curl", "(", "request", ",", "compressed", "=", "False", ",", "verify", "=", "True", ")", ":", "parts", "=", "[", "(", "'curl'", ",", "None", ")", ",", "(", "'-X'", ",", "request", ".", "method", ")", ",", "]", "for", "k", ",", "v", "...
Returns string with curl command by provided request object Parameters ---------- compressed : bool If `True` then `--compressed` argument will be added to result
[ "Returns", "string", "with", "curl", "command", "by", "provided", "request", "object" ]
python
train
23.025641
gebn/wood
wood/integrations/s3.py
https://github.com/gebn/wood/blob/efc71879890dbd2f2d7a0b1a65ed22a0843139dd/wood/integrations/s3.py#L16-L77
def objects_to_root(objects: List) -> Root: """ Convert a list of s3 ObjectSummaries into a directory tree. :param objects: The list of objects, e.g. the result of calling `.objects.all()` on a bucket. :return: The tree structure, contained within a root node. """ def _to_t...
[ "def", "objects_to_root", "(", "objects", ":", "List", ")", "->", "Root", ":", "def", "_to_tree", "(", "objs", ":", "Iterable", ")", "->", "Dict", ":", "\"\"\"\n Build a tree structure from a flat list of objects.\n\n :param objs: The raw iterable of S3 `ObjectS...
Convert a list of s3 ObjectSummaries into a directory tree. :param objects: The list of objects, e.g. the result of calling `.objects.all()` on a bucket. :return: The tree structure, contained within a root node.
[ "Convert", "a", "list", "of", "s3", "ObjectSummaries", "into", "a", "directory", "tree", "." ]
python
train
38.580645
galactics/beyond
beyond/frames/iau2010.py
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/iau2010.py#L54-L64
def _earth_orientation(date): """Earth orientation parameters in degrees """ ttt = date.change_scale('TT').julian_century # a_a = 0.12 # a_c = 0.26 # s_prime = -0.0015 * (a_c ** 2 / 1.2 + a_a ** 2) * ttt s_prime = - 0.000047 * ttt return date.eop.x / 3600., date.eop.y / 3600., s_prime ...
[ "def", "_earth_orientation", "(", "date", ")", ":", "ttt", "=", "date", ".", "change_scale", "(", "'TT'", ")", ".", "julian_century", "# a_a = 0.12", "# a_c = 0.26", "# s_prime = -0.0015 * (a_c ** 2 / 1.2 + a_a ** 2) * ttt", "s_prime", "=", "-", "0.000047", "*", "ttt"...
Earth orientation parameters in degrees
[ "Earth", "orientation", "parameters", "in", "degrees" ]
python
train
28.727273
marcomusy/vtkplotter
vtkplotter/addons.py
https://github.com/marcomusy/vtkplotter/blob/692c3396782722ec525bc1346a26999868c650c6/vtkplotter/addons.py#L645-L1012
def addAxes(axtype=None, c=None): """Draw axes on scene. Available axes types: :param int axtype: - 0, no axes, - 1, draw three gray grid walls - 2, show cartesian axes from (0,0,0) - 3, show positive range of cartesian axes from (0,0,0) - 4, show a triad...
[ "def", "addAxes", "(", "axtype", "=", "None", ",", "c", "=", "None", ")", ":", "vp", "=", "settings", ".", "plotter_instance", "if", "axtype", "is", "not", "None", ":", "vp", ".", "axes", "=", "axtype", "# overrride", "r", "=", "vp", ".", "renderers"...
Draw axes on scene. Available axes types: :param int axtype: - 0, no axes, - 1, draw three gray grid walls - 2, show cartesian axes from (0,0,0) - 3, show positive range of cartesian axes from (0,0,0) - 4, show a triad at bottom left - 5, show a cu...
[ "Draw", "axes", "on", "scene", ".", "Available", "axes", "types", ":" ]
python
train
40.244565
gwastro/pycbc
pycbc/pnutils.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/pnutils.py#L642-L645
def _meco_frequency(m1, m2, chi1, chi2): """Returns the frequency of the minimum energy cutoff for 3.5pN (2.5pN spin) """ return velocity_to_frequency(meco_velocity(m1, m2, chi1, chi2), m1+m2)
[ "def", "_meco_frequency", "(", "m1", ",", "m2", ",", "chi1", ",", "chi2", ")", ":", "return", "velocity_to_frequency", "(", "meco_velocity", "(", "m1", ",", "m2", ",", "chi1", ",", "chi2", ")", ",", "m1", "+", "m2", ")" ]
Returns the frequency of the minimum energy cutoff for 3.5pN (2.5pN spin)
[ "Returns", "the", "frequency", "of", "the", "minimum", "energy", "cutoff", "for", "3", ".", "5pN", "(", "2", ".", "5pN", "spin", ")" ]
python
train
50.25
BlueBrain/NeuroM
examples/plot_somas.py
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/examples/plot_somas.py#L48-L54
def plot_somas(somas): '''Plot set of somas on same figure as spheres, each with different color''' _, ax = common.get_figure(new_fig=True, subplot=111, params={'projection': '3d', 'aspect': 'equal'}) for s in somas: common.plot_sphere(ax, s.center, s.radius, color=rand...
[ "def", "plot_somas", "(", "somas", ")", ":", "_", ",", "ax", "=", "common", ".", "get_figure", "(", "new_fig", "=", "True", ",", "subplot", "=", "111", ",", "params", "=", "{", "'projection'", ":", "'3d'", ",", "'aspect'", ":", "'equal'", "}", ")", ...
Plot set of somas on same figure as spheres, each with different color
[ "Plot", "set", "of", "somas", "on", "same", "figure", "as", "spheres", "each", "with", "different", "color" ]
python
train
49.857143
rootpy/rootpy
rootpy/plotting/hist.py
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/hist.py#L777-L806
def underflow(self, axis=0): """ Return the underflow for the given axis. Depending on the dimension of the histogram, may return an array. """ if axis not in range(3): raise ValueError("axis must be 0, 1, or 2") if self.DIM == 1: return self.GetB...
[ "def", "underflow", "(", "self", ",", "axis", "=", "0", ")", ":", "if", "axis", "not", "in", "range", "(", "3", ")", ":", "raise", "ValueError", "(", "\"axis must be 0, 1, or 2\"", ")", "if", "self", ".", "DIM", "==", "1", ":", "return", "self", ".",...
Return the underflow for the given axis. Depending on the dimension of the histogram, may return an array.
[ "Return", "the", "underflow", "for", "the", "given", "axis", "." ]
python
train
34.4
MechanicalSoup/MechanicalSoup
mechanicalsoup/browser.py
https://github.com/MechanicalSoup/MechanicalSoup/blob/027a270febf5bcda6a75db60ea9838d631370f4b/mechanicalsoup/browser.py#L58-L63
def __looks_like_html(response): """Guesses entity type when Content-Type header is missing. Since Content-Type is not strictly required, some servers leave it out. """ text = response.text.lstrip().lower() return text.startswith('<html') or text.startswith('<!doctype')
[ "def", "__looks_like_html", "(", "response", ")", ":", "text", "=", "response", ".", "text", ".", "lstrip", "(", ")", ".", "lower", "(", ")", "return", "text", ".", "startswith", "(", "'<html'", ")", "or", "text", ".", "startswith", "(", "'<!doctype'", ...
Guesses entity type when Content-Type header is missing. Since Content-Type is not strictly required, some servers leave it out.
[ "Guesses", "entity", "type", "when", "Content", "-", "Type", "header", "is", "missing", ".", "Since", "Content", "-", "Type", "is", "not", "strictly", "required", "some", "servers", "leave", "it", "out", "." ]
python
train
50.833333
KnorrFG/pyparadigm
pyparadigm/misc.py
https://github.com/KnorrFG/pyparadigm/blob/69944cdf3ce2f6414ae1aa1d27a0d8c6e5fb3fd3/pyparadigm/misc.py#L135-L160
def process_char(buffer: str, char: str, mappings=_char_mappings): """This is a convinience method for use with EventListener.wait_for_unicode_char(). In most cases it simply appends char to buffer. Some replacements are done because presing return will produce '\\r' but for most cases '\\n' would be ...
[ "def", "process_char", "(", "buffer", ":", "str", ",", "char", ":", "str", ",", "mappings", "=", "_char_mappings", ")", ":", "if", "char", "in", "mappings", ":", "return", "buffer", "+", "mappings", "[", "char", "]", "elif", "char", "==", "\"\\u0008\"", ...
This is a convinience method for use with EventListener.wait_for_unicode_char(). In most cases it simply appends char to buffer. Some replacements are done because presing return will produce '\\r' but for most cases '\\n' would be desireable. Also backspace cant just be added to a string either, ther...
[ "This", "is", "a", "convinience", "method", "for", "use", "with", "EventListener", ".", "wait_for_unicode_char", "()", ".", "In", "most", "cases", "it", "simply", "appends", "char", "to", "buffer", ".", "Some", "replacements", "are", "done", "because", "presin...
python
train
39.884615
django-json-api/django-rest-framework-json-api
rest_framework_json_api/filters.py
https://github.com/django-json-api/django-rest-framework-json-api/blob/de7021f9e011615ce8b65d0cb38227c6c12721b6/rest_framework_json_api/filters.py#L25-L58
def remove_invalid_fields(self, queryset, fields, view, request): """ Extend :py:meth:`rest_framework.filters.OrderingFilter.remove_invalid_fields` to validate that all provided sort fields exist (as contrasted with the super's behavior which is to silently remove invalid fields). ...
[ "def", "remove_invalid_fields", "(", "self", ",", "queryset", ",", "fields", ",", "view", ",", "request", ")", ":", "valid_fields", "=", "[", "item", "[", "0", "]", "for", "item", "in", "self", ".", "get_valid_fields", "(", "queryset", ",", "view", ",", ...
Extend :py:meth:`rest_framework.filters.OrderingFilter.remove_invalid_fields` to validate that all provided sort fields exist (as contrasted with the super's behavior which is to silently remove invalid fields). :raises ValidationError: if a sort field is invalid.
[ "Extend", ":", "py", ":", "meth", ":", "rest_framework", ".", "filters", ".", "OrderingFilter", ".", "remove_invalid_fields", "to", "validate", "that", "all", "provided", "sort", "fields", "exist", "(", "as", "contrasted", "with", "the", "super", "s", "behavio...
python
train
49.823529
saltstack/salt
salt/utils/args.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/args.py#L288-L301
def shlex_split(s, **kwargs): ''' Only split if variable is a string ''' if isinstance(s, six.string_types): # On PY2, shlex.split will fail with unicode types if there are # non-ascii characters in the string. So, we need to make sure we # invoke it with a str type, and then dec...
[ "def", "shlex_split", "(", "s", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "s", ",", "six", ".", "string_types", ")", ":", "# On PY2, shlex.split will fail with unicode types if there are", "# non-ascii characters in the string. So, we need to make sure we"...
Only split if variable is a string
[ "Only", "split", "if", "variable", "is", "a", "string" ]
python
train
36.785714
googleads/googleads-python-lib
googleads/adwords.py
https://github.com/googleads/googleads-python-lib/blob/aa3b1b474b0f9789ca55ca46f4b2b57aeae38874/googleads/adwords.py#L1940-L1951
def StartsWithIgnoreCase(self, value): """Sets the type of the WHERE clause as "starts with ignore case". Args: value: The value to be used in the WHERE condition. Returns: The query builder that this WHERE builder links to. """ self._awql = self._CreateSingleValueCondition(value, ...
[ "def", "StartsWithIgnoreCase", "(", "self", ",", "value", ")", ":", "self", ".", "_awql", "=", "self", ".", "_CreateSingleValueCondition", "(", "value", ",", "'STARTS_WITH_IGNORE_CASE'", ")", "return", "self", ".", "_query_builder" ]
Sets the type of the WHERE clause as "starts with ignore case". Args: value: The value to be used in the WHERE condition. Returns: The query builder that this WHERE builder links to.
[ "Sets", "the", "type", "of", "the", "WHERE", "clause", "as", "starts", "with", "ignore", "case", "." ]
python
train
34.333333
klen/muffin
muffin/app.py
https://github.com/klen/muffin/blob/7bc891e174e08b62d1ae232b5d45f8cd8bc82112/muffin/app.py#L266-L284
def _exc_middleware_factory(app): """Handle exceptions. Route exceptions to handlers if they are registered in application. """ @web.middleware async def middleware(request, handler): try: return await handler(request) except Exception as exc: for cls in typ...
[ "def", "_exc_middleware_factory", "(", "app", ")", ":", "@", "web", ".", "middleware", "async", "def", "middleware", "(", "request", ",", "handler", ")", ":", "try", ":", "return", "await", "handler", "(", "request", ")", "except", "Exception", "as", "exc"...
Handle exceptions. Route exceptions to handlers if they are registered in application.
[ "Handle", "exceptions", "." ]
python
train
29.157895
BenjaminSchubert/NitPycker
nitpycker/result.py
https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L72-L79
def addSuccess(self, test: unittest.case.TestCase) -> None: """ Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save """ # noinspection PyTypeChecker self.add_result(TestState.success, test)
[ "def", "addSuccess", "(", "self", ",", "test", ":", "unittest", ".", "case", ".", "TestCase", ")", "->", "None", ":", "# noinspection PyTypeChecker", "self", ".", "add_result", "(", "TestState", ".", "success", ",", "test", ")" ]
Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save
[ "Transforms", "the", "test", "in", "a", "serializable", "version", "of", "it", "and", "sends", "it", "to", "a", "queue", "for", "further", "analysis" ]
python
train
38.25
modin-project/modin
modin/pandas/base.py
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/base.py#L1643-L1657
def mul(self, other, axis="columns", level=None, fill_value=None): """Multiplies this DataFrame against another DataFrame/Series/scalar. Args: other: The object to use to apply the multiply against this. axis: The axis to multiply over. level: The Multilevel in...
[ "def", "mul", "(", "self", ",", "other", ",", "axis", "=", "\"columns\"", ",", "level", "=", "None", ",", "fill_value", "=", "None", ")", ":", "return", "self", ".", "_binary_op", "(", "\"mul\"", ",", "other", ",", "axis", "=", "axis", ",", "level", ...
Multiplies this DataFrame against another DataFrame/Series/scalar. Args: other: The object to use to apply the multiply against this. axis: The axis to multiply over. level: The Multilevel index level to apply multiply over. fill_value: The value to fill Na...
[ "Multiplies", "this", "DataFrame", "against", "another", "DataFrame", "/", "Series", "/", "scalar", ".", "Args", ":", "other", ":", "The", "object", "to", "use", "to", "apply", "the", "multiply", "against", "this", ".", "axis", ":", "The", "axis", "to", ...
python
train
39.933333
acorg/dark-matter
dark/fasta.py
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fasta.py#L57-L81
def fastaSubtract(fastaFiles): """ Given a list of open file descriptors, each with FASTA content, remove the reads found in the 2nd, 3rd, etc files from the first file in the list. @param fastaFiles: a C{list} of FASTA filenames. @raises IndexError: if passed an empty list. @return: An ite...
[ "def", "fastaSubtract", "(", "fastaFiles", ")", ":", "reads", "=", "{", "}", "firstFile", "=", "fastaFiles", ".", "pop", "(", "0", ")", "for", "seq", "in", "SeqIO", ".", "parse", "(", "firstFile", ",", "'fasta'", ")", ":", "reads", "[", "seq", ".", ...
Given a list of open file descriptors, each with FASTA content, remove the reads found in the 2nd, 3rd, etc files from the first file in the list. @param fastaFiles: a C{list} of FASTA filenames. @raises IndexError: if passed an empty list. @return: An iterator producing C{Bio.SeqRecord} instances ...
[ "Given", "a", "list", "of", "open", "file", "descriptors", "each", "with", "FASTA", "content", "remove", "the", "reads", "found", "in", "the", "2nd", "3rd", "etc", "files", "from", "the", "first", "file", "in", "the", "list", "." ]
python
train
34.48
samuraisam/django-json-rpc
jsonrpc/__init__.py
https://github.com/samuraisam/django-json-rpc/blob/a88d744d960e828f3eb21265da0f10a694b8ebcf/jsonrpc/__init__.py#L69-L117
def _parse_sig(sig, arg_names, validate=False): """ Parses signatures into a ``OrderedDict`` of paramName => type. Numerically-indexed arguments that do not correspond to an argument name in python (ie: it takes a variable number of arguments) will be keyed as the stringified version of it's index. ...
[ "def", "_parse_sig", "(", "sig", ",", "arg_names", ",", "validate", "=", "False", ")", ":", "d", "=", "SIG_RE", ".", "match", "(", "sig", ")", "if", "not", "d", ":", "raise", "ValueError", "(", "'Invalid method signature %s'", "%", "sig", ")", "d", "="...
Parses signatures into a ``OrderedDict`` of paramName => type. Numerically-indexed arguments that do not correspond to an argument name in python (ie: it takes a variable number of arguments) will be keyed as the stringified version of it's index. sig the signature to be parsed arg_name...
[ "Parses", "signatures", "into", "a", "OrderedDict", "of", "paramName", "=", ">", "type", ".", "Numerically", "-", "indexed", "arguments", "that", "do", "not", "correspond", "to", "an", "argument", "name", "in", "python", "(", "ie", ":", "it", "takes", "a",...
python
train
45.857143
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/FS.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/FS.py#L1345-L1355
def File(self, name, directory = None, create = 1): """Look up or create a File node with the specified name. If the name is a relative path (begins with ./, ../, or a file name), then it is looked up relative to the supplied directory node, or to the top level directory of the FS (supp...
[ "def", "File", "(", "self", ",", "name", ",", "directory", "=", "None", ",", "create", "=", "1", ")", ":", "return", "self", ".", "_lookup", "(", "name", ",", "directory", ",", "File", ",", "create", ")" ]
Look up or create a File node with the specified name. If the name is a relative path (begins with ./, ../, or a file name), then it is looked up relative to the supplied directory node, or to the top level directory of the FS (supplied at construction time) if no directory is supplied....
[ "Look", "up", "or", "create", "a", "File", "node", "with", "the", "specified", "name", ".", "If", "the", "name", "is", "a", "relative", "path", "(", "begins", "with", ".", "/", "..", "/", "or", "a", "file", "name", ")", "then", "it", "is", "looked"...
python
train
49.181818
uw-it-aca/uw-restclients-canvas
uw_canvas/admins.py
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/admins.py#L28-L39
def create_admin(self, account_id, user_id, role): """ Flag an existing user as an admin within the account. https://canvas.instructure.com/doc/api/admins.html#method.admins.create """ url = ADMINS_API.format(account_id) body = {"user_id": unquote(str(user_id)), ...
[ "def", "create_admin", "(", "self", ",", "account_id", ",", "user_id", ",", "role", ")", ":", "url", "=", "ADMINS_API", ".", "format", "(", "account_id", ")", "body", "=", "{", "\"user_id\"", ":", "unquote", "(", "str", "(", "user_id", ")", ")", ",", ...
Flag an existing user as an admin within the account. https://canvas.instructure.com/doc/api/admins.html#method.admins.create
[ "Flag", "an", "existing", "user", "as", "an", "admin", "within", "the", "account", "." ]
python
test
36.583333
toomore/grs
grs/best_buy_or_sell.py
https://github.com/toomore/grs/blob/a1285cb57878284a886952968be9e31fbfa595dd/grs/best_buy_or_sell.py#L50-L57
def best_buy_1(self): """ 量大收紅 :rtype: bool """ result = self.data.value[-1] > self.data.value[-2] and \ self.data.price[-1] > self.data.openprice[-1] return result
[ "def", "best_buy_1", "(", "self", ")", ":", "result", "=", "self", ".", "data", ".", "value", "[", "-", "1", "]", ">", "self", ".", "data", ".", "value", "[", "-", "2", "]", "and", "self", ".", "data", ".", "price", "[", "-", "1", "]", ">", ...
量大收紅 :rtype: bool
[ "量大收紅" ]
python
train
27.375
googledatalab/pydatalab
solutionbox/ml_workbench/tensorflow/transform.py
https://github.com/googledatalab/pydatalab/blob/d9031901d5bca22fe0d5925d204e6698df9852e1/solutionbox/ml_workbench/tensorflow/transform.py#L431-L506
def preprocess(pipeline, args): """Transfrom csv data into transfromed tf.example files. Outline: 1) read the input data (as csv or bigquery) into a dict format 2) replace image paths with base64 encoded image files 3) build a csv input string with images paths replaced with base64. This matche...
[ "def", "preprocess", "(", "pipeline", ",", "args", ")", ":", "from", "tensorflow", ".", "python", ".", "lib", ".", "io", "import", "file_io", "from", "trainer", "import", "feature_transforms", "schema", "=", "json", ".", "loads", "(", "file_io", ".", "read...
Transfrom csv data into transfromed tf.example files. Outline: 1) read the input data (as csv or bigquery) into a dict format 2) replace image paths with base64 encoded image files 3) build a csv input string with images paths replaced with base64. This matches the serving csv that a trained mode...
[ "Transfrom", "csv", "data", "into", "transfromed", "tf", ".", "example", "files", "." ]
python
train
39.776316
eumis/pyviews
pyviews/core/observable.py
https://github.com/eumis/pyviews/blob/80a868242ee9cdc6f4ded594b3e0544cc238ed55/pyviews/core/observable.py#L110-L112
def observe_all(self, callback: Callable[[str, Any, Any], None]): """Subscribes to all keys changes""" self._all_callbacks.append(callback)
[ "def", "observe_all", "(", "self", ",", "callback", ":", "Callable", "[", "[", "str", ",", "Any", ",", "Any", "]", ",", "None", "]", ")", ":", "self", ".", "_all_callbacks", ".", "append", "(", "callback", ")" ]
Subscribes to all keys changes
[ "Subscribes", "to", "all", "keys", "changes" ]
python
train
51
allenai/allennlp
allennlp/semparse/domain_languages/domain_language.py
https://github.com/allenai/allennlp/blob/648a36f77db7e45784c047176074f98534c76636/allennlp/semparse/domain_languages/domain_language.py#L496-L539
def _execute_expression(self, expression: Any): """ This does the bulk of the work of executing a logical form, recursively executing a single expression. Basically, if the expression is a function we know about, we evaluate its arguments then call the function. If it's a list, we eval...
[ "def", "_execute_expression", "(", "self", ",", "expression", ":", "Any", ")", ":", "# pylint: disable=too-many-return-statements", "if", "isinstance", "(", "expression", ",", "list", ")", ":", "if", "isinstance", "(", "expression", "[", "0", "]", ",", "list", ...
This does the bulk of the work of executing a logical form, recursively executing a single expression. Basically, if the expression is a function we know about, we evaluate its arguments then call the function. If it's a list, we evaluate all elements of the list. If it's a constant (or a zero...
[ "This", "does", "the", "bulk", "of", "the", "work", "of", "executing", "a", "logical", "form", "recursively", "executing", "a", "single", "expression", ".", "Basically", "if", "the", "expression", "is", "a", "function", "we", "know", "about", "we", "evaluate...
python
train
62.886364
futapi/fut
fut/core.py
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L949-L960
def cardInfo(self, resource_id): """Return card info. :params resource_id: Resource id. """ # TODO: add referer to headers (futweb) base_id = baseId(resource_id) if base_id in self.players: return self.players[base_id] else: # not a player? ...
[ "def", "cardInfo", "(", "self", ",", "resource_id", ")", ":", "# TODO: add referer to headers (futweb)", "base_id", "=", "baseId", "(", "resource_id", ")", "if", "base_id", "in", "self", ".", "players", ":", "return", "self", ".", "players", "[", "base_id", "]...
Return card info. :params resource_id: Resource id.
[ "Return", "card", "info", "." ]
python
valid
35.666667
prompt-toolkit/ptpython
ptpython/history_browser.py
https://github.com/prompt-toolkit/ptpython/blob/b1bba26a491324cd65e0ef46c7b818c4b88fd993/ptpython/history_browser.py#L563-L580
def _default_buffer_pos_changed(self, _): """ When the cursor changes in the default buffer. Synchronize with history buffer. """ # Only when this buffer has the focus. if self.app.current_buffer == self.default_buffer: try: line_no = self.default_buffer.docum...
[ "def", "_default_buffer_pos_changed", "(", "self", ",", "_", ")", ":", "# Only when this buffer has the focus.", "if", "self", ".", "app", ".", "current_buffer", "==", "self", ".", "default_buffer", ":", "try", ":", "line_no", "=", "self", ".", "default_buffer", ...
When the cursor changes in the default buffer. Synchronize with history buffer.
[ "When", "the", "cursor", "changes", "in", "the", "default", "buffer", ".", "Synchronize", "with", "history", "buffer", "." ]
python
train
45.388889
geronimp/graftM
graftm/sequence_searcher.py
https://github.com/geronimp/graftM/blob/c82576517290167f605fd0bc4facd009cee29f48/graftm/sequence_searcher.py#L509-L567
def alignment_correcter(self, alignment_file_list, output_file_name, filter_minimum=None): ''' Remove lower case insertions in alignment outputs from HMM align. Give a list of alignments, and an output file name, and each alignment will be corrected, and writt...
[ "def", "alignment_correcter", "(", "self", ",", "alignment_file_list", ",", "output_file_name", ",", "filter_minimum", "=", "None", ")", ":", "corrected_sequences", "=", "{", "}", "for", "alignment_file", "in", "alignment_file_list", ":", "insert_list", "=", "[", ...
Remove lower case insertions in alignment outputs from HMM align. Give a list of alignments, and an output file name, and each alignment will be corrected, and written to a single file, ready to be placed together using pplacer. Parameters ---------- alignment_file_list ...
[ "Remove", "lower", "case", "insertions", "in", "alignment", "outputs", "from", "HMM", "align", ".", "Give", "a", "list", "of", "alignments", "and", "an", "output", "file", "name", "and", "each", "alignment", "will", "be", "corrected", "and", "written", "to",...
python
train
53.169492
TomasTomecek/sen
sen/util.py
https://github.com/TomasTomecek/sen/blob/239b4868125814e8bf5527708119fc08b35f6cc0/sen/util.py#L60-L81
def humanize_bytes(bytesize, precision=2): """ Humanize byte size figures https://gist.github.com/moird/3684595 """ abbrevs = ( (1 << 50, 'PB'), (1 << 40, 'TB'), (1 << 30, 'GB'), (1 << 20, 'MB'), (1 << 10, 'kB'), (1, 'bytes') ) if bytesize == ...
[ "def", "humanize_bytes", "(", "bytesize", ",", "precision", "=", "2", ")", ":", "abbrevs", "=", "(", "(", "1", "<<", "50", ",", "'PB'", ")", ",", "(", "1", "<<", "40", ",", "'TB'", ")", ",", "(", "1", "<<", "30", ",", "'GB'", ")", ",", "(", ...
Humanize byte size figures https://gist.github.com/moird/3684595
[ "Humanize", "byte", "size", "figures" ]
python
train
23.636364
lowandrew/OLCTools
coreGenome/core.py
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/coreGenome/core.py#L205-L231
def blastparser(self, report, sample, fieldnames): """ Parse the number of core genes present in the strain from the BLAST outputs :param report: the name and path of the BLAST outputs :param sample: the sample object :param fieldnames: type LIST: List of fields used to in BLAST ...
[ "def", "blastparser", "(", "self", ",", "report", ",", "sample", ",", "fieldnames", ")", ":", "try", ":", "# Open the sequence profile file as a dictionary", "blastdict", "=", "DictReader", "(", "open", "(", "report", ")", ",", "fieldnames", "=", "self", ".", ...
Parse the number of core genes present in the strain from the BLAST outputs :param report: the name and path of the BLAST outputs :param sample: the sample object :param fieldnames: type LIST: List of fields used to in BLAST analyses
[ "Parse", "the", "number", "of", "core", "genes", "present", "in", "the", "strain", "from", "the", "BLAST", "outputs", ":", "param", "report", ":", "the", "name", "and", "path", "of", "the", "BLAST", "outputs", ":", "param", "sample", ":", "the", "sample"...
python
train
57.185185
quodlibet/mutagen
mutagen/aac.py
https://github.com/quodlibet/mutagen/blob/e393df5971ba41ba5a50de9c2c9e7e5484d82c4e/mutagen/aac.py#L41-L52
def find_stream(cls, fileobj, max_bytes): """Returns a possibly valid _ADTSStream or None. Args: max_bytes (int): maximum bytes to read """ r = BitReader(fileobj) stream = cls(r) if stream.sync(max_bytes): stream.offset = (r.get_position() - 12) ...
[ "def", "find_stream", "(", "cls", ",", "fileobj", ",", "max_bytes", ")", ":", "r", "=", "BitReader", "(", "fileobj", ")", "stream", "=", "cls", "(", "r", ")", "if", "stream", ".", "sync", "(", "max_bytes", ")", ":", "stream", ".", "offset", "=", "(...
Returns a possibly valid _ADTSStream or None. Args: max_bytes (int): maximum bytes to read
[ "Returns", "a", "possibly", "valid", "_ADTSStream", "or", "None", "." ]
python
train
28.25
wndhydrnt/python-oauth2
oauth2/client_authenticator.py
https://github.com/wndhydrnt/python-oauth2/blob/abe3bf5f27bda2ff737cab387b040e2e6e85c2e2/oauth2/client_authenticator.py#L61-L93
def by_identifier_secret(self, request): """ Authenticates a client by its identifier and secret (aka password). :param request: The incoming request :type request: oauth2.web.Request :return: The identified client :rtype: oauth2.datatype.Client :raises OAuthIn...
[ "def", "by_identifier_secret", "(", "self", ",", "request", ")", ":", "client_id", ",", "client_secret", "=", "self", ".", "source", "(", "request", "=", "request", ")", "try", ":", "client", "=", "self", ".", "client_store", ".", "fetch_by_client_id", "(", ...
Authenticates a client by its identifier and secret (aka password). :param request: The incoming request :type request: oauth2.web.Request :return: The identified client :rtype: oauth2.datatype.Client :raises OAuthInvalidError: If the client could not be found, is not ...
[ "Authenticates", "a", "client", "by", "its", "identifier", "and", "secret", "(", "aka", "password", ")", "." ]
python
train
40.787879