Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _process_namespace(self, src_zip):
if self.options.get('namespace_tokenize'):
src_zip = zip_tokenize_namespace(src_zip, self.options['namespace_tokenize'], logger=self.logger)
if self.options.get('namespace_inject'):
kwargs = {}
kwargs['unmanaged'] = process_bool_arg(self.options.get('unmanaged', True))
kwargs['namespaced_org'] = process_bool_arg(self.options.get('namespaced_org', False))
kwargs['logger'] = self.logger
src_zip = zip_inject_namespace(src_zip, self.options['namespace_inject'], **kwargs)
if self.options.get('namespace_strip'):
src_zip = zip_strip_namespace(src_zip, self.options['namespace_strip'], logger=self.logger)
return src_zip
)
if dependency.get('namespace_tokenize'):
self.logger.info('Replacing namespace prefix {}__ in files and filenames with namespace token strings'.format(
'{}__'.format(dependency['namespace_tokenize']),
))
package_zip = zip_tokenize_namespace(
package_zip,
namespace = dependency['namespace_tokenize'],
logger = self.logger,
)
if dependency.get('namespace_inject'):
self.logger.info('Replacing namespace tokens with {}'.format(
'{}__'.format(dependency['namespace_inject']),
))
package_zip = zip_inject_namespace(
package_zip,
namespace = dependency['namespace_inject'],
managed = not dependency.get('unmanaged'),
namespaced_org = self.options['namespaced_org'],
logger = self.logger,
)
if dependency.get('namespace_strip'):
self.logger.info('Removing namespace prefix {}__ from all files and filenames'.format(
'{}__'.format(dependency['namespace_strip']),
))
package_zip = zip_strip_namespace(
package_zip,
namespace = dependency['namespace_strip'],
logger = self.logger,
)
if self.options.get('namespace_inject'):
kwargs = {}
kwargs['managed'] = not process_bool_arg(self.options.get('unmanaged', True))
kwargs['namespaced_org'] = process_bool_arg(self.options.get('namespaced_org', False))
kwargs['logger'] = self.logger
if kwargs['managed']:
self.logger.info(
'Replacing namespace tokens from metadata with namespace prefix {}__'.format(
self.options['namespace_inject'],
)
)
else:
self.logger.info(
'Stripping namespace tokens from metadata for unmanaged deployment'
)
zipf = zip_inject_namespace(zipf, self.options['namespace_inject'], **kwargs)
if self.options.get('namespace_strip'):
zipf = zip_strip_namespace(zipf, self.options['namespace_strip'], logger=self.logger)
return zipf
def _process_namespace(self, src_zip):
if self.options.get('namespace_tokenize'):
src_zip = zip_tokenize_namespace(src_zip, self.options['namespace_tokenize'], logger=self.logger)
if self.options.get('namespace_inject'):
kwargs = {}
kwargs['unmanaged'] = process_bool_arg(self.options.get('unmanaged', True))
kwargs['namespaced_org'] = process_bool_arg(self.options.get('namespaced_org', False))
kwargs['logger'] = self.logger
src_zip = zip_inject_namespace(src_zip, self.options['namespace_inject'], **kwargs)
if self.options.get('namespace_strip'):
src_zip = zip_strip_namespace(src_zip, self.options['namespace_strip'], logger=self.logger)
return src_zip
"{}__".format(dependency["namespace_tokenize"])
)
)
package_zip = zip_tokenize_namespace(
package_zip,
namespace=dependency["namespace_tokenize"],
logger=self.logger,
)
if dependency.get("namespace_inject"):
self.logger.info(
"Replacing namespace tokens with {}".format(
"{}__".format(dependency["namespace_inject"])
)
)
package_zip = zip_inject_namespace(
package_zip,
namespace=dependency["namespace_inject"],
managed=not dependency.get("unmanaged"),
namespaced_org=self.options["namespaced_org"],
logger=self.logger,
)
if dependency.get("namespace_strip"):
self.logger.info(
"Removing namespace prefix {}__ from all files and filenames".format(
"{}__".format(dependency["namespace_strip"])
)
)
package_zip = zip_strip_namespace(
package_zip, namespace=dependency["namespace_strip"], logger=self.logger
)
)
if dependency.get('namespace_tokenize'):
self.logger.info('Replacing namespace prefix {}__ in files and filenames with namespace token strings'.format(
'{}__'.format(dependency['namespace_tokenize']),
))
package_zip = zip_tokenize_namespace(
package_zip,
namespace = dependency['namespace_tokenize'],
logger = self.logger,
)
if dependency.get('namespace_inject'):
self.logger.info('Replacing namespace tokens with {}'.format(
'{}__'.format(dependency['namespace_inject']),
))
package_zip = zip_inject_namespace(
package_zip,
namespace = dependency['namespace_inject'],
managed = not dependency.get('unmanaged'),
namespaced_org = self.options['namespaced_org'],
logger = self.logger,
)
if dependency.get('namespace_strip'):
self.logger.info('Removing namespace prefix {}__ from all files and filenames'.format(
'{}__'.format(dependency['namespace_strip']),
))
package_zip = zip_strip_namespace(
package_zip,
namespace = dependency['namespace_strip'],
logger = self.logger,
)