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
juju/charm-helpers
charmhelpers/fetch/ubuntu.py
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/fetch/ubuntu.py#L259-L267
def apt_purge(packages, fatal=False): """Purge one or more packages.""" cmd = ['apt-get', '--assume-yes', 'purge'] if isinstance(packages, six.string_types): cmd.append(packages) else: cmd.extend(packages) log("Purging {}".format(packages)) _run_apt_command(cmd, fatal)
[ "def", "apt_purge", "(", "packages", ",", "fatal", "=", "False", ")", ":", "cmd", "=", "[", "'apt-get'", ",", "'--assume-yes'", ",", "'purge'", "]", "if", "isinstance", "(", "packages", ",", "six", ".", "string_types", ")", ":", "cmd", ".", "append", "...
Purge one or more packages.
[ "Purge", "one", "or", "more", "packages", "." ]
python
train
rene-aguirre/pywinusb
pywinusb/hid/helpers.py
https://github.com/rene-aguirre/pywinusb/blob/954c4b2105d9f01cb0c50e24500bb747d4ecdc43/pywinusb/hid/helpers.py#L56-L71
def synchronized(lock): """ Synchronization decorator. Allos to set a mutex on any function """ @simple_decorator def wrap(function_target): """Decorator wrapper""" def new_function(*args, **kw): """Decorated function with Mutex""" lock.acquire() ...
[ "def", "synchronized", "(", "lock", ")", ":", "@", "simple_decorator", "def", "wrap", "(", "function_target", ")", ":", "\"\"\"Decorator wrapper\"\"\"", "def", "new_function", "(", "*", "args", ",", "*", "*", "kw", ")", ":", "\"\"\"Decorated function with Mutex\"\...
Synchronization decorator. Allos to set a mutex on any function
[ "Synchronization", "decorator", ".", "Allos", "to", "set", "a", "mutex", "on", "any", "function" ]
python
train
Jammy2211/PyAutoLens
autolens/pipeline/phase.py
https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/pipeline/phase.py#L1485-L1517
def run(self, data, results=None, mask=None, positions=None): """ Run a fit for each galaxy from the previous phase. Parameters ---------- data: LensData results: ResultsCollection Results from all previous phases mask: Mask The mask ...
[ "def", "run", "(", "self", ",", "data", ",", "results", "=", "None", ",", "mask", "=", "None", ",", "positions", "=", "None", ")", ":", "model_image", "=", "results", ".", "last", ".", "unmasked_model_image", "galaxy_tuples", "=", "results", ".", "last",...
Run a fit for each galaxy from the previous phase. Parameters ---------- data: LensData results: ResultsCollection Results from all previous phases mask: Mask The mask positions Returns ------- results: HyperGalaxyResults ...
[ "Run", "a", "fit", "for", "each", "galaxy", "from", "the", "previous", "phase", "." ]
python
valid
pip-services3-python/pip-services3-commons-python
pip_services3_commons/run/Opener.py
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/run/Opener.py#L36-L54
def is_opened(components): """ Checks if all components are opened. To be checked components must implement [[IOpenable]] interface. If they don't the call to this method returns true. :param components: a list of components that are to be checked. :return: true if all...
[ "def", "is_opened", "(", "components", ")", ":", "if", "components", "==", "None", ":", "return", "True", "result", "=", "True", "for", "component", "in", "components", ":", "result", "=", "result", "and", "Opener", ".", "is_opened_one", "(", "component", ...
Checks if all components are opened. To be checked components must implement [[IOpenable]] interface. If they don't the call to this method returns true. :param components: a list of components that are to be checked. :return: true if all components are opened and false if at least on...
[ "Checks", "if", "all", "components", "are", "opened", "." ]
python
train
TestInABox/stackInABox
stackinabox/util/responses/core.py
https://github.com/TestInABox/stackInABox/blob/63ee457401e9a88d987f85f513eb512dcb12d984/stackinabox/util/responses/core.py#L44-L78
def registration(uri): """Responses handler registration. Registers a handler for a given URI with Responses so that it can be intercepted and handed to Stack-In-A-Box. :param uri: URI used for the base of the HTTP requests :returns: n/a """ # log the URI that is used to access the S...
[ "def", "registration", "(", "uri", ")", ":", "# log the URI that is used to access the Stack-In-A-Box services", "logger", ".", "debug", "(", "'Registering Stack-In-A-Box at {0} under Python Responses'", ".", "format", "(", "uri", ")", ")", "# tell Stack-In-A-Box what URI to matc...
Responses handler registration. Registers a handler for a given URI with Responses so that it can be intercepted and handed to Stack-In-A-Box. :param uri: URI used for the base of the HTTP requests :returns: n/a
[ "Responses", "handler", "registration", "." ]
python
train
edx/XBlock
xblock/django/request.py
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/django/request.py#L14-L24
def webob_to_django_response(webob_response): """Returns a django response to the `webob_response`""" from django.http import HttpResponse django_response = HttpResponse( webob_response.app_iter, content_type=webob_response.content_type, status=webob_response.status_code, ) f...
[ "def", "webob_to_django_response", "(", "webob_response", ")", ":", "from", "django", ".", "http", "import", "HttpResponse", "django_response", "=", "HttpResponse", "(", "webob_response", ".", "app_iter", ",", "content_type", "=", "webob_response", ".", "content_type"...
Returns a django response to the `webob_response`
[ "Returns", "a", "django", "response", "to", "the", "webob_response" ]
python
train
markovmodel/PyEMMA
pyemma/_ext/variational/estimators/running_moments.py
https://github.com/markovmodel/PyEMMA/blob/5c3124398217de05ba5ce9c8fb01519222481ab8/pyemma/_ext/variational/estimators/running_moments.py#L233-L308
def add(self, X, Y=None, weights=None): """ Add trajectory to estimate. Parameters ---------- X : ndarray(T, N) array of N time series. Y : ndarray(T, N) array of N time series, usually time shifted version of X. weights : None or float or...
[ "def", "add", "(", "self", ",", "X", ",", "Y", "=", "None", ",", "weights", "=", "None", ")", ":", "# check input", "T", "=", "X", ".", "shape", "[", "0", "]", "if", "Y", "is", "not", "None", ":", "assert", "Y", ".", "shape", "[", "0", "]", ...
Add trajectory to estimate. Parameters ---------- X : ndarray(T, N) array of N time series. Y : ndarray(T, N) array of N time series, usually time shifted version of X. weights : None or float or ndarray(T, ): weights assigned to each trajecto...
[ "Add", "trajectory", "to", "estimate", "." ]
python
train
DataONEorg/d1_python
lib_common/src/d1_common/checksum.py
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/lib_common/src/d1_common/checksum.py#L168-L189
def calculate_checksum_on_bytes( b, algorithm=d1_common.const.DEFAULT_CHECKSUM_ALGORITHM ): """Calculate the checksum of ``bytes``. Warning: This method requires the entire object to be buffered in (virtual) memory, which should normally be avoided in production code. Args: b: bytes ...
[ "def", "calculate_checksum_on_bytes", "(", "b", ",", "algorithm", "=", "d1_common", ".", "const", ".", "DEFAULT_CHECKSUM_ALGORITHM", ")", ":", "checksum_calc", "=", "get_checksum_calculator_by_dataone_designator", "(", "algorithm", ")", "checksum_calc", ".", "update", "...
Calculate the checksum of ``bytes``. Warning: This method requires the entire object to be buffered in (virtual) memory, which should normally be avoided in production code. Args: b: bytes Raw bytes algorithm: str Checksum algorithm, ``MD5`` or ``SHA1`` / ``SHA-1``. Retur...
[ "Calculate", "the", "checksum", "of", "bytes", "." ]
python
train
NetEaseGame/ATX
atx/cmds/tcpproxy.py
https://github.com/NetEaseGame/ATX/blob/f4415c57b45cb0730e08899cbc92a2af1c047ffb/atx/cmds/tcpproxy.py#L16-L28
def main(forward=26944, host='127.0.0.1', listen=5555): ''' Args: - forward(int): local forward port - host(string): local forward host - listen(int): listen port ''' # HTTP->HTTP: On your computer, browse to "http://127.0.0.1:81/" and you'll get http://www.google.com server ...
[ "def", "main", "(", "forward", "=", "26944", ",", "host", "=", "'127.0.0.1'", ",", "listen", "=", "5555", ")", ":", "# HTTP->HTTP: On your computer, browse to \"http://127.0.0.1:81/\" and you'll get http://www.google.com", "server", "=", "maproxy", ".", "proxyserver", "."...
Args: - forward(int): local forward port - host(string): local forward host - listen(int): listen port
[ "Args", ":", "-", "forward", "(", "int", ")", ":", "local", "forward", "port", "-", "host", "(", "string", ")", ":", "local", "forward", "host", "-", "listen", "(", "int", ")", ":", "listen", "port" ]
python
train
jlesquembre/autopilot
src/autopilot/main.py
https://github.com/jlesquembre/autopilot/blob/ca5f36269ba0173bd29c39db6971dac57a58513d/src/autopilot/main.py#L55-L82
def release(no_master, release_type): '''Releases a new version''' try: locale.setlocale(locale.LC_ALL, '') except: print("Warning: Unable to set locale. Expect encoding problems.") git.is_repo_clean(master=(not no_master)) config = utils.get_config() config.update(utils.get_...
[ "def", "release", "(", "no_master", ",", "release_type", ")", ":", "try", ":", "locale", ".", "setlocale", "(", "locale", ".", "LC_ALL", ",", "''", ")", "except", ":", "print", "(", "\"Warning: Unable to set locale. Expect encoding problems.\"", ")", "git", "."...
Releases a new version
[ "Releases", "a", "new", "version" ]
python
train
testedminds/sand
sand/csv.py
https://github.com/testedminds/sand/blob/234f0eedb0742920cdf26da9bc84bf3f863a2f02/sand/csv.py#L23-L26
def csv_to_dicts(file, header=None): """Reads a csv and returns a List of Dicts with keys given by header row.""" with open(file) as csvfile: return [row for row in csv.DictReader(csvfile, fieldnames=header)]
[ "def", "csv_to_dicts", "(", "file", ",", "header", "=", "None", ")", ":", "with", "open", "(", "file", ")", "as", "csvfile", ":", "return", "[", "row", "for", "row", "in", "csv", ".", "DictReader", "(", "csvfile", ",", "fieldnames", "=", "header", ")...
Reads a csv and returns a List of Dicts with keys given by header row.
[ "Reads", "a", "csv", "and", "returns", "a", "List", "of", "Dicts", "with", "keys", "given", "by", "header", "row", "." ]
python
train
liftoff/pyminifier
pyminifier/__main__.py
https://github.com/liftoff/pyminifier/blob/087ea7b0c8c964f1f907c3f350f5ce281798db86/pyminifier/__main__.py#L17-L171
def main(): """ Sets up our command line options, prints the usage/help (if warranted), and runs :py:func:`pyminifier.pyminify` with the given command line options. """ usage = '%prog [options] "<input file>"' if '__main__.py' in sys.argv[0]: # python -m pyminifier usage = 'pyminifier [o...
[ "def", "main", "(", ")", ":", "usage", "=", "'%prog [options] \"<input file>\"'", "if", "'__main__.py'", "in", "sys", ".", "argv", "[", "0", "]", ":", "# python -m pyminifier", "usage", "=", "'pyminifier [options] \"<input file>\"'", "parser", "=", "OptionParser", "...
Sets up our command line options, prints the usage/help (if warranted), and runs :py:func:`pyminifier.pyminify` with the given command line options.
[ "Sets", "up", "our", "command", "line", "options", "prints", "the", "usage", "/", "help", "(", "if", "warranted", ")", "and", "runs", ":", "py", ":", "func", ":", "pyminifier", ".", "pyminify", "with", "the", "given", "command", "line", "options", "." ]
python
train
dpkp/kafka-python
kafka/metrics/dict_reporter.py
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/metrics/dict_reporter.py#L21-L35
def snapshot(self): """ Return a nested dictionary snapshot of all metrics and their values at this time. Example: { 'category': { 'metric1_name': 42.0, 'metric2_name': 'foo' } } """ return dict((category, di...
[ "def", "snapshot", "(", "self", ")", ":", "return", "dict", "(", "(", "category", ",", "dict", "(", "(", "name", ",", "metric", ".", "value", "(", ")", ")", "for", "name", ",", "metric", "in", "list", "(", "metrics", ".", "items", "(", ")", ")", ...
Return a nested dictionary snapshot of all metrics and their values at this time. Example: { 'category': { 'metric1_name': 42.0, 'metric2_name': 'foo' } }
[ "Return", "a", "nested", "dictionary", "snapshot", "of", "all", "metrics", "and", "their", "values", "at", "this", "time", ".", "Example", ":", "{", "category", ":", "{", "metric1_name", ":", "42", ".", "0", "metric2_name", ":", "foo", "}", "}" ]
python
train
Asana/python-asana
asana/resources/gen/tasks.py
https://github.com/Asana/python-asana/blob/6deb7a34495db23f44858e53b6bb2c9eccff7872/asana/resources/gen/tasks.py#L178-L189
def add_dependencies(self, task, params={}, **options): """Marks a set of tasks as dependencies of this task, if they are not already dependencies. *A task can have at most 15 dependencies.* Parameters ---------- task : {Id} The task to add dependencies to. [data] : {Ob...
[ "def", "add_dependencies", "(", "self", ",", "task", ",", "params", "=", "{", "}", ",", "*", "*", "options", ")", ":", "path", "=", "\"/tasks/%s/addDependencies\"", "%", "(", "task", ")", "return", "self", ".", "client", ".", "post", "(", "path", ",", ...
Marks a set of tasks as dependencies of this task, if they are not already dependencies. *A task can have at most 15 dependencies.* Parameters ---------- task : {Id} The task to add dependencies to. [data] : {Object} Data for the request - dependencies : {Array} An arr...
[ "Marks", "a", "set", "of", "tasks", "as", "dependencies", "of", "this", "task", "if", "they", "are", "not", "already", "dependencies", ".", "*", "A", "task", "can", "have", "at", "most", "15", "dependencies", ".", "*" ]
python
train
diffeo/rejester
rejester/_registry.py
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_registry.py#L524-L579
def popitem(self, dict_name, priority_min='-inf', priority_max='+inf'): '''Select an item and remove it. The item comes from `dict_name`, and has the lowest score at least `priority_min` and at most `priority_max`. If some item is found, remove it from `dict_name` and return it. ...
[ "def", "popitem", "(", "self", ",", "dict_name", ",", "priority_min", "=", "'-inf'", ",", "priority_max", "=", "'+inf'", ")", ":", "if", "self", ".", "_session_lock_identifier", "is", "None", ":", "raise", "ProgrammerError", "(", "'must acquire lock first'", ")"...
Select an item and remove it. The item comes from `dict_name`, and has the lowest score at least `priority_min` and at most `priority_max`. If some item is found, remove it from `dict_name` and return it. This runs as a single atomic operation but still requires a session lock...
[ "Select", "an", "item", "and", "remove", "it", "." ]
python
train
simion/pip-upgrader
pip_upgrader/requirements_detector.py
https://github.com/simion/pip-upgrader/blob/716adca65d9ed56d4d416f94ede8a8e4fa8d640a/pip_upgrader/requirements_detector.py#L32-L45
def autodetect_files(self): """ Attempt to detect requirements files in the current working directory """ if self._is_valid_requirements_file('requirements.txt'): self.filenames.append('requirements.txt') if self._is_valid_requirements_file('requirements.pip'): # pragma: nocover ...
[ "def", "autodetect_files", "(", "self", ")", ":", "if", "self", ".", "_is_valid_requirements_file", "(", "'requirements.txt'", ")", ":", "self", ".", "filenames", ".", "append", "(", "'requirements.txt'", ")", "if", "self", ".", "_is_valid_requirements_file", "(",...
Attempt to detect requirements files in the current working directory
[ "Attempt", "to", "detect", "requirements", "files", "in", "the", "current", "working", "directory" ]
python
test
nmdp-bioinformatics/SeqAnn
seqann/util.py
https://github.com/nmdp-bioinformatics/SeqAnn/blob/5ce91559b0a4fbe4fb7758e034eb258202632463/seqann/util.py#L257-L270
def deserialize_date(string): """ Deserializes string to date. :param string: str. :type string: str :return: date. :rtype: date """ try: from dateutil.parser import parse return parse(string).date() except ImportError: return string
[ "def", "deserialize_date", "(", "string", ")", ":", "try", ":", "from", "dateutil", ".", "parser", "import", "parse", "return", "parse", "(", "string", ")", ".", "date", "(", ")", "except", "ImportError", ":", "return", "string" ]
Deserializes string to date. :param string: str. :type string: str :return: date. :rtype: date
[ "Deserializes", "string", "to", "date", "." ]
python
train
aiidateam/aiida-codtools
aiida_codtools/common/cli.py
https://github.com/aiidateam/aiida-codtools/blob/da5e4259b7a2e86cf0cc3f997e11dd36d445fa94/aiida_codtools/common/cli.py#L170-L200
def run(self, daemon=False): """Launch the process with the given inputs, by default running in the current interpreter. :param daemon: boolean, if True, will submit the process instead of running it. """ from aiida.engine import launch # If daemon is True, submit the process a...
[ "def", "run", "(", "self", ",", "daemon", "=", "False", ")", ":", "from", "aiida", ".", "engine", "import", "launch", "# If daemon is True, submit the process and return", "if", "daemon", ":", "node", "=", "launch", ".", "submit", "(", "self", ".", "process", ...
Launch the process with the given inputs, by default running in the current interpreter. :param daemon: boolean, if True, will submit the process instead of running it.
[ "Launch", "the", "process", "with", "the", "given", "inputs", "by", "default", "running", "in", "the", "current", "interpreter", "." ]
python
train
RonenNess/grepfunc
grepfunc/grepfunc.py
https://github.com/RonenNess/grepfunc/blob/a5323d082c0a581e4b053ef85838c9a0101b43ff/grepfunc/grepfunc.py#L18-L39
def __fix_args(kwargs): """ Set all named arguments shortcuts and flags. """ kwargs.setdefault('fixed_strings', kwargs.get('F')) kwargs.setdefault('basic_regexp', kwargs.get('G')) kwargs.setdefault('extended_regexp', kwargs.get('E')) kwargs.setdefault('ignore_case', kwargs.get('i')) kwar...
[ "def", "__fix_args", "(", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'fixed_strings'", ",", "kwargs", ".", "get", "(", "'F'", ")", ")", "kwargs", ".", "setdefault", "(", "'basic_regexp'", ",", "kwargs", ".", "get", "(", "'G'", ")", ")", "kw...
Set all named arguments shortcuts and flags.
[ "Set", "all", "named", "arguments", "shortcuts", "and", "flags", "." ]
python
train
theonion/django-bulbs
bulbs/api/permissions.py
https://github.com/theonion/django-bulbs/blob/0c0e6e3127a7dc487b96677fab95cacd2b3806da/bulbs/api/permissions.py#L78-L86
def has_permission(self, request, view): """If method is GET, user can access, if method is PUT or POST user must be a superuser. """ has_permission = False if request.method == "GET" \ or request.method in ["PUT", "POST", "DELETE"] \ and request.user and ...
[ "def", "has_permission", "(", "self", ",", "request", ",", "view", ")", ":", "has_permission", "=", "False", "if", "request", ".", "method", "==", "\"GET\"", "or", "request", ".", "method", "in", "[", "\"PUT\"", ",", "\"POST\"", ",", "\"DELETE\"", "]", "...
If method is GET, user can access, if method is PUT or POST user must be a superuser.
[ "If", "method", "is", "GET", "user", "can", "access", "if", "method", "is", "PUT", "or", "POST", "user", "must", "be", "a", "superuser", "." ]
python
train
volfpeter/graphscraper
src/graphscraper/spotifyartist.py
https://github.com/volfpeter/graphscraper/blob/11d407509956a282ee25190ed6491a162fc0fe7f/src/graphscraper/spotifyartist.py#L347-L382
def search_artists_by_name(self, artist_name: str, limit: int = 5) -> List[NameExternalIDPair]: """ Returns zero or more artist name - external ID pairs that match the specified artist name. Arguments: artist_name (str): The artist name to search in the Spotify API. limi...
[ "def", "search_artists_by_name", "(", "self", ",", "artist_name", ":", "str", ",", "limit", ":", "int", "=", "5", ")", "->", "List", "[", "NameExternalIDPair", "]", ":", "response", ":", "requests", ".", "Response", "=", "requests", ".", "get", "(", "sel...
Returns zero or more artist name - external ID pairs that match the specified artist name. Arguments: artist_name (str): The artist name to search in the Spotify API. limit (int): The maximum number of results to return. Returns: Zero or more artist name - external ...
[ "Returns", "zero", "or", "more", "artist", "name", "-", "external", "ID", "pairs", "that", "match", "the", "specified", "artist", "name", "." ]
python
train
Spinmob/spinmob
_functions.py
https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L35-L124
def coarsen_data(x, y, ey=None, ex=None, level=2, exponential=False): """ Coarsens the supplied data set. Returns coarsened arrays of x, y, along with quadrature-coarsened arrays of ey and ex if specified. Parameters ---------- x, y Data arrays. Can be lists (will convert to numpy a...
[ "def", "coarsen_data", "(", "x", ",", "y", ",", "ey", "=", "None", ",", "ex", "=", "None", ",", "level", "=", "2", ",", "exponential", "=", "False", ")", ":", "# Normal coarsening", "if", "not", "exponential", ":", "# Coarsen the data", "xc", "=", "coa...
Coarsens the supplied data set. Returns coarsened arrays of x, y, along with quadrature-coarsened arrays of ey and ex if specified. Parameters ---------- x, y Data arrays. Can be lists (will convert to numpy arrays). These are coarsened by taking an average. ey=None, ex=None ...
[ "Coarsens", "the", "supplied", "data", "set", ".", "Returns", "coarsened", "arrays", "of", "x", "y", "along", "with", "quadrature", "-", "coarsened", "arrays", "of", "ey", "and", "ex", "if", "specified", ".", "Parameters", "----------", "x", "y", "Data", "...
python
train
nerdvegas/rez
src/build_utils/virtualenv/virtualenv.py
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/build_utils/virtualenv/virtualenv.py#L385-L390
def show_progress(self): """If we are in a progress scope, and no log messages have been shown, write out another '.'""" if self.in_progress_hanging: sys.stdout.write('.') sys.stdout.flush()
[ "def", "show_progress", "(", "self", ")", ":", "if", "self", ".", "in_progress_hanging", ":", "sys", ".", "stdout", ".", "write", "(", "'.'", ")", "sys", ".", "stdout", ".", "flush", "(", ")" ]
If we are in a progress scope, and no log messages have been shown, write out another '.
[ "If", "we", "are", "in", "a", "progress", "scope", "and", "no", "log", "messages", "have", "been", "shown", "write", "out", "another", "." ]
python
train
bcbio/bcbio-nextgen
bcbio/qc/viral.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/viral.py#L59-L64
def get_files(data): """Retrieve pre-installed viral reference files. """ all_files = glob.glob(os.path.normpath(os.path.join(os.path.dirname(dd.get_ref_file(data)), os.pardir, "viral", "*"))) return sorted(all_files)
[ "def", "get_files", "(", "data", ")", ":", "all_files", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "dd", ".", "get_ref_file", "(", "data", "...
Retrieve pre-installed viral reference files.
[ "Retrieve", "pre", "-", "installed", "viral", "reference", "files", "." ]
python
train
base4sistemas/satcfe
satcfe/clientelocal.py
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/clientelocal.py#L163-L170
def extrair_logs(self): """Sobrepõe :meth:`~satcfe.base.FuncoesSAT.extrair_logs`. :return: Uma resposta SAT especializada em ``ExtrairLogs``. :rtype: satcfe.resposta.extrairlogs.RespostaExtrairLogs """ retorno = super(ClienteSATLocal, self).extrair_logs() return Resposta...
[ "def", "extrair_logs", "(", "self", ")", ":", "retorno", "=", "super", "(", "ClienteSATLocal", ",", "self", ")", ".", "extrair_logs", "(", ")", "return", "RespostaExtrairLogs", ".", "analisar", "(", "retorno", ")" ]
Sobrepõe :meth:`~satcfe.base.FuncoesSAT.extrair_logs`. :return: Uma resposta SAT especializada em ``ExtrairLogs``. :rtype: satcfe.resposta.extrairlogs.RespostaExtrairLogs
[ "Sobrepõe", ":", "meth", ":", "~satcfe", ".", "base", ".", "FuncoesSAT", ".", "extrair_logs", "." ]
python
train
theislab/anndata
anndata/base.py
https://github.com/theislab/anndata/blob/34f4eb63710628fbc15e7050e5efcac1d7806062/anndata/base.py#L225-L232
def _check_2d_shape(X): """Check shape of array or sparse matrix. Assure that X is always 2D: Unlike numpy we always deal with 2D arrays. """ if X.dtype.names is None and len(X.shape) != 2: raise ValueError('X needs to be 2-dimensional, not ' '{}-dimensional.'.format(le...
[ "def", "_check_2d_shape", "(", "X", ")", ":", "if", "X", ".", "dtype", ".", "names", "is", "None", "and", "len", "(", "X", ".", "shape", ")", "!=", "2", ":", "raise", "ValueError", "(", "'X needs to be 2-dimensional, not '", "'{}-dimensional.'", ".", "form...
Check shape of array or sparse matrix. Assure that X is always 2D: Unlike numpy we always deal with 2D arrays.
[ "Check", "shape", "of", "array", "or", "sparse", "matrix", "." ]
python
train
hollenstein/maspy
maspy/proteindb.py
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/proteindb.py#L293-L324
def load(cls, path, name): """Imports the specified ``proteindb`` file from the hard disk. :param path: filedirectory of the ``proteindb`` file :param name: filename without the file extension ".proteindb" .. note:: this generates rather large files, which actually take longer ...
[ "def", "load", "(", "cls", ",", "path", ",", "name", ")", ":", "filepath", "=", "aux", ".", "joinpath", "(", "path", ",", "name", "+", "'.proteindb'", ")", "with", "zipfile", ".", "ZipFile", "(", "filepath", ",", "'r'", ",", "allowZip64", "=", "True"...
Imports the specified ``proteindb`` file from the hard disk. :param path: filedirectory of the ``proteindb`` file :param name: filename without the file extension ".proteindb" .. note:: this generates rather large files, which actually take longer to import than to newly generate. ...
[ "Imports", "the", "specified", "proteindb", "file", "from", "the", "hard", "disk", "." ]
python
train
NeuroML/pyNeuroML
pyneuroml/pynml.py
https://github.com/NeuroML/pyNeuroML/blob/aeba2e3040b360bb26556f643cccbfb3dac3b8fb/pyneuroml/pynml.py#L419-L441
def quick_summary(nml2_doc): ''' Or better just use nml2_doc.summary(show_includes=False) ''' info = 'Contents of NeuroML 2 document: %s\n'%nml2_doc.id membs = inspect.getmembers(nml2_doc) for memb in membs: if isinstance(memb[1], list) and len(memb[1])>0 \ and not...
[ "def", "quick_summary", "(", "nml2_doc", ")", ":", "info", "=", "'Contents of NeuroML 2 document: %s\\n'", "%", "nml2_doc", ".", "id", "membs", "=", "inspect", ".", "getmembers", "(", "nml2_doc", ")", "for", "memb", "in", "membs", ":", "if", "isinstance", "(",...
Or better just use nml2_doc.summary(show_includes=False)
[ "Or", "better", "just", "use", "nml2_doc", ".", "summary", "(", "show_includes", "=", "False", ")" ]
python
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L138-L144
def pretty (self): '''This returns a copy of the screen as a unicode string with an ASCII text box around the screen border. This is similar to __str__/__unicode__ except that it adds a box.''' top_bot = u'+' + u'-'*self.cols + u'+\n' return top_bot + u'\n'.join([u'|'+line+u'|' ...
[ "def", "pretty", "(", "self", ")", ":", "top_bot", "=", "u'+'", "+", "u'-'", "*", "self", ".", "cols", "+", "u'+\\n'", "return", "top_bot", "+", "u'\\n'", ".", "join", "(", "[", "u'|'", "+", "line", "+", "u'|'", "for", "line", "in", "unicode", "(",...
This returns a copy of the screen as a unicode string with an ASCII text box around the screen border. This is similar to __str__/__unicode__ except that it adds a box.
[ "This", "returns", "a", "copy", "of", "the", "screen", "as", "a", "unicode", "string", "with", "an", "ASCII", "text", "box", "around", "the", "screen", "border", ".", "This", "is", "similar", "to", "__str__", "/", "__unicode__", "except", "that", "it", "...
python
train
RedHatInsights/insights-core
insights/configtree/__init__.py
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/insights/configtree/__init__.py#L165-L174
def find(self, *queries, **kwargs): """ Finds the first result found anywhere in the configuration. Pass `one=last` for the last result. Returns `None` if no results are found. """ kwargs["deep"] = True kwargs["roots"] = False if "one" not in kwargs: k...
[ "def", "find", "(", "self", ",", "*", "queries", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "\"deep\"", "]", "=", "True", "kwargs", "[", "\"roots\"", "]", "=", "False", "if", "\"one\"", "not", "in", "kwargs", ":", "kwargs", "[", "\"one\"", "...
Finds the first result found anywhere in the configuration. Pass `one=last` for the last result. Returns `None` if no results are found.
[ "Finds", "the", "first", "result", "found", "anywhere", "in", "the", "configuration", ".", "Pass", "one", "=", "last", "for", "the", "last", "result", ".", "Returns", "None", "if", "no", "results", "are", "found", "." ]
python
train
scanny/python-pptx
pptx/parts/image.py
https://github.com/scanny/python-pptx/blob/d6ab8234f8b03953d2f831ff9394b1852db34130/pptx/parts/image.py#L230-L245
def ext(self): """ Canonical file extension for this image e.g. ``'png'``. The returned extension is all lowercase and is the canonical extension for the content type of this image, regardless of what extension may have been used in its filename, if any. """ ext_m...
[ "def", "ext", "(", "self", ")", ":", "ext_map", "=", "{", "'BMP'", ":", "'bmp'", ",", "'GIF'", ":", "'gif'", ",", "'JPEG'", ":", "'jpg'", ",", "'PNG'", ":", "'png'", ",", "'TIFF'", ":", "'tiff'", ",", "'WMF'", ":", "'wmf'", "}", "format", "=", "s...
Canonical file extension for this image e.g. ``'png'``. The returned extension is all lowercase and is the canonical extension for the content type of this image, regardless of what extension may have been used in its filename, if any.
[ "Canonical", "file", "extension", "for", "this", "image", "e", ".", "g", ".", "png", ".", "The", "returned", "extension", "is", "all", "lowercase", "and", "is", "the", "canonical", "extension", "for", "the", "content", "type", "of", "this", "image", "regar...
python
train
yahoo/TensorFlowOnSpark
examples/wide_deep/census_dataset.py
https://github.com/yahoo/TensorFlowOnSpark/blob/5e4b6c185ab722fd0104ede0377e1149ea8d6f7c/examples/wide_deep/census_dataset.py#L89-L157
def build_model_columns(): """Builds a set of wide and deep feature columns.""" # Continuous variable columns age = tf.feature_column.numeric_column('age') education_num = tf.feature_column.numeric_column('education_num') capital_gain = tf.feature_column.numeric_column('capital_gain') capital_loss = tf.feat...
[ "def", "build_model_columns", "(", ")", ":", "# Continuous variable columns", "age", "=", "tf", ".", "feature_column", ".", "numeric_column", "(", "'age'", ")", "education_num", "=", "tf", ".", "feature_column", ".", "numeric_column", "(", "'education_num'", ")", ...
Builds a set of wide and deep feature columns.
[ "Builds", "a", "set", "of", "wide", "and", "deep", "feature", "columns", "." ]
python
train
fabioz/PyDev.Debugger
pydev_ipython/qt_loaders.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydev_ipython/qt_loaders.py#L85-L124
def has_binding(api): """Safely check for PyQt4 or PySide, without importing submodules Parameters ---------- api : str [ 'pyqtv1' | 'pyqt' | 'pyside' | 'pyqtdefault'] Which module to check for Returns ------- True if the relevant module appears to be i...
[ "def", "has_binding", "(", "api", ")", ":", "# we can't import an incomplete pyside and pyqt4", "# this will cause a crash in sip (#1431)", "# check for complete presence before importing", "module_name", "=", "{", "QT_API_PYSIDE", ":", "'PySide'", ",", "QT_API_PYQT", ":", "'PyQt...
Safely check for PyQt4 or PySide, without importing submodules Parameters ---------- api : str [ 'pyqtv1' | 'pyqt' | 'pyside' | 'pyqtdefault'] Which module to check for Returns ------- True if the relevant module appears to be importable
[ "Safely", "check", "for", "PyQt4", "or", "PySide", "without", "importing", "submodules" ]
python
train
saltstack/salt
salt/netapi/rest_wsgi.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_wsgi.py#L192-L203
def get_json(environ): ''' Return the request body as JSON ''' content_type = environ.get('CONTENT_TYPE', '') if content_type != 'application/json': raise HTTPError(406, 'JSON required') try: return salt.utils.json.loads(read_body(environ)) except ValueError as exc: ...
[ "def", "get_json", "(", "environ", ")", ":", "content_type", "=", "environ", ".", "get", "(", "'CONTENT_TYPE'", ",", "''", ")", "if", "content_type", "!=", "'application/json'", ":", "raise", "HTTPError", "(", "406", ",", "'JSON required'", ")", "try", ":", ...
Return the request body as JSON
[ "Return", "the", "request", "body", "as", "JSON" ]
python
train
KelSolaar/Foundations
foundations/strings.py
https://github.com/KelSolaar/Foundations/blob/5c141330faf09dad70a12bc321f4c564917d0a91/foundations/strings.py#L62-L80
def get_nice_name(name): """ Converts a string to nice string: **currentLogText** -> **Current Log Text**. Usage:: >>> get_nice_name("getMeANiceName") u'Get Me A Nice Name' >>> get_nice_name("__getMeANiceName") u'__Get Me A Nice Name' :param name: Current string to be ...
[ "def", "get_nice_name", "(", "name", ")", ":", "chunks", "=", "re", ".", "sub", "(", "r\"(.)([A-Z][a-z]+)\"", ",", "r\"\\1 \\2\"", ",", "name", ")", "return", "\" \"", ".", "join", "(", "element", ".", "title", "(", ")", "for", "element", "in", "re", "...
Converts a string to nice string: **currentLogText** -> **Current Log Text**. Usage:: >>> get_nice_name("getMeANiceName") u'Get Me A Nice Name' >>> get_nice_name("__getMeANiceName") u'__Get Me A Nice Name' :param name: Current string to be nicified. :type name: unicode ...
[ "Converts", "a", "string", "to", "nice", "string", ":", "**", "currentLogText", "**", "-", ">", "**", "Current", "Log", "Text", "**", "." ]
python
train
signetlabdei/sem
sem/cli.py
https://github.com/signetlabdei/sem/blob/5077dd7a6d15644a18790bb6fde320e905f0fef0/sem/cli.py#L349-L367
def query_parameters(param_list, defaults=None): """ Asks the user for parameters. If available, proposes some defaults. Args: param_list (list): List of parameters to ask the user for values. defaults (list): A list of proposed defaults. It must be a list of the same length as ...
[ "def", "query_parameters", "(", "param_list", ",", "defaults", "=", "None", ")", ":", "script_params", "=", "collections", ".", "OrderedDict", "(", "[", "k", ",", "[", "]", "]", "for", "k", "in", "param_list", ")", "for", "param", ",", "default", "in", ...
Asks the user for parameters. If available, proposes some defaults. Args: param_list (list): List of parameters to ask the user for values. defaults (list): A list of proposed defaults. It must be a list of the same length as param_list. A value of None in one element of the ...
[ "Asks", "the", "user", "for", "parameters", ".", "If", "available", "proposes", "some", "defaults", "." ]
python
train
bram85/topydo
topydo/lib/WriteCommand.py
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/WriteCommand.py#L22-L77
def postprocess_input_todo(self, p_todo): """ Post-processes a parsed todo when adding it to the list. * It converts relative dates to absolute ones. * Automatically inserts a creation date if not present. * Handles more user-friendly dependencies with before:, partof: and ...
[ "def", "postprocess_input_todo", "(", "self", ",", "p_todo", ")", ":", "def", "convert_date", "(", "p_tag", ")", ":", "value", "=", "p_todo", ".", "tag_value", "(", "p_tag", ")", "if", "value", ":", "dateobj", "=", "relative_date_to_date", "(", "value", ")...
Post-processes a parsed todo when adding it to the list. * It converts relative dates to absolute ones. * Automatically inserts a creation date if not present. * Handles more user-friendly dependencies with before:, partof: and after: tags
[ "Post", "-", "processes", "a", "parsed", "todo", "when", "adding", "it", "to", "the", "list", "." ]
python
train
hover2pi/svo_filters
svo_filters/svo.py
https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L799-L886
def filters(filter_directory=None, update=False, fmt='table', **kwargs): """ Get a list of the available filters Parameters ---------- filter_directory: str The directory containing the filter relative spectral response curves update: bool Check the filter directory for new filt...
[ "def", "filters", "(", "filter_directory", "=", "None", ",", "update", "=", "False", ",", "fmt", "=", "'table'", ",", "*", "*", "kwargs", ")", ":", "if", "filter_directory", "is", "None", ":", "filter_directory", "=", "resource_filename", "(", "'svo_filters'...
Get a list of the available filters Parameters ---------- filter_directory: str The directory containing the filter relative spectral response curves update: bool Check the filter directory for new filters and generate pickle of table fmt: str The format for the returned tab...
[ "Get", "a", "list", "of", "the", "available", "filters" ]
python
train
googleapis/oauth2client
oauth2client/contrib/flask_util.py
https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/contrib/flask_util.py#L444-L453
def has_credentials(self): """Returns True if there are valid credentials for the current user.""" if not self.credentials: return False # Is the access token expired? If so, do we have an refresh token? elif (self.credentials.access_token_expired and not self...
[ "def", "has_credentials", "(", "self", ")", ":", "if", "not", "self", ".", "credentials", ":", "return", "False", "# Is the access token expired? If so, do we have an refresh token?", "elif", "(", "self", ".", "credentials", ".", "access_token_expired", "and", "not", ...
Returns True if there are valid credentials for the current user.
[ "Returns", "True", "if", "there", "are", "valid", "credentials", "for", "the", "current", "user", "." ]
python
valid
BerkeleyAutomation/perception
perception/orthographic_intrinsics.py
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/orthographic_intrinsics.py#L308-L339
def load(filename): """Load a CameraIntrinsics object from a file. Parameters ---------- filename : :obj:`str` The .intr file to load the object from. Returns ------- :obj:`CameraIntrinsics` The CameraIntrinsics object loaded from the fil...
[ "def", "load", "(", "filename", ")", ":", "file_root", ",", "file_ext", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "if", "file_ext", ".", "lower", "(", ")", "!=", "INTR_EXTENSION", ":", "raise", "ValueError", "(", "'Extension %s not sup...
Load a CameraIntrinsics object from a file. Parameters ---------- filename : :obj:`str` The .intr file to load the object from. Returns ------- :obj:`CameraIntrinsics` The CameraIntrinsics object loaded from the file. Raises ----...
[ "Load", "a", "CameraIntrinsics", "object", "from", "a", "file", "." ]
python
train
tnkteja/myhelp
virtualEnvironment/lib/python2.7/site-packages/coverage/data.py
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/data.py#L152-L176
def _read_file(self, filename): """Return the stored coverage data from the given file. Returns two values, suitable for assigning to `self.lines` and `self.arcs`. """ lines = {} arcs = {} try: data = self.raw_data(filename) if isinstance...
[ "def", "_read_file", "(", "self", ",", "filename", ")", ":", "lines", "=", "{", "}", "arcs", "=", "{", "}", "try", ":", "data", "=", "self", ".", "raw_data", "(", "filename", ")", "if", "isinstance", "(", "data", ",", "dict", ")", ":", "# Unpack th...
Return the stored coverage data from the given file. Returns two values, suitable for assigning to `self.lines` and `self.arcs`.
[ "Return", "the", "stored", "coverage", "data", "from", "the", "given", "file", "." ]
python
test
ghukill/pyfc4
pyfc4/models.py
https://github.com/ghukill/pyfc4/blob/59011df592f08978c4a901a908862d112a5dcf02/pyfc4/models.py#L1257-L1287
def _handle_object(self, object_input): ''' Method to handle possible values passed for adding, removing, modifying triples. Detects type of input and sets appropriate http://www.w3.org/2001/XMLSchema# datatype Args: object_input (str,int,datetime,): many possible inputs Returns: (rdflib.term.Literal...
[ "def", "_handle_object", "(", "self", ",", "object_input", ")", ":", "# if object is string, convert to rdflib.term.Literal with appropriate datatype", "if", "type", "(", "object_input", ")", "==", "str", ":", "return", "rdflib", ".", "term", ".", "Literal", "(", "obj...
Method to handle possible values passed for adding, removing, modifying triples. Detects type of input and sets appropriate http://www.w3.org/2001/XMLSchema# datatype Args: object_input (str,int,datetime,): many possible inputs Returns: (rdflib.term.Literal): with appropriate datatype attribute
[ "Method", "to", "handle", "possible", "values", "passed", "for", "adding", "removing", "modifying", "triples", ".", "Detects", "type", "of", "input", "and", "sets", "appropriate", "http", ":", "//", "www", ".", "w3", ".", "org", "/", "2001", "/", "XMLSchem...
python
train
pyca/pyopenssl
src/OpenSSL/SSL.py
https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1077-L1104
def set_verify(self, mode, callback): """ et the verification flags for this Context object to *mode* and specify that *callback* should be used for verification callbacks. :param mode: The verify mode, this should be one of :const:`VERIFY_NONE` and :const:`VERIFY_PEER`. If ...
[ "def", "set_verify", "(", "self", ",", "mode", ",", "callback", ")", ":", "if", "not", "isinstance", "(", "mode", ",", "integer_types", ")", ":", "raise", "TypeError", "(", "\"mode must be an integer\"", ")", "if", "not", "callable", "(", "callback", ")", ...
et the verification flags for this Context object to *mode* and specify that *callback* should be used for verification callbacks. :param mode: The verify mode, this should be one of :const:`VERIFY_NONE` and :const:`VERIFY_PEER`. If :const:`VERIFY_PEER` is used, *mode* can be OR...
[ "et", "the", "verification", "flags", "for", "this", "Context", "object", "to", "*", "mode", "*", "and", "specify", "that", "*", "callback", "*", "should", "be", "used", "for", "verification", "callbacks", "." ]
python
test
moonso/loqusdb
loqusdb/commands/cli.py
https://github.com/moonso/loqusdb/blob/792dcd0d461aff5adc703c49eebf58964913a513/loqusdb/commands/cli.py#L62-L111
def cli(ctx, database, username, password, authdb, port, host, uri, verbose, config, test): """loqusdb: manage a local variant count database.""" loglevel = "INFO" if verbose: loglevel = "DEBUG" coloredlogs.install(level=loglevel) LOG.info("Running loqusdb version %s", __version__) conf...
[ "def", "cli", "(", "ctx", ",", "database", ",", "username", ",", "password", ",", "authdb", ",", "port", ",", "host", ",", "uri", ",", "verbose", ",", "config", ",", "test", ")", ":", "loglevel", "=", "\"INFO\"", "if", "verbose", ":", "loglevel", "="...
loqusdb: manage a local variant count database.
[ "loqusdb", ":", "manage", "a", "local", "variant", "count", "database", "." ]
python
train
saltstack/salt
salt/modules/win_groupadd.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_groupadd.py#L166-L200
def info(name): ''' Return information about a group Args: name (str): The name of the group for which to get information Returns: dict: A dictionary of information about the group CLI Example: .. code-block:: bash salt '*' group.info foo ''' try...
[ "def", "info", "(", "name", ")", ":", "try", ":", "groupObj", "=", "_get_group_object", "(", "name", ")", "gr_name", "=", "groupObj", ".", "Name", "gr_mem", "=", "[", "_get_username", "(", "x", ")", "for", "x", "in", "groupObj", ".", "members", "(", ...
Return information about a group Args: name (str): The name of the group for which to get information Returns: dict: A dictionary of information about the group CLI Example: .. code-block:: bash salt '*' group.info foo
[ "Return", "information", "about", "a", "group" ]
python
train
nickmckay/LiPD-utilities
Python/lipd/fetch_doi.py
https://github.com/nickmckay/LiPD-utilities/blob/5dab6bbeffc5effd68e3a6beaca6b76aa928e860/Python/lipd/fetch_doi.py#L165-L180
def clean_doi(doi_string): """ Use regex to extract all DOI ids from string (i.e. 10.1029/2005pa001215) :param str doi_string: Raw DOI string value from input file. Often not properly formatted. :return list: DOI ids. May contain 0, 1, or multiple ids. """ regex = re.compile(r'\b(10[.][0-9]{3,}...
[ "def", "clean_doi", "(", "doi_string", ")", ":", "regex", "=", "re", ".", "compile", "(", "r'\\b(10[.][0-9]{3,}(?:[.][0-9]+)*/(?:(?![\"&\\'<>,])\\S)+)\\b'", ")", "try", ":", "# Returns a list of matching strings", "m", "=", "re", ".", "findall", "(", "regex", ",", "...
Use regex to extract all DOI ids from string (i.e. 10.1029/2005pa001215) :param str doi_string: Raw DOI string value from input file. Often not properly formatted. :return list: DOI ids. May contain 0, 1, or multiple ids.
[ "Use", "regex", "to", "extract", "all", "DOI", "ids", "from", "string", "(", "i", ".", "e", ".", "10", ".", "1029", "/", "2005pa001215", ")" ]
python
train
bfontaine/term2048
term2048/board.py
https://github.com/bfontaine/term2048/blob/8b5ce8b65f44f20a7ad36022a34dce56184070af/term2048/board.py#L103-L105
def getCol(self, x): """return the x-th column, starting at 0""" return [self.getCell(x, i) for i in self.__size_range]
[ "def", "getCol", "(", "self", ",", "x", ")", ":", "return", "[", "self", ".", "getCell", "(", "x", ",", "i", ")", "for", "i", "in", "self", ".", "__size_range", "]" ]
return the x-th column, starting at 0
[ "return", "the", "x", "-", "th", "column", "starting", "at", "0" ]
python
train
tensorflow/hub
examples/image_retraining/retrain.py
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/examples/image_retraining/retrain.py#L481-L544
def get_random_cached_bottlenecks(sess, image_lists, how_many, category, bottleneck_dir, image_dir, jpeg_data_tensor, decoded_image_tensor, resized_input_tensor, bottleneck_tensor, module_name): """Retrieves bottlene...
[ "def", "get_random_cached_bottlenecks", "(", "sess", ",", "image_lists", ",", "how_many", ",", "category", ",", "bottleneck_dir", ",", "image_dir", ",", "jpeg_data_tensor", ",", "decoded_image_tensor", ",", "resized_input_tensor", ",", "bottleneck_tensor", ",", "module_...
Retrieves bottleneck values for cached images. If no distortions are being applied, this function can retrieve the cached bottleneck values directly from disk for images. It picks a random set of images from the specified category. Args: sess: Current TensorFlow Session. image_lists: OrderedDict of tr...
[ "Retrieves", "bottleneck", "values", "for", "cached", "images", "." ]
python
train
rosenbrockc/fortpy
fortpy/tramp.py
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/tramp.py#L78-L86
def touch(self, filepath): """Touches the specified file so that its modified time changes.""" if self.is_ssh(filepath): self._check_ssh() remotepath = self._get_remote(filepath) stdin, stdout, stderr = self.ssh.exec_command("touch {}".format(remotepath)) ...
[ "def", "touch", "(", "self", ",", "filepath", ")", ":", "if", "self", ".", "is_ssh", "(", "filepath", ")", ":", "self", ".", "_check_ssh", "(", ")", "remotepath", "=", "self", ".", "_get_remote", "(", "filepath", ")", "stdin", ",", "stdout", ",", "st...
Touches the specified file so that its modified time changes.
[ "Touches", "the", "specified", "file", "so", "that", "its", "modified", "time", "changes", "." ]
python
train
emencia/emencia-django-forum
forum/models.py
https://github.com/emencia/emencia-django-forum/blob/cda74ed7e5822675c340ee5ec71548d981bccd3b/forum/models.py#L161-L171
def get_paginated_position(self): """ Return the Post position in the paginated list """ # If Post list is not paginated if not settings.FORUM_THREAD_DETAIL_PAGINATE: return 0 count = Post.objects.filter(thread=self.thread_id, created__lt=self.created...
[ "def", "get_paginated_position", "(", "self", ")", ":", "# If Post list is not paginated", "if", "not", "settings", ".", "FORUM_THREAD_DETAIL_PAGINATE", ":", "return", "0", "count", "=", "Post", ".", "objects", ".", "filter", "(", "thread", "=", "self", ".", "th...
Return the Post position in the paginated list
[ "Return", "the", "Post", "position", "in", "the", "paginated", "list" ]
python
train
Opentrons/opentrons
api/src/opentrons/server/endpoints/networking.py
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/api/src/opentrons/server/endpoints/networking.py#L155-L177
def _deduce_security(kwargs) -> nmcli.SECURITY_TYPES: """ Make sure that the security_type is known, or throw. """ # Security should be one of our valid strings sec_translation = { 'wpa-psk': nmcli.SECURITY_TYPES.WPA_PSK, 'none': nmcli.SECURITY_TYPES.NONE, 'wpa-eap': nmcli.SECURITY_T...
[ "def", "_deduce_security", "(", "kwargs", ")", "->", "nmcli", ".", "SECURITY_TYPES", ":", "# Security should be one of our valid strings", "sec_translation", "=", "{", "'wpa-psk'", ":", "nmcli", ".", "SECURITY_TYPES", ".", "WPA_PSK", ",", "'none'", ":", "nmcli", "."...
Make sure that the security_type is known, or throw.
[ "Make", "sure", "that", "the", "security_type", "is", "known", "or", "throw", "." ]
python
train
saltstack/salt
salt/modules/namecheap_domains_dns.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_domains_dns.py#L206-L235
def set_default(sld, tld): ''' Sets domain to use namecheap default DNS servers. Required for free services like Host record management, URL forwarding, email forwarding, dynamic DNS and other value added services. sld SLD of the domain name tld TLD of the domain name Retu...
[ "def", "set_default", "(", "sld", ",", "tld", ")", ":", "opts", "=", "salt", ".", "utils", ".", "namecheap", ".", "get_opts", "(", "'namecheap.domains.dns.setDefault'", ")", "opts", "[", "'SLD'", "]", "=", "sld", "opts", "[", "'TLD'", "]", "=", "tld", ...
Sets domain to use namecheap default DNS servers. Required for free services like Host record management, URL forwarding, email forwarding, dynamic DNS and other value added services. sld SLD of the domain name tld TLD of the domain name Returns ``True`` if the domain was successf...
[ "Sets", "domain", "to", "use", "namecheap", "default", "DNS", "servers", ".", "Required", "for", "free", "services", "like", "Host", "record", "management", "URL", "forwarding", "email", "forwarding", "dynamic", "DNS", "and", "other", "value", "added", "services...
python
train
zhanglab/psamm
psamm/lpsolver/cplex.py
https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/lpsolver/cplex.py#L206-L221
def add_linear_constraints(self, *relations): """Add constraints to the problem Each constraint is represented by a Relation, and the expression in that relation can be a set expression. """ constraints = [] for relation in relations: if self._check_relation...
[ "def", "add_linear_constraints", "(", "self", ",", "*", "relations", ")", ":", "constraints", "=", "[", "]", "for", "relation", "in", "relations", ":", "if", "self", ".", "_check_relation", "(", "relation", ")", ":", "constraints", ".", "append", "(", "Con...
Add constraints to the problem Each constraint is represented by a Relation, and the expression in that relation can be a set expression.
[ "Add", "constraints", "to", "the", "problem" ]
python
train
borntyping/python-riemann-client
riemann_client/transport.py
https://github.com/borntyping/python-riemann-client/blob/3e181d90bdf685afd21c1ec5ee20e6840b011ea5/riemann_client/transport.py#L122-L124
def connect(self): """Connects to the given host""" self.socket = socket.create_connection(self.address, self.timeout)
[ "def", "connect", "(", "self", ")", ":", "self", ".", "socket", "=", "socket", ".", "create_connection", "(", "self", ".", "address", ",", "self", ".", "timeout", ")" ]
Connects to the given host
[ "Connects", "to", "the", "given", "host" ]
python
train
jacebrowning/comparable
comparable/simple.py
https://github.com/jacebrowning/comparable/blob/48455e613650e22412d31109681368fcc479298d/comparable/simple.py#L113-L118
def similarity(self, other): """Get similarity as a ratio of the stripped text.""" logging.debug("comparing %r and %r...", self.stripped, other.stripped) ratio = SequenceMatcher(a=self.stripped, b=other.stripped).ratio() similarity = self.Similarity(ratio) return similarity
[ "def", "similarity", "(", "self", ",", "other", ")", ":", "logging", ".", "debug", "(", "\"comparing %r and %r...\"", ",", "self", ".", "stripped", ",", "other", ".", "stripped", ")", "ratio", "=", "SequenceMatcher", "(", "a", "=", "self", ".", "stripped",...
Get similarity as a ratio of the stripped text.
[ "Get", "similarity", "as", "a", "ratio", "of", "the", "stripped", "text", "." ]
python
train
RRZE-HPC/kerncraft
kerncraft/kernel.py
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L592-L603
def bytes_per_iteration(self): """ Consecutive bytes written out per high-level iterations (as counted by loop stack). Is used to compute number of iterations per cacheline. """ # TODO Find longst consecutive writes to any variable and use as basis var_name = list(self.d...
[ "def", "bytes_per_iteration", "(", "self", ")", ":", "# TODO Find longst consecutive writes to any variable and use as basis", "var_name", "=", "list", "(", "self", ".", "destinations", ")", "[", "0", "]", "var_type", "=", "self", ".", "variables", "[", "var_name", ...
Consecutive bytes written out per high-level iterations (as counted by loop stack). Is used to compute number of iterations per cacheline.
[ "Consecutive", "bytes", "written", "out", "per", "high", "-", "level", "iterations", "(", "as", "counted", "by", "loop", "stack", ")", "." ]
python
test
inasafe/inasafe
safe_extras/raven/contrib/django/client.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe_extras/raven/contrib/django/client.py#L87-L138
def install_sql_hook(): """If installed this causes Django's queries to be captured.""" try: from django.db.backends.utils import CursorWrapper except ImportError: from django.db.backends.util import CursorWrapper try: real_execute = CursorWrapper.execute real_executeman...
[ "def", "install_sql_hook", "(", ")", ":", "try", ":", "from", "django", ".", "db", ".", "backends", ".", "utils", "import", "CursorWrapper", "except", "ImportError", ":", "from", "django", ".", "db", ".", "backends", ".", "util", "import", "CursorWrapper", ...
If installed this causes Django's queries to be captured.
[ "If", "installed", "this", "causes", "Django", "s", "queries", "to", "be", "captured", "." ]
python
train
lingthio/Flask-User
flask_user/token_manager.py
https://github.com/lingthio/Flask-User/blob/a379fa0a281789618c484b459cb41236779b95b1/flask_user/token_manager.py#L147-L177
def encode_data_items(self, *args): """ Encodes a list of integers and strings into a concatenated string. - encode string items as-is. - encode integer items as base-64 with a ``'~'`` prefix. - concatenate encoded items with a ``'|'`` separator. Example: ``encode_d...
[ "def", "encode_data_items", "(", "self", ",", "*", "args", ")", ":", "str_list", "=", "[", "]", "for", "arg", "in", "args", ":", "# encode string items as-is", "if", "isinstance", "(", "arg", ",", "str", ")", ":", "arg_str", "=", "arg", "# encode integer i...
Encodes a list of integers and strings into a concatenated string. - encode string items as-is. - encode integer items as base-64 with a ``'~'`` prefix. - concatenate encoded items with a ``'|'`` separator. Example: ``encode_data_items('abc', 123, 'xyz')`` returns ``'abc|~B...
[ "Encodes", "a", "list", "of", "integers", "and", "strings", "into", "a", "concatenated", "string", "." ]
python
train
log2timeline/dfvfs
dfvfs/file_io/ewf_file_io.py
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/file_io/ewf_file_io.py#L43-L82
def _OpenFileObject(self, path_spec): """Opens the file-like object defined by path specification. Args: path_spec (PathSpec): path specification. Returns: pyewf.handle: a file-like object or None. Raises: PathSpecError: if the path specification is invalid. """ if not path_...
[ "def", "_OpenFileObject", "(", "self", ",", "path_spec", ")", ":", "if", "not", "path_spec", ".", "HasParent", "(", ")", ":", "raise", "errors", ".", "PathSpecError", "(", "'Unsupported path specification without parent.'", ")", "parent_path_spec", "=", "path_spec",...
Opens the file-like object defined by path specification. Args: path_spec (PathSpec): path specification. Returns: pyewf.handle: a file-like object or None. Raises: PathSpecError: if the path specification is invalid.
[ "Opens", "the", "file", "-", "like", "object", "defined", "by", "path", "specification", "." ]
python
train
AkihikoITOH/capybara
capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L165-L176
def _label__get(self): """ Get or set any <label> element associated with this element. """ id = self.get('id') if not id: return None result = _label_xpath(self, id=id) if not result: return None else: return result[0]
[ "def", "_label__get", "(", "self", ")", ":", "id", "=", "self", ".", "get", "(", "'id'", ")", "if", "not", "id", ":", "return", "None", "result", "=", "_label_xpath", "(", "self", ",", "id", "=", "id", ")", "if", "not", "result", ":", "return", "...
Get or set any <label> element associated with this element.
[ "Get", "or", "set", "any", "<label", ">", "element", "associated", "with", "this", "element", "." ]
python
test
saltstack/salt
salt/client/ssh/wrapper/state.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/state.py#L108-L118
def _check_pillar(kwargs, pillar=None): ''' Check the pillar for errors, refuse to run the state if there are errors in the pillar and return the pillar errors ''' if kwargs.get('force'): return True pillar_dict = pillar if pillar is not None else __pillar__ if '_errors' in pillar_di...
[ "def", "_check_pillar", "(", "kwargs", ",", "pillar", "=", "None", ")", ":", "if", "kwargs", ".", "get", "(", "'force'", ")", ":", "return", "True", "pillar_dict", "=", "pillar", "if", "pillar", "is", "not", "None", "else", "__pillar__", "if", "'_errors'...
Check the pillar for errors, refuse to run the state if there are errors in the pillar and return the pillar errors
[ "Check", "the", "pillar", "for", "errors", "refuse", "to", "run", "the", "state", "if", "there", "are", "errors", "in", "the", "pillar", "and", "return", "the", "pillar", "errors" ]
python
train
webrecorder/pywb
pywb/rewrite/templateview.py
https://github.com/webrecorder/pywb/blob/77f8bb647639dd66f6b92b7a9174c28810e4b1d9/pywb/rewrite/templateview.py#L200-L232
def render_to_string(self, env, **kwargs): """Render this template. :param dict env: The WSGI environment associated with the request causing this template to be rendered :param any kwargs: The keyword arguments to be supplied to the Jninja template render method :return: The rendered t...
[ "def", "render_to_string", "(", "self", ",", "env", ",", "*", "*", "kwargs", ")", ":", "template", "=", "None", "template_path", "=", "env", ".", "get", "(", "self", ".", "jenv", ".", "env_template_dir_key", ")", "if", "template_path", ":", "# jinja paths ...
Render this template. :param dict env: The WSGI environment associated with the request causing this template to be rendered :param any kwargs: The keyword arguments to be supplied to the Jninja template render method :return: The rendered template :rtype: str
[ "Render", "this", "template", "." ]
python
train
KelSolaar/Umbra
umbra/ui/widgets/basic_QPlainTextEdit.py
https://github.com/KelSolaar/Umbra/blob/66f45f08d9d723787f1191989f8b0dda84b412ce/umbra/ui/widgets/basic_QPlainTextEdit.py#L449-L459
def get_next_character(self): """ Returns the character after the cursor. :return: Next cursor character. :rtype: QString """ cursor = self.textCursor() cursor.movePosition(QTextCursor.NextCharacter, QTextCursor.KeepAnchor) return cursor.selectedText()
[ "def", "get_next_character", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "movePosition", "(", "QTextCursor", ".", "NextCharacter", ",", "QTextCursor", ".", "KeepAnchor", ")", "return", "cursor", ".", "selectedText"...
Returns the character after the cursor. :return: Next cursor character. :rtype: QString
[ "Returns", "the", "character", "after", "the", "cursor", "." ]
python
train
bitesofcode/projexui
projexui/widgets/xchart/xchartrenderer.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/xchartrenderer.py#L297-L318
def calculateDatasetItems(self, scene, datasets): """ Syncs the scene together with the given datasets to make sure we have the proper number of items, by removing non-existant datasets and adding new ones. :param scene | <XChartScene> ...
[ "def", "calculateDatasetItems", "(", "self", ",", "scene", ",", "datasets", ")", ":", "dataitems", "=", "scene", ".", "datasetItems", "(", ")", "olditems", "=", "set", "(", "dataitems", ".", "keys", "(", ")", ")", ".", "difference", "(", "datasets", ")",...
Syncs the scene together with the given datasets to make sure we have the proper number of items, by removing non-existant datasets and adding new ones. :param scene | <XChartScene> datasets | <XChartDataset> :return {<XChartDatase...
[ "Syncs", "the", "scene", "together", "with", "the", "given", "datasets", "to", "make", "sure", "we", "have", "the", "proper", "number", "of", "items", "by", "removing", "non", "-", "existant", "datasets", "and", "adding", "new", "ones", ".", ":", "param", ...
python
train
mitsei/dlkit
dlkit/json_/commenting/objects.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/objects.py#L303-L318
def set_rating(self, grade_id): """Sets the rating. arg: grade_id (osid.id.Id): the new rating raise: InvalidArgument - ``grade_id`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``grade_id`` is ``null`` *compliance: manda...
[ "def", "set_rating", "(", "self", ",", "grade_id", ")", ":", "# Implemented from template for osid.resource.ResourceForm.set_avatar_template", "if", "self", ".", "get_rating_metadata", "(", ")", ".", "is_read_only", "(", ")", ":", "raise", "errors", ".", "NoAccess", "...
Sets the rating. arg: grade_id (osid.id.Id): the new rating raise: InvalidArgument - ``grade_id`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``grade_id`` is ``null`` *compliance: mandatory -- This method must be implemented.*
[ "Sets", "the", "rating", "." ]
python
train
fjwCode/cerium
cerium/androiddriver.py
https://github.com/fjwCode/cerium/blob/f6e06e0dcf83a0bc924828e9d6cb81383ed2364f/cerium/androiddriver.py#L104-L118
def _execute(self, *args: str, **kwargs) -> tuple: '''Execute command.''' process = self.execute( args=args, options=merge_dict(self.options, kwargs)) command = ' '.join(process.args) if self._dev: output, error = process.communicate() print( ...
[ "def", "_execute", "(", "self", ",", "*", "args", ":", "str", ",", "*", "*", "kwargs", ")", "->", "tuple", ":", "process", "=", "self", ".", "execute", "(", "args", "=", "args", ",", "options", "=", "merge_dict", "(", "self", ".", "options", ",", ...
Execute command.
[ "Execute", "command", "." ]
python
train
CS207-Final-Project-Group-10/cs207-FinalProject
solar_system/eight_planets.py
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/solar_system/eight_planets.py#L234-L275
def accel(q: np.ndarray): """ Compute the gravitational accelerations in the system q in row vector of 6 elements: sun (x, y, z), earth (x, y, z) """ # Infer number of dimensions from q dims: int = len(q) # Initialize acceleration as dimsx1 array a: np.ndarray = np.zeros(dims) ...
[ "def", "accel", "(", "q", ":", "np", ".", "ndarray", ")", ":", "# Infer number of dimensions from q", "dims", ":", "int", "=", "len", "(", "q", ")", "# Initialize acceleration as dimsx1 array", "a", ":", "np", ".", "ndarray", "=", "np", ".", "zeros", "(", ...
Compute the gravitational accelerations in the system q in row vector of 6 elements: sun (x, y, z), earth (x, y, z)
[ "Compute", "the", "gravitational", "accelerations", "in", "the", "system", "q", "in", "row", "vector", "of", "6", "elements", ":", "sun", "(", "x", "y", "z", ")", "earth", "(", "x", "y", "z", ")" ]
python
train
Pytwitcher/pytwitcherapi
src/pytwitcherapi/chat/connection.py
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/chat/connection.py#L187-L222
def _handle_message(self, tags, source, command, target, msg): """Construct the correct events and handle them :param tags: the tags of the message :type tags: :class:`list` of :class:`message.Tag` :param source: the sender of the message :type source: :class:`str` :para...
[ "def", "_handle_message", "(", "self", ",", "tags", ",", "source", ",", "command", ",", "target", ",", "msg", ")", ":", "if", "isinstance", "(", "msg", ",", "tuple", ")", ":", "if", "command", "in", "[", "\"privmsg\"", ",", "\"pubmsg\"", "]", ":", "c...
Construct the correct events and handle them :param tags: the tags of the message :type tags: :class:`list` of :class:`message.Tag` :param source: the sender of the message :type source: :class:`str` :param command: the event type :type command: :class:`str` :par...
[ "Construct", "the", "correct", "events", "and", "handle", "them" ]
python
train
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L143-L153
def getDescriptor(self, dir): """ Detects the descriptor file for either an Unreal project or an Unreal plugin in the specified directory """ try: return self.getProjectDescriptor(dir) except: try: return self.getPluginDescriptor(dir) except: raise UnrealManagerException('could not detect an ...
[ "def", "getDescriptor", "(", "self", ",", "dir", ")", ":", "try", ":", "return", "self", ".", "getProjectDescriptor", "(", "dir", ")", "except", ":", "try", ":", "return", "self", ".", "getPluginDescriptor", "(", "dir", ")", "except", ":", "raise", "Unre...
Detects the descriptor file for either an Unreal project or an Unreal plugin in the specified directory
[ "Detects", "the", "descriptor", "file", "for", "either", "an", "Unreal", "project", "or", "an", "Unreal", "plugin", "in", "the", "specified", "directory" ]
python
train
AustralianSynchrotron/lightflow
lightflow/models/task_data.py
https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/task_data.py#L165-L177
def add_alias(self, alias, index): """ Add an alias pointing to the specified index. Args: alias (str): The alias that should point to the given index. index (int): The index of the dataset for which an alias should be added. Raises: DataInvalidIndex: If the...
[ "def", "add_alias", "(", "self", ",", "alias", ",", "index", ")", ":", "if", "index", ">=", "len", "(", "self", ".", "_datasets", ")", ":", "raise", "DataInvalidIndex", "(", "'A dataset with index {} does not exist'", ".", "format", "(", "index", ")", ")", ...
Add an alias pointing to the specified index. Args: alias (str): The alias that should point to the given index. index (int): The index of the dataset for which an alias should be added. Raises: DataInvalidIndex: If the index does not represent a valid dataset.
[ "Add", "an", "alias", "pointing", "to", "the", "specified", "index", "." ]
python
train
evhub/coconut
coconut/compiler/matching.py
https://github.com/evhub/coconut/blob/ff97177344e7604e89a0a98a977a87ed2a56fc6d/coconut/compiler/matching.py#L131-L135
def get_checks(self, position=None): """Gets the checks at the position.""" if position is None: position = self.position return self.checkdefs[position][0]
[ "def", "get_checks", "(", "self", ",", "position", "=", "None", ")", ":", "if", "position", "is", "None", ":", "position", "=", "self", ".", "position", "return", "self", ".", "checkdefs", "[", "position", "]", "[", "0", "]" ]
Gets the checks at the position.
[ "Gets", "the", "checks", "at", "the", "position", "." ]
python
train
wummel/linkchecker
linkcheck/checker/urlbase.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/checker/urlbase.py#L657-L666
def add_url (self, url, line=0, column=0, page=0, name=u"", base=None): """Add new URL to queue.""" if base: base_ref = urlutil.url_norm(base)[0] else: base_ref = None url_data = get_url_from(url, self.recursion_level+1, self.aggregate, parent_url=self...
[ "def", "add_url", "(", "self", ",", "url", ",", "line", "=", "0", ",", "column", "=", "0", ",", "page", "=", "0", ",", "name", "=", "u\"\"", ",", "base", "=", "None", ")", ":", "if", "base", ":", "base_ref", "=", "urlutil", ".", "url_norm", "("...
Add new URL to queue.
[ "Add", "new", "URL", "to", "queue", "." ]
python
train
raymontag/kppy
kppy/database.py
https://github.com/raymontag/kppy/blob/a43f1fff7d49da1da4b3d8628a1b3ebbaf47f43a/kppy/database.py#L1068-L1121
def _save_entry_field(self, field_type, entry): """This group packs a entry field""" if field_type == 0x0000: # Ignored pass elif field_type == 0x0001: if entry.uuid is not None: return (16, entry.uuid) elif field_type == 0x0002: ...
[ "def", "_save_entry_field", "(", "self", ",", "field_type", ",", "entry", ")", ":", "if", "field_type", "==", "0x0000", ":", "# Ignored", "pass", "elif", "field_type", "==", "0x0001", ":", "if", "entry", ".", "uuid", "is", "not", "None", ":", "return", "...
This group packs a entry field
[ "This", "group", "packs", "a", "entry", "field" ]
python
train
chimera0/accel-brain-code
Reinforcement-Learning/pyqlearning/q_learning.py
https://github.com/chimera0/accel-brain-code/blob/03661f6f544bed656269fcd4b3c23c9061629daa/Reinforcement-Learning/pyqlearning/q_learning.py#L355-L371
def update_q(self, state_key, action_key, reward_value, next_max_q): ''' Update Q-Value. Args: state_key: The key of state. action_key: The key of action. reward_value: R-Value(Reward). next_max_q: Ma...
[ "def", "update_q", "(", "self", ",", "state_key", ",", "action_key", ",", "reward_value", ",", "next_max_q", ")", ":", "# Now Q-Value.", "q", "=", "self", ".", "extract_q_df", "(", "state_key", ",", "action_key", ")", "# Update Q-Value.", "new_q", "=", "q", ...
Update Q-Value. Args: state_key: The key of state. action_key: The key of action. reward_value: R-Value(Reward). next_max_q: Maximum Q-Value.
[ "Update", "Q", "-", "Value", "." ]
python
train
pepkit/peppy
peppy/utils.py
https://github.com/pepkit/peppy/blob/f0f725e1557936b81c86573a77400e6f8da78f05/peppy/utils.py#L131-L150
def get_file_size(filename): """ Get size of all files in gigabytes (Gb). :param str | collections.Iterable[str] filename: A space-separated string or list of space-separated strings of absolute file paths. :return float: size of file(s), in gigabytes. """ if filename is None: r...
[ "def", "get_file_size", "(", "filename", ")", ":", "if", "filename", "is", "None", ":", "return", "float", "(", "0", ")", "if", "type", "(", "filename", ")", "is", "list", ":", "return", "float", "(", "sum", "(", "[", "get_file_size", "(", "x", ")", ...
Get size of all files in gigabytes (Gb). :param str | collections.Iterable[str] filename: A space-separated string or list of space-separated strings of absolute file paths. :return float: size of file(s), in gigabytes.
[ "Get", "size", "of", "all", "files", "in", "gigabytes", "(", "Gb", ")", "." ]
python
train
vertexproject/synapse
synapse/cortex.py
https://github.com/vertexproject/synapse/blob/22e67c5a8f6d7caddbcf34b39ab1bd2d6c4a6e0b/synapse/cortex.py#L1604-L1682
async def streamstorm(self, text, opts=None, user=None): ''' Evaluate a storm query and yield result messages. Yields: ((str,dict)): Storm messages. ''' if opts is None: opts = {} MSG_QUEUE_SIZE = 1000 chan = asyncio.Queue(MSG_QUEUE_SIZE, ...
[ "async", "def", "streamstorm", "(", "self", ",", "text", ",", "opts", "=", "None", ",", "user", "=", "None", ")", ":", "if", "opts", "is", "None", ":", "opts", "=", "{", "}", "MSG_QUEUE_SIZE", "=", "1000", "chan", "=", "asyncio", ".", "Queue", "(",...
Evaluate a storm query and yield result messages. Yields: ((str,dict)): Storm messages.
[ "Evaluate", "a", "storm", "query", "and", "yield", "result", "messages", ".", "Yields", ":", "((", "str", "dict", "))", ":", "Storm", "messages", "." ]
python
train
Nachtfeuer/pipeline
spline/components/docker.py
https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/components/docker.py#L37-L48
def update_environment_variables(self, filename): """Updating OS environment variables and current script path and filename.""" self.env.update({'PIPELINE_BASH_FILE_ORIGINAL': filename}) filename = os.path.join('/root/scripts', os.path.basename(filename)) self.env.update({'PIPELINE_BASH_...
[ "def", "update_environment_variables", "(", "self", ",", "filename", ")", ":", "self", ".", "env", ".", "update", "(", "{", "'PIPELINE_BASH_FILE_ORIGINAL'", ":", "filename", "}", ")", "filename", "=", "os", ".", "path", ".", "join", "(", "'/root/scripts'", "...
Updating OS environment variables and current script path and filename.
[ "Updating", "OS", "environment", "variables", "and", "current", "script", "path", "and", "filename", "." ]
python
train
ssato/python-anytemplate
anytemplate/engine.py
https://github.com/ssato/python-anytemplate/blob/3e56baa914bd47f044083b20e33100f836443596/anytemplate/engine.py#L50-L57
def list_engines_by_priority(engines=None): """ Return a list of engines supported sorted by each priority. """ if engines is None: engines = ENGINES return sorted(engines, key=operator.methodcaller("priority"))
[ "def", "list_engines_by_priority", "(", "engines", "=", "None", ")", ":", "if", "engines", "is", "None", ":", "engines", "=", "ENGINES", "return", "sorted", "(", "engines", ",", "key", "=", "operator", ".", "methodcaller", "(", "\"priority\"", ")", ")" ]
Return a list of engines supported sorted by each priority.
[ "Return", "a", "list", "of", "engines", "supported", "sorted", "by", "each", "priority", "." ]
python
train
ARMmbed/mbed-cloud-sdk-python
src/mbed_cloud/pagination.py
https://github.com/ARMmbed/mbed-cloud-sdk-python/blob/c0af86fb2cdd4dc7ed26f236139241067d293509/src/mbed_cloud/pagination.py#L202-L211
def data(self): """Deprecated. Returns the data as a `list`""" import warnings warnings.warn( '`data` attribute is deprecated and will be removed in a future release, ' 'use %s as an iterable instead' % (PaginatedResponse,), category=DeprecationWarning, ...
[ "def", "data", "(", "self", ")", ":", "import", "warnings", "warnings", ".", "warn", "(", "'`data` attribute is deprecated and will be removed in a future release, '", "'use %s as an iterable instead'", "%", "(", "PaginatedResponse", ",", ")", ",", "category", "=", "Depre...
Deprecated. Returns the data as a `list`
[ "Deprecated", ".", "Returns", "the", "data", "as", "a", "list" ]
python
train
MacHu-GWU/uszipcode-project
uszipcode/pkg/sqlalchemy_mate/crud/inserting.py
https://github.com/MacHu-GWU/uszipcode-project/blob/96282b779a3efb422802de83c48ca284598ba952/uszipcode/pkg/sqlalchemy_mate/crud/inserting.py#L16-L61
def smart_insert(engine, table, data, minimal_size=5): """ An optimized Insert strategy. Guarantee successful and highest insertion speed. But ATOMIC WRITE IS NOT ENSURED IF THE PROGRAM IS INTERRUPTED. **中文文档** 在Insert中, 如果已经预知不会出现IntegrityError, 那么使用Bulk Insert的速度要 远远快于逐条Insert。而如果无法预知, 那么我们采...
[ "def", "smart_insert", "(", "engine", ",", "table", ",", "data", ",", "minimal_size", "=", "5", ")", ":", "insert", "=", "table", ".", "insert", "(", ")", "if", "isinstance", "(", "data", ",", "list", ")", ":", "# 首先进行尝试bulk insert", "try", ":", "engin...
An optimized Insert strategy. Guarantee successful and highest insertion speed. But ATOMIC WRITE IS NOT ENSURED IF THE PROGRAM IS INTERRUPTED. **中文文档** 在Insert中, 如果已经预知不会出现IntegrityError, 那么使用Bulk Insert的速度要 远远快于逐条Insert。而如果无法预知, 那么我们采用如下策略: 1. 尝试Bulk Insert, Bulk Insert由于在结束前不Commit, 所以速度很快。 ...
[ "An", "optimized", "Insert", "strategy", ".", "Guarantee", "successful", "and", "highest", "insertion", "speed", ".", "But", "ATOMIC", "WRITE", "IS", "NOT", "ENSURED", "IF", "THE", "PROGRAM", "IS", "INTERRUPTED", "." ]
python
train
aetros/aetros-cli
aetros/git.py
https://github.com/aetros/aetros-cli/blob/a2a1f38d6af1660e1e2680c7d413ec2aef45faab/aetros/git.py#L691-L699
def add_file(self, git_path, content): """ Add a new file as blob in the storage and add its tree entry into the index. :param git_path: str :param content: str """ blob_id = self.write_blob(content) self.add_index('100644', blob_id, git_path)
[ "def", "add_file", "(", "self", ",", "git_path", ",", "content", ")", ":", "blob_id", "=", "self", ".", "write_blob", "(", "content", ")", "self", ".", "add_index", "(", "'100644'", ",", "blob_id", ",", "git_path", ")" ]
Add a new file as blob in the storage and add its tree entry into the index. :param git_path: str :param content: str
[ "Add", "a", "new", "file", "as", "blob", "in", "the", "storage", "and", "add", "its", "tree", "entry", "into", "the", "index", ".", ":", "param", "git_path", ":", "str", ":", "param", "content", ":", "str" ]
python
train
dnanexus/dx-toolkit
src/python/dxpy/bindings/__init__.py
https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/__init__.py#L378-L389
def add_types(self, types, **kwargs): """ :param types: Types to add to the object :type types: list of strings :raises: :class:`~dxpy.exceptions.DXAPIError` if the object is not in the "open" state Adds each of the specified types to the remote object. Takes no action f...
[ "def", "add_types", "(", "self", ",", "types", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_add_types", "(", "self", ".", "_dxid", ",", "{", "\"types\"", ":", "types", "}", ",", "*", "*", "kwargs", ")" ]
:param types: Types to add to the object :type types: list of strings :raises: :class:`~dxpy.exceptions.DXAPIError` if the object is not in the "open" state Adds each of the specified types to the remote object. Takes no action for types that are already listed for the object.
[ ":", "param", "types", ":", "Types", "to", "add", "to", "the", "object", ":", "type", "types", ":", "list", "of", "strings", ":", "raises", ":", ":", "class", ":", "~dxpy", ".", "exceptions", ".", "DXAPIError", "if", "the", "object", "is", "not", "in...
python
train
gwastro/pycbc
pycbc/strain/recalibrate.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/strain/recalibrate.py#L343-L408
def adjust_strain(self, strain, delta_fs=None, delta_qinv=None, delta_fc=None, kappa_c=1.0, kappa_tst_re=1.0, kappa_tst_im=0.0, kappa_pu_re=1.0, kappa_pu_im=0.0): """Adjust the FrequencySeries strain by changing the time-dependent calibration parameters kappa_...
[ "def", "adjust_strain", "(", "self", ",", "strain", ",", "delta_fs", "=", "None", ",", "delta_qinv", "=", "None", ",", "delta_fc", "=", "None", ",", "kappa_c", "=", "1.0", ",", "kappa_tst_re", "=", "1.0", ",", "kappa_tst_im", "=", "0.0", ",", "kappa_pu_r...
Adjust the FrequencySeries strain by changing the time-dependent calibration parameters kappa_c(t), kappa_a(t), f_c(t), fs, and qinv. Parameters ---------- strain : FrequencySeries The strain data to be adjusted. delta_fc : float Change in coupled-cavity ...
[ "Adjust", "the", "FrequencySeries", "strain", "by", "changing", "the", "time", "-", "dependent", "calibration", "parameters", "kappa_c", "(", "t", ")", "kappa_a", "(", "t", ")", "f_c", "(", "t", ")", "fs", "and", "qinv", "." ]
python
train
GNS3/gns3-server
gns3server/controller/gns3vm/virtualbox_gns3_vm.py
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/virtualbox_gns3_vm.py#L153-L212
def start(self): """ Start the GNS3 VM. """ # get a NAT interface number nat_interface_number = yield from self._look_for_interface("nat") if nat_interface_number < 0: raise GNS3VMError("The GNS3 VM: {} must have a NAT interface configured in order to start"....
[ "def", "start", "(", "self", ")", ":", "# get a NAT interface number", "nat_interface_number", "=", "yield", "from", "self", ".", "_look_for_interface", "(", "\"nat\"", ")", "if", "nat_interface_number", "<", "0", ":", "raise", "GNS3VMError", "(", "\"The GNS3 VM: {}...
Start the GNS3 VM.
[ "Start", "the", "GNS3", "VM", "." ]
python
train
tanghaibao/jcvi
jcvi/assembly/hic.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/assembly/hic.py#L1043-L1075
def optimize_ordering(fwtour, clm, phase, cpus): """ Optimize the ordering of contigs by Genetic Algorithm (GA). """ from .chic import score_evaluate_M # Prepare input files tour_contigs = clm.active_contigs tour_sizes = clm.active_sizes tour_M = clm.M tour = clm.tour signs = cl...
[ "def", "optimize_ordering", "(", "fwtour", ",", "clm", ",", "phase", ",", "cpus", ")", ":", "from", ".", "chic", "import", "score_evaluate_M", "# Prepare input files", "tour_contigs", "=", "clm", ".", "active_contigs", "tour_sizes", "=", "clm", ".", "active_size...
Optimize the ordering of contigs by Genetic Algorithm (GA).
[ "Optimize", "the", "ordering", "of", "contigs", "by", "Genetic", "Algorithm", "(", "GA", ")", "." ]
python
train
CTPUG/wafer
wafer/registration/views.py
https://github.com/CTPUG/wafer/blob/a20af3c399267f76373dc342f4d542a9bc457c35/wafer/registration/views.py#L12-L20
def redirect_profile(request): ''' The default destination from logging in, redirect to the actual profile URL ''' if request.user.is_authenticated: return HttpResponseRedirect(reverse('wafer_user_profile', args=(request.user.username,))) else: ...
[ "def", "redirect_profile", "(", "request", ")", ":", "if", "request", ".", "user", ".", "is_authenticated", ":", "return", "HttpResponseRedirect", "(", "reverse", "(", "'wafer_user_profile'", ",", "args", "=", "(", "request", ".", "user", ".", "username", ",",...
The default destination from logging in, redirect to the actual profile URL
[ "The", "default", "destination", "from", "logging", "in", "redirect", "to", "the", "actual", "profile", "URL" ]
python
train
MartinThoma/hwrt
hwrt/filter_dataset.py
https://github.com/MartinThoma/hwrt/blob/725c21a3d0f5a30b8492cbc184b3688ceb364e1c/hwrt/filter_dataset.py#L179-L197
def read_csv(filepath): """ Read a CSV into a list of dictionarys. The first line of the CSV determines the keys of the dictionary. Parameters ---------- filepath : string Returns ------- list of dictionaries """ symbols = [] with open(filepath, 'rb') as csvfile: ...
[ "def", "read_csv", "(", "filepath", ")", ":", "symbols", "=", "[", "]", "with", "open", "(", "filepath", ",", "'rb'", ")", "as", "csvfile", ":", "spamreader", "=", "csv", ".", "DictReader", "(", "csvfile", ",", "delimiter", "=", "','", ",", "quotechar"...
Read a CSV into a list of dictionarys. The first line of the CSV determines the keys of the dictionary. Parameters ---------- filepath : string Returns ------- list of dictionaries
[ "Read", "a", "CSV", "into", "a", "list", "of", "dictionarys", ".", "The", "first", "line", "of", "the", "CSV", "determines", "the", "keys", "of", "the", "dictionary", "." ]
python
train
coyo8/parinx
parinx/parser.py
https://github.com/coyo8/parinx/blob/6493798ceba8089345d970f71be4a896eb6b081d/parinx/parser.py#L125-L151
def split_docstring(docstring): """ Separates the method's description and paramter's :return: Return description string and list of fields strings """ docstring_list = [line.strip() for line in docstring.splitlines()] description_list = list( takewhile(lambda line: not (line.startswith...
[ "def", "split_docstring", "(", "docstring", ")", ":", "docstring_list", "=", "[", "line", ".", "strip", "(", ")", "for", "line", "in", "docstring", ".", "splitlines", "(", ")", "]", "description_list", "=", "list", "(", "takewhile", "(", "lambda", "line", ...
Separates the method's description and paramter's :return: Return description string and list of fields strings
[ "Separates", "the", "method", "s", "description", "and", "paramter", "s" ]
python
train
Kozea/cairocffi
cairocffi/context.py
https://github.com/Kozea/cairocffi/blob/450853add7e32eea20985b6aa5f54d9cb3cd04fe/cairocffi/context.py#L1356-L1368
def paint_with_alpha(self, alpha): """A drawing operator that paints the current source everywhere within the current clip region using a mask of constant alpha value alpha. The effect is similar to :meth:`paint`, but the drawing is faded out using the :obj:`alpha` value. ...
[ "def", "paint_with_alpha", "(", "self", ",", "alpha", ")", ":", "cairo", ".", "cairo_paint_with_alpha", "(", "self", ".", "_pointer", ",", "alpha", ")", "self", ".", "_check_status", "(", ")" ]
A drawing operator that paints the current source everywhere within the current clip region using a mask of constant alpha value alpha. The effect is similar to :meth:`paint`, but the drawing is faded out using the :obj:`alpha` value. :type alpha: float :param alpha: Alp...
[ "A", "drawing", "operator", "that", "paints", "the", "current", "source", "everywhere", "within", "the", "current", "clip", "region", "using", "a", "mask", "of", "constant", "alpha", "value", "alpha", ".", "The", "effect", "is", "similar", "to", ":", "meth",...
python
train
nugget/python-insteonplm
insteonplm/tools.py
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L258-L277
async def load_device_aldb(self, addr, clear=True): """Read the device ALDB.""" dev_addr = Address(addr) device = None if dev_addr == self.plm.address: device = self.plm else: device = self.plm.devices[dev_addr.id] if device: if clear: ...
[ "async", "def", "load_device_aldb", "(", "self", ",", "addr", ",", "clear", "=", "True", ")", ":", "dev_addr", "=", "Address", "(", "addr", ")", "device", "=", "None", "if", "dev_addr", "==", "self", ".", "plm", ".", "address", ":", "device", "=", "s...
Read the device ALDB.
[ "Read", "the", "device", "ALDB", "." ]
python
train
pyviz/holoviews
holoviews/core/util.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L808-L823
def asarray(arraylike, strict=True): """ Converts arraylike objects to NumPy ndarray types. Errors if object is not arraylike and strict option is enabled. """ if isinstance(arraylike, np.ndarray): return arraylike elif isinstance(arraylike, list): return np.asarray(arraylike, dt...
[ "def", "asarray", "(", "arraylike", ",", "strict", "=", "True", ")", ":", "if", "isinstance", "(", "arraylike", ",", "np", ".", "ndarray", ")", ":", "return", "arraylike", "elif", "isinstance", "(", "arraylike", ",", "list", ")", ":", "return", "np", "...
Converts arraylike objects to NumPy ndarray types. Errors if object is not arraylike and strict option is enabled.
[ "Converts", "arraylike", "objects", "to", "NumPy", "ndarray", "types", ".", "Errors", "if", "object", "is", "not", "arraylike", "and", "strict", "option", "is", "enabled", "." ]
python
train
geomet/geomet
geomet/wkb.py
https://github.com/geomet/geomet/blob/b82d7118113ab723751eba3de5df98c368423c2b/geomet/wkb.py#L414-L434
def _dump_linestring(obj, big_endian, meta): """ Dump a GeoJSON-like `dict` to a linestring WKB string. Input parameters and output are similar to :func:`_dump_point`. """ coords = obj['coordinates'] vertex = coords[0] # Infer the number of dimensions from the first vertex num_dims = le...
[ "def", "_dump_linestring", "(", "obj", ",", "big_endian", ",", "meta", ")", ":", "coords", "=", "obj", "[", "'coordinates'", "]", "vertex", "=", "coords", "[", "0", "]", "# Infer the number of dimensions from the first vertex", "num_dims", "=", "len", "(", "vert...
Dump a GeoJSON-like `dict` to a linestring WKB string. Input parameters and output are similar to :func:`_dump_point`.
[ "Dump", "a", "GeoJSON", "-", "like", "dict", "to", "a", "linestring", "WKB", "string", "." ]
python
train
playpauseandstop/rororo
rororo/settings.py
https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/settings.py#L70-L94
def inject_settings(mixed: Union[str, Settings], context: MutableMapping[str, Any], fail_silently: bool = False) -> None: """Inject settings values to given context. :param mixed: Settings can be a string (that it will be read from Python path), Python mo...
[ "def", "inject_settings", "(", "mixed", ":", "Union", "[", "str", ",", "Settings", "]", ",", "context", ":", "MutableMapping", "[", "str", ",", "Any", "]", ",", "fail_silently", ":", "bool", "=", "False", ")", "->", "None", ":", "if", "isinstance", "("...
Inject settings values to given context. :param mixed: Settings can be a string (that it will be read from Python path), Python module or dict-like instance. :param context: Context to assign settings key values. It should support dict-like item assingment. :param fail_silen...
[ "Inject", "settings", "values", "to", "given", "context", "." ]
python
train
kilometer-io/kilometer-python
kilometer/__init__.py
https://github.com/kilometer-io/kilometer-python/blob/22a720cfed5aa74d4957b4597f224cede2e7c0e5/kilometer/__init__.py#L44-L66
def add_user(self, user_id, custom_properties=None, headers=None, endpoint_url=None): """ Creates a new identified user if he doesn't exist. :param str user_id: identified user's ID :param dict custom_properties: user properties :param dict headers: custom request headers (if is...
[ "def", "add_user", "(", "self", ",", "user_id", ",", "custom_properties", "=", "None", ",", "headers", "=", "None", ",", "endpoint_url", "=", "None", ")", ":", "endpoint_url", "=", "endpoint_url", "or", "self", ".", "_endpoint_url", "url", "=", "endpoint_url...
Creates a new identified user if he doesn't exist. :param str user_id: identified user's ID :param dict custom_properties: user properties :param dict headers: custom request headers (if isn't set default values are used) :param str endpoint_url: where to send the request (if isn't set ...
[ "Creates", "a", "new", "identified", "user", "if", "he", "doesn", "t", "exist", "." ]
python
train
lambdamusic/Ontospy
ontospy/core/ontospy.py
https://github.com/lambdamusic/Ontospy/blob/eb46cb13792b2b87f21babdf976996318eec7571/ontospy/core/ontospy.py#L127-L142
def load_rdf(self, uri_or_path=None, data=None, file_obj=None, rdf_format="", verbose=False, hide_base_schemas=True, hide_implicit_types=True, hide_implicit_preds=True): """Loa...
[ "def", "load_rdf", "(", "self", ",", "uri_or_path", "=", "None", ",", "data", "=", "None", ",", "file_obj", "=", "None", ",", "rdf_format", "=", "\"\"", ",", "verbose", "=", "False", ",", "hide_base_schemas", "=", "True", ",", "hide_implicit_types", "=", ...
Load an RDF source into an ontospy/rdflib graph
[ "Load", "an", "RDF", "source", "into", "an", "ontospy", "/", "rdflib", "graph" ]
python
train
openstack/horizon
openstack_dashboard/utils/settings.py
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/utils/settings.py#L41-L61
def import_dashboard_config(modules): """Imports configuration from all the modules and merges it.""" config = collections.defaultdict(dict) for module in modules: for submodule in import_submodules(module).values(): if hasattr(submodule, 'DASHBOARD'): dashboard = submodu...
[ "def", "import_dashboard_config", "(", "modules", ")", ":", "config", "=", "collections", ".", "defaultdict", "(", "dict", ")", "for", "module", "in", "modules", ":", "for", "submodule", "in", "import_submodules", "(", "module", ")", ".", "values", "(", ")",...
Imports configuration from all the modules and merges it.
[ "Imports", "configuration", "from", "all", "the", "modules", "and", "merges", "it", "." ]
python
train
yamins81/tabular
tabular/tab.py
https://github.com/yamins81/tabular/blob/1caf091c8c395960a9ad7078f95158b533cc52dd/tabular/tab.py#L658-L671
def renamecol(self, old, new): """ Rename column or color in-place. Method wraps:: tabular.spreadsheet.renamecol(self, old, new) """ spreadsheet.renamecol(self,old,new) for x in self.coloring.keys(): if old in self.coloring[x]: ...
[ "def", "renamecol", "(", "self", ",", "old", ",", "new", ")", ":", "spreadsheet", ".", "renamecol", "(", "self", ",", "old", ",", "new", ")", "for", "x", "in", "self", ".", "coloring", ".", "keys", "(", ")", ":", "if", "old", "in", "self", ".", ...
Rename column or color in-place. Method wraps:: tabular.spreadsheet.renamecol(self, old, new)
[ "Rename", "column", "or", "color", "in", "-", "place", "." ]
python
train
redhat-openstack/python-tripleo-helper
tripleohelper/server.py
https://github.com/redhat-openstack/python-tripleo-helper/blob/bfa165538335edb1088170c7a92f097167225c81/tripleohelper/server.py#L54-L103
def enable_user(self, user): """Enable the root account on the remote host. Since the host may have been deployed using a Cloud image, it may not be possible to use the 'root' account. This method ensure the root account is enable, if this is not the case, it will try to get the name ...
[ "def", "enable_user", "(", "self", ",", "user", ")", ":", "if", "user", "in", "self", ".", "ssh_pool", ".", "_ssh_clients", ":", "return", "if", "user", "==", "'root'", ":", "_root_ssh_client", "=", "ssh", ".", "SshClient", "(", "hostname", "=", "self", ...
Enable the root account on the remote host. Since the host may have been deployed using a Cloud image, it may not be possible to use the 'root' account. This method ensure the root account is enable, if this is not the case, it will try to get the name of admin user and use it to re-en...
[ "Enable", "the", "root", "account", "on", "the", "remote", "host", "." ]
python
train
saltstack/salt
salt/states/keystore.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystore.py#L27-L151
def managed(name, passphrase, entries, force_remove=False): ''' Create or manage a java keystore. name The path to the keystore file passphrase The password to the keystore entries A list containing an alias, certificate, and optional private_key. The certificate a...
[ "def", "managed", "(", "name", ",", "passphrase", ",", "entries", ",", "force_remove", "=", "False", ")", ":", "ret", "=", "{", "'changes'", ":", "{", "}", ",", "'comment'", ":", "''", ",", "'name'", ":", "name", ",", "'result'", ":", "True", "}", ...
Create or manage a java keystore. name The path to the keystore file passphrase The password to the keystore entries A list containing an alias, certificate, and optional private_key. The certificate and private_key can be a file or a string .. code-block:: yaml ...
[ "Create", "or", "manage", "a", "java", "keystore", "." ]
python
train
Jajcus/pyxmpp2
pyxmpp2/ext/vcard.py
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/vcard.py#L729-L745
def as_xml(self,parent): """Create vcard-tmp XML representation of the field. :Parameters: - `parent`: parent node for the element :Types: - `parent`: `libxml2.xmlNode` :return: xml node with the field data. :returntype: `libxml2.xmlNode`""" n=pa...
[ "def", "as_xml", "(", "self", ",", "parent", ")", ":", "n", "=", "parent", ".", "newChild", "(", "None", ",", "\"TEL\"", ",", "None", ")", "for", "t", "in", "(", "\"home\"", ",", "\"work\"", ",", "\"voice\"", ",", "\"fax\"", ",", "\"pager\"", ",", ...
Create vcard-tmp XML representation of the field. :Parameters: - `parent`: parent node for the element :Types: - `parent`: `libxml2.xmlNode` :return: xml node with the field data. :returntype: `libxml2.xmlNode`
[ "Create", "vcard", "-", "tmp", "XML", "representation", "of", "the", "field", "." ]
python
valid