repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
basecrm/basecrm-python
basecrm/configuration.py
Configuration.validate
def validate(self): """Validates whether a configuration is valid. :rtype: bool :raises ConfigurationError: if no ``access_token`` provided. :raises ConfigurationError: if provided ``access_token`` is invalid - contains disallowed characters. :raises ConfigurationError: if provi...
python
def validate(self): """Validates whether a configuration is valid. :rtype: bool :raises ConfigurationError: if no ``access_token`` provided. :raises ConfigurationError: if provided ``access_token`` is invalid - contains disallowed characters. :raises ConfigurationError: if provi...
[ "def", "validate", "(", "self", ")", ":", "if", "self", ".", "access_token", "is", "None", ":", "raise", "ConfigurationError", "(", "'No access token provided. '", "'Set your access token during client initialization using: '", "'\"basecrm.Client(access_token= <YOUR_PERSONAL_ACCE...
Validates whether a configuration is valid. :rtype: bool :raises ConfigurationError: if no ``access_token`` provided. :raises ConfigurationError: if provided ``access_token`` is invalid - contains disallowed characters. :raises ConfigurationError: if provided ``access_token`` is invalid...
[ "Validates", "whether", "a", "configuration", "is", "valid", "." ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/configuration.py#L35-L66
train
Validates whether a configuration is valid.
basecrm/basecrm-python
basecrm/sync.py
SyncService.fetch
def fetch(self, device_uuid, session_id): """ Get data from queue Fetch fresh data from the named queue. Using session identifier you call continously the `#fetch` method to drain the named queue. :calls: ``get /sync/{session_id}/queues/main`` :param string device_uuid:...
python
def fetch(self, device_uuid, session_id): """ Get data from queue Fetch fresh data from the named queue. Using session identifier you call continously the `#fetch` method to drain the named queue. :calls: ``get /sync/{session_id}/queues/main`` :param string device_uuid:...
[ "def", "fetch", "(", "self", ",", "device_uuid", ",", "session_id", ")", ":", "status_code", ",", "_", ",", "root", "=", "self", ".", "http_client", ".", "get", "(", "\"/sync/{session_id}/queues/main\"", ".", "format", "(", "session_id", "=", "session_id", "...
Get data from queue Fetch fresh data from the named queue. Using session identifier you call continously the `#fetch` method to drain the named queue. :calls: ``get /sync/{session_id}/queues/main`` :param string device_uuid: Device's UUID for which to perform synchronization. :...
[ "Get", "data", "from", "queue" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/sync.py#L37-L59
train
Fetch fresh data from the named queue.
basecrm/basecrm-python
basecrm/sync.py
SyncService.ack
def ack(self, device_uuid, ack_keys): """ Acknowledge received data Send acknowledgement keys to let know the Sync service which data you have. As you fetch new data, you need to send acknowledgement keys. :calls: ``post /sync/ack`` :param string device_uuid: Device's U...
python
def ack(self, device_uuid, ack_keys): """ Acknowledge received data Send acknowledgement keys to let know the Sync service which data you have. As you fetch new data, you need to send acknowledgement keys. :calls: ``post /sync/ack`` :param string device_uuid: Device's U...
[ "def", "ack", "(", "self", ",", "device_uuid", ",", "ack_keys", ")", ":", "attributes", "=", "{", "'ack_keys'", ":", "ack_keys", "}", "status_code", ",", "_", ",", "_", "=", "self", ".", "http_client", ".", "post", "(", "'/sync/ack'", ",", "body", "=",...
Acknowledge received data Send acknowledgement keys to let know the Sync service which data you have. As you fetch new data, you need to send acknowledgement keys. :calls: ``post /sync/ack`` :param string device_uuid: Device's UUID for which to perform synchronization. :param l...
[ "Acknowledge", "received", "data" ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/sync.py#L61-L80
train
Acknowledge received data for a specific device_uuid
basecrm/basecrm-python
basecrm/sync.py
Sync.fetch
def fetch(self, callback): """ Perform a full synchronization flow. .. code-block:: python :linenos: >>> client = basecrm.Client(access_token='<YOUR_PERSONAL_ACCESS_TOKEN>') >>> sync = basecrm.Sync(client=client, device_uuid='<YOUR_DEVICES_UUID>') ...
python
def fetch(self, callback): """ Perform a full synchronization flow. .. code-block:: python :linenos: >>> client = basecrm.Client(access_token='<YOUR_PERSONAL_ACCESS_TOKEN>') >>> sync = basecrm.Sync(client=client, device_uuid='<YOUR_DEVICES_UUID>') ...
[ "def", "fetch", "(", "self", ",", "callback", ")", ":", "# Set up a new synchronization session for a given device's UUID", "session", "=", "self", ".", "client", ".", "sync", ".", "start", "(", "self", ".", "device_uuid", ")", "# Check if there is anything to synchroni...
Perform a full synchronization flow. .. code-block:: python :linenos: >>> client = basecrm.Client(access_token='<YOUR_PERSONAL_ACCESS_TOKEN>') >>> sync = basecrm.Sync(client=client, device_uuid='<YOUR_DEVICES_UUID>') >>> sync.fetch(lambda meta, data: basecrm.Syn...
[ "Perform", "a", "full", "synchronization", "flow", "." ]
7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/sync.py#L117-L159
train
Perform a full synchronization flow for a given device s UUID.
tinybike/weightedstats
weightedstats/__init__.py
weighted_mean
def weighted_mean(data, weights=None): """Calculate the weighted mean of a list.""" if weights is None: return mean(data) total_weight = float(sum(weights)) weights = [weight / total_weight for weight in weights] w_mean = 0 for i, weight in enumerate(weights): w_mean += weight * ...
python
def weighted_mean(data, weights=None): """Calculate the weighted mean of a list.""" if weights is None: return mean(data) total_weight = float(sum(weights)) weights = [weight / total_weight for weight in weights] w_mean = 0 for i, weight in enumerate(weights): w_mean += weight * ...
[ "def", "weighted_mean", "(", "data", ",", "weights", "=", "None", ")", ":", "if", "weights", "is", "None", ":", "return", "mean", "(", "data", ")", "total_weight", "=", "float", "(", "sum", "(", "weights", ")", ")", "weights", "=", "[", "weight", "/"...
Calculate the weighted mean of a list.
[ "Calculate", "the", "weighted", "mean", "of", "a", "list", "." ]
0e2638099dba7f288a1553a83e957a95522229da
https://github.com/tinybike/weightedstats/blob/0e2638099dba7f288a1553a83e957a95522229da/weightedstats/__init__.py#L43-L52
train
Calculate the weighted mean of a list.
tinybike/weightedstats
weightedstats/__init__.py
numpy_weighted_mean
def numpy_weighted_mean(data, weights=None): """Calculate the weighted mean of an array/list using numpy.""" import numpy as np weights = np.array(weights).flatten() / float(sum(weights)) return np.dot(np.array(data), weights)
python
def numpy_weighted_mean(data, weights=None): """Calculate the weighted mean of an array/list using numpy.""" import numpy as np weights = np.array(weights).flatten() / float(sum(weights)) return np.dot(np.array(data), weights)
[ "def", "numpy_weighted_mean", "(", "data", ",", "weights", "=", "None", ")", ":", "import", "numpy", "as", "np", "weights", "=", "np", ".", "array", "(", "weights", ")", ".", "flatten", "(", ")", "/", "float", "(", "sum", "(", "weights", ")", ")", ...
Calculate the weighted mean of an array/list using numpy.
[ "Calculate", "the", "weighted", "mean", "of", "an", "array", "/", "list", "using", "numpy", "." ]
0e2638099dba7f288a1553a83e957a95522229da
https://github.com/tinybike/weightedstats/blob/0e2638099dba7f288a1553a83e957a95522229da/weightedstats/__init__.py#L54-L58
train
Calculate the weighted mean of an array using numpy.
tinybike/weightedstats
weightedstats/__init__.py
median
def median(data): """Calculate the median of a list.""" data.sort() num_values = len(data) half = num_values // 2 if num_values % 2: return data[half] return 0.5 * (data[half-1] + data[half])
python
def median(data): """Calculate the median of a list.""" data.sort() num_values = len(data) half = num_values // 2 if num_values % 2: return data[half] return 0.5 * (data[half-1] + data[half])
[ "def", "median", "(", "data", ")", ":", "data", ".", "sort", "(", ")", "num_values", "=", "len", "(", "data", ")", "half", "=", "num_values", "//", "2", "if", "num_values", "%", "2", ":", "return", "data", "[", "half", "]", "return", "0.5", "*", ...
Calculate the median of a list.
[ "Calculate", "the", "median", "of", "a", "list", "." ]
0e2638099dba7f288a1553a83e957a95522229da
https://github.com/tinybike/weightedstats/blob/0e2638099dba7f288a1553a83e957a95522229da/weightedstats/__init__.py#L60-L67
train
Calculate the median of a list.
tinybike/weightedstats
weightedstats/__init__.py
weighted_median
def weighted_median(data, weights=None): """Calculate the weighted median of a list.""" if weights is None: return median(data) midpoint = 0.5 * sum(weights) if any([j > midpoint for j in weights]): return data[weights.index(max(weights))] if any([j > 0 for j in weights]): so...
python
def weighted_median(data, weights=None): """Calculate the weighted median of a list.""" if weights is None: return median(data) midpoint = 0.5 * sum(weights) if any([j > midpoint for j in weights]): return data[weights.index(max(weights))] if any([j > 0 for j in weights]): so...
[ "def", "weighted_median", "(", "data", ",", "weights", "=", "None", ")", ":", "if", "weights", "is", "None", ":", "return", "median", "(", "data", ")", "midpoint", "=", "0.5", "*", "sum", "(", "weights", ")", "if", "any", "(", "[", "j", ">", "midpo...
Calculate the weighted median of a list.
[ "Calculate", "the", "weighted", "median", "of", "a", "list", "." ]
0e2638099dba7f288a1553a83e957a95522229da
https://github.com/tinybike/weightedstats/blob/0e2638099dba7f288a1553a83e957a95522229da/weightedstats/__init__.py#L69-L87
train
Calculate the weighted median of a list.
tinybike/weightedstats
weightedstats/__init__.py
numpy_weighted_median
def numpy_weighted_median(data, weights=None): """Calculate the weighted median of an array/list using numpy.""" import numpy as np if weights is None: return np.median(np.array(data).flatten()) data, weights = np.array(data).flatten(), np.array(weights).flatten() if any(weights > 0): ...
python
def numpy_weighted_median(data, weights=None): """Calculate the weighted median of an array/list using numpy.""" import numpy as np if weights is None: return np.median(np.array(data).flatten()) data, weights = np.array(data).flatten(), np.array(weights).flatten() if any(weights > 0): ...
[ "def", "numpy_weighted_median", "(", "data", ",", "weights", "=", "None", ")", ":", "import", "numpy", "as", "np", "if", "weights", "is", "None", ":", "return", "np", ".", "median", "(", "np", ".", "array", "(", "data", ")", ".", "flatten", "(", ")",...
Calculate the weighted median of an array/list using numpy.
[ "Calculate", "the", "weighted", "median", "of", "an", "array", "/", "list", "using", "numpy", "." ]
0e2638099dba7f288a1553a83e957a95522229da
https://github.com/tinybike/weightedstats/blob/0e2638099dba7f288a1553a83e957a95522229da/weightedstats/__init__.py#L89-L104
train
Calculate the weighted median of an array or list using numpy.
Robpol86/Flask-Redis-Helper
flask_redis.py
parse_url
def parse_url(url): """Parses the supplied Redis URL and returns a dict with the parsed/split data. For ambiguous URLs like redis://localhost and redis://my_socket_file this function will prioritize network URLs over socket URLs. redis://my_socket_file will be interpreted as a network URL, with the Redis s...
python
def parse_url(url): """Parses the supplied Redis URL and returns a dict with the parsed/split data. For ambiguous URLs like redis://localhost and redis://my_socket_file this function will prioritize network URLs over socket URLs. redis://my_socket_file will be interpreted as a network URL, with the Redis s...
[ "def", "parse_url", "(", "url", ")", ":", "# Parse URL, make sure string is valid.", "try", ":", "split", "=", "urlsplit", "(", "url", ".", "rstrip", "(", "'/'", ")", ")", "except", "(", "AttributeError", ",", "TypeError", ")", "as", "e", ":", "raise", "Va...
Parses the supplied Redis URL and returns a dict with the parsed/split data. For ambiguous URLs like redis://localhost and redis://my_socket_file this function will prioritize network URLs over socket URLs. redis://my_socket_file will be interpreted as a network URL, with the Redis server having a hostname of ...
[ "Parses", "the", "supplied", "Redis", "URL", "and", "returns", "a", "dict", "with", "the", "parsed", "/", "split", "data", "." ]
5708b1287274ab5f09a57bba25b6f1e79cea9148
https://github.com/Robpol86/Flask-Redis-Helper/blob/5708b1287274ab5f09a57bba25b6f1e79cea9148/flask_redis.py#L21-L99
train
Parses a Redis URL and returns a dictionary with the parsed and split data.
Robpol86/Flask-Redis-Helper
flask_redis.py
read_config
def read_config(config, prefix): """Return a StrictRedis.__init__() compatible dictionary from data in the Flask config. Generate a dictionary compatible with StrictRedis.__init__() keyword arguments from data in the Flask application's configuration values relevant to Redis. This is where REDIS_URL (...
python
def read_config(config, prefix): """Return a StrictRedis.__init__() compatible dictionary from data in the Flask config. Generate a dictionary compatible with StrictRedis.__init__() keyword arguments from data in the Flask application's configuration values relevant to Redis. This is where REDIS_URL (...
[ "def", "read_config", "(", "config", ",", "prefix", ")", ":", "# Get all relevant config values from Flask application.", "suffixes", "=", "(", "'URL'", ",", "'SOCKET'", ",", "'HOST'", ",", "'PORT'", ",", "'PASSWORD'", ",", "'DB'", ")", "config_url", ",", "config_...
Return a StrictRedis.__init__() compatible dictionary from data in the Flask config. Generate a dictionary compatible with StrictRedis.__init__() keyword arguments from data in the Flask application's configuration values relevant to Redis. This is where REDIS_URL (or whatever prefix used) is parsed, by c...
[ "Return", "a", "StrictRedis", ".", "__init__", "()", "compatible", "dictionary", "from", "data", "in", "the", "Flask", "config", "." ]
5708b1287274ab5f09a57bba25b6f1e79cea9148
https://github.com/Robpol86/Flask-Redis-Helper/blob/5708b1287274ab5f09a57bba25b6f1e79cea9148/flask_redis.py#L102-L138
train
Return a dictionary compatible with StrictRedis.
Robpol86/Flask-Redis-Helper
flask_redis.py
Redis.init_app
def init_app(self, app, config_prefix=None): """Actual method to read Redis settings from app configuration and initialize the StrictRedis instance. Positional arguments: app -- Flask application instance. config_prefix -- Prefix used in config key names in the Flask app's configuration...
python
def init_app(self, app, config_prefix=None): """Actual method to read Redis settings from app configuration and initialize the StrictRedis instance. Positional arguments: app -- Flask application instance. config_prefix -- Prefix used in config key names in the Flask app's configuration...
[ "def", "init_app", "(", "self", ",", "app", ",", "config_prefix", "=", "None", ")", ":", "# Normalize the prefix and add this instance to app.extensions.", "config_prefix", "=", "(", "config_prefix", "or", "'REDIS'", ")", ".", "rstrip", "(", "'_'", ")", ".", "uppe...
Actual method to read Redis settings from app configuration and initialize the StrictRedis instance. Positional arguments: app -- Flask application instance. config_prefix -- Prefix used in config key names in the Flask app's configuration. Useful for applications which interface wi...
[ "Actual", "method", "to", "read", "Redis", "settings", "from", "app", "configuration", "and", "initialize", "the", "StrictRedis", "instance", "." ]
5708b1287274ab5f09a57bba25b6f1e79cea9148
https://github.com/Robpol86/Flask-Redis-Helper/blob/5708b1287274ab5f09a57bba25b6f1e79cea9148/flask_redis.py#L187-L211
train
Initializes the StrictRedis instance with the settings from the Flask application configuration and initializes the StrictRedis instance.
Julian/Filesystems
filesystems/common.py
_realpath
def _realpath(fs, path, seen=pset()): """ .. warning:: The ``os.path`` module's realpath does not error or warn about loops, but we do, following the behavior of GNU ``realpath(1)``! """ real = Path.root() for segment in path.segments: current = real / segment seen ...
python
def _realpath(fs, path, seen=pset()): """ .. warning:: The ``os.path`` module's realpath does not error or warn about loops, but we do, following the behavior of GNU ``realpath(1)``! """ real = Path.root() for segment in path.segments: current = real / segment seen ...
[ "def", "_realpath", "(", "fs", ",", "path", ",", "seen", "=", "pset", "(", ")", ")", ":", "real", "=", "Path", ".", "root", "(", ")", "for", "segment", "in", "path", ".", "segments", ":", "current", "=", "real", "/", "segment", "seen", "=", "seen...
.. warning:: The ``os.path`` module's realpath does not error or warn about loops, but we do, following the behavior of GNU ``realpath(1)``!
[ "..", "warning", "::" ]
f366e877d6970712bb91d47167209ee2d1e489c5
https://github.com/Julian/Filesystems/blob/f366e877d6970712bb91d47167209ee2d1e489c5/filesystems/common.py#L11-L34
train
Return the real path of the path.
Julian/Filesystems
filesystems/common.py
_recursive_remove
def _recursive_remove(fs, path): """ A recursive, non-atomic directory removal. """ if not fs.is_link(path=path) and fs.is_dir(path=path): for child in fs.children(path=path): _recursive_remove(fs=fs, path=child) fs.remove_empty_directory(path=path) else: fs.remov...
python
def _recursive_remove(fs, path): """ A recursive, non-atomic directory removal. """ if not fs.is_link(path=path) and fs.is_dir(path=path): for child in fs.children(path=path): _recursive_remove(fs=fs, path=child) fs.remove_empty_directory(path=path) else: fs.remov...
[ "def", "_recursive_remove", "(", "fs", ",", "path", ")", ":", "if", "not", "fs", ".", "is_link", "(", "path", "=", "path", ")", "and", "fs", ".", "is_dir", "(", "path", "=", "path", ")", ":", "for", "child", "in", "fs", ".", "children", "(", "pat...
A recursive, non-atomic directory removal.
[ "A", "recursive", "non", "-", "atomic", "directory", "removal", "." ]
f366e877d6970712bb91d47167209ee2d1e489c5
https://github.com/Julian/Filesystems/blob/f366e877d6970712bb91d47167209ee2d1e489c5/filesystems/common.py#L37-L46
train
A recursive directory removal.
Julian/Filesystems
filesystems/common.py
create
def create( name, create_file, open_file, remove_file, create_directory, list_directory, remove_empty_directory, temporary_directory, stat, lstat, link, readlink, realpath=_realpath, remove=_recursive_remove, ): """ Create a new kind of filesystem. ...
python
def create( name, create_file, open_file, remove_file, create_directory, list_directory, remove_empty_directory, temporary_directory, stat, lstat, link, readlink, realpath=_realpath, remove=_recursive_remove, ): """ Create a new kind of filesystem. ...
[ "def", "create", "(", "name", ",", "create_file", ",", "open_file", ",", "remove_file", ",", "create_directory", ",", "list_directory", ",", "remove_empty_directory", ",", "temporary_directory", ",", "stat", ",", "lstat", ",", "link", ",", "readlink", ",", "real...
Create a new kind of filesystem.
[ "Create", "a", "new", "kind", "of", "filesystem", "." ]
f366e877d6970712bb91d47167209ee2d1e489c5
https://github.com/Julian/Filesystems/blob/f366e877d6970712bb91d47167209ee2d1e489c5/filesystems/common.py#L49-L110
train
Create a new kind of filesystem.
Julian/Filesystems
filesystems/common.py
_exists
def _exists(fs, path): """ Check that the given path exists on the filesystem. Note that unlike `os.path.exists`, we *do* propagate file system errors other than a non-existent path or non-existent directory component. E.g., should EPERM or ELOOP be raised, an exception will bubble up. """ ...
python
def _exists(fs, path): """ Check that the given path exists on the filesystem. Note that unlike `os.path.exists`, we *do* propagate file system errors other than a non-existent path or non-existent directory component. E.g., should EPERM or ELOOP be raised, an exception will bubble up. """ ...
[ "def", "_exists", "(", "fs", ",", "path", ")", ":", "try", ":", "fs", ".", "stat", "(", "path", ")", "except", "(", "exceptions", ".", "FileNotFound", ",", "exceptions", ".", "NotADirectory", ")", ":", "return", "False", "return", "True" ]
Check that the given path exists on the filesystem. Note that unlike `os.path.exists`, we *do* propagate file system errors other than a non-existent path or non-existent directory component. E.g., should EPERM or ELOOP be raised, an exception will bubble up.
[ "Check", "that", "the", "given", "path", "exists", "on", "the", "filesystem", "." ]
f366e877d6970712bb91d47167209ee2d1e489c5
https://github.com/Julian/Filesystems/blob/f366e877d6970712bb91d47167209ee2d1e489c5/filesystems/common.py#L157-L170
train
Check that the given path exists on the filesystem.
Julian/Filesystems
filesystems/common.py
_is_dir
def _is_dir(fs, path): """ Check that the given path is a directory. Note that unlike `os.path.isdir`, we *do* propagate file system errors other than a non-existent path or non-existent directory component. E.g., should EPERM or ELOOP be raised, an exception will bubble up. """ try: ...
python
def _is_dir(fs, path): """ Check that the given path is a directory. Note that unlike `os.path.isdir`, we *do* propagate file system errors other than a non-existent path or non-existent directory component. E.g., should EPERM or ELOOP be raised, an exception will bubble up. """ try: ...
[ "def", "_is_dir", "(", "fs", ",", "path", ")", ":", "try", ":", "return", "stat", ".", "S_ISDIR", "(", "fs", ".", "stat", "(", "path", ")", ".", "st_mode", ")", "except", "exceptions", ".", "FileNotFound", ":", "return", "False" ]
Check that the given path is a directory. Note that unlike `os.path.isdir`, we *do* propagate file system errors other than a non-existent path or non-existent directory component. E.g., should EPERM or ELOOP be raised, an exception will bubble up.
[ "Check", "that", "the", "given", "path", "is", "a", "directory", "." ]
f366e877d6970712bb91d47167209ee2d1e489c5
https://github.com/Julian/Filesystems/blob/f366e877d6970712bb91d47167209ee2d1e489c5/filesystems/common.py#L173-L186
train
Check that the given path is a directory.
Julian/Filesystems
filesystems/common.py
_is_file
def _is_file(fs, path): """ Check that the given path is a file. Note that unlike `os.path.isfile`, we *do* propagate file system errors other than a non-existent path or non-existent directory component. E.g., should EPERM or ELOOP be raised, an exception will bubble up. """ try: ...
python
def _is_file(fs, path): """ Check that the given path is a file. Note that unlike `os.path.isfile`, we *do* propagate file system errors other than a non-existent path or non-existent directory component. E.g., should EPERM or ELOOP be raised, an exception will bubble up. """ try: ...
[ "def", "_is_file", "(", "fs", ",", "path", ")", ":", "try", ":", "return", "stat", ".", "S_ISREG", "(", "fs", ".", "stat", "(", "path", ")", ".", "st_mode", ")", "except", "exceptions", ".", "FileNotFound", ":", "return", "False" ]
Check that the given path is a file. Note that unlike `os.path.isfile`, we *do* propagate file system errors other than a non-existent path or non-existent directory component. E.g., should EPERM or ELOOP be raised, an exception will bubble up.
[ "Check", "that", "the", "given", "path", "is", "a", "file", "." ]
f366e877d6970712bb91d47167209ee2d1e489c5
https://github.com/Julian/Filesystems/blob/f366e877d6970712bb91d47167209ee2d1e489c5/filesystems/common.py#L189-L201
train
Check that the given path is a file.
Julian/Filesystems
filesystems/common.py
_is_link
def _is_link(fs, path): """ Check that the given path is a symbolic link. Note that unlike `os.path.islink`, we *do* propagate file system errors other than a non-existent path or non-existent directory component. E.g., should EPERM or ELOOP be raised, an exception will bubble up. """ try...
python
def _is_link(fs, path): """ Check that the given path is a symbolic link. Note that unlike `os.path.islink`, we *do* propagate file system errors other than a non-existent path or non-existent directory component. E.g., should EPERM or ELOOP be raised, an exception will bubble up. """ try...
[ "def", "_is_link", "(", "fs", ",", "path", ")", ":", "try", ":", "return", "stat", ".", "S_ISLNK", "(", "fs", ".", "lstat", "(", "path", ")", ".", "st_mode", ")", "except", "exceptions", ".", "FileNotFound", ":", "return", "False" ]
Check that the given path is a symbolic link. Note that unlike `os.path.islink`, we *do* propagate file system errors other than a non-existent path or non-existent directory component. E.g., should EPERM or ELOOP be raised, an exception will bubble up.
[ "Check", "that", "the", "given", "path", "is", "a", "symbolic", "link", "." ]
f366e877d6970712bb91d47167209ee2d1e489c5
https://github.com/Julian/Filesystems/blob/f366e877d6970712bb91d47167209ee2d1e489c5/filesystems/common.py#L204-L217
train
Check that the given path is a symbolic link.
rycus86/ghost-client
ghost_client/models.py
ModelList.get_page
def get_page(self, page_number): """ :param page_number: The page number to fetch (1-indexed) :return: The requested page fetched from the API for the query """ if page_number: kwargs = dict(self._list_kwargs) kwargs['limit'] = self.limit kwar...
python
def get_page(self, page_number): """ :param page_number: The page number to fetch (1-indexed) :return: The requested page fetched from the API for the query """ if page_number: kwargs = dict(self._list_kwargs) kwargs['limit'] = self.limit kwar...
[ "def", "get_page", "(", "self", ",", "page_number", ")", ":", "if", "page_number", ":", "kwargs", "=", "dict", "(", "self", ".", "_list_kwargs", ")", "kwargs", "[", "'limit'", "]", "=", "self", ".", "limit", "kwargs", "[", "'page'", "]", "=", "page_num...
:param page_number: The page number to fetch (1-indexed) :return: The requested page fetched from the API for the query
[ ":", "param", "page_number", ":", "The", "page", "number", "to", "fetch", "(", "1", "-", "indexed", ")", ":", "return", ":", "The", "requested", "page", "fetched", "from", "the", "API", "for", "the", "query" ]
863d332801d2c1b8e7ad4573c7b16db78a7f8c8d
https://github.com/rycus86/ghost-client/blob/863d332801d2c1b8e7ad4573c7b16db78a7f8c8d/ghost_client/models.py#L109-L120
train
Retrieves a single page of items from the API.
rycus86/ghost-client
ghost_client/models.py
Controller.list
def list(self, **kwargs): """ Fetch a list of resources from the API. :param kwargs: Parameters for the request (see from and below https://api.ghost.org/docs/limit) :return: The list of items returned by the API wrapped as `Model` objects with pagination by `Mod...
python
def list(self, **kwargs): """ Fetch a list of resources from the API. :param kwargs: Parameters for the request (see from and below https://api.ghost.org/docs/limit) :return: The list of items returned by the API wrapped as `Model` objects with pagination by `Mod...
[ "def", "list", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "ModelList", "(", "self", ".", "ghost", ".", "execute_get", "(", "'%s/'", "%", "self", ".", "_type_name", ",", "*", "*", "kwargs", ")", ",", "self", ".", "_type_name", ",", "s...
Fetch a list of resources from the API. :param kwargs: Parameters for the request (see from and below https://api.ghost.org/docs/limit) :return: The list of items returned by the API wrapped as `Model` objects with pagination by `ModelList`
[ "Fetch", "a", "list", "of", "resources", "from", "the", "API", "." ]
863d332801d2c1b8e7ad4573c7b16db78a7f8c8d
https://github.com/rycus86/ghost-client/blob/863d332801d2c1b8e7ad4573c7b16db78a7f8c8d/ghost_client/models.py#L141-L154
train
Fetch a list of resources from the API.
rycus86/ghost-client
ghost_client/models.py
Controller.get
def get(self, id=None, slug=None, **kwargs): """ Fetch a resource from the API. Either the `id` or the `slug` has to be present. :param id: The ID of the resource :param slug: The slug of the resource :param kwargs: Parameters for the request (see from and be...
python
def get(self, id=None, slug=None, **kwargs): """ Fetch a resource from the API. Either the `id` or the `slug` has to be present. :param id: The ID of the resource :param slug: The slug of the resource :param kwargs: Parameters for the request (see from and be...
[ "def", "get", "(", "self", ",", "id", "=", "None", ",", "slug", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "id", ":", "items", "=", "self", ".", "ghost", ".", "execute_get", "(", "'%s/%s/'", "%", "(", "self", ".", "_type_name", ",", ...
Fetch a resource from the API. Either the `id` or the `slug` has to be present. :param id: The ID of the resource :param slug: The slug of the resource :param kwargs: Parameters for the request (see from and below https://api.ghost.org/docs/limit) :return: The item r...
[ "Fetch", "a", "resource", "from", "the", "API", ".", "Either", "the", "id", "or", "the", "slug", "has", "to", "be", "present", "." ]
863d332801d2c1b8e7ad4573c7b16db78a7f8c8d
https://github.com/rycus86/ghost-client/blob/863d332801d2c1b8e7ad4573c7b16db78a7f8c8d/ghost_client/models.py#L156-L180
train
Fetch a resource from the API. Either the id or the slug has to be specified.
rycus86/ghost-client
ghost_client/models.py
Controller.create
def create(self, **kwargs): """ Creates a new resource. :param kwargs: The properties of the resource :return: The created item returned by the API wrapped as a `Model` object """ response = self.ghost.execute_post('%s/' % self._type_name, json={ ...
python
def create(self, **kwargs): """ Creates a new resource. :param kwargs: The properties of the resource :return: The created item returned by the API wrapped as a `Model` object """ response = self.ghost.execute_post('%s/' % self._type_name, json={ ...
[ "def", "create", "(", "self", ",", "*", "*", "kwargs", ")", ":", "response", "=", "self", ".", "ghost", ".", "execute_post", "(", "'%s/'", "%", "self", ".", "_type_name", ",", "json", "=", "{", "self", ".", "_type_name", ":", "[", "kwargs", "]", "}...
Creates a new resource. :param kwargs: The properties of the resource :return: The created item returned by the API wrapped as a `Model` object
[ "Creates", "a", "new", "resource", "." ]
863d332801d2c1b8e7ad4573c7b16db78a7f8c8d
https://github.com/rycus86/ghost-client/blob/863d332801d2c1b8e7ad4573c7b16db78a7f8c8d/ghost_client/models.py#L182-L197
train
Creates a new resource.
rycus86/ghost-client
ghost_client/models.py
Controller.update
def update(self, id, **kwargs): """ Updates an existing resource. :param id: The ID of the resource :param kwargs: The properties of the resource to change :return: The updated item returned by the API wrapped as a `Model` object """ response = self....
python
def update(self, id, **kwargs): """ Updates an existing resource. :param id: The ID of the resource :param kwargs: The properties of the resource to change :return: The updated item returned by the API wrapped as a `Model` object """ response = self....
[ "def", "update", "(", "self", ",", "id", ",", "*", "*", "kwargs", ")", ":", "response", "=", "self", ".", "ghost", ".", "execute_put", "(", "'%s/%s/'", "%", "(", "self", ".", "_type_name", ",", "id", ")", ",", "json", "=", "{", "self", ".", "_typ...
Updates an existing resource. :param id: The ID of the resource :param kwargs: The properties of the resource to change :return: The updated item returned by the API wrapped as a `Model` object
[ "Updates", "an", "existing", "resource", "." ]
863d332801d2c1b8e7ad4573c7b16db78a7f8c8d
https://github.com/rycus86/ghost-client/blob/863d332801d2c1b8e7ad4573c7b16db78a7f8c8d/ghost_client/models.py#L199-L215
train
Updates an existing resource.
rycus86/ghost-client
ghost_client/models.py
PostController.create
def create(self, **kwargs): """ Creates a new post. When the `markdown` property is present, it will be automatically converted to `mobiledoc` on v1.+ of the server. :param kwargs: The properties of the post :return: The created `Post` object """ return ...
python
def create(self, **kwargs): """ Creates a new post. When the `markdown` property is present, it will be automatically converted to `mobiledoc` on v1.+ of the server. :param kwargs: The properties of the post :return: The created `Post` object """ return ...
[ "def", "create", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "PostController", ",", "self", ")", ".", "create", "(", "*", "*", "self", ".", "_with_markdown", "(", "kwargs", ")", ")" ]
Creates a new post. When the `markdown` property is present, it will be automatically converted to `mobiledoc` on v1.+ of the server. :param kwargs: The properties of the post :return: The created `Post` object
[ "Creates", "a", "new", "post", ".", "When", "the", "markdown", "property", "is", "present", "it", "will", "be", "automatically", "converted", "to", "mobiledoc", "on", "v1", ".", "+", "of", "the", "server", "." ]
863d332801d2c1b8e7ad4573c7b16db78a7f8c8d
https://github.com/rycus86/ghost-client/blob/863d332801d2c1b8e7ad4573c7b16db78a7f8c8d/ghost_client/models.py#L242-L252
train
Creates a new post object with the specified properties.
rycus86/ghost-client
ghost_client/models.py
PostController.update
def update(self, id, **kwargs): """ Updates an existing post. When the `markdown` property is present, it will be automatically converted to `mobiledoc` on v1.+ of the server. :param id: The ID of the existing post :param kwargs: The properties of the post to change ...
python
def update(self, id, **kwargs): """ Updates an existing post. When the `markdown` property is present, it will be automatically converted to `mobiledoc` on v1.+ of the server. :param id: The ID of the existing post :param kwargs: The properties of the post to change ...
[ "def", "update", "(", "self", ",", "id", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "PostController", ",", "self", ")", ".", "update", "(", "id", ",", "*", "*", "self", ".", "_with_markdown", "(", "kwargs", ")", ")" ]
Updates an existing post. When the `markdown` property is present, it will be automatically converted to `mobiledoc` on v1.+ of the server. :param id: The ID of the existing post :param kwargs: The properties of the post to change :return: The updated `Post` object
[ "Updates", "an", "existing", "post", ".", "When", "the", "markdown", "property", "is", "present", "it", "will", "be", "automatically", "converted", "to", "mobiledoc", "on", "v1", ".", "+", "of", "the", "server", "." ]
863d332801d2c1b8e7ad4573c7b16db78a7f8c8d
https://github.com/rycus86/ghost-client/blob/863d332801d2c1b8e7ad4573c7b16db78a7f8c8d/ghost_client/models.py#L254-L265
train
Updates an existing post.
ldomic/lintools
lintools/analysis/residence_time.py
Residence_time.measure_residence_time
def measure_residence_time(self, cutoff = 3.5): """ This function measures the residence time of all residues within the cutoff distance from the ligand. Takes: * cutoff * - cutoff distance in angstroms Output: * self.residue_counts * - dictionary of all r...
python
def measure_residence_time(self, cutoff = 3.5): """ This function measures the residence time of all residues within the cutoff distance from the ligand. Takes: * cutoff * - cutoff distance in angstroms Output: * self.residue_counts * - dictionary of all r...
[ "def", "measure_residence_time", "(", "self", ",", "cutoff", "=", "3.5", ")", ":", "i", "=", "0", "data", "=", "namedtuple", "(", "\"contacts\"", ",", "\"frame time ligandatomname ligandatomindex cutoff proteinatomname proteinatomindex resname resid segid\"", ")", "for", ...
This function measures the residence time of all residues within the cutoff distance from the ligand. Takes: * cutoff * - cutoff distance in angstroms Output: * self.residue_counts * - dictionary of all residues that have made contact with the ligand (i.e. hav...
[ "This", "function", "measures", "the", "residence", "time", "of", "all", "residues", "within", "the", "cutoff", "distance", "from", "the", "ligand", ".", "Takes", ":", "*", "cutoff", "*", "-", "cutoff", "distance", "in", "angstroms", "Output", ":", "*", "s...
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/residence_time.py#L53-L91
train
This function measures the residence time of all residues in the ligand.
ldomic/lintools
lintools/analysis/residence_time.py
Residence_time.define_residues_for_plotting_traj
def define_residues_for_plotting_traj(self, analysis_cutoff): """ Since plotting all residues that have made contact with the ligand over a lenghty simulation is not always feasible or desirable. Therefore, only the residues that have been in contact with ligand for a long amount of time...
python
def define_residues_for_plotting_traj(self, analysis_cutoff): """ Since plotting all residues that have made contact with the ligand over a lenghty simulation is not always feasible or desirable. Therefore, only the residues that have been in contact with ligand for a long amount of time...
[ "def", "define_residues_for_plotting_traj", "(", "self", ",", "analysis_cutoff", ")", ":", "self", ".", "residue_counts_fraction", "=", "{", "}", "#Calculate the fraction of time a residue spends in each simulation", "for", "traj", "in", "self", ".", "residue_counts", ":", ...
Since plotting all residues that have made contact with the ligand over a lenghty simulation is not always feasible or desirable. Therefore, only the residues that have been in contact with ligand for a long amount of time will be plotted in the final image. The function first determine...
[ "Since", "plotting", "all", "residues", "that", "have", "made", "contact", "with", "the", "ligand", "over", "a", "lenghty", "simulation", "is", "not", "always", "feasible", "or", "desirable", ".", "Therefore", "only", "the", "residues", "that", "have", "been",...
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/residence_time.py#L93-L125
train
This function defines the residues that have made contact with the ligand over a lenghty ligand and the simulation is not always feasible or desirable. This function calculates the fraction of time each residue spends in each simulation and plots the residues that have made contact with the ligand over a long amount of...
ldomic/lintools
lintools/analysis/residence_time.py
Residence_time.make_table
def make_table(self): """Make numpy array from timeseries data.""" num_records = np.sum([1 for frame in self.timeseries]) dtype = [("frame",float),("time",float),("ligand atom id",int), ("ligand atom name","|U4"),("cutoff",float), ("protein atom names",list),("pro...
python
def make_table(self): """Make numpy array from timeseries data.""" num_records = np.sum([1 for frame in self.timeseries]) dtype = [("frame",float),("time",float),("ligand atom id",int), ("ligand atom name","|U4"),("cutoff",float), ("protein atom names",list),("pro...
[ "def", "make_table", "(", "self", ")", ":", "num_records", "=", "np", ".", "sum", "(", "[", "1", "for", "frame", "in", "self", ".", "timeseries", "]", ")", "dtype", "=", "[", "(", "\"frame\"", ",", "float", ")", ",", "(", "\"time\"", ",", "float", ...
Make numpy array from timeseries data.
[ "Make", "numpy", "array", "from", "timeseries", "data", "." ]
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/residence_time.py#L127-L140
train
Make numpy array from timeseries data.
ldomic/lintools
lintools/analysis/pistacking.py
PiStacking.detect_aromatic_rings_in_ligand
def detect_aromatic_rings_in_ligand(self): """Using rdkit to detect aromatic rings in ligand - size 4-6 atoms and all atoms are part of the ring. Saves this data in self.ligrings.""" self.ligrings = {} try: ring_info = self.topology_data.mol.GetRingInfo() self.ligand_ring...
python
def detect_aromatic_rings_in_ligand(self): """Using rdkit to detect aromatic rings in ligand - size 4-6 atoms and all atoms are part of the ring. Saves this data in self.ligrings.""" self.ligrings = {} try: ring_info = self.topology_data.mol.GetRingInfo() self.ligand_ring...
[ "def", "detect_aromatic_rings_in_ligand", "(", "self", ")", ":", "self", ".", "ligrings", "=", "{", "}", "try", ":", "ring_info", "=", "self", ".", "topology_data", ".", "mol", ".", "GetRingInfo", "(", ")", "self", ".", "ligand_ring_num", "=", "ring_info", ...
Using rdkit to detect aromatic rings in ligand - size 4-6 atoms and all atoms are part of the ring. Saves this data in self.ligrings.
[ "Using", "rdkit", "to", "detect", "aromatic", "rings", "in", "ligand", "-", "size", "4", "-", "6", "atoms", "and", "all", "atoms", "are", "part", "of", "the", "ring", ".", "Saves", "this", "data", "in", "self", ".", "ligrings", "." ]
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/pistacking.py#L69-L86
train
Detects aromatic rings in ligand - size 4 - 6 atoms and all atoms are part of the ring. Saves self. aromatic_rings self. ligand_ring_num.
ldomic/lintools
lintools/analysis/pistacking.py
PiStacking.detect_aromatic_rings_in_protein
def detect_aromatic_rings_in_protein(self): """Use rdkit to detect aromatic rings in protein. A (relatively) simpler case, since only 4 of 20 aa have rings. Since different forcefields can have different atom names, each of 4 aromatic residues is extracted as PDB file and the aromatic rings are ...
python
def detect_aromatic_rings_in_protein(self): """Use rdkit to detect aromatic rings in protein. A (relatively) simpler case, since only 4 of 20 aa have rings. Since different forcefields can have different atom names, each of 4 aromatic residues is extracted as PDB file and the aromatic rings are ...
[ "def", "detect_aromatic_rings_in_protein", "(", "self", ")", ":", "self", ".", "rings", "=", "{", "}", "for", "ar_resname", "in", "[", "\"PHE\"", ",", "\"TRP\"", ",", "\"TYR\"", ",", "\"HIS\"", "]", ":", "for", "res", "in", "self", ".", "topology_data", ...
Use rdkit to detect aromatic rings in protein. A (relatively) simpler case, since only 4 of 20 aa have rings. Since different forcefields can have different atom names, each of 4 aromatic residues is extracted as PDB file and the aromatic rings are detected for each. The case is trickier with TRP, since...
[ "Use", "rdkit", "to", "detect", "aromatic", "rings", "in", "protein", ".", "A", "(", "relatively", ")", "simpler", "case", "since", "only", "4", "of", "20", "aa", "have", "rings", ".", "Since", "different", "forcefields", "can", "have", "different", "atom"...
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/pistacking.py#L88-L113
train
Use rdkit to detect aromatic rings in protein.
ldomic/lintools
lintools/analysis/pistacking.py
PiStacking.find_all_pistacking_pairs
def find_all_pistacking_pairs(self): """Main analysis function. Analyses each frame in the trajectory in search for pi-pi interactions between previously defined rings on protein residues and ligand molecule. """ data = namedtuple("pistacking","frame time proteinring ligandring distance angle of...
python
def find_all_pistacking_pairs(self): """Main analysis function. Analyses each frame in the trajectory in search for pi-pi interactions between previously defined rings on protein residues and ligand molecule. """ data = namedtuple("pistacking","frame time proteinring ligandring distance angle of...
[ "def", "find_all_pistacking_pairs", "(", "self", ")", ":", "data", "=", "namedtuple", "(", "\"pistacking\"", ",", "\"frame time proteinring ligandring distance angle offset type resname resid segid\"", ")", "i", "=", "0", "if", "self", ".", "trajectory", "==", "[", "]",...
Main analysis function. Analyses each frame in the trajectory in search for pi-pi interactions between previously defined rings on protein residues and ligand molecule.
[ "Main", "analysis", "function", ".", "Analyses", "each", "frame", "in", "the", "trajectory", "in", "search", "for", "pi", "-", "pi", "interactions", "between", "previously", "defined", "rings", "on", "protein", "residues", "and", "ligand", "molecule", "." ]
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/pistacking.py#L133-L184
train
This function is called by the analysis function. It finds all pi - pi interactions between previously defined rings and ligand rings.
ldomic/lintools
lintools/analysis/pistacking.py
PiStacking.make_table
def make_table(self): """Make numpy array from timeseries data.""" num_records = int(np.sum([1 for frame in self.timeseries])) dtype = [ ("frame",float),("time",float),("proteinring",list), ("ligand_ring_ids",list),("distance",float),("angle",float), ...
python
def make_table(self): """Make numpy array from timeseries data.""" num_records = int(np.sum([1 for frame in self.timeseries])) dtype = [ ("frame",float),("time",float),("proteinring",list), ("ligand_ring_ids",list),("distance",float),("angle",float), ...
[ "def", "make_table", "(", "self", ")", ":", "num_records", "=", "int", "(", "np", ".", "sum", "(", "[", "1", "for", "frame", "in", "self", ".", "timeseries", "]", ")", ")", "dtype", "=", "[", "(", "\"frame\"", ",", "float", ")", ",", "(", "\"time...
Make numpy array from timeseries data.
[ "Make", "numpy", "array", "from", "timeseries", "data", "." ]
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/pistacking.py#L186-L198
train
Make numpy array from timeseries data.
ldomic/lintools
lintools/analysis/pistacking.py
PiStacking.count_by_type
def count_by_type(self): """Count how many times each individual pi-pi interaction occured throughout the simulation. Returns numpy array.""" pistack = defaultdict(int) for contact in self.timeseries: #count by residue name not by proteinring pkey = (contact.ligan...
python
def count_by_type(self): """Count how many times each individual pi-pi interaction occured throughout the simulation. Returns numpy array.""" pistack = defaultdict(int) for contact in self.timeseries: #count by residue name not by proteinring pkey = (contact.ligan...
[ "def", "count_by_type", "(", "self", ")", ":", "pistack", "=", "defaultdict", "(", "int", ")", "for", "contact", "in", "self", ".", "timeseries", ":", "#count by residue name not by proteinring", "pkey", "=", "(", "contact", ".", "ligandring", ",", "contact", ...
Count how many times each individual pi-pi interaction occured throughout the simulation. Returns numpy array.
[ "Count", "how", "many", "times", "each", "individual", "pi", "-", "pi", "interaction", "occured", "throughout", "the", "simulation", ".", "Returns", "numpy", "array", "." ]
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/pistacking.py#L209-L222
train
Count how many times each individual pi - pi interaction occured throughout the simulation.
ldomic/lintools
lintools/analysis/pistacking.py
PiStacking.get_ligand_ring_selection
def get_ligand_ring_selection(self,ring): """MDAnalysis atom selections of aromatic rings present in the ligand molecule. Takes: * ring * - index in self.ligrings dictionary Output: * ring_selection * - MDAnalysis Atom group""" ring_names = "" for atom in ...
python
def get_ligand_ring_selection(self,ring): """MDAnalysis atom selections of aromatic rings present in the ligand molecule. Takes: * ring * - index in self.ligrings dictionary Output: * ring_selection * - MDAnalysis Atom group""" ring_names = "" for atom in ...
[ "def", "get_ligand_ring_selection", "(", "self", ",", "ring", ")", ":", "ring_names", "=", "\"\"", "for", "atom", "in", "self", ".", "ligrings", "[", "ring", "]", ":", "ring_names", "=", "ring_names", "+", "\" \"", "+", "str", "(", "atom", ")", "ring_sel...
MDAnalysis atom selections of aromatic rings present in the ligand molecule. Takes: * ring * - index in self.ligrings dictionary Output: * ring_selection * - MDAnalysis Atom group
[ "MDAnalysis", "atom", "selections", "of", "aromatic", "rings", "present", "in", "the", "ligand", "molecule", ".", "Takes", ":", "*", "ring", "*", "-", "index", "in", "self", ".", "ligrings", "dictionary", "Output", ":", "*", "ring_selection", "*", "-", "MD...
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/pistacking.py#L224-L234
train
Returns the atom selections of aromatic rings present in the ligand molecule.
ldomic/lintools
lintools/analysis/pistacking.py
PiStacking.get_pistacking_frequency
def get_pistacking_frequency(self,analysis_cutoff): """Calculates the frequency of pi-pi interactions throughout simulations. If the frequency exceeds the analysis cutoff, this interaction will be plotted in the final figure. Takes: * analysis_cutoff * - fraction of simulation time a...
python
def get_pistacking_frequency(self,analysis_cutoff): """Calculates the frequency of pi-pi interactions throughout simulations. If the frequency exceeds the analysis cutoff, this interaction will be plotted in the final figure. Takes: * analysis_cutoff * - fraction of simulation time a...
[ "def", "get_pistacking_frequency", "(", "self", ",", "analysis_cutoff", ")", ":", "self", ".", "frequency", "=", "defaultdict", "(", "int", ")", "for", "traj", "in", "self", ".", "pistacking_by_type", ":", "for", "contact", "in", "self", ".", "pistacking_by_ty...
Calculates the frequency of pi-pi interactions throughout simulations. If the frequency exceeds the analysis cutoff, this interaction will be plotted in the final figure. Takes: * analysis_cutoff * - fraction of simulation time a feature has to be present for to be plotted Output: ...
[ "Calculates", "the", "frequency", "of", "pi", "-", "pi", "interactions", "throughout", "simulations", ".", "If", "the", "frequency", "exceeds", "the", "analysis", "cutoff", "this", "interaction", "will", "be", "plotted", "in", "the", "final", "figure", ".", "T...
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/pistacking.py#L236-L251
train
Calculates the frequency of pi - pi interactions throughout simulations.
ldomic/lintools
lintools/analysis/pistacking.py
PiStacking.write_output_files
def write_output_files(self,traj): """ The total hydrogen bond count per frame is provided as CSV output file. Each trajectory has a separate file. """ try: os.chdir("analysis") except Exception as e: os.mkdir("analysis") os.chdir("anal...
python
def write_output_files(self,traj): """ The total hydrogen bond count per frame is provided as CSV output file. Each trajectory has a separate file. """ try: os.chdir("analysis") except Exception as e: os.mkdir("analysis") os.chdir("anal...
[ "def", "write_output_files", "(", "self", ",", "traj", ")", ":", "try", ":", "os", ".", "chdir", "(", "\"analysis\"", ")", "except", "Exception", "as", "e", ":", "os", ".", "mkdir", "(", "\"analysis\"", ")", "os", ".", "chdir", "(", "\"analysis\"", ")"...
The total hydrogen bond count per frame is provided as CSV output file. Each trajectory has a separate file.
[ "The", "total", "hydrogen", "bond", "count", "per", "frame", "is", "provided", "as", "CSV", "output", "file", ".", "Each", "trajectory", "has", "a", "separate", "file", "." ]
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/pistacking.py#L253-L276
train
Writes the CSV output files for the trajectory.
yeexiao/boost-py
boost_py/helpers/datetime_helper.py
DateTimeHelper.get_timestamp
def get_timestamp(cls, time_string: str, fmt: str): """ 获得给定的时间字符串,获得相应的时间戳 :param time_string: 时间字符串 :param fmt: :return: """ return int(time.mktime(time.strptime(time_string, fmt)))
python
def get_timestamp(cls, time_string: str, fmt: str): """ 获得给定的时间字符串,获得相应的时间戳 :param time_string: 时间字符串 :param fmt: :return: """ return int(time.mktime(time.strptime(time_string, fmt)))
[ "def", "get_timestamp", "(", "cls", ",", "time_string", ":", "str", ",", "fmt", ":", "str", ")", ":", "return", "int", "(", "time", ".", "mktime", "(", "time", ".", "strptime", "(", "time_string", ",", "fmt", ")", ")", ")" ]
获得给定的时间字符串,获得相应的时间戳 :param time_string: 时间字符串 :param fmt: :return:
[ "获得给定的时间字符串,获得相应的时间戳", ":", "param", "time_string", ":", "时间字符串", ":", "param", "fmt", ":", ":", "return", ":" ]
afc373587ea964efba80feb8a0f0fa93295d878a
https://github.com/yeexiao/boost-py/blob/afc373587ea964efba80feb8a0f0fa93295d878a/boost_py/helpers/datetime_helper.py#L41-L47
train
Get a timestamp from a string.
yeexiao/boost-py
boost_py/helpers/datetime_helper.py
DateTimeHelper.get_formatted_datetime_string
def get_formatted_datetime_string(cls, timestamp: int, fmt="%Y-%m-%d %H:%M:%S"): """ 解析给定的时间戳,获得相应的时间字符串 :param timestamp: :param fmt: :return: """ return time.strftime(fmt, time.localtime(timestamp))
python
def get_formatted_datetime_string(cls, timestamp: int, fmt="%Y-%m-%d %H:%M:%S"): """ 解析给定的时间戳,获得相应的时间字符串 :param timestamp: :param fmt: :return: """ return time.strftime(fmt, time.localtime(timestamp))
[ "def", "get_formatted_datetime_string", "(", "cls", ",", "timestamp", ":", "int", ",", "fmt", "=", "\"%Y-%m-%d %H:%M:%S\"", ")", ":", "return", "time", ".", "strftime", "(", "fmt", ",", "time", ".", "localtime", "(", "timestamp", ")", ")" ]
解析给定的时间戳,获得相应的时间字符串 :param timestamp: :param fmt: :return:
[ "解析给定的时间戳,获得相应的时间字符串", ":", "param", "timestamp", ":", ":", "param", "fmt", ":", ":", "return", ":" ]
afc373587ea964efba80feb8a0f0fa93295d878a
https://github.com/yeexiao/boost-py/blob/afc373587ea964efba80feb8a0f0fa93295d878a/boost_py/helpers/datetime_helper.py#L58-L64
train
Returns a formatted datetime string
robinandeer/puzzle
puzzle/cli/base.py
base
def base(ctx, verbose, config): """Puzzle: manage DNA variant resources.""" # configure root logger to print to STDERR loglevel = LEVELS.get(min(verbose, 3)) configure_stream(level=loglevel) ctx.obj = {} if config and os.path.exists(config): ctx.obj = yaml.load(open(config, 'r')) or {} ...
python
def base(ctx, verbose, config): """Puzzle: manage DNA variant resources.""" # configure root logger to print to STDERR loglevel = LEVELS.get(min(verbose, 3)) configure_stream(level=loglevel) ctx.obj = {} if config and os.path.exists(config): ctx.obj = yaml.load(open(config, 'r')) or {} ...
[ "def", "base", "(", "ctx", ",", "verbose", ",", "config", ")", ":", "# configure root logger to print to STDERR", "loglevel", "=", "LEVELS", ".", "get", "(", "min", "(", "verbose", ",", "3", ")", ")", "configure_stream", "(", "level", "=", "loglevel", ")", ...
Puzzle: manage DNA variant resources.
[ "Puzzle", ":", "manage", "DNA", "variant", "resources", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/cli/base.py#L25-L35
train
Puzzle - base function.
eleme/meepo
examples/repl_db/repl.py
repl_db_sub
def repl_db_sub(master_dsn, slave_dsn, tables): """Database replication subscriber. The function will subscribe to the event sourcing pk stream, retrive rows from master based pk and then update the slave. """ logger = logging.getLogger("meepo.sub.replicate_sub") # sqlalchemy reflection lo...
python
def repl_db_sub(master_dsn, slave_dsn, tables): """Database replication subscriber. The function will subscribe to the event sourcing pk stream, retrive rows from master based pk and then update the slave. """ logger = logging.getLogger("meepo.sub.replicate_sub") # sqlalchemy reflection lo...
[ "def", "repl_db_sub", "(", "master_dsn", ",", "slave_dsn", ",", "tables", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "\"meepo.sub.replicate_sub\"", ")", "# sqlalchemy reflection", "logger", ".", "info", "(", "\"reflecting master database: {}\"", ".", ...
Database replication subscriber. The function will subscribe to the event sourcing pk stream, retrive rows from master based pk and then update the slave.
[ "Database", "replication", "subscriber", "." ]
8212f0fe9b1d44be0c5de72d221a31c1d24bfe7a
https://github.com/eleme/meepo/blob/8212f0fe9b1d44be0c5de72d221a31c1d24bfe7a/examples/repl_db/repl.py#L16-L123
train
This function is used to subscribe to the event sourcing pk stream and update the master table with the new values.
eleme/meepo
examples/repl_db/repl.py
main
def main(master_dsn, slave_dsn, tables, blocking=False): """DB Replication app. This script will replicate data from mysql master to other databases( including mysql, postgres, sqlite). This script only support a very limited replication: 1. data only. The script only replicates data, so you have ...
python
def main(master_dsn, slave_dsn, tables, blocking=False): """DB Replication app. This script will replicate data from mysql master to other databases( including mysql, postgres, sqlite). This script only support a very limited replication: 1. data only. The script only replicates data, so you have ...
[ "def", "main", "(", "master_dsn", ",", "slave_dsn", ",", "tables", ",", "blocking", "=", "False", ")", ":", "# currently only supports mysql master", "assert", "master_dsn", ".", "startswith", "(", "\"mysql\"", ")", "logger", "=", "logging", ".", "getLogger", "(...
DB Replication app. This script will replicate data from mysql master to other databases( including mysql, postgres, sqlite). This script only support a very limited replication: 1. data only. The script only replicates data, so you have to make sure the tables already exists in slave db. 2. ...
[ "DB", "Replication", "app", "." ]
8212f0fe9b1d44be0c5de72d221a31c1d24bfe7a
https://github.com/eleme/meepo/blob/8212f0fe9b1d44be0c5de72d221a31c1d24bfe7a/examples/repl_db/repl.py#L131-L158
train
This script will run as a DB Replication app.
jam31118/vis
vis/layout.py
get_axes_ratio
def get_axes_ratio(ax): """Return height / width ratio of the given Axes object. The ratio is calculated in 'display coordinate', defined in matplotlib document on transformation. Thus, the calculated ratio is what one would feels when the Axes is displayed to the her/him. """ ax_bbox_p...
python
def get_axes_ratio(ax): """Return height / width ratio of the given Axes object. The ratio is calculated in 'display coordinate', defined in matplotlib document on transformation. Thus, the calculated ratio is what one would feels when the Axes is displayed to the her/him. """ ax_bbox_p...
[ "def", "get_axes_ratio", "(", "ax", ")", ":", "ax_bbox_points_in_fig_coord", "=", "ax", ".", "get_position", "(", ")", ".", "get_points", "(", ")", "ax_bbox_points_in_display_coord", "=", "[", "ax", ".", "figure", ".", "transFigure", ".", "transform", "(", "po...
Return height / width ratio of the given Axes object. The ratio is calculated in 'display coordinate', defined in matplotlib document on transformation. Thus, the calculated ratio is what one would feels when the Axes is displayed to the her/him.
[ "Return", "height", "/", "width", "ratio", "of", "the", "given", "Axes", "object", ".", "The", "ratio", "is", "calculated", "in", "display", "coordinate", "defined", "in", "matplotlib", "document", "on", "transformation", ".", "Thus", "the", "calculated", "rat...
965ebec102c539b323d5756fef04153ac71e50d9
https://github.com/jam31118/vis/blob/965ebec102c539b323d5756fef04153ac71e50d9/vis/layout.py#L6-L21
train
Return height / width ratio of the given Axes object.
jam31118/vis
vis/layout.py
get_text_position_in_ax_coord
def get_text_position_in_ax_coord(ax, pos, scale=default_text_relative_padding): """Return text position corresponding to given 'pos'. The text alignment in the bounding box should be set accordingly in order to have a good-looking layout. This corresponding text alignment can be obtained by 'get_text_...
python
def get_text_position_in_ax_coord(ax, pos, scale=default_text_relative_padding): """Return text position corresponding to given 'pos'. The text alignment in the bounding box should be set accordingly in order to have a good-looking layout. This corresponding text alignment can be obtained by 'get_text_...
[ "def", "get_text_position_in_ax_coord", "(", "ax", ",", "pos", ",", "scale", "=", "default_text_relative_padding", ")", ":", "ratio", "=", "get_axes_ratio", "(", "ax", ")", "x", ",", "y", "=", "scale", ",", "scale", "if", "ratio", ">", "1", ":", "# vertica...
Return text position corresponding to given 'pos'. The text alignment in the bounding box should be set accordingly in order to have a good-looking layout. This corresponding text alignment can be obtained by 'get_text_alignment' or 'get_text_position_and_inner_alignment' function.
[ "Return", "text", "position", "corresponding", "to", "given", "pos", ".", "The", "text", "alignment", "in", "the", "bounding", "box", "should", "be", "set", "accordingly", "in", "order", "to", "have", "a", "good", "-", "looking", "layout", ".", "This", "co...
965ebec102c539b323d5756fef04153ac71e50d9
https://github.com/jam31118/vis/blob/965ebec102c539b323d5756fef04153ac71e50d9/vis/layout.py#L24-L44
train
Return text position corresponding to given pos in given axes.
jam31118/vis
vis/layout.py
get_text_alignment
def get_text_alignment(pos): """Return 'verticalalignment'('va') and 'horizontalalignment'('ha') for given 'pos' (position)""" pos = pos.lower() # to make it case insensitive va, ha = None, None if pos == 'nw': va, ha = 'top', 'left' elif pos == 'ne': va, ha = 'top', 'right' elif pos == 'sw': v...
python
def get_text_alignment(pos): """Return 'verticalalignment'('va') and 'horizontalalignment'('ha') for given 'pos' (position)""" pos = pos.lower() # to make it case insensitive va, ha = None, None if pos == 'nw': va, ha = 'top', 'left' elif pos == 'ne': va, ha = 'top', 'right' elif pos == 'sw': v...
[ "def", "get_text_alignment", "(", "pos", ")", ":", "pos", "=", "pos", ".", "lower", "(", ")", "# to make it case insensitive", "va", ",", "ha", "=", "None", ",", "None", "if", "pos", "==", "'nw'", ":", "va", ",", "ha", "=", "'top'", ",", "'left'", "e...
Return 'verticalalignment'('va') and 'horizontalalignment'('ha') for given 'pos' (position)
[ "Return", "verticalalignment", "(", "va", ")", "and", "horizontalalignment", "(", "ha", ")", "for", "given", "pos", "(", "position", ")" ]
965ebec102c539b323d5756fef04153ac71e50d9
https://github.com/jam31118/vis/blob/965ebec102c539b323d5756fef04153ac71e50d9/vis/layout.py#L47-L56
train
Return vertical alignment and horizontal alignment for given position
jam31118/vis
vis/layout.py
get_text_position_and_inner_alignment
def get_text_position_and_inner_alignment(ax, pos, scale=default_text_relative_padding, with_transAxes_kwargs=True): """Return text position and its alignment in its bounding box. The returned position is given in Axes coordinate, as defined in matplotlib documentation on transformation. The retur...
python
def get_text_position_and_inner_alignment(ax, pos, scale=default_text_relative_padding, with_transAxes_kwargs=True): """Return text position and its alignment in its bounding box. The returned position is given in Axes coordinate, as defined in matplotlib documentation on transformation. The retur...
[ "def", "get_text_position_and_inner_alignment", "(", "ax", ",", "pos", ",", "scale", "=", "default_text_relative_padding", ",", "with_transAxes_kwargs", "=", "True", ")", ":", "xy", "=", "get_text_position_in_ax_coord", "(", "ax", ",", "pos", ",", "scale", "=", "s...
Return text position and its alignment in its bounding box. The returned position is given in Axes coordinate, as defined in matplotlib documentation on transformation. The returned alignment is given in dictionary, which can be put as a fontdict to text-relavent method.
[ "Return", "text", "position", "and", "its", "alignment", "in", "its", "bounding", "box", ".", "The", "returned", "position", "is", "given", "in", "Axes", "coordinate", "as", "defined", "in", "matplotlib", "documentation", "on", "transformation", "." ]
965ebec102c539b323d5756fef04153ac71e50d9
https://github.com/jam31118/vis/blob/965ebec102c539b323d5756fef04153ac71e50d9/vis/layout.py#L59-L71
train
Return text position and alignment in its bounding box.
jam31118/vis
vis/layout.py
get_text_position
def get_text_position(fig, ax, ha='left', va='top', pad_scale=1.0): """Return text position inside of the given axis""" ## Check and preprocess input arguments try: pad_scale = float(pad_scale) except: raise TypeError("'pad_scale should be of type 'float'") for arg in [va, ha]: ass...
python
def get_text_position(fig, ax, ha='left', va='top', pad_scale=1.0): """Return text position inside of the given axis""" ## Check and preprocess input arguments try: pad_scale = float(pad_scale) except: raise TypeError("'pad_scale should be of type 'float'") for arg in [va, ha]: ass...
[ "def", "get_text_position", "(", "fig", ",", "ax", ",", "ha", "=", "'left'", ",", "va", "=", "'top'", ",", "pad_scale", "=", "1.0", ")", ":", "## Check and preprocess input arguments", "try", ":", "pad_scale", "=", "float", "(", "pad_scale", ")", "except", ...
Return text position inside of the given axis
[ "Return", "text", "position", "inside", "of", "the", "given", "axis" ]
965ebec102c539b323d5756fef04153ac71e50d9
https://github.com/jam31118/vis/blob/965ebec102c539b323d5756fef04153ac71e50d9/vis/layout.py#L81-L118
train
Return the position of the text inside of the given axis.
robinandeer/puzzle
puzzle/server/factory.py
create_app
def create_app(config=None, config_obj=None): """Flask app factory function. Args: config (Optional[path]): path to a Python module config file config_obj (Optional[class]): Python config object """ app = Flask(__name__) # configure application from external configs configure_ap...
python
def create_app(config=None, config_obj=None): """Flask app factory function. Args: config (Optional[path]): path to a Python module config file config_obj (Optional[class]): Python config object """ app = Flask(__name__) # configure application from external configs configure_ap...
[ "def", "create_app", "(", "config", "=", "None", ",", "config_obj", "=", "None", ")", ":", "app", "=", "Flask", "(", "__name__", ")", "# configure application from external configs", "configure_app", "(", "app", ",", "config", "=", "config", ",", "config_obj", ...
Flask app factory function. Args: config (Optional[path]): path to a Python module config file config_obj (Optional[class]): Python config object
[ "Flask", "app", "factory", "function", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/factory.py#L12-L26
train
Create a new Flask application.
robinandeer/puzzle
puzzle/server/factory.py
configure_app
def configure_app(app, config=None, config_obj=None): """Configure application instance. Args: app (Flask): initialized Flask app instance config (Optional[path]): path to a Python module config file config_obj (Optional[class]): Python config object """ app.config.from_object(c...
python
def configure_app(app, config=None, config_obj=None): """Configure application instance. Args: app (Flask): initialized Flask app instance config (Optional[path]): path to a Python module config file config_obj (Optional[class]): Python config object """ app.config.from_object(c...
[ "def", "configure_app", "(", "app", ",", "config", "=", "None", ",", "config_obj", "=", "None", ")", ":", "app", ".", "config", ".", "from_object", "(", "config_obj", "or", "BaseConfig", ")", "if", "config", "is", "not", "None", ":", "app", ".", "confi...
Configure application instance. Args: app (Flask): initialized Flask app instance config (Optional[path]): path to a Python module config file config_obj (Optional[class]): Python config object
[ "Configure", "application", "instance", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/factory.py#L29-L39
train
Configure application instance.
robinandeer/puzzle
puzzle/server/factory.py
bind_extensions
def bind_extensions(app): """Configure extensions. Args: app (Flask): initialized Flask app instance """ # bind plugin to app object app.db = app.config['PUZZLE_BACKEND'] app.db.init_app(app) # bind bootstrap blueprints bootstrap.init_app(app) markdown(app) @app.templa...
python
def bind_extensions(app): """Configure extensions. Args: app (Flask): initialized Flask app instance """ # bind plugin to app object app.db = app.config['PUZZLE_BACKEND'] app.db.init_app(app) # bind bootstrap blueprints bootstrap.init_app(app) markdown(app) @app.templa...
[ "def", "bind_extensions", "(", "app", ")", ":", "# bind plugin to app object", "app", ".", "db", "=", "app", ".", "config", "[", "'PUZZLE_BACKEND'", "]", "app", ".", "db", ".", "init_app", "(", "app", ")", "# bind bootstrap blueprints", "bootstrap", ".", "init...
Configure extensions. Args: app (Flask): initialized Flask app instance
[ "Configure", "extensions", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/factory.py#L52-L68
train
Configure extensions.
ldomic/lintools
lintools/analysis/hbonds.py
HBonds.find_donors_and_acceptors_in_ligand
def find_donors_and_acceptors_in_ligand(self): """ Since MDAnalysis a pre-set list for acceptor and donor atoms for proteins and solvents from specific forcefields, it is necessary to find donor and acceptor atoms for the ligand molecule. This function uses RDKit and searches through lig...
python
def find_donors_and_acceptors_in_ligand(self): """ Since MDAnalysis a pre-set list for acceptor and donor atoms for proteins and solvents from specific forcefields, it is necessary to find donor and acceptor atoms for the ligand molecule. This function uses RDKit and searches through lig...
[ "def", "find_donors_and_acceptors_in_ligand", "(", "self", ")", ":", "atom_names", "=", "[", "x", ".", "name", "for", "x", "in", "self", ".", "topology_data", ".", "universe", ".", "ligand", "]", "try", ":", "for", "atom", "in", "self", ".", "topology_data...
Since MDAnalysis a pre-set list for acceptor and donor atoms for proteins and solvents from specific forcefields, it is necessary to find donor and acceptor atoms for the ligand molecule. This function uses RDKit and searches through ligand atoms to find matches for pre-set list of possible dono...
[ "Since", "MDAnalysis", "a", "pre", "-", "set", "list", "for", "acceptor", "and", "donor", "atoms", "for", "proteins", "and", "solvents", "from", "specific", "forcefields", "it", "is", "necessary", "to", "find", "donor", "and", "acceptor", "atoms", "for", "th...
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/hbonds.py#L64-L87
train
This function finds donors and acceptors in ligand atoms and returns a list of possible donor and acceptor atoms.
ldomic/lintools
lintools/analysis/hbonds.py
HBonds.analyse_hydrogen_bonds_traj
def analyse_hydrogen_bonds_traj(self,distance=3): """ MDAnalysis.analysis.hbonds module is used to analyse hydrogen bonds formed between protein and ligand for each submitted trajectory. The hydrogen bonds are then counted by total value per frame (count_by_time), as well as obtaining th...
python
def analyse_hydrogen_bonds_traj(self,distance=3): """ MDAnalysis.analysis.hbonds module is used to analyse hydrogen bonds formed between protein and ligand for each submitted trajectory. The hydrogen bonds are then counted by total value per frame (count_by_time), as well as obtaining th...
[ "def", "analyse_hydrogen_bonds_traj", "(", "self", ",", "distance", "=", "3", ")", ":", "i", "=", "0", "for", "traj", "in", "self", ".", "trajectory", ":", "self", ".", "topology_data", ".", "load_trajectory", "(", "traj", ")", "start", "=", "timer", "("...
MDAnalysis.analysis.hbonds module is used to analyse hydrogen bonds formed between protein and ligand for each submitted trajectory. The hydrogen bonds are then counted by total value per frame (count_by_time), as well as obtaining the frequency of each individual hydrogen bond (count_by_type). ...
[ "MDAnalysis", ".", "analysis", ".", "hbonds", "module", "is", "used", "to", "analyse", "hydrogen", "bonds", "formed", "between", "protein", "and", "ligand", "for", "each", "submitted", "trajectory", ".", "The", "hydrogen", "bonds", "are", "then", "counted", "b...
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/hbonds.py#L88-L116
train
This function is used to analyse hydrogen bonds for each trajectory in the current trajectory. It is used to analyse hydrogen bonds for each protein and ligand for each submitted trajectory.
ldomic/lintools
lintools/analysis/hbonds.py
HBonds.count_by_type
def count_by_type(self,table,timesteps): """Count how many times each individual hydrogen bonds occured throughout the simulation. Returns numpy array.""" hbonds = defaultdict(int) for contact in table: #count by residue name not by proteinring pkey = (contact.don...
python
def count_by_type(self,table,timesteps): """Count how many times each individual hydrogen bonds occured throughout the simulation. Returns numpy array.""" hbonds = defaultdict(int) for contact in table: #count by residue name not by proteinring pkey = (contact.don...
[ "def", "count_by_type", "(", "self", ",", "table", ",", "timesteps", ")", ":", "hbonds", "=", "defaultdict", "(", "int", ")", "for", "contact", "in", "table", ":", "#count by residue name not by proteinring", "pkey", "=", "(", "contact", ".", "donor_idx", ",",...
Count how many times each individual hydrogen bonds occured throughout the simulation. Returns numpy array.
[ "Count", "how", "many", "times", "each", "individual", "hydrogen", "bonds", "occured", "throughout", "the", "simulation", ".", "Returns", "numpy", "array", "." ]
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/hbonds.py#L118-L131
train
Count how many times each individual hydrogen bonds occured throughout the simulation.
ldomic/lintools
lintools/analysis/hbonds.py
HBonds.analyse_hydrogen_bonds_topology
def analyse_hydrogen_bonds_topology(self,distance=3): """ MDAnalysis.analysis.hbonds module is used to analyse hydrogen bonds formed between protein and ligand for each submitted trajectory. The hydrogen bonds are then counted by total value per frame (count_by_time), as well as obtainin...
python
def analyse_hydrogen_bonds_topology(self,distance=3): """ MDAnalysis.analysis.hbonds module is used to analyse hydrogen bonds formed between protein and ligand for each submitted trajectory. The hydrogen bonds are then counted by total value per frame (count_by_time), as well as obtainin...
[ "def", "analyse_hydrogen_bonds_topology", "(", "self", ",", "distance", "=", "3", ")", ":", "h", "=", "MDAnalysis", ".", "analysis", ".", "hbonds", ".", "HydrogenBondAnalysis", "(", "self", ".", "topology_data", ".", "universe", ",", "'(segid '", "+", "str", ...
MDAnalysis.analysis.hbonds module is used to analyse hydrogen bonds formed between protein and ligand for each submitted trajectory. The hydrogen bonds are then counted by total value per frame (count_by_time), as well as obtaining the frequency of each individual hydrogen bond (count_by_type). ...
[ "MDAnalysis", ".", "analysis", ".", "hbonds", "module", "is", "used", "to", "analyse", "hydrogen", "bonds", "formed", "between", "protein", "and", "ligand", "for", "each", "submitted", "trajectory", ".", "The", "hydrogen", "bonds", "are", "then", "counted", "b...
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/hbonds.py#L133-L152
train
This function is used to analyse hydrogen bonds in the topology.
ldomic/lintools
lintools/analysis/hbonds.py
HBonds.determine_hbonds_for_drawing
def determine_hbonds_for_drawing(self, analysis_cutoff): """ Since plotting all hydrogen bonds could lead to a messy plot, a cutoff has to be imple- mented. In this function the frequency of each hydrogen bond is summated and the total compared against analysis cutoff - a fraction multip...
python
def determine_hbonds_for_drawing(self, analysis_cutoff): """ Since plotting all hydrogen bonds could lead to a messy plot, a cutoff has to be imple- mented. In this function the frequency of each hydrogen bond is summated and the total compared against analysis cutoff - a fraction multip...
[ "def", "determine_hbonds_for_drawing", "(", "self", ",", "analysis_cutoff", ")", ":", "self", ".", "frequency", "=", "defaultdict", "(", "int", ")", "for", "traj", "in", "self", ".", "hbonds_by_type", ":", "for", "bond", "in", "self", ".", "hbonds_by_type", ...
Since plotting all hydrogen bonds could lead to a messy plot, a cutoff has to be imple- mented. In this function the frequency of each hydrogen bond is summated and the total compared against analysis cutoff - a fraction multiplied by trajectory count. Those hydrogen bonds that are present for l...
[ "Since", "plotting", "all", "hydrogen", "bonds", "could", "lead", "to", "a", "messy", "plot", "a", "cutoff", "has", "to", "be", "imple", "-", "mented", ".", "In", "this", "function", "the", "frequency", "of", "each", "hydrogen", "bond", "is", "summated", ...
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/hbonds.py#L153-L195
train
This function calculates the frequency of each hydrogen bond and the number of hydrogen bonds that are present for longer than analysis_cutoff.
ldomic/lintools
lintools/analysis/hbonds.py
HBonds.write_output_files
def write_output_files(self): """ The total hydrogen bond count per frame is provided as CSV output file. Each trajectory has a separate file. """ os.mkdir("analysis") os.chdir("analysis") os.mkdir("hydrogen_bonds") os.chdir("hydrogen_bonds") for t...
python
def write_output_files(self): """ The total hydrogen bond count per frame is provided as CSV output file. Each trajectory has a separate file. """ os.mkdir("analysis") os.chdir("analysis") os.mkdir("hydrogen_bonds") os.chdir("hydrogen_bonds") for t...
[ "def", "write_output_files", "(", "self", ")", ":", "os", ".", "mkdir", "(", "\"analysis\"", ")", "os", ".", "chdir", "(", "\"analysis\"", ")", "os", ".", "mkdir", "(", "\"hydrogen_bonds\"", ")", "os", ".", "chdir", "(", "\"hydrogen_bonds\"", ")", "for", ...
The total hydrogen bond count per frame is provided as CSV output file. Each trajectory has a separate file.
[ "The", "total", "hydrogen", "bond", "count", "per", "frame", "is", "provided", "as", "CSV", "output", "file", ".", "Each", "trajectory", "has", "a", "separate", "file", "." ]
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/hbonds.py#L196-L223
train
Write the output files for the hydrogen bond tables.
wistful/pympris
pympris/common.py
convert2dbus
def convert2dbus(value, signature): """Converts `value` type from python to dbus according signature. :param value: value to convert to dbus object :param str signature: dbus type signature. :returns: value in dbus type. """ if len(signature) == 2 and signature.startswith('a'): return d...
python
def convert2dbus(value, signature): """Converts `value` type from python to dbus according signature. :param value: value to convert to dbus object :param str signature: dbus type signature. :returns: value in dbus type. """ if len(signature) == 2 and signature.startswith('a'): return d...
[ "def", "convert2dbus", "(", "value", ",", "signature", ")", ":", "if", "len", "(", "signature", ")", "==", "2", "and", "signature", ".", "startswith", "(", "'a'", ")", ":", "return", "dbus", ".", "Array", "(", "value", ",", "signature", "=", "signature...
Converts `value` type from python to dbus according signature. :param value: value to convert to dbus object :param str signature: dbus type signature. :returns: value in dbus type.
[ "Converts", "value", "type", "from", "python", "to", "dbus", "according", "signature", "." ]
4bd64a1f0d151f2adfc392ab34fd9b38894786cb
https://github.com/wistful/pympris/blob/4bd64a1f0d151f2adfc392ab34fd9b38894786cb/pympris/common.py#L25-L40
train
Converts value type from python to dbus according signature.
wistful/pympris
pympris/common.py
convert
def convert(dbus_obj): """Converts dbus_obj from dbus type to python type. :param dbus_obj: dbus object. :returns: dbus_obj in python type. """ _isinstance = partial(isinstance, dbus_obj) ConvertType = namedtuple('ConvertType', 'pytype dbustypes') pyint = ConvertType(int, (dbus.Byte, dbus....
python
def convert(dbus_obj): """Converts dbus_obj from dbus type to python type. :param dbus_obj: dbus object. :returns: dbus_obj in python type. """ _isinstance = partial(isinstance, dbus_obj) ConvertType = namedtuple('ConvertType', 'pytype dbustypes') pyint = ConvertType(int, (dbus.Byte, dbus....
[ "def", "convert", "(", "dbus_obj", ")", ":", "_isinstance", "=", "partial", "(", "isinstance", ",", "dbus_obj", ")", "ConvertType", "=", "namedtuple", "(", "'ConvertType'", ",", "'pytype dbustypes'", ")", "pyint", "=", "ConvertType", "(", "int", ",", "(", "d...
Converts dbus_obj from dbus type to python type. :param dbus_obj: dbus object. :returns: dbus_obj in python type.
[ "Converts", "dbus_obj", "from", "dbus", "type", "to", "python", "type", "." ]
4bd64a1f0d151f2adfc392ab34fd9b38894786cb
https://github.com/wistful/pympris/blob/4bd64a1f0d151f2adfc392ab34fd9b38894786cb/pympris/common.py#L43-L77
train
Converts dbus_obj from dbus type to python type.
wistful/pympris
pympris/common.py
converter
def converter(f): """Decorator to convert value from dbus type to python type.""" @wraps(f) def wrapper(*args, **kwds): return convert(f(*args, **kwds)) return wrapper
python
def converter(f): """Decorator to convert value from dbus type to python type.""" @wraps(f) def wrapper(*args, **kwds): return convert(f(*args, **kwds)) return wrapper
[ "def", "converter", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwds", ")", ":", "return", "convert", "(", "f", "(", "*", "args", ",", "*", "*", "kwds", ")", ")", "return", "wrapper" ]
Decorator to convert value from dbus type to python type.
[ "Decorator", "to", "convert", "value", "from", "dbus", "type", "to", "python", "type", "." ]
4bd64a1f0d151f2adfc392ab34fd9b38894786cb
https://github.com/wistful/pympris/blob/4bd64a1f0d151f2adfc392ab34fd9b38894786cb/pympris/common.py#L80-L85
train
Decorator to convert value from dbus type to python type.
wistful/pympris
pympris/common.py
exception_wrapper
def exception_wrapper(f): """Decorator to convert dbus exception to pympris exception.""" @wraps(f) def wrapper(*args, **kwds): try: return f(*args, **kwds) except dbus.exceptions.DBusException as err: _args = err.args raise PyMPRISException(*_args) re...
python
def exception_wrapper(f): """Decorator to convert dbus exception to pympris exception.""" @wraps(f) def wrapper(*args, **kwds): try: return f(*args, **kwds) except dbus.exceptions.DBusException as err: _args = err.args raise PyMPRISException(*_args) re...
[ "def", "exception_wrapper", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwds", ")", ":", "try", ":", "return", "f", "(", "*", "args", ",", "*", "*", "kwds", ")", "except", "dbus", ".", ...
Decorator to convert dbus exception to pympris exception.
[ "Decorator", "to", "convert", "dbus", "exception", "to", "pympris", "exception", "." ]
4bd64a1f0d151f2adfc392ab34fd9b38894786cb
https://github.com/wistful/pympris/blob/4bd64a1f0d151f2adfc392ab34fd9b38894786cb/pympris/common.py#L88-L97
train
Decorator to convert dbus exception to pyMPRIS exception.
wistful/pympris
pympris/common.py
available_players
def available_players(): """Searchs and returns set of unique names of objects which implements MPRIS2 interfaces. :returns: set of unique names. :type: set """ bus = dbus.SessionBus() players = set() for name in filter(lambda item: item.startswith(MPRIS_NAME_PREFIX), ...
python
def available_players(): """Searchs and returns set of unique names of objects which implements MPRIS2 interfaces. :returns: set of unique names. :type: set """ bus = dbus.SessionBus() players = set() for name in filter(lambda item: item.startswith(MPRIS_NAME_PREFIX), ...
[ "def", "available_players", "(", ")", ":", "bus", "=", "dbus", ".", "SessionBus", "(", ")", "players", "=", "set", "(", ")", "for", "name", "in", "filter", "(", "lambda", "item", ":", "item", ".", "startswith", "(", "MPRIS_NAME_PREFIX", ")", ",", "bus"...
Searchs and returns set of unique names of objects which implements MPRIS2 interfaces. :returns: set of unique names. :type: set
[ "Searchs", "and", "returns", "set", "of", "unique", "names", "of", "objects", "which", "implements", "MPRIS2", "interfaces", "." ]
4bd64a1f0d151f2adfc392ab34fd9b38894786cb
https://github.com/wistful/pympris/blob/4bd64a1f0d151f2adfc392ab34fd9b38894786cb/pympris/common.py#L100-L113
train
Searchs and returns set of unique names of objects which implements MPRIS2 interfaces.
wistful/pympris
pympris/common.py
signal_wrapper
def signal_wrapper(f): """Decorator converts function's arguments from dbus types to python.""" @wraps(f) def wrapper(*args, **kwds): args = map(convert, args) kwds = {convert(k): convert(v) for k, v in kwds.items()} return f(*args, **kwds) return wrapper
python
def signal_wrapper(f): """Decorator converts function's arguments from dbus types to python.""" @wraps(f) def wrapper(*args, **kwds): args = map(convert, args) kwds = {convert(k): convert(v) for k, v in kwds.items()} return f(*args, **kwds) return wrapper
[ "def", "signal_wrapper", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwds", ")", ":", "args", "=", "map", "(", "convert", ",", "args", ")", "kwds", "=", "{", "convert", "(", "k", ")", "...
Decorator converts function's arguments from dbus types to python.
[ "Decorator", "converts", "function", "s", "arguments", "from", "dbus", "types", "to", "python", "." ]
4bd64a1f0d151f2adfc392ab34fd9b38894786cb
https://github.com/wistful/pympris/blob/4bd64a1f0d151f2adfc392ab34fd9b38894786cb/pympris/common.py#L124-L131
train
Decorator converts arguments from dbus types to python types.
wistful/pympris
pympris/common.py
filter_properties_signals
def filter_properties_signals(f, signal_iface_name): """Filters signals by iface name. :param function f: function to wrap. :param str signal_iface_name: interface name. """ @wraps(f) def wrapper(iface, changed_props, invalidated_props, *args, **kwargs): if iface == signal_iface_name: ...
python
def filter_properties_signals(f, signal_iface_name): """Filters signals by iface name. :param function f: function to wrap. :param str signal_iface_name: interface name. """ @wraps(f) def wrapper(iface, changed_props, invalidated_props, *args, **kwargs): if iface == signal_iface_name: ...
[ "def", "filter_properties_signals", "(", "f", ",", "signal_iface_name", ")", ":", "@", "wraps", "(", "f", ")", "def", "wrapper", "(", "iface", ",", "changed_props", ",", "invalidated_props", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "ifa...
Filters signals by iface name. :param function f: function to wrap. :param str signal_iface_name: interface name.
[ "Filters", "signals", "by", "iface", "name", "." ]
4bd64a1f0d151f2adfc392ab34fd9b38894786cb
https://github.com/wistful/pympris/blob/4bd64a1f0d151f2adfc392ab34fd9b38894786cb/pympris/common.py#L134-L145
train
Decorator to filter out properties of a given signal.
inveniosoftware-contrib/json-merger
json_merger/contrib/inspirehep/match.py
distance_function_match
def distance_function_match(l1, l2, thresh, dist_fn, norm_funcs=[]): """Returns pairs of matching indices from l1 and l2.""" common = [] # We will keep track of the global index in the source list as we # will successively reduce their sizes. l1 = list(enumerate(l1)) l2 = list(enumerate(l2)) ...
python
def distance_function_match(l1, l2, thresh, dist_fn, norm_funcs=[]): """Returns pairs of matching indices from l1 and l2.""" common = [] # We will keep track of the global index in the source list as we # will successively reduce their sizes. l1 = list(enumerate(l1)) l2 = list(enumerate(l2)) ...
[ "def", "distance_function_match", "(", "l1", ",", "l2", ",", "thresh", ",", "dist_fn", ",", "norm_funcs", "=", "[", "]", ")", ":", "common", "=", "[", "]", "# We will keep track of the global index in the source list as we", "# will successively reduce their sizes.", "l...
Returns pairs of matching indices from l1 and l2.
[ "Returns", "pairs", "of", "matching", "indices", "from", "l1", "and", "l2", "." ]
adc6d372da018427e1db7b92424d3471e01a4118
https://github.com/inveniosoftware-contrib/json-merger/blob/adc6d372da018427e1db7b92424d3471e01a4118/json_merger/contrib/inspirehep/match.py#L30-L76
train
Returns pairs of matching indices from l1 and l2.
inveniosoftware-contrib/json-merger
json_merger/contrib/inspirehep/match.py
_match_by_norm_func
def _match_by_norm_func(l1, l2, norm_fn, dist_fn, thresh): """Matches elements in l1 and l2 using normalization functions. Splits the elements in each list into buckets given by the normalization function. If the same normalization value points to a bucket from the first list and a bucket from the seco...
python
def _match_by_norm_func(l1, l2, norm_fn, dist_fn, thresh): """Matches elements in l1 and l2 using normalization functions. Splits the elements in each list into buckets given by the normalization function. If the same normalization value points to a bucket from the first list and a bucket from the seco...
[ "def", "_match_by_norm_func", "(", "l1", ",", "l2", ",", "norm_fn", ",", "dist_fn", ",", "thresh", ")", ":", "common", "=", "[", "]", "l1_only_idx", "=", "set", "(", "range", "(", "len", "(", "l1", ")", ")", ")", "l2_only_idx", "=", "set", "(", "ra...
Matches elements in l1 and l2 using normalization functions. Splits the elements in each list into buckets given by the normalization function. If the same normalization value points to a bucket from the first list and a bucket from the second list, both with a single element we consider the elements i...
[ "Matches", "elements", "in", "l1", "and", "l2", "using", "normalization", "functions", "." ]
adc6d372da018427e1db7b92424d3471e01a4118
https://github.com/inveniosoftware-contrib/json-merger/blob/adc6d372da018427e1db7b92424d3471e01a4118/json_merger/contrib/inspirehep/match.py#L79-L138
train
Matches elements in l1 and l2 using normalization functions.
inveniosoftware-contrib/json-merger
json_merger/contrib/inspirehep/match.py
_match_munkres
def _match_munkres(l1, l2, dist_matrix, thresh): """Matches two lists using the Munkres algorithm. Returns pairs of matching indices from the two lists by minimizing the sum of the distance between the linked elements and taking only the elements which have the distance between them less (or equal) tha...
python
def _match_munkres(l1, l2, dist_matrix, thresh): """Matches two lists using the Munkres algorithm. Returns pairs of matching indices from the two lists by minimizing the sum of the distance between the linked elements and taking only the elements which have the distance between them less (or equal) tha...
[ "def", "_match_munkres", "(", "l1", ",", "l2", ",", "dist_matrix", ",", "thresh", ")", ":", "equal_dist_matches", "=", "set", "(", ")", "m", "=", "Munkres", "(", ")", "indices", "=", "m", ".", "compute", "(", "dist_matrix", ")", "for", "l1_idx", ",", ...
Matches two lists using the Munkres algorithm. Returns pairs of matching indices from the two lists by minimizing the sum of the distance between the linked elements and taking only the elements which have the distance between them less (or equal) than the threshold.
[ "Matches", "two", "lists", "using", "the", "Munkres", "algorithm", "." ]
adc6d372da018427e1db7b92424d3471e01a4118
https://github.com/inveniosoftware-contrib/json-merger/blob/adc6d372da018427e1db7b92424d3471e01a4118/json_merger/contrib/inspirehep/match.py#L141-L163
train
Matches two lists using Munkres algorithm.
robinandeer/puzzle
puzzle/plugins/sql/mixins/actions/suspect.py
SuspectActions.add_suspect
def add_suspect(self, case_obj, variant_obj): """Link a suspect to a case.""" new_suspect = Suspect(case=case_obj, variant_id=variant_obj.variant_id, name=variant_obj.display_name) self.session.add(new_suspect) self.save() return new_suspect
python
def add_suspect(self, case_obj, variant_obj): """Link a suspect to a case.""" new_suspect = Suspect(case=case_obj, variant_id=variant_obj.variant_id, name=variant_obj.display_name) self.session.add(new_suspect) self.save() return new_suspect
[ "def", "add_suspect", "(", "self", ",", "case_obj", ",", "variant_obj", ")", ":", "new_suspect", "=", "Suspect", "(", "case", "=", "case_obj", ",", "variant_id", "=", "variant_obj", ".", "variant_id", ",", "name", "=", "variant_obj", ".", "display_name", ")"...
Link a suspect to a case.
[ "Link", "a", "suspect", "to", "a", "case", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/sql/mixins/actions/suspect.py#L10-L16
train
Link a suspect to a case.
robinandeer/puzzle
puzzle/plugins/sql/mixins/actions/suspect.py
SuspectActions.delete_suspect
def delete_suspect(self, suspect_id): """De-link a suspect from a case.""" suspect_obj = self.suspect(suspect_id) logger.debug("Deleting suspect {0}".format(suspect_obj.name)) self.session.delete(suspect_obj) self.save()
python
def delete_suspect(self, suspect_id): """De-link a suspect from a case.""" suspect_obj = self.suspect(suspect_id) logger.debug("Deleting suspect {0}".format(suspect_obj.name)) self.session.delete(suspect_obj) self.save()
[ "def", "delete_suspect", "(", "self", ",", "suspect_id", ")", ":", "suspect_obj", "=", "self", ".", "suspect", "(", "suspect_id", ")", "logger", ".", "debug", "(", "\"Deleting suspect {0}\"", ".", "format", "(", "suspect_obj", ".", "name", ")", ")", "self", ...
De-link a suspect from a case.
[ "De", "-", "link", "a", "suspect", "from", "a", "case", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/sql/mixins/actions/suspect.py#L22-L27
train
De - link a suspect from a case.
robinandeer/puzzle
puzzle/cli/view.py
view
def view(ctx, host, port, debug, pattern, family_file, family_type, variant_source, root, no_browser, phenomizer): """Visualize DNA variant resources. 1. Look for variant source(s) to visualize and inst. the right plugin """ main_loop = (not debug) or (os.environ.get('WERKZEUG_RUN_MAIN') == 't...
python
def view(ctx, host, port, debug, pattern, family_file, family_type, variant_source, root, no_browser, phenomizer): """Visualize DNA variant resources. 1. Look for variant source(s) to visualize and inst. the right plugin """ main_loop = (not debug) or (os.environ.get('WERKZEUG_RUN_MAIN') == 't...
[ "def", "view", "(", "ctx", ",", "host", ",", "port", ",", "debug", ",", "pattern", ",", "family_file", ",", "family_type", ",", "variant_source", ",", "root", ",", "no_browser", ",", "phenomizer", ")", ":", "main_loop", "=", "(", "not", "debug", ")", "...
Visualize DNA variant resources. 1. Look for variant source(s) to visualize and inst. the right plugin
[ "Visualize", "DNA", "variant", "resources", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/cli/view.py#L42-L141
train
Visualize DNA variant resources.
robinandeer/puzzle
puzzle/log.py
configure_stream
def configure_stream(level='WARNING'): """Configure root logger using a standard stream handler. Args: level (string, optional): lowest level to log to the console Returns: logging.RootLogger: root logger instance with attached handler """ # get the root logger root_logger = lo...
python
def configure_stream(level='WARNING'): """Configure root logger using a standard stream handler. Args: level (string, optional): lowest level to log to the console Returns: logging.RootLogger: root logger instance with attached handler """ # get the root logger root_logger = lo...
[ "def", "configure_stream", "(", "level", "=", "'WARNING'", ")", ":", "# get the root logger", "root_logger", "=", "logging", ".", "getLogger", "(", ")", "# set the logger level to the same as will be used by the handler", "root_logger", ".", "setLevel", "(", "level", ")",...
Configure root logger using a standard stream handler. Args: level (string, optional): lowest level to log to the console Returns: logging.RootLogger: root logger instance with attached handler
[ "Configure", "root", "logger", "using", "a", "standard", "stream", "handler", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/log.py#L7-L31
train
Configure root logger using a standard stream handler.
iwoca/django-deep-collector
deep_collector/core.py
DeepCollector.clean_by_fields
def clean_by_fields(self, obj, fields, get_field_fn, exclude_list): """ Function used to exclude defined fields from object collect. :param obj: the object we are collecting :param fields: every field related to this object (direct or reverse one) :param get_field_fn: function us...
python
def clean_by_fields(self, obj, fields, get_field_fn, exclude_list): """ Function used to exclude defined fields from object collect. :param obj: the object we are collecting :param fields: every field related to this object (direct or reverse one) :param get_field_fn: function us...
[ "def", "clean_by_fields", "(", "self", ",", "obj", ",", "fields", ",", "get_field_fn", ",", "exclude_list", ")", ":", "cleaned_list", "=", "[", "]", "obj_model", "=", "get_model_from_instance", "(", "obj", ")", "for", "field", "in", "fields", ":", "field_acc...
Function used to exclude defined fields from object collect. :param obj: the object we are collecting :param fields: every field related to this object (direct or reverse one) :param get_field_fn: function used to get accessor for each field :param exclude_list: model/fields we have defi...
[ "Function", "used", "to", "exclude", "defined", "fields", "from", "object", "collect", ".", ":", "param", "obj", ":", "the", "object", "we", "are", "collecting", ":", "param", "fields", ":", "every", "field", "related", "to", "this", "object", "(", "direct...
1bd599d5362ade525cb51d6ee70713a3f58af219
https://github.com/iwoca/django-deep-collector/blob/1bd599d5362ade525cb51d6ee70713a3f58af219/deep_collector/core.py#L132-L155
train
Function used to exclude defined fields from object collect.
iwoca/django-deep-collector
deep_collector/core.py
DeepCollector._is_same_type_as_root
def _is_same_type_as_root(self, obj): """ Testing if we try to collect an object of the same type as root. This is not really a good sign, because it means that we are going to collect a whole new tree, that will maybe collect a new tree, that will... """ if not self.ALLO...
python
def _is_same_type_as_root(self, obj): """ Testing if we try to collect an object of the same type as root. This is not really a good sign, because it means that we are going to collect a whole new tree, that will maybe collect a new tree, that will... """ if not self.ALLO...
[ "def", "_is_same_type_as_root", "(", "self", ",", "obj", ")", ":", "if", "not", "self", ".", "ALLOWS_SAME_TYPE_AS_ROOT_COLLECT", ":", "obj_model", "=", "get_model_from_instance", "(", "obj", ")", "obj_key", "=", "get_key_from_instance", "(", "obj", ")", "is_same_t...
Testing if we try to collect an object of the same type as root. This is not really a good sign, because it means that we are going to collect a whole new tree, that will maybe collect a new tree, that will...
[ "Testing", "if", "we", "try", "to", "collect", "an", "object", "of", "the", "same", "type", "as", "root", ".", "This", "is", "not", "really", "a", "good", "sign", "because", "it", "means", "that", "we", "are", "going", "to", "collect", "a", "whole", ...
1bd599d5362ade525cb51d6ee70713a3f58af219
https://github.com/iwoca/django-deep-collector/blob/1bd599d5362ade525cb51d6ee70713a3f58af219/deep_collector/core.py#L203-L219
train
Tests if an object of the same type as root.
iwoca/django-deep-collector
deep_collector/core.py
DeepCollector.filter_by_threshold
def filter_by_threshold(self, objects, current_instance, field_name): """ If the field we are currently working on has too many objects related to it, we want to restrict it depending on a settings-driven threshold. :param objects: The objects we want to filter :param current_obj...
python
def filter_by_threshold(self, objects, current_instance, field_name): """ If the field we are currently working on has too many objects related to it, we want to restrict it depending on a settings-driven threshold. :param objects: The objects we want to filter :param current_obj...
[ "def", "filter_by_threshold", "(", "self", ",", "objects", ",", "current_instance", ",", "field_name", ")", ":", "objs_count", "=", "len", "(", "objects", ")", "if", "objs_count", "==", "0", ":", "return", "[", "]", "object_example", "=", "objects", "[", "...
If the field we are currently working on has too many objects related to it, we want to restrict it depending on a settings-driven threshold. :param objects: The objects we want to filter :param current_obj: The current collected instance :param field_name: The current field name ...
[ "If", "the", "field", "we", "are", "currently", "working", "on", "has", "too", "many", "objects", "related", "to", "it", "we", "want", "to", "restrict", "it", "depending", "on", "a", "settings", "-", "driven", "threshold", ".", ":", "param", "objects", "...
1bd599d5362ade525cb51d6ee70713a3f58af219
https://github.com/iwoca/django-deep-collector/blob/1bd599d5362ade525cb51d6ee70713a3f58af219/deep_collector/core.py#L269-L291
train
Filter the list of objects by a threshold.
iwoca/django-deep-collector
deep_collector/core.py
DeepCollector.post_collect
def post_collect(self, obj): """ We want to manage the side-effect of not collecting other items of the same type as root model. If for example, you run the collect on a specific user that is linked to a model "A" linked (ForeignKey) to ANOTHER user. Then the collect won't collec...
python
def post_collect(self, obj): """ We want to manage the side-effect of not collecting other items of the same type as root model. If for example, you run the collect on a specific user that is linked to a model "A" linked (ForeignKey) to ANOTHER user. Then the collect won't collec...
[ "def", "post_collect", "(", "self", ",", "obj", ")", ":", "if", "not", "self", ".", "ALLOWS_SAME_TYPE_AS_ROOT_COLLECT", ":", "for", "field", "in", "self", ".", "get_local_fields", "(", "obj", ")", ":", "if", "isinstance", "(", "field", ",", "ForeignKey", "...
We want to manage the side-effect of not collecting other items of the same type as root model. If for example, you run the collect on a specific user that is linked to a model "A" linked (ForeignKey) to ANOTHER user. Then the collect won't collect this other user, but the collected model "A" wi...
[ "We", "want", "to", "manage", "the", "side", "-", "effect", "of", "not", "collecting", "other", "items", "of", "the", "same", "type", "as", "root", "model", ".", "If", "for", "example", "you", "run", "the", "collect", "on", "a", "specific", "user", "th...
1bd599d5362ade525cb51d6ee70713a3f58af219
https://github.com/iwoca/django-deep-collector/blob/1bd599d5362ade525cb51d6ee70713a3f58af219/deep_collector/core.py#L320-L346
train
This method is called when the object is created to collect the related items of the same type as the root model.
jalmeroth/pymusiccast
pymusiccast/media_status.py
MediaStatus.initialize
def initialize(self, data): """ initialize variable from loaded data """ for item in data: if hasattr(self, item): setattr(self, item, data[item])
python
def initialize(self, data): """ initialize variable from loaded data """ for item in data: if hasattr(self, item): setattr(self, item, data[item])
[ "def", "initialize", "(", "self", ",", "data", ")", ":", "for", "item", "in", "data", ":", "if", "hasattr", "(", "self", ",", "item", ")", ":", "setattr", "(", "self", ",", "item", ",", "data", "[", "item", "]", ")" ]
initialize variable from loaded data
[ "initialize", "variable", "from", "loaded", "data" ]
616379ae22d6b518c61042d58be6d18a46242168
https://github.com/jalmeroth/pymusiccast/blob/616379ae22d6b518c61042d58be6d18a46242168/pymusiccast/media_status.py#L57-L61
train
initialize the object from loaded data
robinandeer/puzzle
setup.py
parse_readme
def parse_readme(): """Parse contents of the README.""" # Get the long description from the relevant file here = os.path.abspath(os.path.dirname(__file__)) readme_path = os.path.join(here, 'README.md') with codecs.open(readme_path, encoding='utf-8') as handle: long_description = handle.read(...
python
def parse_readme(): """Parse contents of the README.""" # Get the long description from the relevant file here = os.path.abspath(os.path.dirname(__file__)) readme_path = os.path.join(here, 'README.md') with codecs.open(readme_path, encoding='utf-8') as handle: long_description = handle.read(...
[ "def", "parse_readme", "(", ")", ":", "# Get the long description from the relevant file", "here", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "readme_path", "=", "os", ".", "path", ".", "join", ...
Parse contents of the README.
[ "Parse", "contents", "of", "the", "README", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/setup.py#L38-L46
train
Parse the contents of the README file.
robinandeer/puzzle
puzzle/plugins/vcf/mixins/variant_extras/transcripts.py
TranscriptExtras._add_transcripts
def _add_transcripts(self, variant_obj, info_dict): """Return all transcripts sound in the vcf file""" vep_string = info_dict.get('CSQ') #Check if snpeff annotation: snpeff_string = info_dict.get('ANN') # We check one of these. # VEP has presedence over snpeff ...
python
def _add_transcripts(self, variant_obj, info_dict): """Return all transcripts sound in the vcf file""" vep_string = info_dict.get('CSQ') #Check if snpeff annotation: snpeff_string = info_dict.get('ANN') # We check one of these. # VEP has presedence over snpeff ...
[ "def", "_add_transcripts", "(", "self", ",", "variant_obj", ",", "info_dict", ")", ":", "vep_string", "=", "info_dict", ".", "get", "(", "'CSQ'", ")", "#Check if snpeff annotation:", "snpeff_string", "=", "info_dict", ".", "get", "(", "'ANN'", ")", "# We check o...
Return all transcripts sound in the vcf file
[ "Return", "all", "transcripts", "sound", "in", "the", "vcf", "file" ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/vcf/mixins/variant_extras/transcripts.py#L9-L36
train
Add transcripts from the vep file to the variant object
robinandeer/puzzle
puzzle/plugins/vcf/mixins/variant_extras/transcripts.py
TranscriptExtras._get_vep_transcript
def _get_vep_transcript(self, transcript_info): """Create a Transcript based on the vep annotation Args: transcript_info (dict): A dict with vep info Returns: transcript (puzzle.models.Transcript): A Transcripts """ transcript = Transcrip...
python
def _get_vep_transcript(self, transcript_info): """Create a Transcript based on the vep annotation Args: transcript_info (dict): A dict with vep info Returns: transcript (puzzle.models.Transcript): A Transcripts """ transcript = Transcrip...
[ "def", "_get_vep_transcript", "(", "self", ",", "transcript_info", ")", ":", "transcript", "=", "Transcript", "(", "hgnc_symbol", "=", "transcript_info", ".", "get", "(", "'SYMBOL'", ")", ",", "transcript_id", "=", "transcript_info", ".", "get", "(", "'Feature'"...
Create a Transcript based on the vep annotation Args: transcript_info (dict): A dict with vep info Returns: transcript (puzzle.models.Transcript): A Transcripts
[ "Create", "a", "Transcript", "based", "on", "the", "vep", "annotation" ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/vcf/mixins/variant_extras/transcripts.py#L39-L63
train
Create a Transcript object based on the vep annotation
robinandeer/puzzle
puzzle/plugins/vcf/mixins/variant_extras/transcripts.py
TranscriptExtras._get_snpeff_transcript
def _get_snpeff_transcript(self, transcript_info): """Create a transcript based on the snpeff annotation Args: transcript_info (dict): A dict with snpeff info Returns: transcript (puzzle.models.Transcript): A Transcripts """ transcript = ...
python
def _get_snpeff_transcript(self, transcript_info): """Create a transcript based on the snpeff annotation Args: transcript_info (dict): A dict with snpeff info Returns: transcript (puzzle.models.Transcript): A Transcripts """ transcript = ...
[ "def", "_get_snpeff_transcript", "(", "self", ",", "transcript_info", ")", ":", "transcript", "=", "Transcript", "(", "hgnc_symbol", "=", "transcript_info", ".", "get", "(", "'Gene_Name'", ")", ",", "transcript_id", "=", "transcript_info", ".", "get", "(", "'Fea...
Create a transcript based on the snpeff annotation Args: transcript_info (dict): A dict with snpeff info Returns: transcript (puzzle.models.Transcript): A Transcripts
[ "Create", "a", "transcript", "based", "on", "the", "snpeff", "annotation" ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/vcf/mixins/variant_extras/transcripts.py#L65-L84
train
Create a Transcript object based on the snpeff annotation
tswicegood/Dolt
dolt/__init__.py
_makes_clone
def _makes_clone(_func, *args, **kw): """ A decorator that returns a clone of the current object so that we can re-use the object for similar requests. """ self = args[0]._clone() _func(self, *args[1:], **kw) return self
python
def _makes_clone(_func, *args, **kw): """ A decorator that returns a clone of the current object so that we can re-use the object for similar requests. """ self = args[0]._clone() _func(self, *args[1:], **kw) return self
[ "def", "_makes_clone", "(", "_func", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "self", "=", "args", "[", "0", "]", ".", "_clone", "(", ")", "_func", "(", "self", ",", "*", "args", "[", "1", ":", "]", ",", "*", "*", "kw", ")", "return...
A decorator that returns a clone of the current object so that we can re-use the object for similar requests.
[ "A", "decorator", "that", "returns", "a", "clone", "of", "the", "current", "object", "so", "that", "we", "can", "re", "-", "use", "the", "object", "for", "similar", "requests", "." ]
e0da1918b7db18f885734a89f824b9e173cc30a5
https://github.com/tswicegood/Dolt/blob/e0da1918b7db18f885734a89f824b9e173cc30a5/dolt/__init__.py#L22-L29
train
A decorator that returns a clone of the current object so that it can be re - used for similar requests.
tswicegood/Dolt
dolt/__init__.py
Dolt._handle_response
def _handle_response(self, response, data): """ Deserializes JSON if the content-type matches, otherwise returns the response body as is. """ # Content-Type headers can include additional parameters(RFC 1521), so # we split on ; to match against only the type/subtype ...
python
def _handle_response(self, response, data): """ Deserializes JSON if the content-type matches, otherwise returns the response body as is. """ # Content-Type headers can include additional parameters(RFC 1521), so # we split on ; to match against only the type/subtype ...
[ "def", "_handle_response", "(", "self", ",", "response", ",", "data", ")", ":", "# Content-Type headers can include additional parameters(RFC 1521), so", "# we split on ; to match against only the type/subtype", "if", "data", "and", "response", ".", "get", "(", "'content-type'"...
Deserializes JSON if the content-type matches, otherwise returns the response body as is.
[ "Deserializes", "JSON", "if", "the", "content", "-", "type", "matches", "otherwise", "returns", "the", "response", "body", "as", "is", "." ]
e0da1918b7db18f885734a89f824b9e173cc30a5
https://github.com/tswicegood/Dolt/blob/e0da1918b7db18f885734a89f824b9e173cc30a5/dolt/__init__.py#L80-L96
train
Handles the response from the server.
tswicegood/Dolt
dolt/__init__.py
Dolt.with_body
def with_body(self, body=None, **params): """ Add a body to the request. When `body` is a: - string, it will be used as is. - dict or list of (key, value) pairs, it will be form encoded - None, remove request body - anything else, a TypeError wil...
python
def with_body(self, body=None, **params): """ Add a body to the request. When `body` is a: - string, it will be used as is. - dict or list of (key, value) pairs, it will be form encoded - None, remove request body - anything else, a TypeError wil...
[ "def", "with_body", "(", "self", ",", "body", "=", "None", ",", "*", "*", "params", ")", ":", "if", "isinstance", "(", "body", ",", "(", "tuple", ",", "list", ")", ")", ":", "body", "=", "dict", "(", "body", ")", "if", "params", ":", "# Body must...
Add a body to the request. When `body` is a: - string, it will be used as is. - dict or list of (key, value) pairs, it will be form encoded - None, remove request body - anything else, a TypeError will be raised If `body` is a dict or None ...
[ "Add", "a", "body", "to", "the", "request", "." ]
e0da1918b7db18f885734a89f824b9e173cc30a5
https://github.com/tswicegood/Dolt/blob/e0da1918b7db18f885734a89f824b9e173cc30a5/dolt/__init__.py#L134-L174
train
Add a body to the request.
tswicegood/Dolt
dolt/__init__.py
Dolt.with_json
def with_json(self, data=None, **params): """ Add a json body to the request. :param data: A json string, a dict, or a list of key, value pairs :param params: A dict of key value pairs to JSON encode """ if isinstance(data, (tuple, list)): dat...
python
def with_json(self, data=None, **params): """ Add a json body to the request. :param data: A json string, a dict, or a list of key, value pairs :param params: A dict of key value pairs to JSON encode """ if isinstance(data, (tuple, list)): dat...
[ "def", "with_json", "(", "self", ",", "data", "=", "None", ",", "*", "*", "params", ")", ":", "if", "isinstance", "(", "data", ",", "(", "tuple", ",", "list", ")", ")", ":", "data", "=", "dict", "(", "data", ")", "if", "params", ":", "# data must...
Add a json body to the request. :param data: A json string, a dict, or a list of key, value pairs :param params: A dict of key value pairs to JSON encode
[ "Add", "a", "json", "body", "to", "the", "request", ".", ":", "param", "data", ":", "A", "json", "string", "a", "dict", "or", "a", "list", "of", "key", "value", "pairs", ":", "param", "params", ":", "A", "dict", "of", "key", "value", "pairs", "to",...
e0da1918b7db18f885734a89f824b9e173cc30a5
https://github.com/tswicegood/Dolt/blob/e0da1918b7db18f885734a89f824b9e173cc30a5/dolt/__init__.py#L176-L200
train
Add a json body to the request.
tswicegood/Dolt
dolt/__init__.py
Dolt.with_headers
def with_headers(self, headers=None, **params): """ Add headers to the request. :param headers: A dict, or a list of key, value pairs :param params: A dict of key value pairs """ if isinstance(headers, (tuple, list)): headers = dict(head...
python
def with_headers(self, headers=None, **params): """ Add headers to the request. :param headers: A dict, or a list of key, value pairs :param params: A dict of key value pairs """ if isinstance(headers, (tuple, list)): headers = dict(head...
[ "def", "with_headers", "(", "self", ",", "headers", "=", "None", ",", "*", "*", "params", ")", ":", "if", "isinstance", "(", "headers", ",", "(", "tuple", ",", "list", ")", ")", ":", "headers", "=", "dict", "(", "headers", ")", "if", "params", ":",...
Add headers to the request. :param headers: A dict, or a list of key, value pairs :param params: A dict of key value pairs
[ "Add", "headers", "to", "the", "request", ".", ":", "param", "headers", ":", "A", "dict", "or", "a", "list", "of", "key", "value", "pairs", ":", "param", "params", ":", "A", "dict", "of", "key", "value", "pairs" ]
e0da1918b7db18f885734a89f824b9e173cc30a5
https://github.com/tswicegood/Dolt/blob/e0da1918b7db18f885734a89f824b9e173cc30a5/dolt/__init__.py#L203-L220
train
Add headers to the request.
tswicegood/Dolt
dolt/__init__.py
Dolt.get_url
def get_url(self, *paths, **params): """ Returns the URL for this request. :param paths: Additional URL path parts to add to the request :param params: Additional query parameters to add to the request """ path_stack = self._attribute_stack[:] if paths: ...
python
def get_url(self, *paths, **params): """ Returns the URL for this request. :param paths: Additional URL path parts to add to the request :param params: Additional query parameters to add to the request """ path_stack = self._attribute_stack[:] if paths: ...
[ "def", "get_url", "(", "self", ",", "*", "paths", ",", "*", "*", "params", ")", ":", "path_stack", "=", "self", ".", "_attribute_stack", "[", ":", "]", "if", "paths", ":", "path_stack", ".", "extend", "(", "paths", ")", "u", "=", "self", ".", "_sta...
Returns the URL for this request. :param paths: Additional URL path parts to add to the request :param params: Additional query parameters to add to the request
[ "Returns", "the", "URL", "for", "this", "request", "." ]
e0da1918b7db18f885734a89f824b9e173cc30a5
https://github.com/tswicegood/Dolt/blob/e0da1918b7db18f885734a89f824b9e173cc30a5/dolt/__init__.py#L222-L244
train
Returns the URL for this request.
tswicegood/Dolt
dolt/__init__.py
Dolt._clone
def _clone(self): """ Clones the state of the current operation. The state is cloned so that you can freeze the state at a certain point for re-use. :: >>> cat = dolt.cat >>> cat.get_url() '/cat' >>> o = cat.foo >>> o.get_url...
python
def _clone(self): """ Clones the state of the current operation. The state is cloned so that you can freeze the state at a certain point for re-use. :: >>> cat = dolt.cat >>> cat.get_url() '/cat' >>> o = cat.foo >>> o.get_url...
[ "def", "_clone", "(", "self", ")", ":", "cls", "=", "self", ".", "__class__", "q", "=", "cls", ".", "__new__", "(", "cls", ")", "q", ".", "__dict__", "=", "self", ".", "__dict__", ".", "copy", "(", ")", "q", ".", "_params", "=", "self", ".", "_...
Clones the state of the current operation. The state is cloned so that you can freeze the state at a certain point for re-use. :: >>> cat = dolt.cat >>> cat.get_url() '/cat' >>> o = cat.foo >>> o.get_url() '/cat/foo' ...
[ "Clones", "the", "state", "of", "the", "current", "operation", "." ]
e0da1918b7db18f885734a89f824b9e173cc30a5
https://github.com/tswicegood/Dolt/blob/e0da1918b7db18f885734a89f824b9e173cc30a5/dolt/__init__.py#L246-L271
train
Returns a copy of the current state of the current operation.
robinandeer/puzzle
puzzle/cli/delete.py
delete
def delete(ctx, family_id, individual_id, root): """ Delete a case or individual from the database. If no database was found run puzzle init first. """ root = root or ctx.obj.get('root') or os.path.expanduser("~/.puzzle") if os.path.isfile(root): logger.error("'root' can't be a file") ...
python
def delete(ctx, family_id, individual_id, root): """ Delete a case or individual from the database. If no database was found run puzzle init first. """ root = root or ctx.obj.get('root') or os.path.expanduser("~/.puzzle") if os.path.isfile(root): logger.error("'root' can't be a file") ...
[ "def", "delete", "(", "ctx", ",", "family_id", ",", "individual_id", ",", "root", ")", ":", "root", "=", "root", "or", "ctx", ".", "obj", ".", "get", "(", "'root'", ")", "or", "os", ".", "path", ".", "expanduser", "(", "\"~/.puzzle\"", ")", "if", "...
Delete a case or individual from the database. If no database was found run puzzle init first.
[ "Delete", "a", "case", "or", "individual", "from", "the", "database", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/cli/delete.py#L18-L57
train
Delete a case or individual from the database.
robinandeer/puzzle
puzzle/server/blueprints/variants/views.py
variants
def variants(case_id): """Show all variants for a case.""" filters = parse_filters() values = [value for key, value in iteritems(filters) if not isinstance(value, dict) and key != 'skip'] is_active = any(values) variants, nr_of_variants = app.db.variants( case_id, skip=...
python
def variants(case_id): """Show all variants for a case.""" filters = parse_filters() values = [value for key, value in iteritems(filters) if not isinstance(value, dict) and key != 'skip'] is_active = any(values) variants, nr_of_variants = app.db.variants( case_id, skip=...
[ "def", "variants", "(", "case_id", ")", ":", "filters", "=", "parse_filters", "(", ")", "values", "=", "[", "value", "for", "key", ",", "value", "in", "iteritems", "(", "filters", ")", "if", "not", "isinstance", "(", "value", ",", "dict", ")", "and", ...
Show all variants for a case.
[ "Show", "all", "variants", "for", "a", "case", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/variants/views.py#L16-L54
train
Show all variants for a given case.
robinandeer/puzzle
puzzle/server/blueprints/variants/views.py
variant
def variant(case_id, variant_id): """Show a single variant.""" case_obj = app.db.case(case_id) variant = app.db.variant(case_id, variant_id) if variant is None: return abort(404, "variant not found") comments = app.db.comments(variant_id=variant.md5) template = 'sv_variant.html' if app....
python
def variant(case_id, variant_id): """Show a single variant.""" case_obj = app.db.case(case_id) variant = app.db.variant(case_id, variant_id) if variant is None: return abort(404, "variant not found") comments = app.db.comments(variant_id=variant.md5) template = 'sv_variant.html' if app....
[ "def", "variant", "(", "case_id", ",", "variant_id", ")", ":", "case_obj", "=", "app", ".", "db", ".", "case", "(", "case_id", ")", "variant", "=", "app", ".", "db", ".", "variant", "(", "case_id", ",", "variant_id", ")", "if", "variant", "is", "None...
Show a single variant.
[ "Show", "a", "single", "variant", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/variants/views.py#L58-L68
train
Show a single variant.
robinandeer/puzzle
puzzle/server/blueprints/variants/views.py
parse_filters
def parse_filters(): """Parse variant filters from the request object.""" genes_str = request.args.get('gene_symbol') filters = {} for key in ('frequency', 'cadd', 'sv_len'): try: filters[key] = float(request.args.get(key)) except (ValueError, TypeError): pass ...
python
def parse_filters(): """Parse variant filters from the request object.""" genes_str = request.args.get('gene_symbol') filters = {} for key in ('frequency', 'cadd', 'sv_len'): try: filters[key] = float(request.args.get(key)) except (ValueError, TypeError): pass ...
[ "def", "parse_filters", "(", ")", ":", "genes_str", "=", "request", ".", "args", ".", "get", "(", "'gene_symbol'", ")", "filters", "=", "{", "}", "for", "key", "in", "(", "'frequency'", ",", "'cadd'", ",", "'sv_len'", ")", ":", "try", ":", "filters", ...
Parse variant filters from the request object.
[ "Parse", "variant", "filters", "from", "the", "request", "object", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/variants/views.py#L71-L102
train
Parse variant filters from the request object.
robinandeer/puzzle
puzzle/server/blueprints/variants/views.py
suspects
def suspects(case_id, variant_id): """Pin a variant as a suspect for a given case.""" case_obj = app.db.case(case_id) variant_obj = app.db.variant(case_id, variant_id) app.db.add_suspect(case_obj, variant_obj) return redirect(request.referrer)
python
def suspects(case_id, variant_id): """Pin a variant as a suspect for a given case.""" case_obj = app.db.case(case_id) variant_obj = app.db.variant(case_id, variant_id) app.db.add_suspect(case_obj, variant_obj) return redirect(request.referrer)
[ "def", "suspects", "(", "case_id", ",", "variant_id", ")", ":", "case_obj", "=", "app", ".", "db", ".", "case", "(", "case_id", ")", "variant_obj", "=", "app", ".", "db", ".", "variant", "(", "case_id", ",", "variant_id", ")", "app", ".", "db", ".", ...
Pin a variant as a suspect for a given case.
[ "Pin", "a", "variant", "as", "a", "suspect", "for", "a", "given", "case", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/variants/views.py#L106-L111
train
Pin a variant as a suspect for a given case.
robinandeer/puzzle
puzzle/server/blueprints/variants/views.py
queries
def queries(): """Store a new GEMINI query.""" query = request.form['query'] name = request.form.get('name') app.db.add_gemini_query(name, query) return redirect(request.referrer)
python
def queries(): """Store a new GEMINI query.""" query = request.form['query'] name = request.form.get('name') app.db.add_gemini_query(name, query) return redirect(request.referrer)
[ "def", "queries", "(", ")", ":", "query", "=", "request", ".", "form", "[", "'query'", "]", "name", "=", "request", ".", "form", ".", "get", "(", "'name'", ")", "app", ".", "db", ".", "add_gemini_query", "(", "name", ",", "query", ")", "return", "r...
Store a new GEMINI query.
[ "Store", "a", "new", "GEMINI", "query", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/variants/views.py#L122-L127
train
Store a new GEMINI query.
thautwarm/Redy
Redy/Opt/ConstExpr.py
_constexpr_transform
def _constexpr_transform(fn): """ >>> from Redy.Opt.ConstExpr import constexpr, const, optimize, macro >>> import dis >>> a = 1; b = ""; c = object() >>> x = 1 >>> @optimize >>> def f(y): >>> val1: const[int] = a >>> val2: const = b >>> if constexpr[x is c]: >>> ...
python
def _constexpr_transform(fn): """ >>> from Redy.Opt.ConstExpr import constexpr, const, optimize, macro >>> import dis >>> a = 1; b = ""; c = object() >>> x = 1 >>> @optimize >>> def f(y): >>> val1: const[int] = a >>> val2: const = b >>> if constexpr[x is c]: >>> ...
[ "def", "_constexpr_transform", "(", "fn", ")", ":", "code_string", "=", "inspect", ".", "getsource", "(", "fn", ")", "while", "_s", ".", "match", "(", "code_string", ")", ":", "code_string", "=", "textwrap", ".", "dedent", "(", "code_string", ")", "module"...
>>> from Redy.Opt.ConstExpr import constexpr, const, optimize, macro >>> import dis >>> a = 1; b = ""; c = object() >>> x = 1 >>> @optimize >>> def f(y): >>> val1: const[int] = a >>> val2: const = b >>> if constexpr[x is c]: >>> return val1, y >>> elif con...
[ ">>>", "from", "Redy", ".", "Opt", ".", "ConstExpr", "import", "constexpr", "const", "optimize", "macro", ">>>", "import", "dis", ">>>", "a", "=", "1", ";", "b", "=", ";", "c", "=", "object", "()", ">>>", "x", "=", "1", ">>>", "@optimize", ">>>", "...
8beee5c5f752edfd2754bb1e6b5f4acb016a7770
https://github.com/thautwarm/Redy/blob/8beee5c5f752edfd2754bb1e6b5f4acb016a7770/Redy/Opt/ConstExpr.py#L325-L448
train
Transform a function to a sequence of functions.
jwodder/javaproperties
javaproperties/reading.py
load
def load(fp, object_pairs_hook=dict): """ Parse the contents of the `~io.IOBase.readline`-supporting file-like object ``fp`` as a simple line-oriented ``.properties`` file and return a `dict` of the key-value pairs. ``fp`` may be either a text or binary filehandle, with or without universal new...
python
def load(fp, object_pairs_hook=dict): """ Parse the contents of the `~io.IOBase.readline`-supporting file-like object ``fp`` as a simple line-oriented ``.properties`` file and return a `dict` of the key-value pairs. ``fp`` may be either a text or binary filehandle, with or without universal new...
[ "def", "load", "(", "fp", ",", "object_pairs_hook", "=", "dict", ")", ":", "return", "object_pairs_hook", "(", "(", "k", ",", "v", ")", "for", "k", ",", "v", ",", "_", "in", "parse", "(", "fp", ")", "if", "k", "is", "not", "None", ")" ]
Parse the contents of the `~io.IOBase.readline`-supporting file-like object ``fp`` as a simple line-oriented ``.properties`` file and return a `dict` of the key-value pairs. ``fp`` may be either a text or binary filehandle, with or without universal newlines enabled. If it is a binary filehandle, its ...
[ "Parse", "the", "contents", "of", "the", "~io", ".", "IOBase", ".", "readline", "-", "supporting", "file", "-", "like", "object", "fp", "as", "a", "simple", "line", "-", "oriented", ".", "properties", "file", "and", "return", "a", "dict", "of", "the", ...
8b48f040305217ebeb80c98c4354691bbb01429b
https://github.com/jwodder/javaproperties/blob/8b48f040305217ebeb80c98c4354691bbb01429b/javaproperties/reading.py#L6-L36
train
Loads the contents of the. properties file - like objectfp into a dictionary of key - value pairs.
jwodder/javaproperties
javaproperties/reading.py
loads
def loads(s, object_pairs_hook=dict): """ Parse the contents of the string ``s`` as a simple line-oriented ``.properties`` file and return a `dict` of the key-value pairs. ``s`` may be either a text string or bytes string. If it is a bytes string, its contents are decoded as Latin-1. By defau...
python
def loads(s, object_pairs_hook=dict): """ Parse the contents of the string ``s`` as a simple line-oriented ``.properties`` file and return a `dict` of the key-value pairs. ``s`` may be either a text string or bytes string. If it is a bytes string, its contents are decoded as Latin-1. By defau...
[ "def", "loads", "(", "s", ",", "object_pairs_hook", "=", "dict", ")", ":", "fp", "=", "BytesIO", "(", "s", ")", "if", "isinstance", "(", "s", ",", "binary_type", ")", "else", "StringIO", "(", "s", ")", "return", "load", "(", "fp", ",", "object_pairs_...
Parse the contents of the string ``s`` as a simple line-oriented ``.properties`` file and return a `dict` of the key-value pairs. ``s`` may be either a text string or bytes string. If it is a bytes string, its contents are decoded as Latin-1. By default, the key-value pairs extracted from ``s`` are c...
[ "Parse", "the", "contents", "of", "the", "string", "s", "as", "a", "simple", "line", "-", "oriented", ".", "properties", "file", "and", "return", "a", "dict", "of", "the", "key", "-", "value", "pairs", "." ]
8b48f040305217ebeb80c98c4354691bbb01429b
https://github.com/jwodder/javaproperties/blob/8b48f040305217ebeb80c98c4354691bbb01429b/javaproperties/reading.py#L38-L66
train
Parses the contents of the string s as a simple line - oriented ASCII - 1 file and returns a dict of the key - value pairs.
jwodder/javaproperties
javaproperties/reading.py
parse
def parse(fp): """ Parse the contents of the `~io.IOBase.readline`-supporting file-like object ``fp`` as a simple line-oriented ``.properties`` file and return a generator of ``(key, value, original_lines)`` triples for every entry in ``fp`` (including duplicate keys) in order of occurrence. The th...
python
def parse(fp): """ Parse the contents of the `~io.IOBase.readline`-supporting file-like object ``fp`` as a simple line-oriented ``.properties`` file and return a generator of ``(key, value, original_lines)`` triples for every entry in ``fp`` (including duplicate keys) in order of occurrence. The th...
[ "def", "parse", "(", "fp", ")", ":", "def", "lineiter", "(", ")", ":", "while", "True", ":", "ln", "=", "fp", ".", "readline", "(", ")", "if", "isinstance", "(", "ln", ",", "binary_type", ")", ":", "ln", "=", "ln", ".", "decode", "(", "'iso-8859-...
Parse the contents of the `~io.IOBase.readline`-supporting file-like object ``fp`` as a simple line-oriented ``.properties`` file and return a generator of ``(key, value, original_lines)`` triples for every entry in ``fp`` (including duplicate keys) in order of occurrence. The third element of each tri...
[ "Parse", "the", "contents", "of", "the", "~io", ".", "IOBase", ".", "readline", "-", "supporting", "file", "-", "like", "object", "fp", "as", "a", "simple", "line", "-", "oriented", ".", "properties", "file", "and", "return", "a", "generator", "of", "(",...
8b48f040305217ebeb80c98c4354691bbb01429b
https://github.com/jwodder/javaproperties/blob/8b48f040305217ebeb80c98c4354691bbb01429b/javaproperties/reading.py#L68-L123
train
Parse the contents of the ~io. IOBase. readLine - supportinging file - like objectfp and return a generator of tuples each containing the key value and original_lines of the line in the file.
jwodder/javaproperties
javaproperties/reading.py
unescape
def unescape(field): """ Decode escape sequences in a ``.properties`` key or value. The following escape sequences are recognized:: \\t \\n \\f \\r \\uXXXX \\\\ If a backslash is followed by any other character, the backslash is dropped. In addition, any valid UTF-16 surrogate pairs ...
python
def unescape(field): """ Decode escape sequences in a ``.properties`` key or value. The following escape sequences are recognized:: \\t \\n \\f \\r \\uXXXX \\\\ If a backslash is followed by any other character, the backslash is dropped. In addition, any valid UTF-16 surrogate pairs ...
[ "def", "unescape", "(", "field", ")", ":", "return", "re", ".", "sub", "(", "r'[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]'", ",", "_unsurrogate", ",", "re", ".", "sub", "(", "r'\\\\(u.{0,4}|.)'", ",", "_unesc", ",", "field", ")", ")" ]
Decode escape sequences in a ``.properties`` key or value. The following escape sequences are recognized:: \\t \\n \\f \\r \\uXXXX \\\\ If a backslash is followed by any other character, the backslash is dropped. In addition, any valid UTF-16 surrogate pairs in the string after escape-de...
[ "Decode", "escape", "sequences", "in", "a", ".", "properties", "key", "or", "value", ".", "The", "following", "escape", "sequences", "are", "recognized", "::" ]
8b48f040305217ebeb80c98c4354691bbb01429b
https://github.com/jwodder/javaproperties/blob/8b48f040305217ebeb80c98c4354691bbb01429b/javaproperties/reading.py#L125-L150
train
Unescape a string in a. properties key or value.
TiagoBras/audio-clip-extractor
audioclipextractor/core.py
AudioClipExtractor.extractClips
def extractClips(self, specsFilePathOrStr, outputDir=None, zipOutput=False): """Extract clips according to the specification file or string. Arguments: specsFilePathOrStr (str): Specification file path or string outputDir (str): Location of the extracted clips ...
python
def extractClips(self, specsFilePathOrStr, outputDir=None, zipOutput=False): """Extract clips according to the specification file or string. Arguments: specsFilePathOrStr (str): Specification file path or string outputDir (str): Location of the extracted clips ...
[ "def", "extractClips", "(", "self", ",", "specsFilePathOrStr", ",", "outputDir", "=", "None", ",", "zipOutput", "=", "False", ")", ":", "clips", "=", "SpecsParser", ".", "parse", "(", "specsFilePathOrStr", ")", "# Output to current working directory if no outputDir wa...
Extract clips according to the specification file or string. Arguments: specsFilePathOrStr (str): Specification file path or string outputDir (str): Location of the extracted clips zipOutput (bool): Archive extracted clips' flag Specifications format: ...
[ "Extract", "clips", "according", "to", "the", "specification", "file", "or", "string", ".", "Arguments", ":", "specsFilePathOrStr", "(", "str", ")", ":", "Specification", "file", "path", "or", "string", "outputDir", "(", "str", ")", ":", "Location", "of", "t...
b0dd90266656dcbf7e663b3e174dce4d09e74c32
https://github.com/TiagoBras/audio-clip-extractor/blob/b0dd90266656dcbf7e663b3e174dce4d09e74c32/audioclipextractor/core.py#L35-L80
train
Extract clips according to the specification file or string.
TiagoBras/audio-clip-extractor
audioclipextractor/core.py
AudioClipExtractor._extractClipData
def _extractClipData(self, audioClipSpec, showLogs=False): """Extracts a single clip according to audioClipSpec. Arguments: audioClipSpec (AudioClipSpec): Clip specification showLogs (bool): Show ffmpeg output """ command = [self._ffmpegPath] if not show...
python
def _extractClipData(self, audioClipSpec, showLogs=False): """Extracts a single clip according to audioClipSpec. Arguments: audioClipSpec (AudioClipSpec): Clip specification showLogs (bool): Show ffmpeg output """ command = [self._ffmpegPath] if not show...
[ "def", "_extractClipData", "(", "self", ",", "audioClipSpec", ",", "showLogs", "=", "False", ")", ":", "command", "=", "[", "self", ".", "_ffmpegPath", "]", "if", "not", "showLogs", ":", "command", "+=", "[", "'-nostats'", ",", "'-loglevel'", ",", "'0'", ...
Extracts a single clip according to audioClipSpec. Arguments: audioClipSpec (AudioClipSpec): Clip specification showLogs (bool): Show ffmpeg output
[ "Extracts", "a", "single", "clip", "according", "to", "audioClipSpec", "." ]
b0dd90266656dcbf7e663b3e174dce4d09e74c32
https://github.com/TiagoBras/audio-clip-extractor/blob/b0dd90266656dcbf7e663b3e174dce4d09e74c32/audioclipextractor/core.py#L82-L114
train
Extracts a single clip according to audioClipSpec.
robinandeer/puzzle
puzzle/plugins/sql/mixins/actions/phenotype.py
PhenotypeActions.add_phenotype
def add_phenotype(self, ind_obj, phenotype_id): """Add a phenotype term to the case.""" if phenotype_id.startswith('HP:') or len(phenotype_id) == 7: logger.debug('querying on HPO term') hpo_results = phizz.query_hpo([phenotype_id]) else: logger.debug('querying...
python
def add_phenotype(self, ind_obj, phenotype_id): """Add a phenotype term to the case.""" if phenotype_id.startswith('HP:') or len(phenotype_id) == 7: logger.debug('querying on HPO term') hpo_results = phizz.query_hpo([phenotype_id]) else: logger.debug('querying...
[ "def", "add_phenotype", "(", "self", ",", "ind_obj", ",", "phenotype_id", ")", ":", "if", "phenotype_id", ".", "startswith", "(", "'HP:'", ")", "or", "len", "(", "phenotype_id", ")", "==", "7", ":", "logger", ".", "debug", "(", "'querying on HPO term'", ")...
Add a phenotype term to the case.
[ "Add", "a", "phenotype", "term", "to", "the", "case", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/sql/mixins/actions/phenotype.py#L13-L39
train
Add a phenotype term to the case.