forked from walkccc/cpp2python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkeywords.py
35 lines (32 loc) · 809 Bytes
/
keywords.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from typing import Dict, List
replaced_start: Dict[str, str] = {
'class Solution {': 'class Solution:',
'->': '.',
'//': '#',
'/': '//',
'false': 'False',
'true': 'True',
'||': 'or',
'"': '\'',
'.push_back(': '.append(',
'.emplace(': '.append(',
'.pop_front(': '.popleft(',
'.pop_back(': '.pop(',
'.insert(': '.add(',
'.erase(': '.remove(',
'.front()': '[0]',
'.back()': '[-1]',
'INT_MAX': 'math.inf',
'INT_MIN': '-math.inf',
'nullptr': 'None'
}
replaced_end: Dict[str, str] = {
'&&': 'and',
'1\'000\'000\'007': '1_000_000_007',
'.top()': '[-1]',
'.push(': '.append(',
}
useless: List[str] = [
'const ', 'constexpr ', 'string ', 'string& ', 'long ', 'int ', 'bool ',
'char ', '++', '--', ';', '}', '{',
]