Skip to content

Commit 9f8dbdb

Browse files
authored
Merge pull request #18 from CSCfi/feature/python-3.10
switch to python 3.10
2 parents 35c0213 + c17fc33 commit 9f8dbdb

File tree

3 files changed

+49
-29
lines changed

3 files changed

+49
-29
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Release
33
on:
44
push:
55
tags:
6-
- 'v*'
6+
- "v*"
77

88
jobs:
99
create_release:
@@ -43,10 +43,10 @@ jobs:
4343
artifact_name: crypt4gh-gui
4444
os_suffix: macos-amd64
4545
asset_name: crypt4gh-gui
46-
python-version: [3.8]
47-
46+
python-version: ["3.10"]
47+
4848
runs-on: ${{ matrix.os }}
49-
49+
5050
steps:
5151
- name: Checkout code
5252
uses: actions/checkout@v2
@@ -77,7 +77,7 @@ jobs:
7777
docker pull cscfi/pyinstaller
7878
docker run --rm -v "${PWD}:/builder" cscfi/pyinstaller --noconsole --onefile crypt4gh_gui.py --name ${{ matrix.asset_name }}
7979
sudo chown -R $USER:$GROUP dist/
80-
- name: Build artifact
80+
- name: Build artifact
8181
if: matrix.os != 'ubuntu-latest'
8282
run: |
8383
pyinstaller --noconsole --onefile crypt4gh_gui.py --name ${{ matrix.asset_name }}
@@ -86,7 +86,7 @@ jobs:
8686
cd ./dist
8787
zip --junk-paths ${{ matrix.asset_name }}-python${{ matrix.python-version }}-${{ matrix.os_suffix }}.zip ${{ matrix.artifact_name }}
8888
- name: Upload Release Asset
89-
id: upload-release-asset
89+
id: upload-release-asset
9090
uses: softprops/action-gh-release@v1
9191
if: startsWith(github.ref, 'refs/tags/')
9292
with:

.github/workflows/style.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@ jobs:
88
max-parallel: 4
99
matrix:
1010
os: [ubuntu-latest]
11-
python-version: [3.7, 3.8]
12-
11+
python-version: ["3.10"]
12+
1313
runs-on: ${{ matrix.os }}
1414

1515
steps:
16-
- uses: actions/checkout@v1
17-
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v1
19-
with:
20-
python-version: ${{ matrix.python-version }}
21-
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip
24-
pip install tox tox-gh-actions
25-
- name: Black formatting check
26-
run: tox -e black
27-
- name: Flake8 syntax check
28-
run: tox -e flake8
29-
- name: Type hints check
30-
run: tox -e mypy
16+
- uses: actions/checkout@v1
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v1
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install tox tox-gh-actions
25+
- name: Black formatting check
26+
run: tox -e black
27+
- name: Flake8 syntax check
28+
run: tox -e flake8
29+
- name: Type hints check
30+
run: tox -e mypy

crypt4gh_gui.py

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ def __init__(self, window: tk.Tk) -> None:
5353
self.my_key_field.grid(column=0, row=1, sticky=tk.W)
5454
self.my_key_field.config(state="disabled")
5555
# Auto-load generated private key if such exists: username_crypt4gh.key (can be changed in UI)
56-
default_private_key_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), f"{getpass.getuser()}_crypt4gh.key")
56+
default_private_key_path = os.path.join(
57+
os.path.dirname(os.path.abspath(__file__)),
58+
f"{getpass.getuser()}_crypt4gh.key",
59+
)
5760
if os.path.isfile(default_private_key_path):
5861
self.my_key_value.set(default_private_key_path)
5962

@@ -103,7 +106,12 @@ def __init__(self, window: tk.Tk) -> None:
103106
)
104107
self.load_their_key_button.grid(column=1, row=2, sticky=tk.E, columnspan=2)
105108

106-
self.select_file_button = tk.Button(window, text="Select File", width=OS_CONFIG["config_button_width"], command=partial(self.open_file, "file"))
109+
self.select_file_button = tk.Button(
110+
window,
111+
text="Select File",
112+
width=OS_CONFIG["config_button_width"],
113+
command=partial(self.open_file, "file"),
114+
)
107115
self.select_file_button.grid(column=1, row=3, sticky=tk.E, columnspan=2)
108116

109117
self.encrypt_button = tk.Button(
@@ -156,7 +164,11 @@ def password_prompt(self, action: Optional[str]) -> None:
156164
# This if-clause is for preventing error messages
157165
if password1 is None:
158166
return
159-
password2 = askstring("Private Key Passphrase", "Re-type Private Key Passphrase to Confirm", show="*")
167+
password2 = askstring(
168+
"Private Key Passphrase",
169+
"Re-type Private Key Passphrase to Confirm",
170+
show="*",
171+
)
160172
if password2 is None:
161173
return
162174
if password1 != password2:
@@ -191,7 +203,11 @@ def password_prompt(self, action: Optional[str]) -> None:
191203
if password is None:
192204
return
193205
while len(password) == 0:
194-
password = askstring("Private Key Passphrase", "Passphrase can't be empty", show="*")
206+
password = askstring(
207+
"Private Key Passphrase",
208+
"Passphrase can't be empty",
209+
show="*",
210+
)
195211
# This if-clause is for preventing error messages
196212
if password is None:
197213
return
@@ -207,7 +223,7 @@ def password_prompt(self, action: Optional[str]) -> None:
207223
if private_key is not None:
208224
their_key = get_public_key(self.their_key_value.get())
209225
print("Encrypting...")
210-
encrypted_file: Union[BufferedWriter, BufferedReader]
226+
encrypted_file_wb: Union[BufferedWriter, BufferedReader]
211227
original_file = open(self.file_value.get(), "rb")
212228
encrypted_file_wb = open(f"{self.file_value.get()}.c4gh", "wb")
213229
encrypt([(0, private_key, their_key)], original_file, encrypted_file_wb)
@@ -230,7 +246,11 @@ def password_prompt(self, action: Optional[str]) -> None:
230246
if password is None:
231247
return
232248
while len(password) == 0:
233-
password = askstring("Private Key Passphrase", "Passphrase can't be empty", show="*")
249+
password = askstring(
250+
"Private Key Passphrase",
251+
"Passphrase can't be empty",
252+
show="*",
253+
)
234254
# This if-clause is for preventing error messages
235255
if password is None:
236256
return

0 commit comments

Comments
 (0)