|
1 | | -import requests, html, re, os, random |
| 1 | +import requests |
| 2 | +import re |
| 3 | +import os |
| 4 | +import random |
2 | 5 | import xml.etree.ElementTree as ET |
3 | 6 | from cfengine_module_library import PromiseModule, ValidationError, Result |
4 | 7 |
|
@@ -42,7 +45,7 @@ def validate_promise(self, promiser, attributes, metadata): |
42 | 45 | # check that attribute select has a valid type |
43 | 46 | if type(select) is not str: |
44 | 47 | raise ValidationError( |
45 | | - f"Invalid type for attribute select: expected string" |
| 48 | + "Invalid type for attribute select: expected string" |
46 | 49 | ) |
47 | 50 |
|
48 | 51 | # check that attribute select has a valid value |
@@ -159,18 +162,18 @@ def _write_promiser(self, item, promiser): |
159 | 162 | return Result.NOT_KEPT |
160 | 163 |
|
161 | 164 | def _is_win_file(self, path): |
162 | | - return re.search(r"^[a-zA-Z]:\\[\\\S|*\S]?.*$", path) != None |
| 165 | + return re.search(r"^[a-zA-Z]:\\[\\\S|*\S]?.*$", path) is not None |
163 | 166 |
|
164 | 167 | def _is_unix_file(self, path): |
165 | | - return re.search(r"^(/[^/ ]*)+/?$", path) != None |
| 168 | + return re.search(r"^(/[^/ ]*)+/?$", path) is not None |
166 | 169 |
|
167 | 170 | def _is_url(self, path): |
168 | 171 | return ( |
169 | 172 | re.search( |
170 | 173 | r"^http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+", |
171 | 174 | path, |
172 | 175 | ) |
173 | | - != None |
| 176 | + is not None |
174 | 177 | ) |
175 | 178 |
|
176 | 179 |
|
|
0 commit comments