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 |
|---|---|---|---|---|---|
import config
import experiment
# initialize experiment:
# - single-label classification problem using the IRIS flower dataset
# - the model should predict the iris species
cfg = config.config()
exp = experiment.experiment(cfg.expdir + "/iris", trials = 10)
exp.set_task(cfg.task_iris(folds=10))
# loss functions
exp.... | accosmin/nanocv | exp/experiment_iris.py | Python | mit | 1,050 |
#
# This file is part of Healpy.
#
# Healpy 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 2 of the License, or
# (at your option) any later version.
#
# Healpy is distributed in the hope... | lpsinger/healpy | healpy/fitsfunc.py | Python | gpl-2.0 | 25,458 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import flt, cstr
from webnotes import _
from accounts.utils import validate_expense_against_budget
class StockA... | saurabh6790/omn-app | accounts/general_ledger.py | Python | agpl-3.0 | 4,558 |
# Copyright (c) 2014-2015, Doug Kelly
# 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... | vangdfang/conspace-register | admin.py | Python | bsd-2-clause | 14,624 |
''' Example dangerous usage of urllib[2] opener functions
The urllib and urllib2 opener functions and object can open http, ftp,
and file urls. Often, the abilit to open file urls is overlooked leading
to code that can unexpectedly open files on the local server. This
could be used by an attacker to leak information a... | austin987/bandit | examples/urlopen.py | Python | apache-2.0 | 1,129 |
"""
Errors for self-assessment
"""
from .base import AssessmentError
class SelfAssessmentError(AssessmentError):
"""Generic Self Assessment Error
Raised when an error occurs while processing a request related to the
Self Assessment Workflow.
"""
pass
class SelfAssessmentRequestError(SelfAssess... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/openassessment/assessment/errors/self.py | Python | agpl-3.0 | 579 |
# Copyright (C) 2011 Michal Zielinski (michal@zielinscy.org.pl)
#
# 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; either version 2, or (at your option)
# any later version.
#
# This program is d... | zielmicha/freeciv-android | lib/freeciv/client/actions.py | Python | gpl-2.0 | 10,344 |
# Copyright 2019 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... | tensorflow/tensorflow | tensorflow/python/training/tracking/benchmarks_test.py | Python | apache-2.0 | 3,894 |
# Copyright (C) 2006, Red Hat, Inc.
# Copyright (C) 2007, One Laptop Per Child
#
# 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, either version 3 of the License, or
# (at your option) any later ... | icarito/sugar | src/jarabe/journal/journalactivity.py | Python | gpl-3.0 | 17,383 |
"""Elasticsearch utilities not general enough to lift into pyelasticsearch"""
from flask import current_app
from pyelasticsearch import ElasticHttpNotFoundError
from werkzeug.exceptions import NotFound
from dxr.config import FORMAT
UNINDEXED_STRING = {
'type': 'string',
'index': 'no',
}
UNANALYZED_STRING ... | pombredanne/dxr | dxr/es.py | Python | mit | 3,308 |
import itertools
from sqlalchemy import Boolean
from sqlalchemy import delete
from sqlalchemy import exc as sa_exc
from sqlalchemy import func
from sqlalchemy import insert
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import select
from sqlalchemy import Sequence
from sqlalchemy impor... | monetate/sqlalchemy | test/sql/test_returning.py | Python | mit | 25,316 |
# -*- coding: utf-8 -*-
# ProjectEuler/src/python/problem177.py
#
# Integer angled Quadrilaterals.
# ==============================
# Published on Friday, 11th January 2008, 09:00 pm
#
# Let ABCD be a convex quadrilateral, with diagonals AC and BD. At each vertex
# the diagonal makes an angle with each of the two side... | olduvaihand/ProjectEuler | src/python/problem177.py | Python | mit | 1,090 |
import numpy as np
import pandas as pd
import src.mylib.mfile as mfile
import src.mylib.mcalc as mcalc
import matplotlib.pyplot as plt
dat = mfile.loadOneSymbol("JPY=X", "../db/forex.db", 'FX')
dat = dat[['Close']]
dat = mcalc.m_pct(dat, True)
#dat = dat.iloc[:1000]
#print(dat)
T = mcalc.vector_delay_embed(dat, 6, 1)
... | kakaba2009/MachineLearning | python/src/dna/time_dynamics.py | Python | apache-2.0 | 1,020 |
from setuptools import setup
setup(
name='hello-world',
packages=['hello'],
) | imsardine/learning | tox/slides/start/setup.py | Python | mit | 86 |
Experiment(description='Subsetting on the fly now with optimisation on full data at end and IMT3Lin',
data_dir='../data/tsdlr/',
max_depth=10,
random_order=True,
k=1,
debug=False,
local_computation=False,
n_rand=9,
sd=4,
... | ekamioka/gpss-research | experiments/2013-09-04-subset-integral.py | Python | mit | 761 |
#!/usr/bin/python
import argparse
import subprocess
import yaml
import tempfile
parser = argparse.ArgumentParser()
parser.add_argument('--conf', type=str, default="",
dest='configfile', required=True,
help='Jenkins configuration file')
parser.add_argument('--whitelist', type=st... | lebauce/skydive | scripts/ci/jobs/update-jobs.py | Python | apache-2.0 | 961 |
import functools
import uuid
from ...core.exts import ext_container as exts
class StateContainer(object):
"""
Keeps a registry of all installed :py:class:`StorageProvider` instances
and references to all the data that they manage.
"""
#: Unique identifier of event which notifies about state chang... | Outernet-Project/librarian | librarian/data/state/container.py | Python | gpl-3.0 | 4,761 |
import sys
import time
import copy
import signal
import logging
import asyncore
from threading import Thread
from multiprocessing import Process
from servicebus import utils
if sys.version_info < (3, 0):
from Queue import Queue
else:
from queue import Queue
class ServiceBus(object):
def __init__(self, co... | blacktear23/py-servicebus | servicebus/service.py | Python | bsd-3-clause | 7,156 |
#!c:\users\user\desktop\django-poll-app-master\django-poll-app-master\venv\scripts\python.exe
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| GiovanniConserva/TestDeploy | venv/Scripts/django-admin.py | Python | bsd-3-clause | 200 |
from __future__ import unicode_literals
from pages.models import Link
from django.conf import settings
from django.db import models
def get_upload_path(instance,filename):
return "sponsors/{}/{}".format(instance.name,filename)
class Sponsor(models.Model):
language_code = models.CharField(choices=settings.LA... | bilbeyt/ituro_website | ituro_website/sponsorship/models.py | Python | mit | 662 |
import unittest
import numpy
import chainer
from chainer import backend
from chainer.backends import cuda
from chainer import functions
from chainer import testing
from chainer.testing import attr
def _uniform(*shape):
return numpy.random.uniform(-1, 1, shape).astype(numpy.float32)
@testing.parameterize(*test... | pfnet/chainer | tests/chainer_tests/functions_tests/connection_tests/test_bilinear.py | Python | mit | 4,269 |
#!/usr/bin/env python
"""
setup.py file for compiling Infomap module
"""
from distutils.core import setup, Extension
import fnmatch
import os
import re
cppSources = []
for root, dirnames, filenames in os.walk('.'):
if root == 'src': cppSources.append(os.path.join(root, 'Infomap.cpp'))
else:
for filen... | guillermodeandajauregui/enrichmentator | lib/infomap/interfaces/python/setup.py | Python | gpl-2.0 | 1,026 |
import unittest
from test import support
import base64
import binascii
import os
from array import array
from test.support import script_helper
class LegacyBase64TestCase(unittest.TestCase):
# Legacy API is not as permissive as the modern API
def check_type_errors(self, f):
self.assertRaises(TypeErro... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.6.0/Lib/test/test_base64.py | Python | mit | 30,193 |
# -*- coding: utf-8 -*-
stations = [
{
"code": "0342",
"name": u"가수원"
},
{
"code": "0476",
"name": u"가야"
},
{
"code": "0150",
"name": u"가평"
},
{
"code": "0309",
"name": u"각계"
},
{
"code": "0172",
"name":... | devxoul/korail | korail/stations.py | Python | bsd-3-clause | 21,357 |
#Pràctica 2 - Exercici 6
# Fer un programa que demani un nombre de com a màxim 3 xifres a un usuari
# Si l'usuari entra un nombre de més de 3 xifres ha de donar un error.
numero = int(raw_input("Introduce una cifra "))
if (numero >=0) & (numero <=999):
print numero
else:
print "El número introducido ... | LorenaCapo/1DAW_Python | Práctica 2/practica2_exercici6.py | Python | gpl-3.0 | 352 |
# 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... | jjas0nn/solvem | tensorflow/lib/python2.7/site-packages/tensorflow/python/ops/math_ops.py | Python | mit | 75,695 |
# coding: utf-8
from django.db import models
from django.utils.translation import ugettext_lazy as _, pgettext_lazy
class ContentBase(models.Model):
"""
Base class for models that share content attributes
The attributes added by this mixin are ``title``, ``description``,
``content`` and ``is_visible`... | artscoop/django-basemix | basemix/mixins/content/content.py | Python | bsd-3-clause | 1,190 |
#!/usr/bin/env python2
# Copyright (c) 2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test re-org scenarios with a mempool that contains transactions
# that spend (directly or indirectly) coin... | coinkeeper/2015-06-22_18-31_bitcoin | qa/rpc-tests/rawtransactions.py | Python | mit | 5,925 |
#!/usr/bin/env python
# DickServ IRC Bot - Developed by acidvegas in Python (https://acid.vegas/dickserv)
# commands.py
import cryptocurrency
import dictionary
import google
import imdb
import isup
import netsplit
import reddit
import tpb
import tripsit
import weather
import wolfram
import youtube | acidvegas/dickserv | dickserv/core/commands.py | Python | isc | 299 |
from __future__ import annotations
import os
import time
import locale
from collections import defaultdict
from .command import SiteCommand, Fail
from staticsite.render import File
from staticsite.utils import timings
import logging
log = logging.getLogger("build")
class Build(SiteCommand):
"build the site into ... | spanezz/staticsite | staticsite/cmd/build.py | Python | gpl-3.0 | 5,551 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
""" deploy wordpress """
# Prereq:
# mysql allows connection from other hosts
# "dumps" directory in cwd
from __future__ import with_statement
import time
import shutil, os
from fabric.api import cd, lcd, local, run, get, put, settings, abort, env
from fabric.contrib.con... | fheinle/wordpress-fabfile | fabfile.py | Python | mit | 6,237 |
#! /usr/bin/env python
import re
import sys
import warnings
warnings.filterwarnings("ignore")
from dateutil.parser import parse
import matplotlib as mpl
import pylab as pl
import seaborn as sns
import mpld3
def show(args):
# if figure saving requested
if hasattr(args, 'savefig') and args.savefig:
# s... | subodhchhabra/pandashells | pandashells/lib/plot_lib.py | Python | bsd-2-clause | 3,970 |
import sys
import time
import cStringIO
import pycurl
sys.path.append('../conf')
sys.path.append('controller')
sys.path.append('database')
sys.path.append('environment')
sys.path.append('manager')
sys.path.append('monitor')
sys.path.append('predictor')
sys.path.append('util')
import configuration
from configuration_h... | fabiomorais/autoscaler | src/autoscaler.py | Python | apache-2.0 | 1,416 |
"""
Tests to verify correct number of MongoDB calls during course import/export and traversal
when using the Split modulestore.
"""
from shutil import rmtree
from tempfile import mkdtemp
from unittest import skip
import ddt
from django.test import TestCase # lint-amnesty, pylint: disable=reimported
from xmodule.mo... | eduNEXT/edunext-platform | common/lib/xmodule/xmodule/modulestore/tests/test_mongo_call_count.py | Python | agpl-3.0 | 8,932 |
#!/usr/bin/env python
from __future__ import division
__author__ = "Rob Knight"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = ["Rob Knight", "Daniel McDonald", "Yoshiki Vazquez Baeza"]
__license__ = "GPL"
__version__ = "1.8.0-dev"
__maintainer__ = "Justin Kuczynski"
__email__ = "justinak@gmail.com"... | wasade/qiime | scripts/fix_arb_fasta.py | Python | gpl-2.0 | 2,197 |
PARENT_KEY = "key_parent"
PARAMS_KEY = "key_params"
DATA_KEY = "key_data"
CL_TT_KEY = "key_cl_tt"
CL_TE_KEY = "key_cl_te"
CL_EE_KEY = "key_cl_ee"
CL_BB_KEY = "key_cl_bb" | BradGreig/21CMMC | 21CMMC_SourceCode/Programs/CosmoHammer_21CMMC/likelihood/ChainConstants.py | Python | gpl-2.0 | 173 |
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from rest_framework.test import APILiveServerTestCase
from urllib import parse
from grd.models import Device
from .common import BaseTestCase
class ApiTest(StaticLiveServerTestCase, APILiveServerTestCase):
fixtures = ['agents.json', 'devices... | eReuse/grd | grd/functional_tests/test_retrieval.py | Python | agpl-3.0 | 3,288 |
from csv import DictWriter, QUOTE_NONNUMERIC
from collections import OrderedDict
from datetime import date, timedelta
from django.conf import settings
from django.contrib.auth.mixins import UserPassesTestMixin
from django.db.models import F, Q, Min, Max, Sum, Count, Value
from django.db.models.functions import Coalesce... | eedf/jeito | accounting/views.py | Python | mit | 36,069 |
#
# Copyright 2013 eNovance
#
# 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, ... | Juniper/ceilometer | ceilometer/alarm/notifier/test.py | Python | apache-2.0 | 1,257 |
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 1 13:24:43 2017
@author: Shabaka
"""
import pandas as pd
import matplotlib.pyplot as plt
# Define plot_pop()
def plot_pop(filename, country_code):
# Initialize reader object: urb_pop_reader
urb_pop_reader = pd.read_csv(filename, chunksize=1000)
# Initia... | qalhata/Python-Scripts-Repo-on-Data-Science | Datchunk_PopPlot.py | Python | gpl-3.0 | 1,416 |
#!/usr/bin/env python3
import sys
import os
import unittest
import logging
import inspect
# Extend PYTHONPATH with local 'lib' folder
if __name__ == "__main__":
jasyroot = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir, os.pardir, os.pardir))
sys.path.insert(0, jasyroot)
... | sebastian-software/jasy | jasy/test/style/specials.py | Python | mit | 1,570 |
from django.db import models
from django.db.models.query import EmptyQuerySet
from ...decorators import not_implemented
from query import NodeQuerySet
class NodeModelManager(models.Manager):
def __init__(self):
super(NodeModelManager, self).__init__()
self._using = None
self.model = None
... | mpetyx/django-rdfGraph | graphBackend/graphBackend/api/neo4django/db/models/manager.py | Python | mit | 1,150 |
# Copyright 2016 Capital One Services, 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 agreed to in... | RyanWolfe/cloud-custodian | tests/test_autotag.py | Python | apache-2.0 | 3,686 |
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
import copy
import ntpath
import os
import posixpath
import re
import subprocess
import sys
from collections import Ordered... | enclose-io/compiler | lts/tools/gyp/pylib/gyp/generator/msvs.py | Python | mit | 135,691 |
print('There once was a movie star icon')
print('who preferred to sleep with the light on')
print('They learned how to code')
print('a device that sure glowed')
print('and lit up the night using Python!')
| susanibach/IntroToPython | ChallengeSolutionFiles/Module2DisplayPoemChallengeSolution.py | Python | apache-2.0 | 210 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_jobs_operations.py | Python | mit | 42,923 |
import math
def bcuint(y, y1, y2, y12, x1l, x1u, x2l, x2u, x1, x2):
d1 = x1u-x1l
d2 = x2u-x2l
c = bcuoff(y,y1,y2,y12,d1,d2)
if x1u==x1l or x2u==x2l:
print "bad input in routine bcuint"
t = (x1-x1l)/d1
u = (x2-x2l)/d2
ansy = 0.0
for i in range(3, -1,-1):
ansy = t*ansy +(... | connolly/sims_catalogs_measures | python/lsst/sims/catalogs/measures/weakLensing/interpolation.py | Python | gpl-3.0 | 4,979 |
import os
import re
class Get(object):
"""All the getting stuff is here
"""
def __init__(self):
print "loading..."
@classmethod
def get_current_next_version(cls,filename, major=False):
version = re.match(".+[\._]v(\d+)[_.]?(\d+)?$", filename)
if version:
if vers... | arvizard1/vfxTools | vizTools/_get.py | Python | mit | 639 |
#-*- coding:utf-8 -*-
"""
This file is part of openexp.
openexp 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 version.
openexp is distributed in ... | amazinger2013/OpenSesame | libqtopensesame/sketchpad_elements/__init__.py | Python | gpl-3.0 | 1,008 |
import inspect
import logging
import optparse as op
import os
import sys
import api
import attrdict
import task
__usage__ = "%prog [OPTIONS] [BASE_DIRECTORY]"
def options():
return [
op.make_option('-c', '--cfg', dest='cfg', metavar='FILE',
help='Path to a config file to load. [./godo.cfg.py]... | joelimome/godo | godo/main.py | Python | mit | 2,850 |
"""This is a trivial test script for testing of Python in AppRunner"""
import os
import platform
import flask
app = flask.Flask(__name__)
app.url_map.strict_slashes = False #Tolerate trailing slashes
app_name = os.getenv("APP_NAME", 'python2')
HTML = """
<html>
<head><title>Python 2 in AppRunner - App {APP_NAME}</tit... | danielflower/app-runner | sample-apps/python2/server2.py | Python | mit | 1,113 |
import _plotly_utils.basevalidators
class MetaValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(self, plotly_name="meta", parent_name="parcats", **kwargs):
super(MetaValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
array_ok=k... | plotly/plotly.py | packages/python/plotly/plotly/validators/parcats/_meta.py | Python | mit | 435 |
#!/usr/bin/env python
#
# Copyright 2014, Rackspace US, 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 applicab... | VaneCloud/openstack-ansible | scripts/inventory-manage.py | Python | apache-2.0 | 10,570 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright notice
# ----------------
#
# Copyright (C) 2014 Daniel Jung
# Contact: djungbremen@gmail.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 Fo... | proggy/easytable | __init__.py | Python | gpl-2.0 | 57,611 |
from numpy import broadcast_arrays
from scipy.stats import (
linregress,
pearsonr,
spearmanr,
)
from zipline.errors import IncompatibleTerms
from zipline.pipeline.factors import CustomFactor
from zipline.pipeline.filters import SingleAsset
from zipline.pipeline.mixins import SingleInputMixin
from zipline.... | humdings/zipline | zipline/pipeline/factors/statistical.py | Python | apache-2.0 | 18,288 |
# -*- coding: utf-8 -*-
import os
import subprocess
import sys
import time
from girder import config
from girder.api import access
from girder.api.describe import Description, describeRoute
from girder.api.rest import Resource
from girder.constants import registerAccessFlag, ROOT_DIR
from girder.exceptions import Rest... | girder/girder | tests/web_client_test.py | Python | apache-2.0 | 8,021 |
#!/usr/bin/env python
import numpy, cube, fnv
bohr = 1.889725989
# i/o
fdef = 'def.cube' # charged defect supercell
fref = 'ref.cube' # reference (neutral or bulk) supercell
wf = 'dwf.cube' # defect wavefunction
is_charge = False # is the input a charge density file?
out = 'pc.dat' # output
# parameters
p... | wayn3/finite_size_correction | example.py | Python | gpl-2.0 | 915 |
# -*- coding: utf-8 -*-
"""
ulmo.usgs.core
~~~~~~~~~~~~~~
This module provides direct access to `USGS National Water Information
System`_ web services.
.. _USGS National Water Information System: http://waterdata.usgs.gov/nwis
"""
import contextlib
import datetime
import io
import logging
impor... | timcera/tsgettoolbox | src/tsgettoolbox/ulmo/usgs/nwis/core.py | Python | bsd-3-clause | 14,419 |
#
# Copyright (C) 2000-2005 by Yasushi Saito (yasushi.saito@gmail.com)
#
# Pychart 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 2, or (at your option) any
# later version.
#
# Pychart is dist... | cecep-edu/refactory | requirements/PyChart-1.39/demos/bartest.py | Python | gpl-3.0 | 1,647 |
import json
import logging
import os
import sys
import six
from docker.utils.ports import split_port
from jsonschema import Draft4Validator
from jsonschema import FormatChecker
from jsonschema import RefResolver
from jsonschema import ValidationError
from .errors import ConfigurationError
log = logging.getLogger(__... | j-fuentes/compose | compose/config/validation.py | Python | apache-2.0 | 13,105 |
"""Test the Coolmaster config flow."""
from unittest.mock import patch
from homeassistant import config_entries, setup
from homeassistant.components.coolmaster.const import DOMAIN, AVAILABLE_MODES
from tests.common import mock_coro
def _flow_data():
options = {"host": "1.1.1.1"}
for mode in AVAILABLE_MODES:... | joopert/home-assistant | tests/components/coolmaster/test_config_flow.py | Python | apache-2.0 | 3,258 |
# -*- coding: utf-8 -*-
# Created by apple on 2017/2/7.
from ..config import Config
from sanic import Blueprint
static_blueprint = Blueprint('static', Config.static_main)
# 静态文件
static_blueprint.static(Config.static_icon, Config.icon_dir)
static_blueprint.static(Config.static_app, Config.app_dir)
static_blueprint.st... | skytoup/AppServer | app/blueprints/static.py | Python | mit | 368 |
RASP_USER_NAME = 'pi'
DEFAULT_PASSWORD = 'raspberry'
| yuancheng2013/edupi | deploy/deploy/settings.py | Python | mit | 54 |
import pytest
from unittest import mock
from libhdhomerun import lib as HOMERUN_LIB
@pytest.fixture
def lib():
from libhdhomerun import api
return api.HDHomeRunLibrary()
@pytest.fixture
def device_mock():
return mock.Mock()
@pytest.fixture
def discover_device_mock(request):
patcher = mock.patch("... | rsenk330/glowstick | libhdhomerun/test/test_api.py | Python | mit | 9,198 |
#!/usr/bin/env python2
from setuptools import setup
setup(
name='vkplayer',
version='0.1',
description='VK Player built in Python & GTK3.',
url='http://github.com/and3rson/vkplayer',
author='Andrew Dunai',
author_email='andrew@dun.ai',
license='GPLv2',
packages=['vkpl'],
zip_safe=F... | and3rson/vkplayer | setup.py | Python | gpl-3.0 | 466 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2001-2006 Donald N. Allingham
# Copyright (C) 2009 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... | pmghalvorsen/gramps_branch | gramps/gui/plug/report/_fileentry.py | Python | gpl-2.0 | 3,959 |
#!/usr/bin/env python3
# A simple script that connects to a server and displays block headers
import time
import asyncio
from electrum_grs.network import Network
from electrum_grs.util import print_msg, json_encode, create_and_start_event_loop, log_exceptions
from electrum_grs.simple_config import SimpleConfig
conf... | GroestlCoin/electrum-grs | electrum_grs/scripts/block_headers.py | Python | gpl-3.0 | 1,046 |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'mysite.views.home', name='home'),
# url(r'^mysite/', include('mysite.foo.urls')),
# Uncomm... | snailwalker/python | zentst/0023/mysite/urls.py | Python | mit | 610 |
"""Development settings and globals."""
from __future__ import absolute_import
from os.path import join, normpath
from .base import *
########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-deb... | zachcalvert/eulers_cookbook | eulers_cookbook/eulers_cookbook/settings/local.py | Python | gpl-3.0 | 2,016 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A module for the run command."""
import cr
class RunCommand(cr.Command):
"""The implementation of the run command.
This first uses Builder to brin... | 7kbird/chrome | tools/cr/cr/commands/run.py | Python | bsd-3-clause | 1,663 |
# coding: utf-8
# This file is part of https://github.com/marcus67/rechtschreibung
import six
import log
import rulesets
if six.PY3:
from importlib import reload
reload(log)
reload(rulesets)
global logger
logger = log.open_logging(__name__)
def get_letter_histogram(text):
histogram = {}
for l in text:
i... | marcus67/rechtschreibung | statistics.py | Python | gpl-2.0 | 2,486 |
from util import runparams
from util import profile
from unsplitFluxes import *
import vars
import numpy
def evolve(myData, dt):
pf = profile.timer("evolve")
pf.begin()
dens = myData.getVarPtr("density")
xmom = myData.getVarPtr("x-momentum")
ymom = myData.getVarPtr("y-momentum")
ener = my... | bt3gl/Numerical-Methods-for-Physics | homework6_rayleigh-taylor_instability/compressible/evolve.py | Python | apache-2.0 | 2,345 |
#coding: utf-8
# 依赖openpyxl库:http://openpyxl.readthedocs.org/en/latest/
from openpyxl import Workbook
from openpyxl.compat import range
from openpyxl.cell import get_column_letter
from openpyxl import load_workbook
import csv
import os
import sys
def xlsx2csv(filename):
try:
xlsx_file_reader = load_workbo... | guanxiLi/django_check | d3jscluster/excel_to_csv.py | Python | apache-2.0 | 1,717 |
"""
naverwebtoonfeeds.feeds.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Defines endpoints for feeds.
"""
import logging
from flask import Blueprint, render_template, Response
from ..ext import cache
from .helpers import feed_cache_key, index_cache_key, naver_url
from .models import Series
from .signals import f... | clee704/NaverWebtoonFeeds | naverwebtoonfeeds/feeds/views.py | Python | agpl-3.0 | 1,882 |
# -*- coding: utf-8 -*-
#
# eofs documentation build configuration file, created by
# sphinx-quickstart on Thu Jul 5 15:47:55 2012.
#
# 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 co... | ajdawson/eofs | doc/conf.py | Python | gpl-3.0 | 9,234 |
# coding=utf-8
# Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
from twitter.common.collections import maybe_list
from pants.backend.python.targets.pyth... | foursquare/pants | src/python/pants/backend/python/targets/python_distribution.py | Python | apache-2.0 | 2,300 |
#! /usr/bin/env python3
# Written by Martin v. Löwis <loewis@informatik.hu-berlin.de>
"""Generate binary message catalog from textual translation description.
This program converts a textual Uniforum-style message catalog (.po file) into
a binary GNU catalog (.mo file). This is essentially the same function as the
G... | fp12/yahtr | tools/msgfmt.py | Python | mit | 7,033 |
# Functions to deal with messaging
''' Function to switch messaging between command line and ArcGIS dialog
Input:
AsGISTool: 0 if operating in command line, 1 if using as ArcGIS tool
Message: string for output to command line or ArcGIS dialog'''
def MessageSwitch(AsGISTool,Message):
try:
if AsGISTool==0:... | carawalter/RiverCorridorPolygons | MessagingModule.py | Python | mit | 508 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# virt.py - Copyright (C) 2012 Red Hat, Inc.
# Written by Fabian Deutsch <fabiand@redhat.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; versio... | ChinaMassClouds/copenstack-server | deploy/src/mplatform/utils/virt.py | Python | gpl-2.0 | 4,483 |
from Tkinter import *
import colorsys
class ising_gui(object):
MIN_RED = MIN_GREEN = MIN_BLUE = 0x0
MAX_RED = MAX_GREEN = MAX_BLUE = 0xFF
PIXEL_WIDTH = 10
def __init__(self, grid_x, grid_y):
self.grid_x = grid_x
self.grid_y = grid_y
self.pixels = [(0, 0, 0) for i in range(s... | rpcope1/PyIsing | ising_gui.py | Python | gpl-2.0 | 3,090 |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 28 17:49:08 2014
@author: chuong nguyen, chuong.v.nguyen@gmail.com
"""
from __future__ import absolute_import, division, print_function
import cv2
import logging
import timestream
import numpy as np
from timestream.parse import ts_parse_date
import docopt
import datetime... | borevitzlab/timestreamlib | scripts/tscli/playTimestream.py | Python | gpl-3.0 | 2,769 |
# -*- coding: utf-8 -*-
from __future__ import division, print_function
__all__ = ["State"]
import numpy as np
from .compat import iteritems
class State(object):
def __init__(self, coords, lnprior, lnlike, accepted=False, **metadata):
self.coords = coords
self.lnprior = lnprior
self.l... | jellis18/emcee3 | emcee3/state.py | Python | mit | 1,096 |
# $Id: 150_srtp_1_3.py 3334 2010-10-05 16:32:04Z nanang $
#
from inc_cfg import *
test_param = TestParam(
"Callee=optional SRTP, caller=optional (with duplicated offer) SRTP",
[
InstanceParam("callee", "--null-audio --use-srtp=1 --srtp-secure=0 --max-calls=1"),
InstanceParam("caller", "--null-audio -... | AlexanderVangelov/pjsip | tests/pjsua/scripts-call/150_srtp_1_3.py | Python | gpl-2.0 | 375 |
CC_RESPONSE_CODES = {
100: "Successful transaction",
101: "Declined - The request is missing one or more fields",
102: "Declined - One or more fields in the request contains invalid data",
104: "Declined - The merchantReferenceCode sent with this authorization request matches the mercha... | bartels/pycybersource | pycybersource/response.py | Python | bsd-3-clause | 6,752 |
import logging
logger = logging.getLogger(__name__)
from troposphere import Base64, Join
from stacker.blueprints.base import Blueprint
class EmpireBase(Blueprint):
def create_conditions(self):
logger.debug("No conditions to setup for %s", self.name)
def create_security_groups(self):
logger... | EnTeQuAk/stacker | stacker/blueprints/empire/empire_base.py | Python | bsd-2-clause | 1,541 |
import builder,os
from catalyst_support import *
class generic_x86(builder.generic):
"abstract base class for all x86 builders"
def __init__(self,myspec):
builder.generic.__init__(self,myspec)
if self.settings["buildarch"]=="amd64":
if not os.path.exists("/bin/linux32") and not os.path.exists("/usr/bin/linux... | dol-sen/catalyst | arch/x86.py | Python | gpl-2.0 | 5,365 |
# -*- coding: utf-8 -*-
import sys
import webbrowser
from builtins import input
from getpass import getpass
from toot import api, config, DEFAULT_INSTANCE, User, App
from toot.exceptions import ApiError, ConsoleError
from toot.output import print_out
def register_app(domain, scheme='https'):
print_out("Looking... | ihabunek/toot | toot/auth.py | Python | gpl-3.0 | 3,438 |
"""
WSGI config for esite project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTING... | vollovs/doonvalley | django/esite/wsgi.py | Python | mit | 392 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect 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 Lice... | AnshulYADAV007/Lean | Algorithm.Framework/Selection/QC500UniverseSelectionModel.py | Python | apache-2.0 | 4,855 |
#!/usr/bin/env python
# -*- Mode: Python; tab-width: 4 -*-
#
# Inf Driver parser
#
# Copyright (C) 2005-2007 Gianluigi Tiesi <sherpya@netfarm.it>
# 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; ... | smx-smx/ris-linux | infparser.py | Python | gpl-2.0 | 11,172 |
import numpy as np
from data_management.database import Database
from utils.utils import log, today
class DataManager(object):
name = "DataManager"
def __init__(self, monkey, starting_point="2016-12-01", end_point=today(), database_path=None):
self.db = Database(database_path)
self.monkey ... | AurelienNioche/MonkeyProject | data_management/data_manager.py | Python | gpl-3.0 | 6,946 |
# Copyright (c) 2011-2022 Berkeley Model United Nations. All rights reserved.
# Use of this source code is governed by a BSD License (see LICENSE).
import json
from django.db import transaction
from rest_framework import status
from rest_framework.response import Response
from huxley.core.models import Delegate
cl... | bmun/huxley | huxley/api/mixins.py | Python | bsd-3-clause | 1,318 |
from __future__ import print_function, division
'''
Use llvmlite to create executable functions from Sympy expressions
This module requires llvmlite (https://github.com/numba/llvmlite).
'''
import ctypes
from sympy.external import import_module
from sympy.printing.printer import Printer
from sympy import S
from sym... | jerli/sympy | sympy/printing/llvmjitcode.py | Python | bsd-3-clause | 7,509 |
#!/usr/bin/env python
"""
This file is part of open-ihm.
open-ihm 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 version.
open-ihm is di... | tectronics/open-ihm | src/openihm/outputs/routines/generate_data_entry_sheet.py | Python | lgpl-3.0 | 19,094 |
# Copyright 2016 Capital One Services, 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 agreed to in... | RyanWolfe/cloud-custodian | c7n/handler.py | Python | apache-2.0 | 2,110 |
#!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a plutoniumkoind ... | cassubian/plutonium | contrib/spendfrom/spendfrom.py | Python | mit | 10,245 |
# -*- coding: utf-8 -*-
from time import mktime, strptime
from module.plugins.Account import Account
class SimplydebridCom(Account):
__name__ = "SimplydebridCom"
__version__ = "0.1"
__type__ = "account"
__description__ = """Simply-Debrid.com account plugin"""
__author_name__ = "Kagenoshin"
... | estaban/pyload | module/plugins/accounts/SimplydebridCom.py | Python | gpl-3.0 | 1,155 |
# vi: ts=4 expandtab
#
# Copyright (C) 2012 Yahoo! Inc.
#
# Author: Joshua Harlow <harlowja@yahoo-inc.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
# published by the Free Software Foundation.
#
# This... | racker/cloud-init-debian-pkg | cloudinit/config/cc_write_files.py | Python | gpl-3.0 | 3,554 |
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
# Morituri - for those about to RIP
# Copyright (C) 2009 Thomas Vander Stichele
# This file is part of morituri.
#
# morituri 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 Sof... | thomasvs/morituri | morituri/common/log.py | Python | gpl-3.0 | 987 |
from json import loads, dumps
class User:
def __init__(self, username):
self.username = username
def __str__(self):
return self.username
class Message:
def __init__(self, user, message, timestamp):
self.user = user
self.message = message
self.timestamp = timesta... | martinhath/ttm4100-project | code/models.py | Python | mit | 1,159 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.