Skip to content

Commit

Permalink
Merge pull request #1802 from jwhitlock/dep-updates-mar-2022-pt-2
Browse files Browse the repository at this point in the history
Dependency updates, March 2022, part 2
  • Loading branch information
jwhitlock committed Mar 5, 2022
2 parents d881428 + f15685a commit d4cc2d1
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 64 deletions.
4 changes: 2 additions & 2 deletions docker/run_update_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ IFS=$'\n\t'

export CUSTOM_COMPILE_COMMAND="make update-reqs"
cd /app
echo ">>> pip-compile --quiet --generate-hashes requirements.in"
pip-compile --quiet --generate-hashes requirements.in
echo ">>> pip-compile --quiet --generate-hashes --allow-unsafe requirements.in"
pip-compile --quiet --generate-hashes --allow-unsafe requirements.in
2 changes: 1 addition & 1 deletion ichnaea/api/locate/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from enum import Enum

_MAX_INT = 2 ** 32 - 1
_MAX_INT = 2**32 - 1

# Approximate circumference of the Earth in meters.
EARTH_CIRCUMFERENCE = 40000000.0
Expand Down
4 changes: 2 additions & 2 deletions ichnaea/api/locate/tests/test_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def test_from_number(self):
assert DataAccuracy.from_number(-0.1) == DataAccuracy.high
assert DataAccuracy.from_number(500) == DataAccuracy.high
assert DataAccuracy.from_number(500.1) == DataAccuracy.medium
assert DataAccuracy.from_number(10 ** 5) == DataAccuracy.low
assert DataAccuracy.from_number(10 ** 9) == DataAccuracy.none
assert DataAccuracy.from_number(10**5) == DataAccuracy.low
assert DataAccuracy.from_number(10**9) == DataAccuracy.none
with pytest.raises(TypeError):
DataAccuracy.from_number(None)
with pytest.raises(ValueError):
Expand Down
2 changes: 1 addition & 1 deletion ichnaea/api/locate/tests/test_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def check(accuracy, expected):
check(0.0, DataAccuracy.high)
check(100, DataAccuracy.high)
check(20000.0, DataAccuracy.medium)
check(10 ** 6, DataAccuracy.low)
check(10**6, DataAccuracy.low)


class TestRegion(object):
Expand Down
4 changes: 2 additions & 2 deletions ichnaea/api/submit/tests/test_submit_v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ def test_timestamp(self):
data = SUBMIT_V0_SCHEMA.deserialize(
{"items": [{"time": "2016-04-07T03:33:20", "wifi": [{"key": wifi.mac}]}]}
)
assert data["items"][0]["timestamp"] == 146 * 10 ** 10
assert data["items"][0]["timestamp"] == 146 * 10**10

data = SUBMIT_V0_SCHEMA.deserialize(
{"items": [{"time": "1710-02-28", "wifi": [{"key": wifi.mac}]}]}
)
# 1710 was discarded and replaced by 'now'
assert data["items"][0]["timestamp"] > 10 ** 12
assert data["items"][0]["timestamp"] > 10**12


class TestView(BaseSubmitTest):
Expand Down
8 changes: 4 additions & 4 deletions ichnaea/api/submit/tests/test_submit_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,26 @@ def test_timestamp(self):
{
"items": [
{
"timestamp": 146 * 10 ** 10,
"timestamp": 146 * 10**10,
"wifiAccessPoints": [{"macAddress": wifi.mac}],
}
]
}
)
assert data["items"][0]["timestamp"] == 146 * 10 ** 10
assert data["items"][0]["timestamp"] == 146 * 10**10

data = SUBMIT_V1_SCHEMA.deserialize(
{
"items": [
{
"timestamp": 146 * 10 ** 9,
"timestamp": 146 * 10**9,
"wifiAccessPoints": [{"macAddress": wifi.mac}],
}
]
}
)
# value was discarded and replaced by 'now'
assert data["items"][0]["timestamp"] > 10 ** 12
assert data["items"][0]["timestamp"] > 10**12


class TestView(BaseSubmitTest):
Expand Down
8 changes: 4 additions & 4 deletions ichnaea/api/submit/tests/test_submit_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,26 @@ def test_timestamp(self):
{
"items": [
{
"timestamp": 146 * 10 ** 10,
"timestamp": 146 * 10**10,
"wifiAccessPoints": [{"macAddress": wifi.mac}],
}
]
}
)
assert data["items"][0]["timestamp"] == 146 * 10 ** 10
assert data["items"][0]["timestamp"] == 146 * 10**10

