Skip to content

Commit 86b8976

Browse files
Merge pull request #1608 from AvitalFineRedis/MEMORY_DOCTOR
Throw NotImplementedError for MEMORY DOCTOR and MEMORY HELP
2 parents 4a97313 + 5fb24c4 commit 86b8976

File tree

1 file changed

+36
-17
lines changed

1 file changed

+36
-17
lines changed

redis/commands.py

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def client_list(self, _type=None, client_id=[]):
373373
return self.execute_command('CLIENT LIST', *args)
374374

375375
def client_getname(self):
376-
"Returns the current connection name"
376+
"""Returns the current connection name"""
377377
return self.execute_command('CLIENT GETNAME')
378378

379379
def client_reply(self, reply):
@@ -396,11 +396,12 @@ def client_reply(self, reply):
396396
return self.execute_command("CLIENT REPLY", reply)
397397

398398
def client_id(self):
399-
"Returns the current connection id"
399+
"""Returns the current connection id"""
400400
return self.execute_command('CLIENT ID')
401401

402402
def client_trackinginfo(self):
403-
"""Returns the information about the current client connection's
403+
"""
404+
Returns the information about the current client connection's
404405
use of the server assisted client side cache.
405406
See https://redis.io/commands/client-trackinginfo
406407
"""
@@ -438,39 +439,45 @@ def client_unpause(self):
438439
return self.execute_command('CLIENT UNPAUSE')
439440

440441
def readwrite(self):
441-
"Disables read queries for a connection to a Redis Cluster slave node"
442+
"""
443+
Disables read queries for a connection to a Redis Cluster slave node.
444+
"""
442445
return self.execute_command('READWRITE')
443446

444447
def readonly(self):
445-
"Enables read queries for a connection to a Redis Cluster replica node"
448+
"""
449+
Enables read queries for a connection to a Redis Cluster replica node.
450+
"""
446451
return self.execute_command('READONLY')
447452

448453
def config_get(self, pattern="*"):
449-
"Return a dictionary of configuration based on the ``pattern``"
454+
"""Return a dictionary of configuration based on the ``pattern``"""
450455
return self.execute_command('CONFIG GET', pattern)
451456

452457
def config_set(self, name, value):
453458
"Set config item ``name`` with ``value``"
454459
return self.execute_command('CONFIG SET', name, value)
455460

456461
def config_resetstat(self):
457-
"Reset runtime statistics"
462+
"""Reset runtime statistics"""
458463
return self.execute_command('CONFIG RESETSTAT')
459464

460465
def config_rewrite(self):
461-
"Rewrite config file with the minimal change to reflect running config"
466+
"""
467+
Rewrite config file with the minimal change to reflect running config.
468+
"""
462469
return self.execute_command('CONFIG REWRITE')
463470

464471
def dbsize(self):
465-
"Returns the number of keys in the current database"
472+
"""Returns the number of keys in the current database"""
466473
return self.execute_command('DBSIZE')
467474

468475
def debug_object(self, key):
469-
"Returns version specific meta information about a given key"
476+
"""Returns version specific meta information about a given key"""
470477
return self.execute_command('DEBUG OBJECT', key)
471478

472479
def echo(self, value):
473-
"Echo the string back from the server"
480+
"""Echo the string back from the server"""
474481
return self.execute_command('ECHO', value)
475482

476483
def flushall(self, asynchronous=False):
@@ -524,7 +531,8 @@ def lastsave(self):
524531
return self.execute_command('LASTSAVE')
525532

526533
def lolwut(self, *version_numbers):
527-
"""Get the Redis version and a piece of generative computer art
534+
"""
535+
Get the Redis version and a piece of generative computer art
528536
See: https://redis.io/commands/lolwut
529537
"""
530538
if version_numbers:
@@ -568,11 +576,21 @@ def migrate(self, host, port, keys, destination_db, timeout,
568576
timeout, *pieces)
569577

570578
def object(self, infotype, key):
571-
"Return the encoding, idletime, or refcount about the key"
579+
"""Return the encoding, idletime, or refcount about the key"""
572580
return self.execute_command('OBJECT', infotype, key, infotype=infotype)
573581

582+
def memory_doctor(self):
583+
raise NotImplementedError(
584+
"MEMORY DOCTOR is intentionally not implemented in the client."
585+
)
586+
587+
def memory_help(self):
588+
raise NotImplementedError(
589+
"MEMORY HELP is intentionally not implemented in the client."
590+
)
591+
574592
def memory_stats(self):
575-
"Return a dictionary of memory stats"
593+
"""Return a dictionary of memory stats"""
576594
return self.execute_command('MEMORY STATS')
577595

578596
def memory_usage(self, key, samples=None):
@@ -590,15 +608,16 @@ def memory_usage(self, key, samples=None):
590608
return self.execute_command('MEMORY USAGE', key, *args)
591609

592610
def memory_purge(self):
593-
"Attempts to purge dirty pages for reclamation by allocator"
611+
"""Attempts to purge dirty pages for reclamation by allocator"""
594612
return self.execute_command('MEMORY PURGE')
595613

596614
def ping(self):
597-
"Ping the Redis server"
615+
"""Ping the Redis server"""
598616
return self.execute_command('PING')
599617

600618
def quit(self):
601-
"""Ask the server to close the connection.
619+
"""
620+
Ask the server to close the connection.
602621
https://redis.io/commands/quit
603622
"""
604623
return self.execute_command('QUIT')

0 commit comments

Comments
 (0)