code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | dims/heat | heat/engine/resources/openstack/neutron/qos.py | Python | apache-2.0 | 6,587 |
#!/usr/bin/python3.7
import ssl
import remi.gui as gui
from remi import start, App
class Camera(App):
def __init__(self, *args, **kwargs):
super(Camera, self).__init__(*args)
def video_widgets(self):
width = '300'
height = '300'
self.video = gui.Widget(_type='video')
s... | dddomodossola/remi | examples/examples_from_contributors/camera.py | Python | apache-2.0 | 2,815 |
# Ivysalt's sentry module. It keeps track of people who join and leave a chat.
# LICENSE: This single module is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
# @category Tools
# @copyright Copyright (c) 2018 dpc
# @version 1.1
# @author dpc
import asyncio
i... | retrodpc/Bulbaspot-Cogs | sentry/sentry.py | Python | apache-2.0 | 11,849 |
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException... | gena701/Seleniun_php4dvd_lesson2_Rovinsky | php4dvd/php4dvd_negative.py | Python | apache-2.0 | 2,371 |
# -*- test-case-name: txdav.who.test.test_augment -*-
##
# Copyright (c) 2013-2017 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/li... | macosforge/ccs-calendarserver | txdav/who/augment.py | Python | apache-2.0 | 18,083 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from common import find_target_items
if len(sys.argv) != 3:
print("Find the value keyword in all pairs")
print(("Usage: ", sys.argv[0], "[input] [keyword]"))
exit(1)
find_target_items(sys.argv[1], sys.argv[2])
| BYVoid/OpenCC | data/scripts/find_target.py | Python | apache-2.0 | 282 |
#!/usr/bin/env python
def makeYqlQuery(req):
result = req.get("result")
parameters = result.get("parameters")
city = parameters.get("geo-city")
if city is None:
return None
return "select * from weather.forecast where woeid in (select woeid from geo.places(1) where text='" + city + ... | jacoboariza/BotIntendHub | yahooWeatherForecast.py | Python | apache-2.0 | 335 |
from __future__ import unicode_literals
import datetime
import django
from django.utils.timezone import now
from django.test import TransactionTestCase
from mock import call, patch
from job.seed.metadata import SeedMetadata
from source.configuration.source_data_file import SourceDataFileParseSaver
from storage.model... | ngageoint/scale | scale/source/test/configuration/test_source_data_file.py | Python | apache-2.0 | 4,106 |
# Copyright 2018 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | masayukig/tempest | tempest/api/image/v2/admin/test_images.py | Python | apache-2.0 | 2,341 |
import tensorflow as tf
from tensorflow.contrib import layers
from tensorflow.contrib.framework import arg_scope
from tensormate.graph import TfGgraphBuilder
class ImageGraphBuilder(TfGgraphBuilder):
def __init__(self, scope=None, device=None, plain=False, data_format="NHWC",
data_format_ops=(l... | songgc/tensormate | tensormate/graph/image_graph.py | Python | apache-2.0 | 1,742 |
__author__ = 'sianwahl'
from string import Template
class NedGenerator:
def __init__(self, number_of_channels):
self.number_of_channels = number_of_channels
def generate(self):
return self._generate_tuplefeeder_ned(), self._generate_m2etis_ned()
def _generate_tuplefeeder_ned(self):
... | ClockworkOrigins/m2etis | configurator/configurator/NedGenerator.py | Python | apache-2.0 | 6,119 |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | google/upvote_py2 | upvote/gae/utils/user_utils.py | Python | apache-2.0 | 901 |
"""Class to hold all camera accessories."""
import asyncio
from datetime import timedelta
import logging
from haffmpeg.core import HAFFmpeg
from pyhap.camera import (
VIDEO_CODEC_PARAM_LEVEL_TYPES,
VIDEO_CODEC_PARAM_PROFILE_ID_TYPES,
Camera as PyhapCamera,
)
from pyhap.const import CATEGORY_CAMERA
from ho... | titilambert/home-assistant | homeassistant/components/homekit/type_cameras.py | Python | apache-2.0 | 15,437 |
# !/usr/bin/env python
# -*-coding:utf-8-*-
# by huangjiangbo
# 部署服务
# deploy.py
from ConfigParser import ConfigParser
ConfigFile = r'config.ini' # 读取配置文件
config = ConfigParser()
config.read(ConfigFile)
de_infos = config.items(r'deploy_server') # 远程部署服务器信息
redeploy_server_info = {}
appinfo = {}
print de_infos
for (... | cherry-hyx/hjb-test | 脚本/deploy/t.py | Python | artistic-2.0 | 449 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
__author__="Scott Hendrickson"
__license__="Simplified BSD"
import sys
import datetime
import fileinput
from io import StringIO
# Experimental: Use numba to speed up some fo the basic function
# that are run many times per record
# from numba import jit
# use fastest optio... | DrSkippy/Gnacs | acscsv/acscsv.py | Python | bsd-2-clause | 13,140 |
from django.conf.urls import include, url
from django.views.generic.base import RedirectView
from cms.models import *
from cms.views import show
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = [
url(r'^$', show,{'slug':"/%s"%settings.HOME_... | eliasfernandez/django-simplecms | cms/urls.py | Python | bsd-2-clause | 537 |
import platform
import pytest
import math
import numpy as np
import dartpy as dart
def test_solve_for_free_joint():
'''
Very simple test of InverseKinematics module, applied to a FreeJoint to
ensure that the target is reachable
'''
skel = dart.dynamics.Skeleton()
[joint0, body0] = skel.create... | dartsim/dart | python/tests/unit/dynamics/test_inverse_kinematics.py | Python | bsd-2-clause | 2,669 |
'''
Project: Farnsworth
Author: Karandeep Singh Nagra
'''
from django.contrib.auth.models import User, Group, Permission
from django.core.urlresolvers import reverse
from django.db import models
from base.models import UserProfile
class Thread(models.Model):
'''
The Thread model. Used to group messages.
... | knagra/farnsworth | threads/models.py | Python | bsd-2-clause | 3,639 |
from __future__ import unicode_literals
class MorfessorException(Exception):
"""Base class for exceptions in this module."""
pass
class ArgumentException(Exception):
"""Exception in command line argument parsing."""
pass
class InvalidCategoryError(MorfessorException):
"""Attempt to load data u... | aalto-speech/flatcat | flatcat/exception.py | Python | bsd-2-clause | 1,153 |
# -*- 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):
# Changing field 'Feed.title'
db.alter_column('feedmanager_feed', 'title', self.gf('django.db.models.fields.... | jacobjbollinger/sorbet | sorbet/feedmanager/migrations/0006_chg_field_feed_title.py | Python | bsd-2-clause | 5,274 |
# General utility functions can go here.
import os
import random
import string
from django.utils import functional
from django.utils.http import urlencode
def rand_string(numOfChars):
"""
Generates a string of lowercase letters and numbers.
That makes 36^10 = 3 x 10^15 possibilities.
If we generate f... | DevangS/CoralNet | utils.py | Python | bsd-2-clause | 2,240 |
import django
from django.db import router
from django.db.models import signals
try:
from django.db.models.fields.related import ReverseManyRelatedObjectsDescriptor
except ImportError:
from django.db.models.fields.related import ManyToManyDescriptor as ReverseManyRelatedObjectsDescriptor
from ..utils import cached... | SpectralAngel/django-select2-forms | select2/models/descriptors.py | Python | bsd-2-clause | 8,496 |
from setuptools import find_packages, setup
from auspost_pac import __version__ as version
setup(
name='python-auspost-pac',
version=version,
license='BSD',
author='Sam Kingston',
author_email='sam@sjkwi.com.au',
description='Python API for Australia Post\'s Postage Assessment Calculator (pac)... | sjkingo/python-auspost-pac | setup.py | Python | bsd-2-clause | 900 |
import io
import sys
import mock
import argparse
from monolith.compat import unittest
from monolith.cli.base import arg
from monolith.cli.base import ExecutionManager
from monolith.cli.base import SimpleExecutionManager
from monolith.cli.base import BaseCommand
from monolith.cli.base import CommandError
from monolith.c... | lukaszb/monolith | monolith/tests/test_cli.py | Python | bsd-2-clause | 11,047 |
# Copyright (c) 2015-2018 by the parties listed in the AUTHORS file.
# All rights reserved. Use of this source code is governed by
# a BSD-style license that can be found in the LICENSE file.
import numpy as np
from .tod import TOD
from .noise import Noise
from ..op import Operator
from .. import timing as timing... | tskisner/pytoast | src/python/tod/sim_noise.py | Python | bsd-2-clause | 3,547 |
from JumpScale import j
import JumpScale.baselib.watchdog.manager
import JumpScale.baselib.redis
import JumpScale.lib.rogerthat
descr = """
critical alert
"""
organization = "jumpscale"
enable = True
REDIS_PORT = 9999
# API_KEY = j.application.config.get('rogerthat.apikey')
redis_client = j.clients.credis.getRedis... | Jumpscale/jumpscale6_core | apps/watchdogmanager/alerttypes/critical.py | Python | bsd-2-clause | 2,105 |
import tornado.web
import json
from tornado_cors import CorsMixin
from common import ParameterFormat, EnumEncoder
class DefaultRequestHandler(CorsMixin, tornado.web.RequestHandler):
CORS_ORIGIN = '*'
def initialize(self):
self.default_format = self.get_argument("format", "json", True)
self.s... | sebastianwebber/pgconfig-api | common/util.py | Python | bsd-2-clause | 5,642 |
from ._stub import *
from ._fluent import *
from ._matchers import *
| manahl/mockextras | mockextras/__init__.py | Python | bsd-2-clause | 69 |
from steamstoreprice.exception import UrlNotSteam, PageNotFound, RequestGenericError
from bs4 import BeautifulSoup
import requests
class SteamStorePrice:
def normalizeurl(self, url):
"""
clean the url from referal and other stuff
:param url(string): amazon url
:return: string(ur... | Mirio/steamstoreprice | steamstoreprice/steamstoreprice.py | Python | bsd-2-clause | 2,007 |
import common.config
import common.messaging as messaging
import common.storage
import common.debug as debug
from common.geo import Line, LineSet
from common.concurrency import ConcurrentObject
from threading import Lock, RLock
import tree.pachinko.message_type as message_type
import tree.pachinko.config as config
i... | kaimast/inanutshell | tree/pachinko/content_server.py | Python | bsd-2-clause | 16,352 |
from django.test import override_settings
from incuna_test_utils.testcases.api_request import (
BaseAPIExampleTestCase, BaseAPIRequestTestCase,
)
from tests.factories import UserFactory
class APIRequestTestCase(BaseAPIRequestTestCase):
user_factory = UserFactory
def test_create_request_format(self):
... | incuna/incuna-test-utils | tests/testcases/test_api_request.py | Python | bsd-2-clause | 918 |
from django.forms import ModelForm
from bug_reporting.models import Feedback
from CoralNet.forms import FormHelper
class FeedbackForm(ModelForm):
class Meta:
model = Feedback
fields = ('type', 'comment') # Other fields are auto-set
#error_css_class = ...
#required_css_class = ...
d... | DevangS/CoralNet | bug_reporting/forms.py | Python | bsd-2-clause | 661 |
import logging
import re
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.plugin.api import validate
from streamlink.stream import HLSStream
from streamlink.utils.parse import parse_json
log = logging.getLogger(__name__)
@pluginmatcher(re.compile(
r"https?://(?:www\.)?livestream\.com/"
))
cla... | melmorabity/streamlink | src/streamlink/plugins/livestream.py | Python | bsd-2-clause | 1,433 |
import time
import threading
import PyTango
import numpy
import h5py
THREAD_DELAY_SEC = 0.1
class HDFwriterThread(threading.Thread):
#-----------------------------------------------------------------------------------
# __init__
#-----------------------------------------------------------------------------------... | ess-dmsc/do-ess-data-simulator | DonkiDirector/HDFWriterThread.py | Python | bsd-2-clause | 6,785 |
from rknfilter.targets import BaseTarget
from rknfilter.db import Resource, Decision, CommitEvery
from rknfilter.core import DumpFilesParser
class StoreTarget(BaseTarget):
def __init__(self, *args, **kwargs):
super(StoreTarget, self).__init__(*args, **kwargs)
self._dump_files_parser = DumpFilesPars... | DmitryFillo/rknfilter | rknfilter/targets/store.py | Python | bsd-2-clause | 1,324 |
from quex.engine.generator.languages.address import Address
from quex.blackboard import E_EngineTypes, E_AcceptanceIDs, E_StateIndices, \
E_TransitionN, E_PostContextIDs, E_PreContextIDs, \
... | coderjames/pascal | quex-0.63.1/quex/engine/generator/state/drop_out.py | Python | bsd-2-clause | 4,373 |
# based on https://github.com/pypa/sampleproject/blob/master/setup.py
# see http://packaging.python.org/en/latest/tutorial.html#creating-your-own-project
from setuptools import setup, find_packages
from setuptools.command.install import install as stdinstall
import codecs
import os
import re
import sys
def find_v... | prechelt/typecheck-decorator | setup.py | Python | bsd-2-clause | 3,969 |
import re, csv
header_end = re.compile("\s+START\s+END\s+")
## p. 1172 is missing a space between the final date and the description. Can't understand why the layout option does this; a space is clearly visible. I dunno.
five_data_re = re.compile("\s*([\w\d]+)\s+(\d\d\/\d\d\/\d\d\d\d)\s+(.*?)\s+(\d\d\/\d\d\/\d\d\d\d... | jsfenfen/senate_disbursements | 114_sdoc4/read_pages.py | Python | bsd-2-clause | 11,865 |
from django.views.generic import ListView
from models import Project
# Create your views here.
class ListProjectView(ListView):
model = Project
template_name = 'cmsplugin_vfoss_project/project_list.html'
| thuydang/djagazin | wsgi/djagazin/cmsplugin_vfoss_project/views.py | Python | bsd-2-clause | 207 |
""" Common utility
"""
import logging
import time
def measure(func, *args, **kwargs):
def start(*args, **kwargs):
begin = time.time()
result = func(*args, **kwargs)
end = time.time()
arg = args
while not (isinstance(arg, str) or isinstance(arg, int) or isinstance(arg, flo... | inlinechan/stags | stags/util.py | Python | bsd-2-clause | 856 |
from __future__ import (absolute_import, print_function, division)
class NotImplementedException(Exception):
pass
| zbuc/imaghost | ghost_exceptions/__init__.py | Python | bsd-2-clause | 120 |
from django.db import models
from django.db.models.signals import post_delete, post_save
from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _
from jsonfield import JSONField
from model_utils import Choices
from model_utils.models import TimeStampedModel
from crate.web.packages.... | crateio/crate.web | crate/web/history/models.py | Python | bsd-2-clause | 2,810 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'TtTrip.shape'
db.add_column(u'timetable_tttrip', 'shape',... | hasadna/OpenTrain | webserver/opentrain/timetable/migrations/0013_auto__add_field_tttrip_shape.py | Python | bsd-3-clause | 2,893 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-16 00:13
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0005_queue_name'),
]
operations = [
... | falcaopetri/enqueuer-api | api/migrations/0006_auto_20161015_2113.py | Python | bsd-3-clause | 543 |
# Short help
def display_summary():
print("{:<13}{}".format( 'rm', "Removes a previously copied SCM Repository" ))
# DOCOPT command line definition
USAGE="""
Removes a previously 'copied' repository
===============================================================================
usage: evie [common-opts] rm [option... | johnttaylor/Outcast | bin/scm/rm.py | Python | bsd-3-clause | 1,756 |
# -*- coding: utf-8 -*-
"""
DU task for ABP Table: doing jointly row BIESO and horizontal cuts
block2line edges do not cross another block.
The cut are based on baselines of text blocks.
- the labels of horizontal cuts are SIO (instead of SO in previous version)
Copyright Naver Labs... | Transkribus/TranskribusDU | TranskribusDU/tasks/TablePrototypes/DU_ABPTableRCut1SIO.py | Python | bsd-3-clause | 34,506 |
#!/usr/bin/env python
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 data... | sinhrks/pandas-ml | pandas_ml/xgboost/test/test_base.py | Python | bsd-3-clause | 4,415 |
# Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import itertools
import numpy as np
import pytest
from coremltools.converters.mil.mil import Builder... | apple/coremltools | coremltools/converters/mil/mil/passes/test_noop_elimination.py | Python | bsd-3-clause | 13,225 |
import logging
import os
# URL to clone product_details JSON files from.
# Include trailing slash.
PROD_DETAILS_URL = 'http://svn.mozilla.org/libs/product-details/json/'
# Target dir to drop JSON files into (must be writable)
PROD_DETAILS_DIR = os.path.join(os.path.dirname(__file__), 'json')
# log level.
LOG_LEVEL ... | pmclanahan/django-mozilla-product-details | product_details/settings_defaults.py | Python | bsd-3-clause | 335 |
"""
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
h... | colour-science/colour | colour/colorimetry/lefs.py | Python | bsd-3-clause | 30,125 |
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.minHe... | acil-bwh/SlicerCIP | Scripted/CIP_/CIP/ui/CollapsibleMultilineText.py | Python | bsd-3-clause | 595 |
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
fr... | eLRuLL/scrapy | tests/test_dupefilters.py | Python | bsd-3-clause | 7,297 |
# -*- coding: utf-8 -*-
"""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,
... | Cawb07/t1-python | terminalone/models/vertical.py | Python | bsd-3-clause | 596 |
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]
setu... | Bauble/bauble.api | test/spec/test_genus.py | Python | bsd-3-clause | 4,372 |
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 EStat... | rdkit/rdkit | Code/GraphMol/Descriptors/test3D_old.py | Python | bsd-3-clause | 3,537 |
"""
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``... | sztosz/invoices | config/wsgi.py | Python | bsd-3-clause | 1,618 |
"""
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 whe... | GenericMappingTools/gmt-python | examples/gallery/images/track_sampling.py | Python | bsd-3-clause | 1,614 |
"""
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, a... | teoliphant/numpy-refactor | numpy/polynomial/__init__.py | Python | bsd-3-clause | 951 |
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:
... | rackerlabs/django-DefectDojo | dojo/management/commands/system_settings.py | Python | bsd-3-clause | 1,040 |
"""
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(
... | bouhlelma/smt | smt/sampling_methods/full_factorial.py | Python | bsd-3-clause | 1,806 |
"""
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(__... | placiflury/gridmonitor-sft | sft/db/sft_handler.py | Python | bsd-3-clause | 3,142 |
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_shipp... | jonathanmeier5/teamstore | saleor/checkout/views/shipping.py | Python | bsd-3-clause | 3,737 |
from httpx import AsyncClient
# Runtime import to avoid syntax errors in samples on Python < 3.5 and reach top-dir
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(__fi... | rmk135/objects | tests/unit/wiring/test_wiringfastapi_py36.py | Python | bsd-3-clause | 1,426 |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2017, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | gregcaporaso/q2cli | q2cli/handlers.py | Python | bsd-3-clause | 22,305 |
"""
=======================================
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 a... | flightgong/scikit-learn | examples/plot_roc.py | Python | bsd-3-clause | 3,681 |
# Copyright 2013 The Chromium 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 os
import unittest
from telemetry import story
from telemetry import page as page_module
from telemetry import value
from telemetry.value import impro... | catapult-project/catapult-csm | telemetry/telemetry/value/scalar_unittest.py | Python | bsd-3-clause | 7,682 |
#!/usr/bin/env python3
"""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 classi... | ufal/neuralmonkey | scripts/preprocess_bert.py | Python | bsd-3-clause | 3,940 |
from .. utils import TranspileTestCase, UnaryOperationTestCase, BinaryOperationTestCase, InplaceOperationTestCase
class StrTests(TranspileTestCase):
def test_setattr(self):
self.assertCodeExecution("""
x = "Hello, world"
x.attr = 42
print('Done.')
""")
... | Felix5721/voc | tests/datatypes/test_str.py | Python | bsd-3-clause | 9,931 |
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)... | hongquan/saleor | saleor/product/models/products.py | Python | bsd-3-clause | 1,423 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyrigh... | nuagenetworks/vspk-python | vspk/v6/nuvnfthresholdpolicy.py | Python | bsd-3-clause | 16,674 |
from __future__ import division, print_function, absolute_import
#from pnet.vzlog import default as vz
import numpy as np
import amitgroup as ag
import itertools as itr
import sys
import os
#import gv
import pnet
import time
def test(ims, labels, net):
yhat = net.classify(ims)
return yhat == labels
if pnet... | amitgroup/parts-net | scripts/train_and_test5.py | Python | bsd-3-clause | 12,277 |
# proxy module
from pyface.qt.QtScript import *
| enthought/etsproxy | enthought/qt/QtScript.py | Python | bsd-3-clause | 48 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
## @file ostap/frames/tree_reduce.py
# Helper module to "Reduce" tree using frames
# @see Ostap::DataFrame
# @see ROOT::RDataFrame
# @author Vanya BELYAEV Ivan.Belyaev@itep.ru
# @date 201... | OstapHEP/ostap | ostap/frames/tree_reduce.py | Python | bsd-3-clause | 12,435 |
"""
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,
Times... | pandas-dev/pandas | pandas/tests/frame/indexing/test_coercion.py | Python | bsd-3-clause | 5,463 |
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)) + ... | stefanv/selective-inference | selection/algorithms/tests/test_forward_step.py | Python | bsd-3-clause | 8,482 |
# proxy module
from __future__ import absolute_import
from codetools.blocks.analysis import *
| enthought/etsproxy | enthought/blocks/analysis.py | Python | bsd-3-clause | 94 |
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>[^/]+)/'
... | Osmose/snippets-service-prototype | snippets/base/urls.py | Python | bsd-3-clause | 836 |
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,
... | rossant/spiky | experimental/ephyview.py | Python | bsd-3-clause | 7,411 |
# 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):
# Adding model 'Fare'
db.create_table('gtfs_fare', (
('id', self.gf('django.db.models.fields.AutoFiel... | rcoup/traveldash | traveldash/gtfs/migrations/0011_auto__add_fare__add_unique_fare_source_fare_id__add_unique_shape_sourc.py | Python | bsd-3-clause | 16,927 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# This file is the main file used when running tests with pytest directly,
# in particular if running e.g. ``pytest docs/``.
from importlib.util import find_spec
import os
import pkg_resources
import tempfile
try:
from pytest_astropy_header.display ... | MSeifert04/astropy | conftest.py | Python | bsd-3-clause | 1,526 |
#!/usr/bin/python
# Code is executed top-to-bottom on load.
# Variables are defined at the first assignment
a = 2 # defines `a`
b = 2
# 'print' operator, simple form: just prints out human-readable representation
# of the argument. NOTE: no \n!
print a + b
# Types in Python are dynamic!
v = 42 # `v` is an integer... | denfromufa/mipt-course | demos/python/2_variables_and_types.py | Python | bsd-3-clause | 694 |
"""
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 ... | waxkinetic/fabcloudkit | fabcloudkit/tool/nginx.py | Python | bsd-3-clause | 6,961 |
import emission.analysis.modelling.tour_model.data_preprocessing as preprocess
# to determine if the user is valid:
# valid user should have >= 10 trips for further analysis and the proportion of filter_trips is >=50%
def valid_user(filter_trips,trips):
valid = False
if len(filter_trips) >= 10 and len(filter_... | e-mission/e-mission-server | emission/analysis/modelling/tour_model/get_users.py | Python | bsd-3-clause | 1,172 |
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, ... | ilendl2/chrisdev-cookiecutter | {{cookiecutter.repo_name}}/{{cookiecutter.project_name}}/news/views.py | Python | bsd-3-clause | 2,060 |
"""
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... | rjleveque/tsunami_benchmarks | nthmp_currents_2015/problem2/maketopo.py | Python | bsd-3-clause | 2,646 |
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); | antoinecarme/pyaf | tests/artificial/transf_Difference/trend_Lag1Trend/cycle_7/ar_12/test_artificial_128_Difference_Lag1Trend_7_12_20.py | Python | bsd-3-clause | 266 |
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:... | andrewtron3000/jampy | generator_matrix.py | Python | bsd-3-clause | 4,610 |
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
fro... | Pylons/kai | kai/controllers/comments.py | Python | bsd-3-clause | 2,956 |
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)... | praekelt/django-analytics | analytics/sites.py | Python | bsd-3-clause | 657 |
#!/usr/bin/env python
#
# Written by Chema Garcia (aka sch3m4)
# Contact: chema@safetybits.net || http://safetybits.net || @sch3m4
#
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
'''
r... | sch3m4/SerialCrypt | apps/locate.py | Python | bsd-3-clause | 724 |
# -*- coding: utf-8 -*-
"""
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 thres... | Andrwe/py3status | py3status/modules/scratchpad.py | Python | bsd-3-clause | 5,375 |
# Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
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_bindin... | chriskiehl/python-stix | stix/extensions/marking/tlp.py | Python | bsd-3-clause | 1,713 |
#!/usr/bin/env python
# Copyright 2017 The Chromium 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 argparse
import json
import logging
import os
import pipes
import posixpath
import random
import re
import shlex
import sys
imp... | chrisdickinson/nojs | build/android/apk_operations.py | Python | bsd-3-clause | 34,076 |
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,
... | almarklein/scikit-image | skimage/transform/tests/test_geometric.py | Python | bsd-3-clause | 7,870 |
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 ... | uq-eresearch/uqam | location/views.py | Python | bsd-3-clause | 4,790 |
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_BA... | eeue56/pycho | pycho/gui/windows.py | Python | bsd-3-clause | 5,304 |
"""This module contains an interface for using the GPy library in ELFI."""
# TODO: make own general GPRegression and kernel classes
import copy
import logging
import GPy
import numpy as np
logger = logging.getLogger(__name__)
logging.getLogger("GP").setLevel(logging.WARNING) # GPy library logger
class GPyRegress... | lintusj1/elfi | elfi/methods/bo/gpy_regression.py | Python | bsd-3-clause | 12,384 |
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.... | inonit/wagtail | wagtail/tests/settings.py | Python | bsd-3-clause | 4,667 |
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
... | pandas-dev/pandas | pandas/tests/frame/methods/test_between_time.py | Python | bsd-3-clause | 10,811 |
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")),
]
| eldarion/formly | formly/tests/urls.py | Python | bsd-3-clause | 249 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.