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
38,900
jic-dtool/dtool-cli
dtool_cli/cli.py
dtool
def dtool(debug): """Tool to work with datasets.""" level = logging.WARNING if debug: level = logging.DEBUG logging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=level)
python
def dtool(debug): """Tool to work with datasets.""" level = logging.WARNING if debug: level = logging.DEBUG logging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=level)
[ "def", "dtool", "(", "debug", ")", ":", "level", "=", "logging", ".", "WARNING", "if", "debug", ":", "level", "=", "logging", ".", "DEBUG", "logging", ".", "basicConfig", "(", "format", "=", "'%(asctime)s - %(name)s - %(levelname)s - %(message)s'", ",", "level",...
Tool to work with datasets.
[ "Tool", "to", "work", "with", "datasets", "." ]
010d573d98cfe870cf489844c3feaab4976425ff
https://github.com/jic-dtool/dtool-cli/blob/010d573d98cfe870cf489844c3feaab4976425ff/dtool_cli/cli.py#L127-L134
38,901
HPCC-Cloud-Computing/CAL
calplus/v1/compute/drivers/openstack.py
OpenstackDriver.add_nic
def add_nic(self, instance_id, net_id): """Add a Network Interface Controller""" #TODO: upgrade with port_id and fixed_ip in future self.client.servers.interface_attach( instance_id, None, net_id, None) return True
python
def add_nic(self, instance_id, net_id): """Add a Network Interface Controller""" #TODO: upgrade with port_id and fixed_ip in future self.client.servers.interface_attach( instance_id, None, net_id, None) return True
[ "def", "add_nic", "(", "self", ",", "instance_id", ",", "net_id", ")", ":", "#TODO: upgrade with port_id and fixed_ip in future", "self", ".", "client", ".", "servers", ".", "interface_attach", "(", "instance_id", ",", "None", ",", "net_id", ",", "None", ")", "r...
Add a Network Interface Controller
[ "Add", "a", "Network", "Interface", "Controller" ]
7134b3dfe9ee3a383506a592765c7a12fa4ca1e9
https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/v1/compute/drivers/openstack.py#L112-L117
38,902
HPCC-Cloud-Computing/CAL
calplus/v1/compute/drivers/openstack.py
OpenstackDriver.delete_nic
def delete_nic(self, instance_id, port_id): """Delete a Network Interface Controller""" self.client.servers.interface_detach(instance_id, port_id) return True
python
def delete_nic(self, instance_id, port_id): """Delete a Network Interface Controller""" self.client.servers.interface_detach(instance_id, port_id) return True
[ "def", "delete_nic", "(", "self", ",", "instance_id", ",", "port_id", ")", ":", "self", ".", "client", ".", "servers", ".", "interface_detach", "(", "instance_id", ",", "port_id", ")", "return", "True" ]
Delete a Network Interface Controller
[ "Delete", "a", "Network", "Interface", "Controller" ]
7134b3dfe9ee3a383506a592765c7a12fa4ca1e9
https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/v1/compute/drivers/openstack.py#L119-L122
38,903
HPCC-Cloud-Computing/CAL
calplus/v1/compute/drivers/openstack.py
OpenstackDriver.disassociate_public_ip
def disassociate_public_ip(self, public_ip_id): """Disassociate a external IP""" floating_ip = self.client.floating_ips.get(public_ip_id) floating_ip = floating_ip.to_dict() instance_id = floating_ip.get('instance_id') address = floating_ip.get('ip') self.client.servers....
python
def disassociate_public_ip(self, public_ip_id): """Disassociate a external IP""" floating_ip = self.client.floating_ips.get(public_ip_id) floating_ip = floating_ip.to_dict() instance_id = floating_ip.get('instance_id') address = floating_ip.get('ip') self.client.servers....
[ "def", "disassociate_public_ip", "(", "self", ",", "public_ip_id", ")", ":", "floating_ip", "=", "self", ".", "client", ".", "floating_ips", ".", "get", "(", "public_ip_id", ")", "floating_ip", "=", "floating_ip", ".", "to_dict", "(", ")", "instance_id", "=", ...
Disassociate a external IP
[ "Disassociate", "a", "external", "IP" ]
7134b3dfe9ee3a383506a592765c7a12fa4ca1e9
https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/v1/compute/drivers/openstack.py#L149-L158
38,904
diamondman/proteusisc
proteusisc/promise.py
TDOPromise.split
def split(self, bitindex): """Split a promise into two promises at the provided index. A common operation in JTAG is reading/writing to a register. During the operation, the TMS pin must be low, but during the writing of the last bit, the TMS pin must be high. Requiring all read...
python
def split(self, bitindex): """Split a promise into two promises at the provided index. A common operation in JTAG is reading/writing to a register. During the operation, the TMS pin must be low, but during the writing of the last bit, the TMS pin must be high. Requiring all read...
[ "def", "split", "(", "self", ",", "bitindex", ")", ":", "if", "bitindex", "<", "0", ":", "raise", "ValueError", "(", "\"bitindex must be larger or equal to 0.\"", ")", "if", "bitindex", ">", "len", "(", "self", ")", ":", "raise", "ValueError", "(", "\"bitind...
Split a promise into two promises at the provided index. A common operation in JTAG is reading/writing to a register. During the operation, the TMS pin must be low, but during the writing of the last bit, the TMS pin must be high. Requiring all reads or writes to have full arbitrary ...
[ "Split", "a", "promise", "into", "two", "promises", "at", "the", "provided", "index", "." ]
7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c
https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/promise.py#L105-L149
38,905
diamondman/proteusisc
proteusisc/promise.py
TDOPromise._fulfill
def _fulfill(self, bits, ignore_nonpromised_bits=False): """Supply the promise with the bits from its associated primitive's execution. The fulfillment process must walk the promise chain backwards until it reaches the original promise and can supply the final value. The data t...
python
def _fulfill(self, bits, ignore_nonpromised_bits=False): """Supply the promise with the bits from its associated primitive's execution. The fulfillment process must walk the promise chain backwards until it reaches the original promise and can supply the final value. The data t...
[ "def", "_fulfill", "(", "self", ",", "bits", ",", "ignore_nonpromised_bits", "=", "False", ")", ":", "if", "self", ".", "_allsubsfulfilled", "(", ")", ":", "if", "not", "self", ".", "_components", ":", "if", "ignore_nonpromised_bits", ":", "self", ".", "_v...
Supply the promise with the bits from its associated primitive's execution. The fulfillment process must walk the promise chain backwards until it reaches the original promise and can supply the final value. The data that comes in can either be all a bit read for every bit writ...
[ "Supply", "the", "promise", "with", "the", "bits", "from", "its", "associated", "primitive", "s", "execution", "." ]
7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c
https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/promise.py#L151-L182
38,906
diamondman/proteusisc
proteusisc/promise.py
TDOPromise.makesubatoffset
def makesubatoffset(self, bitoffset, *, _offsetideal=None): """Create a copy of this promise with an offset, and use it as this promise's child. If this promise's primitive is being merged with another primitive, a new subpromise may be required to keep track of the new offset of data c...
python
def makesubatoffset(self, bitoffset, *, _offsetideal=None): """Create a copy of this promise with an offset, and use it as this promise's child. If this promise's primitive is being merged with another primitive, a new subpromise may be required to keep track of the new offset of data c...
[ "def", "makesubatoffset", "(", "self", ",", "bitoffset", ",", "*", ",", "_offsetideal", "=", "None", ")", ":", "if", "_offsetideal", "is", "None", ":", "_offsetideal", "=", "bitoffset", "if", "bitoffset", "is", "0", ":", "return", "self", "newpromise", "="...
Create a copy of this promise with an offset, and use it as this promise's child. If this promise's primitive is being merged with another primitive, a new subpromise may be required to keep track of the new offset of data coming from the new primitive. Args: bitoffset: An...
[ "Create", "a", "copy", "of", "this", "promise", "with", "an", "offset", "and", "use", "it", "as", "this", "promise", "s", "child", "." ]
7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c
https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/promise.py#L193-L222
38,907
diamondman/proteusisc
proteusisc/promise.py
TDOPromiseCollection.add
def add(self, promise, bitoffset, *, _offsetideal=None): """Add a promise to the promise collection at an optional offset. Args: promise: A TDOPromise to add to this collection. bitoffset: An integer offset for this new promise in the collection. _offsetideal: An int...
python
def add(self, promise, bitoffset, *, _offsetideal=None): """Add a promise to the promise collection at an optional offset. Args: promise: A TDOPromise to add to this collection. bitoffset: An integer offset for this new promise in the collection. _offsetideal: An int...
[ "def", "add", "(", "self", ",", "promise", ",", "bitoffset", ",", "*", ",", "_offsetideal", "=", "None", ")", ":", "#This Assumes that things are added in order.", "#Sorting or checking should likely be added.", "if", "_offsetideal", "is", "None", ":", "_offsetideal", ...
Add a promise to the promise collection at an optional offset. Args: promise: A TDOPromise to add to this collection. bitoffset: An integer offset for this new promise in the collection. _offsetideal: An integer offset for this new promise in the collection if the associated...
[ "Add", "a", "promise", "to", "the", "promise", "collection", "at", "an", "optional", "offset", "." ]
7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c
https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/promise.py#L239-L257
38,908
diamondman/proteusisc
proteusisc/promise.py
TDOPromiseCollection.split
def split(self, bitindex): """Split a promise into two promises. A tail bit, and the 'rest'. Same operation as the one on TDOPromise, except this works with a collection of promises and splits the appropriate one. Returns: The 'Rest' and the 'Tail'. The 'Rest' i...
python
def split(self, bitindex): """Split a promise into two promises. A tail bit, and the 'rest'. Same operation as the one on TDOPromise, except this works with a collection of promises and splits the appropriate one. Returns: The 'Rest' and the 'Tail'. The 'Rest' i...
[ "def", "split", "(", "self", ",", "bitindex", ")", ":", "if", "bitindex", "<", "0", ":", "raise", "ValueError", "(", "\"bitindex must be larger or equal to 0.\"", ")", "if", "bitindex", "==", "0", ":", "return", "None", ",", "self", "lastend", "=", "0", "s...
Split a promise into two promises. A tail bit, and the 'rest'. Same operation as the one on TDOPromise, except this works with a collection of promises and splits the appropriate one. Returns: The 'Rest' and the 'Tail'. The 'Rest' is TDOPromiseCollection containing the ...
[ "Split", "a", "promise", "into", "two", "promises", ".", "A", "tail", "bit", "and", "the", "rest", "." ]
7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c
https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/promise.py#L259-L317
38,909
diamondman/proteusisc
proteusisc/promise.py
TDOPromiseCollection.makesubatoffset
def makesubatoffset(self, bitoffset, *, _offsetideal=None): """Create a copy of this PromiseCollection with an offset applied to each contained promise and register each with their parent. If this promise's primitive is being merged with another primitive, a new subpromise may be required to ke...
python
def makesubatoffset(self, bitoffset, *, _offsetideal=None): """Create a copy of this PromiseCollection with an offset applied to each contained promise and register each with their parent. If this promise's primitive is being merged with another primitive, a new subpromise may be required to ke...
[ "def", "makesubatoffset", "(", "self", ",", "bitoffset", ",", "*", ",", "_offsetideal", "=", "None", ")", ":", "if", "_offsetideal", "is", "None", ":", "_offsetideal", "=", "bitoffset", "if", "bitoffset", "is", "0", ":", "return", "self", "newpromise", "="...
Create a copy of this PromiseCollection with an offset applied to each contained promise and register each with their parent. If this promise's primitive is being merged with another primitive, a new subpromise may be required to keep track of the new offset of data coming from the new primitiv...
[ "Create", "a", "copy", "of", "this", "PromiseCollection", "with", "an", "offset", "applied", "to", "each", "contained", "promise", "and", "register", "each", "with", "their", "parent", "." ]
7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c
https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/promise.py#L335-L358
38,910
e7dal/bubble3
bubble3/commands/cmd_rules.py
cli
def cli(ctx, stage): """Show transformer rules""" if not ctx.bubble: ctx.say_yellow('There is no bubble present, ' + 'will not show any transformer rules') raise click.Abort() path = ctx.home + '/' RULES = None ctx.say('Stage:'+stage, verbosity=10) if stag...
python
def cli(ctx, stage): """Show transformer rules""" if not ctx.bubble: ctx.say_yellow('There is no bubble present, ' + 'will not show any transformer rules') raise click.Abort() path = ctx.home + '/' RULES = None ctx.say('Stage:'+stage, verbosity=10) if stag...
[ "def", "cli", "(", "ctx", ",", "stage", ")", ":", "if", "not", "ctx", ".", "bubble", ":", "ctx", ".", "say_yellow", "(", "'There is no bubble present, '", "+", "'will not show any transformer rules'", ")", "raise", "click", ".", "Abort", "(", ")", "path", "=...
Show transformer rules
[ "Show", "transformer", "rules" ]
59c735281a95b44f6263a25f4d6ce24fca520082
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/commands/cmd_rules.py#L16-L65
38,911
sporsh/carnifex
carnifex/ssh/session.py
connectExec
def connectExec(connection, protocol, commandLine): """Connect a Protocol to a ssh exec session """ deferred = connectSession(connection, protocol) @deferred.addCallback def requestSubsystem(session): return session.requestExec(commandLine) return deferred
python
def connectExec(connection, protocol, commandLine): """Connect a Protocol to a ssh exec session """ deferred = connectSession(connection, protocol) @deferred.addCallback def requestSubsystem(session): return session.requestExec(commandLine) return deferred
[ "def", "connectExec", "(", "connection", ",", "protocol", ",", "commandLine", ")", ":", "deferred", "=", "connectSession", "(", "connection", ",", "protocol", ")", "@", "deferred", ".", "addCallback", "def", "requestSubsystem", "(", "session", ")", ":", "retur...
Connect a Protocol to a ssh exec session
[ "Connect", "a", "Protocol", "to", "a", "ssh", "exec", "session" ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/ssh/session.py#L14-L21
38,912
sporsh/carnifex
carnifex/ssh/session.py
connectShell
def connectShell(connection, protocol): """Connect a Protocol to a ssh shell session """ deferred = connectSession(connection, protocol) @deferred.addCallback def requestSubsystem(session): return session.requestShell() return deferred
python
def connectShell(connection, protocol): """Connect a Protocol to a ssh shell session """ deferred = connectSession(connection, protocol) @deferred.addCallback def requestSubsystem(session): return session.requestShell() return deferred
[ "def", "connectShell", "(", "connection", ",", "protocol", ")", ":", "deferred", "=", "connectSession", "(", "connection", ",", "protocol", ")", "@", "deferred", ".", "addCallback", "def", "requestSubsystem", "(", "session", ")", ":", "return", "session", ".",...
Connect a Protocol to a ssh shell session
[ "Connect", "a", "Protocol", "to", "a", "ssh", "shell", "session" ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/ssh/session.py#L23-L30
38,913
sporsh/carnifex
carnifex/ssh/session.py
connectSubsystem
def connectSubsystem(connection, protocol, subsystem): """Connect a Protocol to a ssh subsystem channel """ deferred = connectSession(connection, protocol) @deferred.addCallback def requestSubsystem(session): return session.requestSubsystem(subsystem) return deferred
python
def connectSubsystem(connection, protocol, subsystem): """Connect a Protocol to a ssh subsystem channel """ deferred = connectSession(connection, protocol) @deferred.addCallback def requestSubsystem(session): return session.requestSubsystem(subsystem) return deferred
[ "def", "connectSubsystem", "(", "connection", ",", "protocol", ",", "subsystem", ")", ":", "deferred", "=", "connectSession", "(", "connection", ",", "protocol", ")", "@", "deferred", ".", "addCallback", "def", "requestSubsystem", "(", "session", ")", ":", "re...
Connect a Protocol to a ssh subsystem channel
[ "Connect", "a", "Protocol", "to", "a", "ssh", "subsystem", "channel" ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/ssh/session.py#L32-L39
38,914
sporsh/carnifex
carnifex/ssh/session.py
connectSession
def connectSession(connection, protocol, sessionFactory=None, *args, **kwargs): """Open a SSHSession channel and connect a Protocol to it @param connection: the SSH Connection to open the session channel on @param protocol: the Protocol instance to connect to the session @param sessionFactory: factory ...
python
def connectSession(connection, protocol, sessionFactory=None, *args, **kwargs): """Open a SSHSession channel and connect a Protocol to it @param connection: the SSH Connection to open the session channel on @param protocol: the Protocol instance to connect to the session @param sessionFactory: factory ...
[ "def", "connectSession", "(", "connection", ",", "protocol", ",", "sessionFactory", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "factory", "=", "sessionFactory", "or", "defaultSessionFactory", "session", "=", "factory", "(", "*", "args"...
Open a SSHSession channel and connect a Protocol to it @param connection: the SSH Connection to open the session channel on @param protocol: the Protocol instance to connect to the session @param sessionFactory: factory method to generate a SSHSession instance @note: :args: and :kwargs: are passed to t...
[ "Open", "a", "SSHSession", "channel", "and", "connect", "a", "Protocol", "to", "it" ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/ssh/session.py#L41-L64
38,915
sporsh/carnifex
carnifex/ssh/session.py
SSHSession.requestSubsystem
def requestSubsystem(self, subsystem): """Request a subsystem and return a deferred reply. """ data = common.NS(subsystem) return self.sendRequest('subsystem', data, wantReply=True)
python
def requestSubsystem(self, subsystem): """Request a subsystem and return a deferred reply. """ data = common.NS(subsystem) return self.sendRequest('subsystem', data, wantReply=True)
[ "def", "requestSubsystem", "(", "self", ",", "subsystem", ")", ":", "data", "=", "common", ".", "NS", "(", "subsystem", ")", "return", "self", ".", "sendRequest", "(", "'subsystem'", ",", "data", ",", "wantReply", "=", "True", ")" ]
Request a subsystem and return a deferred reply.
[ "Request", "a", "subsystem", "and", "return", "a", "deferred", "reply", "." ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/ssh/session.py#L104-L108
38,916
sporsh/carnifex
carnifex/ssh/session.py
SSHSession.requestPty
def requestPty(self, term=None, rows=0, cols=0, xpixel=0, ypixel=0, modes=''): """Request allocation of a pseudo-terminal for a channel @param term: TERM environment variable value (e.g., vt100) @param columns: terminal width, characters (e.g., 80) @param rows: terminal height, rows (e....
python
def requestPty(self, term=None, rows=0, cols=0, xpixel=0, ypixel=0, modes=''): """Request allocation of a pseudo-terminal for a channel @param term: TERM environment variable value (e.g., vt100) @param columns: terminal width, characters (e.g., 80) @param rows: terminal height, rows (e....
[ "def", "requestPty", "(", "self", ",", "term", "=", "None", ",", "rows", "=", "0", ",", "cols", "=", "0", ",", "xpixel", "=", "0", ",", "ypixel", "=", "0", ",", "modes", "=", "''", ")", ":", "#TODO: Needs testing!", "term", "=", "term", "or", "os...
Request allocation of a pseudo-terminal for a channel @param term: TERM environment variable value (e.g., vt100) @param columns: terminal width, characters (e.g., 80) @param rows: terminal height, rows (e.g., 24) @param width: terminal width, pixels (e.g., 640) @param height: te...
[ "Request", "allocation", "of", "a", "pseudo", "-", "terminal", "for", "a", "channel" ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/ssh/session.py#L110-L128
38,917
sporsh/carnifex
carnifex/ssh/session.py
SSHSession.requestEnv
def requestEnv(self, env={}): """Send requests to set the environment variables for the channel """ for variable, value in env.items(): data = common.NS(variable) + common.NS(value) self.sendRequest('env', data)
python
def requestEnv(self, env={}): """Send requests to set the environment variables for the channel """ for variable, value in env.items(): data = common.NS(variable) + common.NS(value) self.sendRequest('env', data)
[ "def", "requestEnv", "(", "self", ",", "env", "=", "{", "}", ")", ":", "for", "variable", ",", "value", "in", "env", ".", "items", "(", ")", ":", "data", "=", "common", ".", "NS", "(", "variable", ")", "+", "common", ".", "NS", "(", "value", ")...
Send requests to set the environment variables for the channel
[ "Send", "requests", "to", "set", "the", "environment", "variables", "for", "the", "channel" ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/ssh/session.py#L130-L135
38,918
PhracturedBlue/asterisk_mbox
asterisk_mbox/commands.py
commandstr
def commandstr(command): """Convert command into string.""" if command == CMD_MESSAGE_ERROR: msg = "CMD_MESSAGE_ERROR" elif command == CMD_MESSAGE_LIST: msg = "CMD_MESSAGE_LIST" elif command == CMD_MESSAGE_PASSWORD: msg = "CMD_MESSAGE_PASSWORD" elif command == CMD_MESSAGE_MP3...
python
def commandstr(command): """Convert command into string.""" if command == CMD_MESSAGE_ERROR: msg = "CMD_MESSAGE_ERROR" elif command == CMD_MESSAGE_LIST: msg = "CMD_MESSAGE_LIST" elif command == CMD_MESSAGE_PASSWORD: msg = "CMD_MESSAGE_PASSWORD" elif command == CMD_MESSAGE_MP3...
[ "def", "commandstr", "(", "command", ")", ":", "if", "command", "==", "CMD_MESSAGE_ERROR", ":", "msg", "=", "\"CMD_MESSAGE_ERROR\"", "elif", "command", "==", "CMD_MESSAGE_LIST", ":", "msg", "=", "\"CMD_MESSAGE_LIST\"", "elif", "command", "==", "CMD_MESSAGE_PASSWORD"...
Convert command into string.
[ "Convert", "command", "into", "string", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/commands.py#L13-L33
38,919
Equitable/trump
docs/diagrams/tsadisplay/reflect.py
run
def run(): """Command for reflection database objects""" parser = OptionParser( version=__version__, description=__doc__, ) parser.add_option( '-u', '--url', dest='url', help='Database URL (connection string)', ) parser.add_option( '-r', '--render', dest='render...
python
def run(): """Command for reflection database objects""" parser = OptionParser( version=__version__, description=__doc__, ) parser.add_option( '-u', '--url', dest='url', help='Database URL (connection string)', ) parser.add_option( '-r', '--render', dest='render...
[ "def", "run", "(", ")", ":", "parser", "=", "OptionParser", "(", "version", "=", "__version__", ",", "description", "=", "__doc__", ",", ")", "parser", ".", "add_option", "(", "'-u'", ",", "'--url'", ",", "dest", "=", "'url'", ",", "help", "=", "'Datab...
Command for reflection database objects
[ "Command", "for", "reflection", "database", "objects" ]
a2802692bc642fa32096374159eea7ceca2947b4
https://github.com/Equitable/trump/blob/a2802692bc642fa32096374159eea7ceca2947b4/docs/diagrams/tsadisplay/reflect.py#L15-L86
38,920
EricDalrymple91/strawpy
strawpy/strawpy.py
StrawPoll.refresh
def refresh(self): """ Refresh all class attributes. """ strawpoll_response = requests.get('{api_url}/{poll_id}'.format(api_url=api_url, poll_id=self.id)) raise_status(strawpoll_response) self.status_code = strawpoll_response.status_code self.response_json = strawpoll_re...
python
def refresh(self): """ Refresh all class attributes. """ strawpoll_response = requests.get('{api_url}/{poll_id}'.format(api_url=api_url, poll_id=self.id)) raise_status(strawpoll_response) self.status_code = strawpoll_response.status_code self.response_json = strawpoll_re...
[ "def", "refresh", "(", "self", ")", ":", "strawpoll_response", "=", "requests", ".", "get", "(", "'{api_url}/{poll_id}'", ".", "format", "(", "api_url", "=", "api_url", ",", "poll_id", "=", "self", ".", "id", ")", ")", "raise_status", "(", "strawpoll_respons...
Refresh all class attributes.
[ "Refresh", "all", "class", "attributes", "." ]
0c4294fc2dca250a5c13a97e825ae21587278a91
https://github.com/EricDalrymple91/strawpy/blob/0c4294fc2dca250a5c13a97e825ae21587278a91/strawpy/strawpy.py#L157-L172
38,921
iskandr/serializable
serializable/serializable.py
Serializable.write_json_file
def write_json_file(self, path): """ Serialize this VariantCollection to a JSON representation and write it out to a text file. """ with open(path, "w") as f: f.write(self.to_json())
python
def write_json_file(self, path): """ Serialize this VariantCollection to a JSON representation and write it out to a text file. """ with open(path, "w") as f: f.write(self.to_json())
[ "def", "write_json_file", "(", "self", ",", "path", ")", ":", "with", "open", "(", "path", ",", "\"w\"", ")", "as", "f", ":", "f", ".", "write", "(", "self", ".", "to_json", "(", ")", ")" ]
Serialize this VariantCollection to a JSON representation and write it out to a text file.
[ "Serialize", "this", "VariantCollection", "to", "a", "JSON", "representation", "and", "write", "it", "out", "to", "a", "text", "file", "." ]
6807dfd582567b3bda609910806b7429d8d53b44
https://github.com/iskandr/serializable/blob/6807dfd582567b3bda609910806b7429d8d53b44/serializable/serializable.py#L92-L98
38,922
iskandr/serializable
serializable/serializable.py
Serializable.read_json_file
def read_json_file(cls, path): """ Construct a VariantCollection from a JSON file. """ with open(path, 'r') as f: json_string = f.read() return cls.from_json(json_string)
python
def read_json_file(cls, path): """ Construct a VariantCollection from a JSON file. """ with open(path, 'r') as f: json_string = f.read() return cls.from_json(json_string)
[ "def", "read_json_file", "(", "cls", ",", "path", ")", ":", "with", "open", "(", "path", ",", "'r'", ")", "as", "f", ":", "json_string", "=", "f", ".", "read", "(", ")", "return", "cls", ".", "from_json", "(", "json_string", ")" ]
Construct a VariantCollection from a JSON file.
[ "Construct", "a", "VariantCollection", "from", "a", "JSON", "file", "." ]
6807dfd582567b3bda609910806b7429d8d53b44
https://github.com/iskandr/serializable/blob/6807dfd582567b3bda609910806b7429d8d53b44/serializable/serializable.py#L101-L107
38,923
Yipit/ejson
ejson/__init__.py
dumps
def dumps(data, escape=False, **kwargs): """A wrapper around `json.dumps` that can handle objects that json module is not aware. This function is aware of a list of custom serializers that can be registered by the API user, making it possible to convert any kind of object to types that the json lib...
python
def dumps(data, escape=False, **kwargs): """A wrapper around `json.dumps` that can handle objects that json module is not aware. This function is aware of a list of custom serializers that can be registered by the API user, making it possible to convert any kind of object to types that the json lib...
[ "def", "dumps", "(", "data", ",", "escape", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "'sort_keys'", "not", "in", "kwargs", ":", "kwargs", "[", "'sort_keys'", "]", "=", "True", "converted", "=", "json", ".", "dumps", "(", "data", ",", ...
A wrapper around `json.dumps` that can handle objects that json module is not aware. This function is aware of a list of custom serializers that can be registered by the API user, making it possible to convert any kind of object to types that the json library can handle.
[ "A", "wrapper", "around", "json", ".", "dumps", "that", "can", "handle", "objects", "that", "json", "module", "is", "not", "aware", "." ]
6665703f1534923d1c30849e08339f0ff97d8230
https://github.com/Yipit/ejson/blob/6665703f1534923d1c30849e08339f0ff97d8230/ejson/__init__.py#L49-L70
38,924
Yipit/ejson
ejson/__init__.py
deserialize
def deserialize(klass, data): """Helper function to access a method that creates objects of a given `klass` with the received `data`. """ handler = DESERIALIZE_REGISTRY.get(klass) if handler: return handler(data) raise TypeError("There is no deserializer registered to handle " ...
python
def deserialize(klass, data): """Helper function to access a method that creates objects of a given `klass` with the received `data`. """ handler = DESERIALIZE_REGISTRY.get(klass) if handler: return handler(data) raise TypeError("There is no deserializer registered to handle " ...
[ "def", "deserialize", "(", "klass", ",", "data", ")", ":", "handler", "=", "DESERIALIZE_REGISTRY", ".", "get", "(", "klass", ")", "if", "handler", ":", "return", "handler", "(", "data", ")", "raise", "TypeError", "(", "\"There is no deserializer registered to ha...
Helper function to access a method that creates objects of a given `klass` with the received `data`.
[ "Helper", "function", "to", "access", "a", "method", "that", "creates", "objects", "of", "a", "given", "klass", "with", "the", "received", "data", "." ]
6665703f1534923d1c30849e08339f0ff97d8230
https://github.com/Yipit/ejson/blob/6665703f1534923d1c30849e08339f0ff97d8230/ejson/__init__.py#L73-L81
38,925
Yipit/ejson
ejson/__init__.py
_convert_from
def _convert_from(data): """Internal function that will be hooked to the native `json.loads` Find the right deserializer for a given value, taking into account the internal deserializer registry. """ try: module, klass_name = data['__class__'].rsplit('.', 1) klass = getattr(import_m...
python
def _convert_from(data): """Internal function that will be hooked to the native `json.loads` Find the right deserializer for a given value, taking into account the internal deserializer registry. """ try: module, klass_name = data['__class__'].rsplit('.', 1) klass = getattr(import_m...
[ "def", "_convert_from", "(", "data", ")", ":", "try", ":", "module", ",", "klass_name", "=", "data", "[", "'__class__'", "]", ".", "rsplit", "(", "'.'", ",", "1", ")", "klass", "=", "getattr", "(", "import_module", "(", "module", ")", ",", "klass_name"...
Internal function that will be hooked to the native `json.loads` Find the right deserializer for a given value, taking into account the internal deserializer registry.
[ "Internal", "function", "that", "will", "be", "hooked", "to", "the", "native", "json", ".", "loads" ]
6665703f1534923d1c30849e08339f0ff97d8230
https://github.com/Yipit/ejson/blob/6665703f1534923d1c30849e08339f0ff97d8230/ejson/__init__.py#L157-L176
38,926
Yipit/ejson
ejson/__init__.py
_converter
def _converter(data): """Internal function that will be passed to the native `json.dumps`. This function uses the `REGISTRY` of serializers and try to convert a given instance to an object that json.dumps can understand. """ handler = REGISTRY.get(data.__class__) if handler: full_name =...
python
def _converter(data): """Internal function that will be passed to the native `json.dumps`. This function uses the `REGISTRY` of serializers and try to convert a given instance to an object that json.dumps can understand. """ handler = REGISTRY.get(data.__class__) if handler: full_name =...
[ "def", "_converter", "(", "data", ")", ":", "handler", "=", "REGISTRY", ".", "get", "(", "data", ".", "__class__", ")", "if", "handler", ":", "full_name", "=", "'{}.{}'", ".", "format", "(", "data", ".", "__class__", ".", "__module__", ",", "data", "."...
Internal function that will be passed to the native `json.dumps`. This function uses the `REGISTRY` of serializers and try to convert a given instance to an object that json.dumps can understand.
[ "Internal", "function", "that", "will", "be", "passed", "to", "the", "native", "json", ".", "dumps", "." ]
6665703f1534923d1c30849e08339f0ff97d8230
https://github.com/Yipit/ejson/blob/6665703f1534923d1c30849e08339f0ff97d8230/ejson/__init__.py#L179-L194
38,927
invinst/ResponseBot
responsebot/responsebot.py
ResponseBot.handle_error
def handle_error(self, error): """ Try to detect repetitive errors and sleep for a while to avoid being marked as spam """ logging.exception("try to sleep if there are repeating errors.") error_desc = str(error) now = datetime.datetime.now() if error_desc not in s...
python
def handle_error(self, error): """ Try to detect repetitive errors and sleep for a while to avoid being marked as spam """ logging.exception("try to sleep if there are repeating errors.") error_desc = str(error) now = datetime.datetime.now() if error_desc not in s...
[ "def", "handle_error", "(", "self", ",", "error", ")", ":", "logging", ".", "exception", "(", "\"try to sleep if there are repeating errors.\"", ")", "error_desc", "=", "str", "(", "error", ")", "now", "=", "datetime", ".", "datetime", ".", "now", "(", ")", ...
Try to detect repetitive errors and sleep for a while to avoid being marked as spam
[ "Try", "to", "detect", "repetitive", "errors", "and", "sleep", "for", "a", "while", "to", "avoid", "being", "marked", "as", "spam" ]
a6b1a431a343007f7ae55a193e432a61af22253f
https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot.py#L66-L87
38,928
ScottDuckworth/python-anyvcs
anyvcs/common.py
parse_isodate
def parse_isodate(datestr): """Parse a string that loosely fits ISO 8601 formatted date-time string """ m = isodate_rx.search(datestr) assert m, 'unrecognized date format: ' + datestr year, month, day = m.group('year', 'month', 'day') hour, minute, second, fraction = m.group('hour', 'minute', 's...
python
def parse_isodate(datestr): """Parse a string that loosely fits ISO 8601 formatted date-time string """ m = isodate_rx.search(datestr) assert m, 'unrecognized date format: ' + datestr year, month, day = m.group('year', 'month', 'day') hour, minute, second, fraction = m.group('hour', 'minute', 's...
[ "def", "parse_isodate", "(", "datestr", ")", ":", "m", "=", "isodate_rx", ".", "search", "(", "datestr", ")", "assert", "m", ",", "'unrecognized date format: '", "+", "datestr", "year", ",", "month", ",", "day", "=", "m", ".", "group", "(", "'year'", ","...
Parse a string that loosely fits ISO 8601 formatted date-time string
[ "Parse", "a", "string", "that", "loosely", "fits", "ISO", "8601", "formatted", "date", "-", "time", "string" ]
9eb09defbc6b7c99d373fad53cbf8fc81b637923
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/common.py#L43-L72
38,929
ScottDuckworth/python-anyvcs
anyvcs/common.py
VCSRepo.ls
def ls( self, rev, path, recursive=False, recursive_dirs=False, directory=False, report=() ): """List directory or file :param rev: The revision to use. :param path: The path to list. May start with a '/' or not. Directories may end with a '/' or not. ...
python
def ls( self, rev, path, recursive=False, recursive_dirs=False, directory=False, report=() ): """List directory or file :param rev: The revision to use. :param path: The path to list. May start with a '/' or not. Directories may end with a '/' or not. ...
[ "def", "ls", "(", "self", ",", "rev", ",", "path", ",", "recursive", "=", "False", ",", "recursive_dirs", "=", "False", ",", "directory", "=", "False", ",", "report", "=", "(", ")", ")", ":", "raise", "NotImplementedError" ]
List directory or file :param rev: The revision to use. :param path: The path to list. May start with a '/' or not. Directories may end with a '/' or not. :param recursive: Recursively list files in subdirectories. :param recursive_dirs: Used when recursive=True, al...
[ "List", "directory", "or", "file" ]
9eb09defbc6b7c99d373fad53cbf8fc81b637923
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/common.py#L338-L375
38,930
ScottDuckworth/python-anyvcs
anyvcs/common.py
VCSRepo.log
def log( self, revrange=None, limit=None, firstparent=False, merges=None, path=None, follow=False ): """Get commit logs :param revrange: Either a single revision or a range of revisions as a 2-element list or tuple. :param int limit: Limit the number...
python
def log( self, revrange=None, limit=None, firstparent=False, merges=None, path=None, follow=False ): """Get commit logs :param revrange: Either a single revision or a range of revisions as a 2-element list or tuple. :param int limit: Limit the number...
[ "def", "log", "(", "self", ",", "revrange", "=", "None", ",", "limit", "=", "None", ",", "firstparent", "=", "False", ",", "merges", "=", "None", ",", "path", "=", "None", ",", "follow", "=", "False", ")", ":", "raise", "NotImplementedError" ]
Get commit logs :param revrange: Either a single revision or a range of revisions as a 2-element list or tuple. :param int limit: Limit the number of log entries. :param bool firstparent: Only follow the first parent of merges. :param bool merges: True means onl...
[ "Get", "commit", "logs" ]
9eb09defbc6b7c99d373fad53cbf8fc81b637923
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/common.py#L460-L489
38,931
jlinn/pyflare
pyflare/hosting.py
PyflareHosting.user_create
def user_create(self, cloudflare_email, cloudflare_pass, unique_id=None): """ Create new cloudflare user with selected email and id. Optionally also select unique_id which can be then used to get user information. :param cloudflare_email: new user cloudflare email :type c...
python
def user_create(self, cloudflare_email, cloudflare_pass, unique_id=None): """ Create new cloudflare user with selected email and id. Optionally also select unique_id which can be then used to get user information. :param cloudflare_email: new user cloudflare email :type c...
[ "def", "user_create", "(", "self", ",", "cloudflare_email", ",", "cloudflare_pass", ",", "unique_id", "=", "None", ")", ":", "params", "=", "{", "'act'", ":", "'user_create'", ",", "'cloudflare_email'", ":", "cloudflare_email", ",", "'cloudflare_pass'", ":", "cl...
Create new cloudflare user with selected email and id. Optionally also select unique_id which can be then used to get user information. :param cloudflare_email: new user cloudflare email :type cloudflare_email: str :param cloudflare_pass: new user cloudflare password ...
[ "Create", "new", "cloudflare", "user", "with", "selected", "email", "and", "id", ".", "Optionally", "also", "select", "unique_id", "which", "can", "be", "then", "used", "to", "get", "user", "information", "." ]
1108e82a9622d1aa6d92d4c4797744ff3cf41f68
https://github.com/jlinn/pyflare/blob/1108e82a9622d1aa6d92d4c4797744ff3cf41f68/pyflare/hosting.py#L31-L53
38,932
jlinn/pyflare
pyflare/hosting.py
PyflareHosting.zone_set
def zone_set(self, user_key, zone_name, resolve_to, subdomains): """ Create new zone for user associated with this user_key. :param user_key: The unique 3auth string,identifying the user's CloudFlare Account. Generated from a user_create or user_auth :type user_key: s...
python
def zone_set(self, user_key, zone_name, resolve_to, subdomains): """ Create new zone for user associated with this user_key. :param user_key: The unique 3auth string,identifying the user's CloudFlare Account. Generated from a user_create or user_auth :type user_key: s...
[ "def", "zone_set", "(", "self", ",", "user_key", ",", "zone_name", ",", "resolve_to", ",", "subdomains", ")", ":", "params", "=", "{", "'act'", ":", "'zone_set'", ",", "'user_key'", ":", "user_key", ",", "'zone_name'", ":", "zone_name", ",", "'resolve_to'", ...
Create new zone for user associated with this user_key. :param user_key: The unique 3auth string,identifying the user's CloudFlare Account. Generated from a user_create or user_auth :type user_key: str :param zone_name: The zone you'd like to run CNAMES through CloudFlare...
[ "Create", "new", "zone", "for", "user", "associated", "with", "this", "user_key", "." ]
1108e82a9622d1aa6d92d4c4797744ff3cf41f68
https://github.com/jlinn/pyflare/blob/1108e82a9622d1aa6d92d4c4797744ff3cf41f68/pyflare/hosting.py#L55-L81
38,933
jlinn/pyflare
pyflare/hosting.py
PyflareHosting.full_zone_set
def full_zone_set(self, user_key, zone_name): """ Create new zone and all subdomains for user associated with this user_key. :param user_key: The unique 3auth string,identifying the user's CloudFlare Account. Generated from a user_create or user_auth :type user_...
python
def full_zone_set(self, user_key, zone_name): """ Create new zone and all subdomains for user associated with this user_key. :param user_key: The unique 3auth string,identifying the user's CloudFlare Account. Generated from a user_create or user_auth :type user_...
[ "def", "full_zone_set", "(", "self", ",", "user_key", ",", "zone_name", ")", ":", "params", "=", "{", "'act'", ":", "'full_zone_set'", ",", "'user_key'", ":", "user_key", ",", "'zone_name'", ":", "zone_name", ",", "}", "return", "self", ".", "_request", "(...
Create new zone and all subdomains for user associated with this user_key. :param user_key: The unique 3auth string,identifying the user's CloudFlare Account. Generated from a user_create or user_auth :type user_key: str :param zone_name: The zone you'd like to ru...
[ "Create", "new", "zone", "and", "all", "subdomains", "for", "user", "associated", "with", "this", "user_key", "." ]
1108e82a9622d1aa6d92d4c4797744ff3cf41f68
https://github.com/jlinn/pyflare/blob/1108e82a9622d1aa6d92d4c4797744ff3cf41f68/pyflare/hosting.py#L83-L102
38,934
jlinn/pyflare
pyflare/hosting.py
PyflareHosting.user_lookup
def user_lookup(self, cloudflare_email=None, unique_id=None): """ Lookup user data based on either his cloudflare_email or his unique_id. :param cloudflare_email: email associated with user :type cloudflare_email: str :param unique_id: unique id associat...
python
def user_lookup(self, cloudflare_email=None, unique_id=None): """ Lookup user data based on either his cloudflare_email or his unique_id. :param cloudflare_email: email associated with user :type cloudflare_email: str :param unique_id: unique id associat...
[ "def", "user_lookup", "(", "self", ",", "cloudflare_email", "=", "None", ",", "unique_id", "=", "None", ")", ":", "if", "not", "cloudflare_email", "and", "not", "unique_id", ":", "raise", "KeyError", "(", "'Either cloudflare_email or unique_id must be present'", ")"...
Lookup user data based on either his cloudflare_email or his unique_id. :param cloudflare_email: email associated with user :type cloudflare_email: str :param unique_id: unique id associated with user :type unique_id: str :returns: :r...
[ "Lookup", "user", "data", "based", "on", "either", "his", "cloudflare_email", "or", "his", "unique_id", "." ]
1108e82a9622d1aa6d92d4c4797744ff3cf41f68
https://github.com/jlinn/pyflare/blob/1108e82a9622d1aa6d92d4c4797744ff3cf41f68/pyflare/hosting.py#L104-L127
38,935
jlinn/pyflare
pyflare/hosting.py
PyflareHosting.user_auth
def user_auth( self, cloudflare_email=None, cloudflare_pass=None, unique_id=None ): """ Get user_key based on either his email and password or unique_id. :param cloudflare_email: email associated with user :type cloudflare_email: str ...
python
def user_auth( self, cloudflare_email=None, cloudflare_pass=None, unique_id=None ): """ Get user_key based on either his email and password or unique_id. :param cloudflare_email: email associated with user :type cloudflare_email: str ...
[ "def", "user_auth", "(", "self", ",", "cloudflare_email", "=", "None", ",", "cloudflare_pass", "=", "None", ",", "unique_id", "=", "None", ")", ":", "if", "not", "(", "cloudflare_email", "and", "cloudflare_pass", ")", "and", "not", "unique_id", ":", "raise",...
Get user_key based on either his email and password or unique_id. :param cloudflare_email: email associated with user :type cloudflare_email: str :param cloudflare_pass: pass associated with user :type cloudflare_pass: str :param unique_id: unique id asso...
[ "Get", "user_key", "based", "on", "either", "his", "email", "and", "password", "or", "unique_id", "." ]
1108e82a9622d1aa6d92d4c4797744ff3cf41f68
https://github.com/jlinn/pyflare/blob/1108e82a9622d1aa6d92d4c4797744ff3cf41f68/pyflare/hosting.py#L129-L158
38,936
jlinn/pyflare
pyflare/hosting.py
PyflareHosting.zone_list
def zone_list( self, user_key, limit=100, offset=0, zone_name=None, sub_id=None, zone_status='ALL', sub_status='ALL', ): """ List zones for a user. :param user_key: key for authentication of user :type u...
python
def zone_list( self, user_key, limit=100, offset=0, zone_name=None, sub_id=None, zone_status='ALL', sub_status='ALL', ): """ List zones for a user. :param user_key: key for authentication of user :type u...
[ "def", "zone_list", "(", "self", ",", "user_key", ",", "limit", "=", "100", ",", "offset", "=", "0", ",", "zone_name", "=", "None", ",", "sub_id", "=", "None", ",", "zone_status", "=", "'ALL'", ",", "sub_status", "=", "'ALL'", ",", ")", ":", "if", ...
List zones for a user. :param user_key: key for authentication of user :type user_key: str :param limit: limit of zones shown :type limit: int :param offset: offset of zones to be shown :type offset: int :param zone_name: name of zone to...
[ "List", "zones", "for", "a", "user", "." ]
1108e82a9622d1aa6d92d4c4797744ff3cf41f68
https://github.com/jlinn/pyflare/blob/1108e82a9622d1aa6d92d4c4797744ff3cf41f68/pyflare/hosting.py#L196-L244
38,937
karjaljo/hiisi
hiisi/hiisi.py
HiisiHDF.attr_exists
def attr_exists(self, attr): """Returns True if at least on instance of the attribute is found """ gen = self.attr_gen(attr) n_instances = len(list(gen)) if n_instances > 0: return True else: return False
python
def attr_exists(self, attr): """Returns True if at least on instance of the attribute is found """ gen = self.attr_gen(attr) n_instances = len(list(gen)) if n_instances > 0: return True else: return False
[ "def", "attr_exists", "(", "self", ",", "attr", ")", ":", "gen", "=", "self", ".", "attr_gen", "(", "attr", ")", "n_instances", "=", "len", "(", "list", "(", "gen", ")", ")", "if", "n_instances", ">", "0", ":", "return", "True", "else", ":", "retur...
Returns True if at least on instance of the attribute is found
[ "Returns", "True", "if", "at", "least", "on", "instance", "of", "the", "attribute", "is", "found" ]
de6a64df5dcbcb37d5d3d5468663e65a7794f9a8
https://github.com/karjaljo/hiisi/blob/de6a64df5dcbcb37d5d3d5468663e65a7794f9a8/hiisi/hiisi.py#L49-L57
38,938
karjaljo/hiisi
hiisi/hiisi.py
HiisiHDF.datasets
def datasets(self): """Method returns a list of dataset paths. Examples -------- >>> for dataset in h5f.datasets(): print(dataset) '/dataset1/data1/data' '/dataset1/data2/data' '/dataset2/data1/data' '/dataset2/data2/data' """ ...
python
def datasets(self): """Method returns a list of dataset paths. Examples -------- >>> for dataset in h5f.datasets(): print(dataset) '/dataset1/data1/data' '/dataset1/data2/data' '/dataset2/data1/data' '/dataset2/data2/data' """ ...
[ "def", "datasets", "(", "self", ")", ":", "HiisiHDF", ".", "_clear_cache", "(", ")", "self", ".", "visititems", "(", "HiisiHDF", ".", "_is_dataset", ")", "return", "HiisiHDF", ".", "CACHE", "[", "'dataset_paths'", "]" ]
Method returns a list of dataset paths. Examples -------- >>> for dataset in h5f.datasets(): print(dataset) '/dataset1/data1/data' '/dataset1/data2/data' '/dataset2/data1/data' '/dataset2/data2/data'
[ "Method", "returns", "a", "list", "of", "dataset", "paths", "." ]
de6a64df5dcbcb37d5d3d5468663e65a7794f9a8
https://github.com/karjaljo/hiisi/blob/de6a64df5dcbcb37d5d3d5468663e65a7794f9a8/hiisi/hiisi.py#L69-L83
38,939
karjaljo/hiisi
hiisi/hiisi.py
HiisiHDF.create_from_filedict
def create_from_filedict(self, filedict): """ Creates h5 file from dictionary containing the file structure. Filedict is a regular dictinary whose keys are hdf5 paths and whose values are dictinaries containing the metadata and datasets. Metadata is given as normal key-v...
python
def create_from_filedict(self, filedict): """ Creates h5 file from dictionary containing the file structure. Filedict is a regular dictinary whose keys are hdf5 paths and whose values are dictinaries containing the metadata and datasets. Metadata is given as normal key-v...
[ "def", "create_from_filedict", "(", "self", ",", "filedict", ")", ":", "if", "self", ".", "mode", "in", "[", "'r+'", ",", "'w'", ",", "'w-'", ",", "'x'", ",", "'a'", "]", ":", "for", "h5path", ",", "path_content", "in", "filedict", ".", "iteritems", ...
Creates h5 file from dictionary containing the file structure. Filedict is a regular dictinary whose keys are hdf5 paths and whose values are dictinaries containing the metadata and datasets. Metadata is given as normal key-value -pairs and dataset arrays are given using 'DATASE...
[ "Creates", "h5", "file", "from", "dictionary", "containing", "the", "file", "structure", ".", "Filedict", "is", "a", "regular", "dictinary", "whose", "keys", "are", "hdf5", "paths", "and", "whose", "values", "are", "dictinaries", "containing", "the", "metadata",...
de6a64df5dcbcb37d5d3d5468663e65a7794f9a8
https://github.com/karjaljo/hiisi/blob/de6a64df5dcbcb37d5d3d5468663e65a7794f9a8/hiisi/hiisi.py#L135-L181
38,940
karjaljo/hiisi
hiisi/hiisi.py
HiisiHDF.search
def search(self, attr, value, tolerance=0): """Find paths with a key value match Parameters ---------- attr : str name of the attribute value : str or numerical value value of the searched attribute Keywords -------- toler...
python
def search(self, attr, value, tolerance=0): """Find paths with a key value match Parameters ---------- attr : str name of the attribute value : str or numerical value value of the searched attribute Keywords -------- toler...
[ "def", "search", "(", "self", ",", "attr", ",", "value", ",", "tolerance", "=", "0", ")", ":", "found_paths", "=", "[", "]", "gen", "=", "self", ".", "attr_gen", "(", "attr", ")", "for", "path_attr_pair", "in", "gen", ":", "# if attribute is numerical us...
Find paths with a key value match Parameters ---------- attr : str name of the attribute value : str or numerical value value of the searched attribute Keywords -------- tolerance : float tolerance used when searching ...
[ "Find", "paths", "with", "a", "key", "value", "match" ]
de6a64df5dcbcb37d5d3d5468663e65a7794f9a8
https://github.com/karjaljo/hiisi/blob/de6a64df5dcbcb37d5d3d5468663e65a7794f9a8/hiisi/hiisi.py#L183-L238
38,941
hollenstein/maspy
maspy/isobar.py
_extractReporterIons
def _extractReporterIons(ionArrays, reporterMz, mzTolerance): """Find and a list of reporter ions and return mz and intensity values. Expected reporter mz values are searched in "ionArray['mz']" and reported if the observed relative deviation is less than specified by "mzTolerance". In the case of mult...
python
def _extractReporterIons(ionArrays, reporterMz, mzTolerance): """Find and a list of reporter ions and return mz and intensity values. Expected reporter mz values are searched in "ionArray['mz']" and reported if the observed relative deviation is less than specified by "mzTolerance". In the case of mult...
[ "def", "_extractReporterIons", "(", "ionArrays", ",", "reporterMz", ",", "mzTolerance", ")", ":", "reporterIons", "=", "{", "'mz'", ":", "[", "]", ",", "'i'", ":", "[", "]", "}", "for", "reporterMzValue", "in", "reporterMz", ":", "limHi", "=", "reporterMzV...
Find and a list of reporter ions and return mz and intensity values. Expected reporter mz values are searched in "ionArray['mz']" and reported if the observed relative deviation is less than specified by "mzTolerance". In the case of multiple matches, the one with the minimal deviation is picked. If no...
[ "Find", "and", "a", "list", "of", "reporter", "ions", "and", "return", "mz", "and", "intensity", "values", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/isobar.py#L356-L400
38,942
hollenstein/maspy
maspy/isobar.py
_correctIsotopeImpurities
def _correctIsotopeImpurities(matrix, intensities): """Corrects observed reporter ion intensities for isotope impurities. :params matrix: a matrix (2d nested list) containing numbers, each isobaric channel must be present as a COLUMN. Use maspy.isobar._transposeMatrix() if channels are written ...
python
def _correctIsotopeImpurities(matrix, intensities): """Corrects observed reporter ion intensities for isotope impurities. :params matrix: a matrix (2d nested list) containing numbers, each isobaric channel must be present as a COLUMN. Use maspy.isobar._transposeMatrix() if channels are written ...
[ "def", "_correctIsotopeImpurities", "(", "matrix", ",", "intensities", ")", ":", "correctedIntensities", ",", "_", "=", "scipy", ".", "optimize", ".", "nnls", "(", "matrix", ",", "intensities", ")", "return", "correctedIntensities" ]
Corrects observed reporter ion intensities for isotope impurities. :params matrix: a matrix (2d nested list) containing numbers, each isobaric channel must be present as a COLUMN. Use maspy.isobar._transposeMatrix() if channels are written in rows. :param intensities: numpy array of observed re...
[ "Corrects", "observed", "reporter", "ion", "intensities", "for", "isotope", "impurities", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/isobar.py#L403-L414
38,943
hollenstein/maspy
maspy/isobar.py
_normalizeImpurityMatrix
def _normalizeImpurityMatrix(matrix): """Normalize each row of the matrix that the sum of the row equals 1. :params matrix: a matrix (2d nested list) containing numbers, each isobaric channel must be present as a row. :returns: a matrix containing normalized values """ newMatrix = list() ...
python
def _normalizeImpurityMatrix(matrix): """Normalize each row of the matrix that the sum of the row equals 1. :params matrix: a matrix (2d nested list) containing numbers, each isobaric channel must be present as a row. :returns: a matrix containing normalized values """ newMatrix = list() ...
[ "def", "_normalizeImpurityMatrix", "(", "matrix", ")", ":", "newMatrix", "=", "list", "(", ")", "for", "line", "in", "matrix", ":", "total", "=", "sum", "(", "line", ")", "if", "total", "!=", "0", ":", "newMatrix", ".", "append", "(", "[", "i", "/", ...
Normalize each row of the matrix that the sum of the row equals 1. :params matrix: a matrix (2d nested list) containing numbers, each isobaric channel must be present as a row. :returns: a matrix containing normalized values
[ "Normalize", "each", "row", "of", "the", "matrix", "that", "the", "sum", "of", "the", "row", "equals", "1", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/isobar.py#L464-L478
38,944
hollenstein/maspy
maspy/isobar.py
_padImpurityMatrix
def _padImpurityMatrix(matrix, preChannels, postChannels): """Align the values of an isotope impurity matrix and fill up with 0. NOTE: The length of the rows in the "matrix" must be the sum of "preChannels" and "postChannels" + 1. :params matrix: a matrix (2d nested list) containing number...
python
def _padImpurityMatrix(matrix, preChannels, postChannels): """Align the values of an isotope impurity matrix and fill up with 0. NOTE: The length of the rows in the "matrix" must be the sum of "preChannels" and "postChannels" + 1. :params matrix: a matrix (2d nested list) containing number...
[ "def", "_padImpurityMatrix", "(", "matrix", ",", "preChannels", ",", "postChannels", ")", ":", "extendedMatrix", "=", "list", "(", ")", "lastMatrixI", "=", "len", "(", "matrix", ")", "-", "1", "for", "i", ",", "line", "in", "enumerate", "(", "matrix", ")...
Align the values of an isotope impurity matrix and fill up with 0. NOTE: The length of the rows in the "matrix" must be the sum of "preChannels" and "postChannels" + 1. :params matrix: a matrix (2d nested list) containing numbers, each isobaric channel must be present as a row. :pa...
[ "Align", "the", "values", "of", "an", "isotope", "impurity", "matrix", "and", "fill", "up", "with", "0", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/isobar.py#L481-L506
38,945
hollenstein/maspy
maspy/isobar.py
IsobaricTag._processImpurityMatrix
def _processImpurityMatrix(self): """Process the impurity matrix so that it can be used to correct observed reporter intensities. """ processedMatrix = _normalizeImpurityMatrix(self.impurityMatrix) processedMatrix = _padImpurityMatrix( processedMatrix, self.matrixPreC...
python
def _processImpurityMatrix(self): """Process the impurity matrix so that it can be used to correct observed reporter intensities. """ processedMatrix = _normalizeImpurityMatrix(self.impurityMatrix) processedMatrix = _padImpurityMatrix( processedMatrix, self.matrixPreC...
[ "def", "_processImpurityMatrix", "(", "self", ")", ":", "processedMatrix", "=", "_normalizeImpurityMatrix", "(", "self", ".", "impurityMatrix", ")", "processedMatrix", "=", "_padImpurityMatrix", "(", "processedMatrix", ",", "self", ".", "matrixPreChannels", ",", "self...
Process the impurity matrix so that it can be used to correct observed reporter intensities.
[ "Process", "the", "impurity", "matrix", "so", "that", "it", "can", "be", "used", "to", "correct", "observed", "reporter", "intensities", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/isobar.py#L176-L185
38,946
bbelyeu/flask-exceptions
flask_exceptions/extension.py
exception
def exception(message): """Exception method convenience wrapper.""" def decorator(method): """Inner decorator so we can accept arguments.""" @wraps(method) def wrapper(self, *args, **kwargs): """Innermost decorator wrapper - this is confusing.""" if self.message...
python
def exception(message): """Exception method convenience wrapper.""" def decorator(method): """Inner decorator so we can accept arguments.""" @wraps(method) def wrapper(self, *args, **kwargs): """Innermost decorator wrapper - this is confusing.""" if self.message...
[ "def", "exception", "(", "message", ")", ":", "def", "decorator", "(", "method", ")", ":", "\"\"\"Inner decorator so we can accept arguments.\"\"\"", "@", "wraps", "(", "method", ")", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ...
Exception method convenience wrapper.
[ "Exception", "method", "convenience", "wrapper", "." ]
1812a2f4620783883a3c884b01c216bd02177dbb
https://github.com/bbelyeu/flask-exceptions/blob/1812a2f4620783883a3c884b01c216bd02177dbb/flask_exceptions/extension.py#L7-L27
38,947
bbelyeu/flask-exceptions
flask_exceptions/extension.py
APIException.to_dict
def to_dict(self): """Convert Exception class to a Python dictionary.""" val = dict(self.payload or ()) if self.message: val['message'] = self.message return val
python
def to_dict(self): """Convert Exception class to a Python dictionary.""" val = dict(self.payload or ()) if self.message: val['message'] = self.message return val
[ "def", "to_dict", "(", "self", ")", ":", "val", "=", "dict", "(", "self", ".", "payload", "or", "(", ")", ")", "if", "self", ".", "message", ":", "val", "[", "'message'", "]", "=", "self", ".", "message", "return", "val" ]
Convert Exception class to a Python dictionary.
[ "Convert", "Exception", "class", "to", "a", "Python", "dictionary", "." ]
1812a2f4620783883a3c884b01c216bd02177dbb
https://github.com/bbelyeu/flask-exceptions/blob/1812a2f4620783883a3c884b01c216bd02177dbb/flask_exceptions/extension.py#L43-L48
38,948
bbelyeu/flask-exceptions
flask_exceptions/extension.py
AddExceptions.init_app
def init_app(self, app, config=None, statsd=None): """Init Flask Extension.""" if config is not None: self.config = config elif self.config is None: self.config = app.config self.messages = self.config.get('EXCEPTION_MESSAGE', True) self.prefix = self.con...
python
def init_app(self, app, config=None, statsd=None): """Init Flask Extension.""" if config is not None: self.config = config elif self.config is None: self.config = app.config self.messages = self.config.get('EXCEPTION_MESSAGE', True) self.prefix = self.con...
[ "def", "init_app", "(", "self", ",", "app", ",", "config", "=", "None", ",", "statsd", "=", "None", ")", ":", "if", "config", "is", "not", "None", ":", "self", ".", "config", "=", "config", "elif", "self", ".", "config", "is", "None", ":", "self", ...
Init Flask Extension.
[ "Init", "Flask", "Extension", "." ]
1812a2f4620783883a3c884b01c216bd02177dbb
https://github.com/bbelyeu/flask-exceptions/blob/1812a2f4620783883a3c884b01c216bd02177dbb/flask_exceptions/extension.py#L124-L133
38,949
BrianHicks/emit
emit/router/celery.py
CeleryRouter.wrap_node
def wrap_node(self, node, options): '''\ celery registers tasks by decorating them, and so do we, so the user can pass a celery task and we'll wrap our code with theirs in a nice package celery can execute. ''' if 'celery_task' in options: return options['cele...
python
def wrap_node(self, node, options): '''\ celery registers tasks by decorating them, and so do we, so the user can pass a celery task and we'll wrap our code with theirs in a nice package celery can execute. ''' if 'celery_task' in options: return options['cele...
[ "def", "wrap_node", "(", "self", ",", "node", ",", "options", ")", ":", "if", "'celery_task'", "in", "options", ":", "return", "options", "[", "'celery_task'", "]", "(", "node", ")", "return", "self", ".", "celery_task", "(", "node", ")" ]
\ celery registers tasks by decorating them, and so do we, so the user can pass a celery task and we'll wrap our code with theirs in a nice package celery can execute.
[ "\\", "celery", "registers", "tasks", "by", "decorating", "them", "and", "so", "do", "we", "so", "the", "user", "can", "pass", "a", "celery", "task", "and", "we", "ll", "wrap", "our", "code", "with", "theirs", "in", "a", "nice", "package", "celery", "c...
19a86c2392b136c9e857000798ccaa525aa0ed84
https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/router/celery.py#L33-L42
38,950
mpavan/ediblepickle
ediblepickle.py
checkpoint
def checkpoint(key=0, unpickler=pickle.load, pickler=pickle.dump, work_dir=gettempdir(), refresh=False): """ A utility decorator to save intermediate results of a function. It is the caller's responsibility to specify a key naming scheme such that the output of each function call with different argument...
python
def checkpoint(key=0, unpickler=pickle.load, pickler=pickle.dump, work_dir=gettempdir(), refresh=False): """ A utility decorator to save intermediate results of a function. It is the caller's responsibility to specify a key naming scheme such that the output of each function call with different argument...
[ "def", "checkpoint", "(", "key", "=", "0", ",", "unpickler", "=", "pickle", ".", "load", ",", "pickler", "=", "pickle", ".", "dump", ",", "work_dir", "=", "gettempdir", "(", ")", ",", "refresh", "=", "False", ")", ":", "def", "decorator", "(", "func"...
A utility decorator to save intermediate results of a function. It is the caller's responsibility to specify a key naming scheme such that the output of each function call with different arguments is stored in a separate file. :param key: The key to store the computed intermediate output of the decorated f...
[ "A", "utility", "decorator", "to", "save", "intermediate", "results", "of", "a", "function", ".", "It", "is", "the", "caller", "s", "responsibility", "to", "specify", "a", "key", "naming", "scheme", "such", "that", "the", "output", "of", "each", "function", ...
7dca67260caaf8a342ef7197f651c841724d67b0
https://github.com/mpavan/ediblepickle/blob/7dca67260caaf8a342ef7197f651c841724d67b0/ediblepickle.py#L41-L172
38,951
chrisbouchard/braillegraph
braillegraph/__main__.py
run
def run(): """Display the arguments as a braille graph on standard output.""" # We override the program name to reflect that this script must be run with # the python executable. parser = argparse.ArgumentParser( prog='python -m braillegraph', description='Print a braille bar graph of t...
python
def run(): """Display the arguments as a braille graph on standard output.""" # We override the program name to reflect that this script must be run with # the python executable. parser = argparse.ArgumentParser( prog='python -m braillegraph', description='Print a braille bar graph of t...
[ "def", "run", "(", ")", ":", "# We override the program name to reflect that this script must be run with", "# the python executable.", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "'python -m braillegraph'", ",", "description", "=", "'Print a braille bar...
Display the arguments as a braille graph on standard output.
[ "Display", "the", "arguments", "as", "a", "braille", "graph", "on", "standard", "output", "." ]
744ca8394676579cfb11e5c297c9bd794ab5bd78
https://github.com/chrisbouchard/braillegraph/blob/744ca8394676579cfb11e5c297c9bd794ab5bd78/braillegraph/__main__.py#L45-L88
38,952
MacHu-GWU/rolex-project
rolex/generator.py
_rnd_date
def _rnd_date(start, end): """Internal random date generator. """ return date.fromordinal(random.randint(start.toordinal(), end.toordinal()))
python
def _rnd_date(start, end): """Internal random date generator. """ return date.fromordinal(random.randint(start.toordinal(), end.toordinal()))
[ "def", "_rnd_date", "(", "start", ",", "end", ")", ":", "return", "date", ".", "fromordinal", "(", "random", ".", "randint", "(", "start", ".", "toordinal", "(", ")", ",", "end", ".", "toordinal", "(", ")", ")", ")" ]
Internal random date generator.
[ "Internal", "random", "date", "generator", "." ]
a1111b410ed04b4b6eddd81df110fa2dacfa6537
https://github.com/MacHu-GWU/rolex-project/blob/a1111b410ed04b4b6eddd81df110fa2dacfa6537/rolex/generator.py#L253-L256
38,953
MacHu-GWU/rolex-project
rolex/generator.py
rnd_date_list_high_performance
def rnd_date_list_high_performance(size, start=date(1970, 1, 1), end=None, **kwargs): """ Generate mass random date. :param size: int, number of :param start: date similar object, int / str / date / datetime :param end: date similar object, int / str / date / datetime, default today's date :par...
python
def rnd_date_list_high_performance(size, start=date(1970, 1, 1), end=None, **kwargs): """ Generate mass random date. :param size: int, number of :param start: date similar object, int / str / date / datetime :param end: date similar object, int / str / date / datetime, default today's date :par...
[ "def", "rnd_date_list_high_performance", "(", "size", ",", "start", "=", "date", "(", "1970", ",", "1", ",", "1", ")", ",", "end", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "end", "is", "None", ":", "end", "=", "date", ".", "today", "...
Generate mass random date. :param size: int, number of :param start: date similar object, int / str / date / datetime :param end: date similar object, int / str / date / datetime, default today's date :param kwargs: args placeholder :return: list of datetime.date
[ "Generate", "mass", "random", "date", "." ]
a1111b410ed04b4b6eddd81df110fa2dacfa6537
https://github.com/MacHu-GWU/rolex-project/blob/a1111b410ed04b4b6eddd81df110fa2dacfa6537/rolex/generator.py#L295-L319
38,954
MacHu-GWU/rolex-project
rolex/generator.py
day_interval
def day_interval(year, month, day, milliseconds=False, return_string=False): """ Return a start datetime and end datetime of a day. :param milliseconds: Minimum time resolution. :param return_string: If you want string instead of datetime, set True Usage Example:: >>> start, end = rolex.d...
python
def day_interval(year, month, day, milliseconds=False, return_string=False): """ Return a start datetime and end datetime of a day. :param milliseconds: Minimum time resolution. :param return_string: If you want string instead of datetime, set True Usage Example:: >>> start, end = rolex.d...
[ "def", "day_interval", "(", "year", ",", "month", ",", "day", ",", "milliseconds", "=", "False", ",", "return_string", "=", "False", ")", ":", "if", "milliseconds", ":", "# pragma: no cover", "delta", "=", "timedelta", "(", "milliseconds", "=", "1", ")", "...
Return a start datetime and end datetime of a day. :param milliseconds: Minimum time resolution. :param return_string: If you want string instead of datetime, set True Usage Example:: >>> start, end = rolex.day_interval(2014, 6, 17) >>> start datetime(2014, 6, 17, 0, 0, 0) ...
[ "Return", "a", "start", "datetime", "and", "end", "datetime", "of", "a", "day", "." ]
a1111b410ed04b4b6eddd81df110fa2dacfa6537
https://github.com/MacHu-GWU/rolex-project/blob/a1111b410ed04b4b6eddd81df110fa2dacfa6537/rolex/generator.py#L387-L414
38,955
MacHu-GWU/rolex-project
rolex/generator.py
month_interval
def month_interval(year, month, milliseconds=False, return_string=False): """ Return a start datetime and end datetime of a month. :param milliseconds: Minimum time resolution. :param return_string: If you want string instead of datetime, set True Usage Example:: >>> start, end = rolex.mo...
python
def month_interval(year, month, milliseconds=False, return_string=False): """ Return a start datetime and end datetime of a month. :param milliseconds: Minimum time resolution. :param return_string: If you want string instead of datetime, set True Usage Example:: >>> start, end = rolex.mo...
[ "def", "month_interval", "(", "year", ",", "month", ",", "milliseconds", "=", "False", ",", "return_string", "=", "False", ")", ":", "if", "milliseconds", ":", "# pragma: no cover", "delta", "=", "timedelta", "(", "milliseconds", "=", "1", ")", "else", ":", ...
Return a start datetime and end datetime of a month. :param milliseconds: Minimum time resolution. :param return_string: If you want string instead of datetime, set True Usage Example:: >>> start, end = rolex.month_interval(2000, 2) >>> start datetime(2000, 2, 1, 0, 0, 0) ...
[ "Return", "a", "start", "datetime", "and", "end", "datetime", "of", "a", "month", "." ]
a1111b410ed04b4b6eddd81df110fa2dacfa6537
https://github.com/MacHu-GWU/rolex-project/blob/a1111b410ed04b4b6eddd81df110fa2dacfa6537/rolex/generator.py#L417-L448
38,956
MacHu-GWU/rolex-project
rolex/generator.py
year_interval
def year_interval(year, milliseconds=False, return_string=False): """ Return a start datetime and end datetime of a year. :param milliseconds: Minimum time resolution. :param return_string: If you want string instead of datetime, set True Usage Example:: >>> start, end = rolex.year_interv...
python
def year_interval(year, milliseconds=False, return_string=False): """ Return a start datetime and end datetime of a year. :param milliseconds: Minimum time resolution. :param return_string: If you want string instead of datetime, set True Usage Example:: >>> start, end = rolex.year_interv...
[ "def", "year_interval", "(", "year", ",", "milliseconds", "=", "False", ",", "return_string", "=", "False", ")", ":", "if", "milliseconds", ":", "# pragma: no cover", "delta", "=", "timedelta", "(", "milliseconds", "=", "1", ")", "else", ":", "delta", "=", ...
Return a start datetime and end datetime of a year. :param milliseconds: Minimum time resolution. :param return_string: If you want string instead of datetime, set True Usage Example:: >>> start, end = rolex.year_interval(2007) >>> start datetime(2007, 1, 1, 0, 0, 0) >>> ...
[ "Return", "a", "start", "datetime", "and", "end", "datetime", "of", "a", "year", "." ]
a1111b410ed04b4b6eddd81df110fa2dacfa6537
https://github.com/MacHu-GWU/rolex-project/blob/a1111b410ed04b4b6eddd81df110fa2dacfa6537/rolex/generator.py#L451-L478
38,957
mgaitan/tisu
tisu/gh.py
GithubManager.get_milestone
def get_milestone(self, title): """ given the title as str, looks for an existing milestone or create a new one, and return the object """ if not title: return GithubObject.NotSet if not hasattr(self, '_milestones'): self._milestones = {m.title: m ...
python
def get_milestone(self, title): """ given the title as str, looks for an existing milestone or create a new one, and return the object """ if not title: return GithubObject.NotSet if not hasattr(self, '_milestones'): self._milestones = {m.title: m ...
[ "def", "get_milestone", "(", "self", ",", "title", ")", ":", "if", "not", "title", ":", "return", "GithubObject", ".", "NotSet", "if", "not", "hasattr", "(", "self", ",", "'_milestones'", ")", ":", "self", ".", "_milestones", "=", "{", "m", ".", "title...
given the title as str, looks for an existing milestone or create a new one, and return the object
[ "given", "the", "title", "as", "str", "looks", "for", "an", "existing", "milestone", "or", "create", "a", "new", "one", "and", "return", "the", "object" ]
7984e7ae414073ef43bb3984909ab7337471c851
https://github.com/mgaitan/tisu/blob/7984e7ae414073ef43bb3984909ab7337471c851/tisu/gh.py#L30-L43
38,958
mgaitan/tisu
tisu/gh.py
GithubManager.get_assignee
def get_assignee(self, login): """ given the user login, looks for a user in assignee list of the repo and return it if was found. """ if not login: return GithubObject.NotSet if not hasattr(self, '_assignees'): self._assignees = {c.login: c for c ...
python
def get_assignee(self, login): """ given the user login, looks for a user in assignee list of the repo and return it if was found. """ if not login: return GithubObject.NotSet if not hasattr(self, '_assignees'): self._assignees = {c.login: c for c ...
[ "def", "get_assignee", "(", "self", ",", "login", ")", ":", "if", "not", "login", ":", "return", "GithubObject", ".", "NotSet", "if", "not", "hasattr", "(", "self", ",", "'_assignees'", ")", ":", "self", ".", "_assignees", "=", "{", "c", ".", "login", ...
given the user login, looks for a user in assignee list of the repo and return it if was found.
[ "given", "the", "user", "login", "looks", "for", "a", "user", "in", "assignee", "list", "of", "the", "repo", "and", "return", "it", "if", "was", "found", "." ]
7984e7ae414073ef43bb3984909ab7337471c851
https://github.com/mgaitan/tisu/blob/7984e7ae414073ef43bb3984909ab7337471c851/tisu/gh.py#L45-L57
38,959
mgaitan/tisu
tisu/gh.py
GithubManager.sender
def sender(self, issues): """ push a list of issues to github """ for issue in issues: state = self.get_state(issue.state) if issue.number: try: gh_issue = self.repo.get_issue(issue.number) original_state = ...
python
def sender(self, issues): """ push a list of issues to github """ for issue in issues: state = self.get_state(issue.state) if issue.number: try: gh_issue = self.repo.get_issue(issue.number) original_state = ...
[ "def", "sender", "(", "self", ",", "issues", ")", ":", "for", "issue", "in", "issues", ":", "state", "=", "self", ".", "get_state", "(", "issue", ".", "state", ")", "if", "issue", ".", "number", ":", "try", ":", "gh_issue", "=", "self", ".", "repo"...
push a list of issues to github
[ "push", "a", "list", "of", "issues", "to", "github" ]
7984e7ae414073ef43bb3984909ab7337471c851
https://github.com/mgaitan/tisu/blob/7984e7ae414073ef43bb3984909ab7337471c851/tisu/gh.py#L67-L102
38,960
BrianHicks/emit
emit/router/rq.py
RQRouter.wrap_node
def wrap_node(self, node, options): ''' we have the option to construct nodes here, so we can use different queues for nodes without having to have different queue objects. ''' job_kwargs = { 'queue': options.get('queue', 'default'), 'connection': options....
python
def wrap_node(self, node, options): ''' we have the option to construct nodes here, so we can use different queues for nodes without having to have different queue objects. ''' job_kwargs = { 'queue': options.get('queue', 'default'), 'connection': options....
[ "def", "wrap_node", "(", "self", ",", "node", ",", "options", ")", ":", "job_kwargs", "=", "{", "'queue'", ":", "options", ".", "get", "(", "'queue'", ",", "'default'", ")", ",", "'connection'", ":", "options", ".", "get", "(", "'connection'", ",", "se...
we have the option to construct nodes here, so we can use different queues for nodes without having to have different queue objects.
[ "we", "have", "the", "option", "to", "construct", "nodes", "here", "so", "we", "can", "use", "different", "queues", "for", "nodes", "without", "having", "to", "have", "different", "queue", "objects", "." ]
19a86c2392b136c9e857000798ccaa525aa0ed84
https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/router/rq.py#L28-L40
38,961
codenerix/django-codenerix-invoicing
codenerix_invoicing/models_sales_original.py
GenLineProduct.create_albaran_automatic
def create_albaran_automatic(pk, list_lines): """ creamos de forma automatica el albaran """ line_bd = SalesLineAlbaran.objects.filter(line_order__pk__in=list_lines).values_list('line_order__pk') if line_bd.count() == 0 or len(list_lines) != len(line_bd[0]): # solo aq...
python
def create_albaran_automatic(pk, list_lines): """ creamos de forma automatica el albaran """ line_bd = SalesLineAlbaran.objects.filter(line_order__pk__in=list_lines).values_list('line_order__pk') if line_bd.count() == 0 or len(list_lines) != len(line_bd[0]): # solo aq...
[ "def", "create_albaran_automatic", "(", "pk", ",", "list_lines", ")", ":", "line_bd", "=", "SalesLineAlbaran", ".", "objects", ".", "filter", "(", "line_order__pk__in", "=", "list_lines", ")", ".", "values_list", "(", "'line_order__pk'", ")", "if", "line_bd", "....
creamos de forma automatica el albaran
[ "creamos", "de", "forma", "automatica", "el", "albaran" ]
7db5c62f335f9215a8b308603848625208b48698
https://github.com/codenerix/django-codenerix-invoicing/blob/7db5c62f335f9215a8b308603848625208b48698/codenerix_invoicing/models_sales_original.py#L1009-L1020
38,962
codenerix/django-codenerix-invoicing
codenerix_invoicing/models_sales_original.py
GenLineProduct.create_invoice_from_albaran
def create_invoice_from_albaran(pk, list_lines): """ la pk y list_lines son de albaranes, necesitamos la info de las lineas de pedidos """ context = {} if list_lines: new_list_lines = [x[0] for x in SalesLineAlbaran.objects.values_list('line_order__pk').filter( ...
python
def create_invoice_from_albaran(pk, list_lines): """ la pk y list_lines son de albaranes, necesitamos la info de las lineas de pedidos """ context = {} if list_lines: new_list_lines = [x[0] for x in SalesLineAlbaran.objects.values_list('line_order__pk').filter( ...
[ "def", "create_invoice_from_albaran", "(", "pk", ",", "list_lines", ")", ":", "context", "=", "{", "}", "if", "list_lines", ":", "new_list_lines", "=", "[", "x", "[", "0", "]", "for", "x", "in", "SalesLineAlbaran", ".", "objects", ".", "values_list", "(", ...
la pk y list_lines son de albaranes, necesitamos la info de las lineas de pedidos
[ "la", "pk", "y", "list_lines", "son", "de", "albaranes", "necesitamos", "la", "info", "de", "las", "lineas", "de", "pedidos" ]
7db5c62f335f9215a8b308603848625208b48698
https://github.com/codenerix/django-codenerix-invoicing/blob/7db5c62f335f9215a8b308603848625208b48698/codenerix_invoicing/models_sales_original.py#L1201-L1227
38,963
codenerix/django-codenerix-invoicing
codenerix_invoicing/models_sales_original.py
GenLineProduct.create_invoice_from_ticket
def create_invoice_from_ticket(pk, list_lines): """ la pk y list_lines son de ticket, necesitamos la info de las lineas de pedidos """ context = {} if list_lines: new_list_lines = [x[0] for x in SalesLineTicket.objects.values_list('line_order__pk').filter(pk__in=[int(...
python
def create_invoice_from_ticket(pk, list_lines): """ la pk y list_lines son de ticket, necesitamos la info de las lineas de pedidos """ context = {} if list_lines: new_list_lines = [x[0] for x in SalesLineTicket.objects.values_list('line_order__pk').filter(pk__in=[int(...
[ "def", "create_invoice_from_ticket", "(", "pk", ",", "list_lines", ")", ":", "context", "=", "{", "}", "if", "list_lines", ":", "new_list_lines", "=", "[", "x", "[", "0", "]", "for", "x", "in", "SalesLineTicket", ".", "objects", ".", "values_list", "(", ...
la pk y list_lines son de ticket, necesitamos la info de las lineas de pedidos
[ "la", "pk", "y", "list_lines", "son", "de", "ticket", "necesitamos", "la", "info", "de", "las", "lineas", "de", "pedidos" ]
7db5c62f335f9215a8b308603848625208b48698
https://github.com/codenerix/django-codenerix-invoicing/blob/7db5c62f335f9215a8b308603848625208b48698/codenerix_invoicing/models_sales_original.py#L1230-L1249
38,964
xtream1101/cutil
cutil/database.py
_check_values
def _check_values(in_values): """ Check if values need to be converted before they get mogrify'd """ out_values = [] for value in in_values: # if isinstance(value, (dict, list)): # out_values.append(json.dumps(value)) # else: out_values...
python
def _check_values(in_values): """ Check if values need to be converted before they get mogrify'd """ out_values = [] for value in in_values: # if isinstance(value, (dict, list)): # out_values.append(json.dumps(value)) # else: out_values...
[ "def", "_check_values", "(", "in_values", ")", ":", "out_values", "=", "[", "]", "for", "value", "in", "in_values", ":", "# if isinstance(value, (dict, list)):", "# out_values.append(json.dumps(value))", "# else:", "out_values", ".", "append", "(", "value", ")", "...
Check if values need to be converted before they get mogrify'd
[ "Check", "if", "values", "need", "to", "be", "converted", "before", "they", "get", "mogrify", "d" ]
2e4d1f00e66154b44d4ccffb9b1db3f37e87f2e8
https://github.com/xtream1101/cutil/blob/2e4d1f00e66154b44d4ccffb9b1db3f37e87f2e8/cutil/database.py#L10-L20
38,965
ScottDuckworth/python-anyvcs
anyvcs/__init__.py
clone
def clone(srcpath, destpath, vcs=None): """Clone an existing repository. :param str srcpath: Path to an existing repository :param str destpath: Desired path of new repository :param str vcs: Either ``git``, ``hg``, or ``svn`` :returns VCSRepo: The newly cloned repository If ``vcs`` is not giv...
python
def clone(srcpath, destpath, vcs=None): """Clone an existing repository. :param str srcpath: Path to an existing repository :param str destpath: Desired path of new repository :param str vcs: Either ``git``, ``hg``, or ``svn`` :returns VCSRepo: The newly cloned repository If ``vcs`` is not giv...
[ "def", "clone", "(", "srcpath", ",", "destpath", ",", "vcs", "=", "None", ")", ":", "vcs", "=", "vcs", "or", "probe", "(", "srcpath", ")", "cls", "=", "_get_repo_class", "(", "vcs", ")", "return", "cls", ".", "clone", "(", "srcpath", ",", "destpath",...
Clone an existing repository. :param str srcpath: Path to an existing repository :param str destpath: Desired path of new repository :param str vcs: Either ``git``, ``hg``, or ``svn`` :returns VCSRepo: The newly cloned repository If ``vcs`` is not given, then the repository type is discovered from...
[ "Clone", "an", "existing", "repository", "." ]
9eb09defbc6b7c99d373fad53cbf8fc81b637923
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/__init__.py#L32-L46
38,966
ScottDuckworth/python-anyvcs
anyvcs/__init__.py
probe
def probe(path): """Probe a repository for its type. :param str path: The path of the repository :raises UnknownVCSType: if the repository type couldn't be inferred :returns str: either ``git``, ``hg``, or ``svn`` This function employs some heuristics to guess the type of the repository. """ ...
python
def probe(path): """Probe a repository for its type. :param str path: The path of the repository :raises UnknownVCSType: if the repository type couldn't be inferred :returns str: either ``git``, ``hg``, or ``svn`` This function employs some heuristics to guess the type of the repository. """ ...
[ "def", "probe", "(", "path", ")", ":", "import", "os", "from", ".", "common", "import", "UnknownVCSType", "if", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", "join", "(", "path", ",", "'.git'", ")", ")", ":", "return", "'git'", "eli...
Probe a repository for its type. :param str path: The path of the repository :raises UnknownVCSType: if the repository type couldn't be inferred :returns str: either ``git``, ``hg``, or ``svn`` This function employs some heuristics to guess the type of the repository.
[ "Probe", "a", "repository", "for", "its", "type", "." ]
9eb09defbc6b7c99d373fad53cbf8fc81b637923
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/__init__.py#L60-L91
38,967
ScottDuckworth/python-anyvcs
anyvcs/__init__.py
open
def open(path, vcs=None): """Open an existing repository :param str path: The path of the repository :param vcs: If specified, assume the given repository type to avoid auto-detection. Either ``git``, ``hg``, or ``svn``. :raises UnknownVCSType: if the repository type couldn't be inferre...
python
def open(path, vcs=None): """Open an existing repository :param str path: The path of the repository :param vcs: If specified, assume the given repository type to avoid auto-detection. Either ``git``, ``hg``, or ``svn``. :raises UnknownVCSType: if the repository type couldn't be inferre...
[ "def", "open", "(", "path", ",", "vcs", "=", "None", ")", ":", "import", "os", "assert", "os", ".", "path", ".", "isdir", "(", "path", ")", ",", "path", "+", "' is not a directory'", "vcs", "=", "vcs", "or", "probe", "(", "path", ")", "cls", "=", ...
Open an existing repository :param str path: The path of the repository :param vcs: If specified, assume the given repository type to avoid auto-detection. Either ``git``, ``hg``, or ``svn``. :raises UnknownVCSType: if the repository type couldn't be inferred If ``vcs`` is not specifie...
[ "Open", "an", "existing", "repository" ]
9eb09defbc6b7c99d373fad53cbf8fc81b637923
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/__init__.py#L94-L109
38,968
ProjetPP/PPP-datamodel-Python
ppp_datamodel/utils/attributesholder.py
AttributesHolder._check_attributes
def _check_attributes(self, attributes, extra=None): """Check if attributes given to the constructor can be used to instanciate a valid node.""" extra = extra or () unknown_keys = set(attributes) - set(self._possible_attributes) - set(extra) if unknown_keys: logger.wa...
python
def _check_attributes(self, attributes, extra=None): """Check if attributes given to the constructor can be used to instanciate a valid node.""" extra = extra or () unknown_keys = set(attributes) - set(self._possible_attributes) - set(extra) if unknown_keys: logger.wa...
[ "def", "_check_attributes", "(", "self", ",", "attributes", ",", "extra", "=", "None", ")", ":", "extra", "=", "extra", "or", "(", ")", "unknown_keys", "=", "set", "(", "attributes", ")", "-", "set", "(", "self", ".", "_possible_attributes", ")", "-", ...
Check if attributes given to the constructor can be used to instanciate a valid node.
[ "Check", "if", "attributes", "given", "to", "the", "constructor", "can", "be", "used", "to", "instanciate", "a", "valid", "node", "." ]
0c7958fb4df75468fd3137240a5065925c239776
https://github.com/ProjetPP/PPP-datamodel-Python/blob/0c7958fb4df75468fd3137240a5065925c239776/ppp_datamodel/utils/attributesholder.py#L13-L20
38,969
standage/tag
tag/__main__.py
main
def main(args=None): """ Entry point for the tag CLI. Isolated as a method so that the CLI can be called by other Python code (e.g. for testing), in which case the arguments are passed to the function. If no arguments are passed to the function, parse them from the command line. """ if ...
python
def main(args=None): """ Entry point for the tag CLI. Isolated as a method so that the CLI can be called by other Python code (e.g. for testing), in which case the arguments are passed to the function. If no arguments are passed to the function, parse them from the command line. """ if ...
[ "def", "main", "(", "args", "=", "None", ")", ":", "if", "args", "is", "None", ":", "args", "=", "tag", ".", "cli", ".", "parser", "(", ")", ".", "parse_args", "(", ")", "assert", "args", ".", "cmd", "in", "mains", "mainmethod", "=", "mains", "["...
Entry point for the tag CLI. Isolated as a method so that the CLI can be called by other Python code (e.g. for testing), in which case the arguments are passed to the function. If no arguments are passed to the function, parse them from the command line.
[ "Entry", "point", "for", "the", "tag", "CLI", "." ]
94686adf57115cea1c5235e99299e691f80ba10b
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/__main__.py#L22-L36
38,970
PhracturedBlue/asterisk_mbox
asterisk_mbox/__init__.py
_build_request
def _build_request(request): """Build message to transfer over the socket from a request.""" msg = bytes([request['cmd']]) if 'dest' in request: msg += bytes([request['dest']]) else: msg += b'\0' if 'sha' in request: msg += request['sha'] else: for dummy in range(...
python
def _build_request(request): """Build message to transfer over the socket from a request.""" msg = bytes([request['cmd']]) if 'dest' in request: msg += bytes([request['dest']]) else: msg += b'\0' if 'sha' in request: msg += request['sha'] else: for dummy in range(...
[ "def", "_build_request", "(", "request", ")", ":", "msg", "=", "bytes", "(", "[", "request", "[", "'cmd'", "]", "]", ")", "if", "'dest'", "in", "request", ":", "msg", "+=", "bytes", "(", "[", "request", "[", "'dest'", "]", "]", ")", "else", ":", ...
Build message to transfer over the socket from a request.
[ "Build", "message", "to", "transfer", "over", "the", "socket", "from", "a", "request", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/__init__.py#L28-L41
38,971
PhracturedBlue/asterisk_mbox
asterisk_mbox/__init__.py
main
def main(): """Show example using the API.""" __async__ = True logging.basicConfig(format="%(levelname)-10s %(message)s", level=logging.DEBUG) if len(sys.argv) != 2: logging.error("Must specify configuration file") sys.exit() config = configparser.ConfigParse...
python
def main(): """Show example using the API.""" __async__ = True logging.basicConfig(format="%(levelname)-10s %(message)s", level=logging.DEBUG) if len(sys.argv) != 2: logging.error("Must specify configuration file") sys.exit() config = configparser.ConfigParse...
[ "def", "main", "(", ")", ":", "__async__", "=", "True", "logging", ".", "basicConfig", "(", "format", "=", "\"%(levelname)-10s %(message)s\"", ",", "level", "=", "logging", ".", "DEBUG", ")", "if", "len", "(", "sys", ".", "argv", ")", "!=", "2", ":", "...
Show example using the API.
[ "Show", "example", "using", "the", "API", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/__init__.py#L242-L267
38,972
PhracturedBlue/asterisk_mbox
asterisk_mbox/__init__.py
Client.start
def start(self): """Start thread.""" if not self._thread: logging.info("Starting asterisk mbox thread") # Ensure signal queue is empty try: while True: self.signal.get(False) except queue.Empty: pass ...
python
def start(self): """Start thread.""" if not self._thread: logging.info("Starting asterisk mbox thread") # Ensure signal queue is empty try: while True: self.signal.get(False) except queue.Empty: pass ...
[ "def", "start", "(", "self", ")", ":", "if", "not", "self", ".", "_thread", ":", "logging", ".", "info", "(", "\"Starting asterisk mbox thread\"", ")", "# Ensure signal queue is empty", "try", ":", "while", "True", ":", "self", ".", "signal", ".", "get", "("...
Start thread.
[ "Start", "thread", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/__init__.py#L73-L85
38,973
PhracturedBlue/asterisk_mbox
asterisk_mbox/__init__.py
Client.stop
def stop(self): """Stop thread.""" if self._thread: self.signal.put("Stop") self._thread.join() if self._soc: self._soc.shutdown() self._soc.close() self._thread = None
python
def stop(self): """Stop thread.""" if self._thread: self.signal.put("Stop") self._thread.join() if self._soc: self._soc.shutdown() self._soc.close() self._thread = None
[ "def", "stop", "(", "self", ")", ":", "if", "self", ".", "_thread", ":", "self", ".", "signal", ".", "put", "(", "\"Stop\"", ")", "self", ".", "_thread", ".", "join", "(", ")", "if", "self", ".", "_soc", ":", "self", ".", "_soc", ".", "shutdown",...
Stop thread.
[ "Stop", "thread", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/__init__.py#L87-L95
38,974
PhracturedBlue/asterisk_mbox
asterisk_mbox/__init__.py
Client._recv_msg
def _recv_msg(self): """Read a message from the server.""" command = ord(recv_blocking(self._soc, 1)) msglen = recv_blocking(self._soc, 4) msglen = ((msglen[0] << 24) + (msglen[1] << 16) + (msglen[2] << 8) + msglen[3]) msg = recv_blocking(self._soc, msglen) ...
python
def _recv_msg(self): """Read a message from the server.""" command = ord(recv_blocking(self._soc, 1)) msglen = recv_blocking(self._soc, 4) msglen = ((msglen[0] << 24) + (msglen[1] << 16) + (msglen[2] << 8) + msglen[3]) msg = recv_blocking(self._soc, msglen) ...
[ "def", "_recv_msg", "(", "self", ")", ":", "command", "=", "ord", "(", "recv_blocking", "(", "self", ".", "_soc", ",", "1", ")", ")", "msglen", "=", "recv_blocking", "(", "self", ".", "_soc", ",", "4", ")", "msglen", "=", "(", "(", "msglen", "[", ...
Read a message from the server.
[ "Read", "a", "message", "from", "the", "server", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/__init__.py#L104-L111
38,975
PhracturedBlue/asterisk_mbox
asterisk_mbox/__init__.py
Client._loop
def _loop(self): """Handle data.""" request = {} connected = False while True: timeout = None sockets = [self.request_queue, self.signal] if not connected: try: self._clear_request(request) self._...
python
def _loop(self): """Handle data.""" request = {} connected = False while True: timeout = None sockets = [self.request_queue, self.signal] if not connected: try: self._clear_request(request) self._...
[ "def", "_loop", "(", "self", ")", ":", "request", "=", "{", "}", "connected", "=", "False", "while", "True", ":", "timeout", "=", "None", "sockets", "=", "[", "self", ".", "request_queue", ",", "self", ".", "signal", "]", "if", "not", "connected", ":...
Handle data.
[ "Handle", "data", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/__init__.py#L146-L196
38,976
PhracturedBlue/asterisk_mbox
asterisk_mbox/__init__.py
Client.mp3
def mp3(self, sha, **kwargs): """Get raw MP3 of a message.""" return self._queue_msg({'cmd': cmd.CMD_MESSAGE_MP3, 'sha': _get_bytes(sha)}, **kwargs)
python
def mp3(self, sha, **kwargs): """Get raw MP3 of a message.""" return self._queue_msg({'cmd': cmd.CMD_MESSAGE_MP3, 'sha': _get_bytes(sha)}, **kwargs)
[ "def", "mp3", "(", "self", ",", "sha", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_queue_msg", "(", "{", "'cmd'", ":", "cmd", ".", "CMD_MESSAGE_MP3", ",", "'sha'", ":", "_get_bytes", "(", "sha", ")", "}", ",", "*", "*", "kwargs", ...
Get raw MP3 of a message.
[ "Get", "raw", "MP3", "of", "a", "message", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/__init__.py#L216-L219
38,977
PhracturedBlue/asterisk_mbox
asterisk_mbox/__init__.py
Client.delete
def delete(self, sha, **kwargs): """Delete a message.""" return self._queue_msg({'cmd': cmd.CMD_MESSAGE_DELETE, 'sha': _get_bytes(sha)}, **kwargs)
python
def delete(self, sha, **kwargs): """Delete a message.""" return self._queue_msg({'cmd': cmd.CMD_MESSAGE_DELETE, 'sha': _get_bytes(sha)}, **kwargs)
[ "def", "delete", "(", "self", ",", "sha", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_queue_msg", "(", "{", "'cmd'", ":", "cmd", ".", "CMD_MESSAGE_DELETE", ",", "'sha'", ":", "_get_bytes", "(", "sha", ")", "}", ",", "*", "*", "kwarg...
Delete a message.
[ "Delete", "a", "message", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/__init__.py#L221-L224
38,978
PhracturedBlue/asterisk_mbox
asterisk_mbox/__init__.py
Client.get_cdr
def get_cdr(self, start=0, count=-1, **kwargs): """Request range of CDR messages""" sha = encode_to_sha("{:d},{:d}".format(start, count)) return self._queue_msg({'cmd': cmd.CMD_MESSAGE_CDR, 'sha': sha}, **kwargs)
python
def get_cdr(self, start=0, count=-1, **kwargs): """Request range of CDR messages""" sha = encode_to_sha("{:d},{:d}".format(start, count)) return self._queue_msg({'cmd': cmd.CMD_MESSAGE_CDR, 'sha': sha}, **kwargs)
[ "def", "get_cdr", "(", "self", ",", "start", "=", "0", ",", "count", "=", "-", "1", ",", "*", "*", "kwargs", ")", ":", "sha", "=", "encode_to_sha", "(", "\"{:d},{:d}\"", ".", "format", "(", "start", ",", "count", ")", ")", "return", "self", ".", ...
Request range of CDR messages
[ "Request", "range", "of", "CDR", "messages" ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/__init__.py#L231-L235
38,979
chrizzFTD/naming
naming/__init__.py
File.path
def path(self) -> Path: """A Path for this name object joining field names from `self.get_path_pattern_list` with this object's name""" args = list(self._iter_translated_field_names(self.get_path_pattern_list())) args.append(self.get_name()) return Path(*args)
python
def path(self) -> Path: """A Path for this name object joining field names from `self.get_path_pattern_list` with this object's name""" args = list(self._iter_translated_field_names(self.get_path_pattern_list())) args.append(self.get_name()) return Path(*args)
[ "def", "path", "(", "self", ")", "->", "Path", ":", "args", "=", "list", "(", "self", ".", "_iter_translated_field_names", "(", "self", ".", "get_path_pattern_list", "(", ")", ")", ")", "args", ".", "append", "(", "self", ".", "get_name", "(", ")", ")"...
A Path for this name object joining field names from `self.get_path_pattern_list` with this object's name
[ "A", "Path", "for", "this", "name", "object", "joining", "field", "names", "from", "self", ".", "get_path_pattern_list", "with", "this", "object", "s", "name" ]
ed0efbd2a3718f977c01cc15b33aeb1aa4fb299c
https://github.com/chrizzFTD/naming/blob/ed0efbd2a3718f977c01cc15b33aeb1aa4fb299c/naming/__init__.py#L103-L107
38,980
ProjetPP/PPP-datamodel-Python
ppp_datamodel/nodes/abstractnode.py
AbstractNode.fold
def fold(self, predicate): """Takes a predicate and applies it to each node starting from the leaves and making the return value propagate.""" childs = {x:y.fold(predicate) for (x,y) in self._attributes.items() if isinstance(y, SerializableTypedAttributesHolder)} return...
python
def fold(self, predicate): """Takes a predicate and applies it to each node starting from the leaves and making the return value propagate.""" childs = {x:y.fold(predicate) for (x,y) in self._attributes.items() if isinstance(y, SerializableTypedAttributesHolder)} return...
[ "def", "fold", "(", "self", ",", "predicate", ")", ":", "childs", "=", "{", "x", ":", "y", ".", "fold", "(", "predicate", ")", "for", "(", "x", ",", "y", ")", "in", "self", ".", "_attributes", ".", "items", "(", ")", "if", "isinstance", "(", "y...
Takes a predicate and applies it to each node starting from the leaves and making the return value propagate.
[ "Takes", "a", "predicate", "and", "applies", "it", "to", "each", "node", "starting", "from", "the", "leaves", "and", "making", "the", "return", "value", "propagate", "." ]
0c7958fb4df75468fd3137240a5065925c239776
https://github.com/ProjetPP/PPP-datamodel-Python/blob/0c7958fb4df75468fd3137240a5065925c239776/ppp_datamodel/nodes/abstractnode.py#L41-L46
38,981
edx/help-tokens
help_tokens/core.py
HelpUrlExpert.the_one
def the_one(cls): """Get the single global HelpUrlExpert object.""" if cls.THE_ONE is None: cls.THE_ONE = cls(settings.HELP_TOKENS_INI_FILE) return cls.THE_ONE
python
def the_one(cls): """Get the single global HelpUrlExpert object.""" if cls.THE_ONE is None: cls.THE_ONE = cls(settings.HELP_TOKENS_INI_FILE) return cls.THE_ONE
[ "def", "the_one", "(", "cls", ")", ":", "if", "cls", ".", "THE_ONE", "is", "None", ":", "cls", ".", "THE_ONE", "=", "cls", "(", "settings", ".", "HELP_TOKENS_INI_FILE", ")", "return", "cls", ".", "THE_ONE" ]
Get the single global HelpUrlExpert object.
[ "Get", "the", "single", "global", "HelpUrlExpert", "object", "." ]
b77d102bbf1e9c9e10d8a6300f4df87fe2263048
https://github.com/edx/help-tokens/blob/b77d102bbf1e9c9e10d8a6300f4df87fe2263048/help_tokens/core.py#L28-L32
38,982
edx/help-tokens
help_tokens/core.py
HelpUrlExpert.get_config_value
def get_config_value(self, section_name, option, default_option="default"): """ Read a value from the configuration, with a default. Args: section_name (str): name of the section in the configuration from which the option should be found. option (str): na...
python
def get_config_value(self, section_name, option, default_option="default"): """ Read a value from the configuration, with a default. Args: section_name (str): name of the section in the configuration from which the option should be found. option (str): na...
[ "def", "get_config_value", "(", "self", ",", "section_name", ",", "option", ",", "default_option", "=", "\"default\"", ")", ":", "if", "self", ".", "config", "is", "None", ":", "self", ".", "config", "=", "configparser", ".", "ConfigParser", "(", ")", "sel...
Read a value from the configuration, with a default. Args: section_name (str): name of the section in the configuration from which the option should be found. option (str): name of the configuration option. default_option (str): name of the default configurat...
[ "Read", "a", "value", "from", "the", "configuration", "with", "a", "default", "." ]
b77d102bbf1e9c9e10d8a6300f4df87fe2263048
https://github.com/edx/help-tokens/blob/b77d102bbf1e9c9e10d8a6300f4df87fe2263048/help_tokens/core.py#L34-L62
38,983
edx/help-tokens
help_tokens/core.py
HelpUrlExpert.url_for_token
def url_for_token(self, token): """Find the full URL for a help token.""" book_url = self.get_config_value("pages", token) book, _, url_tail = book_url.partition(':') book_base = settings.HELP_TOKENS_BOOKS[book] url = book_base lang = getattr(settings, "HELP_TOKENS_LANG...
python
def url_for_token(self, token): """Find the full URL for a help token.""" book_url = self.get_config_value("pages", token) book, _, url_tail = book_url.partition(':') book_base = settings.HELP_TOKENS_BOOKS[book] url = book_base lang = getattr(settings, "HELP_TOKENS_LANG...
[ "def", "url_for_token", "(", "self", ",", "token", ")", ":", "book_url", "=", "self", ".", "get_config_value", "(", "\"pages\"", ",", "token", ")", "book", ",", "_", ",", "url_tail", "=", "book_url", ".", "partition", "(", "':'", ")", "book_base", "=", ...
Find the full URL for a help token.
[ "Find", "the", "full", "URL", "for", "a", "help", "token", "." ]
b77d102bbf1e9c9e10d8a6300f4df87fe2263048
https://github.com/edx/help-tokens/blob/b77d102bbf1e9c9e10d8a6300f4df87fe2263048/help_tokens/core.py#L64-L82
38,984
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
multi_load_data_custom
def multi_load_data_custom(Channel, TraceTitle, RunNos, directoryPath='.', calcPSD=True, NPerSegmentPSD=1000000): """ Lets you load multiple datasets named with the LeCroy's custom naming scheme at once. Parameters ---------- Channel : int The channel you want to load TraceTitle : strin...
python
def multi_load_data_custom(Channel, TraceTitle, RunNos, directoryPath='.', calcPSD=True, NPerSegmentPSD=1000000): """ Lets you load multiple datasets named with the LeCroy's custom naming scheme at once. Parameters ---------- Channel : int The channel you want to load TraceTitle : strin...
[ "def", "multi_load_data_custom", "(", "Channel", ",", "TraceTitle", ",", "RunNos", ",", "directoryPath", "=", "'.'", ",", "calcPSD", "=", "True", ",", "NPerSegmentPSD", "=", "1000000", ")", ":", "# files = glob('{}/*'.format(directoryPath))", "# files_CorrectChann...
Lets you load multiple datasets named with the LeCroy's custom naming scheme at once. Parameters ---------- Channel : int The channel you want to load TraceTitle : string The custom trace title of the files. RunNos : sequence Sequence of run numbers you want to load Rep...
[ "Lets", "you", "load", "multiple", "datasets", "named", "with", "the", "LeCroy", "s", "custom", "naming", "scheme", "at", "once", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L1514-L1559
38,985
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
search_data_custom
def search_data_custom(Channel, TraceTitle, RunNos, directoryPath='.'): """ Lets you create a list with full file paths of the files named with the LeCroy's custom naming scheme. Parameters ---------- Channel : int The channel you want to load TraceTitle : string The custom ...
python
def search_data_custom(Channel, TraceTitle, RunNos, directoryPath='.'): """ Lets you create a list with full file paths of the files named with the LeCroy's custom naming scheme. Parameters ---------- Channel : int The channel you want to load TraceTitle : string The custom ...
[ "def", "search_data_custom", "(", "Channel", ",", "TraceTitle", ",", "RunNos", ",", "directoryPath", "=", "'.'", ")", ":", "files", "=", "glob", "(", "'{}/*'", ".", "format", "(", "directoryPath", ")", ")", "files_CorrectChannel", "=", "[", "]", "for", "fi...
Lets you create a list with full file paths of the files named with the LeCroy's custom naming scheme. Parameters ---------- Channel : int The channel you want to load TraceTitle : string The custom trace title of the files. RunNos : sequence Sequence of run numbers you...
[ "Lets", "you", "create", "a", "list", "with", "full", "file", "paths", "of", "the", "files", "named", "with", "the", "LeCroy", "s", "custom", "naming", "scheme", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L1561-L1598
38,986
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
calc_temp
def calc_temp(Data_ref, Data): """ Calculates the temperature of a data set relative to a reference. The reference is assumed to be at 300K. Parameters ---------- Data_ref : DataObject Reference data set, assumed to be 300K Data : DataObject Data object to have the temperatu...
python
def calc_temp(Data_ref, Data): """ Calculates the temperature of a data set relative to a reference. The reference is assumed to be at 300K. Parameters ---------- Data_ref : DataObject Reference data set, assumed to be 300K Data : DataObject Data object to have the temperatu...
[ "def", "calc_temp", "(", "Data_ref", ",", "Data", ")", ":", "T", "=", "300", "*", "(", "(", "Data", ".", "A", "*", "Data_ref", ".", "Gamma", ")", "/", "(", "Data_ref", ".", "A", "*", "Data", ".", "Gamma", ")", ")", "Data", ".", "T", "=", "T",...
Calculates the temperature of a data set relative to a reference. The reference is assumed to be at 300K. Parameters ---------- Data_ref : DataObject Reference data set, assumed to be 300K Data : DataObject Data object to have the temperature calculated for Returns ------- ...
[ "Calculates", "the", "temperature", "of", "a", "data", "set", "relative", "to", "a", "reference", ".", "The", "reference", "is", "assumed", "to", "be", "at", "300K", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L1601-L1620
38,987
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
fit_curvefit
def fit_curvefit(p0, datax, datay, function, **kwargs): """ Fits the data to a function using scipy.optimise.curve_fit Parameters ---------- p0 : array_like initial parameters to use for fitting datax : array_like x data to use for fitting datay : array_like y data t...
python
def fit_curvefit(p0, datax, datay, function, **kwargs): """ Fits the data to a function using scipy.optimise.curve_fit Parameters ---------- p0 : array_like initial parameters to use for fitting datax : array_like x data to use for fitting datay : array_like y data t...
[ "def", "fit_curvefit", "(", "p0", ",", "datax", ",", "datay", ",", "function", ",", "*", "*", "kwargs", ")", ":", "pfit", ",", "pcov", "=", "_curve_fit", "(", "function", ",", "datax", ",", "datay", ",", "p0", "=", "p0", ",", "epsfcn", "=", "0.0001...
Fits the data to a function using scipy.optimise.curve_fit Parameters ---------- p0 : array_like initial parameters to use for fitting datax : array_like x data to use for fitting datay : array_like y data to use for fitting function : function funcion to be fit ...
[ "Fits", "the", "data", "to", "a", "function", "using", "scipy", ".", "optimise", ".", "curve_fit" ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L1656-L1693
38,988
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
moving_average
def moving_average(array, n=3): """ Calculates the moving average of an array. Parameters ---------- array : array The array to have the moving average taken of n : int The number of points of moving average to take Returns ------- MovingAverageArray : array ...
python
def moving_average(array, n=3): """ Calculates the moving average of an array. Parameters ---------- array : array The array to have the moving average taken of n : int The number of points of moving average to take Returns ------- MovingAverageArray : array ...
[ "def", "moving_average", "(", "array", ",", "n", "=", "3", ")", ":", "ret", "=", "_np", ".", "cumsum", "(", "array", ",", "dtype", "=", "float", ")", "ret", "[", "n", ":", "]", "=", "ret", "[", "n", ":", "]", "-", "ret", "[", ":", "-", "n",...
Calculates the moving average of an array. Parameters ---------- array : array The array to have the moving average taken of n : int The number of points of moving average to take Returns ------- MovingAverageArray : array The n-point moving average of the input...
[ "Calculates", "the", "moving", "average", "of", "an", "array", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L1696-L1714
38,989
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
fit_autocorrelation
def fit_autocorrelation(autocorrelation, time, GammaGuess, TrapFreqGuess=None, method='energy', MakeFig=True, show_fig=True): """ Fits exponential relaxation theory to data. Parameters ---------- autocorrelation : array array containing autocorrelation to be fitted time : array ...
python
def fit_autocorrelation(autocorrelation, time, GammaGuess, TrapFreqGuess=None, method='energy', MakeFig=True, show_fig=True): """ Fits exponential relaxation theory to data. Parameters ---------- autocorrelation : array array containing autocorrelation to be fitted time : array ...
[ "def", "fit_autocorrelation", "(", "autocorrelation", ",", "time", ",", "GammaGuess", ",", "TrapFreqGuess", "=", "None", ",", "method", "=", "'energy'", ",", "MakeFig", "=", "True", ",", "show_fig", "=", "True", ")", ":", "datax", "=", "time", "datay", "="...
Fits exponential relaxation theory to data. Parameters ---------- autocorrelation : array array containing autocorrelation to be fitted time : array array containing the time of each point the autocorrelation was evaluated GammaGuess : float The approximate Big Gamma...
[ "Fits", "exponential", "relaxation", "theory", "to", "data", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L1794-L1880
38,990
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
IFFT_filter
def IFFT_filter(Signal, SampleFreq, lowerFreq, upperFreq, PyCUDA = False): """ Filters data using fft -> zeroing out fft bins -> ifft Parameters ---------- Signal : ndarray Signal to be filtered SampleFreq : float Sample frequency of signal lowerFreq : float Lower fr...
python
def IFFT_filter(Signal, SampleFreq, lowerFreq, upperFreq, PyCUDA = False): """ Filters data using fft -> zeroing out fft bins -> ifft Parameters ---------- Signal : ndarray Signal to be filtered SampleFreq : float Sample frequency of signal lowerFreq : float Lower fr...
[ "def", "IFFT_filter", "(", "Signal", ",", "SampleFreq", ",", "lowerFreq", ",", "upperFreq", ",", "PyCUDA", "=", "False", ")", ":", "if", "PyCUDA", "==", "True", ":", "Signalfft", "=", "calc_fft_with_PyCUDA", "(", "Signal", ")", "else", ":", "print", "(", ...
Filters data using fft -> zeroing out fft bins -> ifft Parameters ---------- Signal : ndarray Signal to be filtered SampleFreq : float Sample frequency of signal lowerFreq : float Lower frequency of bandpass to allow through filter upperFreq : float Upper frequenc...
[ "Filters", "data", "using", "fft", "-", ">", "zeroing", "out", "fft", "bins", "-", ">", "ifft" ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L2693-L2734
38,991
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
calc_fft_with_PyCUDA
def calc_fft_with_PyCUDA(Signal): """ Calculates the FFT of the passed signal by using the scikit-cuda libary which relies on PyCUDA Parameters ---------- Signal : ndarray Signal to be transformed into Fourier space Returns ------- Signalfft : ndarray Array containi...
python
def calc_fft_with_PyCUDA(Signal): """ Calculates the FFT of the passed signal by using the scikit-cuda libary which relies on PyCUDA Parameters ---------- Signal : ndarray Signal to be transformed into Fourier space Returns ------- Signalfft : ndarray Array containi...
[ "def", "calc_fft_with_PyCUDA", "(", "Signal", ")", ":", "print", "(", "\"starting fft\"", ")", "Signal", "=", "Signal", ".", "astype", "(", "_np", ".", "float32", ")", "Signal_gpu", "=", "_gpuarray", ".", "to_gpu", "(", "Signal", ")", "Signalfft_gpu", "=", ...
Calculates the FFT of the passed signal by using the scikit-cuda libary which relies on PyCUDA Parameters ---------- Signal : ndarray Signal to be transformed into Fourier space Returns ------- Signalfft : ndarray Array containing the signal's FFT
[ "Calculates", "the", "FFT", "of", "the", "passed", "signal", "by", "using", "the", "scikit", "-", "cuda", "libary", "which", "relies", "on", "PyCUDA" ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L2736-L2760
38,992
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
calc_ifft_with_PyCUDA
def calc_ifft_with_PyCUDA(Signalfft): """ Calculates the inverse-FFT of the passed FFT-signal by using the scikit-cuda libary which relies on PyCUDA Parameters ---------- Signalfft : ndarray FFT-Signal to be transformed into Real space Returns ------- Signal : ndarray ...
python
def calc_ifft_with_PyCUDA(Signalfft): """ Calculates the inverse-FFT of the passed FFT-signal by using the scikit-cuda libary which relies on PyCUDA Parameters ---------- Signalfft : ndarray FFT-Signal to be transformed into Real space Returns ------- Signal : ndarray ...
[ "def", "calc_ifft_with_PyCUDA", "(", "Signalfft", ")", ":", "print", "(", "\"starting ifft\"", ")", "Signalfft", "=", "Signalfft", ".", "astype", "(", "_np", ".", "complex64", ")", "Signalfft_gpu", "=", "_gpuarray", ".", "to_gpu", "(", "Signalfft", "[", "0", ...
Calculates the inverse-FFT of the passed FFT-signal by using the scikit-cuda libary which relies on PyCUDA Parameters ---------- Signalfft : ndarray FFT-Signal to be transformed into Real space Returns ------- Signal : ndarray Array containing the ifft signal
[ "Calculates", "the", "inverse", "-", "FFT", "of", "the", "passed", "FFT", "-", "signal", "by", "using", "the", "scikit", "-", "cuda", "libary", "which", "relies", "on", "PyCUDA" ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L2762-L2785
38,993
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
make_butterworth_b_a
def make_butterworth_b_a(lowcut, highcut, SampleFreq, order=5, btype='band'): """ Generates the b and a coefficients for a butterworth IIR filter. Parameters ---------- lowcut : float frequency of lower bandpass limit highcut : float frequency of higher bandpass limit Sample...
python
def make_butterworth_b_a(lowcut, highcut, SampleFreq, order=5, btype='band'): """ Generates the b and a coefficients for a butterworth IIR filter. Parameters ---------- lowcut : float frequency of lower bandpass limit highcut : float frequency of higher bandpass limit Sample...
[ "def", "make_butterworth_b_a", "(", "lowcut", ",", "highcut", ",", "SampleFreq", ",", "order", "=", "5", ",", "btype", "=", "'band'", ")", ":", "nyq", "=", "0.5", "*", "SampleFreq", "low", "=", "lowcut", "/", "nyq", "high", "=", "highcut", "/", "nyq", ...
Generates the b and a coefficients for a butterworth IIR filter. Parameters ---------- lowcut : float frequency of lower bandpass limit highcut : float frequency of higher bandpass limit SampleFreq : float Sample frequency of filter order : int, optional order of...
[ "Generates", "the", "b", "and", "a", "coefficients", "for", "a", "butterworth", "IIR", "filter", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L2815-L2850
38,994
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
make_butterworth_bandpass_b_a
def make_butterworth_bandpass_b_a(CenterFreq, bandwidth, SampleFreq, order=5, btype='band'): """ Generates the b and a coefficients for a butterworth bandpass IIR filter. Parameters ---------- CenterFreq : float central frequency of bandpass bandwidth : float width of the bandpa...
python
def make_butterworth_bandpass_b_a(CenterFreq, bandwidth, SampleFreq, order=5, btype='band'): """ Generates the b and a coefficients for a butterworth bandpass IIR filter. Parameters ---------- CenterFreq : float central frequency of bandpass bandwidth : float width of the bandpa...
[ "def", "make_butterworth_bandpass_b_a", "(", "CenterFreq", ",", "bandwidth", ",", "SampleFreq", ",", "order", "=", "5", ",", "btype", "=", "'band'", ")", ":", "lowcut", "=", "CenterFreq", "-", "bandwidth", "/", "2", "highcut", "=", "CenterFreq", "+", "bandwi...
Generates the b and a coefficients for a butterworth bandpass IIR filter. Parameters ---------- CenterFreq : float central frequency of bandpass bandwidth : float width of the bandpass from centre to edge SampleFreq : float Sample frequency of filter order : int, optiona...
[ "Generates", "the", "b", "and", "a", "coefficients", "for", "a", "butterworth", "bandpass", "IIR", "filter", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L2851-L2878
38,995
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
get_freq_response
def get_freq_response(a, b, show_fig=True, SampleFreq=(2 * pi), NumOfFreqs=500, whole=False): """ This function takes an array of coefficients and finds the frequency response of the filter using scipy.signal.freqz. show_fig sets if the response should be plotted Parameters ---------- b : a...
python
def get_freq_response(a, b, show_fig=True, SampleFreq=(2 * pi), NumOfFreqs=500, whole=False): """ This function takes an array of coefficients and finds the frequency response of the filter using scipy.signal.freqz. show_fig sets if the response should be plotted Parameters ---------- b : a...
[ "def", "get_freq_response", "(", "a", ",", "b", ",", "show_fig", "=", "True", ",", "SampleFreq", "=", "(", "2", "*", "pi", ")", ",", "NumOfFreqs", "=", "500", ",", "whole", "=", "False", ")", ":", "w", ",", "h", "=", "scipy", ".", "signal", ".", ...
This function takes an array of coefficients and finds the frequency response of the filter using scipy.signal.freqz. show_fig sets if the response should be plotted Parameters ---------- b : array_like Coefficients multiplying the x values (inputs of the filter) a : array_like ...
[ "This", "function", "takes", "an", "array", "of", "coefficients", "and", "finds", "the", "frequency", "response", "of", "the", "filter", "using", "scipy", ".", "signal", ".", "freqz", ".", "show_fig", "sets", "if", "the", "response", "should", "be", "plotted...
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L2926-L3002
38,996
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
multi_plot_PSD
def multi_plot_PSD(DataArray, xlim=[0, 500], units="kHz", LabelArray=[], ColorArray=[], alphaArray=[], show_fig=True): """ plot the pulse spectral density for multiple data sets on the same axes. Parameters ---------- DataArray : array-like array of DataObject instances for which to plo...
python
def multi_plot_PSD(DataArray, xlim=[0, 500], units="kHz", LabelArray=[], ColorArray=[], alphaArray=[], show_fig=True): """ plot the pulse spectral density for multiple data sets on the same axes. Parameters ---------- DataArray : array-like array of DataObject instances for which to plo...
[ "def", "multi_plot_PSD", "(", "DataArray", ",", "xlim", "=", "[", "0", ",", "500", "]", ",", "units", "=", "\"kHz\"", ",", "LabelArray", "=", "[", "]", ",", "ColorArray", "=", "[", "]", ",", "alphaArray", "=", "[", "]", ",", "show_fig", "=", "True"...
plot the pulse spectral density for multiple data sets on the same axes. Parameters ---------- DataArray : array-like array of DataObject instances for which to plot the PSDs xlim : array-like, optional 2 element array specifying the lower and upper x limit for which to plot...
[ "plot", "the", "pulse", "spectral", "density", "for", "multiple", "data", "sets", "on", "the", "same", "axes", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3005-L3071
38,997
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
multi_plot_time
def multi_plot_time(DataArray, SubSampleN=1, units='s', xlim=None, ylim=None, LabelArray=[], show_fig=True): """ plot the time trace for multiple data sets on the same axes. Parameters ---------- DataArray : array-like array of DataObject instances for which to plot the PSDs SubSampleN ...
python
def multi_plot_time(DataArray, SubSampleN=1, units='s', xlim=None, ylim=None, LabelArray=[], show_fig=True): """ plot the time trace for multiple data sets on the same axes. Parameters ---------- DataArray : array-like array of DataObject instances for which to plot the PSDs SubSampleN ...
[ "def", "multi_plot_time", "(", "DataArray", ",", "SubSampleN", "=", "1", ",", "units", "=", "'s'", ",", "xlim", "=", "None", ",", "ylim", "=", "None", ",", "LabelArray", "=", "[", "]", ",", "show_fig", "=", "True", ")", ":", "unit_prefix", "=", "unit...
plot the time trace for multiple data sets on the same axes. Parameters ---------- DataArray : array-like array of DataObject instances for which to plot the PSDs SubSampleN : int, optional Number of intervals between points to remove (to sub-sample data so that you effectively ...
[ "plot", "the", "time", "trace", "for", "multiple", "data", "sets", "on", "the", "same", "axes", "." ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3074-L3127
38,998
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
multi_subplots_time
def multi_subplots_time(DataArray, SubSampleN=1, units='s', xlim=None, ylim=None, LabelArray=[], show_fig=True): """ plot the time trace on multiple axes Parameters ---------- DataArray : array-like array of DataObject instances for which to plot the PSDs SubSampleN : int, optional ...
python
def multi_subplots_time(DataArray, SubSampleN=1, units='s', xlim=None, ylim=None, LabelArray=[], show_fig=True): """ plot the time trace on multiple axes Parameters ---------- DataArray : array-like array of DataObject instances for which to plot the PSDs SubSampleN : int, optional ...
[ "def", "multi_subplots_time", "(", "DataArray", ",", "SubSampleN", "=", "1", ",", "units", "=", "'s'", ",", "xlim", "=", "None", ",", "ylim", "=", "None", ",", "LabelArray", "=", "[", "]", ",", "show_fig", "=", "True", ")", ":", "unit_prefix", "=", "...
plot the time trace on multiple axes Parameters ---------- DataArray : array-like array of DataObject instances for which to plot the PSDs SubSampleN : int, optional Number of intervals between points to remove (to sub-sample data so that you effectively have lower sample rate t...
[ "plot", "the", "time", "trace", "on", "multiple", "axes" ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3130-L3181
38,999
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
calc_autocorrelation
def calc_autocorrelation(Signal, FFT=False, PyCUDA=False): """ Calculates the autocorrelation from a given Signal via using Parameters ---------- Signal : array-like Array containing the signal to have the autocorrelation calculated for FFT : optional, bool Uses FFT to acce...
python
def calc_autocorrelation(Signal, FFT=False, PyCUDA=False): """ Calculates the autocorrelation from a given Signal via using Parameters ---------- Signal : array-like Array containing the signal to have the autocorrelation calculated for FFT : optional, bool Uses FFT to acce...
[ "def", "calc_autocorrelation", "(", "Signal", ",", "FFT", "=", "False", ",", "PyCUDA", "=", "False", ")", ":", "if", "FFT", "==", "True", ":", "Signal_padded", "=", "scipy", ".", "fftpack", ".", "ifftshift", "(", "(", "Signal", "-", "_np", ".", "averag...
Calculates the autocorrelation from a given Signal via using Parameters ---------- Signal : array-like Array containing the signal to have the autocorrelation calculated for FFT : optional, bool Uses FFT to accelerate autocorrelation calculation, but assumes certain certain...
[ "Calculates", "the", "autocorrelation", "from", "a", "given", "Signal", "via", "using" ]
9d390acc834d70024d47b574aea14189a5a5714e
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3267-L3309