Skip to content

Commit

Permalink
style: Ruff
Browse files Browse the repository at this point in the history
I: Sort imports
  • Loading branch information
adityahase committed Jul 13, 2024
1 parent a5b38bc commit 28a7ac3
Show file tree
Hide file tree
Showing 251 changed files with 711 additions and 522 deletions.
3 changes: 2 additions & 1 deletion press/agent.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe and contributors
# For license information, please see license.txt
import _io
import json
import os
from datetime import date
from typing import TYPE_CHECKING, List

import _io
import frappe
import requests
from frappe.utils.password import get_decrypted_password

from press.utils import log_error, sanitize_config

if TYPE_CHECKING:
Expand Down
1 change: 1 addition & 0 deletions press/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import frappe

from press.utils import get_minified_script, get_minified_script_2


Expand Down
14 changes: 7 additions & 7 deletions press/api/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@
import frappe
from frappe import _
from frappe.core.doctype.user.user import update_password
from frappe.core.utils import find
from frappe.exceptions import DoesNotExistError
from frappe.utils.data import sha256_hash
from frappe.query_builder.custom import GROUP_CONCAT
from frappe.rate_limiter import rate_limit
from frappe.utils import get_url
from frappe.utils.data import sha256_hash
from frappe.utils.oauth import get_oauth2_authorize_url, get_oauth_keys
from frappe.website.utils import build_response
from frappe.core.utils import find
from frappe.rate_limiter import rate_limit
from pypika.terms import ValueWrapper

from press.api.site import protected
from press.press.doctype.team.team import (
Team,
get_team_members,
get_child_team_members,
get_team_members,
has_unsettled_invoices,
)
from press.utils import get_country_info, get_current_team, is_user_part_of_team
from press.utils.telemetry import capture, identify
from press.api.site import protected
from frappe.query_builder.custom import GROUP_CONCAT
from pypika.terms import ValueWrapper


@frappe.whitelist(allow_guest=True)
Expand Down
21 changes: 11 additions & 10 deletions press/api/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,32 @@
# For license information, please see license.txt


from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search, A
import json
from datetime import datetime, timedelta

import frappe
from pytz import timezone as pytz_timezone
import requests
import json
import sqlparse
from frappe.utils import flt
from press.api.site import protected
from press.press.doctype.site_plan.site_plan import get_plan_config
from elasticsearch import Elasticsearch
from elasticsearch_dsl import A, Search
from frappe.utils import (
convert_utc_to_timezone,
flt,
get_datetime,
get_datetime_str,
get_system_timezone,
)
from frappe.utils.password import get_decrypted_password
from datetime import datetime, timedelta
from pytz import timezone as pytz_timezone

from press.agent import Agent
from press.api.site import protected
from press.press.doctype.site_plan.site_plan import get_plan_config
from press.press.report.binary_log_browser.binary_log_browser import (
get_files_in_timespan,
convert_user_timezone_to_utc,
get_files_in_timespan,
)


try:
from frappe.utils import convert_utc_to_user_timezone
except ImportError:
Expand Down
6 changes: 4 additions & 2 deletions press/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@


import json
from typing import TYPE_CHECKING

import frappe
from press.utils import get_current_team

from press.press.doctype.app.app import new_app
from typing import TYPE_CHECKING
from press.utils import get_current_team

if TYPE_CHECKING:
from press.press.doctype.app.app import App
Expand Down
1 change: 1 addition & 0 deletions press/api/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from frappe.core.utils import find, find_all
from frappe.model.naming import append_number_if_name_exists
from frappe.utils import flt, sbool

from press.api.github import branches
from press.api.site import protected
from press.press.doctype.agent_job.agent_job import job_detail
Expand Down
13 changes: 7 additions & 6 deletions press/api/billing.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# For license information, please see license.txt

import frappe

from typing import Dict, List
from itertools import groupby
from frappe.utils import fmt_money
from typing import Dict, List

import frappe
from frappe.core.utils import find
from frappe.utils import fmt_money

from press.press.doctype.team.team import (
has_unsettled_invoices,
)
from press.utils import get_current_team
from press.utils.billing import (
GSTIN_FORMAT,
clear_setup_intent,
get_publishable_key,
get_setup_intent,
get_razorpay_client,
get_setup_intent,
get_stripe,
make_formatted_doc,
states_with_tin,
validate_gstin_check_digit,
GSTIN_FORMAT,
)


Expand Down
2 changes: 1 addition & 1 deletion press/api/central.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# For license information, please see license.txt

import frappe
from frappe.geo.country_info import get_country_timezone_info
from frappe.core.utils import find
from frappe.geo.country_info import get_country_timezone_info

