Skip to content

Commit

Permalink
Upgrade reorder_python_imports
Browse files Browse the repository at this point in the history
  • Loading branch information
lslunis committed Mar 13, 2023
1 parent 812017f commit 920254b
Show file tree
Hide file tree
Showing 56 changed files with 6 additions and 73 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ repos:
hooks:
- id: prettier
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.5.0
rev: v3.9.0
hooks:
- id: reorder-python-imports
args: [--py39-plus, --separate-relative, --separate-from-import]
args: [--py39-plus]
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
Expand Down
1 change: 0 additions & 1 deletion ice/agents/approval.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import shelve

from contextlib import contextmanager
from pathlib import Path
from typing import Optional
Expand Down
1 change: 0 additions & 1 deletion ice/agents/fake.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import random

from typing import Optional

from faker import Faker
Expand Down
1 change: 0 additions & 1 deletion ice/agents/openai.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import math

from typing import Any
from typing import Optional

Expand Down
1 change: 0 additions & 1 deletion ice/agents/ought_inference.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from urllib.parse import urljoin

import httpx

from tenacity import retry
from tenacity.stop import stop_after_attempt
from tenacity.wait import wait_random_exponential
Expand Down
1 change: 0 additions & 1 deletion ice/apis/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import Union

import httpx

from httpx import Response
from httpx import TimeoutException
from structlog.stdlib import get_logger
Expand Down
1 change: 0 additions & 1 deletion ice/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import asyncio
import functools
import inspect

from pathlib import Path

from ice.settings import CACHE_DIR
Expand Down
1 change: 0 additions & 1 deletion ice/cli_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import importlib.util
import os.path

from typing import Optional
from typing import Type

Expand Down
1 change: 0 additions & 1 deletion ice/datasets/qasper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import json
import re

from collections.abc import Sequence
from itertools import islice
from typing import Optional
Expand Down
2 changes: 0 additions & 2 deletions ice/environment.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import abc
import re
import sys

from contextvars import ContextVar
from io import TextIOWrapper
from typing import Any
Expand All @@ -12,7 +11,6 @@
import nest_asyncio
import questionary
import rich

from rich.console import Console
from rich.markdown import Markdown
from rich.panel import Panel
Expand Down
1 change: 0 additions & 1 deletion ice/evaluation/evaluation_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import Union

import pandas as pd

from pydantic import BaseModel
from rich import box
from rich.table import Table
Expand Down
1 change: 0 additions & 1 deletion ice/evaluation/summarize_experiment_evals.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import ast
import asyncio

from sys import argv

import pandas as pd
Expand Down
1 change: 0 additions & 1 deletion ice/formatter/multi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import enum
import string

from collections import Counter
from collections.abc import Mapping
from collections.abc import Sequence
Expand Down
1 change: 0 additions & 1 deletion ice/json_value.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import dataclasses

from inspect import isfunction
from math import isnan
from typing import Any
Expand Down
2 changes: 0 additions & 2 deletions ice/metrics/gold_paragraphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
Make a dataframe that contains the paragraphs that contain the gold standard quotes.
"""
import asyncio

from pathlib import Path
from typing import Optional

import pandas as pd

from structlog import get_logger

from ice.cache import diskcache
Expand Down
1 change: 0 additions & 1 deletion ice/metrics/gold_standards.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from typing import TypeVar

import pandas as pd

from pydantic import BaseModel
from pydantic.generics import GenericModel
from structlog.stdlib import get_logger
Expand Down
1 change: 0 additions & 1 deletion ice/metrics/nubia.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from urllib.parse import urljoin

import httpx

from pydantic import BaseModel

from ice.metrics.base import Metric
Expand Down
1 change: 0 additions & 1 deletion ice/metrics/qasper.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Taken from https://github.com/allenai/qasper-led-baseline/blob/main/scripts/evaluator.py
import re
import string

from collections import Counter


Expand Down
2 changes: 0 additions & 2 deletions ice/nn/bert_t5_t0_ensemble.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import functools
import re
import time

from enum import IntEnum
from typing import Tuple

import torch

from structlog.stdlib import get_logger
from transformers.models.auto.modeling_auto import AutoModelForSeq2SeqLM
from transformers.models.auto.tokenization_auto import AutoTokenizer
Expand Down
2 changes: 0 additions & 2 deletions ice/nn/tfew.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import re

from collections.abc import Callable
from dataclasses import dataclass
from time import perf_counter

import torch
import torch.nn.functional as F

from structlog.stdlib import get_logger
from torch import nn
from transformers.models.auto.modeling_auto import AutoModelForSeq2SeqLM
Expand Down
2 changes: 0 additions & 2 deletions ice/paper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re

from collections.abc import Iterator
from functools import cache
from pathlib import Path
Expand All @@ -9,7 +8,6 @@

import nltk
import requests

from nltk.tokenize import sent_tokenize
from pydantic import BaseModel
from pydantic import Field
Expand Down
2 changes: 0 additions & 2 deletions ice/recipe.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import asyncio
import importlib
import sys

from abc import abstractmethod
from collections.abc import Awaitable
from collections.abc import Callable
Expand All @@ -19,7 +18,6 @@

import defopt
import pandas as pd

from merge_args import merge_args
from pydantic import BaseSettings
from structlog.stdlib import get_logger
Expand Down
3 changes: 1 addition & 2 deletions ice/recipes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from typing import Type

from ice.recipe import Recipe

from .adherence_keyword_baseline import AdherenceKeywordBaseline
from .adherence_simple import AdherenceSimpleInstruct
from .adherence_tfew_paragraph import AdherenceParagraphTfew
Expand All @@ -22,6 +20,7 @@
from .program_search.nodes.decontext.decontextualize import PaperDecontext
from .rank_paragraphs import RankParagraphs
from .subrecipe_example import ExampleMetaRecipe
from ice.recipe import Recipe


def get_recipe_classes() -> list[Type[Recipe]]:
Expand Down
6 changes: 2 additions & 4 deletions ice/recipes/adherence_tfew_paragraph.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re

from collections import Counter
from collections.abc import Awaitable
from collections.abc import Callable
Expand All @@ -12,6 +11,8 @@
from transformers.models.auto.tokenization_auto import AutoTokenizer
from transformers.models.gpt2.tokenization_gpt2_fast import GPT2TokenizerFast

from ..trace import recorder
from ..trace import trace
from ice.apis.openai import openai_complete
from ice.evaluation.evaluate_recipe_result import RecipeResult
from ice.metrics.gold_standards import list_experiments
Expand All @@ -23,9 +24,6 @@
from ice.utils import map_async
from ice.utils import max_by_value

from ..trace import recorder
from ..trace import trace


gpt2_tokenizer: GPT2TokenizerFast = AutoTokenizer.from_pretrained("gpt2")

Expand Down
1 change: 0 additions & 1 deletion ice/recipes/best_completion.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import math

from functools import partial

from structlog.stdlib import get_logger
Expand Down
2 changes: 0 additions & 2 deletions ice/recipes/blinding_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@
- vittengl-2009.pdf
"""
import itertools

