repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
couchbase/couchbase-python-client
couchbase/cluster.py
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/cluster.py#L395-L407
def get_auto_credentials(self, bucket): """ :param bucket: :return: returns a dictionary of credentials for bucket/admin authentication """ result = {k: v(self) for k, v in self.get_unique_creds_dict().items()} if bucket: result.update(self.get_cred_b...
[ "def", "get_auto_credentials", "(", "self", ",", "bucket", ")", ":", "result", "=", "{", "k", ":", "v", "(", "self", ")", "for", "k", ",", "v", "in", "self", ".", "get_unique_creds_dict", "(", ")", ".", "items", "(", ")", "}", "if", "bucket", ":", ...
:param bucket: :return: returns a dictionary of credentials for bucket/admin authentication
[ ":", "param", "bucket", ":", ":", "return", ":", "returns", "a", "dictionary", "of", "credentials", "for", "bucket", "/", "admin", "authentication" ]
python
train
rosenbrockc/ci
pyci/server.py
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L216-L224
def _get_repos(self): """Gets a list of all the installed repositories in this server. """ result = {} for xmlpath in self.installed: repo = RepositorySettings(self, xmlpath) result[repo.name.lower()] = repo return result
[ "def", "_get_repos", "(", "self", ")", ":", "result", "=", "{", "}", "for", "xmlpath", "in", "self", ".", "installed", ":", "repo", "=", "RepositorySettings", "(", "self", ",", "xmlpath", ")", "result", "[", "repo", ".", "name", ".", "lower", "(", ")...
Gets a list of all the installed repositories in this server.
[ "Gets", "a", "list", "of", "all", "the", "installed", "repositories", "in", "this", "server", "." ]
python
train
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L193-L207
def delete_volume(self, volume_name: str): """Removes/stops a docker volume. Only the manager nodes can delete a volume Args: volume_name (string): Name of the volume """ # Raise an exception if we are not a manager if not self._manager: raise Ru...
[ "def", "delete_volume", "(", "self", ",", "volume_name", ":", "str", ")", ":", "# Raise an exception if we are not a manager", "if", "not", "self", ".", "_manager", ":", "raise", "RuntimeError", "(", "'Volumes can only be deleted '", "'on swarm manager nodes'", ")", "# ...
Removes/stops a docker volume. Only the manager nodes can delete a volume Args: volume_name (string): Name of the volume
[ "Removes", "/", "stops", "a", "docker", "volume", "." ]
python
train
spyder-ide/spyder
spyder/plugins/projects/plugin.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L337-L363
def delete_project(self): """ Delete the current project without deleting the files in the directory. """ if self.current_active_project: self.switch_to_plugin() path = self.current_active_project.root_path buttons = QMessageBox.Yes | QMessageBo...
[ "def", "delete_project", "(", "self", ")", ":", "if", "self", ".", "current_active_project", ":", "self", ".", "switch_to_plugin", "(", ")", "path", "=", "self", ".", "current_active_project", ".", "root_path", "buttons", "=", "QMessageBox", ".", "Yes", "|", ...
Delete the current project without deleting the files in the directory.
[ "Delete", "the", "current", "project", "without", "deleting", "the", "files", "in", "the", "directory", "." ]
python
train
Laufire/ec
tools/modules/helpers.py
https://github.com/Laufire/ec/blob/63e84a1daef9234487d7de538e5da233a7d13071/tools/modules/helpers.py#L24-L31
def run(command, **kwargs): """Excecutes the given command while transfering control, till the execution is complete. """ print command p = Popen(shlex.split(command), **kwargs) p.wait() return p.returncode
[ "def", "run", "(", "command", ",", "*", "*", "kwargs", ")", ":", "print", "command", "p", "=", "Popen", "(", "shlex", ".", "split", "(", "command", ")", ",", "*", "*", "kwargs", ")", "p", ".", "wait", "(", ")", "return", "p", ".", "returncode" ]
Excecutes the given command while transfering control, till the execution is complete.
[ "Excecutes", "the", "given", "command", "while", "transfering", "control", "till", "the", "execution", "is", "complete", "." ]
python
train
dwavesystems/penaltymodel
penaltymodel_cache/penaltymodel/cache/database_manager.py
https://github.com/dwavesystems/penaltymodel/blob/b9d343233aea8df0f59cea45a07f12d0b3b8d9b3/penaltymodel_cache/penaltymodel/cache/database_manager.py#L215-L236
def iter_feasible_configurations(cur): """Iterate over all of the sets of feasible configurations in the cache. Args: cur (:class:`sqlite3.Cursor`): An sqlite3 cursor. This function is meant to be run within a :obj:`with` statement. Yields: dict[tuple(int): number]: The feasibl...
[ "def", "iter_feasible_configurations", "(", "cur", ")", ":", "select", "=", "\"\"\"\n SELECT num_variables, feasible_configurations, energies\n FROM feasible_configurations\n \"\"\"", "for", "num_variables", ",", "feasible_configurations", ",", "energies", "in", ...
Iterate over all of the sets of feasible configurations in the cache. Args: cur (:class:`sqlite3.Cursor`): An sqlite3 cursor. This function is meant to be run within a :obj:`with` statement. Yields: dict[tuple(int): number]: The feasible_configurations.
[ "Iterate", "over", "all", "of", "the", "sets", "of", "feasible", "configurations", "in", "the", "cache", "." ]
python
train
wonambi-python/wonambi
wonambi/ioeeg/bci2000.py
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/bci2000.py#L38-L99
def return_hdr(self): """Return the header for further use. Returns ------- subj_id : str subject identification code start_time : datetime start time of the dataset s_freq : float sampling frequency chan_name : list of str ...
[ "def", "return_hdr", "(", "self", ")", ":", "orig", "=", "{", "}", "orig", "=", "_read_header", "(", "self", ".", "filename", ")", "nchan", "=", "int", "(", "orig", "[", "'SourceCh'", "]", ")", "chan_name", "=", "[", "'ch{:03d}'", ".", "format", "(",...
Return the header for further use. Returns ------- subj_id : str subject identification code start_time : datetime start time of the dataset s_freq : float sampling frequency chan_name : list of str list of all the channels...
[ "Return", "the", "header", "for", "further", "use", "." ]
python
train
jaraco/irc
irc/features.py
https://github.com/jaraco/irc/blob/571c1f448d5d5bb92bbe2605c33148bf6e698413/irc/features.py#L44-L47
def load(self, arguments): "Load the values from the a ServerConnection arguments" features = arguments[1:-1] list(map(self.load_feature, features))
[ "def", "load", "(", "self", ",", "arguments", ")", ":", "features", "=", "arguments", "[", "1", ":", "-", "1", "]", "list", "(", "map", "(", "self", ".", "load_feature", ",", "features", ")", ")" ]
Load the values from the a ServerConnection arguments
[ "Load", "the", "values", "from", "the", "a", "ServerConnection", "arguments" ]
python
train
houluy/chessboard
chessboard/__init__.py
https://github.com/houluy/chessboard/blob/b834819d93d71b492f27780a58dfbb3a107d7e85/chessboard/__init__.py#L423-L441
def rotate_board(self, angle, unit='radian'): '''Rotate the chessboard for a specific angle, angle must be integral multiple of pi/2(90 degree)''' if unit == 'angle': angle = angle*math.pi/180 angle %= 2*math.pi if angle not in [0, math.pi/2, math.pi, math.pi*3/2]: ...
[ "def", "rotate_board", "(", "self", ",", "angle", ",", "unit", "=", "'radian'", ")", ":", "if", "unit", "==", "'angle'", ":", "angle", "=", "angle", "*", "math", ".", "pi", "/", "180", "angle", "%=", "2", "*", "math", ".", "pi", "if", "angle", "n...
Rotate the chessboard for a specific angle, angle must be integral multiple of pi/2(90 degree)
[ "Rotate", "the", "chessboard", "for", "a", "specific", "angle", "angle", "must", "be", "integral", "multiple", "of", "pi", "/", "2", "(", "90", "degree", ")" ]
python
train
saltstack/salt
salt/states/service.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/service.py#L858-L1002
def mod_watch(name, sfun=None, sig=None, full_restart=False, init_delay=None, force=False, **kwargs): ''' The service watcher, called to invoke the watch command. When called, it will restart or reload the named service. ...
[ "def", "mod_watch", "(", "name", ",", "sfun", "=", "None", ",", "sig", "=", "None", ",", "full_restart", "=", "False", ",", "init_delay", "=", "None", ",", "force", "=", "False", ",", "*", "*", "kwargs", ")", ":", "reload_", "=", "kwargs", ".", "po...
The service watcher, called to invoke the watch command. When called, it will restart or reload the named service. .. note:: This state exists to support special handling of the ``watch`` :ref:`requisite <requisites>`. It should not be called directly. Parameters for this function shou...
[ "The", "service", "watcher", "called", "to", "invoke", "the", "watch", "command", ".", "When", "called", "it", "will", "restart", "or", "reload", "the", "named", "service", "." ]
python
train
roboogle/gtkmvc3
gtkmvco/gtkmvc3/adapters/default.py
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/adapters/default.py#L131-L146
def search_adapter_info(wid, flavour=None): """Given a widget returns the default tuple found in __def_adapter. @param flavour can be used to specialize the search for a particular tuple. """ t = (type(wid), flavour) if t in __memoize__: return __memoize__[t] for w in __def_adapter...
[ "def", "search_adapter_info", "(", "wid", ",", "flavour", "=", "None", ")", ":", "t", "=", "(", "type", "(", "wid", ")", ",", "flavour", ")", "if", "t", "in", "__memoize__", ":", "return", "__memoize__", "[", "t", "]", "for", "w", "in", "__def_adapte...
Given a widget returns the default tuple found in __def_adapter. @param flavour can be used to specialize the search for a particular tuple.
[ "Given", "a", "widget", "returns", "the", "default", "tuple", "found", "in", "__def_adapter", "." ]
python
train
20c/xbahn
xbahn/connection/__init__.py
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/connection/__init__.py#L320-L327
def listen(url, prefix=None, **kwargs): """ bind and return a connection instance from url arguments: - url (str): xbahn connection url """ return listener(url, prefix=get_prefix(prefix), **kwargs)
[ "def", "listen", "(", "url", ",", "prefix", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "listener", "(", "url", ",", "prefix", "=", "get_prefix", "(", "prefix", ")", ",", "*", "*", "kwargs", ")" ]
bind and return a connection instance from url arguments: - url (str): xbahn connection url
[ "bind", "and", "return", "a", "connection", "instance", "from", "url" ]
python
train
mitsei/dlkit
dlkit/json_/authorization/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authorization/sessions.py#L613-L654
def get_authorizations_by_ids(self, authorization_ids): """Gets an ``AuthorizationList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the authorizations specified in the ``Id`` list, in the order of the list, including duplicates, or an error...
[ "def", "get_authorizations_by_ids", "(", "self", ",", "authorization_ids", ")", ":", "# Implemented from template for", "# osid.resource.ResourceLookupSession.get_resources_by_ids", "# NOTE: This implementation currently ignores plenary view", "collection", "=", "JSONClientValidated", "(...
Gets an ``AuthorizationList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the authorizations specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if an ``Id`` in the supplied list is not found or ...
[ "Gets", "an", "AuthorizationList", "corresponding", "to", "the", "given", "IdList", "." ]
python
train
linkedin/luminol
src/luminol/anomaly_detector.py
https://github.com/linkedin/luminol/blob/42e4ab969b774ff98f902d064cb041556017f635/src/luminol/anomaly_detector.py#L79-L89
def _get_algorithm(self, algorithm_name): """ Get the specific algorithm. :param str algorithm_name: name of the algorithm to use(file name). :return: algorithm object. """ try: algorithm = anomaly_detector_algorithms[algorithm_name] return algorit...
[ "def", "_get_algorithm", "(", "self", ",", "algorithm_name", ")", ":", "try", ":", "algorithm", "=", "anomaly_detector_algorithms", "[", "algorithm_name", "]", "return", "algorithm", "except", "KeyError", ":", "raise", "exceptions", ".", "AlgorithmNotFound", "(", ...
Get the specific algorithm. :param str algorithm_name: name of the algorithm to use(file name). :return: algorithm object.
[ "Get", "the", "specific", "algorithm", ".", ":", "param", "str", "algorithm_name", ":", "name", "of", "the", "algorithm", "to", "use", "(", "file", "name", ")", ".", ":", "return", ":", "algorithm", "object", "." ]
python
train
log2timeline/dfvfs
dfvfs/volume/volume_system.py
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/volume/volume_system.py#L195-L201
def sections(self): """list[VolumeExtent]: sections.""" if not self._is_parsed: self._Parse() self._is_parsed = True return self._sections
[ "def", "sections", "(", "self", ")", ":", "if", "not", "self", ".", "_is_parsed", ":", "self", ".", "_Parse", "(", ")", "self", ".", "_is_parsed", "=", "True", "return", "self", ".", "_sections" ]
list[VolumeExtent]: sections.
[ "list", "[", "VolumeExtent", "]", ":", "sections", "." ]
python
train
MartinThoma/hwrt
hwrt/partitions.py
https://github.com/MartinThoma/hwrt/blob/725c21a3d0f5a30b8492cbc184b3688ceb364e1c/hwrt/partitions.py#L160-L177
def get_top_segmentations(table, n): """ Parameters ---------- table : matrix of probabilities Each cell (i, j) of `table` gives the probability that i and j are in the same symbol. n : int Number of best segmentations which get returned """ stroke_count = list(range(...
[ "def", "get_top_segmentations", "(", "table", ",", "n", ")", ":", "stroke_count", "=", "list", "(", "range", "(", "len", "(", "table", ")", ")", ")", "topf", "=", "TopFinder", "(", "n", ")", "for", "curr_segmentation", "in", "all_segmentations", "(", "st...
Parameters ---------- table : matrix of probabilities Each cell (i, j) of `table` gives the probability that i and j are in the same symbol. n : int Number of best segmentations which get returned
[ "Parameters", "----------", "table", ":", "matrix", "of", "probabilities", "Each", "cell", "(", "i", "j", ")", "of", "table", "gives", "the", "probability", "that", "i", "and", "j", "are", "in", "the", "same", "symbol", ".", "n", ":", "int", "Number", ...
python
train
wonambi-python/wonambi
wonambi/widgets/modal_widgets.py
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/modal_widgets.py#L102-L121
def update_cycles(self): """Enable cycles checkbox only if there are cycles marked, with no errors.""" self.idx_cycle.clear() try: self.cycles = self.parent.notes.annot.get_cycles() except ValueError as err: self.idx_cycle.setEnabled(False) m...
[ "def", "update_cycles", "(", "self", ")", ":", "self", ".", "idx_cycle", ".", "clear", "(", ")", "try", ":", "self", ".", "cycles", "=", "self", ".", "parent", ".", "notes", ".", "annot", ".", "get_cycles", "(", ")", "except", "ValueError", "as", "er...
Enable cycles checkbox only if there are cycles marked, with no errors.
[ "Enable", "cycles", "checkbox", "only", "if", "there", "are", "cycles", "marked", "with", "no", "errors", "." ]
python
train
pypa/pipenv
pipenv/vendor/distlib/database.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L57-L63
def clear(self): """ Clear the cache, setting it to its initial state. """ self.name.clear() self.path.clear() self.generated = False
[ "def", "clear", "(", "self", ")", ":", "self", ".", "name", ".", "clear", "(", ")", "self", ".", "path", ".", "clear", "(", ")", "self", ".", "generated", "=", "False" ]
Clear the cache, setting it to its initial state.
[ "Clear", "the", "cache", "setting", "it", "to", "its", "initial", "state", "." ]
python
train
google/grr
grr/client_builder/grr_response_client_builder/builders/signing.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client_builder/grr_response_client_builder/builders/signing.py#L85-L103
def SignBuffer(self, in_buffer): """Sign a buffer via temp files. Our signing tool can't sign a buffer, so we work around it using temporary files. Args: in_buffer: data to sign Returns: signed data """ precondition.AssertType(in_buffer, bytes) with tempfile.NamedTemporary...
[ "def", "SignBuffer", "(", "self", ",", "in_buffer", ")", ":", "precondition", ".", "AssertType", "(", "in_buffer", ",", "bytes", ")", "with", "tempfile", ".", "NamedTemporaryFile", "(", ")", "as", "temp_in", ":", "temp_in", ".", "write", "(", "in_buffer", ...
Sign a buffer via temp files. Our signing tool can't sign a buffer, so we work around it using temporary files. Args: in_buffer: data to sign Returns: signed data
[ "Sign", "a", "buffer", "via", "temp", "files", "." ]
python
train
Jajcus/pyxmpp2
pyxmpp2/ext/muc/muccore.py
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muccore.py#L157-L186
def set_history(self, parameters): """ Set history parameters. Types: - `parameters`: `HistoryParameters` """ for child in xml_element_iter(self.xmlnode.children): if get_node_ns_uri(child) == MUC_NS and child.name == "history": child.unli...
[ "def", "set_history", "(", "self", ",", "parameters", ")", ":", "for", "child", "in", "xml_element_iter", "(", "self", ".", "xmlnode", ".", "children", ")", ":", "if", "get_node_ns_uri", "(", "child", ")", "==", "MUC_NS", "and", "child", ".", "name", "==...
Set history parameters. Types: - `parameters`: `HistoryParameters`
[ "Set", "history", "parameters", "." ]
python
valid
saltstack/salt
salt/modules/zpool.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zpool.py#L1384-L1435
def offline(zpool, *vdevs, **kwargs): ''' .. versionadded:: 2015.5.0 Ensure that the specified devices are offline .. warning:: By default, the ``OFFLINE`` state is persistent. The device remains offline when the system is rebooted. To temporarily take a device offline, use ``...
[ "def", "offline", "(", "zpool", ",", "*", "vdevs", ",", "*", "*", "kwargs", ")", ":", "## Configure pool", "# NOTE: initialize the defaults", "flags", "=", "[", "]", "target", "=", "[", "]", "# NOTE: set extra config based on kwargs", "if", "kwargs", ".", "get",...
.. versionadded:: 2015.5.0 Ensure that the specified devices are offline .. warning:: By default, the ``OFFLINE`` state is persistent. The device remains offline when the system is rebooted. To temporarily take a device offline, use ``temporary=True``. zpool : string name...
[ "..", "versionadded", "::", "2015", ".", "5", ".", "0" ]
python
train
pyviz/holoviews
holoviews/streams.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/streams.py#L528-L548
def verify(self, x): """ Verify consistency of dataframes that pass through this stream """ if type(x) != type(self.data): raise TypeError("Input expected to be of type %s, got %s." % (type(self.data).__name__, type(x).__name__)) elif isinstance(x, np.ndar...
[ "def", "verify", "(", "self", ",", "x", ")", ":", "if", "type", "(", "x", ")", "!=", "type", "(", "self", ".", "data", ")", ":", "raise", "TypeError", "(", "\"Input expected to be of type %s, got %s.\"", "%", "(", "type", "(", "self", ".", "data", ")",...
Verify consistency of dataframes that pass through this stream
[ "Verify", "consistency", "of", "dataframes", "that", "pass", "through", "this", "stream" ]
python
train
datastax/python-driver
cassandra/metadata.py
https://github.com/datastax/python-driver/blob/30a80d0b798b1f45f8cb77163b1fa791f3e3ca29/cassandra/metadata.py#L264-L291
def rebuild_token_map(self, partitioner, token_map): """ Rebuild our view of the topology from fresh rows from the system topology tables. For internal use only. """ self.partitioner = partitioner if partitioner.endswith('RandomPartitioner'): token_cla...
[ "def", "rebuild_token_map", "(", "self", ",", "partitioner", ",", "token_map", ")", ":", "self", ".", "partitioner", "=", "partitioner", "if", "partitioner", ".", "endswith", "(", "'RandomPartitioner'", ")", ":", "token_class", "=", "MD5Token", "elif", "partitio...
Rebuild our view of the topology from fresh rows from the system topology tables. For internal use only.
[ "Rebuild", "our", "view", "of", "the", "topology", "from", "fresh", "rows", "from", "the", "system", "topology", "tables", ".", "For", "internal", "use", "only", "." ]
python
train
nion-software/nionswift
nion/swift/LineGraphCanvasItem.py
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LineGraphCanvasItem.py#L936-L946
def size_to_content(self): """ Size the canvas item to the proper width. """ new_sizing = self.copy_sizing() new_sizing.minimum_width = 0 new_sizing.maximum_width = 0 axes = self.__axes if axes and axes.is_valid: if axes.y_calibration and axes.y_calibration.un...
[ "def", "size_to_content", "(", "self", ")", ":", "new_sizing", "=", "self", ".", "copy_sizing", "(", ")", "new_sizing", ".", "minimum_width", "=", "0", "new_sizing", ".", "maximum_width", "=", "0", "axes", "=", "self", ".", "__axes", "if", "axes", "and", ...
Size the canvas item to the proper width.
[ "Size", "the", "canvas", "item", "to", "the", "proper", "width", "." ]
python
train
pudo-attic/scrapekit
scrapekit/logs.py
https://github.com/pudo-attic/scrapekit/blob/cfd258120922fcd571430cdf00ba50f3cf18dc15/scrapekit/logs.py#L42-L45
def log_path(scraper): """ Determine the file name for the JSON log. """ return os.path.join(scraper.config.data_path, '%s.jsonlog' % scraper.name)
[ "def", "log_path", "(", "scraper", ")", ":", "return", "os", ".", "path", ".", "join", "(", "scraper", ".", "config", ".", "data_path", ",", "'%s.jsonlog'", "%", "scraper", ".", "name", ")" ]
Determine the file name for the JSON log.
[ "Determine", "the", "file", "name", "for", "the", "JSON", "log", "." ]
python
train
ray-project/ray
python/ray/tune/schedulers/hyperband.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L199-L207
def on_trial_remove(self, trial_runner, trial): """Notification when trial terminates. Trial info is removed from bracket. Triggers halving if bracket is not finished.""" bracket, _ = self._trial_info[trial] bracket.cleanup_trial(trial) if not bracket.finished(): ...
[ "def", "on_trial_remove", "(", "self", ",", "trial_runner", ",", "trial", ")", ":", "bracket", ",", "_", "=", "self", ".", "_trial_info", "[", "trial", "]", "bracket", ".", "cleanup_trial", "(", "trial", ")", "if", "not", "bracket", ".", "finished", "(",...
Notification when trial terminates. Trial info is removed from bracket. Triggers halving if bracket is not finished.
[ "Notification", "when", "trial", "terminates", "." ]
python
train
kensho-technologies/graphql-compiler
graphql_compiler/compiler/filters.py
https://github.com/kensho-technologies/graphql-compiler/blob/f6079c6d10f64932f6b3af309b79bcea2123ca8f/graphql_compiler/compiler/filters.py#L546-L561
def _get_filter_op_name_and_values(directive): """Extract the (op_name, operator_params) tuple from a directive object.""" args = get_uniquely_named_objects_by_name(directive.arguments) if 'op_name' not in args: raise AssertionError(u'op_name not found in filter directive arguments!' ...
[ "def", "_get_filter_op_name_and_values", "(", "directive", ")", ":", "args", "=", "get_uniquely_named_objects_by_name", "(", "directive", ".", "arguments", ")", "if", "'op_name'", "not", "in", "args", ":", "raise", "AssertionError", "(", "u'op_name not found in filter d...
Extract the (op_name, operator_params) tuple from a directive object.
[ "Extract", "the", "(", "op_name", "operator_params", ")", "tuple", "from", "a", "directive", "object", "." ]
python
train
Alignak-monitoring/alignak
alignak/objects/host.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/host.py#L304-L317
def fill_predictive_missing_parameters(self): """Fill address with host_name if not already set and define state with initial_state :return: None """ if hasattr(self, 'host_name') and not hasattr(self, 'address'): self.address = self.host_name if hasattr(self...
[ "def", "fill_predictive_missing_parameters", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'host_name'", ")", "and", "not", "hasattr", "(", "self", ",", "'address'", ")", ":", "self", ".", "address", "=", "self", ".", "host_name", "if", "hasat...
Fill address with host_name if not already set and define state with initial_state :return: None
[ "Fill", "address", "with", "host_name", "if", "not", "already", "set", "and", "define", "state", "with", "initial_state" ]
python
train
jazzband/django-axes
axes/helpers.py
https://github.com/jazzband/django-axes/blob/3e215a174030e43e7ab8c2a79c395eb0eeddc667/axes/helpers.py#L106-L134
def get_client_username(request: AxesHttpRequest, credentials: dict = None) -> str: """ Resolve client username from the given request or credentials if supplied. The order of preference for fetching the username is as follows: 1. If configured, use ``AXES_USERNAME_CALLABLE``, and supply ``request, cr...
[ "def", "get_client_username", "(", "request", ":", "AxesHttpRequest", ",", "credentials", ":", "dict", "=", "None", ")", "->", "str", ":", "if", "settings", ".", "AXES_USERNAME_CALLABLE", ":", "log", ".", "debug", "(", "'Using settings.AXES_USERNAME_CALLABLE to get ...
Resolve client username from the given request or credentials if supplied. The order of preference for fetching the username is as follows: 1. If configured, use ``AXES_USERNAME_CALLABLE``, and supply ``request, credentials`` as arguments 2. If given, use ``credentials`` and fetch username from ``AXES_USE...
[ "Resolve", "client", "username", "from", "the", "given", "request", "or", "credentials", "if", "supplied", "." ]
python
train
alorence/pysvg-py3
pysvg/turtle.py
https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/turtle.py#L187-L193
def getXML(self): """Retrieves the pysvg elements that make up the turtles path and returns them as String in an xml representation. """ s = '' for element in self._svgElements: s += element.getXML() return s
[ "def", "getXML", "(", "self", ")", ":", "s", "=", "''", "for", "element", "in", "self", ".", "_svgElements", ":", "s", "+=", "element", ".", "getXML", "(", ")", "return", "s" ]
Retrieves the pysvg elements that make up the turtles path and returns them as String in an xml representation.
[ "Retrieves", "the", "pysvg", "elements", "that", "make", "up", "the", "turtles", "path", "and", "returns", "them", "as", "String", "in", "an", "xml", "representation", "." ]
python
train
willprice/python-omxplayer-wrapper
omxplayer/player.py
https://github.com/willprice/python-omxplayer-wrapper/blob/f242cb391f0fd07be2d9211c13ebe72fbc628fa3/omxplayer/player.py#L618-L629
def set_video_pos(self, x1, y1, x2, y2): """ Set the video position on the screen Args: x1 (int): Top left x coordinate (px) y1 (int): Top left y coordinate (px) x2 (int): Bottom right x coordinate (px) y2 (int): Bottom right y coordinate (px) ...
[ "def", "set_video_pos", "(", "self", ",", "x1", ",", "y1", ",", "x2", ",", "y2", ")", ":", "position", "=", "\"%s %s %s %s\"", "%", "(", "str", "(", "x1", ")", ",", "str", "(", "y1", ")", ",", "str", "(", "x2", ")", ",", "str", "(", "y2", ")"...
Set the video position on the screen Args: x1 (int): Top left x coordinate (px) y1 (int): Top left y coordinate (px) x2 (int): Bottom right x coordinate (px) y2 (int): Bottom right y coordinate (px)
[ "Set", "the", "video", "position", "on", "the", "screen" ]
python
valid
saltstack/salt
salt/master.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L1130-L1141
def run(self): ''' Start a Master Worker ''' salt.utils.process.appendproctitle(self.name) self.clear_funcs = ClearFuncs( self.opts, self.key, ) self.aes_funcs = AESFuncs(self.opts) salt.utils.crypt.reinit_crypto() self.__b...
[ "def", "run", "(", "self", ")", ":", "salt", ".", "utils", ".", "process", ".", "appendproctitle", "(", "self", ".", "name", ")", "self", ".", "clear_funcs", "=", "ClearFuncs", "(", "self", ".", "opts", ",", "self", ".", "key", ",", ")", "self", "....
Start a Master Worker
[ "Start", "a", "Master", "Worker" ]
python
train
Arubacloud/pyArubaCloud
ArubaCloud/base/__init__.py
https://github.com/Arubacloud/pyArubaCloud/blob/ec4aecd8ca342b1e1a4f16b7cc87cb5e697cfcd4/ArubaCloud/base/__init__.py#L95-L114
def _commit(self): """ :return: (dict) Response object content """ assert self.uri is not None, Exception("BadArgument: uri property cannot be None") url = '{}/{}'.format(self.uri, self.__class__.__name__) serialized_json = jsonpickle.encode(self, unpicklable=False, ) ...
[ "def", "_commit", "(", "self", ")", ":", "assert", "self", ".", "uri", "is", "not", "None", ",", "Exception", "(", "\"BadArgument: uri property cannot be None\"", ")", "url", "=", "'{}/{}'", ".", "format", "(", "self", ".", "uri", ",", "self", ".", "__clas...
:return: (dict) Response object content
[ ":", "return", ":", "(", "dict", ")", "Response", "object", "content" ]
python
train
TrafficSenseMSD/SumoTools
traci/_vehicle.py
https://github.com/TrafficSenseMSD/SumoTools/blob/8607b4f885f1d1798e43240be643efe6dccccdaa/traci/_vehicle.py#L1185-L1201
def add(self, vehID, routeID, depart=tc.DEPARTFLAG_NOW, pos=0, speed=0, lane=tc.DEPARTFLAG_LANE_FIRST_ALLOWED, typeID="DEFAULT_VEHTYPE"): """ Add a new vehicle (old style) """ self._connection._beginMessage(tc.CMD_SET_VEHICLE_VARIABLE, tc.ADD, vehID, ...
[ "def", "add", "(", "self", ",", "vehID", ",", "routeID", ",", "depart", "=", "tc", ".", "DEPARTFLAG_NOW", ",", "pos", "=", "0", ",", "speed", "=", "0", ",", "lane", "=", "tc", ".", "DEPARTFLAG_LANE_FIRST_ALLOWED", ",", "typeID", "=", "\"DEFAULT_VEHTYPE\"...
Add a new vehicle (old style)
[ "Add", "a", "new", "vehicle", "(", "old", "style", ")" ]
python
train
drhagen/parsita
parsita/state.py
https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/state.py#L298-L330
def merge(self, status: 'Status[Input, Output]') -> 'Status[Input, Output]': """Merge the failure message from another status into this one. Whichever status represents parsing that has gone the farthest is retained. If both statuses have gone the same distance, then the expected values...
[ "def", "merge", "(", "self", ",", "status", ":", "'Status[Input, Output]'", ")", "->", "'Status[Input, Output]'", ":", "if", "status", "is", "None", "or", "status", ".", "farthest", "is", "None", ":", "# No new message; simply return unchanged", "pass", "elif", "s...
Merge the failure message from another status into this one. Whichever status represents parsing that has gone the farthest is retained. If both statuses have gone the same distance, then the expected values from both are retained. Args: status: The status to merge into thi...
[ "Merge", "the", "failure", "message", "from", "another", "status", "into", "this", "one", "." ]
python
test
rosenbrockc/fortpy
fortpy/serialize.py
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/serialize.py#L147-L153
def _cache_directory(self): """Returns the full path to the cache directory as specified in settings. """ if settings.unit_testing_mode or settings.use_test_cache: return os.path.join(settings.cache_directory.replace("Fortpy", "Fortpy_Testing"), self.py_tag) else: ...
[ "def", "_cache_directory", "(", "self", ")", ":", "if", "settings", ".", "unit_testing_mode", "or", "settings", ".", "use_test_cache", ":", "return", "os", ".", "path", ".", "join", "(", "settings", ".", "cache_directory", ".", "replace", "(", "\"Fortpy\"", ...
Returns the full path to the cache directory as specified in settings.
[ "Returns", "the", "full", "path", "to", "the", "cache", "directory", "as", "specified", "in", "settings", "." ]
python
train
santosjorge/cufflinks
cufflinks/pandastools.py
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/pandastools.py#L6-L29
def _screen(self,include=True,**kwargs): """ Filters a DataFrame for columns that contain the given strings. Parameters: ----------- include : bool If False then it will exclude items that match the given filters. This is the same as passing a regex ^keyword kwargs : Key value pairs that indicate...
[ "def", "_screen", "(", "self", ",", "include", "=", "True", ",", "*", "*", "kwargs", ")", ":", "df", "=", "self", ".", "copy", "(", ")", "for", "k", ",", "v", "in", "list", "(", "kwargs", ".", "items", "(", ")", ")", ":", "v", "=", "[", "v"...
Filters a DataFrame for columns that contain the given strings. Parameters: ----------- include : bool If False then it will exclude items that match the given filters. This is the same as passing a regex ^keyword kwargs : Key value pairs that indicate the column and value to screen for Examp...
[ "Filters", "a", "DataFrame", "for", "columns", "that", "contain", "the", "given", "strings", ".", "Parameters", ":", "-----------", "include", ":", "bool", "If", "False", "then", "it", "will", "exclude", "items", "that", "match", "the", "given", "filters", "...
python
train
jupyterhub/nullauthenticator
examples/token-only/login-service.py
https://github.com/jupyterhub/nullauthenticator/blob/155a44f85cf4474a5ecf7fa74bc6834f1f04393d/examples/token-only/login-service.py#L38-L42
async def delete_user(name): """Stop a user's server and delete the user""" app_log.info("Deleting user %s", name) await api_request('users/{}/server'.format(name), method='DELETE') await api_request('users/{}'.format(name), method='DELETE')
[ "async", "def", "delete_user", "(", "name", ")", ":", "app_log", ".", "info", "(", "\"Deleting user %s\"", ",", "name", ")", "await", "api_request", "(", "'users/{}/server'", ".", "format", "(", "name", ")", ",", "method", "=", "'DELETE'", ")", "await", "a...
Stop a user's server and delete the user
[ "Stop", "a", "user", "s", "server", "and", "delete", "the", "user" ]
python
train
SatelliteQE/nailgun
nailgun/entity_mixins.py
https://github.com/SatelliteQE/nailgun/blob/c36d8c20862e87bf6975bd48ac1ca40a9e634eaa/nailgun/entity_mixins.py#L898-L919
def create_raw(self, create_missing=None): """Create an entity. Possibly call :meth:`create_missing`. Then make an HTTP POST call to ``self.path('base')``. The request payload consists of whatever is returned by :meth:`create_payload`. Return the response. :param create_missing...
[ "def", "create_raw", "(", "self", ",", "create_missing", "=", "None", ")", ":", "if", "create_missing", "is", "None", ":", "create_missing", "=", "CREATE_MISSING", "if", "create_missing", "is", "True", ":", "self", ".", "create_missing", "(", ")", "return", ...
Create an entity. Possibly call :meth:`create_missing`. Then make an HTTP POST call to ``self.path('base')``. The request payload consists of whatever is returned by :meth:`create_payload`. Return the response. :param create_missing: Should :meth:`create_missing` be called? In ...
[ "Create", "an", "entity", "." ]
python
train
fprimex/zdesk
zdesk/zdesk_api.py
https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4438-L4442
def visitor_update(self, visitor_id, data, **kwargs): "https://developer.zendesk.com/rest_api/docs/chat/visitors#update-visitor" api_path = "/api/v2/visitors/{visitor_id}" api_path = api_path.format(visitor_id=visitor_id) return self.call(api_path, method="PUT", data=data, **kwargs)
[ "def", "visitor_update", "(", "self", ",", "visitor_id", ",", "data", ",", "*", "*", "kwargs", ")", ":", "api_path", "=", "\"/api/v2/visitors/{visitor_id}\"", "api_path", "=", "api_path", ".", "format", "(", "visitor_id", "=", "visitor_id", ")", "return", "sel...
https://developer.zendesk.com/rest_api/docs/chat/visitors#update-visitor
[ "https", ":", "//", "developer", ".", "zendesk", ".", "com", "/", "rest_api", "/", "docs", "/", "chat", "/", "visitors#update", "-", "visitor" ]
python
train
klahnakoski/pyLibrary
mo_dots/__init__.py
https://github.com/klahnakoski/pyLibrary/blob/fa2dcbc48fda8d26999baef400e9a98149e0b982/mo_dots/__init__.py#L121-L126
def join_field(path): """ RETURN field SEQUENCE AS STRING """ output = ".".join([f.replace(".", "\\.") for f in path if f != None]) return output if output else "."
[ "def", "join_field", "(", "path", ")", ":", "output", "=", "\".\"", ".", "join", "(", "[", "f", ".", "replace", "(", "\".\"", ",", "\"\\\\.\"", ")", "for", "f", "in", "path", "if", "f", "!=", "None", "]", ")", "return", "output", "if", "output", ...
RETURN field SEQUENCE AS STRING
[ "RETURN", "field", "SEQUENCE", "AS", "STRING" ]
python
train
Azure/azure-kusto-python
azure-kusto-ingest/azure/kusto/ingest/_ingest_client.py
https://github.com/Azure/azure-kusto-python/blob/92466a2ae175d6353d1dee3496a02517b2a71a86/azure-kusto-ingest/azure/kusto/ingest/_ingest_client.py#L32-L69
def ingest_from_dataframe(self, df, ingestion_properties): """Enqueuing an ingest command from local files. :param pandas.DataFrame df: input dataframe to ingest. :param azure.kusto.ingest.IngestionProperties ingestion_properties: Ingestion properties. """ from pandas i...
[ "def", "ingest_from_dataframe", "(", "self", ",", "df", ",", "ingestion_properties", ")", ":", "from", "pandas", "import", "DataFrame", "if", "not", "isinstance", "(", "df", ",", "DataFrame", ")", ":", "raise", "ValueError", "(", "\"Expected DataFrame instance, fo...
Enqueuing an ingest command from local files. :param pandas.DataFrame df: input dataframe to ingest. :param azure.kusto.ingest.IngestionProperties ingestion_properties: Ingestion properties.
[ "Enqueuing", "an", "ingest", "command", "from", "local", "files", ".", ":", "param", "pandas", ".", "DataFrame", "df", ":", "input", "dataframe", "to", "ingest", ".", ":", "param", "azure", ".", "kusto", ".", "ingest", ".", "IngestionProperties", "ingestion_...
python
train
sjwood/pydvdid
pydvdid/functions.py
https://github.com/sjwood/pydvdid/blob/03914fb7e24283c445e5af724f9d919b23caaf95/pydvdid/functions.py#L161-L180
def _get_first_64k_content(file_path): """Returns the first 65536 (or the file size, whichever is smaller) bytes of the file at the specified file path, as a bytearray. """ if not isfile(file_path): raise PathDoesNotExistException(file_path) file_size = getsize(file_path) content_s...
[ "def", "_get_first_64k_content", "(", "file_path", ")", ":", "if", "not", "isfile", "(", "file_path", ")", ":", "raise", "PathDoesNotExistException", "(", "file_path", ")", "file_size", "=", "getsize", "(", "file_path", ")", "content_size", "=", "min", "(", "f...
Returns the first 65536 (or the file size, whichever is smaller) bytes of the file at the specified file path, as a bytearray.
[ "Returns", "the", "first", "65536", "(", "or", "the", "file", "size", "whichever", "is", "smaller", ")", "bytes", "of", "the", "file", "at", "the", "specified", "file", "path", "as", "a", "bytearray", "." ]
python
train
acoomans/flask-autodoc
flask_autodoc/autodoc.py
https://github.com/acoomans/flask-autodoc/blob/6c77c8935b71fbf3243b5e589c5c255d0299d853/flask_autodoc/autodoc.py#L168-L194
def html(self, groups='all', template=None, **context): """Return an html string of the routes specified by the doc() method A template can be specified. A list of routes is available under the 'autodoc' value (refer to the documentation for the generate() for a description of available...
[ "def", "html", "(", "self", ",", "groups", "=", "'all'", ",", "template", "=", "None", ",", "*", "*", "context", ")", ":", "context", "[", "'autodoc'", "]", "=", "context", "[", "'autodoc'", "]", "if", "'autodoc'", "in", "context", "else", "self", "....
Return an html string of the routes specified by the doc() method A template can be specified. A list of routes is available under the 'autodoc' value (refer to the documentation for the generate() for a description of available values). If no template is specified, a default template i...
[ "Return", "an", "html", "string", "of", "the", "routes", "specified", "by", "the", "doc", "()", "method" ]
python
train
chimera0/accel-brain-code
Reinforcement-Learning/demo/demo_maze_multi_agent_deep_q_network.py
https://github.com/chimera0/accel-brain-code/blob/03661f6f544bed656269fcd4b3c23c9061629daa/Reinforcement-Learning/demo/demo_maze_multi_agent_deep_q_network.py#L73-L128
def inference(self, state_arr, limit=1000): ''' Infernce. Args: state_arr: `np.ndarray` of state. limit: The number of inferencing. Returns: `list of `np.ndarray` of an optimal route. ''' self.__inferencing_f...
[ "def", "inference", "(", "self", ",", "state_arr", ",", "limit", "=", "1000", ")", ":", "self", ".", "__inferencing_flag", "=", "True", "agent_x", ",", "agent_y", "=", "np", ".", "where", "(", "state_arr", "[", "0", "]", "==", "1", ")", "agent_x", ",...
Infernce. Args: state_arr: `np.ndarray` of state. limit: The number of inferencing. Returns: `list of `np.ndarray` of an optimal route.
[ "Infernce", ".", "Args", ":", "state_arr", ":", "np", ".", "ndarray", "of", "state", ".", "limit", ":", "The", "number", "of", "inferencing", ".", "Returns", ":", "list", "of", "np", ".", "ndarray", "of", "an", "optimal", "route", "." ]
python
train
tonyfischetti/sake
sakelib/acts.py
https://github.com/tonyfischetti/sake/blob/b7ad20fe8e7137db99a20ac06b8da26492601b00/sakelib/acts.py#L626-L675
def visualize(G, settings, filename="dependencies", no_graphviz=False): """ Uses networkX to draw a graphviz dot file either (a) calls the graphviz command "dot" to turn it into a SVG and remove the dotfile (default), or (b) if no_graphviz is True, just output the graphviz dot file Args: ...
[ "def", "visualize", "(", "G", ",", "settings", ",", "filename", "=", "\"dependencies\"", ",", "no_graphviz", "=", "False", ")", ":", "error", "=", "settings", "[", "\"error\"", "]", "if", "no_graphviz", ":", "write_dot_file", "(", "G", ",", "filename", ")"...
Uses networkX to draw a graphviz dot file either (a) calls the graphviz command "dot" to turn it into a SVG and remove the dotfile (default), or (b) if no_graphviz is True, just output the graphviz dot file Args: a NetworkX DiGraph the settings dictionary a filename (a default i...
[ "Uses", "networkX", "to", "draw", "a", "graphviz", "dot", "file", "either", "(", "a", ")", "calls", "the", "graphviz", "command", "dot", "to", "turn", "it", "into", "a", "SVG", "and", "remove", "the", "dotfile", "(", "default", ")", "or", "(", "b", "...
python
valid
biocore/burrito-fillings
bfillings/bwa.py
https://github.com/biocore/burrito-fillings/blob/02ab71a46119b40793bd56a4ae00ca15f6dc3329/bfillings/bwa.py#L243-L273
def _get_result_paths(self, data): """Gets the results for a run of bwa index. bwa index outputs 5 files when the index is created. The filename prefix will be the same as the input fasta, unless overridden with the -p option, and the 5 extensions are listed below: .amb ...
[ "def", "_get_result_paths", "(", "self", ",", "data", ")", ":", "# determine the names of the files. The name will be the same as the", "# input fasta file unless overridden with the -p option", "if", "self", ".", "Parameters", "[", "'-p'", "]", ".", "isOn", "(", ")", ":", ...
Gets the results for a run of bwa index. bwa index outputs 5 files when the index is created. The filename prefix will be the same as the input fasta, unless overridden with the -p option, and the 5 extensions are listed below: .amb .ann .bwt .pac .sa ...
[ "Gets", "the", "results", "for", "a", "run", "of", "bwa", "index", "." ]
python
train
saltstack/salt
salt/states/kubernetes.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kubernetes.py#L595-L634
def configmap_absent(name, namespace='default', **kwargs): ''' Ensures that the named configmap is absent from the given namespace. name The name of the configmap namespace The namespace holding the configmap. The 'default' one is going to be used unless a different one is spec...
[ "def", "configmap_absent", "(", "name", ",", "namespace", "=", "'default'", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "False", ",", "'comment'", ":", "''", "}", ...
Ensures that the named configmap is absent from the given namespace. name The name of the configmap namespace The namespace holding the configmap. The 'default' one is going to be used unless a different one is specified.
[ "Ensures", "that", "the", "named", "configmap", "is", "absent", "from", "the", "given", "namespace", "." ]
python
train
DerMitch/fritzbox-smarthome
fritzhome/fritz.py
https://github.com/DerMitch/fritzbox-smarthome/blob/84cbd7c1b33e6256add041b0395ff5fccc01f103/fritzhome/fritz.py#L213-L268
def get_consumption(self, deviceid, timerange="10"): """ Return all available energy consumption data for the device. You need to divice watt_values by 100 and volt_values by 1000 to get the "real" values. :return: dict """ tranges = ("10", "24h", "month", "year"...
[ "def", "get_consumption", "(", "self", ",", "deviceid", ",", "timerange", "=", "\"10\"", ")", ":", "tranges", "=", "(", "\"10\"", ",", "\"24h\"", ",", "\"month\"", ",", "\"year\"", ")", "if", "timerange", "not", "in", "tranges", ":", "raise", "ValueError",...
Return all available energy consumption data for the device. You need to divice watt_values by 100 and volt_values by 1000 to get the "real" values. :return: dict
[ "Return", "all", "available", "energy", "consumption", "data", "for", "the", "device", ".", "You", "need", "to", "divice", "watt_values", "by", "100", "and", "volt_values", "by", "1000", "to", "get", "the", "real", "values", "." ]
python
train
hanguokai/youku
youku/youku_videos.py
https://github.com/hanguokai/youku/blob/b2df060c7dccfad990bcfa289fff68bb77d1e69b/youku/youku_videos.py#L71-L83
def find_video_details_by_ids(self, video_ids, ext=None): """doc: http://open.youku.com/docs/doc?id=47 """ url = 'https://openapi.youku.com/v2/videos/show_batch.json' params = { 'client_id': self.client_id, 'video_ids': video_ids } if ext: ...
[ "def", "find_video_details_by_ids", "(", "self", ",", "video_ids", ",", "ext", "=", "None", ")", ":", "url", "=", "'https://openapi.youku.com/v2/videos/show_batch.json'", "params", "=", "{", "'client_id'", ":", "self", ".", "client_id", ",", "'video_ids'", ":", "v...
doc: http://open.youku.com/docs/doc?id=47
[ "doc", ":", "http", ":", "//", "open", ".", "youku", ".", "com", "/", "docs", "/", "doc?id", "=", "47" ]
python
train
vanheeringen-lab/gimmemotifs
gimmemotifs/comparison.py
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/comparison.py#L662-L711
def get_closest_match(self, motifs, dbmotifs=None, match="partial", metric="wic",combine="mean", parallel=True, ncpus=None): """Return best match in database for motifs. Parameters ---------- motifs : list or str Filename of motifs or list of motifs. dbmotifs : list...
[ "def", "get_closest_match", "(", "self", ",", "motifs", ",", "dbmotifs", "=", "None", ",", "match", "=", "\"partial\"", ",", "metric", "=", "\"wic\"", ",", "combine", "=", "\"mean\"", ",", "parallel", "=", "True", ",", "ncpus", "=", "None", ")", ":", "...
Return best match in database for motifs. Parameters ---------- motifs : list or str Filename of motifs or list of motifs. dbmotifs : list or str, optional Database motifs, default will be used if not specified. match : str, optional metric : s...
[ "Return", "best", "match", "in", "database", "for", "motifs", "." ]
python
train
BernardFW/bernard
src/bernard/i18n/translator.py
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/i18n/translator.py#L607-L626
async def render( text: TransText, request: Optional['Request'], multi_line=False) -> Union[Text, List[Text]]: """ Render either a normal string either a string to translate into an actual string for the specified request. """ if isinstance(text, str): out = [text] ...
[ "async", "def", "render", "(", "text", ":", "TransText", ",", "request", ":", "Optional", "[", "'Request'", "]", ",", "multi_line", "=", "False", ")", "->", "Union", "[", "Text", ",", "List", "[", "Text", "]", "]", ":", "if", "isinstance", "(", "text...
Render either a normal string either a string to translate into an actual string for the specified request.
[ "Render", "either", "a", "normal", "string", "either", "a", "string", "to", "translate", "into", "an", "actual", "string", "for", "the", "specified", "request", "." ]
python
train
cloudera/cm_api
python/src/cm_api/endpoints/role_config_groups.py
https://github.com/cloudera/cm_api/blob/5d2512375bd94684b4da36df9e0d9177865ffcbb/python/src/cm_api/endpoints/role_config_groups.py#L229-L241
def move_roles(self, roles): """ Moves roles to this role config group. The roles can be moved from any role config group belonging to the same service. The role type of the destination group must match the role type of the roles. @param roles: The names of the roles to move. @return: List...
[ "def", "move_roles", "(", "self", ",", "roles", ")", ":", "return", "move_roles", "(", "self", ".", "_get_resource_root", "(", ")", ",", "self", ".", "serviceRef", ".", "serviceName", ",", "self", ".", "name", ",", "roles", ",", "self", ".", "serviceRef"...
Moves roles to this role config group. The roles can be moved from any role config group belonging to the same service. The role type of the destination group must match the role type of the roles. @param roles: The names of the roles to move. @return: List of roles which have been moved successfu...
[ "Moves", "roles", "to", "this", "role", "config", "group", "." ]
python
train
pypa/pipenv
pipenv/vendor/dotenv/__init__.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/__init__.py#L9-L30
def get_cli_string(path=None, action=None, key=None, value=None, quote=None): """Returns a string suitable for running as a shell script. Useful for converting a arguments passed to a fabric task to be passed to a `local` or `run` command. """ command = ['dotenv'] if quote: command.appe...
[ "def", "get_cli_string", "(", "path", "=", "None", ",", "action", "=", "None", ",", "key", "=", "None", ",", "value", "=", "None", ",", "quote", "=", "None", ")", ":", "command", "=", "[", "'dotenv'", "]", "if", "quote", ":", "command", ".", "appen...
Returns a string suitable for running as a shell script. Useful for converting a arguments passed to a fabric task to be passed to a `local` or `run` command.
[ "Returns", "a", "string", "suitable", "for", "running", "as", "a", "shell", "script", "." ]
python
train
Gandi/gandi.cli
gandi/cli/modules/cert.py
https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/cert.py#L236-L245
def advice_dcv_method(cls, csr, package, altnames, dcv_method, cert_id=None): """ Display dcv_method information. """ params = {'csr': csr, 'package': package, 'dcv_method': dcv_method} if cert_id: params['cert_id'] = cert_id result = cls.call('cert....
[ "def", "advice_dcv_method", "(", "cls", ",", "csr", ",", "package", ",", "altnames", ",", "dcv_method", ",", "cert_id", "=", "None", ")", ":", "params", "=", "{", "'csr'", ":", "csr", ",", "'package'", ":", "package", ",", "'dcv_method'", ":", "dcv_metho...
Display dcv_method information.
[ "Display", "dcv_method", "information", "." ]
python
train
mitsei/dlkit
dlkit/json_/assessment/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/sessions.py#L9199-L9218
def get_child_banks(self, bank_id): """Gets the children of the given bank. arg: bank_id (osid.id.Id): the ``Id`` to query return: (osid.assessment.BankList) - the children of the bank raise: NotFound - ``bank_id`` is not found raise: NullArgument - ``bank_id`` is ``null`` ...
[ "def", "get_child_banks", "(", "self", ",", "bank_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.get_child_bins", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session", ".", "ge...
Gets the children of the given bank. arg: bank_id (osid.id.Id): the ``Id`` to query return: (osid.assessment.BankList) - the children of the bank raise: NotFound - ``bank_id`` is not found raise: NullArgument - ``bank_id`` is ``null`` raise: OperationFailed - unable to com...
[ "Gets", "the", "children", "of", "the", "given", "bank", "." ]
python
train
gem/oq-engine
openquake/hazardlib/gsim/lin_lee_2008.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/lin_lee_2008.py#L102-L107
def _compute_mean(self, C, mag, rhypo, hypo_depth, mean, idx): """ Compute mean value according to equations 10 and 11 page 226. """ mean[idx] = (C['C1'] + C['C2'] * mag + C['C3'] * np.log(rhypo[idx] + C['C4'] * np.exp(C['C5'] * mag)) + C['C6'] * hypo_depth)
[ "def", "_compute_mean", "(", "self", ",", "C", ",", "mag", ",", "rhypo", ",", "hypo_depth", ",", "mean", ",", "idx", ")", ":", "mean", "[", "idx", "]", "=", "(", "C", "[", "'C1'", "]", "+", "C", "[", "'C2'", "]", "*", "mag", "+", "C", "[", ...
Compute mean value according to equations 10 and 11 page 226.
[ "Compute", "mean", "value", "according", "to", "equations", "10", "and", "11", "page", "226", "." ]
python
train
horazont/aioxmpp
aioxmpp/carbons/service.py
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/carbons/service.py#L93-L109
def disable(self): """ Disable message carbons. :raises RuntimeError: if the server does not support message carbons. :raises aioxmpp.XMPPError: if the server responded with an error to the request. :raises: as specified in :meth:`aioxmpp.Clien...
[ "def", "disable", "(", "self", ")", ":", "yield", "from", "self", ".", "_check_for_feature", "(", ")", "iq", "=", "aioxmpp", ".", "IQ", "(", "type_", "=", "aioxmpp", ".", "IQType", ".", "SET", ",", "payload", "=", "carbons_xso", ".", "Disable", "(", ...
Disable message carbons. :raises RuntimeError: if the server does not support message carbons. :raises aioxmpp.XMPPError: if the server responded with an error to the request. :raises: as specified in :meth:`aioxmpp.Client.send`
[ "Disable", "message", "carbons", "." ]
python
train
onicagroup/runway
runway/commands/runway/gen_sample.py
https://github.com/onicagroup/runway/blob/3f3549ec3bf6e39b9f27d9738a1847f3a4369e7f/runway/commands/runway/gen_sample.py#L107-L151
def generate_sample_cdk_cs_module(env_root, module_dir=None): """Generate skeleton CDK C# sample module.""" if module_dir is None: module_dir = os.path.join(env_root, 'sampleapp.cdk') generate_sample_module(module_dir) for i in ['add-project.hook.d.ts', 'cdk.json', 'package.json', ...
[ "def", "generate_sample_cdk_cs_module", "(", "env_root", ",", "module_dir", "=", "None", ")", ":", "if", "module_dir", "is", "None", ":", "module_dir", "=", "os", ".", "path", ".", "join", "(", "env_root", ",", "'sampleapp.cdk'", ")", "generate_sample_module", ...
Generate skeleton CDK C# sample module.
[ "Generate", "skeleton", "CDK", "C#", "sample", "module", "." ]
python
train
adamcharnock/swiftwind
swiftwind/costs/models.py
https://github.com/adamcharnock/swiftwind/blob/72c715800841c3b2feabded3f3b65b76388b4cea/swiftwind/costs/models.py#L146-L150
def get_amount_arrears_balance(self, billing_cycle): """Get the balance of to_account at the end of billing_cycle""" return self.to_account.balance( transaction__date__lt=billing_cycle.date_range.lower, )
[ "def", "get_amount_arrears_balance", "(", "self", ",", "billing_cycle", ")", ":", "return", "self", ".", "to_account", ".", "balance", "(", "transaction__date__lt", "=", "billing_cycle", ".", "date_range", ".", "lower", ",", ")" ]
Get the balance of to_account at the end of billing_cycle
[ "Get", "the", "balance", "of", "to_account", "at", "the", "end", "of", "billing_cycle" ]
python
train
materialsproject/pymatgen
pymatgen/io/abinit/pseudos.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/pseudos.py#L1439-L1462
def plot_projectors(self, ax=None, fontsize=12, **kwargs): """ Plot the PAW projectors. Args: ax: matplotlib :class:`Axes` or None if a new figure should be created. Returns: `matplotlib` figure """ ax, fig, plt = get_ax_fig_plt(ax) title = kwargs.po...
[ "def", "plot_projectors", "(", "self", ",", "ax", "=", "None", ",", "fontsize", "=", "12", ",", "*", "*", "kwargs", ")", ":", "ax", ",", "fig", ",", "plt", "=", "get_ax_fig_plt", "(", "ax", ")", "title", "=", "kwargs", ".", "pop", "(", "\"title\"",...
Plot the PAW projectors. Args: ax: matplotlib :class:`Axes` or None if a new figure should be created. Returns: `matplotlib` figure
[ "Plot", "the", "PAW", "projectors", "." ]
python
train
ntoll/microfs
microfs.py
https://github.com/ntoll/microfs/blob/11387109cfc36aaddceb018596ea75d55417ca0c/microfs.py#L111-L119
def get_serial(): """ Detect if a micro:bit is connected and return a serial object to talk to it. """ port, serial_number = find_microbit() if port is None: raise IOError('Could not find micro:bit.') return Serial(port, SERIAL_BAUD_RATE, timeout=1, parity='N')
[ "def", "get_serial", "(", ")", ":", "port", ",", "serial_number", "=", "find_microbit", "(", ")", "if", "port", "is", "None", ":", "raise", "IOError", "(", "'Could not find micro:bit.'", ")", "return", "Serial", "(", "port", ",", "SERIAL_BAUD_RATE", ",", "ti...
Detect if a micro:bit is connected and return a serial object to talk to it.
[ "Detect", "if", "a", "micro", ":", "bit", "is", "connected", "and", "return", "a", "serial", "object", "to", "talk", "to", "it", "." ]
python
train
HPENetworking/PYHPEIMC
build/lib/pyhpimc/plat/operator.py
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpimc/plat/operator.py#L115-L129
def get_plat_operator(auth, url,headers=HEADERS): ''' Funtion takes no inputs and returns a list of dictionaties of all of the operators currently configured on the HPE IMC system :return: list of dictionaries ''' get_operator_url = '/imcrs/plat/operator?start=0&size=1000&orderBy=id&desc=false&t...
[ "def", "get_plat_operator", "(", "auth", ",", "url", ",", "headers", "=", "HEADERS", ")", ":", "get_operator_url", "=", "'/imcrs/plat/operator?start=0&size=1000&orderBy=id&desc=false&total=false'", "f_url", "=", "url", "+", "get_operator_url", "try", ":", "r", "=", "r...
Funtion takes no inputs and returns a list of dictionaties of all of the operators currently configured on the HPE IMC system :return: list of dictionaries
[ "Funtion", "takes", "no", "inputs", "and", "returns", "a", "list", "of", "dictionaties", "of", "all", "of", "the", "operators", "currently", "configured", "on", "the", "HPE", "IMC", "system", ":", "return", ":", "list", "of", "dictionaries" ]
python
train
JasonKessler/scattertext
scattertext/ScatterChart.py
https://github.com/JasonKessler/scattertext/blob/cacf1f687d218ee8cae3fc05cc901db824bb1b81/scattertext/ScatterChart.py#L106-L134
def inject_metadata_descriptions(self, term_dict): ''' Inserts a set of descriptions of meta data terms. These will be displayed below the scatter plot when a meta data term is clicked. All keys in the term dict must occur as meta data. Parameters ---------- ter...
[ "def", "inject_metadata_descriptions", "(", "self", ",", "term_dict", ")", ":", "assert", "type", "(", "term_dict", ")", "==", "dict", "if", "not", "self", ".", "term_doc_matrix", ".", "metadata_in_use", "(", ")", ":", "raise", "TermDocMatrixHasNoMetadataException...
Inserts a set of descriptions of meta data terms. These will be displayed below the scatter plot when a meta data term is clicked. All keys in the term dict must occur as meta data. Parameters ---------- term_dict: dict {metadataname: str: 'explanation to insert', ...} ...
[ "Inserts", "a", "set", "of", "descriptions", "of", "meta", "data", "terms", ".", "These", "will", "be", "displayed", "below", "the", "scatter", "plot", "when", "a", "meta", "data", "term", "is", "clicked", ".", "All", "keys", "in", "the", "term", "dict",...
python
train
ihucos/plash
opt/plash/lib/py/plash/macros/common.py
https://github.com/ihucos/plash/blob/2ab2bc956e309d5aa6414c80983bfbf29b0ce572/opt/plash/lib/py/plash/macros/common.py#L78-L92
def eval_file(file): 'evaluate file content as expressions' fname = os.path.realpath(os.path.expanduser(file)) with open(fname) as f: inscript = f.read() sh = run_write_read(['plash', 'eval'], inscript.encode()).decode() # we remove an possibly existing newline # because else this mac...
[ "def", "eval_file", "(", "file", ")", ":", "fname", "=", "os", ".", "path", ".", "realpath", "(", "os", ".", "path", ".", "expanduser", "(", "file", ")", ")", "with", "open", "(", "fname", ")", "as", "f", ":", "inscript", "=", "f", ".", "read", ...
evaluate file content as expressions
[ "evaluate", "file", "content", "as", "expressions" ]
python
train
shidenggui/easyquotation
easyquotation/jsl.py
https://github.com/shidenggui/easyquotation/blob/a75820db4f05f5386e1c1024d05b0bfc1de6cbda/easyquotation/jsl.py#L209-L221
def fundm(self): """以字典形式返回分级母基数据 """ # 添加当前的ctime self.__fundm_url = self.__fundm_url.format(ctime=int(time.time())) # 请求数据 rep = requests.get(self.__fundm_url) # 获取返回的json字符串 fundmjson = json.loads(rep.text) # 格式化返回的json字符串 data = self.fo...
[ "def", "fundm", "(", "self", ")", ":", "# 添加当前的ctime", "self", ".", "__fundm_url", "=", "self", ".", "__fundm_url", ".", "format", "(", "ctime", "=", "int", "(", "time", ".", "time", "(", ")", ")", ")", "# 请求数据", "rep", "=", "requests", ".", "get", ...
以字典形式返回分级母基数据
[ "以字典形式返回分级母基数据" ]
python
train
astropy/photutils
photutils/background/background_2d.py
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/background/background_2d.py#L501-L535
def _make_2d_array(self, data): """ Convert a 1D array of mesh values to a masked 2D mesh array given the 1D mesh indices ``mesh_idx``. Parameters ---------- data : 1D `~numpy.ndarray` A 1D array of mesh values. Returns ------- result...
[ "def", "_make_2d_array", "(", "self", ",", "data", ")", ":", "if", "data", ".", "shape", "!=", "self", ".", "mesh_idx", ".", "shape", ":", "raise", "ValueError", "(", "'data and mesh_idx must have the same shape'", ")", "if", "np", ".", "ma", ".", "is_masked...
Convert a 1D array of mesh values to a masked 2D mesh array given the 1D mesh indices ``mesh_idx``. Parameters ---------- data : 1D `~numpy.ndarray` A 1D array of mesh values. Returns ------- result : 2D `~numpy.ma.MaskedArray` A 2D maske...
[ "Convert", "a", "1D", "array", "of", "mesh", "values", "to", "a", "masked", "2D", "mesh", "array", "given", "the", "1D", "mesh", "indices", "mesh_idx", "." ]
python
train
zeaphoo/budoc
budoc/pydoc.py
https://github.com/zeaphoo/budoc/blob/28f3aea4ad72ac90605ced012ed20e61af90c23a/budoc/pydoc.py#L653-L661
def instance_variables(self): """ Returns all instance variables in the class, sorted alphabetically as a list of `pydoc.Variable`. Instance variables are attributes of `self` defined in a class's `__init__` method. """ p = lambda o: isinstance(o, Variable) and se...
[ "def", "instance_variables", "(", "self", ")", ":", "p", "=", "lambda", "o", ":", "isinstance", "(", "o", ",", "Variable", ")", "and", "self", ".", "module", ".", "_docfilter", "(", "o", ")", "return", "filter", "(", "p", ",", "self", ".", "doc_init"...
Returns all instance variables in the class, sorted alphabetically as a list of `pydoc.Variable`. Instance variables are attributes of `self` defined in a class's `__init__` method.
[ "Returns", "all", "instance", "variables", "in", "the", "class", "sorted", "alphabetically", "as", "a", "list", "of", "pydoc", ".", "Variable", ".", "Instance", "variables", "are", "attributes", "of", "self", "defined", "in", "a", "class", "s", "__init__", "...
python
train
PMEAL/OpenPNM
openpnm/utils/Project.py
https://github.com/PMEAL/OpenPNM/blob/0547b5724ffedc0a593aae48639d36fe10e0baed/openpnm/utils/Project.py#L76-L94
def extend(self, obj): r""" This function is used to add objects to the project. Arguments can be single OpenPNM objects, an OpenPNM project list, or a plain list of OpenPNM objects. """ if type(obj) is not list: obj = [obj] for item in obj: ...
[ "def", "extend", "(", "self", ",", "obj", ")", ":", "if", "type", "(", "obj", ")", "is", "not", "list", ":", "obj", "=", "[", "obj", "]", "for", "item", "in", "obj", ":", "if", "hasattr", "(", "item", ",", "'_mro'", ")", ":", "if", "'GenericNet...
r""" This function is used to add objects to the project. Arguments can be single OpenPNM objects, an OpenPNM project list, or a plain list of OpenPNM objects.
[ "r", "This", "function", "is", "used", "to", "add", "objects", "to", "the", "project", ".", "Arguments", "can", "be", "single", "OpenPNM", "objects", "an", "OpenPNM", "project", "list", "or", "a", "plain", "list", "of", "OpenPNM", "objects", "." ]
python
train
thomwiggers/httpserver
httpserver/httpserver.py
https://github.com/thomwiggers/httpserver/blob/88a3a35619ce5185347c6764f211878e898e6aad/httpserver/httpserver.py#L173-L184
def _get_request_uri(self, request): """Parse the request URI into something useful Server MUST accept full URIs (5.1.2)""" request_uri = request['target'] if request_uri.startswith('/'): # eg. GET /index.html return (request.get('Host', 'localhost').split(':')[0], ...
[ "def", "_get_request_uri", "(", "self", ",", "request", ")", ":", "request_uri", "=", "request", "[", "'target'", "]", "if", "request_uri", ".", "startswith", "(", "'/'", ")", ":", "# eg. GET /index.html", "return", "(", "request", ".", "get", "(", "'Host'",...
Parse the request URI into something useful Server MUST accept full URIs (5.1.2)
[ "Parse", "the", "request", "URI", "into", "something", "useful" ]
python
train
google/grr
grr/server/grr_response_server/artifact.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/artifact.py#L61-L111
def GetArtifactKnowledgeBase(client_obj, allow_uninitialized=False): """This generates an artifact knowledge base from a GRR client. Args: client_obj: A GRRClient object which is opened for reading. allow_uninitialized: If True we accept an uninitialized knowledge_base. Returns: A KnowledgeBase sema...
[ "def", "GetArtifactKnowledgeBase", "(", "client_obj", ",", "allow_uninitialized", "=", "False", ")", ":", "client_schema", "=", "client_obj", ".", "Schema", "kb", "=", "client_obj", ".", "Get", "(", "client_schema", ".", "KNOWLEDGE_BASE", ")", "if", "not", "allo...
This generates an artifact knowledge base from a GRR client. Args: client_obj: A GRRClient object which is opened for reading. allow_uninitialized: If True we accept an uninitialized knowledge_base. Returns: A KnowledgeBase semantic value. Raises: ArtifactProcessingError: If called when the kno...
[ "This", "generates", "an", "artifact", "knowledge", "base", "from", "a", "GRR", "client", "." ]
python
train
bcbio/bcbio-nextgen
bcbio/variation/vfilter.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vfilter.py#L78-L112
def _freebayes_cutoff(in_file, data): """Perform filtering of FreeBayes results, flagging low confidence calls. Filters using cutoffs on low depth based on Meynert et al's work modeling sensitivity of homozygote and heterozygote calling on depth: http://www.ncbi.nlm.nih.gov/pubmed/23773188 and hi...
[ "def", "_freebayes_cutoff", "(", "in_file", ",", "data", ")", ":", "if", "not", "vcfutils", ".", "vcf_has_variants", "(", "in_file", ")", ":", "base", ",", "ext", "=", "utils", ".", "splitext_plus", "(", "in_file", ")", "out_file", "=", "\"{base}-filter{ext}...
Perform filtering of FreeBayes results, flagging low confidence calls. Filters using cutoffs on low depth based on Meynert et al's work modeling sensitivity of homozygote and heterozygote calling on depth: http://www.ncbi.nlm.nih.gov/pubmed/23773188 and high depth heterozygote SNP filtering based on ...
[ "Perform", "filtering", "of", "FreeBayes", "results", "flagging", "low", "confidence", "calls", "." ]
python
train
townsenddw/jhubctl
jhubctl/hubs/single.py
https://github.com/townsenddw/jhubctl/blob/c8c20f86a16e9d01dd90e4607d81423417cc773b/jhubctl/hubs/single.py#L52-L59
def get(self): """Get specific information about this hub.""" output = helm("get", self.release) if output.returncode != 0: print("Something went wrong!") print(output.stderr) else: print(output.stdout)
[ "def", "get", "(", "self", ")", ":", "output", "=", "helm", "(", "\"get\"", ",", "self", ".", "release", ")", "if", "output", ".", "returncode", "!=", "0", ":", "print", "(", "\"Something went wrong!\"", ")", "print", "(", "output", ".", "stderr", ")",...
Get specific information about this hub.
[ "Get", "specific", "information", "about", "this", "hub", "." ]
python
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_map/__init__.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/__init__.py#L136-L173
def cmd_map(self, args): '''map commands''' from MAVProxy.modules.mavproxy_map import mp_slipmap if len(args) < 1: print("usage: map <icon|set>") elif args[0] == "icon": if len(args) < 3: print("Usage: map icon <lat> <lon> <icon>") else...
[ "def", "cmd_map", "(", "self", ",", "args", ")", ":", "from", "MAVProxy", ".", "modules", ".", "mavproxy_map", "import", "mp_slipmap", "if", "len", "(", "args", ")", "<", "1", ":", "print", "(", "\"usage: map <icon|set>\"", ")", "elif", "args", "[", "0",...
map commands
[ "map", "commands" ]
python
train
callowayproject/Calloway
calloway/apps/django_ext/templatetags/fb.py
https://github.com/callowayproject/Calloway/blob/d22e98d41fbd298ab6393ba7bd84a75528be9f81/calloway/apps/django_ext/templatetags/fb.py#L43-L97
def fburl(parser, token): """ Returns an absolute URL matching given view with its parameters. This is a way to define links that aren't tied to a particular URL configuration:: {% url path.to.some_view arg1,arg2,name1=value1 %} The first argument is a path to a view. It can be an absolut...
[ "def", "fburl", "(", "parser", ",", "token", ")", ":", "bits", "=", "token", ".", "contents", ".", "split", "(", "' '", ")", "if", "len", "(", "bits", ")", "<", "2", ":", "raise", "template", ".", "TemplateSyntaxError", "(", "\"'%s' takes at least one ar...
Returns an absolute URL matching given view with its parameters. This is a way to define links that aren't tied to a particular URL configuration:: {% url path.to.some_view arg1,arg2,name1=value1 %} The first argument is a path to a view. It can be an absolute python path or just ``app_name.v...
[ "Returns", "an", "absolute", "URL", "matching", "given", "view", "with", "its", "parameters", "." ]
python
train
deepmind/sonnet
sonnet/python/modules/spatial_transformer.py
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/spatial_transformer.py#L538-L546
def combine_with(self, additional_constraints): """Combines two sets of constraints into a coherent single set.""" x = additional_constraints if not isinstance(additional_constraints, AffineWarpConstraints): x = AffineWarpConstraints(additional_constraints) new_constraints = [] for left, right...
[ "def", "combine_with", "(", "self", ",", "additional_constraints", ")", ":", "x", "=", "additional_constraints", "if", "not", "isinstance", "(", "additional_constraints", ",", "AffineWarpConstraints", ")", ":", "x", "=", "AffineWarpConstraints", "(", "additional_const...
Combines two sets of constraints into a coherent single set.
[ "Combines", "two", "sets", "of", "constraints", "into", "a", "coherent", "single", "set", "." ]
python
train
saltstack/salt
salt/state.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/state.py#L2211-L2246
def verify_retry_data(self, retry_data): ''' verifies the specified retry data ''' retry_defaults = { 'until': True, 'attempts': 2, 'splay': 0, 'interval': 30, } expected_data = { 'until': bool, ...
[ "def", "verify_retry_data", "(", "self", ",", "retry_data", ")", ":", "retry_defaults", "=", "{", "'until'", ":", "True", ",", "'attempts'", ":", "2", ",", "'splay'", ":", "0", ",", "'interval'", ":", "30", ",", "}", "expected_data", "=", "{", "'until'",...
verifies the specified retry data
[ "verifies", "the", "specified", "retry", "data" ]
python
train
rootpy/rootpy
rootpy/tree/tree.py
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/tree/tree.py#L85-L101
def branch_type(cls, branch): """ Return the string representation for the type of a branch """ typename = branch.GetClassName() if not typename: leaf = branch.GetListOfLeaves()[0] typename = leaf.GetTypeName() # check if leaf has multiple elem...
[ "def", "branch_type", "(", "cls", ",", "branch", ")", ":", "typename", "=", "branch", ".", "GetClassName", "(", ")", "if", "not", "typename", ":", "leaf", "=", "branch", ".", "GetListOfLeaves", "(", ")", "[", "0", "]", "typename", "=", "leaf", ".", "...
Return the string representation for the type of a branch
[ "Return", "the", "string", "representation", "for", "the", "type", "of", "a", "branch" ]
python
train
Azure/azure-sdk-for-python
azure-mgmt-web/azure/mgmt/web/operations/web_apps_operations.py
https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-mgmt-web/azure/mgmt/web/operations/web_apps_operations.py#L7932-L7989
def start_web_site_network_trace_operation( self, resource_group_name, name, duration_in_seconds=None, max_frame_length=None, sas_url=None, custom_headers=None, raw=False, polling=True, **operation_config): """Start capturing network packets for the site. Start capturing network packets for...
[ "def", "start_web_site_network_trace_operation", "(", "self", ",", "resource_group_name", ",", "name", ",", "duration_in_seconds", "=", "None", ",", "max_frame_length", "=", "None", ",", "sas_url", "=", "None", ",", "custom_headers", "=", "None", ",", "raw", "=", ...
Start capturing network packets for the site. Start capturing network packets for the site. :param resource_group_name: Name of the resource group to which the resource belongs. :type resource_group_name: str :param name: The name of the web app. :type name: str ...
[ "Start", "capturing", "network", "packets", "for", "the", "site", "." ]
python
test
malinoff/structures
structures/core.py
https://github.com/malinoff/structures/blob/36b1d641d399cd0b2a824704da53d8b5c8bd4f10/structures/core.py#L62-L79
def build_stream(self, obj, stream: BytesIO, context=None) -> None: """ Build bytes from the python object into the stream. :param obj: Python object to build bytes from. :param stream: A ``io.BytesIO`` instance to write bytes into. :param context: Optional context dictionary. ...
[ "def", "build_stream", "(", "self", ",", "obj", ",", "stream", ":", "BytesIO", ",", "context", "=", "None", ")", "->", "None", ":", "if", "context", "is", "None", ":", "context", "=", "Context", "(", ")", "if", "not", "isinstance", "(", "context", ",...
Build bytes from the python object into the stream. :param obj: Python object to build bytes from. :param stream: A ``io.BytesIO`` instance to write bytes into. :param context: Optional context dictionary.
[ "Build", "bytes", "from", "the", "python", "object", "into", "the", "stream", "." ]
python
train
senaite/senaite.core
bika/lims/exportimport/instruments/horiba/jobinyvon/parser.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/exportimport/instruments/horiba/jobinyvon/parser.py#L66-L77
def parse_line_headers(self, line): """We must build headers carefully: there are multiple blank values in the header row, and the instrument may just add more for all we know. """ headers = line.split(",") for i, v in enumerate(headers): if v: ...
[ "def", "parse_line_headers", "(", "self", ",", "line", ")", ":", "headers", "=", "line", ".", "split", "(", "\",\"", ")", "for", "i", ",", "v", "in", "enumerate", "(", "headers", ")", ":", "if", "v", ":", "headers", "[", "i", "]", "=", "v", "else...
We must build headers carefully: there are multiple blank values in the header row, and the instrument may just add more for all we know.
[ "We", "must", "build", "headers", "carefully", ":", "there", "are", "multiple", "blank", "values", "in", "the", "header", "row", "and", "the", "instrument", "may", "just", "add", "more", "for", "all", "we", "know", "." ]
python
train
GPflow/GPflow
gpflow/models/gplvm.py
https://github.com/GPflow/GPflow/blob/549394f0b1b0696c7b521a065e49bdae6e7acf27/gpflow/models/gplvm.py#L123-L166
def _build_likelihood(self): """ Construct a tensorflow function to compute the bound on the marginal likelihood. """ pX = DiagonalGaussian(self.X_mean, self.X_var) num_inducing = len(self.feature) psi0 = tf.reduce_sum(expectation(pX, self.kern)) psi1 = e...
[ "def", "_build_likelihood", "(", "self", ")", ":", "pX", "=", "DiagonalGaussian", "(", "self", ".", "X_mean", ",", "self", ".", "X_var", ")", "num_inducing", "=", "len", "(", "self", ".", "feature", ")", "psi0", "=", "tf", ".", "reduce_sum", "(", "expe...
Construct a tensorflow function to compute the bound on the marginal likelihood.
[ "Construct", "a", "tensorflow", "function", "to", "compute", "the", "bound", "on", "the", "marginal", "likelihood", "." ]
python
train
mitsei/dlkit
dlkit/json_/commenting/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2465-L2486
def get_parent_books(self, book_id): """Gets the parent books of the given ``id``. arg: book_id (osid.id.Id): the ``Id`` of the ``Book`` to query return: (osid.commenting.BookList) - the parent books of the ``id`` raise: NotFound - a ``Book`` identifi...
[ "def", "get_parent_books", "(", "self", ",", "book_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.get_parent_bins", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session", ".", "...
Gets the parent books of the given ``id``. arg: book_id (osid.id.Id): the ``Id`` of the ``Book`` to query return: (osid.commenting.BookList) - the parent books of the ``id`` raise: NotFound - a ``Book`` identified by ``Id is`` not found raise: NullAr...
[ "Gets", "the", "parent", "books", "of", "the", "given", "id", "." ]
python
train
openid/python-openid
openid/consumer/discover.py
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/discover.py#L303-L311
def normalizeURL(url): """Normalize a URL, converting normalization failures to DiscoveryFailure""" try: normalized = urinorm.urinorm(url) except ValueError, why: raise DiscoveryFailure('Normalizing identifier: %s' % (why[0],), None) else: return urlparse.urldefrag(normalized...
[ "def", "normalizeURL", "(", "url", ")", ":", "try", ":", "normalized", "=", "urinorm", ".", "urinorm", "(", "url", ")", "except", "ValueError", ",", "why", ":", "raise", "DiscoveryFailure", "(", "'Normalizing identifier: %s'", "%", "(", "why", "[", "0", "]...
Normalize a URL, converting normalization failures to DiscoveryFailure
[ "Normalize", "a", "URL", "converting", "normalization", "failures", "to", "DiscoveryFailure" ]
python
train
clinicedc/edc-notification
edc_notification/site_notifications.py
https://github.com/clinicedc/edc-notification/blob/79e43a44261e37566c63a8780d80b0d8ece89cc9/edc_notification/site_notifications.py#L86-L98
def notify(self, instance=None, **kwargs): """A wrapper to call notification.notify for each notification class associated with the given model instance. Returns a dictionary of {notification.name: model, ...} including only notifications sent. """ notified = {} ...
[ "def", "notify", "(", "self", ",", "instance", "=", "None", ",", "*", "*", "kwargs", ")", ":", "notified", "=", "{", "}", "for", "notification_cls", "in", "self", ".", "registry", ".", "values", "(", ")", ":", "notification", "=", "notification_cls", "...
A wrapper to call notification.notify for each notification class associated with the given model instance. Returns a dictionary of {notification.name: model, ...} including only notifications sent.
[ "A", "wrapper", "to", "call", "notification", ".", "notify", "for", "each", "notification", "class", "associated", "with", "the", "given", "model", "instance", "." ]
python
train
shidenggui/easyquotation
easyquotation/basequotation.py
https://github.com/shidenggui/easyquotation/blob/a75820db4f05f5386e1c1024d05b0bfc1de6cbda/easyquotation/basequotation.py#L89-L94
def market_snapshot(self, prefix=False): """return all market quotation snapshot :param prefix: if prefix is True, return quotation dict's stock_code key start with sh/sz market flag """ return self.get_stock_data(self.stock_list, prefix=prefix)
[ "def", "market_snapshot", "(", "self", ",", "prefix", "=", "False", ")", ":", "return", "self", ".", "get_stock_data", "(", "self", ".", "stock_list", ",", "prefix", "=", "prefix", ")" ]
return all market quotation snapshot :param prefix: if prefix is True, return quotation dict's stock_code key start with sh/sz market flag
[ "return", "all", "market", "quotation", "snapshot", ":", "param", "prefix", ":", "if", "prefix", "is", "True", "return", "quotation", "dict", "s", "stock_code", "key", "start", "with", "sh", "/", "sz", "market", "flag" ]
python
train
mitsei/dlkit
dlkit/runtime/impls/proxy/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/runtime/impls/proxy/sessions.py#L34-L69
def get_proxy(self, input_): """Gets a proxy. :param input: a proxy condition :type input: ``osid.proxy.ProxyCondition`` :return: a proxy :rtype: ``osid.proxy.Proxy`` :raise: ``NullArgument`` -- ``input`` is ``null`` :raise: ``OperationFailed`` -- unable to compl...
[ "def", "get_proxy", "(", "self", ",", "input_", ")", ":", "if", "input_", ".", "_http_request", "is", "not", "None", ":", "authentication", "=", "DjangoAuthentication", "(", ")", "authentication", ".", "set_django_user", "(", "input_", ".", "_http_request", "....
Gets a proxy. :param input: a proxy condition :type input: ``osid.proxy.ProxyCondition`` :return: a proxy :rtype: ``osid.proxy.Proxy`` :raise: ``NullArgument`` -- ``input`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``Permission...
[ "Gets", "a", "proxy", "." ]
python
train
tensorlayer/tensorlayer
tensorlayer/prepro.py
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L881-L915
def flip_axis(x, axis=1, is_random=False): """Flip the axis of an image, such as flip left and right, up and down, randomly or non-randomly, Parameters ---------- x : numpy.array An image with dimension of [row, col, channel] (default). axis : int Which axis to flip. - 0...
[ "def", "flip_axis", "(", "x", ",", "axis", "=", "1", ",", "is_random", "=", "False", ")", ":", "if", "is_random", ":", "factor", "=", "np", ".", "random", ".", "uniform", "(", "-", "1", ",", "1", ")", "if", "factor", ">", "0", ":", "x", "=", ...
Flip the axis of an image, such as flip left and right, up and down, randomly or non-randomly, Parameters ---------- x : numpy.array An image with dimension of [row, col, channel] (default). axis : int Which axis to flip. - 0, flip up and down - 1, flip left and ...
[ "Flip", "the", "axis", "of", "an", "image", "such", "as", "flip", "left", "and", "right", "up", "and", "down", "randomly", "or", "non", "-", "randomly" ]
python
valid
lorien/grab
grab/deprecated.py
https://github.com/lorien/grab/blob/8b301db2a08c830245b61c589e58af6234f4db79/grab/deprecated.py#L76-L93
def find_link(self, href_pattern, make_absolute=True): """ Find link in response body which href value matches ``href_pattern``. Returns found url or None. """ if make_absolute: self.tree.make_links_absolute(self.doc.url) if isinstance(href_pattern, six.tex...
[ "def", "find_link", "(", "self", ",", "href_pattern", ",", "make_absolute", "=", "True", ")", ":", "if", "make_absolute", ":", "self", ".", "tree", ".", "make_links_absolute", "(", "self", ".", "doc", ".", "url", ")", "if", "isinstance", "(", "href_pattern...
Find link in response body which href value matches ``href_pattern``. Returns found url or None.
[ "Find", "link", "in", "response", "body", "which", "href", "value", "matches", "href_pattern", "." ]
python
train
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Tags.py
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L751-L785
def insertAfter(self, child, afterChild): ''' insertAfter - Inserts a child after #afterChild @param child <AdvancedTag/str> - Child block to insert @param afterChild <AdvancedTag/str> - Child block to insert after. if None, will be appended @return -...
[ "def", "insertAfter", "(", "self", ",", "child", ",", "afterChild", ")", ":", "# If after child is null/None, just append", "if", "afterChild", "is", "None", ":", "return", "self", ".", "appendBlock", "(", "child", ")", "isChildTag", "=", "isTagNode", "(", "chil...
insertAfter - Inserts a child after #afterChild @param child <AdvancedTag/str> - Child block to insert @param afterChild <AdvancedTag/str> - Child block to insert after. if None, will be appended @return - The added child. Note, if it is a text block (str), the return is...
[ "insertAfter", "-", "Inserts", "a", "child", "after", "#afterChild" ]
python
train
user-cont/conu
conu/backend/nspawn/image.py
https://github.com/user-cont/conu/blob/08caae7bb6bdd265b55bb106c3da6a7946a5a352/conu/backend/nspawn/image.py#L256-L271
def create_snapshot(self, name, tag): """ Create new instance of image with snaphot image (it is copied inside class constructuor) :param name: str - name of image - not used now :param tag: str - tag for image :return: NspawnImage instance """ source = self.loca...
[ "def", "create_snapshot", "(", "self", ",", "name", ",", "tag", ")", ":", "source", "=", "self", ".", "local_location", "logger", ".", "debug", "(", "\"Create Snapshot: %s -> %s\"", "%", "(", "source", ",", "name", ")", ")", "# FIXME: actually create the snapsho...
Create new instance of image with snaphot image (it is copied inside class constructuor) :param name: str - name of image - not used now :param tag: str - tag for image :return: NspawnImage instance
[ "Create", "new", "instance", "of", "image", "with", "snaphot", "image", "(", "it", "is", "copied", "inside", "class", "constructuor", ")" ]
python
train
osrg/ryu
ryu/lib/ovs/vsctl.py
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/vsctl.py#L2142-L2158
def _check_value(self, ovsrec_row, column_value): """ :type column_value: tuple of column and value_json """ column, value_json = column_value column_schema = ovsrec_row._table.columns[column] value = ovs.db.data.Datum.from_json( column_schema.type, value_json...
[ "def", "_check_value", "(", "self", ",", "ovsrec_row", ",", "column_value", ")", ":", "column", ",", "value_json", "=", "column_value", "column_schema", "=", "ovsrec_row", ".", "_table", ".", "columns", "[", "column", "]", "value", "=", "ovs", ".", "db", "...
:type column_value: tuple of column and value_json
[ ":", "type", "column_value", ":", "tuple", "of", "column", "and", "value_json" ]
python
train
jplusplus/statscraper
statscraper/base_scraper.py
https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/base_scraper.py#L560-L565
def move_to_top(self): """Move to root item.""" self.current_item = self.root for f in self._hooks["top"]: f(self) return self
[ "def", "move_to_top", "(", "self", ")", ":", "self", ".", "current_item", "=", "self", ".", "root", "for", "f", "in", "self", ".", "_hooks", "[", "\"top\"", "]", ":", "f", "(", "self", ")", "return", "self" ]
Move to root item.
[ "Move", "to", "root", "item", "." ]
python
train
JoelBender/bacpypes
py25/bacpypes/primitivedata.py
https://github.com/JoelBender/bacpypes/blob/4111b8604a16fa2b7f80d8104a43b9f3e28dfc78/py25/bacpypes/primitivedata.py#L137-L173
def decode(self, pdu): """Decode a tag from the PDU.""" try: tag = pdu.get() # extract the type self.tagClass = (tag >> 3) & 0x01 # extract the tag number self.tagNumber = (tag >> 4) if (self.tagNumber == 0x0F): se...
[ "def", "decode", "(", "self", ",", "pdu", ")", ":", "try", ":", "tag", "=", "pdu", ".", "get", "(", ")", "# extract the type", "self", ".", "tagClass", "=", "(", "tag", ">>", "3", ")", "&", "0x01", "# extract the tag number", "self", ".", "tagNumber", ...
Decode a tag from the PDU.
[ "Decode", "a", "tag", "from", "the", "PDU", "." ]
python
train
BreakingBytes/simkit
simkit/core/calculators.py
https://github.com/BreakingBytes/simkit/blob/205163d879d3880b6c9ef609f1b723a58773026b/simkit/core/calculators.py#L106-L163
def get_covariance(datargs, outargs, vargs, datvar, outvar): """ Get covariance matrix. :param datargs: data arguments :param outargs: output arguments :param vargs: variable arguments :param datvar: variance of data arguments :param outvar: variance of output ar...
[ "def", "get_covariance", "(", "datargs", ",", "outargs", ",", "vargs", ",", "datvar", ",", "outvar", ")", ":", "# number of formula arguments that are not constant", "argn", "=", "len", "(", "vargs", ")", "# number of observations must be the same for all vargs", "nobs", ...
Get covariance matrix. :param datargs: data arguments :param outargs: output arguments :param vargs: variable arguments :param datvar: variance of data arguments :param outvar: variance of output arguments :return: covariance
[ "Get", "covariance", "matrix", "." ]
python
train
esterhui/pypu
pypu/service_facebook.py
https://github.com/esterhui/pypu/blob/cc3e259d59f024c2c4c0fbb9c8a1547e51de75ec/pypu/service_facebook.py#L147-L165
def _load_megapixels(self,directory): """Opens megapixel file, if contains '3.5' for instance, will scale all uploaded photos in directory this this size, the original photo is untouched. Returns None if file not found """ #FIXME: should check if DB tracking file...
[ "def", "_load_megapixels", "(", "self", ",", "directory", ")", ":", "#FIXME: should check if DB tracking file before using it", "fullfile", "=", "os", ".", "path", ".", "join", "(", "directory", ",", "MEGAPIXEL_FILE", ")", "try", ":", "mp", "=", "float", "(", "o...
Opens megapixel file, if contains '3.5' for instance, will scale all uploaded photos in directory this this size, the original photo is untouched. Returns None if file not found
[ "Opens", "megapixel", "file", "if", "contains", "3", ".", "5", "for", "instance", "will", "scale", "all", "uploaded", "photos", "in", "directory", "this", "this", "size", "the", "original", "photo", "is", "untouched", ".", "Returns", "None", "if", "file", ...
python
train
ozak/georasters
georasters/georasters.py
https://github.com/ozak/georasters/blob/0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70/georasters/georasters.py#L477-L480
def copy(self): """Returns copy of itself""" return GeoRaster(self.raster.copy(), self.geot, nodata_value=self.nodata_value, projection=self.projection, datatype=self.datatype)
[ "def", "copy", "(", "self", ")", ":", "return", "GeoRaster", "(", "self", ".", "raster", ".", "copy", "(", ")", ",", "self", ".", "geot", ",", "nodata_value", "=", "self", ".", "nodata_value", ",", "projection", "=", "self", ".", "projection", ",", "...
Returns copy of itself
[ "Returns", "copy", "of", "itself" ]
python
train
jmurty/xml4h
xml4h/impls/lxml_etree.py
https://github.com/jmurty/xml4h/blob/adbb45e27a01a869a505aee7bc16bad2f517b511/xml4h/impls/lxml_etree.py#L440-L455
def _is_ns_in_ancestor(self, node, name, value): """ Return True if the given namespace name/value is defined in an ancestor of the given node, meaning that the given node need not have its own attributes to apply that namespacing. """ curr_node = self.get_node_parent(nod...
[ "def", "_is_ns_in_ancestor", "(", "self", ",", "node", ",", "name", ",", "value", ")", ":", "curr_node", "=", "self", ".", "get_node_parent", "(", "node", ")", "while", "curr_node", ".", "__class__", "==", "etree", ".", "_Element", ":", "if", "(", "hasat...
Return True if the given namespace name/value is defined in an ancestor of the given node, meaning that the given node need not have its own attributes to apply that namespacing.
[ "Return", "True", "if", "the", "given", "namespace", "name", "/", "value", "is", "defined", "in", "an", "ancestor", "of", "the", "given", "node", "meaning", "that", "the", "given", "node", "need", "not", "have", "its", "own", "attributes", "to", "apply", ...
python
train
nicktgr15/sac
sac/methods/sm_analysis/kernel.py
https://github.com/nicktgr15/sac/blob/4b1d5d8e6ca2c437972db34ddc72990860865159/sac/methods/sm_analysis/kernel.py#L66-L112
def get_checkerboard_matrix(kernel_width, kernel_type="default", gaussian_param=0.1): """ example matrix for width = 2 -1 -1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 -1 -1 :param kernel_type: :param kernel_width: :return: """ if kernel_type is "gaussian": ...
[ "def", "get_checkerboard_matrix", "(", "kernel_width", ",", "kernel_type", "=", "\"default\"", ",", "gaussian_param", "=", "0.1", ")", ":", "if", "kernel_type", "is", "\"gaussian\"", ":", "return", "get_gaussian_kernel", "(", "kernel_width", ",", "gaussian_param", "...
example matrix for width = 2 -1 -1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 -1 -1 :param kernel_type: :param kernel_width: :return:
[ "example", "matrix", "for", "width", "=", "2" ]
python
train
rackerlabs/timid
timid/utils.py
https://github.com/rackerlabs/timid/blob/b1c6aa159ab380a033740f4aa392cf0d125e0ac6/timid/utils.py#L28-L43
def canonicalize_path(cwd, path): """ Canonicalizes a path relative to a given working directory. That is, the path, if not absolute, is interpreted relative to the working directory, then converted to absolute form. :param cwd: The working directory. :param path: The path to canonicalize. ...
[ "def", "canonicalize_path", "(", "cwd", ",", "path", ")", ":", "if", "not", "os", ".", "path", ".", "isabs", "(", "path", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "cwd", ",", "path", ")", "return", "os", ".", "path", ".", "ab...
Canonicalizes a path relative to a given working directory. That is, the path, if not absolute, is interpreted relative to the working directory, then converted to absolute form. :param cwd: The working directory. :param path: The path to canonicalize. :returns: The absolute path.
[ "Canonicalizes", "a", "path", "relative", "to", "a", "given", "working", "directory", ".", "That", "is", "the", "path", "if", "not", "absolute", "is", "interpreted", "relative", "to", "the", "working", "directory", "then", "converted", "to", "absolute", "form"...
python
test