code
stringlengths
6
947k
repo_name
stringlengths
5
100
path
stringlengths
4
226
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
6
947k
#!usr/bin/env python from pysnmp.entity.rfc3413.oneliner import cmdgen import shlex import subprocess import re import os import sys import smtplib from devices.models import AP as AccessPoint ## This file is used to update the access point inventory data. Use the ## updateAccessPoints function to run the update. The ...
lindseypack/NIM
code/ap/apInv.py
Python
mit
5,106
import json from rest_framework.renderers import JSONRenderer class CustomJSONRenderer(JSONRenderer): charset = 'utf-8' object_label = 'object' pagination_object_label = 'objects' pagination_count_label = 'count' def render(self, data, media_type=None, renderer_context=None): if data.get...
jsbUSMC/django-edge-api
apps/core/renderers.py
Python
mit
977
"""Support for Melnor RainCloud sprinkler water timer.""" from __future__ import annotations import logging import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity from homeassistant.const import CONF_MONITORED_CONDITIONS from homeassistant.core import HomeAssistant import ...
rohitranjan1991/home-assistant
homeassistant/components/raincloud/sensor.py
Python
mit
2,656
#!/usr/bin/env python # -*- coding: utf8 -*- # ***************************************************************** # ** PTS -- Python Toolkit for working with SKIRT ** # ** © Astronomical Observatory, Ghent University ** # ***************************************************************** ##...
Stargrazer82301/CAAPR
CAAPR/CAAPR_AstroMagic/PTS/pts/core/plot/memory.py
Python
mit
7,242
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_propeller_demo.settings") try: from django.core.management import execute_from_command_line except ImportError: # The above import may fail for some other reason. En...
tfroehlich82/django-propeller
manage.py
Python
mit
819
''' A condition ''' from base import Base from compares import const class ComparisonMixin(object): ''' Compare two values with a comparison utility to denote if a change has validated. ''' def compare(self, a, b, ctype=None): ''' compare 'a' against 'b' for a comparison of `ctyp...
Strangemother/python-state-machine
scratch/machine_2/core/conditions.py
Python
mit
3,066
# -*- coding: utf-8 -*- # # b3j0f.sync documentation build configuration file, created by # sphinx-quickstart on Sun Jun 14 17:29:14 2015. # # 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. # ...
b3j0f/sync
docs/source/conf.py
Python
mit
11,487
from google.appengine.api import mail import json import webapp2 class SendEmail(webapp2.RequestHandler): def post(self): to = self.request.get("to") user_name = self.request.get("name") user_address = self.request.get("email") subject = self.request.get("subject") body = se...
ZenBarrier/Coding-Barrier
contact.py
Python
mit
976
from django.shortcuts import render from django.conf.urls import patterns, url from django.core.urlresolvers import reverse_lazy from django.views.generic import TemplateView from django.contrib.auth.decorators import login_required from edamame import base, utils, generic from . import models class SiteViews(base....
tokibito/django-edamame
example/note/views.py
Python
mit
1,407
import matplotlib.pyplot as plt import numpy as np from phuzzy.mpl import TruncNorm def test_truncnorm(): alpha0 = [0, 2] # alpha1 = [2] p = TruncNorm(alpha0=alpha0, alpha1=None, number_of_alpha_levels=7) print(p) print(p.df) print(p.df.values.tolist()) ref = [[0.0, 0.0, 2.0], [0.1666666...
lepy/phuzzy
tests/test_truncnorm.py
Python
mit
885
# 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/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_images_operations.py
Python
mit
21,016
#!/usr/bin/env python2 # Copyright (c) 2014-2015 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # Exercise the listtransactions API from test_framework.test_framework import BitcoinTestFramework from ...
BurningMan44/SprintCoin
qa/rpc-tests/listtransactions.py
Python
mit
10,132
#!/usr/bin/env python from __future__ import ( unicode_literals, absolute_import, print_function, division, ) import aaf2 import traceback import subprocess import json import os import datetime import sys import tempfile import shutil import time import fractions from aaf2 import auid from pprint...
markreidvfx/pyaaf2
examples/import_media.py
Python
mit
17,403
from helper import greeting greeting("hello world...")
brentbaum/cs3240-labdemo
hello.py
Python
mit
55
import _plotly_utils.basevalidators class ColorValidator(_plotly_utils.basevalidators.ColorValidator): def __init__( self, plotly_name="color", parent_name="histogram2dcontour.textfont", **kwargs ): super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_n...
plotly/plotly.py
packages/python/plotly/plotly/validators/histogram2dcontour/textfont/_color.py
Python
mit
424
""" Entry point to API application. This will be for running simple checks on the application """ from flask import jsonify, url_for, redirect, request from flask_login import current_user from . import home from ..__meta__ import __version__, __project__, __copyright__ @home.route("") @home.route("home") @home.rout...
BrianLusina/Arco
server/app/mod_home/views.py
Python
mit
557
# coding: UTF-8 import unittest from usig_normalizador_amba.Callejero import Callejero from usig_normalizador_amba.Partido import Partido from usig_normalizador_amba.Calle import Calle from tests.test_commons import cargarCallejeroEstatico class CallejeroTestCase(unittest.TestCase): p = Partido('jose_c_paz', '...
usig/normalizador-amba
tests/CallejeroTestCase.py
Python
mit
7,895
from huzzer.function_generator import generate_expression, generate_unary_expr from huzzer.expressions import VariableExpression, FunctionExpression, BRANCH_EXPRESSIONS from huzzer.namers import DefaultNamer from huzzer import INT, BOOL empty_variables = { INT: [], BOOL: [] } def test_generate_unary_expr(): ...
coopie/huzzer
test/test_function_generator.py
Python
mit
3,071
# -*- coding: utf-8 -*- """ Created on Thu Apr 21 22:48:37 2016 @author: burger """ import numpy as np from matplotlib import pyplot as plt def sigma(x, a=1, b=0): return 1/(1+np.exp(-(a*x+b))) x = np.asarray([[0.0, .1], [0, 1], [.9, .05], [.9, .95]]) markers = 'v<>^' a = .5*np.ones((2,)) proj = np.dot(x, a)...
burgerdev/hostload
visualization/xor2.py
Python
mit
1,409
"""Utility methods for flake8.""" import collections import fnmatch as _fnmatch import inspect import io import logging import os import platform import re import sys import tokenize from typing import Callable, Dict, Generator, List, Optional, Pattern from typing import Sequence, Set, Tuple, Union from flake8 import ...
TeamSPoon/logicmoo_workspace
packs_web/butterfly/lib/python3.7/site-packages/flake8/utils.py
Python
mit
15,155
import unittest """ Test for the local and the web html page for table table generation """ class TestNET(unittest.TestCase): def test_net(self): pass if __name__ == "__main__": unittest.main()
shashankg7/pynet
tests/test_net.py
Python
mit
225
# gunicorn configuration bind = '0.0.0.0:8000' workers = 3 # These log settings assume that gunicorn log config will be included in the django base.py logging configuration accesslog = '-' errorlog = '-' access_log_format = '{"request": "%(r)s", "http_status_code": "%(s)s", "http_request_url": "%(U)s", "http_query_st...
penzance/hdt_monitor
hdt_monitor/settings/gunicorn_config.py
Python
mit
530
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-08-03 11:13 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Team',...
OKThess/website
main/migrations/0001_initial.py
Python
mit
736
"""Hello World API implemented using Google Cloud Endpoints. Defined here are the ProtoRPC messages needed to define Schemas for methods as well as those methods defined in an API. """ import endpoints from protorpc import messages, message_types, remote # TODO remove messages and message types when possible from go...
AlexanderOtavka/hello-endpoints
api/__init__.py
Python
mit
3,467
__all__ = ['BaseConstructor', 'SafeConstructor', 'Constructor', 'ConstructorError'] from error import * from nodes import * import datetime import binascii, re, sys, types class ConstructorError(MarkedYAMLError): pass class BaseConstructor(object): yaml_constructors = {} yaml_mul...
croxis/SpaceDrive
spacedrive/renderpipeline/rplibs/yaml/yaml_py2/constructor.py
Python
mit
25,820
""" WSGI config for Texas LAN Web project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICAT...
TexasLAN/texaslan.org
config/wsgi.py
Python
mit
1,450
def unique_elems(data): found_numbers = {} for number in data: if number not in found_numbers: found_numbers[number] = number else: return False return True
GeorgeGkas/Data_Structures_and_Algorithms_in_Python
Chapter1/C-1/15.py
Python
mit
210
from typing import Any, Collection, Dict, List, Optional, overload from ..language import Node, OperationType from ..pyutils import is_iterable __all__ = ["ast_to_dict"] @overload def ast_to_dict( node: Node, locations: bool = False, cache: Optional[Dict[Node, Any]] = None ) -> Dict: ... @overload def as...
graphql-python/graphql-core
src/graphql/utilities/ast_to_dict.py
Python
mit
1,596
import time from socketio import packet def test(): p = packet.Packet(packet.EVENT, 'hello') start = time.time() count = 0 while True: p = packet.Packet(encoded_packet=p.encode()) count += 1 if time.time() - start >= 5: break return count if __name__ == '__mai...
miguelgrinberg/python-socketio
tests/performance/text_packet.py
Python
mit
400
from __future__ import unicode_literals, division, absolute_import from builtins import * # pylint: disable=unused-import, redefined-builtin import logging import re import xmlrpc.client from flexget import plugin from flexget.event import event from flexget.utils.template import RenderError from flexget.plugin impo...
qvazzler/Flexget
flexget/plugins/plugin_aria2.py
Python
mit
22,207
import unittest import os from latexbuild.utils import ( random_str_uuid, random_name_filepath, list_filepathes_with_predicate, read_file, recursive_apply, ) PATH_FILE = os.path.abspath(__file__) PATH_TEST = os.path.dirname(PATH_FILE) class TestRandomStrUuid(unittest.Te...
pappasam/latexbuild
tests/test_utils.py
Python
mit
4,066
__author__ = 'oier' import json from flask import Flask, make_response app = Flask(__name__) import seaborn as sns import numpy as np import pandas as pd import os from datetime import datetime import matplotlib.pyplot as plt import sys from matplotlib.figure import Figure from matplotlib.backends.backend_agg impo...
oiertwo/vampyr
flask/index.py
Python
mit
1,592
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import DataMigration from django.db import models class Migration(DataMigration): def forwards(self, orm): """Write your forwards methods here.""" # Replace all null values with blanks...
michaelbrooks/twitter-feels
twitter_feels/apps/map/migrations/0003_replace_null_tweetchunk_tz_country.py
Python
mit
5,898
# 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/aks/azure-mgmt-devspaces/azure/mgmt/devspaces/models/_models_py3.py
Python
mit
19,905
""" .. module:: CreateProfileForm :synopsis: A form for completing a user's profile. .. moduleauthor:: Dan Schlosser <dan@schlosser.io> """ from flask.ext.wtf import Form from wtforms import StringField, HiddenField from wtforms.validators import URL, Email, Required EMAIL_ERROR = 'Please provide a valid email a...
danrschlosser/eventum
eventum/forms/CreateProfileForm.py
Python
mit
1,023
# __author__ = MelissaChan # -*- coding: utf-8 -*- # 16-2-14 下午4:37 # 词表转换向量 # 创建词汇表 def createVocabList(dataSet): vocabSet = set([]) for document in dataSet: vocabSet = vocabSet | set(document) return list(vocabSet) # 转换为向量 def setOfWords2Vec(vocablist,inputset): returnVec = [0] * len(vocablis...
MelissaChan/MachineLearning
naiveBayes/bayes.py
Python
mit
4,473
import unittest class UnitParsingTest(unittest.TestCase): def _assert_meters(self, tag_value, expected): from vectordatasource.meta.function import mz_to_float_meters parsed = mz_to_float_meters(tag_value) if parsed is None and expected is not None: self.fail("Failed to parse...
mapzen/vector-datasource
test/test_meta_functions.py
Python
mit
3,085
#!/usr/bin/env python # encoding: utf-8 import glob import os import subprocess ''' Convert 23andMe files to PLINK format ''' def twenty3_and_me_files(): """Return the opensnp files that are 23 and me format""" all_twenty3_and_me_files= glob.glob('../opensnp_datadump.current/*.23andme.txt') fifteen_mb = 15 * 100...
ciyer/opensnp-fun
run_plink_reformat.py
Python
mit
886
import _plotly_utils.basevalidators class NticksValidator(_plotly_utils.basevalidators.IntegerValidator): def __init__( self, plotly_name="nticks", parent_name="layout.ternary.baxis", **kwargs ): super(NticksValidator, self).__init__( plotly_name=plotly_name, parent_nam...
plotly/plotly.py
packages/python/plotly/plotly/validators/layout/ternary/baxis/_nticks.py
Python
mit
459
import unittest import warnings from collections import OrderedDict import numpy as np import numpy.testing as np_test from pgmpy.extern.six.moves import range from pgmpy.factors.discrete import DiscreteFactor from pgmpy.factors.discrete import JointProbabilityDistribution as JPD from pgmpy.factors import factor_divi...
khalibartan/pgmpy
pgmpy/tests/test_factors/test_discrete/test_Factor.py
Python
mit
56,244
# CIS 410/510pm # Homework 5 beta 0.0.1 # Cameron Palk # May 2016 # # Special thanks to Daniel Lowd for the skeletor code import sys import tokenize from functools import reduce global_card = [] num_vars = 0 ''' Calc Strides ''' def calcStrides( scope ): rev_scope = list( reversed( scope ) ) res = [ 1 ] + [ 0 ] *...
CKPalk/ProbabilisticMethods
A5/hw5_start.py
Python
mit
4,767
# -*- coding: utf-8 -*- import unittest import json from api_health.verifier import Verifier class JsonVerifier(unittest.TestCase): def test_constructor_should_be_smart_about_params(self): simple_json = u'{ "foo": "bar" }' json_dict = json.loads(simple_json) try: v1 = Verifier(...
bigodines/api-health
tests/test_verifier.py
Python
mit
1,105
from props.graph_representation.word import Word,NO_INDEX, strip_punctuations import cgi from copy import deepcopy from props.dependency_tree.definitions import time_prep, definite_label,\ adjectival_mod_dependencies COPULA = "SAME AS" # the textual value of a copula node PROP = "PROP" # t...
gabrielStanovsky/props
props/graph_representation/node.py
Python
mit
18,324
#!/usr/bin/python "Assignment 5 - This defines a topology for running a firewall. It is not \ necessarily the topology that will be used for grading, so feel free to \ edit and create new topologies and share them." from mininet.topo import Topo from mininet.net import Mininet from mininet.node import CPULim...
PicoGeyer/CS-6250-A5_firewall_test
testing-topo.py
Python
mit
2,069
from application import CONFIG, app from .models import * from flask import current_app, session from flask.ext.login import login_user, logout_user, current_user from flask.ext.principal import Principal, Identity, AnonymousIdentity, identity_changed, identity_loaded, RoleNeed import bcrypt import re import sendgrid i...
hackBCA/missioncontrol
application/mod_user/controllers.py
Python
mit
3,822
""" WSGI config for first_app 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.7/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "first_app.settings") from django.co...
IlyaSergeev/taxi_service
first_app/wsgi.py
Python
mit
393
import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab import matplotlib.ticker as ticker r = mlab.csv2rec('data/imdb.csv') r.sort() r = r[-30:] # get the last 30 days N = len(r) ind = np.arange(N) # the evenly spaced plot indices def format_date(x, pos=None): thisind = np.clip(int(x...
janusnic/21v-python
unit_20/matplotlib/pyplot_index_formatter.py
Python
mit
556
# WARNING: Do not edit by hand, this file was generated by Crank: # # https://github.com/gocardless/crank # from . import base_service from .. import resources from ..paginator import Paginator from .. import errors class MandatePdfsService(base_service.BaseService): """Service class that provides access to the...
gocardless/gocardless-pro-python
gocardless_pro/services/mandate_pdfs_service.py
Python
mit
3,470
# -*- coding: utf-8 -*- """ @file @brief image et synthèse """ from .image_synthese_facette import Rectangle from .image_synthese_base import Rayon, Couleur from .image_synthese_sphere import Sphere class RectangleImage(Rectangle): """définit un rectangle contenant un portrait""" def __init__(self, a, b, c,...
sdpython/ensae_teaching_cs
src/ensae_teaching_cs/special/image/image_synthese_facette_image.py
Python
mit
2,656
# -*- coding: utf-8 -*- # # Copyright (C) 2008-2014 Jonathan F. Donges # Author: Jonathan F. Donges <donges@pik-potsdam.de> # URL: <http://www.pik-potsdam.de/members/donges/software> """ Performs recurrence analysis of paleoclimate proxy records. This script provides analyses for this publication: J.F. Donges, R.V. ...
pik-copan/pyregimeshifts
scripts/raw_proxy_records_analysis/recurrence_analysis_speleo_raw.py
Python
mit
13,113
""" http://coreygoldberg.blogspot.com/2013/01/python-matrix-in-your-terminal.html Create "The Matrix" of binary numbers scrolling vertically in your terminal. original code adapted from juancarlospaco: - http://ubuntuforums.org/showpost.php?p=10306676 Inspired by the movie: The Matrix - Corey Goldberg (2013) ...
Pyroseza/Random
matrix_cool.py
Python
mit
2,355
from __future__ import division import math import numpy as np from time import time import sympy as sp import mpmath as mp from mpmath.ctx_mp_python import mpf from scipy.misc import factorial from scipy.special import gamma precision = 53 mp.prec = precision mp.pretty = True def calculate_factorial_ratio(n,...
tripatheea/Riemann-Zeta
python/dirichlet.py
Python
mit
1,897
"""Contains the :code:`Address` class, representing a collection of reverse geocoding results. Primarily, this functions as a container for a set of :code:`errorgeopy.Location` objects after a successful reverse geocode, and exposes methods that operate on this set of results, including: - de-duplication - extracting ...
alpha-beta-soup/errorgeopy
errorgeopy/address.py
Python
mit
7,782
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import unicode_literals import os from core.base_processor import xBaseProcessor from utilities.export_helper import xExportHelper from utilities.file_utility import xFileUtility from definitions.constant_data impo...
xLemon/xExcelConvertor
excel_convertor/processors/processor_php.py
Python
mit
7,054
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import datetime from frappe import _ import frappe import frappe.database import frappe.utils from frappe.utils import cint, flt, get_datetime, datetime, date_diff, today import ...
adityahase/frappe
frappe/auth.py
Python
mit
14,424
from .ui import * from .windows_views import *
Saldenisov/QY_itegrating_sphere
views/__init__.py
Python
mit
46
from collections import OrderedDict import logging import json import re import itertools import sublime import sublime_plugin from ..lib import inhibit_word_completions from .commandinfo import ( get_command_name, get_builtin_command_meta_data, get_builtin_commands, iter_python_command_classes, g...
SublimeText/PackageDev
plugins/command_completions/__init__.py
Python
mit
9,912
import re from bs4 import BeautifulSoup from nose.tools import assert_equal, assert_in, assert_true import pages import requests APP_URL = 'https://www.github.com' ADMIN_CREDENTIALS = {'username': 'admin@example.com', 'password': 'pk$321'} ROOT_CREDENTIALS = {'username': 'root', 'password': '123456'} API_URLS_MAP = {...
KorolevskyMax/TestFrameworkTemplate
helpers/app_helpers/app_session.py
Python
mit
1,768
import numpy as np import lxml.etree as ET from ...dates import timedelta from ...orbits import StateVector from ...orbits.man import ImpulsiveMan, ContinuousMan from ...utils import units from ...frames.orient import G50, EME2000, GCRF, MOD, TEME, TOD, CIRF from .cov import load_cov, dump_cov from .commons import ( ...
galactics/beyond
beyond/io/ccsds/opm.py
Python
mit
13,862
# -*- coding: utf-8 -*- """Startup utilities""" # pylint:skip-file import os import sys from functools import partial import paste.script.command import werkzeug.script etc = partial(os.path.join, 'parts', 'etc') DEPLOY_INI = etc('deploy.ini') DEPLOY_CFG = etc('deploy.cfg') DEBUG_INI = etc('debug.ini') DEBUG_CFG =...
stxnext-kindergarten/presence-analyzer-kjagodzinski
src/presence_analyzer/script.py
Python
mit
3,487
import time def import_grid(file_to_open): grid = [] print(file_to_open) with open(file_to_open) as file: for i, line in enumerate(file): if i == 0: iterations = int(line.split(" ")[0]) delay = float(line.split(" ")[1]) else: ...
tburrows13/Game-of-Life
tools.py
Python
mit
771
# ============================================================================= # COPYRIGHT 2013 Brain Corporation. # License under MIT license (see LICENSE file) # ============================================================================= import pytest from robustus.detail import perform_standard_test def test_b...
braincorp/robustus
robustus/tests/test_bullet.py
Python
mit
775
"""Instruction descriptions for the "SPIR-V Extended Instructions for GLSL" version 1.00, revision 2. """ INST_FORMAT = { 1 : { 'name' : 'Round', 'operands' : ['Id'], 'has_side_effects' : False, 'is_commutative' : False }, 2 : { 'name' : 'RoundEven', 'operand...
kristerw/spirv-tools
spirv_tools/ext_inst/glsl_std_450.py
Python
mit
11,873
from unittest import TestCase from dirty_validators.basic import (BaseValidator, EqualTo, NotEqualTo, StringNotContaining, Length, NumberRange, Regexp, Email, IPAddress, MacAddress, URL, UUID, AnyOf, NoneOf, IsEmpty, NotEmpty, NotEmptyString, IsNon...
alfred82santa/dirty-validators
tests/dirty_validators/tests_basic.py
Python
mit
26,469
from models.sampler import DynamicBlockGibbsSampler from models.distribution import DynamicBernoulli from models.optimizer import DynamicSGD from utils.utils import prepare_frames from scipy import io as matio from data.gwtaylor.path import * import ipdb import numpy as np SIZE_BATCH = 10 EPOCHS = 100 SIZE_HIDDEN = 50...
deprofundis/deprofundis
models/scripts/example_crbm.py
Python
mit
2,313
#!/usr/bin/python # build_native.py # Build native codes import sys import os, os.path import shutil from optparse import OptionParser import cocos from MultiLanguage import MultiLanguage import cocos_project import json import re from xml.dom import minidom import project_compile BUILD_CFIG_FILE="build-cfg.json" ...
dios-game/dios-cocos
src/oslibs/cocos/cocos-src/tools/cocos2d-console/plugins/project_compile/build_android.py
Python
mit
28,191
#!/usr/bin/env python from __future__ import print_function import sys import math import hyperopt from hyperopt import fmin, tpe, hp from hyperopt.mongoexp import MongoTrials def get_space(): space = (hp.quniform('numTrees', 1, 10, 1), hp.quniform('samplesPerImage', 10, 7500, 1), hp....
ferasha/curfil
scripts/hyperopt/hyperopt_search.py
Python
mit
2,103
''' Defines the base class of an electric potential grid. ''' import numpy as np import matplotlib as mpl import matplotlib.pylab as plt from numba import jit # Global dimensions (used for plots) sqc_x = (2., 'cm') # unit length for SquareCable sqc_u = (10., 'V') # unit potential for SquareCable edm_x = (10., 'mm')...
nkoukou/University_Projects_Year_3
EDM_Assembly/base_class.py
Python
mit
11,366
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Very basic tool to generate a binary font from a TTF. Currently # hardcodes a lot of things, so it's only really suitable for this demo. # # Assumes every glyph fits in an 8x8 box. Each glyph is encoded as # an uncompressed 8-byte bitmap, preceeded by a one-byte escapem...
Qusic/Companionship
fontgen.py
Python
mit
1,083
# Created by PyCharm Pro Edition # User: Kaushik Talukdar # Date: 27-03-2017 # Time: 05:25 PM fastfood = ["momo", "roll", "chow", "pizza"] print(fastfood) print("\n") #print one element using pop() #output the popped element print(fastfood.pop() + "\n") ...
KT26/PythonCourse
2. Introducing Lists/6.py
Python
mit
380
""" Given an array nums, partition it into two (contiguous) subarrays left and right so that: Every element in left is less than or equal to every element in right. left and right are non-empty. left has the smallest possible size. Return the length of left after such a partitioning. It is guaranteed that such a part...
franklingu/leetcode-solutions
questions/partition-array-into-disjoint-intervals/Solution.py
Python
mit
1,320
import re from functools import reduce from typing import Optional, Callable, Any, Type, Union import wx # type: ignore from gooey.gui import formatters, events from gooey.gui.util import wx_util from gooey.python_bindings.types import FormField from gooey.util.functional import getin, ifPresent from gooey...
chriskiehl/Gooey
gooey/gui/components/widgets/bases.py
Python
mit
9,873
from ubluepy import Scanner, constants def bytes_to_str(bytes): string = "" for b in bytes: string += chr(b) return string def get_device_names(scan_entries): dev_names = [] for e in scan_entries: scan = e.getScanData() if scan: for s in scan: if ...
adafruit/micropython
ports/nrf/examples/ubluepy_scan.py
Python
mit
923
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting field 'Feed.feed_type' db.delete_column('syndication_feed', 'feed_type_id') def backwards(s...
wtrevino/django-listings
listings/syndication/migrations/0007_auto__del_field_feed_feed_type.py
Python
mit
1,955
#!/usr/bin/python r""" PYTHONRC ======== Initialization script for the interactive Python interpreter. Its main purpose is to enhance the overall user experience when working in such an environment by adding some niceties to the standard console. It also works with IPython and BPython, although its utility in that kin...
0xf4/pythonrc
pythonrc.py
Python
mit
19,310
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-04-02 15:02 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('talks', '0004_auto_20170326_1755'), ] operations = [ migrations.AlterField(...
tlksio/tlksio
talks/migrations/0005_auto_20170402_1502.py
Python
mit
866
""" Django settings for blog project. Generated by 'django-admin startproject' using Django 1.9. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import os # Buil...
our-iot-project-org/pingow-web-service
src/blog/settings.py
Python
mit
3,829
from axiom.test.historic.stubloader import StubbedTest from xquotient.mail import MailTransferAgent from axiom.userbase import LoginSystem class MTAUpgraderTest(StubbedTest): def testMTA2to3(self): """ Make sure MailTransferAgent upgraded OK and that its "userbase" attribute refers to the s...
twisted/quotient
xquotient/test/historic/test_mta2to3.py
Python
mit
512
from sys import stdout from collections import defaultdict from .parse import main, HTMLTag def maybe_call(f, *args, **kwargs): if callable(f): return f(*args, **kwargs) return f class Compiler(object): def __init__(self, stream): self.stream = stream self.blocks = [] se...
xiaq/jadepy
jade/compile.py
Python
mit
7,708
""" airPy is a flight controller based on pyboard and written in micropython. The MIT License (MIT) Copyright (c) 2016 Fabrizio Scimia, fabrizio.scimia@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...
Sokrates80/air-py
aplink/messages/ap_save_tx_calibration.py
Python
mit
2,515
import datetime import unittest2 import urlparse from mock import Mock, ANY import svb from svb.six.moves.urllib import parse from svb.test.helper import SvbUnitTestCase VALID_API_METHODS = ('get', 'post', 'delete', 'patch') class GMT1(datetime.tzinfo): def utcoffset(self, dt): return datetime.timed...
fuziontech/svb
svb/test/test_requestor.py
Python
mit
15,897
from django.test import TestCase from django.contrib.auth.models import User from dixit import settings from dixit.game.models.game import Game from dixit.game.models.player import Player from dixit.game.models.round import Round, RoundStatus, Play from dixit.game.models.card import Card from dixit.game.exceptions im...
jminuscula/dixit-online
server/src/dixit/game/test/round.py
Python
mit
13,429
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('layout_page', '0007_auto_20170509_1148'), ] operations = [ migrations.AddField( model_name='layoutpage', ...
ic-labs/django-icekit
icekit/page_types/layout_page/migrations/0008_auto_20170518_1629.py
Python
mit
686
# -*- coding: utf-8 -*- __title__ = 'pywebtask' __version__ = '0.1.8' __build__ = 0x000108 __author__ = 'Sebastián José Seba' __license__ = 'MIT' __copyright__ = 'Copyright 2016 Sebastián José Seba' from .webtasks import run, run_file # Set default logging handler to avoid "No handler found" warnings. import loggin...
ssebastianj/pywebtasks
pywebtasks/__init__.py
Python
mit
546
import traceback import BigWorld from gui.Scaleform.daapi.view.lobby.messengerBar.NotificationListButton import NotificationListButton from xfw import * import xvm_main.python.config as config from xvm_main.python.logger import * ### @overrideMethod(NotificationListButton, 'as_setStateS') def _NotificationListButt...
peterbartha/ImmunoMod
res_mods/mods/packages/xvm_hangar/python/svcmsg.py
Python
mit
675
# # Retrieved from: https://svn.code.sf.net/p/p2tk/code/python/syllabify/syllabifier.py # on 2014-09-05. # # According to https://www.ling.upenn.edu/phonetics/p2tk/, this is licensed # under MIT. # # This is the P2TK automated syllabifier. Given a string of phonemes, # it automatically divides the phonemes into syllab...
dfm/twitterick
twitterick/syllabifier.py
Python
mit
6,769
import re from copy import copy from random import randint class Server(object): def __init__(self, ip, port, hostname): self.ip = ip self.port = port self.hostname = hostname self.weight = 500 self.maxconn = None def __cmp__(self, other): if not isinstance(othe...
meltwater/proxymatic
src/proxymatic/services.py
Python
mit
5,559
__author__ = "Christian Kongsgaard" __license__ = 'MIT' # -------------------------------------------------------------------------------------------------------------------- # # IMPORTS # Modules # RiBuild Modules from delphin_6_automation.database_interactions.db_templates import delphin_entry from delphin_6_autom...
thp44/delphin_6_automation
data_process/wp6_v2/not_in_sample.py
Python
mit
3,478
def pe0001(upto): total = 0 for i in range(upto): if i % 3 == 0 or i % 5 == 0: total += i return total print(pe0001(1000))
guandalf/projecteuler
pe0001.py
Python
mit
155
from setuptools import setup, find_packages setup(name='MODEL1201230000', version=20140916, description='MODEL1201230000 from BioModels', url='http://www.ebi.ac.uk/biomodels-main/MODEL1201230000', maintainer='Stanley Gu', maintainer_url='stanleygu@gmail.com', packages=find_packages(...
biomodels/MODEL1201230000
setup.py
Python
cc0-1.0
377
import os def replace_temp(inputfile_folder): os.chdir(inputfile_folder) home_dir = os.getcwd() for i in os.listdir(os.getcwd()): if os.path.isdir(i): os.chdir(i) print("In folder: {}".format(os.getcwd())) for z in os.listdir(os.getcwd()): if...
ScottHull/Exoplanet-Pocketknife
old/hefesto_temp_fix.py
Python
cc0-1.0
1,250
## This file is part of Invenio. ## Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 CERN. ## ## Invenio 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...
PXke/invenio
invenio/legacy/dbquery.py
Python
gpl-2.0
17,135
# -*- coding: utf-8 -*- import 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 'Subscription.paid' db.add_column(u'subscriptions_subscription', 'paid', ...
xiru/xiru.wttd
eventex/subscriptions/migrations/0002_auto__add_field_subscription_paid.py
Python
gpl-2.0
1,450
import re from stgit.compat import environ_get from stgit.config import config from .base import Immutable from .date import Date class Person(Immutable): """Represents an author or committer in a Git commit object. Contains :attr:`name`, :attr:`email` and :attr:`timestamp`. """ def __init__(self...
emacsmirror/stgit
stgit/lib/git/person.py
Python
gpl-2.0
2,200
# -*- coding: utf-8 -*- """Called from datakortet\dkcoverage.bat to record regression test coverage data in dashboard. """ import re import os # import sys # import time import glob # from datakortet.dkdash.status import send_status # from datakortet.utils import root from coverage import coverage, misc from cover...
thebjorn/dkcoverage
dkcoverage/rtestcover.py
Python
gpl-2.0
3,325
#!/usr/bin/env python2 from GSettingsWidgets import * from ChooserButtonWidgets import TweenChooserButton, EffectChooserButton EFFECT_SETS = { "cinnamon": ("traditional", "traditional", "traditional", "none", "none", "none"), "scale": ("scale", "scale", "scale", "scale", "scale", "scale...
pixunil/Cinnamon
files/usr/share/cinnamon/cinnamon-settings/modules/cs_effects.py
Python
gpl-2.0
10,983
#!/usr/bin/env python import os import sys import MySQLdb if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "academicControl.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
hyms/academicControl
manage.py
Python
gpl-2.0
273
# -*- Mode: Python; test-case-name: flumotion.test.test_pb -*- # vi:si:et:sw=4:sts=4:ts=4 # # Flumotion - a streaming media server # Copyright (C) 2004,2005,2006,2007 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 Licen...
ylatuya/Flumotion
flumotion/test/test_pb.py
Python
gpl-2.0
21,383
import numpy as np import re import os def GetBlocks(filename): ''' prende il filename e ritorna la lista [[[pt1.x,pt1.y],...],[blocco2],...] ''' f=open(filename) block=False lastlist=[] listone=[] for i in f: print(i) if(re.match(r"[\d\.]+e[\+\-][\d]+\t[\d\.]+e[\+\-][\...
AleCandido/Lab3.2
Utilities/parser.py
Python
gpl-2.0
755
#! /usr/bin/python3 import sys MAXLINELEN = 80 TABLEN = 8 # 3 for two quotes and a comma FIRSTLINELEN = MAXLINELEN - TABLEN - 3 OTHERLINELEN = FIRSTLINELEN - 2 * TABLEN FIRSTLINEBYTES = FIRSTLINELEN // 2 OTHERLINEBYTES = OTHERLINELEN // 2 def fix_line(line): return "".join("\\x{}".format(line[i:i + 2].decode()) f...
talshorer/cryptopals
scripts/transform_hex_multine.py
Python
gpl-2.0
960