style: Format code with black and isort
This commit is contained in:
parent
3a18a4536c
commit
79ca52987b
|
@ -72,7 +72,7 @@ def main():
|
||||||
"--blocklists",
|
"--blocklists",
|
||||||
"-b",
|
"-b",
|
||||||
help="Either a blocklist hosts file or a directory containing blocklist hosts files", # noqa E501
|
help="Either a blocklist hosts file or a directory containing blocklist hosts files", # noqa E501
|
||||||
default="blocklists", # Not really needed because the get_blocklists function will default to this # noqa: E501
|
default="blocklists", # Not really needed because the get_blocklists function will default to this # noqa: E501
|
||||||
)
|
)
|
||||||
upload_parser.add_argument(
|
upload_parser.add_argument(
|
||||||
"--whitelists",
|
"--whitelists",
|
||||||
|
|
|
@ -46,7 +46,7 @@ def delete_adblock_policy(policies: dict, account_id: str, token: str):
|
||||||
def main():
|
def main():
|
||||||
account_id = input("Enter your Cloudflare account ID: ")
|
account_id = input("Enter your Cloudflare account ID: ")
|
||||||
token = input("Enter your Cloudflare API token: ")
|
token = input("Enter your Cloudflare API token: ")
|
||||||
|
|
||||||
rules = utils.get_gateway_rules(account_id, token)
|
rules = utils.get_gateway_rules(account_id, token)
|
||||||
delete_adblock_policy(rules, account_id, token)
|
delete_adblock_policy(rules, account_id, token)
|
||||||
lists = utils.get_lists(account_id, token)
|
lists = utils.get_lists(account_id, token)
|
||||||
|
|
|
@ -5,7 +5,7 @@ import requests
|
||||||
from . import utils
|
from . import utils
|
||||||
|
|
||||||
|
|
||||||
def get_blocklists(hosts_path: str = 'blocklists'):
|
def get_blocklists(hosts_path: str = "blocklists"):
|
||||||
blocklists = []
|
blocklists = []
|
||||||
hosts_path = pathlib.Path(hosts_path)
|
hosts_path = pathlib.Path(hosts_path)
|
||||||
if hosts_path.is_file():
|
if hosts_path.is_file():
|
||||||
|
@ -18,7 +18,7 @@ def get_blocklists(hosts_path: str = 'blocklists'):
|
||||||
return blocklists
|
return blocklists
|
||||||
|
|
||||||
|
|
||||||
def apply_whitelists(blocklists, whitelist: str = 'whitelists'):
|
def apply_whitelists(blocklists, whitelist: str = "whitelists"):
|
||||||
# If whitelist is a file, convert it to a list.
|
# If whitelist is a file, convert it to a list.
|
||||||
# If whitelist is a directory, convert all files in it to a list and combine them.
|
# If whitelist is a directory, convert all files in it to a list and combine them.
|
||||||
# If it does not exist, return the original blocklists
|
# If it does not exist, return the original blocklists
|
||||||
|
@ -102,7 +102,6 @@ def create_dns_policy(lists, account_id: str, token: str) -> None:
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
account_id = input("Enter your Cloudflare account ID: ")
|
account_id = input("Enter your Cloudflare account ID: ")
|
||||||
token = input("Enter your Cloudflare API token: ")
|
token = input("Enter your Cloudflare API token: ")
|
||||||
|
|
||||||
|
@ -114,5 +113,6 @@ def main():
|
||||||
cloud_lists = utils.filter_adblock_lists(cloud_lists)
|
cloud_lists = utils.filter_adblock_lists(cloud_lists)
|
||||||
create_dns_policy(cloud_lists, account_id, token)
|
create_dns_policy(cloud_lists, account_id, token)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue