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

Format code with black #8

Merged
merged 4 commits into from
Mar 22, 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
28 changes: 8 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,12 @@ name: ci

on:
push:
branches: [ "master" ]
branches: [ "main" ]
pull_request:
branches: [ "master" ]
branches: [ "main" ]

jobs:
check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
sudo apt-get install -y libgpgme11-dev
curl -sSL https://install.python-poetry.org | python3 -
poetry install -n
- name: Check code
run: poetry run black bmaptools/* tests/* --check

test:
needs: check
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -47,3 +29,9 @@ jobs:
poetry install -n
- name: Run tests
run: poetry run python -m unittest -bv

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
4 changes: 2 additions & 2 deletions bmaptool/BmapCopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,14 +624,14 @@ def _get_data(self, verify):

_log.debug("the reader thread has started")
try:
for (first, last, chksum) in self._get_block_ranges():
for first, last, chksum in self._get_block_ranges():
if verify and chksum:
hash_obj = hashlib.new(self._cs_type)

self._f_image.seek(first * self.block_size)

iterator = self._get_batches(first, last)
for (start, end, length) in iterator:
for start, end, length in iterator:
try:
buf = self._f_image.read(length * self.block_size)
except IOError as err:
Expand Down
176 changes: 77 additions & 99 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/oldcodebase/BmapCopy1_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,14 +425,14 @@ def _get_data(self, verify):
* 'buf' a buffer containing the batch data."""

try:
for (first, last, sha1) in self._get_block_ranges():
for first, last, sha1 in self._get_block_ranges():
if verify and sha1:
hash_obj = hashlib.new("sha1")

self._f_image.seek(first * self.block_size)

iterator = self._get_batches(first, last)
for (start, end, length) in iterator:
for start, end, length in iterator:
try:
buf = self._f_image.read(length * self.block_size)
except IOError as err:
Expand Down
4 changes: 2 additions & 2 deletions tests/oldcodebase/BmapCopy2_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,14 @@ def _get_data(self, verify):
* 'buf' a buffer containing the batch data."""

try:
for (first, last, sha1) in self._get_block_ranges():
for first, last, sha1 in self._get_block_ranges():
if verify and sha1:
hash_obj = hashlib.new("sha1")

self._f_image.seek(first * self.block_size)

iterator = self._get_batches(first, last)
for (start, end, length) in iterator:
for start, end, length in iterator:
try:
buf = self._f_image.read(length * self.block_size)
except IOError as err:
Expand Down
4 changes: 2 additions & 2 deletions tests/oldcodebase/BmapCopy2_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,14 +375,14 @@ def _get_data(self, verify):
* 'buf' a buffer containing the batch data."""

try:
for (first, last, sha1) in self._get_block_ranges():
for first, last, sha1 in self._get_block_ranges():
if verify and sha1:
hash_obj = hashlib.new("sha1")

self._f_image.seek(first * self.block_size)

iterator = self._get_batches(first, last)
for (start, end, length) in iterator:
for start, end, length in iterator:
try:
buf = self._f_image.read(length * self.block_size)
except IOError as err:
Expand Down
4 changes: 2 additions & 2 deletions tests/oldcodebase/BmapCopy2_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,14 @@ def _get_data(self, verify):
* 'buf' a buffer containing the batch data."""

try:
for (first, last, sha1) in self._get_block_ranges():
for first, last, sha1 in self._get_block_ranges():
if verify and sha1:
hash_obj = hashlib.new("sha1")

self._f_image.seek(first * self.block_size)

iterator = self._get_batches(first, last)
for (start, end, length) in iterator:
for start, end, length in iterator:
try:
buf = self._f_image.read(length * self.block_size)
except IOError as err:
Expand Down
4 changes: 2 additions & 2 deletions tests/oldcodebase/BmapCopy2_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,14 @@ def _get_data(self, verify):
* 'buf' a buffer containing the batch data."""

try:
for (first, last, sha1) in self._get_block_ranges():
for first, last, sha1 in self._get_block_ranges():
if verify and sha1:
hash_obj = hashlib.new("sha1")

self._f_image.seek(first * self.block_size)

iterator = self._get_batches(first, last)
for (start, end, length) in iterator:
for start, end, length in iterator:
try:
buf = self._f_image.read(length * self.block_size)
except IOError as err:
Expand Down
Loading
Loading