repo_name stringlengths 7 65 | path stringlengths 5 185 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 977 990k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 7.18 99.4 | line_max int64 31 999 | alpha_frac float64 0.25 0.95 | ratio float64 1.5 7.84 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
p1c2u/openapi-core | openapi_core/unmarshalling/schemas/factories.py | 1 | 4628 | import warnings
from typing import Any
from typing import Dict
from typing import Iterable
from typing import Optional
from typing import Type
from typing import Union
from jsonschema.protocols import Validator
from openapi_schema_validator import OAS30Validator
from openapi_core.spec import Spec
from openapi_core.un... | bsd-3-clause | 3b73ed1452e3ce4ea640abce2ac25716 | 36.024 | 79 | 0.706137 | 4.034874 | false | false | false | false |
p1c2u/openapi-core | openapi_core/deserializing/parameters/factories.py | 1 | 1431 | import re
from functools import partial
from typing import Dict
from openapi_core.deserializing.parameters.datatypes import (
DeserializerCallable,
)
from openapi_core.deserializing.parameters.deserializers import (
BaseParameterDeserializer,
)
from openapi_core.deserializing.parameters.deserializers import (
... | bsd-3-clause | 4efccc43ff2fdf921a94efe088938ce8 | 33.902439 | 73 | 0.734451 | 4.008403 | false | false | false | false |
p1c2u/openapi-core | tests/unit/schema/test_schema_parameters.py | 1 | 3115 | import pytest
from openapi_core.schema.parameters import get_explode
from openapi_core.schema.parameters import get_style
from openapi_core.spec.paths import Spec
class TestGetStyle:
@pytest.mark.parametrize(
"location,expected",
[
("query", "form"),
("path", "simple"),
... | bsd-3-clause | c7d685889fd76c057d4495460ddfc40f | 24.325203 | 79 | 0.463884 | 4.209459 | false | true | false | false |
p1c2u/openapi-core | openapi_core/deserializing/media_types/factories.py | 1 | 1786 | from json import loads
from typing import Any
from typing import Callable
from typing import Dict
from typing import Optional
from openapi_core.deserializing.media_types.datatypes import (
DeserializerCallable,
)
from openapi_core.deserializing.media_types.deserializers import (
BaseMediaTypeDeserializer,
)
fr... | bsd-3-clause | 94e977bd03f757355a7712b49a992cd9 | 33.346154 | 79 | 0.740202 | 4.059091 | false | false | false | false |
p1c2u/openapi-core | openapi_core/contrib/flask/views.py | 1 | 1090 | """OpenAPI core contrib flask views module"""
from typing import Any
from flask.views import MethodView
from openapi_core.contrib.flask.decorators import FlaskOpenAPIViewDecorator
from openapi_core.contrib.flask.handlers import FlaskOpenAPIErrorsHandler
from openapi_core.spec import Spec
from openapi_core.validation.... | bsd-3-clause | 734223a8041ca8c4ba9185a7c0b43a6a | 36.586207 | 78 | 0.73211 | 4.257813 | false | false | false | false |
simon-weber/gmusicapi | setup.py | 2 | 2676 | #!/usr/bin/env python
import re
from setuptools import setup, find_packages
import sys
import warnings
if sys.version_info[:3] < (3, 5, 0):
warnings.warn("gmusicapi does not officially support versions below "
"Python 3.5.0", RuntimeWarning)
# This hack is from http://stackoverflow.com/a/707135... | bsd-3-clause | 514163cb75a8abff3a8130c14d414923 | 38.940299 | 95 | 0.556054 | 3.544371 | false | false | false | false |
p1c2u/openapi-core | openapi_core/templating/util.py | 1 | 1094 | from typing import Any
from typing import Optional
from parse import Match
from parse import Parser
class ExtendedParser(Parser): # type: ignore
def _handle_field(self, field: str) -> Any:
# handle as path parameter field
field = field[1:-1]
path_parameter_field = "{%s:PathParameter}" % ... | bsd-3-clause | e407f65ccc3f5ec68a35c9bce276575e | 27.051282 | 72 | 0.670932 | 3.598684 | false | false | false | false |
p1c2u/openapi-core | openapi_core/casting/schemas/factories.py | 1 | 1150 | from typing import Dict
from openapi_core.casting.schemas.casters import ArrayCaster
from openapi_core.casting.schemas.casters import BaseSchemaCaster
from openapi_core.casting.schemas.casters import CallableSchemaCaster
from openapi_core.casting.schemas.casters import DummyCaster
from openapi_core.casting.schemas.dat... | bsd-3-clause | 276bcccec12c89ab2925b6d75feef3cb | 29.263158 | 69 | 0.691304 | 3.62776 | false | false | false | false |
p1c2u/openapi-core | tests/unit/contrib/requests/test_requests_requests.py | 1 | 2955 | from werkzeug.datastructures import Headers
from werkzeug.datastructures import ImmutableMultiDict
from openapi_core.contrib.requests import RequestsOpenAPIRequest
from openapi_core.validation.request.datatypes import RequestParameters
class TestRequestsOpenAPIRequest:
def test_simple(self, request_factory, requ... | bsd-3-clause | 3f02ec488364064837e7133044f69a12 | 33.764706 | 71 | 0.597293 | 4.567233 | false | false | false | false |
getsentry/raven-python | raven/transport/gevent.py | 14 | 1658 | """
raven.transport.gevent
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from raven.transport.base import AsyncTransport
from raven.transport.http import HTTPTransport
try:
... | bsd-3-clause | c34bc59244e7821cebd542f79c2b164d | 30.283019 | 75 | 0.648975 | 3.910377 | false | false | false | false |
getsentry/raven-python | raven/contrib/bottle/utils.py | 12 | 1043 | """
raven.contrib.bottle.utils
~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import logging
from raven.utils.compat import urlparse
from raven.utils.wsgi import get_headers... | bsd-3-clause | 5d5aed2b6154923de7566139d01185af | 25.74359 | 83 | 0.602109 | 3.725 | false | false | false | false |
getsentry/raven-python | raven/contrib/django/views.py | 12 | 2988 | """
raven.contrib.django.views
~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from functools import wraps
from django.conf import settings
from django.http import HttpRespon... | bsd-3-clause | 4fe14d3f2c0eb16aa6928daa87f4e587 | 26.666667 | 84 | 0.63822 | 4.059783 | false | false | false | false |
getsentry/raven-python | raven/transport/twisted.py | 14 | 2322 | """
raven.transport.twisted
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from raven.utils.compat import BytesIO
from raven.transport.base import AsyncTransport
from raven.tr... | bsd-3-clause | 011f2917320fed76156aed6be2595dbb | 29.96 | 79 | 0.596469 | 4.448276 | false | false | false | false |
getsentry/raven-python | tests/contrib/flask/tests.py | 1 | 11004 | import logging
import pytest
from exam import before, fixture
from flask import Flask, current_app, g
try:
from flask.ext.login import LoginManager, AnonymousUserMixin, login_user
except ImportError:
from flask_login import LoginManager, AnonymousUserMixin, login_user
from mock import patch, Mock
from raven.c... | bsd-3-clause | 59e9abd4fddf6ce0edccf2c9a4577376 | 33.712934 | 105 | 0.62341 | 3.820833 | false | true | false | false |
getsentry/raven-python | raven/transport/registry.py | 14 | 2606 | """
raven.transport.registry
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
# TODO(dcramer): we really should need to import all of these by default
from raven.transport.eventl... | bsd-3-clause | 5b963dddd61afd568fc9a34a5061e03a | 33.746667 | 102 | 0.695318 | 4.307438 | false | false | false | false |
getsentry/raven-python | raven/utils/ssl_match_hostname.py | 1 | 3597 | """The match_hostname() function from Python 3.2, essential when using SSL."""
from __future__ import absolute_import
import re
__version__ = '3.2.2'
class CertificateError(ValueError):
pass
def _dnsname_match(dn, hostname, max_wildcards=1):
"""Matching according to RFC 6125, section 6.4.3
http://to... | bsd-3-clause | 44de5f2c9b74b10b19ecc3b6c810075c | 33.586538 | 78 | 0.604949 | 4.110857 | false | false | false | false |
getsentry/raven-python | raven/contrib/tornado/__init__.py | 1 | 8241 | """
raven.contrib.tornado
~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details
:license: BSD, see LICENSE for more details
"""
from __future__ import absolute_import
from functools import partial
from tornado import ioloop
from tornado.httpclient import AsyncHTTPClient, HTTPErr... | bsd-3-clause | cbfe47efde569d21771b26536c98f2de | 32.096386 | 100 | 0.598228 | 4.42351 | false | false | false | false |
mozilla/airmozilla | airmozilla/manage/tests/test_tweeter.py | 3 | 14098 | import datetime
from nose.tools import eq_, ok_
import mock
from django.contrib.auth.models import User, Group
from django.conf import settings
from django.utils import timezone
from django.core.urlresolvers import reverse
from airmozilla.base.tests.testbase import Response, DjangoTestCase
from airmozilla.manage.twe... | bsd-3-clause | 098227396de43661444054f76b313717 | 30.823928 | 79 | 0.571074 | 3.704151 | false | true | false | false |
mozilla/airmozilla | airmozilla/main/tests/views/test_too_few_tags.py | 2 | 5211 | from nose.tools import eq_, ok_
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.utils.encoding import smart_text
from airmozilla.main.models import (
Event,
Tag,
EventRevision,
UserProfile,
)
from airmozilla.base.tests.testbase import DjangoTestCase... | bsd-3-clause | 91829326e1e2914e0ae3be9f4dfc9dac | 36.221429 | 79 | 0.600077 | 3.623783 | false | true | false | false |
mozilla/airmozilla | airmozilla/cronlogger/decorators.py | 15 | 1456 | import time
import sys
import functools
import contextlib
import traceback
from StringIO import StringIO
from .models import CronLog
@contextlib.contextmanager
def redirect_streams(stdout, stderr):
sys.stdout = stdout
sys.stderr = stderr
yield
sys.stdout = sys.__stdout__
sys.stderr = sys.__stderr... | bsd-3-clause | 5c964014327e6cd963e0d9dea4a44229 | 27 | 71 | 0.488324 | 4.452599 | false | false | false | false |
mozilla/airmozilla | airmozilla/manage/tests/test_event_hit_stats.py | 12 | 8671 | import datetime
from cStringIO import StringIO
from nose.tools import eq_, ok_
import mock
from django.utils import timezone
from airmozilla.base.tests.testbase import DjangoTestCase
from airmozilla.manage import event_hit_stats
from airmozilla.main.models import Event, EventHitStats, Template
SAMPLE_STATISTICS_XML... | bsd-3-clause | af8ab14f7e94b0f47e56292bce51b7e4 | 31.597744 | 79 | 0.593934 | 3.677269 | false | false | false | false |
mozilla/airmozilla | airmozilla/base/rev.py | 2 | 3262 | import os
import requests
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
def _get_api_headers():
if not settings.REV_CLIENT_API_KEY:
raise ImproperlyConfigured('REV_CLIENT_API_KEY') # pragma: no cover
if not settings.REV_USER_API_KEY:
raise Improper... | bsd-3-clause | 7af66559fa16ef27cea35c239a524534 | 26.644068 | 77 | 0.584611 | 3.855792 | false | false | false | false |
mozilla/airmozilla | airmozilla/subtitles/views.py | 2 | 1192 | import json
from django import http
from django.views.decorators.http import require_POST
from django.views.decorators.csrf import csrf_exempt
from airmozilla.subtitles.models import AmaraCallback, AmaraVideo
@csrf_exempt
@require_POST
def amara_callback(request):
try:
post = request.body and json.loads... | bsd-3-clause | 8df5c4c89472dd831b9eebd89b40584c | 29.564103 | 65 | 0.675336 | 3.590361 | false | false | false | false |
mozilla/airmozilla | airmozilla/main/cloud.py | 15 | 1959 | import math
# Font size distribution algorithms
LOGARITHMIC, LINEAR = 1, 2
def calculate_cloud(tags, steps=4, distribution=LOGARITHMIC):
"""
Add a ``font_size`` attribute to each tag according to the
frequency of its use, as indicated by its ``count``
attribute.
``steps`` defines the range of f... | bsd-3-clause | 23d74a3ba837a5e7a8f2cc0b027256d7 | 32.20339 | 73 | 0.620214 | 3.894632 | false | false | false | false |
mozilla/airmozilla | airmozilla/manage/tests/test_widgets.py | 3 | 1206 | from nose.tools import ok_
from django.core.files import File
from django.core.urlresolvers import reverse
from airmozilla.base.tests.testbase import DjangoTestCase
from airmozilla.manage import widgets
from airmozilla.main.models import (
Event,
Picture
)
class TestWidgets(DjangoTestCase):
def test_pi... | bsd-3-clause | 9228f31dfb76f31529fb248f2e68524e | 31.594595 | 71 | 0.65257 | 3.967105 | false | true | false | false |
mozilla/airmozilla | airmozilla/manage/views/cronlogger.py | 2 | 2116 | import datetime
from django import http
from django.core.cache import cache
from django.shortcuts import render
from django.db.models import Count
from jsonview.decorators import json_view
from airmozilla.cronlogger.models import CronLog
from .decorators import superuser_required
@superuser_required
def cronlogge... | bsd-3-clause | 6369f694fcc3f057560e51514f22dec8 | 25.78481 | 74 | 0.583648 | 3.812613 | false | false | false | false |
mozilla/airmozilla | airmozilla/main/templatetags/jinja_helpers.py | 2 | 7795 | # -*- coding: utf-8 -*-
import locale
import time
import urllib
import json
import urlparse
import bleach
import jinja2
from django.utils.text import Truncator
from django.db.utils import IntegrityError
from django.contrib.sites.requests import RequestSite
from django.utils.safestring import mark_safe
from django.ut... | bsd-3-clause | d439f0ccab6b932a0f3dfec1daee6848 | 27.032374 | 78 | 0.58899 | 3.7611 | false | false | false | false |
mozilla/airmozilla | airmozilla/staticpages/views.py | 2 | 3146 | # Adapted from django.contrib.flatpages.middleware
from django.conf import settings
from django.http import Http404, HttpResponse, HttpResponsePermanentRedirect
from django.shortcuts import get_object_or_404, render
from django.template import loader, engines
from django.utils.safestring import mark_safe
from airmozi... | bsd-3-clause | b823d264e5c55c8b93e615c4ce49837b | 32.115789 | 76 | 0.646853 | 4.161376 | false | false | false | false |
mozilla/airmozilla | airmozilla/manage/vidly_synchronization.py | 15 | 4017 | import datetime
from random import shuffle
from collections import defaultdict
from django.utils.timezone import utc
from airmozilla.main.models import Event, VidlySubmission
from airmozilla.manage import vidly
def synchronize_all(verbose=False):
submissions = (
VidlySubmission.objects
.filter(e... | bsd-3-clause | 3dfd33658d4d58d6639ef11f4bf4aa7e | 31.92623 | 77 | 0.520538 | 4.287086 | false | false | false | false |
mozilla/airmozilla | airmozilla/manage/views/staticpages.py | 2 | 3469 | from django.contrib import messages
from django.shortcuts import render, redirect
from django.db import transaction
from airmozilla.base.utils import paginate
from airmozilla.main.models import Channel
from airmozilla.manage import forms
from airmozilla.staticpages.models import StaticPage
from .decorators import (
... | bsd-3-clause | 0d61e4fc0ec29087a8b14dadd7a04d43 | 33.69 | 77 | 0.628423 | 4.100473 | false | false | false | false |
quantmind/pulsar | pulsar/async/mixins.py | 1 | 6580 | import time
from asyncio import Queue, CancelledError
DEFAULT_LIMIT = 2**16
class FlowControl:
"""A protocol mixin for flow control logic.
This implements the protocol methods :meth:`pause_writing`,
:meth:`resume_writing`.
"""
_b_limit = 2*DEFAULT_LIMIT
_paused = False
_buffer_size = 0... | bsd-3-clause | 105442cacd94902977c9b374bd48f64d | 30.037736 | 74 | 0.537538 | 4.500684 | false | false | false | false |
quantmind/pulsar | pulsar/utils/tools/pidfile.py | 1 | 2115 | import os
import tempfile
__all__ = ['Pidfile']
class Pidfile:
"""\
Manage a PID file. If a specific name is provided
it and '"%s.oldpid" % name' will be used. Otherwise
we create a temp file using os.mkstemp.
"""
def __init__(self, fname=None):
self.fname = fname
self.pid = N... | bsd-3-clause | d36cb61266154b05a247f2d5b239f93e | 27.2 | 76 | 0.469976 | 4.204771 | false | false | false | false |
quantmind/pulsar | pulsar/apps/data/channels.py | 1 | 10691 | import re
import logging
import json
from functools import wraps
from enum import Enum
from asyncio import gather
from collections import namedtuple, OrderedDict
from ...utils.exceptions import ProtocolError
from ...apps.ds import redis_to_py_pattern
from .store import PubSubClient
event_callbacks = namedtuple('even... | bsd-3-clause | 34a070af691ff1ec385e71f895de7ef4 | 29.200565 | 79 | 0.587504 | 4.616149 | false | false | false | false |
quantmind/pulsar | pulsar/async/futures.py | 1 | 6424 | from asyncio import Future, CancelledError, TimeoutError, sleep, gather
from .consts import MAX_ASYNC_WHILE
from .access import (
get_event_loop, LOGGER, ensure_future, create_future
)
def return_false():
return False
def chain_future(future, callback=None, errback=None, next=None):
'''Chain a :class:`... | bsd-3-clause | a421abeff806a9cbc340085b69024f3c | 29.736842 | 79 | 0.594022 | 4.285524 | false | false | false | false |
quantmind/pulsar | extensions/ext.py | 1 | 2242 | #
# Required by Cython to build Hiredis extensions
#
import os
import sys
from distutils.extension import Extension
from distutils.command.build_ext import build_ext
from distutils.errors import (CCompilerError, DistutilsExecError,
DistutilsPlatformError)
path = os.path.join('extensions',... | bsd-3-clause | 62e4ac6f0ba302811c98074a8f357378 | 29.297297 | 76 | 0.588314 | 4.222222 | false | false | false | false |
quantmind/pulsar | pulsar/cmds/pypi_version.py | 1 | 1771 | """Check PyPI version
"""
from distutils.cmd import Command
from distutils.errors import DistutilsError
try:
from xmlrpc.client import ServerProxy
except ImportError:
from xmlrpclib import ServerProxy
class InvalidVersion(DistutilsError):
pass
class PyPi(Command):
description = (
'Validate ... | bsd-3-clause | ab05aff3544f72b14b7e497b6c990e85 | 27.111111 | 77 | 0.599661 | 4.383663 | false | false | false | false |
quantmind/pulsar | pulsar/utils/pylib/wsgiresponse.py | 1 | 8449 | import time
from http.client import responses
from http.cookies import SimpleCookie
from functools import reduce
from datetime import datetime, timedelta
from wsgiref.handlers import format_date_time as http_date
from multidict import CIMultiDict
from .wsgi import has_empty_content, HEAD
PULSAR_CACHE = 'pulsar.cach... | bsd-3-clause | 8edb316d0fe174d9c4994299f51db648 | 29.612319 | 79 | 0.585276 | 4.201392 | false | false | false | false |
quantmind/pulsar | pulsar/utils/context.py | 1 | 2995 | from asyncio import Task, get_event_loop
from contextlib import contextmanager
class TaskContext:
_previous_task_factory = None
def __call__(self, loop, coro):
current = Task.current_task(loop=loop)
task = Task(coro, loop=loop)
try:
task._context = current._context.copy()
... | bsd-3-clause | db9230df56aaba98c3d07e003caae3eb | 26.990654 | 79 | 0.543239 | 4.334298 | false | false | false | false |
quantmind/pulsar | pulsar/utils/system/posixsystem.py | 1 | 5042 | import os
import sys
import fcntl
import resource
import grp
import pwd
import signal
import ctypes
from multiprocessing import current_process
from .base import * # noqa
__all__ = ['daemonize',
'EXIT_SIGNALS',
'SIGNALS',
'kill',
'get_uid',
'get_gid',
... | bsd-3-clause | 7308991e8ab38fe566880d58618a075d | 25.819149 | 80 | 0.578739 | 3.751488 | false | false | false | false |
quantmind/pulsar | pulsar/apps/wsgi/routers.py | 1 | 21405 | import os
import re
import stat
import mimetypes
from collections import OrderedDict
from functools import partial, lru_cache
from email.utils import parsedate_tz, mktime_tz
from pulsar.utils.httpurl import CacheControl
from pulsar.utils.slugify import slugify
from pulsar.utils.security import digest
from pulsar.util... | bsd-3-clause | ed269efcfc5a15975bba8727694b9b38 | 32.708661 | 80 | 0.56968 | 4.35947 | false | false | false | false |
quantmind/pulsar | pulsar/cmds/linux_wheels.py | 1 | 3440 | #!/usr/bin/env python
"""Build python wheels for a package
Optionally check if the version is greatre then the current version on PyPI
(pass the --release flag in the command line)
"""
import os
from distutils.cmd import Command
from distutils.errors import DistutilsModuleError
try:
import docker
except ImportErr... | bsd-3-clause | 8f42b375002700cb53486370eaab6327 | 32.398058 | 78 | 0.533721 | 4 | false | false | false | false |
yt-project/unyt | unyt/tests/test_define_unit.py | 1 | 1247 | import pytest
from unyt.array import unyt_quantity
from unyt.unit_object import define_unit
from unyt.unit_registry import UnitRegistry
def test_define_unit():
define_unit("mph", (1.0, "mile/hr"))
a = unyt_quantity(2.0, "mph")
b = unyt_quantity(1.0, "mile")
c = unyt_quantity(1.0, "hr")
assert a =... | bsd-3-clause | 9c6b7fc71d9cd6e4a56f67c1bff73b9d | 28 | 51 | 0.59583 | 2.834091 | false | true | false | false |
mozilla/amo-validator | tests/test_markup_markuptester.py | 2 | 11984 | # -*- coding: utf-8 -*-
import validator.testcases.markup.markuptester as markuptester
from validator.errorbundler import ErrorBundle
from validator.constants import *
def _test_xul(path, should_fail=False, type_=None):
with open(path) as f:
return _test_xul_raw(f.read(), path, should_fail, type_)
def _... | bsd-3-clause | d3adbb1555cf9f23e072578b7487414a | 26.170068 | 80 | 0.596979 | 3.267521 | false | true | false | false |
mozilla/amo-validator | validator/testcases/packagelayout.py | 3 | 15774 | from fnmatch import fnmatch as fnm
from validator.constants import (FF4_MIN, FIREFOX_GUID, FENNEC_GUID,
THUNDERBIRD_GUID as TB_GUID, ANDROID_GUID,
PACKAGE_DICTIONARY, )
import validator.decorator as decorator
from validator.decorator import version_rang... | bsd-3-clause | c90d3e9aece90b6609174ea0d4f52541 | 39.342711 | 80 | 0.548878 | 4.382884 | false | true | false | false |
mozilla/amo-validator | tests/compat/test_gecko52.py | 2 | 1959 | import pytest
from helper import CompatTestCase
from validator.compat import FX52_DEFINITION
class TestFX52Compat(CompatTestCase):
"""Test that compatibility tests for Gecko 52 are properly executed."""
VERSION = FX52_DEFINITION
def test_nsISupportsArray_deprecated(self):
"""https://github.com/... | bsd-3-clause | 91078f47154f15b60fea323ea0052797 | 31.114754 | 130 | 0.646248 | 4.150424 | false | true | false | false |
mozilla/amo-validator | validator/version.py | 8 | 2256 | # This Source Code Form is subject to the terms of the Mozilla Public
# 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/.
# Derived from nsVersionComparator.cpp in mozilla-central
from itertools import izip_longest
import re
__all__ = 'Ver... | bsd-3-clause | ec0a372e8640ebbca661954febc81b9a | 24.066667 | 71 | 0.526596 | 3.53605 | false | false | false | false |
mozilla/amo-validator | validator/chromemanifest.py | 7 | 8636 | import os.path
from validator.contextgenerator import ContextGenerator
class ChromeManifest(object):
"""This class enables convenient parsing and iteration of
chrome.manifest files."""
def __init__(self, data, path):
self.context = ContextGenerator(data)
self.lines = data.split('\n')
... | bsd-3-clause | 049efdc073f39d97a509f646d6e35c63 | 34.983333 | 78 | 0.513201 | 5.003476 | false | false | false | false |
mozilla/amo-validator | tests/test_regex.py | 2 | 6347 | from mock import Mock
from helper import MockXPI
from js_helper import _do_real_test_raw as _do_test_raw
from validator.errorbundler import ErrorBundle
from validator.testcases import regex
from validator.testcases.regex import RegexTest
import validator.testcases.content
def test_valid():
'Tests a valid string ... | bsd-3-clause | fc33daecd2998bf81c27baf90f057704 | 29.661836 | 104 | 0.614464 | 3.367109 | false | true | false | false |
ella/ella | ella/positions/migrations/0001_initial.py | 6 | 3073 |
from south.db import db
from django.db import models
from ella.positions.models import *
class Migration:
depends_on = (
("core", "0001_initial"),
)
def forwards(self, orm):
# Adding model 'Position'
db.create_table('positions_position', (
('id', models.... | bsd-3-clause | fb8680d2cee8e7e8af284f9862c40bd0 | 47.777778 | 163 | 0.532379 | 4.175272 | false | false | false | false |
ella/ella | ella/photos/admin.py | 2 | 5010 | from django import forms
from django.contrib import admin
from django.conf import settings
from django.utils.translation import ugettext
from django.forms.util import ValidationError
from django.utils import simplejson
from django.utils.translation import ugettext_lazy as _
from django.utils.safestring import mark_safe... | bsd-3-clause | bb52981a44f853cf6bd3e38b0cfd16d1 | 34.034965 | 119 | 0.605589 | 4.073171 | false | false | false | false |
ella/ella | ella/photos/migrations/0003_auto__chg_field_photo_created__chg_field_photo_image.py | 6 | 9405 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Photo.created'
db.alter_column('photos_photo', 'created', self.gf('django.db.models.fields.DateT... | bsd-3-clause | 895fae575bb7b4ca15abe8e541bafdd8 | 69.714286 | 182 | 0.553854 | 3.771051 | false | false | false | false |
ella/ella | test_ella/test_photos/test_resize.py | 3 | 7688 | # -*- coding: utf-8 -*-
from unittest import TestCase
from os import path
from nose import tools
from PIL import Image
from ella.photos.models import Format
from ella.photos.formatter import Formatter
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
class TestPhoto... | bsd-3-clause | 52d56f78d2558d38279aeb05cde50410 | 34.925234 | 90 | 0.599376 | 3.083835 | false | true | false | false |
ella/ella | ella/core/models/publishable.py | 2 | 11470 | from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _, ugettext
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from django.contrib.redirects.models import Redirect
from django.core.validators import ... | bsd-3-clause | fb0c3a406aba5ce5cd819f7cffaca244 | 36.606557 | 109 | 0.631473 | 4.246575 | false | false | false | false |
ella/ella | ella/api/serialization.py | 6 | 1508 | import logging
from django.http import HttpResponse
__all__ = ['response_serializer', 'object_serializer', 'FULL', 'PARTIAL']
log = logging.getLogger('ella.api.serialization')
FULL = object()
PARTIAL = object()
class ResponseSerializer(object):
def __init__(self):
self._registry = {}
def regist... | bsd-3-clause | ce71b78958d41dc4b0dbb8d8cf2d4fd4 | 24.559322 | 82 | 0.609416 | 4.396501 | false | false | false | false |
ella/ella | ella/photos/models.py | 2 | 15704 | import logging
from PIL import Image
from os import path
from cStringIO import StringIO
import os.path
import string
from django.db import models
from django.db.models import signals
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import force_unicode, smart_str
from django.contrib.s... | bsd-3-clause | 402e99b823ff5f33ed1492ef8f20ba0d | 33.28821 | 117 | 0.613538 | 4.013289 | false | false | false | false |
craft-ai/craft-ai-client-python | craft_ai/jwt_decode.py | 1 | 1971 | import base64
import binascii
import json
from craft_ai.errors import CraftAiTokenError
# Initial code retrieved from PyJWT
# cf. https://github.com/jpadilla/pyjwt/blob/ceff941/jwt/utils.py#L33-L42
def base64url_decode(base64_input):
if isinstance(base64_input, str):
base64_input = base64_input.encode("a... | bsd-3-clause | 66a7444aab07881aa8d1280152bd6a53 | 29.323077 | 84 | 0.664637 | 3.525939 | false | false | false | false |
craft-ai/craft-ai-client-python | craft_ai/pandas/interpreter.py | 1 | 3019 | import pandas as pd
from .. import Interpreter as VanillaInterpreter, Time
from ..errors import CraftAiNullDecisionError
from .utils import is_valid_property_value, create_timezone_df, format_input
class Interpreter(VanillaInterpreter):
@staticmethod
def decide_from_contexts_df(tree, contexts_df):
ba... | bsd-3-clause | d48e4e92b0e1a943dc70944f50d4c4d4 | 34.517647 | 85 | 0.555813 | 4.388081 | false | true | false | false |
ask/python-github2 | github2/client.py | 1 | 5923 | # -*- coding: utf-8 -*-
# Copyright (C) 2009-2012 Ask Solem <askh@modwheel.net>
# Christopher MacGown <ignoti+github@gmail.com>
# Evan Broder <broder@mit.edu>
# James Rowe <jnrowe@gmail.com>
# Jeremy Dunck <jdunck@gmail.com>... | bsd-3-clause | 4a23353b36a0edc1180220d5f8c48b6c | 39.292517 | 79 | 0.574033 | 4.279624 | false | false | false | false |
tsuru/rpaas | tests/test_admin_plugin.py | 1 | 36086 | # Copyright 2016 rpaas authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import datetime
import json
import os
import time
import unittest
import urllib
import urllib2
import urlparse
from io import StringIO
import mock
from rpaas impo... | bsd-3-clause | d4afa307e9e9f1e476edb8d5bb2a687b | 45.323492 | 118 | 0.55764 | 4.000665 | false | true | false | false |
tsuru/rpaas | tests/test_api.py | 1 | 38450 | # -*- coding: utf-8 -*-
# Copyright 2014 rpaas authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import base64
import inspect
import json
import os
import unittest
from io import BytesIO
from rpaas import admin_plugin, api, plugin, sto... | bsd-3-clause | 2bc633acd5f41bf4b99c88821c3d263e | 44.018735 | 110 | 0.594808 | 3.833865 | false | true | false | false |
openxc/openxc-python | openxc/tools/dump.py | 1 | 1172 | """
This module contains the methods for the ``openxc-dump`` command line program.
`main` is executed when ``openxc-dump`` is run, and all other callables in this
module are internal only.
"""
import argparse
import time
import logging
import sys
from openxc.formats.json import JsonFormatter
from .common import dev... | bsd-3-clause | 93d7816aafd56af7435107ad2f6f3249 | 25.044444 | 79 | 0.681741 | 4.156028 | false | false | false | false |
openxc/openxc-python | openxc/sources/bluetooth.py | 1 | 2211 | """A Bluetooth data source."""
import logging
from openxc.controllers.base import Controller
from .socket import SocketDataSource
from .base import DataSourceError
LOG = logging.getLogger(__name__)
try:
import bluetooth
except ImportError:
LOG.debug("pybluez library not installed, can't use bluetooth inter... | bsd-3-clause | 26ff706555f1cdc3b3dea726f3431844 | 30.140845 | 82 | 0.615559 | 4.439759 | false | false | false | false |
openxc/openxc-python | openxc/vehicle.py | 1 | 3945 | """This module is contains the Vehicle class, which is the main entry point for
using the Python library to access vehicle data programatically. Most users will
want to interact with an instance of Vehicle, and won't need to deal with other
parts of the library directly (besides measurement types).
"""
from .measuremen... | bsd-3-clause | 9a0ec020d07248a8a5604b734c3bf464 | 38.059406 | 80 | 0.654499 | 4.581882 | false | false | false | false |
sigmavirus24/github3.py | src/github3/repos/contents.py | 1 | 7166 | """This module contains the Contents object."""
from base64 import b64decode
from base64 import b64encode
from json import dumps
from .. import models
from ..decorators import requires_auth
from ..git import Commit
class Contents(models.GitHubCore):
"""A representation of file contents returned via the API.
... | bsd-3-clause | e2f2b2a841395a6a1e5b1d37fa4a03a2 | 32.962085 | 79 | 0.586241 | 4.532574 | false | false | false | false |
sigmavirus24/github3.py | src/github3/structs.py | 1 | 6990 | import collections.abc
import functools
import typing as t
from requests.compat import urlencode
from requests.compat import urlparse
from . import exceptions
from . import models
if t.TYPE_CHECKING:
import requests.models
from . import session
T = t.TypeVar("T")
class GitHubIterator(models.GitHubCore, ... | bsd-3-clause | dd480d9f8d8ea3a9224cf4b4b5b5708f | 33.95 | 78 | 0.557797 | 4.133649 | false | false | false | false |
sigmavirus24/github3.py | tests/unit/helper.py | 1 | 11558 | """Base classes and helpers for unit tests."""
import json
import os.path
import sys
import unittest.mock
import pytest
import github3
def create_url_helper(base_url):
"""A function to generate ``url_for`` helpers."""
base_url = base_url.rstrip("/")
def url_for(path=""):
if path:
pa... | bsd-3-clause | 8a9a191f097ce3a46e6ca6f674c6f42f | 30.84022 | 79 | 0.612995 | 4.162045 | false | true | false | false |
sigmavirus24/github3.py | src/github3/notifications.py | 1 | 8365 | """
This module contains the classes relating to notifications.
See also: http://developer.github.com/v3/activity/notifications/
"""
from json import dumps
from . import models
class Thread(models.GitHubCore):
"""Object representing a notification thread.
.. versionchanged:: 1.0.0
The ``comment``,... | bsd-3-clause | ddd9ddff338996379d63de836e52e33c | 28.558304 | 79 | 0.639091 | 4.691531 | false | false | false | false |
sigmavirus24/github3.py | src/github3/repos/comment.py | 1 | 4027 | """This module contains the RepoComment class."""
from .. import models
from .. import users
from ..decorators import requires_auth
class _RepoComment(models.GitHubCore):
"""The :class:`RepoComment <RepoComment>` object.
This stores the information about a comment on a file in a repository.
Two comment ... | bsd-3-clause | aa0929fd1091b858e333ab1b070dfe4f | 24.814103 | 76 | 0.605165 | 4.449724 | false | false | false | false |
healthchecks/healthchecks | hc/api/migrations/0076_auto_20201128_0951.py | 2 | 1187 | # Generated by Django 3.1.2 on 2020-11-28 09:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0075_auto_20200805_1004'),
]
operations = [
migrations.AddField(
model_name='ping',
name='exitstatus',
... | bsd-3-clause | 70f2925cb7828a2f05ef0b06e9058580 | 50.608696 | 699 | 0.5754 | 3.44058 | false | false | false | false |
healthchecks/healthchecks | hc/front/tests/test_resume.py | 1 | 2128 | from __future__ import annotations
from hc.api.models import Check, Flip
from hc.test import BaseTestCase
class ResumeTestCase(BaseTestCase):
def setUp(self):
super().setUp()
self.check = Check.objects.create(project=self.project, status="paused")
self.url = "/checks/%s/resume/" % self.ch... | bsd-3-clause | e34e86bed90b00e9598a5f7b39c20bdb | 35.067797 | 84 | 0.650846 | 3.637607 | false | true | false | false |
healthchecks/healthchecks | hc/api/tests/test_notify_trello.py | 1 | 2025 | from __future__ import annotations
import json
from datetime import timedelta as td
from unittest.mock import patch
from django.test.utils import override_settings
from django.utils.timezone import now
from hc.api.models import Channel, Check, Notification
from hc.test import BaseTestCase
@override_settings(TRELLO... | bsd-3-clause | b2a869756f5d417dbc3c4e5de24fbed9 | 30.640625 | 62 | 0.615309 | 3.661844 | false | true | false | false |
healthchecks/healthchecks | hc/front/tests/test_add_pushbullet_complete.py | 1 | 3099 | from __future__ import annotations
import json
from unittest.mock import patch
from django.test.utils import override_settings
from hc.api.models import Channel
from hc.test import BaseTestCase
@override_settings(PUSHBULLET_CLIENT_ID="t1", PUSHBULLET_CLIENT_SECRET="s1")
class AddPushbulletTestCase(BaseTestCase):
... | bsd-3-clause | 3eb132eb0e5fb886ba9571dca4479448 | 34.62069 | 76 | 0.657309 | 3.637324 | false | true | false | false |
jazzband/django-debug-toolbar | debug_toolbar/panels/profiling.py | 2 | 5680 | import cProfile
import os
from colorsys import hsv_to_rgb
from pstats import Stats
from django.conf import settings
from django.utils.html import format_html
from django.utils.translation import gettext_lazy as _
from debug_toolbar import settings as dt_settings
from debug_toolbar.panels import Panel
class Function... | bsd-3-clause | cd74605fc20a788e5bb17f4d15566f81 | 29.702703 | 86 | 0.514085 | 3.850847 | false | false | false | false |
civisanalytics/civis-python | civis/tests/test_polling.py | 1 | 3964 | """Test the `civis.polling` module"""
import time
from concurrent import futures
import unittest
from unittest import mock
from civis.response import Response
from civis.polling import PollableResult, _ResultPollingThread
import pytest
class State:
def __init__(self, state):
self.state = state
def cre... | bsd-3-clause | 524abe0efb9fdfa54af530c76c4d3012 | 36.046729 | 79 | 0.58552 | 4.280778 | false | true | false | false |
civisanalytics/civis-python | civis/parallel.py | 1 | 42308 | """Parallel computations using the Civis Platform infrastructure
"""
from concurrent.futures import wait
from datetime import datetime, timedelta
from io import BytesIO
import logging
import os
import pickle # nosec
from tempfile import TemporaryDirectory
import time
import warnings
import cloudpickle
from joblib._... | bsd-3-clause | ad386c2c010837753029f472c3a4d3b9 | 42.706612 | 79 | 0.598587 | 4.531705 | false | false | false | false |
jazzband/django-debug-toolbar | debug_toolbar/panels/request.py | 2 | 2220 | from django.http import Http404
from django.urls import resolve
from django.utils.translation import gettext_lazy as _
from debug_toolbar.panels import Panel
from debug_toolbar.utils import get_name_from_obj, get_sorted_request_variable
class RequestPanel(Panel):
"""
A panel to display request variables (POS... | bsd-3-clause | faf98efd781e736361998846b43257ef | 30.714286 | 87 | 0.528829 | 4.165103 | false | false | false | false |
jazzband/django-debug-toolbar | debug_toolbar/panels/staticfiles.py | 3 | 6395 | from os.path import join, normpath
from django.conf import settings
from django.contrib.staticfiles import finders, storage
from django.core.checks import Warning
from django.core.files.storage import get_storage_class
from django.utils.functional import LazyObject
from django.utils.translation import gettext_lazy as ... | bsd-3-clause | c8e9d11613dcee9f36df90067f146f30 | 30.658416 | 92 | 0.579672 | 4.571122 | false | false | false | false |
jazzband/django-debug-toolbar | tests/panels/test_request.py | 2 | 5493 | from django.http import QueryDict
from ..base import BaseTestCase
class RequestPanelTestCase(BaseTestCase):
panel_id = "RequestPanel"
def test_non_ascii_session(self):
self.request.session = {"où": "où"}
response = self.panel.process_request(self.request)
self.panel.generate_stats(se... | bsd-3-clause | 782304028c77807365377f11f0497f35 | 39.577778 | 87 | 0.625411 | 3.929699 | false | true | false | false |
civisanalytics/civis-python | setup.py | 1 | 2177 | from glob import glob
import os
import re
import setuptools
from setuptools import find_packages, setup
_THIS_DIR = os.path.dirname(os.path.realpath(__file__))
PYTHON_REQUIRES = ">=3.7"
CLASSIFIERS = [
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Pytho... | bsd-3-clause | dfda9f975f4f5a22e70b4f0b11f671c1 | 29.661972 | 74 | 0.595774 | 3.658824 | false | false | false | false |
civisanalytics/civis-python | civis/futures.py | 1 | 27166 | from abc import ABCMeta, abstractmethod
from concurrent.futures import Executor
from concurrent import futures
import copy
import datetime
import logging
import os
import time
import threading
import warnings
from civis import APIClient
from civis.base import (
CivisAPIError, CivisJobFailure, DONE, _err_msg_with_j... | bsd-3-clause | d7d0f9e26d6745c384d5305c652ddf24 | 38.428157 | 79 | 0.581352 | 4.462221 | false | false | false | false |
jazzband/django-debug-toolbar | debug_toolbar/middleware.py | 3 | 3918 | """
Debug Toolbar middleware
"""
import re
from functools import lru_cache
from django.conf import settings
from django.utils.module_loading import import_string
from debug_toolbar import settings as dt_settings
from debug_toolbar.toolbar import DebugToolbar
from debug_toolbar.utils import clear_stack_trace_caches
... | bsd-3-clause | a16058f234326002b8e642616041415e | 34.618182 | 87 | 0.637315 | 4.392377 | false | false | false | false |
jazzband/django-debug-toolbar | tests/test_forms.py | 3 | 1745 | from datetime import datetime, timezone
from django import forms
from django.test import TestCase
from debug_toolbar.forms import SignedDataForm
SIGNATURE = "-WiogJKyy4E8Om00CrFSy0T6XHObwBa6Zb46u-vmeYE"
DATA = {"date": datetime(2020, 1, 1, tzinfo=timezone.utc), "value": "foo"}
SIGNED_DATA = f'{{"date": "2020-01-01 ... | bsd-3-clause | 453212ef228acb3ad8fd933e1aa34054 | 33.9 | 84 | 0.641834 | 3.525253 | false | true | false | false |
civisanalytics/civis-python | docs/source/conf.py | 1 | 15852 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Civis Client documentation build configuration file, created by
# sphinx-quickstart on Tue Sep 15 11:15:53 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this... | bsd-3-clause | 73e2f53ca49a55d22894cf54d8194a4d | 33.535948 | 79 | 0.681113 | 3.60929 | false | true | false | false |
civisanalytics/civis-python | civis/base.py | 1 | 9720 | import os
from posixpath import join
import threading
from concurrent import futures
import warnings
from requests import Request
from civis.response import PaginatedResponse, convert_response_data_type
from civis._utils import open_session, retry_request, MAX_RETRIES
FINISHED = ['success', 'succeeded']
FAILED = ['fa... | bsd-3-clause | 1b6dcf1a7c1b3f2c2bee95609fdf0b6a | 34.090253 | 92 | 0.590535 | 4.180645 | false | false | false | false |
onepercentclub/onepercentclub-site | fabfile.py | 1 | 17394 | # Fabfile for deploying Project Bluebottle.
#
# This file is structured as follows:
#
# 1. Environment settings
# 2. Utility functions
# 3. Fabric tasks
from datetime import datetime
from git import Repo
from fabric.api import env, roles, sudo, prefix, cd, task, require, run, local, put, prompt, abort
from fab... | bsd-3-clause | 5ab4329c981edaa964d4daabe9f5044a | 26.919743 | 125 | 0.641601 | 3.725423 | false | true | false | false |
onepercentclub/onepercentclub-site | apps/payouts/migrations/0001_initial.py | 1 | 31224 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ProjectPayout'
db.create_table('payouts_payout', (
(u'id', self.gf('django.db.mo... | bsd-3-clause | b7146ef181b9613f9bced714ca12b7ab | 90.568915 | 197 | 0.572957 | 3.572131 | false | false | false | false |
onepercentclub/onepercentclub-site | apps/mail/__init__.py | 1 | 1066 | from django.contrib.sites.models import Site
from django.core.mail import EmailMultiAlternatives
from django.template import Context
from django.template.loader import get_template
from django.utils import translation
def send_mail(template_name, subject, to, **kwargs):
if hasattr(to, 'primary_language') and to.p... | bsd-3-clause | 6373ab519948d20ae96031d690767274 | 35.758621 | 99 | 0.72045 | 3.933579 | false | false | false | false |
onepercentclub/onepercentclub-site | apps/cowry/serializers.py | 2 | 2194 | from apps.cowry_docdata.models import DocDataPaymentOrder
from django.conf import settings
from django.utils.translation import ugettext as _
from rest_framework import serializers
from . import factory, payments
from .exceptions import PaymentException
from .models import Payment
class PaymentSerializer(serializers.... | bsd-3-clause | 9308a8d7e85bf76c41d999f15abde036 | 47.755556 | 120 | 0.690064 | 4.450304 | false | false | false | false |
blaze/odo | odo/backends/hdfstore.py | 9 | 3965 | from __future__ import absolute_import, division, print_function
import numpy as np
import pandas as pd
import datashape
from datashape import discover
from ..append import append
from ..convert import convert, ooc_types
from ..chunks import chunks
from ..resource import resource
from ..utils import filter_kwargs
@... | bsd-3-clause | 399e1ce5ff111c040822f995ccf0d55d | 31.235772 | 83 | 0.675662 | 3.584991 | false | false | false | false |
blaze/odo | odo/chunks.py | 4 | 1738 | from __future__ import absolute_import, division, print_function
from collections import Iterator
from toolz import memoize, first, peek
from datashape import discover, var
from .utils import cls_name, copydoc
from dask.threaded import get as dsk_get
class Chunks(object):
""" An Iterable of chunked data
It... | bsd-3-clause | 48c2f0ef493d5fac79e0b64ff75eef5d | 25.333333 | 79 | 0.574223 | 3.518219 | false | false | false | false |
blaze/odo | odo/directory.py | 4 | 1996 | from __future__ import absolute_import, division, print_function
from glob import glob
from .chunks import Chunks, chunks
from .resource import resource
from .utils import copydoc
from toolz import memoize, first
from datashape import discover, var
import os
class _Directory(Chunks):
""" A directory of files on ... | bsd-3-clause | 8fd042dc3882de4bd51401e8e569eb34 | 27.112676 | 78 | 0.640782 | 3.589928 | false | false | false | false |
blaze/odo | odo/backends/aws.py | 4 | 11802 | from __future__ import print_function, division, absolute_import
import os
import uuid
import zlib
import re
from fnmatch import fnmatch
from contextlib import contextmanager
from collections import Iterator
from operator import attrgetter
from io import BytesIO
import pandas as pd
from toolz import memoize, first, c... | bsd-3-clause | 896df98a5133948ea42e590b7728d987 | 34.763636 | 98 | 0.60888 | 3.332957 | false | false | false | false |
blaze/odo | odo/into.py | 5 | 4965 | from __future__ import absolute_import, division, print_function
import functools
from toolz import merge
from multipledispatch import Dispatcher
from .convert import convert
from .append import append
from .resource import resource
from .utils import ignoring
import datashape
from datashape import discover
from d... | bsd-3-clause | 32f7e798efad9962396c959b10d75b4d | 30.624204 | 92 | 0.661631 | 3.816295 | false | false | false | false |
jamesoff/simplemonitor | simplemonitor/Alerters/pushover.py | 1 | 1888 | """
SimpleMonitor alerts via pushover
"""
from typing import cast
import requests
from ..Monitors.monitor import Monitor
from .alerter import Alerter, AlertLength, AlertType, register
@register
class PushoverAlerter(Alerter):
"""Send push notification via Pushover."""
alerter_type = "pushover"
def __... | bsd-3-clause | b9d6784b2b52438828dfd35e11cdf9f3 | 29.95082 | 87 | 0.598517 | 3.983122 | false | true | false | false |
jamesoff/simplemonitor | tests/test_host.py | 1 | 3303 | # type: ignore
import unittest
from simplemonitor.Monitors import host
class TestHostMonitors(unittest.TestCase):
safe_config = {"partition": "/", "limit": "10G"}
one_KB = 1024
one_MB = one_KB * 1024
one_GB = one_MB * 1024
one_TB = one_GB * 1024
def test_DiskSpace_brokenConfigOne(self):
... | bsd-3-clause | 9ed0b6f592b0ea1fc7a74b67211d8003 | 34.516129 | 88 | 0.597336 | 3.753409 | false | true | false | false |
sfepy/sfepy | sfepy/scripts/plot_times.py | 5 | 1722 | #!/usr/bin/env python
"""
Plot time steps, times of time steps and time deltas in a HDF5 results file.
"""
from __future__ import absolute_import
import sys
sys.path.append('.')
from argparse import ArgumentParser
import numpy as nm
import matplotlib.pyplot as plt
from sfepy.postprocess.time_history import extract_ti... | bsd-3-clause | 863f7a6a06ec31e65ffa396a3d3750ea | 25.90625 | 76 | 0.613821 | 3.249057 | false | false | false | false |
sfepy/sfepy | sfepy/terms/terms_shells.py | 5 | 7748 | # -*- coding: utf-8 -*-
"""
Terms implementing shell elements.
"""
import numpy as nm
from sfepy.terms.terms import Term
from sfepy.linalg import dot_sequences as ddot
import sfepy.mechanics.shell10x as shell10x
class Shell10XTerm(Term):
r"""
The shell10x element term based on the Reissner-Mindlin theory [1]_... | bsd-3-clause | 0541e48603d1e82aaa69632d4c9cf8a1 | 37.133005 | 80 | 0.582612 | 2.985345 | false | false | false | false |
sfepy/sfepy | tools/gen_gallery.py | 4 | 19709 | #!/usr/bin/env python
"""
Generate the images and rst files for gallery of SfePy examples.
The following steps need to be made to regenerate the documentation with the
updated example files:
1. remove doc/examples/*::
$ rm -rf doc/examples/*
2. generate the files:
$ ./tools/gen_gallery.py
3. regenerate the ... | bsd-3-clause | 7254b7baaa2b629bf7c5be3ed2b184a7 | 28.816944 | 80 | 0.50926 | 3.513817 | false | false | false | false |
sfepy/sfepy | sfepy/examples/diffusion/time_poisson.py | 4 | 2520 | r"""
Transient Laplace equation with non-constant initial conditions given by a
function.
Find :math:`T(t)` for :math:`t \in [0, t_{\rm final}]` such that:
.. math::
\int_{\Omega} s \pdiff{T}{t}
+ \int_{\Omega} c \nabla s \cdot \nabla T
= 0
\;, \quad \forall s \;.
"""
from __future__ import absolute_i... | bsd-3-clause | 1cf91bad470c8604bd8fbdd940681cf1 | 18.6875 | 74 | 0.473016 | 2.413793 | false | false | false | false |
sfepy/sfepy | sfepy/solvers/oseen.py | 4 | 13300 | from __future__ import absolute_import
import numpy as nm
import numpy.linalg as nla
from sfepy.base.base import output, get_default, Struct
from sfepy.base.log import Log, get_logging_conf
from sfepy.base.timing import Timer
from sfepy.solvers.solvers import NonlinearSolver
from .nls import conv_test
import six
cla... | bsd-3-clause | cb8fe2a27db93165c4a43b814f5f1f5f | 34.466667 | 81 | 0.487444 | 3.580081 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.