repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
wohlgejm/accountable
accountable/cli.py
components
def components(accountable, project_key): """ Returns a list of all a project's components. """ components = accountable.project_components(project_key) headers = sorted(['id', 'name', 'self']) rows = [[v for k, v in sorted(component.items()) if k in headers] for component in compone...
python
def components(accountable, project_key): """ Returns a list of all a project's components. """ components = accountable.project_components(project_key) headers = sorted(['id', 'name', 'self']) rows = [[v for k, v in sorted(component.items()) if k in headers] for component in compone...
[ "def", "components", "(", "accountable", ",", "project_key", ")", ":", "components", "=", "accountable", ".", "project_components", "(", "project_key", ")", "headers", "=", "sorted", "(", "[", "'id'", ",", "'name'", ",", "'self'", "]", ")", "rows", "=", "[...
Returns a list of all a project's components.
[ "Returns", "a", "list", "of", "all", "a", "project", "s", "components", "." ]
train
https://github.com/wohlgejm/accountable/blob/20586365ccd319061e5548ce14fb0b8f449580fa/accountable/cli.py#L106-L115
wohlgejm/accountable
accountable/cli.py
createmeta
def createmeta(accountable, project_key, issue_type=None): """ Create new issue. """ metadata = accountable.create_meta(project_key, issue_type) headers = [ 'project_key', 'issuetype_name', 'field_key', 'field_name', 'required' ] rows = [headers] for project in metadata: ...
python
def createmeta(accountable, project_key, issue_type=None): """ Create new issue. """ metadata = accountable.create_meta(project_key, issue_type) headers = [ 'project_key', 'issuetype_name', 'field_key', 'field_name', 'required' ] rows = [headers] for project in metadata: ...
[ "def", "createmeta", "(", "accountable", ",", "project_key", ",", "issue_type", "=", "None", ")", ":", "metadata", "=", "accountable", ".", "create_meta", "(", "project_key", ",", "issue_type", ")", "headers", "=", "[", "'project_key'", ",", "'issuetype_name'", ...
Create new issue.
[ "Create", "new", "issue", "." ]
train
https://github.com/wohlgejm/accountable/blob/20586365ccd319061e5548ce14fb0b8f449580fa/accountable/cli.py#L131-L151
wohlgejm/accountable
accountable/cli.py
createissue
def createissue(accountable, options): """ Create new issue. """ issue = accountable.issue_create(options) headers = sorted(['id', 'key', 'self']) rows = [headers, [itemgetter(header)(issue) for header in headers]] print_table(SingleTable(rows))
python
def createissue(accountable, options): """ Create new issue. """ issue = accountable.issue_create(options) headers = sorted(['id', 'key', 'self']) rows = [headers, [itemgetter(header)(issue) for header in headers]] print_table(SingleTable(rows))
[ "def", "createissue", "(", "accountable", ",", "options", ")", ":", "issue", "=", "accountable", ".", "issue_create", "(", "options", ")", "headers", "=", "sorted", "(", "[", "'id'", ",", "'key'", ",", "'self'", "]", ")", "rows", "=", "[", "headers", "...
Create new issue.
[ "Create", "new", "issue", "." ]
train
https://github.com/wohlgejm/accountable/blob/20586365ccd319061e5548ce14fb0b8f449580fa/accountable/cli.py#L156-L163
wohlgejm/accountable
accountable/cli.py
checkoutbranch
def checkoutbranch(accountable, options): """ Create a new issue and checkout a branch named after it. """ issue = accountable.checkout_branch(options) headers = sorted(['id', 'key', 'self']) rows = [headers, [itemgetter(header)(issue) for header in headers]] print_table(SingleTable(rows))
python
def checkoutbranch(accountable, options): """ Create a new issue and checkout a branch named after it. """ issue = accountable.checkout_branch(options) headers = sorted(['id', 'key', 'self']) rows = [headers, [itemgetter(header)(issue) for header in headers]] print_table(SingleTable(rows))
[ "def", "checkoutbranch", "(", "accountable", ",", "options", ")", ":", "issue", "=", "accountable", ".", "checkout_branch", "(", "options", ")", "headers", "=", "sorted", "(", "[", "'id'", ",", "'key'", ",", "'self'", "]", ")", "rows", "=", "[", "headers...
Create a new issue and checkout a branch named after it.
[ "Create", "a", "new", "issue", "and", "checkout", "a", "branch", "named", "after", "it", "." ]
train
https://github.com/wohlgejm/accountable/blob/20586365ccd319061e5548ce14fb0b8f449580fa/accountable/cli.py#L168-L175
wohlgejm/accountable
accountable/cli.py
checkout
def checkout(accountable, issue_key): """ Checkout a new branch or checkout to a branch for a given issue. """ issue = accountable.checkout(issue_key) headers = issue.keys() rows = [headers, [v for k, v in issue.items()]] print_table(SingleTable(rows))
python
def checkout(accountable, issue_key): """ Checkout a new branch or checkout to a branch for a given issue. """ issue = accountable.checkout(issue_key) headers = issue.keys() rows = [headers, [v for k, v in issue.items()]] print_table(SingleTable(rows))
[ "def", "checkout", "(", "accountable", ",", "issue_key", ")", ":", "issue", "=", "accountable", ".", "checkout", "(", "issue_key", ")", "headers", "=", "issue", ".", "keys", "(", ")", "rows", "=", "[", "headers", ",", "[", "v", "for", "k", ",", "v", ...
Checkout a new branch or checkout to a branch for a given issue.
[ "Checkout", "a", "new", "branch", "or", "checkout", "to", "a", "branch", "for", "a", "given", "issue", "." ]
train
https://github.com/wohlgejm/accountable/blob/20586365ccd319061e5548ce14fb0b8f449580fa/accountable/cli.py#L181-L188
wohlgejm/accountable
accountable/cli.py
issue
def issue(ctx, accountable, issue_key): """ List metadata for a given issue key. """ accountable.issue_key = issue_key if not ctx.invoked_subcommand: issue = accountable.issue_meta() headers = issue.keys() rows = [headers, [v for k, v in issue.items()]] print_table(Si...
python
def issue(ctx, accountable, issue_key): """ List metadata for a given issue key. """ accountable.issue_key = issue_key if not ctx.invoked_subcommand: issue = accountable.issue_meta() headers = issue.keys() rows = [headers, [v for k, v in issue.items()]] print_table(Si...
[ "def", "issue", "(", "ctx", ",", "accountable", ",", "issue_key", ")", ":", "accountable", ".", "issue_key", "=", "issue_key", "if", "not", "ctx", ".", "invoked_subcommand", ":", "issue", "=", "accountable", ".", "issue_meta", "(", ")", "headers", "=", "is...
List metadata for a given issue key.
[ "List", "metadata", "for", "a", "given", "issue", "key", "." ]
train
https://github.com/wohlgejm/accountable/blob/20586365ccd319061e5548ce14fb0b8f449580fa/accountable/cli.py#L195-L204
wohlgejm/accountable
accountable/cli.py
update
def update(accountable, options): """ Update an existing issue. """ issue = accountable.issue_update(options) headers = issue.keys() rows = [headers, [v for k, v in issue.items()]] print_table(SingleTable(rows))
python
def update(accountable, options): """ Update an existing issue. """ issue = accountable.issue_update(options) headers = issue.keys() rows = [headers, [v for k, v in issue.items()]] print_table(SingleTable(rows))
[ "def", "update", "(", "accountable", ",", "options", ")", ":", "issue", "=", "accountable", ".", "issue_update", "(", "options", ")", "headers", "=", "issue", ".", "keys", "(", ")", "rows", "=", "[", "headers", ",", "[", "v", "for", "k", ",", "v", ...
Update an existing issue.
[ "Update", "an", "existing", "issue", "." ]
train
https://github.com/wohlgejm/accountable/blob/20586365ccd319061e5548ce14fb0b8f449580fa/accountable/cli.py#L209-L216
wohlgejm/accountable
accountable/cli.py
comments
def comments(accountable): """ Lists all comments for a given issue key. """ comments = accountable.issue_comments() headers = sorted(['author_name', 'body', 'updated']) if comments: rows = [[v for k, v in sorted(c.items()) if k in headers] for c in comments] row...
python
def comments(accountable): """ Lists all comments for a given issue key. """ comments = accountable.issue_comments() headers = sorted(['author_name', 'body', 'updated']) if comments: rows = [[v for k, v in sorted(c.items()) if k in headers] for c in comments] row...
[ "def", "comments", "(", "accountable", ")", ":", "comments", "=", "accountable", ".", "issue_comments", "(", ")", "headers", "=", "sorted", "(", "[", "'author_name'", ",", "'body'", ",", "'updated'", "]", ")", "if", "comments", ":", "rows", "=", "[", "["...
Lists all comments for a given issue key.
[ "Lists", "all", "comments", "for", "a", "given", "issue", "key", "." ]
train
https://github.com/wohlgejm/accountable/blob/20586365ccd319061e5548ce14fb0b8f449580fa/accountable/cli.py#L221-L236
wohlgejm/accountable
accountable/cli.py
addcomment
def addcomment(accountable, body): """ Add a comment to the given issue key. Accepts a body argument to be used as the comment's body. """ r = accountable.issue_add_comment(body) headers = sorted(['author_name', 'body', 'updated']) rows = [[v for k, v in sorted(r.items()) if k in headers]] ...
python
def addcomment(accountable, body): """ Add a comment to the given issue key. Accepts a body argument to be used as the comment's body. """ r = accountable.issue_add_comment(body) headers = sorted(['author_name', 'body', 'updated']) rows = [[v for k, v in sorted(r.items()) if k in headers]] ...
[ "def", "addcomment", "(", "accountable", ",", "body", ")", ":", "r", "=", "accountable", ".", "issue_add_comment", "(", "body", ")", "headers", "=", "sorted", "(", "[", "'author_name'", ",", "'body'", ",", "'updated'", "]", ")", "rows", "=", "[", "[", ...
Add a comment to the given issue key. Accepts a body argument to be used as the comment's body.
[ "Add", "a", "comment", "to", "the", "given", "issue", "key", ".", "Accepts", "a", "body", "argument", "to", "be", "used", "as", "the", "comment", "s", "body", "." ]
train
https://github.com/wohlgejm/accountable/blob/20586365ccd319061e5548ce14fb0b8f449580fa/accountable/cli.py#L242-L252
wohlgejm/accountable
accountable/cli.py
worklog
def worklog(accountable): """ List all worklogs for a given issue key. """ worklog = accountable.issue_worklog() headers = ['author_name', 'comment', 'time_spent'] if worklog: rows = [[v for k, v in sorted(w.items()) if k in headers] for w in worklog] rows.insert(...
python
def worklog(accountable): """ List all worklogs for a given issue key. """ worklog = accountable.issue_worklog() headers = ['author_name', 'comment', 'time_spent'] if worklog: rows = [[v for k, v in sorted(w.items()) if k in headers] for w in worklog] rows.insert(...
[ "def", "worklog", "(", "accountable", ")", ":", "worklog", "=", "accountable", ".", "issue_worklog", "(", ")", "headers", "=", "[", "'author_name'", ",", "'comment'", ",", "'time_spent'", "]", "if", "worklog", ":", "rows", "=", "[", "[", "v", "for", "k",...
List all worklogs for a given issue key.
[ "List", "all", "worklogs", "for", "a", "given", "issue", "key", "." ]
train
https://github.com/wohlgejm/accountable/blob/20586365ccd319061e5548ce14fb0b8f449580fa/accountable/cli.py#L257-L272
wohlgejm/accountable
accountable/cli.py
transitions
def transitions(accountable): """ List all possible transitions for a given issue. """ transitions = accountable.issue_transitions().get('transitions') headers = ['id', 'name'] if transitions: rows = [[v for k, v in sorted(t.items()) if k in headers] for t in transitions]...
python
def transitions(accountable): """ List all possible transitions for a given issue. """ transitions = accountable.issue_transitions().get('transitions') headers = ['id', 'name'] if transitions: rows = [[v for k, v in sorted(t.items()) if k in headers] for t in transitions]...
[ "def", "transitions", "(", "accountable", ")", ":", "transitions", "=", "accountable", ".", "issue_transitions", "(", ")", ".", "get", "(", "'transitions'", ")", "headers", "=", "[", "'id'", ",", "'name'", "]", "if", "transitions", ":", "rows", "=", "[", ...
List all possible transitions for a given issue.
[ "List", "all", "possible", "transitions", "for", "a", "given", "issue", "." ]
train
https://github.com/wohlgejm/accountable/blob/20586365ccd319061e5548ce14fb0b8f449580fa/accountable/cli.py#L277-L292
wohlgejm/accountable
accountable/cli.py
dotransition
def dotransition(accountable, transition_id): """ Transition the given issue to the provided ID. The API does not return a JSON response for this call. """ t = accountable.issue_do_transition(transition_id) if t.status_code == 204: click.secho( 'Successfully transitioned {}'....
python
def dotransition(accountable, transition_id): """ Transition the given issue to the provided ID. The API does not return a JSON response for this call. """ t = accountable.issue_do_transition(transition_id) if t.status_code == 204: click.secho( 'Successfully transitioned {}'....
[ "def", "dotransition", "(", "accountable", ",", "transition_id", ")", ":", "t", "=", "accountable", ".", "issue_do_transition", "(", "transition_id", ")", "if", "t", ".", "status_code", "==", "204", ":", "click", ".", "secho", "(", "'Successfully transitioned {}...
Transition the given issue to the provided ID. The API does not return a JSON response for this call.
[ "Transition", "the", "given", "issue", "to", "the", "provided", "ID", ".", "The", "API", "does", "not", "return", "a", "JSON", "response", "for", "this", "call", "." ]
train
https://github.com/wohlgejm/accountable/blob/20586365ccd319061e5548ce14fb0b8f449580fa/accountable/cli.py#L298-L308
wohlgejm/accountable
accountable/cli.py
users
def users(accountable, query): """ Executes a user search for the given query. """ users = accountable.users(query) headers = ['display_name', 'key'] if users: rows = [[v for k, v in sorted(u.items()) if k in headers] for u in users] rows.insert(0, headers) ...
python
def users(accountable, query): """ Executes a user search for the given query. """ users = accountable.users(query) headers = ['display_name', 'key'] if users: rows = [[v for k, v in sorted(u.items()) if k in headers] for u in users] rows.insert(0, headers) ...
[ "def", "users", "(", "accountable", ",", "query", ")", ":", "users", "=", "accountable", ".", "users", "(", "query", ")", "headers", "=", "[", "'display_name'", ",", "'key'", "]", "if", "users", ":", "rows", "=", "[", "[", "v", "for", "k", ",", "v"...
Executes a user search for the given query.
[ "Executes", "a", "user", "search", "for", "the", "given", "query", "." ]
train
https://github.com/wohlgejm/accountable/blob/20586365ccd319061e5548ce14fb0b8f449580fa/accountable/cli.py#L314-L328
abalkin/tz
tz/system_tzdata.py
guess_saves
def guess_saves(zone, data): """Return types with guessed DST saves""" saves = {} details = {} for (time0, type0), (time1, type1) in pairs(data.times): is_dst0 = bool(data.types[type0][1]) is_dst1 = bool(data.types[type1][1]) if (is_dst0, is_dst1) == (False, True): sh...
python
def guess_saves(zone, data): """Return types with guessed DST saves""" saves = {} details = {} for (time0, type0), (time1, type1) in pairs(data.times): is_dst0 = bool(data.types[type0][1]) is_dst1 = bool(data.types[type1][1]) if (is_dst0, is_dst1) == (False, True): sh...
[ "def", "guess_saves", "(", "zone", ",", "data", ")", ":", "saves", "=", "{", "}", "details", "=", "{", "}", "for", "(", "time0", ",", "type0", ")", ",", "(", "time1", ",", "type1", ")", "in", "pairs", "(", "data", ".", "times", ")", ":", "is_ds...
Return types with guessed DST saves
[ "Return", "types", "with", "guessed", "DST", "saves" ]
train
https://github.com/abalkin/tz/blob/f25fca6afbf1abd46fd7aeb978282823c7dab5ab/tz/system_tzdata.py#L69-L105
jtpaasch/simplygithub
simplygithub/files.py
prepare
def prepare(data): """Restructure/prepare data about a blob for output.""" result = {} result["mode"] = data.get("mode") result["path"] = data.get("path") result["type"] = data.get("type") result["sha"] = data.get("sha") return result
python
def prepare(data): """Restructure/prepare data about a blob for output.""" result = {} result["mode"] = data.get("mode") result["path"] = data.get("path") result["type"] = data.get("type") result["sha"] = data.get("sha") return result
[ "def", "prepare", "(", "data", ")", ":", "result", "=", "{", "}", "result", "[", "\"mode\"", "]", "=", "data", ".", "get", "(", "\"mode\"", ")", "result", "[", "\"path\"", "]", "=", "data", ".", "get", "(", "\"path\"", ")", "result", "[", "\"type\"...
Restructure/prepare data about a blob for output.
[ "Restructure", "/", "prepare", "data", "about", "a", "blob", "for", "output", "." ]
train
https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/files.py#L9-L16
jtpaasch/simplygithub
simplygithub/files.py
get_commit_tree
def get_commit_tree(profile, sha): """Get the SHA of a commit's tree. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. sha ...
python
def get_commit_tree(profile, sha): """Get the SHA of a commit's tree. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. sha ...
[ "def", "get_commit_tree", "(", "profile", ",", "sha", ")", ":", "data", "=", "commits", ".", "get_commit", "(", "profile", ",", "sha", ")", "tree", "=", "data", ".", "get", "(", "\"tree\"", ")", "sha", "=", "tree", ".", "get", "(", "\"sha\"", ")", ...
Get the SHA of a commit's tree. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. sha The SHA of a commit. Retu...
[ "Get", "the", "SHA", "of", "a", "commit", "s", "tree", "." ]
train
https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/files.py#L43-L63
jtpaasch/simplygithub
simplygithub/files.py
get_files_in_tree
def get_files_in_tree(profile, sha): """Get the files (blobs) in a tree. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. s...
python
def get_files_in_tree(profile, sha): """Get the files (blobs) in a tree. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. s...
[ "def", "get_files_in_tree", "(", "profile", ",", "sha", ")", ":", "data", "=", "trees", ".", "get_tree", "(", "profile", ",", "sha", ")", "tree", "=", "data", ".", "get", "(", "\"tree\"", ")", "blobs", "=", "[", "x", "for", "x", "in", "tree", "if",...
Get the files (blobs) in a tree. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. sha The SHA of a tree. Retur...
[ "Get", "the", "files", "(", "blobs", ")", "in", "a", "tree", "." ]
train
https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/files.py#L66-L86
jtpaasch/simplygithub
simplygithub/files.py
remove_file_from_tree
def remove_file_from_tree(tree, file_path): """Remove a file from a tree. Args: tree A list of dicts containing info about each blob in a tree. file_path The path of a file to remove from a tree. Returns: The provided tree, but with the item matching the s...
python
def remove_file_from_tree(tree, file_path): """Remove a file from a tree. Args: tree A list of dicts containing info about each blob in a tree. file_path The path of a file to remove from a tree. Returns: The provided tree, but with the item matching the s...
[ "def", "remove_file_from_tree", "(", "tree", ",", "file_path", ")", ":", "match", "=", "None", "for", "item", "in", "tree", ":", "if", "item", ".", "get", "(", "\"path\"", ")", "==", "file_path", ":", "match", "=", "item", "break", "if", "match", ":", ...
Remove a file from a tree. Args: tree A list of dicts containing info about each blob in a tree. file_path The path of a file to remove from a tree. Returns: The provided tree, but with the item matching the specified file_path removed.
[ "Remove", "a", "file", "from", "a", "tree", "." ]
train
https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/files.py#L89-L112
jtpaasch/simplygithub
simplygithub/files.py
add_file_to_tree
def add_file_to_tree(tree, file_path, file_contents, is_executable=False): """Add a file to a tree. Args: tree A list of dicts containing info about each blob in a tree. file_path The path of the new file in the tree. file_contents The (UTF-8 encod...
python
def add_file_to_tree(tree, file_path, file_contents, is_executable=False): """Add a file to a tree. Args: tree A list of dicts containing info about each blob in a tree. file_path The path of the new file in the tree. file_contents The (UTF-8 encod...
[ "def", "add_file_to_tree", "(", "tree", ",", "file_path", ",", "file_contents", ",", "is_executable", "=", "False", ")", ":", "record", "=", "{", "\"path\"", ":", "file_path", ",", "\"mode\"", ":", "\"100755\"", "if", "is_executable", "else", "\"100644\"", ","...
Add a file to a tree. Args: tree A list of dicts containing info about each blob in a tree. file_path The path of the new file in the tree. file_contents The (UTF-8 encoded) contents of the new file. is_executable If ``True``, the ...
[ "Add", "a", "file", "to", "a", "tree", "." ]
train
https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/files.py#L115-L144
jtpaasch/simplygithub
simplygithub/files.py
get_files_in_branch
def get_files_in_branch(profile, branch_sha): """Get all files in a branch's tree. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. ...
python
def get_files_in_branch(profile, branch_sha): """Get all files in a branch's tree. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. ...
[ "def", "get_files_in_branch", "(", "profile", ",", "branch_sha", ")", ":", "tree_sha", "=", "get_commit_tree", "(", "profile", ",", "branch_sha", ")", "files", "=", "get_files_in_tree", "(", "profile", ",", "tree_sha", ")", "tree", "=", "[", "prepare", "(", ...
Get all files in a branch's tree. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. branch_sha The SHA a branch's HE...
[ "Get", "all", "files", "in", "a", "branch", "s", "tree", "." ]
train
https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/files.py#L147-L167
jtpaasch/simplygithub
simplygithub/files.py
add_file
def add_file( profile, branch, file_path, file_contents, is_executable=False, commit_message=None): """Add a file to a branch. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this...
python
def add_file( profile, branch, file_path, file_contents, is_executable=False, commit_message=None): """Add a file to a branch. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this...
[ "def", "add_file", "(", "profile", ",", "branch", ",", "file_path", ",", "file_contents", ",", "is_executable", "=", "False", ",", "commit_message", "=", "None", ")", ":", "branch_sha", "=", "get_branch_sha", "(", "profile", ",", "branch", ")", "tree", "=", ...
Add a file to a branch. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. branch The name of a branch. file...
[ "Add", "a", "file", "to", "a", "branch", "." ]
train
https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/files.py#L191-L239
jtpaasch/simplygithub
simplygithub/files.py
remove_file
def remove_file(profile, branch, file_path, commit_message=None): """Remove a file from a branch. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to...
python
def remove_file(profile, branch, file_path, commit_message=None): """Remove a file from a branch. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to...
[ "def", "remove_file", "(", "profile", ",", "branch", ",", "file_path", ",", "commit_message", "=", "None", ")", ":", "branch_sha", "=", "get_branch_sha", "(", "profile", ",", "branch", ")", "tree", "=", "get_files_in_branch", "(", "profile", ",", "branch_sha",...
Remove a file from a branch. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. branch The name of a branch. ...
[ "Remove", "a", "file", "from", "a", "branch", "." ]
train
https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/files.py#L242-L277
jtpaasch/simplygithub
simplygithub/files.py
get_file
def get_file(profile, branch, file_path): """Get a file from a branch. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. bra...
python
def get_file(profile, branch, file_path): """Get a file from a branch. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. bra...
[ "def", "get_file", "(", "profile", ",", "branch", ",", "file_path", ")", ":", "branch_sha", "=", "get_branch_sha", "(", "profile", ",", "branch", ")", "tree", "=", "get_files_in_branch", "(", "profile", ",", "branch_sha", ")", "match", "=", "None", "for", ...
Get a file from a branch. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. branch The name of a branch. fi...
[ "Get", "a", "file", "from", "a", "branch", "." ]
train
https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/files.py#L280-L311
djtaylor/python-lsbinit
lsbinit/lock.py
_LSBLockHandler.make
def make(self): """ Make the lock file. """ try: # Create the lock file self.mkfile(self.lock_file) except Exception as e: self.die('Failed to generate lock file: {}'.format(str(e)))
python
def make(self): """ Make the lock file. """ try: # Create the lock file self.mkfile(self.lock_file) except Exception as e: self.die('Failed to generate lock file: {}'.format(str(e)))
[ "def", "make", "(", "self", ")", ":", "try", ":", "# Create the lock file", "self", ".", "mkfile", "(", "self", ".", "lock_file", ")", "except", "Exception", "as", "e", ":", "self", ".", "die", "(", "'Failed to generate lock file: {}'", ".", "format", "(", ...
Make the lock file.
[ "Make", "the", "lock", "file", "." ]
train
https://github.com/djtaylor/python-lsbinit/blob/a41fc551226f61ac2bf1b8b0f3f5395db85e75a2/lsbinit/lock.py#L36-L45
cirruscluster/cirruscluster
cirruscluster/ext/ansible/runner/connection_plugins/fireball.py
Connection.connect
def connect(self): ''' activates the connection object ''' if not HAVE_ZMQ: raise errors.AnsibleError("zmq is not installed") # this is rough/temporary and will likely be optimized later ... self.context = zmq.Context() socket = self.context.socket(zmq.REQ) ...
python
def connect(self): ''' activates the connection object ''' if not HAVE_ZMQ: raise errors.AnsibleError("zmq is not installed") # this is rough/temporary and will likely be optimized later ... self.context = zmq.Context() socket = self.context.socket(zmq.REQ) ...
[ "def", "connect", "(", "self", ")", ":", "if", "not", "HAVE_ZMQ", ":", "raise", "errors", ".", "AnsibleError", "(", "\"zmq is not installed\"", ")", "# this is rough/temporary and will likely be optimized later ...", "self", ".", "context", "=", "zmq", ".", "Context",...
activates the connection object
[ "activates", "the", "connection", "object" ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/connection_plugins/fireball.py#L55-L68
cirruscluster/cirruscluster
cirruscluster/ext/ansible/runner/connection_plugins/fireball.py
Connection.exec_command
def exec_command(self, cmd, tmp_path, sudo_user, sudoable=False, executable='/bin/sh'): ''' run a command on the remote host ''' vvv("EXEC COMMAND %s" % cmd) if self.runner.sudo and sudoable: raise errors.AnsibleError("fireball does not use sudo, but runs as whoever it was initiate...
python
def exec_command(self, cmd, tmp_path, sudo_user, sudoable=False, executable='/bin/sh'): ''' run a command on the remote host ''' vvv("EXEC COMMAND %s" % cmd) if self.runner.sudo and sudoable: raise errors.AnsibleError("fireball does not use sudo, but runs as whoever it was initiate...
[ "def", "exec_command", "(", "self", ",", "cmd", ",", "tmp_path", ",", "sudo_user", ",", "sudoable", "=", "False", ",", "executable", "=", "'/bin/sh'", ")", ":", "vvv", "(", "\"EXEC COMMAND %s\"", "%", "cmd", ")", "if", "self", ".", "runner", ".", "sudo",...
run a command on the remote host
[ "run", "a", "command", "on", "the", "remote", "host" ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/connection_plugins/fireball.py#L70-L92
cirruscluster/cirruscluster
cirruscluster/ext/ansible/runner/connection_plugins/fireball.py
Connection.put_file
def put_file(self, in_path, out_path): ''' transfer a file from local to remote ''' vvv("PUT %s TO %s" % (in_path, out_path), host=self.host) if not os.path.exists(in_path): raise errors.AnsibleFileNotFound("file or module does not exist: %s" % in_path) data = file(in_path)...
python
def put_file(self, in_path, out_path): ''' transfer a file from local to remote ''' vvv("PUT %s TO %s" % (in_path, out_path), host=self.host) if not os.path.exists(in_path): raise errors.AnsibleFileNotFound("file or module does not exist: %s" % in_path) data = file(in_path)...
[ "def", "put_file", "(", "self", ",", "in_path", ",", "out_path", ")", ":", "vvv", "(", "\"PUT %s TO %s\"", "%", "(", "in_path", ",", "out_path", ")", ",", "host", "=", "self", ".", "host", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "i...
transfer a file from local to remote
[ "transfer", "a", "file", "from", "local", "to", "remote" ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/connection_plugins/fireball.py#L94-L112
cirruscluster/cirruscluster
cirruscluster/ext/ansible/runner/connection_plugins/fireball.py
Connection.fetch_file
def fetch_file(self, in_path, out_path): ''' save a remote file to the specified path ''' vvv("FETCH %s TO %s" % (in_path, out_path), host=self.host) data = dict(mode='fetch', in_path=in_path) data = utils.jsonify(data) data = utils.encrypt(self.key, data) self.socket.se...
python
def fetch_file(self, in_path, out_path): ''' save a remote file to the specified path ''' vvv("FETCH %s TO %s" % (in_path, out_path), host=self.host) data = dict(mode='fetch', in_path=in_path) data = utils.jsonify(data) data = utils.encrypt(self.key, data) self.socket.se...
[ "def", "fetch_file", "(", "self", ",", "in_path", ",", "out_path", ")", ":", "vvv", "(", "\"FETCH %s TO %s\"", "%", "(", "in_path", ",", "out_path", ")", ",", "host", "=", "self", ".", "host", ")", "data", "=", "dict", "(", "mode", "=", "'fetch'", ",...
save a remote file to the specified path
[ "save", "a", "remote", "file", "to", "the", "specified", "path" ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/connection_plugins/fireball.py#L116-L133
edeposit/edeposit.amqp.serializers
src/edeposit/amqp/serializers/serializers.py
_serializeNT
def _serializeNT(data): """ Serialize namedtuples (and other basic python types) to dictionary with some special properties. Args: data (namedtuple/other python types): Data which will be serialized to dict. Data can be later automatically de-serialized by calling _deserialize...
python
def _serializeNT(data): """ Serialize namedtuples (and other basic python types) to dictionary with some special properties. Args: data (namedtuple/other python types): Data which will be serialized to dict. Data can be later automatically de-serialized by calling _deserialize...
[ "def", "_serializeNT", "(", "data", ")", ":", "if", "isinstance", "(", "data", ",", "list", ")", ":", "return", "[", "_serializeNT", "(", "item", ")", "for", "item", "in", "data", "]", "elif", "isinstance", "(", "data", ",", "tuple", ")", "and", "has...
Serialize namedtuples (and other basic python types) to dictionary with some special properties. Args: data (namedtuple/other python types): Data which will be serialized to dict. Data can be later automatically de-serialized by calling _deserializeNT().
[ "Serialize", "namedtuples", "(", "and", "other", "basic", "python", "types", ")", "to", "dictionary", "with", "some", "special", "properties", "." ]
train
https://github.com/edeposit/edeposit.amqp.serializers/blob/44409db650b16658e778255e420da9f14ef9f197/src/edeposit/amqp/serializers/serializers.py#L71-L100
edeposit/edeposit.amqp.serializers
src/edeposit/amqp/serializers/serializers.py
_deserializeNT
def _deserializeNT(data, glob): """ Deserialize special kinds of dicts from _serializeNT(). """ if isinstance(data, list): return [_deserializeNT(item, glob) for item in data] elif isinstance(data, tuple): return tuple(_deserializeNT(item, glob) for item in data) elif isinstanc...
python
def _deserializeNT(data, glob): """ Deserialize special kinds of dicts from _serializeNT(). """ if isinstance(data, list): return [_deserializeNT(item, glob) for item in data] elif isinstance(data, tuple): return tuple(_deserializeNT(item, glob) for item in data) elif isinstanc...
[ "def", "_deserializeNT", "(", "data", ",", "glob", ")", ":", "if", "isinstance", "(", "data", ",", "list", ")", ":", "return", "[", "_deserializeNT", "(", "item", ",", "glob", ")", "for", "item", "in", "data", "]", "elif", "isinstance", "(", "data", ...
Deserialize special kinds of dicts from _serializeNT().
[ "Deserialize", "special", "kinds", "of", "dicts", "from", "_serializeNT", "()", "." ]
train
https://github.com/edeposit/edeposit.amqp.serializers/blob/44409db650b16658e778255e420da9f14ef9f197/src/edeposit/amqp/serializers/serializers.py#L117-L151
edeposit/edeposit.amqp.serializers
src/edeposit/amqp/serializers/serializers.py
iiOfAny
def iiOfAny(instance, classes): """ Returns true, if `instance` is instance of any (iiOfAny) of the `classes`. This function doesn't use :py:func:`isinstance` check, it just compares the `class` names. This can be generaly dangerous, but it is really useful when you are comparing class seriali...
python
def iiOfAny(instance, classes): """ Returns true, if `instance` is instance of any (iiOfAny) of the `classes`. This function doesn't use :py:func:`isinstance` check, it just compares the `class` names. This can be generaly dangerous, but it is really useful when you are comparing class seriali...
[ "def", "iiOfAny", "(", "instance", ",", "classes", ")", ":", "if", "type", "(", "classes", ")", "not", "in", "[", "list", ",", "tuple", "]", ":", "classes", "=", "[", "classes", "]", "return", "any", "(", "type", "(", "instance", ")", ".", "__name_...
Returns true, if `instance` is instance of any (iiOfAny) of the `classes`. This function doesn't use :py:func:`isinstance` check, it just compares the `class` names. This can be generaly dangerous, but it is really useful when you are comparing class serialized in one module and deserialized in anothe...
[ "Returns", "true", "if", "instance", "is", "instance", "of", "any", "(", "iiOfAny", ")", "of", "the", "classes", "." ]
train
https://github.com/edeposit/edeposit.amqp.serializers/blob/44409db650b16658e778255e420da9f14ef9f197/src/edeposit/amqp/serializers/serializers.py#L178-L209
antonybholmes/libdna
libdna/decode.py
DNA.fasta
def fasta(self, loc, mask='mask'): """ Prints a fasta representation of a sequence. Parameters ---------- l : tuple (str, int, int) location chr, start, and end mask : str, optional Either 'upper', 'lower', or 'n'. If 'lower', poor quality...
python
def fasta(self, loc, mask='mask'): """ Prints a fasta representation of a sequence. Parameters ---------- l : tuple (str, int, int) location chr, start, and end mask : str, optional Either 'upper', 'lower', or 'n'. If 'lower', poor quality...
[ "def", "fasta", "(", "self", ",", "loc", ",", "mask", "=", "'mask'", ")", ":", "l", "=", "libdna", ".", "parse_loc", "(", "loc", ")", "print", "(", "'>{}'", ".", "format", "(", "l", ")", ")", "print", "(", "self", ".", "dna", "(", "l", ",", "...
Prints a fasta representation of a sequence. Parameters ---------- l : tuple (str, int, int) location chr, start, and end mask : str, optional Either 'upper', 'lower', or 'n'. If 'lower', poor quality bases will be converted to lowercase.
[ "Prints", "a", "fasta", "representation", "of", "a", "sequence", ".", "Parameters", "----------", "l", ":", "tuple", "(", "str", "int", "int", ")", "location", "chr", "start", "and", "end", "mask", ":", "str", "optional", "Either", "upper", "lower", "or", ...
train
https://github.com/antonybholmes/libdna/blob/96badfd33c8896c799b1c633bb9fb75cec65a83a/libdna/decode.py#L18-L34
antonybholmes/libdna
libdna/decode.py
DNA2Bit.rev_comp
def rev_comp(dna): """ Parameters ---------- dna : bytearray dna sequence to be reverse complemented """ i2 = len(dna) - 1 l = len(dna) // 2 for i in range(0, l): b = DNA_COMP_DICT[dna[i]] dna[...
python
def rev_comp(dna): """ Parameters ---------- dna : bytearray dna sequence to be reverse complemented """ i2 = len(dna) - 1 l = len(dna) // 2 for i in range(0, l): b = DNA_COMP_DICT[dna[i]] dna[...
[ "def", "rev_comp", "(", "dna", ")", ":", "i2", "=", "len", "(", "dna", ")", "-", "1", "l", "=", "len", "(", "dna", ")", "//", "2", "for", "i", "in", "range", "(", "0", ",", "l", ")", ":", "b", "=", "DNA_COMP_DICT", "[", "dna", "[", "i", "...
Parameters ---------- dna : bytearray dna sequence to be reverse complemented
[ "Parameters", "----------", "dna", ":", "bytearray", "dna", "sequence", "to", "be", "reverse", "complemented" ]
train
https://github.com/antonybholmes/libdna/blob/96badfd33c8896c799b1c633bb9fb75cec65a83a/libdna/decode.py#L72-L88
antonybholmes/libdna
libdna/decode.py
DNA2Bit._read1bit
def _read1bit(d, l, offset=False): """ Read data from a 1 bit file where each byte encodes 8 bases. Parameters ---------- d : array byte array l : tuple chr, start, end Returns ------- list list...
python
def _read1bit(d, l, offset=False): """ Read data from a 1 bit file where each byte encodes 8 bases. Parameters ---------- d : array byte array l : tuple chr, start, end Returns ------- list list...
[ "def", "_read1bit", "(", "d", ",", "l", ",", "offset", "=", "False", ")", ":", "s", "=", "l", ".", "start", "-", "1", "length", "=", "l", ".", "end", "-", "l", ".", "start", "+", "1", "ret", "=", "[", "0", "]", "*", "length", "if", "offset"...
Read data from a 1 bit file where each byte encodes 8 bases. Parameters ---------- d : array byte array l : tuple chr, start, end Returns ------- list list of 1s and 0s of length equal to the number of bases in...
[ "Read", "data", "from", "a", "1", "bit", "file", "where", "each", "byte", "encodes", "8", "bases", ".", "Parameters", "----------", "d", ":", "array", "byte", "array", "l", ":", "tuple", "chr", "start", "end", "Returns", "-------", "list", "list", "of", ...
train
https://github.com/antonybholmes/libdna/blob/96badfd33c8896c799b1c633bb9fb75cec65a83a/libdna/decode.py#L92-L149
antonybholmes/libdna
libdna/decode.py
DNA2Bit._read2bit
def _read2bit(d, l, offset=False): """ Read DNA from a 2bit file where each base is encoded in 2bit (4 bases per byte). Parameters ---------- d: l : tuple Location tuple Returns ------- list Array ...
python
def _read2bit(d, l, offset=False): """ Read DNA from a 2bit file where each base is encoded in 2bit (4 bases per byte). Parameters ---------- d: l : tuple Location tuple Returns ------- list Array ...
[ "def", "_read2bit", "(", "d", ",", "l", ",", "offset", "=", "False", ")", ":", "s", "=", "l", ".", "start", "-", "1", "ret", "=", "bytearray", "(", "[", "0", "]", "*", "l", ".", "length", ")", "#[]", "if", "offset", ":", "bi", "=", "s", "//...
Read DNA from a 2bit file where each base is encoded in 2bit (4 bases per byte). Parameters ---------- d: l : tuple Location tuple Returns ------- list Array of base chars
[ "Read", "DNA", "from", "a", "2bit", "file", "where", "each", "base", "is", "encoded", "in", "2bit", "(", "4", "bases", "per", "byte", ")", ".", "Parameters", "----------", "d", ":", "l", ":", "tuple", "Location", "tuple", "Returns", "-------", "list", ...
train
https://github.com/antonybholmes/libdna/blob/96badfd33c8896c799b1c633bb9fb75cec65a83a/libdna/decode.py#L153-L201
antonybholmes/libdna
libdna/decode.py
DNA2Bit._read_dna
def _read_dna(self, l, lowercase=False): """ Read DNA from a 2bit file where each base is encoded in 2bit (4 bases per byte). Parameters ---------- l : tuple Location tuple Returns ------- list Array of ba...
python
def _read_dna(self, l, lowercase=False): """ Read DNA from a 2bit file where each base is encoded in 2bit (4 bases per byte). Parameters ---------- l : tuple Location tuple Returns ------- list Array of ba...
[ "def", "_read_dna", "(", "self", ",", "l", ",", "lowercase", "=", "False", ")", ":", "file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "dir", ",", "l", ".", "chr", "+", "\".dna.2bit\"", ")", "print", "(", "file", ")", "if", "not", ...
Read DNA from a 2bit file where each base is encoded in 2bit (4 bases per byte). Parameters ---------- l : tuple Location tuple Returns ------- list Array of base chars
[ "Read", "DNA", "from", "a", "2bit", "file", "where", "each", "base", "is", "encoded", "in", "2bit", "(", "4", "bases", "per", "byte", ")", ".", "Parameters", "----------", "l", ":", "tuple", "Location", "tuple", "Returns", "-------", "list", "Array", "of...
train
https://github.com/antonybholmes/libdna/blob/96badfd33c8896c799b1c633bb9fb75cec65a83a/libdna/decode.py#L204-L233
antonybholmes/libdna
libdna/decode.py
DNA2Bit._read_1bit_file
def _read_1bit_file(file, l): """ Load data from 1 bit file into array Parameters ---------- file : str 1bit filename l : libdna.Loc dna location Returns ------- bytes byte array from file where...
python
def _read_1bit_file(file, l): """ Load data from 1 bit file into array Parameters ---------- file : str 1bit filename l : libdna.Loc dna location Returns ------- bytes byte array from file where...
[ "def", "_read_1bit_file", "(", "file", ",", "l", ")", ":", "f", "=", "open", "(", "file", ",", "'rb'", ")", "f", ".", "seek", "(", "(", "l", ".", "start", "-", "1", ")", "//", "8", ")", "# read length + 2 because we need the extra byte in case the start", ...
Load data from 1 bit file into array Parameters ---------- file : str 1bit filename l : libdna.Loc dna location Returns ------- bytes byte array from file where each byte represents 8 bases.
[ "Load", "data", "from", "1", "bit", "file", "into", "array", "Parameters", "----------", "file", ":", "str", "1bit", "filename", "l", ":", "libdna", ".", "Loc", "dna", "location", "Returns", "-------", "bytes", "byte", "array", "from", "file", "where", "ea...
train
https://github.com/antonybholmes/libdna/blob/96badfd33c8896c799b1c633bb9fb75cec65a83a/libdna/decode.py#L237-L266
antonybholmes/libdna
libdna/decode.py
DNA2Bit._read_n
def _read_n(self, l, ret): """ Reads 'N' mask from 1 bit file to convert bases to 'N'. In the 2 bit file, 'N' or any other invalid base is written as 'A'. Therefore the 'N' mask file is required to correctly identify where invalid bases are. Parameters --...
python
def _read_n(self, l, ret): """ Reads 'N' mask from 1 bit file to convert bases to 'N'. In the 2 bit file, 'N' or any other invalid base is written as 'A'. Therefore the 'N' mask file is required to correctly identify where invalid bases are. Parameters --...
[ "def", "_read_n", "(", "self", ",", "l", ",", "ret", ")", ":", "file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "dir", ",", "l", ".", "chr", "+", "\".n.1bit\"", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "file", ")...
Reads 'N' mask from 1 bit file to convert bases to 'N'. In the 2 bit file, 'N' or any other invalid base is written as 'A'. Therefore the 'N' mask file is required to correctly identify where invalid bases are. Parameters ---------- l : tuple location...
[ "Reads", "N", "mask", "from", "1", "bit", "file", "to", "convert", "bases", "to", "N", ".", "In", "the", "2", "bit", "file", "N", "or", "any", "other", "invalid", "base", "is", "written", "as", "A", ".", "Therefore", "the", "N", "mask", "file", "is...
train
https://github.com/antonybholmes/libdna/blob/96badfd33c8896c799b1c633bb9fb75cec65a83a/libdna/decode.py#L269-L295
antonybholmes/libdna
libdna/decode.py
DNA2Bit._read_mask
def _read_mask(self, l, ret, mask='upper'): """ Reads mask from 1 bit file to convert bases to identify poor quality bases that will either be converted to lowercase or 'N'. In the 2 bit file, 'N' or any other invalid base is written as 'A'. Therefore the 'N' mask file is require...
python
def _read_mask(self, l, ret, mask='upper'): """ Reads mask from 1 bit file to convert bases to identify poor quality bases that will either be converted to lowercase or 'N'. In the 2 bit file, 'N' or any other invalid base is written as 'A'. Therefore the 'N' mask file is require...
[ "def", "_read_mask", "(", "self", ",", "l", ",", "ret", ",", "mask", "=", "'upper'", ")", ":", "if", "mask", ".", "startswith", "(", "'u'", ")", ":", "return", "file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "__dir", ",", "l", "....
Reads mask from 1 bit file to convert bases to identify poor quality bases that will either be converted to lowercase or 'N'. In the 2 bit file, 'N' or any other invalid base is written as 'A'. Therefore the 'N' mask file is required to correctly identify where invalid bases are. ...
[ "Reads", "mask", "from", "1", "bit", "file", "to", "convert", "bases", "to", "identify", "poor", "quality", "bases", "that", "will", "either", "be", "converted", "to", "lowercase", "or", "N", ".", "In", "the", "2", "bit", "file", "N", "or", "any", "oth...
train
https://github.com/antonybholmes/libdna/blob/96badfd33c8896c799b1c633bb9fb75cec65a83a/libdna/decode.py#L298-L337
antonybholmes/libdna
libdna/decode.py
DNA2Bit.dna
def dna(self, loc, mask='lower', rev_comp=False, lowercase=False): """ Returns the DNA for a location. Parameters ---------- mask : str, optional Indicate whether masked bases should be represented as is ('upper'), lowercase ('lower'), or as N ('n...
python
def dna(self, loc, mask='lower', rev_comp=False, lowercase=False): """ Returns the DNA for a location. Parameters ---------- mask : str, optional Indicate whether masked bases should be represented as is ('upper'), lowercase ('lower'), or as N ('n...
[ "def", "dna", "(", "self", ",", "loc", ",", "mask", "=", "'lower'", ",", "rev_comp", "=", "False", ",", "lowercase", "=", "False", ")", ":", "l", "=", "libdna", ".", "parse_loc", "(", "loc", ")", "ret", "=", "self", ".", "_read_dna", "(", "l", ",...
Returns the DNA for a location. Parameters ---------- mask : str, optional Indicate whether masked bases should be represented as is ('upper'), lowercase ('lower'), or as N ('n') lowercase : bool, optional Indicates whether sequence should be ...
[ "Returns", "the", "DNA", "for", "a", "location", ".", "Parameters", "----------", "mask", ":", "str", "optional", "Indicate", "whether", "masked", "bases", "should", "be", "represented", "as", "is", "(", "upper", ")", "lowercase", "(", "lower", ")", "or", ...
train
https://github.com/antonybholmes/libdna/blob/96badfd33c8896c799b1c633bb9fb75cec65a83a/libdna/decode.py#L340-L377
antonybholmes/libdna
libdna/decode.py
DNA2Bit.merge_read_pair_seq
def merge_read_pair_seq(self, r1, r2): """ Merge the sequence of two reads into one continuous read either by inserting the missing DNA, or joining on the common sequence. Parameters ---------- r1 : libsam.Read Read 1 r2 : libsam.Read ...
python
def merge_read_pair_seq(self, r1, r2): """ Merge the sequence of two reads into one continuous read either by inserting the missing DNA, or joining on the common sequence. Parameters ---------- r1 : libsam.Read Read 1 r2 : libsam.Read ...
[ "def", "merge_read_pair_seq", "(", "self", ",", "r1", ",", "r2", ")", ":", "s1", "=", "r1", ".", "pos", "# + 1", "# end of first read", "e1", "=", "s1", "+", "r1", ".", "length", "-", "1", "# start of second read", "s2", "=", "r2", ".", "pos", "# + 1",...
Merge the sequence of two reads into one continuous read either by inserting the missing DNA, or joining on the common sequence. Parameters ---------- r1 : libsam.Read Read 1 r2 : libsam.Read Read 2
[ "Merge", "the", "sequence", "of", "two", "reads", "into", "one", "continuous", "read", "either", "by", "inserting", "the", "missing", "DNA", "or", "joining", "on", "the", "common", "sequence", ".", "Parameters", "----------", "r1", ":", "libsam", ".", "Read"...
train
https://github.com/antonybholmes/libdna/blob/96badfd33c8896c799b1c633bb9fb75cec65a83a/libdna/decode.py#L380-L413
antonybholmes/libdna
libdna/decode.py
CachedDNA2Bit._read_dna
def _read_dna(self, l, lowercase=False): """ Read DNA from a 2bit file where each base is encoded in 2bit (4 bases per byte). Parameters ---------- l : tuple Location tuple Returns ------- list Array of ba...
python
def _read_dna(self, l, lowercase=False): """ Read DNA from a 2bit file where each base is encoded in 2bit (4 bases per byte). Parameters ---------- l : tuple Location tuple Returns ------- list Array of ba...
[ "def", "_read_dna", "(", "self", ",", "l", ",", "lowercase", "=", "False", ")", ":", "file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "dir", ",", "l", ".", "chr", "+", "\".dna.2bit\"", ")", "if", "not", "os", ".", "path", ".", "ex...
Read DNA from a 2bit file where each base is encoded in 2bit (4 bases per byte). Parameters ---------- l : tuple Location tuple Returns ------- list Array of base chars
[ "Read", "DNA", "from", "a", "2bit", "file", "where", "each", "base", "is", "encoded", "in", "2bit", "(", "4", "bases", "per", "byte", ")", ".", "Parameters", "----------", "l", ":", "tuple", "Location", "tuple", "Returns", "-------", "list", "Array", "of...
train
https://github.com/antonybholmes/libdna/blob/96badfd33c8896c799b1c633bb9fb75cec65a83a/libdna/decode.py#L428-L458
antonybholmes/libdna
libdna/decode.py
CachedDNA2Bit._read_n
def _read_n(self, l, ret): """ Reads 'N' mask from 1 bit file to convert bases to 'N'. In the 2 bit file, 'N' or any other invalid base is written as 'A'. Therefore the 'N' mask file is required to correctly identify where invalid bases are. Parameters --...
python
def _read_n(self, l, ret): """ Reads 'N' mask from 1 bit file to convert bases to 'N'. In the 2 bit file, 'N' or any other invalid base is written as 'A'. Therefore the 'N' mask file is required to correctly identify where invalid bases are. Parameters --...
[ "def", "_read_n", "(", "self", ",", "l", ",", "ret", ")", ":", "file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "dir", ",", "l", ".", "chr", "+", "\".n.1bit\"", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "file", ")...
Reads 'N' mask from 1 bit file to convert bases to 'N'. In the 2 bit file, 'N' or any other invalid base is written as 'A'. Therefore the 'N' mask file is required to correctly identify where invalid bases are. Parameters ---------- l : tuple location...
[ "Reads", "N", "mask", "from", "1", "bit", "file", "to", "convert", "bases", "to", "N", ".", "In", "the", "2", "bit", "file", "N", "or", "any", "other", "invalid", "base", "is", "written", "as", "A", ".", "Therefore", "the", "N", "mask", "file", "is...
train
https://github.com/antonybholmes/libdna/blob/96badfd33c8896c799b1c633bb9fb75cec65a83a/libdna/decode.py#L461-L492
antonybholmes/libdna
libdna/decode.py
CachedDNA2Bit._read_mask
def _read_mask(self, l, ret, mask='upper'): """ Reads mask from 1 bit file to convert bases to identify poor quality bases that will either be converted to lowercase or 'N'. In the 2 bit file, 'N' or any other invalid base is written as 'A'. Therefore the 'N' mask file is require...
python
def _read_mask(self, l, ret, mask='upper'): """ Reads mask from 1 bit file to convert bases to identify poor quality bases that will either be converted to lowercase or 'N'. In the 2 bit file, 'N' or any other invalid base is written as 'A'. Therefore the 'N' mask file is require...
[ "def", "_read_mask", "(", "self", ",", "l", ",", "ret", ",", "mask", "=", "'upper'", ")", ":", "if", "mask", ".", "startswith", "(", "'u'", ")", ":", "return", "file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "dir", ",", "l", ".",...
Reads mask from 1 bit file to convert bases to identify poor quality bases that will either be converted to lowercase or 'N'. In the 2 bit file, 'N' or any other invalid base is written as 'A'. Therefore the 'N' mask file is required to correctly identify where invalid bases are. ...
[ "Reads", "mask", "from", "1", "bit", "file", "to", "convert", "bases", "to", "identify", "poor", "quality", "bases", "that", "will", "either", "be", "converted", "to", "lowercase", "or", "N", ".", "In", "the", "2", "bit", "file", "N", "or", "any", "oth...
train
https://github.com/antonybholmes/libdna/blob/96badfd33c8896c799b1c633bb9fb75cec65a83a/libdna/decode.py#L495-L539
jkenlooper/chill
src/chill/api.py
_short_circuit
def _short_circuit(value=None): """ Add the `value` to the `collection` by modifying the collection to be either a dict or list depending on what is already in the collection and value. Returns the collection with the value added to it. Clean up by removing single item array and single key dict...
python
def _short_circuit(value=None): """ Add the `value` to the `collection` by modifying the collection to be either a dict or list depending on what is already in the collection and value. Returns the collection with the value added to it. Clean up by removing single item array and single key dict...
[ "def", "_short_circuit", "(", "value", "=", "None", ")", ":", "if", "not", "isinstance", "(", "value", ",", "list", ")", ":", "return", "value", "if", "len", "(", "value", ")", "==", "0", ":", "return", "value", "if", "len", "(", "value", ")", "=="...
Add the `value` to the `collection` by modifying the collection to be either a dict or list depending on what is already in the collection and value. Returns the collection with the value added to it. Clean up by removing single item array and single key dict. ['abc'] -> 'abc' [['abc']] -> 'abc...
[ "Add", "the", "value", "to", "the", "collection", "by", "modifying", "the", "collection", "to", "be", "either", "a", "dict", "or", "list", "depending", "on", "what", "is", "already", "in", "the", "collection", "and", "value", ".", "Returns", "the", "collec...
train
https://github.com/jkenlooper/chill/blob/35360c17c2a3b769ecb5406c6dabcf4cc70bd76f/src/chill/api.py#L8-L49
jkenlooper/chill
src/chill/api.py
_query
def _query(_node_id, value=None, **kw): "Look up value by using Query table" query_result = [] try: query_result = db.execute(text(fetch_query_string('select_query_from_node.sql')), **kw).fetchall() except DatabaseError as err: current_app.logger.error("DatabaseError: %s, %s", err, kw) ...
python
def _query(_node_id, value=None, **kw): "Look up value by using Query table" query_result = [] try: query_result = db.execute(text(fetch_query_string('select_query_from_node.sql')), **kw).fetchall() except DatabaseError as err: current_app.logger.error("DatabaseError: %s, %s", err, kw) ...
[ "def", "_query", "(", "_node_id", ",", "value", "=", "None", ",", "*", "*", "kw", ")", ":", "query_result", "=", "[", "]", "try", ":", "query_result", "=", "db", ".", "execute", "(", "text", "(", "fetch_query_string", "(", "'select_query_from_node.sql'", ...
Look up value by using Query table
[ "Look", "up", "value", "by", "using", "Query", "table" ]
train
https://github.com/jkenlooper/chill/blob/35360c17c2a3b769ecb5406c6dabcf4cc70bd76f/src/chill/api.py#L53-L97
jkenlooper/chill
src/chill/api.py
_template
def _template(node_id, value=None): "Check if a template is assigned to it and render that with the value" result = [] select_template_from_node = fetch_query_string('select_template_from_node.sql') try: result = db.execute(text(select_template_from_node), node_id=node_id) template_resul...
python
def _template(node_id, value=None): "Check if a template is assigned to it and render that with the value" result = [] select_template_from_node = fetch_query_string('select_template_from_node.sql') try: result = db.execute(text(select_template_from_node), node_id=node_id) template_resul...
[ "def", "_template", "(", "node_id", ",", "value", "=", "None", ")", ":", "result", "=", "[", "]", "select_template_from_node", "=", "fetch_query_string", "(", "'select_template_from_node.sql'", ")", "try", ":", "result", "=", "db", ".", "execute", "(", "text",...
Check if a template is assigned to it and render that with the value
[ "Check", "if", "a", "template", "is", "assigned", "to", "it", "and", "render", "that", "with", "the", "value" ]
train
https://github.com/jkenlooper/chill/blob/35360c17c2a3b769ecb5406c6dabcf4cc70bd76f/src/chill/api.py#L99-L118
jkenlooper/chill
src/chill/api.py
render_node
def render_node(_node_id, value=None, noderequest={}, **kw): "Recursively render a node's value" if value == None: kw.update( noderequest ) results = _query(_node_id, **kw) current_app.logger.debug("results: %s", results) if results: values = [] for (resul...
python
def render_node(_node_id, value=None, noderequest={}, **kw): "Recursively render a node's value" if value == None: kw.update( noderequest ) results = _query(_node_id, **kw) current_app.logger.debug("results: %s", results) if results: values = [] for (resul...
[ "def", "render_node", "(", "_node_id", ",", "value", "=", "None", ",", "noderequest", "=", "{", "}", ",", "*", "*", "kw", ")", ":", "if", "value", "==", "None", ":", "kw", ".", "update", "(", "noderequest", ")", "results", "=", "_query", "(", "_nod...
Recursively render a node's value
[ "Recursively", "render", "a", "node", "s", "value" ]
train
https://github.com/jkenlooper/chill/blob/35360c17c2a3b769ecb5406c6dabcf4cc70bd76f/src/chill/api.py#L120-L154
riquito/richinput
richinput/terminfo.py
load_terminfo
def load_terminfo(terminal_name=None, fallback='vt100'): """ If the environment variable TERM is unset try with `fallback` if not empty. vt100 is a popular terminal supporting ANSI X3.64. """ terminal_name = os.getenv('TERM') if not terminal_name: if not fallback: raise Term...
python
def load_terminfo(terminal_name=None, fallback='vt100'): """ If the environment variable TERM is unset try with `fallback` if not empty. vt100 is a popular terminal supporting ANSI X3.64. """ terminal_name = os.getenv('TERM') if not terminal_name: if not fallback: raise Term...
[ "def", "load_terminfo", "(", "terminal_name", "=", "None", ",", "fallback", "=", "'vt100'", ")", ":", "terminal_name", "=", "os", ".", "getenv", "(", "'TERM'", ")", "if", "not", "terminal_name", ":", "if", "not", "fallback", ":", "raise", "TerminfoError", ...
If the environment variable TERM is unset try with `fallback` if not empty. vt100 is a popular terminal supporting ANSI X3.64.
[ "If", "the", "environment", "variable", "TERM", "is", "unset", "try", "with", "fallback", "if", "not", "empty", ".", "vt100", "is", "a", "popular", "terminal", "supporting", "ANSI", "X3", ".", "64", "." ]
train
https://github.com/riquito/richinput/blob/858c6068d80377148b89dcf9107f4e46a2b464d4/richinput/terminfo.py#L116-L232
riquito/richinput
richinput/terminfo.py
Terminfo.get
def get(self, name): """Get the escape code associated to name. `name` can be either a varialble_name, a capname or a tcap code See man terminfo(5) to see which names are available. If the name is not supported, None is returned. If the name isn't present in the database...
python
def get(self, name): """Get the escape code associated to name. `name` can be either a varialble_name, a capname or a tcap code See man terminfo(5) to see which names are available. If the name is not supported, None is returned. If the name isn't present in the database...
[ "def", "get", "(", "self", ",", "name", ")", ":", "# `name` is most likely a capname, so we try that first", "for", "i", "in", "(", "self", ".", "_by_capname", ",", "self", ".", "_by_var", ",", "self", ".", "_by_tcap_code", ")", ":", "if", "i", ".", "get", ...
Get the escape code associated to name. `name` can be either a varialble_name, a capname or a tcap code See man terminfo(5) to see which names are available. If the name is not supported, None is returned. If the name isn't present in the database an exception is raised.
[ "Get", "the", "escape", "code", "associated", "to", "name", ".", "name", "can", "be", "either", "a", "varialble_name", "a", "capname", "or", "a", "tcap", "code", "See", "man", "terminfo", "(", "5", ")", "to", "see", "which", "names", "are", "available", ...
train
https://github.com/riquito/richinput/blob/858c6068d80377148b89dcf9107f4e46a2b464d4/richinput/terminfo.py#L70-L83
riquito/richinput
richinput/terminfo.py
Terminfo.detect
def detect(self, escape_code): import re """ str_params = '%(%' + \ r'|[-+*/m&\|cisl^=><AO!~]|p[1-9]|[Pg][a-zA-Z]' + \ r'|((:?[-+# ])?([0-9]+(\.[0-9]+)?)?[doxXs])' + \ r"|('c'|\{[0-9]+\})" + \ r"|(\?.*?;)" + \ ')' """ cap ...
python
def detect(self, escape_code): import re """ str_params = '%(%' + \ r'|[-+*/m&\|cisl^=><AO!~]|p[1-9]|[Pg][a-zA-Z]' + \ r'|((:?[-+# ])?([0-9]+(\.[0-9]+)?)?[doxXs])' + \ r"|('c'|\{[0-9]+\})" + \ r"|(\?.*?;)" + \ ')' """ cap ...
[ "def", "detect", "(", "self", ",", "escape_code", ")", ":", "import", "re", "cap", "=", "self", ".", "_by_escape_code", ".", "get", "(", "escape_code", ",", "UnknownCapability", "(", ")", ")", "cap", ".", "value", "=", "escape_code", "\"\"\"\n pattern...
str_params = '%(%' + \ r'|[-+*/m&\|cisl^=><AO!~]|p[1-9]|[Pg][a-zA-Z]' + \ r'|((:?[-+# ])?([0-9]+(\.[0-9]+)?)?[doxXs])' + \ r"|('c'|\{[0-9]+\})" + \ r"|(\?.*?;)" + \ ')'
[ "str_params", "=", "%", "(", "%", "+", "\\", "r", "|", "[", "-", "+", "*", "/", "m&", "\\", "|cisl^", "=", ">", "<AO!~", "]", "|p", "[", "1", "-", "9", "]", "|", "[", "Pg", "]", "[", "a", "-", "zA", "-", "Z", "]", "+", "\\", "r", "|",...
train
https://github.com/riquito/richinput/blob/858c6068d80377148b89dcf9107f4e46a2b464d4/richinput/terminfo.py#L85-L107
heikomuller/sco-client
scocli/experiment.py
get_run_listing
def get_run_listing(listing_url, offset, limit, properties): """Get list of experiment resources from a SCO-API. Parameters ---------- listing_url : string url for experiments run listing. offset : int Starting offset for returned list items limit : int Limit the number ...
python
def get_run_listing(listing_url, offset, limit, properties): """Get list of experiment resources from a SCO-API. Parameters ---------- listing_url : string url for experiments run listing. offset : int Starting offset for returned list items limit : int Limit the number ...
[ "def", "get_run_listing", "(", "listing_url", ",", "offset", ",", "limit", ",", "properties", ")", ":", "# Create listing query based on given arguments", "query", "=", "[", "QPARA_OFFSET", "+", "'='", "+", "str", "(", "offset", ")", ",", "QPARA_LIMIT", "+", "'=...
Get list of experiment resources from a SCO-API. Parameters ---------- listing_url : string url for experiments run listing. offset : int Starting offset for returned list items limit : int Limit the number of items in the result properties : List(string) List of...
[ "Get", "list", "of", "experiment", "resources", "from", "a", "SCO", "-", "API", "." ]
train
https://github.com/heikomuller/sco-client/blob/c4afab71297f73003379bba4c1679be9dcf7cef8/scocli/experiment.py#L206-L255
heikomuller/sco-client
scocli/experiment.py
ExperimentHandle.create
def create(url, name, subject_id, image_group_id, properties): """Create a new experiment using the given SCO-API create experiment Url. Parameters ---------- url : string Url to POST experiment create request name : string User-defined name for experimen...
python
def create(url, name, subject_id, image_group_id, properties): """Create a new experiment using the given SCO-API create experiment Url. Parameters ---------- url : string Url to POST experiment create request name : string User-defined name for experimen...
[ "def", "create", "(", "url", ",", "name", ",", "subject_id", ",", "image_group_id", ",", "properties", ")", ":", "# Create list of key,value-pairs representing experiment properties for", "# request. The given name overrides the name in properties (if present).", "obj_props", "=", ...
Create a new experiment using the given SCO-API create experiment Url. Parameters ---------- url : string Url to POST experiment create request name : string User-defined name for experiment subject_id : string Unique identifier for subject at...
[ "Create", "a", "new", "experiment", "using", "the", "given", "SCO", "-", "API", "create", "experiment", "Url", "." ]
train
https://github.com/heikomuller/sco-client/blob/c4afab71297f73003379bba4c1679be9dcf7cef8/scocli/experiment.py#L62-L108
heikomuller/sco-client
scocli/experiment.py
ExperimentHandle.run
def run(self, model_id, name, arguments={}, properties=None): """Create a new model run with given name, arguments, and properties. Parameters ---------- model_id : string Unique model identifier name : string User-defined name for experiment argum...
python
def run(self, model_id, name, arguments={}, properties=None): """Create a new model run with given name, arguments, and properties. Parameters ---------- model_id : string Unique model identifier name : string User-defined name for experiment argum...
[ "def", "run", "(", "self", ",", "model_id", ",", "name", ",", "arguments", "=", "{", "}", ",", "properties", "=", "None", ")", ":", "return", "self", ".", "sco", ".", "experiments_predictions_create", "(", "model_id", ",", "name", ",", "self", ".", "li...
Create a new model run with given name, arguments, and properties. Parameters ---------- model_id : string Unique model identifier name : string User-defined name for experiment arguments : Dictionary Dictionary of arguments for model run ...
[ "Create", "a", "new", "model", "run", "with", "given", "name", "arguments", "and", "properties", ".", "Parameters", "----------", "model_id", ":", "string", "Unique", "model", "identifier", "name", ":", "string", "User", "-", "defined", "name", "for", "experim...
train
https://github.com/heikomuller/sco-client/blob/c4afab71297f73003379bba4c1679be9dcf7cef8/scocli/experiment.py#L137-L161
heikomuller/sco-client
scocli/experiment.py
ExperimentHandle.runs
def runs(self, offset=0, limit=-1, properties=None): """Get a list of run descriptors associated with this expriment. Parameters ---------- offset : int, optional Starting offset for returned list items limit : int, optional Limit the number of items in t...
python
def runs(self, offset=0, limit=-1, properties=None): """Get a list of run descriptors associated with this expriment. Parameters ---------- offset : int, optional Starting offset for returned list items limit : int, optional Limit the number of items in t...
[ "def", "runs", "(", "self", ",", "offset", "=", "0", ",", "limit", "=", "-", "1", ",", "properties", "=", "None", ")", ":", "return", "get_run_listing", "(", "self", ".", "runs_url", ",", "offset", "=", "offset", ",", "limit", "=", "limit", ",", "p...
Get a list of run descriptors associated with this expriment. Parameters ---------- offset : int, optional Starting offset for returned list items limit : int, optional Limit the number of items in the result properties : List(string) List of ...
[ "Get", "a", "list", "of", "run", "descriptors", "associated", "with", "this", "expriment", "." ]
train
https://github.com/heikomuller/sco-client/blob/c4afab71297f73003379bba4c1679be9dcf7cef8/scocli/experiment.py#L163-L186
hweickert/itermate
itermate/__init__.py
imapchain
def imapchain(*a, **kwa): """ Like map but also chains the results. """ imap_results = map( *a, **kwa ) return itertools.chain( *imap_results )
python
def imapchain(*a, **kwa): """ Like map but also chains the results. """ imap_results = map( *a, **kwa ) return itertools.chain( *imap_results )
[ "def", "imapchain", "(", "*", "a", ",", "*", "*", "kwa", ")", ":", "imap_results", "=", "map", "(", "*", "a", ",", "*", "*", "kwa", ")", "return", "itertools", ".", "chain", "(", "*", "imap_results", ")" ]
Like map but also chains the results.
[ "Like", "map", "but", "also", "chains", "the", "results", "." ]
train
https://github.com/hweickert/itermate/blob/501cb4c31c6435b2f99703eb516aca2886d513b6/itermate/__init__.py#L13-L17
hweickert/itermate
itermate/__init__.py
iapply
def iapply(function, *iterables): """ Like itertools.imap, but returns the iterable's item/iterables' items instead. """ iterables = map(iter, iterables) while True: args = [next(it) for it in iterables] if function is None: yield tuple(args) else: f...
python
def iapply(function, *iterables): """ Like itertools.imap, but returns the iterable's item/iterables' items instead. """ iterables = map(iter, iterables) while True: args = [next(it) for it in iterables] if function is None: yield tuple(args) else: f...
[ "def", "iapply", "(", "function", ",", "*", "iterables", ")", ":", "iterables", "=", "map", "(", "iter", ",", "iterables", ")", "while", "True", ":", "args", "=", "[", "next", "(", "it", ")", "for", "it", "in", "iterables", "]", "if", "function", "...
Like itertools.imap, but returns the iterable's item/iterables' items instead.
[ "Like", "itertools", ".", "imap", "but", "returns", "the", "iterable", "s", "item", "/", "iterables", "items", "instead", "." ]
train
https://github.com/hweickert/itermate/blob/501cb4c31c6435b2f99703eb516aca2886d513b6/itermate/__init__.py#L20-L30
hweickert/itermate
itermate/__init__.py
iskip
def iskip( value, iterable ): """ Skips all values in 'iterable' matching the given 'value'. """ for e in iterable: if value is None: if e is None: continue elif e == value: continue yield e
python
def iskip( value, iterable ): """ Skips all values in 'iterable' matching the given 'value'. """ for e in iterable: if value is None: if e is None: continue elif e == value: continue yield e
[ "def", "iskip", "(", "value", ",", "iterable", ")", ":", "for", "e", "in", "iterable", ":", "if", "value", "is", "None", ":", "if", "e", "is", "None", ":", "continue", "elif", "e", "==", "value", ":", "continue", "yield", "e" ]
Skips all values in 'iterable' matching the given 'value'.
[ "Skips", "all", "values", "in", "iterable", "matching", "the", "given", "value", "." ]
train
https://github.com/hweickert/itermate/blob/501cb4c31c6435b2f99703eb516aca2886d513b6/itermate/__init__.py#L33-L42
hweickert/itermate
itermate/__init__.py
unique
def unique(iterable): """ Generator yielding each element only once. Note: May consume lots of memory depending on the given iterable. """ yielded = set() for i in iterable: if i in yielded: continue yield i yielded.add(i)
python
def unique(iterable): """ Generator yielding each element only once. Note: May consume lots of memory depending on the given iterable. """ yielded = set() for i in iterable: if i in yielded: continue yield i yielded.add(i)
[ "def", "unique", "(", "iterable", ")", ":", "yielded", "=", "set", "(", ")", "for", "i", "in", "iterable", ":", "if", "i", "in", "yielded", ":", "continue", "yield", "i", "yielded", ".", "add", "(", "i", ")" ]
Generator yielding each element only once. Note: May consume lots of memory depending on the given iterable.
[ "Generator", "yielding", "each", "element", "only", "once", ".", "Note", ":", "May", "consume", "lots", "of", "memory", "depending", "on", "the", "given", "iterable", "." ]
train
https://github.com/hweickert/itermate/blob/501cb4c31c6435b2f99703eb516aca2886d513b6/itermate/__init__.py#L45-L57
rorr73/LifeSOSpy
lifesospy/command.py
Command.format
def format(self, password: str = '') -> str: """Format command along with any arguments, ready to be sent.""" return MARKER_START + \ self.name + \ self.action + \ self.args + \ password + \ MARKER_END
python
def format(self, password: str = '') -> str: """Format command along with any arguments, ready to be sent.""" return MARKER_START + \ self.name + \ self.action + \ self.args + \ password + \ MARKER_END
[ "def", "format", "(", "self", ",", "password", ":", "str", "=", "''", ")", "->", "str", ":", "return", "MARKER_START", "+", "self", ".", "name", "+", "self", ".", "action", "+", "self", ".", "args", "+", "password", "+", "MARKER_END" ]
Format command along with any arguments, ready to be sent.
[ "Format", "command", "along", "with", "any", "arguments", "ready", "to", "be", "sent", "." ]
train
https://github.com/rorr73/LifeSOSpy/blob/62360fbab2e90bf04d52b547093bdab2d4e389b4/lifesospy/command.py#L38-L45
rorr73/LifeSOSpy
lifesospy/command.py
SetDateTimeCommand.args
def args(self) -> str: """Provides arguments for the command.""" value = self._value if not value: value = datetime.now() return value.strftime('%y%m%d%w%H%M')
python
def args(self) -> str: """Provides arguments for the command.""" value = self._value if not value: value = datetime.now() return value.strftime('%y%m%d%w%H%M')
[ "def", "args", "(", "self", ")", "->", "str", ":", "value", "=", "self", ".", "_value", "if", "not", "value", ":", "value", "=", "datetime", ".", "now", "(", ")", "return", "value", ".", "strftime", "(", "'%y%m%d%w%H%M'", ")" ]
Provides arguments for the command.
[ "Provides", "arguments", "for", "the", "command", "." ]
train
https://github.com/rorr73/LifeSOSpy/blob/62360fbab2e90bf04d52b547093bdab2d4e389b4/lifesospy/command.py#L93-L98
rorr73/LifeSOSpy
lifesospy/command.py
GetDeviceCommand.args
def args(self) -> str: """Provides arguments for the command.""" return '{}{}'.format( to_ascii_hex(self._group_number, 2), to_ascii_hex(self._unit_number, 2))
python
def args(self) -> str: """Provides arguments for the command.""" return '{}{}'.format( to_ascii_hex(self._group_number, 2), to_ascii_hex(self._unit_number, 2))
[ "def", "args", "(", "self", ")", "->", "str", ":", "return", "'{}{}'", ".", "format", "(", "to_ascii_hex", "(", "self", ".", "_group_number", ",", "2", ")", ",", "to_ascii_hex", "(", "self", ".", "_unit_number", ",", "2", ")", ")" ]
Provides arguments for the command.
[ "Provides", "arguments", "for", "the", "command", "." ]
train
https://github.com/rorr73/LifeSOSpy/blob/62360fbab2e90bf04d52b547093bdab2d4e389b4/lifesospy/command.py#L199-L203
rorr73/LifeSOSpy
lifesospy/command.py
ChangeDeviceCommand.args
def args(self) -> str: """Provides arguments for the command.""" return '{}{}{}{}{}'.format( to_ascii_hex(self._index, 2), to_ascii_hex(self._group_number, 2), to_ascii_hex(self._unit_number, 2), to_ascii_hex(int(self._enable_status), 4), to_as...
python
def args(self) -> str: """Provides arguments for the command.""" return '{}{}{}{}{}'.format( to_ascii_hex(self._index, 2), to_ascii_hex(self._group_number, 2), to_ascii_hex(self._unit_number, 2), to_ascii_hex(int(self._enable_status), 4), to_as...
[ "def", "args", "(", "self", ")", "->", "str", ":", "return", "'{}{}{}{}{}'", ".", "format", "(", "to_ascii_hex", "(", "self", ".", "_index", ",", "2", ")", ",", "to_ascii_hex", "(", "self", ".", "_group_number", ",", "2", ")", ",", "to_ascii_hex", "(",...
Provides arguments for the command.
[ "Provides", "arguments", "for", "the", "command", "." ]
train
https://github.com/rorr73/LifeSOSpy/blob/62360fbab2e90bf04d52b547093bdab2d4e389b4/lifesospy/command.py#L245-L252
rorr73/LifeSOSpy
lifesospy/command.py
ChangeSpecialDeviceCommand.args
def args(self) -> str: """Provides arguments for the command.""" return '{}{}{}{}{}{}{}{}{}{}{}'.format( to_ascii_hex(self._index, 2), to_ascii_hex(self._group_number, 2), to_ascii_hex(self._unit_number, 2), to_ascii_hex(int(self._enable_status), 4), ...
python
def args(self) -> str: """Provides arguments for the command.""" return '{}{}{}{}{}{}{}{}{}{}{}'.format( to_ascii_hex(self._index, 2), to_ascii_hex(self._group_number, 2), to_ascii_hex(self._unit_number, 2), to_ascii_hex(int(self._enable_status), 4), ...
[ "def", "args", "(", "self", ")", "->", "str", ":", "return", "'{}{}{}{}{}{}{}{}{}{}{}'", ".", "format", "(", "to_ascii_hex", "(", "self", ".", "_index", ",", "2", ")", ",", "to_ascii_hex", "(", "self", ".", "_group_number", ",", "2", ")", ",", "to_ascii_...
Provides arguments for the command.
[ "Provides", "arguments", "for", "the", "command", "." ]
train
https://github.com/rorr73/LifeSOSpy/blob/62360fbab2e90bf04d52b547093bdab2d4e389b4/lifesospy/command.py#L321-L334
rorr73/LifeSOSpy
lifesospy/command.py
ChangeSpecial2DeviceCommand.args
def args(self) -> str: """Provides arguments for the command.""" return '{}{}{}'.format( ChangeSpecialDeviceCommand.args, to_ascii_hex(encode_value_using_ma(self._message_attribute, self._control_high_limit), 2), to_ascii...
python
def args(self) -> str: """Provides arguments for the command.""" return '{}{}{}'.format( ChangeSpecialDeviceCommand.args, to_ascii_hex(encode_value_using_ma(self._message_attribute, self._control_high_limit), 2), to_ascii...
[ "def", "args", "(", "self", ")", "->", "str", ":", "return", "'{}{}{}'", ".", "format", "(", "ChangeSpecialDeviceCommand", ".", "args", ",", "to_ascii_hex", "(", "encode_value_using_ma", "(", "self", ".", "_message_attribute", ",", "self", ".", "_control_high_li...
Provides arguments for the command.
[ "Provides", "arguments", "for", "the", "command", "." ]
train
https://github.com/rorr73/LifeSOSpy/blob/62360fbab2e90bf04d52b547093bdab2d4e389b4/lifesospy/command.py#L405-L412
rackerlabs/silverberg
scripts/python-lint.py
lint
def lint(to_lint): """ Run all linters against a list of files. :param to_lint: a list of files to lint. """ exit_code = 0 for linter, options in (('pyflakes', []), ('pep8', [])): try: output = local[linter](*(options + to_lint)) except commands.ProcessExecutionErro...
python
def lint(to_lint): """ Run all linters against a list of files. :param to_lint: a list of files to lint. """ exit_code = 0 for linter, options in (('pyflakes', []), ('pep8', [])): try: output = local[linter](*(options + to_lint)) except commands.ProcessExecutionErro...
[ "def", "lint", "(", "to_lint", ")", ":", "exit_code", "=", "0", "for", "linter", ",", "options", "in", "(", "(", "'pyflakes'", ",", "[", "]", ")", ",", "(", "'pep8'", ",", "[", "]", ")", ")", ":", "try", ":", "output", "=", "local", "[", "linte...
Run all linters against a list of files. :param to_lint: a list of files to lint.
[ "Run", "all", "linters", "against", "a", "list", "of", "files", "." ]
train
https://github.com/rackerlabs/silverberg/blob/c6fae78923a019f1615e9516ab30fa105c72a542/scripts/python-lint.py#L24-L49
rackerlabs/silverberg
scripts/python-lint.py
hacked_pep257
def hacked_pep257(to_lint): """ Check for the presence of docstrings, but ignore some of the options """ def ignore(*args, **kwargs): pass pep257.check_blank_before_after_class = ignore pep257.check_blank_after_last_paragraph = ignore pep257.check_blank_after_summary = ignore pe...
python
def hacked_pep257(to_lint): """ Check for the presence of docstrings, but ignore some of the options """ def ignore(*args, **kwargs): pass pep257.check_blank_before_after_class = ignore pep257.check_blank_after_last_paragraph = ignore pep257.check_blank_after_summary = ignore pe...
[ "def", "hacked_pep257", "(", "to_lint", ")", ":", "def", "ignore", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "pass", "pep257", ".", "check_blank_before_after_class", "=", "ignore", "pep257", ".", "check_blank_after_last_paragraph", "=", "ignore", "p...
Check for the presence of docstrings, but ignore some of the options
[ "Check", "for", "the", "presence", "of", "docstrings", "but", "ignore", "some", "of", "the", "options" ]
train
https://github.com/rackerlabs/silverberg/blob/c6fae78923a019f1615e9516ab30fa105c72a542/scripts/python-lint.py#L52-L84
rackerlabs/silverberg
scripts/python-lint.py
Lint.main
def main(self, *directories): """ The actual logic that runs the linters """ if not self.git and len(directories) == 0: print ("ERROR: At least one directory must be provided (or the " "--git-precommit flag must be passed.\n") self.help() ...
python
def main(self, *directories): """ The actual logic that runs the linters """ if not self.git and len(directories) == 0: print ("ERROR: At least one directory must be provided (or the " "--git-precommit flag must be passed.\n") self.help() ...
[ "def", "main", "(", "self", ",", "*", "directories", ")", ":", "if", "not", "self", ".", "git", "and", "len", "(", "directories", ")", "==", "0", ":", "print", "(", "\"ERROR: At least one directory must be provided (or the \"", "\"--git-precommit flag must be passed...
The actual logic that runs the linters
[ "The", "actual", "logic", "that", "runs", "the", "linters" ]
train
https://github.com/rackerlabs/silverberg/blob/c6fae78923a019f1615e9516ab30fa105c72a542/scripts/python-lint.py#L97-L133
20tab/twentytab-tree
tree/template_context/context_processors.py
set_meta
def set_meta(request): """ This context processor returns meta informations contained in cached files. If there aren't cache it calculates dictionary to return """ context_extras = {} if not request.is_ajax() and hasattr(request, 'upy_context') and request.upy_context['PAGE']: context_e...
python
def set_meta(request): """ This context processor returns meta informations contained in cached files. If there aren't cache it calculates dictionary to return """ context_extras = {} if not request.is_ajax() and hasattr(request, 'upy_context') and request.upy_context['PAGE']: context_e...
[ "def", "set_meta", "(", "request", ")", ":", "context_extras", "=", "{", "}", "if", "not", "request", ".", "is_ajax", "(", ")", "and", "hasattr", "(", "request", ",", "'upy_context'", ")", "and", "request", ".", "upy_context", "[", "'PAGE'", "]", ":", ...
This context processor returns meta informations contained in cached files. If there aren't cache it calculates dictionary to return
[ "This", "context", "processor", "returns", "meta", "informations", "contained", "in", "cached", "files", ".", "If", "there", "aren", "t", "cache", "it", "calculates", "dictionary", "to", "return" ]
train
https://github.com/20tab/twentytab-tree/blob/f2c1ced33e6c211bb52a25a7d48155e39fbdc088/tree/template_context/context_processors.py#L1-L10
necrolyte2/bootstrap_vi
bootstrap_vi.py
download_virtualenv
def download_virtualenv(version, dldir=None): ''' Download virtualenv package from pypi and return response that can be read and written to file :param str version: version to download or latest version if None :param str dldir: directory to download into or None for cwd ''' dl_url = PYPI_D...
python
def download_virtualenv(version, dldir=None): ''' Download virtualenv package from pypi and return response that can be read and written to file :param str version: version to download or latest version if None :param str dldir: directory to download into or None for cwd ''' dl_url = PYPI_D...
[ "def", "download_virtualenv", "(", "version", ",", "dldir", "=", "None", ")", ":", "dl_url", "=", "PYPI_DL_URL", ".", "format", "(", "VER", "=", "version", ")", "filename", "=", "basename", "(", "dl_url", ")", "if", "dldir", ":", "dl_path", "=", "join", ...
Download virtualenv package from pypi and return response that can be read and written to file :param str version: version to download or latest version if None :param str dldir: directory to download into or None for cwd
[ "Download", "virtualenv", "package", "from", "pypi", "and", "return", "response", "that", "can", "be", "read", "and", "written", "to", "file" ]
train
https://github.com/necrolyte2/bootstrap_vi/blob/cde96df76ecea1850cd26c2234ac13b3420d64dd/bootstrap_vi.py#L74-L91
necrolyte2/bootstrap_vi
bootstrap_vi.py
create_virtualenv
def create_virtualenv(venvpath, venvargs=None): ''' Run virtualenv from downloaded venvpath using venvargs If venvargs is None, then 'venv' will be used as the virtualenv directory :param str venvpath: Path to root downloaded virtualenv package(must contain virtualenv.py) :param list venvar...
python
def create_virtualenv(venvpath, venvargs=None): ''' Run virtualenv from downloaded venvpath using venvargs If venvargs is None, then 'venv' will be used as the virtualenv directory :param str venvpath: Path to root downloaded virtualenv package(must contain virtualenv.py) :param list venvar...
[ "def", "create_virtualenv", "(", "venvpath", ",", "venvargs", "=", "None", ")", ":", "cmd", "=", "[", "join", "(", "venvpath", ",", "'virtualenv.py'", ")", "]", "venv_path", "=", "None", "if", "venvargs", ":", "cmd", "+=", "venvargs", "venv_path", "=", "...
Run virtualenv from downloaded venvpath using venvargs If venvargs is None, then 'venv' will be used as the virtualenv directory :param str venvpath: Path to root downloaded virtualenv package(must contain virtualenv.py) :param list venvargs: Virtualenv arguments to pass to virtualenv.py
[ "Run", "virtualenv", "from", "downloaded", "venvpath", "using", "venvargs", "If", "venvargs", "is", "None", "then", "venv", "will", "be", "used", "as", "the", "virtualenv", "directory" ]
train
https://github.com/necrolyte2/bootstrap_vi/blob/cde96df76ecea1850cd26c2234ac13b3420d64dd/bootstrap_vi.py#L93-L110
necrolyte2/bootstrap_vi
bootstrap_vi.py
bootstrap_vi
def bootstrap_vi(version=None, venvargs=None): ''' Bootstrap virtualenv into current directory :param str version: Virtualenv version like 13.1.0 or None for latest version :param list venvargs: argv list for virtualenv.py or None for default ''' if not version: version = get_latest_vir...
python
def bootstrap_vi(version=None, venvargs=None): ''' Bootstrap virtualenv into current directory :param str version: Virtualenv version like 13.1.0 or None for latest version :param list venvargs: argv list for virtualenv.py or None for default ''' if not version: version = get_latest_vir...
[ "def", "bootstrap_vi", "(", "version", "=", "None", ",", "venvargs", "=", "None", ")", ":", "if", "not", "version", ":", "version", "=", "get_latest_virtualenv_version", "(", ")", "tarball", "=", "download_virtualenv", "(", "version", ")", "p", "=", "subproc...
Bootstrap virtualenv into current directory :param str version: Virtualenv version like 13.1.0 or None for latest version :param list venvargs: argv list for virtualenv.py or None for default
[ "Bootstrap", "virtualenv", "into", "current", "directory" ]
train
https://github.com/necrolyte2/bootstrap_vi/blob/cde96df76ecea1850cd26c2234ac13b3420d64dd/bootstrap_vi.py#L112-L125
edeposit/edeposit.amqp.storage
src/edeposit/amqp/storage/web_tools.py
compose_path
def compose_path(pub, uuid_url=False): """ Compose absolute path for given `pub`. Args: pub (obj): :class:`.DBPublication` instance. uuid_url (bool, default False): Compose URL using UUID. Returns: str: Absolute url-path of the publication, without server's address \ ...
python
def compose_path(pub, uuid_url=False): """ Compose absolute path for given `pub`. Args: pub (obj): :class:`.DBPublication` instance. uuid_url (bool, default False): Compose URL using UUID. Returns: str: Absolute url-path of the publication, without server's address \ ...
[ "def", "compose_path", "(", "pub", ",", "uuid_url", "=", "False", ")", ":", "if", "uuid_url", ":", "return", "join", "(", "\"/\"", ",", "UUID_DOWNLOAD_KEY", ",", "str", "(", "pub", ".", "uuid", ")", ")", "return", "join", "(", "\"/\"", ",", "DOWNLOAD_K...
Compose absolute path for given `pub`. Args: pub (obj): :class:`.DBPublication` instance. uuid_url (bool, default False): Compose URL using UUID. Returns: str: Absolute url-path of the publication, without server's address \ and protocol. Raises: PrivatePublic...
[ "Compose", "absolute", "path", "for", "given", "pub", "." ]
train
https://github.com/edeposit/edeposit.amqp.storage/blob/fb6bd326249847de04b17b64e856c878665cea92/src/edeposit/amqp/storage/web_tools.py#L31-L58
edeposit/edeposit.amqp.storage
src/edeposit/amqp/storage/web_tools.py
compose_tree_path
def compose_tree_path(tree, issn=False): """ Compose absolute path for given `tree`. Args: pub (obj): :class:`.Tree` instance. issn (bool, default False): Compose URL using ISSN. Returns: str: Absolute path of the tree, without server's address and protocol. """ if issn...
python
def compose_tree_path(tree, issn=False): """ Compose absolute path for given `tree`. Args: pub (obj): :class:`.Tree` instance. issn (bool, default False): Compose URL using ISSN. Returns: str: Absolute path of the tree, without server's address and protocol. """ if issn...
[ "def", "compose_tree_path", "(", "tree", ",", "issn", "=", "False", ")", ":", "if", "issn", ":", "return", "join", "(", "\"/\"", ",", "ISSN_DOWNLOAD_KEY", ",", "basename", "(", "tree", ".", "issn", ")", ")", "return", "join", "(", "\"/\"", ",", "PATH_D...
Compose absolute path for given `tree`. Args: pub (obj): :class:`.Tree` instance. issn (bool, default False): Compose URL using ISSN. Returns: str: Absolute path of the tree, without server's address and protocol.
[ "Compose", "absolute", "path", "for", "given", "tree", "." ]
train
https://github.com/edeposit/edeposit.amqp.storage/blob/fb6bd326249847de04b17b64e856c878665cea92/src/edeposit/amqp/storage/web_tools.py#L61-L83
edeposit/edeposit.amqp.storage
src/edeposit/amqp/storage/web_tools.py
compose_full_url
def compose_full_url(pub, uuid_url=False): """ Compose full url for given `pub`, with protocol, server's address and port. Args: pub (obj): :class:`.DBPublication` instance. uuid_url (bool, default False): Compose URL using UUID. Returns: str: Absolute url of the publication. ...
python
def compose_full_url(pub, uuid_url=False): """ Compose full url for given `pub`, with protocol, server's address and port. Args: pub (obj): :class:`.DBPublication` instance. uuid_url (bool, default False): Compose URL using UUID. Returns: str: Absolute url of the publication. ...
[ "def", "compose_full_url", "(", "pub", ",", "uuid_url", "=", "False", ")", ":", "url", "=", "compose_path", "(", "pub", ",", "uuid_url", ")", "if", "WEB_PORT", "==", "80", ":", "return", "\"%s://%s%s\"", "%", "(", "_PROTOCOL", ",", "WEB_ADDR", ",", "url"...
Compose full url for given `pub`, with protocol, server's address and port. Args: pub (obj): :class:`.DBPublication` instance. uuid_url (bool, default False): Compose URL using UUID. Returns: str: Absolute url of the publication. Raises: PrivatePublicationError: When the `p...
[ "Compose", "full", "url", "for", "given", "pub", "with", "protocol", "server", "s", "address", "and", "port", "." ]
train
https://github.com/edeposit/edeposit.amqp.storage/blob/fb6bd326249847de04b17b64e856c878665cea92/src/edeposit/amqp/storage/web_tools.py#L86-L104
edeposit/edeposit.amqp.storage
src/edeposit/amqp/storage/web_tools.py
compose_tree_url
def compose_tree_url(tree, issn_url=False): """ Compose full url for given `tree`, with protocol, server's address and port. Args: tree (obj): :class:`.Tree` instance. issn_url (bool, default False): Compose URL using ISSN. Returns: str: URL of the tree """ url = co...
python
def compose_tree_url(tree, issn_url=False): """ Compose full url for given `tree`, with protocol, server's address and port. Args: tree (obj): :class:`.Tree` instance. issn_url (bool, default False): Compose URL using ISSN. Returns: str: URL of the tree """ url = co...
[ "def", "compose_tree_url", "(", "tree", ",", "issn_url", "=", "False", ")", ":", "url", "=", "compose_tree_path", "(", "tree", ",", "issn_url", ")", "if", "WEB_PORT", "==", "80", ":", "return", "\"%s://%s%s\"", "%", "(", "_PROTOCOL", ",", "WEB_ADDR", ",", ...
Compose full url for given `tree`, with protocol, server's address and port. Args: tree (obj): :class:`.Tree` instance. issn_url (bool, default False): Compose URL using ISSN. Returns: str: URL of the tree
[ "Compose", "full", "url", "for", "given", "tree", "with", "protocol", "server", "s", "address", "and", "port", "." ]
train
https://github.com/edeposit/edeposit.amqp.storage/blob/fb6bd326249847de04b17b64e856c878665cea92/src/edeposit/amqp/storage/web_tools.py#L107-L124
ardydedase/pycouchbase
couchbase-python-cffi/couchbase_ffi/bufmanager.py
BufManager.new_cstr
def new_cstr(self, input, null_if_empty=True): """ Converts the input into an encoded C String (NUL-terminated) :param input: The python string :param null_if_empty: If the input is empty, return NULL rather than the empty string :return: The C string """ ...
python
def new_cstr(self, input, null_if_empty=True): """ Converts the input into an encoded C String (NUL-terminated) :param input: The python string :param null_if_empty: If the input is empty, return NULL rather than the empty string :return: The C string """ ...
[ "def", "new_cstr", "(", "self", ",", "input", ",", "null_if_empty", "=", "True", ")", ":", "if", "input", ":", "enc", "=", "input", ".", "encode", "(", "'utf-8'", ")", "else", ":", "enc", "=", "''", ".", "encode", "(", "'utf-8'", ")", "if", "not", ...
Converts the input into an encoded C String (NUL-terminated) :param input: The python string :param null_if_empty: If the input is empty, return NULL rather than the empty string :return: The C string
[ "Converts", "the", "input", "into", "an", "encoded", "C", "String", "(", "NUL", "-", "terminated", ")", ":", "param", "input", ":", "The", "python", "string", ":", "param", "null_if_empty", ":", "If", "the", "input", "is", "empty", "return", "NULL", "rat...
train
https://github.com/ardydedase/pycouchbase/blob/6f010b4d2ef41aead2366878d0cf0b1284c0db0e/couchbase-python-cffi/couchbase_ffi/bufmanager.py#L18-L38
ardydedase/pycouchbase
couchbase-python-cffi/couchbase_ffi/bufmanager.py
BufManager.new_cbuf
def new_cbuf(self, input, null_if_empty=True): """ Converts the input into a raw C buffer :param input: The input :param null_if_empty: If the input is empty :return: A tuple of buffer,length """ if not isinstance(input, bytes) and input: input = input...
python
def new_cbuf(self, input, null_if_empty=True): """ Converts the input into a raw C buffer :param input: The input :param null_if_empty: If the input is empty :return: A tuple of buffer,length """ if not isinstance(input, bytes) and input: input = input...
[ "def", "new_cbuf", "(", "self", ",", "input", ",", "null_if_empty", "=", "True", ")", ":", "if", "not", "isinstance", "(", "input", ",", "bytes", ")", "and", "input", ":", "input", "=", "input", ".", "encode", "(", "'utf-8'", ")", "if", "not", "input...
Converts the input into a raw C buffer :param input: The input :param null_if_empty: If the input is empty :return: A tuple of buffer,length
[ "Converts", "the", "input", "into", "a", "raw", "C", "buffer", ":", "param", "input", ":", "The", "input", ":", "param", "null_if_empty", ":", "If", "the", "input", "is", "empty", ":", "return", ":", "A", "tuple", "of", "buffer", "length" ]
train
https://github.com/ardydedase/pycouchbase/blob/6f010b4d2ef41aead2366878d0cf0b1284c0db0e/couchbase-python-cffi/couchbase_ffi/bufmanager.py#L40-L54
eallik/spinoff
spinoff/util/meta.py
profile
def profile(func): """ Simple profile decorator, monitors method execution time """ @inlineCallbacks def callme(*args, **kwargs): start = time.time() ret = yield func(*args, **kwargs) time_to_execute = time.time() - start log.msg('%s executed in %.3f seconds' % (func....
python
def profile(func): """ Simple profile decorator, monitors method execution time """ @inlineCallbacks def callme(*args, **kwargs): start = time.time() ret = yield func(*args, **kwargs) time_to_execute = time.time() - start log.msg('%s executed in %.3f seconds' % (func....
[ "def", "profile", "(", "func", ")", ":", "@", "inlineCallbacks", "def", "callme", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "start", "=", "time", ".", "time", "(", ")", "ret", "=", "yield", "func", "(", "*", "args", ",", "*", "*", "k...
Simple profile decorator, monitors method execution time
[ "Simple", "profile", "decorator", "monitors", "method", "execution", "time" ]
train
https://github.com/eallik/spinoff/blob/06b00d6b86c7422c9cb8f9a4b2915906e92b7d52/spinoff/util/meta.py#L9-L20
stain/forgetSQL
lib/forgetSQL.py
prepareClasses
def prepareClasses(locals): """Fix _userClasses and some stuff in classes. Traverses locals, which is a locals() dictionary from the namespace where Forgetter subclasses have been defined, and resolves names in _userClasses to real class-references. Normally you would call forgettSQL.prepareCl...
python
def prepareClasses(locals): """Fix _userClasses and some stuff in classes. Traverses locals, which is a locals() dictionary from the namespace where Forgetter subclasses have been defined, and resolves names in _userClasses to real class-references. Normally you would call forgettSQL.prepareCl...
[ "def", "prepareClasses", "(", "locals", ")", ":", "for", "(", "name", ",", "forgetter", ")", "in", "locals", ".", "items", "(", ")", ":", "if", "not", "(", "type", "(", "forgetter", ")", "is", "types", ".", "TypeType", "and", "issubclass", "(", "forg...
Fix _userClasses and some stuff in classes. Traverses locals, which is a locals() dictionary from the namespace where Forgetter subclasses have been defined, and resolves names in _userClasses to real class-references. Normally you would call forgettSQL.prepareClasses(locals()) after defining ...
[ "Fix", "_userClasses", "and", "some", "stuff", "in", "classes", "." ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L959-L998
stain/forgetSQL
lib/forgetSQL.py
generateFromTables
def generateFromTables(tables, cursor, getLinks=1, code=0): """Generates python code (or class objects if code is false) based on SQL queries on the table names given in the list tables. code -- if given -- should be an dictionary containing these keys to be inserted into generated code: '...
python
def generateFromTables(tables, cursor, getLinks=1, code=0): """Generates python code (or class objects if code is false) based on SQL queries on the table names given in the list tables. code -- if given -- should be an dictionary containing these keys to be inserted into generated code: '...
[ "def", "generateFromTables", "(", "tables", ",", "cursor", ",", "getLinks", "=", "1", ",", "code", "=", "0", ")", ":", "curs", "=", "cursor", "(", ")", "forgetters", "=", "{", "}", "class", "_Wrapper", "(", "forgetSQL", ".", "Forgetter", ")", ":", "_...
Generates python code (or class objects if code is false) based on SQL queries on the table names given in the list tables. code -- if given -- should be an dictionary containing these keys to be inserted into generated code: 'database': database name 'module': database module nam...
[ "Generates", "python", "code", "(", "or", "class", "objects", "if", "code", "is", "false", ")", "based", "on", "SQL", "queries", "on", "the", "table", "names", "given", "in", "the", "list", "tables", "." ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L1001-L1122
stain/forgetSQL
lib/forgetSQL.py
Forgetter._setID
def _setID(self, id): """Set the ID, ie. the values for primary keys. id can be either a list, following the _sqlPrimary, or some other type, that will be set as the singleton ID (requires 1-length sqlPrimary). """ if type(id) in (types.ListType, types.TupleType): ...
python
def _setID(self, id): """Set the ID, ie. the values for primary keys. id can be either a list, following the _sqlPrimary, or some other type, that will be set as the singleton ID (requires 1-length sqlPrimary). """ if type(id) in (types.ListType, types.TupleType): ...
[ "def", "_setID", "(", "self", ",", "id", ")", ":", "if", "type", "(", "id", ")", "in", "(", "types", ".", "ListType", ",", "types", ".", "TupleType", ")", ":", "try", ":", "for", "key", "in", "self", ".", "_sqlPrimary", ":", "value", "=", "id", ...
Set the ID, ie. the values for primary keys. id can be either a list, following the _sqlPrimary, or some other type, that will be set as the singleton ID (requires 1-length sqlPrimary).
[ "Set", "the", "ID", "ie", ".", "the", "values", "for", "primary", "keys", "." ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L279-L300
stain/forgetSQL
lib/forgetSQL.py
Forgetter._getID
def _getID(self): """Get the ID values as a tuple annotated by sqlPrimary""" id = [] for key in self._sqlPrimary: value = self.__dict__[key] if isinstance(value, Forgetter): # It's another object, we store only the ID if value._new: ...
python
def _getID(self): """Get the ID values as a tuple annotated by sqlPrimary""" id = [] for key in self._sqlPrimary: value = self.__dict__[key] if isinstance(value, Forgetter): # It's another object, we store only the ID if value._new: ...
[ "def", "_getID", "(", "self", ")", ":", "id", "=", "[", "]", "for", "key", "in", "self", ".", "_sqlPrimary", ":", "value", "=", "self", ".", "__dict__", "[", "key", "]", "if", "isinstance", "(", "value", ",", "Forgetter", ")", ":", "# It's another ob...
Get the ID values as a tuple annotated by sqlPrimary
[ "Get", "the", "ID", "values", "as", "a", "tuple", "annotated", "by", "sqlPrimary" ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L302-L317
stain/forgetSQL
lib/forgetSQL.py
Forgetter._resetID
def _resetID(self): """Reset all ID fields.""" # Dirty.. .=)) self._setID((None,) * len(self._sqlPrimary)) self._new = True
python
def _resetID(self): """Reset all ID fields.""" # Dirty.. .=)) self._setID((None,) * len(self._sqlPrimary)) self._new = True
[ "def", "_resetID", "(", "self", ")", ":", "# Dirty.. .=))", "self", ".", "_setID", "(", "(", "None", ",", ")", "*", "len", "(", "self", ".", "_sqlPrimary", ")", ")", "self", ".", "_new", "=", "True" ]
Reset all ID fields.
[ "Reset", "all", "ID", "fields", "." ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L319-L323
stain/forgetSQL
lib/forgetSQL.py
Forgetter._checkTable
def _checkTable(cls, field): """Split a field from _sqlFields into table, column. Registers the table in cls._tables, and returns a fully qualified table.column (default table: cls._sqlTable) """ # Get table part try: (table, field) = field.split('.') ...
python
def _checkTable(cls, field): """Split a field from _sqlFields into table, column. Registers the table in cls._tables, and returns a fully qualified table.column (default table: cls._sqlTable) """ # Get table part try: (table, field) = field.split('.') ...
[ "def", "_checkTable", "(", "cls", ",", "field", ")", ":", "# Get table part", "try", ":", "(", "table", ",", "field", ")", "=", "field", ".", "split", "(", "'.'", ")", "except", "ValueError", ":", "table", "=", "cls", ".", "_sqlTable", "# clean away whit...
Split a field from _sqlFields into table, column. Registers the table in cls._tables, and returns a fully qualified table.column (default table: cls._sqlTable)
[ "Split", "a", "field", "from", "_sqlFields", "into", "table", "column", "." ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L381-L398
stain/forgetSQL
lib/forgetSQL.py
Forgetter.reset
def reset(self): """Reset all fields, almost like creating a new object. Note: Forgets changes you have made not saved to database! (Remember: Others might reference the object already, expecting something else!) Override this method if you add properties not defined in _sqlFiel...
python
def reset(self): """Reset all fields, almost like creating a new object. Note: Forgets changes you have made not saved to database! (Remember: Others might reference the object already, expecting something else!) Override this method if you add properties not defined in _sqlFiel...
[ "def", "reset", "(", "self", ")", ":", "self", ".", "_resetID", "(", ")", "self", ".", "_new", "=", "None", "self", ".", "_updated", "=", "None", "self", ".", "_changed", "=", "None", "self", ".", "_values", "=", "{", "}", "# initially create fields", ...
Reset all fields, almost like creating a new object. Note: Forgets changes you have made not saved to database! (Remember: Others might reference the object already, expecting something else!) Override this method if you add properties not defined in _sqlFields.
[ "Reset", "all", "fields", "almost", "like", "creating", "a", "new", "object", "." ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L402-L417
stain/forgetSQL
lib/forgetSQL.py
Forgetter.load
def load(self, id=None): """Load from database. Old values will be discarded.""" if id is not None: # We are asked to change our ID to something else self.reset() self._setID(id) if not self._new and self._validID(): self._loadDB() self._up...
python
def load(self, id=None): """Load from database. Old values will be discarded.""" if id is not None: # We are asked to change our ID to something else self.reset() self._setID(id) if not self._new and self._validID(): self._loadDB() self._up...
[ "def", "load", "(", "self", ",", "id", "=", "None", ")", ":", "if", "id", "is", "not", "None", ":", "# We are asked to change our ID to something else", "self", ".", "reset", "(", ")", "self", ".", "_setID", "(", "id", ")", "if", "not", "self", ".", "_...
Load from database. Old values will be discarded.
[ "Load", "from", "database", ".", "Old", "values", "will", "be", "discarded", "." ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L419-L427
stain/forgetSQL
lib/forgetSQL.py
Forgetter.save
def save(self): """Save to database if anything has changed since last load""" if ( self._new or (self._validID() and self._changed) or (self._updated and self._changed > self._updated) ): # Don't save if we have not loaded existing data! self._saveDB() ...
python
def save(self): """Save to database if anything has changed since last load""" if ( self._new or (self._validID() and self._changed) or (self._updated and self._changed > self._updated) ): # Don't save if we have not loaded existing data! self._saveDB() ...
[ "def", "save", "(", "self", ")", ":", "if", "(", "self", ".", "_new", "or", "(", "self", ".", "_validID", "(", ")", "and", "self", ".", "_changed", ")", "or", "(", "self", ".", "_updated", "and", "self", ".", "_changed", ">", "self", ".", "_updat...
Save to database if anything has changed since last load
[ "Save", "to", "database", "if", "anything", "has", "changed", "since", "last", "load" ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L429-L437
stain/forgetSQL
lib/forgetSQL.py
Forgetter.delete
def delete(self): """Mark this object for deletion in the database. The object will then be reset and ready for use again with a new id. """ (sql, ) = self._prepareSQL("DELETE") curs = self.cursor() curs.execute(sql, self._getID()) curs.close() se...
python
def delete(self): """Mark this object for deletion in the database. The object will then be reset and ready for use again with a new id. """ (sql, ) = self._prepareSQL("DELETE") curs = self.cursor() curs.execute(sql, self._getID()) curs.close() se...
[ "def", "delete", "(", "self", ")", ":", "(", "sql", ",", ")", "=", "self", ".", "_prepareSQL", "(", "\"DELETE\"", ")", "curs", "=", "self", ".", "cursor", "(", ")", "curs", ".", "execute", "(", "sql", ",", "self", ".", "_getID", "(", ")", ")", ...
Mark this object for deletion in the database. The object will then be reset and ready for use again with a new id.
[ "Mark", "this", "object", "for", "deletion", "in", "the", "database", "." ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L439-L449
stain/forgetSQL
lib/forgetSQL.py
Forgetter._prepareSQL
def _prepareSQL(cls, operation="SELECT", where=None, selectfields=None, orderBy=None): """Return a sql for the given operation. Possible operations: SELECT read data for this id SELECTALL read data for all ids INSERT insert data, create new id ...
python
def _prepareSQL(cls, operation="SELECT", where=None, selectfields=None, orderBy=None): """Return a sql for the given operation. Possible operations: SELECT read data for this id SELECTALL read data for all ids INSERT insert data, create new id ...
[ "def", "_prepareSQL", "(", "cls", ",", "operation", "=", "\"SELECT\"", ",", "where", "=", "None", ",", "selectfields", "=", "None", ",", "orderBy", "=", "None", ")", ":", "# Normalize parameter for later comparissions", "operation", "=", "operation", ".", "upper...
Return a sql for the given operation. Possible operations: SELECT read data for this id SELECTALL read data for all ids INSERT insert data, create new id UPDATE update data for this id DELETE remove data for this id ...
[ "Return", "a", "sql", "for", "the", "given", "operation", "." ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L451-L604
stain/forgetSQL
lib/forgetSQL.py
Forgetter._nextSequence
def _nextSequence(cls, name=None): """Return a new sequence number for insertion in self._sqlTable. Note that if your sequences are not named tablename_primarykey_seq (ie. for table 'blapp' with primary key 'john_id', sequence name blapp_john_id_seq) you must give the full se...
python
def _nextSequence(cls, name=None): """Return a new sequence number for insertion in self._sqlTable. Note that if your sequences are not named tablename_primarykey_seq (ie. for table 'blapp' with primary key 'john_id', sequence name blapp_john_id_seq) you must give the full se...
[ "def", "_nextSequence", "(", "cls", ",", "name", "=", "None", ")", ":", "if", "not", "name", ":", "name", "=", "cls", ".", "_sqlSequence", "if", "not", "name", ":", "# Assume it's tablename_primarykey_seq", "if", "len", "(", "cls", ".", "_sqlPrimary", ")",...
Return a new sequence number for insertion in self._sqlTable. Note that if your sequences are not named tablename_primarykey_seq (ie. for table 'blapp' with primary key 'john_id', sequence name blapp_john_id_seq) you must give the full sequence name as an optional argument to _nextSe...
[ "Return", "a", "new", "sequence", "number", "for", "insertion", "in", "self", ".", "_sqlTable", "." ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L608-L629
stain/forgetSQL
lib/forgetSQL.py
Forgetter._loadFromRow
def _loadFromRow(self, result, fields, cursor): """Load from a database row, described by fields. ``fields`` should be the attribute names that will be set. Note that userclasses will be created (but not loaded). """ position = 0 for elem in fields: v...
python
def _loadFromRow(self, result, fields, cursor): """Load from a database row, described by fields. ``fields`` should be the attribute names that will be set. Note that userclasses will be created (but not loaded). """ position = 0 for elem in fields: v...
[ "def", "_loadFromRow", "(", "self", ",", "result", ",", "fields", ",", "cursor", ")", ":", "position", "=", "0", "for", "elem", "in", "fields", ":", "value", "=", "result", "[", "position", "]", "valueType", "=", "cursor", ".", "description", "[", "pos...
Load from a database row, described by fields. ``fields`` should be the attribute names that will be set. Note that userclasses will be created (but not loaded).
[ "Load", "from", "a", "database", "row", "described", "by", "fields", "." ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L633-L655
stain/forgetSQL
lib/forgetSQL.py
Forgetter._loadDB
def _loadDB(self): """Connect to the database to load myself""" if not self._validID(): raise NotFound, self._getID() (sql, fields) = self._prepareSQL("SELECT") curs = self.cursor() curs.execute(sql, self._getID()) result = curs.fetchone() if not resul...
python
def _loadDB(self): """Connect to the database to load myself""" if not self._validID(): raise NotFound, self._getID() (sql, fields) = self._prepareSQL("SELECT") curs = self.cursor() curs.execute(sql, self._getID()) result = curs.fetchone() if not resul...
[ "def", "_loadDB", "(", "self", ")", ":", "if", "not", "self", ".", "_validID", "(", ")", ":", "raise", "NotFound", ",", "self", ".", "_getID", "(", ")", "(", "sql", ",", "fields", ")", "=", "self", ".", "_prepareSQL", "(", "\"SELECT\"", ")", "curs"...
Connect to the database to load myself
[ "Connect", "to", "the", "database", "to", "load", "myself" ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L657-L670
stain/forgetSQL
lib/forgetSQL.py
Forgetter._saveDB
def _saveDB(self): """Insert or update into the database. Note that every field will be updated, not just the changed one. """ # We're a "fresh" copy now self._updated = time.time() if self._new: operation = 'INSERT' if not self._validID()...
python
def _saveDB(self): """Insert or update into the database. Note that every field will be updated, not just the changed one. """ # We're a "fresh" copy now self._updated = time.time() if self._new: operation = 'INSERT' if not self._validID()...
[ "def", "_saveDB", "(", "self", ")", ":", "# We're a \"fresh\" copy now", "self", ".", "_updated", "=", "time", ".", "time", "(", ")", "if", "self", ".", "_new", ":", "operation", "=", "'INSERT'", "if", "not", "self", ".", "_validID", "(", ")", ":", "se...
Insert or update into the database. Note that every field will be updated, not just the changed one.
[ "Insert", "or", "update", "into", "the", "database", "." ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L672-L728
stain/forgetSQL
lib/forgetSQL.py
Forgetter.getAll
def getAll(cls, where=None, orderBy=None): """Retrieve all the objects. If a list of ``where`` clauses are given, they will be AND-ed and will limit the search. This will not load everything out from the database, but will create a large amount of objects with only the ID inser...
python
def getAll(cls, where=None, orderBy=None): """Retrieve all the objects. If a list of ``where`` clauses are given, they will be AND-ed and will limit the search. This will not load everything out from the database, but will create a large amount of objects with only the ID inser...
[ "def", "getAll", "(", "cls", ",", "where", "=", "None", ",", "orderBy", "=", "None", ")", ":", "ids", "=", "cls", ".", "getAllIDs", "(", "where", ",", "orderBy", "=", "orderBy", ")", "# Instansiate a lot of them", "if", "len", "(", "cls", ".", "_sqlPri...
Retrieve all the objects. If a list of ``where`` clauses are given, they will be AND-ed and will limit the search. This will not load everything out from the database, but will create a large amount of objects with only the ID inserted. The data will be loaded from the objects...
[ "Retrieve", "all", "the", "objects", "." ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L730-L746
stain/forgetSQL
lib/forgetSQL.py
Forgetter.getAllIterator
def getAllIterator(cls, where=None, buffer=100, useObject=None, orderBy=None): """Retrieve every object as an iterator. Possibly limitted by the where list of clauses that will be AND-ed. Since an iterator is returned, only ``buffer`` rows are l...
python
def getAllIterator(cls, where=None, buffer=100, useObject=None, orderBy=None): """Retrieve every object as an iterator. Possibly limitted by the where list of clauses that will be AND-ed. Since an iterator is returned, only ``buffer`` rows are l...
[ "def", "getAllIterator", "(", "cls", ",", "where", "=", "None", ",", "buffer", "=", "100", ",", "useObject", "=", "None", ",", "orderBy", "=", "None", ")", ":", "(", "sql", ",", "fields", ")", "=", "cls", ".", "_prepareSQL", "(", "\"SELECTALL\"", ","...
Retrieve every object as an iterator. Possibly limitted by the where list of clauses that will be AND-ed. Since an iterator is returned, only ``buffer`` rows are loaded from the database at once. This is useful if you need to process all objects. If useObject is given,...
[ "Retrieve", "every", "object", "as", "an", "iterator", "." ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L751-L797
stain/forgetSQL
lib/forgetSQL.py
Forgetter.getAllIDs
def getAllIDs(cls, where=None, orderBy=None): """Retrive all the IDs, possibly matching the where clauses. Where should be some list of where clauses that will be joined with AND). Note that the result might be tuples if this table has a multivalue _sqlPrimary. """ (sql,...
python
def getAllIDs(cls, where=None, orderBy=None): """Retrive all the IDs, possibly matching the where clauses. Where should be some list of where clauses that will be joined with AND). Note that the result might be tuples if this table has a multivalue _sqlPrimary. """ (sql,...
[ "def", "getAllIDs", "(", "cls", ",", "where", "=", "None", ",", "orderBy", "=", "None", ")", ":", "(", "sql", ",", "fields", ")", "=", "cls", ".", "_prepareSQL", "(", "\"SELECTALL\"", ",", "where", ",", "cls", ".", "_sqlPrimary", ",", "orderBy", "=",...
Retrive all the IDs, possibly matching the where clauses. Where should be some list of where clauses that will be joined with AND). Note that the result might be tuples if this table has a multivalue _sqlPrimary.
[ "Retrive", "all", "the", "IDs", "possibly", "matching", "the", "where", "clauses", "." ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L801-L824
stain/forgetSQL
lib/forgetSQL.py
Forgetter.getAllText
def getAllText(cls, where=None, SEPERATOR=' ', orderBy=None): """Retrieve a list of of all possible instances of this class. The list is composed of tuples in the format (id, description) - where description is a string composed by the fields from cls._shortView, joint with SEPERATOR. ...
python
def getAllText(cls, where=None, SEPERATOR=' ', orderBy=None): """Retrieve a list of of all possible instances of this class. The list is composed of tuples in the format (id, description) - where description is a string composed by the fields from cls._shortView, joint with SEPERATOR. ...
[ "def", "getAllText", "(", "cls", ",", "where", "=", "None", ",", "SEPERATOR", "=", "' '", ",", "orderBy", "=", "None", ")", ":", "(", "sql", ",", "fields", ")", "=", "cls", ".", "_prepareSQL", "(", "\"SELECTALL\"", ",", "where", ",", "orderBy", "=", ...
Retrieve a list of of all possible instances of this class. The list is composed of tuples in the format (id, description) - where description is a string composed by the fields from cls._shortView, joint with SEPERATOR.
[ "Retrieve", "a", "list", "of", "of", "all", "possible", "instances", "of", "this", "class", "." ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L828-L852
stain/forgetSQL
lib/forgetSQL.py
Forgetter.getChildren
def getChildren(self, forgetter, field=None, where=None, orderBy=None): """Return the children that links to me. That means that I have to be listed in their _userClasses somehow. If field is specified, that field in my children is used as the pointer to me. Use this if you have multipl...
python
def getChildren(self, forgetter, field=None, where=None, orderBy=None): """Return the children that links to me. That means that I have to be listed in their _userClasses somehow. If field is specified, that field in my children is used as the pointer to me. Use this if you have multipl...
[ "def", "getChildren", "(", "self", ",", "forgetter", ",", "field", "=", "None", ",", "where", "=", "None", ",", "orderBy", "=", "None", ")", ":", "if", "type", "(", "where", ")", "in", "(", "types", ".", "StringType", ",", "types", ".", "UnicodeType"...
Return the children that links to me. That means that I have to be listed in their _userClasses somehow. If field is specified, that field in my children is used as the pointer to me. Use this if you have multiple fields referring to my class.
[ "Return", "the", "children", "that", "links", "to", "me", "." ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L856-L880
stain/forgetSQL
lib/forgetSQL.py
MysqlForgetter._saveDB
def _saveDB(self): """Overloaded - we don't have nextval() in mysql""" # We're a "fresh" copy now self._updated = time.time() if self._new: operation = 'INSERT' else: operation = 'UPDATE' (sql, fields) = self._prepareSQL(operation) values =...
python
def _saveDB(self): """Overloaded - we don't have nextval() in mysql""" # We're a "fresh" copy now self._updated = time.time() if self._new: operation = 'INSERT' else: operation = 'UPDATE' (sql, fields) = self._prepareSQL(operation) values =...
[ "def", "_saveDB", "(", "self", ")", ":", "# We're a \"fresh\" copy now", "self", ".", "_updated", "=", "time", ".", "time", "(", ")", "if", "self", ".", "_new", ":", "operation", "=", "'INSERT'", "else", ":", "operation", "=", "'UPDATE'", "(", "sql", ","...
Overloaded - we don't have nextval() in mysql
[ "Overloaded", "-", "we", "don", "t", "have", "nextval", "()", "in", "mysql" ]
train
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L925-L957