Skip to content
Open
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
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@ repos:
- "--py310-plus"

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 26.5.1
rev: 26.10.0
hooks:
- id: black
args:
- --target-version=py310

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.20
rev: v0.16.10
hooks:
- id: ruff-check
args:
- --fix-only

- repo: https://github.com/pycqa/isort
rev: 9.0.0a3
rev: 9.0.2
hooks:
- id: isort
args:
Expand All @@ -60,7 +60,7 @@ repos:
- --filter-files

- repo: https://github.com/pycqa/flake8
rev: 7.3.0
rev: 7.4.1
hooks:
- id: flake8
language: python
Expand Down
4 changes: 2 additions & 2 deletions builder/pyinstaller_build_macos.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

"""
Launch PyInstaller using a Python script.
Expand All @@ -19,7 +19,7 @@

# package
sys.path.insert(0, str(Path(".").resolve()))
from geotribu_cli import __about__ # noqa: E402
from geotribu_cli import __about__

# #############################################################################
# ########### MAIN #################
Expand Down
4 changes: 2 additions & 2 deletions builder/pyinstaller_build_ubuntu.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

"""
Launch PyInstaller using a Python script.
Expand All @@ -19,7 +19,7 @@

# package
sys.path.insert(0, str(Path(".").resolve()))
from geotribu_cli import __about__ # noqa: E402
from geotribu_cli import __about__

# #############################################################################
# ########### MAIN #################
Expand Down
4 changes: 2 additions & 2 deletions builder/pyinstaller_build_windows.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

"""
Launch PyInstaller using a Python script.
Expand All @@ -19,7 +19,7 @@

# package
sys.path.insert(0, str(Path(".").resolve()))
from geotribu_cli import __about__ # noqa: E402
from geotribu_cli import __about__

# #############################################################################
# ########### MAIN #################
Expand Down
2 changes: 1 addition & 1 deletion builder/version_info_templater.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

"""
Microsoft Version Info templater.
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

"""Abstraction on the package metadata to easily retrieve them."""

Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

# submodules
from .__about__ import __version__ # noqa: F401
2 changes: 1 addition & 1 deletion geotribu_cli/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3
# PYTHON_ARGCOMPLETE_OK

"""Main CLI entrypoint."""
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/cli_results_rich_formatters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

# ############################################################################
# ########## IMPORTS #############
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/comments/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

# submodules
from .comments_broadcast import parser_comments_broadcast # noqa: F401
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/comments/comments_broadcast.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

# ############################################################################
# ########## IMPORTS #############
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/comments/comments_latest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

# ############################################################################
# ########## IMPORTS #############
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/comments/comments_open.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

# ############################################################################
# ########## IMPORTS #############
Expand Down
5 changes: 2 additions & 3 deletions geotribu_cli/comments/comments_toolbelt.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

# ############################################################################
# ########## IMPORTS #############
Expand Down Expand Up @@ -183,8 +183,7 @@ def get_latest_comments(
list of comments objects
"""
# check if count is acceptable
if number < 1:
number = 1
number = max(number, 1)

# download remote latest comments
comments_file = download_remote_file_to_local(
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/comments/mdl_comment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3


"""Package constants."""
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/console.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

"""
Shared console instance.
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3


"""Package constants."""
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/content/new_article.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

# ############################################################################
# ########## IMPORTS #############
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/content/yaml_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

# 3rd party
from frontmatter import YAMLHandler
Expand Down
5 changes: 2 additions & 3 deletions geotribu_cli/history.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

"""Store and load CLI history."""

Expand Down Expand Up @@ -61,8 +61,7 @@ def dump(
out_history.write(f"{request_performed}\n")

# results
for i in results_to_dump:
out_history.write(f"{i.get(key_field)}\n")
out_history.writelines(f"{i.get(key_field)}\n" for i in results_to_dump)

logger.debug(f"History saved for {cmd_name}")

Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/images/images_optimizer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

# ############################################################################
# ########## IMPORTS #############
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/images/optim_pillow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

# ############################################################################
# ########## IMPORTS #############
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/images/optim_tinify.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

# ############################################################################
# ########## IMPORTS #############
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/json/json_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3


"""JSON Feed client."""
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/rss/mdl_rss.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3


"""Package constants."""
Expand Down
15 changes: 4 additions & 11 deletions geotribu_cli/rss/rss_reader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

# ############################################################################
# ########## IMPORTS #############
Expand Down Expand Up @@ -220,12 +220,7 @@ def run(args: argparse.Namespace):
# filter on content type
if args.filter_type == "article" and not item.find(
"link"
).text.startswith(f"{defaults_settings.site_base_url}articles/"):
logger.debug(
f"Résultat ignoré par le filtre {args.filter_type}: {item.find('link').text}"
)
continue
elif args.filter_type == "rdp" and not item.find(
).text.startswith(f"{defaults_settings.site_base_url}articles/") or args.filter_type == "rdp" and not item.find(
"link"
).text.startswith(f"{defaults_settings.site_base_url}rdp/"):
logger.debug(
Expand All @@ -251,9 +246,7 @@ def run(args: argparse.Namespace):
)
)
except Exception as err:
err_msg = "Feed item (index = {}) triggers an error. Trace: {}".format(
feed_items.index(item), err
)
err_msg = f"Feed item (index = {feed_items.index(item)}) triggers an error. Trace: {err}"
logger.error(err_msg)
sys.exit(err_msg)

Expand All @@ -276,7 +269,7 @@ def run(args: argparse.Namespace):
prompt="Afficher le résultat n° (q pour quitter)",
console=console,
choices=["q"]
+ [str(i) for i in range(0, min([len(feed_items), args.results_number]))],
+ [str(i) for i in range(min([len(feed_items), args.results_number]))],
default="q",
)

Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/search/mdl_search.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3


