Skip to content

Commit 795e69a

Browse files
committed
Update scripts
1 parent c386034 commit 795e69a

File tree

2 files changed

+48
-17
lines changed

2 files changed

+48
-17
lines changed

scripts/create_issues.py

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66
from dotenv import load_dotenv
77
from github import Github
88

9-
from supported import get_unimplemented_and_implemented_commands, download_redis_commands
9+
from supported import download_redis_commands, implemented_commands
1010

1111
load_dotenv() # take environment variables from .env.
1212

1313
IGNORE_GROUPS = {
1414
'server', 'cf', 'cms', 'topk', 'tdigest', 'bf', 'search', 'suggestion', 'timeseries',
1515
'graph', 'server', 'cluster', 'connection',
16-
'server', 'cluster', 'list', 'connection', 'bitmap', 'sorted-set', 'generic', 'scripting', 'geo', 'hash',
17-
'hyperloglog', 'pubsub', 'stream', 'graph', 'timeseries', 'search', 'suggestion', 'bf', 'cf', 'cms', 'topk',
18-
'tdigest', 'json',
16+
'server', 'cluster', 'list', 'connection', 'bitmap', 'sorted-set', 'generic', 'scripting',
17+
'hyperloglog', 'pubsub', 'graph', 'timeseries', 'search', 'suggestion', 'bf', 'cf', 'cms', 'topk',
18+
'tdigest',
19+
'stream',
1920
}
2021
IGNORE_COMMANDS = {
2122
'PUBSUB HELP',
@@ -28,22 +29,44 @@
2829
'JSON.DEBUG MEMORY',
2930
'JSON.DEBUG',
3031
'JSON.TYPE',
31-
'JSON.OBJKEYS',
32-
'JSON.OBJLEN',
33-
'JSON.ARRTRIM',
34-
'JSON.ARRAPPEND',
35-
'JSON.ARRINDEX',
36-
'JSON.ARRINSERT',
37-
'JSON.ARRLEN',
38-
'JSON.ARRPOP',
39-
'JSON.NUMINCRBY',
40-
'JSON.NUMMULTBY',
4132
'JSON.RESP',
4233
}
4334

4435

36+
def commands_groups(
37+
all_commands: dict, implemented_set: set
38+
) -> tuple[dict[str, list[str]], dict[str, list[str]]]:
39+
implemented, unimplemented = dict(), dict()
40+
for cmd in all_commands:
41+
if cmd.upper() in IGNORE_COMMANDS:
42+
continue
43+
group = all_commands[cmd]['group']
44+
unimplemented.setdefault(group, [])
45+
implemented.setdefault(group, [])
46+
if cmd in implemented_set:
47+
implemented[group].append(cmd)
48+
else:
49+
unimplemented[group].append(cmd)
50+
return implemented, unimplemented
51+
52+
53+
def get_unimplemented_and_implemented_commands() -> tuple[dict[str, list[str]], dict[str, list[str]]]:
54+
"""Returns 2 dictionaries, one of unimplemented commands and another of implemented commands
55+
56+
"""
57+
commands = download_redis_commands()
58+
implemented_commands_set = implemented_commands()
59+
implemented_dict, unimplemented_dict = commands_groups(commands, implemented_commands_set)
60+
groups = sorted(implemented_dict.keys(), key=lambda x: len(unimplemented_dict[x]))
61+
for group in groups:
62+
unimplemented_count = len(unimplemented_dict[group])
63+
total_count = len(implemented_dict.get(group)) + unimplemented_count
64+
print(f'{group} has {unimplemented_count}/{total_count} unimplemented commands')
65+
return unimplemented_dict, implemented_dict
66+
67+
4568
class GithubData:
46-
def __init__(self, dry=False):
69+
def __init__(self, dry=True):
4770
token = os.getenv('GITHUB_TOKEN', None)
4871
g = Github(token)
4972
self.dry = dry or (token is None)

scripts/supported.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
import os
3+
34
import requests
45

56
from fakeredis._commands import SUPPORTED_COMMANDS
@@ -45,10 +46,12 @@ def commands_groups(
4546
implemented, unimplemented = dict(), dict()
4647
for cmd in all_commands:
4748
group = all_commands[cmd]['group']
49+
unimplemented.setdefault(group, [])
50+
implemented.setdefault(group, [])
4851
if cmd in implemented_set:
49-
implemented.setdefault(group, []).append(cmd)
52+
implemented[group].append(cmd)
5053
else:
51-
unimplemented.setdefault(group, []).append(cmd)
54+
unimplemented[group].append(cmd)
5255
return implemented, unimplemented
5356

5457

@@ -87,6 +90,11 @@ def get_unimplemented_and_implemented_commands() -> tuple[dict[str, list[str]],
8790
commands = download_redis_commands()
8891
implemented_commands_set = implemented_commands()
8992
implemented_dict, unimplemented_dict = commands_groups(commands, implemented_commands_set)
93+
groups = sorted(implemented_dict.keys(), key=lambda x: len(unimplemented_dict[x]))
94+
for group in groups:
95+
unimplemented_count = len(unimplemented_dict[group])
96+
total_count = len(implemented_dict.get(group)) + unimplemented_count
97+
print(f'{group} has {unimplemented_count}/{total_count} unimplemented commands')
9098
return unimplemented_dict, implemented_dict
9199

92100

0 commit comments

Comments
 (0)