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
michal-stuglik/django-blastplus
blastplus/forms.py
https://github.com/michal-stuglik/django-blastplus/blob/4f5e15fb9f8069c3bed5f8fd941c4b9891daad4b/blastplus/forms.py#L177-L187
def check_allowed_letters(seq, allowed_letters_as_set): """Validate sequence: Rise an error if sequence contains undesirable letters. """ # set of unique letters in sequence seq_set = set(seq) not_allowed_letters_in_seq = [x for x in seq_set if str(x).upper() not in allowed_letters_as_set] if le...
[ "def", "check_allowed_letters", "(", "seq", ",", "allowed_letters_as_set", ")", ":", "# set of unique letters in sequence", "seq_set", "=", "set", "(", "seq", ")", "not_allowed_letters_in_seq", "=", "[", "x", "for", "x", "in", "seq_set", "if", "str", "(", "x", "...
Validate sequence: Rise an error if sequence contains undesirable letters.
[ "Validate", "sequence", ":", "Rise", "an", "error", "if", "sequence", "contains", "undesirable", "letters", "." ]
python
train
kstaniek/condoor
condoor/drivers/jumphost.py
https://github.com/kstaniek/condoor/blob/77c054b29d4e286c1d7aca2c74dff86b805e1fae/condoor/drivers/jumphost.py#L21-L29
def get_version_text(self): """Return the version information from Unix host.""" try: version_text = self.device.send('uname -sr', timeout=10) except CommandError: self.log("Non Unix jumphost type detected") return None raise ConnectionError("Non U...
[ "def", "get_version_text", "(", "self", ")", ":", "try", ":", "version_text", "=", "self", ".", "device", ".", "send", "(", "'uname -sr'", ",", "timeout", "=", "10", ")", "except", "CommandError", ":", "self", ".", "log", "(", "\"Non Unix jumphost type detec...
Return the version information from Unix host.
[ "Return", "the", "version", "information", "from", "Unix", "host", "." ]
python
train
zkbt/the-friendly-stars
thefriendlystars/constellations/constellation.py
https://github.com/zkbt/the-friendly-stars/blob/50d3f979e79e63c66629065c75595696dc79802e/thefriendlystars/constellations/constellation.py#L339-L350
def allskyfinder(self, figsize=(14, 7), **kwargs): ''' Plot an all-sky finder chart. This *does* create a new figure. ''' plt.figure(figsize=figsize) scatter = self.plot(**kwargs) plt.xlabel(r'Right Ascension ($^\circ$)'); plt.ylabel(r'Declination ($^\circ$)') #p...
[ "def", "allskyfinder", "(", "self", ",", "figsize", "=", "(", "14", ",", "7", ")", ",", "*", "*", "kwargs", ")", ":", "plt", ".", "figure", "(", "figsize", "=", "figsize", ")", "scatter", "=", "self", ".", "plot", "(", "*", "*", "kwargs", ")", ...
Plot an all-sky finder chart. This *does* create a new figure.
[ "Plot", "an", "all", "-", "sky", "finder", "chart", ".", "This", "*", "does", "*", "create", "a", "new", "figure", "." ]
python
train
twisted/vertex
vertex/sigma.py
https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/sigma.py#L705-L711
def transloadsForPeer(self, peer): """ Returns an iterator of transloads that apply to a particular peer. """ for tl in self.transloads.itervalues(): if peer in tl.peers: yield tl
[ "def", "transloadsForPeer", "(", "self", ",", "peer", ")", ":", "for", "tl", "in", "self", ".", "transloads", ".", "itervalues", "(", ")", ":", "if", "peer", "in", "tl", ".", "peers", ":", "yield", "tl" ]
Returns an iterator of transloads that apply to a particular peer.
[ "Returns", "an", "iterator", "of", "transloads", "that", "apply", "to", "a", "particular", "peer", "." ]
python
train
HazyResearch/metal
metal/label_model/utils.py
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/label_model/utils.py#L39-L46
def compute_inv_covariance(L_aug, Y, k, p): """Given label matrix L and labels Y, compute the covariance. Args: L: (np.array) [n, d] The augmented (indicator) label matrix Y: (np.array int) [n] The true labels in {1,...,k} """ return np.linalg.inv(compute_covariance(L_aug, Y, k, p))
[ "def", "compute_inv_covariance", "(", "L_aug", ",", "Y", ",", "k", ",", "p", ")", ":", "return", "np", ".", "linalg", ".", "inv", "(", "compute_covariance", "(", "L_aug", ",", "Y", ",", "k", ",", "p", ")", ")" ]
Given label matrix L and labels Y, compute the covariance. Args: L: (np.array) [n, d] The augmented (indicator) label matrix Y: (np.array int) [n] The true labels in {1,...,k}
[ "Given", "label", "matrix", "L", "and", "labels", "Y", "compute", "the", "covariance", "." ]
python
train
swevm/scaleio-py
scaleiopy/scaleio.py
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/scaleio.py#L190-L203
def volumes(self): """ Returns a `list` of all the `Volume` known to the cluster. Updates every time - no caching. :return: a `list` of all the `Volume` known to the cluster. :rtype: list """ self.connection._check_login() response = self.connection._do_get("{}/{...
[ "def", "volumes", "(", "self", ")", ":", "self", ".", "connection", ".", "_check_login", "(", ")", "response", "=", "self", ".", "connection", ".", "_do_get", "(", "\"{}/{}\"", ".", "format", "(", "self", ".", "connection", ".", "_api_url", ",", "\"types...
Returns a `list` of all the `Volume` known to the cluster. Updates every time - no caching. :return: a `list` of all the `Volume` known to the cluster. :rtype: list
[ "Returns", "a", "list", "of", "all", "the", "Volume", "known", "to", "the", "cluster", ".", "Updates", "every", "time", "-", "no", "caching", ".", ":", "return", ":", "a", "list", "of", "all", "the", "Volume", "known", "to", "the", "cluster", ".", ":...
python
train
hannes-brt/hebel
hebel/pycuda_ops/linalg.py
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/linalg.py#L39-L199
def dot(x_gpu, y_gpu, transa='N', transb='N', handle=None, target=None): """ Dot product of two arrays. For 1D arrays, this function computes the inner product. For 2D arrays of shapes `(m, k)` and `(k, n)`, it computes the matrix product; the result has shape `(m, n)`. Parameters --------...
[ "def", "dot", "(", "x_gpu", ",", "y_gpu", ",", "transa", "=", "'N'", ",", "transb", "=", "'N'", ",", "handle", "=", "None", ",", "target", "=", "None", ")", ":", "if", "handle", "is", "None", ":", "handle", "=", "_global_cublas_handle", "if", "len", ...
Dot product of two arrays. For 1D arrays, this function computes the inner product. For 2D arrays of shapes `(m, k)` and `(k, n)`, it computes the matrix product; the result has shape `(m, n)`. Parameters ---------- x_gpu : pycuda.gpuarray.GPUArray Input array. y_gpu : pycuda.gpuar...
[ "Dot", "product", "of", "two", "arrays", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/data_generators/mnist.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/mnist.py#L51-L66
def _extract_mnist_images(filename, num_images): """Extract images from an MNIST file into a numpy array. Args: filename: The path to an MNIST images file. num_images: The number of images in the file. Returns: A numpy array of shape [number_of_images, height, width, channels]. """ with gzip.ope...
[ "def", "_extract_mnist_images", "(", "filename", ",", "num_images", ")", ":", "with", "gzip", ".", "open", "(", "filename", ")", "as", "bytestream", ":", "bytestream", ".", "read", "(", "16", ")", "buf", "=", "bytestream", ".", "read", "(", "_MNIST_IMAGE_S...
Extract images from an MNIST file into a numpy array. Args: filename: The path to an MNIST images file. num_images: The number of images in the file. Returns: A numpy array of shape [number_of_images, height, width, channels].
[ "Extract", "images", "from", "an", "MNIST", "file", "into", "a", "numpy", "array", "." ]
python
train
cocaine/cocaine-tools
cocaine/tools/dispatch.py
https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1772-L1786
def access_grant(tp, name, cid, uid, perm, **kwargs): """ Add rights to ACL for specified entity (collection, path, etc.). Creates if necessary. """ ctx = Context(**kwargs) ctx.execute_action('access:edit:grant', **{ 'unicat': ctx.repo.create_secure_service('unicat'), 'tp': tp, ...
[ "def", "access_grant", "(", "tp", ",", "name", ",", "cid", ",", "uid", ",", "perm", ",", "*", "*", "kwargs", ")", ":", "ctx", "=", "Context", "(", "*", "*", "kwargs", ")", "ctx", ".", "execute_action", "(", "'access:edit:grant'", ",", "*", "*", "{"...
Add rights to ACL for specified entity (collection, path, etc.). Creates if necessary.
[ "Add", "rights", "to", "ACL", "for", "specified", "entity", "(", "collection", "path", "etc", ".", ")", "." ]
python
train
bitprophet/botox
botox/aws.py
https://github.com/bitprophet/botox/blob/02c887a28bd2638273548cc7d1e6d6f1d4d38bf9/botox/aws.py#L201-L215
def get_instance_subnet_name(self, instance): """ Return a human readable name for given instance's subnet, or None. Uses stored config mapping of subnet IDs to names. """ # TODO: we have to do this here since we are monkeypatching Instance. # If we switch to custom Inst...
[ "def", "get_instance_subnet_name", "(", "self", ",", "instance", ")", ":", "# TODO: we have to do this here since we are monkeypatching Instance.", "# If we switch to custom Instance (sub)class then we could do it in the", "# object, provided it has access to the configuration data.", "if", ...
Return a human readable name for given instance's subnet, or None. Uses stored config mapping of subnet IDs to names.
[ "Return", "a", "human", "readable", "name", "for", "given", "instance", "s", "subnet", "or", "None", "." ]
python
train
miedzinski/google-oauth
google_oauth/service.py
https://github.com/miedzinski/google-oauth/blob/aef2e19d87281b1d8e42d6b158111e14e80128db/google_oauth/service.py#L214-L228
def access_token(self): """Stores always valid OAuth2 access token. Note: Accessing this property may result in HTTP request. Returns: str """ if (self._access_token is None or self.expiration_time <= int(time.time())): resp =...
[ "def", "access_token", "(", "self", ")", ":", "if", "(", "self", ".", "_access_token", "is", "None", "or", "self", ".", "expiration_time", "<=", "int", "(", "time", ".", "time", "(", ")", ")", ")", ":", "resp", "=", "self", ".", "make_access_request", ...
Stores always valid OAuth2 access token. Note: Accessing this property may result in HTTP request. Returns: str
[ "Stores", "always", "valid", "OAuth2", "access", "token", "." ]
python
train
SmileyChris/django-countries
django_countries/fields.py
https://github.com/SmileyChris/django-countries/blob/68b0934e8180d47bc15eff2887b6887aaa6e0228/django_countries/fields.py#L310-L313
def pre_save(self, *args, **kwargs): "Returns field's value just before saving." value = super(CharField, self).pre_save(*args, **kwargs) return self.get_prep_value(value)
[ "def", "pre_save", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "value", "=", "super", "(", "CharField", ",", "self", ")", ".", "pre_save", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "self", ".", "get_prep_value"...
Returns field's value just before saving.
[ "Returns", "field", "s", "value", "just", "before", "saving", "." ]
python
train
rix0rrr/gcl
gcl/query.py
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/query.py#L195-L206
def ldContains(self, what, key): """List/dictinary/missing-aware contains. If the value is a "missing_value", we'll treat it as non-existent so it will be overwritten by an empty list/dict when necessary to assign child keys. """ if isListKey(key): i = listKeyIndex(key) return i < l...
[ "def", "ldContains", "(", "self", ",", "what", ",", "key", ")", ":", "if", "isListKey", "(", "key", ")", ":", "i", "=", "listKeyIndex", "(", "key", ")", "return", "i", "<", "len", "(", "what", ")", "and", "what", "[", "i", "]", "!=", "missing_val...
List/dictinary/missing-aware contains. If the value is a "missing_value", we'll treat it as non-existent so it will be overwritten by an empty list/dict when necessary to assign child keys.
[ "List", "/", "dictinary", "/", "missing", "-", "aware", "contains", "." ]
python
train
Spinmob/spinmob
_functions.py
https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L850-L881
def get_shell_history(): """ This only works with some shells. """ # try for ipython if 'get_ipython' in globals(): a = list(get_ipython().history_manager.input_hist_raw) a.reverse() return a elif 'SPYDER_SHELL_ID' in _os.environ: try: p = _os.path.jo...
[ "def", "get_shell_history", "(", ")", ":", "# try for ipython", "if", "'get_ipython'", "in", "globals", "(", ")", ":", "a", "=", "list", "(", "get_ipython", "(", ")", ".", "history_manager", ".", "input_hist_raw", ")", "a", ".", "reverse", "(", ")", "retur...
This only works with some shells.
[ "This", "only", "works", "with", "some", "shells", "." ]
python
train
onelogin/python3-saml
src/onelogin/saml2/utils.py
https://github.com/onelogin/python3-saml/blob/064b7275fba1e5f39a9116ba1cdcc5d01fc34daa/src/onelogin/saml2/utils.py#L69-L85
def escape_url(url, lowercase_urlencoding=False): """ escape the non-safe symbols in url The encoding used by ADFS 3.0 is not compatible with python's quote_plus (ADFS produces lower case hex numbers and quote_plus produces upper case hex numbers) :param url: the url to e...
[ "def", "escape_url", "(", "url", ",", "lowercase_urlencoding", "=", "False", ")", ":", "encoded", "=", "quote_plus", "(", "url", ")", "return", "re", ".", "sub", "(", "r\"%[A-F0-9]{2}\"", ",", "lambda", "m", ":", "m", ".", "group", "(", "0", ")", ".", ...
escape the non-safe symbols in url The encoding used by ADFS 3.0 is not compatible with python's quote_plus (ADFS produces lower case hex numbers and quote_plus produces upper case hex numbers) :param url: the url to escape :type url: str :param lowercase_urlencoding: lo...
[ "escape", "the", "non", "-", "safe", "symbols", "in", "url", "The", "encoding", "used", "by", "ADFS", "3", ".", "0", "is", "not", "compatible", "with", "python", "s", "quote_plus", "(", "ADFS", "produces", "lower", "case", "hex", "numbers", "and", "quote...
python
train
david-caro/python-autosemver
autosemver/packaging.py
https://github.com/david-caro/python-autosemver/blob/3bc0adb70c33e4bd3623ae4c1944d5ee37f4303d/autosemver/packaging.py#L95-L115
def get_authors(project_dir=os.curdir): """ Retrieves the authors list, from the AUTHORS file (if in a package) or generates it from the git history. Returns: list(str): List of authors Raises: RuntimeError: If the authors could not be retrieved """ authors = set() pkg_...
[ "def", "get_authors", "(", "project_dir", "=", "os", ".", "curdir", ")", ":", "authors", "=", "set", "(", ")", "pkg_info_file", "=", "os", ".", "path", ".", "join", "(", "project_dir", ",", "'PKG-INFO'", ")", "authors_file", "=", "os", ".", "path", "."...
Retrieves the authors list, from the AUTHORS file (if in a package) or generates it from the git history. Returns: list(str): List of authors Raises: RuntimeError: If the authors could not be retrieved
[ "Retrieves", "the", "authors", "list", "from", "the", "AUTHORS", "file", "(", "if", "in", "a", "package", ")", "or", "generates", "it", "from", "the", "git", "history", "." ]
python
train
tensorflow/mesh
mesh_tensorflow/ops.py
https://github.com/tensorflow/mesh/blob/3921196e5e43302e820da0a87329f25d7e2a3016/mesh_tensorflow/ops.py#L4975-L5011
def halo_exchange(x, blocks_dim, block_size_dim, halo_size, wrap=False): """Concat each block with the margins of adjacent blocks. Get left and right blocks_dim and concatenate along block_size_dim. Args: x: a Tensor. blocks_dim: a Dimension in x.shape block_size_dim: a Dimension in x.shape halo...
[ "def", "halo_exchange", "(", "x", ",", "blocks_dim", ",", "block_size_dim", ",", "halo_size", ",", "wrap", "=", "False", ")", ":", "if", "halo_size", "==", "0", ":", "return", "x", "block_size", "=", "block_size_dim", ".", "size", "partial_size", "=", "hal...
Concat each block with the margins of adjacent blocks. Get left and right blocks_dim and concatenate along block_size_dim. Args: x: a Tensor. blocks_dim: a Dimension in x.shape block_size_dim: a Dimension in x.shape halo_size: an integer wrap: a boolean Returns: a Tensor with the same s...
[ "Concat", "each", "block", "with", "the", "margins", "of", "adjacent", "blocks", "." ]
python
train
richardliaw/track
track/autodetect.py
https://github.com/richardliaw/track/blob/7ac42ea34e5c1d7bb92fd813e938835a06a63fc7/track/autodetect.py#L45-L55
def git_hash(): """returns the current git hash or unknown if not in git repo""" if git_repo() is None: return "unknown" git_hash = subprocess.check_output( ["git", "rev-parse", "HEAD"]) # git_hash is a byte string; we want a string. git_hash = git_hash.decode("utf-8") # git_hash...
[ "def", "git_hash", "(", ")", ":", "if", "git_repo", "(", ")", "is", "None", ":", "return", "\"unknown\"", "git_hash", "=", "subprocess", ".", "check_output", "(", "[", "\"git\"", ",", "\"rev-parse\"", ",", "\"HEAD\"", "]", ")", "# git_hash is a byte string; we...
returns the current git hash or unknown if not in git repo
[ "returns", "the", "current", "git", "hash", "or", "unknown", "if", "not", "in", "git", "repo" ]
python
train
pyviz/holoviews
holoviews/core/io.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/io.py#L652-L688
def add(self, obj=None, filename=None, data=None, info={}, **kwargs): """ If a filename is supplied, it will be used. Otherwise, a filename will be generated from the supplied object. Note that if the explicit filename uses the {timestamp} field, it will be formatted upon export....
[ "def", "add", "(", "self", ",", "obj", "=", "None", ",", "filename", "=", "None", ",", "data", "=", "None", ",", "info", "=", "{", "}", ",", "*", "*", "kwargs", ")", ":", "if", "[", "filename", ",", "obj", "]", "==", "[", "None", ",", "None",...
If a filename is supplied, it will be used. Otherwise, a filename will be generated from the supplied object. Note that if the explicit filename uses the {timestamp} field, it will be formatted upon export. The data to be archived is either supplied explicitly as 'data' or autom...
[ "If", "a", "filename", "is", "supplied", "it", "will", "be", "used", ".", "Otherwise", "a", "filename", "will", "be", "generated", "from", "the", "supplied", "object", ".", "Note", "that", "if", "the", "explicit", "filename", "uses", "the", "{", "timestamp...
python
train
cdumay/kser
src/kser/controller.py
https://github.com/cdumay/kser/blob/fbd6fe9ab34b8b89d9937e5ff727614304af48c1/src/kser/controller.py#L129-L143
def register(cls, name, entrypoint): """ Register a new entrypoint :param str name: Key used by messages :param kser.entry.Entrypoint entrypoint: class to load :raises ValidationError: Invalid entry """ if not issubclass(entrypoint, Entrypoint): raise Validat...
[ "def", "register", "(", "cls", ",", "name", ",", "entrypoint", ")", ":", "if", "not", "issubclass", "(", "entrypoint", ",", "Entrypoint", ")", ":", "raise", "ValidationError", "(", "\"Invalid type for entry '{}', MUST implement \"", "\"kser.entry.Entrypoint\"", ".", ...
Register a new entrypoint :param str name: Key used by messages :param kser.entry.Entrypoint entrypoint: class to load :raises ValidationError: Invalid entry
[ "Register", "a", "new", "entrypoint" ]
python
train
mosdef-hub/mbuild
mbuild/coordinate_transform.py
https://github.com/mosdef-hub/mbuild/blob/dcb80a2becd5d0e6a7e3e7bcb1b59793c46a2dd3/mbuild/coordinate_transform.py#L72-L80
def apply_to(self, A): """Apply the coordinate transformation to points in A. """ if A.ndim == 1: A = np.expand_dims(A, axis=0) rows, cols = A.shape A_new = np.hstack([A, np.ones((rows, 1))]) A_new = np.transpose(self.T.dot(np.transpose(A_new))) return A_new[...
[ "def", "apply_to", "(", "self", ",", "A", ")", ":", "if", "A", ".", "ndim", "==", "1", ":", "A", "=", "np", ".", "expand_dims", "(", "A", ",", "axis", "=", "0", ")", "rows", ",", "cols", "=", "A", ".", "shape", "A_new", "=", "np", ".", "hst...
Apply the coordinate transformation to points in A.
[ "Apply", "the", "coordinate", "transformation", "to", "points", "in", "A", "." ]
python
train
DallasMorningNews/django-datafreezer
datafreezer/views.py
https://github.com/DallasMorningNews/django-datafreezer/blob/982dcf2015c80a280f1a093e32977cb71d4ea7aa/datafreezer/views.py#L962-L988
def get(self, request, slug): """Basic functionality for GET request to view. """ matching_datasets = self.generate_matching_datasets(slug) if matching_datasets is None: raise Http404("Datasets meeting these criteria do not exist.") base_context = { 'da...
[ "def", "get", "(", "self", ",", "request", ",", "slug", ")", ":", "matching_datasets", "=", "self", ".", "generate_matching_datasets", "(", "slug", ")", "if", "matching_datasets", "is", "None", ":", "raise", "Http404", "(", "\"Datasets meeting these criteria do no...
Basic functionality for GET request to view.
[ "Basic", "functionality", "for", "GET", "request", "to", "view", "." ]
python
train
pkgw/pwkit
pwkit/numutil.py
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/numutil.py#L351-L361
def reduce_data_frame_evenly_with_gaps (df, valcol, target_len, maxgap, **kwargs): """"Reduce" a DataFrame by collapsing rows in grouped chunks, grouping based on gaps in one of the columns. This function combines :func:`reduce_data_frame` with :func:`slice_evenly_with_gaps`. """ return reduce...
[ "def", "reduce_data_frame_evenly_with_gaps", "(", "df", ",", "valcol", ",", "target_len", ",", "maxgap", ",", "*", "*", "kwargs", ")", ":", "return", "reduce_data_frame", "(", "df", ",", "slice_evenly_with_gaps", "(", "df", "[", "valcol", "]", ",", "target_len...
Reduce" a DataFrame by collapsing rows in grouped chunks, grouping based on gaps in one of the columns. This function combines :func:`reduce_data_frame` with :func:`slice_evenly_with_gaps`.
[ "Reduce", "a", "DataFrame", "by", "collapsing", "rows", "in", "grouped", "chunks", "grouping", "based", "on", "gaps", "in", "one", "of", "the", "columns", "." ]
python
train
prezi/django-zipkin
django_zipkin/_thrift/zipkinQuery/ZipkinQuery.py
https://github.com/prezi/django-zipkin/blob/158d04cf9c2fe0adcb4cda66a250d9e41eae33f3/django_zipkin/_thrift/zipkinQuery/ZipkinQuery.py#L585-L594
def getTraceCombosByIds(self, trace_ids, adjust): """ Not content with just one of traces, summaries or timelines? Want it all? This is the method for you. Parameters: - trace_ids - adjust """ self.send_getTraceCombosByIds(trace_ids, adjust) return self.recv_getTraceCombosByIds()
[ "def", "getTraceCombosByIds", "(", "self", ",", "trace_ids", ",", "adjust", ")", ":", "self", ".", "send_getTraceCombosByIds", "(", "trace_ids", ",", "adjust", ")", "return", "self", ".", "recv_getTraceCombosByIds", "(", ")" ]
Not content with just one of traces, summaries or timelines? Want it all? This is the method for you. Parameters: - trace_ids - adjust
[ "Not", "content", "with", "just", "one", "of", "traces", "summaries", "or", "timelines?", "Want", "it", "all?", "This", "is", "the", "method", "for", "you", "." ]
python
train
ArchiveTeam/wpull
wpull/driver/process.py
https://github.com/ArchiveTeam/wpull/blob/ddf051aa3322479325ba20aa778cb2cb97606bf5/wpull/driver/process.py#L96-L112
def _read_stdout(self): '''Continuously read the stdout for messages.''' try: while self._process.returncode is None: line = yield from self._process.stdout.readline() _logger.debug('Read stdout line %s', repr(line)) if not line: ...
[ "def", "_read_stdout", "(", "self", ")", ":", "try", ":", "while", "self", ".", "_process", ".", "returncode", "is", "None", ":", "line", "=", "yield", "from", "self", ".", "_process", ".", "stdout", ".", "readline", "(", ")", "_logger", ".", "debug", ...
Continuously read the stdout for messages.
[ "Continuously", "read", "the", "stdout", "for", "messages", "." ]
python
train
yyuu/botornado
boto/s3/connection.py
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/s3/connection.py#L351-L365
def get_canonical_user_id(self, headers=None): """ Convenience method that returns the "CanonicalUserID" of the user who's credentials are associated with the connection. The only way to get this value is to do a GET request on the service which returns all buckets associated wit...
[ "def", "get_canonical_user_id", "(", "self", ",", "headers", "=", "None", ")", ":", "rs", "=", "self", ".", "get_all_buckets", "(", "headers", "=", "headers", ")", "return", "rs", ".", "ID" ]
Convenience method that returns the "CanonicalUserID" of the user who's credentials are associated with the connection. The only way to get this value is to do a GET request on the service which returns all buckets associated with the account. As part of that response, the canonical user...
[ "Convenience", "method", "that", "returns", "the", "CanonicalUserID", "of", "the", "user", "who", "s", "credentials", "are", "associated", "with", "the", "connection", ".", "The", "only", "way", "to", "get", "this", "value", "is", "to", "do", "a", "GET", "...
python
train
redapple/parslepy
parslepy/selectors.py
https://github.com/redapple/parslepy/blob/a8bc4c0592824459629018c8f4c6ae3dad6cc3cc/parslepy/selectors.py#L222-L231
def _add_parsley_ns(cls, namespace_dict): """ Extend XPath evaluation with Parsley extensions' namespace """ namespace_dict.update({ 'parslepy' : cls.LOCAL_NAMESPACE, 'parsley' : cls.LOCAL_NAMESPACE, }) return namespace_dict
[ "def", "_add_parsley_ns", "(", "cls", ",", "namespace_dict", ")", ":", "namespace_dict", ".", "update", "(", "{", "'parslepy'", ":", "cls", ".", "LOCAL_NAMESPACE", ",", "'parsley'", ":", "cls", ".", "LOCAL_NAMESPACE", ",", "}", ")", "return", "namespace_dict" ...
Extend XPath evaluation with Parsley extensions' namespace
[ "Extend", "XPath", "evaluation", "with", "Parsley", "extensions", "namespace" ]
python
valid
pymc-devs/pymc
pymc/diagnostics.py
https://github.com/pymc-devs/pymc/blob/c6e530210bff4c0d7189b35b2c971bc53f93f7cd/pymc/diagnostics.py#L403-L450
def batch_means(x, f=lambda y: y, theta=.5, q=.95, burn=0): """ TODO: Use Bayesian CI. Returns the half-width of the frequentist confidence interval (q'th quantile) of the Monte Carlo estimate of E[f(x)]. :Parameters: x : sequence Sampled series. Must be a one-dimensional array...
[ "def", "batch_means", "(", "x", ",", "f", "=", "lambda", "y", ":", "y", ",", "theta", "=", ".5", ",", "q", "=", ".95", ",", "burn", "=", "0", ")", ":", "try", ":", "import", "scipy", "from", "scipy", "import", "stats", "except", "ImportError", ":...
TODO: Use Bayesian CI. Returns the half-width of the frequentist confidence interval (q'th quantile) of the Monte Carlo estimate of E[f(x)]. :Parameters: x : sequence Sampled series. Must be a one-dimensional array. f : function The MCSE of E[f(x)] will be computed....
[ "TODO", ":", "Use", "Bayesian", "CI", "." ]
python
train
saltstack/salt
salt/modules/boto3_elasticache.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto3_elasticache.py#L525-L536
def list_cache_subnet_groups(region=None, key=None, keyid=None, profile=None): ''' Return a list of all cache subnet group names Example: .. code-block:: bash salt myminion boto3_elasticache.list_cache_subnet_groups region=us-east-1 ''' return [g['CacheSubnetGroupName'] for g in ...
[ "def", "list_cache_subnet_groups", "(", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "return", "[", "g", "[", "'CacheSubnetGroupName'", "]", "for", "g", "in", "describe_cache_subnet_groups"...
Return a list of all cache subnet group names Example: .. code-block:: bash salt myminion boto3_elasticache.list_cache_subnet_groups region=us-east-1
[ "Return", "a", "list", "of", "all", "cache", "subnet", "group", "names" ]
python
train
tritemio/PyBroMo
pybromo/diffusion.py
https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/diffusion.py#L373-L379
def compact_name(self, hashsize=6): """Compact representation of all simulation parameters """ # this can be made more robust for ID > 9 (double digit) s = self.compact_name_core(hashsize, t_max=True) s += "_ID%d-%d" % (self.ID, self.EID) return s
[ "def", "compact_name", "(", "self", ",", "hashsize", "=", "6", ")", ":", "# this can be made more robust for ID > 9 (double digit)", "s", "=", "self", ".", "compact_name_core", "(", "hashsize", ",", "t_max", "=", "True", ")", "s", "+=", "\"_ID%d-%d\"", "%", "(",...
Compact representation of all simulation parameters
[ "Compact", "representation", "of", "all", "simulation", "parameters" ]
python
valid
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/core/inputsplitter.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/inputsplitter.py#L675-L679
def _tr_magic(line_info): "Translate lines escaped with: %" tpl = '%sget_ipython().magic(%r)' cmd = ' '.join([line_info.ifun, line_info.the_rest]).strip() return tpl % (line_info.pre, cmd)
[ "def", "_tr_magic", "(", "line_info", ")", ":", "tpl", "=", "'%sget_ipython().magic(%r)'", "cmd", "=", "' '", ".", "join", "(", "[", "line_info", ".", "ifun", ",", "line_info", ".", "the_rest", "]", ")", ".", "strip", "(", ")", "return", "tpl", "%", "(...
Translate lines escaped with: %
[ "Translate", "lines", "escaped", "with", ":", "%" ]
python
test
ARMmbed/icetea
icetea_lib/Reports/ReportJunit.py
https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Reports/ReportJunit.py#L106-L170
def __generate(results): """ Static method which generates the Junit xml string from results :param results: Results as ResultList object. :return: Junit xml format string. """ doc, tag, text = Doc().tagtext() # Counters for testsuite tag info count = 0 ...
[ "def", "__generate", "(", "results", ")", ":", "doc", ",", "tag", ",", "text", "=", "Doc", "(", ")", ".", "tagtext", "(", ")", "# Counters for testsuite tag info", "count", "=", "0", "fails", "=", "0", "errors", "=", "0", "skips", "=", "0", "for", "r...
Static method which generates the Junit xml string from results :param results: Results as ResultList object. :return: Junit xml format string.
[ "Static", "method", "which", "generates", "the", "Junit", "xml", "string", "from", "results" ]
python
train
ska-sa/purr
Purr/Editors.py
https://github.com/ska-sa/purr/blob/4c848768d0485d0f88b30850d0d5372221b21b66/Purr/Editors.py#L484-L500
def resolveFilenameConflicts(self): """Goes through list of DPs to make sure that their destination names do not clash. Adjust names as needed. Returns True if some conflicts were resolved. """ taken_names = set() resolved = False # iterate through items for item,...
[ "def", "resolveFilenameConflicts", "(", "self", ")", ":", "taken_names", "=", "set", "(", ")", "resolved", "=", "False", "# iterate through items", "for", "item", ",", "dp", "in", "self", ".", "getItemDPList", "(", ")", ":", "# only apply this to saved DPs", "if...
Goes through list of DPs to make sure that their destination names do not clash. Adjust names as needed. Returns True if some conflicts were resolved.
[ "Goes", "through", "list", "of", "DPs", "to", "make", "sure", "that", "their", "destination", "names", "do", "not", "clash", ".", "Adjust", "names", "as", "needed", ".", "Returns", "True", "if", "some", "conflicts", "were", "resolved", "." ]
python
train
HewlettPackard/python-hpOneView
hpOneView/resources/servers/id_pools_ranges.py
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/id_pools_ranges.py#L123-L142
def get_allocated_fragments(self, id_or_uri, count=-1, start=0): """ Gets all fragments that have been allocated in range. Args: id_or_uri: ID or URI of range. count: The number of resources to return. A count of -1 requests all items. Th...
[ "def", "get_allocated_fragments", "(", "self", ",", "id_or_uri", ",", "count", "=", "-", "1", ",", "start", "=", "0", ")", ":", "uri", "=", "self", ".", "_client", ".", "build_uri", "(", "id_or_uri", ")", "+", "\"/allocated-fragments?start={0}&count={1}\"", ...
Gets all fragments that have been allocated in range. Args: id_or_uri: ID or URI of range. count: The number of resources to return. A count of -1 requests all items. The actual number of items in the response may differ from the request...
[ "Gets", "all", "fragments", "that", "have", "been", "allocated", "in", "range", "." ]
python
train
peterbrittain/asciimatics
asciimatics/paths.py
https://github.com/peterbrittain/asciimatics/blob/f471427d7786ce2d5f1eeb2dae0e67d19e46e085/asciimatics/paths.py#L123-L130
def wait(self, delay): """ Wait at the current location for the specified number of iterations. :param delay: The time to wait (in animation frames). """ for _ in range(0, delay): self._add_step((self._rec_x, self._rec_y))
[ "def", "wait", "(", "self", ",", "delay", ")", ":", "for", "_", "in", "range", "(", "0", ",", "delay", ")", ":", "self", ".", "_add_step", "(", "(", "self", ".", "_rec_x", ",", "self", ".", "_rec_y", ")", ")" ]
Wait at the current location for the specified number of iterations. :param delay: The time to wait (in animation frames).
[ "Wait", "at", "the", "current", "location", "for", "the", "specified", "number", "of", "iterations", "." ]
python
train
wreckage/django-happenings
happenings/utils/calendars.py
https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/utils/calendars.py#L270-L300
def popover_helper(self): """Populate variables used to build popovers.""" # when display_month = month_name[self.mo] if isinstance(display_month, six.binary_type) and self.encoding: display_month = display_month.decode('utf-8') self.when = ('<p><b>When:</b> ' + dis...
[ "def", "popover_helper", "(", "self", ")", ":", "# when", "display_month", "=", "month_name", "[", "self", ".", "mo", "]", "if", "isinstance", "(", "display_month", ",", "six", ".", "binary_type", ")", "and", "self", ".", "encoding", ":", "display_month", ...
Populate variables used to build popovers.
[ "Populate", "variables", "used", "to", "build", "popovers", "." ]
python
test
wandb/client
wandb/vendor/prompt_toolkit/styles/from_dict.py
https://github.com/wandb/client/blob/7d08954ed5674fee223cd85ed0d8518fe47266b2/wandb/vendor/prompt_toolkit/styles/from_dict.py#L42-L128
def style_from_dict(style_dict, include_defaults=True): """ Create a ``Style`` instance from a dictionary or other mapping. The dictionary is equivalent to the ``Style.styles`` dictionary from pygments, with a few additions: it supports 'reverse' and 'blink'. Usage:: style_from_dict({ ...
[ "def", "style_from_dict", "(", "style_dict", ",", "include_defaults", "=", "True", ")", ":", "assert", "isinstance", "(", "style_dict", ",", "Mapping", ")", "if", "include_defaults", ":", "s2", "=", "{", "}", "s2", ".", "update", "(", "DEFAULT_STYLE_EXTENSIONS...
Create a ``Style`` instance from a dictionary or other mapping. The dictionary is equivalent to the ``Style.styles`` dictionary from pygments, with a few additions: it supports 'reverse' and 'blink'. Usage:: style_from_dict({ Token: '#ff0000 bold underline', Token.Title: '...
[ "Create", "a", "Style", "instance", "from", "a", "dictionary", "or", "other", "mapping", "." ]
python
train
dossier/dossier.store
dossier/store/elastic.py
https://github.com/dossier/dossier.store/blob/b22ffe2470bba9fcc98a30cb55b437bfa1521e7f/dossier/store/elastic.py#L782-L791
def _fc_index_disjunction_from_query(self, query_fc, fname): 'Creates a disjunction for keyword scan queries.' if len(query_fc.get(fname, [])) == 0: return [] terms = query_fc[fname].keys() disj = [] for fname in self.indexes[fname]['feature_names']: disj...
[ "def", "_fc_index_disjunction_from_query", "(", "self", ",", "query_fc", ",", "fname", ")", ":", "if", "len", "(", "query_fc", ".", "get", "(", "fname", ",", "[", "]", ")", ")", "==", "0", ":", "return", "[", "]", "terms", "=", "query_fc", "[", "fnam...
Creates a disjunction for keyword scan queries.
[ "Creates", "a", "disjunction", "for", "keyword", "scan", "queries", "." ]
python
test
openvax/isovar
isovar/reference_context.py
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/reference_context.py#L98-L139
def reference_contexts_for_variant( variant, context_size, transcript_id_whitelist=None): """ variant : varcode.Variant context_size : int Max of nucleotides to include to the left and right of the variant in the context sequence. transcript_id_whitelist : set, ...
[ "def", "reference_contexts_for_variant", "(", "variant", ",", "context_size", ",", "transcript_id_whitelist", "=", "None", ")", ":", "overlapping_transcripts", "=", "reference_transcripts_for_variant", "(", "variant", "=", "variant", ",", "transcript_id_whitelist", "=", "...
variant : varcode.Variant context_size : int Max of nucleotides to include to the left and right of the variant in the context sequence. transcript_id_whitelist : set, optional If given, then only consider transcripts whose IDs are in this set. Returns list of ReferenceContext obj...
[ "variant", ":", "varcode", ".", "Variant" ]
python
train
openego/ding0
ding0/tools/results.py
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/results.py#L1216-L1255
def init_mv_grid(mv_grid_districts=[3545], filename='ding0_tests_grids_1.pkl'): '''Runs ding0 over the districtis selected in mv_grid_districts It also writes the result in filename. If filename = False, then the network is not saved. Parameters ---------- mv_grid_districts: :any:`list` of :ob...
[ "def", "init_mv_grid", "(", "mv_grid_districts", "=", "[", "3545", "]", ",", "filename", "=", "'ding0_tests_grids_1.pkl'", ")", ":", "print", "(", "'\\n########################################'", ")", "print", "(", "' Running ding0 for district'", ",", "mv_grid_districts...
Runs ding0 over the districtis selected in mv_grid_districts It also writes the result in filename. If filename = False, then the network is not saved. Parameters ---------- mv_grid_districts: :any:`list` of :obj:`int` Districts IDs: Defaults to [3545] filename: str Defaults to...
[ "Runs", "ding0", "over", "the", "districtis", "selected", "in", "mv_grid_districts" ]
python
train
SwissDataScienceCenter/renku-python
renku/cli/init.py
https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/init.py#L87-L91
def store_directory(ctx, param, value): """Store directory as a new Git home.""" Path(value).mkdir(parents=True, exist_ok=True) set_git_home(value) return value
[ "def", "store_directory", "(", "ctx", ",", "param", ",", "value", ")", ":", "Path", "(", "value", ")", ".", "mkdir", "(", "parents", "=", "True", ",", "exist_ok", "=", "True", ")", "set_git_home", "(", "value", ")", "return", "value" ]
Store directory as a new Git home.
[ "Store", "directory", "as", "a", "new", "Git", "home", "." ]
python
train
SeattleTestbed/seash
pyreadline/lineeditor/lineobj.py
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/lineeditor/lineobj.py#L243-L246
def visible_line_width(self, position = Point): """Return the visible width of the text in line buffer up to position.""" extra_char_width = len([ None for c in self[:position].line_buffer if 0x2013 <= ord(c) <= 0xFFFD]) return len(self[:position].quoted_text()) + self[:position].line_buffer....
[ "def", "visible_line_width", "(", "self", ",", "position", "=", "Point", ")", ":", "extra_char_width", "=", "len", "(", "[", "None", "for", "c", "in", "self", "[", ":", "position", "]", ".", "line_buffer", "if", "0x2013", "<=", "ord", "(", "c", ")", ...
Return the visible width of the text in line buffer up to position.
[ "Return", "the", "visible", "width", "of", "the", "text", "in", "line", "buffer", "up", "to", "position", "." ]
python
train
gem/oq-engine
openquake/hazardlib/sourcewriter.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L524-L540
def build_simple_fault_source_node(fault_source): """ Parses a simple fault source to a Node class :param fault_source: Simple fault source as instance of :class: `openquake.hazardlib.source.simple_fault.SimpleFaultSource` :returns: Instance of :class:`openquake.baselib.node.Nod...
[ "def", "build_simple_fault_source_node", "(", "fault_source", ")", ":", "# Parse geometry", "source_nodes", "=", "[", "build_simple_fault_geometry", "(", "fault_source", ")", "]", "# Parse common fault source attributes", "source_nodes", ".", "extend", "(", "get_fault_source_...
Parses a simple fault source to a Node class :param fault_source: Simple fault source as instance of :class: `openquake.hazardlib.source.simple_fault.SimpleFaultSource` :returns: Instance of :class:`openquake.baselib.node.Node`
[ "Parses", "a", "simple", "fault", "source", "to", "a", "Node", "class" ]
python
train
bwohlberg/sporco
sporco/admm/admm.py
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/admm/admm.py#L1234-L1240
def obfn_g(self, Y): r"""Compute :math:`g(\mathbf{y}) = g_0(\mathbf{y}_0) + g_1(\mathbf{y}_1)` component of ADMM objective function. """ return self.obfn_g0(self.obfn_g0var()) + \ self.obfn_g1(self.obfn_g1var())
[ "def", "obfn_g", "(", "self", ",", "Y", ")", ":", "return", "self", ".", "obfn_g0", "(", "self", ".", "obfn_g0var", "(", ")", ")", "+", "self", ".", "obfn_g1", "(", "self", ".", "obfn_g1var", "(", ")", ")" ]
r"""Compute :math:`g(\mathbf{y}) = g_0(\mathbf{y}_0) + g_1(\mathbf{y}_1)` component of ADMM objective function.
[ "r", "Compute", ":", "math", ":", "g", "(", "\\", "mathbf", "{", "y", "}", ")", "=", "g_0", "(", "\\", "mathbf", "{", "y", "}", "_0", ")", "+", "g_1", "(", "\\", "mathbf", "{", "y", "}", "_1", ")", "component", "of", "ADMM", "objective", "fun...
python
train
heitzmann/gdspy
gdspy/__init__.py
https://github.com/heitzmann/gdspy/blob/2c8d1313248c544e2066d19095b7ad7158c79bc9/gdspy/__init__.py#L2184-L2215
def copy(self, name, exclude_from_current=False, deep_copy=False): """ Creates a copy of this cell. Parameters ---------- name : string The name of the cell. exclude_from_current : bool If ``True``, the cell will not be included in the global ...
[ "def", "copy", "(", "self", ",", "name", ",", "exclude_from_current", "=", "False", ",", "deep_copy", "=", "False", ")", ":", "new_cell", "=", "Cell", "(", "name", ",", "exclude_from_current", ")", "if", "deep_copy", ":", "new_cell", ".", "elements", "=", ...
Creates a copy of this cell. Parameters ---------- name : string The name of the cell. exclude_from_current : bool If ``True``, the cell will not be included in the global list of cells maintained by ``gdspy``. deep_copy : bool If ...
[ "Creates", "a", "copy", "of", "this", "cell", "." ]
python
train
saltstack/salt
salt/utils/nacl.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nacl.py#L374-L396
def secretbox_decrypt(data, **kwargs): ''' Decrypt data that was encrypted using `nacl.secretbox_encrypt` using the secret key that was generated from `nacl.keygen`. CLI Examples: .. code-block:: bash salt-call nacl.secretbox_decrypt pEXHQM6cuaF7A= salt-call --local nacl.secretbox...
[ "def", "secretbox_decrypt", "(", "data", ",", "*", "*", "kwargs", ")", ":", "if", "data", "is", "None", ":", "return", "None", "# ensure data is in bytes", "data", "=", "salt", ".", "utils", ".", "stringutils", ".", "to_bytes", "(", "data", ")", "key", "...
Decrypt data that was encrypted using `nacl.secretbox_encrypt` using the secret key that was generated from `nacl.keygen`. CLI Examples: .. code-block:: bash salt-call nacl.secretbox_decrypt pEXHQM6cuaF7A= salt-call --local nacl.secretbox_decrypt data='pEXHQM6cuaF7A=' sk_file=/etc/salt/pk...
[ "Decrypt", "data", "that", "was", "encrypted", "using", "nacl", ".", "secretbox_encrypt", "using", "the", "secret", "key", "that", "was", "generated", "from", "nacl", ".", "keygen", "." ]
python
train
Morrolan/surrealism
surrealism.py
https://github.com/Morrolan/surrealism/blob/7fdd2eae534410df16ee1f9d7e9bb77aa10decab/surrealism.py#L622-L638
def __replace_adjective(sentence, counts): """Lets find and replace all instances of #ADJECTIVE :param _sentence: :param counts: """ if sentence is not None: while sentence.find('#ADJECTIVE') != -1: sentence = sentence.replace('#ADJECTIVE', ...
[ "def", "__replace_adjective", "(", "sentence", ",", "counts", ")", ":", "if", "sentence", "is", "not", "None", ":", "while", "sentence", ".", "find", "(", "'#ADJECTIVE'", ")", "!=", "-", "1", ":", "sentence", "=", "sentence", ".", "replace", "(", "'#ADJE...
Lets find and replace all instances of #ADJECTIVE :param _sentence: :param counts:
[ "Lets", "find", "and", "replace", "all", "instances", "of", "#ADJECTIVE", ":", "param", "_sentence", ":", ":", "param", "counts", ":" ]
python
train
jessamynsmith/paragres
paragres/command.py
https://github.com/jessamynsmith/paragres/blob/4e068cbfcafbe8f1b010741d38fb65d40de2c6aa/paragres/command.py#L238-L253
def capture_heroku_database(self): """ Capture Heroku database backup. """ self.print_message("Capturing database backup for app '%s'" % self.args.source_app) args = [ "heroku", "pg:backups:capture", "--app=%s" % self.args.source_app, ] if self...
[ "def", "capture_heroku_database", "(", "self", ")", ":", "self", ".", "print_message", "(", "\"Capturing database backup for app '%s'\"", "%", "self", ".", "args", ".", "source_app", ")", "args", "=", "[", "\"heroku\"", ",", "\"pg:backups:capture\"", ",", "\"--app=%...
Capture Heroku database backup.
[ "Capture", "Heroku", "database", "backup", "." ]
python
train
googledatalab/pydatalab
solutionbox/ml_workbench/xgboost/trainer/task.py
https://github.com/googledatalab/pydatalab/blob/d9031901d5bca22fe0d5925d204e6698df9852e1/solutionbox/ml_workbench/xgboost/trainer/task.py#L462-L582
def make_export_strategy( args, keep_target, assets_extra, features, schema, stats): """Makes prediction graph that takes json input. Args: args: command line args keep_target: If ture, target column is returned in prediction graph. Target column must...
[ "def", "make_export_strategy", "(", "args", ",", "keep_target", ",", "assets_extra", ",", "features", ",", "schema", ",", "stats", ")", ":", "target_name", "=", "feature_transforms", ".", "get_target_name", "(", "features", ")", "csv_header", "=", "[", "col", ...
Makes prediction graph that takes json input. Args: args: command line args keep_target: If ture, target column is returned in prediction graph. Target column must also exist in input data assets_extra: other fiels to copy to the output folder job_dir: root job folder features: features d...
[ "Makes", "prediction", "graph", "that", "takes", "json", "input", "." ]
python
train
pytroll/satpy
satpy/node.py
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/node.py#L315-L344
def _get_compositor_prereqs(self, parent, prereq_names, skip=False, **dfilter): """Determine prerequisite Nodes for a composite. Args: parent (Node): Compositor node to add these prerequisites under prereq_names (sequence): Strings (names), floats...
[ "def", "_get_compositor_prereqs", "(", "self", ",", "parent", ",", "prereq_names", ",", "skip", "=", "False", ",", "*", "*", "dfilter", ")", ":", "prereq_ids", "=", "[", "]", "unknowns", "=", "set", "(", ")", "for", "prereq", "in", "prereq_names", ":", ...
Determine prerequisite Nodes for a composite. Args: parent (Node): Compositor node to add these prerequisites under prereq_names (sequence): Strings (names), floats (wavelengths), or DatasetIDs to analyze. skip (bool, optional): If True, ...
[ "Determine", "prerequisite", "Nodes", "for", "a", "composite", "." ]
python
train
smarie/python-parsyfiles
parsyfiles/parsing_combining_parsers.py
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/parsing_combining_parsers.py#L588-L598
def _parse_singlefile(self, desired_type: Type[T], file_path: str, encoding: str, logger: Logger, options: Dict[str, Dict[str, Any]]) -> T: """ Implementation of AnyParser API """ # first use the base parser to parse something compliant with the conversion chain...
[ "def", "_parse_singlefile", "(", "self", ",", "desired_type", ":", "Type", "[", "T", "]", ",", "file_path", ":", "str", ",", "encoding", ":", "str", ",", "logger", ":", "Logger", ",", "options", ":", "Dict", "[", "str", ",", "Dict", "[", "str", ",", ...
Implementation of AnyParser API
[ "Implementation", "of", "AnyParser", "API" ]
python
train
treycucco/bidon
bidon/db/access/model_access.py
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L158-L166
def find_or_create(self, constructor, props, *, comp=None): """Looks for a model taht matches the given dictionary constraints. If it is not found, a new model of the given type is created and saved to the database, then returned. """ model = self.find_model(constructor, comp or props) if model is N...
[ "def", "find_or_create", "(", "self", ",", "constructor", ",", "props", ",", "*", ",", "comp", "=", "None", ")", ":", "model", "=", "self", ".", "find_model", "(", "constructor", ",", "comp", "or", "props", ")", "if", "model", "is", "None", ":", "mod...
Looks for a model taht matches the given dictionary constraints. If it is not found, a new model of the given type is created and saved to the database, then returned.
[ "Looks", "for", "a", "model", "taht", "matches", "the", "given", "dictionary", "constraints", ".", "If", "it", "is", "not", "found", "a", "new", "model", "of", "the", "given", "type", "is", "created", "and", "saved", "to", "the", "database", "then", "ret...
python
train
lowandrew/OLCTools
coreGenome/core.py
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/coreGenome/core.py#L106-L164
def reporter(metadata, analysistype, reportpath): """ Create the core genome report :param metadata: type LIST: List of metadata objects :param analysistype: type STR: Current analysis type :param reportpath: type STR: Absolute path to folder in which the reports are to be create...
[ "def", "reporter", "(", "metadata", ",", "analysistype", ",", "reportpath", ")", ":", "header", "=", "'Strain,ClosestRef,GenesPresent/Total,\\n'", "data", "=", "str", "(", ")", "for", "sample", "in", "metadata", ":", "try", ":", "if", "sample", "[", "analysist...
Create the core genome report :param metadata: type LIST: List of metadata objects :param analysistype: type STR: Current analysis type :param reportpath: type STR: Absolute path to folder in which the reports are to be created :return:
[ "Create", "the", "core", "genome", "report", ":", "param", "metadata", ":", "type", "LIST", ":", "List", "of", "metadata", "objects", ":", "param", "analysistype", ":", "type", "STR", ":", "Current", "analysis", "type", ":", "param", "reportpath", ":", "ty...
python
train
bapakode/OmMongo
ommongo/fields/sequence.py
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/fields/sequence.py#L117-L126
def validate_unwrap(self, value, session=None): ''' Checks that the type of ``value`` is correct as well as validating the elements of value''' self._validate_unwrap_type(value) self._length_valid(value) for v in value: if self.has_autoload: self._...
[ "def", "validate_unwrap", "(", "self", ",", "value", ",", "session", "=", "None", ")", ":", "self", ".", "_validate_unwrap_type", "(", "value", ")", "self", ".", "_length_valid", "(", "value", ")", "for", "v", "in", "value", ":", "if", "self", ".", "ha...
Checks that the type of ``value`` is correct as well as validating the elements of value
[ "Checks", "that", "the", "type", "of", "value", "is", "correct", "as", "well", "as", "validating", "the", "elements", "of", "value" ]
python
train
nrcharles/caelum
caelum/forecast.py
https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/forecast.py#L58-L65
def current(place): """return data as list of dicts with all data filled in.""" lat, lon = place url = "https://api.forecast.io/forecast/%s/%s,%s?solar" % (APIKEY, lat, lon) w_data = json.loads(urllib2.urlopen(url).read()) currently = w_...
[ "def", "current", "(", "place", ")", ":", "lat", ",", "lon", "=", "place", "url", "=", "\"https://api.forecast.io/forecast/%s/%s,%s?solar\"", "%", "(", "APIKEY", ",", "lat", ",", "lon", ")", "w_data", "=", "json", ".", "loads", "(", "urllib2", ".", "urlope...
return data as list of dicts with all data filled in.
[ "return", "data", "as", "list", "of", "dicts", "with", "all", "data", "filled", "in", "." ]
python
train
google/apitools
apitools/gen/message_registry.py
https://github.com/google/apitools/blob/f3745a7ea535aa0e88b0650c16479b696d6fd446/apitools/gen/message_registry.py#L311-L327
def __AddEntryType(self, entry_type_name, entry_schema, parent_name): """Add a type for a list entry.""" entry_schema.pop('description', None) description = 'Single entry in a %s.' % parent_name schema = { 'id': entry_type_name, 'type': 'object', 'desc...
[ "def", "__AddEntryType", "(", "self", ",", "entry_type_name", ",", "entry_schema", ",", "parent_name", ")", ":", "entry_schema", ".", "pop", "(", "'description'", ",", "None", ")", "description", "=", "'Single entry in a %s.'", "%", "parent_name", "schema", "=", ...
Add a type for a list entry.
[ "Add", "a", "type", "for", "a", "list", "entry", "." ]
python
train
equinor/segyio
python/segyio/field.py
https://github.com/equinor/segyio/blob/58fd449947ccd330b9af0699d6b8710550d34e8e/python/segyio/field.py#L453-L515
def update(self, *args, **kwargs): """d.update([E, ]**F) -> None. Update D from mapping/iterable E and F. Overwrite the values in `d` with the keys from `E` and `F`. If any key in `value` is invalid in `d`, ``KeyError`` is raised. This method is atomic - either all values in `value` a...
[ "def", "update", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "args", ")", ">", "1", ":", "msg", "=", "'update expected at most 1 non-keyword argument, got {}'", "raise", "TypeError", "(", "msg", ".", "format", "(", ...
d.update([E, ]**F) -> None. Update D from mapping/iterable E and F. Overwrite the values in `d` with the keys from `E` and `F`. If any key in `value` is invalid in `d`, ``KeyError`` is raised. This method is atomic - either all values in `value` are set in `d`, or none are. ``update``...
[ "d", ".", "update", "(", "[", "E", "]", "**", "F", ")", "-", ">", "None", ".", "Update", "D", "from", "mapping", "/", "iterable", "E", "and", "F", "." ]
python
train
pazz/alot
alot/db/manager.py
https://github.com/pazz/alot/blob/d0297605c0ec1c6b65f541d0fd5b69ac5a0f4ded/alot/db/manager.py#L240-L261
def untag(self, querystring, tags, afterwards=None): """ removes tags from messages that match `querystring`. This appends an untag operation to the write queue and raises :exc:`~errors.DatabaseROError` if in read only mode. :param querystring: notmuch search string :typ...
[ "def", "untag", "(", "self", ",", "querystring", ",", "tags", ",", "afterwards", "=", "None", ")", ":", "if", "self", ".", "ro", ":", "raise", "DatabaseROError", "(", ")", "self", ".", "writequeue", ".", "append", "(", "(", "'untag'", ",", "afterwards"...
removes tags from messages that match `querystring`. This appends an untag operation to the write queue and raises :exc:`~errors.DatabaseROError` if in read only mode. :param querystring: notmuch search string :type querystring: str :param tags: a list of tags to be added ...
[ "removes", "tags", "from", "messages", "that", "match", "querystring", ".", "This", "appends", "an", "untag", "operation", "to", "the", "write", "queue", "and", "raises", ":", "exc", ":", "~errors", ".", "DatabaseROError", "if", "in", "read", "only", "mode",...
python
train
nugget/python-insteonplm
insteonplm/tools.py
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L613-L648
def do_set_hub_connection(self, args): """Set Hub connection parameters. Usage: set_hub_connection username password host [port] Arguments: username: Hub username password: Hub password host: host name or IP address port: IP port [def...
[ "def", "do_set_hub_connection", "(", "self", ",", "args", ")", ":", "params", "=", "args", ".", "split", "(", ")", "username", "=", "None", "password", "=", "None", "host", "=", "None", "port", "=", "None", "try", ":", "username", "=", "params", "[", ...
Set Hub connection parameters. Usage: set_hub_connection username password host [port] Arguments: username: Hub username password: Hub password host: host name or IP address port: IP port [default 25105]
[ "Set", "Hub", "connection", "parameters", "." ]
python
train
Feneric/doxypypy
doxypypy/doxypypy.py
https://github.com/Feneric/doxypypy/blob/a8555b15fa2a758ea8392372de31c0f635cc0d93/doxypypy/doxypypy.py#L594-L614
def visit_Module(self, node, **kwargs): """ Handles the module-level docstring. Process the module-level docstring and create appropriate Doxygen tags if autobrief option is set. """ containingNodes=kwargs.get('containingNodes', []) if self.options.debug: ...
[ "def", "visit_Module", "(", "self", ",", "node", ",", "*", "*", "kwargs", ")", ":", "containingNodes", "=", "kwargs", ".", "get", "(", "'containingNodes'", ",", "[", "]", ")", "if", "self", ".", "options", ".", "debug", ":", "stderr", ".", "write", "...
Handles the module-level docstring. Process the module-level docstring and create appropriate Doxygen tags if autobrief option is set.
[ "Handles", "the", "module", "-", "level", "docstring", "." ]
python
train
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L10077-L10098
def radrec(inrange, re, dec): """ Convert from range, right ascension, and declination to rectangular coordinates. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/radrec_c.html :param inrange: Distance of a point from the origin. :type inrange: float :param re: Right ascension of p...
[ "def", "radrec", "(", "inrange", ",", "re", ",", "dec", ")", ":", "inrange", "=", "ctypes", ".", "c_double", "(", "inrange", ")", "re", "=", "ctypes", ".", "c_double", "(", "re", ")", "dec", "=", "ctypes", ".", "c_double", "(", "dec", ")", "rectan"...
Convert from range, right ascension, and declination to rectangular coordinates. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/radrec_c.html :param inrange: Distance of a point from the origin. :type inrange: float :param re: Right ascension of point in radians. :type re: float :...
[ "Convert", "from", "range", "right", "ascension", "and", "declination", "to", "rectangular", "coordinates", "." ]
python
train
materialsproject/pymatgen
pymatgen/vis/plotters.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/plotters.py#L81-L95
def add_spectra(self, spectra_dict, key_sort_func=None): """ Add a dictionary of doses, with an optional sorting function for the keys. Args: dos_dict: dict of {label: Dos} key_sort_func: function used to sort the dos_dict keys. """ if key_sort_fu...
[ "def", "add_spectra", "(", "self", ",", "spectra_dict", ",", "key_sort_func", "=", "None", ")", ":", "if", "key_sort_func", ":", "keys", "=", "sorted", "(", "spectra_dict", ".", "keys", "(", ")", ",", "key", "=", "key_sort_func", ")", "else", ":", "keys"...
Add a dictionary of doses, with an optional sorting function for the keys. Args: dos_dict: dict of {label: Dos} key_sort_func: function used to sort the dos_dict keys.
[ "Add", "a", "dictionary", "of", "doses", "with", "an", "optional", "sorting", "function", "for", "the", "keys", "." ]
python
train
numenta/nupic
src/nupic/datafiles/extra/regression/makeDataset.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/datafiles/extra/regression/makeDataset.py#L93-L111
def _generateFile(filename, data): """ Parameters: ---------------------------------------------------------------- filename: name of .csv file to generate """ # Create the file print "Creating %s..." % (filename) numRecords, numFields = data.shape fields = [('field%...
[ "def", "_generateFile", "(", "filename", ",", "data", ")", ":", "# Create the file", "print", "\"Creating %s...\"", "%", "(", "filename", ")", "numRecords", ",", "numFields", "=", "data", ".", "shape", "fields", "=", "[", "(", "'field%d'", "%", "(", "i", "...
Parameters: ---------------------------------------------------------------- filename: name of .csv file to generate
[ "Parameters", ":", "----------------------------------------------------------------", "filename", ":", "name", "of", ".", "csv", "file", "to", "generate" ]
python
valid
aliyun/aliyun-odps-python-sdk
odps/ml/expr/mixin.py
https://github.com/aliyun/aliyun-odps-python-sdk/blob/4b0de18f5864386df6068f26f026e62f932c41e4/odps/ml/expr/mixin.py#L537-L590
def merge_data(*data_frames, **kwargs): """ Merge DataFrames by column. Number of rows in tables must be the same. This method can be called both outside and as a DataFrame method. :param list[DataFrame] data_frames: DataFrames to be merged. :param bool auto_rename: if True, fields in source DataF...
[ "def", "merge_data", "(", "*", "data_frames", ",", "*", "*", "kwargs", ")", ":", "from", ".", "specialized", "import", "build_merge_expr", "from", ".", ".", "utils", "import", "ML_ARG_PREFIX", "if", "len", "(", "data_frames", ")", "<=", "1", ":", "raise", ...
Merge DataFrames by column. Number of rows in tables must be the same. This method can be called both outside and as a DataFrame method. :param list[DataFrame] data_frames: DataFrames to be merged. :param bool auto_rename: if True, fields in source DataFrames will be renamed in the output. :return: m...
[ "Merge", "DataFrames", "by", "column", ".", "Number", "of", "rows", "in", "tables", "must", "be", "the", "same", "." ]
python
train
ucsb-cs-education/hairball
hairball/plugins/blocks.py
https://github.com/ucsb-cs-education/hairball/blob/c6da8971f8a34e88ce401d36b51431715e1dff5b/hairball/plugins/blocks.py#L23-L30
def analyze(self, scratch, **kwargs): """Run and return the results from the BlockCounts plugin.""" file_blocks = Counter() for script in self.iter_scripts(scratch): for name, _, _ in self.iter_blocks(script.blocks): file_blocks[name] += 1 self.blocks.update(f...
[ "def", "analyze", "(", "self", ",", "scratch", ",", "*", "*", "kwargs", ")", ":", "file_blocks", "=", "Counter", "(", ")", "for", "script", "in", "self", ".", "iter_scripts", "(", "scratch", ")", ":", "for", "name", ",", "_", ",", "_", "in", "self"...
Run and return the results from the BlockCounts plugin.
[ "Run", "and", "return", "the", "results", "from", "the", "BlockCounts", "plugin", "." ]
python
train
Telefonica/toolium
toolium/config_driver.py
https://github.com/Telefonica/toolium/blob/56847c243b3a98876df74c184b75e43f8810e475/toolium/config_driver.py#L128-L160
def _create_local_driver(self): """Create a driver in local machine :returns: a new local selenium driver """ driver_type = self.config.get('Driver', 'type') driver_name = driver_type.split('-')[0] if driver_name in ('android', 'ios', 'iphone'): # Create loc...
[ "def", "_create_local_driver", "(", "self", ")", ":", "driver_type", "=", "self", ".", "config", ".", "get", "(", "'Driver'", ",", "'type'", ")", "driver_name", "=", "driver_type", ".", "split", "(", "'-'", ")", "[", "0", "]", "if", "driver_name", "in", ...
Create a driver in local machine :returns: a new local selenium driver
[ "Create", "a", "driver", "in", "local", "machine" ]
python
train
ctuning/ck
ck/kernel.py
https://github.com/ctuning/ck/blob/7e009814e975f8742790d3106340088a46223714/ck/kernel.py#L676-L698
def get_from_dicts(dict1, key, default_value, dict2, extra=''): """ Input: dict1 - first check in this dict (and remove if there) key - key in dict1 default_value - default value if not found dict2 - then check from here Output: value """ ...
[ "def", "get_from_dicts", "(", "dict1", ",", "key", ",", "default_value", ",", "dict2", ",", "extra", "=", "''", ")", ":", "value", "=", "default_value", "if", "key", "not", "in", "dict1", ":", "if", "dict2", "!=", "None", ":", "value", "=", "dict2", ...
Input: dict1 - first check in this dict (and remove if there) key - key in dict1 default_value - default value if not found dict2 - then check from here Output: value
[ "Input", ":", "dict1", "-", "first", "check", "in", "this", "dict", "(", "and", "remove", "if", "there", ")", "key", "-", "key", "in", "dict1", "default_value", "-", "default", "value", "if", "not", "found", "dict2", "-", "then", "check", "from", "here...
python
train
ionelmc/python-cogen
cogen/core/schedulers.py
https://github.com/ionelmc/python-cogen/blob/83b0edb88425eba6e5bfda9f1dcd34642517e2a8/cogen/core/schedulers.py#L178-L212
def iter_run(self): """ The actual processing for the main loop is here. Running the main loop as a generator (where a iteration is a full sched, proactor and timers/timeouts run) is usefull for interleaving the main loop with other applications that have a blocking main l...
[ "def", "iter_run", "(", "self", ")", ":", "self", ".", "running", "=", "True", "urgent", "=", "None", "while", "self", ".", "running", "and", "(", "self", ".", "active", "or", "self", ".", "proactor", "or", "self", ".", "timeouts", "or", "urgent", ")...
The actual processing for the main loop is here. Running the main loop as a generator (where a iteration is a full sched, proactor and timers/timeouts run) is usefull for interleaving the main loop with other applications that have a blocking main loop and require cogen to run in t...
[ "The", "actual", "processing", "for", "the", "main", "loop", "is", "here", ".", "Running", "the", "main", "loop", "as", "a", "generator", "(", "where", "a", "iteration", "is", "a", "full", "sched", "proactor", "and", "timers", "/", "timeouts", "run", ")"...
python
train
CI-WATER/gsshapy
gsshapy/modeling/event.py
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/event.py#L135-L139
def _update_card(self, card_name, new_value, add_quotes=False): """ Adds/updates card for gssha project file """ self.project_manager.setCard(card_name, new_value, add_quotes)
[ "def", "_update_card", "(", "self", ",", "card_name", ",", "new_value", ",", "add_quotes", "=", "False", ")", ":", "self", ".", "project_manager", ".", "setCard", "(", "card_name", ",", "new_value", ",", "add_quotes", ")" ]
Adds/updates card for gssha project file
[ "Adds", "/", "updates", "card", "for", "gssha", "project", "file" ]
python
train
jreinhardt/constraining-order
src/constrainingorder/sets.py
https://github.com/jreinhardt/constraining-order/blob/04d00e4cad0fa9bedf15f2e89b8fd667c0495edc/src/constrainingorder/sets.py#L492-L509
def intersection(self,other): """ Return a new DiscreteSet with the intersection of the two sets, i.e. all elements that are in both self and other. :param DiscreteSet other: Set to intersect with :rtype: DiscreteSet """ if self.everything: if other.e...
[ "def", "intersection", "(", "self", ",", "other", ")", ":", "if", "self", ".", "everything", ":", "if", "other", ".", "everything", ":", "return", "DiscreteSet", "(", ")", "else", ":", "return", "DiscreteSet", "(", "other", ".", "elements", ")", "else", ...
Return a new DiscreteSet with the intersection of the two sets, i.e. all elements that are in both self and other. :param DiscreteSet other: Set to intersect with :rtype: DiscreteSet
[ "Return", "a", "new", "DiscreteSet", "with", "the", "intersection", "of", "the", "two", "sets", "i", ".", "e", ".", "all", "elements", "that", "are", "in", "both", "self", "and", "other", "." ]
python
train
ihmeuw/vivarium
src/vivarium/config_tree.py
https://github.com/ihmeuw/vivarium/blob/c5f5d50f775c8bf337d3aae1ff7c57c025a8e258/src/vivarium/config_tree.py#L328-L363
def update(self, data: Union[Mapping, str, bytes], layer: str=None, source: str=None): """Adds additional data into the ConfigTree. Parameters ---------- data : source data layer : layer to load data into. If none is supplied the outermost one is used ...
[ "def", "update", "(", "self", ",", "data", ":", "Union", "[", "Mapping", ",", "str", ",", "bytes", "]", ",", "layer", ":", "str", "=", "None", ",", "source", ":", "str", "=", "None", ")", ":", "if", "isinstance", "(", "data", ",", "dict", ")", ...
Adds additional data into the ConfigTree. Parameters ---------- data : source data layer : layer to load data into. If none is supplied the outermost one is used source : Source to attribute the values to See Also -------- ...
[ "Adds", "additional", "data", "into", "the", "ConfigTree", "." ]
python
train
kensho-technologies/graphql-compiler
graphql_compiler/compiler/ir_sanity_checks.py
https://github.com/kensho-technologies/graphql-compiler/blob/f6079c6d10f64932f6b3af309b79bcea2123ca8f/graphql_compiler/compiler/ir_sanity_checks.py#L83-L92
def _sanity_check_fold_scope_locations_are_unique(ir_blocks): """Assert that every FoldScopeLocation that exists on a Fold block is unique.""" observed_locations = dict() for block in ir_blocks: if isinstance(block, Fold): alternate = observed_locations.get(block.fold_scope_location, Non...
[ "def", "_sanity_check_fold_scope_locations_are_unique", "(", "ir_blocks", ")", ":", "observed_locations", "=", "dict", "(", ")", "for", "block", "in", "ir_blocks", ":", "if", "isinstance", "(", "block", ",", "Fold", ")", ":", "alternate", "=", "observed_locations"...
Assert that every FoldScopeLocation that exists on a Fold block is unique.
[ "Assert", "that", "every", "FoldScopeLocation", "that", "exists", "on", "a", "Fold", "block", "is", "unique", "." ]
python
train
intake/intake
intake/catalog/base.py
https://github.com/intake/intake/blob/277b96bfdee39d8a3048ea5408c6d6716d568336/intake/catalog/base.py#L267-L279
def serialize(self): """ Produce YAML version of this catalog. Note that this is not the same as ``.yaml()``, which produces a YAML block referring to this catalog. """ import yaml output = {"metadata": self.metadata, "sources": {}, "name": self...
[ "def", "serialize", "(", "self", ")", ":", "import", "yaml", "output", "=", "{", "\"metadata\"", ":", "self", ".", "metadata", ",", "\"sources\"", ":", "{", "}", ",", "\"name\"", ":", "self", ".", "name", "}", "for", "key", ",", "entry", "in", "self"...
Produce YAML version of this catalog. Note that this is not the same as ``.yaml()``, which produces a YAML block referring to this catalog.
[ "Produce", "YAML", "version", "of", "this", "catalog", "." ]
python
train
materialsproject/pymatgen
pymatgen/ext/matproj.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/ext/matproj.py#L1089-L1102
def get_reaction(self, reactants, products): """ Gets a reaction from the Materials Project. Args: reactants ([str]): List of formulas products ([str]): List of formulas Returns: rxn """ return self._make_request("/reaction", ...
[ "def", "get_reaction", "(", "self", ",", "reactants", ",", "products", ")", ":", "return", "self", ".", "_make_request", "(", "\"/reaction\"", ",", "payload", "=", "{", "\"reactants[]\"", ":", "reactants", ",", "\"products[]\"", ":", "products", "}", ",", "m...
Gets a reaction from the Materials Project. Args: reactants ([str]): List of formulas products ([str]): List of formulas Returns: rxn
[ "Gets", "a", "reaction", "from", "the", "Materials", "Project", "." ]
python
train
phn/angles
angles.py
https://github.com/phn/angles/blob/5c30ed7c3a7412177daaed180bf3b2351b287589/angles.py#L2215-L2233
def bear(self, p): """Find position angle between objects, in radians. Parameters ---------- p : AngularPosition The object to which bearing must be determined. Notes ----- This method calls the function bear(). See its docstring for details....
[ "def", "bear", "(", "self", ",", "p", ")", ":", "return", "bear", "(", "self", ".", "alpha", ".", "r", ",", "self", ".", "delta", ".", "r", ",", "p", ".", "alpha", ".", "r", ",", "p", ".", "delta", ".", "r", ")" ]
Find position angle between objects, in radians. Parameters ---------- p : AngularPosition The object to which bearing must be determined. Notes ----- This method calls the function bear(). See its docstring for details. See also ---...
[ "Find", "position", "angle", "between", "objects", "in", "radians", "." ]
python
train
jlinn/pyflare
pyflare/hosting.py
https://github.com/jlinn/pyflare/blob/1108e82a9622d1aa6d92d4c4797744ff3cf41f68/pyflare/hosting.py#L196-L244
def zone_list( self, user_key, limit=100, offset=0, zone_name=None, sub_id=None, zone_status='ALL', sub_status='ALL', ): """ List zones for a user. :param user_key: key for authentication of user :type u...
[ "def", "zone_list", "(", "self", ",", "user_key", ",", "limit", "=", "100", ",", "offset", "=", "0", ",", "zone_name", "=", "None", ",", "sub_id", "=", "None", ",", "zone_status", "=", "'ALL'", ",", "sub_status", "=", "'ALL'", ",", ")", ":", "if", ...
List zones for a user. :param user_key: key for authentication of user :type user_key: str :param limit: limit of zones shown :type limit: int :param offset: offset of zones to be shown :type offset: int :param zone_name: name of zone to...
[ "List", "zones", "for", "a", "user", "." ]
python
train
rlabbe/filterpy
filterpy/kalman/kalman_filter.py
https://github.com/rlabbe/filterpy/blob/8123214de798ffb63db968bb0b9492ee74e77950/filterpy/kalman/kalman_filter.py#L1100-L1106
def log_likelihood(self): """ log-likelihood of the last measurement. """ if self._log_likelihood is None: self._log_likelihood = logpdf(x=self.y, cov=self.S) return self._log_likelihood
[ "def", "log_likelihood", "(", "self", ")", ":", "if", "self", ".", "_log_likelihood", "is", "None", ":", "self", ".", "_log_likelihood", "=", "logpdf", "(", "x", "=", "self", ".", "y", ",", "cov", "=", "self", ".", "S", ")", "return", "self", ".", ...
log-likelihood of the last measurement.
[ "log", "-", "likelihood", "of", "the", "last", "measurement", "." ]
python
train
jaraco/tempora
tempora/schedule.py
https://github.com/jaraco/tempora/blob/f0a9ab636103fe829aa9b495c93f5249aac5f2b8/tempora/schedule.py#L29-L36
def from_timestamp(ts): """ Convert a numeric timestamp to a timezone-aware datetime. A client may override this function to change the default behavior, such as to use local time or timezone-naïve times. """ return datetime.datetime.utcfromtimestamp(ts).replace(tzinfo=pytz.utc)
[ "def", "from_timestamp", "(", "ts", ")", ":", "return", "datetime", ".", "datetime", ".", "utcfromtimestamp", "(", "ts", ")", ".", "replace", "(", "tzinfo", "=", "pytz", ".", "utc", ")" ]
Convert a numeric timestamp to a timezone-aware datetime. A client may override this function to change the default behavior, such as to use local time or timezone-naïve times.
[ "Convert", "a", "numeric", "timestamp", "to", "a", "timezone", "-", "aware", "datetime", "." ]
python
valid
numenta/nupic
src/nupic/algorithms/fdrutilities.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L319-L411
def generateL2Sequences(nL1Patterns=10, l1Hubs=[2,6], l1SeqLength=[5,6,7], nL1SimpleSequences=50, nL1HubSequences=50, l1Pooling=4, perfectStability=False, spHysteresisFactor=1.0, patternLen=500, patternActivity=50): """ Generate the simulated output from a spat...
[ "def", "generateL2Sequences", "(", "nL1Patterns", "=", "10", ",", "l1Hubs", "=", "[", "2", ",", "6", "]", ",", "l1SeqLength", "=", "[", "5", ",", "6", ",", "7", "]", ",", "nL1SimpleSequences", "=", "50", ",", "nL1HubSequences", "=", "50", ",", "l1Poo...
Generate the simulated output from a spatial pooler that's sitting on top of another spatial pooler / temporal memory pair. The average on-time of the outputs from the simulated TM is given by the l1Pooling argument. In this routine, L1 refers to the first spatial and temporal memory and L2 refers to the spat...
[ "Generate", "the", "simulated", "output", "from", "a", "spatial", "pooler", "that", "s", "sitting", "on", "top", "of", "another", "spatial", "pooler", "/", "temporal", "memory", "pair", ".", "The", "average", "on", "-", "time", "of", "the", "outputs", "fro...
python
valid
gem/oq-engine
openquake/hmtk/parsers/faults/fault_yaml_parser.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hmtk/parsers/faults/fault_yaml_parser.py#L89-L105
def parse_tect_region_dict_to_tuples(region_dict): ''' Parses the tectonic regionalisation dictionary attributes to tuples ''' output_region_dict = [] tuple_keys = ['Displacement_Length_Ratio', 'Shear_Modulus'] # Convert MSR string name to openquake.hazardlib.scalerel object for region in re...
[ "def", "parse_tect_region_dict_to_tuples", "(", "region_dict", ")", ":", "output_region_dict", "=", "[", "]", "tuple_keys", "=", "[", "'Displacement_Length_Ratio'", ",", "'Shear_Modulus'", "]", "# Convert MSR string name to openquake.hazardlib.scalerel object", "for", "region",...
Parses the tectonic regionalisation dictionary attributes to tuples
[ "Parses", "the", "tectonic", "regionalisation", "dictionary", "attributes", "to", "tuples" ]
python
train
esafak/mca
src/mca.py
https://github.com/esafak/mca/blob/f2b79ecbf37629902ccdbad2e1a556977c53d370/src/mca.py#L30-L34
def dummy(DF, cols=None): """Dummy code select columns of a DataFrame.""" dummies = (get_dummies(DF[col]) for col in (DF.columns if cols is None else cols)) return concat(dummies, axis=1, keys=DF.columns)
[ "def", "dummy", "(", "DF", ",", "cols", "=", "None", ")", ":", "dummies", "=", "(", "get_dummies", "(", "DF", "[", "col", "]", ")", "for", "col", "in", "(", "DF", ".", "columns", "if", "cols", "is", "None", "else", "cols", ")", ")", "return", "...
Dummy code select columns of a DataFrame.
[ "Dummy", "code", "select", "columns", "of", "a", "DataFrame", "." ]
python
train
awslabs/sockeye
sockeye/extract_parameters.py
https://github.com/awslabs/sockeye/blob/5d64a1ee1ef3cbba17c6d1d94bc061020c43f6ab/sockeye/extract_parameters.py#L34-L51
def _extract(param_names: List[str], params: Dict[str, mx.nd.NDArray], ext_params: Dict[str, np.ndarray]) -> List[str]: """ Extract specific parameters from a given base. :param param_names: Names of parameters to be extracted. :param params: Mapping from parameter names to th...
[ "def", "_extract", "(", "param_names", ":", "List", "[", "str", "]", ",", "params", ":", "Dict", "[", "str", ",", "mx", ".", "nd", ".", "NDArray", "]", ",", "ext_params", ":", "Dict", "[", "str", ",", "np", ".", "ndarray", "]", ")", "->", "List",...
Extract specific parameters from a given base. :param param_names: Names of parameters to be extracted. :param params: Mapping from parameter names to the actual NDArrays parameters. :param ext_params: Extracted parameter dictionary. :return: Remaining names of parameters to be extracted.
[ "Extract", "specific", "parameters", "from", "a", "given", "base", "." ]
python
train
MacHu-GWU/pathlib_mate-project
pathlib_mate/mate_path_filters.py
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L144-L153
def n_subdir(self): """ Count how many folders in this directory (doesn't include folder in sub folders). """ self.assert_is_dir_and_exists() n = 0 for _ in self.select_dir(recursive=False): n += 1 return n
[ "def", "n_subdir", "(", "self", ")", ":", "self", ".", "assert_is_dir_and_exists", "(", ")", "n", "=", "0", "for", "_", "in", "self", ".", "select_dir", "(", "recursive", "=", "False", ")", ":", "n", "+=", "1", "return", "n" ]
Count how many folders in this directory (doesn't include folder in sub folders).
[ "Count", "how", "many", "folders", "in", "this", "directory", "(", "doesn", "t", "include", "folder", "in", "sub", "folders", ")", "." ]
python
valid
pallets/pallets-sphinx-themes
src/pallets_sphinx_themes/themes/click/domain.py
https://github.com/pallets/pallets-sphinx-themes/blob/1d4517d76dd492017f17acd7f72e82e40a1f1bc6/src/pallets_sphinx_themes/themes/click/domain.py#L199-L206
def get_example_runner(document): """Get or create the :class:`ExampleRunner` instance associated with a document. """ runner = getattr(document, "click_example_runner", None) if runner is None: runner = document.click_example_runner = ExampleRunner() return runner
[ "def", "get_example_runner", "(", "document", ")", ":", "runner", "=", "getattr", "(", "document", ",", "\"click_example_runner\"", ",", "None", ")", "if", "runner", "is", "None", ":", "runner", "=", "document", ".", "click_example_runner", "=", "ExampleRunner",...
Get or create the :class:`ExampleRunner` instance associated with a document.
[ "Get", "or", "create", "the", ":", "class", ":", "ExampleRunner", "instance", "associated", "with", "a", "document", "." ]
python
train
mardix/pylot
pylot/utils.py
https://github.com/mardix/pylot/blob/506a33a56ebdfc0925b94015e8cf98ccb16a143c/pylot/utils.py#L170-L183
def is_port_open(port, host="127.0.0.1"): """ Check if a port is open :param port: :param host: :return bool: """ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.connect((host, int(port))) s.shutdown(2) return True except Exception as e: r...
[ "def", "is_port_open", "(", "port", ",", "host", "=", "\"127.0.0.1\"", ")", ":", "s", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ")", "try", ":", "s", ".", "connect", "(", "(", "host", ",", "int", ...
Check if a port is open :param port: :param host: :return bool:
[ "Check", "if", "a", "port", "is", "open", ":", "param", "port", ":", ":", "param", "host", ":", ":", "return", "bool", ":" ]
python
train
kmerkmer/pymer
pymer/base.py
https://github.com/kmerkmer/pymer/blob/c22802436b3756a2e92829c9b234bde6217b683a/pymer/base.py#L27-L30
def consume(self, seq): '''Counts all k-mers in sequence.''' for kmer in iter_kmers(seq, self.k, canonical=self.canonical): self._incr(kmer)
[ "def", "consume", "(", "self", ",", "seq", ")", ":", "for", "kmer", "in", "iter_kmers", "(", "seq", ",", "self", ".", "k", ",", "canonical", "=", "self", ".", "canonical", ")", ":", "self", ".", "_incr", "(", "kmer", ")" ]
Counts all k-mers in sequence.
[ "Counts", "all", "k", "-", "mers", "in", "sequence", "." ]
python
train
glitchassassin/lackey
lackey/RegionMatching.py
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1486-L1492
def stopObserver(self): """ Stops this region's observer loop. If this is running in a subprocess, the subprocess will end automatically. """ self._observer.isStopped = True self._observer.isRunning = False
[ "def", "stopObserver", "(", "self", ")", ":", "self", ".", "_observer", ".", "isStopped", "=", "True", "self", ".", "_observer", ".", "isRunning", "=", "False" ]
Stops this region's observer loop. If this is running in a subprocess, the subprocess will end automatically.
[ "Stops", "this", "region", "s", "observer", "loop", "." ]
python
train
WebarchivCZ/WA-KAT
bin/wa_kat_build_keyword_index.py
https://github.com/WebarchivCZ/WA-KAT/blob/16d064a3a775dc1d2713debda7847ded52dd2a06/bin/wa_kat_build_keyword_index.py#L99-L132
def _download_items(db, last_id): """ Download items from the aleph and store them in `db`. Start from `last_id` if specified. Args: db (obj): Dictionary-like object used as DB. last_id (int): Start from this id. """ MAX_RETRY = 20 # how many times to try till decision that thi...
[ "def", "_download_items", "(", "db", ",", "last_id", ")", ":", "MAX_RETRY", "=", "20", "# how many times to try till decision that this is an end", "MAX_DOC_ID", "=", "10000000", "# this is used for download iterator", "not_found_cnt", "=", "0", "# circuit breaker", "for", ...
Download items from the aleph and store them in `db`. Start from `last_id` if specified. Args: db (obj): Dictionary-like object used as DB. last_id (int): Start from this id.
[ "Download", "items", "from", "the", "aleph", "and", "store", "them", "in", "db", ".", "Start", "from", "last_id", "if", "specified", "." ]
python
train
fabioz/PyDev.Debugger
third_party/pep8/pycodestyle.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/pycodestyle.py#L1397-L1419
def parse_udiff(diff, patterns=None, parent='.'): """Return a dictionary of matching lines.""" # For each file of the diff, the entry key is the filename, # and the value is a set of row numbers to consider. rv = {} path = nrows = None for line in diff.splitlines(): if nrows: ...
[ "def", "parse_udiff", "(", "diff", ",", "patterns", "=", "None", ",", "parent", "=", "'.'", ")", ":", "# For each file of the diff, the entry key is the filename,", "# and the value is a set of row numbers to consider.", "rv", "=", "{", "}", "path", "=", "nrows", "=", ...
Return a dictionary of matching lines.
[ "Return", "a", "dictionary", "of", "matching", "lines", "." ]
python
train
Spinmob/spinmob
_functions.py
https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L1395-L1403
def sort_matrix(a,n=0): """ This will rearrange the array a[n] from lowest to highest, and rearrange the rest of a[i]'s in the same way. It is dumb and slow. Returns a numpy array. """ a = _n.array(a) return a[:,a[n,:].argsort()]
[ "def", "sort_matrix", "(", "a", ",", "n", "=", "0", ")", ":", "a", "=", "_n", ".", "array", "(", "a", ")", "return", "a", "[", ":", ",", "a", "[", "n", ",", ":", "]", ".", "argsort", "(", ")", "]" ]
This will rearrange the array a[n] from lowest to highest, and rearrange the rest of a[i]'s in the same way. It is dumb and slow. Returns a numpy array.
[ "This", "will", "rearrange", "the", "array", "a", "[", "n", "]", "from", "lowest", "to", "highest", "and", "rearrange", "the", "rest", "of", "a", "[", "i", "]", "s", "in", "the", "same", "way", ".", "It", "is", "dumb", "and", "slow", "." ]
python
train
olitheolix/qtmacs
qtmacs/applets/logviewer.py
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/applets/logviewer.py#L196-L246
def qteUpdateLogSlot(self): """ Fetch and display the next batch of log messages. """ # Fetch all log records that have arrived since the last # fetch() call and update the record counter. log = self.logHandler.fetch(start=self.qteLogCnt) self.qteLogCnt += len(lo...
[ "def", "qteUpdateLogSlot", "(", "self", ")", ":", "# Fetch all log records that have arrived since the last", "# fetch() call and update the record counter.", "log", "=", "self", ".", "logHandler", ".", "fetch", "(", "start", "=", "self", ".", "qteLogCnt", ")", "self", ...
Fetch and display the next batch of log messages.
[ "Fetch", "and", "display", "the", "next", "batch", "of", "log", "messages", "." ]
python
train
google/grr
grr/server/grr_response_server/frontend_lib.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/frontend_lib.py#L424-L493
def DrainTaskSchedulerQueueForClient(self, client, max_count=None): """Drains the client's Task Scheduler queue. 1) Get all messages in the client queue. 2) Sort these into a set of session_ids. 3) Use data_store.DB.ResolvePrefix() to query all requests. 4) Delete all responses for retransmitted me...
[ "def", "DrainTaskSchedulerQueueForClient", "(", "self", ",", "client", ",", "max_count", "=", "None", ")", ":", "if", "max_count", "is", "None", ":", "max_count", "=", "self", ".", "max_queue_size", "if", "max_count", "<=", "0", ":", "return", "[", "]", "c...
Drains the client's Task Scheduler queue. 1) Get all messages in the client queue. 2) Sort these into a set of session_ids. 3) Use data_store.DB.ResolvePrefix() to query all requests. 4) Delete all responses for retransmitted messages (if needed). Args: client: The ClientURN object specifyi...
[ "Drains", "the", "client", "s", "Task", "Scheduler", "queue", "." ]
python
train
Kortemme-Lab/klab
klab/stats/misc.py
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/stats/misc.py#L100-L102
def fraction_correct_pandas(dataframe, x_series, y_series, x_cutoff = 1.0, y_cutoff = 1.0, ignore_null_values = False): '''A little (<6%) slower than fraction_correct due to the data extraction overhead.''' return fraction_correct(dataframe[x_series].values.tolist(), dataframe[y_series].values.tolist(), x_cutof...
[ "def", "fraction_correct_pandas", "(", "dataframe", ",", "x_series", ",", "y_series", ",", "x_cutoff", "=", "1.0", ",", "y_cutoff", "=", "1.0", ",", "ignore_null_values", "=", "False", ")", ":", "return", "fraction_correct", "(", "dataframe", "[", "x_series", ...
A little (<6%) slower than fraction_correct due to the data extraction overhead.
[ "A", "little", "(", "<6%", ")", "slower", "than", "fraction_correct", "due", "to", "the", "data", "extraction", "overhead", "." ]
python
train
jsmits/django-logutils
django_logutils/middleware.py
https://github.com/jsmits/django-logutils/blob/e88f6e0a08c6f3df9e61f96cfb6cd79bc5ea8a88/django_logutils/middleware.py#L102-L129
def process_response(self, request, response): """ Create the logging message.. """ try: log_dict = create_log_dict(request, response) # add the request time to the log_dict; if no start time is # available, use -1 as NA value request_time...
[ "def", "process_response", "(", "self", ",", "request", ",", "response", ")", ":", "try", ":", "log_dict", "=", "create_log_dict", "(", "request", ",", "response", ")", "# add the request time to the log_dict; if no start time is", "# available, use -1 as NA value", "requ...
Create the logging message..
[ "Create", "the", "logging", "message", ".." ]
python
train
jeffrimko/Qprompt
lib/qprompt.py
https://github.com/jeffrimko/Qprompt/blob/1887c53656dfecac49e0650e0f912328801cbb83/lib/qprompt.py#L144-L147
def enum(self, desc, func=None, args=None, krgs=None): """Add a menu entry whose name will be an auto indexed number.""" name = str(len(self.entries)+1) self.entries.append(MenuEntry(name, desc, func, args or [], krgs or {}))
[ "def", "enum", "(", "self", ",", "desc", ",", "func", "=", "None", ",", "args", "=", "None", ",", "krgs", "=", "None", ")", ":", "name", "=", "str", "(", "len", "(", "self", ".", "entries", ")", "+", "1", ")", "self", ".", "entries", ".", "ap...
Add a menu entry whose name will be an auto indexed number.
[ "Add", "a", "menu", "entry", "whose", "name", "will", "be", "an", "auto", "indexed", "number", "." ]
python
train
j0057/github-release
github_release.py
https://github.com/j0057/github-release/blob/5421d1ad3e49eaad50c800e548f889d55e159b9d/github_release.py#L148-L161
def _recursive_gh_get(href, items): """Recursively get list of GitHub objects. See https://developer.github.com/v3/guides/traversing-with-pagination/ """ response = _request('GET', href) response.raise_for_status() items.extend(response.json()) if "link" not in response.headers: ret...
[ "def", "_recursive_gh_get", "(", "href", ",", "items", ")", ":", "response", "=", "_request", "(", "'GET'", ",", "href", ")", "response", ".", "raise_for_status", "(", ")", "items", ".", "extend", "(", "response", ".", "json", "(", ")", ")", "if", "\"l...
Recursively get list of GitHub objects. See https://developer.github.com/v3/guides/traversing-with-pagination/
[ "Recursively", "get", "list", "of", "GitHub", "objects", "." ]
python
train
markovmodel/msmtools
msmtools/analysis/api.py
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L93-L133
def is_transition_matrix(T, tol=1e-12): r"""Check if the given matrix is a transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Matrix to check tol : float (optional) Floating point tolerance to check with Returns ------- is_transition_matr...
[ "def", "is_transition_matrix", "(", "T", ",", "tol", "=", "1e-12", ")", ":", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", "'numeric'", ")", "if", "_issparse", "(", ...
r"""Check if the given matrix is a transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Matrix to check tol : float (optional) Floating point tolerance to check with Returns ------- is_transition_matrix : bool True, if T is a valid tran...
[ "r", "Check", "if", "the", "given", "matrix", "is", "a", "transition", "matrix", "." ]
python
train
spyder-ide/spyder
spyder/widgets/findreplace.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/findreplace.py#L446-L533
def replace_find(self, focus_replace_text=False, replace_all=False): """Replace and find""" if (self.editor is not None): replace_text = to_text_string(self.replace_text.currentText()) search_text = to_text_string(self.search_text.currentText()) re_pattern = None...
[ "def", "replace_find", "(", "self", ",", "focus_replace_text", "=", "False", ",", "replace_all", "=", "False", ")", ":", "if", "(", "self", ".", "editor", "is", "not", "None", ")", ":", "replace_text", "=", "to_text_string", "(", "self", ".", "replace_text...
Replace and find
[ "Replace", "and", "find" ]
python
train
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L8950-L8974
def nplnpt(linpt, lindir, point): """ Find the nearest point on a line to a specified point, and find the distance between the two points. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/nplnpt_c.html :param linpt: Point on a line :type linpt: 3-Element Array of floats :param lindi...
[ "def", "nplnpt", "(", "linpt", ",", "lindir", ",", "point", ")", ":", "linpt", "=", "stypes", ".", "toDoubleVector", "(", "linpt", ")", "lindir", "=", "stypes", ".", "toDoubleVector", "(", "lindir", ")", "point", "=", "stypes", ".", "toDoubleVector", "("...
Find the nearest point on a line to a specified point, and find the distance between the two points. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/nplnpt_c.html :param linpt: Point on a line :type linpt: 3-Element Array of floats :param lindir: line's direction vector :type lindir: 3...
[ "Find", "the", "nearest", "point", "on", "a", "line", "to", "a", "specified", "point", "and", "find", "the", "distance", "between", "the", "two", "points", "." ]
python
train
flowersteam/explauto
explauto/agent/agent.py
https://github.com/flowersteam/explauto/blob/cf0f81ecb9f6412f7276a95bd27359000e1e26b6/explauto/agent/agent.py#L31-L59
def from_classes(cls, im_model_cls, im_model_config, expl_dims, sm_model_cls, sm_model_config, inf_dims, m_mins, m_maxs, s_mins, s_maxs, n_bootstrap=0, context_mode=None): """Initialize agent class :param class im_model_cls: a subclass of InterestedMod...
[ "def", "from_classes", "(", "cls", ",", "im_model_cls", ",", "im_model_config", ",", "expl_dims", ",", "sm_model_cls", ",", "sm_model_config", ",", "inf_dims", ",", "m_mins", ",", "m_maxs", ",", "s_mins", ",", "s_maxs", ",", "n_bootstrap", "=", "0", ",", "co...
Initialize agent class :param class im_model_cls: a subclass of InterestedModel, as those registered in the interest_model package :param dict im_model_config: a configuration dict as those registered in the interest_model package :param list expl_dims: the sensorimotor dimensions where explo...
[ "Initialize", "agent", "class" ]
python
train