diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2019-02-19 23:38:32 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2019-02-20 12:38:32 +0800 |
commit | ac1d13f43dea5ebee0506dc229cd431660916c73 (patch) | |
tree | 86b486dd681da2e15017546b4d84956215d56a76 /src/cryptography/x509 | |
parent | 91e69f3b47aea16c4cbd0beb9a220b1bb760dfbe (diff) | |
download | cryptography-ac1d13f43dea5ebee0506dc229cd431660916c73.tar.gz cryptography-ac1d13f43dea5ebee0506dc229cd431660916c73.tar.bz2 cryptography-ac1d13f43dea5ebee0506dc229cd431660916c73.zip |
Simplify string formatting (#4757)
Diffstat (limited to 'src/cryptography/x509')
-rw-r--r-- | src/cryptography/x509/extensions.py | 32 | ||||
-rw-r--r-- | src/cryptography/x509/general_name.py | 10 | ||||
-rw-r--r-- | src/cryptography/x509/name.py | 4 |
3 files changed, 23 insertions, 23 deletions
diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py index 88afa310..f027247e 100644 --- a/src/cryptography/x509/extensions.py +++ b/src/cryptography/x509/extensions.py @@ -81,7 +81,7 @@ class Extensions(object): if ext.oid == oid: return ext - raise ExtensionNotFound("No {0} extension was found".format(oid), oid) + raise ExtensionNotFound("No {} extension was found".format(oid), oid) def get_extension_for_class(self, extclass): if extclass is UnrecognizedExtension: @@ -96,7 +96,7 @@ class Extensions(object): return ext raise ExtensionNotFound( - "No {0} extension was found".format(extclass), extclass.oid + "No {} extension was found".format(extclass), extclass.oid ) def __iter__(self): @@ -110,7 +110,7 @@ class Extensions(object): def __repr__(self): return ( - "<Extensions({0})>".format(self._extensions) + "<Extensions({})>".format(self._extensions) ) @@ -137,7 +137,7 @@ class CRLNumber(object): return hash(self.crl_number) def __repr__(self): - return "<CRLNumber({0})>".format(self.crl_number) + return "<CRLNumber({})>".format(self.crl_number) crl_number = utils.read_only_property("_crl_number") @@ -282,7 +282,7 @@ class AuthorityInformationAccess(object): return len(self._descriptions) def __repr__(self): - return "<AuthorityInformationAccess({0})>".format(self._descriptions) + return "<AuthorityInformationAccess({})>".format(self._descriptions) def __eq__(self, other): if not isinstance(other, AuthorityInformationAccess): @@ -429,7 +429,7 @@ class CRLDistributionPoints(object): return len(self._distribution_points) def __repr__(self): - return "<CRLDistributionPoints({0})>".format(self._distribution_points) + return "<CRLDistributionPoints({})>".format(self._distribution_points) def __eq__(self, other): if not isinstance(other, CRLDistributionPoints): @@ -470,7 +470,7 @@ class FreshestCRL(object): return len(self._distribution_points) def __repr__(self): - return "<FreshestCRL({0})>".format(self._distribution_points) + return "<FreshestCRL({})>".format(self._distribution_points) def __eq__(self, other): if not isinstance(other, FreshestCRL): @@ -676,7 +676,7 @@ class CertificatePolicies(object): return len(self._policies) def __repr__(self): - return "<CertificatePolicies({0})>".format(self._policies) + return "<CertificatePolicies({})>".format(self._policies) def __eq__(self, other): if not isinstance(other, CertificatePolicies): @@ -837,7 +837,7 @@ class ExtendedKeyUsage(object): return len(self._usages) def __repr__(self): - return "<ExtendedKeyUsage({0})>".format(self._usages) + return "<ExtendedKeyUsage({})>".format(self._usages) def __eq__(self, other): if not isinstance(other, ExtendedKeyUsage): @@ -1192,7 +1192,7 @@ class GeneralNames(object): return list(objs) def __repr__(self): - return "<GeneralNames({0})>".format(self._general_names) + return "<GeneralNames({})>".format(self._general_names) def __eq__(self, other): if not isinstance(other, GeneralNames): @@ -1227,7 +1227,7 @@ class SubjectAlternativeName(object): return self._general_names.get_values_for_type(type) def __repr__(self): - return "<SubjectAlternativeName({0})>".format(self._general_names) + return "<SubjectAlternativeName({})>".format(self._general_names) def __eq__(self, other): if not isinstance(other, SubjectAlternativeName): @@ -1262,7 +1262,7 @@ class IssuerAlternativeName(object): return self._general_names.get_values_for_type(type) def __repr__(self): - return "<IssuerAlternativeName({0})>".format(self._general_names) + return "<IssuerAlternativeName({})>".format(self._general_names) def __eq__(self, other): if not isinstance(other, IssuerAlternativeName): @@ -1297,7 +1297,7 @@ class CertificateIssuer(object): return self._general_names.get_values_for_type(type) def __repr__(self): - return "<CertificateIssuer({0})>".format(self._general_names) + return "<CertificateIssuer({})>".format(self._general_names) def __eq__(self, other): if not isinstance(other, CertificateIssuer): @@ -1326,7 +1326,7 @@ class CRLReason(object): self._reason = reason def __repr__(self): - return "<CRLReason(reason={0})>".format(self._reason) + return "<CRLReason(reason={})>".format(self._reason) def __eq__(self, other): if not isinstance(other, CRLReason): @@ -1354,7 +1354,7 @@ class InvalidityDate(object): self._invalidity_date = invalidity_date def __repr__(self): - return "<InvalidityDate(invalidity_date={0})>".format( + return "<InvalidityDate(invalidity_date={})>".format( self._invalidity_date ) @@ -1400,7 +1400,7 @@ class PrecertificateSignedCertificateTimestamps(object): def __repr__(self): return ( - "<PrecertificateSignedCertificateTimestamps({0})>".format( + "<PrecertificateSignedCertificateTimestamps({})>".format( list(self) ) ) diff --git a/src/cryptography/x509/general_name.py b/src/cryptography/x509/general_name.py index fef29c8c..12338415 100644 --- a/src/cryptography/x509/general_name.py +++ b/src/cryptography/x509/general_name.py @@ -206,7 +206,7 @@ class UniformResourceIdentifier(object): if parsed.port: netloc = ( idna.encode(parsed.hostname) + - ":{0}".format(parsed.port).encode("ascii") + ":{}".format(parsed.port).encode("ascii") ).decode("ascii") else: netloc = idna.encode(parsed.hostname).decode("ascii") @@ -250,7 +250,7 @@ class DirectoryName(object): value = utils.read_only_property("_value") def __repr__(self): - return "<DirectoryName(value={0})>".format(self.value) + return "<DirectoryName(value={})>".format(self.value) def __eq__(self, other): if not isinstance(other, DirectoryName): @@ -276,7 +276,7 @@ class RegisteredID(object): value = utils.read_only_property("_value") def __repr__(self): - return "<RegisteredID(value={0})>".format(self.value) + return "<RegisteredID(value={})>".format(self.value) def __eq__(self, other): if not isinstance(other, RegisteredID): @@ -314,7 +314,7 @@ class IPAddress(object): value = utils.read_only_property("_value") def __repr__(self): - return "<IPAddress(value={0})>".format(self.value) + return "<IPAddress(value={})>".format(self.value) def __eq__(self, other): if not isinstance(other, IPAddress): @@ -344,7 +344,7 @@ class OtherName(object): value = utils.read_only_property("_value") def __repr__(self): - return "<OtherName(type_id={0}, value={1!r})>".format( + return "<OtherName(type_id={}, value={!r})>".format( self.type_id, self.value) def __eq__(self, other): diff --git a/src/cryptography/x509/name.py b/src/cryptography/x509/name.py index 026b79c2..dac5639e 100644 --- a/src/cryptography/x509/name.py +++ b/src/cryptography/x509/name.py @@ -190,7 +190,7 @@ class RelativeDistinguishedName(object): return len(self._attributes) def __repr__(self): - return "<RelativeDistinguishedName({0})>".format(self.rfc4514_string()) + return "<RelativeDistinguishedName({})>".format(self.rfc4514_string()) class Name(object): @@ -253,4 +253,4 @@ class Name(object): return sum(len(rdn) for rdn in self._attributes) def __repr__(self): - return "<Name({0})>".format(self.rfc4514_string()) + return "<Name({})>".format(self.rfc4514_string()) |