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 # also works because __main__ is the default module
import argparse
import asyncio
import os
from pathlib import Path
from sys import exit, stderr
import asyncio
import dotenv
from loguru import logger
@ -31,7 +32,9 @@ def main():
# Add 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_args.add_argument(
@ -81,8 +84,6 @@ def main():
set_primary_logger(args.log_level)
logger.debug(args)
# Load variables
global TOKEN
global ACCOUNT_ID
@ -134,6 +135,7 @@ def delete_from_cloudflare(args):
lists = utils.filter_adblock_lists(lists)
asyncio.run(delete.delete_adblock_list(lists, ACCOUNT_ID, TOKEN))
def set_primary_logger(log_level):
logger.remove()
# ^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
import requests
import httpx
import asyncio
import httpx
import requests
from . import utils

View File

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