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
242,600
OpenGov/carpenter
carpenter/carpenter.py
remove_column
def remove_column(table, remove_index): ''' Removes the specified column from the table. ''' for row_index in range(len(table)): old_row = table[row_index] new_row = [] for column_index in range(len(old_row)): if column_index !=...
python
def remove_column(table, remove_index): ''' Removes the specified column from the table. ''' for row_index in range(len(table)): old_row = table[row_index] new_row = [] for column_index in range(len(old_row)): if column_index !=...
[ "def", "remove_column", "(", "table", ",", "remove_index", ")", ":", "for", "row_index", "in", "range", "(", "len", "(", "table", ")", ")", ":", "old_row", "=", "table", "[", "row_index", "]", "new_row", "=", "[", "]", "for", "column_index", "in", "ran...
Removes the specified column from the table.
[ "Removes", "the", "specified", "column", "from", "the", "table", "." ]
0ab3c54c05133b9b0468c63e834a7ce3a6fb575b
https://github.com/OpenGov/carpenter/blob/0ab3c54c05133b9b0468c63e834a7ce3a6fb575b/carpenter/carpenter.py#L16-L27
242,601
OpenGov/carpenter
carpenter/carpenter.py
row_content_length
def row_content_length(row): ''' Returns the length of non-empty content in a given row. ''' if not row: return 0 try: return (index + 1 for index, cell in reversed(list(enumerate(row))) if not is_empty_cell(cell)).next() except StopIteration: return len(row)
python
def row_content_length(row): ''' Returns the length of non-empty content in a given row. ''' if not row: return 0 try: return (index + 1 for index, cell in reversed(list(enumerate(row))) if not is_empty_cell(cell)).next() except StopIteration: return len(row)
[ "def", "row_content_length", "(", "row", ")", ":", "if", "not", "row", ":", "return", "0", "try", ":", "return", "(", "index", "+", "1", "for", "index", ",", "cell", "in", "reversed", "(", "list", "(", "enumerate", "(", "row", ")", ")", ")", "if", ...
Returns the length of non-empty content in a given row.
[ "Returns", "the", "length", "of", "non", "-", "empty", "content", "in", "a", "given", "row", "." ]
0ab3c54c05133b9b0468c63e834a7ce3a6fb575b
https://github.com/OpenGov/carpenter/blob/0ab3c54c05133b9b0468c63e834a7ce3a6fb575b/carpenter/carpenter.py#L99-L108
242,602
OpenGov/carpenter
carpenter/carpenter.py
split_block_by_row_length
def split_block_by_row_length(block, split_row_length): ''' Splits the block by finding all rows with less consequetive, non-empty rows than the min_row_length input. ''' split_blocks = [] current_block = [] for row in block: if row_content_length(row) <= split_row_length: ...
python
def split_block_by_row_length(block, split_row_length): ''' Splits the block by finding all rows with less consequetive, non-empty rows than the min_row_length input. ''' split_blocks = [] current_block = [] for row in block: if row_content_length(row) <= split_row_length: ...
[ "def", "split_block_by_row_length", "(", "block", ",", "split_row_length", ")", ":", "split_blocks", "=", "[", "]", "current_block", "=", "[", "]", "for", "row", "in", "block", ":", "if", "row_content_length", "(", "row", ")", "<=", "split_row_length", ":", ...
Splits the block by finding all rows with less consequetive, non-empty rows than the min_row_length input.
[ "Splits", "the", "block", "by", "finding", "all", "rows", "with", "less", "consequetive", "non", "-", "empty", "rows", "than", "the", "min_row_length", "input", "." ]
0ab3c54c05133b9b0468c63e834a7ce3a6fb575b
https://github.com/OpenGov/carpenter/blob/0ab3c54c05133b9b0468c63e834a7ce3a6fb575b/carpenter/carpenter.py#L110-L128
242,603
MacHu-GWU/angora-project
angora/zzz_manual_install.py
check_need_install
def check_need_install(): """Check if installed package are exactly the same to this one. """ md5_root, md5_dst = list(), list() need_install_flag = False for root, _, basename_list in os.walk(_ROOT): if os.path.basename(root) != "__pycache__": for basename in basename_list: ...
python
def check_need_install(): """Check if installed package are exactly the same to this one. """ md5_root, md5_dst = list(), list() need_install_flag = False for root, _, basename_list in os.walk(_ROOT): if os.path.basename(root) != "__pycache__": for basename in basename_list: ...
[ "def", "check_need_install", "(", ")", ":", "md5_root", ",", "md5_dst", "=", "list", "(", ")", ",", "list", "(", ")", "need_install_flag", "=", "False", "for", "root", ",", "_", ",", "basename_list", "in", "os", ".", "walk", "(", "_ROOT", ")", ":", "...
Check if installed package are exactly the same to this one.
[ "Check", "if", "installed", "package", "are", "exactly", "the", "same", "to", "this", "one", "." ]
689a60da51cd88680ddbe26e28dbe81e6b01d275
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/zzz_manual_install.py#L145-L160
242,604
ebrelsford/feincms-pagepermissions
pagepermissions/extension.py
has_permission_to_view
def has_permission_to_view(page, user): """ Check whether the user has permission to view the page. If the user has any of the page's permissions, they have permission. If the page has no set permissions, they have permission. """ if page.permissions.count() == 0: return True for pe...
python
def has_permission_to_view(page, user): """ Check whether the user has permission to view the page. If the user has any of the page's permissions, they have permission. If the page has no set permissions, they have permission. """ if page.permissions.count() == 0: return True for pe...
[ "def", "has_permission_to_view", "(", "page", ",", "user", ")", ":", "if", "page", ".", "permissions", ".", "count", "(", ")", "==", "0", ":", "return", "True", "for", "perm", "in", "page", ".", "permissions", ".", "all", "(", ")", ":", "perm_label", ...
Check whether the user has permission to view the page. If the user has any of the page's permissions, they have permission. If the page has no set permissions, they have permission.
[ "Check", "whether", "the", "user", "has", "permission", "to", "view", "the", "page", ".", "If", "the", "user", "has", "any", "of", "the", "page", "s", "permissions", "they", "have", "permission", ".", "If", "the", "page", "has", "no", "set", "permissions...
097ebf810e794feb4219defc1dc0cd9dd394a734
https://github.com/ebrelsford/feincms-pagepermissions/blob/097ebf810e794feb4219defc1dc0cd9dd394a734/pagepermissions/extension.py#L41-L54
242,605
mariocesar/pengbot
src/pengbot/adapters/shell.py
Shell.do_directives
def do_directives(self, line): """List all directives supported by the bot""" for name, cmd in self.adapter.directives.items(): with colorize('blue'): print('bot %s:' % name) if cmd.__doc__: for line in cmd.__doc__.split('\n'): ...
python
def do_directives(self, line): """List all directives supported by the bot""" for name, cmd in self.adapter.directives.items(): with colorize('blue'): print('bot %s:' % name) if cmd.__doc__: for line in cmd.__doc__.split('\n'): ...
[ "def", "do_directives", "(", "self", ",", "line", ")", ":", "for", "name", ",", "cmd", "in", "self", ".", "adapter", ".", "directives", ".", "items", "(", ")", ":", "with", "colorize", "(", "'blue'", ")", ":", "print", "(", "'bot %s:'", "%", "name", ...
List all directives supported by the bot
[ "List", "all", "directives", "supported", "by", "the", "bot" ]
070854f92ac1314ee56f7f6cb9d27430b8f0fda8
https://github.com/mariocesar/pengbot/blob/070854f92ac1314ee56f7f6cb9d27430b8f0fda8/src/pengbot/adapters/shell.py#L30-L39
242,606
mariocesar/pengbot
src/pengbot/adapters/shell.py
Shell.do_bot
def do_bot(self, line): """Call the bot""" with colorize('blue'): if not line: self.say('what?') try: res = self.adapter.receive(message=line) except UnknownCommand: self.say("I do not known what the '%s' directive is" ...
python
def do_bot(self, line): """Call the bot""" with colorize('blue'): if not line: self.say('what?') try: res = self.adapter.receive(message=line) except UnknownCommand: self.say("I do not known what the '%s' directive is" ...
[ "def", "do_bot", "(", "self", ",", "line", ")", ":", "with", "colorize", "(", "'blue'", ")", ":", "if", "not", "line", ":", "self", ".", "say", "(", "'what?'", ")", "try", ":", "res", "=", "self", ".", "adapter", ".", "receive", "(", "message", "...
Call the bot
[ "Call", "the", "bot" ]
070854f92ac1314ee56f7f6cb9d27430b8f0fda8
https://github.com/mariocesar/pengbot/blob/070854f92ac1314ee56f7f6cb9d27430b8f0fda8/src/pengbot/adapters/shell.py#L45-L56
242,607
Vito2015/pyextend
pyextend/core/wrappers/timeout.py
timeout
def timeout(seconds, error_message=None): """Timeout checking just for Linux-like platform, not working in Windows platform.""" def decorated(func): result = "" def _handle_timeout(signum, frame): errmsg = error_message or 'Timeout: The action <%s> is timeout!' % func.__name__ ...
python
def timeout(seconds, error_message=None): """Timeout checking just for Linux-like platform, not working in Windows platform.""" def decorated(func): result = "" def _handle_timeout(signum, frame): errmsg = error_message or 'Timeout: The action <%s> is timeout!' % func.__name__ ...
[ "def", "timeout", "(", "seconds", ",", "error_message", "=", "None", ")", ":", "def", "decorated", "(", "func", ")", ":", "result", "=", "\"\"", "def", "_handle_timeout", "(", "signum", ",", "frame", ")", ":", "errmsg", "=", "error_message", "or", "'Time...
Timeout checking just for Linux-like platform, not working in Windows platform.
[ "Timeout", "checking", "just", "for", "Linux", "-", "like", "platform", "not", "working", "in", "Windows", "platform", "." ]
36861dfe1087e437ffe9b5a1da9345c85b4fa4a1
https://github.com/Vito2015/pyextend/blob/36861dfe1087e437ffe9b5a1da9345c85b4fa4a1/pyextend/core/wrappers/timeout.py#L25-L60
242,608
luismasuelli/python-cantrips
cantrips/patterns/broadcast.py
IBroadcast.broadcast
def broadcast(self, command, *args, **kwargs): """ Notifies each user with a specified command. """ criterion = kwargs.pop('criterion', self.BROADCAST_FILTER_ALL) for index, user in items(self.users()): if criterion(user, command, *args, **kwargs): sel...
python
def broadcast(self, command, *args, **kwargs): """ Notifies each user with a specified command. """ criterion = kwargs.pop('criterion', self.BROADCAST_FILTER_ALL) for index, user in items(self.users()): if criterion(user, command, *args, **kwargs): sel...
[ "def", "broadcast", "(", "self", ",", "command", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "criterion", "=", "kwargs", ".", "pop", "(", "'criterion'", ",", "self", ".", "BROADCAST_FILTER_ALL", ")", "for", "index", ",", "user", "in", "items",...
Notifies each user with a specified command.
[ "Notifies", "each", "user", "with", "a", "specified", "command", "." ]
dba2742c1d1a60863bb65f4a291464f6e68eb2ee
https://github.com/luismasuelli/python-cantrips/blob/dba2742c1d1a60863bb65f4a291464f6e68eb2ee/cantrips/patterns/broadcast.py#L88-L95
242,609
KitB/compose-deploy
compose_deploy/_main.py
get_config
def get_config(basedir, files): """ Returns the config object for the selected docker-compose.yml This is an instance of `compose.config.config.Config`. """ config_details = config.find( basedir, files, environment.Environment.from_env_file(basedir)) return config.load(config_detai...
python
def get_config(basedir, files): """ Returns the config object for the selected docker-compose.yml This is an instance of `compose.config.config.Config`. """ config_details = config.find( basedir, files, environment.Environment.from_env_file(basedir)) return config.load(config_detai...
[ "def", "get_config", "(", "basedir", ",", "files", ")", ":", "config_details", "=", "config", ".", "find", "(", "basedir", ",", "files", ",", "environment", ".", "Environment", ".", "from_env_file", "(", "basedir", ")", ")", "return", "config", ".", "load"...
Returns the config object for the selected docker-compose.yml This is an instance of `compose.config.config.Config`.
[ "Returns", "the", "config", "object", "for", "the", "selected", "docker", "-", "compose", ".", "yml" ]
45e351ff4a3e8001e544655e7068d9cacdbb48e5
https://github.com/KitB/compose-deploy/blob/45e351ff4a3e8001e544655e7068d9cacdbb48e5/compose_deploy/_main.py#L31-L40
242,610
KitB/compose-deploy
compose_deploy/_main.py
build
def build(config, services): """ Builds images and tags them appropriately. Where "appropriately" means with the output of: git describe --tags HEAD and 'latest' as well (so the "latest" image for each will always be the most recently built) """ filtered_services = {name: service for ...
python
def build(config, services): """ Builds images and tags them appropriately. Where "appropriately" means with the output of: git describe --tags HEAD and 'latest' as well (so the "latest" image for each will always be the most recently built) """ filtered_services = {name: service for ...
[ "def", "build", "(", "config", ",", "services", ")", ":", "filtered_services", "=", "{", "name", ":", "service", "for", "name", ",", "service", "in", "services", ".", "iteritems", "(", ")", "if", "'build'", "in", "service", "}", "_call_output", "(", "'do...
Builds images and tags them appropriately. Where "appropriately" means with the output of: git describe --tags HEAD and 'latest' as well (so the "latest" image for each will always be the most recently built)
[ "Builds", "images", "and", "tags", "them", "appropriately", "." ]
45e351ff4a3e8001e544655e7068d9cacdbb48e5
https://github.com/KitB/compose-deploy/blob/45e351ff4a3e8001e544655e7068d9cacdbb48e5/compose_deploy/_main.py#L99-L122
242,611
KitB/compose-deploy
compose_deploy/_main.py
push
def push(config, services): """ Upload the defined services to their respective repositories. So's we can then tell the remote docker host to then pull and run them. """ version = _get_version() for service_name, service_dict in services.iteritems(): image = service_dict['image'] th...
python
def push(config, services): """ Upload the defined services to their respective repositories. So's we can then tell the remote docker host to then pull and run them. """ version = _get_version() for service_name, service_dict in services.iteritems(): image = service_dict['image'] th...
[ "def", "push", "(", "config", ",", "services", ")", ":", "version", "=", "_get_version", "(", ")", "for", "service_name", ",", "service_dict", "in", "services", ".", "iteritems", "(", ")", ":", "image", "=", "service_dict", "[", "'image'", "]", "things", ...
Upload the defined services to their respective repositories. So's we can then tell the remote docker host to then pull and run them.
[ "Upload", "the", "defined", "services", "to", "their", "respective", "repositories", "." ]
45e351ff4a3e8001e544655e7068d9cacdbb48e5
https://github.com/KitB/compose-deploy/blob/45e351ff4a3e8001e544655e7068d9cacdbb48e5/compose_deploy/_main.py#L125-L135
242,612
hobson/pug-invest
pug/invest/plot.py
generate_bins
def generate_bins(bins, values=None): """Compute bin edges for numpy.histogram based on values and a requested bin parameters Unlike `range`, the largest value is included within the range of the last, largest value, so generate_bins(N) with produce a sequence with length N+1 Arguments: bins (...
python
def generate_bins(bins, values=None): """Compute bin edges for numpy.histogram based on values and a requested bin parameters Unlike `range`, the largest value is included within the range of the last, largest value, so generate_bins(N) with produce a sequence with length N+1 Arguments: bins (...
[ "def", "generate_bins", "(", "bins", ",", "values", "=", "None", ")", ":", "if", "isinstance", "(", "bins", ",", "int", ")", ":", "bins", "=", "(", "bins", ",", ")", "if", "isinstance", "(", "bins", ",", "float", ")", ":", "bins", "=", "(", "0", ...
Compute bin edges for numpy.histogram based on values and a requested bin parameters Unlike `range`, the largest value is included within the range of the last, largest value, so generate_bins(N) with produce a sequence with length N+1 Arguments: bins (int or 2-tuple of floats or sequence of float...
[ "Compute", "bin", "edges", "for", "numpy", ".", "histogram", "based", "on", "values", "and", "a", "requested", "bin", "parameters" ]
836911258a0e920083a88c91beae88eefdebb20c
https://github.com/hobson/pug-invest/blob/836911258a0e920083a88c91beae88eefdebb20c/pug/invest/plot.py#L203-L256
242,613
appstore-zencore/dictop
dictop.py
select
def select(target, path, default=None, slient=True): """Select item with path from target. If not find item and slient marked as True, return default value. If not find item and slient marked as False, raise KeyError. """ def _(value, slient): if slient: return value el...
python
def select(target, path, default=None, slient=True): """Select item with path from target. If not find item and slient marked as True, return default value. If not find item and slient marked as False, raise KeyError. """ def _(value, slient): if slient: return value el...
[ "def", "select", "(", "target", ",", "path", ",", "default", "=", "None", ",", "slient", "=", "True", ")", ":", "def", "_", "(", "value", ",", "slient", ")", ":", "if", "slient", ":", "return", "value", "else", ":", "raise", "KeyError", "(", "\"\""...
Select item with path from target. If not find item and slient marked as True, return default value. If not find item and slient marked as False, raise KeyError.
[ "Select", "item", "with", "path", "from", "target", "." ]
d730f74f6db9c65b7679db237ccf9b1c4031266b
https://github.com/appstore-zencore/dictop/blob/d730f74f6db9c65b7679db237ccf9b1c4031266b/dictop.py#L5-L34
242,614
appstore-zencore/dictop
dictop.py
update
def update(target, path, value): """Update item in path of target with given value. """ names = path.split(".") names_length = len(names) node = target for index in range(names_length): name = names[index] if index == names_length - 1: last = True else: ...
python
def update(target, path, value): """Update item in path of target with given value. """ names = path.split(".") names_length = len(names) node = target for index in range(names_length): name = names[index] if index == names_length - 1: last = True else: ...
[ "def", "update", "(", "target", ",", "path", ",", "value", ")", ":", "names", "=", "path", ".", "split", "(", "\".\"", ")", "names_length", "=", "len", "(", "names", ")", "node", "=", "target", "for", "index", "in", "range", "(", "names_length", ")",...
Update item in path of target with given value.
[ "Update", "item", "in", "path", "of", "target", "with", "given", "value", "." ]
d730f74f6db9c65b7679db237ccf9b1c4031266b
https://github.com/appstore-zencore/dictop/blob/d730f74f6db9c65b7679db237ccf9b1c4031266b/dictop.py#L44-L78
242,615
cdeboever3/cdpybio
cdpybio/picard.py
parse_bam_index_stats
def parse_bam_index_stats(fn): """ Parse the output from Picard's BamIndexStast and return as pandas Dataframe. Parameters ---------- filename : str of filename or file handle Filename of the Picard output you want to parse. Returns ------- df : pandas.DataFrame Data fr...
python
def parse_bam_index_stats(fn): """ Parse the output from Picard's BamIndexStast and return as pandas Dataframe. Parameters ---------- filename : str of filename or file handle Filename of the Picard output you want to parse. Returns ------- df : pandas.DataFrame Data fr...
[ "def", "parse_bam_index_stats", "(", "fn", ")", ":", "with", "open", "(", "fn", ")", "as", "f", ":", "lines", "=", "[", "x", ".", "strip", "(", ")", ".", "split", "(", ")", "for", "x", "in", "f", ".", "readlines", "(", ")", "]", "no_counts", "=...
Parse the output from Picard's BamIndexStast and return as pandas Dataframe. Parameters ---------- filename : str of filename or file handle Filename of the Picard output you want to parse. Returns ------- df : pandas.DataFrame Data from output file.
[ "Parse", "the", "output", "from", "Picard", "s", "BamIndexStast", "and", "return", "as", "pandas", "Dataframe", "." ]
38efdf0e11d01bc00a135921cb91a19c03db5d5c
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/picard.py#L4-L30
242,616
cdeboever3/cdpybio
cdpybio/picard.py
parse_alignment_summary_metrics
def parse_alignment_summary_metrics(fn): """ Parse the output from Picard's CollectAlignmentSummaryMetrics and return as pandas Dataframe. Parameters ---------- filename : str of filename or file handle Filename of the Picard output you want to parse. Returns ------- df : p...
python
def parse_alignment_summary_metrics(fn): """ Parse the output from Picard's CollectAlignmentSummaryMetrics and return as pandas Dataframe. Parameters ---------- filename : str of filename or file handle Filename of the Picard output you want to parse. Returns ------- df : p...
[ "def", "parse_alignment_summary_metrics", "(", "fn", ")", ":", "df", "=", "pd", ".", "read_table", "(", "fn", ",", "index_col", "=", "0", ",", "skiprows", "=", "range", "(", "6", ")", "+", "[", "10", ",", "11", "]", ")", ".", "T", "return", "df" ]
Parse the output from Picard's CollectAlignmentSummaryMetrics and return as pandas Dataframe. Parameters ---------- filename : str of filename or file handle Filename of the Picard output you want to parse. Returns ------- df : pandas.DataFrame Data from output file.
[ "Parse", "the", "output", "from", "Picard", "s", "CollectAlignmentSummaryMetrics", "and", "return", "as", "pandas", "Dataframe", "." ]
38efdf0e11d01bc00a135921cb91a19c03db5d5c
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/picard.py#L32-L49
242,617
cdeboever3/cdpybio
cdpybio/picard.py
parse_mark_duplicate_metrics
def parse_mark_duplicate_metrics(fn): """ Parse the output from Picard's MarkDuplicates and return as pandas Series. Parameters ---------- filename : str of filename or file handle Filename of the Picard output you want to parse. Returns ------- metrics : pandas.Series ...
python
def parse_mark_duplicate_metrics(fn): """ Parse the output from Picard's MarkDuplicates and return as pandas Series. Parameters ---------- filename : str of filename or file handle Filename of the Picard output you want to parse. Returns ------- metrics : pandas.Series ...
[ "def", "parse_mark_duplicate_metrics", "(", "fn", ")", ":", "with", "open", "(", "fn", ")", "as", "f", ":", "lines", "=", "[", "x", ".", "strip", "(", ")", ".", "split", "(", "'\\t'", ")", "for", "x", "in", "f", ".", "readlines", "(", ")", "]", ...
Parse the output from Picard's MarkDuplicates and return as pandas Series. Parameters ---------- filename : str of filename or file handle Filename of the Picard output you want to parse. Returns ------- metrics : pandas.Series Duplicate metrics. hist : pandas.Series ...
[ "Parse", "the", "output", "from", "Picard", "s", "MarkDuplicates", "and", "return", "as", "pandas", "Series", "." ]
38efdf0e11d01bc00a135921cb91a19c03db5d5c
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/picard.py#L51-L79
242,618
cdeboever3/cdpybio
cdpybio/picard.py
parse_insert_metrics
def parse_insert_metrics(fn): """ Parse the output from Picard's CollectInsertSizeMetrics and return as pandas Series. Parameters ---------- filename : str of filename or file handle Filename of the Picard output you want to parse. Returns ------- metrics : pandas.Series ...
python
def parse_insert_metrics(fn): """ Parse the output from Picard's CollectInsertSizeMetrics and return as pandas Series. Parameters ---------- filename : str of filename or file handle Filename of the Picard output you want to parse. Returns ------- metrics : pandas.Series ...
[ "def", "parse_insert_metrics", "(", "fn", ")", ":", "with", "open", "(", "fn", ")", "as", "f", ":", "lines", "=", "[", "x", ".", "strip", "(", ")", ".", "split", "(", "'\\t'", ")", "for", "x", "in", "f", ".", "readlines", "(", ")", "]", "index"...
Parse the output from Picard's CollectInsertSizeMetrics and return as pandas Series. Parameters ---------- filename : str of filename or file handle Filename of the Picard output you want to parse. Returns ------- metrics : pandas.Series Insert size metrics. hist : pan...
[ "Parse", "the", "output", "from", "Picard", "s", "CollectInsertSizeMetrics", "and", "return", "as", "pandas", "Series", "." ]
38efdf0e11d01bc00a135921cb91a19c03db5d5c
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/picard.py#L81-L121
242,619
bahattincinic/apistar_shell
apistar_shell/commands.py
shell_sqlalchemy
def shell_sqlalchemy(session: SqlalchemySession, backend: ShellBackend): """ This command includes SQLAlchemy DB Session """ namespace = { 'session': session } namespace.update(backend.get_namespace()) embed(user_ns=namespace, header=backend.header)
python
def shell_sqlalchemy(session: SqlalchemySession, backend: ShellBackend): """ This command includes SQLAlchemy DB Session """ namespace = { 'session': session } namespace.update(backend.get_namespace()) embed(user_ns=namespace, header=backend.header)
[ "def", "shell_sqlalchemy", "(", "session", ":", "SqlalchemySession", ",", "backend", ":", "ShellBackend", ")", ":", "namespace", "=", "{", "'session'", ":", "session", "}", "namespace", ".", "update", "(", "backend", ".", "get_namespace", "(", ")", ")", "emb...
This command includes SQLAlchemy DB Session
[ "This", "command", "includes", "SQLAlchemy", "DB", "Session" ]
8b291fc514d668d6f8ff159da488adae242a338a
https://github.com/bahattincinic/apistar_shell/blob/8b291fc514d668d6f8ff159da488adae242a338a/apistar_shell/commands.py#L9-L17
242,620
bahattincinic/apistar_shell
apistar_shell/commands.py
shell_django
def shell_django(session: DjangoSession, backend: ShellBackend): """ This command includes Django DB Session """ namespace = { 'session': session } namespace.update(backend.get_namespace()) embed(user_ns=namespace, header=backend.header)
python
def shell_django(session: DjangoSession, backend: ShellBackend): """ This command includes Django DB Session """ namespace = { 'session': session } namespace.update(backend.get_namespace()) embed(user_ns=namespace, header=backend.header)
[ "def", "shell_django", "(", "session", ":", "DjangoSession", ",", "backend", ":", "ShellBackend", ")", ":", "namespace", "=", "{", "'session'", ":", "session", "}", "namespace", ".", "update", "(", "backend", ".", "get_namespace", "(", ")", ")", "embed", "...
This command includes Django DB Session
[ "This", "command", "includes", "Django", "DB", "Session" ]
8b291fc514d668d6f8ff159da488adae242a338a
https://github.com/bahattincinic/apistar_shell/blob/8b291fc514d668d6f8ff159da488adae242a338a/apistar_shell/commands.py#L20-L28
242,621
Othernet-Project/squery-pg
squery_pg/squery_pg.py
Database.serialize_query
def serialize_query(func): """ Ensure any SQLExpression instances are serialized""" @functools.wraps(func) def wrapper(self, query, *args, **kwargs): if hasattr(query, 'serialize'): query = query.serialize() assert isinstance(query, basestring), 'Expected...
python
def serialize_query(func): """ Ensure any SQLExpression instances are serialized""" @functools.wraps(func) def wrapper(self, query, *args, **kwargs): if hasattr(query, 'serialize'): query = query.serialize() assert isinstance(query, basestring), 'Expected...
[ "def", "serialize_query", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrapper", "(", "self", ",", "query", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "hasattr", "(", "query", ",", "'serialize'", ...
Ensure any SQLExpression instances are serialized
[ "Ensure", "any", "SQLExpression", "instances", "are", "serialized" ]
eaa695c3719e2d2b7e1b049bb58c987c132b6b34
https://github.com/Othernet-Project/squery-pg/blob/eaa695c3719e2d2b7e1b049bb58c987c132b6b34/squery_pg/squery_pg.py#L68-L80
242,622
rsalmaso/django-fluo
fluo/admin/models.py
ModelAdmin.autocomplete_view
def autocomplete_view(self, request): """ Searches in the fields of the given related model and returns the result as a simple string to be used by the jQuery Autocomplete plugin """ query = request.GET.get('q', None) app_label = request.GET.get('app_label', None) ...
python
def autocomplete_view(self, request): """ Searches in the fields of the given related model and returns the result as a simple string to be used by the jQuery Autocomplete plugin """ query = request.GET.get('q', None) app_label = request.GET.get('app_label', None) ...
[ "def", "autocomplete_view", "(", "self", ",", "request", ")", ":", "query", "=", "request", ".", "GET", ".", "get", "(", "'q'", ",", "None", ")", "app_label", "=", "request", ".", "GET", ".", "get", "(", "'app_label'", ",", "None", ")", "model_name", ...
Searches in the fields of the given related model and returns the result as a simple string to be used by the jQuery Autocomplete plugin
[ "Searches", "in", "the", "fields", "of", "the", "given", "related", "model", "and", "returns", "the", "result", "as", "a", "simple", "string", "to", "be", "used", "by", "the", "jQuery", "Autocomplete", "plugin" ]
1321c1e7d6a912108f79be02a9e7f2108c57f89f
https://github.com/rsalmaso/django-fluo/blob/1321c1e7d6a912108f79be02a9e7f2108c57f89f/fluo/admin/models.py#L137-L198
242,623
cuescience/goat
goat/model.py
Match.run
def run(self, context): """We have to overwrite this method because we don't want an implicit context """ args = [] kwargs = {} for arg in self.explicit_arguments: if arg.name is not None: kwargs[arg.name] = arg.value else: ...
python
def run(self, context): """We have to overwrite this method because we don't want an implicit context """ args = [] kwargs = {} for arg in self.explicit_arguments: if arg.name is not None: kwargs[arg.name] = arg.value else: ...
[ "def", "run", "(", "self", ",", "context", ")", ":", "args", "=", "[", "]", "kwargs", "=", "{", "}", "for", "arg", "in", "self", ".", "explicit_arguments", ":", "if", "arg", ".", "name", "is", "not", "None", ":", "kwargs", "[", "arg", ".", "name"...
We have to overwrite this method because we don't want an implicit context
[ "We", "have", "to", "overwrite", "this", "method", "because", "we", "don", "t", "want", "an", "implicit", "context" ]
d76f44b9ec5dc40ad33abca50830c0d7492ef152
https://github.com/cuescience/goat/blob/d76f44b9ec5dc40ad33abca50830c0d7492ef152/goat/model.py#L46-L99
242,624
cdeboever3/cdpybio
cdpybio/analysis.py
liftover_bed
def liftover_bed( bed, chain, mapped=None, unmapped=None, liftOver_path='liftOver', ): """ Lift over a bed file using a given chain file. Parameters ---------- bed : str or pybedtools.BedTool Coordinates to lift over. chain : str Path to chain fi...
python
def liftover_bed( bed, chain, mapped=None, unmapped=None, liftOver_path='liftOver', ): """ Lift over a bed file using a given chain file. Parameters ---------- bed : str or pybedtools.BedTool Coordinates to lift over. chain : str Path to chain fi...
[ "def", "liftover_bed", "(", "bed", ",", "chain", ",", "mapped", "=", "None", ",", "unmapped", "=", "None", ",", "liftOver_path", "=", "'liftOver'", ",", ")", ":", "import", "subprocess", "import", "pybedtools", "as", "pbt", "if", "mapped", "==", "None", ...
Lift over a bed file using a given chain file. Parameters ---------- bed : str or pybedtools.BedTool Coordinates to lift over. chain : str Path to chain file to use for lift over. mapped : str Path for bed file with coordinates that are lifted over correctly. ...
[ "Lift", "over", "a", "bed", "file", "using", "a", "given", "chain", "file", "." ]
38efdf0e11d01bc00a135921cb91a19c03db5d5c
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L354-L437
242,625
cdeboever3/cdpybio
cdpybio/analysis.py
deseq2_size_factors
def deseq2_size_factors(counts, meta, design): """ Get size factors for counts using DESeq2. Parameters ---------- counts : pandas.DataFrame Counts to pass to DESeq2. meta : pandas.DataFrame Pandas dataframe whose index matches the columns of counts. This is passed to D...
python
def deseq2_size_factors(counts, meta, design): """ Get size factors for counts using DESeq2. Parameters ---------- counts : pandas.DataFrame Counts to pass to DESeq2. meta : pandas.DataFrame Pandas dataframe whose index matches the columns of counts. This is passed to D...
[ "def", "deseq2_size_factors", "(", "counts", ",", "meta", ",", "design", ")", ":", "import", "rpy2", ".", "robjects", "as", "r", "from", "rpy2", ".", "robjects", "import", "pandas2ri", "pandas2ri", ".", "activate", "(", ")", "r", ".", "r", "(", "'suppres...
Get size factors for counts using DESeq2. Parameters ---------- counts : pandas.DataFrame Counts to pass to DESeq2. meta : pandas.DataFrame Pandas dataframe whose index matches the columns of counts. This is passed to DESeq2's colData. design : str Design like ~sub...
[ "Get", "size", "factors", "for", "counts", "using", "DESeq2", "." ]
38efdf0e11d01bc00a135921cb91a19c03db5d5c
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L439-L475
242,626
cdeboever3/cdpybio
cdpybio/analysis.py
goseq_gene_enrichment
def goseq_gene_enrichment(genes, sig, plot_fn=None, length_correct=True): """ Perform goseq enrichment for an Ensembl gene set. Parameters ---------- genes : list List of all genes as Ensembl IDs. sig : list List of boolean values indicating whether each gene is signifi...
python
def goseq_gene_enrichment(genes, sig, plot_fn=None, length_correct=True): """ Perform goseq enrichment for an Ensembl gene set. Parameters ---------- genes : list List of all genes as Ensembl IDs. sig : list List of boolean values indicating whether each gene is signifi...
[ "def", "goseq_gene_enrichment", "(", "genes", ",", "sig", ",", "plot_fn", "=", "None", ",", "length_correct", "=", "True", ")", ":", "import", "os", "import", "readline", "import", "statsmodels", ".", "stats", ".", "multitest", "as", "smm", "import", "rpy2",...
Perform goseq enrichment for an Ensembl gene set. Parameters ---------- genes : list List of all genes as Ensembl IDs. sig : list List of boolean values indicating whether each gene is significant or not. plot_fn : str Path to save length bias plot to. If n...
[ "Perform", "goseq", "enrichment", "for", "an", "Ensembl", "gene", "set", "." ]
38efdf0e11d01bc00a135921cb91a19c03db5d5c
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L477-L537
242,627
cdeboever3/cdpybio
cdpybio/analysis.py
categories_to_colors
def categories_to_colors(cats, colormap=None): """ Map categorical data to colors. Parameters ---------- cats : pandas.Series or list Categorical data as a list or in a Series. colormap : list List of RGB triples. If not provided, the tableau20 colormap defined in this...
python
def categories_to_colors(cats, colormap=None): """ Map categorical data to colors. Parameters ---------- cats : pandas.Series or list Categorical data as a list or in a Series. colormap : list List of RGB triples. If not provided, the tableau20 colormap defined in this...
[ "def", "categories_to_colors", "(", "cats", ",", "colormap", "=", "None", ")", ":", "if", "colormap", "is", "None", ":", "colormap", "=", "tableau20", "if", "type", "(", "cats", ")", "!=", "pd", ".", "Series", ":", "cats", "=", "pd", ".", "Series", "...
Map categorical data to colors. Parameters ---------- cats : pandas.Series or list Categorical data as a list or in a Series. colormap : list List of RGB triples. If not provided, the tableau20 colormap defined in this module will be used. Returns ------- legend : ...
[ "Map", "categorical", "data", "to", "colors", "." ]
38efdf0e11d01bc00a135921cb91a19c03db5d5c
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L539-L569
242,628
cdeboever3/cdpybio
cdpybio/analysis.py
plot_color_legend
def plot_color_legend(legend, horizontal=False, ax=None): """ Plot a pandas Series with labels and colors. Parameters ---------- legend : pandas.Series Pandas Series whose values are RGB triples and whose index contains categorical labels. horizontal : bool If True, plo...
python
def plot_color_legend(legend, horizontal=False, ax=None): """ Plot a pandas Series with labels and colors. Parameters ---------- legend : pandas.Series Pandas Series whose values are RGB triples and whose index contains categorical labels. horizontal : bool If True, plo...
[ "def", "plot_color_legend", "(", "legend", ",", "horizontal", "=", "False", ",", "ax", "=", "None", ")", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "import", "numpy", "as", "np", "t", "=", "np", ".", "array", "(", "[", "np", ".", "array...
Plot a pandas Series with labels and colors. Parameters ---------- legend : pandas.Series Pandas Series whose values are RGB triples and whose index contains categorical labels. horizontal : bool If True, plot horizontally. ax : matplotlib.axis Axis to plot on. ...
[ "Plot", "a", "pandas", "Series", "with", "labels", "and", "colors", "." ]
38efdf0e11d01bc00a135921cb91a19c03db5d5c
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L571-L609
242,629
cdeboever3/cdpybio
cdpybio/analysis.py
make_color_legend_rects
def make_color_legend_rects(colors, labels=None): """ Make list of rectangles and labels for making legends. Parameters ---------- colors : pandas.Series or list Pandas series whose values are colors and index is labels. Alternatively, you can provide a list with colors and provide...
python
def make_color_legend_rects(colors, labels=None): """ Make list of rectangles and labels for making legends. Parameters ---------- colors : pandas.Series or list Pandas series whose values are colors and index is labels. Alternatively, you can provide a list with colors and provide...
[ "def", "make_color_legend_rects", "(", "colors", ",", "labels", "=", "None", ")", ":", "from", "matplotlib", ".", "pyplot", "import", "Rectangle", "if", "labels", ":", "d", "=", "dict", "(", "zip", "(", "labels", ",", "colors", ")", ")", "se", "=", "pd...
Make list of rectangles and labels for making legends. Parameters ---------- colors : pandas.Series or list Pandas series whose values are colors and index is labels. Alternatively, you can provide a list with colors and provide the labels as a list. labels : list If co...
[ "Make", "list", "of", "rectangles", "and", "labels", "for", "making", "legends", "." ]
38efdf0e11d01bc00a135921cb91a19c03db5d5c
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L611-L649
242,630
cdeboever3/cdpybio
cdpybio/analysis.py
SVD.pc_correlation
def pc_correlation(self, covariates, num_pc=5): """ Calculate the correlation between the first num_pc prinicipal components and known covariates. The size and index of covariates determines whether u or v is used. Parameters ---------- covariates : pandas.DataFr...
python
def pc_correlation(self, covariates, num_pc=5): """ Calculate the correlation between the first num_pc prinicipal components and known covariates. The size and index of covariates determines whether u or v is used. Parameters ---------- covariates : pandas.DataFr...
[ "def", "pc_correlation", "(", "self", ",", "covariates", ",", "num_pc", "=", "5", ")", ":", "from", "scipy", ".", "stats", "import", "spearmanr", "if", "(", "covariates", ".", "shape", "[", "0", "]", "==", "self", ".", "u", ".", "shape", "[", "0", ...
Calculate the correlation between the first num_pc prinicipal components and known covariates. The size and index of covariates determines whether u or v is used. Parameters ---------- covariates : pandas.DataFrame Dataframe of covariates whose index corresponds to t...
[ "Calculate", "the", "correlation", "between", "the", "first", "num_pc", "prinicipal", "components", "and", "known", "covariates", ".", "The", "size", "and", "index", "of", "covariates", "determines", "whether", "u", "or", "v", "is", "used", "." ]
38efdf0e11d01bc00a135921cb91a19c03db5d5c
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L911-L951
242,631
siku2/Loglette
loglette/parser/__init__.py
Parser.can_handle
def can_handle(self, text: str) -> bool: """Check whether this parser can parse the text""" try: changelogs = self.split_changelogs(text) if not changelogs: return False for changelog in changelogs: _header, _changes = self.split_change...
python
def can_handle(self, text: str) -> bool: """Check whether this parser can parse the text""" try: changelogs = self.split_changelogs(text) if not changelogs: return False for changelog in changelogs: _header, _changes = self.split_change...
[ "def", "can_handle", "(", "self", ",", "text", ":", "str", ")", "->", "bool", ":", "try", ":", "changelogs", "=", "self", ".", "split_changelogs", "(", "text", ")", "if", "not", "changelogs", ":", "return", "False", "for", "changelog", "in", "changelogs"...
Check whether this parser can parse the text
[ "Check", "whether", "this", "parser", "can", "parse", "the", "text" ]
d69f99c3ead2bb24f2aa491a61a7f82cb9ca8095
https://github.com/siku2/Loglette/blob/d69f99c3ead2bb24f2aa491a61a7f82cb9ca8095/loglette/parser/__init__.py#L23-L41
242,632
lvh/maxims
maxims/named.py
remember
def remember(empowered, powerupClass, interface): """ Adds a powerup to ``empowered`` that will instantiate ``powerupClass`` with the empowered's store when adapted to the given interface. :param empowered: The Empowered (Store or Item) to be powered up. :type empowered: ``axiom.item.Empowered`` ...
python
def remember(empowered, powerupClass, interface): """ Adds a powerup to ``empowered`` that will instantiate ``powerupClass`` with the empowered's store when adapted to the given interface. :param empowered: The Empowered (Store or Item) to be powered up. :type empowered: ``axiom.item.Empowered`` ...
[ "def", "remember", "(", "empowered", ",", "powerupClass", ",", "interface", ")", ":", "className", "=", "fullyQualifiedName", "(", "powerupClass", ")", "powerup", "=", "_StoredByName", "(", "store", "=", "empowered", ".", "store", ",", "className", "=", "class...
Adds a powerup to ``empowered`` that will instantiate ``powerupClass`` with the empowered's store when adapted to the given interface. :param empowered: The Empowered (Store or Item) to be powered up. :type empowered: ``axiom.item.Empowered`` :param powerupClass: The class that will be powered up to. ...
[ "Adds", "a", "powerup", "to", "empowered", "that", "will", "instantiate", "powerupClass", "with", "the", "empowered", "s", "store", "when", "adapted", "to", "the", "given", "interface", "." ]
5c53b25d2cc4ccecbfe90193ade9ce0dbfbe4623
https://github.com/lvh/maxims/blob/5c53b25d2cc4ccecbfe90193ade9ce0dbfbe4623/maxims/named.py#L26-L41
242,633
lvh/maxims
maxims/named.py
forget
def forget(empowered, powerupClass, interface): """ Forgets powerups previously stored with ``remember``. :param empowered: The Empowered (Store or Item) to be powered down. :type empowered: ``axiom.item.Empowered`` :param powerupClass: The class for which powerups will be forgotten. :type powe...
python
def forget(empowered, powerupClass, interface): """ Forgets powerups previously stored with ``remember``. :param empowered: The Empowered (Store or Item) to be powered down. :type empowered: ``axiom.item.Empowered`` :param powerupClass: The class for which powerups will be forgotten. :type powe...
[ "def", "forget", "(", "empowered", ",", "powerupClass", ",", "interface", ")", ":", "className", "=", "fullyQualifiedName", "(", "powerupClass", ")", "withThisName", "=", "_StoredByName", ".", "className", "==", "className", "items", "=", "empowered", ".", "stor...
Forgets powerups previously stored with ``remember``. :param empowered: The Empowered (Store or Item) to be powered down. :type empowered: ``axiom.item.Empowered`` :param powerupClass: The class for which powerups will be forgotten. :type powerupClass: class :param interface: The interface the powe...
[ "Forgets", "powerups", "previously", "stored", "with", "remember", "." ]
5c53b25d2cc4ccecbfe90193ade9ce0dbfbe4623
https://github.com/lvh/maxims/blob/5c53b25d2cc4ccecbfe90193ade9ce0dbfbe4623/maxims/named.py#L44-L67
242,634
mayfield/cellulario
cellulario/iocell.py
IOCell.init_event_loop
def init_event_loop(self): """ Every cell should have its own event loop for proper containment. The type of event loop is not so important however. """ self.loop = asyncio.new_event_loop() self.loop.set_debug(self.debug) if hasattr(self.loop, '_set_coroutine_wrapper'): ...
python
def init_event_loop(self): """ Every cell should have its own event loop for proper containment. The type of event loop is not so important however. """ self.loop = asyncio.new_event_loop() self.loop.set_debug(self.debug) if hasattr(self.loop, '_set_coroutine_wrapper'): ...
[ "def", "init_event_loop", "(", "self", ")", ":", "self", ".", "loop", "=", "asyncio", ".", "new_event_loop", "(", ")", "self", ".", "loop", ".", "set_debug", "(", "self", ".", "debug", ")", "if", "hasattr", "(", "self", ".", "loop", ",", "'_set_corouti...
Every cell should have its own event loop for proper containment. The type of event loop is not so important however.
[ "Every", "cell", "should", "have", "its", "own", "event", "loop", "for", "proper", "containment", ".", "The", "type", "of", "event", "loop", "is", "not", "so", "important", "however", "." ]
e9dc10532a0357bc90ebaa2655b36822f9249673
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L82-L97
242,635
mayfield/cellulario
cellulario/iocell.py
IOCell.cleanup_event_loop
def cleanup_event_loop(self): """ Cleanup an event loop and close it down forever. """ for task in asyncio.Task.all_tasks(loop=self.loop): if self.debug: warnings.warn('Cancelling task: %s' % task) task._log_destroy_pending = False task.cancel() ...
python
def cleanup_event_loop(self): """ Cleanup an event loop and close it down forever. """ for task in asyncio.Task.all_tasks(loop=self.loop): if self.debug: warnings.warn('Cancelling task: %s' % task) task._log_destroy_pending = False task.cancel() ...
[ "def", "cleanup_event_loop", "(", "self", ")", ":", "for", "task", "in", "asyncio", ".", "Task", ".", "all_tasks", "(", "loop", "=", "self", ".", "loop", ")", ":", "if", "self", ".", "debug", ":", "warnings", ".", "warn", "(", "'Cancelling task: %s'", ...
Cleanup an event loop and close it down forever.
[ "Cleanup", "an", "event", "loop", "and", "close", "it", "down", "forever", "." ]
e9dc10532a0357bc90ebaa2655b36822f9249673
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L99-L110
242,636
mayfield/cellulario
cellulario/iocell.py
IOCell.add_tier
def add_tier(self, coro, **kwargs): """ Add a coroutine to the cell as a task tier. The source can be a single value or a list of either `Tier` types or coroutine functions already added to a `Tier` via `add_tier`. """ self.assertNotFinalized() assert asyncio.iscoroutinefunction...
python
def add_tier(self, coro, **kwargs): """ Add a coroutine to the cell as a task tier. The source can be a single value or a list of either `Tier` types or coroutine functions already added to a `Tier` via `add_tier`. """ self.assertNotFinalized() assert asyncio.iscoroutinefunction...
[ "def", "add_tier", "(", "self", ",", "coro", ",", "*", "*", "kwargs", ")", ":", "self", ".", "assertNotFinalized", "(", ")", "assert", "asyncio", ".", "iscoroutinefunction", "(", "coro", ")", "tier", "=", "self", ".", "Tier", "(", "self", ",", "coro", ...
Add a coroutine to the cell as a task tier. The source can be a single value or a list of either `Tier` types or coroutine functions already added to a `Tier` via `add_tier`.
[ "Add", "a", "coroutine", "to", "the", "cell", "as", "a", "task", "tier", ".", "The", "source", "can", "be", "a", "single", "value", "or", "a", "list", "of", "either", "Tier", "types", "or", "coroutine", "functions", "already", "added", "to", "a", "Tier...
e9dc10532a0357bc90ebaa2655b36822f9249673
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L123-L132
242,637
mayfield/cellulario
cellulario/iocell.py
IOCell.append_tier
def append_tier(self, coro, **kwargs): """ Implicitly source from the tail tier like a pipe. """ source = self.tiers[-1] if self.tiers else None return self.add_tier(coro, source=source, **kwargs)
python
def append_tier(self, coro, **kwargs): """ Implicitly source from the tail tier like a pipe. """ source = self.tiers[-1] if self.tiers else None return self.add_tier(coro, source=source, **kwargs)
[ "def", "append_tier", "(", "self", ",", "coro", ",", "*", "*", "kwargs", ")", ":", "source", "=", "self", ".", "tiers", "[", "-", "1", "]", "if", "self", ".", "tiers", "else", "None", "return", "self", ".", "add_tier", "(", "coro", ",", "source", ...
Implicitly source from the tail tier like a pipe.
[ "Implicitly", "source", "from", "the", "tail", "tier", "like", "a", "pipe", "." ]
e9dc10532a0357bc90ebaa2655b36822f9249673
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L134-L137
242,638
mayfield/cellulario
cellulario/iocell.py
IOCell.tier
def tier(self, *args, append=True, source=None, **kwargs): """ Function decorator for a tier coroutine. If the function being decorated is not already a coroutine function it will be wrapped. """ if len(args) == 1 and not kwargs and callable(args[0]): raise TypeError('Uncalled decor...
python
def tier(self, *args, append=True, source=None, **kwargs): """ Function decorator for a tier coroutine. If the function being decorated is not already a coroutine function it will be wrapped. """ if len(args) == 1 and not kwargs and callable(args[0]): raise TypeError('Uncalled decor...
[ "def", "tier", "(", "self", ",", "*", "args", ",", "append", "=", "True", ",", "source", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "args", ")", "==", "1", "and", "not", "kwargs", "and", "callable", "(", "args", "[", "0",...
Function decorator for a tier coroutine. If the function being decorated is not already a coroutine function it will be wrapped.
[ "Function", "decorator", "for", "a", "tier", "coroutine", ".", "If", "the", "function", "being", "decorated", "is", "not", "already", "a", "coroutine", "function", "it", "will", "be", "wrapped", "." ]
e9dc10532a0357bc90ebaa2655b36822f9249673
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L145-L159
242,639
mayfield/cellulario
cellulario/iocell.py
IOCell.cleaner
def cleaner(self, coro): """ Function decorator for a cleanup coroutine. """ if not asyncio.iscoroutinefunction(coro): coro = asyncio.coroutine(coro) self.add_cleaner(coro) return coro
python
def cleaner(self, coro): """ Function decorator for a cleanup coroutine. """ if not asyncio.iscoroutinefunction(coro): coro = asyncio.coroutine(coro) self.add_cleaner(coro) return coro
[ "def", "cleaner", "(", "self", ",", "coro", ")", ":", "if", "not", "asyncio", ".", "iscoroutinefunction", "(", "coro", ")", ":", "coro", "=", "asyncio", ".", "coroutine", "(", "coro", ")", "self", ".", "add_cleaner", "(", "coro", ")", "return", "coro" ...
Function decorator for a cleanup coroutine.
[ "Function", "decorator", "for", "a", "cleanup", "coroutine", "." ]
e9dc10532a0357bc90ebaa2655b36822f9249673
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L161-L166
242,640
mayfield/cellulario
cellulario/iocell.py
IOCell.finalize
def finalize(self): """ Look at our tiers and setup the final data flow. Once this is run a cell can not be modified again. """ self.assertNotFinalized() starters = [] finishers = [] for x in self.tiers: if not x.sources: starters.append(x) ...
python
def finalize(self): """ Look at our tiers and setup the final data flow. Once this is run a cell can not be modified again. """ self.assertNotFinalized() starters = [] finishers = [] for x in self.tiers: if not x.sources: starters.append(x) ...
[ "def", "finalize", "(", "self", ")", ":", "self", ".", "assertNotFinalized", "(", ")", "starters", "=", "[", "]", "finishers", "=", "[", "]", "for", "x", "in", "self", ".", "tiers", ":", "if", "not", "x", ".", "sources", ":", "starters", ".", "appe...
Look at our tiers and setup the final data flow. Once this is run a cell can not be modified again.
[ "Look", "at", "our", "tiers", "and", "setup", "the", "final", "data", "flow", ".", "Once", "this", "is", "run", "a", "cell", "can", "not", "be", "modified", "again", "." ]
e9dc10532a0357bc90ebaa2655b36822f9249673
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L168-L182
242,641
mayfield/cellulario
cellulario/iocell.py
IOCell.output
def output(self): """ Produce a classic generator for this cell's final results. """ starters = self.finalize() try: yield from self._output(starters) finally: self.close()
python
def output(self): """ Produce a classic generator for this cell's final results. """ starters = self.finalize() try: yield from self._output(starters) finally: self.close()
[ "def", "output", "(", "self", ")", ":", "starters", "=", "self", ".", "finalize", "(", ")", "try", ":", "yield", "from", "self", ".", "_output", "(", "starters", ")", "finally", ":", "self", ".", "close", "(", ")" ]
Produce a classic generator for this cell's final results.
[ "Produce", "a", "classic", "generator", "for", "this", "cell", "s", "final", "results", "." ]
e9dc10532a0357bc90ebaa2655b36822f9249673
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L200-L206
242,642
mayfield/cellulario
cellulario/iocell.py
IOCell.event_loop
def event_loop(self): """ Run the event loop once. """ if hasattr(self.loop, '._run_once'): self.loop._thread_id = threading.get_ident() try: self.loop._run_once() finally: self.loop._thread_id = None else: self.loop...
python
def event_loop(self): """ Run the event loop once. """ if hasattr(self.loop, '._run_once'): self.loop._thread_id = threading.get_ident() try: self.loop._run_once() finally: self.loop._thread_id = None else: self.loop...
[ "def", "event_loop", "(", "self", ")", ":", "if", "hasattr", "(", "self", ".", "loop", ",", "'._run_once'", ")", ":", "self", ".", "loop", ".", "_thread_id", "=", "threading", ".", "get_ident", "(", ")", "try", ":", "self", ".", "loop", ".", "_run_on...
Run the event loop once.
[ "Run", "the", "event", "loop", "once", "." ]
e9dc10532a0357bc90ebaa2655b36822f9249673
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L208-L218
242,643
mayfield/cellulario
cellulario/iocell.py
IOCell.clean
def clean(self): """ Run all of the cleaners added by the user. """ if self.cleaners: yield from asyncio.wait([x() for x in self.cleaners], loop=self.loop)
python
def clean(self): """ Run all of the cleaners added by the user. """ if self.cleaners: yield from asyncio.wait([x() for x in self.cleaners], loop=self.loop)
[ "def", "clean", "(", "self", ")", ":", "if", "self", ".", "cleaners", ":", "yield", "from", "asyncio", ".", "wait", "(", "[", "x", "(", ")", "for", "x", "in", "self", ".", "cleaners", "]", ",", "loop", "=", "self", ".", "loop", ")" ]
Run all of the cleaners added by the user.
[ "Run", "all", "of", "the", "cleaners", "added", "by", "the", "user", "." ]
e9dc10532a0357bc90ebaa2655b36822f9249673
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L248-L252
242,644
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
Collection.get_html_values
def get_html_values(self, pydict, recovery_name=True): """Convert naive get response data to human readable field name format. using html data format. """ new_dict = {"id": pydict["id"]} for field in self: if field.key in pydict: if recovery_n...
python
def get_html_values(self, pydict, recovery_name=True): """Convert naive get response data to human readable field name format. using html data format. """ new_dict = {"id": pydict["id"]} for field in self: if field.key in pydict: if recovery_n...
[ "def", "get_html_values", "(", "self", ",", "pydict", ",", "recovery_name", "=", "True", ")", ":", "new_dict", "=", "{", "\"id\"", ":", "pydict", "[", "\"id\"", "]", "}", "for", "field", "in", "self", ":", "if", "field", ".", "key", "in", "pydict", "...
Convert naive get response data to human readable field name format. using html data format.
[ "Convert", "naive", "get", "response", "data", "to", "human", "readable", "field", "name", "format", ".", "using", "html", "data", "format", "." ]
dd937f24d7b0a351ba3818eb746c31b29a8cc341
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L50-L62
242,645
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
Collection.get_raw_values
def get_raw_values(self, pydict, recovery_name=True): """Convert naive get response data to human readable field name format. using raw data format. """ new_dict = {"id": pydict["id"]} for field in self: raw_key = "%s_raw" % field.key if raw_key i...
python
def get_raw_values(self, pydict, recovery_name=True): """Convert naive get response data to human readable field name format. using raw data format. """ new_dict = {"id": pydict["id"]} for field in self: raw_key = "%s_raw" % field.key if raw_key i...
[ "def", "get_raw_values", "(", "self", ",", "pydict", ",", "recovery_name", "=", "True", ")", ":", "new_dict", "=", "{", "\"id\"", ":", "pydict", "[", "\"id\"", "]", "}", "for", "field", "in", "self", ":", "raw_key", "=", "\"%s_raw\"", "%", "field", "."...
Convert naive get response data to human readable field name format. using raw data format.
[ "Convert", "naive", "get", "response", "data", "to", "human", "readable", "field", "name", "format", ".", "using", "raw", "data", "format", "." ]
dd937f24d7b0a351ba3818eb746c31b29a8cc341
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L64-L77
242,646
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
Collection.convert_values
def convert_values(self, pydict): """Convert knackhq data type instance to json friendly data. """ new_dict = dict() for key, value in pydict.items(): try: # is it's BaseDataType Instance new_dict[key] = value._data except AttributeError: ...
python
def convert_values(self, pydict): """Convert knackhq data type instance to json friendly data. """ new_dict = dict() for key, value in pydict.items(): try: # is it's BaseDataType Instance new_dict[key] = value._data except AttributeError: ...
[ "def", "convert_values", "(", "self", ",", "pydict", ")", ":", "new_dict", "=", "dict", "(", ")", "for", "key", ",", "value", "in", "pydict", ".", "items", "(", ")", ":", "try", ":", "# is it's BaseDataType Instance", "new_dict", "[", "key", "]", "=", ...
Convert knackhq data type instance to json friendly data.
[ "Convert", "knackhq", "data", "type", "instance", "to", "json", "friendly", "data", "." ]
dd937f24d7b0a351ba3818eb746c31b29a8cc341
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L79-L88
242,647
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
Collection.insert
def insert(self, data, using_name=True): """Insert one or many records. :param data: dict type data or list of dict :param using_name: if you are using field name in data, please set using_name = True (it's the default), otherwise, False **中文文档** 插入...
python
def insert(self, data, using_name=True): """Insert one or many records. :param data: dict type data or list of dict :param using_name: if you are using field name in data, please set using_name = True (it's the default), otherwise, False **中文文档** 插入...
[ "def", "insert", "(", "self", ",", "data", ",", "using_name", "=", "True", ")", ":", "if", "isinstance", "(", "data", ",", "list", ")", ":", "# if iterable, insert one by one", "for", "d", "in", "data", ":", "self", ".", "insert_one", "(", "d", ",", "u...
Insert one or many records. :param data: dict type data or list of dict :param using_name: if you are using field name in data, please set using_name = True (it's the default), otherwise, False **中文文档** 插入多条记录
[ "Insert", "one", "or", "many", "records", "." ]
dd937f24d7b0a351ba3818eb746c31b29a8cc341
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L115-L130
242,648
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
KnackhqAuth.get
def get(self, url, params=dict()): """Http get method wrapper, to support search. """ try: res = requests.get(url, headers=self.headers, params=params) return json.loads(res.text) except Exception as e: print(e) return "error"
python
def get(self, url, params=dict()): """Http get method wrapper, to support search. """ try: res = requests.get(url, headers=self.headers, params=params) return json.loads(res.text) except Exception as e: print(e) return "error"
[ "def", "get", "(", "self", ",", "url", ",", "params", "=", "dict", "(", ")", ")", ":", "try", ":", "res", "=", "requests", ".", "get", "(", "url", ",", "headers", "=", "self", ".", "headers", ",", "params", "=", "params", ")", "return", "json", ...
Http get method wrapper, to support search.
[ "Http", "get", "method", "wrapper", "to", "support", "search", "." ]
dd937f24d7b0a351ba3818eb746c31b29a8cc341
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L330-L338
242,649
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
KnackhqAuth.post
def post(self, url, data): """Http post method wrapper, to support insert. """ try: res = requests.post( url, headers=self.headers, data=json.dumps(data)) return json.loads(res.text) except Exception as e: print(e) return "e...
python
def post(self, url, data): """Http post method wrapper, to support insert. """ try: res = requests.post( url, headers=self.headers, data=json.dumps(data)) return json.loads(res.text) except Exception as e: print(e) return "e...
[ "def", "post", "(", "self", ",", "url", ",", "data", ")", ":", "try", ":", "res", "=", "requests", ".", "post", "(", "url", ",", "headers", "=", "self", ".", "headers", ",", "data", "=", "json", ".", "dumps", "(", "data", ")", ")", "return", "j...
Http post method wrapper, to support insert.
[ "Http", "post", "method", "wrapper", "to", "support", "insert", "." ]
dd937f24d7b0a351ba3818eb746c31b29a8cc341
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L340-L349
242,650
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
KnackhqAuth.delete
def delete(self, url): """Http delete method wrapper, to support delete. """ try: res = requests.delete(url, headers=self.headers) return json.loads(res.text) except Exception as e: print(e) return "error"
python
def delete(self, url): """Http delete method wrapper, to support delete. """ try: res = requests.delete(url, headers=self.headers) return json.loads(res.text) except Exception as e: print(e) return "error"
[ "def", "delete", "(", "self", ",", "url", ")", ":", "try", ":", "res", "=", "requests", ".", "delete", "(", "url", ",", "headers", "=", "self", ".", "headers", ")", "return", "json", ".", "loads", "(", "res", ".", "text", ")", "except", "Exception"...
Http delete method wrapper, to support delete.
[ "Http", "delete", "method", "wrapper", "to", "support", "delete", "." ]
dd937f24d7b0a351ba3818eb746c31b29a8cc341
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L362-L370
242,651
cdeboever3/cdpybio
cdpybio/express.py
combine_express_output
def combine_express_output(fnL, column='eff_counts', names=None, tg=None, define_sample_name=None, debug=False): """ Combine eXpress output files Parameters: ----------...
python
def combine_express_output(fnL, column='eff_counts', names=None, tg=None, define_sample_name=None, debug=False): """ Combine eXpress output files Parameters: ----------...
[ "def", "combine_express_output", "(", "fnL", ",", "column", "=", "'eff_counts'", ",", "names", "=", "None", ",", "tg", "=", "None", ",", "define_sample_name", "=", "None", ",", "debug", "=", "False", ")", ":", "if", "names", "is", "not", "None", ":", "...
Combine eXpress output files Parameters: ----------- fnL : list of strs of filenames List of paths to results.xprs files. column : string Column name of eXpress output to combine. names : list of strings Names to use for columns of output files. Overrides define_sample_na...
[ "Combine", "eXpress", "output", "files" ]
38efdf0e11d01bc00a135921cb91a19c03db5d5c
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/express.py#L5-L75
242,652
MacHu-GWU/angora-project
angora/dataIO/textfile.py
read
def read(path, encoding="utf-8"): """Auto-decoding string reader. Usage:: >>> from angora.dataIO import textfile or >>> from angora.dataIO import * >>> textfile.read("test.txt") """ with open(path, "rb") as f: content = f.read() try: text = c...
python
def read(path, encoding="utf-8"): """Auto-decoding string reader. Usage:: >>> from angora.dataIO import textfile or >>> from angora.dataIO import * >>> textfile.read("test.txt") """ with open(path, "rb") as f: content = f.read() try: text = c...
[ "def", "read", "(", "path", ",", "encoding", "=", "\"utf-8\"", ")", ":", "with", "open", "(", "path", ",", "\"rb\"", ")", "as", "f", ":", "content", "=", "f", ".", "read", "(", ")", "try", ":", "text", "=", "content", ".", "decode", "(", "encodin...
Auto-decoding string reader. Usage:: >>> from angora.dataIO import textfile or >>> from angora.dataIO import * >>> textfile.read("test.txt")
[ "Auto", "-", "decoding", "string", "reader", "." ]
689a60da51cd88680ddbe26e28dbe81e6b01d275
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/dataIO/textfile.py#L35-L52
242,653
MacHu-GWU/angora-project
angora/dataIO/textfile.py
write
def write(text, path): """Writer text to file with utf-8 encoding. Usage:: >>> from angora.dataIO import textfile or >>> from angora.dataIO import * >>> textfile.write("hello world!", "test.txt") """ with open(path, "wb") as f: f.write(text.encode("utf-8"))
python
def write(text, path): """Writer text to file with utf-8 encoding. Usage:: >>> from angora.dataIO import textfile or >>> from angora.dataIO import * >>> textfile.write("hello world!", "test.txt") """ with open(path, "wb") as f: f.write(text.encode("utf-8"))
[ "def", "write", "(", "text", ",", "path", ")", ":", "with", "open", "(", "path", ",", "\"wb\"", ")", "as", "f", ":", "f", ".", "write", "(", "text", ".", "encode", "(", "\"utf-8\"", ")", ")" ]
Writer text to file with utf-8 encoding. Usage:: >>> from angora.dataIO import textfile or >>> from angora.dataIO import * >>> textfile.write("hello world!", "test.txt")
[ "Writer", "text", "to", "file", "with", "utf", "-", "8", "encoding", "." ]
689a60da51cd88680ddbe26e28dbe81e6b01d275
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/dataIO/textfile.py#L54-L66
242,654
MacHu-GWU/angora-project
angora/bot/anjian.py
Script._delay
def _delay(self, ms): """Implement default delay mechanism. """ if ms: self.Delay(ms) else: if self.default_delay: self.Delay(self.default_delay)
python
def _delay(self, ms): """Implement default delay mechanism. """ if ms: self.Delay(ms) else: if self.default_delay: self.Delay(self.default_delay)
[ "def", "_delay", "(", "self", ",", "ms", ")", ":", "if", "ms", ":", "self", ".", "Delay", "(", "ms", ")", "else", ":", "if", "self", ".", "default_delay", ":", "self", ".", "Delay", "(", "self", ".", "default_delay", ")" ]
Implement default delay mechanism.
[ "Implement", "default", "delay", "mechanism", "." ]
689a60da51cd88680ddbe26e28dbe81e6b01d275
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/bot/anjian.py#L91-L98
242,655
MacHu-GWU/angora-project
angora/bot/anjian.py
Script.AltTab
def AltTab(self, n=1, delay=0): """Press down Alt, then press n times Tab, then release Alt. """ self._delay(delay) self.add(Command("KeyDown", 'KeyDown "%s", %s' % (BoardKey.Alt, 1))) for i in range(n): self.add(Command("KeyPress", 'KeyPress "%s", %s' % (BoardKey.Tab...
python
def AltTab(self, n=1, delay=0): """Press down Alt, then press n times Tab, then release Alt. """ self._delay(delay) self.add(Command("KeyDown", 'KeyDown "%s", %s' % (BoardKey.Alt, 1))) for i in range(n): self.add(Command("KeyPress", 'KeyPress "%s", %s' % (BoardKey.Tab...
[ "def", "AltTab", "(", "self", ",", "n", "=", "1", ",", "delay", "=", "0", ")", ":", "self", ".", "_delay", "(", "delay", ")", "self", ".", "add", "(", "Command", "(", "\"KeyDown\"", ",", "'KeyDown \"%s\", %s'", "%", "(", "BoardKey", ".", "Alt", ","...
Press down Alt, then press n times Tab, then release Alt.
[ "Press", "down", "Alt", "then", "press", "n", "times", "Tab", "then", "release", "Alt", "." ]
689a60da51cd88680ddbe26e28dbe81e6b01d275
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/bot/anjian.py#L185-L192
242,656
MacHu-GWU/angora-project
angora/bot/anjian.py
Script.Ctrl_C
def Ctrl_C(self, delay=0): """Ctrl + C shortcut. """ self._delay(delay) self.add(Command("KeyDown", 'KeyDown "%s", %s' % (BoardKey.Ctrl, 1))) self.add(Command("KeyPress", 'KeyPress "%s", %s' % (BoardKey.C, 1))) self.add(Command("KeyUp", 'KeyUp "%s", %s' % (BoardKey.Ctrl, ...
python
def Ctrl_C(self, delay=0): """Ctrl + C shortcut. """ self._delay(delay) self.add(Command("KeyDown", 'KeyDown "%s", %s' % (BoardKey.Ctrl, 1))) self.add(Command("KeyPress", 'KeyPress "%s", %s' % (BoardKey.C, 1))) self.add(Command("KeyUp", 'KeyUp "%s", %s' % (BoardKey.Ctrl, ...
[ "def", "Ctrl_C", "(", "self", ",", "delay", "=", "0", ")", ":", "self", ".", "_delay", "(", "delay", ")", "self", ".", "add", "(", "Command", "(", "\"KeyDown\"", ",", "'KeyDown \"%s\", %s'", "%", "(", "BoardKey", ".", "Ctrl", ",", "1", ")", ")", ")...
Ctrl + C shortcut.
[ "Ctrl", "+", "C", "shortcut", "." ]
689a60da51cd88680ddbe26e28dbe81e6b01d275
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/bot/anjian.py#L194-L200
242,657
MacHu-GWU/angora-project
angora/bot/anjian.py
Script.Ctrl_V
def Ctrl_V(self, delay=0): """Ctrl + V shortcut. """ self._delay(delay) self.add(Command("KeyDown", 'KeyDown "%s", %s' % (BoardKey.Ctrl, 1))) self.add(Command("KeyPress", 'KeyPress "%s", %s' % (BoardKey.V, 1))) self.add(Command("KeyUp", 'KeyUp "%s", %s' % (BoardKey.Ctrl, ...
python
def Ctrl_V(self, delay=0): """Ctrl + V shortcut. """ self._delay(delay) self.add(Command("KeyDown", 'KeyDown "%s", %s' % (BoardKey.Ctrl, 1))) self.add(Command("KeyPress", 'KeyPress "%s", %s' % (BoardKey.V, 1))) self.add(Command("KeyUp", 'KeyUp "%s", %s' % (BoardKey.Ctrl, ...
[ "def", "Ctrl_V", "(", "self", ",", "delay", "=", "0", ")", ":", "self", ".", "_delay", "(", "delay", ")", "self", ".", "add", "(", "Command", "(", "\"KeyDown\"", ",", "'KeyDown \"%s\", %s'", "%", "(", "BoardKey", ".", "Ctrl", ",", "1", ")", ")", ")...
Ctrl + V shortcut.
[ "Ctrl", "+", "V", "shortcut", "." ]
689a60da51cd88680ddbe26e28dbe81e6b01d275
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/bot/anjian.py#L202-L208
242,658
MacHu-GWU/angora-project
angora/bot/anjian.py
Script.Ctrl_W
def Ctrl_W(self, delay=0): """Ctrl + W shortcut. """ self._delay(delay) self.add(Command("KeyDown", 'KeyDown "%s", %s' % (BoardKey.Ctrl, 1))) self.add(Command("KeyPress", 'KeyPress "%s", %s' % (BoardKey.W, 1))) self.add(Command("KeyUp", 'KeyUp "%s", %s' % (BoardKey.Ctrl, ...
python
def Ctrl_W(self, delay=0): """Ctrl + W shortcut. """ self._delay(delay) self.add(Command("KeyDown", 'KeyDown "%s", %s' % (BoardKey.Ctrl, 1))) self.add(Command("KeyPress", 'KeyPress "%s", %s' % (BoardKey.W, 1))) self.add(Command("KeyUp", 'KeyUp "%s", %s' % (BoardKey.Ctrl, ...
[ "def", "Ctrl_W", "(", "self", ",", "delay", "=", "0", ")", ":", "self", ".", "_delay", "(", "delay", ")", "self", ".", "add", "(", "Command", "(", "\"KeyDown\"", ",", "'KeyDown \"%s\", %s'", "%", "(", "BoardKey", ".", "Ctrl", ",", "1", ")", ")", ")...
Ctrl + W shortcut.
[ "Ctrl", "+", "W", "shortcut", "." ]
689a60da51cd88680ddbe26e28dbe81e6b01d275
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/bot/anjian.py#L210-L216
242,659
jeffrimko/Auxly
lib/auxly/stringy.py
randomize
def randomize(length=6, choices=None): """Returns a random string of the given length.""" if type(choices) == str: choices = list(choices) choices = choices or ascii_lowercase return "".join(choice(choices) for _ in range(length))
python
def randomize(length=6, choices=None): """Returns a random string of the given length.""" if type(choices) == str: choices = list(choices) choices = choices or ascii_lowercase return "".join(choice(choices) for _ in range(length))
[ "def", "randomize", "(", "length", "=", "6", ",", "choices", "=", "None", ")", ":", "if", "type", "(", "choices", ")", "==", "str", ":", "choices", "=", "list", "(", "choices", ")", "choices", "=", "choices", "or", "ascii_lowercase", "return", "\"\"", ...
Returns a random string of the given length.
[ "Returns", "a", "random", "string", "of", "the", "given", "length", "." ]
5aae876bcb6ca117c81d904f9455764cdc78cd48
https://github.com/jeffrimko/Auxly/blob/5aae876bcb6ca117c81d904f9455764cdc78cd48/lib/auxly/stringy.py#L22-L27
242,660
inveniosoftware-contrib/record-recommender
record_recommender/recommender.py
calc_scores_for_node
def calc_scores_for_node(G, node, depth_limit=22, number_of_recommendations=None, impact_mode=10): """Calculate the score of multiple records.""" n, w, dep, _ = dfs_edges(G, node, depth_limit, "Record") count_total_ways = len(n) # print "Number of paths {}".format(len(n)) if...
python
def calc_scores_for_node(G, node, depth_limit=22, number_of_recommendations=None, impact_mode=10): """Calculate the score of multiple records.""" n, w, dep, _ = dfs_edges(G, node, depth_limit, "Record") count_total_ways = len(n) # print "Number of paths {}".format(len(n)) if...
[ "def", "calc_scores_for_node", "(", "G", ",", "node", ",", "depth_limit", "=", "22", ",", "number_of_recommendations", "=", "None", ",", "impact_mode", "=", "10", ")", ":", "n", ",", "w", ",", "dep", ",", "_", "=", "dfs_edges", "(", "G", ",", "node", ...
Calculate the score of multiple records.
[ "Calculate", "the", "score", "of", "multiple", "records", "." ]
07f71e783369e6373218b5e6ba0bf15901e9251a
https://github.com/inveniosoftware-contrib/record-recommender/blob/07f71e783369e6373218b5e6ba0bf15901e9251a/record_recommender/recommender.py#L88-L137
242,661
inveniosoftware-contrib/record-recommender
record_recommender/recommender.py
dfs_edges
def dfs_edges(G, start, depth_limit=1, get_only=True, get_path=False): """Deepest first search.""" depth_limit = depth_limit - 1 # creates unsigned int array (2 Byte) output_nodes = array('L') output_depth = array('I') # creates float array (4 Byte) output_weights = array('f') apath = [...
python
def dfs_edges(G, start, depth_limit=1, get_only=True, get_path=False): """Deepest first search.""" depth_limit = depth_limit - 1 # creates unsigned int array (2 Byte) output_nodes = array('L') output_depth = array('I') # creates float array (4 Byte) output_weights = array('f') apath = [...
[ "def", "dfs_edges", "(", "G", ",", "start", ",", "depth_limit", "=", "1", ",", "get_only", "=", "True", ",", "get_path", "=", "False", ")", ":", "depth_limit", "=", "depth_limit", "-", "1", "# creates unsigned int array (2 Byte)", "output_nodes", "=", "array",...
Deepest first search.
[ "Deepest", "first", "search", "." ]
07f71e783369e6373218b5e6ba0bf15901e9251a
https://github.com/inveniosoftware-contrib/record-recommender/blob/07f71e783369e6373218b5e6ba0bf15901e9251a/record_recommender/recommender.py#L140-L203
242,662
inveniosoftware-contrib/record-recommender
record_recommender/recommender.py
calc_weight_of_multiple_paths
def calc_weight_of_multiple_paths(path_scores, impact_div=12): """Caluculate the weight of multipe paths.""" number_of_paths = len(path_scores) if number_of_paths > 1: score_total = 0.0 highest_score = 0.0 for score in path_scores.Scores: score_total += score ...
python
def calc_weight_of_multiple_paths(path_scores, impact_div=12): """Caluculate the weight of multipe paths.""" number_of_paths = len(path_scores) if number_of_paths > 1: score_total = 0.0 highest_score = 0.0 for score in path_scores.Scores: score_total += score ...
[ "def", "calc_weight_of_multiple_paths", "(", "path_scores", ",", "impact_div", "=", "12", ")", ":", "number_of_paths", "=", "len", "(", "path_scores", ")", "if", "number_of_paths", ">", "1", ":", "score_total", "=", "0.0", "highest_score", "=", "0.0", "for", "...
Caluculate the weight of multipe paths.
[ "Caluculate", "the", "weight", "of", "multipe", "paths", "." ]
07f71e783369e6373218b5e6ba0bf15901e9251a
https://github.com/inveniosoftware-contrib/record-recommender/blob/07f71e783369e6373218b5e6ba0bf15901e9251a/record_recommender/recommender.py#L206-L234
242,663
inveniosoftware-contrib/record-recommender
record_recommender/recommender.py
GraphRecommender.recommend_for_record
def recommend_for_record(self, record_id, depth=4, num_reco=10): """Calculate recommendations for record.""" data = calc_scores_for_node(self._graph, record_id, depth, num_reco) return data.Node.tolist(), data.Score.tolist()
python
def recommend_for_record(self, record_id, depth=4, num_reco=10): """Calculate recommendations for record.""" data = calc_scores_for_node(self._graph, record_id, depth, num_reco) return data.Node.tolist(), data.Score.tolist()
[ "def", "recommend_for_record", "(", "self", ",", "record_id", ",", "depth", "=", "4", ",", "num_reco", "=", "10", ")", ":", "data", "=", "calc_scores_for_node", "(", "self", ".", "_graph", ",", "record_id", ",", "depth", ",", "num_reco", ")", "return", "...
Calculate recommendations for record.
[ "Calculate", "recommendations", "for", "record", "." ]
07f71e783369e6373218b5e6ba0bf15901e9251a
https://github.com/inveniosoftware-contrib/record-recommender/blob/07f71e783369e6373218b5e6ba0bf15901e9251a/record_recommender/recommender.py#L47-L50
242,664
inveniosoftware-contrib/record-recommender
record_recommender/recommender.py
GraphRecommender.load_profile
def load_profile(self, profile_name): """Load user profiles from file.""" data = self.storage.get_user_profiles(profile_name) for x in data.get_user_views(): self._graph.add_edge(int(x[0]), int(x[1]), {'weight': float(x[2])}) self.all_records[int(x[1])] += 1 ret...
python
def load_profile(self, profile_name): """Load user profiles from file.""" data = self.storage.get_user_profiles(profile_name) for x in data.get_user_views(): self._graph.add_edge(int(x[0]), int(x[1]), {'weight': float(x[2])}) self.all_records[int(x[1])] += 1 ret...
[ "def", "load_profile", "(", "self", ",", "profile_name", ")", ":", "data", "=", "self", ".", "storage", ".", "get_user_profiles", "(", "profile_name", ")", "for", "x", "in", "data", ".", "get_user_views", "(", ")", ":", "self", ".", "_graph", ".", "add_e...
Load user profiles from file.
[ "Load", "user", "profiles", "from", "file", "." ]
07f71e783369e6373218b5e6ba0bf15901e9251a
https://github.com/inveniosoftware-contrib/record-recommender/blob/07f71e783369e6373218b5e6ba0bf15901e9251a/record_recommender/recommender.py#L52-L60
242,665
inveniosoftware-contrib/record-recommender
record_recommender/recommender.py
GraphRecommender.del_big_nodes
def del_big_nodes(self, grater_than=215): """Delete big nodes with many connections from the graph.""" G = self._graph it = G.nodes_iter() node_paths = [] node_names = [] del_nodes = [] summe = 1 count = 1 for node in it: l = len(G[node...
python
def del_big_nodes(self, grater_than=215): """Delete big nodes with many connections from the graph.""" G = self._graph it = G.nodes_iter() node_paths = [] node_names = [] del_nodes = [] summe = 1 count = 1 for node in it: l = len(G[node...
[ "def", "del_big_nodes", "(", "self", ",", "grater_than", "=", "215", ")", ":", "G", "=", "self", ".", "_graph", "it", "=", "G", ".", "nodes_iter", "(", ")", "node_paths", "=", "[", "]", "node_names", "=", "[", "]", "del_nodes", "=", "[", "]", "summ...
Delete big nodes with many connections from the graph.
[ "Delete", "big", "nodes", "with", "many", "connections", "from", "the", "graph", "." ]
07f71e783369e6373218b5e6ba0bf15901e9251a
https://github.com/inveniosoftware-contrib/record-recommender/blob/07f71e783369e6373218b5e6ba0bf15901e9251a/record_recommender/recommender.py#L62-L85
242,666
Arvedui/picuplib
picuplib/upload.py
punify_filename
def punify_filename(filename): """ small hackisch workaround for unicode problems with the picflash api """ path, extension = splitext(filename) return path.encode('punycode').decode('utf8') + extension
python
def punify_filename(filename): """ small hackisch workaround for unicode problems with the picflash api """ path, extension = splitext(filename) return path.encode('punycode').decode('utf8') + extension
[ "def", "punify_filename", "(", "filename", ")", ":", "path", ",", "extension", "=", "splitext", "(", "filename", ")", "return", "path", ".", "encode", "(", "'punycode'", ")", ".", "decode", "(", "'utf8'", ")", "+", "extension" ]
small hackisch workaround for unicode problems with the picflash api
[ "small", "hackisch", "workaround", "for", "unicode", "problems", "with", "the", "picflash", "api" ]
c8a5d1542dbd421e84afd5ee81fe76efec89fb95
https://github.com/Arvedui/picuplib/blob/c8a5d1542dbd421e84afd5ee81fe76efec89fb95/picuplib/upload.py#L173-L178
242,667
Arvedui/picuplib
picuplib/upload.py
upload
def upload(apikey, picture, resize=None, rotation='00', noexif=False, callback=None): """ prepares post for regular upload :param str apikey: Apikey needed for Autentication on picflash. :param str/tuple/list picture: Path to picture as str or picture data. \ If data a tuple or list ...
python
def upload(apikey, picture, resize=None, rotation='00', noexif=False, callback=None): """ prepares post for regular upload :param str apikey: Apikey needed for Autentication on picflash. :param str/tuple/list picture: Path to picture as str or picture data. \ If data a tuple or list ...
[ "def", "upload", "(", "apikey", ",", "picture", ",", "resize", "=", "None", ",", "rotation", "=", "'00'", ",", "noexif", "=", "False", ",", "callback", "=", "None", ")", ":", "if", "isinstance", "(", "picture", ",", "str", ")", ":", "with", "open", ...
prepares post for regular upload :param str apikey: Apikey needed for Autentication on picflash. :param str/tuple/list picture: Path to picture as str or picture data. \ If data a tuple or list with the file name as str \ and data as byte object in that order. :param str resize: Aresolution...
[ "prepares", "post", "for", "regular", "upload" ]
c8a5d1542dbd421e84afd5ee81fe76efec89fb95
https://github.com/Arvedui/picuplib/blob/c8a5d1542dbd421e84afd5ee81fe76efec89fb95/picuplib/upload.py#L183-L223
242,668
Arvedui/picuplib
picuplib/upload.py
remote_upload
def remote_upload(apikey, picture_url, resize=None, rotation='00', noexif=False): """ prepares post for remote upload :param str apikey: Apikey needed for Autentication on picflash. :param str picture_url: URL to picture allowd Protocols are: ftp, http, https :param str re...
python
def remote_upload(apikey, picture_url, resize=None, rotation='00', noexif=False): """ prepares post for remote upload :param str apikey: Apikey needed for Autentication on picflash. :param str picture_url: URL to picture allowd Protocols are: ftp, http, https :param str re...
[ "def", "remote_upload", "(", "apikey", ",", "picture_url", ",", "resize", "=", "None", ",", "rotation", "=", "'00'", ",", "noexif", "=", "False", ")", ":", "check_rotation", "(", "rotation", ")", "check_resize", "(", "resize", ")", "url", "=", "check_if_re...
prepares post for remote upload :param str apikey: Apikey needed for Autentication on picflash. :param str picture_url: URL to picture allowd Protocols are: ftp, http, https :param str resize: Aresolution in the folowing format: \ '80x80'(optional) :param str|degree rotation: The pictur...
[ "prepares", "post", "for", "remote", "upload" ]
c8a5d1542dbd421e84afd5ee81fe76efec89fb95
https://github.com/Arvedui/picuplib/blob/c8a5d1542dbd421e84afd5ee81fe76efec89fb95/picuplib/upload.py#L227-L252
242,669
Arvedui/picuplib
picuplib/upload.py
compose_post
def compose_post(apikey, resize, rotation, noexif): """ composes basic post requests """ check_rotation(rotation) check_resize(resize) post_data = { 'formatliste': ('', 'og'), 'userdrehung': ('', rotation), 'apikey': ('', apikey) } if resize ...
python
def compose_post(apikey, resize, rotation, noexif): """ composes basic post requests """ check_rotation(rotation) check_resize(resize) post_data = { 'formatliste': ('', 'og'), 'userdrehung': ('', rotation), 'apikey': ('', apikey) } if resize ...
[ "def", "compose_post", "(", "apikey", ",", "resize", ",", "rotation", ",", "noexif", ")", ":", "check_rotation", "(", "rotation", ")", "check_resize", "(", "resize", ")", "post_data", "=", "{", "'formatliste'", ":", "(", "''", ",", "'og'", ")", ",", "'us...
composes basic post requests
[ "composes", "basic", "post", "requests" ]
c8a5d1542dbd421e84afd5ee81fe76efec89fb95
https://github.com/Arvedui/picuplib/blob/c8a5d1542dbd421e84afd5ee81fe76efec89fb95/picuplib/upload.py#L265-L289
242,670
Arvedui/picuplib
picuplib/upload.py
do_upload
def do_upload(post_data, callback=None): """ does the actual upload also sets and generates the user agent string """ encoder = MultipartEncoder(post_data) monitor = MultipartEncoderMonitor(encoder, callback) headers = {'User-Agent': USER_AGENT, 'Content-Type': monitor.content_type} respon...
python
def do_upload(post_data, callback=None): """ does the actual upload also sets and generates the user agent string """ encoder = MultipartEncoder(post_data) monitor = MultipartEncoderMonitor(encoder, callback) headers = {'User-Agent': USER_AGENT, 'Content-Type': monitor.content_type} respon...
[ "def", "do_upload", "(", "post_data", ",", "callback", "=", "None", ")", ":", "encoder", "=", "MultipartEncoder", "(", "post_data", ")", "monitor", "=", "MultipartEncoderMonitor", "(", "encoder", ",", "callback", ")", "headers", "=", "{", "'User-Agent'", ":", ...
does the actual upload also sets and generates the user agent string
[ "does", "the", "actual", "upload", "also", "sets", "and", "generates", "the", "user", "agent", "string" ]
c8a5d1542dbd421e84afd5ee81fe76efec89fb95
https://github.com/Arvedui/picuplib/blob/c8a5d1542dbd421e84afd5ee81fe76efec89fb95/picuplib/upload.py#L292-L304
242,671
Arvedui/picuplib
picuplib/upload.py
Upload.upload
def upload(self, picture, resize=None, rotation=None, noexif=None, callback=None): """ wraps upload function :param str/tuple/list picture: Path to picture as str or picture data. \ If data a tuple or list with the file name as str \ and data as byte objec...
python
def upload(self, picture, resize=None, rotation=None, noexif=None, callback=None): """ wraps upload function :param str/tuple/list picture: Path to picture as str or picture data. \ If data a tuple or list with the file name as str \ and data as byte objec...
[ "def", "upload", "(", "self", ",", "picture", ",", "resize", "=", "None", ",", "rotation", "=", "None", ",", "noexif", "=", "None", ",", "callback", "=", "None", ")", ":", "if", "not", "resize", ":", "resize", "=", "self", ".", "_resize", "if", "no...
wraps upload function :param str/tuple/list picture: Path to picture as str or picture data. \ If data a tuple or list with the file name as str \ and data as byte object in that order. :param str resize: Aresolution in the folowing format: \ '80x80'(optional) ...
[ "wraps", "upload", "function" ]
c8a5d1542dbd421e84afd5ee81fe76efec89fb95
https://github.com/Arvedui/picuplib/blob/c8a5d1542dbd421e84afd5ee81fe76efec89fb95/picuplib/upload.py#L115-L144
242,672
Arvedui/picuplib
picuplib/upload.py
Upload.remote_upload
def remote_upload(self, picture_url, resize=None, rotation=None, noexif=None): """ wraps remote_upload funktion :param str picture_url: URL to picture allowd Protocols are: ftp,\ http, https :param str resize: Aresolution in the folowing format: \ ...
python
def remote_upload(self, picture_url, resize=None, rotation=None, noexif=None): """ wraps remote_upload funktion :param str picture_url: URL to picture allowd Protocols are: ftp,\ http, https :param str resize: Aresolution in the folowing format: \ ...
[ "def", "remote_upload", "(", "self", ",", "picture_url", ",", "resize", "=", "None", ",", "rotation", "=", "None", ",", "noexif", "=", "None", ")", ":", "if", "not", "resize", ":", "resize", "=", "self", ".", "_resize", "if", "not", "rotation", ":", ...
wraps remote_upload funktion :param str picture_url: URL to picture allowd Protocols are: ftp,\ http, https :param str resize: Aresolution in the folowing format: \ '80x80'(optional) :param str|degree rotation: The picture will be rotated by this Value. \ All...
[ "wraps", "remote_upload", "funktion" ]
c8a5d1542dbd421e84afd5ee81fe76efec89fb95
https://github.com/Arvedui/picuplib/blob/c8a5d1542dbd421e84afd5ee81fe76efec89fb95/picuplib/upload.py#L147-L170
242,673
rjw57/throw
throw/identity.py
load_identity
def load_identity(config = Config()): """Load the default identity from the configuration. If there is no default identity, a KeyError is raised. """ return Identity(name = config.get('user', 'name'), email_ = config.get('user', 'email'), **config.get_section...
python
def load_identity(config = Config()): """Load the default identity from the configuration. If there is no default identity, a KeyError is raised. """ return Identity(name = config.get('user', 'name'), email_ = config.get('user', 'email'), **config.get_section...
[ "def", "load_identity", "(", "config", "=", "Config", "(", ")", ")", ":", "return", "Identity", "(", "name", "=", "config", ".", "get", "(", "'user'", ",", "'name'", ")", ",", "email_", "=", "config", ".", "get", "(", "'user'", ",", "'email'", ")", ...
Load the default identity from the configuration. If there is no default identity, a KeyError is raised.
[ "Load", "the", "default", "identity", "from", "the", "configuration", ".", "If", "there", "is", "no", "default", "identity", "a", "KeyError", "is", "raised", "." ]
74a7116362ba5b45635ab247472b25cfbdece4ee
https://github.com/rjw57/throw/blob/74a7116362ba5b45635ab247472b25cfbdece4ee/throw/identity.py#L29-L36
242,674
rjw57/throw
throw/identity.py
Identity._smtp_server
def _smtp_server(self): """Return a smtplib SMTP object correctly initialised and connected to a SMTP server suitable for sending email on behalf of the user.""" if self._use_ssl: server = smtplib.SMTP_SSL(**self._smtp_vars) else: server = smtplib.SMTP(**self._sm...
python
def _smtp_server(self): """Return a smtplib SMTP object correctly initialised and connected to a SMTP server suitable for sending email on behalf of the user.""" if self._use_ssl: server = smtplib.SMTP_SSL(**self._smtp_vars) else: server = smtplib.SMTP(**self._sm...
[ "def", "_smtp_server", "(", "self", ")", ":", "if", "self", ".", "_use_ssl", ":", "server", "=", "smtplib", ".", "SMTP_SSL", "(", "*", "*", "self", ".", "_smtp_vars", ")", "else", ":", "server", "=", "smtplib", ".", "SMTP", "(", "*", "*", "self", "...
Return a smtplib SMTP object correctly initialised and connected to a SMTP server suitable for sending email on behalf of the user.
[ "Return", "a", "smtplib", "SMTP", "object", "correctly", "initialised", "and", "connected", "to", "a", "SMTP", "server", "suitable", "for", "sending", "email", "on", "behalf", "of", "the", "user", "." ]
74a7116362ba5b45635ab247472b25cfbdece4ee
https://github.com/rjw57/throw/blob/74a7116362ba5b45635ab247472b25cfbdece4ee/throw/identity.py#L234-L256
242,675
mgbarrero/xbob.db.atvskeystroke
xbob/db/atvskeystroke/create.py
add_clients
def add_clients(session, verbose): """Add clients to the ATVS Keystroke database.""" for ctype in ['Genuine', 'Impostor']: for cdid in userid_clients: cid = ctype + '_%d' % cdid if verbose>1: print(" Adding user '%s' of type '%s'..." % (cid, ctype)) session.add(Client(cid, ctype, cdid))
python
def add_clients(session, verbose): """Add clients to the ATVS Keystroke database.""" for ctype in ['Genuine', 'Impostor']: for cdid in userid_clients: cid = ctype + '_%d' % cdid if verbose>1: print(" Adding user '%s' of type '%s'..." % (cid, ctype)) session.add(Client(cid, ctype, cdid))
[ "def", "add_clients", "(", "session", ",", "verbose", ")", ":", "for", "ctype", "in", "[", "'Genuine'", ",", "'Impostor'", "]", ":", "for", "cdid", "in", "userid_clients", ":", "cid", "=", "ctype", "+", "'_%d'", "%", "cdid", "if", "verbose", ">", "1", ...
Add clients to the ATVS Keystroke database.
[ "Add", "clients", "to", "the", "ATVS", "Keystroke", "database", "." ]
b7358a73e21757b43334df7c89ba057b377ca704
https://github.com/mgbarrero/xbob.db.atvskeystroke/blob/b7358a73e21757b43334df7c89ba057b377ca704/xbob/db/atvskeystroke/create.py#L30-L36
242,676
mgbarrero/xbob.db.atvskeystroke
xbob/db/atvskeystroke/create.py
add_files
def add_files(session, imagedir, verbose): """Add files to the ATVS Keystroke database.""" def add_file(session, basename, userid, shotid, sessionid): """Parse a single filename and add it to the list.""" session.add(File(userid, basename, sessionid, shotid)) filenames = os.listdir(imagedir) for filen...
python
def add_files(session, imagedir, verbose): """Add files to the ATVS Keystroke database.""" def add_file(session, basename, userid, shotid, sessionid): """Parse a single filename and add it to the list.""" session.add(File(userid, basename, sessionid, shotid)) filenames = os.listdir(imagedir) for filen...
[ "def", "add_files", "(", "session", ",", "imagedir", ",", "verbose", ")", ":", "def", "add_file", "(", "session", ",", "basename", ",", "userid", ",", "shotid", ",", "sessionid", ")", ":", "\"\"\"Parse a single filename and add it to the list.\"\"\"", "session", "...
Add files to the ATVS Keystroke database.
[ "Add", "files", "to", "the", "ATVS", "Keystroke", "database", "." ]
b7358a73e21757b43334df7c89ba057b377ca704
https://github.com/mgbarrero/xbob.db.atvskeystroke/blob/b7358a73e21757b43334df7c89ba057b377ca704/xbob/db/atvskeystroke/create.py#L39-L62
242,677
mgbarrero/xbob.db.atvskeystroke
xbob/db/atvskeystroke/create.py
create
def create(args): """Creates or re-creates this database""" from bob.db.utils import session_try_nolock dbfile = args.files[0] if args.recreate: if args.verbose and os.path.exists(dbfile): print('unlinking %s...' % dbfile) if os.path.exists(dbfile): os.unlink(dbfile) if not os.path.exists(os...
python
def create(args): """Creates or re-creates this database""" from bob.db.utils import session_try_nolock dbfile = args.files[0] if args.recreate: if args.verbose and os.path.exists(dbfile): print('unlinking %s...' % dbfile) if os.path.exists(dbfile): os.unlink(dbfile) if not os.path.exists(os...
[ "def", "create", "(", "args", ")", ":", "from", "bob", ".", "db", ".", "utils", "import", "session_try_nolock", "dbfile", "=", "args", ".", "files", "[", "0", "]", "if", "args", ".", "recreate", ":", "if", "args", ".", "verbose", "and", "os", ".", ...
Creates or re-creates this database
[ "Creates", "or", "re", "-", "creates", "this", "database" ]
b7358a73e21757b43334df7c89ba057b377ca704
https://github.com/mgbarrero/xbob.db.atvskeystroke/blob/b7358a73e21757b43334df7c89ba057b377ca704/xbob/db/atvskeystroke/create.py#L122-L144
242,678
mgbarrero/xbob.db.atvskeystroke
xbob/db/atvskeystroke/create.py
add_command
def add_command(subparsers): """Add specific subcommands that the action "create" can use""" parser = subparsers.add_parser('create', help=create.__doc__) parser.add_argument('-R', '--recreate', action='store_true', help="If set, I'll first erase the current database") parser.add_argument('-v', '--verbose', a...
python
def add_command(subparsers): """Add specific subcommands that the action "create" can use""" parser = subparsers.add_parser('create', help=create.__doc__) parser.add_argument('-R', '--recreate', action='store_true', help="If set, I'll first erase the current database") parser.add_argument('-v', '--verbose', a...
[ "def", "add_command", "(", "subparsers", ")", ":", "parser", "=", "subparsers", ".", "add_parser", "(", "'create'", ",", "help", "=", "create", ".", "__doc__", ")", "parser", ".", "add_argument", "(", "'-R'", ",", "'--recreate'", ",", "action", "=", "'stor...
Add specific subcommands that the action "create" can use
[ "Add", "specific", "subcommands", "that", "the", "action", "create", "can", "use" ]
b7358a73e21757b43334df7c89ba057b377ca704
https://github.com/mgbarrero/xbob.db.atvskeystroke/blob/b7358a73e21757b43334df7c89ba057b377ca704/xbob/db/atvskeystroke/create.py#L146-L155
242,679
litters/shrew
shrew/cli.py
CLI.__parse_args
def __parse_args(self, accept_unrecognized_args=False): """ Invoke the argument parser. """ # If the user provided a description, use it. Otherwise grab the doc string. if self.description: self.argparser.description = self.description elif getattr(sys.modules['__main__'], '...
python
def __parse_args(self, accept_unrecognized_args=False): """ Invoke the argument parser. """ # If the user provided a description, use it. Otherwise grab the doc string. if self.description: self.argparser.description = self.description elif getattr(sys.modules['__main__'], '...
[ "def", "__parse_args", "(", "self", ",", "accept_unrecognized_args", "=", "False", ")", ":", "# If the user provided a description, use it. Otherwise grab the doc string.", "if", "self", ".", "description", ":", "self", ".", "argparser", ".", "description", "=", "self", ...
Invoke the argument parser.
[ "Invoke", "the", "argument", "parser", "." ]
ed4b1879321d858d6bc884d14fea7557372a4d41
https://github.com/litters/shrew/blob/ed4b1879321d858d6bc884d14fea7557372a4d41/shrew/cli.py#L245-L265
242,680
litters/shrew
shrew/cli.py
CLI.__parse_config
def __parse_config(self): """ Invoke the config file parser. """ if self.should_parse_config and (self.args.config or self.config_file): self.config = ConfigParser.SafeConfigParser() self.config.read(self.args.config or self.config_file)
python
def __parse_config(self): """ Invoke the config file parser. """ if self.should_parse_config and (self.args.config or self.config_file): self.config = ConfigParser.SafeConfigParser() self.config.read(self.args.config or self.config_file)
[ "def", "__parse_config", "(", "self", ")", ":", "if", "self", ".", "should_parse_config", "and", "(", "self", ".", "args", ".", "config", "or", "self", ".", "config_file", ")", ":", "self", ".", "config", "=", "ConfigParser", ".", "SafeConfigParser", "(", ...
Invoke the config file parser.
[ "Invoke", "the", "config", "file", "parser", "." ]
ed4b1879321d858d6bc884d14fea7557372a4d41
https://github.com/litters/shrew/blob/ed4b1879321d858d6bc884d14fea7557372a4d41/shrew/cli.py#L267-L272
242,681
litters/shrew
shrew/cli.py
CLI.__process_username_password
def __process_username_password(self): """ If indicated, process the username and password """ if self.use_username_password_store is not None: if self.args.clear_store: with load_config(sections=AUTH_SECTIONS) as config: config.remove_option(AUTH_SECTION...
python
def __process_username_password(self): """ If indicated, process the username and password """ if self.use_username_password_store is not None: if self.args.clear_store: with load_config(sections=AUTH_SECTIONS) as config: config.remove_option(AUTH_SECTION...
[ "def", "__process_username_password", "(", "self", ")", ":", "if", "self", ".", "use_username_password_store", "is", "not", "None", ":", "if", "self", ".", "args", ".", "clear_store", ":", "with", "load_config", "(", "sections", "=", "AUTH_SECTIONS", ")", "as"...
If indicated, process the username and password
[ "If", "indicated", "process", "the", "username", "and", "password" ]
ed4b1879321d858d6bc884d14fea7557372a4d41
https://github.com/litters/shrew/blob/ed4b1879321d858d6bc884d14fea7557372a4d41/shrew/cli.py#L274-L289
242,682
litters/shrew
shrew/cli.py
CLI.__finish_initializing
def __finish_initializing(self): """ Handle any initialization after arguments & config has been parsed. """ if self.args.debug or self.args.trace: # Set the console (StreamHandler) to allow debug statements. if self.args.debug: self.console.setLevel(logging.DEB...
python
def __finish_initializing(self): """ Handle any initialization after arguments & config has been parsed. """ if self.args.debug or self.args.trace: # Set the console (StreamHandler) to allow debug statements. if self.args.debug: self.console.setLevel(logging.DEB...
[ "def", "__finish_initializing", "(", "self", ")", ":", "if", "self", ".", "args", ".", "debug", "or", "self", ".", "args", ".", "trace", ":", "# Set the console (StreamHandler) to allow debug statements.", "if", "self", ".", "args", ".", "debug", ":", "self", ...
Handle any initialization after arguments & config has been parsed.
[ "Handle", "any", "initialization", "after", "arguments", "&", "config", "has", "been", "parsed", "." ]
ed4b1879321d858d6bc884d14fea7557372a4d41
https://github.com/litters/shrew/blob/ed4b1879321d858d6bc884d14fea7557372a4d41/shrew/cli.py#L291-L327
242,683
rpcope1/HackerNewsAPI-Py
HackerNewsAPI/API.py
HackerNewsAPI.get_item
def get_item(self, item_number, raw=False): """ Get a dictionary or object with info about the given item number from the Hacker News API. Item can be a poll, story, comment or possibly other entry. Will raise an requests.HTTPError if we got a non-200 response back. Will raise a ValueErr...
python
def get_item(self, item_number, raw=False): """ Get a dictionary or object with info about the given item number from the Hacker News API. Item can be a poll, story, comment or possibly other entry. Will raise an requests.HTTPError if we got a non-200 response back. Will raise a ValueErr...
[ "def", "get_item", "(", "self", ",", "item_number", ",", "raw", "=", "False", ")", ":", "if", "not", "isinstance", "(", "item_number", ",", "int", ")", ":", "item_number", "=", "int", "(", "item_number", ")", "suburl", "=", "\"v0/item/{}.json\"", ".", "f...
Get a dictionary or object with info about the given item number from the Hacker News API. Item can be a poll, story, comment or possibly other entry. Will raise an requests.HTTPError if we got a non-200 response back. Will raise a ValueError if a item_number that can not be converted to int was...
[ "Get", "a", "dictionary", "or", "object", "with", "info", "about", "the", "given", "item", "number", "from", "the", "Hacker", "News", "API", ".", "Item", "can", "be", "a", "poll", "story", "comment", "or", "possibly", "other", "entry", ".", "Will", "rais...
b231aed24ec59fc32af320bbef27d48cc4b69914
https://github.com/rpcope1/HackerNewsAPI-Py/blob/b231aed24ec59fc32af320bbef27d48cc4b69914/HackerNewsAPI/API.py#L39-L78
242,684
rpcope1/HackerNewsAPI-Py
HackerNewsAPI/API.py
HackerNewsAPI.get_user
def get_user(self, user_name, raw=False): """ Get a dictionary or object with info about the given user from the Hacker News API. Will raise an requests.HTTPError if we got a non-200 response back. Response parameters: "id' -> The user's unique username. Case-sensiti...
python
def get_user(self, user_name, raw=False): """ Get a dictionary or object with info about the given user from the Hacker News API. Will raise an requests.HTTPError if we got a non-200 response back. Response parameters: "id' -> The user's unique username. Case-sensiti...
[ "def", "get_user", "(", "self", ",", "user_name", ",", "raw", "=", "False", ")", ":", "suburl", "=", "\"v0/user/{}.json\"", ".", "format", "(", "user_name", ")", "try", ":", "user_data", "=", "self", ".", "_make_request", "(", "suburl", ")", "except", "r...
Get a dictionary or object with info about the given user from the Hacker News API. Will raise an requests.HTTPError if we got a non-200 response back. Response parameters: "id' -> The user's unique username. Case-sensitive. Required. "delay" -> Delay in minutes betw...
[ "Get", "a", "dictionary", "or", "object", "with", "info", "about", "the", "given", "user", "from", "the", "Hacker", "News", "API", ".", "Will", "raise", "an", "requests", ".", "HTTPError", "if", "we", "got", "a", "non", "-", "200", "response", "back", ...
b231aed24ec59fc32af320bbef27d48cc4b69914
https://github.com/rpcope1/HackerNewsAPI-Py/blob/b231aed24ec59fc32af320bbef27d48cc4b69914/HackerNewsAPI/API.py#L80-L106
242,685
rpcope1/HackerNewsAPI-Py
HackerNewsAPI/API.py
HackerNewsAPI.get_recent_updates
def get_recent_updates(self, raw=True): """ Get the most recent updates on Hacker News Response dictionary parameters: "items" -> A list of the most recently update items by item number. "profiles" -> A list of most recently updated user profiles by user name. ...
python
def get_recent_updates(self, raw=True): """ Get the most recent updates on Hacker News Response dictionary parameters: "items" -> A list of the most recently update items by item number. "profiles" -> A list of most recently updated user profiles by user name. ...
[ "def", "get_recent_updates", "(", "self", ",", "raw", "=", "True", ")", ":", "suburl", "=", "\"v0/updates.json\"", "try", ":", "updates_data", "=", "self", ".", "_make_request", "(", "suburl", ")", "except", "requests", ".", "HTTPError", "as", "e", ":", "h...
Get the most recent updates on Hacker News Response dictionary parameters: "items" -> A list of the most recently update items by item number. "profiles" -> A list of most recently updated user profiles by user name. :param raw: (optional): If true, return the raw dictio...
[ "Get", "the", "most", "recent", "updates", "on", "Hacker", "News" ]
b231aed24ec59fc32af320bbef27d48cc4b69914
https://github.com/rpcope1/HackerNewsAPI-Py/blob/b231aed24ec59fc32af320bbef27d48cc4b69914/HackerNewsAPI/API.py#L135-L153
242,686
mattupstate/cubric
cubric/providers/amazon.py
create_server
def create_server(): """Creates an EC2 Server""" try: import boto except ImportError: sys.exit("boto library required for creating servers with Amazon.") print(green("Creating EC2 server")) conn = boto.connect_ec2( get_or_prompt('ec2_key', 'API Key'), get_or_prompt...
python
def create_server(): """Creates an EC2 Server""" try: import boto except ImportError: sys.exit("boto library required for creating servers with Amazon.") print(green("Creating EC2 server")) conn = boto.connect_ec2( get_or_prompt('ec2_key', 'API Key'), get_or_prompt...
[ "def", "create_server", "(", ")", ":", "try", ":", "import", "boto", "except", "ImportError", ":", "sys", ".", "exit", "(", "\"boto library required for creating servers with Amazon.\"", ")", "print", "(", "green", "(", "\"Creating EC2 server\"", ")", ")", "conn", ...
Creates an EC2 Server
[ "Creates", "an", "EC2", "Server" ]
a648ce00e4467cd14d71e754240ef6c1f87a34b5
https://github.com/mattupstate/cubric/blob/a648ce00e4467cd14d71e754240ef6c1f87a34b5/cubric/providers/amazon.py#L11-L55
242,687
jcalogovic/lightning
stormstats/downloader.py
return_time_elements
def return_time_elements(time_stamp): """Returns formatted strings of time stamps for HTML requests. :parameters time_range: pandas.tslib.Timestamp """ yyyy = str(time_stamp.year) mm = "%02d" % (time_stamp.month,) dd = "%02d" % (time_stamp.day,) hr = "%02d" % (time_stamp.hour,) mins = "...
python
def return_time_elements(time_stamp): """Returns formatted strings of time stamps for HTML requests. :parameters time_range: pandas.tslib.Timestamp """ yyyy = str(time_stamp.year) mm = "%02d" % (time_stamp.month,) dd = "%02d" % (time_stamp.day,) hr = "%02d" % (time_stamp.hour,) mins = "...
[ "def", "return_time_elements", "(", "time_stamp", ")", ":", "yyyy", "=", "str", "(", "time_stamp", ".", "year", ")", "mm", "=", "\"%02d\"", "%", "(", "time_stamp", ".", "month", ",", ")", "dd", "=", "\"%02d\"", "%", "(", "time_stamp", ".", "day", ",", ...
Returns formatted strings of time stamps for HTML requests. :parameters time_range: pandas.tslib.Timestamp
[ "Returns", "formatted", "strings", "of", "time", "stamps", "for", "HTML", "requests", "." ]
f9e52731c9dd40cb302295ec36a444e0377d0570
https://github.com/jcalogovic/lightning/blob/f9e52731c9dd40cb302295ec36a444e0377d0570/stormstats/downloader.py#L10-L20
242,688
samfcmc/fenixedu-python-sdk
fenixedu/configuration.py
FenixEduConfiguration.fromConfigFile
def fromConfigFile(filename = DEFAULT_CONFIG_FILE): """ Read settings from configuration file""" parser = SafeConfigParser() section = 'fenixedu' parser.read(filename) client_id = parser.get(section, 'client_id') redirect_uri = parser.get(section, 'redirect_uri') client_secret = parser.get(...
python
def fromConfigFile(filename = DEFAULT_CONFIG_FILE): """ Read settings from configuration file""" parser = SafeConfigParser() section = 'fenixedu' parser.read(filename) client_id = parser.get(section, 'client_id') redirect_uri = parser.get(section, 'redirect_uri') client_secret = parser.get(...
[ "def", "fromConfigFile", "(", "filename", "=", "DEFAULT_CONFIG_FILE", ")", ":", "parser", "=", "SafeConfigParser", "(", ")", "section", "=", "'fenixedu'", "parser", ".", "read", "(", "filename", ")", "client_id", "=", "parser", ".", "get", "(", "section", ",...
Read settings from configuration file
[ "Read", "settings", "from", "configuration", "file" ]
b9a1366853b2e7a6e208c46c3b99a589062677a9
https://github.com/samfcmc/fenixedu-python-sdk/blob/b9a1366853b2e7a6e208c46c3b99a589062677a9/fenixedu/configuration.py#L17-L36
242,689
mayfield/shellish
shellish/session.py
Session.map_subcommands
def map_subcommands(self, func): """ Run `func` against all the subcommands attached to our root command. """ def crawl(cmd): for sc in cmd.subcommands.values(): yield from crawl(sc) yield cmd return map(func, crawl(self.root_command))
python
def map_subcommands(self, func): """ Run `func` against all the subcommands attached to our root command. """ def crawl(cmd): for sc in cmd.subcommands.values(): yield from crawl(sc) yield cmd return map(func, crawl(self.root_command))
[ "def", "map_subcommands", "(", "self", ",", "func", ")", ":", "def", "crawl", "(", "cmd", ")", ":", "for", "sc", "in", "cmd", ".", "subcommands", ".", "values", "(", ")", ":", "yield", "from", "crawl", "(", "sc", ")", "yield", "cmd", "return", "map...
Run `func` against all the subcommands attached to our root command.
[ "Run", "func", "against", "all", "the", "subcommands", "attached", "to", "our", "root", "command", "." ]
df0f0e4612d138c34d8cb99b66ab5b8e47f1414a
https://github.com/mayfield/shellish/blob/df0f0e4612d138c34d8cb99b66ab5b8e47f1414a/shellish/session.py#L89-L97
242,690
mayfield/shellish
shellish/session.py
Session.handle_command_error
def handle_command_error(self, command, args, exc): """ Depending on how the session is configured this will print information about an unhandled command exception or possibly jump to some other behavior like a debugger. """ verbosity = self.command_error_verbosity if verbosity =...
python
def handle_command_error(self, command, args, exc): """ Depending on how the session is configured this will print information about an unhandled command exception or possibly jump to some other behavior like a debugger. """ verbosity = self.command_error_verbosity if verbosity =...
[ "def", "handle_command_error", "(", "self", ",", "command", ",", "args", ",", "exc", ")", ":", "verbosity", "=", "self", ".", "command_error_verbosity", "if", "verbosity", "==", "'traceback'", ":", "self", ".", "pretty_print_exc", "(", "command", ",", "exc", ...
Depending on how the session is configured this will print information about an unhandled command exception or possibly jump to some other behavior like a debugger.
[ "Depending", "on", "how", "the", "session", "is", "configured", "this", "will", "print", "information", "about", "an", "unhandled", "command", "exception", "or", "possibly", "jump", "to", "some", "other", "behavior", "like", "a", "debugger", "." ]
df0f0e4612d138c34d8cb99b66ab5b8e47f1414a
https://github.com/mayfield/shellish/blob/df0f0e4612d138c34d8cb99b66ab5b8e47f1414a/shellish/session.py#L134-L149
242,691
mayfield/shellish
shellish/session.py
Session.complete_wrap
def complete_wrap(self, func, *args, **kwargs): """ Readline eats exceptions raised by completer functions. """ # Workaround readline's one-time-read of terminal width. termcols = shutil.get_terminal_size()[0] readline.parse_and_bind('set completion-display-width %d' % termcols) ...
python
def complete_wrap(self, func, *args, **kwargs): """ Readline eats exceptions raised by completer functions. """ # Workaround readline's one-time-read of terminal width. termcols = shutil.get_terminal_size()[0] readline.parse_and_bind('set completion-display-width %d' % termcols) ...
[ "def", "complete_wrap", "(", "self", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Workaround readline's one-time-read of terminal width.", "termcols", "=", "shutil", ".", "get_terminal_size", "(", ")", "[", "0", "]", "readline", ".", "p...
Readline eats exceptions raised by completer functions.
[ "Readline", "eats", "exceptions", "raised", "by", "completer", "functions", "." ]
df0f0e4612d138c34d8cb99b66ab5b8e47f1414a
https://github.com/mayfield/shellish/blob/df0f0e4612d138c34d8cb99b66ab5b8e47f1414a/shellish/session.py#L206-L215
242,692
mayfield/shellish
shellish/session.py
Session.setup_readline
def setup_readline(self): """ Configure our tab completion settings for a context and then restore them to previous settings on exit. """ readline.parse_and_bind('tab: complete') completer_save = readline.get_completer() delims_save = readline.get_completer_delims() delim...
python
def setup_readline(self): """ Configure our tab completion settings for a context and then restore them to previous settings on exit. """ readline.parse_and_bind('tab: complete') completer_save = readline.get_completer() delims_save = readline.get_completer_delims() delim...
[ "def", "setup_readline", "(", "self", ")", ":", "readline", ".", "parse_and_bind", "(", "'tab: complete'", ")", "completer_save", "=", "readline", ".", "get_completer", "(", ")", "delims_save", "=", "readline", ".", "get_completer_delims", "(", ")", "delims", "=...
Configure our tab completion settings for a context and then restore them to previous settings on exit.
[ "Configure", "our", "tab", "completion", "settings", "for", "a", "context", "and", "then", "restore", "them", "to", "previous", "settings", "on", "exit", "." ]
df0f0e4612d138c34d8cb99b66ab5b8e47f1414a
https://github.com/mayfield/shellish/blob/df0f0e4612d138c34d8cb99b66ab5b8e47f1414a/shellish/session.py#L222-L239
242,693
mayfield/shellish
shellish/session.py
Session.run_loop
def run_loop(self): """ Main entry point for running in interactive mode. """ self.root_command.prog = '' history_file = self.load_history() rendering.vtmlprint(self.intro) try: self.loop() finally: readline.write_history_file(history_file)
python
def run_loop(self): """ Main entry point for running in interactive mode. """ self.root_command.prog = '' history_file = self.load_history() rendering.vtmlprint(self.intro) try: self.loop() finally: readline.write_history_file(history_file)
[ "def", "run_loop", "(", "self", ")", ":", "self", ".", "root_command", ".", "prog", "=", "''", "history_file", "=", "self", ".", "load_history", "(", ")", "rendering", ".", "vtmlprint", "(", "self", ".", "intro", ")", "try", ":", "self", ".", "loop", ...
Main entry point for running in interactive mode.
[ "Main", "entry", "point", "for", "running", "in", "interactive", "mode", "." ]
df0f0e4612d138c34d8cb99b66ab5b8e47f1414a
https://github.com/mayfield/shellish/blob/df0f0e4612d138c34d8cb99b66ab5b8e47f1414a/shellish/session.py#L241-L249
242,694
mayfield/shellish
shellish/session.py
Session.loop
def loop(self): """ Inner loop for interactive mode. Do not call directly. """ while True: with self.setup_readline(): try: line = input(self.prompt) except EOFError: _vprinterr('^D') break ...
python
def loop(self): """ Inner loop for interactive mode. Do not call directly. """ while True: with self.setup_readline(): try: line = input(self.prompt) except EOFError: _vprinterr('^D') break ...
[ "def", "loop", "(", "self", ")", ":", "while", "True", ":", "with", "self", ".", "setup_readline", "(", ")", ":", "try", ":", "line", "=", "input", "(", "self", ".", "prompt", ")", "except", "EOFError", ":", "_vprinterr", "(", "'^D'", ")", "break", ...
Inner loop for interactive mode. Do not call directly.
[ "Inner", "loop", "for", "interactive", "mode", ".", "Do", "not", "call", "directly", "." ]
df0f0e4612d138c34d8cb99b66ab5b8e47f1414a
https://github.com/mayfield/shellish/blob/df0f0e4612d138c34d8cb99b66ab5b8e47f1414a/shellish/session.py#L251-L275
242,695
langloisjp/tstore
tstore/pgtablestorage.py
sqldelete
def sqldelete(table, where): """Generates SQL delete from ... where ... >>> sqldelete('t', {'id': 5}) ('delete from t where id=%s', [5]) """ validate_name(table) (whereclause, wherevalues) = sqlwhere(where) sql = "delete from {}".format(table) if whereclause: sql += " where " + ...
python
def sqldelete(table, where): """Generates SQL delete from ... where ... >>> sqldelete('t', {'id': 5}) ('delete from t where id=%s', [5]) """ validate_name(table) (whereclause, wherevalues) = sqlwhere(where) sql = "delete from {}".format(table) if whereclause: sql += " where " + ...
[ "def", "sqldelete", "(", "table", ",", "where", ")", ":", "validate_name", "(", "table", ")", "(", "whereclause", ",", "wherevalues", ")", "=", "sqlwhere", "(", "where", ")", "sql", "=", "\"delete from {}\"", ".", "format", "(", "table", ")", "if", "wher...
Generates SQL delete from ... where ... >>> sqldelete('t', {'id': 5}) ('delete from t where id=%s', [5])
[ "Generates", "SQL", "delete", "from", "...", "where", "..." ]
b438f8aaf09117bf6f922ba06ae5cf46b7b97a57
https://github.com/langloisjp/tstore/blob/b438f8aaf09117bf6f922ba06ae5cf46b7b97a57/tstore/pgtablestorage.py#L398-L409
242,696
langloisjp/tstore
tstore/pgtablestorage.py
DB.select
def select(self, table, fields=['*'], where=None, orderby=None, limit=None, offset=None): """ Query and return list of records. >>> import getpass >>> s = DB(dbname='test', user=getpass.getuser(), host='localhost', ... password='') >>> s.execute('drop tabl...
python
def select(self, table, fields=['*'], where=None, orderby=None, limit=None, offset=None): """ Query and return list of records. >>> import getpass >>> s = DB(dbname='test', user=getpass.getuser(), host='localhost', ... password='') >>> s.execute('drop tabl...
[ "def", "select", "(", "self", ",", "table", ",", "fields", "=", "[", "'*'", "]", ",", "where", "=", "None", ",", "orderby", "=", "None", ",", "limit", "=", "None", ",", "offset", "=", "None", ")", ":", "(", "sql", ",", "values", ")", "=", "sqls...
Query and return list of records. >>> import getpass >>> s = DB(dbname='test', user=getpass.getuser(), host='localhost', ... password='') >>> s.execute('drop table if exists t2') >>> s.execute('create table t2 (id int, name text)') >>> s.insert('t2', {'id': 1, 'name': 'T...
[ "Query", "and", "return", "list", "of", "records", "." ]
b438f8aaf09117bf6f922ba06ae5cf46b7b97a57
https://github.com/langloisjp/tstore/blob/b438f8aaf09117bf6f922ba06ae5cf46b7b97a57/tstore/pgtablestorage.py#L98-L118
242,697
langloisjp/tstore
tstore/pgtablestorage.py
DB.insert
def insert(self, table, row): """ Add new row. Row must be a dict or implement the mapping interface. >>> import getpass >>> s = DB(dbname='test', user=getpass.getuser(), host='localhost', ... password='') >>> s.execute('drop table if exists t2') >>> s.execute('c...
python
def insert(self, table, row): """ Add new row. Row must be a dict or implement the mapping interface. >>> import getpass >>> s = DB(dbname='test', user=getpass.getuser(), host='localhost', ... password='') >>> s.execute('drop table if exists t2') >>> s.execute('c...
[ "def", "insert", "(", "self", ",", "table", ",", "row", ")", ":", "(", "sql", ",", "values", ")", "=", "sqlinsert", "(", "table", ",", "row", ")", "self", ".", "execute", "(", "sql", ",", "values", ")" ]
Add new row. Row must be a dict or implement the mapping interface. >>> import getpass >>> s = DB(dbname='test', user=getpass.getuser(), host='localhost', ... password='') >>> s.execute('drop table if exists t2') >>> s.execute('create table t2 (id int, name text)') >>> s...
[ "Add", "new", "row", ".", "Row", "must", "be", "a", "dict", "or", "implement", "the", "mapping", "interface", "." ]
b438f8aaf09117bf6f922ba06ae5cf46b7b97a57
https://github.com/langloisjp/tstore/blob/b438f8aaf09117bf6f922ba06ae5cf46b7b97a57/tstore/pgtablestorage.py#L120-L138
242,698
mgaitan/one
one.py
one
def one(iterable, cmp=None): """ Return the object in the given iterable that evaluates to True. If the given iterable has more than one object that evaluates to True, or if there is no object that fulfills such condition, return False. If a callable ``cmp`` is given, it's used to evaluate each el...
python
def one(iterable, cmp=None): """ Return the object in the given iterable that evaluates to True. If the given iterable has more than one object that evaluates to True, or if there is no object that fulfills such condition, return False. If a callable ``cmp`` is given, it's used to evaluate each el...
[ "def", "one", "(", "iterable", ",", "cmp", "=", "None", ")", ":", "the_one", "=", "False", "for", "i", "in", "iterable", ":", "if", "cmp", "(", "i", ")", "if", "cmp", "else", "i", ":", "if", "the_one", ":", "return", "False", "the_one", "=", "i",...
Return the object in the given iterable that evaluates to True. If the given iterable has more than one object that evaluates to True, or if there is no object that fulfills such condition, return False. If a callable ``cmp`` is given, it's used to evaluate each element. >>> one((True, False, Fa...
[ "Return", "the", "object", "in", "the", "given", "iterable", "that", "evaluates", "to", "True", "." ]
c6639cd7f31c0541df5f8512561a2bb0feea194c
https://github.com/mgaitan/one/blob/c6639cd7f31c0541df5f8512561a2bb0feea194c/one.py#L4-L35
242,699
DasIch/argvard
argvard/__init__.py
ExecutableBase.register_command
def register_command(self, name, command): """ Registers the `command` with the given `name`. If the `name` has already been used to register a command a :exc:`RuntimeError` will be raised. """ if name in self.commands: raise RuntimeError('%s is already defin...
python
def register_command(self, name, command): """ Registers the `command` with the given `name`. If the `name` has already been used to register a command a :exc:`RuntimeError` will be raised. """ if name in self.commands: raise RuntimeError('%s is already defin...
[ "def", "register_command", "(", "self", ",", "name", ",", "command", ")", ":", "if", "name", "in", "self", ".", "commands", ":", "raise", "RuntimeError", "(", "'%s is already defined'", "%", "name", ")", "self", ".", "commands", "[", "name", "]", "=", "c...
Registers the `command` with the given `name`. If the `name` has already been used to register a command a :exc:`RuntimeError` will be raised.
[ "Registers", "the", "command", "with", "the", "given", "name", "." ]
2603e323a995e0915ce41fcf49e2a82519556195
https://github.com/DasIch/argvard/blob/2603e323a995e0915ce41fcf49e2a82519556195/argvard/__init__.py#L108-L117