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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# ezIBpy: a Pythonic Client for Interactive Brokers API
# https://github.com/ranaroussi/ezibpy
#
# Copyright 2015 Ran Aroussi
#
# Licensed under the GNU Lesser General Public License, v3.0 (the "License");
# you may not use this file except in compliance with the License.... | ranaroussi/ezibpy | examples/movestoporder.py | Python | apache-2.0 | 1,403 |
import codewave_core.logger as logger
import codewave_core.util as util
import codewave_core.cmd_instance as cmd_instance
import codewave_core.positioned_cmd_instance as positioned_cmd_instance
import codewave_core.cmd_finder as cmd_finder
import codewave_core.text_parser as text_parser
import codewave_core.closing_p... | kevthunder/codewave-subl | codewave_core/codewave.py | Python | gpl-2.0 | 6,722 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
__RCSID__ = "$Id$"
def VmB(vmKey):
__memScale = {"kB": 1024.0, "mB": 1024.0 * 1024.0, "KB": 1024.0, "MB": 1024.0 * 1024.0}
__vmKeys = [
"VmPeak:",
"VmSize:",
"VmLck:... | ic-hep/DIRAC | src/DIRAC/Core/Utilities/MemStat.py | Python | gpl-3.0 | 1,174 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from flask import session
from indico.core import signals
from indico.core.logger import Logger
from indi... | ThiefMaster/indico | indico/modules/events/persons/__init__.py | Python | mit | 1,555 |
#!/usr/bin/env python3
import dns.resolver
import dns.rdatatype
# This shouldn't be necessary, but for some reason __import__ when
# called from a coroutine, doesn't always work, and I haven't been
# able to figure out why. Possibly this is a 3.4.0 bug that's fixed
# later, but googling for it hasn't worked.
import ... | Abhayakara/minder | smtpd/smtpd.py | Python | gpl-3.0 | 27,553 |
import unittest
class SimplisticTest(unittest.TestCase):
def test(self):
self.failUnless(True)
if __name__ == "__main__":
unittest.main()
| noogel/xyzStudyPython | unittest/unittest_simple.py | Python | apache-2.0 | 157 |
#coding: utf-8
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from conf import mail_conf
def send_mail(to_mail, title, content):
username = mail_conf['username']
password = mail_conf['password']
smtp_server = mail_conf['smtp_server']
from_mail = mail... | hackersql/sq1map | Web/信息收集/信息收集/漏洞扫描/WVS_Patcher-master/mail.py | Python | gpl-3.0 | 932 |
from django.test.client import RequestFactory
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db.models.fields import FieldDoesNotExist
from django.contrib.admin.options import ModelAdmin
from django.contrib.admin.sites import AdminSite
from django.contrib.comments i... | martinburchell/econsensus | django/econsensus/publicweb/tests/open_consent_test_case.py | Python | gpl-3.0 | 5,275 |
#!/usr/bin/python
#
# Copyright 2008 Ariel Barmat.
'''The setup and build script for the python-oembed library.'''
__author__ = 'abarmat@gmail.com'
__version__ = '0.1.1'
# The base package metadata to be used by both distutils and setuptools
METADATA = dict(
name = "python-oembed",
version = __version__,
py_m... | dokterbob/python-oembed | setup.py | Python | mit | 1,784 |
from django.apps import AppConfig
from django.conf import settings
from health_check.plugins import plugin_dir
class HealthCheckConfig(AppConfig):
name = 'tg_utils.health_check.checks.phantomjs'
def ready(self):
from .backends import PhantomJSHealthCheck, PhantomJSWithHeaderHtmlHealthCheck
... | thorgate/tg-utils | tg_utils/health_check/checks/phantomjs/apps.py | Python | isc | 565 |
# Copyright (c) 2011, Kundan Singh. All rights reserved. see README for details.
'''
This is a simple tunnel application that receives connection on RTMPT and forwards on RTMP.
I have tested this with Flash VideoIO on Flash Player 11 and rtmplite's rtmp.py server. To test it yourself, first start an RTMP server, e.g.... | Rembane/rtmplitefork | rtmpt.py | Python | gpl-3.0 | 9,254 |
"""An achievement group which manages and groups achievements."""
from typing import Optional, List
from random import choice
from mpf.core.events import event_handler, EventHandlerKey
from mpf.core.machine import MachineController
from mpf.core.mode import Mode
from mpf.core.mode_device import ModeDevice
from mpf.co... | missionpinball/mpf | mpf/devices/achievement_group.py | Python | mit | 12,482 |
# Copyright 2011 Eldar Nugaev
# 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 ... | tylertian/Openstack | openstack F/nova/nova/tests/api/openstack/compute/contrib/test_server_diagnostics.py | Python | apache-2.0 | 2,735 |
import os
def makedirs(d):
try:
os.makedirs(d)
except OSError, e:
if e.errno != 17:
raise e
| arnehilmann/ebookkit | ebookkit/util.py | Python | gpl-3.0 | 129 |
#!/usr/bin/env python
"""Universal feed parser
Visit http://diveintomark.org/projects/feed_parser/ for the latest version
Handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom feeds
Required: Python 2.1 or later
Recommended: Python 2.3 or later
Recommended: libxml2 <http://xmlsoft.org/python.html>
"""
__version__ = "3.0-fc... | qilicun/python | python2/PyMOTW-1.132/PyMOTW/Queue/feedparser.py | Python | gpl-3.0 | 87,457 |
from __future__ import absolute_import
import six
from sentry.app import tsdb
from sentry.testutils import APITestCase
class ProjectGroupStatsTest(APITestCase):
def test_simple(self):
self.login_as(user=self.user)
project = self.create_project()
group1 = self.create_group(project=projec... | ifduyue/sentry | tests/sentry/api/endpoints/test_project_group_stats.py | Python | bsd-3-clause | 1,204 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | jmcnamara/XlsxWriter | xlsxwriter/test/comparison/test_hyperlink17.py | Python | bsd-2-clause | 1,018 |
# 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 frappe
from frappe import _
from frappe.utils import get_fullname
from frappe.model.document import Document
from erpnext.hr.utils import set_... | indictranstech/focal-erpnext | hr/doctype/expense_claim/expense_claim.py | Python | agpl-3.0 | 1,299 |
"""The tests for the Flux switch platform."""
import unittest
from datetime import timedelta
from unittest.mock import patch
from homeassistant.bootstrap import _setup_component, setup_component
from homeassistant.components import switch, light
from homeassistant.const import CONF_PLATFORM, STATE_ON, SERVICE_TURN_ON
... | mikaelboman/home-assistant | tests/components/switch/test_flux.py | Python | mit | 21,978 |
from .. import value
def Num(node):
return value.Value(node.n), []
def Str(node):
return value.Value(node.s), []
def Bytes(node):
return value.Value(node.s), []
def NameConstant(node):
return value.Value(node.value), []
def List(node):
return lambda *d: list(d), node.elts
def Tuple(node)... | timedata-org/expressy | expressy/ast_handlers/literals.py | Python | mit | 805 |
from unittest import TestCase
from base_mock_outbound_gate import BaseMockOutboundGate
from server.restful_api.data.v1.endpoints.cpus import CpusEndpoint
from server.restful_api.general.requestholder import RequestHolder
class TestCpusEndpoint(TestCase):
def setUp(self):
class MockEndpoint(CpusEndpoint)... | OpServ-Monitoring/opserv-backend | test/server/restful_api/data/v1/endpoints/test_cpus.py | Python | gpl-3.0 | 2,396 |
#!/usr/bin/env python2
from __future__ import division
import itertools
import math
import sys
import numpy
import scipy.stats
import cligraph
import utils
"""
TODO:
- Auto-detect number of bins
- Fixed width or variable width bins
- Stacked bins, overlapped bins or bins next to each other
- Change which side of bi... | bsmithers/CLIgraphs | histogram.py | Python | agpl-3.0 | 8,515 |
# 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 t... | froyobin/horizon | openstack_dashboard/dashboards/admin/volumes/volume_types/qos_specs/tests.py | Python | apache-2.0 | 7,735 |
# $Id: __init__.py,v 1.1 2001/01/19 18:59:37 petli Exp $
#
# Xlib.keysymdef -- X keysym defs
#
# Copyright (C) 2001 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# 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 Fre... | nvazquez/Turtlebots | plugins/xevents/Xlib/keysymdef/__init__.py | Python | mit | 1,171 |
#!/usr/bin/env python
#
# Wrapper script for Java Conda packages that ensures that the java runtime
# is invoked with the right options. Adapted from the bash script (http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in/246128#246128).
#
# Program Parameters
#
import os
import s... | zwanli/bioconda-recipes | recipes/peptide-shaker/1.13.3/peptide-shaker.py | Python | mit | 2,617 |
#
# Honeybee: A Plugin for Environmental Analysis (GPL) started by Mostapha Sadeghipour Roudsari
#
# This file is part of Honeybee.
#
# Copyright (c) 2013-2020, Mostapha Sadeghipour Roudsari <mostapha@ladybug.tools>
# Honeybee is free software; you can redistribute it and/or modify
# it under the terms of the GNU G... | mostaphaRoudsari/Honeybee | src/Honeybee_EnergyPlus NoMass Opaque Material.py | Python | gpl-3.0 | 5,463 |
# -*- coding: utf-8 -*-
import random
from math import sqrt
#from scipy.constants import k as k_b
def langevin_dynamics(x_0, v_0, temp, damp, time_step, total_time, mass, potential_energy_filepath, output_file = 'output.txt'):
'''Completes a 1 dimensional Langevin Dynamics Simulation dependant on an input file of the... | arosenstein/langevin_dynamics | langevin_dynamics/langevin_dynamics.py | Python | mit | 2,624 |
"""Measurement channels module for Zigbee Home Automation."""
import zigpy.zcl.clusters.measurement as measurement
from .. import registries
from ..const import (
REPORT_CONFIG_DEFAULT,
REPORT_CONFIG_IMMEDIATE,
REPORT_CONFIG_MAX_INT,
REPORT_CONFIG_MIN_INT,
)
from .base import ZigbeeChannel
@registrie... | tboyce021/home-assistant | homeassistant/components/zha/core/channels/measurement.py | Python | apache-2.0 | 2,282 |
#!/usr/bin/env python3
"""
The 8-Queens Problem as dynamic programming.
https://en.wikipedia.org/wiki/Eight_queens_puzzle
"""
class QueenSolver:
def __init__(self, numqueens, boardsize):
# Cast and validate
self.numqueens = int(numqueens)
self.boardsize = int(boardsize)
assert self... | jnez71/demos | methods/dynpro_queens.py | Python | mit | 2,894 |
""" comment
export DJANGO_SETTINGS_MODULE="opentrain.settings"
"""
import os
import sys
sys.path.append(os.getcwd())
sys.path.append(os.path.dirname(os.getcwd()))
os.environ['DJANGO_SETTINGS_MODULE'] = 'opentrain.settings'
#/home/oferb/docs/train_project/OpenTrains/webserver
import analysis.models
try:
import matp... | hasadna/OpenTrain | webserver/opentrain/algorithm/stop_detector_test.py | Python | bsd-3-clause | 6,222 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: ?? ???. 6 11:47:57 2012
# by: The Resource Compiler for PyQt (Qt v4.8.1)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x06\xdf\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x4... | bigbn/Telesk | resource_rc.py | Python | gpl-2.0 | 65,814 |
# -*- coding: utf-8 -*-
#
# Copyright 2013 Simone Campagna
#
# 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... | simone-campagna/daikon | tests/unit/test_schema.py | Python | apache-2.0 | 14,840 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Install a provisioning profile
#
import os, sys, subprocess, re, time, poorjson, types
from xml.dom.minidom import parseString
import codecs
from OpenSSL import crypto
def dequote(s):
if s[0:1] == '"':
return s[1:-1]
return s
def getText(nodelist):
... | gianina-ingenuity/titanium-branch-deep-linking | testbed/x/mobilesdk/osx/5.5.1.GA/iphone/provisioner.py | Python | mit | 3,613 |
from questions import *
class Question(RandomizedQuestion):
module = __file__
video = 'alternating-series-important'
# forum = 10187
title = 'approximate a value of arctangent'
textbook = 'example:approximate-alternating-harmonic-series'
def good_enough(self):
# don't want just a single... | kisonecat/sequences-and-series | quizzes/approximateArctangent/__init__.py | Python | gpl-3.0 | 4,707 |
import itertools
from unittest.mock import patch
from ddt import data, ddt
from django.conf import settings
from django.contrib.auth import get_user_model
from rest_framework import status, test
from waldur_core.core.tests.helpers import override_waldur_core_settings
from waldur_core.structure.tests import factories ... | opennode/nodeconductor-assembly-waldur | src/waldur_openstack/openstack/tests/test_tenant.py | Python | mit | 32,256 |
#pylint: disable=bare-except, wildcard-import, too-few-public-methods
"""
Data models
"""
#TODO: move the script generation from the forms to the models
from __future__ import unicode_literals
import sys
import logging
import re
from math import *
from django.db import models
from django.contrib.auth.models import ... | neutrons/web_reflectivity | web_reflectivity/fitting/models.py | Python | apache-2.0 | 20,971 |
def email_domain_loader():
return [
'0-mail.com',
'0815.ru',
'0815.su',
'0clickemail.com',
'0sg.net',
'0wnd.net',
'0wnd.org',
'10mail.org',
'10minutemail.cf',
'10minutemail.com',
'10minutemail.de',
'10minutemail.ga',
... | aaronbassett/DisposableEmailChecker | disposable_email_checker/emails.py | Python | bsd-3-clause | 31,110 |
# Copyright 2016 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... | beomyeol/models | transformer/cluttered_mnist.py | Python | apache-2.0 | 6,536 |
"""
CLASS INFO
-------------------------------------------------------------------------------------------
Dataset_transformations contains every method that has to do with processing or altering a
dataset's structure. Regularyl used in netCDF data for easy transformation of N-dim arrays
to 2D and ... | iaklampanos/bde-pilot-2 | backend/Dataset_transformations.py | Python | apache-2.0 | 2,715 |
# 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 of the License, or
# (at your option) any later version.
import logging
import os
import shutil
import signal
from socket impor... | jtoppins/beaker | IntegrationTests/src/bkr/inttest/labcontroller/__init__.py | Python | gpl-2.0 | 6,241 |
"""Support for SmartHab device integration."""
import logging
import pysmarthab
import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import Confi... | lukas-hetzenecker/home-assistant | homeassistant/components/smarthab/__init__.py | Python | apache-2.0 | 2,407 |
def bijective():
flag=1
for i in range(0,input1):
for j in range(0,i):
if((j+1) in input2):
continue
else:
return "NO"
return "YES"
input1 = int(input())
input2 = [int(x) for x in (input().split())] | priyotosh1/HackerRank_Security | Functions/bijectiveFunction.py | Python | unlicense | 310 |
# -*- coding: utf-8 -*-
import logging
import requests
from pymogilefs.client import Client
from pymogilefs.exceptions import MogilefsError
logger = logging.getLogger('pymogilefs')
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
handler.setFormatter(
logging.Formatter('[%(asctime)s] p%(process)... | bwind/pymogilefs | example/example.py | Python | mit | 1,118 |
urlpatterns = []
handler404 = 'csrf_tests.views.csrf_token_error_handler'
| nesdis/djongo | tests/django_tests/tests/v22/tests/csrf_tests/csrf_token_error_handler_urls.py | Python | agpl-3.0 | 75 |
#!/usr/bin/python
#
# backend code for upgrading from Samba3
# Copyright Jelmer Vernooij 2005-2007
# Released under the GNU GPL v3 or later
#
"""Support code for upgrading from Samba 3 to Samba 4."""
__docformat__ = "restructuredText"
from provision import provision, FILL_DRS
import grp
import ldb
import time
import... | ghmajx/asuswrt-merlin | release/src/router/samba-3.5.8/source4/scripting/python/samba/upgrade.py | Python | gpl-2.0 | 12,708 |
# vim:ts=4:et
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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
# of the License, or (at your option) any later version.
#
# This prog... | taniwha/io_object_mu | quickhull/triangle.py | Python | gpl-2.0 | 4,080 |
#calculo de IMC
#autor = Igor
Altura = 0.0
Peso = 0.0
Altura =float(input("Qual a sua Altura?"))
Peso = float(input("Qual o seu Peso?"))
IMC = Peso / (Altura * Altura)
print(IMC) | ronas/PythonGNF | Igor/IMCv2.py | Python | gpl-3.0 | 185 |
#!motor/env/bin/python
from flask import Flask, request, abort
from flask_restful import Api, Resource, reqparse
from flask_cors import CORS
app = Flask("motor_mock")
CORS(app)
@app.before_request
def only_json():
if request.data and not request.is_json:
abort(400)
api = Api(app)
class MoveMotor(Resour... | fhollanda/Stepper-Motor-Interface | motor/test/mock.py | Python | gpl-3.0 | 1,074 |
# Waterbug, a modular IRC bot written using Python 3
# Copyright (C) 2011 Arvid Fahlström Myrman
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... | BeholdMyGlory/waterbug | src/main.py | Python | agpl-3.0 | 1,208 |
import oe.path
class NotFoundError(bb.BBHandledException):
def __init__(self, path):
self.path = path
def __str__(self):
return "Error: %s not found." % self.path
class CmdError(bb.BBHandledException):
def __init__(self, exitstatus, output):
self.status = exitstatus
self.o... | jaimeantena4040/MiSitioWeb | meta/lib/oe/patch.py | Python | gpl-2.0 | 24,544 |
# IMAPFS - Cloud storage via IMAP
# Copyright (C) 2013 Wes Weber
#
# 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 version.
#
# T... | waweber/imapfs | imapfs/file.py | Python | gpl-3.0 | 7,538 |
from PySide2.QtWidgets import QVBoxLayout
from cutevariant.gui.plugin import PluginWidget
from cutevariant.core.sql import get_sql_connection
from cutevariant.gui.widgets.filters import (
FiltersEditor,
StringFilterWidget,
ChoiceFilterWidget,
)
class AuragenFilterWidget(PluginWidget):
"""Plugin to sh... | labsquare/CuteVariant | poc/auragen_filter/widgets.py | Python | gpl-3.0 | 3,206 |
# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for ISeriesSourcePackageBranch."""
__metaclass__ = type
from datetime import datetime
import pytz
import transaction
from zope.component import getUtility
from lp... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/code/tests/test_seriessourcepackagebranch.py | Python | agpl-3.0 | 5,762 |
# -*- encoding: UTF-8 -*-
class Instrucao_R_I (object):
def __init__(self, tipo, resultado, valor1, valor2=None, func=None):
self.__tipo = tipo
self.__resultado = resultado
self.__valor1 = valor1
self.__valor2 = valor2
self.__func = func
def getTipo (self):
... | diogocs1/simuladormips | lib/instrucoes.py | Python | gpl-2.0 | 1,148 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | mfherbst/spack | var/spack/repos/builtin/packages/codar-cheetah/package.py | Python | lgpl-2.1 | 1,817 |
__problem_title__ = "Square root digital expansion"
__problem_url___ = "https://projecteuler.net/problem=80"
__problem_description__ = "It is well known that if the square root of a natural number is not " \
"an integer, then it is irrational. The decimal expansion of such " \
... | jrichte43/ProjectEuler | Problem-0080/solutions.py | Python | gpl-3.0 | 1,165 |
##
# Copyright (C) 2013 TopCoder Inc., All Rights Reserved.
##
"""
CSVReader is designed to read data from CSV file and construct entity classes.
"""
__author__ = 'Easyhard'
__version__ = '1.0'
from conversion.datareader import DataReader
import csv
from datetime import date, datetime
from conversion import entities... | NASA-Tournament-Lab/CoECI-CMS-Healthcare-Fraud-Prevention | partnerclient/hfppnetwork/partner/conversion/csvreader.py | Python | apache-2.0 | 4,007 |
# Generated by Django 2.0.10 on 2019-03-31 20:14
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('event', '0007_auto_2019... | pytexas/PyTexasBackend | conference/event/migrations/0008_session_reviewer.py | Python | mit | 628 |
print 0xff
| ArcherSys/ArcherSys | skulpt/test/run/t95.py | Python | mit | 11 |
import sys
try:
from django.conf import settings
settings.configure(
DEBUG=True,
USE_TZ=True,
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
}
},
ROOT_URLCONF="djangomapfiles.urls",
INSTALLED_APPS=[
... | pellagic-puffbomb/django-mapfiles | runtests.py | Python | bsd-3-clause | 1,103 |
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2008 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Public License version 2 as published by
# the Free Software Founda... | offlinehacker/flumotion | flumotion/test/test_bouncers_multibouncer.py | Python | gpl-2.0 | 10,685 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'AdvertisementPanel.cols'
db.add_column(u'advertisements_a... | OpenAds/OpenAds | advertisements/migrations/0013_auto__add_field_advertisementpanel_cols__add_field_advertisementpanel_.py | Python | mit | 7,578 |
"""
Configures acls for various users/groups so they can access the cobbler command
line as non-root. Now that CLI is largely remoted (XMLRPC) this is largely just
useful for not having to log in (access to shared-secret) file but also grants
access to hand-edit various collections files and other useful things.
Copy... | kflavin/cobbler | cobbler/action_acl.py | Python | gpl-2.0 | 3,403 |
from commando import management
BaseSQLCommand = management.get_command_class(
"sql", exclude_packages=("commando",))
if BaseSQLCommand is not None:
base = BaseSQLCommand()
class SQLCommandOptions(management.CommandOptions):
"""
SQL command options.
"""
... | skibblenybbles/django-commando | commando/django/core/management/sql.py | Python | mit | 1,170 |
from contextlib import contextmanager
import sys
@contextmanager
def redirect_stdout(stream):
original_stdout = sys.stdout
sys.stdout = stream
yield
sys.stdout = original_stdout
| opensanca/trilha-python | 02-python-oo/aula-06/exemplos/gerenciador_de_contexto/redirect_stdout2.py | Python | mit | 196 |
"""
Joint kernel density estimate
=============================
_thumb: .6, .4
"""
import numpy as np
import pandas as pd
import seaborn as sns
sns.set(style="white")
# Generate a random correlated bivariate dataset
rs = np.random.RandomState(5)
mean = [0, 0]
cov = [(1, .5), (.5, 1)]
x1, x2 = rs.multivariate_normal(m... | phobson/seaborn | examples/joint_kde.py | Python | bsd-3-clause | 523 |
from rest_framework import serializers
def serializer_factory(model, serializer_class=serializers.ModelSerializer, attrs=None, meta=None):
"""
Generate a simple serializer for the given model class.
:param model: Model class
:param serializer_class: Serializer base class
:param attrs: Serializer ... | kcsry/wurst | wurst/api/utils.py | Python | mit | 646 |
#!/usr/bin/env python3
#
# Copyright (c) 2015 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | openstack/oslo.context | doc/source/user/examples/usage_user_identity.py | Python | apache-2.0 | 1,507 |
from puq import *
import numpy as np
# test case with just a single point
def run():
# Declare our parameters here. Both are uniform on [-2, 2]
x = UniformParameter('x', 'x', min=-2, max=2)
# Create a host
host = InteractiveHost()
# Use any of the following
# valarray = np.array([1,2,3,4,5])
... | c-PRIMED/puq | examples/simple_sweep/poly_1.py | Python | mit | 464 |
'''SSL with SNI_-support for Python 2. Follow these instructions if you would
like to verify SSL certificates in Python 2. Note, the default libraries do
*not* do certificate checking; you need to do additional work to validate
certificates yourself.
This needs the following packages installed:
* pyOpenSSL (tested wi... | joealcorn/xbox | xbox/vendor/requests/packages/urllib3/contrib/pyopenssl.py | Python | mit | 9,289 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import Counter
import random
import os
import zipfile
import numpy as np
from six.moves import urllib
import tensorflow as tf
# Parameters for downloading data
DOWNLOAD_URL = 'http://mattmaho... | kabrapratik28/Stanford_courses | cs20si/tf-stanford-tutorials/examples/process_data.py | Python | apache-2.0 | 3,669 |
#!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import
import codecs
import os
import six.moves.configparser
import sys
import tct
from tct import deepget
params = tct.readjson(sys.argv[1])
facts = tct.readjson(params['factsfile'])
milestones = tct.readjson(params['milest... | marble/Toolchain_RenderDocumentation | 12-Get-ready-for-the-project/run_20-Merge-all-buildsettings.py | Python | mit | 6,480 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Base class to iterate file sources and run a function on all files.
The iteration will iterate over files paths, its up to you to open files etc.
Author: Ronen Ness.
Since: 2016
"""
from sources import *
from filters import *
import os
class FilesIterator(object):
""... | RonenNess/Fileter | fileter/files_iterator.py | Python | mit | 11,630 |
import _plotly_utils.basevalidators
class TypeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="type", parent_name="layout.scene.xaxis", **kwargs):
super(TypeValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/layout/scene/xaxis/_type.py | Python | mit | 532 |
# 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 of the License, or
# (at your option) any later version.
"""
.. _bkr-pool-add:
bkr pool-add: Add systems to a system pool
====... | beaker-project/beaker | Client/src/bkr/client/commands/cmd_pool_add.py | Python | gpl-2.0 | 2,794 |
from setuptools import setup
import gief
setup(
name = 'gief',
description = gief.__doc__,
version = gief.__version__,
packages = ['gief'],
scripts = ['scripts/gief'],
install_requires = ['flask==0.11', 'werkzeug==0.16.0'],
url = 'https://github.com/jorgebg/gief',
author = gief.__author__,
author_e... | jorgebg/gief | setup.py | Python | mit | 432 |
# Module to run tests on spectra.io
from __future__ import print_function, absolute_import, \
division, unicode_literals
import os
import pytest
import numpy as np
from shutil import copyfile
import glob
from astropy.io import fits
from astropy.table import Table
from cosredux import utils
from cosredux import... | PYPIT/COS_REDUX | cosredux/tests/test_trace.py | Python | bsd-2-clause | 7,868 |
"""Parser for the CF6 Product."""
import re
import calendar
from io import StringIO
import datetime
from pyiem.nws.product import TextProduct
from pyiem.reference import TRACE_VALUE
import pandas as pd
MONTH_RE = re.compile(r"^MONTH:\s+(?P<month>[A-Z]+)$", re.I)
MONTH_RE_NUM = re.compile(r"^MONTH:\s+(?P<month>[0-9]+)... | akrherz/pyIEM | src/pyiem/nws/products/cf6.py | Python | mit | 5,123 |
# Copyright (c) 2013 Michael Bitzi
# Licensed under the MIT license http://opensource.org/licenses/MIT
import cffi
from pwm.ffi import headers
ffi = cffi.FFI()
ffi.cdef("""
void free(void *ptr);
""" + headers.xcb+headers.cairo)
lib = ffi.verify("""
#include <stdlib.h>
#include <xcb/xcb.h>
#include <xcb... | mibitzi/pwm | pwm/ffi/base.py | Python | mit | 502 |
import re
import pytest
from click.testing import CliRunner
import botocore
from pygypsy.scripts.cli import cli
from conftest import BUCKET
S3_BKT_PREFIX = 's3://%s/' % BUCKET
SKIP_IF_NO_S3 = pytest.mark.skipif(BUCKET is None,
reason="S3 tests are not configured locally")
def s3_o... | tesera/pygypsy | tests/test_cli_s3.py | Python | mit | 3,416 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | 3dfxsoftware/cbss-addons | report_intrastat/report/invoice.py | Python | gpl-2.0 | 1,575 |
# coding=utf-8
"""
This module, qa_selenium_scripts.py, will contain Selenium scripts to run against SK.
"""
# Check if Ubuntu is running this script.
from sys import platform as _platform
if _platform == "linux" or _platform == "linux2":
import sys
# sys.path.remove('/home/dev_usr/urbtek/nexus_django')
sys.path.... | utarsuno/urbtek | quality_assurance/selenium_scripts/sk/sk_selenium_scripts.py | Python | apache-2.0 | 13,938 |
from kayvee import *
| Clever/kayvee-python | kayvee/__init__.py | Python | apache-2.0 | 21 |
import mock
import uuid
import shutil
import tempfile
from cinder import context
from cinder import test
from cinder import quota
from cinder.openstack.common import importutils
from oslo.config import cfg
from stevedore import extension
from paxes_cinder.volume.drivers.vios import vios_iscsi
QUOTAS = quota.QUOTAS
C... | windskyer/k_cinder | paxes_cinder/tests/volume/drivers/vios/test_vios_iscsi.py | Python | apache-2.0 | 3,072 |
#!/usr/bin/env python
# encoding: utf-8
from datetime import datetime
from pyexchange.exchange import models
base_url = "https://www.bitstamp.net/api"
class Bitstamp(models.Exchange):
"""Docstring for Bitstamp """
_markets_map = {'btc_usd': 'btc_usd'}
def __init__(self, market="btc_usd"):
"""@... | coderiot/pyexchange | pyexchange/exchange/bitstamp.py | Python | gpl-2.0 | 2,316 |
# Copyright (c) 2006-2007 The Regents of The University of Michigan
# Copyright (c) 2009 Advanced Micro Devices, 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 co... | koparasy/faultinjection-gem5 | configs/example/ruby_mem_test.py | Python | bsd-3-clause | 5,641 |
#!/usr/bin/python
import numpy as np
import matplotlib.pyplot as plt
import csv
from matplotlib.collections import LineCollection
file = "lattice.dat"
#ax = plt.gca(projection='3d')
pscale=1.0
lscale=10.0
fig, ax = plt. subplots()
ax.set_aspect('equal')
desired=[1,2]
with open(file, 'r') as fin:
reader=csv.reade... | kmkolasinski/Quantulaba | plots/plot_lattice.py | Python | mit | 1,492 |
#!/usr/bin/env python
# coding=utf-8
from toughlib import utils,apiutils
from toughlib.permit import permit
from toughradius.manage.api.apibase import ApiHandler
from toughradius.manage import models
from toughradius.manage.radius.radius_acct_start import RadiusAcctStart
from toughradius.manage.radius.radius_acct_upda... | sumonchai/ToughRADIUS | toughradius/manage/api/v1/api_accounting.py | Python | agpl-3.0 | 1,517 |
#
# FishPi - An autonomous drop in the ocean
#
# View Controller for RPC approach
# View Model for POCV MainView
#
import os
import logging
import math
import wx
from PIL import Image
class MainViewController:
""" Coordinator between UI and main control layers. """
def __init__(self, rpc_client, view_mo... | FishPi/FishPi-POCV---Command---Control | fishpi/ui/view_model_wx.py | Python | bsd-2-clause | 5,506 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo 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 the Software with... | bencharb/AutobahnPython | examples/asyncio/wamp/rpc/slowsquare/frontend.py | Python | mit | 2,616 |
# Copyright The PyTorch Lightning team.
#
# 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 i... | williamFalcon/pytorch-lightning | tests/base/model_optimizers.py | Python | apache-2.0 | 2,560 |
#!/usr/bin/env python
"""
Commands related to syncing copytext from Google Docs.
"""
import app_config
import os
from fabric.api import task
from oauth import get_document, get_credentials
from termcolor import colored
@task(default=True)
def update(gid=None):
"""
Downloads a Google Doc as an Excel file.
... | INN/app-template | fabfile/text.py | Python | mit | 896 |
#
# Copyright (c) dushin.net All Rights Reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the foll... | fadushin/esp8266 | micropython/ulog/ulog/mqtt_sink.py | Python | bsd-2-clause | 2,794 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutStrings(Koan):
def test_double_quoted_strings_are_strings(self):
string = "Hello, world."
self.assertEqual(True, isinstance(string, basestring))
def test_single_quoted_strings_are_also_strings(self):
... | iceout/python_koans_practice | python2/koans/about_strings.py | Python | mit | 3,094 |
# -*- Mode: python; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*-
#
# Copyright (C) 2014 - fossfreedom
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of thie GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your ... | fossfreedom/close-on-hide | close-on-hide.py | Python | gpl-3.0 | 1,588 |
import random
from nose.tools import eq_
from chorddb.chords import Chord
from chorddb.notes import Key
__KEYS = ["A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"]
_KEYS = [Key.parse(k) for k in __KEYS]
_VARIATIONS = ["m", "7", "m7", "maj7"]
def _check_text_parsing(chord):
eq_(Chord.parse(chord.t... | pignacio/chorddb | test/test_chords/__init__.py | Python | gpl-3.0 | 1,372 |
import numpy as np
import theano
import theano.tensor as T
import treeano.nodes as tn
fX = theano.config.floatX
# TODO change me
# n = tn.SpatialRepeatNDNode
n = tn.SpatialSparseUpsampleNode
network = tn.SequentialNode(
"s",
[tn.InputNode("i", shape=(32, 32, 32, 32, 32)),
n("us", upsample_factor=(2, 2, 2... | diogo149/treeano | benchmarks/repeat_n_d_vs_sparse_upsample.py | Python | apache-2.0 | 528 |
import numpy as np
import sys
import util
import time
default_phi_function = lambda x: np.sum(np.abs(x))
default_psi_function = util.soft
def sparsa(y, Aop, tau,
stopCriterion = 2, tolA = 0.01, tolD = 0.001, debias=0, maxiter = 10000,
maxiter_debias = 200, miniter = 5, miniter_debias=0,
... | ericmjonas/pySpaRSA | pysparsa/sparsa.py | Python | mit | 6,917 |
import sys
import random
from devp2p.app import BaseApp
from devp2p.protocol import BaseProtocol
from devp2p.discovery import NodeDiscovery
from devp2p.service import WiredService
from devp2p.crypto import privtopub as privtopub_raw, sha3
from devp2p.utils import colors, COLOR_END
from devp2p import app_helper
from dev... | TomzOk/tiny-ether | fixtures/fixture.py | Python | gpl-3.0 | 2,291 |
# -*- coding: UTF-8 -*-
'''
Module
ats_key_error.py
Copyright
Copyright (C) 2017 Vladimir Roncevic <elektron.ronca@gmail.com>
ats_utilities 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 Foundatio... | vroncevic/py_util | ats_utilities/exceptions/ats_key_error.py | Python | gpl-3.0 | 1,549 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.