Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .travis/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ def validate_redmine_data(redmine_query_url, redmine_issues):
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=helper)

parser.add_argument(
"release_type", type=str, help="Whether the release should be major, minor or patch.",
"release_type", type=str, help="Whether the release should be major, minor or patch."
)

parser.add_argument(
"--lower", type=str, required=False, help="Lower bound of pulpcore requirement.",
"--lower", type=str, required=False, help="Lower bound of pulpcore requirement."
)

parser.add_argument(
"--upper", type=str, required=False, help="Upper bound of pulpcore requirement.",
"--upper", type=str, required=False, help="Upper bound of pulpcore requirement."
)

args = parser.parse_args()
Expand Down
2 changes: 1 addition & 1 deletion dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# python packages handy for developers, but not required by pulp
black
django-crispy-forms
django-extensions
ipython
black==19.10b0
codecov
coverage
flake8
Expand Down
3 changes: 1 addition & 2 deletions pulpcore/app/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ def save(self, *args, **kwargs):

@classmethod
def get_pulp_type(cls):
""" Get the "pulp_type" string associated with this MasterModel type.
"""
"""Get the "pulp_type" string associated with this MasterModel type."""
return "{app_label}.{type}".format(app_label=cls._meta.app_label, type=cls.TYPE)

def cast(self):
Expand Down
2 changes: 1 addition & 1 deletion pulpcore/app/models/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ def sign(self, filename):
A dictionary as validated by the validate() method.
"""
completed_process = subprocess.run(
[self.script, filename], env={}, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
[self.script, filename], env={}, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)

if completed_process.returncode != 0:
Expand Down
2 changes: 1 addition & 1 deletion pulpcore/app/models/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ class RepositoryVersionContentDetails(models.Model):
(REMOVED, "removed"),
)

count_type = models.CharField(max_length=1, choices=COUNT_TYPE_CHOICES,)
count_type = models.CharField(max_length=1, choices=COUNT_TYPE_CHOICES)
content_type = models.TextField()
repository_version = models.ForeignKey(
"RepositoryVersion", related_name="counts", on_delete=models.CASCADE
Expand Down
2 changes: 1 addition & 1 deletion pulpcore/app/serializers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def __init__(self, view_name=None, view_name_pattern=None, **kwargs):
log.warn(
_(
"Please provide either 'view_name' or 'view_name_pattern' for {} on {}."
).format(self.__class__.__name__, traceback.extract_stack()[-4][2],),
).format(self.__class__.__name__, traceback.extract_stack()[-4][2])
)
view_name = _MatchingRegexViewName(r".*")
super().__init__(view_name, **kwargs)
Expand Down
34 changes: 20 additions & 14 deletions pulpcore/app/serializers/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


class BaseContentSerializer(base.ModelSerializer):
pulp_href = base.DetailIdentityField(view_name_pattern=r"contents(-.*/.*)-detail",)
pulp_href = base.DetailIdentityField(view_name_pattern=r"contents(-.*/.*)-detail")

class Meta:
model = models.Content
Expand Down Expand Up @@ -62,7 +62,7 @@ def create(self, validated_data):
relative_path = validated_data.get("relative_path")
content = self.Meta.model.objects.create(**validated_data)
models.ContentArtifact.objects.create(
artifact=artifact, content=content, relative_path=relative_path,
artifact=artifact, content=content, relative_path=relative_path
)
return content

Expand Down Expand Up @@ -92,7 +92,7 @@ def create(self, validated_data):
content = self.Meta.model.objects.create(**validated_data)
for relative_path, artifact in artifacts.items():
models.ContentArtifact.objects.create(
artifact=artifact, content=content, relative_path=relative_path,
artifact=artifact, content=content, relative_path=relative_path
)
return content

Expand All @@ -111,27 +111,33 @@ class ContentChecksumSerializer(serializers.Serializer):
"""

md5 = fields.ContentArtifactChecksumField(
help_text=_("The MD5 checksum if available."), checksum="md5",
help_text=_("The MD5 checksum if available."),
checksum="md5",
)

sha1 = fields.ContentArtifactChecksumField(
help_text=_("The SHA-1 checksum if available."), checksum="sha1",
help_text=_("The SHA-1 checksum if available."),
checksum="sha1",
)

