Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _construct_fork_project(self) -> "PagureProject":
return PagureProject(
service=self.service,
repo=self.repo,
namespace=self.namespace,
username=self._user,
is_fork=True,
)
namespace: Optional[str] = None,
description: Optional[str] = None,
) -> PagureProject:
request_url = self.get_api_url("new")
parameters = {"name": repo, "description": description, "wait": True}
if not description:
parameters["description"] = repo
if namespace:
parameters["namespace"] = namespace
try:
self.call_api(request_url, "POST", data=parameters)
except PagureAPIException as ex:
self.__handle_project_create_fail(ex, namespace)
return PagureProject(repo=repo, namespace=namespace, service=self)
def __eq__(self, o: object) -> bool:
if not isinstance(o, PagureProject):
return False
return (
self.repo == o.repo
and self.namespace == o.namespace
and self.service == o.service
and self._username == o._username
and self._is_fork == o._is_fork
and self.read_only == o.read_only
)
def get_project(self, **kwargs) -> "PagureProject":
if "username" in kwargs:
return PagureProject(service=self, **kwargs)
else:
return PagureProject(
service=self, username=self.user.get_username(), **kwargs
)
def _construct_fork_project(self) -> "PagureProject":
return PagureProject(
service=self.service,
repo=self.repo,
namespace=self.namespace,
username=self._user,
is_fork=True,
)
def get_project(self, **kwargs) -> "PagureProject":
if "username" in kwargs:
return PagureProject(service=self, **kwargs)
else:
return PagureProject(
service=self, username=self.user.get_username(), **kwargs
)