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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
#
# Copyright 2007 Google LLC
#
# 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... | GoogleCloudPlatform/appengine-python-standard | src/google/appengine/api/apiproxy_stub.py | Python | apache-2.0 | 5,483 |
"""The StarLine component."""
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import Config, HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from .account import StarlineAccount
from .const import (
DOMAIN,
PLATFORMS,
SERVICE_UPDA... | joopert/home-assistant | homeassistant/components/starline/__init__.py | Python | apache-2.0 | 2,876 |
# =============================================================================
# Copyright (c) 2016, Cisco Systems, Inc
# 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 sour... | smjurcak/csm | csmserver/work_units/inventory_work_unit.py | Python | apache-2.0 | 4,795 |
'''
Menu for Community Scripts
Author: Christoph Stoettner
Mail: christoph.stoettner@stoeps.de
Documentation: http://scripting101.stoeps.de
Version: 5.0.1
Date: 09/19/2015
License: Apache 2.0
History: Changed by Jan Alderlieste
'''
import sys
import os
import ibmcnx.funct... | stoeps13/ibmcnx2 | ibmcnx/menu/docs.py | Python | apache-2.0 | 3,638 |
import sys
import logging
logger = logging.getLogger(__name__)
def configure_logging():
root = logging.getLogger()
root.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s %(name)12s %(levelname)7s - %(mes... | edouard-lopez/parlr | config.py | Python | apache-2.0 | 394 |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2015,2016,2018 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with... | quattor/aquilon | tests/broker/test_update_network.py | Python | apache-2.0 | 3,647 |
# Copyright 2015 Mirantis, Inc.
#
# 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 ... | gitfred/fuel-extension-volume-manager | volume_manager/tests/test_migration_volume_manager_extension_001_add_volumes_table.py | Python | apache-2.0 | 3,073 |
#!/usr/bin/env python
# encoding: utf-8
"""
Author: Isabel Restrepo
August 12, 2012
Compute rigid transformation between two point clounds using feature correspondances
"""
import os
import sys
import glob
import time
from optparse import OptionParser
from xml.etree.ElementTree import ElementTree
from vpcl_adaptor imp... | mirestrepo/voxels-at-lems | registration_eval/unused/compute_rigid_transform.py | Python | bsd-2-clause | 2,803 |
# -*- coding: ISO-8859-15 -*-
from core.Uusipuu import UusipuuModule
import random, time
class Module(UusipuuModule):
def startup(self):
if 'memo' not in self.config:
self.config['memo'] = {}
def privmsg(self, user, target, msg):
if target != self.channel:
return
... | desaster/uusipuu | modules/memo.py | Python | bsd-2-clause | 3,945 |
#from django.conf import settings
NOTICE_FROM_ANONYMOUS = 1 | anscii/django-modelnotice | modelnotice/default_settings.py | Python | bsd-2-clause | 60 |
'''A convenient class for parsing HTML pages.'''
from __future__ import unicode_literals
from HTMLParser import HTMLParser
import logging
import re
from RSSvk.core import Error
LOG = logging.getLogger(__name__)
LOG.setLevel(logging.INFO)
class HTMLPageParser(HTMLParser):
'''A convenient class for parsing HTML... | Densvin/RSSVK | vkfeed/tools/html_parser.py | Python | bsd-2-clause | 8,733 |
# -*- coding: utf-8 -*-
class Company(object):
def __init__(self, name=None, code=None, phone=None, digit=None):
# Company's name
self.name = name
# Codename
self.code = code
# The digit of the invoice number
if digit is None:
digit = []
self.dig... | iBluemind/armatis | armatis/models.py | Python | bsd-2-clause | 2,596 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 14, 2011
@author:Isabel Restrepo
A script to run (fast) k-means on J sets of random subsamples
"""
import os;
import dbrec3d_batch
import multiprocessing
import Queue
import time
import random
import optparse
import sys
from numpy import log, ceil
from... | mirestrepo/voxels-at-lems | dbrec3d/bof/pca/learn_codebook/refined_init_k_means/k_means_on_CM_means.py | Python | bsd-2-clause | 4,760 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | jmcnamara/XlsxWriter | xlsxwriter/test/comparison/test_textbox15.py | Python | bsd-2-clause | 900 |
import sys
if '' not in sys.path:
sys.path.append('')
import time
import unittest
from pyactors.logs import file_logger
from pyactors.exceptions import EmptyInboxException
from tests import ForkedGreActor as TestActor
from multiprocessing import Manager
class ForkedGreenletActorTest(unittest.TestCase):
de... | snakeego/pyactors | tests/test_forked_green_actors.py | Python | bsd-2-clause | 1,024 |
#!/usr/bin/env python
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import messagebird
# ACCESS_KEY = ''
# MESSAGE_ID = ''
try:
ACCESS_KEY
except NameError:
print('You need to set an ACCESS_KEY constant in this file')
sys.exit(1)
try:
MESSAGE_ID
except NameError:
print('Yo... | messagebird/python-rest-api | examples/voice_message.py | Python | bsd-2-clause | 1,642 |
with open('README.txt') as f:
long_description = f.read()
from distutils.core import setup
setup(
name = "nomit",
packages = ["nomit"],
version = "1.0",
description = "Process Monit HTTP/XML",
author = "Markus Juenemann",
author_email = "markus@juenemann.net",
url = "https://github.com... | mjuenema/nomit | setup.py | Python | bsd-2-clause | 902 |
# Copyright 2018 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
from lino.core.roles import UserRole
class NotesUser(UserRole):
pass
class NotesStaff(NotesUser):
pass
| lino-framework/xl | lino_xl/lib/notes/roles.py | Python | bsd-2-clause | 228 |
from __future__ import absolute_import
__author__ = 'noe'
from pyemma._base.model import SampledModel
from pyemma.msm.models.msm import MSM
from pyemma.util.types import is_iterable
class SampledMSM(MSM, SampledModel):
def __init__(self, samples, ref=None, conf=0.95):
r""" Constructs a sampled MSM
... | trendelkampschroer/PyEMMA | pyemma/msm/models/msm_sampled.py | Python | bsd-2-clause | 15,417 |
#!/usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
u"""
OMD Livestatus dynamic inventory script
=======================================
If running as an OMD site user, i.e. if ${OMD_ROOT} is set, we try to
connect to the Livestatus socket at the default location
${OMD_ROOT}/tmp/run/live
Alternatively, ... | ahaerpfer/ansible-inventory-omd-livestatus | omd_livestatus.py | Python | bsd-2-clause | 11,214 |
from __future__ import annotations
from os import getenv
import gc
import sys
from unittest import TestCase, main
from unittest import skip as skip
from unittest import skipIf as skipIf
import logging
from progressivis import Scheduler, log_level
from progressivis.storage import init_temp_dir_if, cleanup_temp_dir
imp... | jdfekete/progressivis | tests/__init__.py | Python | bsd-2-clause | 2,610 |
"""Leetcode 100. Same Tree
Easy
URL: https://leetcode.com/problems/same-tree/
Given two binary trees, write a function to check if they are the same or not.
Two binary trees are considered the same if they are structurally identical and
the nodes have the same value.
Example 1:
Input: 1 1
/ \ ... | bowen0701/algorithms_data_structures | lc0100_same_tree.py | Python | bsd-2-clause | 4,044 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... | ganeshgore/myremolab | server/src/test/unit/voodoo/gen/loader/APItype1.py | Python | bsd-2-clause | 422 |
#
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pysnmp/license.html
#
from pysnmp import error
class MetaObserver(object):
"""This is a simple facility for exposing internal SNMP Engine
working details to pysnmp applicat... | etingof/pysnmp | pysnmp/entity/observer.py | Python | bsd-2-clause | 2,572 |
import logging
from .. import exceptions
from ..plan import COMPLETE, Plan
from ..status import NotSubmittedStatus, NotUpdatedStatus
from . import build
import difflib
import json
logger = logging.getLogger(__name__)
def diff_dictionaries(old_dict, new_dict):
"""Diffs two single dimension dictionaries
Retu... | mhahn/stacker | stacker/actions/diff.py | Python | bsd-2-clause | 6,533 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2017, Thierry Lemeunier <thierry at lemeunier dot net>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must reta... | thethythy/Mnemopwd | mnemopwd/client/uilayer/uicomponents/TitledOnBorderWindow.py | Python | bsd-2-clause | 2,237 |
default_app_config = 'user_deletion.apps.UserDeletionConfig'
| incuna/django-user-deletion | user_deletion/__init__.py | Python | bsd-2-clause | 61 |
from django.conf.urls import url
from .views import simple_password
urlpatterns = [
url(r'^$', view=simple_password, name="simple_auth_password"),
]
| bennylope/django-simple-auth | simple_auth/urls.py | Python | bsd-2-clause | 156 |
#!/usr/bin/env python3
# Software License Agreement (BSD License)
#
# Copyright (c) 2020, UFACTORY, Inc.
# All rights reserved.
#
# Author: Vinman <vinman.wen@ufactory.cc> <vinman.cub@gmail.com>
import re
import time
import math
import threading
try:
from multiprocessing.pool import ThreadPool
except... | xArm-Developer/xArm-Python-SDK | xarm/x3/base.py | Python | bsd-3-clause | 102,034 |
"""
A socket wrapper that uses Event IO.
"""
import socket
import event
import time
import logging
import errno
import traceback
import os
from collections import deque
# TODO: Use new io objects from 2.6
# 26 July 10 - I looked into this and a potential problem with io.StringIO is
# that it assumes all text is unico... | agoragames/py-eventsocket | eventsocket.py | Python | bsd-3-clause | 20,384 |
def test_basic_editor(scratch_tree):
sess = scratch_tree.edit('/')
assert sess.id == ''
assert sess.path == '/'
assert sess.record is not None
assert sess['_model'] == 'page'
assert sess['title'] == 'Index'
assert sess['body'] == 'Hello World!'
sess['body'] = 'A new body'
sess.com... | bameda/lektor | tests/test_editor.py | Python | bsd-3-clause | 1,424 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-07 06:05
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('news', '0003_auto_20170228_2249'),
]
operations = ... | GeorgiaTechDHLab/TOME | news/migrations/0004_auto_20170307_0605.py | Python | bsd-3-clause | 1,746 |
__author__="Joao" | joaofrancese/heavy-destruction | Panda/src/objects/__init__.py | Python | bsd-3-clause | 17 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.views.generic import TemplateView
urlpatterns = [
url(r'^$', TemplateView.as_view(
template_name='pages/home.htm... | LABETE/TestYourProject | config/urls.py | Python | bsd-3-clause | 1,501 |
def extractDlscanlationsCom(item):
'''
Parser for 'dlscanlations.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous', 'Loi... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractDlscanlationsCom.py | Python | bsd-3-clause | 547 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
class WSPayForm(forms.Form):
ShopID = forms.CharField(widget=forms.HiddenInput)
ShoppingCartID = forms.CharField(widget=forms.HiddenInput)
TotalAmount = forms.CharField(widget=forms.HiddenInput)
Signature = forms... | dinoperovic/django-shop-wspay | shop_wspay/forms.py | Python | bsd-3-clause | 536 |
import operator
import numpy as np
from pandas._libs import index as libindex
from pandas import compat
from pandas.compat.numpy import function as nv
from pandas.core.dtypes.generic import ABCCategorical, ABCSeries
from pandas.core.dtypes.dtypes import CategoricalDtype
from pandas.core.dtypes.common import (
is_... | louispotok/pandas | pandas/core/indexes/category.py | Python | bsd-3-clause | 31,573 |
from BinPy.Gates import *
class PowerSource:
"""
Models a Power Source from which various connectors can tap by connecting to it.
taps: The list of all connectors connected to this power source.
connect(): Takes in one or more connectors as input and connects them to the power source.
disconne... | coder006/BinPy | BinPy/tools/powersource.py | Python | bsd-3-clause | 1,962 |
''' Simple test for apachelogs '''
import unittest
from apachelogs import ApacheLogFile
class apachelogs_test(unittest.TestCase):
def test_foo(self):
log = ApacheLogFile('test.log')
line = iter(log).next()
self.assertEquals(line.ip, '127.0.0.1')
self.assertEquals(line.ident, '-... | bkjones/loghetti | test/apachelogs_test.py | Python | bsd-3-clause | 930 |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# global default settings for physical simulation
# ---------------------------------------------------------------------
# system parameters
d1 = 0.08
l2 = 0.19
d2 = 0.08
l3 = 0.19
initial_state = [0, 0, 0, 0, 0]
# anima... | cklb/PyMoskito | pymoskito/examples/car/settings.py | Python | bsd-3-clause | 379 |
from django.contrib import messages
from django.http import Http404, HttpResponse
from django.shortcuts import render
from corehq.apps.app_manager.dbaccessors import get_app
from corehq.apps.app_manager.decorators import require_deploy_apps, \
require_can_edit_apps
from corehq.apps.app_manager.xform import XForm
fr... | qedsoftware/commcare-hq | corehq/apps/app_manager/views/multimedia.py | Python | bsd-3-clause | 2,218 |
''' Provide functions to embed Bokeh models (e.g., plots, widget, layouts)
in various different ways.
There are a number of different combinations of options when embedding
Bokeh plots. The data for the plot can be contained in the document,
or on a Bokeh server, or in a sidecar JavaScript file. Likewise, BokehJS
may ... | gpfreitas/bokeh | bokeh/embed.py | Python | bsd-3-clause | 20,330 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 30, transform = "Quantization", sigma = 0.0, exog_count = 20, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Quantization/trend_PolyTrend/cycle_30/ar_/test_artificial_1024_Quantization_PolyTrend_30__20.py | Python | bsd-3-clause | 269 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..brainsuite import Hemisplit
def test_Hemisplit_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_exception=dict(nohash=True,
usedefau... | mick-d/nipype | nipype/interfaces/brainsuite/tests/test_auto_Hemisplit.py | Python | bsd-3-clause | 1,610 |
"""
Phil scope of options for scaling.
"""
from __future__ import annotations
import iotbx.phil
phil_scope = iotbx.phil.parse(
"""
anomalous = False
.type = bool
.help = "Separate anomalous pairs in scaling and error model optimisation."
.expert_level=0
overwrite_existing_models = False
.type... | dials/dials | algorithms/scaling/scaling_options.py | Python | bsd-3-clause | 8,202 |
import unittest
import pythran
import os.path
#pythran export a((float,(int,uintp),str list) list list)
#pythran export a(str)
#pythran export a( (str,str), int, intp list list)
#pythran export a( float set )
#pythran export a( bool:str dict )
#pythran export a( float )
#pythran export a( int8[] )
#pythran export a( i... | pombredanne/pythran | pythran/tests/test_spec_parser.py | Python | bsd-3-clause | 3,994 |
import pytest
from pontoon.test import factories
@pytest.fixture
def admin():
"""Admin - a superuser"""
return factories.UserFactory.create(username="admin", is_superuser=True,)
@pytest.fixture
def client_superuser(client, admin):
"""Provides a client with a logged in superuser. """
client.force_lo... | jotes/pontoon | pontoon/test/fixtures/base.py | Python | bsd-3-clause | 3,576 |
from __future__ import unicode_literals
import json
import requests
import six
from datetime import datetime
from six.moves.urllib.parse import parse_qs
from xml.etree.ElementTree import Element, SubElement, tostring
from xml.parsers.expat import ExpatError
from .auth import OAuth2Credentials
from .exceptions import ... | freakboy3742/pyxero | xero/basemanager.py | Python | bsd-3-clause | 16,413 |
from jsonapi_requests import base
from jsonapi_requests.orm import registry
class OrmApi:
def __init__(self, api):
self.type_registry = registry.TypeRegistry()
self.api = api
@classmethod
def config(cls, *args, **kwargs):
return cls(base.Api.config(*args, **kwargs))
def endpo... | socialwifi/jsonapi-requests | jsonapi_requests/orm/api.py | Python | bsd-3-clause | 376 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings # noqa
from django.utils.translation import ugettext_lazy as _ # noqa
from appconf import AppConf
class BlogConf(AppConf):
DISQUS_SHORTNAME = 'django-staticgen'
POST_IDENTIFIER = 'current_post'
class Met... | mishbahr/staticgen-demo | staticgen_demo/blog/conf.py | Python | bsd-3-clause | 347 |
"""All pytest-django fixtures"""
from __future__ import with_statement
import os
import warnings
import pytest
from . import live_server_helper
from .db_reuse import (monkey_patch_creation_for_db_reuse,
monkey_patch_creation_for_db_suffix)
from .django_compat import is_django_unittest
from .l... | tomviner/pytest-django | pytest_django/fixtures.py | Python | bsd-3-clause | 12,082 |
"""empty message
Revision ID: 424f18f4c1df
Revises: 106e3631fe9
Create Date: 2015-06-23 11:31:08.548661
"""
# revision identifiers, used by Alembic.
revision = '424f18f4c1df'
down_revision = '106e3631fe9'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from sqlalchemy.diale... | uwcirg/true_nth_usa_portal | portal/migrations/versions/424f18f4c1df_.py | Python | bsd-3-clause | 1,316 |
"""
JupyterHub Spawner to spawn user notebooks on a Kubernetes cluster.
This module exports `KubeSpawner` class, which is the actual spawner
implementation that should be used by JupyterHub.
"""
import asyncio
import os
import signal
import string
import sys
import warnings
from functools import partial
from functools... | jupyterhub/kubespawner | kubespawner/spawner.py | Python | bsd-3-clause | 109,371 |
from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.config import ConfigValidationError
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from txircd.utils import trimStringToByteLength
from zope.interface import implementer
from typing import Any, Callabl... | Heufneutje/txircd | txircd/modules/rfc/cmd_away.py | Python | bsd-3-clause | 2,756 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("AdaBoostClassifier" , "FourClass_100" , "db2")
| antoinecarme/sklearn2sql_heroku | tests/classification/FourClass_100/ws_FourClass_100_AdaBoostClassifier_db2_code_gen.py | Python | bsd-3-clause | 144 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# 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 copyright notice, this
# ... | vlegoff/tsunami | src/secondaires/magie/editeurs/spedit/__init__.py | Python | bsd-3-clause | 9,326 |
# Copyright 2008 Google Inc.
#
# 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, ... | nicko96/Chrome-Infra | appengine/chromium_rietveld/codereview/decorators_chromium.py | Python | bsd-3-clause | 2,669 |
import unittest
import doctest
from pprint import pprint
from interlude import interact
import lxml.etree as etree
optionflags = doctest.NORMALIZE_WHITESPACE | \
doctest.ELLIPSIS | \
doctest.REPORT_ONLY_FIRST_FAILURE #| \
# doctest.REPORT_NDIFF
TESTFILES = [
'api.rst',
... | bluedynamics/vdexcsv | src/vdexcsv/tests.py | Python | bsd-3-clause | 886 |
#coding:utf8
from __future__ import absolute_import, unicode_literals
import msgpack
from .base import BaseSerializer
class MSGPackSerializer(BaseSerializer):
def dumps(self, value):
return msgpack.dumps(value)
def loads(self, value):
return msgpack.loads(value, encoding="utf-8")
| glumu/django-redis-cluster | django_redis_cluster/serializers/msgpack.py | Python | bsd-3-clause | 311 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'resources/about_dialog.ui'
#
# Created: Sat Apr 8 00:53:02 2017
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_AboutDialog(object):
... | timsavage/funktion-generator | utils/wave-editor/wave_editor/_ui/about_dialog.py | Python | bsd-3-clause | 2,661 |
"""The WaveBlocks Project
Compute the transformation to the eigen basis for wavefunction.
@author: R. Bourquin
@copyright: Copyright (C) 2012, 2016 R. Bourquin
@license: Modified BSD License
"""
from WaveBlocksND import BlockFactory
from WaveBlocksND import WaveFunction
from WaveBlocksND import BasisTransformationWF... | WaveBlocks/WaveBlocksND | WaveBlocksND/Interface/EigentransformWavefunction.py | Python | bsd-3-clause | 2,041 |
from django.conf.urls import url
from .views import BaseView
urlpatterns = [
url(r"^$", BaseView.as_view(), name="base-view-2"),
]
| nephila/djangocms-apphook-setup | tests/sample_app_2/urls.py | Python | bsd-3-clause | 137 |
from datetime import date, timedelta, datetime
import time
def get_first_day(dt, d_years=0, d_months=0):
# d_years, d_months are "deltas" to apply to dt
y, m = dt.year + d_years, dt.month + d_months
a, m = divmod(m-1, 12)
return date(y+a, m+1, 1)
def get_last_day(dt):
return get_first_day(dt, 0, 1... | russelmahmud/mess-account | core/utils.py | Python | bsd-3-clause | 581 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models import CMSPlugin, Page, get_plugin_media_path
from os.path import basename
class Picture(CMSPlugin):
"""
A Picture with or without a link
"""
CENTER = "center"
LEFT = "left"
RIGHT = "right"
... | pbs/django-cms | cms/plugins/picture/models.py | Python | bsd-3-clause | 1,579 |
from __future__ import print_function
from glyphNameFormatter.tools import camelCase
doNotProcessAsLigatureRanges = [
(0xfc5e, 0xfc63),
(0xfe70, 0xfe74),
#(0xfc5e, 0xfc61),
(0xfcf2, 0xfcf4),
(0xfe76, 0xfe80),
]
def process(self):
# Specifically: do not add suffixes to these ligatures,
... | LettError/glyphNameFormatter | Lib/glyphNameFormatter/rangeProcessors/helper_arabic_ligature_exceptions.py | Python | bsd-3-clause | 1,516 |
import datetime
import factory
from django.db.models import signals
from elections.models import (
Election,
ModerationHistory,
ElectionType,
ElectedRole,
ModerationStatus,
ModerationStatuses,
)
from organisations.tests.factories import (
OrganisationFactory,
OrganisationDivisionFactor... | DemocracyClub/EveryElection | every_election/apps/elections/tests/factories.py | Python | bsd-3-clause | 2,998 |
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
import commonware.log
import waffle
from users.models import UserProfile
from .models import Access
from .oauth import OAuthServer
log = commonware.log.getLogger('z.api')
class RestOAuthMiddleware(object):
"""
This is b... | mdaif/olympia | apps/api/middleware.py | Python | bsd-3-clause | 3,064 |
from setuptools import setup, find_packages
setup(
name = 'django-dzenlog',
version = __import__('django_dzenlog').__version__,
description = '''Django Dzenlog is a set of models and templates, which can be '''
'''used to create blogs with different kinds media.''',
long_description =... | svetlyak40wt/django-dzenlog | setup.py | Python | bsd-3-clause | 2,152 |
class WorkflowRegistry(object):
def __init__(self):
self.workflows = {}
self.class_index = {}
def add(self, name, cls):
self.workflows[id(cls)] = self.workflows.get(id(cls), set())
self.workflows[id(cls)].add(name)
self.class_index[id(cls)] = cls
def get_class_field... | javrasya/django-river | river/core/workflowregistry.py | Python | bsd-3-clause | 418 |
from sympy import (
Abs, Chi, Ci, CosineTransform, Dict, Ei, Eq, FallingFactorial, FiniteSet,
Float, FourierTransform, Function, Integral, Interval,
InverseCosineTransform, InverseFourierTransform,
InverseLaplaceTransform, InverseMellinTransform, InverseSineTransform,
Lambda, LaplaceTransform, Limit... | amitjamadagni/sympy | sympy/printing/tests/test_latex.py | Python | bsd-3-clause | 36,468 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import json
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group, Permission
from django.core import mail
from django.core.urlresolvers import reverse, reverse_lazy
from django.test import TestCase... | Toshakins/wagtail | wagtail/wagtailadmin/tests/tests.py | Python | bsd-3-clause | 12,417 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.core.cache import cache
from django.db import models
from django.db.models.signals import post_save
try:
from django.db.transaction import atomic
except ImportError:
from django.db.transaction import co... | integricho/django-talkalot | talkalot/models.py | Python | bsd-3-clause | 13,435 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.db import transaction
from django.db.models import Count
from django.http import HttpResponseRedirect, ... | caktus/rapidsms-groups | groups/views.py | Python | bsd-3-clause | 3,191 |
def extractQuillofkarnikaWordpressCom(item):
'''
Parser for 'quillofkarnika.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Top Giants: Rebirth of the Black-Bellied Wife', '... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractQuillofkarnikaWordpressCom.py | Python | bsd-3-clause | 708 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from flask_script import Manager, Shell, Server
from flask_script.commands import Clean, ShowUrls
from flask_migrate import MigrateCommand
from inspectors.app import create_app
from inspectors.settings import DevConfig, ProdConfig
from inspectors.database import ... | codeforamerica/mdc-inspectors | manage.py | Python | bsd-3-clause | 1,026 |
from __future__ import division, print_function, absolute_import
from io import StringIO
import tempfile
import numpy as np
from numpy.testing import assert_equal, \
assert_array_almost_equal_nulp
from scipy.sparse import coo_matrix, csc_matrix, rand
from scipy.io import hb_read, hb_write
SIMPLE = """\
No Ti... | arokem/scipy | scipy/io/harwell_boeing/tests/test_hb.py | Python | bsd-3-clause | 2,366 |
import json
from os import linesep
from urllib2 import Request, urlopen
from string import capwords
from django.conf import settings
from django.core.mail import send_mail
from django.contrib.auth.decorators import login_required
from django.contrib.messages.views import SuccessMessageMixin
from django.utils import ti... | ODM2/ODM2ControlledVocabularies | src/odm2cvs/cvinterface/views/base_views.py | Python | bsd-3-clause | 14,543 |
import gzip
import json
import os
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.paginator import EmptyPage
from django.core.paginator import PageNotAnInteger
from django.core.paginator import Paginator
from django.db.mode... | raonyguimaraes/mendelmd | individuals/views.py | Python | bsd-3-clause | 23,385 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" Topological sort """
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ imp... | aldebaran/qibuild | python/qisys/sort.py | Python | bsd-3-clause | 4,651 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import copy
import logging
import time
from collections import OrderedDict
from contextlib import contextmanager
import six
from django.utils.functional import cached_property
from .client import get_es_client
logger = logging.getLogger('elasticindex')
... | ytyng/django-elasticindex | elasticindex/managers.py | Python | bsd-3-clause | 9,274 |
def table_exists(curs, table_name=''):
'''
If table_name is a schema qualified table name and it exists it is returned,
else if it is not schema qualified and the table name exists in the search
path then that schema qualified table name is returned, else None.
'''
curs.execute('SELECT pgparti... | mage2k/pg_partitioner | pg_partitioner/sql_util.py | Python | bsd-3-clause | 2,074 |
class A:
def foo(self):
print('A.foo()')
class B(A):
def foo(self):
print('B.foo()')
class C(A):
def foo(self):
print('C.foo()')
class D(B, C):
def foo(self):
print('D.foo()')
x = D()
print(D.__mro__) # (D, B, C, A, object)
x.foo() # D.foo()
| s3rvac/talks | 2017-03-07-Introduction-to-Python/examples/23-inheritance.py | Python | bsd-3-clause | 303 |
# Copyright 2015 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 ag... | flgiordano/netcash | +/google-cloud-sdk/lib/surface/dataflow/jobs/cancel.py | Python | bsd-3-clause | 2,531 |
from currencies.models import Currency
def currencies(request):
currencies = Currency.objects.active()
if not request.session.get('currency'):
try:
currency = Currency.objects.get(is_default__exact=True)
except Currency.DoesNotExist:
currency = None
request.ses... | barseghyanartur/django-currencies | currencies/context_processors.py | Python | bsd-3-clause | 450 |
"""
Using dates with timeseries models
"""
import statsmodels.api as sm
import numpy as np
import pandas
# Getting started
# ---------------
data = sm.datasets.sunspots.load()
# Right now an annual date series must be datetimes at the end of the year.
from datetime import datetime
dates = sm.tsa.datetools.dates_fro... | pprett/statsmodels | examples/tsa/ex_dates.py | Python | bsd-3-clause | 1,296 |
import inspect
import os
from abc import ABC, ABCMeta
from dataclasses import dataclass
from datetime import datetime, tzinfo
from types import FunctionType, WrapperDescriptorType
from typing import (
Any,
Callable,
Dict,
Generic,
Iterable,
List,
Optional,
Type,
TypeVar,
Union,
... | johnbywater/eventsourcing | eventsourcing/domain.py | Python | bsd-3-clause | 37,825 |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from django.core.cache import cache
from sentry.testutils import PermissionTestCase
from sentry.api.endpoints.setup_wizard import SETUP_WIZARD_CACHE_KEY
class SetupWizard(PermissionTestCase):
def test_redirect(self):
use... | gencer/sentry | tests/sentry/web/frontend/test_setup_wizard.py | Python | bsd-3-clause | 1,341 |
# Copyright 2013 University of Maryland. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE.TXT file.
import os
from framework.Targets import ApacheTarget
class Target(ApacheTarget):
def get_path(filename):
return os.path.dirname(os.pat... | UMD-SEAM/bugbox | framework/Targets/eXtplorer_2_1_0/__init__.py | Python | bsd-3-clause | 494 |
try:
INSTALLED_APPS
except NameError:
INSTALLED_APPS=()
#Generated Config - Don't modify above this line
| igudym/twango | twango/template/default/src/conf/h_third_party_apps.py | Python | bsd-3-clause | 115 |
import sys, time, os
from django.conf import settings
from django.core import mail
from django.core.mail.backends import locmem
from django.db import DEFAULT_DB_ALIAS
from django.test import signals
from django.template import Template
from django.utils.translation import deactivate
from django.utils.unittest import sk... | sam-tsai/django-old | django/test/utils.py | Python | bsd-3-clause | 3,206 |
"""
Copyright (C) 2018 Roberto Bruttomesso <roberto.bruttomesso@gmail.com>
This file is distributed under the terms of the 3-clause BSD License.
A copy of the license can be found in the root directory or at
https://opensource.org/licenses/BSD-3-Clause.
Author: Roberto Bruttomesso <roberto.bruttomesso@gmail.com>
Da... | formalmethods/intrepyd | intrepyd/iec611312py/stmtbuilder.py | Python | bsd-3-clause | 8,639 |
from lazyrunner import pmodule, PModule, preset, presetTree, defaults
from treedict import TreeDict
p = defaults()
p.data_defaults.a = 1
p.data_defaults.b = 2
@preset
def change_default_a(p):
p.data_defaults.a = 10
@pmodule
class Data(PModule):
# Use this to set up the local branch of the preset tree. Ca... | hoytak/lazyrunner | test/test_environment/data/data.py | Python | bsd-3-clause | 2,204 |
from django.db import models
from sampledatahelper.helper import SampleDataHelper
from sampledatahelper import handlers
class Register(object):
fields = {}
ignored_fields = []
_instance = None
sd = SampleDataHelper()
def __new__(cls, *args, **kwargs):
if not cls._instance:
cls... | kaleidos/django-sampledatahelper | sampledatahelper/register.py | Python | bsd-3-clause | 2,778 |
# -*- coding: utf-8 -*-
"""Functional tests using WebTest.
See: http://webtest.readthedocs.org/
"""
from flask import url_for
from recruit_app.user.models import User
from .factories import UserFactory
class TestLoggingIn:
"""Login."""
def test_can_log_in_returns_200(self, user, testapp):
"""Login ... | tyler274/Recruitment-App | tests/test_functional.py | Python | bsd-3-clause | 3,980 |
import numdifftools
numdifftools.test() | maniteja123/numdifftools | conda_recipe/run_test.py | Python | bsd-3-clause | 40 |
# -*- coding: utf-8 -*-
'''The app module, containing the app factory function.'''
from flask import Flask, render_template
from cheapr.settings import ProdConfig
from cheapr.assets import assets
from cheapr.extensions import (
bcrypt,
cache,
db,
login_manager,
migrate,
debug_toolbar,
)
from ch... | antani/cheapr | cheapr/app.py | Python | bsd-3-clause | 1,780 |
#
# See top-level LICENSE.rst file for Copyright information
#
# -*- coding: utf-8 -*-
"""
desispec.pipeline
====================
Tools for pipeline creation and running.
"""
from __future__ import absolute_import, division, print_function
from . import tasks
from .defs import (task_states, prod_options_name,
ta... | desihub/desispec | py/desispec/pipeline/__init__.py | Python | bsd-3-clause | 637 |
#!/usr/bin/env python
# Copyright (c) 2015 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.
'''Unit tests for writers.android_policy_writer'''
import os
import sys
if __name__ == '__main__':
sys.path.append(os.path.join(o... | endlessm/chromium-browser | components/policy/tools/template_writers/writers/android_policy_writer_unittest.py | Python | bsd-3-clause | 3,381 |
#!/usr/bin/env python
from setuptools import setup, find_packages
import versioneer
setup(name='conwhat', #version=versioneer.get_version(),
description='python library for connectome-based white matter atlas analyses in neuroimaging',
long_description='python library for connectome-based white matter at... | JohnGriffiths/ConWhAt | setup.py | Python | bsd-3-clause | 1,353 |
# coding=UTF-8
from datetime import timedelta
import resource
import time
import urllib
from django.core.exceptions import ObjectDoesNotExist
from snh.models.youtubemodel import *
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
import snhlogger
logger = snhlogger.init_logger(__name__, ... | pylanglois/Social-Network-Harvester | SocialNetworkHarvester/snh/management/commands/cronharvester/youtubech.py | Python | bsd-3-clause | 8,013 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.