sha224 = fields.ContentArtifactChecksumField(
help_text=_("The SHA-224 checksum if available."), checksum="sha224",
help_text=_("The SHA-224 checksum if available."),
checksum="sha224",
)

sha256 = fields.ContentArtifactChecksumField(
help_text=_("The SHA-256 checksum if available."), checksum="sha256",
help_text=_("The SHA-256 checksum if available."),
checksum="sha256",
)

sha384 = fields.ContentArtifactChecksumField(
help_text=_("The SHA-384 checksum if available."), checksum="sha384",
help_text=_("The SHA-384 checksum if available."),
checksum="sha384",
)

sha512 = fields.ContentArtifactChecksumField(
help_text=_("The SHA-512 checksum if available."), checksum="sha512",
help_text=_("The SHA-512 checksum if available."),
checksum="sha512",
)

class Meta:
Expand All @@ -147,14 +153,14 @@ class Meta:


class ArtifactSerializer(base.ModelSerializer):
pulp_href = base.IdentityField(view_name="artifacts-detail",)
pulp_href = base.IdentityField(view_name="artifacts-detail")

file = serializers.FileField(help_text=_("The stored file."), allow_empty_file=True,)
file = serializers.FileField(help_text=_("The stored file."), allow_empty_file=True)

size = serializers.IntegerField(help_text=_("The size of the file in bytes."), required=False,)
size = serializers.IntegerField(help_text=_("The size of the file in bytes."), required=False)

md5 = serializers.CharField(
help_text=_("The MD5 checksum of the file if available."), required=False, allow_null=True,
help_text=_("The MD5 checksum of the file if available."), required=False, allow_null=True
)