from typing import Any
from typing import Literal
from typing import Optional
from typing import Union

import rich
import tqdm

from pydantic import BaseModel
from rich.panel import Panel
from thefuzz import fuzz
Expand Down
1 change: 0 additions & 1 deletion ice/recipes/consort_flow/baseline_elicit_answer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re

from collections.abc import Sequence
from typing import Optional

Expand Down
1 change: 0 additions & 1 deletion ice/recipes/consort_flow/golds.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import itertools

from collections.abc import Sequence
from typing import Optional

Expand Down
2 changes: 0 additions & 2 deletions ice/recipes/elicit/common.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import json

from functools import reduce
from pathlib import Path

import httpx

from dotenv import dotenv_values
from tenacity import retry
from tenacity import stop_after_attempt
Expand Down
1 change: 0 additions & 1 deletion ice/recipes/elicit/search.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Optional

import httpx

from structlog import get_logger

from ice.recipe import recipe
Expand Down
1 change: 0 additions & 1 deletion ice/recipes/experiments_and_arms/num_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re

from collections.abc import Sequence

from numerizer import numerize
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json

from collections.abc import Sequence

from ice.evaluation.evaluate_recipe_result import RecipeResult
Expand Down
1 change: 0 additions & 1 deletion ice/recipes/find_best_few_shot_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from typing import TypeVar

import numpy as np

from structlog.stdlib import get_logger
from tqdm import tqdm

Expand Down
1 change: 0 additions & 1 deletion ice/recipes/meta/eval_paper_qa/quick_list.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re

from collections.abc import Sequence

from ice.formatter.multi import format_multi
Expand Down
1 change: 0 additions & 1 deletion ice/recipes/meta/eval_text_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import matplotlib.pyplot as plt
import numpy as np

from sklearn.metrics import precision_recall_curve
from sklearn.metrics import PrecisionRecallDisplay
from sklearn.metrics import roc_auc_score
Expand Down
1 change: 0 additions & 1 deletion ice/recipes/placebo_keyword_baseline.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re

from dataclasses import dataclass
from typing import Literal

Expand Down
1 change: 0 additions & 1 deletion ice/recipes/primer/answer_by_search.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import httpx

from fvalues import F

from ice.recipe import recipe
Expand Down
1 change: 0 additions & 1 deletion ice/recipes/primer/answer_by_search_direct.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import httpx

from fvalues import F

from ice.recipe import recipe
Expand Down
1 change: 0 additions & 1 deletion ice/recipes/primer/search_json.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import httpx

from fvalues import F

from ice.recipe import recipe
Expand Down
1 change: 0 additions & 1 deletion ice/recipes/primer/search_string.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import httpx

from fvalues import F

from ice.recipe import recipe
Expand Down
1 change: 0 additions & 1 deletion ice/recipes/primer/sequential_action.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import math # noqa: F401

from abc import ABC
from abc import abstractmethod
from collections.abc import Sequence
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re

from collections.abc import Sequence
from typing import Optional
from typing import TypedDict
Expand Down
1 change: 0 additions & 1 deletion ice/recipes/program_search/nodes/prune/prompts.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import math

from collections.abc import Mapping
from collections.abc import Sequence
from typing import cast
Expand Down
1 change: 0 additions & 1 deletion ice/recipes/program_search/nodes/select/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from typing import Optional

import numpy as np

from anyio import ExceptionGroup
from structlog.stdlib import get_logger

Expand Down
1 change: 0 additions & 1 deletion ice/recipes/program_search/types.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import typing as t

from typing import Optional
from typing import Union

Expand Down
Loading

0 comments on commit 920254b

Please sign in to comment.