"""Search related models."""
Expand Down
12 changes: 3 additions & 9 deletions geotribu_cli/search/search_content.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

# ############################################################################
# ########## IMPORTS #############
Expand Down Expand Up @@ -389,13 +389,7 @@ def run(args: argparse.Namespace):
# filter on content type
if args.filter_type == "article" and not result.get("ref").startswith(
"articles/"
):
logger.debug(
f"Résultat ignoré par le filtre {args.filter_type}: {result.get('ref')}"
)
count_ignored_results += 1
continue
elif args.filter_type == "rdp" and not result.get("ref").startswith("rdp/"):
) or args.filter_type == "rdp" and not result.get("ref").startswith("rdp/"):
logger.debug(
f"Résultat ignoré par le filtre {args.filter_type}: {result.get('ref')}"
)
Expand Down Expand Up @@ -500,7 +494,7 @@ def run(args: argparse.Namespace):
console=console,
choices=["q"]
+ [
str(i) for i in range(0, min([len(final_results), args.results_number]))
str(i) for i in range(min([len(final_results), args.results_number]))
],
default="q",
)
Expand Down
11 changes: 3 additions & 8 deletions geotribu_cli/search/search_image.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

# ############################################################################
# ########## IMPORTS #############
Expand Down Expand Up @@ -198,12 +198,7 @@ def run(args: argparse.Namespace):
# filter on image type
if args.filter_type == "logo" and not result.get("ref").startswith(
"logos-icones/"
):
logger.debug(
f"Résultat ignoré par le filtre {args.filter_type}: {result.get('ref')}"
)
continue
elif args.filter_type == "geoicone" and not result.get("ref").startswith(
) or args.filter_type == "geoicone" and not result.get("ref").startswith(
"internal/icons-rdp-news/"
):
logger.debug(
Expand Down Expand Up @@ -259,7 +254,7 @@ def run(args: argparse.Namespace):
console=console,
choices=["q"]
+ [
str(i) for i in range(0, min([len(final_results), args.results_number]))
str(i) for i in range(min([len(final_results), args.results_number]))
],
default="q",
)
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/social/cmd_mastodon_export.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

# ############################################################################
# ########## IMPORTS #############
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/social/mastodon_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

# ############################################################################
# ########## IMPORTS #############
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/subcommands/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265 F401
#! python3

# submodules
from geotribu_cli.comments import parser_comments_broadcast # noqa: F401
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/subcommands/open_result.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

# ############################################################################
# ########## IMPORTS #############
Expand Down
9 changes: 2 additions & 7 deletions geotribu_cli/subcommands/upgrade.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

"""
Sub-command in charge of checking if new versions are available.
Expand Down Expand Up @@ -70,11 +70,7 @@ def get_download_url_for_os(
opersys_code = override_opersys

for asset in release_assets:
if opersys_code == "win32" and "Windows" in asset.get("name"):
return asset.get("browser_download_url"), asset.get("content-type")
elif opersys_code == "linux" and "Ubuntu" in asset.get("name"):
return asset.get("browser_download_url"), asset.get("content-type")
elif opersys_code == "darwin" and "MacOS" in asset.get("name"):
if opersys_code == "win32" and "Windows" in asset.get("name") or opersys_code == "linux" and "Ubuntu" in asset.get("name") or opersys_code == "darwin" and "MacOS" in asset.get("name"):
return asset.get("browser_download_url"), asset.get("content-type")
else:
continue
Expand Down Expand Up @@ -281,4 +277,3 @@ def run(args: argparse.Namespace):
# ##################################
if __name__ == "__main__":
"""Standalone execution."""
pass
2 changes: 1 addition & 1 deletion geotribu_cli/utils/args_types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

"""Static objects and variables."""

Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/utils/check_image_size.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! python3 # noqa: E265
#! python3

"""
Check image size using pure Python <https://github.com/shibukawa/imagesize_py>.
Expand Down
Loading
Loading