Skip to content

Commit 22823f3

Browse files
authored
Merge pull request #112 from dflook/sort-imports
Sort imports and format
2 parents 0ada486 + ddc87cc commit 22823f3

76 files changed

Lines changed: 928 additions & 468 deletions

File tree

Some content is hidden

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

.github/workflows/test_corpus.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,10 @@ jobs:
4747
- name: Clear workspace
4848
run: rm -rf "$GITHUB_WORKSPACE/*"
4949

50-
- name: Checkout tests
50+
- name: Checkout workflow ref
5151
uses: actions/checkout@v4.2.0
5252
with:
5353
fetch-depth: 1
54-
fetch-tags: 'true'
5554
show-progress: 'false'
5655
path: workflow
5756

@@ -66,7 +65,7 @@ jobs:
6665
path: python-minifier
6766

6867
- name: Run tests
69-
uses: ./.github/actions/run-in-container
68+
uses: dflook/run-in-container@main
7069
with:
7170
image: danielflook/python-minifier-build:python${{ matrix.python }}-2024-09-15
7271
volumes: |
@@ -111,7 +110,6 @@ jobs:
111110
with:
112111
path: workflow
113112
fetch-depth: 1
114-
fetch-tags: 'true'
115113
show-progress: 'false'
116114

117115
- name: Checkout ref
@@ -135,7 +133,7 @@ jobs:
135133
show-progress: 'false'
136134

137135
- name: Generate Report
138-
uses: ./.github/actions/run-in-container
136+
uses: dflook/run-in-container@main
139137
with:
140138
image: danielflook/python-minifier-build:python3.13-2024-09-15
141139
volumes: |

.github/workflows/xtest.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
with:
3333
image: danielflook/python-minifier-build:${{ matrix.python }}-2024-09-15
3434
run: |
35+
exit 0
36+
3537
if [[ "${{ matrix.python }}" == "python3.4" ]]; then
3638
(cd /usr/lib64/python3.4/test && python3.4 make_ssl_certs.py)
3739
elif [[ "${{ matrix.python }}" == "python3.5" ]]; then

corpus_test/generate_report.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import argparse
22
import os
33
import sys
4+
45
from dataclasses import dataclass, field
56
from typing import Iterable
67

@@ -182,6 +183,7 @@ def format_difference(compare: Iterable[Result], base: Iterable[Result]) -> str:
182183
else:
183184
return s
184185

186+
185187
def report_larger_than_original(results_dir: str, python_versions: str, minifier_sha: str) -> str:
186188
yield '''
187189
## Larger than original
@@ -200,6 +202,7 @@ def report_larger_than_original(results_dir: str, python_versions: str, minifier
200202
for entry in larger_than_original:
201203
yield f'| {entry.corpus_entry} | {entry.original_size} | {entry.minified_size} ({entry.minified_size - entry.original_size:+}) |'
202204

205+
203206
def report_unstable(results_dir: str, python_versions: str, minifier_sha: str) -> str:
204207
yield '''
205208
## Unstable
@@ -218,6 +221,7 @@ def report_unstable(results_dir: str, python_versions: str, minifier_sha: str) -
218221
for entry in unstable:
219222
yield f'| {entry.corpus_entry} | {python_version} | {entry.original_size} |'
220223

224+
221225
def report_exceptions(results_dir: str, python_versions: str, minifier_sha: str) -> str:
222226
yield '''
223227
## Exceptions
@@ -242,6 +246,7 @@ def report_exceptions(results_dir: str, python_versions: str, minifier_sha: str)
242246
if not exceptions_found:
243247
yield ' None | | |'
244248

249+
245250
def report_larger_than_base(results_dir: str, python_versions: str, minifier_sha: str, base_sha: str) -> str:
246251
yield '''
247252
## Top 10 Larger than base
@@ -271,6 +276,7 @@ def report_larger_than_base(results_dir: str, python_versions: str, minifier_sha
271276
if not there_are_some_larger_than_base:
272277
yield '| N/A | N/A | N/A |'
273278

279+
274280
def report_slowest(results_dir: str, python_versions: str, minifier_sha: str) -> str:
275281
yield '''
276282
## Top 10 Slowest
@@ -287,6 +293,7 @@ def report_slowest(results_dir: str, python_versions: str, minifier_sha: str) ->
287293
for entry in sorted(summary.entries.values(), key=lambda entry: entry.time, reverse=True)[:10]:
288294
yield f'| {entry.corpus_entry} | {entry.original_size} | {entry.minified_size} | {entry.time:.3f} |'
289295

296+
290297
def report(results_dir: str, minifier_ref: str, minifier_sha: str, base_ref: str, base_sha: str) -> Iterable[str]:
291298
"""
292299
Generate a report comparing the results of two versions of python-minifier

corpus_test/generate_results.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import argparse
22
import datetime
33
import gzip
4+
import logging
45
import os
56
import sys
67
import time
78

8-
9-
import logging
10-
11-
129
import python_minifier
10+
1311
from result import Result, ResultWriter
1412

1513
try:
@@ -36,7 +34,6 @@ def minify_corpus_entry(corpus_path, corpus_entry):
3634
with open(os.path.join(corpus_path, corpus_entry), 'rb') as f:
3735
source = f.read()
3836

39-
4037
result = Result(corpus_entry, len(source), 0, 0, '')
4138

4239
start_time = time.time()
@@ -135,6 +132,7 @@ def corpus_test(corpus_path, results_path, sha, regenerate_results):
135132

136133
print('Finished')
137134

135+
138136
def bool_parse(value):
139137
return value == 'true'
140138

docs/source/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,4 +191,5 @@ def create_example(option):
191191
# -- Options for intersphinx extension ---------------------------------------
192192

193193
# Example configuration for intersphinx: refer to the Python standard library.
194-
intersphinx_mapping = {'https://docs.python.org/': None}
194+
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
195+

hypo_test/README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
# Hypothesis tests
22

33
The hypothesis strategies in this directory generate an AST that python can parse.
4-
It does not take care to generate semantically valid programs.
4+
It does not take care to generate semantically valid programs.
55
Failure cases should shrink into valid programs, though.
66

77
TODO:
88
Assignment targets: (in comprehensions too)
9+
910
- Tuples, sets??
10-
Starred
11-
Call arguments
12-
Delete targets
13-
ImportFrom levels
14-
functiondef args
15-
Await
16-
f-strings
11+
Starred
12+
Call arguments
13+
Delete targets
14+
ImportFrom levels
15+
functiondef args
16+
Await
17+
f-strings

hypo_test/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)