Skip to content

Commit

Permalink
updated dependencies, modified config loading
Browse files Browse the repository at this point in the history
  • Loading branch information
9FS committed May 12, 2024
1 parent 12c31de commit c77276f
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 87 deletions.
86 changes: 47 additions & 39 deletions poetry.lock

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

18 changes: 9 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ name = ""
package-mode = false # this is an application, not library
readme = "readme.md"
repository = "https://github.com/9-FS/2022-01-26-Metric-METAR-for-Discord"
version = "1.1.5"
version = "1.1.6"

[tool.poetry.dependencies]
discord = "^2.3.2"
jsonpickle = "^3.0.2"
kfsconfig = "^1.0.0"
discord = "^2.3.0"
jsonpickle = "^3.0.0"
kfsconfig = "^2.0.0"
kfsconvert-to-si = "^1.0.0"
kfsfstr = "^1.0.0"
kfslog = "^1.0.0"
pandas = "^2.1.0"
python = "^3.11.0"
kfslog = "^2.0.0"
pandas = "^2.2.0"
python = "^3.12.0"
requests = "^2.31.0"

[tool.poetry.group.dev.dependencies]
hypothesis = "^6.87.0"
pytest = "^7.4.2"
hypothesis = "^6.0.0"
pytest = "^8.0.0"

[build-system]
build-backend = "poetry.core.masonry.api"
Expand Down
54 changes: 27 additions & 27 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
aiohttp==3.8.6 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
aiosignal==1.3.1 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
async-timeout==4.0.3 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
attrs==23.1.0 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
certifi==2023.7.22 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
charset-normalizer==3.3.2 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
colorama==0.4.6 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
discord-py==2.3.2 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
discord==2.3.2 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
frozenlist==1.4.0 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
idna==3.4 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
jsonpickle==3.0.2 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
kfsconfig==1.0.2 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
kfsconvert-to-si==1.0.1 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
kfsfstr==1.1.0 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
kfslog==1.0.1 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
kfsmath==1.0.1 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
multidict==6.0.4 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
numpy==1.26.1 ; python_version == "3.11"
pandas==2.1.2 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
python-dateutil==2.8.2 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
pytz==2023.3.post1 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
requests==2.31.0 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
six==1.16.0 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
tzdata==2023.3 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
urllib3==2.0.7 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
yarl==1.9.2 ; python_full_version >= "3.11.0" and python_full_version < "4.0.0"
aiohttp==3.9.5 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
aiosignal==1.3.1 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
attrs==23.2.0 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
certifi==2024.2.2 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
charset-normalizer==3.3.2 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
colorama==0.4.6 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
discord-py==2.3.2 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
discord==2.3.2 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
frozenlist==1.4.1 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
idna==3.7 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
jsonpickle==3.0.4 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
kfsconfig==2.1.5 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
kfsconvert-to-si==1.0.2 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
kfsfstr==1.1.2 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
kfslog==2.0.1 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
kfsmath==1.0.2 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
multidict==6.0.5 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
numpy==1.26.4 ; python_version >= "3.12" and python_full_version < "4.0.0"
pandas==2.2.2 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
python-dateutil==2.9.0.post0 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
pytz==2024.1 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
requests==2.31.0 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
result==0.16.1 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
six==1.16.0 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
tzdata==2024.1 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
urllib3==2.2.1 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
yarl==1.9.4 ; python_full_version >= "3.12.0" and python_full_version < "4.0.0"
26 changes: 14 additions & 12 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
SERVERS_FILENAME: str="./config/servers.json" # save filename for all servers, so subscription is remembered beyond restarts


@KFSlog.timeit_async
@KFSlog.timeit_async()
async def main(DEBUG: bool) -> None:
global servers

Expand All @@ -42,19 +42,21 @@ async def main(DEBUG: bool) -> None:
"^(?P<station_ICAO>[0-9A-Z]{4}) TAF$",
# "^(?P<station_ICAO>[0-9A-Z]{4}) INFO$" # TODO
)
discord_bot: discord.Client # discord client instance
discord_bot_channel_names: list[str] # bot channel names
discord_bot_token: str # discord bot token
intents: discord.Intents # client permissions
if logging.root.level<=logging.DEBUG: # if level debug or lower:
UPDATE_FREQUENCY: float=200e-3 # update subscription with 200mHz (every 5s)
discord_bot: discord.Client # discord client instance
discord_bot_channel_names: list[str] # bot channel names
DISCORD_BOT_CHANNEL_NAMES_DEFAULT: dict[str, str]={"content": "bots\nbotspam\nmetar"} # default bot channel names
discord_bot_token: str # discord bot token
DISCORD_BOT_TOKEN_DEFAULT: dict[str, str]={"content": ""} # default discord bot token
intents: discord.Intents # client permissions
if logging.root.level<=logging.DEBUG: # if level debug or lower:
UPDATE_FREQUENCY: float=200e-3 # update subscription with 200mHz (every 5s)
else:
UPDATE_FREQUENCY: float=10e-3 # but usually update subscription with 10mHz (every 100s)
UPDATE_FREQUENCY: float=10e-3 # but usually update subscription with 10mHz (every 100s)

try:
discord_bot_channel_names=[bot_channel_name for bot_channel_name in KFSconfig.load_config("./config/discord_bot_channel_names.txt", "bots\nbotspam\nmetar").split("\n") if bot_channel_name!=""] # load bot channel names, remove empty lines
discord_bot_token=KFSconfig.load_config("./config/discord_bot.token") # load discord bot token
except FileNotFoundError:
discord_bot_channel_names=[bot_channel_name for bot_channel_name in KFSconfig.load_config(env=False, config_filepaths=["./config/discord_bot_channel_names.txt"], config_default=DISCORD_BOT_CHANNEL_NAMES_DEFAULT)["content"].split("\n") if bot_channel_name!=""] # if no bot channel names: use default
discord_bot_token=KFSconfig.load_config(config_filepaths=["./config/discord_bot.token"], config_default=DISCORD_BOT_TOKEN_DEFAULT)["content"] # if no discord bot token: use default
except ValueError:
return
intents=discord.Intents.default() # standard permissions
intents.message_content=True # in addition with message contents
Expand Down Expand Up @@ -202,7 +204,7 @@ def __exit__(self, exc_type, exc_value, exc_traceback): # up
station.elev=None
else: # if elevation available:
station.elev=aerodrome.at[0, "elevation_ft"]*KFSconvert_to_SI.LENGTH["ft"] # save elevation [m]
logging.info(f"Elevation: {KFSfstr.notation_abs(station.elev, 0, round_static=True)}m")
logging.info(f"Elevation: {KFSfstr.notation_abs(station.elev, 0, round_static=True)}m") # type:ignore

# information command
# if INFO_command==True: # if information command: execute that, then return without downloading METAR, TAF etc.
Expand Down

0 comments on commit c77276f

Please sign in to comment.