Update dev requirements (#2046)

* Update dev-requirements

* Reformat after black upgrade

* Update ruff configuration after version upgrade

* Fix new ruff errors
pull/2047/head
Gulshan Singh 2 years ago committed by GitHub
parent 03f4dd0638
commit 5ab3ed0888
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,16 +1,16 @@
black==23.3.0
coverage[toml]==7.2.6
tomli==2.0.1
isort==5.12.0
mypy==1.3.0
pytest==7.3.1
black==24.2.0
coverage[toml]==7.4.3
isort==5.13.2
mypy==1.8.0
pytest==8.0.2
pytest-cov==4.1.0
rich==13.3.5
ruff==0.0.270
rich==13.7.1
ruff==0.3.0
testresources==2.0.1
types-gdb==12.1.4.5
types-psutil==5.9.5
types-Pygments==2.15.0
types-tabulate==0.9.0
types-requests==2.31.0
vermin==1.5.2
tomli==2.0.1
types-gdb==12.1.4.20240113
types-psutil==5.9.5.20240205
types-Pygments==2.17.0.20240106
types-requests==2.31.0.20240218
types-tabulate==0.9.0.20240106
vermin==1.6.0

@ -71,6 +71,6 @@ fi
# Checking minimum python version
vermin -vvv --no-tips -t=3.8- --violations ./pwndbg/
ruff check --show-source ${LINT_FILES}
ruff check --output-format=full ${LINT_FILES}
mypy pwndbg

@ -2,6 +2,7 @@
Allows describing functions, specifically enumerating arguments which
may be passed in a combination of registers and stack values.
"""
from __future__ import annotations
import gdb

@ -350,15 +350,15 @@ def query(prompt, model="text-davinci-003", max_tokens=100, temperature=0.0):
if dummy:
return f"""This is a dummy response for unit testing purposes.\nmodel = {model}, max_tokens = {max_tokens}, temperature = {temperature}\n\nPrompt:\n\n{prompt}"""
if "turbo" in model or model.startswith("gpt-4"):
if type(prompt) is str:
if isinstance(prompt, str):
prompt = [{"role": "user", "content": prompt}]
return query_openai_chat(prompt, model, max_tokens, temperature)
elif model.startswith("claude"):
if type(prompt) is list:
if isinstance(prompt, list):
prompt = flatten_prompt(prompt)
return query_anthropic(prompt, model, max_tokens, temperature)
else:
if type(prompt) is list:
if isinstance(prompt, list):
prompt = flatten_prompt(prompt)
return query_openai_completions(prompt, model, max_tokens, temperature)

@ -1,6 +1,7 @@
"""
Command to start an interactive IPython prompt.
"""
from __future__ import annotations
import sys

@ -1,6 +1,7 @@
from __future__ import annotations
import argparse
from typing import Union
import pwndbg.chain
import pwndbg.color.message as message
@ -122,17 +123,17 @@ def flag_str_to_val(flagstr):
return flag_int
def parse_str_or_int(val, parser):
def parse_str_or_int(val: Union[str, int], parser):
"""
Try parsing a string with one of the parsers above or by converting it to
an int, or passes the value through if it is already an integer.
"""
if type(val) is str:
if isinstance(val, str):
candidate = parser(val)
if candidate != 0:
return candidate
return int(val, 0)
elif type(val) is int:
elif isinstance(val, int):
return val
else:
# Getting here is a bug, we shouldn't be seeing other types at all.

@ -4,6 +4,7 @@ Commands for dealing with Linux kernel slab allocator. Currently, only SLUB is s
Some of the code here was inspired from https://github.com/NeatMonster/slabdbg
Some of the code here was inspired from https://github.com/osandov/drgn
"""
from __future__ import annotations
import argparse

@ -2,6 +2,7 @@
Launches the target process after setting a breakpoint at a convenient
entry point.
"""
from __future__ import annotations
import argparse

@ -1,6 +1,7 @@
"""
Command to print the information of the current Thread Local Storage (TLS).
"""
from __future__ import annotations
import argparse

@ -2,7 +2,6 @@
Displays gdb, python and pwndbg versions.
"""
from __future__ import annotations
import argparse

@ -1,6 +1,7 @@
"""
Command to print the virtual memory map a la /proc/self/maps.
"""
from __future__ import annotations
import argparse

@ -14,6 +14,7 @@ module, for example:
>>> int(pwndbg.gdblib.config.example_value)
7
"""
from __future__ import annotations
from typing import Any

@ -2,7 +2,6 @@
Reading, writing, and describing memory.
"""
from __future__ import annotations
import re

@ -2,6 +2,7 @@
Reading register value from the inferior, and provides a
standardized interface to registers like "sp" and "pc".
"""
from __future__ import annotations
import ctypes

@ -5,6 +5,7 @@ vice-versa.
Uses IDA when available if there isn't sufficient symbol
information available.
"""
from __future__ import annotations
import re

@ -5,6 +5,7 @@ address ranges with various ELF files and permissions.
The reason that we need robustness is that not every operating
system has /proc/$$/maps, which backs 'info proc mapping'.
"""
from __future__ import annotations
import bisect

@ -1254,15 +1254,19 @@ class GlibcMemoryAllocator(pwndbg.heap.heap.MemoryAllocator):
return (
56 + (sz >> 6)
if (sz >> 6) <= 38
else 91 + (sz >> 9)
if (sz >> 9) <= 20
else 110 + (sz >> 12)
if (sz >> 12) <= 10
else 119 + (sz >> 15)
if (sz >> 15) <= 4
else 124 + (sz >> 18)
if (sz >> 18) <= 2
else 126
else (
91 + (sz >> 9)
if (sz >> 9) <= 20
else (
110 + (sz >> 12)
if (sz >> 12) <= 10
else (
119 + (sz >> 15)
if (sz >> 15) <= 4
else 124 + (sz >> 18) if (sz >> 18) <= 2 else 126
)
)
)
)
def largebin_index_32_big(self, sz):
@ -1273,15 +1277,19 @@ class GlibcMemoryAllocator(pwndbg.heap.heap.MemoryAllocator):
return (
49 + (sz >> 6)
if (sz >> 6) <= 45
else 91 + (sz >> 9)
if (sz >> 9) <= 20
else 110 + (sz >> 12)
if (sz >> 12) <= 10
else 119 + (sz >> 15)
if (sz >> 15) <= 4
else 124 + (sz >> 18)
if (sz >> 18) <= 2
else 126
else (
91 + (sz >> 9)
if (sz >> 9) <= 20
else (
110 + (sz >> 12)
if (sz >> 12) <= 10
else (
119 + (sz >> 15)
if (sz >> 15) <= 4
else 124 + (sz >> 18) if (sz >> 18) <= 2 else 126
)
)
)
)
def largebin_index_64(self, sz):
@ -1292,15 +1300,19 @@ class GlibcMemoryAllocator(pwndbg.heap.heap.MemoryAllocator):
return (
48 + (sz >> 6)
if (sz >> 6) <= 48
else 91 + (sz >> 9)
if (sz >> 9) <= 20
else 110 + (sz >> 12)
if (sz >> 12) <= 10
else 119 + (sz >> 15)
if (sz >> 15) <= 4
else 124 + (sz >> 18)
if (sz >> 18) <= 2
else 126
else (
91 + (sz >> 9)
if (sz >> 9) <= 20
else (
110 + (sz >> 12)
if (sz >> 12) <= 10
else (
119 + (sz >> 15)
if (sz >> 15) <= 4
else 124 + (sz >> 18) if (sz >> 18) <= 2 else 126
)
)
)
)
def largebin_index(self, sz):

@ -3,6 +3,7 @@ Talks to an XMLRPC server running inside of an active IDA Pro instance,
in order to query it about the database. Allows symbol resolution and
interactive debugging.
"""
from __future__ import annotations
import errno

@ -2,6 +2,7 @@
Reading register value from the inferior, and provides a
standardized interface to registers like "sp" and "pc".
"""
from __future__ import annotations
from typing import Any

@ -2,6 +2,9 @@
line-length = 100
[tool.ruff]
line-length = 100
[tool.ruff.lint]
ignore = [
"A003",
"E402",
@ -13,7 +16,7 @@ ignore = [
"F841",
"W505",
]
line-length = 100
select = [
"A",
"E",
@ -21,7 +24,7 @@ select = [
"W",
]
[tool.ruff.flake8-builtins]
[tool.ruff.lint.flake8-builtins]
builtins-ignorelist = [
"all",
"bin",
@ -38,7 +41,7 @@ builtins-ignorelist = [
"type",
]
[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
[tool.mypy]

@ -19,9 +19,11 @@ def generate_expected_malloc_chunk_output(chunks):
size = int(
chunks["allocated"][
"mchunk_size"
if "mchunk_size" in (f.name for f in chunks["allocated"].type.fields())
else "size"
(
"mchunk_size"
if "mchunk_size" in (f.name for f in chunks["allocated"].type.fields())
else "size"
)
]
)
real_size = size & (0xFFFFFFFFFFFFFFF - 0b111)
@ -34,9 +36,11 @@ def generate_expected_malloc_chunk_output(chunks):
size = int(
chunks["tcache"][
"mchunk_size"
if "mchunk_size" in (f.name for f in chunks["tcache"].type.fields())
else "size"
(
"mchunk_size"
if "mchunk_size" in (f.name for f in chunks["tcache"].type.fields())
else "size"
)
]
)
real_size = size & (0xFFFFFFFFFFFFFFF - 0b111)
@ -50,9 +54,11 @@ def generate_expected_malloc_chunk_output(chunks):
size = int(
chunks["fast"][
"mchunk_size"
if "mchunk_size" in (f.name for f in chunks["fast"].type.fields())
else "size"
(
"mchunk_size"
if "mchunk_size" in (f.name for f in chunks["fast"].type.fields())
else "size"
)
]
)
real_size = size & (0xFFFFFFFFFFFFFFF - 0b111)
@ -66,9 +72,11 @@ def generate_expected_malloc_chunk_output(chunks):
size = int(
chunks["small"][
"mchunk_size"
if "mchunk_size" in (f.name for f in chunks["small"].type.fields())
else "size"
(
"mchunk_size"
if "mchunk_size" in (f.name for f in chunks["small"].type.fields())
else "size"
)
]
)
real_size = size & (0xFFFFFFFFFFFFFFF - 0b111)
@ -83,9 +91,11 @@ def generate_expected_malloc_chunk_output(chunks):
size = int(
chunks["large"][
"mchunk_size"
if "mchunk_size" in (f.name for f in chunks["large"].type.fields())
else "size"
(
"mchunk_size"
if "mchunk_size" in (f.name for f in chunks["large"].type.fields())
else "size"
)
]
)
real_size = size & (0xFFFFFFFFFFFFFFF - 0b111)
@ -102,9 +112,11 @@ def generate_expected_malloc_chunk_output(chunks):
size = int(
chunks["unsorted"][
"mchunk_size"
if "mchunk_size" in (f.name for f in chunks["unsorted"].type.fields())
else "size"
(
"mchunk_size"
if "mchunk_size" in (f.name for f in chunks["unsorted"].type.fields())
else "size"
)
]
)
real_size = size & (0xFFFFFFFFFFFFFFF - 0b111)

@ -28,9 +28,9 @@ import pwndbg.gdblib.config
0,
"0",
{
"param_class": gdb.PARAM_ZUINTEGER
if hasattr(gdb, "PARAM_ZUINTEGER")
else "PARAM_ZUINTEGER"
"param_class": (
gdb.PARAM_ZUINTEGER if hasattr(gdb, "PARAM_ZUINTEGER") else "PARAM_ZUINTEGER"
)
},
),
(
@ -38,9 +38,11 @@ import pwndbg.gdblib.config
-1,
"unlimited",
{
"param_class": gdb.PARAM_ZUINTEGER_UNLIMITED
if hasattr(gdb, "PARAM_ZUINTEGER_UNLIMITED")
else "PARAM_ZUINTEGER_UNLIMITED"
"param_class": (
gdb.PARAM_ZUINTEGER_UNLIMITED
if hasattr(gdb, "PARAM_ZUINTEGER_UNLIMITED")
else "PARAM_ZUINTEGER_UNLIMITED"
)
},
),
),

Loading…
Cancel
Save