code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
import yaml
import json
from pprint import pprint
with open('my_list.yml') as f:
new_yaml_list = yaml.load(f)
pprint(new_yaml_list)
with open('my_list.json') as g:
new_json_list = json.load(g)
pprint(new_json_list)
| ccherian/W1 | ex7.py | Python | apache-2.0 | 238 |
"""CorEx Hierarchical Topic Models
Use the principle of Total Cor-relation Explanation (CorEx) to construct
hierarchical topic models. This module is specially designed for sparse count
data and implements semi-supervision via the information bottleneck.
Greg Ver Steeg and Aram Galstyan. "Maximally Informative Hierar... | gregversteeg/corex_topic | corextopic/corextopic.py | Python | apache-2.0 | 31,413 |
# -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Crisis Mapping Toolkit (CMT) v1 platform is licensed under the Apache
#... | asurunis/CrisisMappingToolkit | bin/test_active_contour.py | Python | apache-2.0 | 8,927 |
# 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
# d... | rahulunair/nova | nova/tests/functional/test_boot_from_volume.py | Python | apache-2.0 | 10,599 |
# Copyright 2013 Red Hat, 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 agr... | ozamiatin/oslo.messaging | oslo_messaging/rpc/server.py | Python | apache-2.0 | 9,230 |
def equalPairOfBits(n, m):
return 2 ** [i for i in range(min(len(bin(n)[2:].zfill(30)), len(bin(m)[2:].zfill(30)))) if bin(n)[2:].zfill(30)[::-1][i] == bin(m)[2:].zfill(30)[::-1][i] == '1' or bin(n)[2:].zfill(30)[::-1][i] == bin(m)[2:].zfill(30)[::-1][i] == '0'][0] if len([i for i in range(min(len(bin(n)[2:].zfill... | emirot/codefights | the_core/equalPairOfBits.py | Python | apache-2.0 | 524 |
"""
tests.pytests.conftest
~~~~~~~~~~~~~~~~~~~~~~
"""
import functools
import inspect
import logging
import os
import shutil
import stat
import sys
import attr
import pytest
import salt.ext.tornado.ioloop
import salt.utils.files
import salt.utils.platform
from salt.serializers import yaml
from saltfactories.ut... | saltstack/salt | tests/pytests/conftest.py | Python | apache-2.0 | 17,614 |
"""
pygments.lexers.ruby
~~~~~~~~~~~~~~~~~~~~
Lexers for Ruby and related languages.
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import Lexer, RegexLexer, ExtendedRegexLexer, include, \
bygroups,... | sonntagsgesicht/regtest | .aux/venv/lib/python3.9/site-packages/pygments/lexers/ruby.py | Python | apache-2.0 | 22,653 |
import zstackwoodpecker.test_state as ts_header
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template2",
path_list=[[TestAction.create_volume, "volume1", "=scsi"],\
[TestAction.attach_volume, "vm1", "volume1"], \
[TestAction.create_volume, "volume2", "=scsi"],\
[TestAction.clea... | zstackio/zstack-woodpecker | integrationtest/vm/multihosts/volumes/paths/path139.py | Python | apache-2.0 | 1,258 |
"""DO NOT MODIFY. Auto-generated by script/fingerprint_frontend."""
FINGERPRINTS = {
"compatibility.js": "8e4c44b5f4288cc48ec1ba94a9bec812",
"core.js": "d4a7cb8c80c62b536764e0e81385f6aa",
"frontend.html": "fbb9d6bdd3d661db26cad9475a5e22f1",
"mdi.html": "f407a5a57addbe93817ee1b244d33fbe",
"micromark... | shaftoe/home-assistant | homeassistant/components/frontend/version.py | Python | apache-2.0 | 1,379 |
# adapted from https://lsandig.org/blog/2014/08/apollon-python/en/
from cmath import sqrt
import math
class Circle(object):
"""
A circle represented by center point as complex number and radius.
"""
def __init__ ( self, mx, my, r ):
"""
@param mx: x center coordinate
@param my:... | 5agado/data-science-learning | graphics/blender/apollonian_gaskets.py | Python | apache-2.0 | 4,357 |
# -*- coding: utf-8 -*-
from apis.verification import create_token
from apis.exception import Unauthorized
from . import Resource
class OauthToken(Resource):
async def post(self, request):
is_validate, token = create_token(request)
if not is_validate:
raise Unauthorized('unauthorize... | gusibi/Metis | apis/auth/api/oauth_token.py | Python | apache-2.0 | 386 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License... | quattor/aquilon | lib/aquilon/worker/commands/search_network_device.py | Python | apache-2.0 | 4,003 |
import MySQLdb
from CamelUtils import CamelUtils
class DbManager:
# connection params
hostName = ""
userName = ""
passwd = ""
dbName = ""
connection = None
def __init__(self):
params = CamelUtils().getConnectionParams()
self.hostName = params[0]
self.userName = ... | tomasz-galuszka/camel-db | camel/DbManager.py | Python | apache-2.0 | 1,341 |
from django.apps import apps
from django.core.management.commands.startapp import Command as StartAppCommand
from django_mako_plus.management.mixins import DMPCommandMixIn
import os, os.path, platform
NOT_SET = object()
class Command(DMPCommandMixIn, StartAppCommand):
help = (
"Creates a DMP app direct... | doconix/django-mako-plus | django_mako_plus/management/commands/dmp_startapp.py | Python | apache-2.0 | 1,873 |
import hashlib
import json
import os
import sys
from Queue import PriorityQueue
from bson.json_util import dumps
from pymongo import MongoClient
import storm
'''
========================================
ENOW CODE EXECUTION MODULE
========================================
Description :
This module is f... | ENOW-IJI/storm | resources/resources/executingBolt.py | Python | apache-2.0 | 8,691 |
# Copyright 2012, Nachi Ueno, NTT MCL, 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
#
# Unles... | cloudbase/neutron-virtualbox | neutron/plugins/metaplugin/meta_neutron_plugin.py | Python | apache-2.0 | 17,438 |
import ast
import sys
from PIL import Image as im
import matplotlib.pyplot as plt
import numpy as np
import theano.tensor as tt
from theano import shared, config, function
from theanet.layer import ElasticLayer
config.exception_verbosity = 'high'
config.optimizer = 'fast_compile'
np.set_printoptions(precision=2)
####... | ilyakava/theanet | tests/test_elastic.py | Python | apache-2.0 | 3,262 |
# Copyright (c) 2012 OpenStack Foundation.
#
# 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... | Brocade-OpenSource/OpenStack-DNRM-Neutron | neutron/common/constants.py | Python | apache-2.0 | 2,119 |
#!/usr/bin/env python
import sys, subprocess
import rrdtool, tempfile, time
#fd, path= tempfile.mkstemp('t.png')
MINUTE=100
HALFHOUR=1800
DAY=86400
YEAR=365 * DAY
a=0
var=""
while a == 0 :
var=subprocess.Popen(("netstat", "-s"), stdout=subprocess.PIPE)
var_o=subprocess.check_output(("grep", "OutOctets"), stdin=v... | irl/womaas | rrd/network.py | Python | bsd-2-clause | 1,182 |
import json
from django import forms
from django.conf import settings
from django.utils.encoding import force_str
from django.utils.http import urlencode
from selectable import __version__
from selectable.forms.base import import_lookup_class
__all__ = (
'AutoCompleteWidget',
'AutoCompleteSelectWidget',
... | mlavin/django-selectable | selectable/forms/widgets.py | Python | bsd-2-clause | 8,532 |
from unittest import mock
from django import forms
from django.db import IntegrityError, transaction
from django.test import TestCase
from incuna_test_utils.utils import field_names
from conman.routes import handlers
from conman.routes.models import Route
from tests.models import NestedRouteSubclass, RouteSubclass
f... | meshy/django-conman | tests/routes/test_models.py | Python | bsd-2-clause | 19,201 |
"""Client frontend to the URY API.
---
Copyright (c) 2013, University Radio York.
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 notic... | UniversityRadioYork/lass-pyramid | common/api.py | Python | bsd-2-clause | 4,079 |
import os
import io
import json_encoder
import file_utils
import config
import zipfile
from lxml import objectify, etree
from converter.nsl.nsl_converter import NslConverter
from converter.nsl.nsl_dictionary_converter import NslDictionaryConverter
from converter.nsl.other.nsl_other_converter import NslOtherConverter
... | c0d3m0nkey/xml-to-json-converter | app/nsl_ingestor.py | Python | bsd-2-clause | 2,124 |
# encoding: utf-8
# module gi._glib._glib
# from /usr/lib/python2.7/dist-packages/gi/_glib/_glib.so
# by generator 1.130
# no doc
# imports
import gi._glib as __gi__glib
# Variables with simple values
IO_ERR = 8
IO_FLAG_APPEND = 1
IO_FLAG_GET_MASK = 31
IO_FLAG_IS_READABLE = 4
IO_FLAG_IS_SEEKABLE = 16
IO_FLAG_IS_... | akiokio/centralfitestoque | src/.pycharm_helpers/python_stubs/-1807332816/gi/_glib/_glib.py | Python | bsd-2-clause | 19,730 |
from .vector3d import Vector3d
from .point import PointBase
class Point3d(Vector3d, PointBase):
"""Functionally similar to a Vector3d, but concpetually distinct, and
includes several additional methods.
"""
def __init__(self, *args, **kwargs):
Vector3d.__init__()
PointBase.__init__()
... | bengolder/python-geometry | geometry/point3d.py | Python | bsd-2-clause | 772 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import funannotate.library as lib
import funannotate.resources as resources
def main(args):
# setup funannotate DB path
try:
FUNDB = os.environ["FUNANNOTATE_DB"]
except KeyError:
print('$FUNANNOTATE_DB not found, run funan... | nextgenusfs/funannotate | funannotate/database.py | Python | bsd-2-clause | 2,275 |
"""A group of functions to help Python 2 act like Python 3"""
import sys
def run_script(path, globals=None, locals=None):
# In Python 2, we can use execfile(...), but in Python 3 that function
# doesn't exist, and we instead use exec(open(...)). Since the latter
# approach always works, just use t... | belson17/modred | modred/py2to3.py | Python | bsd-2-clause | 1,947 |
# Copyright (c) 2017, Djaodjin 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:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | djaodjin/djaodjin-deployutils | deployutils/apps/django/management/commands/referenced_assets.py | Python | bsd-2-clause | 2,360 |
# -*- coding: utf-8 -*-
from optparse import make_option
import json
import os
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from healthsites.map_clustering import cluster
from healthsites.models.healthsite import Healthsite
class Command(BaseCommand):
args =... | cchristelis/watchkeeper | django_project/healthsites/management/commands/gen_cluster_cache.py | Python | bsd-2-clause | 1,579 |
#!/usr/bin/python
#
# FishPi - An autonomous drop in the ocean
#
# Calibrate ESC through PWM controller
#
import raspberrypi
from time import sleep
from drive_controller import DriveController
from drive_controller import AdafruitDriveController
if __name__ == "__main__":
print "Calibrating ESC"
drive = Ada... | FishPi/FishPi-POCV---Command---Control | fishpi/vehicle/calibrateESC.py | Python | bsd-2-clause | 845 |
from spa.api.v1.BaseResource import BaseResource
from spa.models.chatmessage import ChatMessage
class ChatResource(BaseResource):
class Meta:
queryset = ChatMessage.objects.all().order_by('-timestamp')
resource_name = 'chat'
| fergalmoran/dss | spa/api/v1/ChatResource.py | Python | bsd-2-clause | 246 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from distutils.core import setup
pkg_name = 'symneqsys'
version_ = '0.0.1'
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent"... | bjodah/symneqsys | setup.py | Python | bsd-2-clause | 1,852 |
#
# Scroll multiple streams of text, one pixel-column at a time
# on to the terminal.
#
# Copyright 2014 by John K. Hinsdale <hin@alma.com>
# Use under BSD license with above copyright notice(s) retained.
import ledfont
from collections import deque
# Text scroll object, handles multiple lines of text
class TextScrol... | jhinsdale/arduino-rgb-matrix | font/text_scroll.py | Python | bsd-2-clause | 2,658 |
"""
Caching example. The object has a readonly property "data", that gets
automatically set when the "source" property gets set. The
download_data handler takes care of updating data when necesary.
This example aims for an analog of "streams" as they are used in
reactive programming. In RP, the data property would be ... | JohnLunzer/flexx | flexx/event/examples/caching.py | Python | bsd-2-clause | 1,252 |
#! /usr/bin/env python
'''
ekm
Numerically integrate only the octupole term of the equations of motion of
a hierarchical triple. This procedure averages over not only the
individual orbits, but also the individual KL cycles as well.
'''
# Ignore DeprecationWarnings if called from command line
if __name__ == '__main... | joe-antognini/triplesec | ekm.py | Python | bsd-2-clause | 11,543 |
# -*- coding: utf-8 -*-
#
# Wooey documentation build configuration file, created by
# sphinx-quickstart on Thu Dec 12 15:30:39 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | mfitzp/padua | docs/conf.py | Python | bsd-2-clause | 9,770 |
#!/usr/bin/env python
"""
@package mi.dataset.driver
@file mi/dataset/driver/flort_dj/cspp/flort_dj_cspp_telemetered_driver.py
@author Jeff Roy
@brief Driver for the flort_dj_cspp instrument
Release notes:
Initial Release
"""
from mi.dataset.dataset_parser import DataSetDriverConfigKeys
from mi.dataset.dataset_driv... | JeffRoy/mi-dataset | mi/dataset/driver/flort_dj/cspp/flort_dj_cspp_telemetered_driver.py | Python | bsd-2-clause | 2,106 |
#! /usr/bin/env python
#
# SCons - a Software Constructor
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation
#
# 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 Softwa... | frew/simpleproto | sconsign.py | Python | bsd-2-clause | 16,572 |
from __future__ import print_function
import sys
import math
class InputParameters:
def __init__(self):
self.v = 0.0
self.theta = 0.0
self.p_target = 0.0
| JacquesCarette/literate-scientific-software | code/drasil-example/Drasil/Projectile/src/InputParameters.py | Python | bsd-2-clause | 196 |
from datetime import datetime, timedelta
from time import sleep
import unittest
import uuid
from sqlalchemy import (
Column,
ForeignKey,
Integer,
Unicode,
UnicodeText,
UniqueConstraint,
func,
inspect,
)
from sqlalchemy.dialects import postgresql
from sqlalchemy.exc import IntegrityError... | hasgeek/coaster | tests/test_sqlalchemy_models.py | Python | bsd-2-clause | 53,493 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014-2015, Ghislain Antony Vaillant
# All rights reserved.
#
# This file is distributed under the BSD License, see the LICENSE file or
# checkout the license terms at http://opensource.org/licenses/BSD-2-Clause).
from __future__ import absolute_import, division, print_function... | ghisvail/ismrmrdpy | ismrmrdpy/ismrmrd.py | Python | bsd-2-clause | 4,383 |
__all__ = ['PaypalHandler', 'PersonHandler', 'ThankyouHandler', 'CancelHandler', 'StepbyStepHandler', 'ListAllHandler', 'IndexHandler']
from .person import PersonHandler
from .pay import PaypalHandler
from .thankyou import ThankyouHandler
from .cancel import CancelHandler
from .stepbystep import StepbyStepHandler
from... | uthcode/baysourashtra | handlers/__init__.py | Python | bsd-2-clause | 383 |
from __future__ import print_function, absolute_import
import os
import subprocess
import sys
import time
import argparse
import io
import conda
from distutils.version import LooseVersion
from conda_build.metadata import MetaData
from conda_build.utils import ensure_list
from . import configure_feedstock
from . impo... | shadowwalkersb/conda-smithy | conda_smithy/cli.py | Python | bsd-3-clause | 12,147 |
# Userena settings file.
#
# Please consult the docs for more information about each setting.
from django.conf import settings
gettext = lambda s: s
USERENA_SIGNIN_AFTER_SIGNUP = getattr(settings,
'USERENA_SIGNIN_AFTER_SIGNUP',
False)
USERE... | botify-labs/django-userena | userena/settings.py | Python | bsd-3-clause | 4,473 |
# BSD 3-Clause License
#
# Copyright (c) 2019, Elasticsearch BV
# 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, t... | beniwohli/apm-agent-python | tests/instrumentation/asyncio_tests/aiopg_tests.py | Python | bsd-3-clause | 5,247 |
from __future__ import division
import abc
import numpy as np
from menpo.shape import mean_pointcloud
from menpo.transform import Scale, Translation, GeneralizedProcrustesAnalysis
from menpo.model.pca import PCAModel
from menpo.visualize import print_dynamic, progress_bar_str
from .base import is_pyramid_on_features
... | mrgloom/menpofit | menpofit/builder.py | Python | bsd-3-clause | 6,176 |
"""
FilmLight E-Gamut Colourspace
=============================
Defines the *FilmLight E-Gamut* colourspace:
- :attr:`colour.models.RGB_COLOURSPACE_FILMLIGHT_E_GAMUT`.
References
----------
- :cite:`Siragusano2018a` : Siragusano, D. (2018). Private Discussion with
Shaw, Nick.
"""
from __future__ import anno... | colour-science/colour | colour/models/rgb/datasets/filmlight_egamut.py | Python | bsd-3-clause | 2,488 |
from dolfin import *
import numpy
import sympy
import sympy_interface as S
import tabulate
parameters["form_compiler"]["cpp_optimize"] = True
set_log_level(ERROR)
### utils #################################################################
def my_mixed_function_space(Vs):
""" My convenient handler for mixed functio... | lzlarryli/feeclotexp | src/3d-1-form.py | Python | bsd-3-clause | 8,490 |
import requests
class Response(object):
def __init__(self, base_url, response):
self.response = response
self.base_url = base_url
self.json = self.response.json
def download_url(self, filename=None):
url_parts = [self.base_url, self.json['download_path']]
if filename i... | peterlandry/unbrowser-python | unbrowser/base.py | Python | bsd-3-clause | 1,134 |
# This file is part of the Astrometry.net suite.
# Licensed under a 3-clause BSD style license - see LICENSE
from __future__ import print_function
from astrometry.util.fits import fits_table
from ngc2000 import ngc2000, ngc2000accurate
from astrometry.util.fits import *
if __name__ == '__main__':
T = fits_table... | olebole/astrometry.net | catalogs/ngc2000tofits.py | Python | bsd-3-clause | 1,852 |
#!/usr/bin/env python
import os
import time
TEST_COUNT = 8
print "Running Automated Test Application...\n"
os.system("touch ../build/mica2/src/tests/automated/test.log")
os.remove("../build/mica2/src/tests/automated/test.log")
os.system("touch ../build/mica2/src/tests/automated/test.log")
os.chdir("../src/tests/aut... | turon/mantis | scripts/run_tests.py | Python | bsd-3-clause | 590 |
# coding=utf-8
## web 到 内部状态1(Reply)
## tz = web_to_internal(url, pg_count)
##
## 内部状态1 到 编排
## internal_to_bp(tz)
##
## ----------------------------
##
## 编排 到 内部状态2(BPReply)
## lst = bp_to_internal2(infile)
##
## 处理 内部状态2
## lst = process_internal2(lst)
##
## 内部状态2 到 编排
## internal2_to_bp(lst)
##
## ---... | animalize/tz2txt | tz2txt/datamachine.py | Python | bsd-3-clause | 18,988 |
import os
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'dasdocc', # Or path to database file if using sqlite3.
'USER': 'root', # Not used with sql... | JohnRandom/django-aggregator | dasdocc/conf/base.py | Python | bsd-3-clause | 2,263 |
"""
kombu.connection
================
Broker connection and pools.
"""
from __future__ import absolute_import, unicode_literals
import os
import socket
from collections import OrderedDict
from contextlib import contextmanager
from itertools import count, cycle
from operator import itemgetter
# jython breaks on rel... | Elastica/kombu | kombu/connection.py | Python | bsd-3-clause | 33,769 |
from hashlib import md5
import re
from app import db
from app import app
from config import WHOOSH_ENABLED
import sys
if sys.version_info >= (3, 0):
enable_search = False
else:
enable_search = WHOOSH_ENABLED
import flask.ext.whooshalchemy as whooshalchemy
# Note that we are not declaring this table as a m... | staeff/megaflask | app/models.py | Python | bsd-3-clause | 5,157 |
# Copyright 2016 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
def InjectJavaScript(tab, js_file_name):
with open(os.path.join(os.path.dirname(__file__), js_file_name)) as f:
js = f.read()
tab.Execu... | endlessm/chromium-browser | third_party/catapult/telemetry/telemetry/internal/actions/utils.py | Python | bsd-3-clause | 337 |
# -*- coding: utf-8 -*-
"""
Check Django metadata
This checks that:
1. Every resource has a metadata entry.
2. Every metadata entry has a title.
More tests are left for later.
* By default, prints errors on stdout.
* Optional argument --log instead logs output to system log.
"""
from django.conf import settings
f... | hydroshare/hydroshare | hs_core/management/commands/check_django_metadata.py | Python | bsd-3-clause | 4,006 |
"""
TXT/IGOR 2D Q Map file reader
"""
#####################################################################
#This software was developed by the University of Tennessee as part of the
#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
#project funded by the US National Science Foundation.
#See the ... | SasView/sasview | src/sas/sascalc/dataloader/readers/red2d_reader.py | Python | bsd-3-clause | 11,495 |
from data_collection.management.commands import BaseXpressWebLookupCsvImporter
class Command(BaseXpressWebLookupCsvImporter):
council_id = 'E08000010'
addresses_name = 'WiganNewPropertyPollingStation_master.csv'
stations_name = 'WiganNewPropertyPollingStation_master.csv'
elections = [
... | chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_wigan.py | Python | bsd-3-clause | 399 |
def extractUndecentTranslations(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
return False
| fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractUndecentTranslations.py | Python | bsd-3-clause | 221 |
#
# ------------------------------------------------------------
# Copyright (c) All rights reserved
# SiLab, Institute of Physics, University of Bonn
# ------------------------------------------------------------
#
import logging
import serial
from basil.TL.TransferLayer import TransferLayer
logger = logging.getLog... | SiLab-Bonn/basil | basil/TL/Serial.py | Python | bsd-3-clause | 3,259 |
from decimal import Decimal
from django import forms
from django.template import loader
from django.template import RequestContext
from django.utils.translation import ugettext_lazy as _
from l10n.utils import moneyfmt
from livesettings import config_value, config_value_safe
from payment import signals
from payment.con... | goodguy/satchmo | satchmo/apps/payment/forms.py | Python | bsd-3-clause | 22,625 |
# -*- coding: utf-8 -*-
"""Algorithms for directed acyclic graphs (DAGs)."""
# Copyright (C) 2006-2016 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
from fractions import gcd
import heapq
import networkx a... | cmtm/networkx | networkx/algorithms/dag.py | Python | bsd-3-clause | 13,929 |
from qepy import *
from yambopy import *
class hBN_1l_test():
"""
Input files for hBN monolayer for testing purposes (i.e., UNCONVERGED)
"""
def __init__(self,prefix='bn_TEST',pseudo_path='./pseudos'):
self.prefix = prefix
self.pseudos = pseudo_path
self.scfin = self.scf()
... | alexmoratalla/yambopy | materials/hbn_test.py | Python | bsd-3-clause | 2,481 |
import sys,os
import wx
import wx.lib.scrolledpanel as scrolled
from jumeg.tsvgl.wxutils.jumeg_tsv_wxutils import DLGButtonPanel,ColorComboBoxDialog
try:
from agw import floatspin as FS
except ImportError: # if it's not there locally, try the wxPython lib.
import wx.lib.agw.floatspin as FS
"""
self.mvp[:,0... | fboers/jumegX | tsvgl/wxutils/jumeg_tsv_wx_dlg_group.py | Python | bsd-3-clause | 11,410 |
from custom_keras_model_and_fit_capsels import kaggle_winsol
import keras.backend as T
import keras.initializers as init
from keras.models import Sequential, Model
from keras.layers import Dense, Dropout, Input
from keras.layers.core import Lambda
# TODO will be removed from keras2, can this be achieved with a lambda
... | garbersc/keras-galaxies | custom_keras_model_x_cat_x_maxout.py | Python | bsd-3-clause | 14,597 |
from __future__ import division, absolute_import, print_function
import sys
import warnings
from decimal import Decimal
import numpy as np
from numpy.testing import *
assert np.einsum is not None
class TestEinSum(TestCase):
def test_einsum_errors(self):
# Need enough arguments
assert_raises(Valu... | NextThought/pypy-numpy | numpy/core/tests/test_einsum.py | Python | bsd-3-clause | 24,019 |
'''
Monkey patch setuptools to write faster console_scripts with this format:
import sys
from mymodule import entry_function
sys.exit(entry_function())
This is better.
(c) 2016, Aaron Christianson
http://github.com/ninjaaron/fast-entry_points
'''
from setuptools.command import easy_install
import re
TEMP... | steinnes/ebenv | fastentrypoints.py | Python | bsd-3-clause | 2,465 |
# -*- coding: utf-8 -*-
"""Media module
This module is for the writing and publishing of articles
and other such media.
"""
from . import views
| brotherjack/Rood-Kamer | roodkamer/media/__init__.py | Python | bsd-3-clause | 156 |
# -*- coding: utf-8 -*-
#
# kanjidic.py
# cjktools
#
"""
A nice interface to the Kanjidic dictionary.
"""
from __future__ import unicode_literals
import re
from itertools import chain
from cjktools import scripts
from cjktools.common import sopen
from cjktools.common import _ExitStack as ExitStack
from functools ... | larsyencken/cjktools | cjktools/resources/kanjidic.py | Python | bsd-3-clause | 5,341 |
# -*- coding: utf-8 -*-
"""
Spanish-specific Form helpers
"""
from __future__ import absolute_import, unicode_literals
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_la... | yakky/django-localflavor | localflavor/es/forms.py | Python | bsd-3-clause | 7,746 |
"""
Copyright (c) 2017, 2020 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
__version__ = "3.3.0"
| DBuildService/atomic-reactor | atomic_reactor/version.py | Python | bsd-3-clause | 207 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2017, Zhijiang Yao, Jie Dong and Dongsheng Cao
# All rights reserved.
# This file is part of the PyBioMed.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the PyBioMed source tree.
"""
#####... | gadsbyfly/PyBioMed | PyBioMed/PyMolecule/moe.py | Python | bsd-3-clause | 6,732 |
from __future__ import absolute_import
import six
from sentry.utils.compat.mock import patch
from sentry.models import IdentityProvider, Identity, Integration, OrganizationIntegration
from sentry.testutils import IntegrationTestCase
from sentry.integrations.example import ExampleIntegrationProvider, AliasedIntegrati... | beeftornado/sentry | tests/sentry/integrations/test_pipeline.py | Python | bsd-3-clause | 13,706 |
import datetime
import logging
import time
from google.appengine.api import memcache
from google.appengine.api import users
from google.appengine.ext import db
#from google.appengine.ext.db import djangoforms
#from django.forms import ModelForm
from django import forms
import settings
SIMPLE_TYPES = (int, long, fl... | modulexcite/chromium-dashboard | models.py | Python | bsd-3-clause | 19,669 |
# Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors
#
# This module is part of GitDB and is released under
# the New BSD License: http://www.opensource.org/licenses/bsd-license.php
"""Module containing information about types known to the database"""
#{ String types
# For compatability o... | Conjuro/GitPython | typ.py | Python | bsd-3-clause | 695 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | bokeh/bokeh | bokeh/protocol/__init__.py | Python | bsd-3-clause | 5,493 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Quantization'] , ['Lag1Trend'] , ['Seasonal_WeekOfYear'] , ['NoAR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Quantization/model_control_one_enabled_Quantization_Lag1Trend_Seasonal_WeekOfYear_NoAR.py | Python | bsd-3-clause | 166 |
from django.utils.translation import ugettext_lazy as _
TABLE_ID = _(
"Choose something short, unique, and memorable using "
"lowercase letters, numbers, and underscores")
REPORT_ID = _(
'The System ID of the report (sometimes needed in APIs or other advanced features)'
)
DATA_SOURCE_ID = _(
'The Syste... | dimagi/commcare-hq | corehq/apps/userreports/ui/help_text.py | Python | bsd-3-clause | 2,071 |
from typing import List, Any
from urllib.parse import urljoin
from ..base_rpc import BaseRPC
from ..exceptions import TorrtRPCException
from ..utils import make_soup, TorrentData
class UTorrentRPC(BaseRPC):
"""See http://www.utorrent.com/community/developers/webapi for protocol spec details.
idle sign: What... | idlesign/torrt | torrt/rpc/utorrent.py | Python | bsd-3-clause | 4,522 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-27 18:18
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('django_commandlog', '0001_... | achedeuzot/django-commandlog | django_commandlog/migrations/0002_auto_20161127_1818.py | Python | bsd-3-clause | 618 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dataset', '0013_featureddataset_revision'),
]
operations = [
migrations.AlterField(
model_name='featureddataset'... | poldracklab/open_fmri | open_fmri/apps/dataset/migrations/0014_auto_20151015_2320.py | Python | bsd-3-clause | 601 |
from distutils.core import setup
from setuptools import find_packages
setup(
name='banana',
version='2.0',
author='Gijs Molenaar',
author_email='gijsmolenaar%(at)sgmail.com' % {'at': '@'},
packages=find_packages(),
include_package_data=True,
url='https://github.com/gijzelaerr/banana',
l... | bartscheers/banana | setup.py | Python | bsd-3-clause | 840 |
import re
from django import template
WIKI_WORD = r'(?:[A-Z]+[a-z]+){2,}'
VALID_TITLE = r'^[A-Za-z0-9]+[A-Za-z0-9_]+'
register = template.Library()
wikifier = re.compile(r'\b(%s)\b' % WIKI_WORD)
@register.filter
def wikify(s):
from django.core.urlresolvers import reverse
wiki_root = reverse('wiki.views.i... | dannycamp/django-nowiki | templatetags/wiki.py | Python | bsd-3-clause | 413 |
# compare Brython stdlib and CPython stdlib
import os
import filecmp
import shutil
bdir = os.path.join(os.path.dirname(os.getcwd()),
"www", "src", "Lib")
p_old_dir = r'c:\Python39\Lib'
p_new_dir = r'c:\Python310\Lib'
for dirpath, dirnames, filenames in os.walk(bdir):
if "site-packages" in dirnames:
d... | brython-dev/brython | scripts/update_stlib_from_cpython.py | Python | bsd-3-clause | 2,283 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2021 The NiPreps Developers <nipreps@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... | oesteban/niworkflows | niworkflows/utils/tests/test_spaces.py | Python | bsd-3-clause | 3,424 |
#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# 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
# list ... | stephenlienharrell/roster-dns-management | test/audit_log_unittest.py | Python | bsd-3-clause | 6,793 |
from __future__ import absolute_import, unicode_literals
from collections import OrderedDict
from rest_framework.fields import Field, ReadOnlyField
from wagtail.api.v2.serializers import PageSerializer
from wagtail.api.v2.utils import get_full_url
from wagtail.wagtailcore.models import Page
def get_model_listing_u... | iansprice/wagtail | wagtail/wagtailadmin/api/serializers.py | Python | bsd-3-clause | 2,245 |
"""Classes representing the internal Packet Filter statistics and counters.
PFStatus objects contain a series of runtime statistical information describing
the current status of the Packet Filter.
"""
import time
from socket import ntohl
from pf.constants import *
from pf._struct import pf_status, pfi_kif
from pf._b... | dotpy/py-pf | pf/status.py | Python | bsd-3-clause | 9,958 |
from IPython.paths import get_ipython_dir
import os
def get_history_file(kernel):
"""Gets the history file for the kernel.
Histories are stored in ~/.ipython/metakernel/history
"""
base = get_ipython_dir()
dname = os.path.join(base, 'metakernel', 'history')
if not os.path.exists(dname):
... | Calysto/metakernel | metakernel/config.py | Python | bsd-3-clause | 944 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_modules = [Extension('fsdt_shadmehri2012_bc3',
['fsdt_shadmehri2012_bc3.pyx'],
extra_compile_args=['/openmp',
'/O2', '/favor:INTEL64'],... | albertoferna/compmech | compmech/conecyl/fsdt/setup_fsdt_shadmehri2012_bc3.py | Python | bsd-3-clause | 493 |
from __future__ import annotations
import random
import textwrap
from math import cos, pi, sin, sqrt
from dxtbx.model import BeamFactory, Detector, DetectorFactory, Panel
from libtbx.test_utils import approx_equal
from scitbx import matrix
from dials.algorithms.refinement.parameterisation.detector_parameters import ... | dials/dials | tests/algorithms/refinement/test_detector_parameters.py | Python | bsd-3-clause | 11,987 |
from .datasets import (
MUNSELL_COLOURS_ALL,
MUNSELL_COLOURS_1929,
MUNSELL_COLOURS_REAL,
MUNSELL_COLOURS,
)
from .munsell import MUNSELL_VALUE_METHODS
from .munsell import munsell_value
from .munsell import (
munsell_value_Priest1920,
munsell_value_Munsell1933,
munsell_value_Moon1943,
mu... | colour-science/colour | colour/notation/__init__.py | Python | bsd-3-clause | 1,115 |
from .widget import *
class SplitView(Widget):
HORIZONTAL = True
VERTICAL = False
def __init__(self, direction=VERTICAL):
super(SplitView, self).__init__()
self._impl = None
self._content = None
self.direction = direction
self.startup()
def startup(self):
... | gabrielcsapo/dobby | dobby/widgets/splitview.py | Python | bsd-3-clause | 1,411 |
# -*- coding: utf-8 -*-
#
# test_fs.py
# proj
#
import os
from os import path
import tempfile
import shutil
from proj import fs
class TestFs:
def setup_method(self):
self.old_cwd = os.getcwd()
self.base = tempfile.mkdtemp()
self.current = path.join(self.base, "current")
fs.mkdi... | larsyencken/proj | tests/test_fs.py | Python | bsd-3-clause | 944 |
from cwbot.modules.BaseDungeonModule import BaseDungeonModule, eventDbMatch
from cwbot.common.exceptions import FatalError
from cwbot.common.kmailContainer import Kmail
from cwbot.kolextra.request.UserProfileRequest import UserProfileRequest
import pytz
from copy import deepcopy
import itertools
from collections... | ijzer/cwbot-ndy | cwbot/modules/dread/DreadTimelineModule.py | Python | bsd-3-clause | 18,099 |
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 = "Lag1Trend", cycle_length = 12, transform = "RelativeDifference", sigma = 0.0, exog_count = 0, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_RelativeDifference/trend_Lag1Trend/cycle_12/ar_/test_artificial_32_RelativeDifference_Lag1Trend_12__0.py | Python | bsd-3-clause | 272 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# gae.py
#
# Copyright 2010 Pablo Alejandro Costesich <pcostesi@alu.itba.edu.ar>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# ... | pcostesi/pymemtools | memtools/storages/gae.py | Python | bsd-3-clause | 2,775 |
from __future__ import division, absolute_import, print_function
import os
import re
import sys
import copy
import glob
import atexit
import tempfile
import subprocess
import shutil
import multiprocessing
import textwrap
import distutils
from distutils.errors import DistutilsError
try:
from threading import local... | MSeifert04/numpy | numpy/distutils/misc_util.py | Python | bsd-3-clause | 84,609 |