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 |
|---|---|---|---|---|---|
# coding=utf-8
# Copyright 2017 The DLT2T Authors.
#
# 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 ... | renqianluo/DLT2T | DLT2T/utils/registry_test.py | Python | apache-2.0 | 7,045 |
# ===============================================================================
# Copyright 2014 Jake Ross
#
# 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... | UManPychron/pychron | pychron/hardware/environmental_probe.py | Python | apache-2.0 | 1,717 |
# Copyright 2015 Rackspace, 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 b... | rackerlabs/onmetal-scripts | onmetal_scripts/tests/test_reboot_unprovisioned.py | Python | apache-2.0 | 2,243 |
"""Voluptuous schemas for the KNX integration."""
import voluptuous as vol
from xknx.devices.climate import SetpointShiftMode
from homeassistant.const import (
CONF_ADDRESS,
CONF_DEVICE_CLASS,
CONF_ENTITY_ID,
CONF_HOST,
CONF_NAME,
CONF_PORT,
CONF_TYPE,
)
import homeassistant.helpers.config_... | tchellomello/home-assistant | homeassistant/components/knx/schema.py | Python | apache-2.0 | 14,928 |
#
# Copyright 2015 Fasih
#
# 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... | faskiri/barry2gugl | dn.py | Python | apache-2.0 | 3,915 |
#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCoun... | dominickhera/PosaRepo | cis3250labs/parseTest.py | Python | apache-2.0 | 2,244 |
"""
Support for KNX/IP climate devices.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/climate.knx/
"""
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.climate import (
PLATFORM_SCHEMA, SUP... | PetePriority/home-assistant | homeassistant/components/knx/climate.py | Python | apache-2.0 | 11,010 |
"""
WSGI config for comic 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`` se... | cpatrick/comic-django | django/comic/wsgi.py | Python | apache-2.0 | 1,360 |
import httplib
from pyamf import AMF0, AMF3
from pyamf import remoting
from pyamf.remoting.client import RemotingService
height = 1080
def build_amf_request(const, playerID, videoPlayer, publisherID):
env = remoting.Envelope(amfVersion=3)
env.bodies.append(
(
"/1",
remotin... | aplicatii-romanesti/allinclusive-kodi-pi | .kodi/addons/plugin.video.kidsplace/brightcovePlayer.py | Python | apache-2.0 | 1,587 |
"""
Overview of all settings which can be customized.
"""
from django.conf import settings
from parler import appsettings as parler_appsettings
FLUENT_CONTENTS_CACHE_OUTPUT = getattr(settings, 'FLUENT_CONTENTS_CACHE_OUTPUT', True)
FLUENT_CONTENTS_PLACEHOLDER_CONFIG = getattr(settings, 'FLUENT_CONTENTS_PLACEHOLDER_CO... | pombredanne/django-fluent-contents | fluent_contents/appsettings.py | Python | apache-2.0 | 658 |
# File permute.py
def permute1(seq):
if not seq: # Shuffle any sequence: list
return [seq] # Empty sequence
else:
res = []
for i in range(len(seq)):
rest = seq[:i] + seq[i+1:] # Delete current node
for... | dreadrel/UWF_2014_spring_COP3990C-2507 | notebooks/scripts/book_code/code/permute.py | Python | apache-2.0 | 865 |
from __future__ import absolute_import, unicode_literals
import django
from django.db import models
from django.utils.translation import ugettext_lazy as _
from .managers import QueueManager, MessageManager
class Queue(models.Model):
name = models.CharField(_('name'), max_length=200, unique=True)
objects ... | arcivanov/karellen-kombu-ext | src/main/python/karellen/kombu/transport/django/models.py | Python | apache-2.0 | 1,161 |
from givabit.backend.charity import Charity
from givabit.backend.errors import MissingValueException, MultipleValueException
from givabit.test_common import test_data
from givabit.test_common import test_utils
class CharityRepositoryTest(test_utils.TestCase):
def setUp(self):
super(CharityRepositoryTest, ... | illicitonion/givabit | src/givabit/backend/charity_repository_test.py | Python | apache-2.0 | 1,597 |
# -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology NV
#
# 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... | rogerthat-platform/rogerthat-backend | src-test/rogerthat_tests/mobicage/models/test_compressed_int_list.py | Python | apache-2.0 | 2,303 |
# 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
# distributed under the... | Lukasa/cryptography | tests/utils.py | Python | apache-2.0 | 14,122 |
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google-research/adamatch | semi_supervised_domain_adaptation/baseline.py | Python | apache-2.0 | 7,016 |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | akosel/incubator-airflow | tests/contrib/hooks/test_jira_hook.py | Python | apache-2.0 | 1,861 |
import sys
import click
from solar.core import testing
from solar.core import resource
from solar.system_log import change
from solar.system_log import operations
from solar.system_log import data
from solar.cli.uids_history import get_uid, remember_uid, SOLARUID
@click.group()
def changes():
pass
@changes.c... | dshulyak/solar | solar/solar/cli/system_log.py | Python | apache-2.0 | 2,234 |
# Copyright 2008-2012 Nokia Siemens Networks Oyj
#
# 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... | Senseg/robotframework | src/robot/reporting/logreportwriters.py | Python | apache-2.0 | 2,447 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2009,2010,2011,2012,2013,2014,2015,2016,2017 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ma... | quattor/aquilon | lib/aquilon/worker/commands/del_cluster_systemlist.py | Python | apache-2.0 | 1,563 |
#!/usr/bin/env python
from __future__ import with_statement
import argparse
import sys
import logging
import urllib, urllib2
import json
from fabric.operations import local
from fabric.api import hide
import yaml
VERSION = "0.0.1"
SERVER_FILE = ".server"
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
d... | creyer/nursery | nursery.py | Python | apache-2.0 | 7,857 |
from typing import Dict, List, Optional
from ray.tune.suggest.suggestion import Searcher, ConcurrencyLimiter
from ray.tune.suggest.search_generator import SearchGenerator
from ray.tune.trial import Trial
class _MockSearcher(Searcher):
def __init__(self, **kwargs):
self.live_trials = {}
self.count... | ray-project/ray | python/ray/tune/suggest/_mock.py | Python | apache-2.0 | 1,752 |
# Copyright 2014, 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 ... | dukhlov/oslo.messaging | oslo_messaging/_drivers/protocols/amqp/drivertasks.py | Python | apache-2.0 | 4,126 |
import sys
sys.path.insert(1, "../../../")
import h2o
def binop_plus(ip,port):
# Connect to h2o
h2o.init(ip,port)
iris = h2o.import_frame(path=h2o.locate("smalldata/iris/iris_wheader_65_rows.csv"))
rows, cols = iris.dim()
iris.show()
###########################################################... | ChristosChristofidis/h2o-3 | h2o-py/tests/testdir_munging/binop/pyunit_binop2_plus.py | Python | apache-2.0 | 3,072 |
#!/usr/bin/python
from __future__ import print_function
from guild.actor import Actor, actor_method, process_method, late_bind
class Dog(Actor):
@actor_method # Input - triggered by data coming in
def woof(self):
print("Woof", self)
@process_method # Process - triggered each time it's run
... | sparkslabs/guild | examples/dogs_go_woof_actors.py | Python | apache-2.0 | 988 |
import os
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from django.test import TestCase
from mock import patch, Mock
import re
import rdflib
from rdflib import RDF
from urllib import urlencode, u... | emory-libraries/readux | readux/books/tests/models.py | Python | apache-2.0 | 25,398 |
# Copyright (c) 2019 Verizon Media
# 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 require... | openstack/neutron-lib | neutron_lib/api/definitions/tag_ports_during_bulk_creation.py | Python | apache-2.0 | 1,024 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import unittest
from... | digwanderlust/pants | tests/python/pants_test/backend/jvm/targets/test_jvm_binary.py | Python | apache-2.0 | 9,783 |
#
# Copyright (c) SAS Institute 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 w... | sassoftware/rmake3 | rmake/cmdline/monitor.py | Python | apache-2.0 | 26,810 |
# A basic web server using sockets
import socket
PORT = 8090
MAX_OPEN_REQUESTS = 5
def process_client(clientsocket):
print(clientsocket)
data = clientsocket.recv(1024)
print(data)
web_contents = "<h1>Received</h1>"
f = open("myhtml.html", "r")
web_contents = f.read()
f.close()
web_headers = "HTT... | acs-test/openfda | PER_2017-18/clientServer/P1/server_web.py | Python | apache-2.0 | 1,505 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-os-config | google/cloud/osconfig_v1/types/__init__.py | Python | apache-2.0 | 4,373 |
#
# Copyright 2018 Analytics Zoo Authors.
#
# 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... | intel-analytics/analytics-zoo | pyzoo/test/zoo/chronos/detector/anomaly/test_ae_detector.py | Python | apache-2.0 | 2,541 |
from __future__ import absolute_import, unicode_literals
import os
from django import VERSION as DJANGO_VERSION
from django.utils.translation import ugettext_lazy as _
######################
# MEZZANINE SETTINGS #
######################
# The following settings are already defined with default values in
# the ``de... | nikdval/cloudSolar | solarApp/solar/settings.py | Python | artistic-2.0 | 11,845 |
import pyautogui, win32api, win32con, ctypes, autoit
from PIL import ImageOps, Image, ImageGrab
from numpy import *
import os
import time
import cv2
import random
from Bot import *
def main():
bot = Bot()
autoit.win_wait(bot.title, 5)
counter = 0
poitonUse = 0
cycle = True
fullCounter = 0
... | oyajiro/l2bot | hf/wl.py | Python | artistic-2.0 | 2,661 |
# Even Fibonacci numbers
# Problem 2
# Each new term in the Fibonacci sequence is generated by adding the
# previous two terms. By starting with 1 and 2, the first 10 terms will be:
# 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
# By considering the terms in the Fibonacci sequence whose values do not exceed
# four million... | nabilhassein/project-euler | p2.py | Python | bsd-2-clause | 638 |
from click.testing import CliRunner
from twelve_tone.cli import main
def test_main():
runner = CliRunner()
result = runner.invoke(main, [])
assert result.exit_code == 0
| accraze/python-twelve-tone | tests/test_twelve_tone.py | Python | bsd-2-clause | 186 |
import numpy as np
from numba import cuda, float32
from numba.cuda.testing import unittest, CUDATestCase
def generate_input(n):
A = np.array(np.arange(n * n).reshape(n, n), dtype=np.float32)
B = np.array(np.arange(n) + 0, dtype=A.dtype)
return A, B
class TestCudaNonDet(CUDATestCase):
def test_for_pr... | sklam/numba | numba/cuda/tests/cudapy/test_nondet.py | Python | bsd-2-clause | 1,378 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name = 'wechat-python-sdk',
version = '0.5.7',
keywords = ('wechat', 'sdk', 'wechat sdk'),
description = u'微信公众平台Python开发包',
long_description = open("README.rst").read(),
license = 'BSD License',
... | Beeblio/wechat-python-sdk | setup.py | Python | bsd-2-clause | 622 |
import sys
import itertools
from functools import reduce
from operator import iadd
import numpy
from PyQt4.QtGui import (
QFormLayout, QGraphicsRectItem, QGraphicsGridLayout,
QFontMetrics, QPen, QIcon, QPixmap, QLinearGradient, QPainter, QColor,
QBrush, QTransform, QGraphicsWidget, QApplication
)
from Py... | kwikadi/orange3 | Orange/widgets/unsupervised/owdistancemap.py | Python | bsd-2-clause | 26,035 |
#!/usr/bin/env python
from rdflib import Graph, BNode, Literal, URIRef
from rdflib.namespace import FOAF
from flask import Flask
import flask_rdf
import random
app = Flask(__name__)
# set up a custom formatter to return turtle in text/plain to browsers
custom_formatter = flask_rdf.FormatSelector()
custom_formatter.w... | hufman/flask_rdf | examples/browser_default.py | Python | bsd-2-clause | 751 |
"""
Commands for X-ray Diffraction
Note that an XRD camera must be installed!
"""
def setup_epics_shutter(prefix='13MARCCD4:'):
"""
Setup Epics shutter for CCD camera
open /close pv = 13IDA:m70.VAL (SSA H WID)
open val = 0.080, close val = -0.020
"""
caput(prefix+'cam1:ShutterOpenEPICS.... | newville/microprobe_docs | doc/macros/xrd.py | Python | bsd-2-clause | 7,656 |
# test_queue.py
# Created on: Dec 2, 2015
# Author: pchero
import os
import sys
import test_common
def main():
ast = test_common.Ami()
ast.username = sys.argv[1]
ast.password = sys.argv[2]
if ast.conn() == False:
print("Could not connect.")
return 1
# ... | pchero/asterisk-outbound | test/test_queue.py | Python | bsd-2-clause | 2,084 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jkyeung/XlsxWriter | xlsxwriter/test/comparison/test_chart_title01.py | Python | bsd-2-clause | 1,535 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-06 02:47
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operation... | italopaiva/your.car | yourcar/car/migrations/0001_initial.py | Python | bsd-2-clause | 2,468 |
"""Widget for creating classes from non-numeric attribute by substrings"""
import re
from itertools import count
import numpy as np
from AnyQt.QtWidgets import QGridLayout, QLabel, QLineEdit, QSizePolicy
from AnyQt.QtCore import QSize, Qt
from Orange.data import StringVariable, DiscreteVariable, Domain
from Orange.d... | cheral/orange3 | Orange/widgets/data/owcreateclass.py | Python | bsd-2-clause | 20,686 |
"""
This is a subfile for IsyClass.py
These funtions are accessable via the Isy class opj
"""
__author__ = 'Peter Shipley <peter.shipley@gmail.com>'
__copyright__ = "Copyright (C) 2013 Peter Shipley"
__license__ = "BSD"
import time
##
## Climate funtions
##
def load_clim(self):
""" Load climate data from ISY ... | fxstein/ISYlib-python | ISY/_isyclimate.py | Python | bsd-2-clause | 1,533 |
#!/usr/bin/env python3
from zested.main import main
if __name__ == "__main__":
main()
| Luthaf/Zested | Zested.py | Python | bsd-2-clause | 91 |
from __future__ import print_function
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import http, useragents
from streamlink.stream import HDSStream
from streamlink.stream import HLSStream
class TF1(Plugin):
url_re = re.compile(r"https?://(?:www\.)?(?:tf1\.fr/(\w+)/direct|(lci).fr/dire... | mmetak/streamlink | src/streamlink/plugins/tf1.py | Python | bsd-2-clause | 2,485 |
import bcrypt
def hash_password(password):
default_rounds = 14
bcrypt_salt = bcrypt.gensalt(default_rounds)
hashed_password = bcrypt.hashpw(password, bcrypt_salt)
return hashed_password
def check_password(password, hashed):
return bcrypt.checkpw(password, hashed)
| fdemian/Morpheus | api/Crypto.py | Python | bsd-2-clause | 288 |
# -*- coding: utf-8 -*-
import os
import requests
import time
import math
import datetime
import random
import envoy
import jsonfield
import logging
import urllib
from collections import defaultdict
from magic_repr import make_repr
from hashlib import md5, sha1
from django.db import models
from django.db.models import... | AllMyChanges/allmychanges.com | allmychanges/models.py | Python | bsd-2-clause | 55,463 |
# Copyright (c) 2012-2021, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "AWS Shield"
prefix = "shield"
class Action(BaseAction):
def __init__(self, action: str = None) -> None:
super(... | cloudtools/awacs | awacs/shield.py | Python | bsd-2-clause | 2,682 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0002_auto_20150326_1433'),
]
operations = [
migrations.RemoveField(
model_name='problem',
nam... | shanzi/tchelper | api/migrations/0003_auto_20150326_1435.py | Python | bsd-2-clause | 560 |
# DO NOT EDIT THIS FILE. This file will be overwritten when re-running go-raml.
from app import app
import gevent
from gevent.pywsgi import WSGIServer
from gevent.pool import Pool
from gevent import monkey
import signal
monkey.patch_all()
server = WSGIServer(('', 5000), app, spawn=Pool(None))
def stop():
se... | Jumpscale/go-raml | codegen/fixtures/congo/python_server/server.py | Python | bsd-2-clause | 425 |
"""
"""
# Created on 2016.08.09
#
# Author: Giovanni Cannata
#
# Copyright 2016, 2017 Giovanni Cannata
#
# This file is part of ldap3.
#
# ldap3 is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either v... | Varbin/EEH | _vendor/ldap3/protocol/formatters/validators.py | Python | bsd-2-clause | 5,077 |
#!/usr/bin/env python
"""
LeBLEU - Letter-edit / Levenshtein BLEU
"""
import logging
#__all__ = []
__version__ = '0.0.1'
__author__ = 'Stig-Arne Gronroos'
__author_email__ = "stig-arne.gronroos@aalto.fi"
_logger = logging.getLogger(__name__)
def get_version():
return __version__
# The public api imports nee... | Waino/LeBLEU | lebleu/__init__.py | Python | bsd-2-clause | 670 |
import cStringIO
import zlib
import wx
#----------------------------------------------------------------------
def getMailData():
return zlib.decompress(
"x\xda\x01M\x01\xb2\xfe\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00 \x00\
\x00\x00 \x08\x06\x00\x00\x00szz\xf4\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\... | doudz/checkfeedmail | icon.py | Python | bsd-2-clause | 9,632 |
import flask; from flask import request
import os
import urllib.parse
from voussoirkit import flasktools
from voussoirkit import gentools
from voussoirkit import stringtools
import etiquette
from .. import common
site = common.site
session_manager = common.session_manager
# Individual albums ######################... | voussoir/etiquette | frontends/etiquette_flask/backend/endpoints/album_endpoints.py | Python | bsd-2-clause | 9,106 |
#!/usr/bin/env python
import sys
def ip2str(ip):
l = [
(ip >> (3*8)) & 0xFF,
(ip >> (2*8)) & 0xFF,
(ip >> (1*8)) & 0xFF,
(ip >> (0*8)) & 0xFF,
]
return '.'.join([str(i) for i in l])
def str2ip(line):
a, b, c, d = [int(s) for s in line.split('.')]
ip = 0
ip +... | owalch/oliver | linux/config/scripts/ipblock.py | Python | bsd-2-clause | 870 |
"""
Workaround for a conda-build bug where failing to compile some Python files
results in a build failure.
See https://github.com/conda/conda-build/issues/1001
"""
import os
import sys
py2_only_files = []
py3_only_files = [
'numba/tests/annotation_usecases.py',
]
def remove_files(basedir):
"""
R... | stefanseefeld/numba | buildscripts/remove_unwanted_files.py | Python | bsd-2-clause | 764 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import random
import sys
class DayLife:
"""Life in a day."""
def __init__(self, date, life):
"""Set birth datetime and life."""
self.birthdate = date
self.life = life
finalyear = self.birthdate.year + self.life
... | wakamori/GoForIt | 1/1-2.py | Python | bsd-2-clause | 1,719 |
# -*- coding: utf-8 -*-
"""
The scheduler is responsible for the module handling.
"""
import modules
from importlib import import_module
from additional.Logging import Logging
################################################################################
class Scheduler():
"""
This class instantiates the... | andreas-kowasch/DomainSearch | DomainSearchViewer/additional/Scheduler.py | Python | bsd-2-clause | 3,767 |
from django.conf.urls import patterns, include, url
from django.shortcuts import redirect, render_to_response
from django.template.context import RequestContext
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
# Just redirect / to /blog for now until I can
# co... | Justasic/StackSmash | StackSmash/urls.py | Python | bsd-2-clause | 3,146 |
import sys
import collections
class GeocoderResult(collections.Iterator):
"""
A geocoder resultset to iterate through address results.
Exemple:
results = Geocoder.geocode('paris, us')
for result in results:
print(result.formatted_address, result.location)
Provide shortcut to ease fiel... | zoeren/pygeocoder | pygeolib.py | Python | bsd-3-clause | 4,972 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
from djangocms_carousel import __version__
INSTALL_REQUIRES = [
]
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
... | mirskytech/djangocms-carousel | setup.py | Python | bsd-3-clause | 1,241 |
from scout.parse.variant.rank_score import parse_rank_score
from scout.parse.variant.variant import parse_variant
def test_parse_rank_score():
## GIVEN a rank score string on genmod format
rank_scores_info = "123:10"
variant_score = 10.0
family_id = "123"
## WHEN parsing the rank score
parsed_... | Clinical-Genomics/scout | tests/parse/test_parse_rank_score.py | Python | bsd-3-clause | 1,288 |
import amitgroup as ag
import numpy as np
ag.set_verbose(True)
# This requires you to have the MNIST data set.
data, digits = ag.io.load_mnist('training', selection=slice(0, 100))
pd = ag.features.PartsDescriptor((5, 5), 20, patch_frame=1, edges_threshold=5, samples_per_image=10)
# Use only 100 of the digits
pd.tr... | amitgroup/amitgroup | examples/parts_descriptor_test.py | Python | bsd-3-clause | 608 |
from django.contrib.gis.geoip2 import GeoIP2
from geoip2.errors import GeoIP2Error
from ipware import get_client_ip
def get_location_from_ip(request):
client_ip, is_routable = get_client_ip(request)
if client_ip is not None:
g = GeoIP2()
try:
record = g.city(client_ip)
exc... | richardcornish/smsweather | emojiweather/utils/utils.py | Python | bsd-3-clause | 596 |
# BinGrep, version 1.0.0
# Copyright 2017 Hiroki Hada
# coding:UTF-8
import sys, os, time, argparse
import re
import pprint
#import pydot
import math
import cPickle
import ged_node
from idautils import *
from idc import *
import idaapi
def idascript_exit(code=0):
idc.Exit(code)
def get_short_function_name(functi... | hada2/bingrep | bingrep_dump.py | Python | bsd-3-clause | 8,471 |
# -*- python -*-
# stdlib imports ---
import os
import os.path as osp
import textwrap
# waf imports ---
import waflib.Utils
import waflib.Logs as msg
from waflib.Configure import conf
#
_heptooldir = osp.dirname(osp.abspath(__file__))
def options(opt):
opt.load('hwaf-base', tooldir=_heptooldir)
opt.add_op... | hwaf/hwaf | py-hwaftools/find_cmake.py | Python | bsd-3-clause | 1,951 |
# ----------------------------------------------------------------------------
# Copyright (c) 2008 Andrew D. Straw and Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistr... | bitcraft/pyglet | contrib/experimental/input/xinput.py | Python | bsd-3-clause | 9,260 |
# Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
from wtforms import validators
from ..forms import ModelForm
from digits import utils
class ImageModelForm(ModelForm):
"""
Defines the form used to create a new ImageModelJob
"""
crop_size = ... | Deepomatic/DIGITS | digits/model/images/forms.py | Python | bsd-3-clause | 3,851 |
from setuptools import setup, find_packages
import os
# The version of the wrapped library is the starting point for the
# version number of the python package.
# In bugfix releases of the python package, add a '-' suffix and an
# incrementing integer.
# For example, a packaging bugfix release version 1.4.4 of the
# j... | mmariani/js.chosen | setup.py | Python | bsd-3-clause | 1,226 |
"""myproject URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | greven/vagrant-django | project_name/urls.py | Python | bsd-3-clause | 993 |
__author__ = 'Cedric Da Costa Faro'
from flask import render_template
from . import main
@main.app_errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
@main.app_errorhandler(405)
def method_not_allowed(e):
return render_template('405.html'), 405
@main.app_errorhandler(500)
de... | cdcf/time_tracker | app/main/errors.py | Python | bsd-3-clause | 392 |
"""
PostgreSQL Session API
======================
The Session classes wrap the Queries :py:class:`Session <queries.Session>` and
:py:class:`TornadoSession <queries.tornado_session.TornadoSession>` classes
providing environment variable based configuration.
Environment variables should be set using the ``PGSQL[_DBNAME]... | sprockets/sprockets.clients.postgresql | sprockets/clients/postgresql/__init__.py | Python | bsd-3-clause | 5,585 |
__author__ = 'Robert Meyer'
try:
import scoop
except ImportError:
scoop = None
def scoop_not_functional_check():
if scoop is not None and scoop.IS_RUNNING:
print('SCOOP mode functional!')
return False
else:
print('SCOOP NOT running!')
return True
from pypet.tests.in... | SmokinCaterpillar/pypet | pypet/tests/integration/environment_scoop_test.py | Python | bsd-3-clause | 6,504 |
"""
These URL patterns are included in two different ways in the main urls.py, with
an extra argument present in one case. Thus, there are two different ways for
each name to resolve and Django must distinguish the possibilities based on the
argument list.
"""
from django.conf.urls import url
from .views imp... | yephper/django | tests/urlpatterns_reverse/included_urls2.py | Python | bsd-3-clause | 489 |
#!/usr/bin/env python
"""
New Drawing class to create new mark and style on axes.
"""
# from copy import deepcopy, copy
from decimal import Decimal
import numpy as np
import toyplot
# from .Admixture import AdmixEdges
# for setting values from iterables
ITERABLE = (list, tuple, np.ndarray)
class GridSetup:
"... | eaton-lab/toytree | toytree/CanvasSetup.py | Python | bsd-3-clause | 9,455 |
# Copyright (c) 2014, Salesforce.com, 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 source code must retain the above copyright
# notice, this list of conditions... | forcedotcom/distributions | distributions/util.py | Python | bsd-3-clause | 7,375 |
"""
Read a dictionary from a JSON file,
and add its contents to a Python dictionary.
"""
import json
import types
from instmakelib import rtimport
INSTMAKE_SITE_DIR = "instmakesite"
# These are the supported field names
# ===================================
# The name of the plugin (without ".py") for logging
# usa... | gilramir/instmake | instmakelib/jsonconfig.py | Python | bsd-3-clause | 999 |
''' Renderers for various kinds of annotations that can be added to
Bokeh plots
'''
from __future__ import absolute_import
from six import string_types
from ..core.enums import (AngleUnits, Dimension, FontStyle, LegendClickPolicy, LegendLocation,
Orientation, RenderMode, SpatialUnits, Verti... | rs2/bokeh | bokeh/models/annotations.py | Python | bsd-3-clause | 34,179 |
# Copyright (c) 2008, Stefano Taschini <taschini@ieee.org>
# All rights reserved.
# See LICENSE for details.
import unittest
from interval import interval, fpu
class FpuTestCase(unittest.TestCase):
def test_third(self):
"Nearest rounding of 1/3 is downwards."
self.assertEqual(1/3.0, fpu.down(lam... | abarnert/pyinterval | test/test_basic.py | Python | bsd-3-clause | 13,302 |
import threading
from ctypes import POINTER, Structure, byref, c_char, c_char_p, c_int, c_size_t
from django.contrib.gis.geos.base import GEOSBase
from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOSFuncFactory
from django.contrib.gis.geos.prototypes.errcheck import (
check_geom, check_sized_string, check_st... | erikr/django | django/contrib/gis/geos/prototypes/io.py | Python | bsd-3-clause | 11,671 |
"""
Downloads the following:
- Korean Wikipedia texts
- Korean
"""
from sqlparse import parsestream
from sqlparse.sql import Parenthesis
for statement in parsestream(open('data/test.sql')):
texts = [str(token.tokens[1].tokens[-1]).decode('string_escape') for token in statement.tokens if isinstance(token, Parent... | carpedm20/Bias | scripts/download.py | Python | bsd-3-clause | 449 |
"""
Methods to characterize image textures.
"""
import numpy as np
from ._texture import _glcm_loop, _local_binary_pattern
def greycomatrix(image, distances, angles, levels=256, symmetric=False,
normed=False):
"""Calculate the grey-level co-occurrence matrix.
A grey level co-occurence matr... | SamHames/scikit-image | skimage/feature/texture.py | Python | bsd-3-clause | 10,468 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'mptt',
'cms',
'menus',
'djangocms_inherit',
'south',
]
DATABASES = {
... | divio/djangocms-inherit | schemamigration.py | Python | bsd-3-clause | 1,455 |
# Copyright (c) 2016, the GPyOpt Authors
# Licensed under the BSD 3-clause license (see LICENSE.txt)
from ...models import GPModel
import numpy as np
class CostModel(object):
"""
Class to handle the cost of evaluating the function.
param cost_withGradients: function that returns the cost of evaluating ... | SheffieldML/GPyOpt | GPyOpt/core/task/cost.py | Python | bsd-3-clause | 2,686 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2015, MuChu Hsu
Contributed by Muchu Hsu (muchu1983@gmail.com)
This file is part of BSD license
<https://opensource.org/licenses/BSD-3-Clause>
"""
from selenium import webdriver
import os
import time
import logging
import re
import random
from cameo.utility import Utility
from... | muchu1983/104_cameo | cameo/spiderForTECHORANGE.py | Python | bsd-3-clause | 7,806 |
import itertools
import os
import re
from abc import ABC, abstractmethod
from glob import glob
from pathlib import Path
import numpy as np
import torch
from PIL import Image
from ..io.image import _read_png_16
from .utils import verify_str_arg
from .vision import VisionDataset
__all__ = (
"KittiFlow",
"Sint... | pytorch/vision | torchvision/datasets/_optical_flow.py | Python | bsd-3-clause | 19,330 |
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
__version__ = "1.2.0.11"
| STIXProject/python-stix | stix/version.py | Python | bsd-3-clause | 130 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
class BadOption(Exception):
""" Incorrect HTTP API arguments """
pass
class RenderError(Exception):
""" Error rendering page """
pass
class InternalError(Exception):
""" Unhandled internal error """
pass
class GlobalTimeoutEr... | Youwotma/splash | splash/exceptions.py | Python | bsd-3-clause | 1,502 |
"Yang/Wu's OEP implementation, in PyQuante."
from math import sqrt
import settings
from PyQuante.NumWrap import zeros,matrixmultiply,transpose,dot,identity,\
array,solve
from PyQuante.Ints import getbasis, getints, getJ,get2JmK,getK
from PyQuante.LA2 import geigh,mkdens,trace2,simx
from PyQuante.hartree_fock impo... | berquist/PyQuante | PyQuante/OEP.py | Python | bsd-3-clause | 25,427 |
def extractLittlebambooHomeBlog(item):
'''
Parser for 'littlebamboo.home.blog'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('FW', 'Fortunate Wife', 'translated'),
... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractLittlebambooHomeBlog.py | Python | bsd-3-clause | 622 |
from __future__ import print_function, division
from sympy.core import S, sympify, cacheit, pi, I, Rational
from sympy.core.add import Add
from sympy.core.function import Function, ArgumentIndexError, _coeff_isneg
from sympy.functions.combinatorial.factorials import factorial, RisingFactorial
from sympy.functions.elem... | kaushik94/sympy | sympy/functions/elementary/hyperbolic.py | Python | bsd-3-clause | 48,081 |
#!/usr/bin/env python
"""
Single trace Analysis
"""
__author__ = "Yanlong Yin (yyin2@iit.edu)"
__version__ = "$Revision: 1.4$"
__date__ = "$Date: 02/08/2014 $"
__copyright__ = "Copyright (c) 2010-2014 SCS Lab, IIT"
__license__ = "Python"
import sys, os, string, getopt, gc, multiprocessing
from sig import *
from acc... | yinyanlong/iosig | src/analysis/single_trace_analysis.py | Python | bsd-3-clause | 8,008 |
# -*- coding: utf-8 -*-
#
# __init__.py
# cjktools
#
"""
This package contains various tools for Japanese NLP tasks, although some
may be applicable to any python project. See documentation of each module for
details.
"""
__all__ = [
'alternations',
'common',
'enum',
'exceptions',
'kana_table',
... | larsyencken/cjktools | cjktools/__init__.py | Python | bsd-3-clause | 385 |
import errno
import os
import types
import typing as t
from werkzeug.utils import import_string
class ConfigAttribute:
"""Makes an attribute forward to the config"""
def __init__(self, name: str, get_converter: t.Optional[t.Callable] = None) -> None:
self.__name__ = name
self.get_converter =... | mitsuhiko/flask | src/flask/config.py | Python | bsd-3-clause | 11,068 |
from sympy.core.numbers import comp, Rational
from sympy.physics.optics.utils import (refraction_angle, fresnel_coefficients,
deviation, brewster_angle, critical_angle, lens_makers_formula,
mirror_formula, lens_formula, hyperfocal_distance,
transverse_magnification)
from sympy.physics.optics.med... | kaushik94/sympy | sympy/physics/optics/tests/test_utils.py | Python | bsd-3-clause | 7,792 |
# Copyright 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.
"""Provides a layer of abstraction for the issue tracker API."""
import logging
from apiclient import discovery
from apiclient import errors
import httplib... | SummerLW/Perf-Insight-Report | dashboard/dashboard/issue_tracker_service.py | Python | bsd-3-clause | 6,428 |
# -*- coding: utf-8 -*-
from flask import render_template, redirect, url_for, flash, abort
from purchasing.decorators import requires_roles
from purchasing.data.stages import Stage
from purchasing.data.flows import Flow
from purchasing.conductor.forms import FlowForm, NewFlowForm
from purchasing.conductor.manager im... | codeforamerica/pittsburgh-purchasing-suite | purchasing/conductor/manager/flow_management.py | Python | bsd-3-clause | 2,911 |