Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps-dev): bump black from 23.12.1 to 24.1.1 #1955

Merged
merged 4 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/flake8.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ extend-ignore =
F811,
# E501 line too long (prefer black)
E501,
# E701 multiple statements on one line (colon) (prefer black, see https://github.com/psf/black/issues/4173)
E701,
# B010 Do not call setattr with a constant attribute value
B010,
# G200 Logging statement uses exception in arguments
Expand Down
3 changes: 1 addition & 2 deletions capa/features/address.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

class Address(abc.ABC):
@abc.abstractmethod
def __eq__(self, other):
...
def __eq__(self, other): ...

@abc.abstractmethod
def __lt__(self, other):
Expand Down
1 change: 1 addition & 0 deletions capa/features/freeze/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
"""

import json
import zlib
import logging
Expand Down
6 changes: 3 additions & 3 deletions capa/ida/plugin/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,9 +932,9 @@ def get_ask_use_persistent_cache(self, analyze):
update_wait_box("verifying cached results")

try:
results: Optional[
capa.render.result_document.ResultDocument
] = capa.ida.helpers.load_and_verify_cached_results()
results: Optional[capa.render.result_document.ResultDocument] = (
capa.ida.helpers.load_and_verify_cached_results()
)
except Exception as e:
capa.ida.helpers.inform_user_ida_ui("Failed to verify cached results, reanalyzing program")
logger.exception("Failed to verify cached results (error: %s)", e)
Expand Down
8 changes: 5 additions & 3 deletions capa/ida/plugin/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,11 @@ def load_preview_meta(self, ea, author, scope):
" references:",
" - <insert_references>",
" examples:",
f" - {capa.ida.helpers.get_file_md5().upper()}:{hex(ea)}"
if ea
else f" - {capa.ida.helpers.get_file_md5().upper()}",
(
f" - {capa.ida.helpers.get_file_md5().upper()}:{hex(ea)}"
if ea
else f" - {capa.ida.helpers.get_file_md5().upper()}"
),
" features:",
]
self.setText("\n".join(metadata_default))
Expand Down
4 changes: 2 additions & 2 deletions capa/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ def result_rec(result: capa.features.common.Result):
)
for t in threads
if t in matched_threads
) # this object is open to extension in the future,
), # this object is open to extension in the future,
# such as with the function name, etc.
)
for p, threads in threads_by_process.items()
Expand Down Expand Up @@ -524,7 +524,7 @@ def compute_static_layout(rules: RuleSet, extractor: StaticFeatureExtractor, cap
address=frz.Address.from_capa(f),
matched_basic_blocks=tuple(
rdoc.BasicBlockLayout(address=frz.Address.from_capa(bb)) for bb in bbs if bb in matched_bbs
) # this object is open to extension in the future,
), # this object is open to extension in the future,
# such as with the function name, etc.
)
for f, bbs in bbs_by_function.items()
Expand Down
9 changes: 4 additions & 5 deletions capa/render/result_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ class CompoundStatementType:
OPTIONAL = "optional"


class StatementModel(FrozenModel):
...
class StatementModel(FrozenModel): ...


class CompoundStatement(StatementModel):
Expand Down Expand Up @@ -650,9 +649,9 @@ def from_capa(cls, meta: Metadata, rules: RuleSet, capabilities: MatchResults) -
return ResultDocument(meta=meta, rules=rule_matches)

def to_capa(self) -> Tuple[Metadata, Dict]:
capabilities: Dict[
str, List[Tuple[capa.features.address.Address, capa.features.common.Result]]
] = collections.defaultdict(list)
capabilities: Dict[str, List[Tuple[capa.features.address.Address, capa.features.common.Result]]] = (
collections.defaultdict(list)
)

# this doesn't quite work because we don't have the rule source for rules that aren't matched.
rules_by_name = {
Expand Down
1 change: 1 addition & 0 deletions capa/render/verbose.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
"""

from typing import cast

import tabulate
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ dev = [
"flake8-use-pathlib==0.3.0",
"flake8-copyright==0.2.4",
"ruff==0.1.14",
"black==23.12.1",
"black==24.1.1",
"isort==5.13.2",
"mypy==1.8.0",
"psutil==5.9.2",
Expand Down
1 change: 1 addition & 0 deletions scripts/cache-ruleset.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
"""

import sys
import logging
import argparse
Expand Down
1 change: 1 addition & 0 deletions scripts/capafmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
"""

import sys
import logging
import argparse
Expand Down
1 change: 1 addition & 0 deletions scripts/import-to-ida.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
"""

import logging
import binascii
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions scripts/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
"""

import gc
import os
import re
Expand Down
Loading