Skip to content

Commit edfd55a

Browse files
authored
Merge branch 'master' into torchaudio
2 parents 86e9d20 + 373f6c7 commit edfd55a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+2949
-18
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "wordcount",
3+
"image": "mcr.microsoft.com/devcontainers/python:3.13-bookworm",
4+
"workspaceFolder": "/workspaces/materials/wordcount",
5+
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/materials,type=bind",
6+
"postCreateCommand": {
7+
"project": "python -m pip install -r requirements.txt -e . && rm -rf src/*.egg-info/",
8+
"help": "echo 'echo -e \"💡 Run \\e[1mpytest --task\\e[0m to display instructions for the current task.\n💡 Run \\e[1mpytest\\e[0m to evaluate your solution and track your progress.\"' >> ~/.bashrc"
9+
},
10+
"customizations": {
11+
"codespaces": {
12+
"openFiles": [
13+
"src/wordcount.py"
14+
]
15+
},
16+
"vscode": {
17+
"extensions": [
18+
"ms-python.python"
19+
]
20+
}
21+
}
22+
}

python-bitwise-operators/README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
# Bitwise Operators in Python
22

3-
Source code of the least-significant bit **steganography** example from the [Bitwise Operators in Python](https://realpython.com/python-bitwise-operators/) article.
3+
Source code of the least-significant bit steganography example from the [Bitwise Operators in Python](https://realpython.com/python-bitwise-operators/) tutorial.
44

55
## Installation
66

7-
There are no external dependencies except for a Python interpreter.
7+
There are no external dependencies except for a Python interpreter. You can install this project by creating a new [virtual environment](https://realpython.com/python-virtual-environments-a-primer/), activating it, and installing the Python package:
8+
9+
```shell
10+
$ python -m venv venv/
11+
$ source venv/bin/activate
12+
(venv) python -m pip install .
13+
```
814

915
## Running
1016

11-
Change directory to the current folder, where this `README.md` file is located, and then execute Python module:
17+
Once the project is installed within your virtual environment, you can use the `stegano` command:
1218

1319
```shell
14-
$ python -m stegano /path/to/bitmap (--encode /path/to/file | --decode | --erase)
20+
$ stegano /path/to/bitmap (--encode /path/to/file | --decode | --erase)
1521
```
1622

1723
For example, to extract a secret file from the attached bitmap, type the following:
1824

1925
```shell
20-
$ python -m stegano example.bmp -d
26+
$ stegano example.bmp -d
2127
Extracted a secret file: podcast.mp4
2228
```
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[build-system]
2+
requires = ["setuptools>=64.0.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "stegano"
7+
version = "1.0.0"
8+
description = "Least Significant Bit Steganography in Python"
9+
authors = [
10+
{ name="Bartosz Zaczyński", email="[email protected]" }
11+
]
12+
readme = "README.md"
13+
license = { text = "MIT" }
14+
15+
[project.scripts]
16+
stegano = "stegano.__main__:entry_point"

python-bitwise-operators/src/stegano/__init__.py

Whitespace-only changes.

python-bitwise-operators/stegano/__main__.py renamed to python-bitwise-operators/src/stegano/__main__.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,23 @@
33
$ python -m stegano
44
"""
55

6-
from .bitmap import Bitmap
7-
from .cli import CommandLineArguments, parse_args
8-
from .decoder import DecodingError, decode
9-
from .encoder import EncodingError, encode
10-
from .eraser import erase
6+
from stegano.bitmap import Bitmap
7+
from stegano.cli import CommandLineArguments, parse_args
8+
from stegano.decoder import DecodingError, decode
9+
from stegano.encoder import EncodingError, encode
10+
from stegano.eraser import erase
1111

1212

13-
def main(args: CommandLineArguments) -> None:
13+
def entry_point() -> None:
1414
"""Entry point to the script."""
15+
try:
16+
main(parse_args())
17+
except (EncodingError, DecodingError) as ex:
18+
print(ex)
19+
20+
21+
def main(args: CommandLineArguments) -> None:
22+
"""Handle the command line arguments and perform actions."""
1523
with Bitmap(args.bitmap) as bitmap:
1624
if args.encode:
1725
encode(bitmap, args.encode)
@@ -22,7 +30,4 @@ def main(args: CommandLineArguments) -> None:
2230

2331

2432
if __name__ == "__main__":
25-
try:
26-
main(parse_args())
27-
except (EncodingError, DecodingError) as ex:
28-
print(ex)
33+
entry_point()
File renamed without changes.
File renamed without changes.

python-bitwise-operators/stegano/decoder.py renamed to python-bitwise-operators/src/stegano/decoder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pathlib import Path
77
from typing import Iterator
88

9-
from .bitmap import Bitmap
9+
from stegano.bitmap import Bitmap
1010

1111

1212
class DecodingError(Exception):

python-bitwise-operators/stegano/encoder.py renamed to python-bitwise-operators/src/stegano/encoder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pathlib
66
from typing import Iterator
77

8-
from .bitmap import Bitmap
8+
from stegano.bitmap import Bitmap
99

1010

1111
class EncodingError(Exception):

python-bitwise-operators/stegano/eraser.py renamed to python-bitwise-operators/src/stegano/eraser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from itertools import islice
66
from random import random
77

8-
from .bitmap import Bitmap
8+
from stegano.bitmap import Bitmap
99

1010

1111
def erase(bitmap: Bitmap) -> None:

0 commit comments

Comments
 (0)