|
18 | 18 | from ... import util |
19 | 19 |
|
20 | 20 | if typing.TYPE_CHECKING: |
| 21 | + import bmemcached |
21 | 22 | import memcache |
22 | 23 | import pylibmc |
23 | | - import bmemcached |
24 | 24 | import pymemcache |
25 | | -else: |
| 25 | + |
| 26 | +if not typing.TYPE_CHECKING: |
26 | 27 | # delayed import |
27 | | - memcache = None |
28 | | - pylibmc = None |
29 | | - bmemcached = None |
30 | | - pymemcache = None |
| 28 | + bmemcached = None # noqa F811 |
| 29 | + memcache = None # noqa F811 |
| 30 | + pylibmc = None # noqa F811 |
| 31 | + pymemcache = None # noqa F811 |
31 | 32 |
|
32 | 33 | __all__ = ( |
33 | 34 | "GenericMemcachedBackend", |
@@ -234,9 +235,6 @@ def __init__(self, arguments): |
234 | 235 | super(MemcacheArgs, self).__init__(arguments) |
235 | 236 |
|
236 | 237 |
|
237 | | -pylibmc = None |
238 | | - |
239 | | - |
240 | 238 | class PylibmcBackend(MemcacheArgs, GenericMemcachedBackend): |
241 | 239 | """A backend for the |
242 | 240 | `pylibmc <http://sendapatch.se/projects/pylibmc/index.html>`_ |
@@ -286,9 +284,6 @@ def _create_client(self): |
286 | 284 | ) |
287 | 285 |
|
288 | 286 |
|
289 | | -memcache = None |
290 | | - |
291 | | - |
292 | 287 | class MemcachedBackend(MemcacheArgs, GenericMemcachedBackend): |
293 | 288 | """A backend using the standard |
294 | 289 | `Python-memcached <http://www.tummy.com/Community/software/\ |
@@ -317,9 +312,6 @@ def _create_client(self): |
317 | 312 | return memcache.Client(self.url) |
318 | 313 |
|
319 | 314 |
|
320 | | -bmemcached = None |
321 | | - |
322 | | - |
323 | 315 | class BMemcachedBackend(GenericMemcachedBackend): |
324 | 316 | """A backend for the |
325 | 317 | `python-binary-memcached <https://github.com/jaysonsantos/\ |
@@ -430,9 +422,6 @@ def delete_multi(self, keys): |
430 | 422 | self.delete(key) |
431 | 423 |
|
432 | 424 |
|
433 | | -pymemcache = None |
434 | | - |
435 | | - |
436 | 425 | class PyMemcacheBackend(GenericMemcachedBackend): |
437 | 426 | """A backend for the |
438 | 427 | `pymemcache <https://github.com/pinterest/pymemcache>`_ |
|
0 commit comments