text stringlengths 81 112k |
|---|
Can set a parameter to a value that is inconsistent with existing values.
This method sets the inconsistent value and then reapplies all existing values
that are still consistent, all non-consistent (conflicting) values are removed from the object
and returned as a list
:param item: na... |
Resets all parameters to None
def reset_all(self):
"""
Resets all parameters to None
"""
for item in self.inputs:
setattr(self, "_%s" % item, None)
self.stack = [] |
Add a parameter-value pair to the stack of parameters that have been set.
:param item:
:param value:
:return:
def _add_to_stack(self, item, value):
"""
Add a parameter-value pair to the stack of parameters that have been set.
:param item:
:param value:
:r... |
Calculate the shear wave velocity
:param saturated: bool, if true then use saturated mass
:return:
def get_shear_vel(self, saturated):
"""
Calculate the shear wave velocity
:param saturated: bool, if true then use saturated mass
:return:
"""
try:
... |
Volume of water to volume of voids
def saturation(self, value):
"""Volume of water to volume of voids"""
value = clean_float(value)
if value is None:
return
try:
unit_moisture_weight = self.unit_moist_weight - self.unit_dry_weight
unit_moisture_volume... |
Set the relative weight of the solid
def specific_gravity(self, value):
""" Set the relative weight of the solid """
value = clean_float(value)
if value is None:
return
specific_gravity = self._calc_specific_gravity()
if specific_gravity is not None and not ct.isclos... |
Adds a soil to the SoilProfile at a set depth.
Note, the soils are automatically reordered based on depth from surface.
:param depth: depth from surface to top of soil layer
:param soil: Soil object
def add_layer(self, depth, soil):
"""
Adds a soil to the SoilProfile at a set ... |
Sort the layers by depth.
def _sort_layers(self):
"""Sort the layers by depth."""
self._layers = OrderedDict(sorted(self._layers.items(), key=lambda t: t[0])) |
Get the layer height by layer id number.
:param layer_int:
:return: float, height of the soil layer
def layer_height(self, layer_int):
"""
Get the layer height by layer id number.
:param layer_int:
:return: float, height of the soil layer
"""
if layer_i... |
Calculate the equivalent crust cohesion strength according to Karamitros et al. 2013 sett, pg 8 eq. 14
:return: equivalent cohesion [Pa]
def equivalent_crust_cohesion(self):
"""
Calculate the equivalent crust cohesion strength according to Karamitros et al. 2013 sett, pg 8 eq. 14
:ret... |
Determine the vertical total stress at depth z, where z can be a number or an array of numbers.
def get_v_total_stress_at_depth(self, z):
"""
Determine the vertical total stress at depth z, where z can be a number or an array of numbers.
"""
if not hasattr(z, "__len__"):
re... |
Determine the vertical total stress at a single depth z_c.
:param z_c: depth from surface
def one_vertical_total_stress(self, z_c):
"""
Determine the vertical total stress at a single depth z_c.
:param z_c: depth from surface
"""
total_stress = 0.0
depths = sel... |
Determine the vertical effective stress at a single depth z_c.
:param y_c: float, depth from surface
def get_v_eff_stress_at_depth(self, y_c):
"""
Determine the vertical effective stress at a single depth z_c.
:param y_c: float, depth from surface
"""
sigma_v_c = self.... |
Get the shear wave velocity at a depth.
:param y_c: float, depth from surface
:return:
def shear_vel_at_depth(self, y_c):
"""
Get the shear wave velocity at a depth.
:param y_c: float, depth from surface
:return:
"""
sl = self.get_soil_at_depth(y_c)
... |
Build the text of the file and write the file.
def create_package_file(root, master_package, subroot, py_files, opts, subs):
"""Build the text of the file and write the file."""
package = os.path.split(root)[-1]
text = format_heading(1, '%s Package' % package)
# add each package's module
for py_fil... |
Create the module's index.
def create_modules_toc_file(master_package, modules, opts, name='modules'):
"""
Create the module's index.
"""
text = format_heading(1, '%s Modules' % opts.header)
text += '.. toctree::\n'
text += ' :maxdepth: %s\n\n' % opts.maxdepth
modules.sort()
prev_mod... |
Look for every file in the directory tree and create the corresponding
ReST files.
def recurse_tree(path, excludes, opts):
"""
Look for every file in the directory tree and create the corresponding
ReST files.
"""
# use absolute path for root, as relative paths like '../../foo' cause
# 'if ... |
Normalize the excluded directory list:
* must be either an absolute path or start with rootpath,
* otherwise it is joined with rootpath
* with trailing slash
def normalize_excludes(rootpath, excludes):
"""
Normalize the excluded directory list:
* must be either an absolute path or start with ro... |
Check if the directory is in the exclude list.
Note: by having trailing slashes, we avoid common prefix issues, like
e.g. an exlude "foo" also accidentally excluding "foobar".
def is_excluded(root, excludes):
"""
Check if the directory is in the exclude list.
Note: by having trailing slashe... |
Parse and check the command line arguments.
def main():
"""
Parse and check the command line arguments.
"""
parser = optparse.OptionParser(usage="""usage: %prog [options] <package path> [exclude paths, ...]
Note: By default this script will not overwrite already created files.""")
parser.add_optio... |
Return the path to the file, if the ref is a file
def path(self):
"""Return the path to the file, if the ref is a file"""
if not isinstance(self.ref, str):
return None
u = parse_app_url(self.ref)
if u.inner.proto != 'file':
return None
return u.path |
The absolute directory of the document
def doc_dir(self):
"""The absolute directory of the document"""
from os.path import abspath
if not self.ref:
return None
u = parse_app_url(self.ref)
return abspath(dirname(u.path)) |
Only removes top-level terms. Child terms can be removed at the parent.
def remove_term(self, t):
"""Only removes top-level terms. Child terms can be removed at the parent. """
try:
self.terms.remove(t)
except ValueError:
pass
if t.section and t.parent_term_lc ... |
Return a new section
def new_section(self, name, params=None):
"""Return a new section"""
self.sections[name.lower()] = SectionTerm(None, name, term_args=params, doc=self)
# Set the default arguments
s = self.sections[name.lower()]
if name.lower() in self.decl_sections:
... |
Create a new section or return an existing one of the same name
def get_or_new_section(self, name, params=None):
"""Create a new section or return an existing one of the same name"""
if name not in self.sections:
self.sections[name.lower()] = SectionTerm(None, name, term_args=params, doc=se... |
Sort sections according to the section names in the order list. All remaining sections
are added to the end in their original order
:param order: Iterable of section names
:return:
def sort_sections(self, order):
"""
Sort sections according to the section names in the order li... |
Return a list of terms, possibly in a particular section. Use joined term notation, such as 'Root.Name' The kwargs arg is used to set term properties, all of which match returned terms, so ``name='foobar'`` will match terms that have a ``name`` property of ``foobar``
:param term: The type of term to find, in f... |
Return the first term, returning the default if no term is found
def get(self, term, default=None):
"""Return the first term, returning the default if no term is found"""
v = self.find_first(term)
if not v:
return default
else:
return v |
Return the first value, returning the default if no term is found
def get_value(self, term, default=None, section=None):
"""Return the first value, returning the default if no term is found"""
term = self.find_first(term, value=False, section=section)
if term is None:
return defaul... |
Create a builder from a sequence of terms, usually a TermInterpreter
def load_terms(self, terms):
"""Create a builder from a sequence of terms, usually a TermInterpreter"""
#if self.root and len(self.root.children) > 0:
# raise MetatabError("Can't run after adding terms to document.")
... |
Clean up some terms, like ensuring that the name is a slug
def cleanse(self):
"""Clean up some terms, like ensuring that the name is a slug"""
from .util import slugify
self.ensure_identifier()
try:
self.update_name()
except MetatabError:
identifier = ... |
Generate the Root.Name term from DatasetName, Version, Origin, TIme and Space
def update_name(self, force=False, create_term=False, report_unchanged=True):
"""Generate the Root.Name term from DatasetName, Version, Origin, TIme and Space"""
updates = []
self.ensure_identifier()
name_t... |
Iterate, link terms and convert to a dict
def as_dict(self, replace_value_names=True):
"""Iterate, link terms and convert to a dict"""
# This function is a hack, due to confusion between the root of the document, which
# should contain all terms, and the root section, which has only terms that... |
Iterate over all of the rows
def rows(self):
"""Iterate over all of the rows"""
for s_name, s in self.sections.items():
# Yield the section header
if s.name != 'Root':
yield [''] # Unecessary, but makes for nice formatting. Should actually be done just before... |
Iterate over all of the terms. The self.terms property has only root level terms. This iterator
iterates over all terms
def all_terms(self):
"""Iterate over all of the terms. The self.terms property has only root level terms. This iterator
iterates over all terms"""
for s_name, s in se... |
Return a CSV representation as a string
def as_csv(self):
"""Return a CSV representation as a string"""
from io import StringIO
s = StringIO()
w = csv.writer(s)
for row in self.rows:
w.writerow(row)
return s.getvalue() |
Return a Lines representation as a string
def as_lines(self):
"""Return a Lines representation as a string"""
out_lines = []
for t,v in self.lines:
# Make the output prettier
if t == 'Section':
out_lines.append('')
out_lines.append('{}: {}'... |
Defines a class factory creating :class:`QWidgetComponent` classes using given ui file.
:param ui_file: Ui file.
:type ui_file: unicode
:param \*args: Arguments.
:type \*args: \*
:param \*\*kwargs: Keywords arguments.
:type \*\*kwargs: \*\*
:return: QWidgetComponent class.
:rtype: QWidg... |
Remove volume node if it follows a journal logically in the tree hierarchy.
Args:
left (ast.ASTElement): The journal KeywordOp node.
right (ast.ASTElement): The rest of the tree to be restructured.
Return:
(ast.ASTElement): The restructured tree, with the volume node removed.
Note... |
Chain SimpleValueBooleanQuery values into chained AndOp queries with the given current Keyword.
def _convert_simple_value_boolean_query_to_and_boolean_queries(tree, keyword):
"""Chain SimpleValueBooleanQuery values into chained AndOp queries with the given current Keyword."""
def _create_operator_node(value_n... |
Convert BooleanRule into AndOp or OrOp nodes.
def visit_boolean_query(self, node):
"""Convert BooleanRule into AndOp or OrOp nodes."""
left = node.left.accept(self)
right = node.right.accept(self)
is_journal_keyword_op = isinstance(left, KeywordOp) and left.left == Keyword('journal')
... |
Visits only the children of :class:`SimpleValueBooleanQuery` without substituting the actual node type.
Notes:
Defer conversion from :class:`SimpleValueBooleanQuery` to AndOp or OrOp.
This transformation needs to occur higher in the tree, so that we don't lose the information that this ... |
Transform a :class:`SpiresKeywordQuery` into a :class:`KeywordOp`.
Notes:
In case the value being a :class:`SimpleValueBooleanQuery`, the subtree is transformed to chained
:class:`AndOp` queries containing :class:`KeywordOp`, whose keyword is the keyword of the current node and
... |
Transform an :class:`InvenioKeywordQuery` into a :class:`KeywordOp`.
Notes:
In case the value being a :class:`SimpleValueBooleanQuery`, the subtree is transformed to chained
:class:`AndOp` queries containing :class:`KeywordOp`, whose keyword is the keyword of the current node and
... |
Convert :class:`ComplexValue` to one of ExactMatch, PartialMatch and Regex Value nodes.
def visit_complex_value(self, node):
"""Convert :class:`ComplexValue` to one of ExactMatch, PartialMatch and Regex Value nodes."""
if node.value.startswith(ComplexValue.EXACT_VALUE_TOKEN):
value = node.v... |
Simple wrapper around `asyncio.sleep()`.
async def sleep(self, duration: float=0.0) -> None:
'''Simple wrapper around `asyncio.sleep()`.'''
duration = max(0, duration)
if duration > 0:
Log.debug('sleeping task %s for %.1f seconds', self.name, duration)
await asyncio.sle... |
Cancel the task if it hasn't yet started, or tell it to
gracefully stop running if it has.
async def stop(self, force: bool=False) -> None:
'''Cancel the task if it hasn't yet started, or tell it to
gracefully stop running if it has.'''
Log.debug('stopping task %s', self.name)
... |
Recognizes whether the name contains full name parts and not initials or only lastname.
Returns:
bool: True if name has only full name parts, e.g. 'Ellis John', False otherwise. So for example, False is
returned for 'Ellis, J.' or 'Ellis'.
def author_name_contains_fullnames(author_name):
... |
Detects whether the name variation consists only from initials.
def _name_variation_has_only_initials(name):
"""Detects whether the name variation consists only from initials."""
def _is_initial(name_variation):
return len(name_variation) == 1 or u'.' in name_variation
parsed_name = ParsedName.loa... |
Generate a small number of name variations.
Notes:
Unidecodes the name, so that we use its transliterated version, since this is how the field is being indexed.
For names with more than one part, {lastname} x {non lastnames, non lastnames initial} variations.
Additionally, it generates the... |
Decorator for registering handlers that convert text dates to dates.
Args:
date_specifier_patterns (str): the date specifier (in regex pattern format) for which the handler is registered
def register_date_conversion_handler(date_specifier_patterns):
"""Decorator for registering handlers that convert t... |
Truncate wildcard from date parts.
Returns:
(str) The truncated date.
Raises:
ValueError, on either unsupported date separator (currently only ' ' and '-' are supported), or if there's a
wildcard in the year.
Notes:
Either whole date part is wildcard, in which we ignore it... |
Truncates date value (to year only) according to the given date field.
Args:
field (unicode): The field for which the date value will be used to query on.
date_value (str): The date value that is going to be truncated to its year.
Returns:
PartialDate: The possibly truncated date, on s... |
Calculates the next date from the given partial date.
Args:
partial_date (inspire_utils.date.PartialDate): The partial date whose next date should be calculated.
Returns:
PartialDate: The next date from the given partial date.
def _get_next_date_from_partial_date(partial_date):
"""Calcula... |
Returns the proper ES date math unit according to the "resolution" of the partial_date.
Args:
partial_date (PartialDate): The partial date for which the date math unit is.
Returns:
(str): The ES date math unit format.
Notes:
This is needed for supporting range queries on dates, i.... |
Updates (operator, date value) pairs by normalizing the date value according to the given field.
Args:
field (unicode): The fieldname for which the operator-value pairs are being generated.
operator_value_pairs (dict): ES range operator {'gt', 'gte', 'lt', 'lte'} along with a value.
Add... |
Helper for generating a match query.
Args:
field (six.text_type): The ES field to be queried.
value (six.text_type/bool): The value of the query (bool for the case of type-code query ["core: true"]).
with_operator_and (bool): Flag that signifies whether to generate the explicit notation of ... |
Helper for wrapping a list of queries into a bool.{must, should} clause.
Args:
queries (list): List of queries to be wrapped in a bool.{must, should} clause.
use_must_clause (bool): Flag that signifies whether to use 'must' or 'should' clause.
preserve_bool_semantics_if_one_clause (bool): F... |
Helper for wrapping a query into a nested if the fields within the query are nested
Args:
query : The query to be wrapped.
field : The field that is being queried.
nested_fields : List of fields which are nested.
Returns:
(dict): The nested query
def wrap_query_in_nested_if_fie... |
Returns True if the difference between date and any value in dates
is less than or equal to limit.
def is_within_limits(self, limit, date, dates):
"""
Returns True if the difference between date and any value in dates
is less than or equal to limit.
"""
return any((self.... |
Returns a tree representation of a parse tree.
Arguments:
tree: the parse tree whose tree representation is to be generated
verbose (bool): if True prints the parse tree to be formatted
Returns:
str: tree-like representation of the parse tree
def emit_tree_format(tree, verb... |
Calculates an exponential backoff for retry attempts with a small
amount of jitter.
def calculate_retry_delay(attempt, max_delay=300):
"""Calculates an exponential backoff for retry attempts with a small
amount of jitter."""
delay = int(random.uniform(2, 4) ** attempt)
if delay > max_delay:
... |
Drives the whole logic, by parsing, restructuring and finally, generating an ElasticSearch query.
Args:
query_str (six.text_types): the given query to be translated to an ElasticSearch query
Returns:
six.text_types: Return an ElasticSearch query.
Notes:
In case there's an error, a... |
Return a running Task object matching the given name or class.
def task(self, name_or_class: Any) -> Task:
'''Return a running Task object matching the given name or class.'''
if name_or_class in self.all_tasks:
return self.all_tasks[name_or_class]
try:
return self.all... |
Initialize configuration and start tasks.
async def init(self) -> None:
'''Initialize configuration and start tasks.'''
self.stats = await self.insert(self.stats)
self.configuration = await self.insert(self.configuration)
if not self.executor:
try:
max_work... |
Insert the given task class into the Tasky event loop.
async def insert(self, task: Task) -> None:
'''Insert the given task class into the Tasky event loop.'''
if not isinstance(task, Task):
task = task()
if task.name not in self.all_tasks:
task.tasky = self
... |
Execute an arbitrary function outside the event loop using
a shared Executor.
async def execute(self, fn, *args, **kwargs) -> None:
'''Execute an arbitrary function outside the event loop using
a shared Executor.'''
fn = functools.partial(fn, *args, **kwargs)
return await self.... |
Execute the tasky/asyncio event loop until terminated.
def run_forever(self) -> None:
'''Execute the tasky/asyncio event loop until terminated.'''
Log.debug('running event loop until terminated')
asyncio.ensure_future(self.init())
self.loop.run_forever()
self.loop.close() |
Execute the tasky/asyncio event loop until all tasks finish.
def run_until_complete(self) -> None:
'''Execute the tasky/asyncio event loop until all tasks finish.'''
Log.debug('running event loop until all tasks completed')
self.terminate_on_finish = True
asyncio.ensure_future(self.ini... |
Execute the tasky/asyncio event loop for `duration` seconds.
def run_for_time(self, duration: float=10.0) -> None:
'''Execute the tasky/asyncio event loop for `duration` seconds.'''
Log.debug('running event loop for %.1f seconds', duration)
try:
asyncio.ensure_future(self.init())
... |
Stop all scheduled and/or executing tasks, first by asking nicely,
and then by waiting up to `timeout` seconds before forcefully stopping
the asyncio event loop.
def terminate(self, *, force: bool=False, timeout: float=30.0,
step: float=1.0) -> None:
'''Stop all scheduled and/... |
Initialize the task, queue it for execution, add the done callback,
and keep track of it for when tasks need to be stopped.
async def start_task(self, task: Task) -> None:
'''Initialize the task, queue it for execution, add the done callback,
and keep track of it for when tasks need to be stopp... |
Monitor all known tasks for run state. Ensure that enabled tasks
are running, and that disabled tasks are stopped.
async def monitor_tasks(self, interval: float=1.0) -> None:
'''Monitor all known tasks for run state. Ensure that enabled tasks
are running, and that disabled tasks are stopped.'... |
Log unhandled exceptions from anywhere in the event loop.
def exception(self, loop: asyncio.BaseEventLoop, context: dict) -> None:
'''Log unhandled exceptions from anywhere in the event loop.'''
Log.error('unhandled exception: %s', context['message'])
Log.error('%s', context)
if 'excep... |
Handle the user pressing Ctrl-C by stopping tasks nicely at first,
then forcibly upon further presses.
def sigint(self) -> None:
'''Handle the user pressing Ctrl-C by stopping tasks nicely at first,
then forcibly upon further presses.'''
if self.stop_attempts < 1:
Log.info(... |
Handle SIGTERM from the system by stopping tasks gracefully.
Repeated signals will be ignored while waiting for tasks to finish.
def sigterm(self) -> None:
'''Handle SIGTERM from the system by stopping tasks gracefully.
Repeated signals will be ignored while waiting for tasks to finish.'''
... |
Checks if terminal token is a keyword after lower-casing it.
def parse(cls, parser, text, pos):
"""Checks if terminal token is a keyword after lower-casing it."""
match = cls.regex.match(text)
if match:
# Check if match is is not in the grammar of the specific keyword class.
... |
Parse InspireKeyword.
If the keyword is `texkey`, enable the parsing texkey expression flag, since its value contains ':' which
normally isn't allowed.
def parse(cls, parser, text, pos):
"""Parse InspireKeyword.
If the keyword is `texkey`, enable the parsing texkey expression flag, si... |
Parses a terminal token that doesn't contain parentheses nor colon symbol.
Note:
Handles a special case of tokens where a ':' is needed (for `texkey` queries).
If we're parsing text not in parentheses, then some DSL keywords (e.g. And, Or, Not, defined above) should
not be ... |
Imitates parsing a list grammar.
Specifically, this
grammar = [
SimpleValueUnit.date_specifiers_regex,
SimpleValueUnit.arxiv_token_regex,
SimpleValueUnit.token_regex,
SimpleValueUnit.parenthesized_token_grammar
].
Parses plaintext which m... |
Reconstruct input in case of consuming a keyword query or a value query with ComplexValue as value.
Un-consuming at most 3 elements and specifically (Keyword,) Whitespace and ComplexValue, while also
reconstructing parser's input text.
Example:
Given this query "author foo t 'bar'"... |
Using our own parse to enable the flag below.
def parse(cls, parser, text, pos):
"""Using our own parse to enable the flag below."""
try:
parser._parsing_parenthesized_simple_values_expression = True
remaining_text, recognized_tokens = parser.parse(text, cls.grammar)
... |
Generates new fieldnames in case of BAI query.
Args:
node_value (six.text_type): The node's value (i.e. author name).
bai_field_variation (six.text_type): Which field variation to query ('search' or 'raw').
query_bai_field_if_dots_in_name (bool): Whether to query BAI field (... |
Generates a query handling specifically authors.
Notes:
The match query is generic enough to return many results. Then, using the filter clause we truncate these
so that we imitate legacy's behaviour on returning more "exact" results. E.g. Searching for `Smith, John`
shouldn... |
Generates a term query handling authors and BAIs.
Notes:
If given value is a BAI, search for the provided value in the raw field variation of
`ElasticSearchVisitor.AUTHORS_BAI_FIELD`.
Otherwise, the value will be procesed in the same way as the indexed value (i.e. lowercased... |
Helper for generating a date keyword query containing a wildcard.
Returns:
(dict): The date query containing the wildcard or an empty dict in case the date value is malformed.
The policy followed here is quite conservative on what it accepts as valid input. Look into
:meth:`inspire... |
Generate queries for any symbols in the title against the whitespace tokenized field of titles.
Returns:
(dict): The query or queries for the whitespace tokenized field of titles. If none such tokens exist, then
returns an empty dict.
Notes:
Splits the value ... |
Generate type-code queries.
Notes:
If the value of the type-code query exists in `TYPECODE_VALUE_TO_FIELD_AND_VALUE_PAIRS_MAPPING, then we
query the specified field, along with the given value according to the mapping.
See: https://github.com/inspirehep/inspire-query-parser/... |
Generates ElasticSearch range queries.
Args:
fieldnames (list): The fieldnames on which the search is the range query is targeted on,
operator_value_pairs (dict): Contains (range_operator, value) pairs.
The range_operator should be one of those supported by ElasticSearch... |
Generates a query on the ``_all`` field with all the query content.
Args:
data (six.text_type or list): The query in the format of ``six.text_type`` (when used from parsing driver)
or ``list`` when used from withing the ES visitor.
def _generate_malformed_query(data):
"""Ge... |
Transforms the given journal query value (old publication info) to the new one.
Args:
third_journal_field (six.text_type): The final field to be used for populating the old publication info.
old_publication_info_values (six.text_type): The old publication info. It must be one of {only t... |
Generates ElasticSearch nested query(s).
Args:
value (string): Contains the journal_title, journal_volume and artid or start_page separated by a comma.
This value should be of type string.
Notes:
The value contains at least one of the 3 mentioned ite... |
Generates a term query (exact search in ElasticSearch).
def visit_exact_match_value(self, node, fieldnames=None):
"""Generates a term query (exact search in ElasticSearch)."""
if not fieldnames:
fieldnames = ['_all']
else:
fieldnames = force_list(fieldnames)
if ... |
Generates a query which looks for a substring of the node's value in the given fieldname.
def visit_partial_match_value(self, node, fieldnames=None):
"""Generates a query which looks for a substring of the node's value in the given fieldname."""
if ElasticSearchVisitor.KEYWORD_TO_ES_FIELDNAME['date'] =... |
Arguments:
schedule_id {int} -- The schedule to send messages for
def run(self, schedule_id, **kwargs):
"""
Arguments:
schedule_id {int} -- The schedule to send messages for
"""
subscriptions = Subscription.objects.filter(
schedule_id=schedule_id, act... |
Synchronises the schedule specified by the ID `schedule_id` to the
scheduler service.
Arguments:
schedule_id {str} -- The ID of the schedule to sync
def run(self, schedule_id, **kwargs):
"""
Synchronises the schedule specified by the ID `schedule_id` to the
schedule... |
Deactivates the schedule specified by the ID `scheduler_schedule_id` in
the scheduler service.
Arguments:
scheduler_schedule_id {str} -- The ID of the schedule to deactivate
def run(self, scheduler_schedule_id, **kwargs):
"""
Deactivates the schedule specified by the ID `sc... |
Returns the tags for a specific model/content type.
def get_for_model(self, obj):
"""Returns the tags for a specific model/content type."""
qs = Tag.objects.language(get_language())
qs = qs.filter(
tagged_items__content_type=ctype_models.ContentType.objects.get_for_model(obj)) # NO... |
Returns all tags for a whole queryset of objects.
def get_for_queryset(self, obj_queryset):
"""Returns all tags for a whole queryset of objects."""
qs = Tag.objects.language(get_language())
if obj_queryset.count() == 0:
return qs.none()
qs = qs.filter(
tagged_ite... |
Task to ensure subscription is bumped or converted
def post_send_process(context):
"""
Task to ensure subscription is bumped or converted
"""
if "error" in context:
return context
[deserialized_subscription] = serializers.deserialize(
"json", context["subscription"]
)
subsc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.