data = SUBMIT_V2_SCHEMA.deserialize(
{
"items": [
{
"timestamp": 146 * 10 ** 9,
"timestamp": 146 * 10**9,
"wifiAccessPoints": [{"macAddress": wifi.mac}],
}
]
}
)
# value was discarded and replaced by 'now'
assert data["items"][0]["timestamp"] > 10 ** 12
assert data["items"][0]["timestamp"] > 10**12


class TestView(BaseSubmitTest):
Expand Down
2 changes: 1 addition & 1 deletion ichnaea/data/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def __call__(self):
success = True
except self._retriable:
success = False
time.sleep(self._retry_wait * (i ** 2 + 1))
time.sleep(self._retry_wait * (i**2 + 1))

if success:
METRICS.incr("data.export.batch", tags=self.stats_tags)
Expand Down
8 changes: 4 additions & 4 deletions ichnaea/models/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class ReportSource(IntEnum):
MAX_PRESSURE = 1200.0 # Maximum pressure in hPA.
MIN_SPEED = 0.0
MAX_SPEED = 300.0 # A bit less than speed of sound, in meters per second.
MIN_TIMESTAMP = 10 ** 12 # Minimum allowed time stamp, 2001.
MAX_TIMESTAMP = 10 ** 13 # Maximum allowed time stamp, 2286.
MIN_TIMESTAMP = 10**12 # Minimum allowed time stamp, 2001.
MAX_TIMESTAMP = 10**13 # Maximum allowed time stamp, 2286.

BLUE_MAX_RADIUS = 100 # Max radius of a single Bluetooth network.
CELLAREA_MAX_RADIUS = 20000000 # Max radius of a cell area.
Expand Down Expand Up @@ -128,8 +128,8 @@ class ReportSource(IntEnum):
MAX_LAC = 65533 # Maximum accepted cell area code.

MIN_CID = 1 # Minimum accepted cell id.
MAX_CID = 2 ** 28 - 1 # Maximum accepted cell id.
MAX_CID_GSM = 2 ** 16 - 1 # Maximum accepted GSM cell id.
MAX_CID = 2**28 - 1 # Maximum accepted cell id.
MAX_CID_GSM = 2**16 - 1 # Maximum accepted GSM cell id.

MIN_PSC = 0 # Minimum accepted psc/pci.
MAX_PSC = 511 # Maximum accepted psc/pci.
Expand Down
4 changes: 2 additions & 2 deletions ichnaea/models/tests/test_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def test_encode_cell(self):
assert value == b"\x02\x016\x00\x01\x00\x0c\x00\x00\x00\x00"

def test_max(self):
bit16 = 2 ** 16 - 1
bit32 = 2 ** 32 - 1
bit16 = 2**16 - 1
bit32 = 2**32 - 1

value = encode_cellarea(Radio.wcdma, bit16, bit16, bit16, codec="base64")
assert value == b"Av///////w=="
Expand Down
10 changes: 2 additions & 8 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@ boto3==1.21.13
# Code: https://github.com/celery/celery
# Changes: https://docs.celeryproject.org/en/stable/changelog.html
# Docs: https://docs.celeryproject.org/en/stable/index.html
celery[redis]==5.1.2

# Command line interface toolkit
# Code: https://github.com/pallets/click
# Changes: https://click.palletsprojects.com/en/7.x/changelog/
# Docs: https://click.palletsprojects.com/en/7.x/
Click==7.1.2
celery[redis]==5.2.3

# Schema-based serialization and deserialization library
# Code: https://github.com/Pylons/colander
Expand Down Expand Up @@ -209,7 +203,7 @@ beautifulsoup4
# Code: https://github.com/psf/black
# Changes: https://github.com/psf/black/blob/master/CHANGES.md
# Docs: https://black.readthedocs.io/en/stable/
black==21.12b0
black==22.1.0

# Cross-platform colored terminal text, used for structlog output
# Code: https://github.com/tartley/colorama
Expand Down
101 changes: 68 additions & 33 deletions requirements.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d4cc2d1

Please sign in to comment.