code stringlengths 1 199k |
|---|
import matplotlib
matplotlib.use('Agg')
import numpy as np # noqa
import pandas as pd # noqa
import pandas_ml as pdml # noqa
import pandas_ml.util.testing as tm # noqa
import sklearn.datasets as datasets # noqa
import xgboost ... |
import itertools
import numpy as np
import pytest
from coremltools.converters.mil.mil import Builder as mb
from coremltools.converters.mil.testing_utils import (
assert_model_is_valid,
get_op_types_in_program,
apply_pass_and_basic_check,
)
@pytest.mark.parametrize("op_type, pos, val", itertools.product(['ad... |
import logging
import os
PROD_DETAILS_URL = 'http://svn.mozilla.org/libs/product-details/json/'
PROD_DETAILS_DIR = os.path.join(os.path.dirname(__file__), 'json')
LOG_LEVEL = logging.INFO |
"""
Luminous Efficiency Functions Spectral Distributions
====================================================
Defines the luminous efficiency functions computation related objects.
References
----------
- :cite:`Wikipedia2005d` : Wikipedia. (2005). Mesopic weighting function.
Retrieved June 20, 2014, from
htt... |
import qt
class CollapsibleMultilineText(qt.QTextEdit):
"""Text field that expands when it gets the focus and remain collapsed otherwise"""
def __init__(self):
super(CollapsibleMultilineText, self).__init__()
self.minHeight = 20
self.maxHeight = 50
self.setFixedHeight(self.minHei... |
import hashlib
import tempfile
import unittest
import shutil
import os
import sys
from testfixtures import LogCapture
from scrapy.dupefilters import RFPDupeFilter
from scrapy.http import Request
from scrapy.core.scheduler import Scheduler
from scrapy.utils.python import to_bytes
from scrapy.utils.job import job_dir
fro... |
"""Provides vertical object."""
from __future__ import absolute_import
from ..entity import Entity
class Vertical(Entity):
"""docstring for Vertical."""
collection = 'verticals'
resource = 'vertical'
_relations = {
'advertiser',
}
_pull = {
'id': int,
'name': None,
... |
import pytest
import bauble.db as db
from bauble.model.family import Family
from bauble.model.genus import Genus, GenusSynonym, GenusNote
import test.api as api
@pytest.fixture
def setup(organization, session):
setup.organization = session.merge(organization)
setup.user = setup.organization.owners[0]
setup.... |
from rdkit import Chem
from rdkit import rdBase
from rdkit.Chem import rdMolDescriptors as rdMD
from rdkit.Chem import AllChem
from rdkit.Chem.EState import EStateIndices
from rdkit.Chem.EState import AtomTypes
import time
print rdBase.rdkitVersion
print rdBase.boostVersion
def getEState(mol):
return EStateIndices(... |
"""
WSGI config for invoices project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` ... |
"""
Sampling along tracks
---------------------
The :func:`pygmt.grdtrack` function samples a raster grid's value along specified
points. We will need to input a 2D raster to ``grid`` which can be an
:class:`xarray.DataArray`. The argument passed to the ``points`` parameter can be a
:class:`pandas.DataFrame` table wher... |
"""
A sub-package for efficiently dealing with polynomials.
Within the documentation for this sub-package, a "finite power series,"
i.e., a polynomial (also referred to simply as a "series") is represented
by a 1-D numpy array of the polynomial's coefficients, ordered from lowest
order term to highest. For example, ar... |
from django.core.management.base import BaseCommand
from dojo.models import System_Settings
class Command(BaseCommand):
help = 'Updates product grade calculation'
def handle(self, *args, **options):
code = """def grade_product(crit, high, med, low):
health=100
if crit > 0:
... |
"""
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
Full-factorial sampling.
"""
import numpy as np
from smt.sampling_methods.sampling_method import SamplingMethod
class FullFactorial(SamplingMethod):
def _initialize(self):
self.options.declare(
"... |
"""
Dealing with SFT tests.
"""
import logging
import sft_meta
import sft_schema as schema
from sft.utils.helpers import strip_args
class SFTPool():
""" This class defines all site functional tests (SFT)s
that shall be executed.
"""
def __init__(self):
self.log = logging.getLogger(__name__)
... |
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from ..forms import AnonymousUserShippingForm, ShippingAddressesForm
from ...userprofile.forms import get_address_form
from ...userprofile.models import Address
from ...teamstore.utils import get_team
def anonymous_user_shipping... |
from httpx import AsyncClient
import os
_TOP_DIR = os.path.abspath(
os.path.sep.join((
os.path.dirname(__file__),
'../',
)),
)
_SAMPLES_DIR = os.path.abspath(
os.path.sep.join((
os.path.dirname(__file__),
'../samples/',
)),
)
import sys
sys.path.append(_TOP_DIR)
sys.path.... |
import collections
NoDefault = collections.namedtuple('NoDefault', [])()
class ValueNotFoundException(Exception):
"""Raised when a value cannot be found. Used for control-flow only."""
class Handler:
def __init__(self, name, prefix='', default=NoDefault, description=None):
# e.g. my_option_name
... |
"""
=======================================
Receiver Operating Characteristic (ROC)
=======================================
Example of Receiver Operating Characteristic (ROC) metric to evaluate
classifier output quality.
ROC curves typically feature true positive rate on the Y axis, and false
positive rate on the X axi... |
import os
import unittest
from telemetry import story
from telemetry import page as page_module
from telemetry import value
from telemetry.value import improvement_direction
from telemetry.value import none_values
from telemetry.value import scalar
class TestBase(unittest.TestCase):
def setUp(self):
story_set = s... |
"""Creates training data for the BERT network training
(noisified + masked gold predictions) using the input corpus.
The masked Gold predictions use Neural Monkey's PAD_TOKEN to indicate
tokens that should not be classified during training.
We only leave `coverage` percent of symbols for classification. These
symbols a... |
from .. utils import TranspileTestCase, UnaryOperationTestCase, BinaryOperationTestCase, InplaceOperationTestCase
class StrTests(TranspileTestCase):
def test_setattr(self):
self.assertCodeExecution("""
x = "Hello, world"
x.attr = 42
print('Done.')
""")
def... |
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import pgettext_lazy
from .base import Product
from .variants import (ProductVariant, PhysicalProduct, ColoredVariant,
StockedProduct)
c... |
from .fetchers import NUPermissionsFetcher
from .fetchers import NUMetadatasFetcher
from .fetchers import NUGlobalMetadatasFetcher
from bambou import NURESTObject
class NUVNFThresholdPolicy(NURESTObject):
""" Represents a VNFThresholdPolicy in the VSD
Notes:
VNF Threshold Policy represents thres... |
from __future__ import division, print_function, absolute_import
import numpy as np
import amitgroup as ag
import itertools as itr
import sys
import os
import pnet
import time
def test(ims, labels, net):
yhat = net.classify(ims)
return yhat == labels
if pnet.parallel.main(__name__):
print("1")
import ar... |
from pyface.qt.QtScript import * |
"""Helper module to ``reduce'' tree using frames
- see Ostap.DataFrame
- see ROOT.ROOT.RDataFrame
"""
__version__ = "$Revision$"
__author__ = "Vanya BELYAEV Ivan.Belyaev@itep.ru"
__date__ = "2011-06-07"
__all__ = (
'ReduceTree' ,
'reduce' ,
)
import ROOT, os
from ostap.logger.logger import getLo... |
"""
Tests for values coercion in setitem-like operations on DataFrame.
For the most part, these should be multi-column DataFrames, otherwise
we would share the tests with Series.
"""
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
MultiIndex,
NaT,
Series,
Timesta... |
import numpy as np
import matplotlib.pyplot as plt
import statsmodels.api as sm
from selection.algorithms.lasso import instance
from selection.algorithms.forward_step import forward_stepwise, info_crit_stop, sequential, data_carving_IC
def test_FS(k=10):
n, p = 100, 200
X = np.random.standard_normal((n,p)) + 0.... |
from __future__ import absolute_import
from codetools.blocks.analysis import * |
from django.conf.urls.defaults import patterns, url
from snippets.base import views
urlpatterns = patterns('',
url(r'^$', views.index, name='base.index'),
url(r'^(?P<startpage_version>[^/]+)/(?P<name>[^/]+)/(?P<version>[^/]+)/'
'(?P<appbuildid>[^/]+)/(?P<build_target>[^/]+)/(?P<locale>[^/]+)/'
'... |
import os
import numpy as np
import tables
import galry.pyplot as plt
from galry import Visual, process_coordinates, get_next_color, get_color
from qtools import inthread
MAXSIZE = 5000
CHANNEL_HEIGHT = .25
class MultiChannelVisual(Visual):
def initialize(self, x=None, y=None, color=None, point_size=1.0,
... |
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 'Fare'
db.create_table('gtfs_fare', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True))... |
from importlib.util import find_spec
import os
import pkg_resources
import tempfile
try:
from pytest_astropy_header.display import PYTEST_HEADER_MODULES
except ImportError:
PYTEST_HEADER_MODULES = {}
import astropy
if find_spec('asdf') is not None:
from asdf import __version__ as asdf_version
if asdf_ve... |
a = 2 # defines `a`
b = 2
print a + b
v = 42 # `v` is an integer
print v
v = 0.42 # now it's a float
print v
v = 2**76 # NEW: Loooong integers are supported!
print v
v = 4 + 0.2j # NEW: complex numbers!
print v
v = "almost but not quite entirely unlike tea" # now it's a string
print v
print "%d %.1f %s" % (42, 4.... |
"""
fabcloudkit
Functions for managing Nginx.
This module provides functions that check for installation, install, and manage an
installation of, Nginx.
/etc/init.d/nginx:
The "init-script" that allows Nginx to be run automatically at system startup.
The existence of this file is ver... |
import emission.analysis.modelling.tour_model.data_preprocessing as preprocess
def valid_user(filter_trips,trips):
valid = False
if len(filter_trips) >= 10 and len(filter_trips) / len(trips) >= 0.5:
valid = True
return valid
def get_user_ls(all_users,radius):
user_ls = []
valid_user_ls = []
... |
from django.shortcuts import render_to_response, get_object_or_404
from django.http import Http404
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.views.generic.dates import YearArchiveView, MonthArchiveView,\
DateDetailView
from .models import Article, ... |
"""
Module to create topo and qinit data files for this example.
"""
from clawpack.geoclaw import topotools
from pylab import *
def maketopo_hilo():
x = loadtxt('x.txt')
y = loadtxt('y.txt')
z = loadtxt('z.txt')
# modify x and y so that cell size is truly uniform:
dx = 1. / (3.*3600.) # 1/3"
x... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 7, transform = "Difference", sigma = 0.0, exog_count = 20, ar_order = 12); |
import random
import time
import sys
import Csound
import subprocess
import base64
import hashlib
import matrixmusic
csd = None
oscillator = None
buzzer = None
voice = None
truevoice = None
song_publisher = None
def add_motif(instrument, req):
global csd
time = req.motif_start_time
for note in req.score:
... |
import logging
from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
from pylons.templating import render_mako_def
from kai.lib.base import BaseController, render
from kai.lib.helpers import textilize
from kai.lib.serialization import render_feed
from ... |
class Gadgets(object):
"""
A Gadgets object providing managing of various gadgets for display on analytics dashboard.
Gadgets are registered with the Gadgets using the register() method.
"""
def __init__(self):
self._registry = {} # gadget hash -> gadget object.
def get_gadget(self, id):... |
import serial.tools.list_ports
from SerialCrypt import Devices
def locateDevice(devid):
'''
Returns the serial port path of the arduino if found, or None if it isn't connected
'''
retval = None
for port in serial.tools.list_ports.comports():
if port[2][:len(devid)] == devid:
retval = port[0]
break
return ... |
"""
Display number of scratchpad windows and urgency hints.
Configuration parameters:
cache_timeout: refresh interval for i3-msg or swaymsg (default 5)
format: display format for this module
(default "\u232b [\?color=scratchpad {scratchpad}]")
thresholds: specify color thresholds to use
(def... |
import stix
from stix.data_marking import MarkingStructure
import stix.bindings.extensions.marking.tlp as tlp_binding
@stix.register_extension
class TLPMarkingStructure(MarkingStructure):
_binding = tlp_binding
_binding_class = tlp_binding.TLPMarkingStructureType
_namespace = 'http://data-marking.mitre.org/... |
import argparse
import json
import logging
import os
import pipes
import posixpath
import random
import re
import shlex
import sys
import devil_chromium
from devil import devil_env
from devil.android import apk_helper
from devil.android import device_errors
from devil.android import device_utils
from devil.android impo... |
import numpy as np
from numpy.testing import (assert_equal, assert_array_almost_equal,
assert_raises)
from skimage.transform._geometric import _stackcopy
from skimage.transform._geometric import GeometricTransform
from skimage.transform import (estimate_transform, matrix_transform,
... |
from django.http import HttpResponse, Http404
from django.core.exceptions import ObjectDoesNotExist
from django.shortcuts import render, get_object_or_404
from django.core.urlresolvers import reverse
from django.utils.xmlutils import SimplerXMLGenerator
from models import Place, Region
from models import Locality
from ... |
from __future__ import division
from PyQt5 import QtCore, QtWidgets
from pycho.gui.widgets import GLPlotWidget
from pycho.world.navigation import DIRECTIONS
from pycho.gui.interaction import QT_KEYS, is_left, is_right, is_up, is_down
from pycho.world.helpers import box_around
import logging
xrange = range
TURN_BASED = ... |
"""This module contains an interface for using the GPy library in ELFI."""
import copy
import logging
import GPy
import numpy as np
logger = logging.getLogger(__name__)
logging.getLogger("GP").setLevel(logging.WARNING) # GPy library logger
class GPyRegression:
"""Gaussian Process regression using the GPy library.
... |
import os
WAGTAIL_ROOT = os.path.dirname(__file__)
STATIC_ROOT = os.path.join(WAGTAIL_ROOT, 'test-static')
MEDIA_ROOT = os.path.join(WAGTAIL_ROOT, 'test-media')
MEDIA_URL = '/media/'
DATABASES = {
'default': {
'ENGINE': os.environ.get('DATABASE_ENGINE', 'django.db.backends.sqlite3'),
'NAME': os.envi... |
from datetime import (
datetime,
time,
)
import numpy as np
import pytest
from pandas._libs.tslibs import timezones
import pandas.util._test_decorators as td
from pandas import (
DataFrame,
Series,
date_range,
)
import pandas._testing as tm
class TestBetweenTime:
@td.skip_if_has_locale
def t... |
from django.conf.urls import include, url
from django.views.generic import TemplateView
urlpatterns = [
url(r"^home/", TemplateView.as_view(template_name="no-ie.html"), name="home"),
url(r"^", include("formly.urls", namespace="formly")),
] |
import subprocess
import sys
import setup_util
import os
def start(args, logfile, errfile):
try:
subprocess.check_call("mvn clean compile assembly:single", shell=True, cwd="netty", stderr=errfile, stdout=logfile)
subprocess.Popen("java -jar netty-example-0.1-jar-with-dependencies.jar".rsplit(" "), cwd="netty/... |
"""Signing Model Objects
This module contains classes that encapsulate data about the signing process.
"""
import os.path
class CodeSignedProduct(object):
"""Represents a build product that will be signed with `codesign(1)`."""
def __init__(self,
path,
identifier,
... |
import hashlib
import os
import re
import time
import uuid
import subprocess
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.contrib.staticfiles.finders import find as find_static_path
from olympia.lib.jingo_minify_helpers import ensure_path_exists
def run_... |
from __future__ import unicode_literals
from django.conf.urls import patterns, include, url
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from mezzanine.core.views import direct_to_template
from mezzanine.conf import settings
from hs_core.api import v1_api
from theme import views as t... |
import webapp2
import hinet
import seednet
import StringIO
import PyRSS2Gen
import urllib
import datetime
import hashlib
from google.appengine.api import memcache
HTTP_DATE_FMT = '%a, %d %b %Y %H:%M:%S %Z'
def check_date_fmt(date):
date = date.strip().split(' ')
if len(date) == 5:
HTTP_DATE_FMT = '%a, %... |
import socket
from pyasn1.error import PyAsn1Error
import requests
from .heartbleed import test_heartbleed
from .models import Check
try:
from OpenSSL.SSL import Error as SSLError
except ImportError:
# In development, we might not have OpenSSL - it's only needed for SNI
class SSLError(Exception):
pa... |
import csv
import json
from cStringIO import StringIO
from datetime import datetime
from django.conf import settings
from django.core import mail, management
from django.core.cache import cache
import mock
from nose.plugins.attrib import attr
from nose.tools import eq_
from piston.models import Consumer
from pyquery im... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('django_project', '0013_auto_20160710_1124'),
]
operations = [
migrations.AlterField(
model_name='annotation'... |
from django.http import HttpResponse
from django.template import Template
def admin_required_view(request):
if request.user.is_staff:
return HttpResponse(Template('You are an admin').render({}))
return HttpResponse(Template('Access denied').render({})) |
from django.db import models
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
from press_links.enums import STATUS_CHOICES, LIVE_STATUS, DRAFT_STATUS
from django.utils import timezone
from parler.models import TranslatableMo... |
import json
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import Client
from huxley.accounts.models import User
from huxley.api.tests import (CreateAPITestCase, DestroyAPITestCase,
ListAPITestCase, PartialUpdateAPITestCase,
... |
from django.db import models
class Entry(models.Model):
title = models.CharField(max_length=200)
date = models.DateTimeField()
class Meta:
ordering = ('date',)
def __unicode__(self):
return self.title
def get_absolute_url(self):
return "/blog/%s/" % self.pk
class Article(mode... |
from holoviews.element import (
ElementConversion, Points as HvPoints, Polygons as HvPolygons,
Path as HvPath
)
from .geo import (_Element, Feature, Tiles, is_geographic, # noqa (API import)
WMTS, Points, Image, Text, LineContours, RGB,
FilledContours, Path, Polygons, Sha... |
'''
Copyright (C) 2020, WAFW00F Developers.
See the LICENSE file for copying permission.
'''
NAME = 'Edgecast (Verizon Digital Media)'
def is_waf(self):
schemes = [
self.matchHeader(('Server', r'^ECD(.+)?')),
self.matchHeader(('Server', r'^ECS(.*)?'))
]
if any(i for i in schemes):
re... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('topics', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='articletopicrank',
options={'ordering': ('rank',)},
... |
from operator import attrgetter
from plyj.model.source_element import Expression
from plyj.utility import assert_type
class Name(Expression):
simple = property(attrgetter("_simple"))
value = property(attrgetter("_value"))
def __init__(self, value):
"""
Represents a name.
:param value... |
from .variables import *
def Cell(node):
# cells must stand on own line
if node.parent.cls not in ("Assign", "Assigns"):
node.auxiliary("cell")
return "{", ",", "}"
def Assign(node):
if node.name == 'varargin':
out = "%(0)s = va_arg(varargin, " + node[0].type + ") ;"
else:
ou... |
"""Fichier contenant le paramètre 'border' de la commande 'voile'."""
from primaires.interpreteur.masque.parametre import Parametre
class PrmBorder(Parametre):
"""Commande 'voile border'.
"""
def __init__(self):
"""Constructeur du paramètre"""
Parametre.__init__(self, "border", "haul")
... |
from corehq.apps.reports.models import HQToggle
from corehq.apps.reports.fields import ReportField
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_noop
class SubmitToggle(HQToggle):
def __init__(self, type, show, name, doc_type):
super(SubmitToggle, self).__... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0004_auto_20150428_2142'),
]
operations = [
migrations.AddField(
model_name='parentrelation',
name='signature',
... |
from __future__ import print_function
import doctest
import os
import random
import sqlite3
import tempfile
import unittest
import warnings
import time
from datetime import datetime
import bridgedb.Bridges
import bridgedb.Main
import bridgedb.Dist
import bridgedb.Time
import bridgedb.Storage
import re
import ipaddr
fro... |
from __future__ import absolute_import, unicode_literals
from six import add_metaclass, text_type
from .event_encoder import Parameter, EventEncoder
@add_metaclass(EventEncoder)
class Event(object):
hit = Parameter('t', text_type, required=True)
category = Parameter('ec', text_type, required=True)
action = ... |
"""
=======================
Generate Surface Labels
=======================
Define a label that is centered on a specific vertex in the surface mesh. Plot
that label and the focus that defines its center.
"""
print __doc__
from surfer import Brain, utils
subject_id = "fsaverage"
"""
Bring up the visualization.
"""
brai... |
import logging
from telemetry.page.actions import all_page_actions
from telemetry.page.actions import page_action
def _GetActionFromData(action_data):
action_name = action_data['action']
action = all_page_actions.FindClassWithName(action_name)
if not action:
logging.critical('Could not find an action named %s... |
from django.conf.urls import url, patterns
from data import views
urlpatterns = patterns("data.views",
url(r"^$", views.IndexView.as_view()),
url(r"^a/(?P<application_external_id>[^/]{,255})\.json$", views.ApplicationInstanceListView.as_view()),
url(r"^(?P<model_external_id>[^/]{,255})\.json$", views.Instan... |
from setuptools import setup, find_packages
setup(
name='django-facebook-comments',
version=__import__('facebook_comments').__version__,
description='Django implementation for Facebook Graph API Comments',
long_description=open('README.md').read(),
author='ramusus',
author_email='ramusus@gmail.c... |
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('datasets', parent_package, top_path)
config.add_subpackage('volumes')
config.add_subpackage('transforms')
return config
if __name__ == '__main__':
from numpy.distutils.... |
"""
:Requirements: django-tagging
This module contains some additional helper tags for the django-tagging
project. Note that the functionality here might already be present in
django-tagging but perhaps with some slightly different behaviour or
usage.
"""
from django import template
from django.core.urlresolvers import... |
import rospy
import thread
import threading
import time
import mavros
import actionlib
from math import *
from mavros.utils import *
from mavros import setpoint as SP
from tf.transformations import quaternion_from_euler
from kuri_msgs.msg import *
class dropzone_landing:
def __init__(self):
self.done = Fals... |
from setuptools import setup
setup(
name='pymail365',
version='0.1',
description='A python client for sending mail using Microsoft Office 365 rest service.',
long_description=open('README.rst').read(),
author='Mikko Hellsing',
author_email='mikko@aino.se',
license='BSD',
url='https://git... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 5, transform = "Quantization", sigma = 0.0, exog_count = 100, ar_order = 12); |
from tastypie.resources import ModelResource
from tastypie.fields import ToOneField, ToManyField
from tastypie.constants import ALL, ALL_WITH_RELATIONS
from ietf import api
from ietf.message.models import * # pyflakes:ignore
from ietf.person.resources import PersonResource
from ietf.group.resources import GroupRe... |
"""\
Tests if the PNG serializer does not add more colors than needed.
See also issue <https://github.com/heuer/segno/issues/62>
"""
from __future__ import unicode_literals, absolute_import
import io
import pytest
import segno
def test_plte():
qr = segno.make_qr('test')
assert qr.version < 7
dark = 'red'
... |
from __future__ import unicode_literals
from cms.models import Page
from cms.utils.i18n import get_language_list
from django.db import migrations, models
def forwards(apps, schema_editor):
BlogConfig = apps.get_model('djangocms_blog', 'BlogConfig')
BlogConfigTranslation = apps.get_model('djangocms_blog', 'BlogC... |
"""private_base will be populated from puppet and placed in this directory"""
import logging
import os
import dj_database_url
from lib.settings_base import CACHE_PREFIX, ES_INDEXES, KNOWN_PROXIES, LOGGING
from .. import splitstrip
import private_base as private
ENGAGE_ROBOTS = False
EMAIL_BACKEND = 'django.core.mail.ba... |
'''
Created on 9 jan. 2013
@author: sander
'''
from bitstring import BitStream, ConstBitStream, Bits
from ipaddress import IPv4Address, IPv6Address
from pylisp.packet.ip import protocol_registry
from pylisp.packet.ip.protocol import Protocol
from pylisp.utils import checksum
import numbers
class UDPMessage(Protocol):
... |
import tensorflow as tf
import numpy as np
import sys, struct
import convert_header as header
__all__ = ['convert_from_tensorflow']
class Operand(object):
IOTYPE_INPUT = 1
IOTYPE_OUTPUT = 2
IOTYPE_INTERMEDIATE = IOTYPE_INPUT | IOTYPE_OUTPUT
DTYPE_FLOAT = 1
DTYPE_UINT8 = 4
index = 0
def __ini... |
import os
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import Client
from .....checkout.tests import BaseCheckoutAppTests
from .....delivery.tests import TestDeliveryProvider
from .....order import handler as order_handler
from .....payment import ConfirmationFormNeeded... |
import datetime
import logging
import os
import numpy as np
from matplotlib.path import Path
from matplotlib.widgets import Cursor, EllipseSelector, LassoSelector, RectangleSelector
from sastool.io.credo_cct import Exposure
from scipy.io import loadmat, savemat
from ..core.exposureloader import ExposureLoader
from ..co... |
import numpy as np
from numpy.testing import (assert_equal,
assert_almost_equal,
assert_raises)
import skimage
from skimage import data
from skimage._shared._warnings import expected_warnings
from skimage.filters.thresholding import (threshold_adaptive,
... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "content_edit_proj.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) |
from __future__ import division, unicode_literals, print_function
from django.core.management import BaseCommand
from applications.posts.models import Post
class Command(BaseCommand):
def handle(self, *args, **options):
posts = Post.objects.all()
delete_ids = []
for post in posts:
... |
from flask.ext.sqlalchemy import SQLAlchemy
db = SQLAlchemy()
from saef_app.core import models |
from django.db import models
from .managers import CRUDManager, CRUDException
class CRUDFilterModel(models.Model):
class Meta:
abstract = True
@classmethod
def verify_user_has_role(cls, user, role, request):
"""
Call user-defined auth function to determine if this user can use this r... |
"""frosted/checker.py.
The core functionality of frosted lives here. Implements the core checking capability models Bindings and Scopes
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restr... |
import os
import re
import sys
import glob
import argparse
from copy import copy
from decimal import Decimal,InvalidOperation
number_pattern = re.compile("(-?\d+\.?\d*(e[\+|\-]?\d+)?)", re.IGNORECASE)
def findNumber(value):
try:
return Decimal(value)
except InvalidOperation:
try:
ret... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.