sha1 = serializers.CharField(
Expand Down Expand Up @@ -246,7 +252,7 @@ class SigningServiceSerializer(base.ModelSerializer):
A serializer for the model declaring a signing service.
"""

pulp_href = base.IdentityField(view_name="signing-services-detail",)
pulp_href = base.IdentityField(view_name="signing-services-detail")
name = serializers.CharField(help_text=_("A unique name used to recognize a script."))
script = serializers.CharField(
help_text=_("An absolute path to a script which is going to be used for the signing.")
Expand Down
4 changes: 2 additions & 2 deletions pulpcore/app/serializers/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ExporterSerializer(ModelSerializer):
Base serializer for Exporters.
"""

pulp_href = DetailIdentityField(view_name_pattern=r"exporter(-.*/.*)-detail",)
pulp_href = DetailIdentityField(view_name_pattern=r"exporter(-.*/.*)-detail")
name = serializers.CharField(
help_text=_("Unique name of the file system exporter."),
validators=[UniqueValidator(queryset=models.Exporter.objects.all())],
Expand Down Expand Up @@ -94,7 +94,7 @@ class ExportSerializer(ModelSerializer):
)

exported_resources = ExportedResourcesField(
help_text=_("Resources that were exported."), source="*", read_only=True,
help_text=_("Resources that were exported."), source="*", read_only=True
)

params = serializers.JSONField(
Expand Down
3 changes: 1 addition & 2 deletions pulpcore/app/serializers/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,7 @@ def get_object(self, view_name, view_args, view_kwargs):


class TaskGroupStatusCountField(serializers.IntegerField, serializers.ReadOnlyField):
""" Serializer field for counting the tasks on a task group in a given state.
"""
"""Serializer field for counting the tasks on a task group in a given state."""

def __init__(self, state, *args, **kwargs):
self.state = state
Expand Down
2 changes: 1 addition & 1 deletion pulpcore/app/serializers/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class ImporterSerializer(ModelSerializer):
"""Base serializer for Importers."""

pulp_href = DetailIdentityField(view_name_pattern=r"importer(-.*/.*)-detail",)
pulp_href = DetailIdentityField(view_name_pattern=r"importer(-.*/.*)-detail")
name = serializers.CharField(
help_text=_("Unique name of the Importer."),
validators=[UniqueValidator(queryset=models.Importer.objects.all())],
Expand Down
12 changes: 6 additions & 6 deletions pulpcore/app/serializers/publication.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


class PublicationSerializer(ModelSerializer):
pulp_href = DetailIdentityField(view_name_pattern=r"publications(-.*/.*)-detail",)
pulp_href = DetailIdentityField(view_name_pattern=r"publications(-.*/.*)-detail")
repository_version = RepositoryVersionRelatedField(required=False)
repository = DetailRelatedField(
help_text=_("A URI of the repository to be published."),
Expand Down Expand Up @@ -62,7 +62,7 @@ class Meta:


class ContentGuardSerializer(ModelSerializer):
pulp_href = DetailIdentityField(view_name_pattern=r"contentguards(-.*/.*)-detail",)
pulp_href = DetailIdentityField(view_name_pattern=r"contentguards(-.*/.*)-detail")

name = serializers.CharField(help_text=_("The unique name."))
description = serializers.CharField(
Expand Down Expand Up @@ -91,7 +91,7 @@ class BaseDistributionSerializer(ModelSerializer):

"""

pulp_href = DetailIdentityField(view_name_pattern=r"distributions(-.*/.*)-detail",)
pulp_href = DetailIdentityField(view_name_pattern=r"distributions(-.*/.*)-detail")
base_path = serializers.CharField(
help_text=_(
'The base (relative) path component of the published url. Avoid paths that \
Expand Down Expand Up @@ -119,7 +119,7 @@ class BaseDistributionSerializer(ModelSerializer):
class Meta:
abstract = True
model = models.BaseDistribution
fields = ModelSerializer.Meta.fields + ("base_path", "base_url", "content_guard", "name",)
fields = ModelSerializer.Meta.fields + ("base_path", "base_url", "content_guard", "name")

def _validate_path_overlap(self, path):
# look for any base paths nested in path
Expand Down Expand Up @@ -172,12 +172,12 @@ class RepositoryVersionDistributionSerializer(BaseDistributionSerializer):
allow_null=True,
)
repository_version = RepositoryVersionRelatedField(
required=False, help_text=_("RepositoryVersion to be served"), allow_null=True,
required=False, help_text=_("RepositoryVersion to be served"), allow_null=True
)

class Meta:
abstract = True
fields = BaseDistributionSerializer.Meta.fields + ("repository", "repository_version",)
fields = BaseDistributionSerializer.Meta.fields + ("repository", "repository_version")

def validate(self, data):
super().validate(data)
Expand Down
8 changes: 4 additions & 4 deletions pulpcore/app/serializers/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


class RepositorySerializer(ModelSerializer):
pulp_href = DetailIdentityField(view_name_pattern=r"repositories(-.*/.*)-detail",)
pulp_href = DetailIdentityField(view_name_pattern=r"repositories(-.*/.*)-detail")
versions_href = RepositoryVersionsIdentityFromRepositoryField()
latest_version_href = LatestVersionField()
name = serializers.CharField(
Expand Down Expand Up @@ -61,12 +61,12 @@ class RemoteSerializer(ModelSerializer):
class. Please import from `pulpcore.plugin.serializers` rather than from this module directly.
"""

pulp_href = DetailIdentityField(view_name_pattern=r"remotes(-.*/.*)-detail",)
pulp_href = DetailIdentityField(view_name_pattern=r"remotes(-.*/.*)-detail")
name = serializers.CharField(
help_text=_("A unique name for this remote."),
validators=[UniqueValidator(queryset=models.Remote.objects.all())],
)
url = serializers.CharField(help_text="The URL of an external content source.",)
url = serializers.CharField(help_text="The URL of an external content source.")
ca_cert = serializers.CharField(
help_text="A PEM encoded CA certificate used to validate the server "
"certificate presented by the remote server.",
Expand All @@ -84,7 +84,7 @@ class RemoteSerializer(ModelSerializer):
allow_null=True,
)
tls_validation = serializers.BooleanField(
help_text="If True, TLS peer validation must be performed.", required=False,
help_text="If True, TLS peer validation must be performed.", required=False
)
proxy_url = serializers.CharField(
help_text="The proxy URL. Format: scheme://user:password@host:port",
Expand Down
4 changes: 2 additions & 2 deletions pulpcore/app/serializers/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class VersionSerializer(serializers.Serializer):
Serializer for the version information of Pulp components
"""

component = serializers.CharField(help_text=_("Name of a versioned component of Pulp"),)
component = serializers.CharField(help_text=_("Name of a versioned component of Pulp"))

version = serializers.CharField(help_text=_("Version of the component (e.g. 3.0.0)"),)
version = serializers.CharField(help_text=_("Version of the component (e.g. 3.0.0)"))


class DatabaseConnectionSerializer(serializers.Serializer):
Expand Down
2 changes: 1 addition & 1 deletion pulpcore/app/serializers/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class TaskSerializer(ModelSerializer):
read_only=True,
view_name="None", # This is a polymorphic field. The serializer does not need a view name.
)
reserved_resources_record = ReservedResourcesSerializer(many=True, read_only=True,)
reserved_resources_record = ReservedResourcesSerializer(many=True, read_only=True)

class Meta:
model = models.Task
Expand Down
10 changes: 5 additions & 5 deletions pulpcore/app/serializers/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


class UploadChunkSerializer(ValidateFieldsMixin, serializers.Serializer):
file = serializers.FileField(help_text=_("A chunk of the uploaded file."), write_only=True,)
file = serializers.FileField(help_text=_("A chunk of the uploaded file."), write_only=True)

sha256 = serializers.CharField(
help_text=_("The SHA-256 checksum of the chunk if available."),
Expand All @@ -20,9 +20,9 @@ class UploadChunkSerializer(ValidateFieldsMixin, serializers.Serializer):
write_only=True,
)

offset = serializers.IntegerField(read_only=True,)
offset = serializers.IntegerField(read_only=True)

size = serializers.IntegerField(read_only=True,)
size = serializers.IntegerField(read_only=True)

def validate(self, data):
data = super().validate(data)
Expand Down Expand Up @@ -50,7 +50,7 @@ class Meta:
class UploadSerializer(base.ModelSerializer):
"""Serializer for chunked uploads."""

pulp_href = base.IdentityField(view_name="uploads-detail",)
pulp_href = base.IdentityField(view_name="uploads-detail")

size = serializers.IntegerField(help_text=_("The size of the upload in bytes."))

Expand All @@ -64,7 +64,7 @@ class Meta:


class UploadDetailSerializer(UploadSerializer):
chunks = UploadChunkSerializer(many=True, read_only=True,)
chunks = UploadChunkSerializer(many=True, read_only=True)

class Meta(UploadSerializer.Meta):
fields = UploadSerializer.Meta.fields + ("chunks",)
Expand Down
2 changes: 1 addition & 1 deletion pulpcore/app/serializers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def to_representation(self, obj):
class UserGroupSerializer(serializers.ModelSerializer):
"""Serializer for Groups that belong to an User."""

name = serializers.CharField(help_text=_("Name."), max_length=150,)
name = serializers.CharField(help_text=_("Name."), max_length=150)
pulp_href = IdentityField(view_name="groups-detail")

class Meta:
Expand Down
2 changes: 1 addition & 1 deletion pulpcore/app/viewsets/access_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class AccessPolicyViewSet(
NamedModelViewSet, mixins.UpdateModelMixin, mixins.RetrieveModelMixin, mixins.ListModelMixin,
NamedModelViewSet, mixins.UpdateModelMixin, mixins.RetrieveModelMixin, mixins.ListModelMixin
):
"""
ViewSet for AccessPolicy.
Expand Down
2 changes: 1 addition & 1 deletion pulpcore/app/viewsets/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,6 @@ def create(self, request, importer_pk):
path = serializer.validated_data.get("path")
toc = serializer.validated_data.get("toc")
result = enqueue_with_reservation(
pulp_import, [importer], kwargs={"importer_pk": importer.pk, "path": path, "toc": toc},
pulp_import, [importer], kwargs={"importer_pk": importer.pk, "path": path, "toc": toc}
)
return OperationPostponedResponse(result, request)
2 changes: 1 addition & 1 deletion pulpcore/app/viewsets/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ def commit(self, request, pk):

upload = self.get_object()
async_result = enqueue_with_reservation(
tasks.upload.commit, [upload], args=(upload.pk, sha256),
tasks.upload.commit, [upload], args=(upload.pk, sha256)
)
return OperationPostponedResponse(async_result, request)
Loading