code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# Copyright 2012 OpenStack Foundation
# All Rights Reserved
# Copyright (c) 2012 NEC Corporation
#
# 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/lic... | hanlind/nova | nova/network/neutronv2/api.py | Python | apache-2.0 | 114,778 |
"""The Bravia TV component."""
from __future__ import annotations
import asyncio
from collections.abc import Iterable
from datetime import timedelta
import logging
from typing import Final
from bravia_tv import BraviaRC
from bravia_tv.braviarc import NoIPControl
from homeassistant.config_entries import ConfigEntry
f... | rohitranjan1991/home-assistant | homeassistant/components/braviatv/__init__.py | Python | mit | 10,665 |
# Test for reading from a buffer in a compute shader.
# This is a special compute-only test script. It relies on stuff
# from the test framework so will not work inside Syrup itself.
from SRPScripting import *
cs = ri.CompileShader("ComputeTest.hlsl", "ReadFromBuffer", "cs_4_0")
numElements = 16
input = range(0, numE... | simontaylor81/Syrup | SRPTests/TestScripts/Python/ReadFromBuffer.py | Python | mit | 784 |
from shlex import split
import pytest
from ghutil.util import search_query
@pytest.mark.parametrize(
"terms,query",
[
(split("label:Nice to Have"), "label:Nice to Have"),
(split('label:"Nice to Have"'), 'label:"Nice to Have"'),
(split("label:'Nice to Have'"), 'label:"Nice to Have"'),
... | jwodder/ghutil | test/test_search_query.py | Python | mit | 1,093 |
#!/usr/bin/env python
# -*- mode:python; coding:utf-8; -*-
# Calculation of Pi using quadrature. Using the python-csp package by Sarah Mount.
#
# Copyright © 2009-10 Russel Winder
import time
import multiprocessing
import sys
sys.path.insert(0, "../..")
from csp.csp import *
@process
def calculator ( channel , ... | futurecore/python-csp | test/winder_bug/pi_python_python-csp_single_separate.py | Python | gpl-2.0 | 1,822 |
"""Merges from one status space to another
This module provide ways to map the power set of status space to an
other status space; e.g. the status space of VCs ("VC_PROVED",
"VC_NOT_PROVED") to the status space of an enclosing source entity
(e.g. "FULLY PROVED", "NOT PROVED", "PARTIALLY PROVED"). The map is
expressed ... | ptroja/spark2014 | gnatmerge/share/gnatmerge/library/spec_maps.py | Python | gpl-3.0 | 6,122 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('Articulo', '0005_articulo_proveedor_proveedor'),
]
operations = [
migrations.AlterField(
model_name='articulo_cl... | jrmendozat/mtvm | Articulo/migrations/0006_auto_20150408_0949.py | Python | gpl-2.0 | 1,098 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/stat/responder/responderpolicylabel_stats.py | Python | apache-2.0 | 4,062 |
import sys
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from config import FACEBOOK_USERNAME, FACEBOOK_PASSWORD
from selenium.webdriver.support.wait import WebDriverWait
def wait_until_item(driver, item_id):
WebDriverWait(driver, 10).until(
lambda browser: browser.find... | kaflesudip/sample-scrapers | medium_bot/bot.py | Python | apache-2.0 | 1,405 |
from django.contrib.gis.db.models import Collect, Count, Extent, F, Union
from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.geos import GEOSGeometry, MultiPoint, Point
from django.db import connection
from django.test import TestCase, skipUnlessDBFeature
from django.test.utils import over... | camilonova/django | tests/gis_tests/relatedapp/tests.py | Python | bsd-3-clause | 14,177 |
'''
Copyright (c) 2008 Georgios Giannoudovardis, <vardis.g@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use,... | vardis/pano | src/pano/view/ScreenFilter.py | Python | mit | 13,141 |
import factory
from django.contrib.contenttypes.models import ContentType
from django.utils.text import slugify
from article.models import Article
# from functional_tests.factory import ContentTypeFactory
class ContentTypeFactory(factory.django.DjangoModelFactory):
class Meta:
model = ContentType
... | PARINetwork/pari | functional_tests/factory/article_factory.py | Python | bsd-3-clause | 2,772 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010 Romain Bignon
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will b... | jocelynj/weboob | weboob/applications/webcontentedit/webcontentedit.py | Python | gpl-3.0 | 3,817 |
import tensorflow as tf
import time
import numpy as np
import mdl_data
import sys
GPUNUM = sys.argv[1]
FILEPATH = sys.argv[2]
# Network Parameters
learning_rate = 0.001
training_epochs = 20
batch_size = 256
display_step = 1
n_input_img = 4096 # YLI_MED image data input (data shape: 4096, fc7 layer output)
n_hidden... | lheadjh/MultimodalDeepLearning | ver_tensorflow/MM1CA.py | Python | mit | 9,152 |
from __future__ import absolute_import, unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
from modelcluster.fields import ParentalKey
from wagtail.wagtailadmin.edit_handlers import InlinePanel, MultiFieldPanel, \
FieldRowPanel, FieldPanel, StreamFieldPanel, Tabbe... | Dekker1/moore | src/home/models.py | Python | agpl-3.0 | 10,376 |
# This file is part of OpenDrift.
#
# OpenDrift is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2
#
# OpenDrift is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without ev... | OpenDrift/opendrift | opendrift/models/windblow.py | Python | gpl-2.0 | 1,401 |
# -*- encoding: utf-8 -*-
###############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or ... | open-synergy/vertical-travel | airport/res_partner.py | Python | agpl-3.0 | 1,391 |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
},
}
INSTALLED_APPS = [
"django.contrib.sites",
"django.contrib.flatpages",
"geelweb.django.customflatpages",
]
SITE_ID = 1
SECRET_KEY = 'sfbysvgcizvncwhf89'
MIDDLEWARE_CLASSES = (
'django... | geelweb/django-customflatpages | tests/test_settings.py | Python | mit | 728 |
"""Selection sort."""
def sort(lst):
"""In-place selection sort
Args:
lst: List to sort
"""
for i in range(len(lst) - 1):
min_index = i
for j in range(i + 1, len(lst)):
if lst[min_index] > lst[j]:
min_index = j
lst[min_index], lst[i] = lst[i... | niemmi/algolib | algolib/sort/selection_sort.py | Python | bsd-3-clause | 338 |
"""
These settings are used by the ``manage.py`` command.
With normal tests we want to use the fastest possible way which is an
in-memory sqlite database but if you want to create South migrations you
need a persistant database.
Unfortunately there seems to be an issue with either South or syncdb so that
defining two... | bitmazk/cmsplugin-blog-language-publish | cmsplugin_blog_language_publish/tests/south_settings.py | Python | mit | 599 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'svksurvey.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^list/',incl... | adiseshu219/visualisation | svksurvey/urls.py | Python | agpl-3.0 | 340 |
print False or False
| ArcherSys/ArcherSys | skulpt/test/run/t255.py | Python | mit | 21 |
"""
sentry_extras
~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by David Szotten.
:license: MIT, see LICENSE for more details.
"""
try:
VERSION = __import__('pkg_resources') \
.get_distribution('sentry-extras').version
except Exception, e:
VERSION = 'unknown'
| davidszotten/sentry-extras | sentry_extras/__init__.py | Python | mit | 275 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import os
import sys
import configparser
import credential
from ResHelp.ResHelp import ResHelp
logging.basicConfig(
level=logging.WARNING,
format='%(asctime)s %(levelname)s [%(filename)s-%(funcName)s()]'
' %(message)s',
datefmt='%m-%d %H:%M... | sauleddy/HomePortal | resource_help/main.py | Python | mit | 1,414 |
#!/usr/bin/python
import textwrap
import config
import random
class AbstractTest:
def name(self): return self.__class__.__name__
def description(self): return 'Here should be a description but someone was too lazy!'
def info(self, *messages):
print_with_indent(self.__class__.__name__, messages... | artem-smotrakov/httpooh | helper.py | Python | gpl-3.0 | 7,942 |
"""Support for Magic Home select."""
from __future__ import annotations
import asyncio
from flux_led.aio import AIOWifiLedBulb
from flux_led.base_device import DeviceType
from flux_led.const import (
DEFAULT_WHITE_CHANNEL_TYPE,
STATE_CHANGE_LATENCY,
WhiteChannelType,
)
from flux_led.protocol import PowerR... | rohitranjan1991/home-assistant | homeassistant/components/flux_led/select.py | Python | mit | 9,012 |
"""Module containing the functions to run engine calculations in normal or
parallel mode."""
from pvfactors import logging
from pvfactors.geometry import OrderedPVArray
from pvfactors.irradiance import HybridPerezOrdered
from pvfactors.viewfactors import VFCalculator
from pvfactors.engine import PVEngine
from multipro... | SunPower/pvfactors | pvfactors/run.py | Python | bsd-3-clause | 12,818 |
#!/usr/local/bin/python
from __future__ import print_function
import random
import time
import serial
# Main function
def blink_flares():
filename = 'cleaned_data.txt'
flare_delays = open(filename, 'r').read().split(',')
leds = [b'1', b'2', b'3', b'4', b'5', b'6', b'7', b'8', b'9', b'0', b'A', b'B']
t... | andres-root/sun-art-light | old.py | Python | gpl-3.0 | 1,215 |
from __future__ import division
def rel_calc(n):
"""Calculate the colour-specific bit, given a colour hex-string."""
n = int(n, 16) / 255
if n <= 0.03928:
n = n / 12.92
else:
n = ((n + 0.055) / 1.055) ** 2.4
return n
def relative_luminance(h):
"""Calculate the relative lumina... | opencorato/sayit | speeches/colour.py | Python | agpl-3.0 | 893 |
# -*- coding: utf-8 -*-
#
# Mock documentation build configuration file, created by
# sphinx-quickstart on Mon Nov 17 18:12:00 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable... | waseem18/oh-mainline | vendor/packages/mock/docs/conf.py | Python | agpl-3.0 | 5,852 |
import json
import requests
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
import olympia.core.logger
from olympia.files.models import FileUpload
from olympia.github.tasks import process_webhook
from olympia.github.utils import GithubCallback,... | lavish205/olympia | src/olympia/github/views.py | Python | bsd-3-clause | 2,231 |
# Copyright 2013 Mirantis 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 ... | sacharya/nova | nova/db/sqlalchemy/migrate_repo/versions/185_rename_unique_constraints.py | Python | apache-2.0 | 6,916 |
__version__="v2.5 beta10"
welcome_block="""
# Multi-Echo ICA, Version %s
#
# Kundu, P., Brenowitz, N.D., Voon, V., Worbe, Y., Vertes, P.E., Inati, S.J., Saad, Z.S.,
# Bandettini, P.A. & Bullmore, E.T. Integrated strategy for improving functional
# connectivity mapping using multiecho fMRI. PNAS (2013).
#
# Kundu, P.,... | ME-ICA/me-ica | meica.libs/select_model.py | Python | lgpl-2.1 | 12,834 |
"""Bundle HDF5 DLLs into an h5py wheel on Windows
This is meant to do something like auditwheel on Linux & delocate on Mac,
but h5py-specific.
"""
from base64 import urlsafe_b64encode
from contextlib import contextmanager
from glob import glob
import hashlib
import os
import os.path as osp
import shutil
import sys
imp... | h5py/h5py | ci/bundle_hdf5_whl.py | Python | bsd-3-clause | 2,651 |
from application import app
from config import config
import requests
from bs4 import BeautifulSoup as beautifulsoup
import json
from datetime import datetime, timedelta
def GET(url):
return requests.get(url).text
def POST(url, data):
headers = {'content-type': 'application/json'}
return requests.post(u... | limiear/soyprice | soyprice/variables/core.py | Python | gpl-3.0 | 1,706 |
# (C) British Crown Copyright 2010 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris 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 version 3 of the License, or
# (at your option) any l... | mo-g/iris | docs/iris/example_tests/test_cross_section.py | Python | gpl-3.0 | 1,337 |
# Copyright (C) 2004 Anthony Baxter
# This file is necessary to make this directory a package
__version__ = '0.3alpha0'
| braams/shtoom | shtoom/__init__.py | Python | lgpl-2.1 | 121 |
# python count_client_ssl.py
from OpenSSL import SSL
from decimal import Decimal
from datetime import datetime
from sys import stdout, exit
from twisted.internet import reactor, ssl
from twisted.internet.protocol import ClientFactory
from twisted.protocols import amp
from twisted.python.log import startLogging, err, m... | glyph/amp-java | examples/count_client_ssl.py | Python | mit | 2,215 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2017 Stephen Bunn (stephen@bunn.io)
# GNU GPLv3 <https://www.gnu.org/licenses/gpl-3.0.en.html>
from ._common import *
from .rethinkdb import RethinkDBPipe
from .mongodb import MongoDBPipe
| ritashugisha/neat | neat/pipe/__init__.py | Python | gpl-3.0 | 255 |
import urllib
import os
import re
from time import sleep
from datetime import date
def welcome(modulename):
print """
|==========================================================|
|====================== [ 404 ] ========================|
|==============[ lordnotfound404@gmail.com ]==... | lordnotfound404/404web | wp_joom.py | Python | gpl-2.0 | 4,272 |
#!/usr/bin/python
# -*- coding: utf-8
'''
This file is part of VetApp.
VetApp is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later ver... | mape90/VetApp | models/globalvar.py | Python | gpl-3.0 | 1,166 |
# -*- encoding: utf-8 -*-
###############################################################################
# #
# Copyright (C) 2015 TrustCode - www.trustcode.com.br #
# Danimar Ribeiro <danimaribeiro@gmail.co... | odoo-brazil/odoo-brazil-sped | l10n_br_sped/models/sped_contabil.py | Python | agpl-3.0 | 3,377 |
# Copyright (C) 2009 by Eric Talevich (eric.talevich@gmail.com)
# Based on Bio.Nexus, copyright 2005-2008 by Frank Kauff & Cymon J. Cox.
# All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this pa... | Ambuj-UF/ConCat-1.0 | src/Utils/Bio/Phylo/NewickIO.py | Python | gpl-2.0 | 12,791 |
#!/usr/bin/env python
## vim:ts=4:et:nowrap
"""A user-defined wrapper around string objects
Note: string objects have grown methods in Python 1.6
This module requires Python 1.6 or later.
"""
from types import StringType, UnicodeType
import sys
__all__ = ["UserString","MutableString"]
class UserString:
def __ini... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.1/Lib/UserString.py | Python | mit | 7,530 |
#!/usr/bin/env python
# coding=utf-8
from crystal.spiders.spider import CommonSpider
from preprocesser import UrlPreprocesser
# scrapy api
from scrapy.utils.project import get_project_settings
from scrapy.crawler import CrawlerProcess
#debug
from ipdb import set_trace
import crash_on_ipy
#model
from model.db_config im... | x-hansong/Crystal | run.py | Python | mit | 1,170 |
from bokeh.layouts import gridplot
from bokeh.models import BooleanFilter, CDSView, ColumnDataSource
from bokeh.plotting import figure, show
source = ColumnDataSource(data=dict(x=[1, 2, 3, 4, 5], y=[1, 2, 3, 4, 5]))
booleans = [True if y_val > 2 else False for y_val in source.data['y']]
view = CDSView(source=source, f... | ericmjl/bokeh | sphinx/source/docs/user_guide/examples/data_filtering_boolean_filter.py | Python | bsd-3-clause | 765 |
#!/usr/bin/env python
from __future__ import print_function
import sys
from StringIO import StringIO
from Registry import Registry, RegistryLog
def print_test_testAAAA_testBBBB(reg):
try:
reg.root().find_key('testAAAA')
print('testAAAA found!')
except Exception:
print('testAAAA not fou... | williballenthin/python-registry | testing/TransactionLogFiles.py | Python | apache-2.0 | 4,016 |
###############################################################################
# lazyflow: data flow based lazy parallel computation framework
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/o... | jakirkham/lazyflow | lazyflow/utility/io/RESTfulBlockwiseFileset.py | Python | lgpl-3.0 | 17,769 |
#!/usr/bin/env python
import sys
import numpy as np
from matplotlib import pyplot as plt
E, Ndown, Nup = np.loadtxt(sys.argv[1], usecols = (0,1,2), unpack = True)
plt.plot(E, -Ndown,label="down")
plt.plot(E, Nup,label="up" )
try:
plt.plot([float(sys.argv[2])] * 2, [max(Nup),-max(Ndown)],"r-")
except:
pa... | addman2/KvantSim | Exercises/bin/sdos.plot.py | Python | mit | 485 |
def fib_rec(count, prev_num, curr_num, end):
count = count + 1
next_num = prev_num + curr_num
l = len(str(curr_num))
print(count, l, curr_num)
if l < end:
fib_rec(count, curr_num, next_num, end)
def fib_loop(count, prev_num, curr_num, end):
while True:
count = count + 1
... | bobbarnes1981/ProjectEuler | Problem0025/solution.py | Python | gpl-2.0 | 538 |
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from .. import views
class Common(object):
"""
Stuff shared by the two views.
"""
def get_return_url(self):
return reverse('openid_callback')
... | brutasse/django-le-social | le_social/openid/tests/views.py | Python | bsd-3-clause | 714 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Inscripcion paso 1: agregar cliente"""
import cgi
import cgitb; cgitb.enable()
import datos
import htm
import pagina
def paso_1(frm):
"""Inscripcion paso 1: agregar cliente"""
cliente_id = frm.getvalue("cliente_id", 0)
if cliente_id != 0:
htm.redirigi... | mescobal/geined | alu_inscripcion1.py | Python | gpl-3.0 | 2,008 |
# -*- coding: utf-8 -*-
import time
class Attempt(object):
def __init__(self,
number,
was_successful,
result,
exception,
first_attempt_start_time):
self.number = number
self.was_successful = was_successful
... | dnguyen0304/clare | clare/clare/common/retry/attempt.py | Python | mit | 1,709 |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2017
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | txemagon/1984 | modules/Telegram-bot-python/telegram/utils/promise.py | Python | gpl-3.0 | 1,705 |
import csv
with open("osm_3.csv") as clean:
with open("ids.csv", "wb") as ids:
ww = csv.writer(ids)
for crow in csv.reader(clean):
ww.writerow([crow[2]])
| sirmmo/osm-tper-importer | clean_shp.py | Python | unlicense | 164 |
# Orca
#
# Copyright 2010 Joanmarie Diggs.
#
# This library 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
# version 2.1 of the License, or (at your option) any later version.
#
# This library i... | chrys87/orca-beep | src/orca/scripts/apps/soffice/script_utilities.py | Python | lgpl-2.1 | 22,259 |
"""idlelib.config -- Manage IDLE configuration information.
The comments at the beginning of config-main.def describe the
configuration files and the design implemented to update user
configuration information. In particular, user configuration choices
which duplicate the defaults will be removed from the user's
conf... | Microsoft/PTVS | Python/Product/Miniconda/Miniconda3-x64/Lib/idlelib/config.py | Python | apache-2.0 | 38,945 |
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
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 wr... | GustavWi/mbed | workspace_tools/export/iar.py | Python | apache-2.0 | 5,615 |
# need
#export PYTHONPATH=/path/to/lib:/path/to/tests
#python3 -m unittest test_CallOut
import unittest
import time
from CallOut import CallOut
# This needs a (sim) BT to respond
class TestCallOutMethods(unittest.TestCase):
#def setUp(self):
# self.pt = gpsPos(45.395676, -75.676829)
#def setUp(self... | pdgilbert/Vcourse | tests/test_CallOut.py | Python | gpl-2.0 | 4,890 |
class Hero:
"""Represents character controlled by the player"""
def __init__(self, sName):
self.name = sName
self.health = 10
self.maxHealth = 10
self.strength = 1
self.weapon = weapons.fist()
self.armorValue = 200
self.level = 1
self.experience =... | bionexus/freshgame | releases/v1.0/freshgame.py | Python | gpl-2.0 | 7,738 |
"sadasdg
| Nakrez/RePy | tests/parser/bad/bad-string.py | Python | mit | 9 |
#| This file is part of pyCAF. |
#| |
#| pyCAF is free so... | maximeolivier/pyCAF | pycaf/architecture/devices/server_features/lists/interface_list.py | Python | gpl-3.0 | 3,585 |
from .base import BaseSampler
from .emcee import EmceeSampler
| tensorprob/tensorprob | tensorprob/samplers/__init__.py | Python | mit | 63 |
#!/usr/bin/env python
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import unicodedata, re, os, cPickle, textwrap
from bisect import bisect
from ... | insomnia-lab/calibre | src/calibre/gui2/tweak_book/char_select.py | Python | gpl-3.0 | 31,785 |
# Copyright 2015 The TensorFlow Authors. 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 applica... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/contrib/keras/python/keras/applications/vgg16.py | Python | apache-2.0 | 8,578 |
import pytest
from django.db.models import F
from .models import (
ExpressionModelTest,
MixedFieldsModelTest,
ModelTest,
ModelWithForeignKeyTest,
)
from .utils import assert_number_of_queries_on_regex
@pytest.mark.django_db
def test_save_dirty_simple_field():
tm = ModelTest.objects.create()
... | smn/django-dirtyfields | tests/test_save_fields.py | Python | bsd-3-clause | 7,003 |
"""
Unit tests for the Mixed Modulestore, with DDT for the various stores (Split, Draft, XML)
"""
import datetime
import itertools
import logging
import mimetypes
from collections import namedtuple
from contextlib import contextmanager
from shutil import rmtree
from tempfile import mkdtemp
from uuid import uuid4
from... | edx/edx-platform | common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py | Python | agpl-3.0 | 179,488 |
# protocol.py -- States, Lists, PrivacyModes classes, and errors global
#
# Copyright (C) 2003 Manish Jethani (manish_jethani AT yahoo.com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation... | leleobhz/scripts | python/others_utilities/msnp/protocol.py | Python | gpl-2.0 | 3,026 |
'''
Create a set of thin PV slices
'''
from spectral_cube import SpectralCube, Projection
from astropy.io import fits
from astropy import units as u
import numpy as np
from cube_analysis.disk_pvslices import disk_pvslices
from paths import fourteenB_HI_data_wGBT_path, fourteenB_wGBT_HI_file_dict
from galaxy_params ... | e-koch/VLA_Lband | 14B-088/HI/analysis/HI_pvslices_thin.py | Python | mit | 1,012 |
"""
Implementation of the OpenWeatherMap API.
"""
__author__ = 'ajay@roopakalu.com (Ajay Roopakalu)'
OPEN_WEATHER_MAP_URL = 'http://api.openweathermap.org/data/2.5'
WEATHER_URL = '/weather'
import requests
import log
logging = log.Log(__name__)
def GetCurrentExternalWeather(app_id, city_id):
"""Get current weat... | jrupac/nest-wfh | weather.py | Python | mit | 1,031 |
"""Tests for the Agent DVR config flow."""
from homeassistant import data_entry_flow
from homeassistant.components.agent_dvr import config_flow
from homeassistant.components.agent_dvr.const import SERVER_URL
from homeassistant.config_entries import SOURCE_USER
from homeassistant.const import CONF_HOST, CONF_PORT
from h... | pschmitt/home-assistant | tests/components/agent_dvr/test_config_flow.py | Python | apache-2.0 | 3,260 |
"""Unit tests for emrcontainers-supported APIs."""
import re
from datetime import datetime, timezone, timedelta
from unittest import SkipTest
import boto3
import pytest
import sure # noqa # pylint: disable=unused-import
from botocore.exceptions import ClientError, ParamValidationError
from moto import mock_emrcontai... | spulec/moto | tests/test_emrcontainers/test_emrcontainers.py | Python | apache-2.0 | 20,520 |
"""
Django settings for myBlog project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | liuminyt/BlogPoint | myBlog/templates/myBlog/settings.py | Python | gpl-2.0 | 2,527 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'slice_visualization.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_slice_visualization_gui(object):
def setupUi(self, slice_v... | johanesmikhael/ContinuityAnalysis | slice_visualization_ui.py | Python | mit | 1,409 |
#!/usr/bin/env python
#########################################################################################
#
# Compute maximum spinal cord compression.
#
# ---------------------------------------------------------------------------------------
# Copyright (c) 2015 Polytechnique Montreal <www.neuro.polymtl.ca>
# Au... | 3324fr/spinalcordtoolbox | scripts/sct_compute_mscc.py | Python | mit | 2,773 |
import json
import os
base = os.path.dirname(os.path.realpath(__file__))
def loader(name):
'''
Parameter
name
filename without .json
'''
filename = os.path.join(base, name + '.json')
with open(filename, 'r') as jsonfile:
r = json.load(jsonfile)
return r
| infant-cognition-tampere/fixationmodel-py | tests/fixtures/loader.py | Python | mit | 312 |
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
with open(path.join(here, 'requirements.txt'), encoding='utf-8') as f:
requires = f.r... | timkpaine/lantern | setup.py | Python | apache-2.0 | 1,382 |
from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen
from Components.config import config, ConfigSubsection, ConfigInteger, ConfigSlider, getConfigListEntry
config.plugins.OSDPositionSetup = ConfigSubsection()
config.plugins.OSDPositionSetup.dst_left = ConfigInteger(default = 0)
config.... | ssh1/stbgui | lib/python/Plugins/SystemPlugins/OSDPositionSetup/plugin.py | Python | gpl-2.0 | 5,733 |
# Automated Stock Market Trading Simulation
# FB - 20140515
import random
initialMoneyOwned = 1000.0
initialStocksOwned = 0.1
initialStockPrice = 10000.0
tradingDays = 1000
tp = 5.0 # buy/sell percentage threshold of the investor
maxVolatilityPercent = 5.0 # of the stock
numTrials = 1000
initialInvestment = initialMo... | ActiveState/code | recipes/Python/578881_Automated_Stock_Market_Trading/recipe-578881.py | Python | mit | 2,075 |
"""empty message
Revision ID: 178762dff445
Revises: 12f9dcc2e36c
Create Date: 2015-03-26 11:02:49.934915
"""
# revision identifiers, used by Alembic.
revision = '178762dff445'
down_revision = '3d3fb04d1a98'
from alembic import op
from sqlalchemy.sql import table, column
from sqlalchemy import String, Boolean
import... | alphagov/digitalmarketplace-api | migrations/versions/178762dff445_.py | Python | mit | 1,103 |
import math
from scipy import integrate, optimize
import numpy as np
import matplotlib.pyplot as plt
import numpy. polynomial.chebyshev as cheb
from matplotlib import rc
iphi = lambda x: np.sqrt(9.8 / 8.) * (1. - np.cos(x)) / \
np.sqrt((x - np.sin(x)) * np.sin(x / 2.))
def getChebNodes(N):
return -np.cos(np... | liebannam/pipes | interpolation_tests/intphisucks.py | Python | gpl-3.0 | 3,989 |
# -*- coding: utf-8 -*-
"""Tests for the Collection model"""
import unittest
import sys
import os
from os.path import join, abspath, dirname
parentpath = abspath(join(dirname(__file__), '../../..'))
sys.path.append(parentpath)
from blibbapi.db import get_engine, init_db, get_db_session, Base
from blibbapi.models.bli... | ipedrazas/blibb-project | blibbapi/tests/models/test_collection.py | Python | apache-2.0 | 1,607 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/OSIS-Louvain | program_management/ddd/validators/_minimum_editable_year.py | Python | agpl-3.0 | 1,815 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp.osv import fields, osv
import time
import datetime
from openerp import tools
from openerp.exceptions import UserError
from openerp.tools.translate import _
from dateutil.relativedelta import relativedelta
d... | mkieszek/odoo | addons/fleet/fleet.py | Python | agpl-3.0 | 45,359 |
import urllib
from django.core.exceptions import ImproperlyConfigured
from django.core.mail import send_mail
from django.db import models
from django.db.models.manager import EmptyManager
from django.utils.crypto import get_random_string
from django.utils.encoding import smart_str
from django.utils.translation import ... | lzw120/django | django/contrib/auth/models.py | Python | bsd-3-clause | 16,830 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("orgs", "0015_auto_20160209_0926")]
operations = [
migrations.AddField(model_name="taskstate", name="is_disabled", field=models.BooleanField(default=False))
]
| rapidpro/dash | dash/orgs/migrations/0016_taskstate_is_disabled.py | Python | bsd-3-clause | 306 |
from uuid import uuid4
from django.contrib.auth.models import User
from django.conf.urls.defaults import url
from django.core.urlresolvers import reverse
from django.contrib.auth import forms as auth_forms
from django.contrib.auth import views as auth_views
from django.contrib.auth import logout as auth_logout
from dj... | agoravoting/agora-ciudadana | agora_site/agora_core/resources/user.py | Python | agpl-3.0 | 19,122 |
from django.conf import settings
from django.conf.urls import url
from plans.views import CreateOrderView, OrderListView, InvoiceDetailView, AccountActivationView, \
OrderPaymentReturnView, CurrentPlanView, UpgradePlanView, OrderView, BillingInfoRedirectView, \
BillingInfoCreateView, BillingInfoUpdateView, Bil... | cypreess/django-plans | plans/urls.py | Python | mit | 2,070 |
from .test_models import *
from .test_views import * | benracine/opencomparison | apps/profiles/tests/__init__.py | Python | mit | 52 |
import numpy as np
import pandas as pd
import datetime as dt
def initiate_procedure():
results = pd.DataFrame(columns=('Responses', 'Value', 'Reversal', 'Run',
'Trial', 'Direction', 'DateTime'))
return results
def append_result(res, resp, down, up, stepSize... | codles/UpDownMethods | UpDownMethods/process.py | Python | mit | 5,746 |
import fdb
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.orm.exc import MultipleResultsFound
# from sqlalchemy import (create_engine, MetaData, Table, Column, Integer,
# String, ForeignKey, Float, DateTime, event)
# from sqlalchemy.orm import sessionmaker, mapper, relationship
from sqlalchemy... | habedi/SqlAlchemy-Sqlite | sources/firebirdsqlpy.py | Python | mit | 2,800 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-07 11:34
from __future__ import unicode_literals
import datetime
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('discount', '0002_voucher'),
]
oper... | UITools/saleor | saleor/discount/migrations/0003_auto_20160207_0534.py | Python | bsd-3-clause | 2,391 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# 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 ... | oberstet/autobahn-python | examples/twisted/wamp/rpc/slowsquare/backend.py | Python | mit | 2,214 |
from django.test import TestCase
from django.contrib.auth.models import Group
from hs_access_control.models import UserResourceProvenance, UserResourcePrivilege, \
GroupResourceProvenance, GroupResourcePrivilege, \
UserGroupProvenance, UserGroupPrivilege, \
PrivilegeCodes
from hs_core import hydroshare
fr... | ResearchSoftwareInstitute/MyHPOM | hs_access_control/tests/test_provenance_function.py | Python | bsd-3-clause | 58,013 |
filename="files/genfromtxt_example_data.txt"
import numpy
data = numpy.genfromtxt("files/genfromtxt_example_data.txt", comments="#",
delimiter="\t", skip_header=3)
print(data)
| juhaj/topics-python-in-research | codes/python/genfromtxt_example_import.py | Python | gpl-3.0 | 200 |
from __future__ import print_function
__title__ = 'admin_timeline.tests'
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
__copyright__ = 'Copyright (c) 2013-2014 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
import unittest
import os
PROJECT_DIR = lambda base : os.path.join(os.path.dirname(__file__... | mick-t/django-admin-timeline | src/admin_timeline/tests.py | Python | gpl-2.0 | 20,490 |
from mytest import *
thingy = MyTest()
a = thingy.MapToStandardSquare(10,20)
print "a = ", a
| geomview/gv2 | Py/swigtest/test.py | Python | gpl-2.0 | 93 |
import numpy as np
from matplotlib import pyplot
def scatterplot(X, marker='.', title=None, fig=None, ax=None, **kwargs):
'''General plotting function for a set of points X. May be [1-3] dimensional.'''
assert len(X.shape) in (1,2), 'Only valid for 1 or 2-d arrays of points'
assert len(X.shape) == 1 or X.shape[... | all-umass/manifold_spanning_graphs | viz.py | Python | mit | 2,551 |
#!/usr/bin/env python
"""Usage: timer
Counts the time since this program was started, printing it to stdout
every second."""
import sys
import time
import datetime
def main(argv):
if "-h" in argv or "--help" in argv:
return __doc__
start = datetime.datetime.now()
while True:
try:
... | ingolemo/cmd-utils | timer.py | Python | gpl-3.0 | 578 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2011 OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you ... | OpusVL/odoo | addons/share/__openerp__.py | Python | agpl-3.0 | 2,267 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.