diff --git a/opendrop/__init__.py b/opendrop/__init__.py index 8404244..2fc5d94 100644 --- a/opendrop/__init__.py +++ b/opendrop/__init__.py @@ -26,6 +26,6 @@ __version__ = "0.12.2" if platform.system() == "Darwin": dyld_path = os.environ.get("DYLD_LIBRARY_PATH", "") # save old path archive_path = "/usr/local/opt/libarchive/lib" - os.environ["DYLD_LIBRARY_PATH"] = "{}:{}".format(dyld_path, archive_path) + os.environ["DYLD_LIBRARY_PATH"] = f"{dyld_path}:{archive_path}" logger = logging.getLogger(__name__) diff --git a/opendrop/client.py b/opendrop/client.py index f45c8ca..28adda7 100644 --- a/opendrop/client.py +++ b/opendrop/client.py @@ -97,7 +97,7 @@ class AirDropClient: logger.debug(f"Send {url} request") AirDropUtil.write_debug( - self.config, body, "send_{}_request.plist".format(url.lower().strip("/")) + self.config, body, f"send_{url.lower().strip('/')}_request.plist" ) _headers = self._get_headers() @@ -119,7 +119,7 @@ class AirDropClient: AirDropUtil.write_debug( self.config, response_bytes, - "send_{}_response.plist".format(url.lower().strip("/")), + f"send_{url.lower().strip('/')}_response.plist", ) if http_resp.status != 200: diff --git a/opendrop/config.py b/opendrop/config.py index 1f0be42..91a49ef 100644 --- a/opendrop/config.py +++ b/opendrop/config.py @@ -81,9 +81,7 @@ class AirDropConfig: self.port = server_port if service_id is None: - service_id = "{0:0{1}x}".format( - random.randint(0, 0xFFFFFFFFFFFF), 12 - ) # random 6-byte string in base16 + service_id = f"{random.randint(0, 0xFFFFFFFFFFFF):012x}" # random 6-byte string in base16 self.service_id = service_id self.debug = debug @@ -109,7 +107,7 @@ class AirDropConfig: self.root_ca_file = resource_filename("opendrop", "certs/apple_root_ca.pem") if not os.path.exists(self.root_ca_file): raise FileNotFoundError( - "Need Apple root CA certificate: {}".format(self.root_ca_file) + f"Need Apple root CA certificate: {self.root_ca_file}" ) self.key_dir = os.path.join(self.airdrop_dir, "keys") @@ -148,7 +146,7 @@ class AirDropConfig: "-out", "certificate.pem", "-subj", - "/CN={}".format(self.computer_name), + f"/CN={self.computer_name}", ], cwd=self.key_dir, stdout=subprocess.PIPE, diff --git a/opendrop/server.py b/opendrop/server.py index e188e21..f6585df 100644 --- a/opendrop/server.py +++ b/opendrop/server.py @@ -54,14 +54,11 @@ class AirDropServer: if self.ip_addr is None: if self.config.interface == "awdl0": raise RuntimeError( - "Interface {} does not have an IPv6 address. " - "Make sure that `owl` is running.".format(self.config.interface) + f"Interface {self.config.interface} does not have an IPv6 address. Make sure that `owl` is running." ) else: raise RuntimeError( - "Interface {} does not have an IPv6 address".format( - self.config.interface - ) + f"Interface {self.config.interface} does not have an IPv6 address" ) self.Handler = AirDropServerHandler