text
stringlengths
0
828
strict (bool): Whether or not to parse the files in strict mode.
Returns:
confpy.core.config.Configuration: The loaded configuration object.
Raises:
MissingRequiredOption: If a required option is not defined in any file.
NamespaceNotRegistered: If a file contains a namespace which is not
defined.
OptionNotRegistered: If a file contains an option which is not defined
but resides under a valid namespace.
UnrecognizedFileExtension: If there is no loader for a path.
""""""
return check_for_missing_options(
config=set_cli_options(
config=set_environment_var_options(
config=configuration_from_paths(
paths=files,
strict=strict,
),
prefix=env_prefix,
),
)
)"
1703,"def buy_product(self, product_pk):
""""""
determina si el customer ha comprado un producto
""""""
if self.invoice_sales.filter(line_invoice_sales__line_order__product__pk=product_pk).exists() \
or self.ticket_sales.filter(line_ticket_sales__line_order__product__pk=product_pk).exists():
return True
else:
return False"
1704,"def template(self):
"""""" Get the template from: YAML or class """"""
# First try props
if self.props.template:
return self.props.template
else:
# Return the wtype of the widget, and we'll presume that,
# like resources, there's a .html file in that directory
return self.wtype"
1705,"def render(self, sphinx_app: Sphinx, context):
"""""" Given a Sphinx builder and context with sphinx_app in it,
generate HTML """"""
# Called from kaybee.plugins.widgets.handlers.render_widgets
builder: StandaloneHTMLBuilder = sphinx_app.builder
resource = sphinx_app.env.resources[self.docname]
context['sphinx_app'] = sphinx_app
context['widget'] = self
context['resource'] = resource
# make_context is optionally implemented on the concrete class
# for each widget
self.make_context(context, sphinx_app)
# NOTE: Can use builder.templates.render_string
template = self.template + '.html'
html = builder.templates.render(template, context)
return html"
1706,"def desc(t=None, reg=True):
""""""
Describe Class Dependency
:param reg: should we register this class as well
:param t: custom type as well
:return:
""""""
def decorated_fn(cls):
if not inspect.isclass(cls):
return NotImplemented('For now we can only describe classes')
name = t or camel_case_to_underscore(cls.__name__)[0]
if reg:
di.injector.register(name, cls)
else:
di.injector.describe(name, cls)
return cls
return decorated_fn"
1707,"def add(self, key, value=None):
""""""
Adds the new key to this enumerated type.
:param key | <str>
""""""
if value is None:
value = 2 ** (len(self))
self[key] = value
setattr(self, key, self[key])
return value"
1708,"def all(self):
""""""
Returns all the values joined together.
:return <int>