id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
39,100
Cadasta/django-tutelary
tutelary/mixins.py
APIPermissionRequiredMixin.check_permissions
def check_permissions(self, request): """Permission checking for DRF.""" objs = [None] if hasattr(self, 'get_perms_objects'): objs = self.get_perms_objects() else: if hasattr(self, 'get_object'): try: objs = [self.get_object()] ...
python
def check_permissions(self, request): """Permission checking for DRF.""" objs = [None] if hasattr(self, 'get_perms_objects'): objs = self.get_perms_objects() else: if hasattr(self, 'get_object'): try: objs = [self.get_object()] ...
[ "def", "check_permissions", "(", "self", ",", "request", ")", ":", "objs", "=", "[", "None", "]", "if", "hasattr", "(", "self", ",", "'get_perms_objects'", ")", ":", "objs", "=", "self", ".", "get_perms_objects", "(", ")", "else", ":", "if", "hasattr", ...
Permission checking for DRF.
[ "Permission", "checking", "for", "DRF", "." ]
66bb05de7098777c0a383410c287bf48433cde87
https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/mixins.py#L146-L180
39,101
jaredLunde/redis_structures
redis_structures/__init__.py
BaseRedisStructure._hashed_key
def _hashed_key(self): """ Returns 16-digit numeric hash of the redis key """ return abs(int(hashlib.md5( self.key_prefix.encode('utf8') ).hexdigest(), 16)) % (10 ** ( self._size_mod if hasattr(self, '_size_mod') else 5))
python
def _hashed_key(self): """ Returns 16-digit numeric hash of the redis key """ return abs(int(hashlib.md5( self.key_prefix.encode('utf8') ).hexdigest(), 16)) % (10 ** ( self._size_mod if hasattr(self, '_size_mod') else 5))
[ "def", "_hashed_key", "(", "self", ")", ":", "return", "abs", "(", "int", "(", "hashlib", ".", "md5", "(", "self", ".", "key_prefix", ".", "encode", "(", "'utf8'", ")", ")", ".", "hexdigest", "(", ")", ",", "16", ")", ")", "%", "(", "10", "**", ...
Returns 16-digit numeric hash of the redis key
[ "Returns", "16", "-", "digit", "numeric", "hash", "of", "the", "redis", "key" ]
b9cce5f5c85db5e12c292633ff8d04e3ae053294
https://github.com/jaredLunde/redis_structures/blob/b9cce5f5c85db5e12c292633ff8d04e3ae053294/redis_structures/__init__.py#L165-L170
39,102
jaredLunde/redis_structures
redis_structures/__init__.py
RedisMap.update
def update(self, data): """ Set given keys to their respective values @data: #dict or :class:RedisMap of |{key: value}| entries to set """ if not data: return _rk, _dumps = self.get_key, self._dumps data = self._client.mset({ _rk(key): _dumps(v...
python
def update(self, data): """ Set given keys to their respective values @data: #dict or :class:RedisMap of |{key: value}| entries to set """ if not data: return _rk, _dumps = self.get_key, self._dumps data = self._client.mset({ _rk(key): _dumps(v...
[ "def", "update", "(", "self", ",", "data", ")", ":", "if", "not", "data", ":", "return", "_rk", ",", "_dumps", "=", "self", ".", "get_key", ",", "self", ".", "_dumps", "data", "=", "self", ".", "_client", ".", "mset", "(", "{", "_rk", "(", "key",...
Set given keys to their respective values @data: #dict or :class:RedisMap of |{key: value}| entries to set
[ "Set", "given", "keys", "to", "their", "respective", "values" ]
b9cce5f5c85db5e12c292633ff8d04e3ae053294
https://github.com/jaredLunde/redis_structures/blob/b9cce5f5c85db5e12c292633ff8d04e3ae053294/redis_structures/__init__.py#L417-L426
39,103
jaredLunde/redis_structures
redis_structures/__init__.py
RedisMap.expire_at
def expire_at(self, key, _time): """ Sets the expiration time of @key to @_time @_time: absolute Unix timestamp (seconds since January 1, 1970) """ return self._client.expireat(self.get_key(key), round(_time))
python
def expire_at(self, key, _time): """ Sets the expiration time of @key to @_time @_time: absolute Unix timestamp (seconds since January 1, 1970) """ return self._client.expireat(self.get_key(key), round(_time))
[ "def", "expire_at", "(", "self", ",", "key", ",", "_time", ")", ":", "return", "self", ".", "_client", ".", "expireat", "(", "self", ".", "get_key", "(", "key", ")", ",", "round", "(", "_time", ")", ")" ]
Sets the expiration time of @key to @_time @_time: absolute Unix timestamp (seconds since January 1, 1970)
[ "Sets", "the", "expiration", "time", "of" ]
b9cce5f5c85db5e12c292633ff8d04e3ae053294
https://github.com/jaredLunde/redis_structures/blob/b9cce5f5c85db5e12c292633ff8d04e3ae053294/redis_structures/__init__.py#L453-L457
39,104
jaredLunde/redis_structures
redis_structures/__init__.py
RedisDict._bucket_key
def _bucket_key(self): """ Returns hash bucket key for the redis key """ return "{}.size.{}".format( self.prefix, (self._hashed_key//1000) if self._hashed_key > 1000 else self._hashed_key)
python
def _bucket_key(self): """ Returns hash bucket key for the redis key """ return "{}.size.{}".format( self.prefix, (self._hashed_key//1000) if self._hashed_key > 1000 else self._hashed_key)
[ "def", "_bucket_key", "(", "self", ")", ":", "return", "\"{}.size.{}\"", ".", "format", "(", "self", ".", "prefix", ",", "(", "self", ".", "_hashed_key", "//", "1000", ")", "if", "self", ".", "_hashed_key", ">", "1000", "else", "self", ".", "_hashed_key"...
Returns hash bucket key for the redis key
[ "Returns", "hash", "bucket", "key", "for", "the", "redis", "key" ]
b9cce5f5c85db5e12c292633ff8d04e3ae053294
https://github.com/jaredLunde/redis_structures/blob/b9cce5f5c85db5e12c292633ff8d04e3ae053294/redis_structures/__init__.py#L708-L712
39,105
jaredLunde/redis_structures
redis_structures/__init__.py
RedisList.reverse_iter
def reverse_iter(self, start=None, stop=None, count=2000): """ -> yields items of the list in reverse """ cursor = '0' count = 1000 start = start if start is not None else (-1 * count) stop = stop if stop is not None else -1 _loads = self._loads while cursor: ...
python
def reverse_iter(self, start=None, stop=None, count=2000): """ -> yields items of the list in reverse """ cursor = '0' count = 1000 start = start if start is not None else (-1 * count) stop = stop if stop is not None else -1 _loads = self._loads while cursor: ...
[ "def", "reverse_iter", "(", "self", ",", "start", "=", "None", ",", "stop", "=", "None", ",", "count", "=", "2000", ")", ":", "cursor", "=", "'0'", "count", "=", "1000", "start", "=", "start", "if", "start", "is", "not", "None", "else", "(", "-", ...
-> yields items of the list in reverse
[ "-", ">", "yields", "items", "of", "the", "list", "in", "reverse" ]
b9cce5f5c85db5e12c292633ff8d04e3ae053294
https://github.com/jaredLunde/redis_structures/blob/b9cce5f5c85db5e12c292633ff8d04e3ae053294/redis_structures/__init__.py#L1350-L1362
39,106
jaredLunde/redis_structures
redis_structures/__init__.py
RedisList.pop
def pop(self, index=None): """ Removes and returns the item at @index or from the end of the list -> item at @index """ if index is None: return self._loads(self._client.rpop(self.key_prefix)) elif index == 0: return self._loads(self._client.lpop(self....
python
def pop(self, index=None): """ Removes and returns the item at @index or from the end of the list -> item at @index """ if index is None: return self._loads(self._client.rpop(self.key_prefix)) elif index == 0: return self._loads(self._client.lpop(self....
[ "def", "pop", "(", "self", ",", "index", "=", "None", ")", ":", "if", "index", "is", "None", ":", "return", "self", ".", "_loads", "(", "self", ".", "_client", ".", "rpop", "(", "self", ".", "key_prefix", ")", ")", "elif", "index", "==", "0", ":"...
Removes and returns the item at @index or from the end of the list -> item at @index
[ "Removes", "and", "returns", "the", "item", "at" ]
b9cce5f5c85db5e12c292633ff8d04e3ae053294
https://github.com/jaredLunde/redis_structures/blob/b9cce5f5c85db5e12c292633ff8d04e3ae053294/redis_structures/__init__.py#L1387-L1400
39,107
jaredLunde/redis_structures
redis_structures/__init__.py
RedisList.count
def count(self, value): """ Not recommended for use on large lists due to time complexity, but it works. Use with caution. -> #int number of occurences of @value """ cnt = 0 for x in self: if x == value: cnt += 1 return cnt
python
def count(self, value): """ Not recommended for use on large lists due to time complexity, but it works. Use with caution. -> #int number of occurences of @value """ cnt = 0 for x in self: if x == value: cnt += 1 return cnt
[ "def", "count", "(", "self", ",", "value", ")", ":", "cnt", "=", "0", "for", "x", "in", "self", ":", "if", "x", "==", "value", ":", "cnt", "+=", "1", "return", "cnt" ]
Not recommended for use on large lists due to time complexity, but it works. Use with caution. -> #int number of occurences of @value
[ "Not", "recommended", "for", "use", "on", "large", "lists", "due", "to", "time", "complexity", "but", "it", "works", ".", "Use", "with", "caution", "." ]
b9cce5f5c85db5e12c292633ff8d04e3ae053294
https://github.com/jaredLunde/redis_structures/blob/b9cce5f5c85db5e12c292633ff8d04e3ae053294/redis_structures/__init__.py#L1417-L1427
39,108
jaredLunde/redis_structures
redis_structures/__init__.py
RedisList.push
def push(self, *items): """ Prepends the list with @items -> #int length of list after operation """ if self.serialized: items = list(map(self._dumps, items)) return self._client.lpush(self.key_prefix, *items)
python
def push(self, *items): """ Prepends the list with @items -> #int length of list after operation """ if self.serialized: items = list(map(self._dumps, items)) return self._client.lpush(self.key_prefix, *items)
[ "def", "push", "(", "self", ",", "*", "items", ")", ":", "if", "self", ".", "serialized", ":", "items", "=", "list", "(", "map", "(", "self", ".", "_dumps", ",", "items", ")", ")", "return", "self", ".", "_client", ".", "lpush", "(", "self", ".",...
Prepends the list with @items -> #int length of list after operation
[ "Prepends", "the", "list", "with" ]
b9cce5f5c85db5e12c292633ff8d04e3ae053294
https://github.com/jaredLunde/redis_structures/blob/b9cce5f5c85db5e12c292633ff8d04e3ae053294/redis_structures/__init__.py#L1429-L1435
39,109
jaredLunde/redis_structures
redis_structures/__init__.py
RedisList.index
def index(self, item): """ Not recommended for use on large lists due to time complexity, but it works -> #int list index of @item """ for i, x in enumerate(self.iter()): if x == item: return i return None
python
def index(self, item): """ Not recommended for use on large lists due to time complexity, but it works -> #int list index of @item """ for i, x in enumerate(self.iter()): if x == item: return i return None
[ "def", "index", "(", "self", ",", "item", ")", ":", "for", "i", ",", "x", "in", "enumerate", "(", "self", ".", "iter", "(", ")", ")", ":", "if", "x", "==", "item", ":", "return", "i", "return", "None" ]
Not recommended for use on large lists due to time complexity, but it works -> #int list index of @item
[ "Not", "recommended", "for", "use", "on", "large", "lists", "due", "to", "time", "complexity", "but", "it", "works" ]
b9cce5f5c85db5e12c292633ff8d04e3ae053294
https://github.com/jaredLunde/redis_structures/blob/b9cce5f5c85db5e12c292633ff8d04e3ae053294/redis_structures/__init__.py#L1437-L1446
39,110
jaredLunde/redis_structures
redis_structures/__init__.py
RedisSet.intersection
def intersection(self, *others): """ Calculates the intersection of all the given sets, that is, members which are present in all given sets. @others: one or several #str keynames or :class:RedisSet objects -> #set of resulting intersection between @others and this set ...
python
def intersection(self, *others): """ Calculates the intersection of all the given sets, that is, members which are present in all given sets. @others: one or several #str keynames or :class:RedisSet objects -> #set of resulting intersection between @others and this set ...
[ "def", "intersection", "(", "self", ",", "*", "others", ")", ":", "others", "=", "self", ".", "_typesafe_others", "(", "others", ")", "return", "set", "(", "map", "(", "self", ".", "_loads", ",", "self", ".", "_client", ".", "sinter", "(", "self", "....
Calculates the intersection of all the given sets, that is, members which are present in all given sets. @others: one or several #str keynames or :class:RedisSet objects -> #set of resulting intersection between @others and this set
[ "Calculates", "the", "intersection", "of", "all", "the", "given", "sets", "that", "is", "members", "which", "are", "present", "in", "all", "given", "sets", "." ]
b9cce5f5c85db5e12c292633ff8d04e3ae053294
https://github.com/jaredLunde/redis_structures/blob/b9cce5f5c85db5e12c292633ff8d04e3ae053294/redis_structures/__init__.py#L1741-L1751
39,111
jaredLunde/redis_structures
redis_structures/__init__.py
RedisSortedSet.rank
def rank(self, member): """ Gets the ASC rank of @member from the sorted set, that is, lower scores have lower ranks """ if self.reversed: return self._client.zrevrank(self.key_prefix, self._dumps(member)) return self._client.zrank(self.key_prefix, self._dumps(mem...
python
def rank(self, member): """ Gets the ASC rank of @member from the sorted set, that is, lower scores have lower ranks """ if self.reversed: return self._client.zrevrank(self.key_prefix, self._dumps(member)) return self._client.zrank(self.key_prefix, self._dumps(mem...
[ "def", "rank", "(", "self", ",", "member", ")", ":", "if", "self", ".", "reversed", ":", "return", "self", ".", "_client", ".", "zrevrank", "(", "self", ".", "key_prefix", ",", "self", ".", "_dumps", "(", "member", ")", ")", "return", "self", ".", ...
Gets the ASC rank of @member from the sorted set, that is, lower scores have lower ranks
[ "Gets", "the", "ASC", "rank", "of" ]
b9cce5f5c85db5e12c292633ff8d04e3ae053294
https://github.com/jaredLunde/redis_structures/blob/b9cce5f5c85db5e12c292633ff8d04e3ae053294/redis_structures/__init__.py#L2102-L2108
39,112
PhracturedBlue/asterisk_mbox
asterisk_mbox/utils.py
recv_blocking
def recv_blocking(conn, msglen): """Recieve data until msglen bytes have been received.""" msg = b'' while len(msg) < msglen: maxlen = msglen-len(msg) if maxlen > 4096: maxlen = 4096 tmpmsg = conn.recv(maxlen) if not tmpmsg: raise RuntimeError("socket ...
python
def recv_blocking(conn, msglen): """Recieve data until msglen bytes have been received.""" msg = b'' while len(msg) < msglen: maxlen = msglen-len(msg) if maxlen > 4096: maxlen = 4096 tmpmsg = conn.recv(maxlen) if not tmpmsg: raise RuntimeError("socket ...
[ "def", "recv_blocking", "(", "conn", ",", "msglen", ")", ":", "msg", "=", "b''", "while", "len", "(", "msg", ")", "<", "msglen", ":", "maxlen", "=", "msglen", "-", "len", "(", "msg", ")", "if", "maxlen", ">", "4096", ":", "maxlen", "=", "4096", "...
Recieve data until msglen bytes have been received.
[ "Recieve", "data", "until", "msglen", "bytes", "have", "been", "received", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/utils.py#L52-L65
39,113
PhracturedBlue/asterisk_mbox
asterisk_mbox/utils.py
compare_password
def compare_password(expected, actual): """Compare two 64byte encoded passwords.""" if expected == actual: return True, "OK" msg = [] ver_exp = expected[-8:].rstrip() ver_act = actual[-8:].rstrip() if expected[:-8] != actual[:-8]: msg.append("Password mismatch") if ver_exp !...
python
def compare_password(expected, actual): """Compare two 64byte encoded passwords.""" if expected == actual: return True, "OK" msg = [] ver_exp = expected[-8:].rstrip() ver_act = actual[-8:].rstrip() if expected[:-8] != actual[:-8]: msg.append("Password mismatch") if ver_exp !...
[ "def", "compare_password", "(", "expected", ",", "actual", ")", ":", "if", "expected", "==", "actual", ":", "return", "True", ",", "\"OK\"", "msg", "=", "[", "]", "ver_exp", "=", "expected", "[", "-", "8", ":", "]", ".", "rstrip", "(", ")", "ver_act"...
Compare two 64byte encoded passwords.
[ "Compare", "two", "64byte", "encoded", "passwords", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/utils.py#L74-L87
39,114
PhracturedBlue/asterisk_mbox
asterisk_mbox/utils.py
encode_to_sha
def encode_to_sha(msg): """coerce numeric list inst sha-looking bytearray""" if isinstance(msg, str): msg = msg.encode('utf-8') return (codecs.encode(msg, "hex_codec") + (b'00' * 32))[:64]
python
def encode_to_sha(msg): """coerce numeric list inst sha-looking bytearray""" if isinstance(msg, str): msg = msg.encode('utf-8') return (codecs.encode(msg, "hex_codec") + (b'00' * 32))[:64]
[ "def", "encode_to_sha", "(", "msg", ")", ":", "if", "isinstance", "(", "msg", ",", "str", ")", ":", "msg", "=", "msg", ".", "encode", "(", "'utf-8'", ")", "return", "(", "codecs", ".", "encode", "(", "msg", ",", "\"hex_codec\"", ")", "+", "(", "b'0...
coerce numeric list inst sha-looking bytearray
[ "coerce", "numeric", "list", "inst", "sha", "-", "looking", "bytearray" ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/utils.py#L90-L94
39,115
PhracturedBlue/asterisk_mbox
asterisk_mbox/utils.py
decode_from_sha
def decode_from_sha(sha): """convert coerced sha back into numeric list""" if isinstance(sha, str): sha = sha.encode('utf-8') return codecs.decode(re.sub(rb'(00)*$', b'', sha), "hex_codec")
python
def decode_from_sha(sha): """convert coerced sha back into numeric list""" if isinstance(sha, str): sha = sha.encode('utf-8') return codecs.decode(re.sub(rb'(00)*$', b'', sha), "hex_codec")
[ "def", "decode_from_sha", "(", "sha", ")", ":", "if", "isinstance", "(", "sha", ",", "str", ")", ":", "sha", "=", "sha", ".", "encode", "(", "'utf-8'", ")", "return", "codecs", ".", "decode", "(", "re", ".", "sub", "(", "rb'(00)*$'", ",", "b''", ",...
convert coerced sha back into numeric list
[ "convert", "coerced", "sha", "back", "into", "numeric", "list" ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/utils.py#L97-L101
39,116
jplusplus/statscraper
statscraper/scrapers/PXWebScraper.py
PXWeb._api_path
def _api_path(self, item): """Get the API path for the current cursor position.""" if self.base_url is None: raise NotImplementedError("base_url not set") path = "/".join([x.blob["id"] for x in item.path]) return "/".join([self.base_url, path])
python
def _api_path(self, item): """Get the API path for the current cursor position.""" if self.base_url is None: raise NotImplementedError("base_url not set") path = "/".join([x.blob["id"] for x in item.path]) return "/".join([self.base_url, path])
[ "def", "_api_path", "(", "self", ",", "item", ")", ":", "if", "self", ".", "base_url", "is", "None", ":", "raise", "NotImplementedError", "(", "\"base_url not set\"", ")", "path", "=", "\"/\"", ".", "join", "(", "[", "x", ".", "blob", "[", "\"id\"", "]...
Get the API path for the current cursor position.
[ "Get", "the", "API", "path", "for", "the", "current", "cursor", "position", "." ]
932ec048b23d15b3dbdaf829facc55fd78ec0109
https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/PXWebScraper.py#L31-L36
39,117
pauleveritt/kaybee
kaybee/plugins/references/handlers.py
register_references
def register_references(kb_app: kb, sphinx_app: Sphinx, sphinx_env: BuildEnvironment, docnames: List[str]): """ Walk the registry and add sphinx directives """ references: ReferencesContainer = sphinx_app.env.references for name, klas...
python
def register_references(kb_app: kb, sphinx_app: Sphinx, sphinx_env: BuildEnvironment, docnames: List[str]): """ Walk the registry and add sphinx directives """ references: ReferencesContainer = sphinx_app.env.references for name, klas...
[ "def", "register_references", "(", "kb_app", ":", "kb", ",", "sphinx_app", ":", "Sphinx", ",", "sphinx_env", ":", "BuildEnvironment", ",", "docnames", ":", "List", "[", "str", "]", ")", ":", "references", ":", "ReferencesContainer", "=", "sphinx_app", ".", "...
Walk the registry and add sphinx directives
[ "Walk", "the", "registry", "and", "add", "sphinx", "directives" ]
a00a718aaaa23b2d12db30dfacb6b2b6ec84459c
https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/references/handlers.py#L25-L37
39,118
invinst/ResponseBot
responsebot/listeners/responsebot_listener.py
ResponseBotListener.register_handlers
def register_handlers(self, handler_classes): """ Create handlers from discovered handler classes :param handler_classes: List of :class:`~responsebot.handlers.base.BaseTweetHandler`'s derived classes """ for handler_class in handler_classes: self.handlers.append(han...
python
def register_handlers(self, handler_classes): """ Create handlers from discovered handler classes :param handler_classes: List of :class:`~responsebot.handlers.base.BaseTweetHandler`'s derived classes """ for handler_class in handler_classes: self.handlers.append(han...
[ "def", "register_handlers", "(", "self", ",", "handler_classes", ")", ":", "for", "handler_class", "in", "handler_classes", ":", "self", ".", "handlers", ".", "append", "(", "handler_class", "(", "client", "=", "self", ".", "client", ")", ")", "logging", "."...
Create handlers from discovered handler classes :param handler_classes: List of :class:`~responsebot.handlers.base.BaseTweetHandler`'s derived classes
[ "Create", "handlers", "from", "discovered", "handler", "classes" ]
a6b1a431a343007f7ae55a193e432a61af22253f
https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/listeners/responsebot_listener.py#L23-L33
39,119
invinst/ResponseBot
responsebot/listeners/responsebot_listener.py
ResponseBotListener.get_merged_filter
def get_merged_filter(self): """ Return merged filter from list of handlers :return: merged filter :rtype: :class:`~responsebot.models.TweetFilter` """ track = set() follow = set() for handler in self.handlers: track.update(handler.filter.tra...
python
def get_merged_filter(self): """ Return merged filter from list of handlers :return: merged filter :rtype: :class:`~responsebot.models.TweetFilter` """ track = set() follow = set() for handler in self.handlers: track.update(handler.filter.tra...
[ "def", "get_merged_filter", "(", "self", ")", ":", "track", "=", "set", "(", ")", "follow", "=", "set", "(", ")", "for", "handler", "in", "self", ".", "handlers", ":", "track", ".", "update", "(", "handler", ".", "filter", ".", "track", ")", "follow"...
Return merged filter from list of handlers :return: merged filter :rtype: :class:`~responsebot.models.TweetFilter`
[ "Return", "merged", "filter", "from", "list", "of", "handlers" ]
a6b1a431a343007f7ae55a193e432a61af22253f
https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/listeners/responsebot_listener.py#L75-L89
39,120
MacHu-GWU/crawlib-project
crawlib/util.py
get_domain
def get_domain(url): """ Get domain part of an url. For example: https://www.python.org/doc/ -> https://www.python.org """ parse_result = urlparse(url) domain = "{schema}://{netloc}".format( schema=parse_result.scheme, netloc=parse_result.netloc) return domain
python
def get_domain(url): """ Get domain part of an url. For example: https://www.python.org/doc/ -> https://www.python.org """ parse_result = urlparse(url) domain = "{schema}://{netloc}".format( schema=parse_result.scheme, netloc=parse_result.netloc) return domain
[ "def", "get_domain", "(", "url", ")", ":", "parse_result", "=", "urlparse", "(", "url", ")", "domain", "=", "\"{schema}://{netloc}\"", ".", "format", "(", "schema", "=", "parse_result", ".", "scheme", ",", "netloc", "=", "parse_result", ".", "netloc", ")", ...
Get domain part of an url. For example: https://www.python.org/doc/ -> https://www.python.org
[ "Get", "domain", "part", "of", "an", "url", "." ]
241516f2a7a0a32c692f7af35a1f44064e8ce1ab
https://github.com/MacHu-GWU/crawlib-project/blob/241516f2a7a0a32c692f7af35a1f44064e8ce1ab/crawlib/util.py#L24-L33
39,121
MacHu-GWU/crawlib-project
crawlib/util.py
join_all
def join_all(domain, *parts): """ Join all url components. Example:: >>> join_all("https://www.apple.com", "iphone") https://www.apple.com/iphone :param domain: Domain parts, example: https://www.python.org :param parts: Other parts, example: "/doc", "/py27" :return: url "...
python
def join_all(domain, *parts): """ Join all url components. Example:: >>> join_all("https://www.apple.com", "iphone") https://www.apple.com/iphone :param domain: Domain parts, example: https://www.python.org :param parts: Other parts, example: "/doc", "/py27" :return: url "...
[ "def", "join_all", "(", "domain", ",", "*", "parts", ")", ":", "l", "=", "list", "(", ")", "if", "domain", ".", "endswith", "(", "\"/\"", ")", ":", "domain", "=", "domain", "[", ":", "-", "1", "]", "l", ".", "append", "(", "domain", ")", "for",...
Join all url components. Example:: >>> join_all("https://www.apple.com", "iphone") https://www.apple.com/iphone :param domain: Domain parts, example: https://www.python.org :param parts: Other parts, example: "/doc", "/py27" :return: url
[ "Join", "all", "url", "components", "." ]
241516f2a7a0a32c692f7af35a1f44064e8ce1ab
https://github.com/MacHu-GWU/crawlib-project/blob/241516f2a7a0a32c692f7af35a1f44064e8ce1ab/crawlib/util.py#L36-L60
39,122
nicferrier/md
src/mdlib/pull.py
_list_remote
def _list_remote(store, maildir, verbose=False): """List the a maildir. store is an abstract representation of the source maildir. maildir is the local maildir to which mail will be pulled. This is a generator for a reason. Because of the way ssh multi-mastering works a single open TCP connectio...
python
def _list_remote(store, maildir, verbose=False): """List the a maildir. store is an abstract representation of the source maildir. maildir is the local maildir to which mail will be pulled. This is a generator for a reason. Because of the way ssh multi-mastering works a single open TCP connectio...
[ "def", "_list_remote", "(", "store", ",", "maildir", ",", "verbose", "=", "False", ")", ":", "# This command produces a list of all files in the maildir like:", "# base-filename timestamp container-directory", "command", "=", "\"\"\"echo {maildir}/{{cur,new}} | tr ' ' '\\\\n' | whi...
List the a maildir. store is an abstract representation of the source maildir. maildir is the local maildir to which mail will be pulled. This is a generator for a reason. Because of the way ssh multi-mastering works a single open TCP connection allows multiple virtual ssh connections. So the en...
[ "List", "the", "a", "maildir", "." ]
302ca8882dae060fb15bd5ae470d8e661fb67ec4
https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/pull.py#L96-L120
39,123
nicferrier/md
src/mdlib/pull.py
sshpull
def sshpull(host, maildir, localmaildir, noop=False, verbose=False, filterfile=None): """Pull a remote maildir to the local one. """ store = _SSHStore(host, maildir) _pull(store, localmaildir, noop, verbose, filterfile)
python
def sshpull(host, maildir, localmaildir, noop=False, verbose=False, filterfile=None): """Pull a remote maildir to the local one. """ store = _SSHStore(host, maildir) _pull(store, localmaildir, noop, verbose, filterfile)
[ "def", "sshpull", "(", "host", ",", "maildir", ",", "localmaildir", ",", "noop", "=", "False", ",", "verbose", "=", "False", ",", "filterfile", "=", "None", ")", ":", "store", "=", "_SSHStore", "(", "host", ",", "maildir", ")", "_pull", "(", "store", ...
Pull a remote maildir to the local one.
[ "Pull", "a", "remote", "maildir", "to", "the", "local", "one", "." ]
302ca8882dae060fb15bd5ae470d8e661fb67ec4
https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/pull.py#L122-L126
39,124
nicferrier/md
src/mdlib/pull.py
filepull
def filepull(maildir, localmaildir, noop=False, verbose=False, filterfile=None): """Pull one local maildir into another. The source need not be an md folder (it need not have a store). In this case filepull is kind of an import. """ store = _Store(maildir) _pull(store, localmaildir, noop, verbo...
python
def filepull(maildir, localmaildir, noop=False, verbose=False, filterfile=None): """Pull one local maildir into another. The source need not be an md folder (it need not have a store). In this case filepull is kind of an import. """ store = _Store(maildir) _pull(store, localmaildir, noop, verbo...
[ "def", "filepull", "(", "maildir", ",", "localmaildir", ",", "noop", "=", "False", ",", "verbose", "=", "False", ",", "filterfile", "=", "None", ")", ":", "store", "=", "_Store", "(", "maildir", ")", "_pull", "(", "store", ",", "localmaildir", ",", "no...
Pull one local maildir into another. The source need not be an md folder (it need not have a store). In this case filepull is kind of an import.
[ "Pull", "one", "local", "maildir", "into", "another", "." ]
302ca8882dae060fb15bd5ae470d8e661fb67ec4
https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/pull.py#L128-L135
39,125
nicferrier/md
src/mdlib/pull.py
_filter
def _filter(msgdata, mailparser, mdfolder, mailfilters): """Filter msgdata by mailfilters""" if mailfilters: for f in mailfilters: msg = mailparser.parse(StringIO(msgdata)) rule = f(msg, folder=mdfolder) if rule: yield rule return
python
def _filter(msgdata, mailparser, mdfolder, mailfilters): """Filter msgdata by mailfilters""" if mailfilters: for f in mailfilters: msg = mailparser.parse(StringIO(msgdata)) rule = f(msg, folder=mdfolder) if rule: yield rule return
[ "def", "_filter", "(", "msgdata", ",", "mailparser", ",", "mdfolder", ",", "mailfilters", ")", ":", "if", "mailfilters", ":", "for", "f", "in", "mailfilters", ":", "msg", "=", "mailparser", ".", "parse", "(", "StringIO", "(", "msgdata", ")", ")", "rule",...
Filter msgdata by mailfilters
[ "Filter", "msgdata", "by", "mailfilters" ]
302ca8882dae060fb15bd5ae470d8e661fb67ec4
https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/pull.py#L144-L152
39,126
nicferrier/md
src/mdlib/pull.py
_SSHStore.cmd
def cmd(self, cmd, verbose=False): """Executes the specified command on the remote host. The cmd must be format safe, this means { and } must be doubled, thusly: echo /var/local/maildir/{{cur,new}} the cmd can include the format word 'maildir' to be replaced by self.director...
python
def cmd(self, cmd, verbose=False): """Executes the specified command on the remote host. The cmd must be format safe, this means { and } must be doubled, thusly: echo /var/local/maildir/{{cur,new}} the cmd can include the format word 'maildir' to be replaced by self.director...
[ "def", "cmd", "(", "self", ",", "cmd", ",", "verbose", "=", "False", ")", ":", "command", "=", "cmd", ".", "format", "(", "maildir", "=", "self", ".", "directory", ")", "if", "verbose", ":", "print", "(", "command", ")", "p", "=", "Popen", "(", "...
Executes the specified command on the remote host. The cmd must be format safe, this means { and } must be doubled, thusly: echo /var/local/maildir/{{cur,new}} the cmd can include the format word 'maildir' to be replaced by self.directory. eg: echo {maildir}/{{cur,new}}
[ "Executes", "the", "specified", "command", "on", "the", "remote", "host", "." ]
302ca8882dae060fb15bd5ae470d8e661fb67ec4
https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/pull.py#L37-L59
39,127
sharibarboza/py_zap
py_zap/search.py
SearchDaily.fetch_result
def fetch_result(self): """Return a list of urls for each search result.""" results = self.soup.find_all('div', {'class': 'container container-small'}) href = None is_match = False i = 0 while i < len(results) and not is_match: result = results[i] ...
python
def fetch_result(self): """Return a list of urls for each search result.""" results = self.soup.find_all('div', {'class': 'container container-small'}) href = None is_match = False i = 0 while i < len(results) and not is_match: result = results[i] ...
[ "def", "fetch_result", "(", "self", ")", ":", "results", "=", "self", ".", "soup", ".", "find_all", "(", "'div'", ",", "{", "'class'", ":", "'container container-small'", "}", ")", "href", "=", "None", "is_match", "=", "False", "i", "=", "0", "while", ...
Return a list of urls for each search result.
[ "Return", "a", "list", "of", "urls", "for", "each", "search", "result", "." ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/search.py#L40-L64
39,128
sharibarboza/py_zap
py_zap/search.py
SearchDaily._filter_results
def _filter_results(self, result, anchor): """Filter search results by checking category titles and dates""" valid = True try: cat_tag = result.find('a', {'rel': 'category tag'}).string title = anchor.string.lower() date_tag = result.find('time').string ...
python
def _filter_results(self, result, anchor): """Filter search results by checking category titles and dates""" valid = True try: cat_tag = result.find('a', {'rel': 'category tag'}).string title = anchor.string.lower() date_tag = result.find('time').string ...
[ "def", "_filter_results", "(", "self", ",", "result", ",", "anchor", ")", ":", "valid", "=", "True", "try", ":", "cat_tag", "=", "result", ".", "find", "(", "'a'", ",", "{", "'rel'", ":", "'category tag'", "}", ")", ".", "string", "title", "=", "anch...
Filter search results by checking category titles and dates
[ "Filter", "search", "results", "by", "checking", "category", "titles", "and", "dates" ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/search.py#L66-L86
39,129
sharibarboza/py_zap
py_zap/search.py
SearchDaily._build_url
def _build_url(self): """Build url based on searching by date or by show.""" url_params = [ BASE_URL, self.category + ' ratings', self.day, self.year, self.month ] return SEARCH_URL.format(*url_params)
python
def _build_url(self): """Build url based on searching by date or by show.""" url_params = [ BASE_URL, self.category + ' ratings', self.day, self.year, self.month ] return SEARCH_URL.format(*url_params)
[ "def", "_build_url", "(", "self", ")", ":", "url_params", "=", "[", "BASE_URL", ",", "self", ".", "category", "+", "' ratings'", ",", "self", ".", "day", ",", "self", ".", "year", ",", "self", ".", "month", "]", "return", "SEARCH_URL", ".", "format", ...
Build url based on searching by date or by show.
[ "Build", "url", "based", "on", "searching", "by", "date", "or", "by", "show", "." ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/search.py#L88-L94
39,130
sharibarboza/py_zap
py_zap/search.py
SearchDaily._assert_category
def _assert_category(self, category): """Validate category argument""" category = category.lower() valid_categories = ['cable', 'broadcast', 'final', 'tv'] assert_msg = "%s is not a valid category." % (category) assert (category in valid_categories), assert_msg
python
def _assert_category(self, category): """Validate category argument""" category = category.lower() valid_categories = ['cable', 'broadcast', 'final', 'tv'] assert_msg = "%s is not a valid category." % (category) assert (category in valid_categories), assert_msg
[ "def", "_assert_category", "(", "self", ",", "category", ")", ":", "category", "=", "category", ".", "lower", "(", ")", "valid_categories", "=", "[", "'cable'", ",", "'broadcast'", ",", "'final'", ",", "'tv'", "]", "assert_msg", "=", "\"%s is not a valid categ...
Validate category argument
[ "Validate", "category", "argument" ]
ce90853efcad66d3e28b8f1ac910f275349d016c
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/search.py#L96-L101
39,131
rogerhil/thegamesdb
thegamesdb/api.py
TheGamesDb.get_data
def get_data(self, path, **params): """ Giving a service path and optional specific arguments, returns the XML data from the API parsed as a dict structure. """ xml = self.get_response(path, **params) try: return parse(xml) except Exception as err: ...
python
def get_data(self, path, **params): """ Giving a service path and optional specific arguments, returns the XML data from the API parsed as a dict structure. """ xml = self.get_response(path, **params) try: return parse(xml) except Exception as err: ...
[ "def", "get_data", "(", "self", ",", "path", ",", "*", "*", "params", ")", ":", "xml", "=", "self", ".", "get_response", "(", "path", ",", "*", "*", "params", ")", "try", ":", "return", "parse", "(", "xml", ")", "except", "Exception", "as", "err", ...
Giving a service path and optional specific arguments, returns the XML data from the API parsed as a dict structure.
[ "Giving", "a", "service", "path", "and", "optional", "specific", "arguments", "returns", "the", "XML", "data", "from", "the", "API", "parsed", "as", "a", "dict", "structure", "." ]
795314215f9ee73697c7520dea4ddecfb23ca8e6
https://github.com/rogerhil/thegamesdb/blob/795314215f9ee73697c7520dea4ddecfb23ca8e6/thegamesdb/api.py#L120-L131
39,132
langloisjp/tornado-logging-app
tornadoutil.py
LoggingApplication.run
def run(self, port): # pragma: no coverage """ Run on given port. Parse standard options and start the http server. """ tornado.options.parse_command_line() http_server = tornado.httpserver.HTTPServer(self) http_server.listen(port) tornado.ioloop.IOLoop.instance()...
python
def run(self, port): # pragma: no coverage """ Run on given port. Parse standard options and start the http server. """ tornado.options.parse_command_line() http_server = tornado.httpserver.HTTPServer(self) http_server.listen(port) tornado.ioloop.IOLoop.instance()...
[ "def", "run", "(", "self", ",", "port", ")", ":", "# pragma: no coverage", "tornado", ".", "options", ".", "parse_command_line", "(", ")", "http_server", "=", "tornado", ".", "httpserver", ".", "HTTPServer", "(", "self", ")", "http_server", ".", "listen", "(...
Run on given port. Parse standard options and start the http server.
[ "Run", "on", "given", "port", ".", "Parse", "standard", "options", "and", "start", "the", "http", "server", "." ]
02505b8a5bef782f9b67120874355b64f1b3e81a
https://github.com/langloisjp/tornado-logging-app/blob/02505b8a5bef782f9b67120874355b64f1b3e81a/tornadoutil.py#L46-L53
39,133
langloisjp/tornado-logging-app
tornadoutil.py
LoggingApplication.log_request
def log_request(self, handler): """ Override base method to log requests to JSON UDP collector and emit a metric. """ packet = {'method': handler.request.method, 'uri': handler.request.uri, 'remote_ip': handler.request.remote_ip, ...
python
def log_request(self, handler): """ Override base method to log requests to JSON UDP collector and emit a metric. """ packet = {'method': handler.request.method, 'uri': handler.request.uri, 'remote_ip': handler.request.remote_ip, ...
[ "def", "log_request", "(", "self", ",", "handler", ")", ":", "packet", "=", "{", "'method'", ":", "handler", ".", "request", ".", "method", ",", "'uri'", ":", "handler", ".", "request", ".", "uri", ",", "'remote_ip'", ":", "handler", ".", "request", "....
Override base method to log requests to JSON UDP collector and emit a metric.
[ "Override", "base", "method", "to", "log", "requests", "to", "JSON", "UDP", "collector", "and", "emit", "a", "metric", "." ]
02505b8a5bef782f9b67120874355b64f1b3e81a
https://github.com/langloisjp/tornado-logging-app/blob/02505b8a5bef782f9b67120874355b64f1b3e81a/tornadoutil.py#L55-L80
39,134
langloisjp/tornado-logging-app
tornadoutil.py
RequestHandler.logvalue
def logvalue(self, key, value): """Add log entry to request log info""" if not hasattr(self, 'logvalues'): self.logvalues = {} self.logvalues[key] = value
python
def logvalue(self, key, value): """Add log entry to request log info""" if not hasattr(self, 'logvalues'): self.logvalues = {} self.logvalues[key] = value
[ "def", "logvalue", "(", "self", ",", "key", ",", "value", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'logvalues'", ")", ":", "self", ".", "logvalues", "=", "{", "}", "self", ".", "logvalues", "[", "key", "]", "=", "value" ]
Add log entry to request log info
[ "Add", "log", "entry", "to", "request", "log", "info" ]
02505b8a5bef782f9b67120874355b64f1b3e81a
https://github.com/langloisjp/tornado-logging-app/blob/02505b8a5bef782f9b67120874355b64f1b3e81a/tornadoutil.py#L94-L98
39,135
langloisjp/tornado-logging-app
tornadoutil.py
RequestHandler.write_error
def write_error(self, status_code, **kwargs): """Log halt_reason in service log and output error page""" message = default_message = httplib.responses.get(status_code, '') # HTTPError exceptions may have a log_message attribute if 'exc_info' in kwargs: (_, exc, _) = kwargs['e...
python
def write_error(self, status_code, **kwargs): """Log halt_reason in service log and output error page""" message = default_message = httplib.responses.get(status_code, '') # HTTPError exceptions may have a log_message attribute if 'exc_info' in kwargs: (_, exc, _) = kwargs['e...
[ "def", "write_error", "(", "self", ",", "status_code", ",", "*", "*", "kwargs", ")", ":", "message", "=", "default_message", "=", "httplib", ".", "responses", ".", "get", "(", "status_code", ",", "''", ")", "# HTTPError exceptions may have a log_message attribute"...
Log halt_reason in service log and output error page
[ "Log", "halt_reason", "in", "service", "log", "and", "output", "error", "page" ]
02505b8a5bef782f9b67120874355b64f1b3e81a
https://github.com/langloisjp/tornado-logging-app/blob/02505b8a5bef782f9b67120874355b64f1b3e81a/tornadoutil.py#L108-L120
39,136
langloisjp/tornado-logging-app
tornadoutil.py
RequestHandler.timeit
def timeit(self, metric, func, *args, **kwargs): """Time execution of callable and emit metric then return result.""" return metrics.timeit(metric, func, *args, **kwargs)
python
def timeit(self, metric, func, *args, **kwargs): """Time execution of callable and emit metric then return result.""" return metrics.timeit(metric, func, *args, **kwargs)
[ "def", "timeit", "(", "self", ",", "metric", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "metrics", ".", "timeit", "(", "metric", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Time execution of callable and emit metric then return result.
[ "Time", "execution", "of", "callable", "and", "emit", "metric", "then", "return", "result", "." ]
02505b8a5bef782f9b67120874355b64f1b3e81a
https://github.com/langloisjp/tornado-logging-app/blob/02505b8a5bef782f9b67120874355b64f1b3e81a/tornadoutil.py#L122-L124
39,137
langloisjp/tornado-logging-app
tornadoutil.py
RequestHandler.require_content_type
def require_content_type(self, content_type): """Raises a 400 if request content type is not as specified.""" if self.request.headers.get('content-type', '') != content_type: self.halt(400, 'Content type must be ' + content_type)
python
def require_content_type(self, content_type): """Raises a 400 if request content type is not as specified.""" if self.request.headers.get('content-type', '') != content_type: self.halt(400, 'Content type must be ' + content_type)
[ "def", "require_content_type", "(", "self", ",", "content_type", ")", ":", "if", "self", ".", "request", ".", "headers", ".", "get", "(", "'content-type'", ",", "''", ")", "!=", "content_type", ":", "self", ".", "halt", "(", "400", ",", "'Content type must...
Raises a 400 if request content type is not as specified.
[ "Raises", "a", "400", "if", "request", "content", "type", "is", "not", "as", "specified", "." ]
02505b8a5bef782f9b67120874355b64f1b3e81a
https://github.com/langloisjp/tornado-logging-app/blob/02505b8a5bef782f9b67120874355b64f1b3e81a/tornadoutil.py#L130-L133
39,138
langloisjp/tornado-logging-app
tornadoutil.py
RequestHandler._ensure_request_id_header
def _ensure_request_id_header(self): "Ensure request headers have a request ID. Set one if needed." if REQUEST_ID_HEADER not in self.request.headers: self.request.headers.add(REQUEST_ID_HEADER, uuid.uuid1().hex)
python
def _ensure_request_id_header(self): "Ensure request headers have a request ID. Set one if needed." if REQUEST_ID_HEADER not in self.request.headers: self.request.headers.add(REQUEST_ID_HEADER, uuid.uuid1().hex)
[ "def", "_ensure_request_id_header", "(", "self", ")", ":", "if", "REQUEST_ID_HEADER", "not", "in", "self", ".", "request", ".", "headers", ":", "self", ".", "request", ".", "headers", ".", "add", "(", "REQUEST_ID_HEADER", ",", "uuid", ".", "uuid1", "(", ")...
Ensure request headers have a request ID. Set one if needed.
[ "Ensure", "request", "headers", "have", "a", "request", "ID", ".", "Set", "one", "if", "needed", "." ]
02505b8a5bef782f9b67120874355b64f1b3e81a
https://github.com/langloisjp/tornado-logging-app/blob/02505b8a5bef782f9b67120874355b64f1b3e81a/tornadoutil.py#L149-L152
39,139
GeorgeArgyros/symautomata
symautomata/stateremoval.py
main
def main(): """Testing function for DFA _Brzozowski Operation""" if len(argv) < 2: targetfile = 'target.y' else: targetfile = argv[1] print 'Parsing ruleset: ' + targetfile, flex_a = Flexparser() mma = flex_a.yyparse(targetfile) print 'OK' print 'Perform minimization on i...
python
def main(): """Testing function for DFA _Brzozowski Operation""" if len(argv) < 2: targetfile = 'target.y' else: targetfile = argv[1] print 'Parsing ruleset: ' + targetfile, flex_a = Flexparser() mma = flex_a.yyparse(targetfile) print 'OK' print 'Perform minimization on i...
[ "def", "main", "(", ")", ":", "if", "len", "(", "argv", ")", "<", "2", ":", "targetfile", "=", "'target.y'", "else", ":", "targetfile", "=", "argv", "[", "1", "]", "print", "'Parsing ruleset: '", "+", "targetfile", ",", "flex_a", "=", "Flexparser", "("...
Testing function for DFA _Brzozowski Operation
[ "Testing", "function", "for", "DFA", "_Brzozowski", "Operation" ]
f5d66533573b27e155bec3f36b8c00b8e3937cb3
https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/stateremoval.py#L148-L164
39,140
GeorgeArgyros/symautomata
symautomata/stateremoval.py
StateRemoval._state_removal_init
def _state_removal_init(self): """State Removal Operation Initialization""" # First, we remove all multi-edges: for state_i in self.mma.states: for state_j in self.mma.states: if state_i.stateid == state_j.stateid: self.l_transitions[ ...
python
def _state_removal_init(self): """State Removal Operation Initialization""" # First, we remove all multi-edges: for state_i in self.mma.states: for state_j in self.mma.states: if state_i.stateid == state_j.stateid: self.l_transitions[ ...
[ "def", "_state_removal_init", "(", "self", ")", ":", "# First, we remove all multi-edges:", "for", "state_i", "in", "self", ".", "mma", ".", "states", ":", "for", "state_j", "in", "self", ".", "mma", ".", "states", ":", "if", "state_i", ".", "stateid", "==",...
State Removal Operation Initialization
[ "State", "Removal", "Operation", "Initialization" ]
f5d66533573b27e155bec3f36b8c00b8e3937cb3
https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/stateremoval.py#L45-L64
39,141
GeorgeArgyros/symautomata
symautomata/stateremoval.py
StateRemoval._state_removal_solve
def _state_removal_solve(self): """The State Removal Operation""" initial = sorted( self.mma.states, key=attrgetter('initial'), reverse=True)[0].stateid for state_k in self.mma.states: if state_k.final: continue if state...
python
def _state_removal_solve(self): """The State Removal Operation""" initial = sorted( self.mma.states, key=attrgetter('initial'), reverse=True)[0].stateid for state_k in self.mma.states: if state_k.final: continue if state...
[ "def", "_state_removal_solve", "(", "self", ")", ":", "initial", "=", "sorted", "(", "self", ".", "mma", ".", "states", ",", "key", "=", "attrgetter", "(", "'initial'", ")", ",", "reverse", "=", "True", ")", "[", "0", "]", ".", "stateid", "for", "sta...
The State Removal Operation
[ "The", "State", "Removal", "Operation" ]
f5d66533573b27e155bec3f36b8c00b8e3937cb3
https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/stateremoval.py#L125-L139
39,142
iron-io/iron_core_python
iron_core.py
IronClient.request
def request(self, url, method, body="", headers={}, retry=True): """Execute an HTTP request and return a dict containing the response and the response status code. Keyword arguments: url -- The path to execute the result against, not including the API version or project I...
python
def request(self, url, method, body="", headers={}, retry=True): """Execute an HTTP request and return a dict containing the response and the response status code. Keyword arguments: url -- The path to execute the result against, not including the API version or project I...
[ "def", "request", "(", "self", ",", "url", ",", "method", ",", "body", "=", "\"\"", ",", "headers", "=", "{", "}", ",", "retry", "=", "True", ")", ":", "if", "headers", ":", "headers", "=", "dict", "(", "list", "(", "headers", ".", "items", "(", ...
Execute an HTTP request and return a dict containing the response and the response status code. Keyword arguments: url -- The path to execute the result against, not including the API version or project ID, with no leading /. Required. method -- The HTTP method to use. Re...
[ "Execute", "an", "HTTP", "request", "and", "return", "a", "dict", "containing", "the", "response", "and", "the", "response", "status", "code", "." ]
f09a160a854912efcb75a810702686bc25b74fa8
https://github.com/iron-io/iron_core_python/blob/f09a160a854912efcb75a810702686bc25b74fa8/iron_core.py#L209-L270
39,143
iron-io/iron_core_python
iron_core.py
IronClient.get
def get(self, url, headers={}, retry=True): """Execute an HTTP GET request and return a dict containing the response and the response status code. Keyword arguments: url -- The path to execute the result against, not including the API version or project ID, with no leadin...
python
def get(self, url, headers={}, retry=True): """Execute an HTTP GET request and return a dict containing the response and the response status code. Keyword arguments: url -- The path to execute the result against, not including the API version or project ID, with no leadin...
[ "def", "get", "(", "self", ",", "url", ",", "headers", "=", "{", "}", ",", "retry", "=", "True", ")", ":", "return", "self", ".", "request", "(", "url", "=", "url", ",", "method", "=", "\"GET\"", ",", "headers", "=", "headers", ",", "retry", "=",...
Execute an HTTP GET request and return a dict containing the response and the response status code. Keyword arguments: url -- The path to execute the result against, not including the API version or project ID, with no leading /. Required. headers -- HTTP Headers to send ...
[ "Execute", "an", "HTTP", "GET", "request", "and", "return", "a", "dict", "containing", "the", "response", "and", "the", "response", "status", "code", "." ]
f09a160a854912efcb75a810702686bc25b74fa8
https://github.com/iron-io/iron_core_python/blob/f09a160a854912efcb75a810702686bc25b74fa8/iron_core.py#L272-L285
39,144
iron-io/iron_core_python
iron_core.py
IronClient.post
def post(self, url, body="", headers={}, retry=True): """Execute an HTTP POST request and return a dict containing the response and the response status code. Keyword arguments: url -- The path to execute the result against, not including the API version or project ID, wit...
python
def post(self, url, body="", headers={}, retry=True): """Execute an HTTP POST request and return a dict containing the response and the response status code. Keyword arguments: url -- The path to execute the result against, not including the API version or project ID, wit...
[ "def", "post", "(", "self", ",", "url", ",", "body", "=", "\"\"", ",", "headers", "=", "{", "}", ",", "retry", "=", "True", ")", ":", "headers", "[", "\"Content-Length\"", "]", "=", "str", "(", "len", "(", "body", ")", ")", "return", "self", ".",...
Execute an HTTP POST request and return a dict containing the response and the response status code. Keyword arguments: url -- The path to execute the result against, not including the API version or project ID, with no leading /. Required. body -- A string or file object...
[ "Execute", "an", "HTTP", "POST", "request", "and", "return", "a", "dict", "containing", "the", "response", "and", "the", "response", "status", "code", "." ]
f09a160a854912efcb75a810702686bc25b74fa8
https://github.com/iron-io/iron_core_python/blob/f09a160a854912efcb75a810702686bc25b74fa8/iron_core.py#L287-L303
39,145
iron-io/iron_core_python
iron_core.py
IronClient.patch
def patch(self, url, body="", headers={}, retry=True): """Execute an HTTP PATCH request and return a dict containing the response and the response status code. Keyword arguments: url -- The path to execute the result against, not including the API version or project ID, w...
python
def patch(self, url, body="", headers={}, retry=True): """Execute an HTTP PATCH request and return a dict containing the response and the response status code. Keyword arguments: url -- The path to execute the result against, not including the API version or project ID, w...
[ "def", "patch", "(", "self", ",", "url", ",", "body", "=", "\"\"", ",", "headers", "=", "{", "}", ",", "retry", "=", "True", ")", ":", "return", "self", ".", "request", "(", "url", "=", "url", ",", "method", "=", "\"PATCH\"", ",", "body", "=", ...
Execute an HTTP PATCH request and return a dict containing the response and the response status code. Keyword arguments: url -- The path to execute the result against, not including the API version or project ID, with no leading /. Required. body -- A string or file objec...
[ "Execute", "an", "HTTP", "PATCH", "request", "and", "return", "a", "dict", "containing", "the", "response", "and", "the", "response", "status", "code", "." ]
f09a160a854912efcb75a810702686bc25b74fa8
https://github.com/iron-io/iron_core_python/blob/f09a160a854912efcb75a810702686bc25b74fa8/iron_core.py#L339-L354
39,146
ScottDuckworth/python-anyvcs
anyvcs/svn.py
SvnRepo.clone
def clone(cls, srcpath, destpath): """Copy a main repository to a new location.""" try: os.makedirs(destpath) except OSError as e: if not e.errno == errno.EEXIST: raise cmd = [SVNADMIN, 'dump', '--quiet', '.'] dump = subprocess.Popen( ...
python
def clone(cls, srcpath, destpath): """Copy a main repository to a new location.""" try: os.makedirs(destpath) except OSError as e: if not e.errno == errno.EEXIST: raise cmd = [SVNADMIN, 'dump', '--quiet', '.'] dump = subprocess.Popen( ...
[ "def", "clone", "(", "cls", ",", "srcpath", ",", "destpath", ")", ":", "try", ":", "os", ".", "makedirs", "(", "destpath", ")", "except", "OSError", "as", "e", ":", "if", "not", "e", ".", "errno", "==", "errno", ".", "EEXIST", ":", "raise", "cmd", ...
Copy a main repository to a new location.
[ "Copy", "a", "main", "repository", "to", "a", "new", "location", "." ]
9eb09defbc6b7c99d373fad53cbf8fc81b637923
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/svn.py#L118-L138
39,147
ScottDuckworth/python-anyvcs
anyvcs/svn.py
SvnRepo.proplist
def proplist(self, rev, path=None): """List Subversion properties of the path""" rev, prefix = self._maprev(rev) if path is None: return self._proplist(str(rev), None) else: path = type(self).cleanPath(_join(prefix, path)) return self._proplist(str(rev...
python
def proplist(self, rev, path=None): """List Subversion properties of the path""" rev, prefix = self._maprev(rev) if path is None: return self._proplist(str(rev), None) else: path = type(self).cleanPath(_join(prefix, path)) return self._proplist(str(rev...
[ "def", "proplist", "(", "self", ",", "rev", ",", "path", "=", "None", ")", ":", "rev", ",", "prefix", "=", "self", ".", "_maprev", "(", "rev", ")", "if", "path", "is", "None", ":", "return", "self", ".", "_proplist", "(", "str", "(", "rev", ")", ...
List Subversion properties of the path
[ "List", "Subversion", "properties", "of", "the", "path" ]
9eb09defbc6b7c99d373fad53cbf8fc81b637923
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/svn.py#L193-L200
39,148
ScottDuckworth/python-anyvcs
anyvcs/svn.py
SvnRepo.propget
def propget(self, prop, rev, path=None): """Get Subversion property value of the path""" rev, prefix = self._maprev(rev) if path is None: return self._propget(prop, str(rev), None) else: path = type(self).cleanPath(_join(prefix, path)) return self._pro...
python
def propget(self, prop, rev, path=None): """Get Subversion property value of the path""" rev, prefix = self._maprev(rev) if path is None: return self._propget(prop, str(rev), None) else: path = type(self).cleanPath(_join(prefix, path)) return self._pro...
[ "def", "propget", "(", "self", ",", "prop", ",", "rev", ",", "path", "=", "None", ")", ":", "rev", ",", "prefix", "=", "self", ".", "_maprev", "(", "rev", ")", "if", "path", "is", "None", ":", "return", "self", ".", "_propget", "(", "prop", ",", ...
Get Subversion property value of the path
[ "Get", "Subversion", "property", "value", "of", "the", "path" ]
9eb09defbc6b7c99d373fad53cbf8fc81b637923
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/svn.py#L206-L213
39,149
ScottDuckworth/python-anyvcs
anyvcs/svn.py
SvnRepo.dump
def dump( self, stream, progress=None, lower=None, upper=None, incremental=False, deltas=False ): """Dump the repository to a dumpfile stream. :param stream: A file stream to which the dumpfile is written :param progress: A file stream to which progress is written :p...
python
def dump( self, stream, progress=None, lower=None, upper=None, incremental=False, deltas=False ): """Dump the repository to a dumpfile stream. :param stream: A file stream to which the dumpfile is written :param progress: A file stream to which progress is written :p...
[ "def", "dump", "(", "self", ",", "stream", ",", "progress", "=", "None", ",", "lower", "=", "None", ",", "upper", "=", "None", ",", "incremental", "=", "False", ",", "deltas", "=", "False", ")", ":", "cmd", "=", "[", "SVNADMIN", ",", "'dump'", ",",...
Dump the repository to a dumpfile stream. :param stream: A file stream to which the dumpfile is written :param progress: A file stream to which progress is written :param lower: Must be a numeric version number :param upper: Must be a numeric version number See ``svnadmin help ...
[ "Dump", "the", "repository", "to", "a", "dumpfile", "stream", "." ]
9eb09defbc6b7c99d373fad53cbf8fc81b637923
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/svn.py#L746-L776
39,150
ScottDuckworth/python-anyvcs
anyvcs/svn.py
SvnRepo.load
def load( self, stream, progress=None, ignore_uuid=False, force_uuid=False, use_pre_commit_hook=False, use_post_commit_hook=False, parent_dir=None ): """Load a dumpfile stream into the repository. :param stream: A file stream from which the dumpfile is read :param progress: ...
python
def load( self, stream, progress=None, ignore_uuid=False, force_uuid=False, use_pre_commit_hook=False, use_post_commit_hook=False, parent_dir=None ): """Load a dumpfile stream into the repository. :param stream: A file stream from which the dumpfile is read :param progress: ...
[ "def", "load", "(", "self", ",", "stream", ",", "progress", "=", "None", ",", "ignore_uuid", "=", "False", ",", "force_uuid", "=", "False", ",", "use_pre_commit_hook", "=", "False", ",", "use_post_commit_hook", "=", "False", ",", "parent_dir", "=", "None", ...
Load a dumpfile stream into the repository. :param stream: A file stream from which the dumpfile is read :param progress: A file stream to which progress is written See ``svnadmin help load`` for details on the other arguments.
[ "Load", "a", "dumpfile", "stream", "into", "the", "repository", "." ]
9eb09defbc6b7c99d373fad53cbf8fc81b637923
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/svn.py#L778-L811
39,151
themattrix/python-temporary
temporary/files.py
temp_file
def temp_file( content=None, suffix='', prefix='tmp', parent_dir=None): """ Create a temporary file and optionally populate it with content. The file is deleted when the context exits. The temporary file is created when entering the context manager and deleted when e...
python
def temp_file( content=None, suffix='', prefix='tmp', parent_dir=None): """ Create a temporary file and optionally populate it with content. The file is deleted when the context exits. The temporary file is created when entering the context manager and deleted when e...
[ "def", "temp_file", "(", "content", "=", "None", ",", "suffix", "=", "''", ",", "prefix", "=", "'tmp'", ",", "parent_dir", "=", "None", ")", ":", "binary", "=", "isinstance", "(", "content", ",", "(", "bytes", ",", "bytearray", ")", ")", "parent_dir", ...
Create a temporary file and optionally populate it with content. The file is deleted when the context exits. The temporary file is created when entering the context manager and deleted when exiting it. >>> import temporary >>> with temporary.temp_file() as temp_file: ... assert temp_file.ex...
[ "Create", "a", "temporary", "file", "and", "optionally", "populate", "it", "with", "content", ".", "The", "file", "is", "deleted", "when", "the", "context", "exits", "." ]
5af1a393e57e71c2d4728e2c8e228edfd020e847
https://github.com/themattrix/python-temporary/blob/5af1a393e57e71c2d4728e2c8e228edfd020e847/temporary/files.py#L11-L55
39,152
Sikilabs/pyebook
pyebook/pyebook.py
Book.load_content
def load_content(self): """ Load the book content """ # get the toc file from the root file rel_path = self.root_file_url.replace(os.path.basename(self.root_file_url), '') self.toc_file_url = rel_path + self.root_file.find(id="ncx")['href'] self.toc_file_soup = b...
python
def load_content(self): """ Load the book content """ # get the toc file from the root file rel_path = self.root_file_url.replace(os.path.basename(self.root_file_url), '') self.toc_file_url = rel_path + self.root_file.find(id="ncx")['href'] self.toc_file_soup = b...
[ "def", "load_content", "(", "self", ")", ":", "# get the toc file from the root file", "rel_path", "=", "self", ".", "root_file_url", ".", "replace", "(", "os", ".", "path", ".", "basename", "(", "self", ".", "root_file_url", ")", ",", "''", ")", "self", "."...
Load the book content
[ "Load", "the", "book", "content" ]
96a14833df3ad8585efde91ac2b6c30982dca0d3
https://github.com/Sikilabs/pyebook/blob/96a14833df3ad8585efde91ac2b6c30982dca0d3/pyebook/pyebook.py#L48-L66
39,153
Equitable/trump
uninstall/uninstall.py
UninstallTrump
def UninstallTrump(RemoveDataTables=True, RemoveOverrides=True, RemoveFailsafes=True): """ This script removes all tables associated with Trump. It's written for PostgreSQL, but should be very easy to adapt to other databases. """ ts = ['_symbols', '_symbol_validity', '_symbol_...
python
def UninstallTrump(RemoveDataTables=True, RemoveOverrides=True, RemoveFailsafes=True): """ This script removes all tables associated with Trump. It's written for PostgreSQL, but should be very easy to adapt to other databases. """ ts = ['_symbols', '_symbol_validity', '_symbol_...
[ "def", "UninstallTrump", "(", "RemoveDataTables", "=", "True", ",", "RemoveOverrides", "=", "True", ",", "RemoveFailsafes", "=", "True", ")", ":", "ts", "=", "[", "'_symbols'", ",", "'_symbol_validity'", ",", "'_symbol_tags'", ",", "'_symbol_aliases'", ",", "'_f...
This script removes all tables associated with Trump. It's written for PostgreSQL, but should be very easy to adapt to other databases.
[ "This", "script", "removes", "all", "tables", "associated", "with", "Trump", ".", "It", "s", "written", "for", "PostgreSQL", "but", "should", "be", "very", "easy", "to", "adapt", "to", "other", "databases", "." ]
a2802692bc642fa32096374159eea7ceca2947b4
https://github.com/Equitable/trump/blob/a2802692bc642fa32096374159eea7ceca2947b4/uninstall/uninstall.py#L3-L31
39,154
hollenstein/maspy
maspy/peptidemethods.py
digestInSilico
def digestInSilico(proteinSequence, cleavageRule='[KR]', missedCleavage=0, removeNtermM=True, minLength=5, maxLength=55): """Returns a list of peptide sequences and cleavage information derived from an in silico digestion of a polypeptide. :param proteinSequence: amino acid sequence of t...
python
def digestInSilico(proteinSequence, cleavageRule='[KR]', missedCleavage=0, removeNtermM=True, minLength=5, maxLength=55): """Returns a list of peptide sequences and cleavage information derived from an in silico digestion of a polypeptide. :param proteinSequence: amino acid sequence of t...
[ "def", "digestInSilico", "(", "proteinSequence", ",", "cleavageRule", "=", "'[KR]'", ",", "missedCleavage", "=", "0", ",", "removeNtermM", "=", "True", ",", "minLength", "=", "5", ",", "maxLength", "=", "55", ")", ":", "passFilter", "=", "lambda", "startPos"...
Returns a list of peptide sequences and cleavage information derived from an in silico digestion of a polypeptide. :param proteinSequence: amino acid sequence of the poly peptide to be digested :param cleavageRule: cleavage rule expressed in a regular expression, see :attr:`maspy.constants....
[ "Returns", "a", "list", "of", "peptide", "sequences", "and", "cleavage", "information", "derived", "from", "an", "in", "silico", "digestion", "of", "a", "polypeptide", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/peptidemethods.py#L42-L128
39,155
hollenstein/maspy
maspy/peptidemethods.py
calcPeptideMass
def calcPeptideMass(peptide, **kwargs): """Calculate the mass of a peptide. :param aaMass: A dictionary with the monoisotopic masses of amino acid residues, by default :attr:`maspy.constants.aaMass` :param aaModMass: A dictionary with the monoisotopic mass changes of modications, by default...
python
def calcPeptideMass(peptide, **kwargs): """Calculate the mass of a peptide. :param aaMass: A dictionary with the monoisotopic masses of amino acid residues, by default :attr:`maspy.constants.aaMass` :param aaModMass: A dictionary with the monoisotopic mass changes of modications, by default...
[ "def", "calcPeptideMass", "(", "peptide", ",", "*", "*", "kwargs", ")", ":", "aaMass", "=", "kwargs", ".", "get", "(", "'aaMass'", ",", "maspy", ".", "constants", ".", "aaMass", ")", "aaModMass", "=", "kwargs", ".", "get", "(", "'aaModMass'", ",", "mas...
Calculate the mass of a peptide. :param aaMass: A dictionary with the monoisotopic masses of amino acid residues, by default :attr:`maspy.constants.aaMass` :param aaModMass: A dictionary with the monoisotopic mass changes of modications, by default :attr:`maspy.constants.aaModMass` :param e...
[ "Calculate", "the", "mass", "of", "a", "peptide", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/peptidemethods.py#L132-L170
39,156
hollenstein/maspy
maspy/peptidemethods.py
removeModifications
def removeModifications(peptide): """Removes all modifications from a peptide string and return the plain amino acid sequence. :param peptide: peptide sequence, modifications have to be written in the format "[modificationName]" :param peptide: str :returns: amino acid sequence of ``peptid...
python
def removeModifications(peptide): """Removes all modifications from a peptide string and return the plain amino acid sequence. :param peptide: peptide sequence, modifications have to be written in the format "[modificationName]" :param peptide: str :returns: amino acid sequence of ``peptid...
[ "def", "removeModifications", "(", "peptide", ")", ":", "while", "peptide", ".", "find", "(", "'['", ")", "!=", "-", "1", ":", "peptide", "=", "peptide", ".", "split", "(", "'['", ",", "1", ")", "[", "0", "]", "+", "peptide", ".", "split", "(", "...
Removes all modifications from a peptide string and return the plain amino acid sequence. :param peptide: peptide sequence, modifications have to be written in the format "[modificationName]" :param peptide: str :returns: amino acid sequence of ``peptide`` without any modifications
[ "Removes", "all", "modifications", "from", "a", "peptide", "string", "and", "return", "the", "plain", "amino", "acid", "sequence", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/peptidemethods.py#L173-L185
39,157
hollenstein/maspy
maspy/peptidemethods.py
returnModPositions
def returnModPositions(peptide, indexStart=1, removeModString='UNIMOD:'): """Determines the amino acid positions of all present modifications. :param peptide: peptide sequence, modifications have to be written in the format "[modificationName]" :param indexStart: returned amino acids positions of t...
python
def returnModPositions(peptide, indexStart=1, removeModString='UNIMOD:'): """Determines the amino acid positions of all present modifications. :param peptide: peptide sequence, modifications have to be written in the format "[modificationName]" :param indexStart: returned amino acids positions of t...
[ "def", "returnModPositions", "(", "peptide", ",", "indexStart", "=", "1", ",", "removeModString", "=", "'UNIMOD:'", ")", ":", "unidmodPositionDict", "=", "dict", "(", ")", "while", "peptide", ".", "find", "(", "'['", ")", "!=", "-", "1", ":", "currModifica...
Determines the amino acid positions of all present modifications. :param peptide: peptide sequence, modifications have to be written in the format "[modificationName]" :param indexStart: returned amino acids positions of the peptide start with this number (first amino acid position = indexStart...
[ "Determines", "the", "amino", "acid", "positions", "of", "all", "present", "modifications", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/peptidemethods.py#L188-L216
39,158
hollenstein/maspy
maspy/peptidemethods.py
calcMhFromMz
def calcMhFromMz(mz, charge): """Calculate the MH+ value from mz and charge. :param mz: float, mass to charge ratio (Dalton / charge) :param charge: int, charge state :returns: mass to charge ratio of the mono protonated ion (charge = 1) """ mh = (mz * charge) - (maspy.constants.atomicMassProt...
python
def calcMhFromMz(mz, charge): """Calculate the MH+ value from mz and charge. :param mz: float, mass to charge ratio (Dalton / charge) :param charge: int, charge state :returns: mass to charge ratio of the mono protonated ion (charge = 1) """ mh = (mz * charge) - (maspy.constants.atomicMassProt...
[ "def", "calcMhFromMz", "(", "mz", ",", "charge", ")", ":", "mh", "=", "(", "mz", "*", "charge", ")", "-", "(", "maspy", ".", "constants", ".", "atomicMassProton", "*", "(", "charge", "-", "1", ")", ")", "return", "mh" ]
Calculate the MH+ value from mz and charge. :param mz: float, mass to charge ratio (Dalton / charge) :param charge: int, charge state :returns: mass to charge ratio of the mono protonated ion (charge = 1)
[ "Calculate", "the", "MH", "+", "value", "from", "mz", "and", "charge", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/peptidemethods.py#L220-L229
39,159
hollenstein/maspy
maspy/peptidemethods.py
calcMzFromMh
def calcMzFromMh(mh, charge): """Calculate the mz value from MH+ and charge. :param mh: float, mass to charge ratio (Dalton / charge) of the mono protonated ion :param charge: int, charge state :returns: mass to charge ratio of the specified charge state """ mz = (mh + (maspy.constants...
python
def calcMzFromMh(mh, charge): """Calculate the mz value from MH+ and charge. :param mh: float, mass to charge ratio (Dalton / charge) of the mono protonated ion :param charge: int, charge state :returns: mass to charge ratio of the specified charge state """ mz = (mh + (maspy.constants...
[ "def", "calcMzFromMh", "(", "mh", ",", "charge", ")", ":", "mz", "=", "(", "mh", "+", "(", "maspy", ".", "constants", ".", "atomicMassProton", "*", "(", "charge", "-", "1", ")", ")", ")", "/", "charge", "return", "mz" ]
Calculate the mz value from MH+ and charge. :param mh: float, mass to charge ratio (Dalton / charge) of the mono protonated ion :param charge: int, charge state :returns: mass to charge ratio of the specified charge state
[ "Calculate", "the", "mz", "value", "from", "MH", "+", "and", "charge", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/peptidemethods.py#L232-L242
39,160
hollenstein/maspy
maspy/peptidemethods.py
calcMzFromMass
def calcMzFromMass(mass, charge): """Calculate the mz value of a peptide from its mass and charge. :param mass: float, exact non protonated mass :param charge: int, charge state :returns: mass to charge ratio of the specified charge state """ mz = (mass + (maspy.constants.atomicMassProton * ch...
python
def calcMzFromMass(mass, charge): """Calculate the mz value of a peptide from its mass and charge. :param mass: float, exact non protonated mass :param charge: int, charge state :returns: mass to charge ratio of the specified charge state """ mz = (mass + (maspy.constants.atomicMassProton * ch...
[ "def", "calcMzFromMass", "(", "mass", ",", "charge", ")", ":", "mz", "=", "(", "mass", "+", "(", "maspy", ".", "constants", ".", "atomicMassProton", "*", "charge", ")", ")", "/", "charge", "return", "mz" ]
Calculate the mz value of a peptide from its mass and charge. :param mass: float, exact non protonated mass :param charge: int, charge state :returns: mass to charge ratio of the specified charge state
[ "Calculate", "the", "mz", "value", "of", "a", "peptide", "from", "its", "mass", "and", "charge", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/peptidemethods.py#L245-L254
39,161
hollenstein/maspy
maspy/peptidemethods.py
calcMassFromMz
def calcMassFromMz(mz, charge): """Calculate the mass of a peptide from its mz and charge. :param mz: float, mass to charge ratio (Dalton / charge) :param charge: int, charge state :returns: non protonated mass (charge = 0) """ mass = (mz - maspy.constants.atomicMassProton) * charge return...
python
def calcMassFromMz(mz, charge): """Calculate the mass of a peptide from its mz and charge. :param mz: float, mass to charge ratio (Dalton / charge) :param charge: int, charge state :returns: non protonated mass (charge = 0) """ mass = (mz - maspy.constants.atomicMassProton) * charge return...
[ "def", "calcMassFromMz", "(", "mz", ",", "charge", ")", ":", "mass", "=", "(", "mz", "-", "maspy", ".", "constants", ".", "atomicMassProton", ")", "*", "charge", "return", "mass" ]
Calculate the mass of a peptide from its mz and charge. :param mz: float, mass to charge ratio (Dalton / charge) :param charge: int, charge state :returns: non protonated mass (charge = 0)
[ "Calculate", "the", "mass", "of", "a", "peptide", "from", "its", "mz", "and", "charge", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/peptidemethods.py#L257-L266
39,162
sporsh/carnifex
carnifex/sshprocess.py
SSHProcessInductor.execute
def execute(self, processProtocol, command, env={}, path=None, uid=None, gid=None, usePTY=0, childFDs=None): """Execute a process on the remote machine using SSH @param processProtocol: the ProcessProtocol instance to connect @param executable: the executable program to run ...
python
def execute(self, processProtocol, command, env={}, path=None, uid=None, gid=None, usePTY=0, childFDs=None): """Execute a process on the remote machine using SSH @param processProtocol: the ProcessProtocol instance to connect @param executable: the executable program to run ...
[ "def", "execute", "(", "self", ",", "processProtocol", ",", "command", ",", "env", "=", "{", "}", ",", "path", "=", "None", ",", "uid", "=", "None", ",", "gid", "=", "None", ",", "usePTY", "=", "0", ",", "childFDs", "=", "None", ")", ":", "sshCom...
Execute a process on the remote machine using SSH @param processProtocol: the ProcessProtocol instance to connect @param executable: the executable program to run @param args: the arguments to pass to the process @param env: environment variables to request the remote ssh server to set ...
[ "Execute", "a", "process", "on", "the", "remote", "machine", "using", "SSH" ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/sshprocess.py#L64-L88
39,163
sporsh/carnifex
carnifex/sshprocess.py
SSHProcessInductor._getUserAuthObject
def _getUserAuthObject(self, user, connection): """Get a SSHUserAuthClient object to use for authentication @param user: The username to authenticate for @param connection: The connection service to start after authentication """ credentials = self._getCredentials(user) ...
python
def _getUserAuthObject(self, user, connection): """Get a SSHUserAuthClient object to use for authentication @param user: The username to authenticate for @param connection: The connection service to start after authentication """ credentials = self._getCredentials(user) ...
[ "def", "_getUserAuthObject", "(", "self", ",", "user", ",", "connection", ")", ":", "credentials", "=", "self", ".", "_getCredentials", "(", "user", ")", "userAuthObject", "=", "AutomaticUserAuthClient", "(", "user", ",", "connection", ",", "*", "*", "credenti...
Get a SSHUserAuthClient object to use for authentication @param user: The username to authenticate for @param connection: The connection service to start after authentication
[ "Get", "a", "SSHUserAuthClient", "object", "to", "use", "for", "authentication" ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/sshprocess.py#L140-L148
39,164
sporsh/carnifex
carnifex/sshprocess.py
SSHProcessInductor._verifyHostKey
def _verifyHostKey(self, hostKey, fingerprint): """Called when ssh transport requests us to verify a given host key. Return a deferred that callback if we accept the key or errback if we decide to reject it. """ if fingerprint in self.knownHosts: return defer.succeed(...
python
def _verifyHostKey(self, hostKey, fingerprint): """Called when ssh transport requests us to verify a given host key. Return a deferred that callback if we accept the key or errback if we decide to reject it. """ if fingerprint in self.knownHosts: return defer.succeed(...
[ "def", "_verifyHostKey", "(", "self", ",", "hostKey", ",", "fingerprint", ")", ":", "if", "fingerprint", "in", "self", ".", "knownHosts", ":", "return", "defer", ".", "succeed", "(", "True", ")", "return", "defer", ".", "fail", "(", "UnknownHostKey", "(", ...
Called when ssh transport requests us to verify a given host key. Return a deferred that callback if we accept the key or errback if we decide to reject it.
[ "Called", "when", "ssh", "transport", "requests", "us", "to", "verify", "a", "given", "host", "key", ".", "Return", "a", "deferred", "that", "callback", "if", "we", "accept", "the", "key", "or", "errback", "if", "we", "decide", "to", "reject", "it", "." ...
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/sshprocess.py#L150-L157
39,165
coala/coala-decorators-USE-cOALA-UTILS-INSTEAD
coala_decorators/__init__.py
yield_once
def yield_once(iterator): """ Decorator to make an iterator returned by a method yield each result only once. >>> @yield_once ... def generate_list(foo): ... return foo >>> list(generate_list([1, 2, 1])) [1, 2] :param iterator: Any method that returns an iterator :return: ...
python
def yield_once(iterator): """ Decorator to make an iterator returned by a method yield each result only once. >>> @yield_once ... def generate_list(foo): ... return foo >>> list(generate_list([1, 2, 1])) [1, 2] :param iterator: Any method that returns an iterator :return: ...
[ "def", "yield_once", "(", "iterator", ")", ":", "@", "wraps", "(", "iterator", ")", "def", "yield_once_generator", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "yielded", "=", "set", "(", ")", "for", "item", "in", "iterator", "(", "*", "args"...
Decorator to make an iterator returned by a method yield each result only once. >>> @yield_once ... def generate_list(foo): ... return foo >>> list(generate_list([1, 2, 1])) [1, 2] :param iterator: Any method that returns an iterator :return: An method returning an iterator...
[ "Decorator", "to", "make", "an", "iterator", "returned", "by", "a", "method", "yield", "each", "result", "only", "once", "." ]
b1c4463f364bbcd0ad5138f697a52f11c9afe326
https://github.com/coala/coala-decorators-USE-cOALA-UTILS-INSTEAD/blob/b1c4463f364bbcd0ad5138f697a52f11c9afe326/coala_decorators/__init__.py#L6-L29
39,166
coala/coala-decorators-USE-cOALA-UTILS-INSTEAD
coala_decorators/__init__.py
_to_list
def _to_list(var): """ Make variable to list. >>> _to_list(None) [] >>> _to_list('whee') ['whee'] >>> _to_list([None]) [None] >>> _to_list((1, 2, 3)) [1, 2, 3] :param var: variable of any type :return: list """ if isinstance(var, list): return var ...
python
def _to_list(var): """ Make variable to list. >>> _to_list(None) [] >>> _to_list('whee') ['whee'] >>> _to_list([None]) [None] >>> _to_list((1, 2, 3)) [1, 2, 3] :param var: variable of any type :return: list """ if isinstance(var, list): return var ...
[ "def", "_to_list", "(", "var", ")", ":", "if", "isinstance", "(", "var", ",", "list", ")", ":", "return", "var", "elif", "var", "is", "None", ":", "return", "[", "]", "elif", "isinstance", "(", "var", ",", "str", ")", "or", "isinstance", "(", "var"...
Make variable to list. >>> _to_list(None) [] >>> _to_list('whee') ['whee'] >>> _to_list([None]) [None] >>> _to_list((1, 2, 3)) [1, 2, 3] :param var: variable of any type :return: list
[ "Make", "variable", "to", "list", "." ]
b1c4463f364bbcd0ad5138f697a52f11c9afe326
https://github.com/coala/coala-decorators-USE-cOALA-UTILS-INSTEAD/blob/b1c4463f364bbcd0ad5138f697a52f11c9afe326/coala_decorators/__init__.py#L32-L59
39,167
coala/coala-decorators-USE-cOALA-UTILS-INSTEAD
coala_decorators/__init__.py
arguments_to_lists
def arguments_to_lists(function): """ Decorator for a function that converts all arguments to lists. :param function: target function :return: target function with only lists as parameters """ def l_function(*args, **kwargs): l_args = [_to_list(arg) for arg in args] l_kw...
python
def arguments_to_lists(function): """ Decorator for a function that converts all arguments to lists. :param function: target function :return: target function with only lists as parameters """ def l_function(*args, **kwargs): l_args = [_to_list(arg) for arg in args] l_kw...
[ "def", "arguments_to_lists", "(", "function", ")", ":", "def", "l_function", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "l_args", "=", "[", "_to_list", "(", "arg", ")", "for", "arg", "in", "args", "]", "l_kwargs", "=", "{", "}", "for", "k...
Decorator for a function that converts all arguments to lists. :param function: target function :return: target function with only lists as parameters
[ "Decorator", "for", "a", "function", "that", "converts", "all", "arguments", "to", "lists", "." ]
b1c4463f364bbcd0ad5138f697a52f11c9afe326
https://github.com/coala/coala-decorators-USE-cOALA-UTILS-INSTEAD/blob/b1c4463f364bbcd0ad5138f697a52f11c9afe326/coala_decorators/__init__.py#L62-L77
39,168
coala/coala-decorators-USE-cOALA-UTILS-INSTEAD
coala_decorators/__init__.py
generate_eq
def generate_eq(*members): """ Decorator that generates equality and inequality operators for the decorated class. The given members as well as the type of self and other will be taken into account. Note that this decorator modifies the given class in place! :param members: A list of members t...
python
def generate_eq(*members): """ Decorator that generates equality and inequality operators for the decorated class. The given members as well as the type of self and other will be taken into account. Note that this decorator modifies the given class in place! :param members: A list of members t...
[ "def", "generate_eq", "(", "*", "members", ")", ":", "def", "decorator", "(", "cls", ")", ":", "def", "eq", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "cls", ")", ":", "return", "False", "return", "all", "(",...
Decorator that generates equality and inequality operators for the decorated class. The given members as well as the type of self and other will be taken into account. Note that this decorator modifies the given class in place! :param members: A list of members to compare for equality.
[ "Decorator", "that", "generates", "equality", "and", "inequality", "operators", "for", "the", "decorated", "class", ".", "The", "given", "members", "as", "well", "as", "the", "type", "of", "self", "and", "other", "will", "be", "taken", "into", "account", "."...
b1c4463f364bbcd0ad5138f697a52f11c9afe326
https://github.com/coala/coala-decorators-USE-cOALA-UTILS-INSTEAD/blob/b1c4463f364bbcd0ad5138f697a52f11c9afe326/coala_decorators/__init__.py#L196-L221
39,169
coala/coala-decorators-USE-cOALA-UTILS-INSTEAD
coala_decorators/__init__.py
enforce_signature
def enforce_signature(function): """ Enforces the signature of the function by throwing TypeError's if invalid arguments are provided. The return value is not checked. You can annotate any parameter of your function with the desired type or a tuple of allowed types. If you annotate the function wit...
python
def enforce_signature(function): """ Enforces the signature of the function by throwing TypeError's if invalid arguments are provided. The return value is not checked. You can annotate any parameter of your function with the desired type or a tuple of allowed types. If you annotate the function wit...
[ "def", "enforce_signature", "(", "function", ")", ":", "argspec", "=", "inspect", ".", "getfullargspec", "(", "function", ")", "annotations", "=", "argspec", ".", "annotations", "argnames", "=", "argspec", ".", "args", "unnamed_annotations", "=", "{", "}", "fo...
Enforces the signature of the function by throwing TypeError's if invalid arguments are provided. The return value is not checked. You can annotate any parameter of your function with the desired type or a tuple of allowed types. If you annotate the function with a value, this value only will be allowe...
[ "Enforces", "the", "signature", "of", "the", "function", "by", "throwing", "TypeError", "s", "if", "invalid", "arguments", "are", "provided", ".", "The", "return", "value", "is", "not", "checked", "." ]
b1c4463f364bbcd0ad5138f697a52f11c9afe326
https://github.com/coala/coala-decorators-USE-cOALA-UTILS-INSTEAD/blob/b1c4463f364bbcd0ad5138f697a52f11c9afe326/coala_decorators/__init__.py#L277-L317
39,170
nicferrier/md
src/mdlib/api.py
MdMessage.as_string
def as_string(self): """Get the underlying message object as a string""" if self.headers_only: self.msgobj = self._get_content() # We could just use msgobj.as_string() but this is more flexible... we might need it. from email.generator import Generator fp = StringIO(...
python
def as_string(self): """Get the underlying message object as a string""" if self.headers_only: self.msgobj = self._get_content() # We could just use msgobj.as_string() but this is more flexible... we might need it. from email.generator import Generator fp = StringIO(...
[ "def", "as_string", "(", "self", ")", ":", "if", "self", ".", "headers_only", ":", "self", ".", "msgobj", "=", "self", ".", "_get_content", "(", ")", "# We could just use msgobj.as_string() but this is more flexible... we might need it.", "from", "email", ".", "genera...
Get the underlying message object as a string
[ "Get", "the", "underlying", "message", "object", "as", "a", "string" ]
302ca8882dae060fb15bd5ae470d8e661fb67ec4
https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/api.py#L94-L105
39,171
nicferrier/md
src/mdlib/api.py
MdMessage.iteritems
def iteritems(self): """Present the email headers""" for n,v in self.msgobj.__dict__["_headers"]: yield n.lower(), v return
python
def iteritems(self): """Present the email headers""" for n,v in self.msgobj.__dict__["_headers"]: yield n.lower(), v return
[ "def", "iteritems", "(", "self", ")", ":", "for", "n", ",", "v", "in", "self", ".", "msgobj", ".", "__dict__", "[", "\"_headers\"", "]", ":", "yield", "n", ".", "lower", "(", ")", ",", "v", "return" ]
Present the email headers
[ "Present", "the", "email", "headers" ]
302ca8882dae060fb15bd5ae470d8e661fb67ec4
https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/api.py#L129-L133
39,172
nicferrier/md
src/mdlib/api.py
MdMessage._set_flag
def _set_flag(self, flag): """Turns the specified flag on""" self.folder._invalidate_cache() # TODO::: turn the flag off when it's already on def replacer(m): return "%s/%s.%s%s" % ( joinpath(self.folder.base, self.folder.folder, "cur"), m.grou...
python
def _set_flag(self, flag): """Turns the specified flag on""" self.folder._invalidate_cache() # TODO::: turn the flag off when it's already on def replacer(m): return "%s/%s.%s%s" % ( joinpath(self.folder.base, self.folder.folder, "cur"), m.grou...
[ "def", "_set_flag", "(", "self", ",", "flag", ")", ":", "self", ".", "folder", ".", "_invalidate_cache", "(", ")", "# TODO::: turn the flag off when it's already on", "def", "replacer", "(", "m", ")", ":", "return", "\"%s/%s.%s%s\"", "%", "(", "joinpath", "(", ...
Turns the specified flag on
[ "Turns", "the", "specified", "flag", "on" ]
302ca8882dae060fb15bd5ae470d8e661fb67ec4
https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/api.py#L143-L159
39,173
nicferrier/md
src/mdlib/api.py
_KeysCache._get_message
def _get_message(self, key, since=None): """Return the MdMessage object for the key. The object is either returned from the cache in the store or made, cached and then returned. If 'since' is passed in the modification time of the file is checked and the message is only returne...
python
def _get_message(self, key, since=None): """Return the MdMessage object for the key. The object is either returned from the cache in the store or made, cached and then returned. If 'since' is passed in the modification time of the file is checked and the message is only returne...
[ "def", "_get_message", "(", "self", ",", "key", ",", "since", "=", "None", ")", ":", "stored", "=", "self", ".", "store", "[", "key", "]", "if", "isinstance", "(", "stored", ",", "dict", ")", ":", "filename", "=", "stored", "[", "\"path\"", "]", "f...
Return the MdMessage object for the key. The object is either returned from the cache in the store or made, cached and then returned. If 'since' is passed in the modification time of the file is checked and the message is only returned if the mtime is since the specified time. ...
[ "Return", "the", "MdMessage", "object", "for", "the", "key", "." ]
302ca8882dae060fb15bd5ae470d8e661fb67ec4
https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/api.py#L209-L244
39,174
nicferrier/md
src/mdlib/api.py
MdFolder._foldername
def _foldername(self, additionalpath=""): """Dot decorate a folder name.""" if not self._foldername_cache.get(additionalpath): fn = joinpath(self.base, self.folder, additionalpath) \ if not self.is_subfolder \ else joinpath(self.base, ".%s" % self.folder, addi...
python
def _foldername(self, additionalpath=""): """Dot decorate a folder name.""" if not self._foldername_cache.get(additionalpath): fn = joinpath(self.base, self.folder, additionalpath) \ if not self.is_subfolder \ else joinpath(self.base, ".%s" % self.folder, addi...
[ "def", "_foldername", "(", "self", ",", "additionalpath", "=", "\"\"", ")", ":", "if", "not", "self", ".", "_foldername_cache", ".", "get", "(", "additionalpath", ")", ":", "fn", "=", "joinpath", "(", "self", ".", "base", ",", "self", ".", "folder", ",...
Dot decorate a folder name.
[ "Dot", "decorate", "a", "folder", "name", "." ]
302ca8882dae060fb15bd5ae470d8e661fb67ec4
https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/api.py#L298-L305
39,175
nicferrier/md
src/mdlib/api.py
MdFolder.folders
def folders(self): """Return a map of the subfolder objects for this folder. This is a snapshot of the folder list at the time the call was made. It does not update over time. The map contains MdFolder objects: maildir.folders()["Sent"] might retrieve the folder .S...
python
def folders(self): """Return a map of the subfolder objects for this folder. This is a snapshot of the folder list at the time the call was made. It does not update over time. The map contains MdFolder objects: maildir.folders()["Sent"] might retrieve the folder .S...
[ "def", "folders", "(", "self", ")", ":", "entrys", "=", "self", ".", "filesystem", ".", "listdir", "(", "abspath", "(", "self", ".", "_foldername", "(", ")", ")", ")", "regex", "=", "re", ".", "compile", "(", "\"\\\\..*\"", ")", "just_dirs", "=", "di...
Return a map of the subfolder objects for this folder. This is a snapshot of the folder list at the time the call was made. It does not update over time. The map contains MdFolder objects: maildir.folders()["Sent"] might retrieve the folder .Sent from the maildir.
[ "Return", "a", "map", "of", "the", "subfolder", "objects", "for", "this", "folder", "." ]
302ca8882dae060fb15bd5ae470d8e661fb67ec4
https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/api.py#L307-L355
39,176
nicferrier/md
src/mdlib/api.py
MdFolder.move
def move(self, key, folder): """Move the specified key to folder. folder must be an MdFolder instance. MdFolders can be obtained through the 'folders' method call. """ # Basically this is a sophisticated __delitem__ # We need the path so we can make it in the new folder ...
python
def move(self, key, folder): """Move the specified key to folder. folder must be an MdFolder instance. MdFolders can be obtained through the 'folders' method call. """ # Basically this is a sophisticated __delitem__ # We need the path so we can make it in the new folder ...
[ "def", "move", "(", "self", ",", "key", ",", "folder", ")", ":", "# Basically this is a sophisticated __delitem__", "# We need the path so we can make it in the new folder", "path", ",", "host", ",", "flags", "=", "self", ".", "_exists", "(", "key", ")", "self", "."...
Move the specified key to folder. folder must be an MdFolder instance. MdFolders can be obtained through the 'folders' method call.
[ "Move", "the", "specified", "key", "to", "folder", "." ]
302ca8882dae060fb15bd5ae470d8e661fb67ec4
https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/api.py#L357-L377
39,177
nicferrier/md
src/mdlib/api.py
MdFolder._muaprocessnew
def _muaprocessnew(self): """Moves all 'new' files into cur, correctly flagging""" foldername = self._foldername("new") files = self.filesystem.listdir(foldername) for filename in files: if filename == "": continue curfilename = self._foldername(jo...
python
def _muaprocessnew(self): """Moves all 'new' files into cur, correctly flagging""" foldername = self._foldername("new") files = self.filesystem.listdir(foldername) for filename in files: if filename == "": continue curfilename = self._foldername(jo...
[ "def", "_muaprocessnew", "(", "self", ")", ":", "foldername", "=", "self", ".", "_foldername", "(", "\"new\"", ")", "files", "=", "self", ".", "filesystem", ".", "listdir", "(", "foldername", ")", "for", "filename", "in", "files", ":", "if", "filename", ...
Moves all 'new' files into cur, correctly flagging
[ "Moves", "all", "new", "files", "into", "cur", "correctly", "flagging" ]
302ca8882dae060fb15bd5ae470d8e661fb67ec4
https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/api.py#L382-L394
39,178
nicferrier/md
src/mdlib/api.py
MdFolder._exists
def _exists(self, key): """Find a key in a particular section Searches through all the files and looks for matches with a regex. """ filecache, keycache = self._fileslist() msg = keycache.get(key, None) if msg: path = msg.filename meta = filecache...
python
def _exists(self, key): """Find a key in a particular section Searches through all the files and looks for matches with a regex. """ filecache, keycache = self._fileslist() msg = keycache.get(key, None) if msg: path = msg.filename meta = filecache...
[ "def", "_exists", "(", "self", ",", "key", ")", ":", "filecache", ",", "keycache", "=", "self", ".", "_fileslist", "(", ")", "msg", "=", "keycache", ".", "get", "(", "key", ",", "None", ")", "if", "msg", ":", "path", "=", "msg", ".", "filename", ...
Find a key in a particular section Searches through all the files and looks for matches with a regex.
[ "Find", "a", "key", "in", "a", "particular", "section" ]
302ca8882dae060fb15bd5ae470d8e661fb67ec4
https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/api.py#L432-L443
39,179
mjirik/sed3
sed3/sed3.py
__put_slice_in_slim
def __put_slice_in_slim(slim, dataim, sh, i): """ put one small slice as a tile in a big image """ a, b = np.unravel_index(int(i), sh) st0 = int(dataim.shape[0] * a) st1 = int(dataim.shape[1] * b) sp0 = int(st0 + dataim.shape[0]) sp1 = int(st1 + dataim.shape[1]) slim[ ...
python
def __put_slice_in_slim(slim, dataim, sh, i): """ put one small slice as a tile in a big image """ a, b = np.unravel_index(int(i), sh) st0 = int(dataim.shape[0] * a) st1 = int(dataim.shape[1] * b) sp0 = int(st0 + dataim.shape[0]) sp1 = int(st1 + dataim.shape[1]) slim[ ...
[ "def", "__put_slice_in_slim", "(", "slim", ",", "dataim", ",", "sh", ",", "i", ")", ":", "a", ",", "b", "=", "np", ".", "unravel_index", "(", "int", "(", "i", ")", ",", "sh", ")", "st0", "=", "int", "(", "dataim", ".", "shape", "[", "0", "]", ...
put one small slice as a tile in a big image
[ "put", "one", "small", "slice", "as", "a", "tile", "in", "a", "big", "image" ]
270c12836218fd2fa2fe192c6b6fef882322c173
https://github.com/mjirik/sed3/blob/270c12836218fd2fa2fe192c6b6fef882322c173/sed3/sed3.py#L738-L754
39,180
mjirik/sed3
sed3/sed3.py
_import_data
def _import_data(data, axis, slice_step, first_slice_offset=0): """ import ndarray or SimpleITK data """ try: import SimpleITK as sitk if type(data) is sitk.SimpleITK.Image: data = sitk.GetArrayFromImage(data) except: pass data = __select_slices(da...
python
def _import_data(data, axis, slice_step, first_slice_offset=0): """ import ndarray or SimpleITK data """ try: import SimpleITK as sitk if type(data) is sitk.SimpleITK.Image: data = sitk.GetArrayFromImage(data) except: pass data = __select_slices(da...
[ "def", "_import_data", "(", "data", ",", "axis", ",", "slice_step", ",", "first_slice_offset", "=", "0", ")", ":", "try", ":", "import", "SimpleITK", "as", "sitk", "if", "type", "(", "data", ")", "is", "sitk", ".", "SimpleITK", ".", "Image", ":", "data...
import ndarray or SimpleITK data
[ "import", "ndarray", "or", "SimpleITK", "data" ]
270c12836218fd2fa2fe192c6b6fef882322c173
https://github.com/mjirik/sed3/blob/270c12836218fd2fa2fe192c6b6fef882322c173/sed3/sed3.py#L845-L857
39,181
mjirik/sed3
sed3/sed3.py
index_to_coords
def index_to_coords(index, shape): '''convert index to coordinates given the shape''' coords = [] for i in xrange(1, len(shape)): divisor = int(np.product(shape[i:])) value = index // divisor coords.append(value) index -= value * divisor coords.append(index) ...
python
def index_to_coords(index, shape): '''convert index to coordinates given the shape''' coords = [] for i in xrange(1, len(shape)): divisor = int(np.product(shape[i:])) value = index // divisor coords.append(value) index -= value * divisor coords.append(index) ...
[ "def", "index_to_coords", "(", "index", ",", "shape", ")", ":", "coords", "=", "[", "]", "for", "i", "in", "xrange", "(", "1", ",", "len", "(", "shape", ")", ")", ":", "divisor", "=", "int", "(", "np", ".", "product", "(", "shape", "[", "i", ":...
convert index to coordinates given the shape
[ "convert", "index", "to", "coordinates", "given", "the", "shape" ]
270c12836218fd2fa2fe192c6b6fef882322c173
https://github.com/mjirik/sed3/blob/270c12836218fd2fa2fe192c6b6fef882322c173/sed3/sed3.py#L1115-L1124
39,182
mjirik/sed3
sed3/sed3.py
sed3.on_scroll
def on_scroll(self, event): ''' mouse wheel is used for setting slider value''' if event.button == 'up': self.next_slice() if event.button == 'down': self.prev_slice() self.actual_slice_slider.set_val(self.actual_slice)
python
def on_scroll(self, event): ''' mouse wheel is used for setting slider value''' if event.button == 'up': self.next_slice() if event.button == 'down': self.prev_slice() self.actual_slice_slider.set_val(self.actual_slice)
[ "def", "on_scroll", "(", "self", ",", "event", ")", ":", "if", "event", ".", "button", "==", "'up'", ":", "self", ".", "next_slice", "(", ")", "if", "event", ".", "button", "==", "'down'", ":", "self", ".", "prev_slice", "(", ")", "self", ".", "act...
mouse wheel is used for setting slider value
[ "mouse", "wheel", "is", "used", "for", "setting", "slider", "value" ]
270c12836218fd2fa2fe192c6b6fef882322c173
https://github.com/mjirik/sed3/blob/270c12836218fd2fa2fe192c6b6fef882322c173/sed3/sed3.py#L517-L523
39,183
mjirik/sed3
sed3/sed3.py
sed3.on_press
def on_press(self, event): 'on but-ton press we will see if the mouse is over us and store data' if event.inaxes != self.ax: return # contains, attrd = self.rect.contains(event) # if not contains: return # print('event contains', self.rect.xy) # x0, y0 ...
python
def on_press(self, event): 'on but-ton press we will see if the mouse is over us and store data' if event.inaxes != self.ax: return # contains, attrd = self.rect.contains(event) # if not contains: return # print('event contains', self.rect.xy) # x0, y0 ...
[ "def", "on_press", "(", "self", ",", "event", ")", ":", "if", "event", ".", "inaxes", "!=", "self", ".", "ax", ":", "return", "# contains, attrd = self.rect.contains(event)\r", "# if not contains: return\r", "# print('event contains', self.rect.xy)\r", "# x0, y0 = self.rect...
on but-ton press we will see if the mouse is over us and store data
[ "on", "but", "-", "ton", "press", "we", "will", "see", "if", "the", "mouse", "is", "over", "us", "and", "store", "data" ]
270c12836218fd2fa2fe192c6b6fef882322c173
https://github.com/mjirik/sed3/blob/270c12836218fd2fa2fe192c6b6fef882322c173/sed3/sed3.py#L529-L537
39,184
mjirik/sed3
sed3/sed3.py
sed3.on_motion
def on_motion(self, event): 'on motion we will move the rect if the mouse is over us' if self.press is None: return if event.inaxes != self.ax: return # print(event.inaxes) x0, y0, btn = self.press x0.append(event.xdata) y0.app...
python
def on_motion(self, event): 'on motion we will move the rect if the mouse is over us' if self.press is None: return if event.inaxes != self.ax: return # print(event.inaxes) x0, y0, btn = self.press x0.append(event.xdata) y0.app...
[ "def", "on_motion", "(", "self", ",", "event", ")", ":", "if", "self", ".", "press", "is", "None", ":", "return", "if", "event", ".", "inaxes", "!=", "self", ".", "ax", ":", "return", "# print(event.inaxes)\r", "x0", ",", "y0", ",", "btn", "=", "self...
on motion we will move the rect if the mouse is over us
[ "on", "motion", "we", "will", "move", "the", "rect", "if", "the", "mouse", "is", "over", "us" ]
270c12836218fd2fa2fe192c6b6fef882322c173
https://github.com/mjirik/sed3/blob/270c12836218fd2fa2fe192c6b6fef882322c173/sed3/sed3.py#L540-L551
39,185
mjirik/sed3
sed3/sed3.py
sed3.on_release
def on_release(self, event): 'on release we reset the press data' if self.press is None: return # print(self.press) x0, y0, btn = self.press if btn == 1: color = 'r' elif btn == 2: color = 'b' # noqa # plt.axes(self...
python
def on_release(self, event): 'on release we reset the press data' if self.press is None: return # print(self.press) x0, y0, btn = self.press if btn == 1: color = 'r' elif btn == 2: color = 'b' # noqa # plt.axes(self...
[ "def", "on_release", "(", "self", ",", "event", ")", ":", "if", "self", ".", "press", "is", "None", ":", "return", "# print(self.press)\r", "x0", ",", "y0", ",", "btn", "=", "self", ".", "press", "if", "btn", "==", "1", ":", "color", "=", "'r'", "e...
on release we reset the press data
[ "on", "release", "we", "reset", "the", "press", "data" ]
270c12836218fd2fa2fe192c6b6fef882322c173
https://github.com/mjirik/sed3/blob/270c12836218fd2fa2fe192c6b6fef882322c173/sed3/sed3.py#L553-L573
39,186
mjirik/sed3
sed3/sed3.py
sed3.get_seed_sub
def get_seed_sub(self, label): """ Return list of all seeds with specific label """ sx, sy, sz = np.nonzero(self.seeds == label) return sx, sy, sz
python
def get_seed_sub(self, label): """ Return list of all seeds with specific label """ sx, sy, sz = np.nonzero(self.seeds == label) return sx, sy, sz
[ "def", "get_seed_sub", "(", "self", ",", "label", ")", ":", "sx", ",", "sy", ",", "sz", "=", "np", ".", "nonzero", "(", "self", ".", "seeds", "==", "label", ")", "return", "sx", ",", "sy", ",", "sz" ]
Return list of all seeds with specific label
[ "Return", "list", "of", "all", "seeds", "with", "specific", "label" ]
270c12836218fd2fa2fe192c6b6fef882322c173
https://github.com/mjirik/sed3/blob/270c12836218fd2fa2fe192c6b6fef882322c173/sed3/sed3.py#L595-L600
39,187
Ceasar/trees
trees/heap.py
heap.push
def push(self, item): '''Push the value item onto the heap, maintaining the heap invariant. If the item is not hashable, a TypeError is raised. ''' hash(item) heapq.heappush(self._items, item)
python
def push(self, item): '''Push the value item onto the heap, maintaining the heap invariant. If the item is not hashable, a TypeError is raised. ''' hash(item) heapq.heappush(self._items, item)
[ "def", "push", "(", "self", ",", "item", ")", ":", "hash", "(", "item", ")", "heapq", ".", "heappush", "(", "self", ".", "_items", ",", "item", ")" ]
Push the value item onto the heap, maintaining the heap invariant. If the item is not hashable, a TypeError is raised.
[ "Push", "the", "value", "item", "onto", "the", "heap", "maintaining", "the", "heap", "invariant", ".", "If", "the", "item", "is", "not", "hashable", "a", "TypeError", "is", "raised", "." ]
09059857112d3607942c81e87ab9ad04be4641f7
https://github.com/Ceasar/trees/blob/09059857112d3607942c81e87ab9ad04be4641f7/trees/heap.py#L51-L56
39,188
what-studio/smartformat
smartformat/local.py
LocalFormatter.format_field_by_match
def format_field_by_match(self, value, match): """Formats a field by a Regex match of the format spec pattern.""" groups = match.groups() fill, align, sign, sharp, zero, width, comma, prec, type_ = groups if not comma and not prec and type_ not in list('fF%'): return None ...
python
def format_field_by_match(self, value, match): """Formats a field by a Regex match of the format spec pattern.""" groups = match.groups() fill, align, sign, sharp, zero, width, comma, prec, type_ = groups if not comma and not prec and type_ not in list('fF%'): return None ...
[ "def", "format_field_by_match", "(", "self", ",", "value", ",", "match", ")", ":", "groups", "=", "match", ".", "groups", "(", ")", "fill", ",", "align", ",", "sign", ",", "sharp", ",", "zero", ",", "width", ",", "comma", ",", "prec", ",", "type_", ...
Formats a field by a Regex match of the format spec pattern.
[ "Formats", "a", "field", "by", "a", "Regex", "match", "of", "the", "format", "spec", "pattern", "." ]
5731203cbf29617ab8d42542f9dac03d5e34b217
https://github.com/what-studio/smartformat/blob/5731203cbf29617ab8d42542f9dac03d5e34b217/smartformat/local.py#L102-L133
39,189
jaredLunde/redis_structures
redis_structures/debug/__init__.py
Timer.reset
def reset(self): """ Resets the time intervals """ self._start = 0 self._first_start = 0 self._stop = time.perf_counter() self._array = None self._array_len = 0 self.intervals = [] self._intervals_len = 0
python
def reset(self): """ Resets the time intervals """ self._start = 0 self._first_start = 0 self._stop = time.perf_counter() self._array = None self._array_len = 0 self.intervals = [] self._intervals_len = 0
[ "def", "reset", "(", "self", ")", ":", "self", ".", "_start", "=", "0", "self", ".", "_first_start", "=", "0", "self", ".", "_stop", "=", "time", ".", "perf_counter", "(", ")", "self", ".", "_array", "=", "None", "self", ".", "_array_len", "=", "0"...
Resets the time intervals
[ "Resets", "the", "time", "intervals" ]
b9cce5f5c85db5e12c292633ff8d04e3ae053294
https://github.com/jaredLunde/redis_structures/blob/b9cce5f5c85db5e12c292633ff8d04e3ae053294/redis_structures/debug/__init__.py#L2147-L2155
39,190
HPENetworking/topology_lib_ip
setup.py
read
def read(filename): """ Read a file relative to setup.py location. """ import os here = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(here, filename)) as fd: return fd.read()
python
def read(filename): """ Read a file relative to setup.py location. """ import os here = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(here, filename)) as fd: return fd.read()
[ "def", "read", "(", "filename", ")", ":", "import", "os", "here", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "__file__", ")", ")", "with", "open", "(", "os", ".", "path", ".", "join", "(", "here", ",", ...
Read a file relative to setup.py location.
[ "Read", "a", "file", "relative", "to", "setup", ".", "py", "location", "." ]
c69cc3db80d96575d787fdc903a9370d2df1c5ae
https://github.com/HPENetworking/topology_lib_ip/blob/c69cc3db80d96575d787fdc903a9370d2df1c5ae/setup.py#L22-L29
39,191
HPENetworking/topology_lib_ip
setup.py
find_version
def find_version(filename): """ Find package version in file. """ import re content = read(filename) version_match = re.search( r"^__version__ = ['\"]([^'\"]*)['\"]", content, re.M ) if version_match: return version_match.group(1) raise RuntimeError('Unable to find ve...
python
def find_version(filename): """ Find package version in file. """ import re content = read(filename) version_match = re.search( r"^__version__ = ['\"]([^'\"]*)['\"]", content, re.M ) if version_match: return version_match.group(1) raise RuntimeError('Unable to find ve...
[ "def", "find_version", "(", "filename", ")", ":", "import", "re", "content", "=", "read", "(", "filename", ")", "version_match", "=", "re", ".", "search", "(", "r\"^__version__ = ['\\\"]([^'\\\"]*)['\\\"]\"", ",", "content", ",", "re", ".", "M", ")", "if", "...
Find package version in file.
[ "Find", "package", "version", "in", "file", "." ]
c69cc3db80d96575d787fdc903a9370d2df1c5ae
https://github.com/HPENetworking/topology_lib_ip/blob/c69cc3db80d96575d787fdc903a9370d2df1c5ae/setup.py#L32-L43
39,192
HPENetworking/topology_lib_ip
setup.py
find_requirements
def find_requirements(filename): """ Find requirements in file. """ import string content = read(filename) requirements = [] for line in content.splitlines(): line = line.strip() if line and line[:1] in string.ascii_letters: requirements.append(line) return re...
python
def find_requirements(filename): """ Find requirements in file. """ import string content = read(filename) requirements = [] for line in content.splitlines(): line = line.strip() if line and line[:1] in string.ascii_letters: requirements.append(line) return re...
[ "def", "find_requirements", "(", "filename", ")", ":", "import", "string", "content", "=", "read", "(", "filename", ")", "requirements", "=", "[", "]", "for", "line", "in", "content", ".", "splitlines", "(", ")", ":", "line", "=", "line", ".", "strip", ...
Find requirements in file.
[ "Find", "requirements", "in", "file", "." ]
c69cc3db80d96575d787fdc903a9370d2df1c5ae
https://github.com/HPENetworking/topology_lib_ip/blob/c69cc3db80d96575d787fdc903a9370d2df1c5ae/setup.py#L46-L57
39,193
botstory/botstory
botstory/integrations/ga/universal_analytics/tracker.py
generate_uuid
def generate_uuid(basedata=None): """ Provides a _random_ UUID with no input, or a UUID4-format MD5 checksum of any input data provided """ if basedata is None: return str(uuid.uuid4()) elif isinstance(basedata, str): checksum = hashlib.md5(basedata).hexdigest() return '%8s-%4s-%4s-%...
python
def generate_uuid(basedata=None): """ Provides a _random_ UUID with no input, or a UUID4-format MD5 checksum of any input data provided """ if basedata is None: return str(uuid.uuid4()) elif isinstance(basedata, str): checksum = hashlib.md5(basedata).hexdigest() return '%8s-%4s-%4s-%...
[ "def", "generate_uuid", "(", "basedata", "=", "None", ")", ":", "if", "basedata", "is", "None", ":", "return", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "elif", "isinstance", "(", "basedata", ",", "str", ")", ":", "checksum", "=", "hashlib", "...
Provides a _random_ UUID with no input, or a UUID4-format MD5 checksum of any input data provided
[ "Provides", "a", "_random_", "UUID", "with", "no", "input", "or", "a", "UUID4", "-", "format", "MD5", "checksum", "of", "any", "input", "data", "provided" ]
9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3
https://github.com/botstory/botstory/blob/9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3/botstory/integrations/ga/universal_analytics/tracker.py#L30-L37
39,194
botstory/botstory
botstory/integrations/ga/universal_analytics/tracker.py
Time.from_unix
def from_unix(cls, seconds, milliseconds=0): """ Produce a full |datetime.datetime| object from a Unix timestamp """ base = list(time.gmtime(seconds))[0:6] base.append(milliseconds * 1000) # microseconds return cls(*base)
python
def from_unix(cls, seconds, milliseconds=0): """ Produce a full |datetime.datetime| object from a Unix timestamp """ base = list(time.gmtime(seconds))[0:6] base.append(milliseconds * 1000) # microseconds return cls(*base)
[ "def", "from_unix", "(", "cls", ",", "seconds", ",", "milliseconds", "=", "0", ")", ":", "base", "=", "list", "(", "time", ".", "gmtime", "(", "seconds", ")", ")", "[", "0", ":", "6", "]", "base", ".", "append", "(", "milliseconds", "*", "1000", ...
Produce a full |datetime.datetime| object from a Unix timestamp
[ "Produce", "a", "full", "|datetime", ".", "datetime|", "object", "from", "a", "Unix", "timestamp" ]
9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3
https://github.com/botstory/botstory/blob/9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3/botstory/integrations/ga/universal_analytics/tracker.py#L44-L48
39,195
botstory/botstory
botstory/integrations/ga/universal_analytics/tracker.py
Time.to_unix
def to_unix(cls, timestamp): """ Wrapper over time module to produce Unix epoch time as a float """ if not isinstance(timestamp, datetime.datetime): raise TypeError('Time.milliseconds expects a datetime object') base = time.mktime(timestamp.timetuple()) return base
python
def to_unix(cls, timestamp): """ Wrapper over time module to produce Unix epoch time as a float """ if not isinstance(timestamp, datetime.datetime): raise TypeError('Time.milliseconds expects a datetime object') base = time.mktime(timestamp.timetuple()) return base
[ "def", "to_unix", "(", "cls", ",", "timestamp", ")", ":", "if", "not", "isinstance", "(", "timestamp", ",", "datetime", ".", "datetime", ")", ":", "raise", "TypeError", "(", "'Time.milliseconds expects a datetime object'", ")", "base", "=", "time", ".", "mktim...
Wrapper over time module to produce Unix epoch time as a float
[ "Wrapper", "over", "time", "module", "to", "produce", "Unix", "epoch", "time", "as", "a", "float" ]
9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3
https://github.com/botstory/botstory/blob/9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3/botstory/integrations/ga/universal_analytics/tracker.py#L51-L56
39,196
botstory/botstory
botstory/integrations/ga/universal_analytics/tracker.py
HTTPRequest.fixUTF8
def fixUTF8(cls, data): # Ensure proper encoding for UA's servers... """ Convert all strings to UTF-8 """ for key in data: if isinstance(data[key], str): data[key] = data[key].encode('utf-8') return data
python
def fixUTF8(cls, data): # Ensure proper encoding for UA's servers... """ Convert all strings to UTF-8 """ for key in data: if isinstance(data[key], str): data[key] = data[key].encode('utf-8') return data
[ "def", "fixUTF8", "(", "cls", ",", "data", ")", ":", "# Ensure proper encoding for UA's servers...", "for", "key", "in", "data", ":", "if", "isinstance", "(", "data", "[", "key", "]", ",", "str", ")", ":", "data", "[", "key", "]", "=", "data", "[", "ke...
Convert all strings to UTF-8
[ "Convert", "all", "strings", "to", "UTF", "-", "8" ]
9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3
https://github.com/botstory/botstory/blob/9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3/botstory/integrations/ga/universal_analytics/tracker.py#L86-L91
39,197
botstory/botstory
botstory/integrations/ga/universal_analytics/tracker.py
Tracker.consume_options
def consume_options(cls, data, hittype, args): """ Interpret sequential arguments related to known hittypes based on declared structures """ opt_position = 0 data['t'] = hittype # integrate hit type parameter if hittype in cls.option_sequence: for expected_type, optname in c...
python
def consume_options(cls, data, hittype, args): """ Interpret sequential arguments related to known hittypes based on declared structures """ opt_position = 0 data['t'] = hittype # integrate hit type parameter if hittype in cls.option_sequence: for expected_type, optname in c...
[ "def", "consume_options", "(", "cls", ",", "data", ",", "hittype", ",", "args", ")", ":", "opt_position", "=", "0", "data", "[", "'t'", "]", "=", "hittype", "# integrate hit type parameter", "if", "hittype", "in", "cls", ".", "option_sequence", ":", "for", ...
Interpret sequential arguments related to known hittypes based on declared structures
[ "Interpret", "sequential", "arguments", "related", "to", "known", "hittypes", "based", "on", "declared", "structures" ]
9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3
https://github.com/botstory/botstory/blob/9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3/botstory/integrations/ga/universal_analytics/tracker.py#L173-L181
39,198
botstory/botstory
botstory/integrations/ga/universal_analytics/tracker.py
Tracker.set_timestamp
def set_timestamp(self, data): """ Interpret time-related options, apply queue-time parameter as needed """ if 'hittime' in data: # an absolute timestamp data['qt'] = self.hittime(timestamp=data.pop('hittime', None)) if 'hitage' in data: # a relative age (in seconds) da...
python
def set_timestamp(self, data): """ Interpret time-related options, apply queue-time parameter as needed """ if 'hittime' in data: # an absolute timestamp data['qt'] = self.hittime(timestamp=data.pop('hittime', None)) if 'hitage' in data: # a relative age (in seconds) da...
[ "def", "set_timestamp", "(", "self", ",", "data", ")", ":", "if", "'hittime'", "in", "data", ":", "# an absolute timestamp", "data", "[", "'qt'", "]", "=", "self", ".", "hittime", "(", "timestamp", "=", "data", ".", "pop", "(", "'hittime'", ",", "None", ...
Interpret time-related options, apply queue-time parameter as needed
[ "Interpret", "time", "-", "related", "options", "apply", "queue", "-", "time", "parameter", "as", "needed" ]
9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3
https://github.com/botstory/botstory/blob/9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3/botstory/integrations/ga/universal_analytics/tracker.py#L218-L223
39,199
botstory/botstory
botstory/integrations/ga/universal_analytics/tracker.py
Tracker.send
async def send(self, hittype, *args, **data): """ Transmit HTTP requests to Google Analytics using the measurement protocol """ if hittype not in self.valid_hittypes: raise KeyError('Unsupported Universal Analytics Hit Type: {0}'.format(repr(hittype))) self.set_timestamp(data) ...
python
async def send(self, hittype, *args, **data): """ Transmit HTTP requests to Google Analytics using the measurement protocol """ if hittype not in self.valid_hittypes: raise KeyError('Unsupported Universal Analytics Hit Type: {0}'.format(repr(hittype))) self.set_timestamp(data) ...
[ "async", "def", "send", "(", "self", ",", "hittype", ",", "*", "args", ",", "*", "*", "data", ")", ":", "if", "hittype", "not", "in", "self", ".", "valid_hittypes", ":", "raise", "KeyError", "(", "'Unsupported Universal Analytics Hit Type: {0}'", ".", "forma...
Transmit HTTP requests to Google Analytics using the measurement protocol
[ "Transmit", "HTTP", "requests", "to", "Google", "Analytics", "using", "the", "measurement", "protocol" ]
9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3
https://github.com/botstory/botstory/blob/9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3/botstory/integrations/ga/universal_analytics/tracker.py#L225-L249