Update pre-commit repositories

This commit is contained in:
Marco Castelluccio 2023-02-06 11:42:06 +01:00
Родитель 4ede6fdaae
Коммит 5a2870be2e
17 изменённых файлов: 12 добавлений и 30 удалений

Просмотреть файл

@ -1,10 +1,10 @@
repos:
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
@ -22,7 +22,7 @@ repos:
- "flake8-debugger==4.1.2"
- "flake8-mypy==17.8.0"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.4.0
hooks:
- id: check-ast
- id: check-docstring-first
@ -41,7 +41,7 @@ repos:
- id: requirements-txt-fixer
- id: check-vcs-permalinks
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
rev: v2.2.2
hooks:
- id: codespell
exclude_types: [json]
@ -50,7 +50,7 @@ repos:
hooks:
- id: taskcluster_yml
- repo: https://github.com/asottile/yesqa
rev: v1.3.0
rev: v1.4.0
hooks:
- id: yesqa
- repo: https://github.com/pre-commit/mirrors-mypy

Просмотреть файл

@ -731,7 +731,6 @@ class BugExtractor(BaseEstimator, TransformerMixin):
already_rollbacked = set()
def apply_transform(bug):
is_couple = isinstance(bug, tuple)
if not is_couple:

Просмотреть файл

@ -49,7 +49,6 @@ class IssueExtractor(BaseEstimator, TransformerMixin):
results = []
for issue in issues():
if self.rollback:
issue = issue_snapshot.rollback(issue, self.rollback_when)

Просмотреть файл

