Skip to content
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 CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ WIP
===

- Added ``GappedCircleModuleDrawer`` (PIL) to render QR code modules as non-contiguous circles. (BenwestGate in `#373`_)
- Improved test coveraged (akx in `#315`_)
- Migrate pyproject.toml to PEP 621-compliant [project] metadata format. (hroncok in `#399`_)
- Allow execution as a Python module. (stefansjs in `#400`_)

::

python -m qrcode --output qrcode.png "hello world"

.. _#315: https://github.com/lincolnloop/python-qrcode/pull/315
.. _#373: https://github.com/lincolnloop/python-qrcode/pull/373
.. _#399: https://github.com/lincolnloop/python-qrcode/pull/399
.. _#400: https://github.com/lincolnloop/python-qrcode/pull/400
Expand Down
14 changes: 14 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,17 @@ date-format =" %%-d %%B %%Y"
prereleaser.middle = [
"qrcode.release.update_manpage"
]

[tool.coverage.run]
source = ["qrcode"]
parallel = true

[tool.coverage.report]
exclude_lines = [
"@abc.abstractmethod",
"@overload",
"if (typing\\.)?TYPE_CHECKING:",
"pragma: no cover",
"raise NotImplementedError"
]
skip_covered = true
3 changes: 1 addition & 2 deletions qrcode/image/styledpil.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ def draw_embedded_image(self):
def save(self, stream, format=None, **kwargs):
if format is None:
format = kwargs.get("kind", self.kind)
if "kind" in kwargs:
del kwargs["kind"]
kwargs.pop("kind", None)
self._img.save(stream, format=format, **kwargs)

def __getattr__(self, name):
Expand Down
4 changes: 2 additions & 2 deletions qrcode/image/styles/moduledrawers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# For backwards compatibility, importing the PIL drawers here.
try:
from .pil import CircleModuleDrawer # noqa: F401
from .pil import GappedCircleModuleDrawer # noqa: F401
from .pil import GappedCircleModuleDrawer # noqa: F401
from .pil import GappedSquareModuleDrawer # noqa: F401
from .pil import HorizontalBarsDrawer # noqa: F401
from .pil import RoundedModuleDrawer # noqa: F401
from .pil import SquareModuleDrawer # noqa: F401
from .pil import VerticalBarsDrawer # noqa: F401
except ImportError:
except ImportError: # pragma: no cover
pass
4 changes: 3 additions & 1 deletion qrcode/image/styles/moduledrawers/pil.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ def initialize(self, *args, **kwargs):
(0, 0, fake_size, fake_size), fill=self.img.paint_color
)
smaller_size = int(self.size_ratio * box_size)
self.circle = self.circle.resize((smaller_size, smaller_size), Image.Resampling.LANCZOS)
self.circle = self.circle.resize(
(smaller_size, smaller_size), Image.Resampling.LANCZOS
)

def drawrect(self, box, is_active: bool):
if is_active:
Expand Down