from press.api.account import get_account_request_from_key
from press.press.doctype.site.erpnext_site import (
Expand Down
1 change: 1 addition & 0 deletions press/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from frappe.model.base_document import get_controller
from frappe.utils import cstr
from pypika.queries import QueryBuilder

from press.utils import has_role

ALLOWED_DOCTYPES = [
Expand Down
1 change: 1 addition & 0 deletions press/api/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import frappe

from press.utils import get_client_blacklisted_keys


Expand Down
6 changes: 3 additions & 3 deletions press/api/cookies.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import json
import frappe
import datetime

import json
from urllib.parse import unquote

import frappe
from frappe.auth import CookieManager
from frappe.oauth import get_cookie_dict_from_headers

Expand Down
1 change: 1 addition & 0 deletions press/api/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@


import frappe

from press.api.site import protected
from press.utils import get_current_team

Expand Down
3 changes: 2 additions & 1 deletion press/api/developer/marketplace.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Dict, List

import frappe
from frappe.utils import get_url
from typing import Dict, List

from press.api.developer import raise_invalid_key_error
from press.api.site import get_plans as get_site_plans
Expand Down
1 change: 1 addition & 0 deletions press/api/developer/saas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json

import frappe

from press.api.developer import raise_invalid_key_error
Expand Down
9 changes: 5 additions & 4 deletions press/api/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
# Copyright (c) 2020, Frappe and contributors
# For license information, please see license.txt

import secrets
import json
import requests
import calendar
import json
import secrets
from datetime import datetime

import frappe
from press.utils import log_error
import requests

from press.api.developer.marketplace import get_subscription_info
from press.api.site import site_config, update_config
from press.utils import log_error


class PlanExpiredError(Exception):
Expand Down
14 changes: 8 additions & 6 deletions press/api/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@
# For license information, please see license.txt

import re
import jwt
from base64 import b64decode
from datetime import datetime, timedelta
from pathlib import Path
from typing import TYPE_CHECKING

import frappe
import jwt
import requests

from pathlib import Path
from base64 import b64decode
from datetime import datetime, timedelta
from press.utils import get_current_team, log_error
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from press.press.doctype.github_webhook_log.github_webhook_log import GitHubWebhookLog
from typing import Optional

from press.press.doctype.github_webhook_log.github_webhook_log import GitHubWebhookLog


@frappe.whitelist(allow_guest=True, xss_safe=True)
def hook(*args, **kwargs):
Expand Down
13 changes: 8 additions & 5 deletions press/api/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
# MIT License. See license.txt

from __future__ import unicode_literals
import frappe

import json
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import Flow

import frappe
from frappe import _
from google.auth.transport.requests import Request
from google.oauth2 import id_token
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import Flow
from googleapiclient.discovery import build

from press.utils import log_error
from frappe import _


@frappe.whitelist(allow_guest=True)
Expand Down
4 changes: 3 additions & 1 deletion press/api/monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
# For license information, please see license.txt


import frappe
from itertools import groupby

import frappe

from press.utils import log_error


Expand Down
19 changes: 7 additions & 12 deletions press/api/oauth.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import json
import frappe
import os

import frappe
from frappe.core.utils import find
from frappe.utils import get_url
from frappe.utils.oauth import get_oauth2_authorize_url

from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import Flow
from google.auth.transport.requests import Request
from google.oauth2 import id_token

from frappe.utils import get_url
from frappe.core.utils import find
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import Flow
from googleapiclient.discovery import build

from press.api.account import get_account_request_from_key, setup_account
from press.api.saas import (
Expand All @@ -20,10 +19,6 @@
)
from press.press.doctype.site.saas_site import get_saas_domain
from press.utils import log_error


import os

from press.utils.telemetry import capture, identify

os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"
Expand Down
3 changes: 2 additions & 1 deletion press/api/partner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import frappe
from frappe.utils.data import today
from frappe.utils import flt
from frappe.utils.data import today

from press.utils import get_current_team


Expand Down
14 changes: 7 additions & 7 deletions press/api/saas.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import frappe
import json

import frappe
from frappe.core.utils import find
from press.press.doctype.team.team import Team
from press.api.account import get_account_request_from_key
from press.utils import get_current_team, group_children_in_result, log_error

from press.api.account import get_account_request_from_key
from press.press.doctype.site.erpnext_site import get_erpnext_domain
from press.press.doctype.site.saas_pool import get as get_pooled_saas_site
from press.press.doctype.site.saas_site import (
SaasSite,
get_default_team_for_app,
get_saas_domain,
get_saas_site_plan,
set_site_in_subscription_docs,
)
from press.press.doctype.site.saas_pool import get as get_pooled_saas_site
from press.press.doctype.site.erpnext_site import get_erpnext_domain
from press.press.doctype.team.team import Team
from press.utils import get_current_team, group_children_in_result, log_error
from press.utils.telemetry import capture, identify


# ----------------------------- SIGNUP APIs ---------------------------------


Expand Down
5 changes: 3 additions & 2 deletions press/api/security.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import frappe
from press.api.server import all as get_all_servers
from press.agent import Agent
from frappe.utils import get_datetime

from press.agent import Agent
from press.api.server import all as get_all_servers


@frappe.whitelist()
def get_servers(server_filter):
Expand Down
Loading

0 comments on commit 28a7ac3

Please sign in to comment.