style: format code with black and isort

Format code with black and isort

This commit fixes the style issues introduced in fc08c85 according to the output
from Black and isort.

Details: https://app.deepsource.com/gh/slashtechno/cloudflare-gateway-adblocking/transform/140ba183-64cc-487b-8647-7ec70640c747/
This commit is contained in:
deepsource-autofix[bot] 2023-08-07 21:48:16 +00:00 committed by GitHub
parent fc08c858e1
commit 86d0ae5fc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 13 deletions

View File

@ -2,10 +2,11 @@
# python -m src.__main__ # python -m src.__main__
# python -m src # also works because __main__ is the default module # python -m src # also works because __main__ is the default module
import argparse import argparse
import asyncio
import os import os
from pathlib import Path from pathlib import Path
from sys import exit, stderr from sys import exit, stderr
import asyncio
import dotenv import dotenv
from loguru import logger from loguru import logger
@ -31,7 +32,9 @@ def main():
# Add arguments # Add arguments
# General arguments # General arguments
argparser.add_argument('--log-level', '-l', help='Log level', default='INFO') # noqa E501 argparser.add_argument(
"--log-level", "-l", help="Log level", default="INFO"
) # noqa E501
# Credential arguments # Credential arguments
credential_args.add_argument( credential_args.add_argument(
@ -81,8 +84,6 @@ def main():
set_primary_logger(args.log_level) set_primary_logger(args.log_level)
logger.debug(args) logger.debug(args)
# Load variables # Load variables
global TOKEN global TOKEN
global ACCOUNT_ID global ACCOUNT_ID
@ -134,6 +135,7 @@ def delete_from_cloudflare(args):
lists = utils.filter_adblock_lists(lists) lists = utils.filter_adblock_lists(lists)
asyncio.run(delete.delete_adblock_list(lists, ACCOUNT_ID, TOKEN)) asyncio.run(delete.delete_adblock_list(lists, ACCOUNT_ID, TOKEN))
def set_primary_logger(log_level): def set_primary_logger(log_level):
logger.remove() logger.remove()
# ^10 is a formatting directive to center with a padding of 10 # ^10 is a formatting directive to center with a padding of 10

View File

@ -1,8 +1,10 @@
# This is a scriprt to undo the changes made by adblock-zerotrust.py # This is a scriprt to undo the changes made by adblock-zerotrust.py
import requests
import httpx
import asyncio import asyncio
import httpx
import requests
from . import utils from . import utils

View File

@ -1,8 +1,8 @@
import asyncio
import pathlib import pathlib
import requests
import asyncio
import httpx import httpx
import requests
from . import utils from . import utils
@ -52,9 +52,7 @@ async def upload_to_cloudflare(lists, account_id: str, token: str) -> None:
async with httpx.AsyncClient() as client: async with httpx.AsyncClient() as client:
for i, lst in enumerate(lists): for i, lst in enumerate(lists):
list_name = f"adblock-list-{i + 1}" list_name = f"adblock-list-{i + 1}"
url = ( url = f"https://api.cloudflare.com/client/v4/accounts/{account_id}/gateway/lists"
f"https://api.cloudflare.com/client/v4/accounts/{account_id}/gateway/lists"
)
headers = { headers = {
"Authorization": f"Bearer {token}", "Authorization": f"Bearer {token}",
"Content-Type": "application/json", "Content-Type": "application/json",
@ -79,7 +77,6 @@ async def upload_to_cloudflare(lists, account_id: str, token: str) -> None:
exit(1) exit(1)
def create_dns_policy(lists, account_id: str, token: str) -> None: def create_dns_policy(lists, account_id: str, token: str) -> None:
url = f"https://api.cloudflare.com/client/v4/accounts/{account_id}/gateway/rules" url = f"https://api.cloudflare.com/client/v4/accounts/{account_id}/gateway/rules"
headers = { headers = {