Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0498c91

Browse files
committed
Update CI workflow to split the checkers out
The checkers only need to run once, using the latest supported Python (probably?). Also fix black errors in order to re-enable it. Close ua-parser#96
1 parent ced19d4 commit 0498c91

File tree

2 files changed

+29
-20
lines changed

2 files changed

+29
-20
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,36 @@ on:
77
branches: [ master ]
88

99
jobs:
10+
checks:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
steps:
15+
- name: Checkout working copy
16+
uses: actions/checkout@v3
17+
- name: Set up Python
18+
uses: actions/setup-python@v3
19+
with:
20+
python-version: "3.8"
21+
- name: Install checkers
22+
run: |
23+
python -mpip install --upgrade pip
24+
python -mpip install black flake8
25+
- name: flake
26+
run: flake8 .
27+
- name: black
28+
run: black --check --diff --color --quiet .
29+
1030
test:
1131
runs-on: ubuntu-latest
1232
strategy:
1333
fail-fast: false
1434
matrix:
1535
python-version: ["2.7", "3.6", "3.7", "3.8"]
16-
include:
17-
- python-version: "3.8"
18-
checkers: true
1936

2037
steps:
21-
- uses: actions/checkout@v3
38+
- name: Checkout working copy
39+
uses: actions/checkout@v3
2240
- name: Set up Python ${{ matrix.python-version }}
2341
uses: actions/setup-python@v3
2442
with:
@@ -27,15 +45,6 @@ jobs:
2745
run: |
2846
python -m pip install --upgrade pip
2947
python -m pip install -r requirements.txt -r requirements_dev.txt
30-
- name: Install checkers
31-
if: ${{ matrix.checkers }}
32-
run: python -m pip install black flake8
33-
#- name: black
34-
# if: ${{ matrix.checkers }}
35-
# run: black --check --diff .
36-
- name: flake
37-
if: ${{ matrix.checkers }}
38-
run: flake8 .
3948
- name: tests
4049
run: |
4150
python setup.py develop

ua_parser/user_agent_parser.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def Parse(self, user_agent_string):
219219

220220

221221
def Parse(user_agent_string, **jsParseBits):
222-
""" Parse all the things
222+
"""Parse all the things
223223
Args:
224224
user_agent_string: the full user agent string
225225
jsParseBits: javascript override bits
@@ -244,7 +244,7 @@ def Parse(user_agent_string, **jsParseBits):
244244

245245

246246
def ParseUserAgent(user_agent_string, **jsParseBits):
247-
""" Parses the user-agent string for user agent (browser) info.
247+
"""Parses the user-agent string for user agent (browser) info.
248248
Args:
249249
user_agent_string: The full user-agent string.
250250
jsParseBits: javascript override bits.
@@ -290,7 +290,7 @@ def ParseUserAgent(user_agent_string, **jsParseBits):
290290

291291

292292
def ParseOS(user_agent_string, **jsParseBits):
293-
""" Parses the user-agent string for operating system info
293+
"""Parses the user-agent string for operating system info
294294
Args:
295295
user_agent_string: The full user-agent string.
296296
jsParseBits: javascript override bits.
@@ -312,7 +312,7 @@ def ParseOS(user_agent_string, **jsParseBits):
312312

313313

314314
def ParseDevice(user_agent_string):
315-
""" Parses the user-agent string for device info.
315+
"""Parses the user-agent string for device info.
316316
Args:
317317
user_agent_string: The full user-agent string.
318318
ua_family: The parsed user agent family name.
@@ -368,7 +368,7 @@ def ParseWithJSOverrides(
368368
js_user_agent_v2=None,
369369
js_user_agent_v3=None,
370370
):
371-
""" backwards compatible. use one of the other Parse methods instead! """
371+
"""backwards compatible. use one of the other Parse methods instead!"""
372372

373373
# Override via JS properties.
374374
if js_user_agent_family is not None and js_user_agent_family != "":
@@ -404,7 +404,7 @@ def ParseWithJSOverrides(
404404

405405

406406
def Pretty(family, v1=None, v2=None, v3=None):
407-
""" backwards compatible. use PrettyUserAgent instead! """
407+
"""backwards compatible. use PrettyUserAgent instead!"""
408408
if v3:
409409
if v3[0].isdigit():
410410
return "%s %s.%s.%s" % (family, v1, v2, v3)
@@ -477,7 +477,7 @@ def GetFilters(
477477
except ImportError:
478478
from yaml import SafeLoader
479479

480-
with open(UA_PARSER_YAML, 'rb') as fp:
480+
with open(UA_PARSER_YAML, "rb") as fp:
481481
regexes = yaml.load(fp, Loader=SafeLoader)
482482

483483
USER_AGENT_PARSERS = []

0 commit comments

Comments
 (0)