diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2018-12-24 09:43:45 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2018-12-24 09:43:45 +0100 |
commit | ba98bcd4a07c589722c6db103b363c8aa1d3561d (patch) | |
tree | 22c7651ad945c502e4b1154d8dccd7f0dcaaba54 /crocoite/behavior.py | |
parent | 36447c97a0036592d3748fbe594928ae9c76d5af (diff) | |
download | crocoite-ba98bcd4a07c589722c6db103b363c8aa1d3561d.tar.gz crocoite-ba98bcd4a07c589722c6db103b363c8aa1d3561d.tar.bz2 crocoite-ba98bcd4a07c589722c6db103b363c8aa1d3561d.zip |
Use f-strings where possible
Replaces str.format, which is less readable due to its separation of
format and arguments.
Diffstat (limited to 'crocoite/behavior.py')
-rw-r--r-- | crocoite/behavior.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crocoite/behavior.py b/crocoite/behavior.py index 321b65c..7f3a3a0 100644 --- a/crocoite/behavior.py +++ b/crocoite/behavior.py @@ -59,7 +59,7 @@ class Script: self.data = pkg_resources.resource_string (__name__, os.path.join ('data', path)).decode (encoding) def __repr__ (self): - return '<Script {}>'.format (self.path) + return f'<Script {self.path}>' def __str__ (self): return self.data @@ -89,7 +89,7 @@ class Behavior: return True def __repr__ (self): - return '<Behavior {}>'.format (self.name) + return f'<Behavior {self.name}>' async def onload (self): """ After loading the page started """ @@ -138,7 +138,7 @@ class JsOnload (Behavior): constructor = result['objectId'] if self.options: - yield Script.fromStr (json.dumps (self.options, indent=2), '{}/options'.format (self.script.path)) + yield Script.fromStr (json.dumps (self.options, indent=2), f'{self.script.path}/options') result = await tab.Runtime.callFunctionOn ( functionDeclaration='function(options){return new this(options);}', objectId=constructor, @@ -231,9 +231,9 @@ class DomSnapshot (Behavior): if url in haveUrls: # ignore duplicate URLs. they are usually caused by # javascript-injected iframes (advertising) with no(?) src - self.logger.warning ('have DOM snapshot for URL {}, ignoring'.format (url)) + self.logger.warning (f'have DOM snapshot for URL {url}, ignoring') elif url.scheme in ('http', 'https'): - self.logger.debug ('saving DOM snapshot for url {}, base {}'.format (doc['documentURL'], doc['baseURL'])) + self.logger.debug (f'saving DOM snapshot for url {url}, base {doc["baseURL"]}') haveUrls.add (url) walker = ChromeTreeWalker (doc) # remove script, to make the page static and noscript, because at the |