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 = process_text_in_zipfile(
src_zip,
functools.partial(
tokenize_namespace,
namespace=self.options["namespace_tokenize"],
logger=self.logger,
),
)
if self.options.get("namespace_inject"):
src_zip = process_text_in_zipfile(
src_zip,
functools.partial(
inject_namespace,
namespace=self.options["namespace_inject"],
managed=not process_bool_arg(self.options.get("unmanaged", True)),
namespaced_org=process_bool_arg(
self.options.get("namespaced_org", False)
),
logger=self.logger,
),
)
if self.options.get("namespace_strip"):
src_zip = process_text_in_zipfile(
src_zip,
functools.partial(
strip_namespace,
package_zip = self._download_extract_github(
gh_for_repo,
dependency["repo_owner"],
dependency["repo_name"],
dependency["subfolder"],
ref=dependency.get("ref"),
)
if package_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 = process_text_in_zipfile(
package_zip,
functools.partial(
tokenize_namespace,
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 = process_text_in_zipfile(
package_zip,
logger=self.logger,
),
)
if self.options.get("namespace_inject"):
managed = not process_bool_arg(self.options.get("unmanaged", True))
if 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 = process_text_in_zipfile(
zipf,
functools.partial(
inject_namespace,
namespace=self.options["namespace_inject"],
managed=managed,
namespaced_org=process_bool_arg(
self.options.get("namespaced_org", False)
),
logger=self.logger,
),
)
if self.options.get("namespace_strip"):
zipf = process_text_in_zipfile(
zipf,
functools.partial(
strip_namespace,
def _process_namespace(self, src_zip):
if self.options.get("namespace_tokenize"):
src_zip = process_text_in_zipfile(
src_zip,
functools.partial(
tokenize_namespace,
namespace=self.options["namespace_tokenize"],
logger=self.logger,
),
)
if self.options.get("namespace_inject"):
src_zip = process_text_in_zipfile(
src_zip,
functools.partial(
inject_namespace,
namespace=self.options["namespace_inject"],
managed=not process_bool_arg(self.options.get("unmanaged", True)),
namespaced_org=process_bool_arg(
self.options.get("namespaced_org", False)
"Stripping namespace tokens from metadata for unmanaged deployment"
)
zipf = process_text_in_zipfile(
zipf,
functools.partial(
inject_namespace,
namespace=self.options["namespace_inject"],
managed=managed,
namespaced_org=process_bool_arg(
self.options.get("namespaced_org", False)
),
logger=self.logger,
),
)
if self.options.get("namespace_strip"):
zipf = process_text_in_zipfile(
zipf,
functools.partial(
strip_namespace,
namespace=self.options["namespace_strip"],
logger=self.logger,
),
)
return zipf
def _process_namespace(self, zipf):
if self.options.get("namespace_tokenize"):
self.logger.info(
"Tokenizing namespace prefix {}__".format(
self.options["namespace_tokenize"]
)
)
zipf = process_text_in_zipfile(
zipf,
functools.partial(
tokenize_namespace,
namespace=self.options["namespace_tokenize"],
logger=self.logger,
),
)
if self.options.get("namespace_inject"):
managed = not process_bool_arg(self.options.get("unmanaged", True))
if managed:
self.logger.info(
"Replacing namespace tokens from metadata with namespace prefix {}__".format(
self.options["namespace_inject"]
)
)
else:
package_zip = process_text_in_zipfile(
package_zip,
functools.partial(
tokenize_namespace,
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 = process_text_in_zipfile(
package_zip,
functools.partial(
inject_namespace,
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"])
)
)
functools.partial(
inject_namespace,
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 = process_text_in_zipfile(
package_zip,
functools.partial(
strip_namespace,
namespace=dependency["namespace_strip"],
logger=self.logger,
),
)
package_zip = ZipfilePackageZipBuilder(package_zip)()
elif "namespace" in dependency:
self.logger.info(
"Installing {} version {}".format(
dependency["namespace"], dependency["version"]
)
)