Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def import_recipe(module, filename):
return SourceFileLoader(module, filename).load_module()
class RecipeMeta(type):
def __new__(cls, name, bases, dct):
if name != 'Recipe':
if 'url' in dct:
dct['_url'] = dct.pop('url')
if 'version' in dct:
dct['_version'] = dct.pop('version')
return super(RecipeMeta, cls).__new__(cls, name, bases, dct)
class Recipe(with_metaclass(RecipeMeta)):
_url = None
'''The address from which the recipe may be downloaded. This is not
essential, it may be omitted if the source is available some other
way, such as via the :class:`IncludedFilesBehaviour` mixin.
If the url includes the version, you may (and probably should)
replace this with ``{version}``, which will automatically be
replaced by the :attr:`version` string during download.
.. note:: Methods marked (internal) are used internally and you
probably don't need to call them, but they are available
if you want.
'''
_version = None
'''A string giving the version of the software the recipe describes,
def import_recipe(module, filename):
return SourceFileLoader(module, filename).load_module()
class RecipeMeta(type):
def __new__(cls, name, bases, dct):
if name != 'Recipe':
if 'url' in dct:
dct['_url'] = dct.pop('url')
if 'version' in dct:
dct['_version'] = dct.pop('version')
return super(RecipeMeta, cls).__new__(cls, name, bases, dct)
class Recipe(with_metaclass(RecipeMeta)):
_url = None
'''The address from which the recipe may be downloaded. This is not
essential, it may be omitted if the source is available some other
way, such as via the :class:`IncludedFilesBehaviour` mixin.
If the url includes the version, you may (and probably should)
replace this with ``{version}``, which will automatically be
replaced by the :attr:`version` string during download.
.. note:: Methods marked (internal) are used internally and you
probably don't need to call them, but they are available
if you want.
'''
_version = None
'''A string giving the version of the software the recipe describes,
def __new__(cls, name, bases, dct):
if name != 'Recipe':
if 'url' in dct:
dct['_url'] = dct.pop('url')
if 'version' in dct:
dct['_version'] = dct.pop('version')
return super(RecipeMeta, cls).__new__(cls, name, bases, dct)
def __new__(cls, name, bases, dct):
if name != 'Recipe':
if 'url' in dct:
dct['_url'] = dct.pop('url')
if 'version' in dct:
dct['_version'] = dct.pop('version')
return super(RecipeMeta, cls).__new__(cls, name, bases, dct)