@ -258,7 +258,6 @@ class ComponentModel(BugModel):
# than 0 bugs
for conflated_component in self.CONFLATED_COMPONENTS:
matching_components = [
full_comp
for full_comp in bugs_number
@ -286,7 +285,6 @@ class ComponentModel(BugModel):
# still exist as components and have more than 0 bugs
for full_comp in self.CONFLATED_COMPONENTS_MAPPING.values():
if full_comp not in bugs_number:
print(
f"{full_comp} from conflated component mapping doesn't exists, failure"
@ -302,7 +300,6 @@ class ComponentModel(BugModel):
# exist as components or are in CONFLATED_COMPONENTS_MAPPING
for conflated_component in self.CONFLATED_COMPONENTS:
in_mapping = conflated_component in self.CONFLATED_COMPONENTS_MAPPING
matching_components = [

Просмотреть файл

@ -66,7 +66,7 @@ class ComponentNNClassifier(KerasClassifier):
self.long_desc_emb_sz = kwargs.pop("long_desc_emb_sz")
self.model_params = kwargs.pop("params")
for (k, v) in self.model_params.items():
for k, v in self.model_params.items():
setattr(self, k, v)
return self

Просмотреть файл

@ -76,7 +76,6 @@ class DuplicateModel(BugCoupleModel):
self.clf = XGBClassifier(n_jobs=utils.get_physical_cpu_count())
def get_labels(self):
random.seed(4)
all_ids = set(

Просмотреть файл

@ -130,7 +130,7 @@ class SpamBugModel(BugModel):
return self.extraction_pipeline.named_steps["union"].get_feature_names()
def overwrite_classes(self, bugs, classes, probabilities):
for (i, bug) in enumerate(bugs):
for i, bug in enumerate(bugs):
if "@mozilla" in bug["creator"]:
if probabilities:
classes[i] = [1.0, 0.0]

Просмотреть файл

@ -48,7 +48,6 @@ def spacy_token_lemmatizer(text):
class SpacyVectorizer(TfidfVectorizer):
def __init__(self, *args, **kwargs):
# Detect when the Spacy optional dependency is missing
if not HAS_OPTIONAL_DEPENDENCIES:
raise NotImplementedError(OPT_MSG_MISSING)

Просмотреть файл

@ -45,7 +45,7 @@ class KerasClassifier(BaseEstimator, ClassifierMixin):
self.model = self.model_creator(X_dict, y)
for (epochs, batch_size) in self.fit_params:
for epochs, batch_size in self.fit_params:
self.model.fit(X_dict, y, epochs=epochs, batch_size=batch_size, verbose=1)
return self

Просмотреть файл

@ -138,7 +138,6 @@ class BaseSimilarity(abc.ABC):
return similar_bug_ids
def text_preprocess(self, text, stemming=True, lemmatization=False, join=False):
for func in self.cleanup_functions:
text = func(text)
@ -274,7 +273,6 @@ class LSISimilarity(BaseSimilarity):
self.corpus = []
for bug in bugzilla.get_bugs():
textual_features = self.text_preprocess(self.get_text(bug))
self.corpus.append([bug["id"], textual_features])
@ -349,7 +347,6 @@ class NeighborsSimilarity(BaseSimilarity):
self.similarity_calculator.fit(self.vectorizer.transform(text))
def search_similar_bugs(self, query):
processed_query = self.vectorizer.transform([self.get_text(query)])
_, indices = self.similarity_calculator.kneighbors(processed_query)
@ -466,7 +463,6 @@ class Word2VecWmdSimilarity(Word2VecSimilarityBase):
)
def search_similar_bugs(self, query):
words = self.text_preprocess(self.get_text(query))
words = [word for word in words if word in self.w2vmodel.wv.vocab]
@ -493,7 +489,6 @@ class Word2VecWmdSimilarity(Word2VecSimilarityBase):
confirmed_distances = []
for i, (doc_id, rwmd_distance) in enumerate(distances):
if (
len(confirmed_distances) >= 10
and rwmd_distance > confirmed_distances[10 - 1]
@ -520,7 +515,6 @@ class Word2VecWmdSimilarity(Word2VecSimilarityBase):
]
def get_distance(self, query1, query2):
words1 = self.text_preprocess(self.get_text(query1))
words1 = [word for word in words1 if word in self.w2vmodel.wv.vocab]
words2 = self.text_preprocess(self.get_text(query2))
@ -550,7 +544,6 @@ class Word2VecWmdRelaxSimilarity(Word2VecSimilarityBase):
self.tfidf = TfidfModel(dictionary=self.dictionary)
def search_similar_bugs(self, query):
query = self.text_preprocess(self.get_text(query))
words = [
word for word in set(chain(query, *self.corpus)) if word in self.w2vmodel.wv

Просмотреть файл

@ -121,7 +121,6 @@ def analyze_metrics(
# First process the metrics JSON files
for metric_file_path in root.glob("metric*.json"):
date, model_name, metric = parse_metric_file(metric_file_path)
# Then process the report
@ -151,7 +150,6 @@ def analyze_metrics(
# Then analyze them
for model_name in metrics:
for metric_name, values in metrics[model_name].items():
if metric_name.endswith("_std"):
LOGGER.info(
"Skipping analysis of %r, analysis is not efficient on standard deviation",

Просмотреть файл

@ -47,7 +47,7 @@ def run_untriaged(untriaged_bugs):
(ComponentModel, "../componentmodel"),
(ComponentNNModel, "../componentnnmodel"),
]
for (model_class, model_file_name) in models:
for model_class, model_file_name in models:
rows = []
model = model_class.load(model_file_name)
for bug in untriaged_bugs:

Просмотреть файл

@ -19,7 +19,6 @@ logger = getLogger(__name__)
def classify_issues(
owner: str, repo: str, retrieve_events: bool, model_name: str, issue_number: int
) -> None:
model_file_name = f"{model_name}model"
if not os.path.exists(model_file_name):

Просмотреть файл

@ -70,7 +70,6 @@ class Retriever(object):
return updated_issues, updated_ids
def retrieve_issues(self) -> None:
last_modified = None
db.download(self.github.db_path)

Просмотреть файл

@ -31,7 +31,6 @@ def parse_args(args):
def main(args):
if args.algorithm == "elasticsearch":
model = similarity.model_name_to_class[args.algorithm]()
else:

Просмотреть файл

@ -9,7 +9,6 @@ from bugbug.models.bugtype import BugTypeModel
def test_get_bugtype_labels():
model = BugTypeModel()
classes, keyword_list = model.get_labels()

Просмотреть файл

@ -186,7 +186,9 @@ def test_reduce4(failing_together: LMDBDict) -> None:
},
1.0,
)
assert result == {"windows10/opt-e",} or result == {
assert result == {
"windows10/opt-e",
} or result == {
"windows10/opt-b",
}