Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added isort support #797

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[settings]
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=79

; 3 stands for Vertical Hanging Indent, e.g.
; from third_party import (
; lib1,
; lib2,
; lib3,
; )
; docs: https://github.com/timothycrosley/isort#multi-line-output-modes
multi_line_output=3
known_future_library = six,six.moves,__future__
known_third_party=google,mock,pymysql,sqlalchemy,psycopg2,mysql,requests,django,pytest,grpc,flask,bitarray,prometheus_client,psutil,pymongo,wrapt,thrift,retrying,pyramid,werkzeug,gevent
known_first_party=opencensus
1 change: 1 addition & 0 deletions context/opencensus-context/examples/async_span.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import asyncio

from opencensus.common.runtime_context import RuntimeContext

RuntimeContext.register_slot('current_span', None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

from threading import Thread

from opencensus.common.runtime_context import RuntimeContext

RuntimeContext.register_slot('operation_id', '<empty>')
Expand Down
5 changes: 3 additions & 2 deletions context/opencensus-context/examples/thread_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from multiprocessing.dummy import Pool as ThreadPool
import time
import threading
import time
from multiprocessing.dummy import Pool as ThreadPool

from opencensus.common.runtime_context import RuntimeContext

RuntimeContext.register_slot('operation_id', '<empty>')
Expand Down
4 changes: 2 additions & 2 deletions context/opencensus-context/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from setuptools import find_packages
from setuptools import setup
from setuptools import find_packages, setup

from version import __version__

setup(
Expand Down
1 change: 1 addition & 0 deletions context/opencensus-context/tests/test_runtime_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import unittest

from opencensus.common.runtime_context import RuntimeContext


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from opencensus.common.correlationcontext.correlationcontext \
import CorrelationContext

from opencensus.common.correlationcontext.correlationcontext import (
CorrelationContext,
)

__all__ = ['CorrelationContext']
4 changes: 2 additions & 2 deletions contrib/opencensus-correlation/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from setuptools import find_packages
from setuptools import setup
from setuptools import find_packages, setup

from version import __version__

setup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import unittest

from opencensus.common.correlationcontext import CorrelationContext


Expand Down
3 changes: 2 additions & 1 deletion contrib/opencensus-ext-azure/examples/metrics/standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import psutil
import time

import psutil

from opencensus.ext.azure import metrics_exporter


Expand Down
1 change: 1 addition & 0 deletions contrib/opencensus-ext-azure/examples/traces/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

from flask import Flask

from opencensus.ext.flask.flask_middleware import FlaskMiddleware

app = Flask(__name__)
Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-azure/examples/traces/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from flask import Flask
import requests
from flask import Flask

from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.ext.flask.flask_middleware import FlaskMiddleware
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
import threading
import time

from opencensus.common.schedule import Queue
from opencensus.common.schedule import QueueEvent
from opencensus.common.schedule import Queue, QueueEvent
from opencensus.ext.azure.common import Options
from opencensus.trace import execution_context

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import datetime
import json
import random
import os
import random

from opencensus.common.schedule import PeriodicTask

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import json
import logging

import requests

logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
import platform
import sys

from opencensus.common.utils import timestamp_to_microseconds, to_iso_str
from opencensus.common.version import __version__ as opencensus_version
from opencensus.ext.azure.common.version import __version__ as ext_version

try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse

from opencensus.common.version import __version__ as opencensus_version
from opencensus.common.utils import timestamp_to_microseconds
from opencensus.common.utils import to_iso_str
from opencensus.ext.azure.common.version import __version__ as ext_version

azure_monitor_context = {
'ai.cloud.role': os.path.basename(sys.argv[0]) or 'Python Application',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
import time
import traceback

from opencensus.common.schedule import Queue
from opencensus.common.schedule import QueueExitEvent
from opencensus.common.schedule import QueueEvent
from opencensus.ext.azure.common import Options
from opencensus.ext.azure.common import utils
from opencensus.ext.azure.common.protocol import Data
from opencensus.ext.azure.common.protocol import Envelope
from opencensus.ext.azure.common.protocol import ExceptionData
from opencensus.ext.azure.common.protocol import Message
from opencensus.common.schedule import Queue, QueueEvent, QueueExitEvent
from opencensus.ext.azure.common import Options, utils
from opencensus.ext.azure.common.protocol import (
Data,
Envelope,
ExceptionData,
Message,
)
from opencensus.ext.azure.common.storage import LocalFileStorage
from opencensus.ext.azure.common.transport import TransportMixin
from opencensus.trace import execution_context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@

import json
import logging

import requests

from opencensus.common import utils as common_utils
from opencensus.ext.azure.common import Options
from opencensus.ext.azure.common import utils
from opencensus.ext.azure.common.protocol import Data
from opencensus.ext.azure.common.protocol import DataPoint
from opencensus.ext.azure.common.protocol import Envelope
from opencensus.ext.azure.common.protocol import MetricData
from opencensus.ext.azure.common import Options, utils
from opencensus.ext.azure.common.protocol import (
Data,
DataPoint,
Envelope,
MetricData,
)
from opencensus.ext.azure.metrics_exporter import standard_metrics
from opencensus.metrics import transport
from opencensus.metrics.export.metric_descriptor import MetricDescriptorType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from opencensus.ext.azure.metrics_exporter.standard_metrics.cpu import (
ProcessorTimeMetric,
)
from opencensus.ext.azure.metrics_exporter.standard_metrics.http_dependency import ( # noqa E501
DependencyRateMetric,
)
from opencensus.ext.azure.metrics_exporter.standard_metrics.http_requests import ( # noqa E501
RequestsAvgExecutionMetric,
RequestsRateMetric,
)
from opencensus.ext.azure.metrics_exporter.standard_metrics.memory import (
AvailableMemoryMetric,
)
from opencensus.ext.azure.metrics_exporter.standard_metrics.process import (
ProcessCPUMetric,
ProcessMemoryMetric,
)
from opencensus.metrics.export.gauge import Registry
from opencensus.metrics.export.metric_producer import MetricProducer
from opencensus.ext.azure.metrics_exporter.standard_metrics.cpu \
import ProcessorTimeMetric
from opencensus.ext.azure.metrics_exporter.standard_metrics.http_dependency \
import DependencyRateMetric
from opencensus.ext.azure.metrics_exporter.standard_metrics.memory \
import AvailableMemoryMetric
from opencensus.ext.azure.metrics_exporter.standard_metrics.process \
import ProcessCPUMetric
from opencensus.ext.azure.metrics_exporter.standard_metrics.process \
import ProcessMemoryMetric
from opencensus.ext.azure.metrics_exporter.standard_metrics.http_requests \
import RequestsAvgExecutionMetric
from opencensus.ext.azure.metrics_exporter.standard_metrics.http_requests \
import RequestsRateMetric

# List of standard metrics to track
STANDARD_METRICS = [AvailableMemoryMetric,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import requests
import threading
import time

import requests

from opencensus.metrics.export.gauge import DerivedDoubleGauge
from opencensus.trace import execution_context

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import time

from opencensus.metrics.export.gauge import DerivedDoubleGauge

if sys.version_info < (3,):
from BaseHTTPServer import HTTPServer
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
# limitations under the License.

import logging

import psutil

from opencensus.metrics.export.gauge import DerivedLongGauge
from opencensus.metrics.export.gauge import DerivedDoubleGauge
from opencensus.metrics.export.gauge import (
DerivedDoubleGauge,
DerivedLongGauge,
)

logger = logging.getLogger(__name__)
PROCESS = psutil.Process()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
import logging

from opencensus.common.schedule import QueueExitEvent
from opencensus.ext.azure.common import Options
from opencensus.ext.azure.common import utils
from opencensus.ext.azure.common import Options, utils
from opencensus.ext.azure.common.exporter import BaseExporter
from opencensus.ext.azure.common.protocol import Data
from opencensus.ext.azure.common.protocol import Envelope
from opencensus.ext.azure.common.protocol import RemoteDependency
from opencensus.ext.azure.common.protocol import Request
from opencensus.ext.azure.common.protocol import (
Data,
Envelope,
RemoteDependency,
Request,
)
from opencensus.ext.azure.common.storage import LocalFileStorage
from opencensus.ext.azure.common.transport import TransportMixin
from opencensus.trace.span import SpanKind
Expand Down
4 changes: 2 additions & 2 deletions contrib/opencensus-ext-azure/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from setuptools import find_packages
from setuptools import setup
from setuptools import find_packages, setup

from opencensus.ext.azure.common.version import __version__

setup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
# limitations under the License.

import logging
import mock
import os
import shutil
import unittest

import mock

from opencensus.ext.azure import log_exporter

TEST_FOLDER = os.path.abspath('.test.logs')
Expand Down
21 changes: 11 additions & 10 deletions contrib/opencensus-ext-azure/tests/test_azure_metrics_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import mock
import unittest
from datetime import datetime

import mock

from opencensus.common import utils
from opencensus.ext.azure import metrics_exporter
from opencensus.ext.azure.common import Options
from opencensus.ext.azure.common.protocol import DataPoint
from opencensus.ext.azure.common.protocol import Envelope
from opencensus.ext.azure.common.protocol import DataPoint, Envelope
from opencensus.ext.azure.metrics_exporter import standard_metrics
from opencensus.metrics import label_key
from opencensus.metrics import label_value
from opencensus.metrics.export import metric
from opencensus.metrics.export import metric_descriptor
from opencensus.metrics.export import point
from opencensus.metrics.export import time_series
from opencensus.metrics.export import value
from opencensus.metrics import label_key, label_value
from opencensus.metrics.export import (
metric,
metric_descriptor,
point,
time_series,
value,
)
from opencensus.metrics.export.metric_descriptor import MetricDescriptorType


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
# limitations under the License.

import collections
import mock
import requests
import sys
import unittest

import mock
import requests

from opencensus.ext.azure.metrics_exporter import standard_metrics
from opencensus.trace import execution_context

if sys.version_info < (3,):
from BaseHTTPServer import HTTPServer
else:
Expand Down
Loading