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
54,800
CivicSpleen/ambry
ambry/metadata/proptree.py
_set_value
def _set_value(instance_to_path_map, path_to_instance_map, prop_tree, config_instance): """ Finds appropriate term in the prop_tree and sets its value from config_instance. Args: configs_map (dict): key is id of the config, value is Config instance (AKA cache of the configs) prop_tree (Property...
python
def _set_value(instance_to_path_map, path_to_instance_map, prop_tree, config_instance): """ Finds appropriate term in the prop_tree and sets its value from config_instance. Args: configs_map (dict): key is id of the config, value is Config instance (AKA cache of the configs) prop_tree (Property...
[ "def", "_set_value", "(", "instance_to_path_map", ",", "path_to_instance_map", ",", "prop_tree", ",", "config_instance", ")", ":", "path", "=", "instance_to_path_map", "[", "config_instance", "]", "# find group", "group", "=", "prop_tree", "for", "elem", "in", "path...
Finds appropriate term in the prop_tree and sets its value from config_instance. Args: configs_map (dict): key is id of the config, value is Config instance (AKA cache of the configs) prop_tree (PropertyDictTree): poperty tree to populate. config_instance (Config):
[ "Finds", "appropriate", "term", "in", "the", "prop_tree", "and", "sets", "its", "value", "from", "config_instance", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/metadata/proptree.py#L1148-L1189
54,801
CivicSpleen/ambry
ambry/metadata/proptree.py
get_or_create
def get_or_create(session, model, **kwargs): """ Get or create sqlalchemy instance. Args: session (Sqlalchemy session): model (sqlalchemy model): kwargs (dict): kwargs to lookup or create instance. Returns: Tuple: first element is found or created instance, second is boolea...
python
def get_or_create(session, model, **kwargs): """ Get or create sqlalchemy instance. Args: session (Sqlalchemy session): model (sqlalchemy model): kwargs (dict): kwargs to lookup or create instance. Returns: Tuple: first element is found or created instance, second is boolea...
[ "def", "get_or_create", "(", "session", ",", "model", ",", "*", "*", "kwargs", ")", ":", "instance", "=", "session", ".", "query", "(", "model", ")", ".", "filter_by", "(", "*", "*", "kwargs", ")", ".", "first", "(", ")", "if", "instance", ":", "re...
Get or create sqlalchemy instance. Args: session (Sqlalchemy session): model (sqlalchemy model): kwargs (dict): kwargs to lookup or create instance. Returns: Tuple: first element is found or created instance, second is boolean - True if instance created, False if in...
[ "Get", "or", "create", "sqlalchemy", "instance", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/metadata/proptree.py#L1192-L1213
54,802
CivicSpleen/ambry
ambry/metadata/proptree.py
_get_config_instance
def _get_config_instance(group_or_term, session, **kwargs): """ Finds appropriate config instance and returns it. Args: group_or_term (Group or Term): session (Sqlalchemy session): kwargs (dict): kwargs to pass to get_or_create. Returns: tuple of (Config, bool): """ ...
python
def _get_config_instance(group_or_term, session, **kwargs): """ Finds appropriate config instance and returns it. Args: group_or_term (Group or Term): session (Sqlalchemy session): kwargs (dict): kwargs to pass to get_or_create. Returns: tuple of (Config, bool): """ ...
[ "def", "_get_config_instance", "(", "group_or_term", ",", "session", ",", "*", "*", "kwargs", ")", ":", "path", "=", "group_or_term", ".", "_get_path", "(", ")", "cached", "=", "group_or_term", ".", "_top", ".", "_cached_configs", ".", "get", "(", "path", ...
Finds appropriate config instance and returns it. Args: group_or_term (Group or Term): session (Sqlalchemy session): kwargs (dict): kwargs to pass to get_or_create. Returns: tuple of (Config, bool):
[ "Finds", "appropriate", "config", "instance", "and", "returns", "it", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/metadata/proptree.py#L1216-L1235
54,803
CivicSpleen/ambry
ambry/metadata/proptree.py
StructuredPropertyTree.register_members
def register_members(self): """Collect the names of the class member and convert them to object members. Unlike Terms, the Group class members are converted into object members, so the configuration data """ self._members = { name: attr for name, attr in it...
python
def register_members(self): """Collect the names of the class member and convert them to object members. Unlike Terms, the Group class members are converted into object members, so the configuration data """ self._members = { name: attr for name, attr in it...
[ "def", "register_members", "(", "self", ")", ":", "self", ".", "_members", "=", "{", "name", ":", "attr", "for", "name", ",", "attr", "in", "iteritems", "(", "type", "(", "self", ")", ".", "__dict__", ")", "if", "isinstance", "(", "attr", ",", "Group...
Collect the names of the class member and convert them to object members. Unlike Terms, the Group class members are converted into object members, so the configuration data
[ "Collect", "the", "names", "of", "the", "class", "member", "and", "convert", "them", "to", "object", "members", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/metadata/proptree.py#L304-L317
54,804
CivicSpleen/ambry
ambry/metadata/proptree.py
StructuredPropertyTree.add_error
def add_error(self, group, term, sub_term, value): """For records that are not defined as terms, either add it to the errors list.""" self._errors[(group, term, sub_term)] = value
python
def add_error(self, group, term, sub_term, value): """For records that are not defined as terms, either add it to the errors list.""" self._errors[(group, term, sub_term)] = value
[ "def", "add_error", "(", "self", ",", "group", ",", "term", ",", "sub_term", ",", "value", ")", ":", "self", ".", "_errors", "[", "(", "group", ",", "term", ",", "sub_term", ")", "]", "=", "value" ]
For records that are not defined as terms, either add it to the errors list.
[ "For", "records", "that", "are", "not", "defined", "as", "terms", "either", "add", "it", "to", "the", "errors", "list", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/metadata/proptree.py#L357-L361
54,805
CivicSpleen/ambry
ambry/metadata/proptree.py
StructuredPropertyTree._jinja_sub
def _jinja_sub(self, st): """Create a Jina template engine, then perform substitutions on a string""" if isinstance(st, string_types): from jinja2 import Template try: for i in range(5): # Only do 5 recursive substitutions. st = Template(st)...
python
def _jinja_sub(self, st): """Create a Jina template engine, then perform substitutions on a string""" if isinstance(st, string_types): from jinja2 import Template try: for i in range(5): # Only do 5 recursive substitutions. st = Template(st)...
[ "def", "_jinja_sub", "(", "self", ",", "st", ")", ":", "if", "isinstance", "(", "st", ",", "string_types", ")", ":", "from", "jinja2", "import", "Template", "try", ":", "for", "i", "in", "range", "(", "5", ")", ":", "# Only do 5 recursive substitutions.", ...
Create a Jina template engine, then perform substitutions on a string
[ "Create", "a", "Jina", "template", "engine", "then", "perform", "substitutions", "on", "a", "string" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/metadata/proptree.py#L371-L388
54,806
CivicSpleen/ambry
ambry/metadata/proptree.py
StructuredPropertyTree.scalar_term
def scalar_term(self, st): """Return a _ScalarTermS or _ScalarTermU from a string, to perform text and HTML substitutions""" if isinstance(st, binary_type): return _ScalarTermS(st, self._jinja_sub) elif isinstance(st, text_type): return _ScalarTermU(st, self._jinja_sub) ...
python
def scalar_term(self, st): """Return a _ScalarTermS or _ScalarTermU from a string, to perform text and HTML substitutions""" if isinstance(st, binary_type): return _ScalarTermS(st, self._jinja_sub) elif isinstance(st, text_type): return _ScalarTermU(st, self._jinja_sub) ...
[ "def", "scalar_term", "(", "self", ",", "st", ")", ":", "if", "isinstance", "(", "st", ",", "binary_type", ")", ":", "return", "_ScalarTermS", "(", "st", ",", "self", ".", "_jinja_sub", ")", "elif", "isinstance", "(", "st", ",", "text_type", ")", ":", ...
Return a _ScalarTermS or _ScalarTermU from a string, to perform text and HTML substitutions
[ "Return", "a", "_ScalarTermS", "or", "_ScalarTermU", "from", "a", "string", "to", "perform", "text", "and", "HTML", "substitutions" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/metadata/proptree.py#L390-L399
54,807
CivicSpleen/ambry
ambry/metadata/proptree.py
Group.update_config
def update_config(self): """ Updates or creates config of that group. Requires tree bound to db. """ dataset = self._top._config.dataset session = object_session(self._top._config) logger.debug( 'Updating group config. dataset: {}, type: {}, key: {}'.format(dataset.vid, self....
python
def update_config(self): """ Updates or creates config of that group. Requires tree bound to db. """ dataset = self._top._config.dataset session = object_session(self._top._config) logger.debug( 'Updating group config. dataset: {}, type: {}, key: {}'.format(dataset.vid, self....
[ "def", "update_config", "(", "self", ")", ":", "dataset", "=", "self", ".", "_top", ".", "_config", ".", "dataset", "session", "=", "object_session", "(", "self", ".", "_top", ".", "_config", ")", "logger", ".", "debug", "(", "'Updating group config. dataset...
Updates or creates config of that group. Requires tree bound to db.
[ "Updates", "or", "creates", "config", "of", "that", "group", ".", "Requires", "tree", "bound", "to", "db", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/metadata/proptree.py#L446-L466
54,808
CivicSpleen/ambry
ambry/metadata/proptree.py
Group.get_group_instance
def get_group_instance(self, parent): """Create an instance object""" o = copy.copy(self) o.init_instance(parent) return o
python
def get_group_instance(self, parent): """Create an instance object""" o = copy.copy(self) o.init_instance(parent) return o
[ "def", "get_group_instance", "(", "self", ",", "parent", ")", ":", "o", "=", "copy", ".", "copy", "(", "self", ")", "o", ".", "init_instance", "(", "parent", ")", "return", "o" ]
Create an instance object
[ "Create", "an", "instance", "object" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/metadata/proptree.py#L489-L493
54,809
CivicSpleen/ambry
ambry/metadata/proptree.py
VarDictGroup.update_config
def update_config(self, key, value): """ Creates or updates db config of the VarDictGroup. Requires bound to db tree. """ dataset = self._top._config.dataset session = object_session(self._top._config) logger.debug( 'Updating VarDictGroup config. dataset: {}, type: {}, key: {...
python
def update_config(self, key, value): """ Creates or updates db config of the VarDictGroup. Requires bound to db tree. """ dataset = self._top._config.dataset session = object_session(self._top._config) logger.debug( 'Updating VarDictGroup config. dataset: {}, type: {}, key: {...
[ "def", "update_config", "(", "self", ",", "key", ",", "value", ")", ":", "dataset", "=", "self", ".", "_top", ".", "_config", ".", "dataset", "session", "=", "object_session", "(", "self", ".", "_top", ".", "_config", ")", "logger", ".", "debug", "(", ...
Creates or updates db config of the VarDictGroup. Requires bound to db tree.
[ "Creates", "or", "updates", "db", "config", "of", "the", "VarDictGroup", ".", "Requires", "bound", "to", "db", "tree", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/metadata/proptree.py#L720-L751
54,810
CivicSpleen/ambry
ambry/metadata/proptree.py
Term.update_config
def update_config(self): """ Creates or updates db config of the term. Requires bound to db tree. """ dataset = self._top._config.dataset session = object_session(self._top._config) #logger.debug('Updating term config. dataset: {}, type: {}, key: {}, value: {}'.format( # ...
python
def update_config(self): """ Creates or updates db config of the term. Requires bound to db tree. """ dataset = self._top._config.dataset session = object_session(self._top._config) #logger.debug('Updating term config. dataset: {}, type: {}, key: {}, value: {}'.format( # ...
[ "def", "update_config", "(", "self", ")", ":", "dataset", "=", "self", ".", "_top", ".", "_config", ".", "dataset", "session", "=", "object_session", "(", "self", ".", "_top", ".", "_config", ")", "#logger.debug('Updating term config. dataset: {}, type: {}, key: {},...
Creates or updates db config of the term. Requires bound to db tree.
[ "Creates", "or", "updates", "db", "config", "of", "the", "term", ".", "Requires", "bound", "to", "db", "tree", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/metadata/proptree.py#L792-L817
54,811
CivicSpleen/ambry
ambry/metadata/proptree.py
_ScalarTermS.text
def text(self): """Interpret the scalar as Markdown, strip the HTML and return text""" s = MLStripper() s.feed(self.html) return s.get_data()
python
def text(self): """Interpret the scalar as Markdown, strip the HTML and return text""" s = MLStripper() s.feed(self.html) return s.get_data()
[ "def", "text", "(", "self", ")", ":", "s", "=", "MLStripper", "(", ")", "s", ".", "feed", "(", "self", ".", "html", ")", "return", "s", ".", "get_data", "(", ")" ]
Interpret the scalar as Markdown, strip the HTML and return text
[ "Interpret", "the", "scalar", "as", "Markdown", "strip", "the", "HTML", "and", "return", "text" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/metadata/proptree.py#L890-L895
54,812
SmartTeleMax/iktomi
iktomi/utils/__init__.py
quoteattrs
def quoteattrs(data): '''Takes dict of attributes and returns their HTML representation''' items = [] for key, value in data.items(): items.append('{}={}'.format(key, quoteattr(value))) return ' '.join(items)
python
def quoteattrs(data): '''Takes dict of attributes and returns their HTML representation''' items = [] for key, value in data.items(): items.append('{}={}'.format(key, quoteattr(value))) return ' '.join(items)
[ "def", "quoteattrs", "(", "data", ")", ":", "items", "=", "[", "]", "for", "key", ",", "value", "in", "data", ".", "items", "(", ")", ":", "items", ".", "append", "(", "'{}={}'", ".", "format", "(", "key", ",", "quoteattr", "(", "value", ")", ")"...
Takes dict of attributes and returns their HTML representation
[ "Takes", "dict", "of", "attributes", "and", "returns", "their", "HTML", "representation" ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/utils/__init__.py#L16-L21
54,813
SmartTeleMax/iktomi
iktomi/utils/__init__.py
quote_js
def quote_js(text): '''Quotes text to be used as JavaScript string in HTML templates. The result doesn't contain surrounding quotes.''' if isinstance(text, six.binary_type): text = text.decode('utf-8') # for Jinja2 Markup text = text.replace('\\', '\\\\'); text = text.replace('\n', '\\n'); ...
python
def quote_js(text): '''Quotes text to be used as JavaScript string in HTML templates. The result doesn't contain surrounding quotes.''' if isinstance(text, six.binary_type): text = text.decode('utf-8') # for Jinja2 Markup text = text.replace('\\', '\\\\'); text = text.replace('\n', '\\n'); ...
[ "def", "quote_js", "(", "text", ")", ":", "if", "isinstance", "(", "text", ",", "six", ".", "binary_type", ")", ":", "text", "=", "text", ".", "decode", "(", "'utf-8'", ")", "# for Jinja2 Markup", "text", "=", "text", ".", "replace", "(", "'\\\\'", ","...
Quotes text to be used as JavaScript string in HTML templates. The result doesn't contain surrounding quotes.
[ "Quotes", "text", "to", "be", "used", "as", "JavaScript", "string", "in", "HTML", "templates", ".", "The", "result", "doesn", "t", "contain", "surrounding", "quotes", "." ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/utils/__init__.py#L23-L33
54,814
sailthru/relay
relay/runner.py
create_ramp_plan
def create_ramp_plan(err, ramp): """ Formulate and execute on a plan to slowly add heat or cooling to the system `err` initial error (PV - SP) `ramp` the size of the ramp A ramp plan might yield MVs in this order at every timestep: [5, 0, 4, 0, 3, 0, 2, 0, 1] where err == 5 + 4 + 3...
python
def create_ramp_plan(err, ramp): """ Formulate and execute on a plan to slowly add heat or cooling to the system `err` initial error (PV - SP) `ramp` the size of the ramp A ramp plan might yield MVs in this order at every timestep: [5, 0, 4, 0, 3, 0, 2, 0, 1] where err == 5 + 4 + 3...
[ "def", "create_ramp_plan", "(", "err", ",", "ramp", ")", ":", "if", "ramp", "==", "1", ":", "# basecase", "yield", "int", "(", "err", ")", "while", "True", ":", "yield", "0", "# np.arange(n).sum() == err", "# --> solve for n", "# err = (n - 1) * (n // 2) == .5 * n...
Formulate and execute on a plan to slowly add heat or cooling to the system `err` initial error (PV - SP) `ramp` the size of the ramp A ramp plan might yield MVs in this order at every timestep: [5, 0, 4, 0, 3, 0, 2, 0, 1] where err == 5 + 4 + 3 + 2 + 1
[ "Formulate", "and", "execute", "on", "a", "plan", "to", "slowly", "add", "heat", "or", "cooling", "to", "the", "system" ]
995209346c6663675d96d0cbff3bb67b9758c8e2
https://github.com/sailthru/relay/blob/995209346c6663675d96d0cbff3bb67b9758c8e2/relay/runner.py#L69-L101
54,815
SmartTeleMax/iktomi
iktomi/forms/fields.py
BaseField.clean_value
def clean_value(self): ''' Current field's converted value from form's python_data. ''' # XXX cached_property is used only for set initial state # this property should be set every time field data # has been changed, for instance, in accept method python_d...
python
def clean_value(self): ''' Current field's converted value from form's python_data. ''' # XXX cached_property is used only for set initial state # this property should be set every time field data # has been changed, for instance, in accept method python_d...
[ "def", "clean_value", "(", "self", ")", ":", "# XXX cached_property is used only for set initial state", "# this property should be set every time field data", "# has been changed, for instance, in accept method", "python_data", "=", "self", ".", "parent", ".", "python_data", ...
Current field's converted value from form's python_data.
[ "Current", "field", "s", "converted", "value", "from", "form", "s", "python_data", "." ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/forms/fields.py#L105-L115
54,816
SmartTeleMax/iktomi
iktomi/forms/fields.py
Field.accept
def accept(self): '''Extracts raw value from form's raw data and passes it to converter''' value = self.raw_value if not self._check_value_type(value): # XXX should this be silent or TypeError? value = [] if self.multiple else self._null_value self.clean_value = s...
python
def accept(self): '''Extracts raw value from form's raw data and passes it to converter''' value = self.raw_value if not self._check_value_type(value): # XXX should this be silent or TypeError? value = [] if self.multiple else self._null_value self.clean_value = s...
[ "def", "accept", "(", "self", ")", ":", "value", "=", "self", ".", "raw_value", "if", "not", "self", ".", "_check_value_type", "(", "value", ")", ":", "# XXX should this be silent or TypeError?", "value", "=", "[", "]", "if", "self", ".", "multiple", "else",...
Extracts raw value from form's raw data and passes it to converter
[ "Extracts", "raw", "value", "from", "form", "s", "raw", "data", "and", "passes", "it", "to", "converter" ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/forms/fields.py#L202-L209
54,817
SmartTeleMax/iktomi
iktomi/forms/fields.py
AggregateField.python_data
def python_data(self): '''Representation of aggregate value as dictionary.''' try: value = self.clean_value except LookupError: # XXX is this necessary? value = self.get_initial() return self.from_python(value)
python
def python_data(self): '''Representation of aggregate value as dictionary.''' try: value = self.clean_value except LookupError: # XXX is this necessary? value = self.get_initial() return self.from_python(value)
[ "def", "python_data", "(", "self", ")", ":", "try", ":", "value", "=", "self", ".", "clean_value", "except", "LookupError", ":", "# XXX is this necessary?", "value", "=", "self", ".", "get_initial", "(", ")", "return", "self", ".", "from_python", "(", "value...
Representation of aggregate value as dictionary.
[ "Representation", "of", "aggregate", "value", "as", "dictionary", "." ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/forms/fields.py#L215-L222
54,818
SmartTeleMax/iktomi
iktomi/forms/fields.py
FieldSet.accept
def accept(self): ''' Accepts all children fields, collects resulting values into dict and passes that dict to converter. Returns result of converter as separate value in parent `python_data` ''' result = dict(self.python_data) for field in self.fields: ...
python
def accept(self): ''' Accepts all children fields, collects resulting values into dict and passes that dict to converter. Returns result of converter as separate value in parent `python_data` ''' result = dict(self.python_data) for field in self.fields: ...
[ "def", "accept", "(", "self", ")", ":", "result", "=", "dict", "(", "self", ".", "python_data", ")", "for", "field", "in", "self", ".", "fields", ":", "if", "field", ".", "writable", ":", "result", ".", "update", "(", "field", ".", "accept", "(", "...
Accepts all children fields, collects resulting values into dict and passes that dict to converter. Returns result of converter as separate value in parent `python_data`
[ "Accepts", "all", "children", "fields", "collects", "resulting", "values", "into", "dict", "and", "passes", "that", "dict", "to", "converter", "." ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/forms/fields.py#L282-L298
54,819
SmartTeleMax/iktomi
iktomi/forms/fields.py
FieldBlock.accept
def accept(self): ''' Acts as `Field.accepts` but returns result of every child field as value in parent `python_data`. ''' result = FieldSet.accept(self) self.clean_value = result[self.name] return self.clean_value
python
def accept(self): ''' Acts as `Field.accepts` but returns result of every child field as value in parent `python_data`. ''' result = FieldSet.accept(self) self.clean_value = result[self.name] return self.clean_value
[ "def", "accept", "(", "self", ")", ":", "result", "=", "FieldSet", ".", "accept", "(", "self", ")", "self", ".", "clean_value", "=", "result", "[", "self", ".", "name", "]", "return", "self", ".", "clean_value" ]
Acts as `Field.accepts` but returns result of every child field as value in parent `python_data`.
[ "Acts", "as", "Field", ".", "accepts", "but", "returns", "result", "of", "every", "child", "field", "as", "value", "in", "parent", "python_data", "." ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/forms/fields.py#L327-L334
54,820
CodeReclaimers/btce-api
btceapi/public.py
getTicker
def getTicker(pair, connection=None, info=None): """Retrieve the ticker for the given pair. Returns a Ticker instance.""" if info is not None: info.validate_pair(pair) if connection is None: connection = common.BTCEConnection() response = connection.makeJSONRequest("/api/3/ticker/%s"...
python
def getTicker(pair, connection=None, info=None): """Retrieve the ticker for the given pair. Returns a Ticker instance.""" if info is not None: info.validate_pair(pair) if connection is None: connection = common.BTCEConnection() response = connection.makeJSONRequest("/api/3/ticker/%s"...
[ "def", "getTicker", "(", "pair", ",", "connection", "=", "None", ",", "info", "=", "None", ")", ":", "if", "info", "is", "not", "None", ":", "info", ".", "validate_pair", "(", "pair", ")", "if", "connection", "is", "None", ":", "connection", "=", "co...
Retrieve the ticker for the given pair. Returns a Ticker instance.
[ "Retrieve", "the", "ticker", "for", "the", "given", "pair", ".", "Returns", "a", "Ticker", "instance", "." ]
cdf7da694261edf64b32af46e7ce9b701cad7dee
https://github.com/CodeReclaimers/btce-api/blob/cdf7da694261edf64b32af46e7ce9b701cad7dee/btceapi/public.py#L124-L143
54,821
CodeReclaimers/btce-api
btceapi/public.py
getTradeHistory
def getTradeHistory(pair, connection=None, info=None, count=None): """Retrieve the trade history for the given pair. Returns a list of Trade instances. If count is not None, it should be an integer, and specifies the number of items from the trade history that will be processed and returned.""" i...
python
def getTradeHistory(pair, connection=None, info=None, count=None): """Retrieve the trade history for the given pair. Returns a list of Trade instances. If count is not None, it should be an integer, and specifies the number of items from the trade history that will be processed and returned.""" i...
[ "def", "getTradeHistory", "(", "pair", ",", "connection", "=", "None", ",", "info", "=", "None", ",", "count", "=", "None", ")", ":", "if", "info", "is", "not", "None", ":", "info", ".", "validate_pair", "(", "pair", ")", "if", "connection", "is", "N...
Retrieve the trade history for the given pair. Returns a list of Trade instances. If count is not None, it should be an integer, and specifies the number of items from the trade history that will be processed and returned.
[ "Retrieve", "the", "trade", "history", "for", "the", "given", "pair", ".", "Returns", "a", "list", "of", "Trade", "instances", ".", "If", "count", "is", "not", "None", "it", "should", "be", "an", "integer", "and", "specifies", "the", "number", "of", "ite...
cdf7da694261edf64b32af46e7ce9b701cad7dee
https://github.com/CodeReclaimers/btce-api/blob/cdf7da694261edf64b32af46e7ce9b701cad7dee/btceapi/public.py#L178-L208
54,822
CivicSpleen/ambry
ambry/bundle/files.py
BuildSourceFile.remove
def remove(self): """ Removes file from filesystem. """ from fs.errors import ResourceNotFoundError try: self._fs.remove(self.file_name) except ResourceNotFoundError: pass
python
def remove(self): """ Removes file from filesystem. """ from fs.errors import ResourceNotFoundError try: self._fs.remove(self.file_name) except ResourceNotFoundError: pass
[ "def", "remove", "(", "self", ")", ":", "from", "fs", ".", "errors", "import", "ResourceNotFoundError", "try", ":", "self", ".", "_fs", ".", "remove", "(", "self", ".", "file_name", ")", "except", "ResourceNotFoundError", ":", "pass" ]
Removes file from filesystem.
[ "Removes", "file", "from", "filesystem", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/files.py#L160-L167
54,823
CivicSpleen/ambry
ambry/bundle/files.py
BuildSourceFile.sync
def sync(self, force=None): """Synchronize between the file in the file system and the field record""" try: if force: sd = force else: sd = self.sync_dir() if sd == self.SYNC_DIR.FILE_TO_RECORD: if force and not self....
python
def sync(self, force=None): """Synchronize between the file in the file system and the field record""" try: if force: sd = force else: sd = self.sync_dir() if sd == self.SYNC_DIR.FILE_TO_RECORD: if force and not self....
[ "def", "sync", "(", "self", ",", "force", "=", "None", ")", ":", "try", ":", "if", "force", ":", "sd", "=", "force", "else", ":", "sd", "=", "self", ".", "sync_dir", "(", ")", "if", "sd", "==", "self", ".", "SYNC_DIR", ".", "FILE_TO_RECORD", ":",...
Synchronize between the file in the file system and the field record
[ "Synchronize", "between", "the", "file", "in", "the", "file", "system", "and", "the", "field", "record" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/files.py#L247-L274
54,824
CivicSpleen/ambry
ambry/bundle/files.py
DictBuildSourceFile.record_to_fh
def record_to_fh(self, f): """Write the record, in filesystem format, to a file handle or file object""" fr = self.record if fr.contents: yaml.safe_dump(fr.unpacked_contents, f, default_flow_style=False, encoding='utf-8') fr.source_hash = self.fs_hash fr.mod...
python
def record_to_fh(self, f): """Write the record, in filesystem format, to a file handle or file object""" fr = self.record if fr.contents: yaml.safe_dump(fr.unpacked_contents, f, default_flow_style=False, encoding='utf-8') fr.source_hash = self.fs_hash fr.mod...
[ "def", "record_to_fh", "(", "self", ",", "f", ")", ":", "fr", "=", "self", ".", "record", "if", "fr", ".", "contents", ":", "yaml", ".", "safe_dump", "(", "fr", ".", "unpacked_contents", ",", "f", ",", "default_flow_style", "=", "False", ",", "encoding...
Write the record, in filesystem format, to a file handle or file object
[ "Write", "the", "record", "in", "filesystem", "format", "to", "a", "file", "handle", "or", "file", "object" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/files.py#L458-L466
54,825
CivicSpleen/ambry
ambry/bundle/files.py
MetadataFile.objects_to_record
def objects_to_record(self): """Write from object metadata to the record. Note that we don't write everything""" o = self.get_object() o.about = self._bundle.metadata.about o.identity = self._dataset.identity.ident_dict o.names = self._dataset.identity.names_dict o.cont...
python
def objects_to_record(self): """Write from object metadata to the record. Note that we don't write everything""" o = self.get_object() o.about = self._bundle.metadata.about o.identity = self._dataset.identity.ident_dict o.names = self._dataset.identity.names_dict o.cont...
[ "def", "objects_to_record", "(", "self", ")", ":", "o", "=", "self", ".", "get_object", "(", ")", "o", ".", "about", "=", "self", ".", "_bundle", ".", "metadata", ".", "about", "o", ".", "identity", "=", "self", ".", "_dataset", ".", "identity", ".",...
Write from object metadata to the record. Note that we don't write everything
[ "Write", "from", "object", "metadata", "to", "the", "record", ".", "Note", "that", "we", "don", "t", "write", "everything" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/files.py#L573-L583
54,826
CivicSpleen/ambry
ambry/bundle/files.py
MetadataFile.update_identity
def update_identity(self): """Update the identity and names to match the dataset id and version""" fr = self.record d = fr.unpacked_contents d['identity'] = self._dataset.identity.ident_dict d['names'] = self._dataset.identity.names_dict fr.update_contents(msgpack.pac...
python
def update_identity(self): """Update the identity and names to match the dataset id and version""" fr = self.record d = fr.unpacked_contents d['identity'] = self._dataset.identity.ident_dict d['names'] = self._dataset.identity.names_dict fr.update_contents(msgpack.pac...
[ "def", "update_identity", "(", "self", ")", ":", "fr", "=", "self", ".", "record", "d", "=", "fr", ".", "unpacked_contents", "d", "[", "'identity'", "]", "=", "self", ".", "_dataset", ".", "identity", ".", "ident_dict", "d", "[", "'names'", "]", "=", ...
Update the identity and names to match the dataset id and version
[ "Update", "the", "identity", "and", "names", "to", "match", "the", "dataset", "id", "and", "version" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/files.py#L613-L623
54,827
CivicSpleen/ambry
ambry/bundle/files.py
MetadataFile.get_object
def get_object(self): """Return contents in object form, an AttrDict""" from ..util import AttrDict c = self.record.unpacked_contents if not c: c = yaml.safe_load(self.default) return AttrDict(c)
python
def get_object(self): """Return contents in object form, an AttrDict""" from ..util import AttrDict c = self.record.unpacked_contents if not c: c = yaml.safe_load(self.default) return AttrDict(c)
[ "def", "get_object", "(", "self", ")", ":", "from", ".", ".", "util", "import", "AttrDict", "c", "=", "self", ".", "record", ".", "unpacked_contents", "if", "not", "c", ":", "c", "=", "yaml", ".", "safe_load", "(", "self", ".", "default", ")", "retur...
Return contents in object form, an AttrDict
[ "Return", "contents", "in", "object", "form", "an", "AttrDict" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/files.py#L625-L635
54,828
CivicSpleen/ambry
ambry/bundle/files.py
NotebookFile.execute
def execute(self): """Convert the notebook to a python script and execute it, returning the local context as a dict""" from nbformat import read from nbconvert.exporters import export_script from cStringIO import StringIO notebook = read(StringIO(self.record.unpacked_co...
python
def execute(self): """Convert the notebook to a python script and execute it, returning the local context as a dict""" from nbformat import read from nbconvert.exporters import export_script from cStringIO import StringIO notebook = read(StringIO(self.record.unpacked_co...
[ "def", "execute", "(", "self", ")", ":", "from", "nbformat", "import", "read", "from", "nbconvert", ".", "exporters", "import", "export_script", "from", "cStringIO", "import", "StringIO", "notebook", "=", "read", "(", "StringIO", "(", "self", ".", "record", ...
Convert the notebook to a python script and execute it, returning the local context as a dict
[ "Convert", "the", "notebook", "to", "a", "python", "script", "and", "execute", "it", "returning", "the", "local", "context", "as", "a", "dict" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/files.py#L685-L701
54,829
CivicSpleen/ambry
ambry/bundle/files.py
PythonSourceFile.import_module
def import_module(self, module_path = 'ambry.build', **kwargs): """ Import the contents of the file into the ambry.build module :param kwargs: items to add to the module globals :return: """ from fs.errors import NoSysPathError if module_path in sys.modules: ...
python
def import_module(self, module_path = 'ambry.build', **kwargs): """ Import the contents of the file into the ambry.build module :param kwargs: items to add to the module globals :return: """ from fs.errors import NoSysPathError if module_path in sys.modules: ...
[ "def", "import_module", "(", "self", ",", "module_path", "=", "'ambry.build'", ",", "*", "*", "kwargs", ")", ":", "from", "fs", ".", "errors", "import", "NoSysPathError", "if", "module_path", "in", "sys", ".", "modules", ":", "module", "=", "sys", ".", "...
Import the contents of the file into the ambry.build module :param kwargs: items to add to the module globals :return:
[ "Import", "the", "contents", "of", "the", "file", "into", "the", "ambry", ".", "build", "module" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/files.py#L719-L756
54,830
CivicSpleen/ambry
ambry/bundle/files.py
PythonSourceFile.import_bundle
def import_bundle(self): """Add the filesystem to the Python sys path with an import hook, then import to file as Python""" from fs.errors import NoSysPathError try: import ambry.build module = sys.modules['ambry.build'] except ImportError: mo...
python
def import_bundle(self): """Add the filesystem to the Python sys path with an import hook, then import to file as Python""" from fs.errors import NoSysPathError try: import ambry.build module = sys.modules['ambry.build'] except ImportError: mo...
[ "def", "import_bundle", "(", "self", ")", ":", "from", "fs", ".", "errors", "import", "NoSysPathError", "try", ":", "import", "ambry", ".", "build", "module", "=", "sys", ".", "modules", "[", "'ambry.build'", "]", "except", "ImportError", ":", "module", "=...
Add the filesystem to the Python sys path with an import hook, then import to file as Python
[ "Add", "the", "filesystem", "to", "the", "Python", "sys", "path", "with", "an", "import", "hook", "then", "import", "to", "file", "as", "Python" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/files.py#L758-L783
54,831
CivicSpleen/ambry
ambry/bundle/files.py
PythonSourceFile.import_lib
def import_lib(self): """Import the lib.py file into the bundle module""" try: import ambry.build module = sys.modules['ambry.build'] except ImportError: module = imp.new_module('ambry.build') sys.modules['ambry.build'] = module bf = self...
python
def import_lib(self): """Import the lib.py file into the bundle module""" try: import ambry.build module = sys.modules['ambry.build'] except ImportError: module = imp.new_module('ambry.build') sys.modules['ambry.build'] = module bf = self...
[ "def", "import_lib", "(", "self", ")", ":", "try", ":", "import", "ambry", ".", "build", "module", "=", "sys", ".", "modules", "[", "'ambry.build'", "]", "except", "ImportError", ":", "module", "=", "imp", ".", "new_module", "(", "'ambry.build'", ")", "s...
Import the lib.py file into the bundle module
[ "Import", "the", "lib", ".", "py", "file", "into", "the", "bundle", "module" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/files.py#L785-L810
54,832
CivicSpleen/ambry
ambry/bundle/files.py
SourceSchemaFile.record_to_objects
def record_to_objects(self): """Write from the stored file data to the source records""" from ambry.orm import SourceTable bsfile = self.record failures = set() # Clear out all of the columns from existing tables. We don't clear out the # tables, since they may be refe...
python
def record_to_objects(self): """Write from the stored file data to the source records""" from ambry.orm import SourceTable bsfile = self.record failures = set() # Clear out all of the columns from existing tables. We don't clear out the # tables, since they may be refe...
[ "def", "record_to_objects", "(", "self", ")", ":", "from", "ambry", ".", "orm", "import", "SourceTable", "bsfile", "=", "self", ".", "record", "failures", "=", "set", "(", ")", "# Clear out all of the columns from existing tables. We don't clear out the", "# tables, sin...
Write from the stored file data to the source records
[ "Write", "from", "the", "stored", "file", "data", "to", "the", "source", "records" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/files.py#L1133-L1169
54,833
CivicSpleen/ambry
ambry/bundle/files.py
ASQLSourceFile.execute
def execute(self): """ Executes all sql statements from bundle.sql. """ from ambry.mprlib import execute_sql execute_sql(self._bundle.library, self.record_content)
python
def execute(self): """ Executes all sql statements from bundle.sql. """ from ambry.mprlib import execute_sql execute_sql(self._bundle.library, self.record_content)
[ "def", "execute", "(", "self", ")", ":", "from", "ambry", ".", "mprlib", "import", "execute_sql", "execute_sql", "(", "self", ".", "_bundle", ".", "library", ",", "self", ".", "record_content", ")" ]
Executes all sql statements from bundle.sql.
[ "Executes", "all", "sql", "statements", "from", "bundle", ".", "sql", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/files.py#L1204-L1208
54,834
CivicSpleen/ambry
ambry/bundle/files.py
BuildSourceFileAccessor.list_records
def list_records(self, file_const=None): """Iterate through the file records""" for r in self._dataset.files: if file_const and r.minor_type != file_const: continue yield self.instance_from_name(r.path)
python
def list_records(self, file_const=None): """Iterate through the file records""" for r in self._dataset.files: if file_const and r.minor_type != file_const: continue yield self.instance_from_name(r.path)
[ "def", "list_records", "(", "self", ",", "file_const", "=", "None", ")", ":", "for", "r", "in", "self", ".", "_dataset", ".", "files", ":", "if", "file_const", "and", "r", ".", "minor_type", "!=", "file_const", ":", "continue", "yield", "self", ".", "i...
Iterate through the file records
[ "Iterate", "through", "the", "file", "records" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/files.py#L1295-L1300
54,835
CivicSpleen/ambry
ambry/bundle/files.py
BuildSourceFileAccessor.record_to_objects
def record_to_objects(self, preference=None): """Create objects from files, or merge the files into the objects. """ from ambry.orm.file import File for f in self.list_records(): pref = preference if preference else f.record.preference if pref == File.PREFERENCE.FILE: ...
python
def record_to_objects(self, preference=None): """Create objects from files, or merge the files into the objects. """ from ambry.orm.file import File for f in self.list_records(): pref = preference if preference else f.record.preference if pref == File.PREFERENCE.FILE: ...
[ "def", "record_to_objects", "(", "self", ",", "preference", "=", "None", ")", ":", "from", "ambry", ".", "orm", ".", "file", "import", "File", "for", "f", "in", "self", ".", "list_records", "(", ")", ":", "pref", "=", "preference", "if", "preference", ...
Create objects from files, or merge the files into the objects.
[ "Create", "objects", "from", "files", "or", "merge", "the", "files", "into", "the", "objects", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/files.py#L1338-L1352
54,836
CivicSpleen/ambry
ambry/bundle/files.py
BuildSourceFileAccessor.objects_to_record
def objects_to_record(self, preference=None): """Create file records from objects. """ from ambry.orm.file import File raise NotImplementedError("Still uses obsolete file_info_map") for file_const, (file_name, clz) in iteritems(file_info_map): f = self.file(file_const) ...
python
def objects_to_record(self, preference=None): """Create file records from objects. """ from ambry.orm.file import File raise NotImplementedError("Still uses obsolete file_info_map") for file_const, (file_name, clz) in iteritems(file_info_map): f = self.file(file_const) ...
[ "def", "objects_to_record", "(", "self", ",", "preference", "=", "None", ")", ":", "from", "ambry", ".", "orm", ".", "file", "import", "File", "raise", "NotImplementedError", "(", "\"Still uses obsolete file_info_map\"", ")", "for", "file_const", ",", "(", "file...
Create file records from objects.
[ "Create", "file", "records", "from", "objects", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/files.py#L1354-L1366
54,837
CivicSpleen/ambry
ambry/bundle/files.py
BuildSourceFileAccessor.set_defaults
def set_defaults(self): """Add default content to any file record that is empty""" for const_name, c in file_classes.items(): if c.multiplicity == '1': f = self.file(const_name) if not f.record.unpacked_contents: f.setcontent(f.default)
python
def set_defaults(self): """Add default content to any file record that is empty""" for const_name, c in file_classes.items(): if c.multiplicity == '1': f = self.file(const_name) if not f.record.unpacked_contents: f.setcontent(f.default)
[ "def", "set_defaults", "(", "self", ")", ":", "for", "const_name", ",", "c", "in", "file_classes", ".", "items", "(", ")", ":", "if", "c", ".", "multiplicity", "==", "'1'", ":", "f", "=", "self", ".", "file", "(", "const_name", ")", "if", "not", "f...
Add default content to any file record that is empty
[ "Add", "default", "content", "to", "any", "file", "record", "that", "is", "empty" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/files.py#L1368-L1375
54,838
PythonRails/rails
rails/__init__.py
run
def run(host='127.0.0.1', port=8000): """ Run web server. """ print("Server running on {}:{}".format(host, port)) app_router = Router() server = make_server(host, port, app_router) server.serve_forever()
python
def run(host='127.0.0.1', port=8000): """ Run web server. """ print("Server running on {}:{}".format(host, port)) app_router = Router() server = make_server(host, port, app_router) server.serve_forever()
[ "def", "run", "(", "host", "=", "'127.0.0.1'", ",", "port", "=", "8000", ")", ":", "print", "(", "\"Server running on {}:{}\"", ".", "format", "(", "host", ",", "port", ")", ")", "app_router", "=", "Router", "(", ")", "server", "=", "make_server", "(", ...
Run web server.
[ "Run", "web", "server", "." ]
1e199b9da4da5b24fef39fc6212d71fc9fbb18a5
https://github.com/PythonRails/rails/blob/1e199b9da4da5b24fef39fc6212d71fc9fbb18a5/rails/__init__.py#L5-L12
54,839
twisted/epsilon
epsilon/scripts/certcreate.py
main
def main(args=None): """ Create a private key and a certificate and write them to a file. """ if args is None: args = sys.argv[1:] o = Options() try: o.parseOptions(args) except usage.UsageError, e: raise SystemExit(str(e)) else: return createSSLCertifica...
python
def main(args=None): """ Create a private key and a certificate and write them to a file. """ if args is None: args = sys.argv[1:] o = Options() try: o.parseOptions(args) except usage.UsageError, e: raise SystemExit(str(e)) else: return createSSLCertifica...
[ "def", "main", "(", "args", "=", "None", ")", ":", "if", "args", "is", "None", ":", "args", "=", "sys", ".", "argv", "[", "1", ":", "]", "o", "=", "Options", "(", ")", "try", ":", "o", ".", "parseOptions", "(", "args", ")", "except", "usage", ...
Create a private key and a certificate and write them to a file.
[ "Create", "a", "private", "key", "and", "a", "certificate", "and", "write", "them", "to", "a", "file", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/scripts/certcreate.py#L49-L62
54,840
CivicSpleen/ambry
ambry/orm/code.py
Code.update
def update(self, f): """Copy another files properties into this one.""" for p in self.__mapper__.attrs: if p.key == 'oid': continue try: setattr(self, p.key, getattr(f, p.key)) except AttributeError: # The dict() meth...
python
def update(self, f): """Copy another files properties into this one.""" for p in self.__mapper__.attrs: if p.key == 'oid': continue try: setattr(self, p.key, getattr(f, p.key)) except AttributeError: # The dict() meth...
[ "def", "update", "(", "self", ",", "f", ")", ":", "for", "p", "in", "self", ".", "__mapper__", ".", "attrs", ":", "if", "p", ".", "key", "==", "'oid'", ":", "continue", "try", ":", "setattr", "(", "self", ",", "p", ".", "key", ",", "getattr", "...
Copy another files properties into this one.
[ "Copy", "another", "files", "properties", "into", "this", "one", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/code.py#L54-L67
54,841
twisted/epsilon
epsilon/hotfixes/timeoutmixin_calllater.py
TimeoutMixin.resetTimeout
def resetTimeout(self): """Reset the timeout count down""" if self.__timeoutCall is not None and self.timeOut is not None: self.__timeoutCall.reset(self.timeOut)
python
def resetTimeout(self): """Reset the timeout count down""" if self.__timeoutCall is not None and self.timeOut is not None: self.__timeoutCall.reset(self.timeOut)
[ "def", "resetTimeout", "(", "self", ")", ":", "if", "self", ".", "__timeoutCall", "is", "not", "None", "and", "self", ".", "timeOut", "is", "not", "None", ":", "self", ".", "__timeoutCall", ".", "reset", "(", "self", ".", "timeOut", ")" ]
Reset the timeout count down
[ "Reset", "the", "timeout", "count", "down" ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/hotfixes/timeoutmixin_calllater.py#L17-L20
54,842
twisted/epsilon
epsilon/hotfixes/timeoutmixin_calllater.py
TimeoutMixin.setTimeout
def setTimeout(self, period): """Change the timeout period @type period: C{int} or C{NoneType} @param period: The period, in seconds, to change the timeout to, or C{None} to disable the timeout. """ prev = self.timeOut self.timeOut = period if self.__tim...
python
def setTimeout(self, period): """Change the timeout period @type period: C{int} or C{NoneType} @param period: The period, in seconds, to change the timeout to, or C{None} to disable the timeout. """ prev = self.timeOut self.timeOut = period if self.__tim...
[ "def", "setTimeout", "(", "self", ",", "period", ")", ":", "prev", "=", "self", ".", "timeOut", "self", ".", "timeOut", "=", "period", "if", "self", ".", "__timeoutCall", "is", "not", "None", ":", "if", "period", "is", "None", ":", "self", ".", "__ti...
Change the timeout period @type period: C{int} or C{NoneType} @param period: The period, in seconds, to change the timeout to, or C{None} to disable the timeout.
[ "Change", "the", "timeout", "period" ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/hotfixes/timeoutmixin_calllater.py#L22-L41
54,843
PythonRails/rails
rails/router.py
Router._load_controllers
def _load_controllers(self): """ Load all controllers from folder 'controllers'. Ignore files with leading underscore (for example: controllers/_blogs.py) """ for file_name in os.listdir(os.path.join(self._project_dir, 'controllers')): # ignore disabled controllers ...
python
def _load_controllers(self): """ Load all controllers from folder 'controllers'. Ignore files with leading underscore (for example: controllers/_blogs.py) """ for file_name in os.listdir(os.path.join(self._project_dir, 'controllers')): # ignore disabled controllers ...
[ "def", "_load_controllers", "(", "self", ")", ":", "for", "file_name", "in", "os", ".", "listdir", "(", "os", ".", "path", ".", "join", "(", "self", ".", "_project_dir", ",", "'controllers'", ")", ")", ":", "# ignore disabled controllers", "if", "not", "fi...
Load all controllers from folder 'controllers'. Ignore files with leading underscore (for example: controllers/_blogs.py)
[ "Load", "all", "controllers", "from", "folder", "controllers", "." ]
1e199b9da4da5b24fef39fc6212d71fc9fbb18a5
https://github.com/PythonRails/rails/blob/1e199b9da4da5b24fef39fc6212d71fc9fbb18a5/rails/router.py#L73-L95
54,844
PythonRails/rails
rails/router.py
Router._init_view
def _init_view(self): """ Initialize View with project settings. """ views_engine = get_config('rails.views.engine', 'jinja') templates_dir = os.path.join(self._project_dir, "views", "templates") self._view = View(views_engine, templates_dir)
python
def _init_view(self): """ Initialize View with project settings. """ views_engine = get_config('rails.views.engine', 'jinja') templates_dir = os.path.join(self._project_dir, "views", "templates") self._view = View(views_engine, templates_dir)
[ "def", "_init_view", "(", "self", ")", ":", "views_engine", "=", "get_config", "(", "'rails.views.engine'", ",", "'jinja'", ")", "templates_dir", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_project_dir", ",", "\"views\"", ",", "\"templates\"", "...
Initialize View with project settings.
[ "Initialize", "View", "with", "project", "settings", "." ]
1e199b9da4da5b24fef39fc6212d71fc9fbb18a5
https://github.com/PythonRails/rails/blob/1e199b9da4da5b24fef39fc6212d71fc9fbb18a5/rails/router.py#L97-L103
54,845
PythonRails/rails
rails/router.py
Router.get_action_handler
def get_action_handler(self, controller_name, action_name): """ Return action of controller as callable. If requested controller isn't found - return 'not_found' action of requested controller or Index controller. """ try_actions = [ controller_name + '/' + a...
python
def get_action_handler(self, controller_name, action_name): """ Return action of controller as callable. If requested controller isn't found - return 'not_found' action of requested controller or Index controller. """ try_actions = [ controller_name + '/' + a...
[ "def", "get_action_handler", "(", "self", ",", "controller_name", ",", "action_name", ")", ":", "try_actions", "=", "[", "controller_name", "+", "'/'", "+", "action_name", ",", "controller_name", "+", "'/not_found'", ",", "# call Index controller to catch all unhandled ...
Return action of controller as callable. If requested controller isn't found - return 'not_found' action of requested controller or Index controller.
[ "Return", "action", "of", "controller", "as", "callable", "." ]
1e199b9da4da5b24fef39fc6212d71fc9fbb18a5
https://github.com/PythonRails/rails/blob/1e199b9da4da5b24fef39fc6212d71fc9fbb18a5/rails/router.py#L111-L128
54,846
CivicSpleen/ambry
ambry/mprlib/backends/sqlite.py
_preprocess_sqlite_index
def _preprocess_sqlite_index(asql_query, library, backend, connection): """ Creates materialized view for each indexed partition found in the query. Args: asql_query (str): asql query library (ambry.Library): backend (SQLiteBackend): connection (apsw.Connection): Returns: ...
python
def _preprocess_sqlite_index(asql_query, library, backend, connection): """ Creates materialized view for each indexed partition found in the query. Args: asql_query (str): asql query library (ambry.Library): backend (SQLiteBackend): connection (apsw.Connection): Returns: ...
[ "def", "_preprocess_sqlite_index", "(", "asql_query", ",", "library", ",", "backend", ",", "connection", ")", ":", "new_query", "=", "None", "if", "asql_query", ".", "strip", "(", ")", ".", "lower", "(", ")", ".", "startswith", "(", "'index'", ")", ":", ...
Creates materialized view for each indexed partition found in the query. Args: asql_query (str): asql query library (ambry.Library): backend (SQLiteBackend): connection (apsw.Connection): Returns: str: converted asql if it contains index query. If not, returns asql_quer...
[ "Creates", "materialized", "view", "for", "each", "indexed", "partition", "found", "in", "the", "query", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/mprlib/backends/sqlite.py#L476-L508
54,847
CivicSpleen/ambry
ambry/mprlib/backends/sqlite.py
SQLiteBackend.close
def close(self): """ Closes connection to sqlite database. """ if getattr(self, '_connection', None): logger.debug('Closing sqlite connection.') self._connection.close() self._connection = None
python
def close(self): """ Closes connection to sqlite database. """ if getattr(self, '_connection', None): logger.debug('Closing sqlite connection.') self._connection.close() self._connection = None
[ "def", "close", "(", "self", ")", ":", "if", "getattr", "(", "self", ",", "'_connection'", ",", "None", ")", ":", "logger", ".", "debug", "(", "'Closing sqlite connection.'", ")", "self", ".", "_connection", ".", "close", "(", ")", "self", ".", "_connect...
Closes connection to sqlite database.
[ "Closes", "connection", "to", "sqlite", "database", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/mprlib/backends/sqlite.py#L138-L143
54,848
CivicSpleen/ambry
ambry/mprlib/backends/sqlite.py
SQLiteBackend._get_mpr_view
def _get_mpr_view(self, connection, table): """ Finds and returns view name in the sqlite db represented by given connection. Args: connection: connection to sqlite db where to look for partition table. table (orm.Table): Raises: MissingViewError: if databas...
python
def _get_mpr_view(self, connection, table): """ Finds and returns view name in the sqlite db represented by given connection. Args: connection: connection to sqlite db where to look for partition table. table (orm.Table): Raises: MissingViewError: if databas...
[ "def", "_get_mpr_view", "(", "self", ",", "connection", ",", "table", ")", ":", "logger", ".", "debug", "(", "'Looking for view of the table.\\n table: {}'", ".", "format", "(", "table", ".", "vid", ")", ")", "view", "=", "self", ".", "get_view_name", "(", ...
Finds and returns view name in the sqlite db represented by given connection. Args: connection: connection to sqlite db where to look for partition table. table (orm.Table): Raises: MissingViewError: if database does not have partition table. Returns: ...
[ "Finds", "and", "returns", "view", "name", "in", "the", "sqlite", "db", "represented", "by", "given", "connection", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/mprlib/backends/sqlite.py#L149-L173
54,849
CivicSpleen/ambry
ambry/mprlib/backends/sqlite.py
SQLiteBackend._get_mpr_table
def _get_mpr_table(self, connection, partition): """ Returns name of the sqlite table who stores mpr data. Args: connection (apsw.Connection): connection to sqlite database who stores mpr data. partition (orm.Partition): Returns: str: Raises: ...
python
def _get_mpr_table(self, connection, partition): """ Returns name of the sqlite table who stores mpr data. Args: connection (apsw.Connection): connection to sqlite database who stores mpr data. partition (orm.Partition): Returns: str: Raises: ...
[ "def", "_get_mpr_table", "(", "self", ",", "connection", ",", "partition", ")", ":", "# TODO: This is the first candidate for optimization. Add field to partition", "# with table name and update it while table creation.", "# Optimized version.", "#", "# return partition.mpr_table or rais...
Returns name of the sqlite table who stores mpr data. Args: connection (apsw.Connection): connection to sqlite database who stores mpr data. partition (orm.Partition): Returns: str: Raises: MissingTableError: if partition table not found in the ...
[ "Returns", "name", "of", "the", "sqlite", "table", "who", "stores", "mpr", "data", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/mprlib/backends/sqlite.py#L175-L219
54,850
CivicSpleen/ambry
ambry/mprlib/backends/sqlite.py
SQLiteBackend._get_create_query
def _get_create_query(partition, tablename, include=None): """ Creates and returns `CREATE TABLE ...` sql statement for given mprows. Args: partition (orm.Partition): tablename (str): name of the table in the return create query. include (list of str, optional): list...
python
def _get_create_query(partition, tablename, include=None): """ Creates and returns `CREATE TABLE ...` sql statement for given mprows. Args: partition (orm.Partition): tablename (str): name of the table in the return create query. include (list of str, optional): list...
[ "def", "_get_create_query", "(", "partition", ",", "tablename", ",", "include", "=", "None", ")", ":", "TYPE_MAP", "=", "{", "'int'", ":", "'INTEGER'", ",", "'float'", ":", "'REAL'", ",", "six", ".", "binary_type", ".", "__name__", ":", "'TEXT'", ",", "s...
Creates and returns `CREATE TABLE ...` sql statement for given mprows. Args: partition (orm.Partition): tablename (str): name of the table in the return create query. include (list of str, optional): list of columns to include to query. Returns: str: cre...
[ "Creates", "and", "returns", "CREATE", "TABLE", "...", "sql", "statement", "for", "given", "mprows", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/mprlib/backends/sqlite.py#L239-L271
54,851
CivicSpleen/ambry
ambry/mprlib/backends/sqlite.py
SQLiteBackend._get_connection
def _get_connection(self): """ Returns connection to sqlite db. Returns: connection to the sqlite db who stores mpr data. """ if getattr(self, '_connection', None): logger.debug('Connection to sqlite db already exists. Using existing one.') else: ...
python
def _get_connection(self): """ Returns connection to sqlite db. Returns: connection to the sqlite db who stores mpr data. """ if getattr(self, '_connection', None): logger.debug('Connection to sqlite db already exists. Using existing one.') else: ...
[ "def", "_get_connection", "(", "self", ")", ":", "if", "getattr", "(", "self", ",", "'_connection'", ",", "None", ")", ":", "logger", ".", "debug", "(", "'Connection to sqlite db already exists. Using existing one.'", ")", "else", ":", "dsn", "=", "self", ".", ...
Returns connection to sqlite db. Returns: connection to the sqlite db who stores mpr data.
[ "Returns", "connection", "to", "sqlite", "db", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/mprlib/backends/sqlite.py#L273-L294
54,852
CivicSpleen/ambry
ambry/mprlib/backends/sqlite.py
SQLiteBackend._add_partition
def _add_partition(self, connection, partition): """ Creates sqlite virtual table for mpr file of the given partition. Args: connection: connection to the sqlite db who stores mpr data. partition (orm.Partition): """ logger.debug('Creating virtual table for part...
python
def _add_partition(self, connection, partition): """ Creates sqlite virtual table for mpr file of the given partition. Args: connection: connection to the sqlite db who stores mpr data. partition (orm.Partition): """ logger.debug('Creating virtual table for part...
[ "def", "_add_partition", "(", "self", ",", "connection", ",", "partition", ")", ":", "logger", ".", "debug", "(", "'Creating virtual table for partition.\\n partition: {}'", ".", "format", "(", "partition", ".", "name", ")", ")", "sqlite_med", ".", "add_partition...
Creates sqlite virtual table for mpr file of the given partition. Args: connection: connection to the sqlite db who stores mpr data. partition (orm.Partition):
[ "Creates", "sqlite", "virtual", "table", "for", "mpr", "file", "of", "the", "given", "partition", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/mprlib/backends/sqlite.py#L296-L305
54,853
CivicSpleen/ambry
ambry/mprlib/backends/sqlite.py
SQLiteBackend._execute
def _execute(self, connection, query, fetch=True): """ Executes given query using given connection. Args: connection (apsw.Connection): connection to the sqlite db who stores mpr data. query (str): sql query fetch (boolean, optional): if True, fetch query result and ...
python
def _execute(self, connection, query, fetch=True): """ Executes given query using given connection. Args: connection (apsw.Connection): connection to the sqlite db who stores mpr data. query (str): sql query fetch (boolean, optional): if True, fetch query result and ...
[ "def", "_execute", "(", "self", ",", "connection", ",", "query", ",", "fetch", "=", "True", ")", ":", "cursor", "=", "connection", ".", "cursor", "(", ")", "try", ":", "cursor", ".", "execute", "(", "query", ")", "except", "Exception", "as", "e", ":"...
Executes given query using given connection. Args: connection (apsw.Connection): connection to the sqlite db who stores mpr data. query (str): sql query fetch (boolean, optional): if True, fetch query result and return it. If False, do not fetch. Returns: ...
[ "Executes", "given", "query", "using", "given", "connection", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/mprlib/backends/sqlite.py#L307-L330
54,854
project-ncl/pnc-cli
pnc_cli/productmilestones.py
list_milestones
def list_milestones(page_size=200, page_index=0, q="", sort=""): """ List all ProductMilestones """ data = list_milestones_raw(page_size, page_index, sort, q) if data: return utils.format_json_list(data)
python
def list_milestones(page_size=200, page_index=0, q="", sort=""): """ List all ProductMilestones """ data = list_milestones_raw(page_size, page_index, sort, q) if data: return utils.format_json_list(data)
[ "def", "list_milestones", "(", "page_size", "=", "200", ",", "page_index", "=", "0", ",", "q", "=", "\"\"", ",", "sort", "=", "\"\"", ")", ":", "data", "=", "list_milestones_raw", "(", "page_size", ",", "page_index", ",", "sort", ",", "q", ")", "if", ...
List all ProductMilestones
[ "List", "all", "ProductMilestones" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/productmilestones.py#L41-L47
54,855
project-ncl/pnc-cli
pnc_cli/productmilestones.py
update_milestone
def update_milestone(id, **kwargs): """ Update a ProductMilestone """ data = update_milestone_raw(id, **kwargs) if data: return utils.format_json(data)
python
def update_milestone(id, **kwargs): """ Update a ProductMilestone """ data = update_milestone_raw(id, **kwargs) if data: return utils.format_json(data)
[ "def", "update_milestone", "(", "id", ",", "*", "*", "kwargs", ")", ":", "data", "=", "update_milestone_raw", "(", "id", ",", "*", "*", "kwargs", ")", "if", "data", ":", "return", "utils", ".", "format_json", "(", "data", ")" ]
Update a ProductMilestone
[ "Update", "a", "ProductMilestone" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/productmilestones.py#L121-L127
54,856
project-ncl/pnc-cli
pnc_cli/productmilestones.py
close_milestone
def close_milestone(id, **kwargs): """ Close a milestone. This triggers its release process. The user can optionally specify the release-date, otherwise today's date is used. If the wait parameter is specified and set to True, upon closing the milestone, we'll periodically check that the relea...
python
def close_milestone(id, **kwargs): """ Close a milestone. This triggers its release process. The user can optionally specify the release-date, otherwise today's date is used. If the wait parameter is specified and set to True, upon closing the milestone, we'll periodically check that the relea...
[ "def", "close_milestone", "(", "id", ",", "*", "*", "kwargs", ")", ":", "data", "=", "close_milestone_raw", "(", "id", ",", "*", "*", "kwargs", ")", "if", "data", ":", "return", "utils", ".", "format_json", "(", "data", ")" ]
Close a milestone. This triggers its release process. The user can optionally specify the release-date, otherwise today's date is used. If the wait parameter is specified and set to True, upon closing the milestone, we'll periodically check that the release being processed is done. Required: ...
[ "Close", "a", "milestone", ".", "This", "triggers", "its", "release", "process", "." ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/productmilestones.py#L156-L174
54,857
carsongee/flask-htpasswd
flask_htpasswd.py
HtPasswdAuth.init_app
def init_app(self, app): """ Find and configure the user database from specified file """ app.config.setdefault('FLASK_AUTH_ALL', False) app.config.setdefault('FLASK_AUTH_REALM', 'Login Required') # Default set to bad file to trigger IOError app.config.setdefault(...
python
def init_app(self, app): """ Find and configure the user database from specified file """ app.config.setdefault('FLASK_AUTH_ALL', False) app.config.setdefault('FLASK_AUTH_REALM', 'Login Required') # Default set to bad file to trigger IOError app.config.setdefault(...
[ "def", "init_app", "(", "self", ",", "app", ")", ":", "app", ".", "config", ".", "setdefault", "(", "'FLASK_AUTH_ALL'", ",", "False", ")", "app", ".", "config", ".", "setdefault", "(", "'FLASK_AUTH_REALM'", ",", "'Login Required'", ")", "# Default set to bad f...
Find and configure the user database from specified file
[ "Find", "and", "configure", "the", "user", "database", "from", "specified", "file" ]
db6fe596dd167f33aeb3d77e975c861d0534cecf
https://github.com/carsongee/flask-htpasswd/blob/db6fe596dd167f33aeb3d77e975c861d0534cecf/flask_htpasswd.py#L30-L58
54,858
carsongee/flask-htpasswd
flask_htpasswd.py
HtPasswdAuth.get_hashhash
def get_hashhash(self, username): """ Generate a digest of the htpasswd hash """ return hashlib.sha256( self.users.get_hash(username) ).hexdigest()
python
def get_hashhash(self, username): """ Generate a digest of the htpasswd hash """ return hashlib.sha256( self.users.get_hash(username) ).hexdigest()
[ "def", "get_hashhash", "(", "self", ",", "username", ")", ":", "return", "hashlib", ".", "sha256", "(", "self", ".", "users", ".", "get_hash", "(", "username", ")", ")", ".", "hexdigest", "(", ")" ]
Generate a digest of the htpasswd hash
[ "Generate", "a", "digest", "of", "the", "htpasswd", "hash" ]
db6fe596dd167f33aeb3d77e975c861d0534cecf
https://github.com/carsongee/flask-htpasswd/blob/db6fe596dd167f33aeb3d77e975c861d0534cecf/flask_htpasswd.py#L99-L105
54,859
carsongee/flask-htpasswd
flask_htpasswd.py
HtPasswdAuth.generate_token
def generate_token(self, username): """ assumes user exists in htpasswd file. Return the token for the given user by signing a token of the username and a hash of the htpasswd string. """ serializer = self.get_signature() return serializer.dumps( { ...
python
def generate_token(self, username): """ assumes user exists in htpasswd file. Return the token for the given user by signing a token of the username and a hash of the htpasswd string. """ serializer = self.get_signature() return serializer.dumps( { ...
[ "def", "generate_token", "(", "self", ",", "username", ")", ":", "serializer", "=", "self", ".", "get_signature", "(", ")", "return", "serializer", ".", "dumps", "(", "{", "'username'", ":", "username", ",", "'hashhash'", ":", "self", ".", "get_hashhash", ...
assumes user exists in htpasswd file. Return the token for the given user by signing a token of the username and a hash of the htpasswd string.
[ "assumes", "user", "exists", "in", "htpasswd", "file", "." ]
db6fe596dd167f33aeb3d77e975c861d0534cecf
https://github.com/carsongee/flask-htpasswd/blob/db6fe596dd167f33aeb3d77e975c861d0534cecf/flask_htpasswd.py#L107-L120
54,860
carsongee/flask-htpasswd
flask_htpasswd.py
HtPasswdAuth.check_token_auth
def check_token_auth(self, token): """ Check to see who this is and if their token gets them into the system. """ serializer = self.get_signature() try: data = serializer.loads(token) except BadSignature: log.warning('Received bad token si...
python
def check_token_auth(self, token): """ Check to see who this is and if their token gets them into the system. """ serializer = self.get_signature() try: data = serializer.loads(token) except BadSignature: log.warning('Received bad token si...
[ "def", "check_token_auth", "(", "self", ",", "token", ")", ":", "serializer", "=", "self", ".", "get_signature", "(", ")", "try", ":", "data", "=", "serializer", ".", "loads", "(", "token", ")", "except", "BadSignature", ":", "log", ".", "warning", "(", ...
Check to see who this is and if their token gets them into the system.
[ "Check", "to", "see", "who", "this", "is", "and", "if", "their", "token", "gets", "them", "into", "the", "system", "." ]
db6fe596dd167f33aeb3d77e975c861d0534cecf
https://github.com/carsongee/flask-htpasswd/blob/db6fe596dd167f33aeb3d77e975c861d0534cecf/flask_htpasswd.py#L122-L147
54,861
carsongee/flask-htpasswd
flask_htpasswd.py
HtPasswdAuth.authenticate
def authenticate(self): """Authenticate user by any means and return either true or false. Args: Returns: tuple (is_valid, username): True is valid user, False if not """ basic_auth = request.authorization is_valid = False user = None if basi...
python
def authenticate(self): """Authenticate user by any means and return either true or false. Args: Returns: tuple (is_valid, username): True is valid user, False if not """ basic_auth = request.authorization is_valid = False user = None if basi...
[ "def", "authenticate", "(", "self", ")", ":", "basic_auth", "=", "request", ".", "authorization", "is_valid", "=", "False", "user", "=", "None", "if", "basic_auth", ":", "is_valid", ",", "user", "=", "self", ".", "check_basic_auth", "(", "basic_auth", ".", ...
Authenticate user by any means and return either true or false. Args: Returns: tuple (is_valid, username): True is valid user, False if not
[ "Authenticate", "user", "by", "any", "means", "and", "return", "either", "true", "or", "false", "." ]
db6fe596dd167f33aeb3d77e975c861d0534cecf
https://github.com/carsongee/flask-htpasswd/blob/db6fe596dd167f33aeb3d77e975c861d0534cecf/flask_htpasswd.py#L163-L192
54,862
carsongee/flask-htpasswd
flask_htpasswd.py
HtPasswdAuth.required
def required(self, func): """ Decorator function with basic and token authentication handler """ @wraps(func) def decorated(*args, **kwargs): """ Actual wrapper to run the auth checks. """ is_valid, user = self.authenticate() ...
python
def required(self, func): """ Decorator function with basic and token authentication handler """ @wraps(func) def decorated(*args, **kwargs): """ Actual wrapper to run the auth checks. """ is_valid, user = self.authenticate() ...
[ "def", "required", "(", "self", ",", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "decorated", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"\n Actual wrapper to run the auth checks.\n \"\"\"", "is_valid", ",", "us...
Decorator function with basic and token authentication handler
[ "Decorator", "function", "with", "basic", "and", "token", "authentication", "handler" ]
db6fe596dd167f33aeb3d77e975c861d0534cecf
https://github.com/carsongee/flask-htpasswd/blob/db6fe596dd167f33aeb3d77e975c861d0534cecf/flask_htpasswd.py#L194-L208
54,863
CivicSpleen/ambry
ambry/identity.py
Name.source_path
def source_path(self): """The name in a form suitable for use in a filesystem. Excludes the revision """ # Need to do this to ensure the function produces the # bundle path when called from subclasses names = [k for k, _, _ in self._name_parts] parts = [self.so...
python
def source_path(self): """The name in a form suitable for use in a filesystem. Excludes the revision """ # Need to do this to ensure the function produces the # bundle path when called from subclasses names = [k for k, _, _ in self._name_parts] parts = [self.so...
[ "def", "source_path", "(", "self", ")", ":", "# Need to do this to ensure the function produces the", "# bundle path when called from subclasses", "names", "=", "[", "k", "for", "k", ",", "_", ",", "_", "in", "self", ".", "_name_parts", "]", "parts", "=", "[", "se...
The name in a form suitable for use in a filesystem. Excludes the revision
[ "The", "name", "in", "a", "form", "suitable", "for", "use", "in", "a", "filesystem", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L239-L257
54,864
CivicSpleen/ambry
ambry/identity.py
Name.cache_key
def cache_key(self): """The name in a form suitable for use as a cache-key""" try: return self.path except TypeError: raise TypeError("self.path is invalild: '{}', '{}'".format(str(self.path), type(self.path)))
python
def cache_key(self): """The name in a form suitable for use as a cache-key""" try: return self.path except TypeError: raise TypeError("self.path is invalild: '{}', '{}'".format(str(self.path), type(self.path)))
[ "def", "cache_key", "(", "self", ")", ":", "try", ":", "return", "self", ".", "path", "except", "TypeError", ":", "raise", "TypeError", "(", "\"self.path is invalild: '{}', '{}'\"", ".", "format", "(", "str", "(", "self", ".", "path", ")", ",", "type", "("...
The name in a form suitable for use as a cache-key
[ "The", "name", "in", "a", "form", "suitable", "for", "use", "as", "a", "cache", "-", "key" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L260-L265
54,865
CivicSpleen/ambry
ambry/identity.py
Name.ver
def ver(self, revision): """Clone and change the version.""" c = self.clone() c.version = self._parse_version(self.version) return c
python
def ver(self, revision): """Clone and change the version.""" c = self.clone() c.version = self._parse_version(self.version) return c
[ "def", "ver", "(", "self", ",", "revision", ")", ":", "c", "=", "self", ".", "clone", "(", ")", "c", ".", "version", "=", "self", ".", "_parse_version", "(", "self", ".", "version", ")", "return", "c" ]
Clone and change the version.
[ "Clone", "and", "change", "the", "version", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L270-L277
54,866
CivicSpleen/ambry
ambry/identity.py
Name.as_partition
def as_partition(self, **kwargs): """Return a PartitionName based on this name.""" return PartitionName(**dict(list(self.dict.items()) + list(kwargs.items())))
python
def as_partition(self, **kwargs): """Return a PartitionName based on this name.""" return PartitionName(**dict(list(self.dict.items()) + list(kwargs.items())))
[ "def", "as_partition", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "PartitionName", "(", "*", "*", "dict", "(", "list", "(", "self", ".", "dict", ".", "items", "(", ")", ")", "+", "list", "(", "kwargs", ".", "items", "(", ")", ")", ...
Return a PartitionName based on this name.
[ "Return", "a", "PartitionName", "based", "on", "this", "name", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L328-L331
54,867
CivicSpleen/ambry
ambry/identity.py
PartialPartitionName.promote
def promote(self, name): """Promote to a PartitionName by combining with a bundle Name.""" return PartitionName(**dict(list(name.dict.items()) + list(self.dict.items())))
python
def promote(self, name): """Promote to a PartitionName by combining with a bundle Name.""" return PartitionName(**dict(list(name.dict.items()) + list(self.dict.items())))
[ "def", "promote", "(", "self", ",", "name", ")", ":", "return", "PartitionName", "(", "*", "*", "dict", "(", "list", "(", "name", ".", "dict", ".", "items", "(", ")", ")", "+", "list", "(", "self", ".", "dict", ".", "items", "(", ")", ")", ")",...
Promote to a PartitionName by combining with a bundle Name.
[ "Promote", "to", "a", "PartitionName", "by", "combining", "with", "a", "bundle", "Name", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L363-L365
54,868
CivicSpleen/ambry
ambry/identity.py
PartitionName.path
def path(self): """The path of the bundle source. Includes the revision. """ # Need to do this to ensure the function produces the # bundle path when called from subclasses names = [k for k, _, _ in Name._name_parts] return os.path.join(self.source, ...
python
def path(self): """The path of the bundle source. Includes the revision. """ # Need to do this to ensure the function produces the # bundle path when called from subclasses names = [k for k, _, _ in Name._name_parts] return os.path.join(self.source, ...
[ "def", "path", "(", "self", ")", ":", "# Need to do this to ensure the function produces the", "# bundle path when called from subclasses", "names", "=", "[", "k", "for", "k", ",", "_", ",", "_", "in", "Name", ".", "_name_parts", "]", "return", "os", ".", "path", ...
The path of the bundle source. Includes the revision.
[ "The", "path", "of", "the", "bundle", "source", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L438-L452
54,869
CivicSpleen/ambry
ambry/identity.py
PartitionName.sub_path
def sub_path(self): """The path of the partition source, excluding the bundle path parts. Includes the revision. """ try: return os.path.join(*(self._local_parts())) except TypeError as e: raise TypeError( "Path failed for partition {} :...
python
def sub_path(self): """The path of the partition source, excluding the bundle path parts. Includes the revision. """ try: return os.path.join(*(self._local_parts())) except TypeError as e: raise TypeError( "Path failed for partition {} :...
[ "def", "sub_path", "(", "self", ")", ":", "try", ":", "return", "os", ".", "path", ".", "join", "(", "*", "(", "self", ".", "_local_parts", "(", ")", ")", ")", "except", "TypeError", "as", "e", ":", "raise", "TypeError", "(", "\"Path failed for partiti...
The path of the partition source, excluding the bundle path parts. Includes the revision.
[ "The", "path", "of", "the", "partition", "source", "excluding", "the", "bundle", "path", "parts", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L459-L472
54,870
CivicSpleen/ambry
ambry/identity.py
PartitionName.partital_dict
def partital_dict(self, with_name=True): """Returns the name as a dict, but with only the items that are particular to a PartitionName.""" d = self._dict(with_name=False) d = {k: d.get(k) for k, _, _ in PartialPartitionName._name_parts if d.get(k, False)} if 'format' in d and ...
python
def partital_dict(self, with_name=True): """Returns the name as a dict, but with only the items that are particular to a PartitionName.""" d = self._dict(with_name=False) d = {k: d.get(k) for k, _, _ in PartialPartitionName._name_parts if d.get(k, False)} if 'format' in d and ...
[ "def", "partital_dict", "(", "self", ",", "with_name", "=", "True", ")", ":", "d", "=", "self", ".", "_dict", "(", "with_name", "=", "False", ")", "d", "=", "{", "k", ":", "d", ".", "get", "(", "k", ")", "for", "k", ",", "_", ",", "_", "in", ...
Returns the name as a dict, but with only the items that are particular to a PartitionName.
[ "Returns", "the", "name", "as", "a", "dict", "but", "with", "only", "the", "items", "that", "are", "particular", "to", "a", "PartitionName", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L496-L509
54,871
CivicSpleen/ambry
ambry/identity.py
ObjectNumber.base62_encode
def base62_encode(cls, num): """Encode a number in Base X. `num`: The number to encode `alphabet`: The alphabet to use for encoding Stolen from: http://stackoverflow.com/a/1119769/1144479 """ alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" ...
python
def base62_encode(cls, num): """Encode a number in Base X. `num`: The number to encode `alphabet`: The alphabet to use for encoding Stolen from: http://stackoverflow.com/a/1119769/1144479 """ alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" ...
[ "def", "base62_encode", "(", "cls", ",", "num", ")", ":", "alphabet", "=", "\"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"", "if", "num", "==", "0", ":", "return", "alphabet", "[", "0", "]", "arr", "=", "[", "]", "base", "=", "len", "(", ...
Encode a number in Base X. `num`: The number to encode `alphabet`: The alphabet to use for encoding Stolen from: http://stackoverflow.com/a/1119769/1144479
[ "Encode", "a", "number", "in", "Base", "X", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L829-L849
54,872
CivicSpleen/ambry
ambry/identity.py
ObjectNumber.base62_decode
def base62_decode(cls, string): """Decode a Base X encoded string into the number. Arguments: - `string`: The encoded string - `alphabet`: The alphabet to use for encoding Stolen from: http://stackoverflow.com/a/1119769/1144479 """ alphabet = "0123456789abcdefg...
python
def base62_decode(cls, string): """Decode a Base X encoded string into the number. Arguments: - `string`: The encoded string - `alphabet`: The alphabet to use for encoding Stolen from: http://stackoverflow.com/a/1119769/1144479 """ alphabet = "0123456789abcdefg...
[ "def", "base62_decode", "(", "cls", ",", "string", ")", ":", "alphabet", "=", "\"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"", "base", "=", "len", "(", "alphabet", ")", "strlen", "=", "len", "(", "string", ")", "num", "=", "0", "idx", "=", ...
Decode a Base X encoded string into the number. Arguments: - `string`: The encoded string - `alphabet`: The alphabet to use for encoding Stolen from: http://stackoverflow.com/a/1119769/1144479
[ "Decode", "a", "Base", "X", "encoded", "string", "into", "the", "number", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L852-L878
54,873
CivicSpleen/ambry
ambry/identity.py
ObjectNumber.increment
def increment(cls, v): """Increment the version number of an object number of object number string""" if not isinstance(v, ObjectNumber): v = ObjectNumber.parse(v) return v.rev(v.revision+1)
python
def increment(cls, v): """Increment the version number of an object number of object number string""" if not isinstance(v, ObjectNumber): v = ObjectNumber.parse(v) return v.rev(v.revision+1)
[ "def", "increment", "(", "cls", ",", "v", ")", ":", "if", "not", "isinstance", "(", "v", ",", "ObjectNumber", ")", ":", "v", "=", "ObjectNumber", ".", "parse", "(", "v", ")", "return", "v", ".", "rev", "(", "v", ".", "revision", "+", "1", ")" ]
Increment the version number of an object number of object number string
[ "Increment", "the", "version", "number", "of", "an", "object", "number", "of", "object", "number", "string" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L881-L886
54,874
CivicSpleen/ambry
ambry/identity.py
ObjectNumber.rev
def rev(self, i): """Return a clone with a different revision.""" on = copy(self) on.revision = i return on
python
def rev(self, i): """Return a clone with a different revision.""" on = copy(self) on.revision = i return on
[ "def", "rev", "(", "self", ",", "i", ")", ":", "on", "=", "copy", "(", "self", ")", "on", ".", "revision", "=", "i", "return", "on" ]
Return a clone with a different revision.
[ "Return", "a", "clone", "with", "a", "different", "revision", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L889-L893
54,875
CivicSpleen/ambry
ambry/identity.py
TopNumber.from_hex
def from_hex(cls, h, space, assignment_class='self'): """Produce a TopNumber, with a length to match the given assignment class, based on an input hex string. This can be used to create TopNumbers from a hash of a string. """ from math import log # Use the ln(N)/ln(ba...
python
def from_hex(cls, h, space, assignment_class='self'): """Produce a TopNumber, with a length to match the given assignment class, based on an input hex string. This can be used to create TopNumbers from a hash of a string. """ from math import log # Use the ln(N)/ln(ba...
[ "def", "from_hex", "(", "cls", ",", "h", ",", "space", ",", "assignment_class", "=", "'self'", ")", ":", "from", "math", "import", "log", "# Use the ln(N)/ln(base) trick to find the right number of hext digits", "# to use", "hex_digits", "=", "int", "(", "round", "...
Produce a TopNumber, with a length to match the given assignment class, based on an input hex string. This can be used to create TopNumbers from a hash of a string.
[ "Produce", "a", "TopNumber", "with", "a", "length", "to", "match", "the", "given", "assignment", "class", "based", "on", "an", "input", "hex", "string", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L941-L959
54,876
CivicSpleen/ambry
ambry/identity.py
TopNumber.from_string
def from_string(cls, s, space): """Produce a TopNumber by hashing a string.""" import hashlib hs = hashlib.sha1(s).hexdigest() return cls.from_hex(hs, space)
python
def from_string(cls, s, space): """Produce a TopNumber by hashing a string.""" import hashlib hs = hashlib.sha1(s).hexdigest() return cls.from_hex(hs, space)
[ "def", "from_string", "(", "cls", ",", "s", ",", "space", ")", ":", "import", "hashlib", "hs", "=", "hashlib", ".", "sha1", "(", "s", ")", ".", "hexdigest", "(", ")", "return", "cls", ".", "from_hex", "(", "hs", ",", "space", ")" ]
Produce a TopNumber by hashing a string.
[ "Produce", "a", "TopNumber", "by", "hashing", "a", "string", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L962-L969
54,877
CivicSpleen/ambry
ambry/identity.py
Identity.classify
def classify(cls, o): """Break an Identity name into parts, or describe the type of other forms. Break a name or object number into parts and classify them. Returns a named tuple that indicates which parts of input string are name components, object number and version number. Do...
python
def classify(cls, o): """Break an Identity name into parts, or describe the type of other forms. Break a name or object number into parts and classify them. Returns a named tuple that indicates which parts of input string are name components, object number and version number. Do...
[ "def", "classify", "(", "cls", ",", "o", ")", ":", "# from collections import namedtuple", "s", "=", "str", "(", "o", ")", "if", "o", "is", "None", ":", "raise", "ValueError", "(", "\"Input cannot be None\"", ")", "class", "IdentityParts", "(", "object", ")"...
Break an Identity name into parts, or describe the type of other forms. Break a name or object number into parts and classify them. Returns a named tuple that indicates which parts of input string are name components, object number and version number. Does not completely parse the name ...
[ "Break", "an", "Identity", "name", "into", "parts", "or", "describe", "the", "type", "of", "other", "forms", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L1332-L1423
54,878
CivicSpleen/ambry
ambry/identity.py
Identity.to_meta
def to_meta(self, md5=None, file=None): """Return a dictionary of metadata, for use in the Remote api.""" # from collections import OrderedDict if not md5: if not file: raise ValueError('Must specify either file or md5') md5 = md5_for_file(file) ...
python
def to_meta(self, md5=None, file=None): """Return a dictionary of metadata, for use in the Remote api.""" # from collections import OrderedDict if not md5: if not file: raise ValueError('Must specify either file or md5') md5 = md5_for_file(file) ...
[ "def", "to_meta", "(", "self", ",", "md5", "=", "None", ",", "file", "=", "None", ")", ":", "# from collections import OrderedDict", "if", "not", "md5", ":", "if", "not", "file", ":", "raise", "ValueError", "(", "'Must specify either file or md5'", ")", "md5",...
Return a dictionary of metadata, for use in the Remote api.
[ "Return", "a", "dictionary", "of", "metadata", "for", "use", "in", "the", "Remote", "api", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L1425-L1446
54,879
CivicSpleen/ambry
ambry/identity.py
Identity.names_dict
def names_dict(self): """A dictionary with only the generated names, name, vname and fqname.""" INCLUDE_KEYS = ['name', 'vname', 'vid'] d = {k: v for k, v in iteritems(self.dict) if k in INCLUDE_KEYS} d['fqname'] = self.fqname return d
python
def names_dict(self): """A dictionary with only the generated names, name, vname and fqname.""" INCLUDE_KEYS = ['name', 'vname', 'vid'] d = {k: v for k, v in iteritems(self.dict) if k in INCLUDE_KEYS} d['fqname'] = self.fqname return d
[ "def", "names_dict", "(", "self", ")", ":", "INCLUDE_KEYS", "=", "[", "'name'", ",", "'vname'", ",", "'vid'", "]", "d", "=", "{", "k", ":", "v", "for", "k", ",", "v", "in", "iteritems", "(", "self", ".", "dict", ")", "if", "k", "in", "INCLUDE_KEY...
A dictionary with only the generated names, name, vname and fqname.
[ "A", "dictionary", "with", "only", "the", "generated", "names", "name", "vname", "and", "fqname", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L1557-L1565
54,880
CivicSpleen/ambry
ambry/identity.py
Identity.ident_dict
def ident_dict(self): """A dictionary with only the items required to specify the identy, excluding the generated names, name, vname and fqname.""" SKIP_KEYS = ['name','vname','fqname','vid','cache_key'] return {k: v for k, v in iteritems(self.dict) if k not in SKIP_KEYS}
python
def ident_dict(self): """A dictionary with only the items required to specify the identy, excluding the generated names, name, vname and fqname.""" SKIP_KEYS = ['name','vname','fqname','vid','cache_key'] return {k: v for k, v in iteritems(self.dict) if k not in SKIP_KEYS}
[ "def", "ident_dict", "(", "self", ")", ":", "SKIP_KEYS", "=", "[", "'name'", ",", "'vname'", ",", "'fqname'", ",", "'vid'", ",", "'cache_key'", "]", "return", "{", "k", ":", "v", "for", "k", ",", "v", "in", "iteritems", "(", "self", ".", "dict", ")...
A dictionary with only the items required to specify the identy, excluding the generated names, name, vname and fqname.
[ "A", "dictionary", "with", "only", "the", "items", "required", "to", "specify", "the", "identy", "excluding", "the", "generated", "names", "name", "vname", "and", "fqname", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L1568-L1573
54,881
CivicSpleen/ambry
ambry/identity.py
Identity.as_partition
def as_partition(self, partition=0, **kwargs): """Return a new PartitionIdentity based on this Identity. :param partition: Integer partition number for PartitionObjectNumber :param kwargs: """ assert isinstance(self._name, Name), "Wrong type: {}".format(type(self._name)) ...
python
def as_partition(self, partition=0, **kwargs): """Return a new PartitionIdentity based on this Identity. :param partition: Integer partition number for PartitionObjectNumber :param kwargs: """ assert isinstance(self._name, Name), "Wrong type: {}".format(type(self._name)) ...
[ "def", "as_partition", "(", "self", ",", "partition", "=", "0", ",", "*", "*", "kwargs", ")", ":", "assert", "isinstance", "(", "self", ".", "_name", ",", "Name", ")", ",", "\"Wrong type: {}\"", ".", "format", "(", "type", "(", "self", ".", "_name", ...
Return a new PartitionIdentity based on this Identity. :param partition: Integer partition number for PartitionObjectNumber :param kwargs:
[ "Return", "a", "new", "PartitionIdentity", "based", "on", "this", "Identity", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L1581-L1595
54,882
CivicSpleen/ambry
ambry/identity.py
Identity.partition
def partition(self): """Convenience function for accessing the first partition in the partitions list, when there is only one.""" if not self.partitions: return None if len(self.partitions) > 1: raise ValueError( "Can't use this method when there...
python
def partition(self): """Convenience function for accessing the first partition in the partitions list, when there is only one.""" if not self.partitions: return None if len(self.partitions) > 1: raise ValueError( "Can't use this method when there...
[ "def", "partition", "(", "self", ")", ":", "if", "not", "self", ".", "partitions", ":", "return", "None", "if", "len", "(", "self", ".", "partitions", ")", ">", "1", ":", "raise", "ValueError", "(", "\"Can't use this method when there is more than one partition\...
Convenience function for accessing the first partition in the partitions list, when there is only one.
[ "Convenience", "function", "for", "accessing", "the", "first", "partition", "in", "the", "partitions", "list", "when", "there", "is", "only", "one", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L1616-L1627
54,883
CivicSpleen/ambry
ambry/identity.py
Identity.rev
def rev(self, rev): """Return a new identity with the given revision""" d = self.dict d['revision'] = rev return self.from_dict(d)
python
def rev(self, rev): """Return a new identity with the given revision""" d = self.dict d['revision'] = rev return self.from_dict(d)
[ "def", "rev", "(", "self", ",", "rev", ")", ":", "d", "=", "self", ".", "dict", "d", "[", "'revision'", "]", "=", "rev", "return", "self", ".", "from_dict", "(", "d", ")" ]
Return a new identity with the given revision
[ "Return", "a", "new", "identity", "with", "the", "given", "revision" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L1629-L1633
54,884
CivicSpleen/ambry
ambry/identity.py
Identity._info
def _info(self): """Returns an OrderedDict of information, for human display.""" d = OrderedDict() d['vid'] = self.vid d['sname'] = self.sname d['vname'] = self.vname return d
python
def _info(self): """Returns an OrderedDict of information, for human display.""" d = OrderedDict() d['vid'] = self.vid d['sname'] = self.sname d['vname'] = self.vname return d
[ "def", "_info", "(", "self", ")", ":", "d", "=", "OrderedDict", "(", ")", "d", "[", "'vid'", "]", "=", "self", ".", "vid", "d", "[", "'sname'", "]", "=", "self", ".", "sname", "d", "[", "'vname'", "]", "=", "self", ".", "vname", "return", "d" ]
Returns an OrderedDict of information, for human display.
[ "Returns", "an", "OrderedDict", "of", "information", "for", "human", "display", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L1638-L1646
54,885
CivicSpleen/ambry
ambry/identity.py
PartitionIdentity.from_dict
def from_dict(cls, d): """Like Identity.from_dict, but will cast the class type based on the format. i.e. if the format is hdf, return an HdfPartitionIdentity. :param d: :return: """ name = PartitionIdentity._name_class(**d) if 'id' in d and 'revision' in d: ...
python
def from_dict(cls, d): """Like Identity.from_dict, but will cast the class type based on the format. i.e. if the format is hdf, return an HdfPartitionIdentity. :param d: :return: """ name = PartitionIdentity._name_class(**d) if 'id' in d and 'revision' in d: ...
[ "def", "from_dict", "(", "cls", ",", "d", ")", ":", "name", "=", "PartitionIdentity", ".", "_name_class", "(", "*", "*", "d", ")", "if", "'id'", "in", "d", "and", "'revision'", "in", "d", ":", "# The vid should be constructed from the id and the revision", "on...
Like Identity.from_dict, but will cast the class type based on the format. i.e. if the format is hdf, return an HdfPartitionIdentity. :param d: :return:
[ "Like", "Identity", ".", "from_dict", "but", "will", "cast", "the", "class", "type", "based", "on", "the", "format", ".", "i", ".", "e", ".", "if", "the", "format", "is", "hdf", "return", "an", "HdfPartitionIdentity", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L1669-L1694
54,886
CivicSpleen/ambry
ambry/identity.py
PartitionIdentity.as_dataset
def as_dataset(self): """Convert this identity to the identity of the corresponding dataset.""" on = self.on.dataset on.revision = self.on.revision name = Name(**self.name.dict) return Identity(name, on)
python
def as_dataset(self): """Convert this identity to the identity of the corresponding dataset.""" on = self.on.dataset on.revision = self.on.revision name = Name(**self.name.dict) return Identity(name, on)
[ "def", "as_dataset", "(", "self", ")", ":", "on", "=", "self", ".", "on", ".", "dataset", "on", ".", "revision", "=", "self", ".", "on", ".", "revision", "name", "=", "Name", "(", "*", "*", "self", ".", "name", ".", "dict", ")", "return", "Identi...
Convert this identity to the identity of the corresponding dataset.
[ "Convert", "this", "identity", "to", "the", "identity", "of", "the", "corresponding", "dataset", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L1700-L1710
54,887
CivicSpleen/ambry
ambry/identity.py
NumberServer.sleep
def sleep(self): """Wait for the sleep time of the last response, to avoid being rate limited.""" if self.next_time and time.time() < self.next_time: time.sleep(self.next_time - time.time())
python
def sleep(self): """Wait for the sleep time of the last response, to avoid being rate limited.""" if self.next_time and time.time() < self.next_time: time.sleep(self.next_time - time.time())
[ "def", "sleep", "(", "self", ")", ":", "if", "self", ".", "next_time", "and", "time", ".", "time", "(", ")", "<", "self", ".", "next_time", ":", "time", ".", "sleep", "(", "self", ".", "next_time", "-", "time", ".", "time", "(", ")", ")" ]
Wait for the sleep time of the last response, to avoid being rate limited.
[ "Wait", "for", "the", "sleep", "time", "of", "the", "last", "response", "to", "avoid", "being", "rate", "limited", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/identity.py#L1798-L1803
54,888
CivicSpleen/ambry
ambry/cli/root.py
root_sync
def root_sync(args, l, config): """Sync with the remote. For more options, use library sync """ from requests.exceptions import ConnectionError all_remote_names = [ r.short_name for r in l.remotes ] if args.all: remotes = all_remote_names else: remotes = args.refs prt("Syn...
python
def root_sync(args, l, config): """Sync with the remote. For more options, use library sync """ from requests.exceptions import ConnectionError all_remote_names = [ r.short_name for r in l.remotes ] if args.all: remotes = all_remote_names else: remotes = args.refs prt("Syn...
[ "def", "root_sync", "(", "args", ",", "l", ",", "config", ")", ":", "from", "requests", ".", "exceptions", "import", "ConnectionError", "all_remote_names", "=", "[", "r", ".", "short_name", "for", "r", "in", "l", ".", "remotes", "]", "if", "args", ".", ...
Sync with the remote. For more options, use library sync
[ "Sync", "with", "the", "remote", ".", "For", "more", "options", "use", "library", "sync" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/cli/root.py#L267-L300
54,889
CivicSpleen/ambry
ambry/bundle/bundle.py
_CaptureException
def _CaptureException(f, *args, **kwargs): """Decorator implementation for capturing exceptions.""" from ambry.dbexceptions import LoggedException b = args[0] # The 'self' argument try: return f(*args, **kwargs) except Exception as e: raise try: b.set_error_sta...
python
def _CaptureException(f, *args, **kwargs): """Decorator implementation for capturing exceptions.""" from ambry.dbexceptions import LoggedException b = args[0] # The 'self' argument try: return f(*args, **kwargs) except Exception as e: raise try: b.set_error_sta...
[ "def", "_CaptureException", "(", "f", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", "ambry", ".", "dbexceptions", "import", "LoggedException", "b", "=", "args", "[", "0", "]", "# The 'self' argument", "try", ":", "return", "f", "(", "*", ...
Decorator implementation for capturing exceptions.
[ "Decorator", "implementation", "for", "capturing", "exceptions", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L31-L53
54,890
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.clear_file_systems
def clear_file_systems(self): """Remove references to build and source file systems, reverting to the defaults""" self._source_url = None self.dataset.config.library.source.url = None self._source_fs = None self._build_url = None self.dataset.config.library.build.url = ...
python
def clear_file_systems(self): """Remove references to build and source file systems, reverting to the defaults""" self._source_url = None self.dataset.config.library.source.url = None self._source_fs = None self._build_url = None self.dataset.config.library.build.url = ...
[ "def", "clear_file_systems", "(", "self", ")", ":", "self", ".", "_source_url", "=", "None", "self", ".", "dataset", ".", "config", ".", "library", ".", "source", ".", "url", "=", "None", "self", ".", "_source_fs", "=", "None", "self", ".", "_build_url",...
Remove references to build and source file systems, reverting to the defaults
[ "Remove", "references", "to", "build", "and", "source", "file", "systems", "reverting", "to", "the", "defaults" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L174-L185
54,891
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.cast_to_subclass
def cast_to_subclass(self): """ Load the bundle file from the database to get the derived bundle class, then return a new bundle built on that class :return: """ self.import_lib() self.load_requirements() try: self.commit() # To ensure the r...
python
def cast_to_subclass(self): """ Load the bundle file from the database to get the derived bundle class, then return a new bundle built on that class :return: """ self.import_lib() self.load_requirements() try: self.commit() # To ensure the r...
[ "def", "cast_to_subclass", "(", "self", ")", ":", "self", ".", "import_lib", "(", ")", "self", ".", "load_requirements", "(", ")", "try", ":", "self", ".", "commit", "(", ")", "# To ensure the rollback() doesn't clear out anything important", "bsf", "=", "self", ...
Load the bundle file from the database to get the derived bundle class, then return a new bundle built on that class :return:
[ "Load", "the", "bundle", "file", "from", "the", "database", "to", "get", "the", "derived", "bundle", "class", "then", "return", "a", "new", "bundle", "built", "on", "that", "class" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L187-L219
54,892
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.load_requirements
def load_requirements(self): """If there are python library requirements set, append the python dir to the path.""" for module_name, pip_name in iteritems(self.metadata.requirements): extant = self.dataset.config.requirements[module_name].url force = (extant and extant ...
python
def load_requirements(self): """If there are python library requirements set, append the python dir to the path.""" for module_name, pip_name in iteritems(self.metadata.requirements): extant = self.dataset.config.requirements[module_name].url force = (extant and extant ...
[ "def", "load_requirements", "(", "self", ")", ":", "for", "module_name", ",", "pip_name", "in", "iteritems", "(", "self", ".", "metadata", ".", "requirements", ")", ":", "extant", "=", "self", ".", "dataset", ".", "config", ".", "requirements", "[", "modul...
If there are python library requirements set, append the python dir to the path.
[ "If", "there", "are", "python", "library", "requirements", "set", "append", "the", "python", "dir", "to", "the", "path", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L225-L239
54,893
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.dep
def dep(self, source_name): """Return a bundle dependency from the sources list :param source_name: Source name. The URL field must be a bundle or partition reference :return: """ from ambry.orm.exc import NotFoundError from ambry.dbexceptions import ConfigurationError ...
python
def dep(self, source_name): """Return a bundle dependency from the sources list :param source_name: Source name. The URL field must be a bundle or partition reference :return: """ from ambry.orm.exc import NotFoundError from ambry.dbexceptions import ConfigurationError ...
[ "def", "dep", "(", "self", ",", "source_name", ")", ":", "from", "ambry", ".", "orm", ".", "exc", "import", "NotFoundError", "from", "ambry", ".", "dbexceptions", "import", "ConfigurationError", "source", "=", "self", ".", "source", "(", "source_name", ")", ...
Return a bundle dependency from the sources list :param source_name: Source name. The URL field must be a bundle or partition reference :return:
[ "Return", "a", "bundle", "dependency", "from", "the", "sources", "list" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L297-L335
54,894
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.documentation
def documentation(self): """Return the documentation, from the documentation.md file, with template substitutions""" # Return the documentation as a scalar term, which has .text() and .html methods to do # metadata substitution using Jinja s = '' rc = self.build_source_files.d...
python
def documentation(self): """Return the documentation, from the documentation.md file, with template substitutions""" # Return the documentation as a scalar term, which has .text() and .html methods to do # metadata substitution using Jinja s = '' rc = self.build_source_files.d...
[ "def", "documentation", "(", "self", ")", ":", "# Return the documentation as a scalar term, which has .text() and .html methods to do", "# metadata substitution using Jinja", "s", "=", "''", "rc", "=", "self", ".", "build_source_files", ".", "documentation", ".", "record_conte...
Return the documentation, from the documentation.md file, with template substitutions
[ "Return", "the", "documentation", "from", "the", "documentation", ".", "md", "file", "with", "template", "substitutions" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L355-L372
54,895
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.progress
def progress(self): """Returned a cached ProcessLogger to record build progress """ if not self._progress: # If won't be building, only use one connection new_connection = False if self._library.read_only else True self._progress = ProcessLogger(self.dataset, self....
python
def progress(self): """Returned a cached ProcessLogger to record build progress """ if not self._progress: # If won't be building, only use one connection new_connection = False if self._library.read_only else True self._progress = ProcessLogger(self.dataset, self....
[ "def", "progress", "(", "self", ")", ":", "if", "not", "self", ".", "_progress", ":", "# If won't be building, only use one connection", "new_connection", "=", "False", "if", "self", ".", "_library", ".", "read_only", "else", "True", "self", ".", "_progress", "=...
Returned a cached ProcessLogger to record build progress
[ "Returned", "a", "cached", "ProcessLogger", "to", "record", "build", "progress" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L375-L385
54,896
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.partition
def partition(self, ref=None, **kwargs): """Return a partition in this bundle for a vid reference or name parts""" from ambry.orm.exc import NotFoundError from sqlalchemy.orm.exc import NoResultFound if not ref and not kwargs: return None if ref: for p i...
python
def partition(self, ref=None, **kwargs): """Return a partition in this bundle for a vid reference or name parts""" from ambry.orm.exc import NotFoundError from sqlalchemy.orm.exc import NoResultFound if not ref and not kwargs: return None if ref: for p i...
[ "def", "partition", "(", "self", ",", "ref", "=", "None", ",", "*", "*", "kwargs", ")", ":", "from", "ambry", ".", "orm", ".", "exc", "import", "NotFoundError", "from", "sqlalchemy", ".", "orm", ".", "exc", "import", "NoResultFound", "if", "not", "ref"...
Return a partition in this bundle for a vid reference or name parts
[ "Return", "a", "partition", "in", "this", "bundle", "for", "a", "vid", "reference", "or", "name", "parts" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L393-L418
54,897
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.partition_by_vid
def partition_by_vid(self, ref): """A much faster way to get partitions, by vid only""" from ambry.orm import Partition p = self.session.query(Partition).filter(Partition.vid == str(ref)).first() if p: return self.wrap_partition(p) else: return None
python
def partition_by_vid(self, ref): """A much faster way to get partitions, by vid only""" from ambry.orm import Partition p = self.session.query(Partition).filter(Partition.vid == str(ref)).first() if p: return self.wrap_partition(p) else: return None
[ "def", "partition_by_vid", "(", "self", ",", "ref", ")", ":", "from", "ambry", ".", "orm", "import", "Partition", "p", "=", "self", ".", "session", ".", "query", "(", "Partition", ")", ".", "filter", "(", "Partition", ".", "vid", "==", "str", "(", "r...
A much faster way to get partitions, by vid only
[ "A", "much", "faster", "way", "to", "get", "partitions", "by", "vid", "only" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L420-L428
54,898
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.sources
def sources(self): """Iterate over downloadable sources""" def set_bundle(s): s._bundle = self return s return list(set_bundle(s) for s in self.dataset.sources)
python
def sources(self): """Iterate over downloadable sources""" def set_bundle(s): s._bundle = self return s return list(set_bundle(s) for s in self.dataset.sources)
[ "def", "sources", "(", "self", ")", ":", "def", "set_bundle", "(", "s", ")", ":", "s", ".", "_bundle", "=", "self", "return", "s", "return", "list", "(", "set_bundle", "(", "s", ")", "for", "s", "in", "self", ".", "dataset", ".", "sources", ")" ]
Iterate over downloadable sources
[ "Iterate", "over", "downloadable", "sources" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L499-L505
54,899
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle._resolve_sources
def _resolve_sources(self, sources, tables, stage=None, predicate=None): """ Determine what sources to run from an input of sources and tables :param sources: A collection of source objects, source names, or source vids :param tables: A collection of table names :param stage: I...
python
def _resolve_sources(self, sources, tables, stage=None, predicate=None): """ Determine what sources to run from an input of sources and tables :param sources: A collection of source objects, source names, or source vids :param tables: A collection of table names :param stage: I...
[ "def", "_resolve_sources", "(", "self", ",", "sources", ",", "tables", ",", "stage", "=", "None", ",", "predicate", "=", "None", ")", ":", "assert", "sources", "is", "None", "or", "tables", "is", "None", "if", "not", "sources", ":", "if", "tables", ":"...
Determine what sources to run from an input of sources and tables :param sources: A collection of source objects, source names, or source vids :param tables: A collection of table names :param stage: If not None, select only sources from this stage :param predicate: If not none, a call...
[ "Determine", "what", "sources", "to", "run", "from", "an", "input", "of", "sources", "and", "tables" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L507-L544