-
-
Notifications
You must be signed in to change notification settings - Fork 631
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0fd729b
commit 87e2d49
Showing
26 changed files
with
194 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[flake8] | ||
per-file-ignores = | ||
# line too long | ||
*.py: E501 | ||
bin/migrate.py: E501 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Run Python Linter | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
paths: | ||
- '**/*.py' | ||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- '**/*.py' | ||
|
||
jobs: | ||
run-python-linter: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.7"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements/requirements.linter.txt | ||
- name: Analyzing the code with flake8 | ||
run: | | ||
if [ -n "$(git ls-files '**/*.py')" ]; then | ||
flake8 $(git ls-files '**/*.py') | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
from __future__ import unicode_literals | ||
|
||
|
||
class SigalrmException(Exception): | ||
pass | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,46 @@ | ||
from __future__ import unicode_literals | ||
|
||
comma = ','.join | ||
quest = lambda l: '=?,'.join(l) + '=?' | ||
quest_2 = lambda l, c: ', '.join([('%s=CASE ' % x) + ("WHEN asset_id=? THEN ? " * c) + 'ELSE asset_id END' for x in l]) | ||
|
||
|
||
def quest(values): | ||
return '=?,'.join(values) + '=?' | ||
|
||
|
||
def quest_2(values, c): | ||
return ', '.join([('%s=CASE ' % x) + ("WHEN asset_id=? THEN ? " * c) + 'ELSE asset_id END' for x in values]) | ||
|
||
|
||
exists_table = "SELECT name FROM sqlite_master WHERE type='table' AND name='assets'" | ||
|
||
read_all = lambda keys: 'select ' + comma(keys) + ' from assets order by play_order' | ||
read = lambda keys: 'select ' + comma(keys) + ' from assets where asset_id=?' | ||
create = lambda keys: 'insert into assets (' + comma(keys) + ') values (' + comma(['?'] * len(keys)) + ')' | ||
|
||
def read_all(keys): | ||
return 'select ' + comma(keys) + ' from assets order by play_order' | ||
|
||
|
||
def read(keys): | ||
return 'select ' + comma(keys) + ' from assets where asset_id=?' | ||
|
||
|
||
def create(keys): | ||
return 'insert into assets (' + comma(keys) + ') values (' + comma(['?'] * len(keys)) + ')' | ||
|
||
|
||
remove = 'delete from assets where asset_id=?' | ||
update = lambda keys: 'update assets set ' + quest(keys) + ' where asset_id=?' | ||
|
||
multiple_update = lambda keys, count: \ | ||
'UPDATE assets SET ' + quest(keys) + ' WHERE asset_id IN (' + comma(['?'] * count) + ')' | ||
multiple_update_not_in = lambda keys, count: \ | ||
'UPDATE assets SET ' + quest(keys) + ' WHERE asset_id NOT IN (' + comma(['?'] * count) + ')' | ||
|
||
multiple_update_with_case = lambda keys, count: 'UPDATE assets SET ' + quest_2(keys, count) + \ | ||
' WHERE asset_id IN (' + comma(['?'] * count) + ')' | ||
def update(keys): | ||
return 'update assets set ' + quest(keys) + ' where asset_id=?' | ||
|
||
|
||
def multiple_update(keys, count): | ||
return 'UPDATE assets SET ' + quest(keys) + ' WHERE asset_id IN (' + comma(['?'] * count) + ')' | ||
|
||
|
||
def multiple_update_not_in(keys, count): | ||
return 'UPDATE assets SET ' + quest(keys) + ' WHERE asset_id NOT IN (' + comma(['?'] * count) + ')' | ||
|
||
|
||
def multiple_update_with_case(keys, count): | ||
return 'UPDATE assets SET ' + quest_2(keys, count) + \ | ||
' WHERE asset_id IN (' + comma(['?'] * count) + ')' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
flake8==5.0.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
click==8.1.7 | ||
requests==2.32.3 | ||
tenacity==8.4.1 | ||
flake8==5.0.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.