Skip to content

Commit a3eccd7

Browse files
committed
Replace duplicate utilities with flutes
1 parent 6f26d0f commit a3eccd7

23 files changed

+133
-937
lines changed

analyze_fails.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from collections import defaultdict
77
from typing import Dict, List, Tuple
88

9+
import flutes
910
import numpy as np
1011
from IPython import embed
1112
from tqdm import tqdm
@@ -58,7 +59,7 @@ def analyze_logs(path: str) -> Dict[str, InfoDict]:
5859

5960

6061
def main():
61-
ghcc.utils.register_ipython_excepthook()
62+
flutes.register_ipython_excepthook()
6263
random.seed(ghcc.__MAGIC__)
6364
np.random.seed(ghcc.__MAGIC__)
6465

compare_logs.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from collections import defaultdict
55
from typing import Dict, Tuple
66

7-
import ghcc
7+
import flutes
88

99
DiffDict = Dict[str, Tuple[int, int]]
1010

@@ -45,11 +45,11 @@ def parse_logs(path: str) -> Dict[str, Dict[str, int]]:
4545
def compare_logs(info_old: Dict[str, Dict[str, int]], info_new: Dict[str, Dict[str, int]]) -> Dict[str, DiffDict]:
4646
for repo_name in info_new:
4747
if repo_name not in info_old:
48-
ghcc.log(f"{repo_name} missing in OLD log", "error")
48+
flutes.log(f"{repo_name} missing in OLD log", "error")
4949
repo_diff: Dict[str, DiffDict] = defaultdict(dict)
5050
for repo_name in info_old:
5151
if repo_name not in info_new:
52-
ghcc.log(f"{repo_name} missing in NEW", "error")
52+
flutes.log(f"{repo_name} missing in NEW", "error")
5353
continue
5454
old_repo_info = info_old[repo_name]
5555
new_repo_info = info_new[repo_name]
@@ -61,7 +61,7 @@ def compare_logs(info_old: Dict[str, Dict[str, int]], info_new: Dict[str, Dict[s
6161
difference.append(f"{tag} {old_val}->{new_val}")
6262
repo_diff[repo_name][tag] = (old_val, new_val)
6363
if len(difference) > 0:
64-
ghcc.log(f"{repo_name}: {', '.join(difference)}")
64+
flutes.log(f"{repo_name}: {', '.join(difference)}")
6565
return repo_diff
6666

6767

ghcc/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from .compile import *
22
from .database import *
3-
from .log import *
43
from .repo import *
54
from . import parse
65
from . import utils

ghcc/compile.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
from enum import Enum, auto
88
from typing import Callable, Dict, Iterator, List, NamedTuple, Optional
99

10+
from flutes.run import run_command
11+
1012
from .database import RepoDB
1113
from .repo import clean
1214
from .utils.docker import run_docker_command
13-
from .utils.run import run_command
1415

1516
MOCK_PATH = os.path.abspath(os.path.join(os.path.split(__file__)[0], "..", "..", "scripts", "mock_path"))
1617

ghcc/log.py

-177
This file was deleted.

ghcc/parse/lexer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Iterator, List, NamedTuple, Tuple
1+
from typing import Iterator, List, NamedTuple
22

33
from pycparser.c_lexer import CLexer
44

ghcc/parse/parser.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
from typing import Dict, Optional, Set, Tuple
66

77
import pycparser
8+
from flutes.fs import remove_prefix
9+
from flutes.run import run_command
810
from pycparser import c_ast
911
from pycparser.c_ast import Node as ASTNode
1012
from pycparser.c_generator import CGenerator
1113
from pycparser.c_parser import CParser
1214

1315
from .lexer import LexerWrapper
14-
from ..utils.fs import remove_prefix
15-
from ..utils.run import run_command
1616

1717
__all__ = [
1818
"FAKE_LIBC_PATH",

ghcc/repo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from enum import Enum, auto
66
from typing import NamedTuple, Optional
77

8-
from .utils.run import run_command
8+
from flutes.run import run_command
99

1010
__all__ = [
1111
"CloneErrorType",

ghcc/utils/__init__.py

-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
11
from .docker import *
2-
from .exception import *
3-
from .fs import *
4-
from .functional import *
5-
from .multiproc import *
6-
from .run import *

ghcc/utils/docker.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from pathlib import Path
55
from typing import Dict, List, Optional, Tuple, Union
66

7-
from .run import CommandResult, error_wrapper, run_command
8-
from ..log import log
7+
from flutes.log import log
8+
from flutes.run import CommandResult, error_wrapper, run_command
99

1010
__all__ = [
1111
"run_docker_command",

0 commit comments

Comments
 (0)