Skip to content

Commit

Permalink
Bug 1790816 - Reformat toolkit/ with isort. r=linter-reviewers,Standa…
Browse files Browse the repository at this point in the history
…rd8 DONTBUILD

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D162670
  • Loading branch information
marco-c committed Nov 22, 2022
1 parent d8d5267 commit 76a10c5
Show file tree
Hide file tree
Showing 80 changed files with 193 additions and 196 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from mod_pywebsocket import msgutil

import time

from mod_pywebsocket import msgutil


def web_socket_do_extra_handshake(request):
# # must set request.ws_protocol to the selected version from ws_requested_protocols
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from marionette_harness import MarionetteTestCase


EXT_ID = "extension-with-bg-sw@test"
EXT_DIR_PATH = "extension-with-bg-sw"
PREF_BG_SW_ENABLED = "extensions.backgroundServiceWorker.enabled"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from marionette_driver import Wait
from marionette_driver.addons import Addons

import os
import sys

from marionette_driver import Wait
from marionette_driver.addons import Addons

# Add this directory to the import path.
sys.path.append(os.path.dirname(__file__))

from service_worker_testutils import (
MarionetteServiceWorkerTestCase,
EXT_ID,
EXT_DIR_PATH,
EXT_ID,
PREF_BG_SW_ENABLED,
PREF_PERSIST_TEMP_ADDONS,
MarionetteServiceWorkerTestCase,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from marionette_driver import Wait
from marionette_driver.addons import Addons

import os
import sys

from marionette_driver import Wait
from marionette_driver.addons import Addons

# Add this directory to the import path.
sys.path.append(os.path.dirname(__file__))

from service_worker_testutils import (
MarionetteServiceWorkerTestCase,
EXT_ID,
EXT_DIR_PATH,
EXT_ID,
PREF_BG_SW_ENABLED,
MarionetteServiceWorkerTestCase,
)


Expand Down
4 changes: 2 additions & 2 deletions toolkit/components/extensions/webidl-api/InspectJSONSchema.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# You can obtain one at http://mozilla.org/MPL/2.0/.

import argparse
import sys
import os
import sys

# Sanity check (ensure the script has been executed through `mach python`).
try:
Expand All @@ -26,9 +26,9 @@
sys.path.append(module_dir)

from GenerateWebIDLBindings import (
APIEntry,
load_and_parse_JSONSchema,
set_logging_level,
APIEntry,
)


Expand Down
1 change: 0 additions & 1 deletion toolkit/components/extensions/webidl-api/test/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import mozpack.path as mozpath


setup_called = False


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

helpers.setup()

from GenerateWebIDLBindings import (
load_and_parse_JSONSchema,
)
from GenerateWebIDLBindings import load_and_parse_JSONSchema


def test_all_jsonschema_load_and_parse_smoketest():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import sys
import json
import os
import sys
from textwrap import dedent

import mozpack.path as mozpath
import mozunit

import pytest

from textwrap import dedent

# Import test helpers module.
OUR_DIR = mozpath.abspath(mozpath.dirname(__file__))
sys.path.append(OUR_DIR)
Expand All @@ -21,13 +19,7 @@

helpers.setup()

from GenerateWebIDLBindings import (
APIEvent,
APIFunction,
APINamespace,
APIType,
Schemas,
)
from GenerateWebIDLBindings import APIEvent, APIFunction, APINamespace, APIType, Schemas


def test_parse_simple_single_api_namespace(write_jsonschema_fixtures):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import sys
from textwrap import dedent

import mozpack.path as mozpath
import mozunit

from textwrap import dedent

# Import test helpers module.
OUR_DIR = mozpath.abspath(mozpath.dirname(__file__))
sys.path.append(OUR_DIR)
Expand All @@ -18,10 +17,10 @@
helpers.setup()

from GenerateWebIDLBindings import (
WEBEXT_STUBS_MAPPING,
APIFunction,
Schemas,
WebIDLHelpers,
WEBEXT_STUBS_MAPPING,
)

original_stub_mapping_config = WEBEXT_STUBS_MAPPING.copy()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
Outputter to generate C++ code for metrics.
"""

import jinja2
import json

from util import generate_metric_ids, generate_ping_ids, get_metrics
import jinja2
from glean_parser import util
from util import generate_metric_ids, generate_ping_ids, get_metrics


def cpp_datatypes_filter(value):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
"""

import enum
import jinja2
import json
import sys

from js import ID_BITS, PING_INDEX_BITS
from util import type_ids_and_categories
import jinja2
from glean_parser import util
from glean_parser.metrics import Rate
from util import type_ids_and_categories

from js import ID_BITS, PING_INDEX_BITS

# The list of all args to CommonMetricData.
# No particular order is required, but I have these in common_metric_data.rs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
"""

import jinja2
from glean_parser import util
from perfecthash import PerfectHash
from string_table import StringTable

from util import generate_metric_ids, generate_ping_ids, get_metrics
from glean_parser import util

"""
We need to store several bits of information in the Perfect Hash Map Entry:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import cpp
import jog
import js
import os
import rust
import sys
from pathlib import Path

import cpp
import jinja2

from util import generate_metric_ids
import jog
import rust
from glean_parser import lint, parser, translate, util
from mozbuild.util import FileAvoidWrite
from pathlib import Path
from util import generate_metric_ids

import js


class ParserError(Exception):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
import json

import jinja2

from js import ID_BITS, ID_SIGNAL_BITS
from util import generate_metric_ids, generate_ping_ids, get_metrics
from glean_parser import util
from glean_parser.metrics import Rate
from util import generate_metric_ids, generate_ping_ids, get_metrics

from js import ID_BITS, ID_SIGNAL_BITS

# The list of all args to CommonMetricData.
# No particular order is required, but I have these in common_metric_data.rs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
Utility functions for the glean_parser-based code generator
"""
import copy
from typing import Dict, List, Tuple

from glean_parser import util
from typing import Dict, List, Tuple


def generate_ping_ids(objs):
Expand Down
14 changes: 8 additions & 6 deletions toolkit/components/glean/build_scripts/mach_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
def data_review(command_context, bug=None):
# Get the metrics_index's list of metrics indices
# by loading the index as a module.
from os import path
import sys
from os import path

sys.path.append(path.join(path.dirname(__file__), path.pardir))
from metrics_index import metrics_yamls
from pathlib import Path

from glean_parser import data_review
from pathlib import Path
from metrics_index import metrics_yamls

return data_review.generate(
bug, [Path(command_context.topsrcdir) / x for x in metrics_yamls]
Expand All @@ -51,16 +51,17 @@ def data_review(command_context, bug=None):
def perf_data_review(command_context, bug=None):
# Get the metrics_index's list of metrics indices
# by loading the index as a module.
from os import path
import sys
from os import path

sys.path.append(path.join(path.dirname(__file__), path.pardir))
from metrics_index import metrics_yamls

sys.path.append(path.dirname(__file__))
import perf_data_review
from pathlib import Path

import perf_data_review

return perf_data_review.generate(
bug, [Path(command_context.topsrcdir) / x for x in metrics_yamls]
)
Expand All @@ -75,6 +76,7 @@ def perf_data_review(command_context, bug=None):
)
def update_glean_tags(command_context):
from pathlib import Path

import yaml
from mozbuild.backend.configenvironment import ConfigEnvironment
from mozbuild.frontend.reader import BuildReader
Expand Down Expand Up @@ -159,8 +161,8 @@ def replace_in_file_or_die(path, pattern, replace):
)
@CommandArgument("version", help="Glean version to upgrade to")
def update_glean(command_context, version):
from pathlib import Path
import textwrap
from pathlib import Path

topsrcdir = Path(command_context.topsrcdir)

Expand Down
6 changes: 2 additions & 4 deletions toolkit/components/glean/build_scripts/perf_data_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
This was mostly copies from glean_parser, and should be kept in sync.
"""

import re
from pathlib import Path
from typing import Sequence
import re


from glean_parser import parser
from glean_parser import util
from glean_parser import parser, util


def generate(
Expand Down
2 changes: 1 addition & 1 deletion toolkit/components/glean/tests/pytest/expect_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import os
import inspect
import os


def expect(path, actual):
Expand Down
4 changes: 2 additions & 2 deletions toolkit/components/glean/tests/pytest/test_gifft.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import io
import mozunit
import sys
from os import path
from pathlib import Path
import sys

import mozunit
from expect_helper import expect

# Shenanigans to import the FOG glean_parser runner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import io
import mozunit
import sys
from os import path
from pathlib import Path
import sys

import mozunit
from expect_helper import expect

# Shenanigans to import the cpp outputter extension
Expand Down
Loading

0 comments on commit 76a10c5

Please sign in to comment.