id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
241,000
diffeo/rejester
rejester/run.py
Manager.do_work_spec
def do_work_spec(self, args): '''dump the contents of an existing work spec''' work_spec_name = self._get_work_spec_name(args) spec = self.task_master.get_work_spec(work_spec_name) if args.json: self.stdout.write(json.dumps(spec, indent=4, sort_keys=True) + ...
python
def do_work_spec(self, args): '''dump the contents of an existing work spec''' work_spec_name = self._get_work_spec_name(args) spec = self.task_master.get_work_spec(work_spec_name) if args.json: self.stdout.write(json.dumps(spec, indent=4, sort_keys=True) + ...
[ "def", "do_work_spec", "(", "self", ",", "args", ")", ":", "work_spec_name", "=", "self", ".", "_get_work_spec_name", "(", "args", ")", "spec", "=", "self", ".", "task_master", ".", "get_work_spec", "(", "work_spec_name", ")", "if", "args", ".", "json", ":...
dump the contents of an existing work spec
[ "dump", "the", "contents", "of", "an", "existing", "work", "spec" ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/run.py#L402-L410
241,001
diffeo/rejester
rejester/run.py
Manager.do_status
def do_status(self, args): '''print the number of work units in an existing work spec''' work_spec_name = self._get_work_spec_name(args) status = self.task_master.status(work_spec_name) self.stdout.write(json.dumps(status, indent=4, sort_keys=True) + '\n')
python
def do_status(self, args): '''print the number of work units in an existing work spec''' work_spec_name = self._get_work_spec_name(args) status = self.task_master.status(work_spec_name) self.stdout.write(json.dumps(status, indent=4, sort_keys=True) + '\n')
[ "def", "do_status", "(", "self", ",", "args", ")", ":", "work_spec_name", "=", "self", ".", "_get_work_spec_name", "(", "args", ")", "status", "=", "self", ".", "task_master", ".", "status", "(", "work_spec_name", ")", "self", ".", "stdout", ".", "write", ...
print the number of work units in an existing work spec
[ "print", "the", "number", "of", "work", "units", "in", "an", "existing", "work", "spec" ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/run.py#L415-L420
241,002
diffeo/rejester
rejester/run.py
Manager.do_summary
def do_summary(self, args): '''print a summary of running rejester work''' assert args.json or args.text or (args.text is None) do_text = args.text xd = {} for ws in self.task_master.iter_work_specs(): name = ws['name'] status = self.task_master.status(na...
python
def do_summary(self, args): '''print a summary of running rejester work''' assert args.json or args.text or (args.text is None) do_text = args.text xd = {} for ws in self.task_master.iter_work_specs(): name = ws['name'] status = self.task_master.status(na...
[ "def", "do_summary", "(", "self", ",", "args", ")", ":", "assert", "args", ".", "json", "or", "args", ".", "text", "or", "(", "args", ".", "text", "is", "None", ")", "do_text", "=", "args", ".", "text", "xd", "=", "{", "}", "for", "ws", "in", "...
print a summary of running rejester work
[ "print", "a", "summary", "of", "running", "rejester", "work" ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/run.py#L427-L457
241,003
diffeo/rejester
rejester/run.py
Manager.do_work_units
def do_work_units(self, args): '''list work units that have not yet completed''' work_spec_name = self._get_work_spec_name(args) if args.status: status = args.status.upper() statusi = getattr(self.task_master, status, None) if statusi is None: ...
python
def do_work_units(self, args): '''list work units that have not yet completed''' work_spec_name = self._get_work_spec_name(args) if args.status: status = args.status.upper() statusi = getattr(self.task_master, status, None) if statusi is None: ...
[ "def", "do_work_units", "(", "self", ",", "args", ")", ":", "work_spec_name", "=", "self", ".", "_get_work_spec_name", "(", "args", ")", "if", "args", ".", "status", ":", "status", "=", "args", ".", "status", ".", "upper", "(", ")", "statusi", "=", "ge...
list work units that have not yet completed
[ "list", "work", "units", "that", "have", "not", "yet", "completed" ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/run.py#L470-L497
241,004
diffeo/rejester
rejester/run.py
Manager.do_work_unit
def do_work_unit(self, args): '''print basic details about work units''' work_spec_name = self._get_work_spec_name(args) for work_unit_name in args.unit: status = self.task_master.get_work_unit_status(work_spec_name, work_uni...
python
def do_work_unit(self, args): '''print basic details about work units''' work_spec_name = self._get_work_spec_name(args) for work_unit_name in args.unit: status = self.task_master.get_work_unit_status(work_spec_name, work_uni...
[ "def", "do_work_unit", "(", "self", ",", "args", ")", ":", "work_spec_name", "=", "self", ".", "_get_work_spec_name", "(", "args", ")", "for", "work_unit_name", "in", "args", ".", "unit", ":", "status", "=", "self", ".", "task_master", ".", "get_work_unit_st...
print basic details about work units
[ "print", "basic", "details", "about", "work", "units" ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/run.py#L516-L558
241,005
diffeo/rejester
rejester/run.py
Manager.do_retry
def do_retry(self, args): '''retry a specific failed job''' work_spec_name = self._get_work_spec_name(args) retried = 0 complained = False try: if args.all: while True: units = self.task_master.get_work_units( ...
python
def do_retry(self, args): '''retry a specific failed job''' work_spec_name = self._get_work_spec_name(args) retried = 0 complained = False try: if args.all: while True: units = self.task_master.get_work_units( ...
[ "def", "do_retry", "(", "self", ",", "args", ")", ":", "work_spec_name", "=", "self", ".", "_get_work_spec_name", "(", "args", ")", "retried", "=", "0", "complained", "=", "False", "try", ":", "if", "args", ".", "all", ":", "while", "True", ":", "units...
retry a specific failed job
[ "retry", "a", "specific", "failed", "job" ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/run.py#L566-L610
241,006
diffeo/rejester
rejester/run.py
Manager.do_clear
def do_clear(self, args): '''remove work units from a work spec''' # Which units? work_spec_name = self._get_work_spec_name(args) units = args.unit or None # What to do? count = 0 if args.status is None: all = units is None count += self.ta...
python
def do_clear(self, args): '''remove work units from a work spec''' # Which units? work_spec_name = self._get_work_spec_name(args) units = args.unit or None # What to do? count = 0 if args.status is None: all = units is None count += self.ta...
[ "def", "do_clear", "(", "self", ",", "args", ")", ":", "# Which units?", "work_spec_name", "=", "self", ".", "_get_work_spec_name", "(", "args", ")", "units", "=", "args", ".", "unit", "or", "None", "# What to do?", "count", "=", "0", "if", "args", ".", ...
remove work units from a work spec
[ "remove", "work", "units", "from", "a", "work", "spec" ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/run.py#L620-L645
241,007
diffeo/rejester
rejester/run.py
Manager.do_mode
def do_mode(self, args): '''get or set the global rejester worker mode''' if args.mode: mode = { 'idle': self.task_master.IDLE, 'run': self.task_master.RUN, 'terminate': self.task_master.TERMINATE }[args.mode] self.task_master.set_mode(mo...
python
def do_mode(self, args): '''get or set the global rejester worker mode''' if args.mode: mode = { 'idle': self.task_master.IDLE, 'run': self.task_master.RUN, 'terminate': self.task_master.TERMINATE }[args.mode] self.task_master.set_mode(mo...
[ "def", "do_mode", "(", "self", ",", "args", ")", ":", "if", "args", ".", "mode", ":", "mode", "=", "{", "'idle'", ":", "self", ".", "task_master", ".", "IDLE", ",", "'run'", ":", "self", ".", "task_master", ".", "RUN", ",", "'terminate'", ":", "sel...
get or set the global rejester worker mode
[ "get", "or", "set", "the", "global", "rejester", "worker", "mode" ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/run.py#L651-L661
241,008
diffeo/rejester
rejester/run.py
Manager.do_workers
def do_workers(self, args): '''list all known workers''' workers = self.task_master.workers(alive=not args.all) for k in sorted(workers.iterkeys()): self.stdout.write('{0} ({1})\n'.format(k, workers[k])) if args.details: heartbeat = self.task_master.get_he...
python
def do_workers(self, args): '''list all known workers''' workers = self.task_master.workers(alive=not args.all) for k in sorted(workers.iterkeys()): self.stdout.write('{0} ({1})\n'.format(k, workers[k])) if args.details: heartbeat = self.task_master.get_he...
[ "def", "do_workers", "(", "self", ",", "args", ")", ":", "workers", "=", "self", ".", "task_master", ".", "workers", "(", "alive", "=", "not", "args", ".", "all", ")", "for", "k", "in", "sorted", "(", "workers", ".", "iterkeys", "(", ")", ")", ":",...
list all known workers
[ "list", "all", "known", "workers" ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/run.py#L687-L695
241,009
diffeo/rejester
rejester/run.py
Manager.do_run_one
def do_run_one(self, args): '''run a single job''' work_spec_names = args.from_work_spec or None worker = SingleWorker(self.config, task_master=self.task_master, work_spec_names=work_spec_names, max_jobs=args.max_jobs) worker.register() rc = False starttime = time.time() ...
python
def do_run_one(self, args): '''run a single job''' work_spec_names = args.from_work_spec or None worker = SingleWorker(self.config, task_master=self.task_master, work_spec_names=work_spec_names, max_jobs=args.max_jobs) worker.register() rc = False starttime = time.time() ...
[ "def", "do_run_one", "(", "self", ",", "args", ")", ":", "work_spec_names", "=", "args", ".", "from_work_spec", "or", "None", "worker", "=", "SingleWorker", "(", "self", ".", "config", ",", "task_master", "=", "self", ".", "task_master", ",", "work_spec_name...
run a single job
[ "run", "a", "single", "job" ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/run.py#L702-L726
241,010
se-esss-litterbox/Pynac
Pynac/Core.py
get_number_of_particles
def get_number_of_particles(): """ Queries the ``dynac.short`` file for the number of particles used in the simulation. """ with open('dynac.short') as f: data_str = ''.join(line for line in f.readlines()) num_of_parts = int(data_str.split('Simulation with')[1].strip().split()[0]) ...
python
def get_number_of_particles(): """ Queries the ``dynac.short`` file for the number of particles used in the simulation. """ with open('dynac.short') as f: data_str = ''.join(line for line in f.readlines()) num_of_parts = int(data_str.split('Simulation with')[1].strip().split()[0]) ...
[ "def", "get_number_of_particles", "(", ")", ":", "with", "open", "(", "'dynac.short'", ")", "as", "f", ":", "data_str", "=", "''", ".", "join", "(", "line", "for", "line", "in", "f", ".", "readlines", "(", ")", ")", "num_of_parts", "=", "int", "(", "...
Queries the ``dynac.short`` file for the number of particles used in the simulation.
[ "Queries", "the", "dynac", ".", "short", "file", "for", "the", "number", "of", "particles", "used", "in", "the", "simulation", "." ]
97e20aa85d20112cd114faa54a8197c5d0f61209
https://github.com/se-esss-litterbox/Pynac/blob/97e20aa85d20112cd114faa54a8197c5d0f61209/Pynac/Core.py#L666-L674
241,011
se-esss-litterbox/Pynac
Pynac/Core.py
multi_process_pynac
def multi_process_pynac(file_list, pynac_func, num_iters=100, max_workers=8): """ Use a ProcessPool from the ``concurrent.futures`` module to execute ``num_iters`` number of instances of ``pynac_func``. This function takes advantage of ``do_single_dynac_process`` and ``pynac_in_sub_directory``. """...
python
def multi_process_pynac(file_list, pynac_func, num_iters=100, max_workers=8): """ Use a ProcessPool from the ``concurrent.futures`` module to execute ``num_iters`` number of instances of ``pynac_func``. This function takes advantage of ``do_single_dynac_process`` and ``pynac_in_sub_directory``. """...
[ "def", "multi_process_pynac", "(", "file_list", ",", "pynac_func", ",", "num_iters", "=", "100", ",", "max_workers", "=", "8", ")", ":", "with", "ProcessPoolExecutor", "(", "max_workers", "=", "max_workers", ")", "as", "executor", ":", "tasks", "=", "[", "ex...
Use a ProcessPool from the ``concurrent.futures`` module to execute ``num_iters`` number of instances of ``pynac_func``. This function takes advantage of ``do_single_dynac_process`` and ``pynac_in_sub_directory``.
[ "Use", "a", "ProcessPool", "from", "the", "concurrent", ".", "futures", "module", "to", "execute", "num_iters", "number", "of", "instances", "of", "pynac_func", ".", "This", "function", "takes", "advantage", "of", "do_single_dynac_process", "and", "pynac_in_sub_dire...
97e20aa85d20112cd114faa54a8197c5d0f61209
https://github.com/se-esss-litterbox/Pynac/blob/97e20aa85d20112cd114faa54a8197c5d0f61209/Pynac/Core.py#L694-L706
241,012
se-esss-litterbox/Pynac
Pynac/Core.py
pynac_in_sub_directory
def pynac_in_sub_directory(num, file_list): """ A context manager to create a new directory, move the files listed in ``file_list`` to that directory, and change to that directory before handing control back to context. The closing action is to change back to the original directory. ...
python
def pynac_in_sub_directory(num, file_list): """ A context manager to create a new directory, move the files listed in ``file_list`` to that directory, and change to that directory before handing control back to context. The closing action is to change back to the original directory. ...
[ "def", "pynac_in_sub_directory", "(", "num", ",", "file_list", ")", ":", "print", "(", "'Running %d'", "%", "num", ")", "new_dir", "=", "'dynacProc_%04d'", "%", "num", "if", "os", ".", "path", ".", "isdir", "(", "new_dir", ")", ":", "shutil", ".", "rmtre...
A context manager to create a new directory, move the files listed in ``file_list`` to that directory, and change to that directory before handing control back to context. The closing action is to change back to the original directory. The directory name is based on the ``num`` input, and if i...
[ "A", "context", "manager", "to", "create", "a", "new", "directory", "move", "the", "files", "listed", "in", "file_list", "to", "that", "directory", "and", "change", "to", "that", "directory", "before", "handing", "control", "back", "to", "context", ".", "The...
97e20aa85d20112cd114faa54a8197c5d0f61209
https://github.com/se-esss-litterbox/Pynac/blob/97e20aa85d20112cd114faa54a8197c5d0f61209/Pynac/Core.py#L723-L746
241,013
se-esss-litterbox/Pynac
Pynac/Core.py
Pynac.run
def run(self): """ Run the simulation in the current directory. """ self._start_dynac_proc(stdin=subp.PIPE, stdout=subp.PIPE) str2write = self.name + '\r\n' if self._DEBUG: with open('pynacrun.log', 'a') as f: f.write(str2write) self.dy...
python
def run(self): """ Run the simulation in the current directory. """ self._start_dynac_proc(stdin=subp.PIPE, stdout=subp.PIPE) str2write = self.name + '\r\n' if self._DEBUG: with open('pynacrun.log', 'a') as f: f.write(str2write) self.dy...
[ "def", "run", "(", "self", ")", ":", "self", ".", "_start_dynac_proc", "(", "stdin", "=", "subp", ".", "PIPE", ",", "stdout", "=", "subp", ".", "PIPE", ")", "str2write", "=", "self", ".", "name", "+", "'\\r\\n'", "if", "self", ".", "_DEBUG", ":", "...
Run the simulation in the current directory.
[ "Run", "the", "simulation", "in", "the", "current", "directory", "." ]
97e20aa85d20112cd114faa54a8197c5d0f61209
https://github.com/se-esss-litterbox/Pynac/blob/97e20aa85d20112cd114faa54a8197c5d0f61209/Pynac/Core.py#L73-L107
241,014
AndresMWeber/Nomenclate
nomenclate/core/nomenclature.py
Nomenclate.format
def format(self, format_target, remove_obsolete=True): """ Changes the internal self.format_string_object format target based on input. Also checks to see if input is an entry in the config file in case we want to switch to a preexisting config format. :param format_target: str, input for ...
python
def format(self, format_target, remove_obsolete=True): """ Changes the internal self.format_string_object format target based on input. Also checks to see if input is an entry in the config file in case we want to switch to a preexisting config format. :param format_target: str, input for ...
[ "def", "format", "(", "self", ",", "format_target", ",", "remove_obsolete", "=", "True", ")", ":", "original_format", ",", "original_format_order", "=", "(", "self", ".", "format", ",", "self", ".", "format_order", ")", "try", ":", "format_target", "=", "sel...
Changes the internal self.format_string_object format target based on input. Also checks to see if input is an entry in the config file in case we want to switch to a preexisting config format. :param format_target: str, input for the new format type. All strings will be the new tokens. :...
[ "Changes", "the", "internal", "self", ".", "format_string_object", "format", "target", "based", "on", "input", ".", "Also", "checks", "to", "see", "if", "input", "is", "an", "entry", "in", "the", "config", "file", "in", "case", "we", "want", "to", "switch"...
e6d6fc28beac042bad588e56fbe77531d2de6b6f
https://github.com/AndresMWeber/Nomenclate/blob/e6d6fc28beac042bad588e56fbe77531d2de6b6f/nomenclate/core/nomenclature.py#L77-L94
241,015
AndresMWeber/Nomenclate
nomenclate/core/nomenclature.py
Nomenclate.initialize_format_options
def initialize_format_options(self, format_target=''): """ First attempts to use format_target as a config path or gets the default format if it's invalid or is empty. :param format_target: (str, list(str)), can be either a query path to a format ...
python
def initialize_format_options(self, format_target=''): """ First attempts to use format_target as a config path or gets the default format if it's invalid or is empty. :param format_target: (str, list(str)), can be either a query path to a format ...
[ "def", "initialize_format_options", "(", "self", ",", "format_target", "=", "''", ")", ":", "try", ":", "if", "format_target", ":", "self", ".", "format", "=", "format_target", "else", ":", "raise", "errors", ".", "FormatError", "except", "errors", ".", "For...
First attempts to use format_target as a config path or gets the default format if it's invalid or is empty. :param format_target: (str, list(str)), can be either a query path to a format or in format of a naming string the sections should be spaced a...
[ "First", "attempts", "to", "use", "format_target", "as", "a", "config", "path", "or", "gets", "the", "default", "format", "if", "it", "s", "invalid", "or", "is", "empty", "." ]
e6d6fc28beac042bad588e56fbe77531d2de6b6f
https://github.com/AndresMWeber/Nomenclate/blob/e6d6fc28beac042bad588e56fbe77531d2de6b6f/nomenclate/core/nomenclature.py#L107-L122
241,016
AndresMWeber/Nomenclate
nomenclate/core/nomenclature.py
Nomenclate.initialize_options
def initialize_options(cls): """ Stores options from the config file """ cls.CONFIG_OPTIONS = cls.CFG.get(cls.CONFIG_PATH, return_type=dict)
python
def initialize_options(cls): """ Stores options from the config file """ cls.CONFIG_OPTIONS = cls.CFG.get(cls.CONFIG_PATH, return_type=dict)
[ "def", "initialize_options", "(", "cls", ")", ":", "cls", ".", "CONFIG_OPTIONS", "=", "cls", ".", "CFG", ".", "get", "(", "cls", ".", "CONFIG_PATH", ",", "return_type", "=", "dict", ")" ]
Stores options from the config file
[ "Stores", "options", "from", "the", "config", "file" ]
e6d6fc28beac042bad588e56fbe77531d2de6b6f
https://github.com/AndresMWeber/Nomenclate/blob/e6d6fc28beac042bad588e56fbe77531d2de6b6f/nomenclate/core/nomenclature.py#L125-L129
241,017
AndresMWeber/Nomenclate
nomenclate/core/nomenclature.py
Nomenclate.merge_dict
def merge_dict(self, *args, **kwargs): """ Takes variable inputs, compiles them into a dictionary then merges it to the current nomenclate's state :param args: (dict, Nomenclate), any number of dictionary inputs or Nomenclates to be converted to dicts :param kwargs: str, any number of kwargs th...
python
def merge_dict(self, *args, **kwargs): """ Takes variable inputs, compiles them into a dictionary then merges it to the current nomenclate's state :param args: (dict, Nomenclate), any number of dictionary inputs or Nomenclates to be converted to dicts :param kwargs: str, any number of kwargs th...
[ "def", "merge_dict", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "input_dict", "=", "self", ".", "_convert_input", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "input_dict", ":", "self", ".", "_sift_and_init_configs", "("...
Takes variable inputs, compiles them into a dictionary then merges it to the current nomenclate's state :param args: (dict, Nomenclate), any number of dictionary inputs or Nomenclates to be converted to dicts :param kwargs: str, any number of kwargs that represent token:value pairs
[ "Takes", "variable", "inputs", "compiles", "them", "into", "a", "dictionary", "then", "merges", "it", "to", "the", "current", "nomenclate", "s", "state" ]
e6d6fc28beac042bad588e56fbe77531d2de6b6f
https://github.com/AndresMWeber/Nomenclate/blob/e6d6fc28beac042bad588e56fbe77531d2de6b6f/nomenclate/core/nomenclature.py#L141-L150
241,018
AndresMWeber/Nomenclate
nomenclate/core/nomenclature.py
Nomenclate.get_token_settings
def get_token_settings(cls, token, default=None): """ Get the value for a specific token as a dictionary or replace with default :param token: str, token to query the nomenclate for :param default: object, substitution if the token is not found :return: (dict, object, None), token setti...
python
def get_token_settings(cls, token, default=None): """ Get the value for a specific token as a dictionary or replace with default :param token: str, token to query the nomenclate for :param default: object, substitution if the token is not found :return: (dict, object, None), token setti...
[ "def", "get_token_settings", "(", "cls", ",", "token", ",", "default", "=", "None", ")", ":", "setting_dict", "=", "{", "}", "for", "key", ",", "value", "in", "iteritems", "(", "cls", ".", "__dict__", ")", ":", "if", "'%s_'", "%", "token", "in", "key...
Get the value for a specific token as a dictionary or replace with default :param token: str, token to query the nomenclate for :param default: object, substitution if the token is not found :return: (dict, object, None), token setting dictionary or default
[ "Get", "the", "value", "for", "a", "specific", "token", "as", "a", "dictionary", "or", "replace", "with", "default" ]
e6d6fc28beac042bad588e56fbe77531d2de6b6f
https://github.com/AndresMWeber/Nomenclate/blob/e6d6fc28beac042bad588e56fbe77531d2de6b6f/nomenclate/core/nomenclature.py#L153-L165
241,019
AndresMWeber/Nomenclate
nomenclate/core/nomenclature.py
Nomenclate._update_tokens_from_swap_format
def _update_tokens_from_swap_format(self, original_format, original_format_order, remove_obsolete=True): """ Updates tokens based on a swap format call that will maintain synchronicity between token_dict and attrs If there was an accidental setting already set to one of the attrs that should now be ...
python
def _update_tokens_from_swap_format(self, original_format, original_format_order, remove_obsolete=True): """ Updates tokens based on a swap format call that will maintain synchronicity between token_dict and attrs If there was an accidental setting already set to one of the attrs that should now be ...
[ "def", "_update_tokens_from_swap_format", "(", "self", ",", "original_format", ",", "original_format_order", ",", "remove_obsolete", "=", "True", ")", ":", "old_format_order", "=", "[", "_", ".", "lower", "(", ")", "for", "_", "in", "original_format_order", "]", ...
Updates tokens based on a swap format call that will maintain synchronicity between token_dict and attrs If there was an accidental setting already set to one of the attrs that should now be a token attr due to the format swap, we wipe it and add a new TokenAttr to the Nomenclate attribute. ...
[ "Updates", "tokens", "based", "on", "a", "swap", "format", "call", "that", "will", "maintain", "synchronicity", "between", "token_dict", "and", "attrs", "If", "there", "was", "an", "accidental", "setting", "already", "set", "to", "one", "of", "the", "attrs", ...
e6d6fc28beac042bad588e56fbe77531d2de6b6f
https://github.com/AndresMWeber/Nomenclate/blob/e6d6fc28beac042bad588e56fbe77531d2de6b6f/nomenclate/core/nomenclature.py#L167-L195
241,020
AndresMWeber/Nomenclate
nomenclate/core/nomenclature.py
Nomenclate._convert_input
def _convert_input(self, *args, **kwargs): """ Takes variable inputs :param args: (dict, Nomenclate), any number of dictionary inputs or Nomenclates to be converted to dicts :param kwargs: str, any number of kwargs that represent token:value pairs :return: dict, combined dictionary of a...
python
def _convert_input(self, *args, **kwargs): """ Takes variable inputs :param args: (dict, Nomenclate), any number of dictionary inputs or Nomenclates to be converted to dicts :param kwargs: str, any number of kwargs that represent token:value pairs :return: dict, combined dictionary of a...
[ "def", "_convert_input", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "args", "=", "[", "arg", ".", "state", "if", "isinstance", "(", "arg", ",", "Nomenclate", ")", "else", "arg", "for", "arg", "in", "args", "]", "input_dict", ...
Takes variable inputs :param args: (dict, Nomenclate), any number of dictionary inputs or Nomenclates to be converted to dicts :param kwargs: str, any number of kwargs that represent token:value pairs :return: dict, combined dictionary of all inputs
[ "Takes", "variable", "inputs" ]
e6d6fc28beac042bad588e56fbe77531d2de6b6f
https://github.com/AndresMWeber/Nomenclate/blob/e6d6fc28beac042bad588e56fbe77531d2de6b6f/nomenclate/core/nomenclature.py#L197-L206
241,021
smbapps/isolcss
isolcss/parser.py
matchiter
def matchiter(r, s, flags=0): """ Yields contiguous MatchObjects of r in s. Raises ValueError if r eventually doesn't match contiguously. """ if isinstance(r, basestring): r = re.compile(r, flags) i = 0 while s: m = r.match(s) g = m and m.group(0) if not m or ...
python
def matchiter(r, s, flags=0): """ Yields contiguous MatchObjects of r in s. Raises ValueError if r eventually doesn't match contiguously. """ if isinstance(r, basestring): r = re.compile(r, flags) i = 0 while s: m = r.match(s) g = m and m.group(0) if not m or ...
[ "def", "matchiter", "(", "r", ",", "s", ",", "flags", "=", "0", ")", ":", "if", "isinstance", "(", "r", ",", "basestring", ")", ":", "r", "=", "re", ".", "compile", "(", "r", ",", "flags", ")", "i", "=", "0", "while", "s", ":", "m", "=", "r...
Yields contiguous MatchObjects of r in s. Raises ValueError if r eventually doesn't match contiguously.
[ "Yields", "contiguous", "MatchObjects", "of", "r", "in", "s", ".", "Raises", "ValueError", "if", "r", "eventually", "doesn", "t", "match", "contiguously", "." ]
1613dfd297f64292af1216855b6d096f2bed82fe
https://github.com/smbapps/isolcss/blob/1613dfd297f64292af1216855b6d096f2bed82fe/isolcss/parser.py#L131-L146
241,022
smbapps/isolcss
isolcss/parser.py
matchall
def matchall(r, s, flags=0): """ Returns the list of contiguous string matches of r in s, or None if r does not successively match the entire s. """ try: return [m.group(0) for m in matchiter(r, s, flags)] except ValueError: return None
python
def matchall(r, s, flags=0): """ Returns the list of contiguous string matches of r in s, or None if r does not successively match the entire s. """ try: return [m.group(0) for m in matchiter(r, s, flags)] except ValueError: return None
[ "def", "matchall", "(", "r", ",", "s", ",", "flags", "=", "0", ")", ":", "try", ":", "return", "[", "m", ".", "group", "(", "0", ")", "for", "m", "in", "matchiter", "(", "r", ",", "s", ",", "flags", ")", "]", "except", "ValueError", ":", "ret...
Returns the list of contiguous string matches of r in s, or None if r does not successively match the entire s.
[ "Returns", "the", "list", "of", "contiguous", "string", "matches", "of", "r", "in", "s", "or", "None", "if", "r", "does", "not", "successively", "match", "the", "entire", "s", "." ]
1613dfd297f64292af1216855b6d096f2bed82fe
https://github.com/smbapps/isolcss/blob/1613dfd297f64292af1216855b6d096f2bed82fe/isolcss/parser.py#L149-L157
241,023
diffeo/yakonfig
yakonfig/configurable.py
check_subconfig
def check_subconfig(config, name, sub): """Validate the configuration of an object within this. This calls :meth:`Configurable.check_config` or equivalent on `sub`. A dictionary configuration for `sub` is required in `config`. >>> def check_config(config, name): ... for sub in sub_modules: ...
python
def check_subconfig(config, name, sub): """Validate the configuration of an object within this. This calls :meth:`Configurable.check_config` or equivalent on `sub`. A dictionary configuration for `sub` is required in `config`. >>> def check_config(config, name): ... for sub in sub_modules: ...
[ "def", "check_subconfig", "(", "config", ",", "name", ",", "sub", ")", ":", "subname", "=", "sub", ".", "config_name", "subconfig", "=", "config", ".", "setdefault", "(", "subname", ",", "{", "}", ")", "if", "not", "isinstance", "(", "subconfig", ",", ...
Validate the configuration of an object within this. This calls :meth:`Configurable.check_config` or equivalent on `sub`. A dictionary configuration for `sub` is required in `config`. >>> def check_config(config, name): ... for sub in sub_modules: ... check_subconfig(config, name, sub)...
[ "Validate", "the", "configuration", "of", "an", "object", "within", "this", "." ]
412e195da29b4f4fc7b72967c192714a6f5eaeb5
https://github.com/diffeo/yakonfig/blob/412e195da29b4f4fc7b72967c192714a6f5eaeb5/yakonfig/configurable.py#L299-L323
241,024
pacificclimate/cfmeta
cfmeta/cmip5file.py
get_cmor_fp_meta
def get_cmor_fp_meta(fp): """Processes a CMOR style file path. Section 3.1 of the `Data Reference Syntax`_ details: The standard CMIP5 output tool CMOR optionally writes output files to a directory structure mapping DRS components to directory names as: <activity>/<product>/<insti...
python
def get_cmor_fp_meta(fp): """Processes a CMOR style file path. Section 3.1 of the `Data Reference Syntax`_ details: The standard CMIP5 output tool CMOR optionally writes output files to a directory structure mapping DRS components to directory names as: <activity>/<product>/<insti...
[ "def", "get_cmor_fp_meta", "(", "fp", ")", ":", "# Copy metadata list then reverse to start at end of path", "directory_meta", "=", "list", "(", "CMIP5_FP_ATTS", ")", "# Prefer meta extracted from filename", "meta", "=", "get_dir_meta", "(", "fp", ",", "directory_meta", ")"...
Processes a CMOR style file path. Section 3.1 of the `Data Reference Syntax`_ details: The standard CMIP5 output tool CMOR optionally writes output files to a directory structure mapping DRS components to directory names as: <activity>/<product>/<institute>/<model>/<experiment>/<frequ...
[ "Processes", "a", "CMOR", "style", "file", "path", "." ]
a6eef78d0bce523bb44920ba96233f034b60316a
https://github.com/pacificclimate/cfmeta/blob/a6eef78d0bce523bb44920ba96233f034b60316a/cfmeta/cmip5file.py#L124-L152
241,025
pacificclimate/cfmeta
cfmeta/cmip5file.py
get_datanode_fp_meta
def get_datanode_fp_meta(fp): """Processes a datanode style file path. Section 3.2 of the `Data Reference Syntax`_ details: It is recommended that ESGF data nodes should layout datasets on disk mapping DRS components to directories as: <activity>/<product>/<institute>/<model>/<exp...
python
def get_datanode_fp_meta(fp): """Processes a datanode style file path. Section 3.2 of the `Data Reference Syntax`_ details: It is recommended that ESGF data nodes should layout datasets on disk mapping DRS components to directories as: <activity>/<product>/<institute>/<model>/<exp...
[ "def", "get_datanode_fp_meta", "(", "fp", ")", ":", "# Copy metadata list then reverse to start at end of path", "directory_meta", "=", "list", "(", "CMIP5_DATANODE_FP_ATTS", ")", "# Prefer meta extracted from filename", "meta", "=", "get_dir_meta", "(", "fp", ",", "directory...
Processes a datanode style file path. Section 3.2 of the `Data Reference Syntax`_ details: It is recommended that ESGF data nodes should layout datasets on disk mapping DRS components to directories as: <activity>/<product>/<institute>/<model>/<experiment>/ <frequency>/<mo...
[ "Processes", "a", "datanode", "style", "file", "path", "." ]
a6eef78d0bce523bb44920ba96233f034b60316a
https://github.com/pacificclimate/cfmeta/blob/a6eef78d0bce523bb44920ba96233f034b60316a/cfmeta/cmip5file.py#L154-L183
241,026
pacificclimate/cfmeta
cfmeta/cmip5file.py
get_cmor_fname_meta
def get_cmor_fname_meta(fname): """Processes a CMOR style file name. Section 3.3 of the `Data Reference Syntax`_ details: filename = <variable name>_<mip_table>_<model>_<experiment>_ <ensemble_member>[_<temporal_subset>][_<geographical_info>].nc Temporal subsets are detailed in sectio...
python
def get_cmor_fname_meta(fname): """Processes a CMOR style file name. Section 3.3 of the `Data Reference Syntax`_ details: filename = <variable name>_<mip_table>_<model>_<experiment>_ <ensemble_member>[_<temporal_subset>][_<geographical_info>].nc Temporal subsets are detailed in sectio...
[ "def", "get_cmor_fname_meta", "(", "fname", ")", ":", "if", "'/'", "in", "fname", ":", "fname", "=", "os", ".", "path", ".", "split", "(", "fname", ")", "[", "1", "]", "fname", "=", "os", ".", "path", ".", "splitext", "(", "fname", ")", "[", "0",...
Processes a CMOR style file name. Section 3.3 of the `Data Reference Syntax`_ details: filename = <variable name>_<mip_table>_<model>_<experiment>_ <ensemble_member>[_<temporal_subset>][_<geographical_info>].nc Temporal subsets are detailed in section 2.4: Time instants or period...
[ "Processes", "a", "CMOR", "style", "file", "name", "." ]
a6eef78d0bce523bb44920ba96233f034b60316a
https://github.com/pacificclimate/cfmeta/blob/a6eef78d0bce523bb44920ba96233f034b60316a/cfmeta/cmip5file.py#L185-L244
241,027
za-creature/gulpless
gulpless/reactor.py
Reactor.run
def run(self, once=False): """Runs the reactor in the main thread.""" self._once = once self.start() while self.running: try: time.sleep(1.0) except KeyboardInterrupt: self.stop() self.join()
python
def run(self, once=False): """Runs the reactor in the main thread.""" self._once = once self.start() while self.running: try: time.sleep(1.0) except KeyboardInterrupt: self.stop() self.join()
[ "def", "run", "(", "self", ",", "once", "=", "False", ")", ":", "self", ".", "_once", "=", "once", "self", ".", "start", "(", ")", "while", "self", ".", "running", ":", "try", ":", "time", ".", "sleep", "(", "1.0", ")", "except", "KeyboardInterrupt...
Runs the reactor in the main thread.
[ "Runs", "the", "reactor", "in", "the", "main", "thread", "." ]
fd73907dbe86880086719816bb042233f85121f6
https://github.com/za-creature/gulpless/blob/fd73907dbe86880086719816bb042233f85121f6/gulpless/reactor.py#L47-L56
241,028
lewisjared/credkeep
credkeep/util.py
clear_to_enc_filename
def clear_to_enc_filename(fname): """ Converts the filename of a cleartext file and convert it to an encrypted filename :param fname: :return: filename of encrypted secret file if found, else None """ if not fname.lower().endswith('.json'): raise CredkeepException('Invalid filetype') ...
python
def clear_to_enc_filename(fname): """ Converts the filename of a cleartext file and convert it to an encrypted filename :param fname: :return: filename of encrypted secret file if found, else None """ if not fname.lower().endswith('.json'): raise CredkeepException('Invalid filetype') ...
[ "def", "clear_to_enc_filename", "(", "fname", ")", ":", "if", "not", "fname", ".", "lower", "(", ")", ".", "endswith", "(", "'.json'", ")", ":", "raise", "CredkeepException", "(", "'Invalid filetype'", ")", "if", "fname", ".", "lower", "(", ")", ".", "en...
Converts the filename of a cleartext file and convert it to an encrypted filename :param fname: :return: filename of encrypted secret file if found, else None
[ "Converts", "the", "filename", "of", "a", "cleartext", "file", "and", "convert", "it", "to", "an", "encrypted", "filename" ]
63638ced094992552a28109b91839bcbbbe9230a
https://github.com/lewisjared/credkeep/blob/63638ced094992552a28109b91839bcbbbe9230a/credkeep/util.py#L12-L27
241,029
lewisjared/credkeep
credkeep/util.py
enc_to_clear_filename
def enc_to_clear_filename(fname): """ Converts the filename of an encrypted file to cleartext :param fname: :return: filename of clear secret file if found, else None """ if not fname.lower().endswith('.json'): raise CredkeepException('Invalid filetype') if not fname.lower().endswi...
python
def enc_to_clear_filename(fname): """ Converts the filename of an encrypted file to cleartext :param fname: :return: filename of clear secret file if found, else None """ if not fname.lower().endswith('.json'): raise CredkeepException('Invalid filetype') if not fname.lower().endswi...
[ "def", "enc_to_clear_filename", "(", "fname", ")", ":", "if", "not", "fname", ".", "lower", "(", ")", ".", "endswith", "(", "'.json'", ")", ":", "raise", "CredkeepException", "(", "'Invalid filetype'", ")", "if", "not", "fname", ".", "lower", "(", ")", "...
Converts the filename of an encrypted file to cleartext :param fname: :return: filename of clear secret file if found, else None
[ "Converts", "the", "filename", "of", "an", "encrypted", "file", "to", "cleartext" ]
63638ced094992552a28109b91839bcbbbe9230a
https://github.com/lewisjared/credkeep/blob/63638ced094992552a28109b91839bcbbbe9230a/credkeep/util.py#L30-L46
241,030
kevinsprong23/aperture
aperture/heatmaps.py
init_heatmap
def init_heatmap(x_vec, y_vec, hist_matrix, fig, colormap='Blues', alpha=1, grid=False, colorbar=True, vmax='auto', vmin='auto', crop=True): """ convenience function to initialize a standard colormap in a figure """ plt.figure(fig.number) ax = fig.gca() # set v...
python
def init_heatmap(x_vec, y_vec, hist_matrix, fig, colormap='Blues', alpha=1, grid=False, colorbar=True, vmax='auto', vmin='auto', crop=True): """ convenience function to initialize a standard colormap in a figure """ plt.figure(fig.number) ax = fig.gca() # set v...
[ "def", "init_heatmap", "(", "x_vec", ",", "y_vec", ",", "hist_matrix", ",", "fig", ",", "colormap", "=", "'Blues'", ",", "alpha", "=", "1", ",", "grid", "=", "False", ",", "colorbar", "=", "True", ",", "vmax", "=", "'auto'", ",", "vmin", "=", "'auto'...
convenience function to initialize a standard colormap in a figure
[ "convenience", "function", "to", "initialize", "a", "standard", "colormap", "in", "a", "figure" ]
d0420fef3b25d8afc0e5ddcfb6fe5f0ff42b9799
https://github.com/kevinsprong23/aperture/blob/d0420fef3b25d8afc0e5ddcfb6fe5f0ff42b9799/aperture/heatmaps.py#L88-L120
241,031
kevinsprong23/aperture
aperture/heatmaps.py
heatmap
def heatmap(x, y, step=None, min_pt=None, max_pt=None, colormap='Blues', alpha=1, grid=False, colorbar=True, scale='lin', vmax='auto', vmin='auto', crop=True): """ function to take vectors x and y and hist them """ (x_vec, y_vec, hist_matrix) = calc_2d_...
python
def heatmap(x, y, step=None, min_pt=None, max_pt=None, colormap='Blues', alpha=1, grid=False, colorbar=True, scale='lin', vmax='auto', vmin='auto', crop=True): """ function to take vectors x and y and hist them """ (x_vec, y_vec, hist_matrix) = calc_2d_...
[ "def", "heatmap", "(", "x", ",", "y", ",", "step", "=", "None", ",", "min_pt", "=", "None", ",", "max_pt", "=", "None", ",", "colormap", "=", "'Blues'", ",", "alpha", "=", "1", ",", "grid", "=", "False", ",", "colorbar", "=", "True", ",", "scale"...
function to take vectors x and y and hist them
[ "function", "to", "take", "vectors", "x", "and", "y", "and", "hist", "them" ]
d0420fef3b25d8afc0e5ddcfb6fe5f0ff42b9799
https://github.com/kevinsprong23/aperture/blob/d0420fef3b25d8afc0e5ddcfb6fe5f0ff42b9799/aperture/heatmaps.py#L123-L144
241,032
jalanb/pysyte
pysyte/paths.py
ext_language
def ext_language(ext, exts=None): """Language of the extension in those extensions If exts is supplied, then restrict recognition to those exts only If exts is not supplied, then use all known extensions >>> ext_language('.py') == 'python' True """ languages = { '.py': 'python', ...
python
def ext_language(ext, exts=None): """Language of the extension in those extensions If exts is supplied, then restrict recognition to those exts only If exts is not supplied, then use all known extensions >>> ext_language('.py') == 'python' True """ languages = { '.py': 'python', ...
[ "def", "ext_language", "(", "ext", ",", "exts", "=", "None", ")", ":", "languages", "=", "{", "'.py'", ":", "'python'", ",", "'.py2'", ":", "'python2'", ",", "'.py3'", ":", "'python3'", ",", "'.sh'", ":", "'bash'", ",", "'.bash'", ":", "'bash'", ",", ...
Language of the extension in those extensions If exts is supplied, then restrict recognition to those exts only If exts is not supplied, then use all known extensions >>> ext_language('.py') == 'python' True
[ "Language", "of", "the", "extension", "in", "those", "extensions" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L273-L293
241,033
jalanb/pysyte
pysyte/paths.py
find_language
def find_language(script, exts=None): """Determine the script's language extension >>> this_script = __file__.rstrip('c') >>> find_language(makepath(this_script)) == 'python' True If exts are given they restrict which extensions are allowed >>> find_language(makepath(this_script), ('.sh', '.t...
python
def find_language(script, exts=None): """Determine the script's language extension >>> this_script = __file__.rstrip('c') >>> find_language(makepath(this_script)) == 'python' True If exts are given they restrict which extensions are allowed >>> find_language(makepath(this_script), ('.sh', '.t...
[ "def", "find_language", "(", "script", ",", "exts", "=", "None", ")", ":", "if", "not", "script", ".", "isfile", "(", ")", ":", "return", "None", "if", "script", ".", "ext", ":", "return", "ext_language", "(", "script", ".", "ext", ",", "exts", ")", ...
Determine the script's language extension >>> this_script = __file__.rstrip('c') >>> find_language(makepath(this_script)) == 'python' True If exts are given they restrict which extensions are allowed >>> find_language(makepath(this_script), ('.sh', '.txt')) is None True If there is no ex...
[ "Determine", "the", "script", "s", "language", "extension" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L296-L320
241,034
jalanb/pysyte
pysyte/paths.py
makepath
def makepath(s, as_file=False): """Make a path from a string Expand out any variables, home squiggles, and normalise it See also http://stackoverflow.com/questions/26403972 """ if s is None: return None result = FilePath(s) if (os.path.isfile(s) or as_file) else DirectPath(s) return...
python
def makepath(s, as_file=False): """Make a path from a string Expand out any variables, home squiggles, and normalise it See also http://stackoverflow.com/questions/26403972 """ if s is None: return None result = FilePath(s) if (os.path.isfile(s) or as_file) else DirectPath(s) return...
[ "def", "makepath", "(", "s", ",", "as_file", "=", "False", ")", ":", "if", "s", "is", "None", ":", "return", "None", "result", "=", "FilePath", "(", "s", ")", "if", "(", "os", ".", "path", ".", "isfile", "(", "s", ")", "or", "as_file", ")", "el...
Make a path from a string Expand out any variables, home squiggles, and normalise it See also http://stackoverflow.com/questions/26403972
[ "Make", "a", "path", "from", "a", "string" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L608-L617
241,035
jalanb/pysyte
pysyte/paths.py
cd
def cd(path_to): # pylint: disable=invalid-name """cd to the given path If the path is a file, then cd to its parent directory Remember current directory before the cd so that we can cd back there with cd('-') """ if path_to == '-': if not cd.previous: raise PathError(...
python
def cd(path_to): # pylint: disable=invalid-name """cd to the given path If the path is a file, then cd to its parent directory Remember current directory before the cd so that we can cd back there with cd('-') """ if path_to == '-': if not cd.previous: raise PathError(...
[ "def", "cd", "(", "path_to", ")", ":", "# pylint: disable=invalid-name", "if", "path_to", "==", "'-'", ":", "if", "not", "cd", ".", "previous", ":", "raise", "PathError", "(", "'No previous directory to return to'", ")", "return", "cd", "(", "cd", ".", "previo...
cd to the given path If the path is a file, then cd to its parent directory Remember current directory before the cd so that we can cd back there with cd('-')
[ "cd", "to", "the", "given", "path" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L622-L651
241,036
jalanb/pysyte
pysyte/paths.py
make_needed
def make_needed(pattern, path_to_directory, wanted): """Make a method to check if an item matches the pattern, and is wanted If wanted is None just check the pattern """ if wanted: def needed(name): return fnmatch(name, pattern) and wanted( os.path.join(path_to_direc...
python
def make_needed(pattern, path_to_directory, wanted): """Make a method to check if an item matches the pattern, and is wanted If wanted is None just check the pattern """ if wanted: def needed(name): return fnmatch(name, pattern) and wanted( os.path.join(path_to_direc...
[ "def", "make_needed", "(", "pattern", ",", "path_to_directory", ",", "wanted", ")", ":", "if", "wanted", ":", "def", "needed", "(", "name", ")", ":", "return", "fnmatch", "(", "name", ",", "pattern", ")", "and", "wanted", "(", "os", ".", "path", ".", ...
Make a method to check if an item matches the pattern, and is wanted If wanted is None just check the pattern
[ "Make", "a", "method", "to", "check", "if", "an", "item", "matches", "the", "pattern", "and", "is", "wanted" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L763-L774
241,037
jalanb/pysyte
pysyte/paths.py
list_items
def list_items(path_to_directory, pattern, wanted): """All items in the given path which match the given glob and are wanted""" if not path_to_directory: return set() needed = make_needed(pattern, path_to_directory, wanted) return [os.path.join(path_to_directory, name) for name in _n...
python
def list_items(path_to_directory, pattern, wanted): """All items in the given path which match the given glob and are wanted""" if not path_to_directory: return set() needed = make_needed(pattern, path_to_directory, wanted) return [os.path.join(path_to_directory, name) for name in _n...
[ "def", "list_items", "(", "path_to_directory", ",", "pattern", ",", "wanted", ")", ":", "if", "not", "path_to_directory", ":", "return", "set", "(", ")", "needed", "=", "make_needed", "(", "pattern", ",", "path_to_directory", ",", "wanted", ")", "return", "[...
All items in the given path which match the given glob and are wanted
[ "All", "items", "in", "the", "given", "path", "which", "match", "the", "given", "glob", "and", "are", "wanted" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L777-L784
241,038
jalanb/pysyte
pysyte/paths.py
contains_glob
def contains_glob(path_to_directory, pattern, wanted=None): """Whether the given path contains an item matching the given glob""" if not path_to_directory: return False needed = make_needed(pattern, path_to_directory, wanted) for name in _names_in_directory(path_to_directory): if needed(...
python
def contains_glob(path_to_directory, pattern, wanted=None): """Whether the given path contains an item matching the given glob""" if not path_to_directory: return False needed = make_needed(pattern, path_to_directory, wanted) for name in _names_in_directory(path_to_directory): if needed(...
[ "def", "contains_glob", "(", "path_to_directory", ",", "pattern", ",", "wanted", "=", "None", ")", ":", "if", "not", "path_to_directory", ":", "return", "False", "needed", "=", "make_needed", "(", "pattern", ",", "path_to_directory", ",", "wanted", ")", "for",...
Whether the given path contains an item matching the given glob
[ "Whether", "the", "given", "path", "contains", "an", "item", "matching", "the", "given", "glob" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L801-L809
241,039
jalanb/pysyte
pysyte/paths.py
tab_complete
def tab_complete(string): """Finish file names "left short" by tab-completion For example, if an argument is "fred." and no file called "fred." exists but "fred.py" does exist then return fred.py """ if is_option(string): return string if not missing_extension(string...
python
def tab_complete(string): """Finish file names "left short" by tab-completion For example, if an argument is "fred." and no file called "fred." exists but "fred.py" does exist then return fred.py """ if is_option(string): return string if not missing_extension(string...
[ "def", "tab_complete", "(", "string", ")", ":", "if", "is_option", "(", "string", ")", ":", "return", "string", "if", "not", "missing_extension", "(", "string", ")", ":", "return", "string", "if", "os", ".", "path", ".", "isfile", "(", "string", ")", "...
Finish file names "left short" by tab-completion For example, if an argument is "fred." and no file called "fred." exists but "fred.py" does exist then return fred.py
[ "Finish", "file", "names", "left", "short", "by", "tab", "-", "completion" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L834-L852
241,040
jalanb/pysyte
pysyte/paths.py
pyc_to_py
def pyc_to_py(path_to_file): """Change some file extensions to those which are more likely to be text >>> pyc_to_py('vim.pyc') == 'vim.py' True """ stem, ext = os.path.splitext(path_to_file) if ext == '.pyc': return '%s.py' % stem return path_to_file
python
def pyc_to_py(path_to_file): """Change some file extensions to those which are more likely to be text >>> pyc_to_py('vim.pyc') == 'vim.py' True """ stem, ext = os.path.splitext(path_to_file) if ext == '.pyc': return '%s.py' % stem return path_to_file
[ "def", "pyc_to_py", "(", "path_to_file", ")", ":", "stem", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "path_to_file", ")", "if", "ext", "==", "'.pyc'", ":", "return", "'%s.py'", "%", "stem", "return", "path_to_file" ]
Change some file extensions to those which are more likely to be text >>> pyc_to_py('vim.pyc') == 'vim.py' True
[ "Change", "some", "file", "extensions", "to", "those", "which", "are", "more", "likely", "to", "be", "text" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L855-L864
241,041
jalanb/pysyte
pysyte/paths.py
DotPath.as_existing_file
def as_existing_file(self, filepath): """Return the file class for existing files only""" if os.path.isfile(filepath) and hasattr(self, '__file_class__'): return self.__file_class__(filepath) # pylint: disable=no-member return self.__class__(filepath)
python
def as_existing_file(self, filepath): """Return the file class for existing files only""" if os.path.isfile(filepath) and hasattr(self, '__file_class__'): return self.__file_class__(filepath) # pylint: disable=no-member return self.__class__(filepath)
[ "def", "as_existing_file", "(", "self", ",", "filepath", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "filepath", ")", "and", "hasattr", "(", "self", ",", "'__file_class__'", ")", ":", "return", "self", ".", "__file_class__", "(", "filepath", "...
Return the file class for existing files only
[ "Return", "the", "file", "class", "for", "existing", "files", "only" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L76-L80
241,042
jalanb/pysyte
pysyte/paths.py
DotPath.dirpaths
def dirpaths(self): """Split the dirname into individual directory names An absolute path starts with an empty string, a relative path does not >>> p = DotPath(u'/path/to/x.py') >>> p.paths == p.dirpaths() True """ parts = self.parts() result = [DotPath(...
python
def dirpaths(self): """Split the dirname into individual directory names An absolute path starts with an empty string, a relative path does not >>> p = DotPath(u'/path/to/x.py') >>> p.paths == p.dirpaths() True """ parts = self.parts() result = [DotPath(...
[ "def", "dirpaths", "(", "self", ")", ":", "parts", "=", "self", ".", "parts", "(", ")", "result", "=", "[", "DotPath", "(", "parts", "[", "0", "]", "or", "'/'", ")", "]", "for", "name", "in", "parts", "[", "1", ":", "]", ":", "result", ".", "...
Split the dirname into individual directory names An absolute path starts with an empty string, a relative path does not >>> p = DotPath(u'/path/to/x.py') >>> p.paths == p.dirpaths() True
[ "Split", "the", "dirname", "into", "individual", "directory", "names" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L103-L116
241,043
jalanb/pysyte
pysyte/paths.py
DotPath.parts
def parts(self): """Split the path into parts like Pathlib >>> expected = ['/', 'path', 'to', 'there'] >>> assert DotPath('/path/to/there').parts() == expected """ parts = self.split(os.path.sep) parts[0] = parts[0] and parts[0] or '/' return parts
python
def parts(self): """Split the path into parts like Pathlib >>> expected = ['/', 'path', 'to', 'there'] >>> assert DotPath('/path/to/there').parts() == expected """ parts = self.split(os.path.sep) parts[0] = parts[0] and parts[0] or '/' return parts
[ "def", "parts", "(", "self", ")", ":", "parts", "=", "self", ".", "split", "(", "os", ".", "path", ".", "sep", ")", "parts", "[", "0", "]", "=", "parts", "[", "0", "]", "and", "parts", "[", "0", "]", "or", "'/'", "return", "parts" ]
Split the path into parts like Pathlib >>> expected = ['/', 'path', 'to', 'there'] >>> assert DotPath('/path/to/there').parts() == expected
[ "Split", "the", "path", "into", "parts", "like", "Pathlib" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L118-L126
241,044
jalanb/pysyte
pysyte/paths.py
DotPath.short_relative_path_to
def short_relative_path_to(self, destination): """The shorter of either the absolute path of the destination, or the relative path to it >>> print(DotPath('/home/guido/bin').short_relative_path_to( ... '/home/guido/build/python.tar')) ../build/python.tar >>> prin...
python
def short_relative_path_to(self, destination): """The shorter of either the absolute path of the destination, or the relative path to it >>> print(DotPath('/home/guido/bin').short_relative_path_to( ... '/home/guido/build/python.tar')) ../build/python.tar >>> prin...
[ "def", "short_relative_path_to", "(", "self", ",", "destination", ")", ":", "relative", "=", "self", ".", "relpathto", "(", "destination", ")", "absolute", "=", "self", ".", "__class__", "(", "destination", ")", ".", "abspath", "(", ")", "if", "len", "(", ...
The shorter of either the absolute path of the destination, or the relative path to it >>> print(DotPath('/home/guido/bin').short_relative_path_to( ... '/home/guido/build/python.tar')) ../build/python.tar >>> print(DotPath('/home/guido/bin').short_relative_path_to( ...
[ "The", "shorter", "of", "either", "the", "absolute", "path", "of", "the", "destination", "or", "the", "relative", "path", "to", "it" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L165-L180
241,045
jalanb/pysyte
pysyte/paths.py
FilePath.extend_by
def extend_by(self, extension): """The path to the file changed to use the given extension >>> FilePath('/path/to/fred').extend_by('.txt') <FilePath '/path/to/fred.txt'> >>> FilePath('/path/to/fred.txt').extend_by('..tmp') <FilePath '/path/to/fred.tmp'> >>> FilePath('/pa...
python
def extend_by(self, extension): """The path to the file changed to use the given extension >>> FilePath('/path/to/fred').extend_by('.txt') <FilePath '/path/to/fred.txt'> >>> FilePath('/path/to/fred.txt').extend_by('..tmp') <FilePath '/path/to/fred.tmp'> >>> FilePath('/pa...
[ "def", "extend_by", "(", "self", ",", "extension", ")", ":", "copy", "=", "self", "[", ":", "]", "filename", ",", "_", "=", "os", ".", "path", ".", "splitext", "(", "copy", ")", "return", "self", ".", "__class__", "(", "'%s.%s'", "%", "(", "filenam...
The path to the file changed to use the given extension >>> FilePath('/path/to/fred').extend_by('.txt') <FilePath '/path/to/fred.txt'> >>> FilePath('/path/to/fred.txt').extend_by('..tmp') <FilePath '/path/to/fred.tmp'> >>> FilePath('/path/to/fred.txt').extend_by('fred') ...
[ "The", "path", "to", "the", "file", "changed", "to", "use", "the", "given", "extension" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L390-L402
241,046
jalanb/pysyte
pysyte/paths.py
FilePath.make_file_exist
def make_file_exist(self): """Make sure the parent directory exists, then touch the file""" self.parent.make_directory_exist() self.parent.touch_file(self.name) return self
python
def make_file_exist(self): """Make sure the parent directory exists, then touch the file""" self.parent.make_directory_exist() self.parent.touch_file(self.name) return self
[ "def", "make_file_exist", "(", "self", ")", ":", "self", ".", "parent", ".", "make_directory_exist", "(", ")", "self", ".", "parent", ".", "touch_file", "(", "self", ".", "name", ")", "return", "self" ]
Make sure the parent directory exists, then touch the file
[ "Make", "sure", "the", "parent", "directory", "exists", "then", "touch", "the", "file" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L438-L442
241,047
jalanb/pysyte
pysyte/paths.py
FilePath.language
def language(self): """The language of this file""" try: return self._language except AttributeError: self._language = find_language(self, getattr(self, 'exts', None)) return self._language
python
def language(self): """The language of this file""" try: return self._language except AttributeError: self._language = find_language(self, getattr(self, 'exts', None)) return self._language
[ "def", "language", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_language", "except", "AttributeError", ":", "self", ".", "_language", "=", "find_language", "(", "self", ",", "getattr", "(", "self", ",", "'exts'", ",", "None", ")", ")", "...
The language of this file
[ "The", "language", "of", "this", "file" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L445-L451
241,048
jalanb/pysyte
pysyte/paths.py
DirectPath.try_remove
def try_remove(self): """Try to remove the path If it is a directory, try recursive removal of contents too """ if self.islink(): self.unlink() elif self.isfile(): self.remove() elif self.isdir(): self.empty_directory() if ...
python
def try_remove(self): """Try to remove the path If it is a directory, try recursive removal of contents too """ if self.islink(): self.unlink() elif self.isfile(): self.remove() elif self.isdir(): self.empty_directory() if ...
[ "def", "try_remove", "(", "self", ")", ":", "if", "self", ".", "islink", "(", ")", ":", "self", ".", "unlink", "(", ")", "elif", "self", ".", "isfile", "(", ")", ":", "self", ".", "remove", "(", ")", "elif", "self", ".", "isdir", "(", ")", ":",...
Try to remove the path If it is a directory, try recursive removal of contents too
[ "Try", "to", "remove", "the", "path" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L483-L498
241,049
jalanb/pysyte
pysyte/paths.py
DirectPath.empty_directory
def empty_directory(self): """Remove all contents of a directory Including any sub-directories and their contents""" for child in self.walkfiles(): child.remove() for child in reversed([d for d in self.walkdirs()]): if child == self or not child.isdir(): ...
python
def empty_directory(self): """Remove all contents of a directory Including any sub-directories and their contents""" for child in self.walkfiles(): child.remove() for child in reversed([d for d in self.walkdirs()]): if child == self or not child.isdir(): ...
[ "def", "empty_directory", "(", "self", ")", ":", "for", "child", "in", "self", ".", "walkfiles", "(", ")", ":", "child", ".", "remove", "(", ")", "for", "child", "in", "reversed", "(", "[", "d", "for", "d", "in", "self", ".", "walkdirs", "(", ")", ...
Remove all contents of a directory Including any sub-directories and their contents
[ "Remove", "all", "contents", "of", "a", "directory" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L500-L509
241,050
jalanb/pysyte
pysyte/paths.py
DirectPath.make_file_exist
def make_file_exist(self, filename=None): """Make the directory exist, then touch the file If the filename is None, then use self.name as filename """ if filename is None: path_to_file = FilePath(self) path_to_file.make_file_exist() return path_to_fil...
python
def make_file_exist(self, filename=None): """Make the directory exist, then touch the file If the filename is None, then use self.name as filename """ if filename is None: path_to_file = FilePath(self) path_to_file.make_file_exist() return path_to_fil...
[ "def", "make_file_exist", "(", "self", ",", "filename", "=", "None", ")", ":", "if", "filename", "is", "None", ":", "path_to_file", "=", "FilePath", "(", "self", ")", "path_to_file", ".", "make_file_exist", "(", ")", "return", "path_to_file", "else", ":", ...
Make the directory exist, then touch the file If the filename is None, then use self.name as filename
[ "Make", "the", "directory", "exist", "then", "touch", "the", "file" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L542-L554
241,051
jalanb/pysyte
pysyte/paths.py
DirectPath.touch_file
def touch_file(self, filename): """Touch a file in the directory""" path_to_file = self.__file_class__(os.path.join(self, filename)) path_to_file.touch() return path_to_file
python
def touch_file(self, filename): """Touch a file in the directory""" path_to_file = self.__file_class__(os.path.join(self, filename)) path_to_file.touch() return path_to_file
[ "def", "touch_file", "(", "self", ",", "filename", ")", ":", "path_to_file", "=", "self", ".", "__file_class__", "(", "os", ".", "path", ".", "join", "(", "self", ",", "filename", ")", ")", "path_to_file", ".", "touch", "(", ")", "return", "path_to_file"...
Touch a file in the directory
[ "Touch", "a", "file", "in", "the", "directory" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L560-L564
241,052
jalanb/pysyte
pysyte/paths.py
DirectPath.existing_sub_paths
def existing_sub_paths(self, sub_paths): """Those in the given list of sub_paths which do exist""" paths_to_subs = [self / _ for _ in sub_paths] return [_ for _ in paths_to_subs if _.exists()]
python
def existing_sub_paths(self, sub_paths): """Those in the given list of sub_paths which do exist""" paths_to_subs = [self / _ for _ in sub_paths] return [_ for _ in paths_to_subs if _.exists()]
[ "def", "existing_sub_paths", "(", "self", ",", "sub_paths", ")", ":", "paths_to_subs", "=", "[", "self", "/", "_", "for", "_", "in", "sub_paths", "]", "return", "[", "_", "for", "_", "in", "paths_to_subs", "if", "_", ".", "exists", "(", ")", "]" ]
Those in the given list of sub_paths which do exist
[ "Those", "in", "the", "given", "list", "of", "sub_paths", "which", "do", "exist" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L566-L569
241,053
frigg/frigg-worker
frigg_worker/deployments.py
Deployment.load_preset
def load_preset(self): """ Loads preset if it is specified in the .frigg.yml """ if 'preset' in self.settings.preview: with open(os.path.join(os.path.dirname(__file__), 'presets.yaml')) as f: presets = yaml.load(f.read()) if self.settings.preview[...
python
def load_preset(self): """ Loads preset if it is specified in the .frigg.yml """ if 'preset' in self.settings.preview: with open(os.path.join(os.path.dirname(__file__), 'presets.yaml')) as f: presets = yaml.load(f.read()) if self.settings.preview[...
[ "def", "load_preset", "(", "self", ")", ":", "if", "'preset'", "in", "self", ".", "settings", ".", "preview", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "'presets.yaml'...
Loads preset if it is specified in the .frigg.yml
[ "Loads", "preset", "if", "it", "is", "specified", "in", "the", ".", "frigg", ".", "yml" ]
8c215cd8f5a27ff9f5a4fedafe93d2ef0fbca86c
https://github.com/frigg/frigg-worker/blob/8c215cd8f5a27ff9f5a4fedafe93d2ef0fbca86c/frigg_worker/deployments.py#L86-L96
241,054
lukaszb/monolith
monolith/cli/base.py
ExecutionManager.call_command
def call_command(self, cmd, *argv): """ Runs a command. :param cmd: command to run (key at the registry) :param argv: arguments that would be passed to the command """ parser = self.get_parser() args = [cmd] + list(argv) namespace = parser.parse_args(args...
python
def call_command(self, cmd, *argv): """ Runs a command. :param cmd: command to run (key at the registry) :param argv: arguments that would be passed to the command """ parser = self.get_parser() args = [cmd] + list(argv) namespace = parser.parse_args(args...
[ "def", "call_command", "(", "self", ",", "cmd", ",", "*", "argv", ")", ":", "parser", "=", "self", ".", "get_parser", "(", ")", "args", "=", "[", "cmd", "]", "+", "list", "(", "argv", ")", "namespace", "=", "parser", ".", "parse_args", "(", "args",...
Runs a command. :param cmd: command to run (key at the registry) :param argv: arguments that would be passed to the command
[ "Runs", "a", "command", "." ]
cd8ab0483829ed4be6439c4f787ea59d48ad35b8
https://github.com/lukaszb/monolith/blob/cd8ab0483829ed4be6439c4f787ea59d48ad35b8/monolith/cli/base.py#L125-L135
241,055
lukaszb/monolith
monolith/cli/base.py
ExecutionManager.execute
def execute(self, argv=None): """ Executes command based on given arguments. """ if self.completion: self.autocomplete() parser = self.get_parser() namespace = parser.parse_args(argv) if hasattr(namespace, 'func'): self.run_command(namespac...
python
def execute(self, argv=None): """ Executes command based on given arguments. """ if self.completion: self.autocomplete() parser = self.get_parser() namespace = parser.parse_args(argv) if hasattr(namespace, 'func'): self.run_command(namespac...
[ "def", "execute", "(", "self", ",", "argv", "=", "None", ")", ":", "if", "self", ".", "completion", ":", "self", ".", "autocomplete", "(", ")", "parser", "=", "self", ".", "get_parser", "(", ")", "namespace", "=", "parser", ".", "parse_args", "(", "a...
Executes command based on given arguments.
[ "Executes", "command", "based", "on", "given", "arguments", "." ]
cd8ab0483829ed4be6439c4f787ea59d48ad35b8
https://github.com/lukaszb/monolith/blob/cd8ab0483829ed4be6439c4f787ea59d48ad35b8/monolith/cli/base.py#L137-L146
241,056
lukaszb/monolith
monolith/cli/base.py
SimpleExecutionManager.get_commands_to_register
def get_commands_to_register(self): """ Returns dictionary with commands given during construction. If value is a string, it would be converted into proper class pointer. """ return dict((key, get_class(value)) for key, value in self.simple_commands.items())
python
def get_commands_to_register(self): """ Returns dictionary with commands given during construction. If value is a string, it would be converted into proper class pointer. """ return dict((key, get_class(value)) for key, value in self.simple_commands.items())
[ "def", "get_commands_to_register", "(", "self", ")", ":", "return", "dict", "(", "(", "key", ",", "get_class", "(", "value", ")", ")", "for", "key", ",", "value", "in", "self", ".", "simple_commands", ".", "items", "(", ")", ")" ]
Returns dictionary with commands given during construction. If value is a string, it would be converted into proper class pointer.
[ "Returns", "dictionary", "with", "commands", "given", "during", "construction", ".", "If", "value", "is", "a", "string", "it", "would", "be", "converted", "into", "proper", "class", "pointer", "." ]
cd8ab0483829ed4be6439c4f787ea59d48ad35b8
https://github.com/lukaszb/monolith/blob/cd8ab0483829ed4be6439c4f787ea59d48ad35b8/monolith/cli/base.py#L195-L201
241,057
datakortet/dkfileutils
dkfileutils/which.py
get_path_directories
def get_path_directories(): """Return a list of all the directories on the path. """ pth = os.environ['PATH'] if sys.platform == 'win32' and os.environ.get("BASH"): # winbash has a bug.. if pth[1] == ';': # pragma: nocover pth = pth.replace(';', ':', 1) return [p.strip()...
python
def get_path_directories(): """Return a list of all the directories on the path. """ pth = os.environ['PATH'] if sys.platform == 'win32' and os.environ.get("BASH"): # winbash has a bug.. if pth[1] == ';': # pragma: nocover pth = pth.replace(';', ':', 1) return [p.strip()...
[ "def", "get_path_directories", "(", ")", ":", "pth", "=", "os", ".", "environ", "[", "'PATH'", "]", "if", "sys", ".", "platform", "==", "'win32'", "and", "os", ".", "environ", ".", "get", "(", "\"BASH\"", ")", ":", "# winbash has a bug..", "if", "pth", ...
Return a list of all the directories on the path.
[ "Return", "a", "list", "of", "all", "the", "directories", "on", "the", "path", "." ]
924098d6e2edf88ad9b3ffdec9c74530f80a7d77
https://github.com/datakortet/dkfileutils/blob/924098d6e2edf88ad9b3ffdec9c74530f80a7d77/dkfileutils/which.py#L18-L26
241,058
datakortet/dkfileutils
dkfileutils/which.py
_listdir
def _listdir(pth, extensions): """Non-raising listdir.""" try: return [fname for fname in os.listdir(pth) if os.path.splitext(fname)[1] in extensions] except OSError: # pragma: nocover pass
python
def _listdir(pth, extensions): """Non-raising listdir.""" try: return [fname for fname in os.listdir(pth) if os.path.splitext(fname)[1] in extensions] except OSError: # pragma: nocover pass
[ "def", "_listdir", "(", "pth", ",", "extensions", ")", ":", "try", ":", "return", "[", "fname", "for", "fname", "in", "os", ".", "listdir", "(", "pth", ")", "if", "os", ".", "path", ".", "splitext", "(", "fname", ")", "[", "1", "]", "in", "extens...
Non-raising listdir.
[ "Non", "-", "raising", "listdir", "." ]
924098d6e2edf88ad9b3ffdec9c74530f80a7d77
https://github.com/datakortet/dkfileutils/blob/924098d6e2edf88ad9b3ffdec9c74530f80a7d77/dkfileutils/which.py#L35-L41
241,059
datakortet/dkfileutils
dkfileutils/which.py
which
def which(filename, interactive=False, verbose=False): """Yield all executable files on path that matches `filename`. """ exe = [e.lower() for e in os.environ.get('PATHEXT', '').split(';')] if sys.platform != 'win32': # pragma: nocover exe.append('') name, ext = os.path.splitext(filename) ...
python
def which(filename, interactive=False, verbose=False): """Yield all executable files on path that matches `filename`. """ exe = [e.lower() for e in os.environ.get('PATHEXT', '').split(';')] if sys.platform != 'win32': # pragma: nocover exe.append('') name, ext = os.path.splitext(filename) ...
[ "def", "which", "(", "filename", ",", "interactive", "=", "False", ",", "verbose", "=", "False", ")", ":", "exe", "=", "[", "e", ".", "lower", "(", ")", "for", "e", "in", "os", ".", "environ", ".", "get", "(", "'PATHEXT'", ",", "''", ")", ".", ...
Yield all executable files on path that matches `filename`.
[ "Yield", "all", "executable", "files", "on", "path", "that", "matches", "filename", "." ]
924098d6e2edf88ad9b3ffdec9c74530f80a7d77
https://github.com/datakortet/dkfileutils/blob/924098d6e2edf88ad9b3ffdec9c74530f80a7d77/dkfileutils/which.py#L48-L93
241,060
a-tal/kezmenu3
kezmenu3/kezmenu_effects.py
KezMenuEffectAble.enableEffect
def enableEffect(self, name, **kwargs): """Enable an effect in the KezMenu.""" if name not in VALID_EFFECTS: raise KeyError("KezMenu doesn't know an effect of type %s" % name) self.__getattribute__( '_effectinit_{}'.format(name.replace("-", "_")) )(name, **kwargs)
python
def enableEffect(self, name, **kwargs): """Enable an effect in the KezMenu.""" if name not in VALID_EFFECTS: raise KeyError("KezMenu doesn't know an effect of type %s" % name) self.__getattribute__( '_effectinit_{}'.format(name.replace("-", "_")) )(name, **kwargs)
[ "def", "enableEffect", "(", "self", ",", "name", ",", "*", "*", "kwargs", ")", ":", "if", "name", "not", "in", "VALID_EFFECTS", ":", "raise", "KeyError", "(", "\"KezMenu doesn't know an effect of type %s\"", "%", "name", ")", "self", ".", "__getattribute__", "...
Enable an effect in the KezMenu.
[ "Enable", "an", "effect", "in", "the", "KezMenu", "." ]
3b06f9cb67fdc98a73928f877eea86692f832fa4
https://github.com/a-tal/kezmenu3/blob/3b06f9cb67fdc98a73928f877eea86692f832fa4/kezmenu3/kezmenu_effects.py#L20-L26
241,061
a-tal/kezmenu3
kezmenu3/kezmenu_effects.py
KezMenuEffectAble.disableEffect
def disableEffect(self, name): """Disable an effect.""" try: del self._effects[name] self.__getattribute__( '_effectdisable_%s' % name.replace("-", "_") )() except KeyError: pass except AttributeError: pass
python
def disableEffect(self, name): """Disable an effect.""" try: del self._effects[name] self.__getattribute__( '_effectdisable_%s' % name.replace("-", "_") )() except KeyError: pass except AttributeError: pass
[ "def", "disableEffect", "(", "self", ",", "name", ")", ":", "try", ":", "del", "self", ".", "_effects", "[", "name", "]", "self", ".", "__getattribute__", "(", "'_effectdisable_%s'", "%", "name", ".", "replace", "(", "\"-\"", ",", "\"_\"", ")", ")", "(...
Disable an effect.
[ "Disable", "an", "effect", "." ]
3b06f9cb67fdc98a73928f877eea86692f832fa4
https://github.com/a-tal/kezmenu3/blob/3b06f9cb67fdc98a73928f877eea86692f832fa4/kezmenu3/kezmenu_effects.py#L28-L38
241,062
a-tal/kezmenu3
kezmenu3/kezmenu_effects.py
KezMenuEffectAble._updateEffects
def _updateEffects(self, time_passed): """Update method for the effects handle""" for name in self._effects: update_func = getattr( self, '_effectupdate_{}'.format(name.replace("-", "_")), ) update_func(time_passed)
python
def _updateEffects(self, time_passed): """Update method for the effects handle""" for name in self._effects: update_func = getattr( self, '_effectupdate_{}'.format(name.replace("-", "_")), ) update_func(time_passed)
[ "def", "_updateEffects", "(", "self", ",", "time_passed", ")", ":", "for", "name", "in", "self", ".", "_effects", ":", "update_func", "=", "getattr", "(", "self", ",", "'_effectupdate_{}'", ".", "format", "(", "name", ".", "replace", "(", "\"-\"", ",", "...
Update method for the effects handle
[ "Update", "method", "for", "the", "effects", "handle" ]
3b06f9cb67fdc98a73928f877eea86692f832fa4
https://github.com/a-tal/kezmenu3/blob/3b06f9cb67fdc98a73928f877eea86692f832fa4/kezmenu3/kezmenu_effects.py#L40-L48
241,063
a-tal/kezmenu3
kezmenu3/kezmenu_effects.py
KezMenuEffectAble._effectinit_enlarge_font_on_focus
def _effectinit_enlarge_font_on_focus(self, name, **kwargs): """Init the effect that enlarge the focused menu entry. Keyword arguments can contain enlarge_time and enlarge_factor. """ self._effects[name] = kwargs if "font" not in kwargs: raise TypeError( ...
python
def _effectinit_enlarge_font_on_focus(self, name, **kwargs): """Init the effect that enlarge the focused menu entry. Keyword arguments can contain enlarge_time and enlarge_factor. """ self._effects[name] = kwargs if "font" not in kwargs: raise TypeError( ...
[ "def", "_effectinit_enlarge_font_on_focus", "(", "self", ",", "name", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_effects", "[", "name", "]", "=", "kwargs", "if", "\"font\"", "not", "in", "kwargs", ":", "raise", "TypeError", "(", "\"enlarge_font_on_foc...
Init the effect that enlarge the focused menu entry. Keyword arguments can contain enlarge_time and enlarge_factor.
[ "Init", "the", "effect", "that", "enlarge", "the", "focused", "menu", "entry", ".", "Keyword", "arguments", "can", "contain", "enlarge_time", "and", "enlarge_factor", "." ]
3b06f9cb67fdc98a73928f877eea86692f832fa4
https://github.com/a-tal/kezmenu3/blob/3b06f9cb67fdc98a73928f877eea86692f832fa4/kezmenu3/kezmenu_effects.py#L50-L75
241,064
a-tal/kezmenu3
kezmenu3/kezmenu_effects.py
KezMenuEffectAble._effectupdate_enlarge_font_on_focus
def _effectupdate_enlarge_font_on_focus(self, time_passed): """Gradually enlarge the font size of the focused line.""" data = self._effects['enlarge-font-on-focus'] fps = data['raise_font_ps'] final_size = data['size'] * data['enlarge_factor'] for i, option in enumerate(self.opt...
python
def _effectupdate_enlarge_font_on_focus(self, time_passed): """Gradually enlarge the font size of the focused line.""" data = self._effects['enlarge-font-on-focus'] fps = data['raise_font_ps'] final_size = data['size'] * data['enlarge_factor'] for i, option in enumerate(self.opt...
[ "def", "_effectupdate_enlarge_font_on_focus", "(", "self", ",", "time_passed", ")", ":", "data", "=", "self", ".", "_effects", "[", "'enlarge-font-on-focus'", "]", "fps", "=", "data", "[", "'raise_font_ps'", "]", "final_size", "=", "data", "[", "'size'", "]", ...
Gradually enlarge the font size of the focused line.
[ "Gradually", "enlarge", "the", "font", "size", "of", "the", "focused", "line", "." ]
3b06f9cb67fdc98a73928f877eea86692f832fa4
https://github.com/a-tal/kezmenu3/blob/3b06f9cb67fdc98a73928f877eea86692f832fa4/kezmenu3/kezmenu_effects.py#L77-L100
241,065
a-tal/kezmenu3
kezmenu3/kezmenu_effects.py
KezMenuEffectAble._effectinit_raise_line_padding_on_focus
def _effectinit_raise_line_padding_on_focus(self, name, **kwargs): """Init the effect for the empty space around the focused entry. Keyword arguments can contain enlarge_time and padding. """ self._effects[name] = kwargs if "enlarge_time" not in kwargs: kwargs['enlar...
python
def _effectinit_raise_line_padding_on_focus(self, name, **kwargs): """Init the effect for the empty space around the focused entry. Keyword arguments can contain enlarge_time and padding. """ self._effects[name] = kwargs if "enlarge_time" not in kwargs: kwargs['enlar...
[ "def", "_effectinit_raise_line_padding_on_focus", "(", "self", ",", "name", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_effects", "[", "name", "]", "=", "kwargs", "if", "\"enlarge_time\"", "not", "in", "kwargs", ":", "kwargs", "[", "'enlarge_time'", "]...
Init the effect for the empty space around the focused entry. Keyword arguments can contain enlarge_time and padding.
[ "Init", "the", "effect", "for", "the", "empty", "space", "around", "the", "focused", "entry", ".", "Keyword", "arguments", "can", "contain", "enlarge_time", "and", "padding", "." ]
3b06f9cb67fdc98a73928f877eea86692f832fa4
https://github.com/a-tal/kezmenu3/blob/3b06f9cb67fdc98a73928f877eea86692f832fa4/kezmenu3/kezmenu_effects.py#L107-L120
241,066
a-tal/kezmenu3
kezmenu3/kezmenu_effects.py
KezMenuEffectAble._effectupdate_raise_line_padding_on_focus
def _effectupdate_raise_line_padding_on_focus(self, time_passed): """Gradually enlarge the padding of the focused line.""" data = self._effects['raise-line-padding-on-focus'] pps = data['padding_pps'] for i, option in enumerate(self.options): if i == self.option: ...
python
def _effectupdate_raise_line_padding_on_focus(self, time_passed): """Gradually enlarge the padding of the focused line.""" data = self._effects['raise-line-padding-on-focus'] pps = data['padding_pps'] for i, option in enumerate(self.options): if i == self.option: ...
[ "def", "_effectupdate_raise_line_padding_on_focus", "(", "self", ",", "time_passed", ")", ":", "data", "=", "self", ".", "_effects", "[", "'raise-line-padding-on-focus'", "]", "pps", "=", "data", "[", "'padding_pps'", "]", "for", "i", ",", "option", "in", "enume...
Gradually enlarge the padding of the focused line.
[ "Gradually", "enlarge", "the", "padding", "of", "the", "focused", "line", "." ]
3b06f9cb67fdc98a73928f877eea86692f832fa4
https://github.com/a-tal/kezmenu3/blob/3b06f9cb67fdc98a73928f877eea86692f832fa4/kezmenu3/kezmenu_effects.py#L122-L138
241,067
a-tal/kezmenu3
kezmenu3/kezmenu_effects.py
KezMenuEffectAble._effectinit_raise_col_padding_on_focus
def _effectinit_raise_col_padding_on_focus(self, name, **kwargs): """Init the column padding on focus effect. Keyword arguments can contain enlarge_time and padding. """ self._effects[name] = kwargs if "enlarge_time" not in kwargs: kwargs['enlarge_time'] = 0.5 ...
python
def _effectinit_raise_col_padding_on_focus(self, name, **kwargs): """Init the column padding on focus effect. Keyword arguments can contain enlarge_time and padding. """ self._effects[name] = kwargs if "enlarge_time" not in kwargs: kwargs['enlarge_time'] = 0.5 ...
[ "def", "_effectinit_raise_col_padding_on_focus", "(", "self", ",", "name", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_effects", "[", "name", "]", "=", "kwargs", "if", "\"enlarge_time\"", "not", "in", "kwargs", ":", "kwargs", "[", "'enlarge_time'", "]"...
Init the column padding on focus effect. Keyword arguments can contain enlarge_time and padding.
[ "Init", "the", "column", "padding", "on", "focus", "effect", ".", "Keyword", "arguments", "can", "contain", "enlarge_time", "and", "padding", "." ]
3b06f9cb67fdc98a73928f877eea86692f832fa4
https://github.com/a-tal/kezmenu3/blob/3b06f9cb67fdc98a73928f877eea86692f832fa4/kezmenu3/kezmenu_effects.py#L146-L159
241,068
crcresearch/py-utils
crc_nd/utils/django.py
make_choices_tuple
def make_choices_tuple(choices, get_display_name): """ Make a tuple for the choices parameter for a data model field. :param choices: sequence of valid values for the model field :param get_display_name: callable that returns the human-readable name for a choice :return: A tuple of 2-tuples (choic...
python
def make_choices_tuple(choices, get_display_name): """ Make a tuple for the choices parameter for a data model field. :param choices: sequence of valid values for the model field :param get_display_name: callable that returns the human-readable name for a choice :return: A tuple of 2-tuples (choic...
[ "def", "make_choices_tuple", "(", "choices", ",", "get_display_name", ")", ":", "assert", "callable", "(", "get_display_name", ")", "return", "tuple", "(", "(", "x", ",", "get_display_name", "(", "x", ")", ")", "for", "x", "in", "choices", ")" ]
Make a tuple for the choices parameter for a data model field. :param choices: sequence of valid values for the model field :param get_display_name: callable that returns the human-readable name for a choice :return: A tuple of 2-tuples (choice, display_name) suitable for the choices parameter
[ "Make", "a", "tuple", "for", "the", "choices", "parameter", "for", "a", "data", "model", "field", "." ]
04caf0425a047baf900da726cf47c42413b0dd81
https://github.com/crcresearch/py-utils/blob/04caf0425a047baf900da726cf47c42413b0dd81/crc_nd/utils/django.py#L16-L26
241,069
jaraco/jaraco.ui
jaraco/ui/editor.py
EditableFile.edit
def edit(self): """ Edit the file """ self.changed = False with self: editor = self.get_editor() cmd = [editor, self.name] try: res = subprocess.call(cmd) except Exception as e: print("Error launching editor %(editor)s" % locals()) print(e) return if res != 0: msg = '%(edito...
python
def edit(self): """ Edit the file """ self.changed = False with self: editor = self.get_editor() cmd = [editor, self.name] try: res = subprocess.call(cmd) except Exception as e: print("Error launching editor %(editor)s" % locals()) print(e) return if res != 0: msg = '%(edito...
[ "def", "edit", "(", "self", ")", ":", "self", ".", "changed", "=", "False", "with", "self", ":", "editor", "=", "self", ".", "get_editor", "(", ")", "cmd", "=", "[", "editor", ",", "self", ".", "name", "]", "try", ":", "res", "=", "subprocess", "...
Edit the file
[ "Edit", "the", "file" ]
10e844c03f3afb3d37bd5d727ba9334af2547fcf
https://github.com/jaraco/jaraco.ui/blob/10e844c03f3afb3d37bd5d727ba9334af2547fcf/jaraco/ui/editor.py#L63-L83
241,070
jaraco/jaraco.ui
jaraco/ui/editor.py
EditableFile._search_env
def _search_env(keys): """ Search the environment for the supplied keys, returning the first one found or None if none was found. """ matches = (os.environ[key] for key in keys if key in os.environ) return next(matches, None)
python
def _search_env(keys): """ Search the environment for the supplied keys, returning the first one found or None if none was found. """ matches = (os.environ[key] for key in keys if key in os.environ) return next(matches, None)
[ "def", "_search_env", "(", "keys", ")", ":", "matches", "=", "(", "os", ".", "environ", "[", "key", "]", "for", "key", "in", "keys", "if", "key", "in", "os", ".", "environ", ")", "return", "next", "(", "matches", ",", "None", ")" ]
Search the environment for the supplied keys, returning the first one found or None if none was found.
[ "Search", "the", "environment", "for", "the", "supplied", "keys", "returning", "the", "first", "one", "found", "or", "None", "if", "none", "was", "found", "." ]
10e844c03f3afb3d37bd5d727ba9334af2547fcf
https://github.com/jaraco/jaraco.ui/blob/10e844c03f3afb3d37bd5d727ba9334af2547fcf/jaraco/ui/editor.py#L86-L92
241,071
jaraco/jaraco.ui
jaraco/ui/editor.py
EditableFile.get_editor
def get_editor(self): """ Give preference to an XML_EDITOR or EDITOR defined in the environment. Otherwise use a default editor based on platform. """ env_search = ['EDITOR'] if 'xml' in self.content_type: env_search.insert(0, 'XML_EDITOR') default_editor = self.platform_default_editors[sys.platform] ...
python
def get_editor(self): """ Give preference to an XML_EDITOR or EDITOR defined in the environment. Otherwise use a default editor based on platform. """ env_search = ['EDITOR'] if 'xml' in self.content_type: env_search.insert(0, 'XML_EDITOR') default_editor = self.platform_default_editors[sys.platform] ...
[ "def", "get_editor", "(", "self", ")", ":", "env_search", "=", "[", "'EDITOR'", "]", "if", "'xml'", "in", "self", ".", "content_type", ":", "env_search", ".", "insert", "(", "0", ",", "'XML_EDITOR'", ")", "default_editor", "=", "self", ".", "platform_defau...
Give preference to an XML_EDITOR or EDITOR defined in the environment. Otherwise use a default editor based on platform.
[ "Give", "preference", "to", "an", "XML_EDITOR", "or", "EDITOR", "defined", "in", "the", "environment", ".", "Otherwise", "use", "a", "default", "editor", "based", "on", "platform", "." ]
10e844c03f3afb3d37bd5d727ba9334af2547fcf
https://github.com/jaraco/jaraco.ui/blob/10e844c03f3afb3d37bd5d727ba9334af2547fcf/jaraco/ui/editor.py#L94-L103
241,072
sbuss/pypercube
pypercube/event.py
Event.from_json
def from_json(cls, json_obj): """Build an Event from JSON. :param json_obj: JSON data representing a Cube Event :type json_obj: `String` or `json` :throws: `InvalidEventError` when any of time field is not present in json_obj. """ if isinstance(json_obj, str): ...
python
def from_json(cls, json_obj): """Build an Event from JSON. :param json_obj: JSON data representing a Cube Event :type json_obj: `String` or `json` :throws: `InvalidEventError` when any of time field is not present in json_obj. """ if isinstance(json_obj, str): ...
[ "def", "from_json", "(", "cls", ",", "json_obj", ")", ":", "if", "isinstance", "(", "json_obj", ",", "str", ")", ":", "json_obj", "=", "json", ".", "loads", "(", "json_obj", ")", "type", "=", "None", "time", "=", "None", "data", "=", "None", "if", ...
Build an Event from JSON. :param json_obj: JSON data representing a Cube Event :type json_obj: `String` or `json` :throws: `InvalidEventError` when any of time field is not present in json_obj.
[ "Build", "an", "Event", "from", "JSON", "." ]
e9d2cca9c004b8bad6d1e0b68b080f887a186a22
https://github.com/sbuss/pypercube/blob/e9d2cca9c004b8bad6d1e0b68b080f887a186a22/pypercube/event.py#L31-L57
241,073
Perfectial/django-view-acl
view_acl/__init__.py
autodiscover
def autodiscover(): """Autodiscover for urls.py""" # Get permissions based on urlpatterns from urls.py url_conf = getattr(settings, 'ROOT_URLCONF', ()) resolver = urlresolvers.get_resolver(url_conf) urlpatterns = resolver.url_patterns permissions = generate_permissions(urlpatterns) # Refresh...
python
def autodiscover(): """Autodiscover for urls.py""" # Get permissions based on urlpatterns from urls.py url_conf = getattr(settings, 'ROOT_URLCONF', ()) resolver = urlresolvers.get_resolver(url_conf) urlpatterns = resolver.url_patterns permissions = generate_permissions(urlpatterns) # Refresh...
[ "def", "autodiscover", "(", ")", ":", "# Get permissions based on urlpatterns from urls.py", "url_conf", "=", "getattr", "(", "settings", ",", "'ROOT_URLCONF'", ",", "(", ")", ")", "resolver", "=", "urlresolvers", ".", "get_resolver", "(", "url_conf", ")", "urlpatte...
Autodiscover for urls.py
[ "Autodiscover", "for", "urls", ".", "py" ]
71f514f65761895bc64d5ca735997c5455c254fa
https://github.com/Perfectial/django-view-acl/blob/71f514f65761895bc64d5ca735997c5455c254fa/view_acl/__init__.py#L7-L15
241,074
Apitax/Apitax
apitax/api/controllers/drivers_controller.py
get_driver_blacklist
def get_driver_blacklist(driver): # noqa: E501 """Retrieve the blacklist in the driver Retrieve the blacklist in the driver # noqa: E501 :param driver: The driver to use for the request. ie. github :type driver: str :rtype: Response """ response = errorIfUnauthorized(role='admin') i...
python
def get_driver_blacklist(driver): # noqa: E501 """Retrieve the blacklist in the driver Retrieve the blacklist in the driver # noqa: E501 :param driver: The driver to use for the request. ie. github :type driver: str :rtype: Response """ response = errorIfUnauthorized(role='admin') i...
[ "def", "get_driver_blacklist", "(", "driver", ")", ":", "# noqa: E501", "response", "=", "errorIfUnauthorized", "(", "role", "=", "'admin'", ")", "if", "response", ":", "return", "response", "else", ":", "response", "=", "ApitaxResponse", "(", ")", "driver", "...
Retrieve the blacklist in the driver Retrieve the blacklist in the driver # noqa: E501 :param driver: The driver to use for the request. ie. github :type driver: str :rtype: Response
[ "Retrieve", "the", "blacklist", "in", "the", "driver" ]
3883e45f17e01eba4edac9d1bba42f0e7a748682
https://github.com/Apitax/Apitax/blob/3883e45f17e01eba4edac9d1bba42f0e7a748682/apitax/api/controllers/drivers_controller.py#L16-L36
241,075
Apitax/Apitax
apitax/api/controllers/drivers_controller.py
get_driver_config
def get_driver_config(driver): # noqa: E501 """Retrieve the config of a loaded driver Retrieve the config of a loaded driver # noqa: E501 :param driver: The driver to use for the request. ie. github :type driver: str :rtype: Response """ response = errorIfUnauthorized(role='admin') ...
python
def get_driver_config(driver): # noqa: E501 """Retrieve the config of a loaded driver Retrieve the config of a loaded driver # noqa: E501 :param driver: The driver to use for the request. ie. github :type driver: str :rtype: Response """ response = errorIfUnauthorized(role='admin') ...
[ "def", "get_driver_config", "(", "driver", ")", ":", "# noqa: E501", "response", "=", "errorIfUnauthorized", "(", "role", "=", "'admin'", ")", "if", "response", ":", "return", "response", "else", ":", "response", "=", "ApitaxResponse", "(", ")", "# TODO: This ne...
Retrieve the config of a loaded driver Retrieve the config of a loaded driver # noqa: E501 :param driver: The driver to use for the request. ie. github :type driver: str :rtype: Response
[ "Retrieve", "the", "config", "of", "a", "loaded", "driver" ]
3883e45f17e01eba4edac9d1bba42f0e7a748682
https://github.com/Apitax/Apitax/blob/3883e45f17e01eba4edac9d1bba42f0e7a748682/apitax/api/controllers/drivers_controller.py#L39-L58
241,076
Apitax/Apitax
apitax/api/controllers/drivers_controller.py
get_driver_list
def get_driver_list(): # noqa: E501 """Retrieve the catalog of drivers Retrieve the catalog of drivers # noqa: E501 :rtype: Response """ response = errorIfUnauthorized(role='admin') if response: return response else: response = ApitaxResponse() response.body.add({'d...
python
def get_driver_list(): # noqa: E501 """Retrieve the catalog of drivers Retrieve the catalog of drivers # noqa: E501 :rtype: Response """ response = errorIfUnauthorized(role='admin') if response: return response else: response = ApitaxResponse() response.body.add({'d...
[ "def", "get_driver_list", "(", ")", ":", "# noqa: E501", "response", "=", "errorIfUnauthorized", "(", "role", "=", "'admin'", ")", "if", "response", ":", "return", "response", "else", ":", "response", "=", "ApitaxResponse", "(", ")", "response", ".", "body", ...
Retrieve the catalog of drivers Retrieve the catalog of drivers # noqa: E501 :rtype: Response
[ "Retrieve", "the", "catalog", "of", "drivers" ]
3883e45f17e01eba4edac9d1bba42f0e7a748682
https://github.com/Apitax/Apitax/blob/3883e45f17e01eba4edac9d1bba42f0e7a748682/apitax/api/controllers/drivers_controller.py#L61-L78
241,077
Apitax/Apitax
apitax/api/controllers/drivers_controller.py
get_driver_whitelist
def get_driver_whitelist(driver): # noqa: E501 """Retrieve the whitelist in the driver Retrieve the whitelist in the driver # noqa: E501 :param driver: The driver to use for the request. ie. github :type driver: str :rtype: Response """ response = errorIfUnauthorized(role='admin') i...
python
def get_driver_whitelist(driver): # noqa: E501 """Retrieve the whitelist in the driver Retrieve the whitelist in the driver # noqa: E501 :param driver: The driver to use for the request. ie. github :type driver: str :rtype: Response """ response = errorIfUnauthorized(role='admin') i...
[ "def", "get_driver_whitelist", "(", "driver", ")", ":", "# noqa: E501", "response", "=", "errorIfUnauthorized", "(", "role", "=", "'admin'", ")", "if", "response", ":", "return", "response", "else", ":", "response", "=", "ApitaxResponse", "(", ")", "driver", "...
Retrieve the whitelist in the driver Retrieve the whitelist in the driver # noqa: E501 :param driver: The driver to use for the request. ie. github :type driver: str :rtype: Response
[ "Retrieve", "the", "whitelist", "in", "the", "driver" ]
3883e45f17e01eba4edac9d1bba42f0e7a748682
https://github.com/Apitax/Apitax/blob/3883e45f17e01eba4edac9d1bba42f0e7a748682/apitax/api/controllers/drivers_controller.py#L116-L136
241,078
bitlabstudio/django-tagging-translated
tagging_translated/models.py
tag_post_save_handler
def tag_post_save_handler(sender, **kwargs): """ Makes sure that a translation is created when a tag is saved. Also ensures that the original tag name gets updated when the english translation is updated. TODO: This will create two tags when a tag is saved through the admin """ instance =...
python
def tag_post_save_handler(sender, **kwargs): """ Makes sure that a translation is created when a tag is saved. Also ensures that the original tag name gets updated when the english translation is updated. TODO: This will create two tags when a tag is saved through the admin """ instance =...
[ "def", "tag_post_save_handler", "(", "sender", ",", "*", "*", "kwargs", ")", ":", "instance", "=", "kwargs", ".", "get", "(", "'instance'", ")", "try", ":", "translation", "=", "instance", ".", "tagtitle_set", ".", "get", "(", "language", "=", "'en'", ")...
Makes sure that a translation is created when a tag is saved. Also ensures that the original tag name gets updated when the english translation is updated. TODO: This will create two tags when a tag is saved through the admin
[ "Makes", "sure", "that", "a", "translation", "is", "created", "when", "a", "tag", "is", "saved", "." ]
8766d88077959efb07a97a116538e53b800b6019
https://github.com/bitlabstudio/django-tagging-translated/blob/8766d88077959efb07a97a116538e53b800b6019/tagging_translated/models.py#L23-L41
241,079
tmr232/rage
rage/rage.py
require_editable
def require_editable(f): """ Makes sure the registry key is editable before trying to edit it. """ def wrapper(self, *args, **kwargs): if not self._edit: raise RegistryKeyNotEditable("The key is not set as editable.") return f(self, *args, **kwargs) return wrapper
python
def require_editable(f): """ Makes sure the registry key is editable before trying to edit it. """ def wrapper(self, *args, **kwargs): if not self._edit: raise RegistryKeyNotEditable("The key is not set as editable.") return f(self, *args, **kwargs) return wrapper
[ "def", "require_editable", "(", "f", ")", ":", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "_edit", ":", "raise", "RegistryKeyNotEditable", "(", "\"The key is not set as editable.\"", ")", "...
Makes sure the registry key is editable before trying to edit it.
[ "Makes", "sure", "the", "registry", "key", "is", "editable", "before", "trying", "to", "edit", "it", "." ]
0973a43a6956e8bacd14245509b26608f6649edb
https://github.com/tmr232/rage/blob/0973a43a6956e8bacd14245509b26608f6649edb/rage/rage.py#L31-L41
241,080
Synerty/pytmpdir
pytmpdir/Directory.py
Directory.createHiddenFolder
def createHiddenFolder(self) -> 'File': """ Create Hidden Folder Create a hidden folder. Raise exception if auto delete isn't True. @return: Created folder. """ if not self._autoDelete: raise Exception("Hidden folders can only be created within" ...
python
def createHiddenFolder(self) -> 'File': """ Create Hidden Folder Create a hidden folder. Raise exception if auto delete isn't True. @return: Created folder. """ if not self._autoDelete: raise Exception("Hidden folders can only be created within" ...
[ "def", "createHiddenFolder", "(", "self", ")", "->", "'File'", ":", "if", "not", "self", ".", "_autoDelete", ":", "raise", "Exception", "(", "\"Hidden folders can only be created within\"", "\" an autoDelete directory\"", ")", "return", "tempfile", ".", "mkdtemp", "("...
Create Hidden Folder Create a hidden folder. Raise exception if auto delete isn't True. @return: Created folder.
[ "Create", "Hidden", "Folder" ]
8f21d7a0b28d4f5c3a0ed91f9660ac5310773605
https://github.com/Synerty/pytmpdir/blob/8f21d7a0b28d4f5c3a0ed91f9660ac5310773605/pytmpdir/Directory.py#L220-L231
241,081
Synerty/pytmpdir
pytmpdir/Directory.py
Directory._listFilesWin
def _listFilesWin(self) -> ['File']: """ List Files for Windows OS Search and list the files and folder in the current directory for the Windows file system. @return: List of directory files and folders. """ output = [] for dirname, dirnames, filenames in os.wa...
python
def _listFilesWin(self) -> ['File']: """ List Files for Windows OS Search and list the files and folder in the current directory for the Windows file system. @return: List of directory files and folders. """ output = [] for dirname, dirnames, filenames in os.wa...
[ "def", "_listFilesWin", "(", "self", ")", "->", "[", "'File'", "]", ":", "output", "=", "[", "]", "for", "dirname", ",", "dirnames", ",", "filenames", "in", "os", ".", "walk", "(", "self", ".", "_path", ")", ":", "for", "subdirname", "in", "dirnames"...
List Files for Windows OS Search and list the files and folder in the current directory for the Windows file system. @return: List of directory files and folders.
[ "List", "Files", "for", "Windows", "OS" ]
8f21d7a0b28d4f5c3a0ed91f9660ac5310773605
https://github.com/Synerty/pytmpdir/blob/8f21d7a0b28d4f5c3a0ed91f9660ac5310773605/pytmpdir/Directory.py#L233-L248
241,082
Synerty/pytmpdir
pytmpdir/Directory.py
Directory._listFilesPosix
def _listFilesPosix(self) -> ['File']: """ List Files for POSIX Search and list the files and folder in the current directory for the POSIX file system. @return: List of directory files and folders. """ find = "find %s -type f" % self._path output = check_outpu...
python
def _listFilesPosix(self) -> ['File']: """ List Files for POSIX Search and list the files and folder in the current directory for the POSIX file system. @return: List of directory files and folders. """ find = "find %s -type f" % self._path output = check_outpu...
[ "def", "_listFilesPosix", "(", "self", ")", "->", "[", "'File'", "]", ":", "find", "=", "\"find %s -type f\"", "%", "self", ".", "_path", "output", "=", "check_output", "(", "args", "=", "find", ".", "split", "(", ")", ")", ".", "strip", "(", ")", "....
List Files for POSIX Search and list the files and folder in the current directory for the POSIX file system. @return: List of directory files and folders.
[ "List", "Files", "for", "POSIX" ]
8f21d7a0b28d4f5c3a0ed91f9660ac5310773605
https://github.com/Synerty/pytmpdir/blob/8f21d7a0b28d4f5c3a0ed91f9660ac5310773605/pytmpdir/Directory.py#L250-L262
241,083
Synerty/pytmpdir
pytmpdir/Directory.py
File.pathName
def pathName(self, pathName: str): """ Path Name Setter Set path name with passed in variable, create new directory and move previous directory contents to new path name. @param pathName: New path name string. @type pathName: String """ if self.pathName == path...
python
def pathName(self, pathName: str): """ Path Name Setter Set path name with passed in variable, create new directory and move previous directory contents to new path name. @param pathName: New path name string. @type pathName: String """ if self.pathName == path...
[ "def", "pathName", "(", "self", ",", "pathName", ":", "str", ")", ":", "if", "self", ".", "pathName", "==", "pathName", ":", "return", "pathName", "=", "self", ".", "sanitise", "(", "pathName", ")", "before", "=", "self", ".", "realPath", "after", "=",...
Path Name Setter Set path name with passed in variable, create new directory and move previous directory contents to new path name. @param pathName: New path name string. @type pathName: String
[ "Path", "Name", "Setter" ]
8f21d7a0b28d4f5c3a0ed91f9660ac5310773605
https://github.com/Synerty/pytmpdir/blob/8f21d7a0b28d4f5c3a0ed91f9660ac5310773605/pytmpdir/Directory.py#L519-L547
241,084
Synerty/pytmpdir
pytmpdir/Directory.py
File.namedTempFileReader
def namedTempFileReader(self) -> NamedTempFileReader: """ Named Temporary File Reader This provides an object compatible with NamedTemporaryFile, used for reading this files contents. This will still delete after the object falls out of scope. This solves the problem on windows where a...
python
def namedTempFileReader(self) -> NamedTempFileReader: """ Named Temporary File Reader This provides an object compatible with NamedTemporaryFile, used for reading this files contents. This will still delete after the object falls out of scope. This solves the problem on windows where a...
[ "def", "namedTempFileReader", "(", "self", ")", "->", "NamedTempFileReader", ":", "# Get the weak ref", "directory", "=", "self", ".", "_directory", "(", ")", "assert", "isinstance", "(", "directory", ",", "Directory", ")", ",", "(", "\"Expected Directory, receieved...
Named Temporary File Reader This provides an object compatible with NamedTemporaryFile, used for reading this files contents. This will still delete after the object falls out of scope. This solves the problem on windows where a NamedTemporaryFile can not be read while it's being writt...
[ "Named", "Temporary", "File", "Reader" ]
8f21d7a0b28d4f5c3a0ed91f9660ac5310773605
https://github.com/Synerty/pytmpdir/blob/8f21d7a0b28d4f5c3a0ed91f9660ac5310773605/pytmpdir/Directory.py#L574-L590
241,085
Synerty/pytmpdir
pytmpdir/Directory.py
File._realPath
def _realPath(self, newPathName: str = None) -> str: """ Private Real Path Get path name. @param newPathName: variable for new path name if passed argument. @type newPathName: String @return: Path Name as string. """ directory = self._directory() assert...
python
def _realPath(self, newPathName: str = None) -> str: """ Private Real Path Get path name. @param newPathName: variable for new path name if passed argument. @type newPathName: String @return: Path Name as string. """ directory = self._directory() assert...
[ "def", "_realPath", "(", "self", ",", "newPathName", ":", "str", "=", "None", ")", "->", "str", ":", "directory", "=", "self", ".", "_directory", "(", ")", "assert", "directory", "return", "os", ".", "path", ".", "join", "(", "directory", ".", "path", ...
Private Real Path Get path name. @param newPathName: variable for new path name if passed argument. @type newPathName: String @return: Path Name as string.
[ "Private", "Real", "Path" ]
8f21d7a0b28d4f5c3a0ed91f9660ac5310773605
https://github.com/Synerty/pytmpdir/blob/8f21d7a0b28d4f5c3a0ed91f9660ac5310773605/pytmpdir/Directory.py#L664-L677
241,086
JNRowe/jnrbase
setup.py
import_file
def import_file(package: str, fname: str) -> ModuleType: """Import file directly. This is a hack to import files from packages without importing <package>/__init__.py, its purpose is to allow import without requiring all the dependencies at this point. Args: package: Package to import from...
python
def import_file(package: str, fname: str) -> ModuleType: """Import file directly. This is a hack to import files from packages without importing <package>/__init__.py, its purpose is to allow import without requiring all the dependencies at this point. Args: package: Package to import from...
[ "def", "import_file", "(", "package", ":", "str", ",", "fname", ":", "str", ")", "->", "ModuleType", ":", "mod_name", "=", "fname", ".", "rstrip", "(", "'.py'", ")", "spec", "=", "spec_from_file_location", "(", "mod_name", ",", "'{}/{}'", ".", "format", ...
Import file directly. This is a hack to import files from packages without importing <package>/__init__.py, its purpose is to allow import without requiring all the dependencies at this point. Args: package: Package to import from fname: File to import Returns: Imported mod...
[ "Import", "file", "directly", "." ]
ae505ef69a9feb739b5f4e62c5a8e6533104d3ea
https://github.com/JNRowe/jnrbase/blob/ae505ef69a9feb739b5f4e62c5a8e6533104d3ea/setup.py#L42-L59
241,087
honzamach/pynspect
pynspect/lexer.py
PynspectFilterLexer.t_FLOAT
def t_FLOAT(tok): # pylint: disable=locally-disabled,invalid-name r'\d+\.\d+' tok.value = (tok.type, float(tok.value)) return tok
python
def t_FLOAT(tok): # pylint: disable=locally-disabled,invalid-name r'\d+\.\d+' tok.value = (tok.type, float(tok.value)) return tok
[ "def", "t_FLOAT", "(", "tok", ")", ":", "# pylint: disable=locally-disabled,invalid-name", "tok", ".", "value", "=", "(", "tok", ".", "type", ",", "float", "(", "tok", ".", "value", ")", ")", "return", "tok" ]
r'\d+\.\d+
[ "r", "\\", "d", "+", "\\", ".", "\\", "d", "+" ]
0582dcc1f7aafe50e25a21c792ea1b3367ea5881
https://github.com/honzamach/pynspect/blob/0582dcc1f7aafe50e25a21c792ea1b3367ea5881/pynspect/lexer.py#L292-L295
241,088
armenzg/buildapi_client
buildapi_client/buildapi_client.py
trigger_arbitrary_job
def trigger_arbitrary_job(repo_name, builder, revision, auth, files=None, dry_run=False, extra_properties=None): """ Request buildapi to trigger a job for us. We return the request or None if dry_run is True. Raises BuildapiAuthError if credentials are invalid. """ as...
python
def trigger_arbitrary_job(repo_name, builder, revision, auth, files=None, dry_run=False, extra_properties=None): """ Request buildapi to trigger a job for us. We return the request or None if dry_run is True. Raises BuildapiAuthError if credentials are invalid. """ as...
[ "def", "trigger_arbitrary_job", "(", "repo_name", ",", "builder", ",", "revision", ",", "auth", ",", "files", "=", "None", ",", "dry_run", "=", "False", ",", "extra_properties", "=", "None", ")", ":", "assert", "len", "(", "revision", ")", "==", "40", ",...
Request buildapi to trigger a job for us. We return the request or None if dry_run is True. Raises BuildapiAuthError if credentials are invalid.
[ "Request", "buildapi", "to", "trigger", "a", "job", "for", "us", "." ]
59af70ad54bf65e09e5eb02241c61b326153b761
https://github.com/armenzg/buildapi_client/blob/59af70ad54bf65e09e5eb02241c61b326153b761/buildapi_client/buildapi_client.py#L35-L75
241,089
armenzg/buildapi_client
buildapi_client/buildapi_client.py
make_retrigger_request
def make_retrigger_request(repo_name, request_id, auth, count=DEFAULT_COUNT_NUM, priority=DEFAULT_PRIORITY, dry_run=True): """ Retrigger a request using buildapi self-serve. Returns a request. Buildapi documentation: POST /self-serve/{branch}/request Rebuild `request_id`...
python
def make_retrigger_request(repo_name, request_id, auth, count=DEFAULT_COUNT_NUM, priority=DEFAULT_PRIORITY, dry_run=True): """ Retrigger a request using buildapi self-serve. Returns a request. Buildapi documentation: POST /self-serve/{branch}/request Rebuild `request_id`...
[ "def", "make_retrigger_request", "(", "repo_name", ",", "request_id", ",", "auth", ",", "count", "=", "DEFAULT_COUNT_NUM", ",", "priority", "=", "DEFAULT_PRIORITY", ",", "dry_run", "=", "True", ")", ":", "url", "=", "'{}/{}/request'", ".", "format", "(", "SELF...
Retrigger a request using buildapi self-serve. Returns a request. Buildapi documentation: POST /self-serve/{branch}/request Rebuild `request_id`, which must be passed in as a POST parameter. `priority` and `count` are also accepted as optional parameters. `count` defaults to 1, and represents the ...
[ "Retrigger", "a", "request", "using", "buildapi", "self", "-", "serve", ".", "Returns", "a", "request", "." ]
59af70ad54bf65e09e5eb02241c61b326153b761
https://github.com/armenzg/buildapi_client/blob/59af70ad54bf65e09e5eb02241c61b326153b761/buildapi_client/buildapi_client.py#L78-L111
241,090
armenzg/buildapi_client
buildapi_client/buildapi_client.py
make_cancel_request
def make_cancel_request(repo_name, request_id, auth, dry_run=True): """ Cancel a request using buildapi self-serve. Returns a request. Buildapi documentation: DELETE /self-serve/{branch}/request/{request_id} Cancel the given request """ url = '{}/{}/request/{}'.format(SELF_SERVE, repo_name, req...
python
def make_cancel_request(repo_name, request_id, auth, dry_run=True): """ Cancel a request using buildapi self-serve. Returns a request. Buildapi documentation: DELETE /self-serve/{branch}/request/{request_id} Cancel the given request """ url = '{}/{}/request/{}'.format(SELF_SERVE, repo_name, req...
[ "def", "make_cancel_request", "(", "repo_name", ",", "request_id", ",", "auth", ",", "dry_run", "=", "True", ")", ":", "url", "=", "'{}/{}/request/{}'", ".", "format", "(", "SELF_SERVE", ",", "repo_name", ",", "request_id", ")", "if", "dry_run", ":", "LOG", ...
Cancel a request using buildapi self-serve. Returns a request. Buildapi documentation: DELETE /self-serve/{branch}/request/{request_id} Cancel the given request
[ "Cancel", "a", "request", "using", "buildapi", "self", "-", "serve", ".", "Returns", "a", "request", "." ]
59af70ad54bf65e09e5eb02241c61b326153b761
https://github.com/armenzg/buildapi_client/blob/59af70ad54bf65e09e5eb02241c61b326153b761/buildapi_client/buildapi_client.py#L114-L131
241,091
armenzg/buildapi_client
buildapi_client/buildapi_client.py
query_jobs_schedule
def query_jobs_schedule(repo_name, revision, auth): """ Query Buildapi for jobs. """ url = "%s/%s/rev/%s?format=json" % (SELF_SERVE, repo_name, revision) LOG.debug("About to fetch %s" % url) req = requests.get(url, auth=auth, timeout=TCP_TIMEOUT) # If the revision doesn't exist on buildapi,...
python
def query_jobs_schedule(repo_name, revision, auth): """ Query Buildapi for jobs. """ url = "%s/%s/rev/%s?format=json" % (SELF_SERVE, repo_name, revision) LOG.debug("About to fetch %s" % url) req = requests.get(url, auth=auth, timeout=TCP_TIMEOUT) # If the revision doesn't exist on buildapi,...
[ "def", "query_jobs_schedule", "(", "repo_name", ",", "revision", ",", "auth", ")", ":", "url", "=", "\"%s/%s/rev/%s?format=json\"", "%", "(", "SELF_SERVE", ",", "repo_name", ",", "revision", ")", "LOG", ".", "debug", "(", "\"About to fetch %s\"", "%", "url", "...
Query Buildapi for jobs.
[ "Query", "Buildapi", "for", "jobs", "." ]
59af70ad54bf65e09e5eb02241c61b326153b761
https://github.com/armenzg/buildapi_client/blob/59af70ad54bf65e09e5eb02241c61b326153b761/buildapi_client/buildapi_client.py#L220-L233
241,092
armenzg/buildapi_client
buildapi_client/buildapi_client.py
query_pending_jobs
def query_pending_jobs(auth, repo_name=None, return_raw=False): """Return pending jobs""" url = '%s/pending?format=json' % HOST_ROOT LOG.debug('About to fetch %s' % url) req = requests.get(url, auth=auth, timeout=TCP_TIMEOUT) # If the revision doesn't exist on buildapi, that means there are # n...
python
def query_pending_jobs(auth, repo_name=None, return_raw=False): """Return pending jobs""" url = '%s/pending?format=json' % HOST_ROOT LOG.debug('About to fetch %s' % url) req = requests.get(url, auth=auth, timeout=TCP_TIMEOUT) # If the revision doesn't exist on buildapi, that means there are # n...
[ "def", "query_pending_jobs", "(", "auth", ",", "repo_name", "=", "None", ",", "return_raw", "=", "False", ")", ":", "url", "=", "'%s/pending?format=json'", "%", "HOST_ROOT", "LOG", ".", "debug", "(", "'About to fetch %s'", "%", "url", ")", "req", "=", "reque...
Return pending jobs
[ "Return", "pending", "jobs" ]
59af70ad54bf65e09e5eb02241c61b326153b761
https://github.com/armenzg/buildapi_client/blob/59af70ad54bf65e09e5eb02241c61b326153b761/buildapi_client/buildapi_client.py#L241-L272
241,093
krukas/Trionyx
trionyx/layout.py
Component.set_object
def set_object(self, object): """ Set object for rendering component and set object to all components :param object: :return: """ if self.object is False: self.object = object # Pass object along to child components for rendering for componen...
python
def set_object(self, object): """ Set object for rendering component and set object to all components :param object: :return: """ if self.object is False: self.object = object # Pass object along to child components for rendering for componen...
[ "def", "set_object", "(", "self", ",", "object", ")", ":", "if", "self", ".", "object", "is", "False", ":", "self", ".", "object", "=", "object", "# Pass object along to child components for rendering", "for", "component", "in", "self", ".", "components", ":", ...
Set object for rendering component and set object to all components :param object: :return:
[ "Set", "object", "for", "rendering", "component", "and", "set", "object", "to", "all", "components" ]
edac132cc0797190153f2e60bc7e88cb50e80da6
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/layout.py#L118-L130
241,094
krukas/Trionyx
trionyx/layout.py
ComponentFieldsMixin.get_fields
def get_fields(self): """Get all fields""" if not hasattr(self, '__fields'): self.__fields = [ self.parse_field(field, index) for index, field in enumerate(getattr(self, 'fields', [])) ] return self.__fields
python
def get_fields(self): """Get all fields""" if not hasattr(self, '__fields'): self.__fields = [ self.parse_field(field, index) for index, field in enumerate(getattr(self, 'fields', [])) ] return self.__fields
[ "def", "get_fields", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'__fields'", ")", ":", "self", ".", "__fields", "=", "[", "self", ".", "parse_field", "(", "field", ",", "index", ")", "for", "index", ",", "field", "in", "enumera...
Get all fields
[ "Get", "all", "fields" ]
edac132cc0797190153f2e60bc7e88cb50e80da6
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/layout.py#L194-L201
241,095
krukas/Trionyx
trionyx/layout.py
ComponentFieldsMixin.parse_field
def parse_field(self, field_data, index=0): """Parse field and add missing options""" field = { '__index__': index, } if isinstance(field_data, str): field.update(self.parse_string_field(field_data)) elif isinstance(field_data, dict): field.up...
python
def parse_field(self, field_data, index=0): """Parse field and add missing options""" field = { '__index__': index, } if isinstance(field_data, str): field.update(self.parse_string_field(field_data)) elif isinstance(field_data, dict): field.up...
[ "def", "parse_field", "(", "self", ",", "field_data", ",", "index", "=", "0", ")", ":", "field", "=", "{", "'__index__'", ":", "index", ",", "}", "if", "isinstance", "(", "field_data", ",", "str", ")", ":", "field", ".", "update", "(", "self", ".", ...
Parse field and add missing options
[ "Parse", "field", "and", "add", "missing", "options" ]
edac132cc0797190153f2e60bc7e88cb50e80da6
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/layout.py#L203-L235
241,096
krukas/Trionyx
trionyx/layout.py
ComponentFieldsMixin.render_field
def render_field(self, field, data): """Render field for given data""" from trionyx.renderer import renderer if 'value' in field: value = field['value'] elif isinstance(data, object) and hasattr(data, field['field']): value = getattr(data, field['field']) ...
python
def render_field(self, field, data): """Render field for given data""" from trionyx.renderer import renderer if 'value' in field: value = field['value'] elif isinstance(data, object) and hasattr(data, field['field']): value = getattr(data, field['field']) ...
[ "def", "render_field", "(", "self", ",", "field", ",", "data", ")", ":", "from", "trionyx", ".", "renderer", "import", "renderer", "if", "'value'", "in", "field", ":", "value", "=", "field", "[", "'value'", "]", "elif", "isinstance", "(", "data", ",", ...
Render field for given data
[ "Render", "field", "for", "given", "data" ]
edac132cc0797190153f2e60bc7e88cb50e80da6
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/layout.py#L290-L313
241,097
krukas/Trionyx
trionyx/layout.py
HtmlTagWrapper.get_attr_text
def get_attr_text(self): """Get html attr text to render in template""" return ' '.join([ '{}="{}"'.format(key, value) for key, value in self.attr.items() ])
python
def get_attr_text(self): """Get html attr text to render in template""" return ' '.join([ '{}="{}"'.format(key, value) for key, value in self.attr.items() ])
[ "def", "get_attr_text", "(", "self", ")", ":", "return", "' '", ".", "join", "(", "[", "'{}=\"{}\"'", ".", "format", "(", "key", ",", "value", ")", "for", "key", ",", "value", "in", "self", ".", "attr", ".", "items", "(", ")", "]", ")" ]
Get html attr text to render in template
[ "Get", "html", "attr", "text", "to", "render", "in", "template" ]
edac132cc0797190153f2e60bc7e88cb50e80da6
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/layout.py#L358-L363
241,098
maceoutliner/django-fiction-outlines
fiction_outlines/forms.py
OutlineMoveNodeForm.mk_dropdown_tree
def mk_dropdown_tree(cls, model, root_node, for_node=None): ''' Override of ``treebeard`` method to enforce the same root. ''' options = [] # The difference is that we only generate the subtree for the current root. logger.debug("Using root node pk of %s" % root_node.pk) ...
python
def mk_dropdown_tree(cls, model, root_node, for_node=None): ''' Override of ``treebeard`` method to enforce the same root. ''' options = [] # The difference is that we only generate the subtree for the current root. logger.debug("Using root node pk of %s" % root_node.pk) ...
[ "def", "mk_dropdown_tree", "(", "cls", ",", "model", ",", "root_node", ",", "for_node", "=", "None", ")", ":", "options", "=", "[", "]", "# The difference is that we only generate the subtree for the current root.", "logger", ".", "debug", "(", "\"Using root node pk of ...
Override of ``treebeard`` method to enforce the same root.
[ "Override", "of", "treebeard", "method", "to", "enforce", "the", "same", "root", "." ]
6c58e356af3fbe7b23557643ba27e46eaef9d4e3
https://github.com/maceoutliner/django-fiction-outlines/blob/6c58e356af3fbe7b23557643ba27e46eaef9d4e3/fiction_outlines/forms.py#L88-L96
241,099
olsoneric/pedemath
pedemath/vec2.py
scale_v2
def scale_v2(vec, amount): """Return a new Vec2 with x and y from vec and multiplied by amount.""" return Vec2(vec.x * amount, vec.y * amount)
python
def scale_v2(vec, amount): """Return a new Vec2 with x and y from vec and multiplied by amount.""" return Vec2(vec.x * amount, vec.y * amount)
[ "def", "scale_v2", "(", "vec", ",", "amount", ")", ":", "return", "Vec2", "(", "vec", ".", "x", "*", "amount", ",", "vec", ".", "y", "*", "amount", ")" ]
Return a new Vec2 with x and y from vec and multiplied by amount.
[ "Return", "a", "new", "Vec2", "with", "x", "and", "y", "from", "vec", "and", "multiplied", "by", "amount", "." ]
4bffcfe7089e421d603eb0a9708b84789c2d16be
https://github.com/olsoneric/pedemath/blob/4bffcfe7089e421d603eb0a9708b84789c2d16be/pedemath/vec2.py#L58-L61