| 1 |
from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import ( |
| 2 |
MyLovelyCompanyTeamProjectComponent # NOT DRY |
| 3 |
) |
| 4 |
from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import ( |
| 5 |
MyLovelyCompanyTeamProjectComponent as component # DRY |
| 6 |
) |
| 7 |
|
| 8 |
# Please keep __all__ alphabetized within each category. |
| 9 |
|
| 10 |
__all__ = [ |
| 11 |
# Super-special typing primitives. |
| 12 |
'Any', |
| 13 |
'Callable', |
| 14 |
'ClassVar', |
| 15 |
|
| 16 |
# ABCs (from collections.abc). |
| 17 |
'AbstractSet', # collections.abc.Set. |
| 18 |
'ByteString', |
| 19 |
'Container', |
| 20 |
|
| 21 |
# Concrete collection types. |
| 22 |
'Counter', |
| 23 |
'Deque', |
| 24 |
'Dict', |
| 25 |
'DefaultDict', |
| 26 |
'List', |
| 27 |
'Set', |
| 28 |
'FrozenSet', |
| 29 |
'NamedTuple', # Not really a type. |
| 30 |
'Generator', |
| 31 |
] |
| 32 |
|
| 33 |
not_shareables = [ |
| 34 |
# singletons |
| 35 |
True, |
| 36 |
False, |
| 37 |
NotImplemented, ..., |
| 38 |
# builtin types and objects |
| 39 |
type, |
| 40 |
object, |
| 41 |
object(), |
| 42 |
Exception(), |
| 43 |
42, |
| 44 |
100.0, |
| 45 |
"spam", |
| 46 |
# user-defined types and objects |
| 47 |
Cheese, |
| 48 |
Cheese("Wensleydale"), |
| 49 |
SubBytes(b"spam"), |
| 50 |
] |
| 51 |
|
| 52 |
if 'PYTHON' in os.environ: |
| 53 |
add_compiler(compiler_from_env()) |
| 54 |
else: |
| 55 |
# for compiler in compilers.values(): |
| 56 |
# add_compiler(compiler) |
| 57 |
add_compiler(compilers[(7.0, 32)]) |
| 58 |
# add_compiler(compilers[(7.1, 64)]) |
| 59 |
|
| 60 |
# Comment before function. |
| 61 |
def inline_comments_in_brackets_ruin_everything(): |
| 62 |
if typedargslist: |
| 63 |
parameters.children = [ |
| 64 |
children[0], # (1 |
| 65 |
body, |
| 66 |
children[-1] # )1 |
| 67 |
] |
| 68 |
parameters.children = [ |
| 69 |
children[0], |
| 70 |
body, |
| 71 |
children[-1], # type: ignore |
| 72 |
] |
| 73 |
else: |
| 74 |
parameters.children = [ |
| 75 |
parameters.children[0], # (2 what if this was actually long |
| 76 |
body, |
| 77 |
parameters.children[-1], # )2 |
| 78 |
] |
| 79 |
parameters.children = [parameters.what_if_this_was_actually_long.children[0], body, parameters.children[-1]] # type: ignore |
| 80 |
if (self._proc is not None |
| 81 |
# has the child process finished? |
| 82 |
and self._returncode is None |
| 83 |
# the child process has finished, but the |
| 84 |
# transport hasn't been notified yet? |
| 85 |
and self._proc.poll() is None): |
| 86 |
pass |
| 87 |
# no newline before or after |
| 88 |
short = [ |
| 89 |
# one |
| 90 |
1, |
| 91 |
# two |
| 92 |
2] |
| 93 |
|
| 94 |
# no newline after |
| 95 |
call(arg1, arg2, """ |
| 96 |
short |
| 97 |
""", arg3=True) |
| 98 |
|
| 99 |
############################################################################ |
| 100 |
|
| 101 |
call2( |
| 102 |
#short |
| 103 |
arg1, |
| 104 |
#but |
| 105 |
arg2, |
| 106 |
#multiline |
| 107 |
""" |
| 108 |
short |
| 109 |
""", |
| 110 |
# yup |
| 111 |
arg3=True) |
| 112 |
lcomp = [ |
| 113 |
element # yup |
| 114 |
for element in collection # yup |
| 115 |
if element is not None # right |
| 116 |
] |
| 117 |
lcomp2 = [ |
| 118 |
# hello |
| 119 |
element |
| 120 |
# yup |
| 121 |
for element in collection |
| 122 |
# right |
| 123 |
if element is not None |
| 124 |
] |
| 125 |
lcomp3 = [ |
| 126 |
# This one is actually too long to fit in a single line. |
| 127 |
element.split('\n', 1)[0] |
| 128 |
# yup |
| 129 |
for element in collection.select_elements() |
| 130 |
# right |
| 131 |
if element is not None |
| 132 |
] |
| 133 |
while True: |
| 134 |
if False: |
| 135 |
continue |
| 136 |
|
| 137 |
# and round and round we go |
| 138 |
# and round and round we go |
| 139 |
|
| 140 |
# let's return |
| 141 |
return Node( |
| 142 |
syms.simple_stmt, |
| 143 |
[ |
| 144 |
Node(statement, result), |
| 145 |
Leaf(token.NEWLINE, '\n') # FIXME: \r\n? |
| 146 |
], |
| 147 |
) |
| 148 |
|
| 149 |
CONFIG_FILES = [CONFIG_FILE, ] + SHARED_CONFIG_FILES + USER_CONFIG_FILES # type: Final |
| 150 |
|
| 151 |
class Test: |
| 152 |
def _init_host(self, parsed) -> None: |
| 153 |
if (parsed.hostname is None or # type: ignore |
| 154 |
not parsed.hostname.strip()): |
| 155 |
pass |
| 156 |
|
| 157 |
|
| 158 |
####################### |
| 159 |
### SECTION COMMENT ### |
| 160 |
####################### |
| 161 |
|
| 162 |
|
| 163 |
instruction()#comment with bad spacing |
| 164 |
|
| 165 |
# END COMMENTS |
| 166 |
# MORE END COMMENTS |
| 167 |
|
| 168 |
|
| 169 |
# output |
| 170 |
|
| 171 |
|
| 172 |
from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import ( |
| 173 |
MyLovelyCompanyTeamProjectComponent, # NOT DRY |
| 174 |
) |
| 175 |
from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import ( |
| 176 |
MyLovelyCompanyTeamProjectComponent as component, # DRY |
| 177 |
) |
| 178 |
|
| 179 |
# Please keep __all__ alphabetized within each category. |
| 180 |
|
| 181 |
__all__ = [ |
| 182 |
# Super-special typing primitives. |
| 183 |
"Any", |
| 184 |
"Callable", |
| 185 |
"ClassVar", |
| 186 |
# ABCs (from collections.abc). |
| 187 |
"AbstractSet", # collections.abc.Set. |
| 188 |
"ByteString", |
| 189 |
"Container", |
| 190 |
# Concrete collection types. |
| 191 |
"Counter", |
| 192 |
"Deque", |
| 193 |
"Dict", |
| 194 |
"DefaultDict", |
| 195 |
"List", |
| 196 |
"Set", |
| 197 |
"FrozenSet", |
| 198 |
"NamedTuple", # Not really a type. |
| 199 |
"Generator", |
| 200 |
] |
| 201 |
|
| 202 |
not_shareables = [ |
| 203 |
# singletons |
| 204 |
True, |
| 205 |
False, |
| 206 |
NotImplemented, |
| 207 |
..., |
| 208 |
# builtin types and objects |
| 209 |
type, |
| 210 |
object, |
| 211 |
object(), |
| 212 |
Exception(), |
| 213 |
42, |
| 214 |
100.0, |
| 215 |
"spam", |
| 216 |
# user-defined types and objects |
| 217 |
Cheese, |
| 218 |
Cheese("Wensleydale"), |
| 219 |
SubBytes(b"spam"), |
| 220 |
] |
| 221 |
|
| 222 |
if "PYTHON" in os.environ: |
| 223 |
add_compiler(compiler_from_env()) |
| 224 |
else: |
| 225 |
# for compiler in compilers.values(): |
| 226 |
# add_compiler(compiler) |
| 227 |
add_compiler(compilers[(7.0, 32)]) |
| 228 |
# add_compiler(compilers[(7.1, 64)]) |
| 229 |
|
| 230 |
|
| 231 |
# Comment before function. |
| 232 |
def inline_comments_in_brackets_ruin_everything(): |
| 233 |
if typedargslist: |
| 234 |
parameters.children = [children[0], body, children[-1]] # (1 # )1 |
| 235 |
parameters.children = [ |
| 236 |
children[0], |
| 237 |
body, |
| 238 |
children[-1], # type: ignore |
| 239 |
] |
| 240 |
else: |
| 241 |
parameters.children = [ |
| 242 |
parameters.children[0], # (2 what if this was actually long |
| 243 |
body, |
| 244 |
parameters.children[-1], # )2 |
| 245 |
] |
| 246 |
parameters.children = [parameters.what_if_this_was_actually_long.children[0], body, parameters.children[-1]] # type: ignore |
| 247 |
if ( |
| 248 |
self._proc is not None |
| 249 |
# has the child process finished? |
| 250 |
and self._returncode is None |
| 251 |
# the child process has finished, but the |
| 252 |
# transport hasn't been notified yet? |
| 253 |
and self._proc.poll() is None |
| 254 |
): |
| 255 |
pass |
| 256 |
# no newline before or after |
| 257 |
short = [ |
| 258 |
# one |
| 259 |
1, |
| 260 |
# two |
| 261 |
2, |
| 262 |
] |
| 263 |
|
| 264 |
# no newline after |
| 265 |
call( |
| 266 |
arg1, |
| 267 |
arg2, |
| 268 |
""" |
| 269 |
short |
| 270 |
""", |
| 271 |
arg3=True, |
| 272 |
) |
| 273 |
|
| 274 |
############################################################################ |
| 275 |
|
| 276 |
call2( |
| 277 |
# short |
| 278 |
arg1, |
| 279 |
# but |
| 280 |
arg2, |
| 281 |
# multiline |
| 282 |
""" |
| 283 |
short |
| 284 |
""", |
| 285 |
# yup |
| 286 |
arg3=True, |
| 287 |
) |
| 288 |
lcomp = [ |
| 289 |
element for element in collection if element is not None # yup # yup # right |
| 290 |
] |
| 291 |
lcomp2 = [ |
| 292 |
# hello |
| 293 |
element |
| 294 |
# yup |
| 295 |
for element in collection |
| 296 |
# right |
| 297 |
if element is not None |
| 298 |
] |
| 299 |
lcomp3 = [ |
| 300 |
# This one is actually too long to fit in a single line. |
| 301 |
element.split("\n", 1)[0] |
| 302 |
# yup |
| 303 |
for element in collection.select_elements() |
| 304 |
# right |
| 305 |
if element is not None |
| 306 |
] |
| 307 |
while True: |
| 308 |
if False: |
| 309 |
continue |
| 310 |
|
| 311 |
# and round and round we go |
| 312 |
# and round and round we go |
| 313 |
|
| 314 |
# let's return |
| 315 |
return Node( |
| 316 |
syms.simple_stmt, |
| 317 |
[Node(statement, result), Leaf(token.NEWLINE, "\n")], # FIXME: \r\n? |
| 318 |
) |
| 319 |
|
| 320 |
|
| 321 |
CONFIG_FILES = ( |
| 322 |
[ |
| 323 |
CONFIG_FILE, |
| 324 |
] |
| 325 |
+ SHARED_CONFIG_FILES |
| 326 |
+ USER_CONFIG_FILES |
| 327 |
) # type: Final |
| 328 |
|
| 329 |
|
| 330 |
class Test: |
| 331 |
def _init_host(self, parsed) -> None: |
| 332 |
if parsed.hostname is None or not parsed.hostname.strip(): # type: ignore |
| 333 |
pass |
| 334 |
|
| 335 |
|
| 336 |
####################### |
| 337 |
### SECTION COMMENT ### |
| 338 |
####################### |
| 339 |
|
| 340 |
|
| 341 |
instruction() # comment with bad spacing |
| 342 |
|
| 343 |
# END COMMENTS |
| 344 |
# MORE END COMMENTS |