Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ruff Implicit String Concatenation Rules #1323

Merged
merged 8 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion parsons/donorbox/donorbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,5 +221,5 @@ def _date_format_helper(self, date_string):
continue
raise ValueError(
f"The date you supplied, {date_string}, is not a valid Donorbox format."
+ "Try the following formats: YYYY-mm-dd YYYY/mm/dd YYYYmmdd dd-mm-YYYY"
"Try the following formats: YYYY-mm-dd YYYY/mm/dd YYYYmmdd dd-mm-YYYY"
)
2 changes: 1 addition & 1 deletion parsons/geocode/census_geocoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def geocode_address_batch(self, table):
if set(table.columns) != {"id", "street", "city", "state", "zip"}:
msg = (
"Table must ONLY include `['id', 'street', 'city', 'state', 'zip']` as"
+ "columns. Tip: try using `table.cut()`"
"columns. Tip: try using `table.cut()`"
)
raise ValueError(msg)

Expand Down
2 changes: 1 addition & 1 deletion parsons/scytl/scytl.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

BROWSER_HEADERS = {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) "
+ "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"
}

TZ_INFO = {
Expand Down
15 changes: 13 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,19 @@ target-version = "py39"
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = ["E4", "E7", "E9", "F", "I"]
ignore = []
select = [
"E", # pycodestyle errors
"F", # Pyflakes (F)
"I", # isort (I)
"TID", # flake8-tidy-imports (TID)
"ICN", # flake8-import-conventions (ICN)
"Q", # flake8-quotes (Q)
"TC", # flake8-type-checking (TC)
"ISC", # flake8-implicit-str-concat (ISC)
]
ignore = [
"E501", # line-too-long (E501)
]

# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
Expand Down
4 changes: 0 additions & 4 deletions test/conftest.py

This file was deleted.

2 changes: 1 addition & 1 deletion test/test_airmeet.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def test_fetch_session_attendance_exception_202(self):
return_value={
"statusCode": 202,
"statusMessage": "Preparing your results. Try after 5 minutes"
+ "to get the updated results",
"to get the updated results",
}
)

Expand Down
10 changes: 5 additions & 5 deletions test/test_shopify.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,23 @@ def test_get_query_url(self, m):
self.assertEqual(
self.shopify.get_query_url(None, None, "orders", True),
f"https://{SUBDOMAIN}.myshopify.com/admin/api/{API_VERSION}/orders/"
+ "count.json?limit=250&status=any",
"count.json?limit=250&status=any",
)
self.assertEqual(
self.shopify.get_query_url("2020-10-20", None, "orders", True),
f"https://{SUBDOMAIN}.myshopify.com/admin/api/{API_VERSION}/orders/"
+ "count.json?limit=250&status=any&created_at_min=2020-10-20T00:00:00&"
+ "created_at_max=2020-10-21T00:00:00",
"count.json?limit=250&status=any&created_at_min=2020-10-20T00:00:00&"
"created_at_max=2020-10-21T00:00:00",
)
self.assertEqual(
self.shopify.get_query_url(None, 2, "orders", True),
f"https://{SUBDOMAIN}.myshopify.com/admin/api/{API_VERSION}/orders/"
+ "count.json?limit=250&status=any&since_id=2",
"count.json?limit=250&status=any&since_id=2",
)
self.assertEqual(
self.shopify.get_query_url(None, None, "orders", False),
f"https://{SUBDOMAIN}.myshopify.com/admin/api/{API_VERSION}/orders.json?"
+ "limit=250&status=any",
"limit=250&status=any",
)

@requests_mock.Mocker()
Expand Down
5 changes: 3 additions & 2 deletions test/test_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from parsons import Table
from parsons.utilities import check_env, files, json_format, sql_helpers
from parsons.utilities.datetime import date_to_timestamp, parse_date
from test.conftest import xfail_value_error


@pytest.mark.parametrize(
Expand All @@ -20,7 +19,9 @@
pytest.param("2018-12-13", 1544659200),
pytest.param("2018-12-13T00:00:00-08:00", 1544688000),
pytest.param("", None),
pytest.param("2018-12-13 PST", None, marks=[xfail_value_error]),
pytest.param(
"2018-12-13 PST", None, marks=[pytest.mark.xfail(raises=ValueError, strict=True)]
),
],
)
def test_date_to_timestamp(date, exp_ts):
Expand Down
Loading