hexsha
stringlengths
40
40
repo
stringlengths
7
114
path
stringlengths
4
124
license
listlengths
1
9
language
stringclasses
1 value
identifier
stringlengths
1
71
return_type
stringlengths
1
749
⌀
original_string
stringlengths
76
22.7k
original_docstring
stringlengths
16
7.61k
docstring
stringlengths
16
2.47k
docstring_tokens
listlengths
6
477
code
stringlengths
14
10.2k
code_tokens
listlengths
6
996
short_docstring
stringlengths
2
644
short_docstring_tokens
listlengths
1
116
comment
listlengths
1
89
parameters
listlengths
0
64
docstring_params
dict
06567899dc23243b653f3c75f5b3d9a486f85bf6
robertobressani/siren_sr
utils/data_utils.py
[ "MIT" ]
Python
compute_image_laplacian
<not_specific>
def compute_image_laplacian(img): """ Function to compute the laplacian of an image using Laplacian filter :param img: CxHxW Tensor :return: CxHxW Tensor """ img = laplacian(img.unsqueeze(0), 3, normalized=False) # adding 1 dimension required by kornia library return img[0]
Function to compute the laplacian of an image using Laplacian filter :param img: CxHxW Tensor :return: CxHxW Tensor
Function to compute the laplacian of an image using Laplacian filter
[ "Function", "to", "compute", "the", "laplacian", "of", "an", "image", "using", "Laplacian", "filter" ]
def compute_image_laplacian(img): img = laplacian(img.unsqueeze(0), 3, normalized=False) return img[0]
[ "def", "compute_image_laplacian", "(", "img", ")", ":", "img", "=", "laplacian", "(", "img", ".", "unsqueeze", "(", "0", ")", ",", "3", ",", "normalized", "=", "False", ")", "return", "img", "[", "0", "]" ]
Function to compute the laplacian of an image using Laplacian filter
[ "Function", "to", "compute", "the", "laplacian", "of", "an", "image", "using", "Laplacian", "filter" ]
[ "\"\"\"\n Function to compute the laplacian of an image using Laplacian filter\n :param img: CxHxW Tensor\n :return: CxHxW Tensor\n \"\"\"", "# adding 1 dimension required by kornia library" ]
[ { "param": "img", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "img", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "...
06567899dc23243b653f3c75f5b3d9a486f85bf6
robertobressani/siren_sr
utils/data_utils.py
[ "MIT" ]
Python
shift
<not_specific>
def shift(model_output, gt, grad=False): """ Shift model output to have the same mean of gt :param model_output: :param gt: :param grad: :return: """ if not grad: mean_diff = torch.mean(model_output, dim=[-2]).detach() - torch.mean(gt, dim=[-2]) else: mean_diff = torc...
Shift model output to have the same mean of gt :param model_output: :param gt: :param grad: :return:
Shift model output to have the same mean of gt
[ "Shift", "model", "output", "to", "have", "the", "same", "mean", "of", "gt" ]
def shift(model_output, gt, grad=False): if not grad: mean_diff = torch.mean(model_output, dim=[-2]).detach() - torch.mean(gt, dim=[-2]) else: mean_diff = torch.mean(model_output, dim=[-3, -2]).detach() - torch.mean(gt, dim=[-3, -2]) return model_output - mean_diff
[ "def", "shift", "(", "model_output", ",", "gt", ",", "grad", "=", "False", ")", ":", "if", "not", "grad", ":", "mean_diff", "=", "torch", ".", "mean", "(", "model_output", ",", "dim", "=", "[", "-", "2", "]", ")", ".", "detach", "(", ")", "-", ...
Shift model output to have the same mean of gt
[ "Shift", "model", "output", "to", "have", "the", "same", "mean", "of", "gt" ]
[ "\"\"\"\n Shift model output to have the same mean of gt\n :param model_output:\n :param gt:\n :param grad:\n :return:\n \"\"\"" ]
[ { "param": "model_output", "type": null }, { "param": "gt", "type": null }, { "param": "grad", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "model_output", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null...
06567899dc23243b653f3c75f5b3d9a486f85bf6
robertobressani/siren_sr
utils/data_utils.py
[ "MIT" ]
Python
plot_all_activations_and_grads
null
def plot_all_activations_and_grads(activations): """ Plot all activations and grads of the network :param activations: :return: """ num_cols = 4 num_rows = len(activations) fig_width = 6 fig_height = num_rows * fig_width / num_cols fontsize = 5 fig, axs = plt.subplots(num_...
Plot all activations and grads of the network :param activations: :return:
Plot all activations and grads of the network
[ "Plot", "all", "activations", "and", "grads", "of", "the", "network" ]
def plot_all_activations_and_grads(activations): num_cols = 4 num_rows = len(activations) fig_width = 6 fig_height = num_rows * fig_width / num_cols fontsize = 5 fig, axs = plt.subplots(num_rows, num_cols, gridspec_kw={'hspace': 0.5, 'wspace': 0.4}, figsize=(fig_width...
[ "def", "plot_all_activations_and_grads", "(", "activations", ")", ":", "num_cols", "=", "4", "num_rows", "=", "len", "(", "activations", ")", "fig_width", "=", "6", "fig_height", "=", "num_rows", "*", "fig_width", "/", "num_cols", "fontsize", "=", "5", "fig", ...
Plot all activations and grads of the network
[ "Plot", "all", "activations", "and", "grads", "of", "the", "network" ]
[ "\"\"\"\n Plot all activations and grads of the network\n :param activations:\n :return:\n \"\"\"", "# (1, num_points, 256)" ]
[ { "param": "activations", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "activations", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null,...
2b53602343ab50935a7947e92aa1ce4179742600
robertobressani/siren_sr
core/network.py
[ "MIT" ]
Python
forward_with_activations
<not_specific>
def forward_with_activations(self, coords, retain_grad=False): '''Returns not only model output, but also intermediate activations. Only used for visualizing activations later!''' activations = OrderedDict() activation_count = 0 x = coords.clone().detach().requires_grad_(True) ...
Returns not only model output, but also intermediate activations. Only used for visualizing activations later!
Returns not only model output, but also intermediate activations. Only used for visualizing activations later!
[ "Returns", "not", "only", "model", "output", "but", "also", "intermediate", "activations", ".", "Only", "used", "for", "visualizing", "activations", "later!" ]
def forward_with_activations(self, coords, retain_grad=False): activations = OrderedDict() activation_count = 0 x = coords.clone().detach().requires_grad_(True) activations['input'] = x for i, layer in enumerate(self.net): if isinstance(layer, SineLayer) or isinstance...
[ "def", "forward_with_activations", "(", "self", ",", "coords", ",", "retain_grad", "=", "False", ")", ":", "activations", "=", "OrderedDict", "(", ")", "activation_count", "=", "0", "x", "=", "coords", ".", "clone", "(", ")", ".", "detach", "(", ")", "."...
Returns not only model output, but also intermediate activations.
[ "Returns", "not", "only", "model", "output", "but", "also", "intermediate", "activations", "." ]
[ "'''Returns not only model output, but also intermediate activations.\n Only used for visualizing activations later!'''" ]
[ { "param": "self", "type": null }, { "param": "coords", "type": null }, { "param": "retain_grad", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "coords", "type": null, "docstring": null, "docstring_tokens":...
afc92008cb8cf56d1ac12f73ca0662adc6341c8f
nickanderson/cf-bottom_self
tom/git.py
[ "MIT" ]
Python
run_command
<not_specific>
def run_command(self, *command, **kwargs): """Runs a git command against git repo. Syntaxically this function tries to be as close to subprocess.run as possible, just adding 'git' with some extra parameters in the beginning """ git_command = [ 'git', '-C', self.dirnam...
Runs a git command against git repo. Syntaxically this function tries to be as close to subprocess.run as possible, just adding 'git' with some extra parameters in the beginning
Runs a git command against git repo. Syntaxically this function tries to be as close to subprocess.run as possible, just adding 'git' with some extra parameters in the beginning
[ "Runs", "a", "git", "command", "against", "git", "repo", ".", "Syntaxically", "this", "function", "tries", "to", "be", "as", "close", "to", "subprocess", ".", "run", "as", "possible", "just", "adding", "'", "git", "'", "with", "some", "extra", "parameters"...
def run_command(self, *command, **kwargs): git_command = [ 'git', '-C', self.dirname, '-c', 'user.name=' + self.username, '-c', 'user.email=' + self.usermail, '-c', 'push.default=simple' ] git_command.extend(command) if 'check' not in kwargs: kwargs['c...
[ "def", "run_command", "(", "self", ",", "*", "command", ",", "**", "kwargs", ")", ":", "git_command", "=", "[", "'git'", ",", "'-C'", ",", "self", ".", "dirname", ",", "'-c'", ",", "'user.name='", "+", "self", ".", "username", ",", "'-c'", ",", "'use...
Runs a git command against git repo.
[ "Runs", "a", "git", "command", "against", "git", "repo", "." ]
[ "\"\"\"Runs a git command against git repo.\n Syntaxically this function tries to be as close to subprocess.run\n as possible, just adding 'git' with some extra parameters in the beginning\n \"\"\"", "# we can't `cd` to target folder when it does not exist yet,", "# so delete `-C self.dirna...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
afc92008cb8cf56d1ac12f73ca0662adc6341c8f
nickanderson/cf-bottom_self
tom/git.py
[ "MIT" ]
Python
checkout
null
def checkout(self, branch, new=False): """Checkout given branch, optionally creating it. Note that it's an error to create-and-checkout branch which already exists. """ if new: self.run_command('checkout', '-b', branch) else: self.run_command('checkout', b...
Checkout given branch, optionally creating it. Note that it's an error to create-and-checkout branch which already exists.
Checkout given branch, optionally creating it. Note that it's an error to create-and-checkout branch which already exists.
[ "Checkout", "given", "branch", "optionally", "creating", "it", ".", "Note", "that", "it", "'", "s", "an", "error", "to", "create", "-", "and", "-", "checkout", "branch", "which", "already", "exists", "." ]
def checkout(self, branch, new=False): if new: self.run_command('checkout', '-b', branch) else: self.run_command('checkout', branch) self.run_command('reset', '--hard', 'origin/' + branch)
[ "def", "checkout", "(", "self", ",", "branch", ",", "new", "=", "False", ")", ":", "if", "new", ":", "self", ".", "run_command", "(", "'checkout'", ",", "'-b'", ",", "branch", ")", "else", ":", "self", ".", "run_command", "(", "'checkout'", ",", "bra...
Checkout given branch, optionally creating it.
[ "Checkout", "given", "branch", "optionally", "creating", "it", "." ]
[ "\"\"\"Checkout given branch, optionally creating it.\n Note that it's an error to create-and-checkout branch which already exists.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "branch", "type": null }, { "param": "new", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "branch", "type": null, "docstring": null, "docstring_tokens":...
afc92008cb8cf56d1ac12f73ca0662adc6341c8f
nickanderson/cf-bottom_self
tom/git.py
[ "MIT" ]
Python
put_file
null
def put_file(self, path, data, add=True): """Overwrites file with data, optionally running `git add {path}` afterwards""" with open(self.dirname + '/' + path, 'w') as f: f.write(data) if add: self.run_command('add', path)
Overwrites file with data, optionally running `git add {path}` afterwards
Overwrites file with data, optionally running `git add {path}` afterwards
[ "Overwrites", "file", "with", "data", "optionally", "running", "`", "git", "add", "{", "path", "}", "`", "afterwards" ]
def put_file(self, path, data, add=True): with open(self.dirname + '/' + path, 'w') as f: f.write(data) if add: self.run_command('add', path)
[ "def", "put_file", "(", "self", ",", "path", ",", "data", ",", "add", "=", "True", ")", ":", "with", "open", "(", "self", ".", "dirname", "+", "'/'", "+", "path", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "data", ")", "if", "ad...
Overwrites file with data, optionally running `git add {path}` afterwards
[ "Overwrites", "file", "with", "data", "optionally", "running", "`", "git", "add", "{", "path", "}", "`", "afterwards" ]
[ "\"\"\"Overwrites file with data, optionally running `git add {path}` afterwards\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "path", "type": null }, { "param": "data", "type": null }, { "param": "add", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "path", "type": null, "docstring": null, "docstring_tokens": [...
afc92008cb8cf56d1ac12f73ca0662adc6341c8f
nickanderson/cf-bottom_self
tom/git.py
[ "MIT" ]
Python
push
null
def push(self, branch_name): """Pushes local branch to remote repo, optionally also setting upstream """ if branch_name: self.run_command('push', '--set-upstream', 'origin', branch_name) else: self.run_command('push')
Pushes local branch to remote repo, optionally also setting upstream
Pushes local branch to remote repo, optionally also setting upstream
[ "Pushes", "local", "branch", "to", "remote", "repo", "optionally", "also", "setting", "upstream" ]
def push(self, branch_name): if branch_name: self.run_command('push', '--set-upstream', 'origin', branch_name) else: self.run_command('push')
[ "def", "push", "(", "self", ",", "branch_name", ")", ":", "if", "branch_name", ":", "self", ".", "run_command", "(", "'push'", ",", "'--set-upstream'", ",", "'origin'", ",", "branch_name", ")", "else", ":", "self", ".", "run_command", "(", "'push'", ")" ]
Pushes local branch to remote repo, optionally also setting upstream
[ "Pushes", "local", "branch", "to", "remote", "repo", "optionally", "also", "setting", "upstream" ]
[ "\"\"\"Pushes local branch to remote repo, optionally also setting upstream\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "branch_name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "branch_name", "type": null, "docstring": null, "docstring_tok...
3d92a18a9ffc8098c283e42ed8c0a26fbbb86322
nickanderson/cf-bottom_self
tom/dependencies.py
[ "MIT" ]
Python
checkfile
<not_specific>
def checkfile(self, url, md5=False): """Checks if file on given URL exists and optionally returns its md5 sum Args: url - URL to check (starting with http or ftp, other protocols might not work) md5 - set it to True to force downloading file and returning md5 sum ...
Checks if file on given URL exists and optionally returns its md5 sum Args: url - URL to check (starting with http or ftp, other protocols might not work) md5 - set it to True to force downloading file and returning md5 sum (otherwise, for http[s] we use HEAD ...
Checks if file on given URL exists and optionally returns its md5 sum Args: url - URL to check (starting with http or ftp, other protocols might not work) md5 - set it to True to force downloading file and returning md5 sum (otherwise, for http[s] we use HEAD request) Returns: True, False, or md5 of a linked file
[ "Checks", "if", "file", "on", "given", "URL", "exists", "and", "optionally", "returns", "its", "md5", "sum", "Args", ":", "url", "-", "URL", "to", "check", "(", "starting", "with", "http", "or", "ftp", "other", "protocols", "might", "not", "work", ")", ...
def checkfile(self, url, md5=False): log.debug('checking URL: ' + url) try: if not md5 and url.startswith('http'): log.debug('testing with HEAD') r = requests.head(url) return r.status_code >= 200 and r.status_code < 300 else: ...
[ "def", "checkfile", "(", "self", ",", "url", ",", "md5", "=", "False", ")", ":", "log", ".", "debug", "(", "'checking URL: '", "+", "url", ")", "try", ":", "if", "not", "md5", "and", "url", ".", "startswith", "(", "'http'", ")", ":", "log", ".", ...
Checks if file on given URL exists and optionally returns its md5 sum Args: url - URL to check (starting with http or ftp, other protocols might not work) md5 - set it to True to force downloading file and returning md5 sum (otherwise, for http[s] we use HEAD request) Returns: True, False, or md5 of a linked file
[ "Checks", "if", "file", "on", "given", "URL", "exists", "and", "optionally", "returns", "its", "md5", "sum", "Args", ":", "url", "-", "URL", "to", "check", "(", "starting", "with", "http", "or", "ftp", "other", "protocols", "might", "not", "work", ")", ...
[ "\"\"\"Checks if file on given URL exists and optionally returns its md5 sum\n Args:\n url - URL to check (starting with http or ftp, other protocols might not work)\n md5 - set it to True to force downloading file and returning md5 sum\n (otherwise, for http[...
[ { "param": "self", "type": null }, { "param": "url", "type": null }, { "param": "md5", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "url", "type": null, "docstring": null, "docstring_tokens": []...
3d92a18a9ffc8098c283e42ed8c0a26fbbb86322
nickanderson/cf-bottom_self
tom/dependencies.py
[ "MIT" ]
Python
find_new_version
<not_specific>
def find_new_version(self, old_url, old_version, separator): """Finds new version by iteratively increasing version in URL and checking if it's still possible to download a file. Returns highest version for which a file exists. Note that if old_version is 1.2.3, and somebody released ver...
Finds new version by iteratively increasing version in URL and checking if it's still possible to download a file. Returns highest version for which a file exists. Note that if old_version is 1.2.3, and somebody released version 1.2.5 WITHOUT releasing 1.2.4 before that, then this functi...
Finds new version by iteratively increasing version in URL and checking if it's still possible to download a file. Returns highest version for which a file exists. Note that if old_version is 1.2.3, and somebody released version 1.2.5 WITHOUT releasing 1.2.4 before that, then this function will NOT find it
[ "Finds", "new", "version", "by", "iteratively", "increasing", "version", "in", "URL", "and", "checking", "if", "it", "'", "s", "still", "possible", "to", "download", "a", "file", ".", "Returns", "highest", "version", "for", "which", "a", "file", "exists", ...
def find_new_version(self, old_url, old_version, separator): increment = 0 url_result = True while url_result: increment += 1 new_version = self.increase_version(old_version, increment, separator) new_url = old_url.replace(old_version, new_version) ...
[ "def", "find_new_version", "(", "self", ",", "old_url", ",", "old_version", ",", "separator", ")", ":", "increment", "=", "0", "url_result", "=", "True", "while", "url_result", ":", "increment", "+=", "1", "new_version", "=", "self", ".", "increase_version", ...
Finds new version by iteratively increasing version in URL and checking if it's still possible to download a file.
[ "Finds", "new", "version", "by", "iteratively", "increasing", "version", "in", "URL", "and", "checking", "if", "it", "'", "s", "still", "possible", "to", "download", "a", "file", "." ]
[ "\"\"\"Finds new version by iteratively increasing version in URL and\n checking if it's still possible to download a file.\n Returns highest version for which a file exists.\n Note that if old_version is 1.2.3, and somebody released version\n 1.2.5 WITHOUT releasing 1.2.4 before that, t...
[ { "param": "self", "type": null }, { "param": "old_url", "type": null }, { "param": "old_version", "type": null }, { "param": "separator", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "old_url", "type": null, "docstring": null, "docstring_tokens"...
3d92a18a9ffc8098c283e42ed8c0a26fbbb86322
nickanderson/cf-bottom_self
tom/dependencies.py
[ "MIT" ]
Python
update_single_dep
<not_specific>
def update_single_dep(self, dep): """Check if new version of dependency dep was released and create commit updating it in *.spec, dist, source, and README.md files """ log.info('Checking new version of {}'.format(dep)) dist_file_path = 'deps-packaging/{}/distfiles'.format(dep) ...
Check if new version of dependency dep was released and create commit updating it in *.spec, dist, source, and README.md files
Check if new version of dependency dep was released and create commit updating it in *.spec, dist, source, and README.md files
[ "Check", "if", "new", "version", "of", "dependency", "dep", "was", "released", "and", "create", "commit", "updating", "it", "in", "*", ".", "spec", "dist", "source", "and", "README", ".", "md", "files" ]
def update_single_dep(self, dep): log.info('Checking new version of {}'.format(dep)) dist_file_path = 'deps-packaging/{}/distfiles'.format(dep) dist_file = self.buildscripts.get_file(dist_file_path) dist_file = dist_file.strip() source_file_path = 'deps-packaging/{}/source'.forma...
[ "def", "update_single_dep", "(", "self", ",", "dep", ")", ":", "log", ".", "info", "(", "'Checking new version of {}'", ".", "format", "(", "dep", ")", ")", "dist_file_path", "=", "'deps-packaging/{}/distfiles'", ".", "format", "(", "dep", ")", "dist_file", "=...
Check if new version of dependency dep was released and create commit updating it in *.spec, dist, source, and README.md files
[ "Check", "if", "new", "version", "of", "dependency", "dep", "was", "released", "and", "create", "commit", "updating", "it", "in", "*", ".", "spec", "dist", "source", "and", "README", ".", "md", "files" ]
[ "\"\"\"Check if new version of dependency dep was released and create\n commit updating it in *.spec, dist, source, and README.md files\n \"\"\"", "# no update needed" ]
[ { "param": "self", "type": null }, { "param": "dep", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dep", "type": null, "docstring": null, "docstring_tokens": []...
3d92a18a9ffc8098c283e42ed8c0a26fbbb86322
nickanderson/cf-bottom_self
tom/dependencies.py
[ "MIT" ]
Python
run
<not_specific>
def run(self, branch): """Run the dependency update for a branch, creating PR in the end""" self.slack.reply("Running dependency updates for " + branch) # prepare repo repo_name = 'buildscripts' upstream_name = 'cfengine' local_path = "../" + repo_name self.builds...
Run the dependency update for a branch, creating PR in the end
Run the dependency update for a branch, creating PR in the end
[ "Run", "the", "dependency", "update", "for", "a", "branch", "creating", "PR", "in", "the", "end" ]
def run(self, branch): self.slack.reply("Running dependency updates for " + branch) repo_name = 'buildscripts' upstream_name = 'cfengine' local_path = "../" + repo_name self.buildscripts = GitRepo(local_path, repo_name, upstream_name, self.username, branch) timestamp = re...
[ "def", "run", "(", "self", ",", "branch", ")", ":", "self", ".", "slack", ".", "reply", "(", "\"Running dependency updates for \"", "+", "branch", ")", "repo_name", "=", "'buildscripts'", "upstream_name", "=", "'cfengine'", "local_path", "=", "\"../\"", "+", "...
Run the dependency update for a branch, creating PR in the end
[ "Run", "the", "dependency", "update", "for", "a", "branch", "creating", "PR", "in", "the", "end" ]
[ "\"\"\"Run the dependency update for a branch, creating PR in the end\"\"\"", "# prepare repo" ]
[ { "param": "self", "type": null }, { "param": "branch", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "branch", "type": null, "docstring": null, "docstring_tokens":...
60f84c4d3a7462780e0e32e7c032f7747461b77c
kenrumer/scorekeeper
golf/views/view_import.py
[ "MIT" ]
Python
courses
<not_specific>
def courses(request): """ Update function to import courses from uploaded json file TODO: json validation, try catch url: '/golf/importcourses/' """ resObject = {} for f in request.FILES: if (request.FILES[f].size < 10000): reqFile = request.FILES[f].read().decode('utf-8'...
Update function to import courses from uploaded json file TODO: json validation, try catch url: '/golf/importcourses/'
Update function to import courses from uploaded json file TODO: json validation, try catch url: '/golf/importcourses/'
[ "Update", "function", "to", "import", "courses", "from", "uploaded", "json", "file", "TODO", ":", "json", "validation", "try", "catch", "url", ":", "'", "/", "golf", "/", "importcourses", "/", "'" ]
def courses(request): resObject = {} for f in request.FILES: if (request.FILES[f].size < 10000): reqFile = request.FILES[f].read().decode('utf-8') reqObject = json.loads(reqFile) for course in serializers.deserialize('json', json.dumps([reqObject['course']])): ...
[ "def", "courses", "(", "request", ")", ":", "resObject", "=", "{", "}", "for", "f", "in", "request", ".", "FILES", ":", "if", "(", "request", ".", "FILES", "[", "f", "]", ".", "size", "<", "10000", ")", ":", "reqFile", "=", "request", ".", "FILES...
Update function to import courses from uploaded json file TODO: json validation, try catch url: '/golf/importcourses/'
[ "Update", "function", "to", "import", "courses", "from", "uploaded", "json", "file", "TODO", ":", "json", "validation", "try", "catch", "url", ":", "'", "/", "golf", "/", "importcourses", "/", "'" ]
[ "\"\"\"\n Update function to import courses from uploaded json file\n TODO: json validation, try catch\n url: '/golf/importcourses/'\n \"\"\"" ]
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
60f84c4d3a7462780e0e32e7c032f7747461b77c
kenrumer/scorekeeper
golf/views/view_import.py
[ "MIT" ]
Python
importRoundImportPlugins
<not_specific>
def importRoundImportPlugins(request): """ Update function to import tournament round import plugins from uploaded zip files Need to extract each file, then import context file, then save the class file and the archive file Always creates a new row in the database, if new plugin, will have a version of ...
Update function to import tournament round import plugins from uploaded zip files Need to extract each file, then import context file, then save the class file and the archive file Always creates a new row in the database, if new plugin, will have a version of 1 otherwize will increment by 1 TODO: json...
Update function to import tournament round import plugins from uploaded zip files Need to extract each file, then import context file, then save the class file and the archive file Always creates a new row in the database, if new plugin, will have a version of 1 otherwize will increment by 1 TODO: json and class valida...
[ "Update", "function", "to", "import", "tournament", "round", "import", "plugins", "from", "uploaded", "zip", "files", "Need", "to", "extract", "each", "file", "then", "import", "context", "file", "then", "save", "the", "class", "file", "and", "the", "archive",...
def importRoundImportPlugins(request): resList = [] for f in request.FILES: thisObject = {} thisObject['filename'] = request.FILES[f].name if (request.FILES[f].size < 1000000): uploadedFileData = os.path.splitext(request.FILES[f].name) if uploadedFileData[1] != '....
[ "def", "importRoundImportPlugins", "(", "request", ")", ":", "resList", "=", "[", "]", "for", "f", "in", "request", ".", "FILES", ":", "thisObject", "=", "{", "}", "thisObject", "[", "'filename'", "]", "=", "request", ".", "FILES", "[", "f", "]", ".", ...
Update function to import tournament round import plugins from uploaded zip files Need to extract each file, then import context file, then save the class file and the archive file Always creates a new row in the database, if new plugin, will have a version of 1 otherwize will increment by 1 TODO: json and class valida...
[ "Update", "function", "to", "import", "tournament", "round", "import", "plugins", "from", "uploaded", "zip", "files", "Need", "to", "extract", "each", "file", "then", "import", "context", "file", "then", "save", "the", "class", "file", "and", "the", "archive",...
[ "\"\"\"\n Update function to import tournament round import plugins from uploaded zip files\n Need to extract each file, then import context file, then save the class file and the archive file\n Always creates a new row in the database, if new plugin, will have a version of 1 otherwize will increment by 1\...
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
60f84c4d3a7462780e0e32e7c032f7747461b77c
kenrumer/scorekeeper
golf/views/view_import.py
[ "MIT" ]
Python
playerPlugins
<not_specific>
def playerPlugins(request): """ Update function to import player plugins from uploaded zip files Need to extract each file, then import context file, then save the class file and the archive file Always creates a new row in the database, if new plugin, will have a version of 1 otherwize will increment b...
Update function to import player plugins from uploaded zip files Need to extract each file, then import context file, then save the class file and the archive file Always creates a new row in the database, if new plugin, will have a version of 1 otherwize will increment by 1 TODO: json and class valida...
Update function to import player plugins from uploaded zip files Need to extract each file, then import context file, then save the class file and the archive file Always creates a new row in the database, if new plugin, will have a version of 1 otherwize will increment by 1 TODO: json and class validation, try catch u...
[ "Update", "function", "to", "import", "player", "plugins", "from", "uploaded", "zip", "files", "Need", "to", "extract", "each", "file", "then", "import", "context", "file", "then", "save", "the", "class", "file", "and", "the", "archive", "file", "Always", "c...
def playerPlugins(request): resList = [] for f in request.FILES: thisObject = {} thisObject['filename'] = request.FILES[f].name if (request.FILES[f].size < 1000000): uploadedFileData = os.path.splitext(request.FILES[f].name) if uploadedFileData[1] != '.zip': ...
[ "def", "playerPlugins", "(", "request", ")", ":", "resList", "=", "[", "]", "for", "f", "in", "request", ".", "FILES", ":", "thisObject", "=", "{", "}", "thisObject", "[", "'filename'", "]", "=", "request", ".", "FILES", "[", "f", "]", ".", "name", ...
Update function to import player plugins from uploaded zip files Need to extract each file, then import context file, then save the class file and the archive file Always creates a new row in the database, if new plugin, will have a version of 1 otherwize will increment by 1 TODO: json and class validation, try catch u...
[ "Update", "function", "to", "import", "player", "plugins", "from", "uploaded", "zip", "files", "Need", "to", "extract", "each", "file", "then", "import", "context", "file", "then", "save", "the", "class", "file", "and", "the", "archive", "file", "Always", "c...
[ "\"\"\"\n Update function to import player plugins from uploaded zip files\n Need to extract each file, then import context file, then save the class file and the archive file\n Always creates a new row in the database, if new plugin, will have a version of 1 otherwize will increment by 1\n TODO: json a...
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
60f84c4d3a7462780e0e32e7c032f7747461b77c
kenrumer/scorekeeper
golf/views/view_import.py
[ "MIT" ]
Python
formatPlugins
<not_specific>
def formatPlugins(request): """ Update function to import format plugins from uploaded zip files Need to extract each file, then import context file, then save the class file and the archive file Always creates a new row in the database, if new plugin, will have a version of 1 otherwize will increment b...
Update function to import format plugins from uploaded zip files Need to extract each file, then import context file, then save the class file and the archive file Always creates a new row in the database, if new plugin, will have a version of 1 otherwize will increment by 1 TODO: json and class valida...
Update function to import format plugins from uploaded zip files Need to extract each file, then import context file, then save the class file and the archive file Always creates a new row in the database, if new plugin, will have a version of 1 otherwize will increment by 1 TODO: json and class validation, try catch u...
[ "Update", "function", "to", "import", "format", "plugins", "from", "uploaded", "zip", "files", "Need", "to", "extract", "each", "file", "then", "import", "context", "file", "then", "save", "the", "class", "file", "and", "the", "archive", "file", "Always", "c...
def formatPlugins(request): resList = [] for f in request.FILES: thisObject = {} thisObject['filename'] = request.FILES[f].name if (request.FILES[f].size < 1000000): uploadedFileData = os.path.splitext(request.FILES[f].name) if uploadedFileData[1] != '.zip': ...
[ "def", "formatPlugins", "(", "request", ")", ":", "resList", "=", "[", "]", "for", "f", "in", "request", ".", "FILES", ":", "thisObject", "=", "{", "}", "thisObject", "[", "'filename'", "]", "=", "request", ".", "FILES", "[", "f", "]", ".", "name", ...
Update function to import format plugins from uploaded zip files Need to extract each file, then import context file, then save the class file and the archive file Always creates a new row in the database, if new plugin, will have a version of 1 otherwize will increment by 1 TODO: json and class validation, try catch u...
[ "Update", "function", "to", "import", "format", "plugins", "from", "uploaded", "zip", "files", "Need", "to", "extract", "each", "file", "then", "import", "context", "file", "then", "save", "the", "class", "file", "and", "the", "archive", "file", "Always", "c...
[ "\"\"\"\n Update function to import format plugins from uploaded zip files\n Need to extract each file, then import context file, then save the class file and the archive file\n Always creates a new row in the database, if new plugin, will have a version of 1 otherwize will increment by 1\n TODO: json a...
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1d72bb98f6e5dba7f5f9959841b261c627690403
kenrumer/scorekeeper
golf/templatetags/user_tags.py
[ "MIT" ]
Python
has_group
<not_specific>
def has_group(user, group_name): """ Verify the user has a group_name in groups """ groups = user.groups.all().values_list('name', flat=True) return True if group_name in groups else False
Verify the user has a group_name in groups
Verify the user has a group_name in groups
[ "Verify", "the", "user", "has", "a", "group_name", "in", "groups" ]
def has_group(user, group_name): groups = user.groups.all().values_list('name', flat=True) return True if group_name in groups else False
[ "def", "has_group", "(", "user", ",", "group_name", ")", ":", "groups", "=", "user", ".", "groups", ".", "all", "(", ")", ".", "values_list", "(", "'name'", ",", "flat", "=", "True", ")", "return", "True", "if", "group_name", "in", "groups", "else", ...
Verify the user has a group_name in groups
[ "Verify", "the", "user", "has", "a", "group_name", "in", "groups" ]
[ "\"\"\"\n Verify the user has a group_name in groups\n \"\"\"" ]
[ { "param": "user", "type": null }, { "param": "group_name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "user", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "group_name", "type": null, "docstring": null, "docstring_toke...
c95389560f872afaf85135189df7bd4a0a5c2cf7
kenrumer/scorekeeper
golf/views/view_export.py
[ "MIT" ]
Python
createFileResponse
<not_specific>
def createFileResponse(context, name, archiveName, classModuleName, classModule, readme=None): """ Helper function to limit the redundancy Make a temporary directory and a data subdirectory which we will add module and json TODO: Add README.txt file which explains the format and how the file can be used...
Helper function to limit the redundancy Make a temporary directory and a data subdirectory which we will add module and json TODO: Add README.txt file which explains the format and how the file can be used to import
Helper function to limit the redundancy Make a temporary directory and a data subdirectory which we will add module and json TODO: Add README.txt file which explains the format and how the file can be used to import
[ "Helper", "function", "to", "limit", "the", "redundancy", "Make", "a", "temporary", "directory", "and", "a", "data", "subdirectory", "which", "we", "will", "add", "module", "and", "json", "TODO", ":", "Add", "README", ".", "txt", "file", "which", "explains",...
def createFileResponse(context, name, archiveName, classModuleName, classModule, readme=None): retObject = {} with tempfile.TemporaryDirectory() as tmpdir: datadir = os.path.join(tmpdir, 'data') os.mkdir(datadir) with open(os.path.join(datadir, 'context.json'), 'w') as outfile: ...
[ "def", "createFileResponse", "(", "context", ",", "name", ",", "archiveName", ",", "classModuleName", ",", "classModule", ",", "readme", "=", "None", ")", ":", "retObject", "=", "{", "}", "with", "tempfile", ".", "TemporaryDirectory", "(", ")", "as", "tmpdir...
Helper function to limit the redundancy Make a temporary directory and a data subdirectory which we will add module and json TODO: Add README.txt file which explains the format and how the file can be used to import
[ "Helper", "function", "to", "limit", "the", "redundancy", "Make", "a", "temporary", "directory", "and", "a", "data", "subdirectory", "which", "we", "will", "add", "module", "and", "json", "TODO", ":", "Add", "README", ".", "txt", "file", "which", "explains",...
[ "\"\"\"\n Helper function to limit the redundancy\n Make a temporary directory and a data subdirectory which we will add module and json\n TODO: Add README.txt file which explains the format and how the file can be used to import\n \"\"\"" ]
[ { "param": "context", "type": null }, { "param": "name", "type": null }, { "param": "archiveName", "type": null }, { "param": "classModuleName", "type": null }, { "param": "classModule", "type": null }, { "param": "readme", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "context", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": null, "docstring_tokens"...
c95389560f872afaf85135189df7bd4a0a5c2cf7
kenrumer/scorekeeper
golf/views/view_export.py
[ "MIT" ]
Python
roundImportPlugin
<not_specific>
def roundImportPlugin(request, roundImportPluginId): """ View function for import export backup dialog in home page Sends the selected tournament format plugin in json format url: 'exportroundimportplugin/(?P<roundImportPluginId>\d+)$' """ plugin = RoundImportPlugin.objects.get(pk=roundImportPlu...
View function for import export backup dialog in home page Sends the selected tournament format plugin in json format url: 'exportroundimportplugin/(?P<roundImportPluginId>\d+)$'
View function for import export backup dialog in home page Sends the selected tournament format plugin in json format url: 'exportroundimportplugin/(?P\d+)$'
[ "View", "function", "for", "import", "export", "backup", "dialog", "in", "home", "page", "Sends", "the", "selected", "tournament", "format", "plugin", "in", "json", "format", "url", ":", "'", "exportroundimportplugin", "/", "(", "?P", "\\", "d", "+", ")", ...
def roundImportPlugin(request, roundImportPluginId): plugin = RoundImportPlugin.objects.get(pk=roundImportPluginId) tempModel = serializers.serialize('json', [plugin]) context = json.loads(tempModel[1:-1]) del context['pk'] del context['model'] del context['fields']['class_module'] del conte...
[ "def", "roundImportPlugin", "(", "request", ",", "roundImportPluginId", ")", ":", "plugin", "=", "RoundImportPlugin", ".", "objects", ".", "get", "(", "pk", "=", "roundImportPluginId", ")", "tempModel", "=", "serializers", ".", "serialize", "(", "'json'", ",", ...
View function for import export backup dialog in home page Sends the selected tournament format plugin in json format url: 'exportroundimportplugin/(?P<roundImportPluginId>\d+)$'
[ "View", "function", "for", "import", "export", "backup", "dialog", "in", "home", "page", "Sends", "the", "selected", "tournament", "format", "plugin", "in", "json", "format", "url", ":", "'", "exportroundimportplugin", "/", "(", "?P<roundImportPluginId", ">", "\...
[ "\"\"\"\n View function for import export backup dialog in home page\n Sends the selected tournament format plugin in json format\n url: 'exportroundimportplugin/(?P<roundImportPluginId>\\d+)$'\n \"\"\"" ]
[ { "param": "request", "type": null }, { "param": "roundImportPluginId", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "roundImportPluginId", "type": null, "docstring": null, "do...
c95389560f872afaf85135189df7bd4a0a5c2cf7
kenrumer/scorekeeper
golf/views/view_export.py
[ "MIT" ]
Python
database
<not_specific>
def database(request): """ View function for import export backup dialog in home page Exports the database compressed in a zip file url: 'exportroundimportplugin/(?P<roundImportPluginId>\d+)$' """ with tempfile.TemporaryDirectory() as tmpdir: with zipfile.ZipFile(os.path.join(tmpdir, 'da...
View function for import export backup dialog in home page Exports the database compressed in a zip file url: 'exportroundimportplugin/(?P<roundImportPluginId>\d+)$'
View function for import export backup dialog in home page Exports the database compressed in a zip file url: 'exportroundimportplugin/(?P\d+)$'
[ "View", "function", "for", "import", "export", "backup", "dialog", "in", "home", "page", "Exports", "the", "database", "compressed", "in", "a", "zip", "file", "url", ":", "'", "exportroundimportplugin", "/", "(", "?P", "\\", "d", "+", ")", "$", "'" ]
def database(request): with tempfile.TemporaryDirectory() as tmpdir: with zipfile.ZipFile(os.path.join(tmpdir, 'data.zip'), 'x') as datazip: datazip.write(settings.DATABASES['default']['NAME'], arcname='db.sqlite3') response = FileResponse(open(os.path.join(tmpdir, 'data.zip'), 'rb')) ...
[ "def", "database", "(", "request", ")", ":", "with", "tempfile", ".", "TemporaryDirectory", "(", ")", "as", "tmpdir", ":", "with", "zipfile", ".", "ZipFile", "(", "os", ".", "path", ".", "join", "(", "tmpdir", ",", "'data.zip'", ")", ",", "'x'", ")", ...
View function for import export backup dialog in home page Exports the database compressed in a zip file url: 'exportroundimportplugin/(?P<roundImportPluginId>\d+)$'
[ "View", "function", "for", "import", "export", "backup", "dialog", "in", "home", "page", "Exports", "the", "database", "compressed", "in", "a", "zip", "file", "url", ":", "'", "exportroundimportplugin", "/", "(", "?P<roundImportPluginId", ">", "\\", "d", "+", ...
[ "\"\"\"\n View function for import export backup dialog in home page\n Exports the database compressed in a zip file\n url: 'exportroundimportplugin/(?P<roundImportPluginId>\\d+)$'\n \"\"\"" ]
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
67cf6a5501a4b36a1f62cbbc685d526316f839a8
kenrumer/scorekeeper
golf/views/view_documentation.py
[ "MIT" ]
Python
docscodestyle
<not_specific>
def docscodestyle(request): """ View function for code style documentation """ return render(request, 'golf/docscodestyle.html', {})
View function for code style documentation
View function for code style documentation
[ "View", "function", "for", "code", "style", "documentation" ]
def docscodestyle(request): return render(request, 'golf/docscodestyle.html', {})
[ "def", "docscodestyle", "(", "request", ")", ":", "return", "render", "(", "request", ",", "'golf/docscodestyle.html'", ",", "{", "}", ")" ]
View function for code style documentation
[ "View", "function", "for", "code", "style", "documentation" ]
[ "\"\"\"\n View function for code style documentation\n \"\"\"" ]
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
67cf6a5501a4b36a1f62cbbc685d526316f839a8
kenrumer/scorekeeper
golf/views/view_documentation.py
[ "MIT" ]
Python
docsinstall
<not_specific>
def docsinstall(request): """ View function for software installation documentation """ return render(request, 'golf/docsinstall.html', {})
View function for software installation documentation
View function for software installation documentation
[ "View", "function", "for", "software", "installation", "documentation" ]
def docsinstall(request): return render(request, 'golf/docsinstall.html', {})
[ "def", "docsinstall", "(", "request", ")", ":", "return", "render", "(", "request", ",", "'golf/docsinstall.html'", ",", "{", "}", ")" ]
View function for software installation documentation
[ "View", "function", "for", "software", "installation", "documentation" ]
[ "\"\"\"\n View function for software installation documentation\n \"\"\"" ]
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
67cf6a5501a4b36a1f62cbbc685d526316f839a8
kenrumer/scorekeeper
golf/views/view_documentation.py
[ "MIT" ]
Python
docseditting
<not_specific>
def docseditting(request): """ View function for source code editting documentation """ return render(request, 'golf/docseditting.html', {})
View function for source code editting documentation
View function for source code editting documentation
[ "View", "function", "for", "source", "code", "editting", "documentation" ]
def docseditting(request): return render(request, 'golf/docseditting.html', {})
[ "def", "docseditting", "(", "request", ")", ":", "return", "render", "(", "request", ",", "'golf/docseditting.html'", ",", "{", "}", ")" ]
View function for source code editting documentation
[ "View", "function", "for", "source", "code", "editting", "documentation" ]
[ "\"\"\"\n View function for source code editting documentation\n \"\"\"" ]
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c46819ccde43b0e1879e28e7350382d0b7cb0ec6
kenrumer/scorekeeper
golf/views/view_director.py
[ "MIT" ]
Python
directorView
<not_specific>
def directorView(request): """ View function for director home page Sends the club, the name and logo are used in the banner Sends the courses and courseTees for the printouts button url: '/golf/' """ resObject = {} tempClub = serializers.serialize('json', [Club.objects.get(pk=1)]) r...
View function for director home page Sends the club, the name and logo are used in the banner Sends the courses and courseTees for the printouts button url: '/golf/'
View function for director home page Sends the club, the name and logo are used in the banner Sends the courses and courseTees for the printouts button url: '/golf/'
[ "View", "function", "for", "director", "home", "page", "Sends", "the", "club", "the", "name", "and", "logo", "are", "used", "in", "the", "banner", "Sends", "the", "courses", "and", "courseTees", "for", "the", "printouts", "button", "url", ":", "'", "/", ...
def directorView(request): resObject = {} tempClub = serializers.serialize('json', [Club.objects.get(pk=1)]) resObject['club'] = tempClub[1:-1] resObject['courseTees'] = serializers.serialize('json', CourseTee.objects.all().order_by('-default', 'priority')) resObject['courses'] = serializers.seriali...
[ "def", "directorView", "(", "request", ")", ":", "resObject", "=", "{", "}", "tempClub", "=", "serializers", ".", "serialize", "(", "'json'", ",", "[", "Club", ".", "objects", ".", "get", "(", "pk", "=", "1", ")", "]", ")", "resObject", "[", "'club'"...
View function for director home page Sends the club, the name and logo are used in the banner Sends the courses and courseTees for the printouts button url: '/golf/'
[ "View", "function", "for", "director", "home", "page", "Sends", "the", "club", "the", "name", "and", "logo", "are", "used", "in", "the", "banner", "Sends", "the", "courses", "and", "courseTees", "for", "the", "printouts", "button", "url", ":", "'", "/", ...
[ "\"\"\"\n View function for director home page\n Sends the club, the name and logo are used in the banner\n Sends the courses and courseTees for the printouts button\n url: '/golf/'\n \"\"\"" ]
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c46819ccde43b0e1879e28e7350382d0b7cb0ec6
kenrumer/scorekeeper
golf/views/view_director.py
[ "MIT" ]
Python
checkForTournamentDuplicate
<not_specific>
def checkForTournamentDuplicate(request): """ Ajax function to check if the tournament already exists url: '/golf/checkfortournamentduplicate/' """ tournamentName = request.POST.get('tournamentName') try: Tournament.objects.get(name=tournamentName) resStr = '{"duplicate": true}' ...
Ajax function to check if the tournament already exists url: '/golf/checkfortournamentduplicate/'
Ajax function to check if the tournament already exists url: '/golf/checkfortournamentduplicate/'
[ "Ajax", "function", "to", "check", "if", "the", "tournament", "already", "exists", "url", ":", "'", "/", "golf", "/", "checkfortournamentduplicate", "/", "'" ]
def checkForTournamentDuplicate(request): tournamentName = request.POST.get('tournamentName') try: Tournament.objects.get(name=tournamentName) resStr = '{"duplicate": true}' except Tournament.MultipleObjectsReturned: resStr = '{"duplicate": true}' except Tournament.DoesNotExist: ...
[ "def", "checkForTournamentDuplicate", "(", "request", ")", ":", "tournamentName", "=", "request", ".", "POST", ".", "get", "(", "'tournamentName'", ")", "try", ":", "Tournament", ".", "objects", ".", "get", "(", "name", "=", "tournamentName", ")", "resStr", ...
Ajax function to check if the tournament already exists url: '/golf/checkfortournamentduplicate/'
[ "Ajax", "function", "to", "check", "if", "the", "tournament", "already", "exists", "url", ":", "'", "/", "golf", "/", "checkfortournamentduplicate", "/", "'" ]
[ "\"\"\"\n Ajax function to check if the tournament already exists\n url: '/golf/checkfortournamentduplicate/'\n \"\"\"" ]
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c46819ccde43b0e1879e28e7350382d0b7cb0ec6
kenrumer/scorekeeper
golf/views/view_director.py
[ "MIT" ]
Python
loadPlayers
<not_specific>
def loadPlayers(request): """ Getter function for list of players from ghin, this calls a plugin from club PlayerPlugin Get the Module(file) get the class (getattr), instansiate the class () call the function url: /golf/loadplayers/ """ plugin = PlayerPlugin.objects.get(club__id=1) classModu...
Getter function for list of players from ghin, this calls a plugin from club PlayerPlugin Get the Module(file) get the class (getattr), instansiate the class () call the function url: /golf/loadplayers/
Getter function for list of players from ghin, this calls a plugin from club PlayerPlugin Get the Module(file) get the class (getattr), instansiate the class () call the function url: /golf/loadplayers
[ "Getter", "function", "for", "list", "of", "players", "from", "ghin", "this", "calls", "a", "plugin", "from", "club", "PlayerPlugin", "Get", "the", "Module", "(", "file", ")", "get", "the", "class", "(", "getattr", ")", "instansiate", "the", "class", "()",...
def loadPlayers(request): plugin = PlayerPlugin.objects.get(club__id=1) classModule = importlib.import_module('golf.media.'+plugin.class_module.name.replace('/', '.').replace('.py', '')) classAccess = getattr(classModule, plugin.class_name) classInst = classAccess() classInst.loadPlayers(plugin.data...
[ "def", "loadPlayers", "(", "request", ")", ":", "plugin", "=", "PlayerPlugin", ".", "objects", ".", "get", "(", "club__id", "=", "1", ")", "classModule", "=", "importlib", ".", "import_module", "(", "'golf.media.'", "+", "plugin", ".", "class_module", ".", ...
Getter function for list of players from ghin, this calls a plugin from club PlayerPlugin Get the Module(file) get the class (getattr), instansiate the class () call the function url: /golf/loadplayers
[ "Getter", "function", "for", "list", "of", "players", "from", "ghin", "this", "calls", "a", "plugin", "from", "club", "PlayerPlugin", "Get", "the", "Module", "(", "file", ")", "get", "the", "class", "(", "getattr", ")", "instansiate", "the", "class", "()",...
[ "\"\"\"\n Getter function for list of players from ghin, this calls a plugin from club PlayerPlugin\n Get the Module(file) get the class (getattr), instansiate the class () call the function\n url: /golf/loadplayers/\n \"\"\"" ]
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3a0f3dcc13df5682aa2d3e58eeb9e3bcd8261e08
kenrumer/scorekeeper
golf/abc_base.py
[ "MIT" ]
Python
showPayout
<not_specific>
def showPayout(self): """ Needs to be implemented by the plugin to show the dollars per person for the tournament. Giving free reign to the plugin at this point. Plugin should have stored most things in payout table in data column. Use getPayoutData to get what the plugin has...
Needs to be implemented by the plugin to show the dollars per person for the tournament. Giving free reign to the plugin at this point. Plugin should have stored most things in payout table in data column. Use getPayoutData to get what the plugin has stored before.
Needs to be implemented by the plugin to show the dollars per person for the tournament. Giving free reign to the plugin at this point. Plugin should have stored most things in payout table in data column. Use getPayoutData to get what the plugin has stored before.
[ "Needs", "to", "be", "implemented", "by", "the", "plugin", "to", "show", "the", "dollars", "per", "person", "for", "the", "tournament", ".", "Giving", "free", "reign", "to", "the", "plugin", "at", "this", "point", ".", "Plugin", "should", "have", "stored",...
def showPayout(self): print('showPayout?') return
[ "def", "showPayout", "(", "self", ")", ":", "print", "(", "'showPayout?'", ")", "return" ]
Needs to be implemented by the plugin to show the dollars per person for the tournament.
[ "Needs", "to", "be", "implemented", "by", "the", "plugin", "to", "show", "the", "dollars", "per", "person", "for", "the", "tournament", "." ]
[ "\"\"\"\n Needs to be implemented by the plugin to show the dollars per person for the tournament.\n Giving free reign to the plugin at this point. Plugin should have stored most things in payout table in data column.\n Use getPayoutData to get what the plugin has stored before.\n ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3a0f3dcc13df5682aa2d3e58eeb9e3bcd8261e08
kenrumer/scorekeeper
golf/abc_base.py
[ "MIT" ]
Python
mergePlayerResults
<not_specific>
def mergePlayerResults(self, newPlayerResultList): """ Merges the existing players from the database with the new players TODO: Need to return response time """ a = datetime.now() playerResultList = [] try: rounds = Round.objects.filter(tournament_roun...
Merges the existing players from the database with the new players TODO: Need to return response time
Merges the existing players from the database with the new players TODO: Need to return response time
[ "Merges", "the", "existing", "players", "from", "the", "database", "with", "the", "new", "players", "TODO", ":", "Need", "to", "return", "response", "time" ]
def mergePlayerResults(self, newPlayerResultList): a = datetime.now() playerResultList = [] try: rounds = Round.objects.filter(tournament_round=self.tournamentRoundId) except (Round.DoesNotExist): print ('there are not any rounds for this tournament_round') ...
[ "def", "mergePlayerResults", "(", "self", ",", "newPlayerResultList", ")", ":", "a", "=", "datetime", ".", "now", "(", ")", "playerResultList", "=", "[", "]", "try", ":", "rounds", "=", "Round", ".", "objects", ".", "filter", "(", "tournament_round", "=", ...
Merges the existing players from the database with the new players TODO: Need to return response time
[ "Merges", "the", "existing", "players", "from", "the", "database", "with", "the", "new", "players", "TODO", ":", "Need", "to", "return", "response", "time" ]
[ "\"\"\"\n Merges the existing players from the database with the new players\n TODO: Need to return response time\n \"\"\"", "#TODO: Normalizing when I don't need to..." ]
[ { "param": "self", "type": null }, { "param": "newPlayerResultList", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "newPlayerResultList", "type": null, "docstring": null, "docst...
3a0f3dcc13df5682aa2d3e58eeb9e3bcd8261e08
kenrumer/scorekeeper
golf/abc_base.py
[ "MIT" ]
Python
updateTournament
<not_specific>
def updateTournament(self, playerResultList): """ Sets the current tournament values in the database return True for success and False for fail TODO: Probably should say how many where updated. TODO: Return response time """ a = datetime.now() ...
Sets the current tournament values in the database return True for success and False for fail TODO: Probably should say how many where updated. TODO: Return response time
Sets the current tournament values in the database return True for success and False for fail TODO: Probably should say how many where updated. TODO: Return response time
[ "Sets", "the", "current", "tournament", "values", "in", "the", "database", "return", "True", "for", "success", "and", "False", "for", "fail", "TODO", ":", "Probably", "should", "say", "how", "many", "where", "updated", ".", "TODO", ":", "Return", "response",...
def updateTournament(self, playerResultList): a = datetime.now() try: tr = TournamentRound.objects.get(id=self.tournamentRoundId) except: print('Failed to get the tournament round') print(self.tournamentRoundId) return False for player in p...
[ "def", "updateTournament", "(", "self", ",", "playerResultList", ")", ":", "a", "=", "datetime", ".", "now", "(", ")", "try", ":", "tr", "=", "TournamentRound", ".", "objects", ".", "get", "(", "id", "=", "self", ".", "tournamentRoundId", ")", "except", ...
Sets the current tournament values in the database return True for success and False for fail TODO: Probably should say how many where updated.
[ "Sets", "the", "current", "tournament", "values", "in", "the", "database", "return", "True", "for", "success", "and", "False", "for", "fail", "TODO", ":", "Probably", "should", "say", "how", "many", "where", "updated", "." ]
[ "\"\"\"\n Sets the current tournament values in the database\n return True for success and False for fail\n TODO: Probably should say how many where updated.\n TODO: Return response time\n \"\"\"", "#Create the round because it doesn't exist", "#except:", "# ...
[ { "param": "self", "type": null }, { "param": "playerResultList", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "playerResultList", "type": null, "docstring": null, "docstrin...
5e3b976924aa1fb47fae49729138d083ed297270
kenrumer/scorekeeper
golf/views/view_player.py
[ "MIT" ]
Python
loadPlayers
<not_specific>
def loadPlayers(request): """ Getter function for list of players from ghin, this calls a plugin from club PlayerPlugin Get the Module(file) get the class (getattr), instansiate the class () call the function url: /golf/loadplayers/ """ plugin = PlayerPlugin.objects.get(club__id=1) classModu...
Getter function for list of players from ghin, this calls a plugin from club PlayerPlugin Get the Module(file) get the class (getattr), instansiate the class () call the function url: /golf/loadplayers/
Getter function for list of players from ghin, this calls a plugin from club PlayerPlugin Get the Module(file) get the class (getattr), instansiate the class () call the function url: /golf/loadplayers
[ "Getter", "function", "for", "list", "of", "players", "from", "ghin", "this", "calls", "a", "plugin", "from", "club", "PlayerPlugin", "Get", "the", "Module", "(", "file", ")", "get", "the", "class", "(", "getattr", ")", "instansiate", "the", "class", "()",...
def loadPlayers(request): plugin = PlayerPlugin.objects.get(club__id=1) classModule = importlib.import_module('golf.media.'+plugin.class_module.name.replace('/', '.').replace('.py', '')) classAccess = getattr(classModule, plugin.class_name) classInst = classAccess() classInst.loadPlayers(plugin.data...
[ "def", "loadPlayers", "(", "request", ")", ":", "plugin", "=", "PlayerPlugin", ".", "objects", ".", "get", "(", "club__id", "=", "1", ")", "classModule", "=", "importlib", ".", "import_module", "(", "'golf.media.'", "+", "plugin", ".", "class_module", ".", ...
Getter function for list of players from ghin, this calls a plugin from club PlayerPlugin Get the Module(file) get the class (getattr), instansiate the class () call the function url: /golf/loadplayers
[ "Getter", "function", "for", "list", "of", "players", "from", "ghin", "this", "calls", "a", "plugin", "from", "club", "PlayerPlugin", "Get", "the", "Module", "(", "file", ")", "get", "the", "class", "(", "getattr", ")", "instansiate", "the", "class", "()",...
[ "\"\"\"\n Getter function for list of players from ghin, this calls a plugin from club PlayerPlugin\n Get the Module(file) get the class (getattr), instansiate the class () call the function\n url: /golf/loadplayers/\n \"\"\"" ]
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4ba04d3557fa8264f7bd7d3d2196acad88b643e4
kenrumer/scorekeeper
golf/views/.~c9_invoke_H9Dn7P.py
[ "MIT" ]
Python
editFormats
<not_specific>
def editFormats(request): """ View function for editting a tournament formats """ return render_to_response('golf/editformats.html')
View function for editting a tournament formats
View function for editting a tournament formats
[ "View", "function", "for", "editting", "a", "tournament", "formats" ]
def editFormats(request): return render_to_response('golf/editformats.html')
[ "def", "editFormats", "(", "request", ")", ":", "return", "render_to_response", "(", "'golf/editformats.html'", ")" ]
View function for editting a tournament formats
[ "View", "function", "for", "editting", "a", "tournament", "formats" ]
[ "\"\"\"\n View function for editting a tournament formats\n \"\"\"" ]
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4ba04d3557fa8264f7bd7d3d2196acad88b643e4
kenrumer/scorekeeper
golf/views/.~c9_invoke_H9Dn7P.py
[ "MIT" ]
Python
newTournament
<not_specific>
def newTournament(request): """ Create function for tournaments Need to ask several questions about course, tee, format, if multi-round - how many... how do you ask from a plugin? """ from django.core import serializers courses = [] courseTees = [] courseIds = request.POST.getlist('cours...
Create function for tournaments Need to ask several questions about course, tee, format, if multi-round - how many... how do you ask from a plugin?
Create function for tournaments Need to ask several questions about course, tee, format, if multi-round - how many...
[ "Create", "function", "for", "tournaments", "Need", "to", "ask", "several", "questions", "about", "course", "tee", "format", "if", "multi", "-", "round", "-", "how", "many", "..." ]
def newTournament(request): from django.core import serializers courses = [] courseTees = [] courseIds = request.POST.getlist('courses') teeIds = request.POST.getlist('tees') t = Tournament(name=request.POST.get('name')) t.save() for i, teeId in enumerate(teeIds): ct = CourseTee....
[ "def", "newTournament", "(", "request", ")", ":", "from", "django", ".", "core", "import", "serializers", "courses", "=", "[", "]", "courseTees", "=", "[", "]", "courseIds", "=", "request", ".", "POST", ".", "getlist", "(", "'courses'", ")", "teeIds", "=...
Create function for tournaments Need to ask several questions about course, tee, format, if multi-round - how many... how do you ask from a plugin?
[ "Create", "function", "for", "tournaments", "Need", "to", "ask", "several", "questions", "about", "course", "tee", "format", "if", "multi", "-", "round", "-", "how", "many", "...", "how", "do", "you", "ask", "from", "a", "plugin?" ]
[ "\"\"\"\n Create function for tournaments\n Need to ask several questions about course, tee, format, if multi-round - how many... how do you ask from a plugin?\n \"\"\"" ]
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4ba04d3557fa8264f7bd7d3d2196acad88b643e4
kenrumer/scorekeeper
golf/views/.~c9_invoke_H9Dn7P.py
[ "MIT" ]
Python
calculateScores
<not_specific>
def calculateScores(request): """ Score the tournament Save the data Return the rankings grosses and nets and colors per cell """ tournament = model_to_dict(Tournament.objects.get(id=request.POST.get('tournamentId'))) f classModule = importlib.import_module('golf.plugins.'+tournament['fo...
Score the tournament Save the data Return the rankings grosses and nets and colors per cell
Score the tournament Save the data Return the rankings grosses and nets and colors per cell
[ "Score", "the", "tournament", "Save", "the", "data", "Return", "the", "rankings", "grosses", "and", "nets", "and", "colors", "per", "cell" ]
def calculateScores(request): tournament = model_to_dict(Tournament.objects.get(id=request.POST.get('tournamentId'))) f classModule = importlib.import_module('golf.plugins.'+tournament['format_plugin__class_package']) classAccess = getattr(classModule, tournament['format_plugin__class_name']) classI...
[ "def", "calculateScores", "(", "request", ")", ":", "tournament", "=", "model_to_dict", "(", "Tournament", ".", "objects", ".", "get", "(", "id", "=", "request", ".", "POST", ".", "get", "(", "'tournamentId'", ")", ")", ")", "f", "classModule", "=", "imp...
Score the tournament Save the data Return the rankings grosses and nets and colors per cell
[ "Score", "the", "tournament", "Save", "the", "data", "Return", "the", "rankings", "grosses", "and", "nets", "and", "colors", "per", "cell" ]
[ "\"\"\"\n Score the tournament\n Save the data\n Return the rankings grosses and nets and colors per cell\n \"\"\"" ]
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4ba04d3557fa8264f7bd7d3d2196acad88b643e4
kenrumer/scorekeeper
golf/views/.~c9_invoke_H9Dn7P.py
[ "MIT" ]
Python
editTournament
<not_specific>
def editTournament(request, tournamentId): """ View function for editting a tournament Tournaments are associated with rounds Scorecards are associated with rounds """ return render(request, 'golf/edittournament.html', context={'tournament_id': tournamentId})
View function for editting a tournament Tournaments are associated with rounds Scorecards are associated with rounds
View function for editting a tournament Tournaments are associated with rounds Scorecards are associated with rounds
[ "View", "function", "for", "editting", "a", "tournament", "Tournaments", "are", "associated", "with", "rounds", "Scorecards", "are", "associated", "with", "rounds" ]
def editTournament(request, tournamentId): return render(request, 'golf/edittournament.html', context={'tournament_id': tournamentId})
[ "def", "editTournament", "(", "request", ",", "tournamentId", ")", ":", "return", "render", "(", "request", ",", "'golf/edittournament.html'", ",", "context", "=", "{", "'tournament_id'", ":", "tournamentId", "}", ")" ]
View function for editting a tournament Tournaments are associated with rounds Scorecards are associated with rounds
[ "View", "function", "for", "editting", "a", "tournament", "Tournaments", "are", "associated", "with", "rounds", "Scorecards", "are", "associated", "with", "rounds" ]
[ "\"\"\"\n View function for editting a tournament\n Tournaments are associated with rounds\n Scorecards are associated with rounds\n \"\"\"" ]
[ { "param": "request", "type": null }, { "param": "tournamentId", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tournamentId", "type": null, "docstring": null, "docstring...
62482e6392de9d542b917ff73cf3517920e20712
kenrumer/scorekeeper
golf/views/view_test.py
[ "MIT" ]
Python
testView
<not_specific>
def testView(request): """ Trying to find the best way to serialize data """ #club = Club.objects.order_by('-id').values('name', 'logo', 'default_tournament_name', 'players_last_updated')[0] data = serializers.serialize("json", Club.objects.all().order_by('-id'), fields=('name', 'logo', 'default_tou...
Trying to find the best way to serialize data
Trying to find the best way to serialize data
[ "Trying", "to", "find", "the", "best", "way", "to", "serialize", "data" ]
def testView(request): data = serializers.serialize("json", Club.objects.all().order_by('-id'), fields=('name', 'logo', 'default_tournament_name', 'players_last_updated', 'data')) print(data) return JsonResponse(data, safe=False)
[ "def", "testView", "(", "request", ")", ":", "data", "=", "serializers", ".", "serialize", "(", "\"json\"", ",", "Club", ".", "objects", ".", "all", "(", ")", ".", "order_by", "(", "'-id'", ")", ",", "fields", "=", "(", "'name'", ",", "'logo'", ",", ...
Trying to find the best way to serialize data
[ "Trying", "to", "find", "the", "best", "way", "to", "serialize", "data" ]
[ "\"\"\"\n Trying to find the best way to serialize data\n \"\"\"", "#club = Club.objects.order_by('-id').values('name', 'logo', 'default_tournament_name', 'players_last_updated')[0]", "#data = serializers.serialize(\"json\", CourseTee.objects.all().order_by('-default', 'priority'), fields=('id', 'name', '...
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d356f797c750afa9cecd427e0de075a0c454483b
kenrumer/scorekeeper
golf/views/view_course.py
[ "MIT" ]
Python
editCourses
<not_specific>
def editCourses(request): """ View function for editting the list of courses """ return render_to_response('golf/editcourses.html')
View function for editting the list of courses
View function for editting the list of courses
[ "View", "function", "for", "editting", "the", "list", "of", "courses" ]
def editCourses(request): return render_to_response('golf/editcourses.html')
[ "def", "editCourses", "(", "request", ")", ":", "return", "render_to_response", "(", "'golf/editcourses.html'", ")" ]
View function for editting the list of courses
[ "View", "function", "for", "editting", "the", "list", "of", "courses" ]
[ "\"\"\"\n View function for editting the list of courses\n \"\"\"" ]
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d356f797c750afa9cecd427e0de075a0c454483b
kenrumer/scorekeeper
golf/views/view_course.py
[ "MIT" ]
Python
editCourseTees
<not_specific>
def editCourseTees(request, courseId): """ View function for editting the list of course holes and tees """ courseTees = list(CourseTee.objects.filter(course_id=courseId).values('id', 'default', 'priority', 'name', 'slope', 'color')) context = { 'courseId': courseId, 'courseTees': co...
View function for editting the list of course holes and tees
View function for editting the list of course holes and tees
[ "View", "function", "for", "editting", "the", "list", "of", "course", "holes", "and", "tees" ]
def editCourseTees(request, courseId): courseTees = list(CourseTee.objects.filter(course_id=courseId).values('id', 'default', 'priority', 'name', 'slope', 'color')) context = { 'courseId': courseId, 'courseTees': courseTees } return render(request, 'golf/editcoursetees.html', context=con...
[ "def", "editCourseTees", "(", "request", ",", "courseId", ")", ":", "courseTees", "=", "list", "(", "CourseTee", ".", "objects", ".", "filter", "(", "course_id", "=", "courseId", ")", ".", "values", "(", "'id'", ",", "'default'", ",", "'priority'", ",", ...
View function for editting the list of course holes and tees
[ "View", "function", "for", "editting", "the", "list", "of", "course", "holes", "and", "tees" ]
[ "\"\"\"\n View function for editting the list of course holes and tees\n \"\"\"" ]
[ { "param": "request", "type": null }, { "param": "courseId", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "courseId", "type": null, "docstring": null, "docstring_tok...
d356f797c750afa9cecd427e0de075a0c454483b
kenrumer/scorekeeper
golf/views/view_course.py
[ "MIT" ]
Python
updateCourseTee
<not_specific>
def updateCourseTee(request, courseId, courseTeeId): """ Setter function for existing course tee """ if (request.POST['default'] == 'true'): ct = CourseTee(id=courseTeeId, default=True, priority=request.POST['priority'], name=request.POST['name'], slope=request.POST['slope'], color=request.POST[...
Setter function for existing course tee
Setter function for existing course tee
[ "Setter", "function", "for", "existing", "course", "tee" ]
def updateCourseTee(request, courseId, courseTeeId): if (request.POST['default'] == 'true'): ct = CourseTee(id=courseTeeId, default=True, priority=request.POST['priority'], name=request.POST['name'], slope=request.POST['slope'], color=request.POST['color'], course_id=courseId) ct.save() else: ...
[ "def", "updateCourseTee", "(", "request", ",", "courseId", ",", "courseTeeId", ")", ":", "if", "(", "request", ".", "POST", "[", "'default'", "]", "==", "'true'", ")", ":", "ct", "=", "CourseTee", "(", "id", "=", "courseTeeId", ",", "default", "=", "Tr...
Setter function for existing course tee
[ "Setter", "function", "for", "existing", "course", "tee" ]
[ "\"\"\"\n Setter function for existing course tee\n \"\"\"" ]
[ { "param": "request", "type": null }, { "param": "courseId", "type": null }, { "param": "courseTeeId", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "courseId", "type": null, "docstring": null, "docstring_tok...
d356f797c750afa9cecd427e0de075a0c454483b
kenrumer/scorekeeper
golf/views/view_course.py
[ "MIT" ]
Python
editCourseTeeHoles
<not_specific>
def editCourseTeeHoles(request, courseId, courseTeeId): """ View function for editting the list of courses """ return render(request, 'golf/editcourseteeholes.html', context={'course_id': courseId, 'course_tee_id': courseTeeId, })
View function for editting the list of courses
View function for editting the list of courses
[ "View", "function", "for", "editting", "the", "list", "of", "courses" ]
def editCourseTeeHoles(request, courseId, courseTeeId): return render(request, 'golf/editcourseteeholes.html', context={'course_id': courseId, 'course_tee_id': courseTeeId, })
[ "def", "editCourseTeeHoles", "(", "request", ",", "courseId", ",", "courseTeeId", ")", ":", "return", "render", "(", "request", ",", "'golf/editcourseteeholes.html'", ",", "context", "=", "{", "'course_id'", ":", "courseId", ",", "'course_tee_id'", ":", "courseTee...
View function for editting the list of courses
[ "View", "function", "for", "editting", "the", "list", "of", "courses" ]
[ "\"\"\"\n View function for editting the list of courses\n \"\"\"" ]
[ { "param": "request", "type": null }, { "param": "courseId", "type": null }, { "param": "courseTeeId", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "courseId", "type": null, "docstring": null, "docstring_tok...
d356f797c750afa9cecd427e0de075a0c454483b
kenrumer/scorekeeper
golf/views/view_course.py
[ "MIT" ]
Python
updateCourseTeeHole
<not_specific>
def updateCourseTeeHole(request, courseId, courseTeeId, teeId): """ Setter function for existing course tee hole """ try: h = Hole.objects.get(number=request.POST['number'], name=request.POST['name'], course_id=courseId) except Hole.DoesNotExist: h = Hole(number=request.POST['number'...
Setter function for existing course tee hole
Setter function for existing course tee hole
[ "Setter", "function", "for", "existing", "course", "tee", "hole" ]
def updateCourseTeeHole(request, courseId, courseTeeId, teeId): try: h = Hole.objects.get(number=request.POST['number'], name=request.POST['name'], course_id=courseId) except Hole.DoesNotExist: h = Hole(number=request.POST['number'], name=request.POST['name'], course_id=courseId) h.save(...
[ "def", "updateCourseTeeHole", "(", "request", ",", "courseId", ",", "courseTeeId", ",", "teeId", ")", ":", "try", ":", "h", "=", "Hole", ".", "objects", ".", "get", "(", "number", "=", "request", ".", "POST", "[", "'number'", "]", ",", "name", "=", "...
Setter function for existing course tee hole
[ "Setter", "function", "for", "existing", "course", "tee", "hole" ]
[ "\"\"\"\n Setter function for existing course tee hole\n \"\"\"" ]
[ { "param": "request", "type": null }, { "param": "courseId", "type": null }, { "param": "courseTeeId", "type": null }, { "param": "teeId", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "courseId", "type": null, "docstring": null, "docstring_tok...
d356f797c750afa9cecd427e0de075a0c454483b
kenrumer/scorekeeper
golf/views/view_course.py
[ "MIT" ]
Python
createCourseTeeHole
<not_specific>
def createCourseTeeHole(request, courseId, courseTeeId): """ Create function for course tee hole """ try: h = Hole.objects.get(number=request.POST['number'], course_id=courseId) except Hole.DoesNotExist: h = Hole(number=request.POST['number'], name=request.POST['name'], course_id=cou...
Create function for course tee hole
Create function for course tee hole
[ "Create", "function", "for", "course", "tee", "hole" ]
def createCourseTeeHole(request, courseId, courseTeeId): try: h = Hole.objects.get(number=request.POST['number'], course_id=courseId) except Hole.DoesNotExist: h = Hole(number=request.POST['number'], name=request.POST['name'], course_id=courseId) h.save() t = Tee(hole_id=h.id, course...
[ "def", "createCourseTeeHole", "(", "request", ",", "courseId", ",", "courseTeeId", ")", ":", "try", ":", "h", "=", "Hole", ".", "objects", ".", "get", "(", "number", "=", "request", ".", "POST", "[", "'number'", "]", ",", "course_id", "=", "courseId", ...
Create function for course tee hole
[ "Create", "function", "for", "course", "tee", "hole" ]
[ "\"\"\"\n Create function for course tee hole\n \"\"\"" ]
[ { "param": "request", "type": null }, { "param": "courseId", "type": null }, { "param": "courseTeeId", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "courseId", "type": null, "docstring": null, "docstring_tok...
e4f7db8701fedaadababd0efc87abbce0e9e3e79
kenrumer/scorekeeper
golf/views/view_tournament.py
[ "MIT" ]
Python
updateScores
<not_specific>
def updateScores(request): """ Score the tournament Save the data Return the rankings grosses and nets and colors per cell """ tournamentId = request.POST['tournamentId'] tournamentName = request.POST['tournamentName'] tournamentRound = json.loads(request.POST['tournamentRound']) sco...
Score the tournament Save the data Return the rankings grosses and nets and colors per cell
Score the tournament Save the data Return the rankings grosses and nets and colors per cell
[ "Score", "the", "tournament", "Save", "the", "data", "Return", "the", "rankings", "grosses", "and", "nets", "and", "colors", "per", "cell" ]
def updateScores(request): tournamentId = request.POST['tournamentId'] tournamentName = request.POST['tournamentName'] tournamentRound = json.loads(request.POST['tournamentRound']) scorecard = json.loads(request.POST['scorecard']) players = json.loads(request.POST['players']) viewTab = request.P...
[ "def", "updateScores", "(", "request", ")", ":", "tournamentId", "=", "request", ".", "POST", "[", "'tournamentId'", "]", "tournamentName", "=", "request", ".", "POST", "[", "'tournamentName'", "]", "tournamentRound", "=", "json", ".", "loads", "(", "request",...
Score the tournament Save the data Return the rankings grosses and nets and colors per cell
[ "Score", "the", "tournament", "Save", "the", "data", "Return", "the", "rankings", "grosses", "and", "nets", "and", "colors", "per", "cell" ]
[ "\"\"\"\n Score the tournament\n Save the data\n Return the rankings grosses and nets and colors per cell\n \"\"\"" ]
[ { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9b99b56ed68b9cd5a6c95205a5538adbf6f3476b
techalchemy/airflow-sync
src/airflow_sync/utils.py
[ "MIT" ]
Python
is_trigger
<not_specific>
def is_trigger(self): """Indicates whether the current sql file represents a trigger Triggers are the direct result of an upstream database execution, e.g. every time an insert is performed, the given trigger is then performed. In this context, a trigger simply represents any sql that ...
Indicates whether the current sql file represents a trigger Triggers are the direct result of an upstream database execution, e.g. every time an insert is performed, the given trigger is then performed. In this context, a trigger simply represents any sql that should be invoked as a result of ...
Indicates whether the current sql file represents a trigger Triggers are the direct result of an upstream database execution, e.g. every time an insert is performed, the given trigger is then performed. In this context, a trigger simply represents any sql that should be invoked as a result of another sql file running.
[ "Indicates", "whether", "the", "current", "sql", "file", "represents", "a", "trigger", "Triggers", "are", "the", "direct", "result", "of", "an", "upstream", "database", "execution", "e", ".", "g", ".", "every", "time", "an", "insert", "is", "performed", "the...
def is_trigger(self): return any(self.name.startswith(trigger) for trigger in TRIGGER_TYPES)
[ "def", "is_trigger", "(", "self", ")", ":", "return", "any", "(", "self", ".", "name", ".", "startswith", "(", "trigger", ")", "for", "trigger", "in", "TRIGGER_TYPES", ")" ]
Indicates whether the current sql file represents a trigger Triggers are the direct result of an upstream database execution, e.g.
[ "Indicates", "whether", "the", "current", "sql", "file", "represents", "a", "trigger", "Triggers", "are", "the", "direct", "result", "of", "an", "upstream", "database", "execution", "e", ".", "g", "." ]
[ "\"\"\"Indicates whether the current sql file represents a trigger\n\n Triggers are the direct result of an upstream database execution, e.g. every time\n an insert is performed, the given trigger is then performed. In this context, a\n trigger simply represents any sql that should be invoked ...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Whether the current file is a trigger", "docstring_tokens": [ "Whether", "the", "current", "file", "is", "a", "trigger" ], "type": "bool" } ], "raises": [], "params": [ { "identifier"...
9b99b56ed68b9cd5a6c95205a5538adbf6f3476b
techalchemy/airflow-sync
src/airflow_sync/utils.py
[ "MIT" ]
Python
merge
"SqlFile"
def merge(self, other: "SqlFile") -> "SqlFile": """Merges the given dependency tree with another metadata set for the same file This is typically used for updating the dependency and trigger information of a given sql file instance. :return: A new instance of the sql file with the give...
Merges the given dependency tree with another metadata set for the same file This is typically used for updating the dependency and trigger information of a given sql file instance. :return: A new instance of the sql file with the given instance merged in :rtype: SqlFile
Merges the given dependency tree with another metadata set for the same file This is typically used for updating the dependency and trigger information of a given sql file instance.
[ "Merges", "the", "given", "dependency", "tree", "with", "another", "metadata", "set", "for", "the", "same", "file", "This", "is", "typically", "used", "for", "updating", "the", "dependency", "and", "trigger", "information", "of", "a", "given", "sql", "file", ...
def merge(self, other: "SqlFile") -> "SqlFile": new_dependencies = tuple(self.dependencies) + other.dependants new_triggers = tuple(self.triggers) + other.triggers new_dependants = tuple(self.dependants) + other.dependants new_dependants = tuple(list(dedup(new_dependants))) new_d...
[ "def", "merge", "(", "self", ",", "other", ":", "\"SqlFile\"", ")", "->", "\"SqlFile\"", ":", "new_dependencies", "=", "tuple", "(", "self", ".", "dependencies", ")", "+", "other", ".", "dependants", "new_triggers", "=", "tuple", "(", "self", ".", "trigger...
Merges the given dependency tree with another metadata set for the same file This is typically used for updating the dependency and trigger information of a given sql file instance.
[ "Merges", "the", "given", "dependency", "tree", "with", "another", "metadata", "set", "for", "the", "same", "file", "This", "is", "typically", "used", "for", "updating", "the", "dependency", "and", "trigger", "information", "of", "a", "given", "sql", "file", ...
[ "\"\"\"Merges the given dependency tree with another metadata set for the same file\n\n This is typically used for updating the dependency and trigger information of a\n given sql file instance.\n\n :return: A new instance of the sql file with the given instance merged in\n :rtype: SqlFi...
[ { "param": "self", "type": null }, { "param": "other", "type": "\"SqlFile\"" } ]
{ "returns": [ { "docstring": "A new instance of the sql file with the given instance merged in", "docstring_tokens": [ "A", "new", "instance", "of", "the", "sql", "file", "with", "the", "given", "instance", ...
9b99b56ed68b9cd5a6c95205a5538adbf6f3476b
techalchemy/airflow-sync
src/airflow_sync/utils.py
[ "MIT" ]
Python
depends_on
"SqlFile"
def depends_on(self, sql_file: "SqlFile") -> "SqlFile": """Indicate that the current sql file has an upstream dependency on *sql_file* This tells the task runner that before this file can be executed, *sql_file* must be executed succesfully. :param SqlFile sql_file: A :class:`SqlFile` ...
Indicate that the current sql file has an upstream dependency on *sql_file* This tells the task runner that before this file can be executed, *sql_file* must be executed succesfully. :param SqlFile sql_file: A :class:`SqlFile` instance which must run first :return: An updated version o...
Indicate that the current sql file has an upstream dependency on *sql_file This tells the task runner that before this file can be executed, *sql_file* must be executed succesfully.
[ "Indicate", "that", "the", "current", "sql", "file", "has", "an", "upstream", "dependency", "on", "*", "sql_file", "This", "tells", "the", "task", "runner", "that", "before", "this", "file", "can", "be", "executed", "*", "sql_file", "*", "must", "be", "exe...
def depends_on(self, sql_file: "SqlFile") -> "SqlFile": dep_list: List["SqlFile"] = list(self.dependencies) new_deps = tuple(self.merge_and_update(dep_list, sql_file)) return attr.evolve(self, dependencies=new_deps)
[ "def", "depends_on", "(", "self", ",", "sql_file", ":", "\"SqlFile\"", ")", "->", "\"SqlFile\"", ":", "dep_list", ":", "List", "[", "\"SqlFile\"", "]", "=", "list", "(", "self", ".", "dependencies", ")", "new_deps", "=", "tuple", "(", "self", ".", "merge...
Indicate that the current sql file has an upstream dependency on *sql_file This tells the task runner that before this file can be executed, *sql_file* must be executed succesfully.
[ "Indicate", "that", "the", "current", "sql", "file", "has", "an", "upstream", "dependency", "on", "*", "sql_file", "This", "tells", "the", "task", "runner", "that", "before", "this", "file", "can", "be", "executed", "*", "sql_file", "*", "must", "be", "exe...
[ "\"\"\"Indicate that the current sql file has an upstream dependency on *sql_file*\n\n This tells the task runner that before this file can be executed, *sql_file* must\n be executed succesfully.\n\n :param SqlFile sql_file: A :class:`SqlFile` instance which must run first\n :return: An ...
[ { "param": "self", "type": null }, { "param": "sql_file", "type": "\"SqlFile\"" } ]
{ "returns": [ { "docstring": "An updated version of the current :class:`SqlFile` with new dependencies", "docstring_tokens": [ "An", "updated", "version", "of", "the", "current", ":", "class", ":", "`", "SqlFile",...
9b99b56ed68b9cd5a6c95205a5538adbf6f3476b
techalchemy/airflow-sync
src/airflow_sync/utils.py
[ "MIT" ]
Python
with_dependencies
"SqlFile"
def with_dependencies(self, dependencies: List["SqlFile"]) -> "SqlFile": """Indicate that the current sql file has multiple upstream dependencies. This tells the task runner that before this file can be executed, *dependencies* must all be executed successfully. :return: An updated ver...
Indicate that the current sql file has multiple upstream dependencies. This tells the task runner that before this file can be executed, *dependencies* must all be executed successfully. :return: An updated version of the current :class:`SqlFile` with new dependencies :rtype: SqlFile ...
Indicate that the current sql file has multiple upstream dependencies. This tells the task runner that before this file can be executed, *dependencies must all be executed successfully.
[ "Indicate", "that", "the", "current", "sql", "file", "has", "multiple", "upstream", "dependencies", ".", "This", "tells", "the", "task", "runner", "that", "before", "this", "file", "can", "be", "executed", "*", "dependencies", "must", "all", "be", "executed", ...
def with_dependencies(self, dependencies: List["SqlFile"]) -> "SqlFile": dep_list: List["SqlFile"] = list(self.dependencies) new_dependencies = tuple(self.merge_from_list(dep_list, dependencies)) return attr.evolve(self, dependencies=new_dependencies)
[ "def", "with_dependencies", "(", "self", ",", "dependencies", ":", "List", "[", "\"SqlFile\"", "]", ")", "->", "\"SqlFile\"", ":", "dep_list", ":", "List", "[", "\"SqlFile\"", "]", "=", "list", "(", "self", ".", "dependencies", ")", "new_dependencies", "=", ...
Indicate that the current sql file has multiple upstream dependencies.
[ "Indicate", "that", "the", "current", "sql", "file", "has", "multiple", "upstream", "dependencies", "." ]
[ "\"\"\"Indicate that the current sql file has multiple upstream dependencies.\n\n This tells the task runner that before this file can be executed, *dependencies*\n must all be executed successfully.\n\n :return: An updated version of the current :class:`SqlFile` with new dependencies\n ...
[ { "param": "self", "type": null }, { "param": "dependencies", "type": "List[\"SqlFile\"]" } ]
{ "returns": [ { "docstring": "An updated version of the current :class:`SqlFile` with new dependencies", "docstring_tokens": [ "An", "updated", "version", "of", "the", "current", ":", "class", ":", "`", "SqlFile",...
9b99b56ed68b9cd5a6c95205a5538adbf6f3476b
techalchemy/airflow-sync
src/airflow_sync/utils.py
[ "MIT" ]
Python
with_trigger
"SqlFile"
def with_trigger(self, sql_file: "SqlFile") -> "SqlFile": """Indicate that the current sql file triggers *sql_file* to run This tells the task runner that before after this file is executed, *sql_file* should be executed. :param SqlFile sql_file: A :class:`SqlFile` instance which must ...
Indicate that the current sql file triggers *sql_file* to run This tells the task runner that before after this file is executed, *sql_file* should be executed. :param SqlFile sql_file: A :class:`SqlFile` instance which must run first :return: An updated version of the current :class:`...
Indicate that the current sql file triggers *sql_file* to run This tells the task runner that before after this file is executed, *sql_file should be executed.
[ "Indicate", "that", "the", "current", "sql", "file", "triggers", "*", "sql_file", "*", "to", "run", "This", "tells", "the", "task", "runner", "that", "before", "after", "this", "file", "is", "executed", "*", "sql_file", "should", "be", "executed", "." ]
def with_trigger(self, sql_file: "SqlFile") -> "SqlFile": trigger_list: List["SqlFile"] = list(self.triggers) new_triggers = tuple(self.merge_and_update(trigger_list, sql_file)) return attr.evolve(self, triggers=new_triggers)
[ "def", "with_trigger", "(", "self", ",", "sql_file", ":", "\"SqlFile\"", ")", "->", "\"SqlFile\"", ":", "trigger_list", ":", "List", "[", "\"SqlFile\"", "]", "=", "list", "(", "self", ".", "triggers", ")", "new_triggers", "=", "tuple", "(", "self", ".", ...
Indicate that the current sql file triggers *sql_file* to run This tells the task runner that before after this file is executed, *sql_file should be executed.
[ "Indicate", "that", "the", "current", "sql", "file", "triggers", "*", "sql_file", "*", "to", "run", "This", "tells", "the", "task", "runner", "that", "before", "after", "this", "file", "is", "executed", "*", "sql_file", "should", "be", "executed", "." ]
[ "\"\"\"Indicate that the current sql file triggers *sql_file* to run\n\n This tells the task runner that before after this file is executed, *sql_file*\n should be executed.\n\n :param SqlFile sql_file: A :class:`SqlFile` instance which must run first\n :return: An updated version of the...
[ { "param": "self", "type": null }, { "param": "sql_file", "type": "\"SqlFile\"" } ]
{ "returns": [ { "docstring": "An updated version of the current :class:`SqlFile` with new triggers", "docstring_tokens": [ "An", "updated", "version", "of", "the", "current", ":", "class", ":", "`", "SqlFile", ...
9b99b56ed68b9cd5a6c95205a5538adbf6f3476b
techalchemy/airflow-sync
src/airflow_sync/utils.py
[ "MIT" ]
Python
with_triggers
"SqlFile"
def with_triggers(self, triggers: List["SqlFile"]) -> "SqlFile": """Indicate that the current sql file has multiple downstream triggers. This tells the task runner that after this file is executed, *triggers* must all be executed. :return: An updated version of the current :class:`SqlF...
Indicate that the current sql file has multiple downstream triggers. This tells the task runner that after this file is executed, *triggers* must all be executed. :return: An updated version of the current :class:`SqlFile` with new triggers :rtype: SqlFile
Indicate that the current sql file has multiple downstream triggers. This tells the task runner that after this file is executed, *triggers must all be executed.
[ "Indicate", "that", "the", "current", "sql", "file", "has", "multiple", "downstream", "triggers", ".", "This", "tells", "the", "task", "runner", "that", "after", "this", "file", "is", "executed", "*", "triggers", "must", "all", "be", "executed", "." ]
def with_triggers(self, triggers: List["SqlFile"]) -> "SqlFile": trigger_list: List["SqlFile"] = list(self.triggers) new_triggers = tuple(self.merge_from_list(trigger_list, triggers)) return attr.evolve(self, triggers=new_triggers)
[ "def", "with_triggers", "(", "self", ",", "triggers", ":", "List", "[", "\"SqlFile\"", "]", ")", "->", "\"SqlFile\"", ":", "trigger_list", ":", "List", "[", "\"SqlFile\"", "]", "=", "list", "(", "self", ".", "triggers", ")", "new_triggers", "=", "tuple", ...
Indicate that the current sql file has multiple downstream triggers.
[ "Indicate", "that", "the", "current", "sql", "file", "has", "multiple", "downstream", "triggers", "." ]
[ "\"\"\"Indicate that the current sql file has multiple downstream triggers.\n\n This tells the task runner that after this file is executed, *triggers*\n must all be executed.\n\n :return: An updated version of the current :class:`SqlFile` with new triggers\n :rtype: SqlFile\n \"\...
[ { "param": "self", "type": null }, { "param": "triggers", "type": "List[\"SqlFile\"]" } ]
{ "returns": [ { "docstring": "An updated version of the current :class:`SqlFile` with new triggers", "docstring_tokens": [ "An", "updated", "version", "of", "the", "current", ":", "class", ":", "`", "SqlFile", ...
9b99b56ed68b9cd5a6c95205a5538adbf6f3476b
techalchemy/airflow-sync
src/airflow_sync/utils.py
[ "MIT" ]
Python
with_child
"SqlFile"
def with_child(self, sql_file: "SqlFile") -> "SqlFile": """Indicate that the current sql file has a downstream dependant of *sql_file* This tells the task runner that after this file is executed, *sql_file* should be executed. :param SqlFile sql_file: A :class:`SqlFile` instance which ...
Indicate that the current sql file has a downstream dependant of *sql_file* This tells the task runner that after this file is executed, *sql_file* should be executed. :param SqlFile sql_file: A :class:`SqlFile` instance which waits on this file :return: An updated version of the curre...
Indicate that the current sql file has a downstream dependant of *sql_file This tells the task runner that after this file is executed, *sql_file* should be executed.
[ "Indicate", "that", "the", "current", "sql", "file", "has", "a", "downstream", "dependant", "of", "*", "sql_file", "This", "tells", "the", "task", "runner", "that", "after", "this", "file", "is", "executed", "*", "sql_file", "*", "should", "be", "executed", ...
def with_child(self, sql_file: "SqlFile") -> "SqlFile": dependant_list: List["SqlFile"] = list(self.dependants) new_dependants = tuple(self.merge_and_update(dependant_list, sql_file)) return attr.evolve(self, dependants=new_dependants)
[ "def", "with_child", "(", "self", ",", "sql_file", ":", "\"SqlFile\"", ")", "->", "\"SqlFile\"", ":", "dependant_list", ":", "List", "[", "\"SqlFile\"", "]", "=", "list", "(", "self", ".", "dependants", ")", "new_dependants", "=", "tuple", "(", "self", "."...
Indicate that the current sql file has a downstream dependant of *sql_file This tells the task runner that after this file is executed, *sql_file* should be executed.
[ "Indicate", "that", "the", "current", "sql", "file", "has", "a", "downstream", "dependant", "of", "*", "sql_file", "This", "tells", "the", "task", "runner", "that", "after", "this", "file", "is", "executed", "*", "sql_file", "*", "should", "be", "executed", ...
[ "\"\"\"Indicate that the current sql file has a downstream dependant of *sql_file*\n\n This tells the task runner that after this file is executed, *sql_file* should\n be executed.\n\n :param SqlFile sql_file: A :class:`SqlFile` instance which waits on this file\n :return: An updated ver...
[ { "param": "self", "type": null }, { "param": "sql_file", "type": "\"SqlFile\"" } ]
{ "returns": [ { "docstring": "An updated version of the current :class:`SqlFile` with new children", "docstring_tokens": [ "An", "updated", "version", "of", "the", "current", ":", "class", ":", "`", "SqlFile", ...
9b99b56ed68b9cd5a6c95205a5538adbf6f3476b
techalchemy/airflow-sync
src/airflow_sync/utils.py
[ "MIT" ]
Python
with_children
"SqlFile"
def with_children(self, children: List["SqlFile"]) -> "SqlFile": """Indicate that the current sql file has multiple downstream child dependants. This tells the task runner that after this file is executed, *dependencies* should all be executed. :return: An updated version of the curren...
Indicate that the current sql file has multiple downstream child dependants. This tells the task runner that after this file is executed, *dependencies* should all be executed. :return: An updated version of the current :class:`SqlFile` with new dependants :rtype: SqlFile
Indicate that the current sql file has multiple downstream child dependants. This tells the task runner that after this file is executed, *dependencies should all be executed.
[ "Indicate", "that", "the", "current", "sql", "file", "has", "multiple", "downstream", "child", "dependants", ".", "This", "tells", "the", "task", "runner", "that", "after", "this", "file", "is", "executed", "*", "dependencies", "should", "all", "be", "executed...
def with_children(self, children: List["SqlFile"]) -> "SqlFile": dependant_list: List["SqlFile"] = list(self.dependants) new_dependants = tuple(self.merge_from_list(dependant_list, children)) return attr.evolve(self, dependants=new_dependants)
[ "def", "with_children", "(", "self", ",", "children", ":", "List", "[", "\"SqlFile\"", "]", ")", "->", "\"SqlFile\"", ":", "dependant_list", ":", "List", "[", "\"SqlFile\"", "]", "=", "list", "(", "self", ".", "dependants", ")", "new_dependants", "=", "tup...
Indicate that the current sql file has multiple downstream child dependants.
[ "Indicate", "that", "the", "current", "sql", "file", "has", "multiple", "downstream", "child", "dependants", "." ]
[ "\"\"\"Indicate that the current sql file has multiple downstream child dependants.\n\n This tells the task runner that after this file is executed, *dependencies*\n should all be executed.\n\n :return: An updated version of the current :class:`SqlFile` with new dependants\n :rtype: SqlF...
[ { "param": "self", "type": null }, { "param": "children", "type": "List[\"SqlFile\"]" } ]
{ "returns": [ { "docstring": "An updated version of the current :class:`SqlFile` with new dependants", "docstring_tokens": [ "An", "updated", "version", "of", "the", "current", ":", "class", ":", "`", "SqlFile", ...
9b99b56ed68b9cd5a6c95205a5538adbf6f3476b
techalchemy/airflow-sync
src/airflow_sync/utils.py
[ "MIT" ]
Python
from_tuple
Tuple["SqlFile", List["SqlFile"], Optional[List["SqlFile"]]]
def from_tuple( cls, pipeline: Tuple[ Union[str, Path], Union[str, List[Union[str, "SqlFile"]]], List[Union[str, "SqlFile"]], ], ) -> Tuple["SqlFile", List["SqlFile"], Optional[List["SqlFile"]]]: """Creates a :class:`SqlFile` instance from a tuple ...
Creates a :class:`SqlFile` instance from a tuple of file paths. :return: A new :class:`SqlFile` and its corresponding triggers and trigger deps :rtype: Tuple[`SqlFile`, List[`SqlFile`], Optional[List[`SqlFile`]]]
Creates a :class:`SqlFile` instance from a tuple of file paths.
[ "Creates", "a", ":", "class", ":", "`", "SqlFile", "`", "instance", "from", "a", "tuple", "of", "file", "paths", "." ]
def from_tuple( cls, pipeline: Tuple[ Union[str, Path], Union[str, List[Union[str, "SqlFile"]]], List[Union[str, "SqlFile"]], ], ) -> Tuple["SqlFile", List["SqlFile"], Optional[List["SqlFile"]]]: path, triggers, deps = pipeline trigger_list...
[ "def", "from_tuple", "(", "cls", ",", "pipeline", ":", "Tuple", "[", "Union", "[", "str", ",", "Path", "]", ",", "Union", "[", "str", ",", "List", "[", "Union", "[", "str", ",", "\"SqlFile\"", "]", "]", "]", ",", "List", "[", "Union", "[", "str",...
Creates a :class:`SqlFile` instance from a tuple of file paths.
[ "Creates", "a", ":", "class", ":", "`", "SqlFile", "`", "instance", "from", "a", "tuple", "of", "file", "paths", "." ]
[ "\"\"\"Creates a :class:`SqlFile` instance from a tuple of file paths.\n\n :return: A new :class:`SqlFile` and its corresponding triggers and trigger deps\n :rtype: Tuple[`SqlFile`, List[`SqlFile`], Optional[List[`SqlFile`]]]\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "pipeline", "type": "Tuple[\n Union[str, Path],\n Union[str, List[Union[str, \"SqlFile\"]]],\n List[Union[str, \"SqlFile\"]],\n ]" } ]
{ "returns": [ { "docstring": "A new :class:`SqlFile` and its corresponding triggers and trigger deps", "docstring_tokens": [ "A", "new", ":", "class", ":", "`", "SqlFile", "`", "and", "its", "corresponding", ...
9b99b56ed68b9cd5a6c95205a5538adbf6f3476b
techalchemy/airflow-sync
src/airflow_sync/utils.py
[ "MIT" ]
Python
annotated_last
null
def annotated_last(seq): """Returns an iterable of pairs of input item and a boolean that show if the current item is the last item in the sequence.""" MISSING = object() for current_item, next_item in pairwise(chain(seq, [MISSING])): yield current_item, next_item is MISSING
Returns an iterable of pairs of input item and a boolean that show if the current item is the last item in the sequence.
Returns an iterable of pairs of input item and a boolean that show if the current item is the last item in the sequence.
[ "Returns", "an", "iterable", "of", "pairs", "of", "input", "item", "and", "a", "boolean", "that", "show", "if", "the", "current", "item", "is", "the", "last", "item", "in", "the", "sequence", "." ]
def annotated_last(seq): MISSING = object() for current_item, next_item in pairwise(chain(seq, [MISSING])): yield current_item, next_item is MISSING
[ "def", "annotated_last", "(", "seq", ")", ":", "MISSING", "=", "object", "(", ")", "for", "current_item", ",", "next_item", "in", "pairwise", "(", "chain", "(", "seq", ",", "[", "MISSING", "]", ")", ")", ":", "yield", "current_item", ",", "next_item", ...
Returns an iterable of pairs of input item and a boolean that show if the current item is the last item in the sequence.
[ "Returns", "an", "iterable", "of", "pairs", "of", "input", "item", "and", "a", "boolean", "that", "show", "if", "the", "current", "item", "is", "the", "last", "item", "in", "the", "sequence", "." ]
[ "\"\"\"Returns an iterable of pairs of input item and a boolean that show if\n the current item is the last item in the sequence.\"\"\"" ]
[ { "param": "seq", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "seq", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4a9c06f7803dd420a9a1fd4517cab90870a30fba
fortierq/mkdocs-jupyter
mkdocs_jupyter/utils.py
[ "Apache-2.0" ]
Python
slugify
<not_specific>
def slugify(value): """ Converts to lowercase, removes non-word characters (alphanumerics and underscores) and converts spaces to hyphens. Also strips leading and trailing whitespace. """ value = ( unicodedata.normalize("NFKD", value) .encode("ascii", "ignore") .decode("a...
Converts to lowercase, removes non-word characters (alphanumerics and underscores) and converts spaces to hyphens. Also strips leading and trailing whitespace.
Converts to lowercase, removes non-word characters (alphanumerics and underscores) and converts spaces to hyphens. Also strips leading and trailing whitespace.
[ "Converts", "to", "lowercase", "removes", "non", "-", "word", "characters", "(", "alphanumerics", "and", "underscores", ")", "and", "converts", "spaces", "to", "hyphens", ".", "Also", "strips", "leading", "and", "trailing", "whitespace", "." ]
def slugify(value): value = ( unicodedata.normalize("NFKD", value) .encode("ascii", "ignore") .decode("ascii") ) value = re.sub(r"[^\w\s-]", "", value).strip().lower() return re.sub(r"[-\s]+", "-", value)
[ "def", "slugify", "(", "value", ")", ":", "value", "=", "(", "unicodedata", ".", "normalize", "(", "\"NFKD\"", ",", "value", ")", ".", "encode", "(", "\"ascii\"", ",", "\"ignore\"", ")", ".", "decode", "(", "\"ascii\"", ")", ")", "value", "=", "re", ...
Converts to lowercase, removes non-word characters (alphanumerics and underscores) and converts spaces to hyphens.
[ "Converts", "to", "lowercase", "removes", "non", "-", "word", "characters", "(", "alphanumerics", "and", "underscores", ")", "and", "converts", "spaces", "to", "hyphens", "." ]
[ "\"\"\"\n Converts to lowercase, removes non-word characters (alphanumerics and\n underscores) and converts spaces to hyphens. Also strips leading and\n trailing whitespace.\n \"\"\"" ]
[ { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "value", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1b443cdc4222480e60e6155f6c9467c8441a35ba
cselab/aphros
deploy/scripts/aphros/vtk.py
[ "MIT" ]
Python
ReadVtkPoly
<not_specific>
def ReadVtkPoly(f, verbose=False): """ Reads vtk points, polygons and fields from legacy VTK file. f: `str` or file-like Path to legacy VTK file or file-like object. Returns: points: `numpy.ndarray`, (num_points, 3) Points (vertices). poly: `list` [`list` [ `int` ]], (num_cells, ...
Reads vtk points, polygons and fields from legacy VTK file. f: `str` or file-like Path to legacy VTK file or file-like object. Returns: points: `numpy.ndarray`, (num_points, 3) Points (vertices). poly: `list` [`list` [ `int` ]], (num_cells, ...) Polygons as lists of indices ...
Reads vtk points, polygons and fields from legacy VTK file. f: `str` or file-like Path to legacy VTK file or file-like object.
[ "Reads", "vtk", "points", "polygons", "and", "fields", "from", "legacy", "VTK", "file", ".", "f", ":", "`", "str", "`", "or", "file", "-", "like", "Path", "to", "legacy", "VTK", "file", "or", "file", "-", "like", "object", "." ]
def ReadVtkPoly(f, verbose=False): def Assert(cond, msg=""): if not cond: caller = inspect.getframeinfo(inspect.stack()[1][0]) lines = "\n".join(caller[3]).strip() filename = os.path.basename(caller.filename) lineno = caller.lineno printerr("\n{:}:...
[ "def", "ReadVtkPoly", "(", "f", ",", "verbose", "=", "False", ")", ":", "def", "Assert", "(", "cond", ",", "msg", "=", "\"\"", ")", ":", "if", "not", "cond", ":", "caller", "=", "inspect", ".", "getframeinfo", "(", "inspect", ".", "stack", "(", ")"...
Reads vtk points, polygons and fields from legacy VTK file.
[ "Reads", "vtk", "points", "polygons", "and", "fields", "from", "legacy", "VTK", "file", "." ]
[ "\"\"\"\n Reads vtk points, polygons and fields from legacy VTK file.\n f: `str` or file-like\n Path to legacy VTK file or file-like object.\n Returns:\n points: `numpy.ndarray`, (num_points, 3)\n Points (vertices).\n poly: `list` [`list` [ `int` ]], (num_cells, ...)\n Polygons a...
[ { "param": "f", "type": null }, { "param": "verbose", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "f", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }...
38259c6d0c3df48e25403f1f3cf68cc441159d09
cselab/aphros
deploy/scripts/plottools/plottools.py
[ "MIT" ]
Python
cache_to_file
<not_specific>
def cache_to_file(targetbase, update=False, arg0=False): """ Factory for a decorator that caches the result of function and stores it to a target file. targetbase: base path to cache file update: force cache update arg0: append cache name by first argument converted to string Example: Crea...
Factory for a decorator that caches the result of function and stores it to a target file. targetbase: base path to cache file update: force cache update arg0: append cache name by first argument converted to string Example: Creates file "_cache_7.pickle" with `int(7)`. @cache_to_file("_...
Factory for a decorator that caches the result of function and stores it to a target file. base path to cache file update: force cache update arg0: append cache name by first argument converted to string
[ "Factory", "for", "a", "decorator", "that", "caches", "the", "result", "of", "function", "and", "stores", "it", "to", "a", "target", "file", ".", "base", "path", "to", "cache", "file", "update", ":", "force", "cache", "update", "arg0", ":", "append", "ca...
def cache_to_file(targetbase, update=False, arg0=False): ext = os.path.splitext(targetbase)[1] if ext == '.pickle': import pickle def load(path): with open(path, 'rb') as f: print("Loading cache '{}'".format(path)) return pickle.load(f) def sav...
[ "def", "cache_to_file", "(", "targetbase", ",", "update", "=", "False", ",", "arg0", "=", "False", ")", ":", "ext", "=", "os", ".", "path", ".", "splitext", "(", "targetbase", ")", "[", "1", "]", "if", "ext", "==", "'.pickle'", ":", "import", "pickle...
Factory for a decorator that caches the result of function and stores it to a target file.
[ "Factory", "for", "a", "decorator", "that", "caches", "the", "result", "of", "function", "and", "stores", "it", "to", "a", "target", "file", "." ]
[ "\"\"\"\n Factory for a decorator that caches the result of\n function and stores it to a target file.\n\n targetbase: base path to cache file\n update: force cache update\n arg0: append cache name by first argument converted to string\n\n Example: Creates file \"_cache_7.pickle\" with `int(7)`.\n...
[ { "param": "targetbase", "type": null }, { "param": "update", "type": null }, { "param": "arg0", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "targetbase", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "update", "type": null, "docstring": null, "docstring_to...
38259c6d0c3df48e25403f1f3cf68cc441159d09
cselab/aphros
deploy/scripts/plottools/plottools.py
[ "MIT" ]
Python
savelegend
null
def savelegend(fig, ax, path, detect_codes=False, **kwargs): """ detect_codes: prepend labels with style codes detected from lines """ figleg, axleg = plt.subplots() handles, labels = ax.get_legend_handles_labels() if detect_codes: labels = [ code_to_str(line_to_code(h)) + ' ...
detect_codes: prepend labels with style codes detected from lines
prepend labels with style codes detected from lines
[ "prepend", "labels", "with", "style", "codes", "detected", "from", "lines" ]
def savelegend(fig, ax, path, detect_codes=False, **kwargs): figleg, axleg = plt.subplots() handles, labels = ax.get_legend_handles_labels() if detect_codes: labels = [ code_to_str(line_to_code(h)) + ' ' + l for h, l in zip(handles, labels) ] legend = axleg.legend...
[ "def", "savelegend", "(", "fig", ",", "ax", ",", "path", ",", "detect_codes", "=", "False", ",", "**", "kwargs", ")", ":", "figleg", ",", "axleg", "=", "plt", ".", "subplots", "(", ")", "handles", ",", "labels", "=", "ax", ".", "get_legend_handles_labe...
detect_codes: prepend labels with style codes detected from lines
[ "detect_codes", ":", "prepend", "labels", "with", "style", "codes", "detected", "from", "lines" ]
[ "\"\"\"\n detect_codes: prepend labels with style codes detected from lines\n \"\"\"", "# FIXME workaround for many lines (>5), incorrect box size" ]
[ { "param": "fig", "type": null }, { "param": "ax", "type": null }, { "param": "path", "type": null }, { "param": "detect_codes", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fig", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ax", "type": null, "docstring": null, "docstring_tokens": [], ...
ebff8287e9ba97a3278e7d65f7937b9d394a4fce
cselab/aphros
deploy/scripts/aphros/io.py
[ "MIT" ]
Python
read_raw
<not_specific>
def read_raw(xmfpath): ''' Returns array from scalar field in raw format. xmfpath: path to xmf metadata file ''' shape, rawpath = parse_raw_xmf(xmfpath) u = np.fromfile(rawpath).reshape(shape) return u
Returns array from scalar field in raw format. xmfpath: path to xmf metadata file
Returns array from scalar field in raw format. xmfpath: path to xmf metadata file
[ "Returns", "array", "from", "scalar", "field", "in", "raw", "format", ".", "xmfpath", ":", "path", "to", "xmf", "metadata", "file" ]
def read_raw(xmfpath): shape, rawpath = parse_raw_xmf(xmfpath) u = np.fromfile(rawpath).reshape(shape) return u
[ "def", "read_raw", "(", "xmfpath", ")", ":", "shape", ",", "rawpath", "=", "parse_raw_xmf", "(", "xmfpath", ")", "u", "=", "np", ".", "fromfile", "(", "rawpath", ")", ".", "reshape", "(", "shape", ")", "return", "u" ]
Returns array from scalar field in raw format.
[ "Returns", "array", "from", "scalar", "field", "in", "raw", "format", "." ]
[ "'''\n Returns array from scalar field in raw format.\n xmfpath: path to xmf metadata file\n '''" ]
[ { "param": "xmfpath", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "xmfpath", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bff4434eafe4f42b2b3d625d3b4635b1aca654b4
felipevicens/csv-compare
excel_compare/scripts/excel.py
[ "Apache-2.0" ]
Python
convert_excel_csv
<not_specific>
def convert_excel_csv(filename): ''' This function convert a xls or xlsx file into a multiple csv files in temp directory Return a list of csv files in the tmp directory ''' excel = pd.ExcelFile(filename) sheets = excel.sheet_names files_location = f"/tmp/{filename}" os.mkdir(files_locat...
This function convert a xls or xlsx file into a multiple csv files in temp directory Return a list of csv files in the tmp directory
This function convert a xls or xlsx file into a multiple csv files in temp directory Return a list of csv files in the tmp directory
[ "This", "function", "convert", "a", "xls", "or", "xlsx", "file", "into", "a", "multiple", "csv", "files", "in", "temp", "directory", "Return", "a", "list", "of", "csv", "files", "in", "the", "tmp", "directory" ]
def convert_excel_csv(filename): excel = pd.ExcelFile(filename) sheets = excel.sheet_names files_location = f"/tmp/{filename}" os.mkdir(files_location) for sheet in sheets: sheet_content = pd.read_excel(excel, sheet) sheet_filename = f'/tmp/{filename}/{sheet}.csv' sheet_conte...
[ "def", "convert_excel_csv", "(", "filename", ")", ":", "excel", "=", "pd", ".", "ExcelFile", "(", "filename", ")", "sheets", "=", "excel", ".", "sheet_names", "files_location", "=", "f\"/tmp/{filename}\"", "os", ".", "mkdir", "(", "files_location", ")", "for",...
This function convert a xls or xlsx file into a multiple csv files in temp directory Return a list of csv files in the tmp directory
[ "This", "function", "convert", "a", "xls", "or", "xlsx", "file", "into", "a", "multiple", "csv", "files", "in", "temp", "directory", "Return", "a", "list", "of", "csv", "files", "in", "the", "tmp", "directory" ]
[ "'''\n This function convert a xls or xlsx file into a multiple csv files in temp directory\n Return a list of csv files in the tmp directory\n '''" ]
[ { "param": "filename", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cc9a4cab6051e18af33088e93861c180f6977610
felipevicens/csv-compare
excel_compare/scripts/compare.py
[ "Apache-2.0" ]
Python
cli
<not_specific>
def cli(process, old, new, ui, clean): """ Excel Workbook row-by-row comparison. \b Process by comparing all sheets between two xls/xlsx files or comparing all csv files between 2 folders. \b When option --process is "folder". It receive 2 arguments: ...
Excel Workbook row-by-row comparison. \b Process by comparing all sheets between two xls/xlsx files or comparing all csv files between 2 folders. \b When option --process is "folder". It receive 2 arguments: - First: The folder containing the old csv f...
Excel Workbook row-by-row comparison. \b Process by comparing all sheets between two xls/xlsx files or comparing all csv files between 2 folders. \b When option --process is "folder". It receive 2 arguments: First: The folder containing the old csv files to be compared Second: The folder containing the new csv files t...
[ "Excel", "Workbook", "row", "-", "by", "-", "row", "comparison", ".", "\\", "b", "Process", "by", "comparing", "all", "sheets", "between", "two", "xls", "/", "xlsx", "files", "or", "comparing", "all", "csv", "files", "between", "2", "folders", ".", "\\",...
def cli(process, old, new, ui, clean): missing_sheets = [] different_sheets = [] def color_diff(diff, clean): for line in diff: if line.startswith('+'): yield f"{Fore.GREEN}{line}{Fore.RESET}" elif line.startswith('-'): yield f"{Fore.RED}{line}...
[ "def", "cli", "(", "process", ",", "old", ",", "new", ",", "ui", ",", "clean", ")", ":", "missing_sheets", "=", "[", "]", "different_sheets", "=", "[", "]", "def", "color_diff", "(", "diff", ",", "clean", ")", ":", "\"\"\"\n Color the difference...
Excel Workbook row-by-row comparison.
[ "Excel", "Workbook", "row", "-", "by", "-", "row", "comparison", "." ]
[ "\"\"\"\n Excel Workbook row-by-row comparison.\n \n \\b\n Process by comparing all sheets between two xls/xlsx files or \n comparing all csv files between 2 folders.\n\n \\b\n When option --process is \"folder\". It receive 2 arguments:\n - First: The folder ...
[ { "param": "process", "type": null }, { "param": "old", "type": null }, { "param": "new", "type": null }, { "param": "ui", "type": null }, { "param": "clean", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "process", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "old", "type": null, "docstring": null, "docstring_tokens":...
cc9a4cab6051e18af33088e93861c180f6977610
felipevicens/csv-compare
excel_compare/scripts/compare.py
[ "Apache-2.0" ]
Python
color_diff
null
def color_diff(diff, clean): """ Color the differences from difflib library :param fname: file path :return: checksum string """ for line in diff: if line.startswith('+'): yield f"{Fore.GREEN}{line}{Fore.RESET}" elif lin...
Color the differences from difflib library :param fname: file path :return: checksum string
Color the differences from difflib library
[ "Color", "the", "differences", "from", "difflib", "library" ]
def color_diff(diff, clean): for line in diff: if line.startswith('+'): yield f"{Fore.GREEN}{line}{Fore.RESET}" elif line.startswith('-'): yield f"{Fore.RED}{line}{Fore.RESET}" elif line.startswith('^'): yield f"{Fore.BLUE}{line...
[ "def", "color_diff", "(", "diff", ",", "clean", ")", ":", "for", "line", "in", "diff", ":", "if", "line", ".", "startswith", "(", "'+'", ")", ":", "yield", "f\"{Fore.GREEN}{line}{Fore.RESET}\"", "elif", "line", ".", "startswith", "(", "'-'", ")", ":", "y...
Color the differences from difflib library
[ "Color", "the", "differences", "from", "difflib", "library" ]
[ "\"\"\"\n Color the differences from difflib library\n :param fname: file path\n :return: checksum string\n \"\"\"" ]
[ { "param": "diff", "type": null }, { "param": "clean", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "diff", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
430a5a659ce1a889e9a365719536c0af3572d9f6
samifriedrich/showquester
showquester.py
[ "MIT" ]
Python
events_df
<not_specific>
def events_df(event_list): """Creates a dataframe out of Songkick events results Excludes events flagged on Songkick as 'cancelled'.""" dates = [] artists = [] ids = [] for event in event_list: status = event['status'] cancelled = status == "cancelled" if not cancelled: ...
Creates a dataframe out of Songkick events results Excludes events flagged on Songkick as 'cancelled'.
Creates a dataframe out of Songkick events results Excludes events flagged on Songkick as 'cancelled'.
[ "Creates", "a", "dataframe", "out", "of", "Songkick", "events", "results", "Excludes", "events", "flagged", "on", "Songkick", "as", "'", "cancelled", "'", "." ]
def events_df(event_list): dates = [] artists = [] ids = [] for event in event_list: status = event['status'] cancelled = status == "cancelled" if not cancelled: performance = event['performance'] num_performers = len(performance) for artist in...
[ "def", "events_df", "(", "event_list", ")", ":", "dates", "=", "[", "]", "artists", "=", "[", "]", "ids", "=", "[", "]", "for", "event", "in", "event_list", ":", "status", "=", "event", "[", "'status'", "]", "cancelled", "=", "status", "==", "\"cance...
Creates a dataframe out of Songkick events results Excludes events flagged on Songkick as 'cancelled'.
[ "Creates", "a", "dataframe", "out", "of", "Songkick", "events", "results", "Excludes", "events", "flagged", "on", "Songkick", "as", "'", "cancelled", "'", "." ]
[ "\"\"\"Creates a dataframe out of Songkick events results\n\n Excludes events flagged on Songkick as 'cancelled'.\"\"\"" ]
[ { "param": "event_list", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "event_list", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
430a5a659ce1a889e9a365719536c0af3572d9f6
samifriedrich/showquester
showquester.py
[ "MIT" ]
Python
create_sq_playlist
<not_specific>
def create_sq_playlist(venue_name, venue_city, venue_state): """Create an empty Showquester playlist on Spotify for a given venue""" playlist_name = f"ShowQuester: {venue_name} ({venue_city}, {venue_state})" results = sp.user_playlist_create(username, playlist_name, public=True) playlist_uri = results['...
Create an empty Showquester playlist on Spotify for a given venue
Create an empty Showquester playlist on Spotify for a given venue
[ "Create", "an", "empty", "Showquester", "playlist", "on", "Spotify", "for", "a", "given", "venue" ]
def create_sq_playlist(venue_name, venue_city, venue_state): playlist_name = f"ShowQuester: {venue_name} ({venue_city}, {venue_state})" results = sp.user_playlist_create(username, playlist_name, public=True) playlist_uri = results['uri'] print(f'Created playlist "{playlist_name}"') return [playlist_...
[ "def", "create_sq_playlist", "(", "venue_name", ",", "venue_city", ",", "venue_state", ")", ":", "playlist_name", "=", "f\"ShowQuester: {venue_name} ({venue_city}, {venue_state})\"", "results", "=", "sp", ".", "user_playlist_create", "(", "username", ",", "playlist_name", ...
Create an empty Showquester playlist on Spotify for a given venue
[ "Create", "an", "empty", "Showquester", "playlist", "on", "Spotify", "for", "a", "given", "venue" ]
[ "\"\"\"Create an empty Showquester playlist on Spotify for a given venue\"\"\"" ]
[ { "param": "venue_name", "type": null }, { "param": "venue_city", "type": null }, { "param": "venue_state", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "venue_name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "venue_city", "type": null, "docstring": null, "docstrin...
430a5a659ce1a889e9a365719536c0af3572d9f6
samifriedrich/showquester
showquester.py
[ "MIT" ]
Python
build_playlist_description
<not_specific>
def build_playlist_description(venue_name, venue_url, venue_city, venue_state): """Create description for ShowQuester playlist.""" todays_date = datetime.date.today() github_url = "https://github.com/samifriedrich/showquester" descr = f"A programmatically-generated playlist featuring artists coming soon...
Create description for ShowQuester playlist.
Create description for ShowQuester playlist.
[ "Create", "description", "for", "ShowQuester", "playlist", "." ]
def build_playlist_description(venue_name, venue_url, venue_city, venue_state): todays_date = datetime.date.today() github_url = "https://github.com/samifriedrich/showquester" descr = f"A programmatically-generated playlist featuring artists coming soon to {venue_name} in {venue_city}, {venue_state}. Update...
[ "def", "build_playlist_description", "(", "venue_name", ",", "venue_url", ",", "venue_city", ",", "venue_state", ")", ":", "todays_date", "=", "datetime", ".", "date", ".", "today", "(", ")", "github_url", "=", "\"https://github.com/samifriedrich/showquester\"", "desc...
Create description for ShowQuester playlist.
[ "Create", "description", "for", "ShowQuester", "playlist", "." ]
[ "\"\"\"Create description for ShowQuester playlist.\"\"\"" ]
[ { "param": "venue_name", "type": null }, { "param": "venue_url", "type": null }, { "param": "venue_city", "type": null }, { "param": "venue_state", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "venue_name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "venue_url", "type": null, "docstring": null, "docstring...
430a5a659ce1a889e9a365719536c0af3572d9f6
samifriedrich/showquester
showquester.py
[ "MIT" ]
Python
update_playlist_details
<not_specific>
def update_playlist_details(playlist_id, playlist_name, playlist_descr): """Updates playlist details. NOTE: There are several reports of issues when updating playlist descriptions in the Spotify community. Currently, it seems the only solution is to wait for the server to update, which could take a day."""...
Updates playlist details. NOTE: There are several reports of issues when updating playlist descriptions in the Spotify community. Currently, it seems the only solution is to wait for the server to update, which could take a day.
Updates playlist details. NOTE: There are several reports of issues when updating playlist descriptions in the Spotify community. Currently, it seems the only solution is to wait for the server to update, which could take a day.
[ "Updates", "playlist", "details", ".", "NOTE", ":", "There", "are", "several", "reports", "of", "issues", "when", "updating", "playlist", "descriptions", "in", "the", "Spotify", "community", ".", "Currently", "it", "seems", "the", "only", "solution", "is", "to...
def update_playlist_details(playlist_id, playlist_name, playlist_descr): results = sp.user_playlist_change_details( username, playlist_id=playlist_id, name=playlist_name, description=playlist_descr) return results
[ "def", "update_playlist_details", "(", "playlist_id", ",", "playlist_name", ",", "playlist_descr", ")", ":", "results", "=", "sp", ".", "user_playlist_change_details", "(", "username", ",", "playlist_id", "=", "playlist_id", ",", "name", "=", "playlist_name", ",", ...
Updates playlist details.
[ "Updates", "playlist", "details", "." ]
[ "\"\"\"Updates playlist details.\n\n NOTE: There are several reports of issues when updating playlist descriptions in the Spotify community.\n Currently, it seems the only solution is to wait for the server to update, which could take a day.\"\"\"", "#print(f'Updated playlist \"{playlist_name}\"')" ]
[ { "param": "playlist_id", "type": null }, { "param": "playlist_name", "type": null }, { "param": "playlist_descr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "playlist_id", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "playlist_name", "type": null, "docstring": null, "docs...
6e75212d8e55ad11acef72fa5621c81f79718e1e
samifriedrich/showquester
flaskapp/app/routes.py
[ "MIT" ]
Python
create_sq_playlist
<not_specific>
def create_sq_playlist(venue_name, venue_city, venue_state): """Create an empty Showquester playlist on Spotify for a given venue""" playlist_name = f"ShowQuester: {venue_name} ({venue_city}, {venue_state})" results = sp.user_playlist_create(USERNAME, playlist_name, public=True) playlist_uri = results['...
Create an empty Showquester playlist on Spotify for a given venue
Create an empty Showquester playlist on Spotify for a given venue
[ "Create", "an", "empty", "Showquester", "playlist", "on", "Spotify", "for", "a", "given", "venue" ]
def create_sq_playlist(venue_name, venue_city, venue_state): playlist_name = f"ShowQuester: {venue_name} ({venue_city}, {venue_state})" results = sp.user_playlist_create(USERNAME, playlist_name, public=True) playlist_uri = results['uri'] print(f'Created playlist "{playlist_name}"') return [playlist_...
[ "def", "create_sq_playlist", "(", "venue_name", ",", "venue_city", ",", "venue_state", ")", ":", "playlist_name", "=", "f\"ShowQuester: {venue_name} ({venue_city}, {venue_state})\"", "results", "=", "sp", ".", "user_playlist_create", "(", "USERNAME", ",", "playlist_name", ...
Create an empty Showquester playlist on Spotify for a given venue
[ "Create", "an", "empty", "Showquester", "playlist", "on", "Spotify", "for", "a", "given", "venue" ]
[ "\"\"\"Create an empty Showquester playlist on Spotify for a given venue\"\"\"" ]
[ { "param": "venue_name", "type": null }, { "param": "venue_city", "type": null }, { "param": "venue_state", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "venue_name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "venue_city", "type": null, "docstring": null, "docstrin...
6e75212d8e55ad11acef72fa5621c81f79718e1e
samifriedrich/showquester
flaskapp/app/routes.py
[ "MIT" ]
Python
update_playlist_details
<not_specific>
def update_playlist_details(playlist_id, playlist_name, playlist_descr): """Updates playlist details. NOTE: There are several reports of issues when updating playlist descriptions in the Spotify community. Currently, it seems the only solution is to wait for the server to update, which could take a day.""" ...
Updates playlist details. NOTE: There are several reports of issues when updating playlist descriptions in the Spotify community. Currently, it seems the only solution is to wait for the server to update, which could take a day.
Updates playlist details. NOTE: There are several reports of issues when updating playlist descriptions in the Spotify community. Currently, it seems the only solution is to wait for the server to update, which could take a day.
[ "Updates", "playlist", "details", ".", "NOTE", ":", "There", "are", "several", "reports", "of", "issues", "when", "updating", "playlist", "descriptions", "in", "the", "Spotify", "community", ".", "Currently", "it", "seems", "the", "only", "solution", "is", "to...
def update_playlist_details(playlist_id, playlist_name, playlist_descr): results = sp.user_playlist_change_details( USERNAME, playlist_id=playlist_id, name=playlist_name, description=playlist_descr) return results
[ "def", "update_playlist_details", "(", "playlist_id", ",", "playlist_name", ",", "playlist_descr", ")", ":", "results", "=", "sp", ".", "user_playlist_change_details", "(", "USERNAME", ",", "playlist_id", "=", "playlist_id", ",", "name", "=", "playlist_name", ",", ...
Updates playlist details.
[ "Updates", "playlist", "details", "." ]
[ "\"\"\"Updates playlist details.\n NOTE: There are several reports of issues when updating playlist descriptions in the Spotify community.\n Currently, it seems the only solution is to wait for the server to update, which could take a day.\"\"\"", "#print(f'Updated playlist \"{playlist_name}\"')" ]
[ { "param": "playlist_id", "type": null }, { "param": "playlist_name", "type": null }, { "param": "playlist_descr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "playlist_id", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "playlist_name", "type": null, "docstring": null, "docs...
21ee70f7cc19c3d10e3918c24315c63e6143be1a
Famila1/plugin.video.example
main.py
[ "Python-2.0" ]
Python
list_videos
null
def list_videos(category): """ Create the list of playable videos in the Kodi interface. :param category: Category name :type category: str """ # Set plugin category. It is displayed in some skins as the name # of the current section. xbmcplugin.setPluginCategory(_HANDLE, category) ...
Create the list of playable videos in the Kodi interface. :param category: Category name :type category: str
Create the list of playable videos in the Kodi interface.
[ "Create", "the", "list", "of", "playable", "videos", "in", "the", "Kodi", "interface", "." ]
def list_videos(category): xbmcplugin.setPluginCategory(_HANDLE, category) xbmcplugin.setContent(_HANDLE, 'videos') videos = get_videos(category) for video in videos: list_item = xbmcgui.ListItem(label=video['name']) list_item.setInfo('video', {'title': video['name'], ...
[ "def", "list_videos", "(", "category", ")", ":", "xbmcplugin", ".", "setPluginCategory", "(", "_HANDLE", ",", "category", ")", "xbmcplugin", ".", "setContent", "(", "_HANDLE", ",", "'videos'", ")", "videos", "=", "get_videos", "(", "category", ")", "for", "v...
Create the list of playable videos in the Kodi interface.
[ "Create", "the", "list", "of", "playable", "videos", "in", "the", "Kodi", "interface", "." ]
[ "\"\"\"\n Create the list of playable videos in the Kodi interface.\n\n :param category: Category name\n :type category: str\n \"\"\"", "# Set plugin category. It is displayed in some skins as the name", "# of the current section.", "# Set plugin content. It allows Kodi to select appropriate views...
[ { "param": "category", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "category", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
21ee70f7cc19c3d10e3918c24315c63e6143be1a
Famila1/plugin.video.example
main.py
[ "Python-2.0" ]
Python
play_video
null
def play_video(path): """ Play a video by the provided path. :param path: Fully-qualified video URL :type path: str """ # Create a playable item with a path to play. play_item = xbmcgui.ListItem(path=path) # Pass the item to the Kodi player. xbmcplugin.setResolvedUrl(_HANDLE, True, ...
Play a video by the provided path. :param path: Fully-qualified video URL :type path: str
Play a video by the provided path.
[ "Play", "a", "video", "by", "the", "provided", "path", "." ]
def play_video(path): play_item = xbmcgui.ListItem(path=path) xbmcplugin.setResolvedUrl(_HANDLE, True, listitem=play_item)
[ "def", "play_video", "(", "path", ")", ":", "play_item", "=", "xbmcgui", ".", "ListItem", "(", "path", "=", "path", ")", "xbmcplugin", ".", "setResolvedUrl", "(", "_HANDLE", ",", "True", ",", "listitem", "=", "play_item", ")" ]
Play a video by the provided path.
[ "Play", "a", "video", "by", "the", "provided", "path", "." ]
[ "\"\"\"\n Play a video by the provided path.\n\n :param path: Fully-qualified video URL\n :type path: str\n \"\"\"", "# Create a playable item with a path to play.", "# Pass the item to the Kodi player." ]
[ { "param": "path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "path", "type": null, "docstring": "Fully-qualified video URL", "docstring_tokens": [ "Fully", "-", "qualified", "video", "URL" ], "default": null, "is_optional": null ...
f8d83efa8910083ef0a1a45fb0b85ed9ea2b65f5
shreyasumbetla/nngeometry
nngeometry/metrics.py
[ "MIT" ]
Python
FIM_MonteCarlo
<not_specific>
def FIM_MonteCarlo(model, loader, representation, variant='classif_logits', trials=1, device='cpu', function=None, layer_collection=None): """ Helper that creates a matrix computi...
Helper that creates a matrix computing the Fisher Information Matrix using a Monte-Carlo estimate of y|x with `trials` samples per example Parameters ---------- model : torch.nn.Module The model that contains all parameters of the function loader : torch.utils.data.DataLoader ...
Helper that creates a matrix computing the Fisher Information Matrix using a Monte-Carlo estimate of y|x with `trials` samples per example Parameters
[ "Helper", "that", "creates", "a", "matrix", "computing", "the", "Fisher", "Information", "Matrix", "using", "a", "Monte", "-", "Carlo", "estimate", "of", "y|x", "with", "`", "trials", "`", "samples", "per", "example", "Parameters" ]
def FIM_MonteCarlo(model, loader, representation, variant='classif_logits', trials=1, device='cpu', function=None, layer_collection=None): if function is None: def function(*d...
[ "def", "FIM_MonteCarlo", "(", "model", ",", "loader", ",", "representation", ",", "variant", "=", "'classif_logits'", ",", "trials", "=", "1", ",", "device", "=", "'cpu'", ",", "function", "=", "None", ",", "layer_collection", "=", "None", ")", ":", "if", ...
Helper that creates a matrix computing the Fisher Information Matrix using a Monte-Carlo estimate of y|x with `trials` samples per example
[ "Helper", "that", "creates", "a", "matrix", "computing", "the", "Fisher", "Information", "Matrix", "using", "a", "Monte", "-", "Carlo", "estimate", "of", "y|x", "with", "`", "trials", "`", "samples", "per", "example" ]
[ "\"\"\"\n Helper that creates a matrix computing the Fisher Information\n Matrix using a Monte-Carlo estimate of y|x with `trials` samples per\n example\n\n Parameters\n ----------\n model : torch.nn.Module\n The model that contains all parameters of the function\n loader : torch.utils.d...
[ { "param": "model", "type": null }, { "param": "loader", "type": null }, { "param": "representation", "type": null }, { "param": "variant", "type": null }, { "param": "trials", "type": null }, { "param": "device", "type": null }, { "param":...
{ "returns": [], "raises": [], "params": [ { "identifier": "model", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "loader", "type": null, "docstring": null, "docstring_tokens"...
bf3e969334ad1c5948a771b03b1a10cb1df7bd8e
shreyasumbetla/nngeometry
nngeometry/object/pspace.py
[ "MIT" ]
Python
solve
null
def solve(self, v, regul): """ Solves Fx = v in x :param regul: Tikhonov regularization :type regul: float :param v: v :type regul: PVector """ raise NotImplementedError
Solves Fx = v in x :param regul: Tikhonov regularization :type regul: float :param v: v :type regul: PVector
Solves Fx = v in x
[ "Solves", "Fx", "=", "v", "in", "x" ]
def solve(self, v, regul): raise NotImplementedError
[ "def", "solve", "(", "self", ",", "v", ",", "regul", ")", ":", "raise", "NotImplementedError" ]
Solves Fx = v in x
[ "Solves", "Fx", "=", "v", "in", "x" ]
[ "\"\"\"\n Solves Fx = v in x\n\n :param regul: Tikhonov regularization\n :type regul: float\n :param v: v\n :type regul: PVector\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "v", "type": null }, { "param": "regul", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "v", "type": null, "docstring": null, "docstring_tokens": [ ...
bf3e969334ad1c5948a771b03b1a10cb1df7bd8e
shreyasumbetla/nngeometry
nngeometry/object/pspace.py
[ "MIT" ]
Python
size
<not_specific>
def size(self, dim=None): """ Size of the matrix as a tuple, regardless of the actual size in memory. :param dim: dimension :type dim: int or None >>> M.size() (1254, 1254) >>> M.size(0) 1254 """ # TODO: test s = self.generator.la...
Size of the matrix as a tuple, regardless of the actual size in memory. :param dim: dimension :type dim: int or None >>> M.size() (1254, 1254) >>> M.size(0) 1254
Size of the matrix as a tuple, regardless of the actual size in memory.
[ "Size", "of", "the", "matrix", "as", "a", "tuple", "regardless", "of", "the", "actual", "size", "in", "memory", "." ]
def size(self, dim=None): s = self.generator.layer_collection.numel() if dim == 0 or dim == 1: return s elif dim is None: return (s, s) else: raise IndexError
[ "def", "size", "(", "self", ",", "dim", "=", "None", ")", ":", "s", "=", "self", ".", "generator", ".", "layer_collection", ".", "numel", "(", ")", "if", "dim", "==", "0", "or", "dim", "==", "1", ":", "return", "s", "elif", "dim", "is", "None", ...
Size of the matrix as a tuple, regardless of the actual size in memory.
[ "Size", "of", "the", "matrix", "as", "a", "tuple", "regardless", "of", "the", "actual", "size", "in", "memory", "." ]
[ "\"\"\"\n Size of the matrix as a tuple, regardless of the actual size in memory.\n\n :param dim: dimension\n :type dim: int or None\n\n >>> M.size()\n (1254, 1254)\n >>> M.size(0)\n 1254\n \"\"\"", "# TODO: test" ]
[ { "param": "self", "type": null }, { "param": "dim", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dim", "type": null, "docstring": null, "docstring_tokens": [ ...
bf3e969334ad1c5948a771b03b1a10cb1df7bd8e
shreyasumbetla/nngeometry
nngeometry/object/pspace.py
[ "MIT" ]
Python
_check_data_examples
null
def _check_data_examples(self, data, examples): """ Either data or examples has to be not None in order to populate the matrix. If both are not None, then it is ambiguous, then the following test will fail """ assert (data is not None) ^ (examples is not None)
Either data or examples has to be not None in order to populate the matrix. If both are not None, then it is ambiguous, then the following test will fail
Either data or examples has to be not None in order to populate the matrix. If both are not None, then it is ambiguous, then the following test will fail
[ "Either", "data", "or", "examples", "has", "to", "be", "not", "None", "in", "order", "to", "populate", "the", "matrix", ".", "If", "both", "are", "not", "None", "then", "it", "is", "ambiguous", "then", "the", "following", "test", "will", "fail" ]
def _check_data_examples(self, data, examples): assert (data is not None) ^ (examples is not None)
[ "def", "_check_data_examples", "(", "self", ",", "data", ",", "examples", ")", ":", "assert", "(", "data", "is", "not", "None", ")", "^", "(", "examples", "is", "not", "None", ")" ]
Either data or examples has to be not None in order to populate the matrix.
[ "Either", "data", "or", "examples", "has", "to", "be", "not", "None", "in", "order", "to", "populate", "the", "matrix", "." ]
[ "\"\"\"\n Either data or examples has to be not None in order\n to populate the matrix. If both are not None, then\n it is ambiguous, then the following test will fail\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "data", "type": null }, { "param": "examples", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": null, "docstring": null, "docstring_tokens": [...
bf3e969334ad1c5948a771b03b1a10cb1df7bd8e
shreyasumbetla/nngeometry
nngeometry/object/pspace.py
[ "MIT" ]
Python
solve
<not_specific>
def solve(self, v, regul=1e-8, impl='solve'): """ solves v = Ax in x """ # TODO: test if impl == 'solve': # TODO: reuse LU decomposition once it is computed inv_v, _ = torch.solve(v.get_flat_representation().view(-1, 1), ...
solves v = Ax in x
solves v = Ax in x
[ "solves", "v", "=", "Ax", "in", "x" ]
def solve(self, v, regul=1e-8, impl='solve'): if impl == 'solve': inv_v, _ = torch.solve(v.get_flat_representation().view(-1, 1), self.data + regul * torch.eye(self.size(0), dev...
[ "def", "solve", "(", "self", ",", "v", ",", "regul", "=", "1e-8", ",", "impl", "=", "'solve'", ")", ":", "if", "impl", "==", "'solve'", ":", "inv_v", ",", "_", "=", "torch", ".", "solve", "(", "v", ".", "get_flat_representation", "(", ")", ".", "...
solves v = Ax in x
[ "solves", "v", "=", "Ax", "in", "x" ]
[ "\"\"\"\n solves v = Ax in x\n \"\"\"", "# TODO: test", "# TODO: reuse LU decomposition once it is computed" ]
[ { "param": "self", "type": null }, { "param": "v", "type": null }, { "param": "regul", "type": null }, { "param": "impl", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "v", "type": null, "docstring": null, "docstring_tokens": [], ...
bf3e969334ad1c5948a771b03b1a10cb1df7bd8e
shreyasumbetla/nngeometry
nngeometry/object/pspace.py
[ "MIT" ]
Python
mm
<not_specific>
def mm(self, other): """ Matrix-matrix product where `other` is another instance of PMatDense :param other: Other FIM matrix :type other: :class:`nngeometry.object.PMatDense` :return: The matrix-matrix product :rtype: :class:`nngeometry.object.PMatDense` ...
Matrix-matrix product where `other` is another instance of PMatDense :param other: Other FIM matrix :type other: :class:`nngeometry.object.PMatDense` :return: The matrix-matrix product :rtype: :class:`nngeometry.object.PMatDense`
Matrix-matrix product where `other` is another instance of PMatDense
[ "Matrix", "-", "matrix", "product", "where", "`", "other", "`", "is", "another", "instance", "of", "PMatDense" ]
def mm(self, other): return PMatDense(self.generator, data=torch.mm(self.data, other.data))
[ "def", "mm", "(", "self", ",", "other", ")", ":", "return", "PMatDense", "(", "self", ".", "generator", ",", "data", "=", "torch", ".", "mm", "(", "self", ".", "data", ",", "other", ".", "data", ")", ")" ]
Matrix-matrix product where `other` is another instance of PMatDense
[ "Matrix", "-", "matrix", "product", "where", "`", "other", "`", "is", "another", "instance", "of", "PMatDense" ]
[ "\"\"\"\n Matrix-matrix product where `other` is another \n instance of PMatDense\n\n :param other: Other FIM matrix\n :type other: :class:`nngeometry.object.PMatDense`\n\n :return: The matrix-matrix product\n :rtype: :class:`nngeometry.object.PMatDense`\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "other", "type": null } ]
{ "returns": [ { "docstring": "The matrix-matrix product", "docstring_tokens": [ "The", "matrix", "-", "matrix", "product" ], "type": ":class:`nngeometry.object.PMatDense`" } ], "raises": [], "params": [ { "identifier": "self", ...
bf3e969334ad1c5948a771b03b1a10cb1df7bd8e
shreyasumbetla/nngeometry
nngeometry/object/pspace.py
[ "MIT" ]
Python
solve
<not_specific>
def solve(self, v, regul=1e-8): """ solves v = Ax in x """ # TODO: test solution = v.get_flat_representation() / (self.data + regul) return PVector(layer_collection=v.layer_collection, vector_repr=solution)
solves v = Ax in x
solves v = Ax in x
[ "solves", "v", "=", "Ax", "in", "x" ]
def solve(self, v, regul=1e-8): solution = v.get_flat_representation() / (self.data + regul) return PVector(layer_collection=v.layer_collection, vector_repr=solution)
[ "def", "solve", "(", "self", ",", "v", ",", "regul", "=", "1e-8", ")", ":", "solution", "=", "v", ".", "get_flat_representation", "(", ")", "/", "(", "self", ".", "data", "+", "regul", ")", "return", "PVector", "(", "layer_collection", "=", "v", ".",...
solves v = Ax in x
[ "solves", "v", "=", "Ax", "in", "x" ]
[ "\"\"\"\n solves v = Ax in x\n \"\"\"", "# TODO: test" ]
[ { "param": "self", "type": null }, { "param": "v", "type": null }, { "param": "regul", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "v", "type": null, "docstring": null, "docstring_tokens": [], ...
bf3e969334ad1c5948a771b03b1a10cb1df7bd8e
shreyasumbetla/nngeometry
nngeometry/object/pspace.py
[ "MIT" ]
Python
mm
<not_specific>
def mm(self, other): """ Matrix-matrix product where `other` is another instance of PMatDiag :param other: Other FIM matrix :type other: :class:`nngeometry.object.PMatDiag` :return: The matrix-matrix product :rtype: :class:`nngeometry.object.PMatDiag` "...
Matrix-matrix product where `other` is another instance of PMatDiag :param other: Other FIM matrix :type other: :class:`nngeometry.object.PMatDiag` :return: The matrix-matrix product :rtype: :class:`nngeometry.object.PMatDiag`
Matrix-matrix product where `other` is another instance of PMatDiag
[ "Matrix", "-", "matrix", "product", "where", "`", "other", "`", "is", "another", "instance", "of", "PMatDiag" ]
def mm(self, other): return PMatDiag(self.generator, data=self.data * other.data)
[ "def", "mm", "(", "self", ",", "other", ")", ":", "return", "PMatDiag", "(", "self", ".", "generator", ",", "data", "=", "self", ".", "data", "*", "other", ".", "data", ")" ]
Matrix-matrix product where `other` is another instance of PMatDiag
[ "Matrix", "-", "matrix", "product", "where", "`", "other", "`", "is", "another", "instance", "of", "PMatDiag" ]
[ "\"\"\"\n Matrix-matrix product where `other` is another \n instance of PMatDiag\n\n :param other: Other FIM matrix\n :type other: :class:`nngeometry.object.PMatDiag`\n\n :return: The matrix-matrix product\n :rtype: :class:`nngeometry.object.PMatDiag`\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "other", "type": null } ]
{ "returns": [ { "docstring": "The matrix-matrix product", "docstring_tokens": [ "The", "matrix", "-", "matrix", "product" ], "type": ":class:`nngeometry.object.PMatDiag`" } ], "raises": [], "params": [ { "identifier": "self", ...
bf3e969334ad1c5948a771b03b1a10cb1df7bd8e
shreyasumbetla/nngeometry
nngeometry/object/pspace.py
[ "MIT" ]
Python
mm
<not_specific>
def mm(self, other): """ Matrix-matrix product where `other` is another instance of PMatBlockDiag :param other: Other FIM matrix :type other: :class:`nngeometry.object.PMatBlockDiag` :return: The matrix-matrix product :rtype: :class:`nngeometry.object.PMatBlock...
Matrix-matrix product where `other` is another instance of PMatBlockDiag :param other: Other FIM matrix :type other: :class:`nngeometry.object.PMatBlockDiag` :return: The matrix-matrix product :rtype: :class:`nngeometry.object.PMatBlockDiag`
Matrix-matrix product where `other` is another instance of PMatBlockDiag
[ "Matrix", "-", "matrix", "product", "where", "`", "other", "`", "is", "another", "instance", "of", "PMatBlockDiag" ]
def mm(self, other): prod = dict() for layer_id, block in self.data.items(): block_other = other.data[layer_id] prod[layer_id] = torch.mm(block, block_other) return PMatBlockDiag(self.generator, data=prod)
[ "def", "mm", "(", "self", ",", "other", ")", ":", "prod", "=", "dict", "(", ")", "for", "layer_id", ",", "block", "in", "self", ".", "data", ".", "items", "(", ")", ":", "block_other", "=", "other", ".", "data", "[", "layer_id", "]", "prod", "[",...
Matrix-matrix product where `other` is another instance of PMatBlockDiag
[ "Matrix", "-", "matrix", "product", "where", "`", "other", "`", "is", "another", "instance", "of", "PMatBlockDiag" ]
[ "\"\"\"\n Matrix-matrix product where `other` is another \n instance of PMatBlockDiag\n\n :param other: Other FIM matrix\n :type other: :class:`nngeometry.object.PMatBlockDiag`\n\n :return: The matrix-matrix product\n :rtype: :class:`nngeometry.object.PMatBlockDiag`\n ...
[ { "param": "self", "type": null }, { "param": "other", "type": null } ]
{ "returns": [ { "docstring": "The matrix-matrix product", "docstring_tokens": [ "The", "matrix", "-", "matrix", "product" ], "type": ":class:`nngeometry.object.PMatBlockDiag`" } ], "raises": [], "params": [ { "identifier": "self"...
bf3e969334ad1c5948a771b03b1a10cb1df7bd8e
shreyasumbetla/nngeometry
nngeometry/object/pspace.py
[ "MIT" ]
Python
mm
<not_specific>
def mm(self, other): """ Matrix-matrix product where `other` is another instance of PMatKFAC :param other: Other FIM matrix :type other: :class:`nngeometry.object.PMatKFAC` :return: The matrix-matrix product :rtype: :class:`nngeometry.object.PMatKFAC` "...
Matrix-matrix product where `other` is another instance of PMatKFAC :param other: Other FIM matrix :type other: :class:`nngeometry.object.PMatKFAC` :return: The matrix-matrix product :rtype: :class:`nngeometry.object.PMatKFAC`
Matrix-matrix product where `other` is another instance of PMatKFAC
[ "Matrix", "-", "matrix", "product", "where", "`", "other", "`", "is", "another", "instance", "of", "PMatKFAC" ]
def mm(self, other): prod = dict() for layer_id, (a, g) in self.data.items(): (a_other, g_other) = other.data[layer_id] prod[layer_id] = (torch.mm(a, a_other), torch.mm(g, g_other)) return PMatKFAC(self.generator, data=prod)
[ "def", "mm", "(", "self", ",", "other", ")", ":", "prod", "=", "dict", "(", ")", "for", "layer_id", ",", "(", "a", ",", "g", ")", "in", "self", ".", "data", ".", "items", "(", ")", ":", "(", "a_other", ",", "g_other", ")", "=", "other", ".", ...
Matrix-matrix product where `other` is another instance of PMatKFAC
[ "Matrix", "-", "matrix", "product", "where", "`", "other", "`", "is", "another", "instance", "of", "PMatKFAC" ]
[ "\"\"\"\n Matrix-matrix product where `other` is another \n instance of PMatKFAC\n\n :param other: Other FIM matrix\n :type other: :class:`nngeometry.object.PMatKFAC`\n\n :return: The matrix-matrix product\n :rtype: :class:`nngeometry.object.PMatKFAC`\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "other", "type": null } ]
{ "returns": [ { "docstring": "The matrix-matrix product", "docstring_tokens": [ "The", "matrix", "-", "matrix", "product" ], "type": ":class:`nngeometry.object.PMatKFAC`" } ], "raises": [], "params": [ { "identifier": "self", ...
bf3e969334ad1c5948a771b03b1a10cb1df7bd8e
shreyasumbetla/nngeometry
nngeometry/object/pspace.py
[ "MIT" ]
Python
update_diag
null
def update_diag(self, examples): """ Will update the diagonal in the KFE (aka the approximate eigenvalues) using current values of the model's parameters """ self.data = (self.data[0], self.generator.get_kfe_diag(self.data[0], examples))
Will update the diagonal in the KFE (aka the approximate eigenvalues) using current values of the model's parameters
Will update the diagonal in the KFE (aka the approximate eigenvalues) using current values of the model's parameters
[ "Will", "update", "the", "diagonal", "in", "the", "KFE", "(", "aka", "the", "approximate", "eigenvalues", ")", "using", "current", "values", "of", "the", "model", "'", "s", "parameters" ]
def update_diag(self, examples): self.data = (self.data[0], self.generator.get_kfe_diag(self.data[0], examples))
[ "def", "update_diag", "(", "self", ",", "examples", ")", ":", "self", ".", "data", "=", "(", "self", ".", "data", "[", "0", "]", ",", "self", ".", "generator", ".", "get_kfe_diag", "(", "self", ".", "data", "[", "0", "]", ",", "examples", ")", ")...
Will update the diagonal in the KFE (aka the approximate eigenvalues) using current values of the model's parameters
[ "Will", "update", "the", "diagonal", "in", "the", "KFE", "(", "aka", "the", "approximate", "eigenvalues", ")", "using", "current", "values", "of", "the", "model", "'", "s", "parameters" ]
[ "\"\"\"\n Will update the diagonal in the KFE (aka the approximate eigenvalues)\n using current values of the model's parameters\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "examples", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "examples", "type": null, "docstring": null, "docstring_tokens...
3550df0a81d5f06baae883ad3f158873ddab62ed
shreyasumbetla/nngeometry
nngeometry/object/vector.py
[ "MIT" ]
Python
random_pvector_dict
<not_specific>
def random_pvector_dict(layer_collection, device=None): """ Returns a random :class:`nngeometry.object.PVector` object using the structure defined by the `layer_collection` parameter, with each components drawn from a normal distribution with mean 0 and standard deviation 1. The returned `PVec...
Returns a random :class:`nngeometry.object.PVector` object using the structure defined by the `layer_collection` parameter, with each components drawn from a normal distribution with mean 0 and standard deviation 1. The returned `PVector` will internally use a dict representation. :param lay...
Returns a random :class:`nngeometry.object.PVector` object using the structure defined by the `layer_collection` parameter, with each components drawn from a normal distribution with mean 0 and standard deviation 1. The returned `PVector` will internally use a dict representation.
[ "Returns", "a", "random", ":", "class", ":", "`", "nngeometry", ".", "object", ".", "PVector", "`", "object", "using", "the", "structure", "defined", "by", "the", "`", "layer_collection", "`", "parameter", "with", "each", "components", "drawn", "from", "a", ...
def random_pvector_dict(layer_collection, device=None): v_dict = dict() for layer_id, layer in layer_collection.layers.items(): if layer.bias is not None: v_dict[layer_id] = (torch.normal(0, 1, layer.weight.size, device=device), torch.normal(0, 1, layer.bias.s...
[ "def", "random_pvector_dict", "(", "layer_collection", ",", "device", "=", "None", ")", ":", "v_dict", "=", "dict", "(", ")", "for", "layer_id", ",", "layer", "in", "layer_collection", ".", "layers", ".", "items", "(", ")", ":", "if", "layer", ".", "bias...
Returns a random :class:`nngeometry.object.PVector` object using the structure defined by the `layer_collection` parameter, with each components drawn from a normal distribution with mean 0 and standard deviation 1.
[ "Returns", "a", "random", ":", "class", ":", "`", "nngeometry", ".", "object", ".", "PVector", "`", "object", "using", "the", "structure", "defined", "by", "the", "`", "layer_collection", "`", "parameter", "with", "each", "components", "drawn", "from", "a", ...
[ "\"\"\"\n Returns a random :class:`nngeometry.object.PVector` object using\n the structure defined by the `layer_collection` parameter, with \n each components drawn from a normal distribution with mean 0 and standard\n deviation 1.\n\n The returned `PVector` will internally use a dict representation...
[ { "param": "layer_collection", "type": null }, { "param": "device", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "layer_collection", "type": null, "docstring": "The :class:`nngeometry.layercollection.LayerCollection`\ndescribing the structure of the random pvector", "docstring_tokens": [ "The", ":", "class", ...
3550df0a81d5f06baae883ad3f158873ddab62ed
shreyasumbetla/nngeometry
nngeometry/object/vector.py
[ "MIT" ]
Python
random_pvector
<not_specific>
def random_pvector(layer_collection, device=None): """ Returns a random :class:`nngeometry.object.PVector` object using the structure defined by the `layer_collection` parameter, with each components drawn from a normal distribution with mean 0 and standard deviation 1. The returned `PVector` ...
Returns a random :class:`nngeometry.object.PVector` object using the structure defined by the `layer_collection` parameter, with each components drawn from a normal distribution with mean 0 and standard deviation 1. The returned `PVector` will internally use a flat representation. :param lay...
Returns a random :class:`nngeometry.object.PVector` object using the structure defined by the `layer_collection` parameter, with each components drawn from a normal distribution with mean 0 and standard deviation 1. The returned `PVector` will internally use a flat representation.
[ "Returns", "a", "random", ":", "class", ":", "`", "nngeometry", ".", "object", ".", "PVector", "`", "object", "using", "the", "structure", "defined", "by", "the", "`", "layer_collection", "`", "parameter", "with", "each", "components", "drawn", "from", "a", ...
def random_pvector(layer_collection, device=None): n_parameters = layer_collection.numel() random_v_flat = torch.normal(0, 1, (n_parameters,), device=device) return PVector(layer_collection=layer_collection, vector_repr=random_v_flat)
[ "def", "random_pvector", "(", "layer_collection", ",", "device", "=", "None", ")", ":", "n_parameters", "=", "layer_collection", ".", "numel", "(", ")", "random_v_flat", "=", "torch", ".", "normal", "(", "0", ",", "1", ",", "(", "n_parameters", ",", ")", ...
Returns a random :class:`nngeometry.object.PVector` object using the structure defined by the `layer_collection` parameter, with each components drawn from a normal distribution with mean 0 and standard deviation 1.
[ "Returns", "a", "random", ":", "class", ":", "`", "nngeometry", ".", "object", ".", "PVector", "`", "object", "using", "the", "structure", "defined", "by", "the", "`", "layer_collection", "`", "parameter", "with", "each", "components", "drawn", "from", "a", ...
[ "\"\"\"\n Returns a random :class:`nngeometry.object.PVector` object using\n the structure defined by the `layer_collection` parameter, with \n each components drawn from a normal distribution with mean 0 and standard\n deviation 1.\n\n The returned `PVector` will internally use a flat representation...
[ { "param": "layer_collection", "type": null }, { "param": "device", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "layer_collection", "type": null, "docstring": "The :class:`nngeometry.layercollection.LayerCollection`\ndescribing the structure of the random pvector", "docstring_tokens": [ "The", ":", "class", ...
3550df0a81d5f06baae883ad3f158873ddab62ed
shreyasumbetla/nngeometry
nngeometry/object/vector.py
[ "MIT" ]
Python
from_model
<not_specific>
def from_model(model): """ Creates a PVector using the current values of the given model """ dict_repr = dict() layer_collection = LayerCollection.from_model(model) l_to_m, _ = layer_collection.get_layerid_module_maps(model) for layer_id, layer in layer_co...
Creates a PVector using the current values of the given model
Creates a PVector using the current values of the given model
[ "Creates", "a", "PVector", "using", "the", "current", "values", "of", "the", "given", "model" ]
def from_model(model): dict_repr = dict() layer_collection = LayerCollection.from_model(model) l_to_m, _ = layer_collection.get_layerid_module_maps(model) for layer_id, layer in layer_collection.layers.items(): mod = l_to_m[layer_id] if layer.bias is not None: ...
[ "def", "from_model", "(", "model", ")", ":", "dict_repr", "=", "dict", "(", ")", "layer_collection", "=", "LayerCollection", ".", "from_model", "(", "model", ")", "l_to_m", ",", "_", "=", "layer_collection", ".", "get_layerid_module_maps", "(", "model", ")", ...
Creates a PVector using the current values of the given model
[ "Creates", "a", "PVector", "using", "the", "current", "values", "of", "the", "given", "model" ]
[ "\"\"\"\n Creates a PVector using the current values of the given\n model\n \"\"\"" ]
[ { "param": "model", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "model", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3550df0a81d5f06baae883ad3f158873ddab62ed
shreyasumbetla/nngeometry
nngeometry/object/vector.py
[ "MIT" ]
Python
add_to_model
null
def add_to_model(self, model): """ Updates `model` parameter values by adding the current PVector Note. This is an inplace operation """ dict_repr = self.get_dict_representation() layer_collection = LayerCollection.from_model(model) l_to_m, _ = layer_collection.g...
Updates `model` parameter values by adding the current PVector Note. This is an inplace operation
Updates `model` parameter values by adding the current PVector Note. This is an inplace operation
[ "Updates", "`", "model", "`", "parameter", "values", "by", "adding", "the", "current", "PVector", "Note", ".", "This", "is", "an", "inplace", "operation" ]
def add_to_model(self, model): dict_repr = self.get_dict_representation() layer_collection = LayerCollection.from_model(model) l_to_m, _ = layer_collection.get_layerid_module_maps(model) for layer_id, layer in layer_collection.layers.items(): mod = l_to_m[layer_id] ...
[ "def", "add_to_model", "(", "self", ",", "model", ")", ":", "dict_repr", "=", "self", ".", "get_dict_representation", "(", ")", "layer_collection", "=", "LayerCollection", ".", "from_model", "(", "model", ")", "l_to_m", ",", "_", "=", "layer_collection", ".", ...
Updates `model` parameter values by adding the current PVector Note.
[ "Updates", "`", "model", "`", "parameter", "values", "by", "adding", "the", "current", "PVector", "Note", "." ]
[ "\"\"\"\n Updates `model` parameter values by adding the current PVector\n\n Note. This is an inplace operation\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "model", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "model", "type": null, "docstring": null, "docstring_tokens": ...
3550df0a81d5f06baae883ad3f158873ddab62ed
shreyasumbetla/nngeometry
nngeometry/object/vector.py
[ "MIT" ]
Python
from_model_grad
<not_specific>
def from_model_grad(model): """ Creates a PVector using the current values of the `.grad` fields of parameters of the given model """ dict_repr = dict() layer_collection = LayerCollection.from_model(model) l_to_m, _ = layer_collection.get_layerid_module_maps(model...
Creates a PVector using the current values of the `.grad` fields of parameters of the given model
Creates a PVector using the current values of the `.grad` fields of parameters of the given model
[ "Creates", "a", "PVector", "using", "the", "current", "values", "of", "the", "`", ".", "grad", "`", "fields", "of", "parameters", "of", "the", "given", "model" ]
def from_model_grad(model): dict_repr = dict() layer_collection = LayerCollection.from_model(model) l_to_m, _ = layer_collection.get_layerid_module_maps(model) for layer_id, layer in layer_collection.layers.items(): mod = l_to_m[layer_id] if layer.bias is not None...
[ "def", "from_model_grad", "(", "model", ")", ":", "dict_repr", "=", "dict", "(", ")", "layer_collection", "=", "LayerCollection", ".", "from_model", "(", "model", ")", "l_to_m", ",", "_", "=", "layer_collection", ".", "get_layerid_module_maps", "(", "model", "...
Creates a PVector using the current values of the `.grad` fields of parameters of the given model
[ "Creates", "a", "PVector", "using", "the", "current", "values", "of", "the", "`", ".", "grad", "`", "fields", "of", "parameters", "of", "the", "given", "model" ]
[ "\"\"\"\n Creates a PVector using the current values of the `.grad`\n fields of parameters of the given model\n \"\"\"" ]
[ { "param": "model", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "model", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3550df0a81d5f06baae883ad3f158873ddab62ed
shreyasumbetla/nngeometry
nngeometry/object/vector.py
[ "MIT" ]
Python
clone
<not_specific>
def clone(self): """ Returns a clone of the current object """ if self.dict_repr is not None: dict_clone = dict() for k, v in self.dict_repr.items(): if len(v) == 2: dict_clone[k] = (v[0].clone(), v[1].clone()) e...
Returns a clone of the current object
Returns a clone of the current object
[ "Returns", "a", "clone", "of", "the", "current", "object" ]
def clone(self): if self.dict_repr is not None: dict_clone = dict() for k, v in self.dict_repr.items(): if len(v) == 2: dict_clone[k] = (v[0].clone(), v[1].clone()) else: dict_clone[k] = (v[0].clone(),) r...
[ "def", "clone", "(", "self", ")", ":", "if", "self", ".", "dict_repr", "is", "not", "None", ":", "dict_clone", "=", "dict", "(", ")", "for", "k", ",", "v", "in", "self", ".", "dict_repr", ".", "items", "(", ")", ":", "if", "len", "(", "v", ")",...
Returns a clone of the current object
[ "Returns", "a", "clone", "of", "the", "current", "object" ]
[ "\"\"\"\n Returns a clone of the current object\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3550df0a81d5f06baae883ad3f158873ddab62ed
shreyasumbetla/nngeometry
nngeometry/object/vector.py
[ "MIT" ]
Python
detach
<not_specific>
def detach(self): """ Detachs the current PVector from the computation graph """ if self.dict_repr is not None: dict_detach = dict() for k, v in self.dict_repr.items(): if len(v) == 2: dict_detach[k] = (v[0].detach(), v[1].detac...
Detachs the current PVector from the computation graph
Detachs the current PVector from the computation graph
[ "Detachs", "the", "current", "PVector", "from", "the", "computation", "graph" ]
def detach(self): if self.dict_repr is not None: dict_detach = dict() for k, v in self.dict_repr.items(): if len(v) == 2: dict_detach[k] = (v[0].detach(), v[1].detach()) else: dict_detach[k] = (v[0].detach(),) ...
[ "def", "detach", "(", "self", ")", ":", "if", "self", ".", "dict_repr", "is", "not", "None", ":", "dict_detach", "=", "dict", "(", ")", "for", "k", ",", "v", "in", "self", ".", "dict_repr", ".", "items", "(", ")", ":", "if", "len", "(", "v", ")...
Detachs the current PVector from the computation graph
[ "Detachs", "the", "current", "PVector", "from", "the", "computation", "graph" ]
[ "\"\"\"\n Detachs the current PVector from the computation graph\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3550df0a81d5f06baae883ad3f158873ddab62ed
shreyasumbetla/nngeometry
nngeometry/object/vector.py
[ "MIT" ]
Python
norm
<not_specific>
def norm(self, p=2): """ Computes the Lp norm of the PVector """ if self.dict_repr is not None: sum_p = 0 for l_id, l in self.layer_collection.layers.items(): sum_p += (self.dict_repr[l_id][0]**p).sum() if l.bias is not None: ...
Computes the Lp norm of the PVector
Computes the Lp norm of the PVector
[ "Computes", "the", "Lp", "norm", "of", "the", "PVector" ]
def norm(self, p=2): if self.dict_repr is not None: sum_p = 0 for l_id, l in self.layer_collection.layers.items(): sum_p += (self.dict_repr[l_id][0]**p).sum() if l.bias is not None: sum_p += (self.dict_repr[l_id][1]**p).sum() ...
[ "def", "norm", "(", "self", ",", "p", "=", "2", ")", ":", "if", "self", ".", "dict_repr", "is", "not", "None", ":", "sum_p", "=", "0", "for", "l_id", ",", "l", "in", "self", ".", "layer_collection", ".", "layers", ".", "items", "(", ")", ":", "...
Computes the Lp norm of the PVector
[ "Computes", "the", "Lp", "norm", "of", "the", "PVector" ]
[ "\"\"\"\n Computes the Lp norm of the PVector\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "p", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "p", "type": null, "docstring": null, "docstring_tokens": [], ...
3550df0a81d5f06baae883ad3f158873ddab62ed
shreyasumbetla/nngeometry
nngeometry/object/vector.py
[ "MIT" ]
Python
dot
<not_specific>
def dot(self, other): """ Computes the dot product between `self` and `other` :param other: The other `PVector` """ if self.vector_repr is not None or other.vector_repr is not None: return torch.dot(self.get_flat_representation(), other.g...
Computes the dot product between `self` and `other` :param other: The other `PVector`
Computes the dot product between `self` and `other`
[ "Computes", "the", "dot", "product", "between", "`", "self", "`", "and", "`", "other", "`" ]
def dot(self, other): if self.vector_repr is not None or other.vector_repr is not None: return torch.dot(self.get_flat_representation(), other.get_flat_representation()) else: dot_ = 0 for l_id, l in self.layer_collection.layers.items(): ...
[ "def", "dot", "(", "self", ",", "other", ")", ":", "if", "self", ".", "vector_repr", "is", "not", "None", "or", "other", ".", "vector_repr", "is", "not", "None", ":", "return", "torch", ".", "dot", "(", "self", ".", "get_flat_representation", "(", ")",...
Computes the dot product between `self` and `other`
[ "Computes", "the", "dot", "product", "between", "`", "self", "`", "and", "`", "other", "`" ]
[ "\"\"\"\n Computes the dot product between `self` and `other`\n\n :param other: The other `PVector`\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "other", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "other", "type": null, "docstring": "The other `PVector`", "do...
3550df0a81d5f06baae883ad3f158873ddab62ed
shreyasumbetla/nngeometry
nngeometry/object/vector.py
[ "MIT" ]
Python
size
<not_specific>
def size(self): """ The size of the PVector, or equivalently the number of parameters of the layer collection """ return (self.layer_collection.numel(), )
The size of the PVector, or equivalently the number of parameters of the layer collection
The size of the PVector, or equivalently the number of parameters of the layer collection
[ "The", "size", "of", "the", "PVector", "or", "equivalently", "the", "number", "of", "parameters", "of", "the", "layer", "collection" ]
def size(self): return (self.layer_collection.numel(), )
[ "def", "size", "(", "self", ")", ":", "return", "(", "self", ".", "layer_collection", ".", "numel", "(", ")", ",", ")" ]
The size of the PVector, or equivalently the number of parameters of the layer collection
[ "The", "size", "of", "the", "PVector", "or", "equivalently", "the", "number", "of", "parameters", "of", "the", "layer", "collection" ]
[ "\"\"\"\n The size of the PVector, or equivalently the number of\n parameters of the layer collection\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
51c53109df59efa16e24f21c5dfe934fc935cac4
shreyasumbetla/nngeometry
nngeometry/layercollection.py
[ "MIT" ]
Python
from_model
<not_specific>
def from_model(model, ignore_unsupported_layers=False): """ Constructs a new LayerCollection object by using all parameters of the model passed as argument. :param model: The PyTorch model :type model: `nn.Module` :param ignore_unsupported_layers: If false, will raise an...
Constructs a new LayerCollection object by using all parameters of the model passed as argument. :param model: The PyTorch model :type model: `nn.Module` :param ignore_unsupported_layers: If false, will raise an error when model contains layers that are not supported ye...
Constructs a new LayerCollection object by using all parameters of the model passed as argument.
[ "Constructs", "a", "new", "LayerCollection", "object", "by", "using", "all", "parameters", "of", "the", "model", "passed", "as", "argument", "." ]
def from_model(model, ignore_unsupported_layers=False): lc = LayerCollection() for layer, mod in model.named_modules(): mod_class = mod.__class__.__name__ if mod_class in ['Linear', 'Conv2d', 'BatchNorm1d', 'BatchNorm2d', 'GroupNorm']: ...
[ "def", "from_model", "(", "model", ",", "ignore_unsupported_layers", "=", "False", ")", ":", "lc", "=", "LayerCollection", "(", ")", "for", "layer", ",", "mod", "in", "model", ".", "named_modules", "(", ")", ":", "mod_class", "=", "mod", ".", "__class__", ...
Constructs a new LayerCollection object by using all parameters of the model passed as argument.
[ "Constructs", "a", "new", "LayerCollection", "object", "by", "using", "all", "parameters", "of", "the", "model", "passed", "as", "argument", "." ]
[ "\"\"\"\n Constructs a new LayerCollection object by using all parameters\n of the model passed as argument.\n\n :param model: The PyTorch model\n :type model: `nn.Module`\n :param ignore_unsupported_layers: If false, will raise an error\n when model contains layers that ar...
[ { "param": "model", "type": null }, { "param": "ignore_unsupported_layers", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "model", "type": null, "docstring": "The PyTorch model", "docstring_tokens": [ "The", "PyTorch", "model" ], "default": null, "is_optional": null }, { "identifier": "ignore...
51c53109df59efa16e24f21c5dfe934fc935cac4
shreyasumbetla/nngeometry
nngeometry/layercollection.py
[ "MIT" ]
Python
add_layer_from_model
null
def add_layer_from_model(self, model, module): """ Add a layer by specifying the module corresponding to this layer (e.g. torch.nn.Linear or torch.nn.BatchNorm1d) :param model: The model defining the neural network :param module: The layer to be added """ if modu...
Add a layer by specifying the module corresponding to this layer (e.g. torch.nn.Linear or torch.nn.BatchNorm1d) :param model: The model defining the neural network :param module: The layer to be added
Add a layer by specifying the module corresponding to this layer
[ "Add", "a", "layer", "by", "specifying", "the", "module", "corresponding", "to", "this", "layer" ]
def add_layer_from_model(self, model, module): if module.__class__.__name__ not in \ ['Linear', 'Conv2d', 'BatchNorm1d', 'BatchNorm2d', 'GroupNorm']: raise NotImplementedError for layer, mod in model.named_modules(): if mod is module: ...
[ "def", "add_layer_from_model", "(", "self", ",", "model", ",", "module", ")", ":", "if", "module", ".", "__class__", ".", "__name__", "not", "in", "[", "'Linear'", ",", "'Conv2d'", ",", "'BatchNorm1d'", ",", "'BatchNorm2d'", ",", "'GroupNorm'", "]", ":", "...
Add a layer by specifying the module corresponding to this layer (e.g.
[ "Add", "a", "layer", "by", "specifying", "the", "module", "corresponding", "to", "this", "layer", "(", "e", ".", "g", "." ]
[ "\"\"\"\n Add a layer by specifying the module corresponding\n to this layer (e.g. torch.nn.Linear or torch.nn.BatchNorm1d)\n\n :param model: The model defining the neural network\n :param module: The layer to be added\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "model", "type": null }, { "param": "module", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "model", "type": null, "docstring": "The model defining the neural n...
51c53109df59efa16e24f21c5dfe934fc935cac4
shreyasumbetla/nngeometry
nngeometry/layercollection.py
[ "MIT" ]
Python
numel
<not_specific>
def numel(self): """ Total number of scalar parameters in this LayerCollection object :return: number of scalar parameters :rtype: int """ return self._numel
Total number of scalar parameters in this LayerCollection object :return: number of scalar parameters :rtype: int
Total number of scalar parameters in this LayerCollection object
[ "Total", "number", "of", "scalar", "parameters", "in", "this", "LayerCollection", "object" ]
def numel(self): return self._numel
[ "def", "numel", "(", "self", ")", ":", "return", "self", ".", "_numel" ]
Total number of scalar parameters in this LayerCollection object
[ "Total", "number", "of", "scalar", "parameters", "in", "this", "LayerCollection", "object" ]
[ "\"\"\"\n Total number of scalar parameters in this LayerCollection object\n\n :return: number of scalar parameters\n :rtype: int \n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "number of scalar parameters", "docstring_tokens": [ "number", "of", "scalar", "parameters" ], "type": "int" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null,...
3ad150625748d42434886e3c0a71c9bc79b9812c
testinggg-art/lightning-flash
flash/data/base_viz.py
[ "Apache-2.0" ]
Python
show
None
def show(self, batch: Dict[str, Any], running_stage: RunningStage, func_names_list: List[str]) -> None: """ Override this function when you want to visualize a composition. """ # filter out the functions to visualise func_names_set: Set[str] = set(func_names_list) & set(_CALLBACK...
Override this function when you want to visualize a composition.
Override this function when you want to visualize a composition.
[ "Override", "this", "function", "when", "you", "want", "to", "visualize", "a", "composition", "." ]
def show(self, batch: Dict[str, Any], running_stage: RunningStage, func_names_list: List[str]) -> None: func_names_set: Set[str] = set(func_names_list) & set(_CALLBACK_FUNCS) if len(func_names_set) == 0: raise MisconfigurationException(f"Invalid function names: {func_names_list}.") f...
[ "def", "show", "(", "self", ",", "batch", ":", "Dict", "[", "str", ",", "Any", "]", ",", "running_stage", ":", "RunningStage", ",", "func_names_list", ":", "List", "[", "str", "]", ")", "->", "None", ":", "func_names_set", ":", "Set", "[", "str", "]"...
Override this function when you want to visualize a composition.
[ "Override", "this", "function", "when", "you", "want", "to", "visualize", "a", "composition", "." ]
[ "\"\"\"\n Override this function when you want to visualize a composition.\n \"\"\"", "# filter out the functions to visualise" ]
[ { "param": "self", "type": null }, { "param": "batch", "type": "Dict[str, Any]" }, { "param": "running_stage", "type": "RunningStage" }, { "param": "func_names_list", "type": "List[str]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "batch", "type": "Dict[str, Any]", "docstring": null, "docstri...
7e95b5f442e070b8cdac834baed35f5907452f97
trdwll/TRDWLL.com
TRDWLL/models.py
[ "MIT" ]
Python
print_alerts
<not_specific>
def print_alerts(request, is_notice=False): """ Get the alerts and format them for display """ alerts = [] alert_defs = dict((v, k) for k, v in Alert.TYPES) if not is_notice: d = [alert_defs['Success'], alert_defs['Danger'], alert_defs['Warning'], alert_defs['Info']] ...
Get the alerts and format them for display
Get the alerts and format them for display
[ "Get", "the", "alerts", "and", "format", "them", "for", "display" ]
def print_alerts(request, is_notice=False): alerts = [] alert_defs = dict((v, k) for k, v in Alert.TYPES) if not is_notice: d = [alert_defs['Success'], alert_defs['Danger'], alert_defs['Warning'], alert_defs['Info']] for tmp in Alert.objects.filter(Q(type__in=d)): ...
[ "def", "print_alerts", "(", "request", ",", "is_notice", "=", "False", ")", ":", "alerts", "=", "[", "]", "alert_defs", "=", "dict", "(", "(", "v", ",", "k", ")", "for", "k", ",", "v", "in", "Alert", ".", "TYPES", ")", "if", "not", "is_notice", "...
Get the alerts and format them for display
[ "Get", "the", "alerts", "and", "format", "them", "for", "display" ]
[ "\"\"\" Get the alerts and format them for display \"\"\"" ]
[ { "param": "request", "type": null }, { "param": "is_notice", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "is_notice", "type": null, "docstring": null, "docstring_to...
4185ec3995096dffe90468f4e2d701f6264aa406
201419/taobao-live-product-recognition
match_rcnn/mmdetection/tools/prepare_img_meta.py
[ "Apache-2.0" ]
Python
pos_pair_statistic
null
def pos_pair_statistic(pos_pair_dict_path): ''' display the frequency of positive-paired images of each image ''' with open(pos_pair_dict_path, 'r') as f: pos_pair_dict = json.load(f) freq_pos_dict = {} for k in list(pos_pair_dict.keys()): if len(pos_pair_dict[k]) not in list(fr...
display the frequency of positive-paired images of each image
display the frequency of positive-paired images of each image
[ "display", "the", "frequency", "of", "positive", "-", "paired", "images", "of", "each", "image" ]
def pos_pair_statistic(pos_pair_dict_path): with open(pos_pair_dict_path, 'r') as f: pos_pair_dict = json.load(f) freq_pos_dict = {} for k in list(pos_pair_dict.keys()): if len(pos_pair_dict[k]) not in list(freq_pos_dict.keys()): freq_pos_dict[len(pos_pair_dict[k])] = 1 e...
[ "def", "pos_pair_statistic", "(", "pos_pair_dict_path", ")", ":", "with", "open", "(", "pos_pair_dict_path", ",", "'r'", ")", "as", "f", ":", "pos_pair_dict", "=", "json", ".", "load", "(", "f", ")", "freq_pos_dict", "=", "{", "}", "for", "k", "in", "lis...
display the frequency of positive-paired images of each image
[ "display", "the", "frequency", "of", "positive", "-", "paired", "images", "of", "each", "image" ]
[ "'''\n display the frequency of positive-paired images of each image\n '''", "# if len(pos_pair_dict[k]) == 21:", "# print(k,':', pos_pair_dict[k])" ]
[ { "param": "pos_pair_dict_path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pos_pair_dict_path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4185ec3995096dffe90468f4e2d701f6264aa406
201419/taobao-live-product-recognition
match_rcnn/mmdetection/tools/prepare_img_meta.py
[ "Apache-2.0" ]
Python
split_data
null
def split_data(pos_pair_dict_path, train_ratio): ''' split data for training and validating matchrcnn model''' with open(pos_pair_dict_path, 'r') as f: pos_pair_dict = json.load(f) # get match-avaible images ma_images = [] for k in list(pos_pair_dict.keys()): if pos_pair_dict[k] == ...
split data for training and validating matchrcnn model
split data for training and validating matchrcnn model
[ "split", "data", "for", "training", "and", "validating", "matchrcnn", "model" ]
def split_data(pos_pair_dict_path, train_ratio): with open(pos_pair_dict_path, 'r') as f: pos_pair_dict = json.load(f) ma_images = [] for k in list(pos_pair_dict.keys()): if pos_pair_dict[k] == []: pass else: ma_images.append(k) train_num = int(len(ma_imag...
[ "def", "split_data", "(", "pos_pair_dict_path", ",", "train_ratio", ")", ":", "with", "open", "(", "pos_pair_dict_path", ",", "'r'", ")", "as", "f", ":", "pos_pair_dict", "=", "json", ".", "load", "(", "f", ")", "ma_images", "=", "[", "]", "for", "k", ...
split data for training and validating matchrcnn model
[ "split", "data", "for", "training", "and", "validating", "matchrcnn", "model" ]
[ "''' split data for training and validating matchrcnn model'''", "# get match-avaible images", "# get the training number", "# form the train.json", "# form the val.json" ]
[ { "param": "pos_pair_dict_path", "type": null }, { "param": "train_ratio", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pos_pair_dict_path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "train_ratio", "type": null, "docstring": null, ...
b66463873d5279b7f561138bd3274002e136d924
ksaur/DaskKubernetes
storage.py
[ "MIT" ]
Python
create_container
<not_specific>
def create_container(c, container_name): """Creates container based on the parameters found in the .env file """ logger = logging.getLogger(__name__) env_values = load_config() account_name = env_values.get("ACCOUNT_NAME") account_key = env_values.get("ACCOUNT_KEY") if _container_exists(c, c...
Creates container based on the parameters found in the .env file
Creates container based on the parameters found in the .env file
[ "Creates", "container", "based", "on", "the", "parameters", "found", "in", "the", ".", "env", "file" ]
def create_container(c, container_name): logger = logging.getLogger(__name__) env_values = load_config() account_name = env_values.get("ACCOUNT_NAME") account_key = env_values.get("ACCOUNT_KEY") if _container_exists(c, container_name, account_name, account_key): logger.info(f"Container {cont...
[ "def", "create_container", "(", "c", ",", "container_name", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "env_values", "=", "load_config", "(", ")", "account_name", "=", "env_values", ".", "get", "(", "\"ACCOUNT_NAME\"", ")", "...
Creates container based on the parameters found in the .env file
[ "Creates", "container", "based", "on", "the", "parameters", "found", "in", "the", ".", "env", "file" ]
[ "\"\"\"Creates container based on the parameters found in the .env file\n \"\"\"" ]
[ { "param": "c", "type": null }, { "param": "container_name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "c", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "container_name", "type": null, "docstring": null, "docstring_tok...
b66463873d5279b7f561138bd3274002e136d924
ksaur/DaskKubernetes
storage.py
[ "MIT" ]
Python
upload_from_local
null
def upload_from_local(c, source, destination, destination_container): """Upload local file or foler to container in premium blob Args: source (str): File or folder found in /data that you want transfered to blob storage destination (str): Corresponding filename or foldername to have it tra...
Upload local file or foler to container in premium blob Args: source (str): File or folder found in /data that you want transfered to blob storage destination (str): Corresponding filename or foldername to have it transfered to in blob storage destination_container (str): Container to ...
Upload local file or foler to container in premium blob
[ "Upload", "local", "file", "or", "foler", "to", "container", "in", "premium", "blob" ]
def upload_from_local(c, source, destination, destination_container): c.invoke_execute( c, "storage.create_container", container_name=destination_container ) env_values = load_config() account_name = env_values.get("ACCOUNT_NAME") account_key = env_values.get("ACCOUNT_KEY") upload_data_f...
[ "def", "upload_from_local", "(", "c", ",", "source", ",", "destination", ",", "destination_container", ")", ":", "c", ".", "invoke_execute", "(", "c", ",", "\"storage.create_container\"", ",", "container_name", "=", "destination_container", ")", "env_values", "=", ...
Upload local file or foler to container in premium blob
[ "Upload", "local", "file", "or", "foler", "to", "container", "in", "premium", "blob" ]
[ "\"\"\"Upload local file or foler to container in premium blob \n \n Args:\n source (str): File or folder found in /data that you want transfered to blob storage\n destination (str): Corresponding filename or foldername to have it transfered to in blob storage\n destination_container (str...
[ { "param": "c", "type": null }, { "param": "source", "type": null }, { "param": "destination", "type": null }, { "param": "destination_container", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "c", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "source", "type": null, "docstring": "File or folder found in /data tha...
b66463873d5279b7f561138bd3274002e136d924
ksaur/DaskKubernetes
storage.py
[ "MIT" ]
Python
copy_movies
null
def copy_movies(c, destination_container): """Copies demo movies to own storage Args: destination_container (str): Name of the container to copy the movies to """ c.invoke_execute( c, "storage.create_container", container_name=destination_container ) env_values = load_config...
Copies demo movies to own storage Args: destination_container (str): Name of the container to copy the movies to
Copies demo movies to own storage
[ "Copies", "demo", "movies", "to", "own", "storage" ]
def copy_movies(c, destination_container): c.invoke_execute( c, "storage.create_container", container_name=destination_container ) env_values = load_config() account_name = env_values.get("ACCOUNT_NAME") account_key = env_values.get("ACCOUNT_KEY") for movie in _MOVIES: _transfer_...
[ "def", "copy_movies", "(", "c", ",", "destination_container", ")", ":", "c", ".", "invoke_execute", "(", "c", ",", "\"storage.create_container\"", ",", "container_name", "=", "destination_container", ")", "env_values", "=", "load_config", "(", ")", "account_name", ...
Copies demo movies to own storage
[ "Copies", "demo", "movies", "to", "own", "storage" ]
[ "\"\"\"Copies demo movies to own storage\n \n Args:\n destination_container (str): Name of the container to copy the movies to\n \"\"\"" ]
[ { "param": "c", "type": null }, { "param": "destination_container", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "c", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "destination_container", "type": null, "docstring": "Name of the contai...
dd911cc56800d11399e2386310b508be09261cb1
ksaur/DaskKubernetes
tasks.py
[ "MIT" ]
Python
select_subscription
null
def select_subscription(c, sub_id=env_values.get("SUBSCRIPTION_ID", None)): """Select Azure subscription to use Note: If sub_id isn't provided or found in env values interactive prompt is created asking for sub id selection The selection is then recorded in the env file Args: s...
Select Azure subscription to use Note: If sub_id isn't provided or found in env values interactive prompt is created asking for sub id selection The selection is then recorded in the env file Args: sub_id (string, optional): [description]. Defaults to env_values.get("SUBSCRIPTION_I...
Select Azure subscription to use Note: If sub_id isn't provided or found in env values interactive prompt is created asking for sub id selection The selection is then recorded in the env file
[ "Select", "Azure", "subscription", "to", "use", "Note", ":", "If", "sub_id", "isn", "'", "t", "provided", "or", "found", "in", "env", "values", "interactive", "prompt", "is", "created", "asking", "for", "sub", "id", "selection", "The", "selection", "is", "...
def select_subscription(c, sub_id=env_values.get("SUBSCRIPTION_ID", None)): env_file = find_dotenv(raise_error_if_not_found=True) if sub_id is None or sub_id == "": sub_id = _prompt_sub_id_selection(c) set_key(env_file, "SUBSCRIPTION_ID", sub_id) c.run(f"az account set -s {sub_id}", pty=True...
[ "def", "select_subscription", "(", "c", ",", "sub_id", "=", "env_values", ".", "get", "(", "\"SUBSCRIPTION_ID\"", ",", "None", ")", ")", ":", "env_file", "=", "find_dotenv", "(", "raise_error_if_not_found", "=", "True", ")", "if", "sub_id", "is", "None", "or...
Select Azure subscription to use Note: If sub_id isn't provided or found in env values interactive prompt is created asking for sub id selection The selection is then recorded in the env file
[ "Select", "Azure", "subscription", "to", "use", "Note", ":", "If", "sub_id", "isn", "'", "t", "provided", "or", "found", "in", "env", "values", "interactive", "prompt", "is", "created", "asking", "for", "sub", "id", "selection", "The", "selection", "is", "...
[ "\"\"\"Select Azure subscription to use\n \n Note:\n If sub_id isn't provided or found in env values interactive prompt is created asking for sub id selection\n The selection is then recorded in the env file\n\n Args:\n sub_id (string, optional): [description]. Defaults to env_values.g...
[ { "param": "c", "type": null }, { "param": "sub_id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "c", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "sub_id", "type": null, "docstring": "[description]. Defaults to env_va...