code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""
pygments.styles.paraiso_light
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Paraíso (Light) by Jan T. Sott
Pygments template by Jan T. Sott (https://github.com/idleberg)
Created with Base16 Builder by Chris Kempson
(https://github.com/chriskempson/base16-builder).
:copyright: ... | tmm1/pygments.rb | vendor/pygments-main/pygments/styles/paraiso_light.py | Python | mit | 5,645 |
# -*- coding: utf-8 -*-
import json
from TM1py.Objects.Axis import ViewAxisSelection, ViewTitleSelection
from TM1py.Objects.Subset import Subset, AnonymousSubset
from TM1py.Objects.View import View
class NativeView(View):
""" Abstraction of TM1 NativeView (classic cube view)
:Notes:
Complet... | MariusWirtz/TM1py | TM1py/Objects/NativeView.py | Python | mit | 9,988 |
import sys
import re
#
# You must include the following class definition at the top of
# your method specification file.
#
class MethodSpec(object):
def __init__(self, name='', source='', class_names='',
class_names_compiled=None):
"""MethodSpec -- A specification of a method.
Member ... | joebowen/movement_validation_cloud | djangodev/lib/python2.7/site-packages/neuroml/nml/helper_methods.py | Python | mit | 4,806 |
import chainer
import chainer.links as L
import chainer.functions as F
class SimpleCNN(chainer.Chain):
""" Simple Convolutional Neural Network for training the MNIST dataset.
Input dimensions are 28, 28, 1 where 1 represent the single grayscale channel.
"""
def __init__(self):
super(SimpleCNN... | hvy/chainer-mnist | models/simplecnn.py | Python | mit | 995 |
from __future__ import print_function
import logging
from collections import namedtuple
import numpy as np
import tensorflow as tf
from model import LSTMPolicy
import six.moves.queue as queue
import scipy.signal
import threading
import distutils.version
use_tf12_api = distutils.version.LooseVersion(
tf.VERSION) >= ... | futurely/openai-universe-agents | a3c.py | Python | mit | 11,820 |
# -*- coding: utf-8 -*-
"""Sphinx Readable Theme documentation build configuration file.
This file is execfile()d with the current directory set to its containing dir.
"""
import os
import sys
import pkg_resources
# Adding this directory to the sys path, to build autodoc of example module.
sys.path.insert(0, os.pa... | onefinestay/sphinx-nameko-theme | docs/source/conf.py | Python | mit | 2,061 |
# -*- coding: utf-8 -*-
# pylint: disable=fixme, protected-access
"""The core module contains the SoCo class that implements
the main entry to the SoCo functionality
"""
from __future__ import unicode_literals
import datetime
import logging
import re
import socket
from functools import wraps
import warnings
from soco... | lawrenceakka/SoCo | soco/core.py | Python | mit | 73,424 |
# -*- encoding: utf-8 -*-
from shapely.wkt import loads as wkt_loads
import dsl
from . import FixtureTest
class ZoosZ13(FixtureTest):
def test_zoo_appears_at_z13(self):
# Zoo Montana, Billings, MT
self.generate_fixtures(dsl.way(2274329294, wkt_loads('POINT (-108.620965329915 45.7322965681428)'), {... | mapzen/vector-datasource | integration-test/421-zoos-z13.py | Python | mit | 609 |
"""
Tests for the module that encompasses fourth species counterpoint.
"""
import unittest
from foox.species.fourth import (Genome, create_population, is_parallel,
make_fitness_function, make_generate_function, make_halt_function,
MAX_REWARD, REWARD_SUSPENSION)
from foox.species.utils import is_suspension
# T... | LoganRickert/foox | test/species/test_fourth.py | Python | mit | 6,328 |
from typing import List, TypeVar
C = TypeVar('C') # how to constrain to only the closure below?
def color_factory(color_code: str) -> C:
def apply(text: str, format_spec: str = '') -> str:
return color_code + format(text, format_spec) + '\033[0m'
def mix(*colors: C) -> List[C]:
return [colo... | rsalmei/clearly | clearly/utils/colors.py | Python | mit | 1,146 |
#If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
#Find the sum of all the multiples of 3 or 5 below 1000.
result = 0
for i in range(1,1000):
if i % 3 == 0 or i % 5 == 0:
result += + i
print(str(result))
print(result) | FelixCao/ProjectEuler | Problem1.py | Python | mit | 310 |
"""Collection of useful data transforms."""
# Imports
import numpy as np
from McNeuron import Neuron
import scipy
import scipy.linalg # SciPy Linear Algebra Library
from numpy.linalg import inv
def get_leaves(nodes, parents):
"""
Compute the list of leaf nodes.
Parameters
----------
nodes: li... | RoozbehFarhoodi/McNeuron | data_transforms.py | Python | mit | 6,699 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-29 17:46
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('polls', '0025_question_poll_algorithm'),
('polls', '0025_item_image'),
]
operations ... | PrefPy/opra | compsocsite/polls/migrations/0026_merge.py | Python | mit | 330 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014, Florian Wesch <fw@dividuum.de>
# 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 copy... | phase/ApplePi | fastmc/auth.py | Python | mit | 7,818 |
"""add unique key to username
Revision ID: c19852e4dcda
Revises: 1478867a872a
Create Date: 2020-08-06 00:39:03.004053
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'c19852e4dcda'
down_revision = '1478867a872a'
branch_labels = None
depends_on = None
def upgr... | hackerspace-silesia/cebulany-manager | migrations/versions/c19852e4dcda_add_unique_key_to_username.py | Python | mit | 953 |
import socket
from contextlib import closing
import argparse
import os
import sys
import pdb
import argparse
sys.path.insert(0, '/scratche/home/ashutosh/services/queue/')
from queue_client import QueueClient
# AVAILABLE SERVERS
SERVERS = {
"idli" : "10.24.28.102",
"momo" : "10.24.28.103",
"dosa" : "10.24... | fossdevil/Assignments | Miscellaneous/services/checkports.py | Python | mit | 2,065 |
import os
import logging
from gii.core import app, signals, EditorCommandStack, RemoteCommand
from gii.core.selection import SelectionManager, getSelectionManager
from gii.qt.controls.Window import MainWindow
from gii.qt.controls.Menu import MenuManager
from gii.qt import TopEditorModule, SubEditorModule
f... | tommo/gii | lib/gii/SceneEditor/SceneEditor.py | Python | mit | 2,647 |
"""
kort-to-osm
Usage:
kort2osm.py [-d] [-q] [-v] [-c COUNT]
kort2osm.py -h | --help
kort2osm.py --version
Options:
-h, --help Show this help message and exit.
-d, --dry Do not actually make changes, only a dry run
-q, --quiet Run quietly, without any output.
-v... | kort/kort-to-osm | kort2osm.py | Python | mit | 1,855 |
from system.core.controller import *
from rauth import OAuth2Service
from flask import redirect, request
import urllib2
import json
from time import strftime
facebook = OAuth2Service(
name='facebook',
base_url='https://graph.facebook.com/',
access_token_url='/oauth/access_token',
authorize_url='https:/... | RydrDojo/Ridr_app | app/controllers/Users.py | Python | mit | 4,431 |
"""
Background kernels are *like* InfluenceKernel, but not necessarily integrable
and there is no support for differentiationg with respect to time.
"""
from .influence import InfluenceKernel
have_autograd = False
try:
import autograd.numpy as np
have_autograd = True
except ImportError as e:
import numpy ... | danmackinlay/branching_process | branching_process/cts/background.py | Python | mit | 6,771 |
from django.contrib.messages import constants as MSG
from django.core.exceptions import ObjectDoesNotExist
from django.test import RequestFactory
from django.urls import reverse
from django.utils.translation import ugettext as _
from test_plus.test import TestCase
from .forms import SignupForm
from fiubar.facultad.mo... | maru/fiubar | fiubar/tests.py | Python | mit | 13,946 |
"""
Read telemetry data from the given serial port and save it in internal graph_channel objects.
"""
import logging
logg = logging.getLogger(__name__)
import struct
import time
import math
import hdlc
from aniplot import graph_channel
from buggy_packets import *
class TelemetryStream:
""" Read telemetry from the... | rustbuggy/racer-telemetry | system/telemetry_stream.py | Python | mit | 7,204 |
# coding=utf-8
from __future__ import absolute_import
import gevent
from gevent.pywsgi import WSGIHandler
import sys
from webob import Request
from .response import Response
from .socket import Socket
from ..event_emitter import EventEmitter
from .transports import WebsocketTransport
import logging
logger = logging.g... | shuoli84/gevent_socketio2 | socketio/engine/handler.py | Python | mit | 5,977 |
#!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import
import os
import tct
import sys
params = tct.readjson(sys.argv[1])
facts = tct.readjson(params['factsfile'])
milestones = tct.readjson(params['milestonesfile'])
reason = ''
resultfile = params['resultfile']
result = tct... | marble/Toolchain_RenderDocumentation | 14-Provide-the-project/04-Check-project-source-params/run_Check-project-source-params.py | Python | mit | 4,455 |
from subprocess import Popen, PIPE
import itertools
ITERATORS_NUM = [0, 1, 4]
UPDATERS_NUM = [1, 2, 4, 8]
DURATION = [2]
PERCENTAGES = [(25, 25)]
KEY_RANGE = [65536]
INIT_SIZE = [1024]
PARAMETER_COMBINATIONS = [ITERATORS_NUM, UPDATERS_NUM, DURATION, PERCENTAGES, KEY_RANGE, INIT_SIZE]
for param in itertools.product(*... | ezrosent/iterators-etc | hash/runTests.py | Python | mit | 722 |
"""
__M6ThenClausePart2Complete_MDL.py_____________________________________________________
Automatically generated AToM3 Model File (Do not modify directly)
Author: gehan
Modified: Thu Oct 24 14:51:32 2013
_______________________________________________________________________________________
"""
from stickylink impo... | levilucio/SyVOLT | GM2AUTOSAR_MM/Properties/positive/models/M6ThenClausePart2Complete_MDL.py | Python | mit | 17,941 |
"""study URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... | shashanksingh28/code-similarity | userstudy/study/urls.py | Python | mit | 864 |
#!/usr/bin/env python
import optparse
import os
import sys
import tempfile
import datetime
from xml.etree import ElementTree as etree
from convert import read_messages, read_calls
import yaffs
def read_chunk(fd, size):
s = fd.read(size)
if len(s) > 0 and len(s) != size:
raise IOError("Broken image fi... | abbot/android-restore-tools | extract.py | Python | mit | 9,201 |
#Clamav database fetcher and unpacker.
#Made by Tomasuh
#For contact: tomasuh [at]
import sys,tarfile,os,shutil,stat,urllib2,random
class ClamAvDatabase(object):
wantedFiles = ["main.db","main.fp","main.hdb","main.info","main.mdb","main.ndb","main.zmd"]
def __init__(self):
if len (sys.argv) != 2:
... | Tomasuh/Tomasuh.github.io | files/ClamAVDatabaseDL.py | Python | mit | 5,183 |
# Write unit tests to perform before implementation
# Create your tests here.
| Diagon/CFApp | cakefactory/tests.py | Python | mit | 79 |
# -*- coding: utf-8 -*-
from .account import Account
from .instance import BlockchainInstance
from graphenecommon.aio.witness import (
Witness as GrapheneWitness,
Witnesses as GrapheneWitnesses,
)
@BlockchainInstance.inject
class Witness(GrapheneWitness):
"""
Read data about a witness in the chain.
... | xeroc/python-bitshares | bitshares/aio/witness.py | Python | mit | 1,031 |
# -*- coding: utf-8 -*-
import logging
import re
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from PIL import Image
from urllib.request import urlopen
from urllib.parse import urlencode
import json
from bs4 import BeautifulSoup, element
from datetime import datetime, timedelta
from waybackscraper.... | abrenaut/mrot | mrot/imdb.py | Python | mit | 6,223 |
import sys
import os
brief = "create a test for controller"
def usage(argv0):
print("Usage: {} generate test controller CONTROLLER_NAME METHOD [METHOD] [...]".format(argv0))
sys.exit(1)
aliases = ['c']
def execute(argv, argv0, engine):
import lib, inflection
os.environ.setdefault("AIOWEB_SETTINGS... | kreopt/aioweb | wyrm/modules/generate/test/controller.py | Python | mit | 1,437 |
# 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/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/_management_groups_operations.py | Python | mit | 31,189 |
#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Dial Tone
# Author: Example
# Description: example flow graph
# Generated: Mon Jul 20 17:36:46 2015
##################################################
from gnuradio import analog
from gnuradio import blocks
f... | dl1ksv/python-for-android | gnuradio-examples/dialtonenokivy/main.py | Python | mit | 2,198 |
from django.apps import AppConfig
class IndexConfig(AppConfig):
name = 'web.index'
| LoRexxar/Cobra-W | web/index/apps.py | Python | mit | 89 |
# coding: utf-8
#!/usr/bin/env python
from __future__ import division, unicode_literals
"""
#TODO: Write module doc.
"""
__author__ = 'Shyue Ping Ong'
__copyright__ = 'Copyright 2013, The Materials Virtual Lab'
__version__ = '0.1'
__maintainer__ = 'Shyue Ping Ong'
__email__ = 'ongsp@ucsd.edu'
__date__ = '8/1/15'
i... | rousseab/pymatgen | pymatgen/io/vaspio/vasp_output.py | Python | mit | 539 |
#!/usr/bin/python2.4
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | rickiepark/openbidder | protobuf/protobuf-2.6.1/python/stubout.py | Python | mit | 4,934 |
'''
Created on Feb 6, 2016
@author: Wuga
'''
import numpy as np
def add_ones(A):
return np.hstack(( np.ones((A.shape[0],1)), A )) | wuga214/FullyConnectedDeepNeuralNetwork | ANN/src/utils/tools.py | Python | mit | 135 |
import json
class BayonetError(Exception):
"""All errors related to making an API request extend this."""
def __init__(self, message=None,
request_body=None, request_headers=None,
http_response_code=None, http_response_message=None):
super(BayonetError, self).__init_... | Bayonet-Client/bayonet-python | bayonet/exceptions.py | Python | mit | 1,465 |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 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 fee estimation code."""
from decimal import Decimal
import random
from test_framework.mininode im... | ryanofsky/bitcoin | test/functional/feature_fee_estimation.py | Python | mit | 11,247 |
""" Automatic Init file """
from app.logic.mailing.models.StackedMailModel import StackedMailEntry
| imvu/bluesteel | app/logic/mailing/models/__init__.py | Python | mit | 100 |
import sys
import logging
import click
import entrypoints
LOG_LEVEL_CODES = {
"debug": logging.DEBUG,
"info": logging.INFO,
"warning": logging.WARNING,
"error": logging.ERROR,
}
def merge_extensions(click_group):
"""
Each extension is called with click group for
ultimate agility while p... | kibitzr/kibitzr | kibitzr/cli.py | Python | mit | 2,704 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
import io
import re
from glob import glob
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import splitext
from setuptools import find_packages
fro... | miroag/mfs | setup.py | Python | mit | 2,863 |
#!/usr/bin/env python
"""
Local Schedule Object
"""
import calendar
from time import mktime as _mktime
from ..debugging import bacpypes_debugging, ModuleLogger
from ..core import deferred
from ..task import OneShotTask
from ..primitivedata import Atomic, Null, Unsigned, Date, Time
from ..constructeddata import Arr... | JoelBender/bacpypes | py27/bacpypes/local/schedule.py | Python | mit | 22,187 |
# Implementation of the insertion-sort sorting algorithm
# O(N^2)
# Insertion sort
def insertionSort(a):
final = a
# Loop through every integer to be sorted
for i in range(1, len(a)):
key = a[i]
j = i - 1
# Find ideal location
while j >= 0 and final[j] > key:
fin... | ruar18/competitive-programming | algorithms-data-structures/sorting/insertion-sort.py | Python | mit | 493 |
from django.test import TestCase
from groups import models as group_model
class SimpleTest(TestCase):
def test_create_group(self):
"""
Test group creation
"""
group = group_model.create_group('ateam@mechmooc.com', 'The A team', 1)
self.assertTrue('address' in group)
... | p2pu/mechanical-mooc | groups/tests.py | Python | mit | 2,657 |
#!/usr/bin/python
# -*- coding:utf-8 -*-
from LagouDb import LagouDb
class Analyzer(object):
def __init__(self):
self.db = LagouDb()
# 统计最受欢迎的工作
@staticmethod
def get_popular_jobs(since=None):
if since:
pass
else:
pass
# 统计职位在不同城市的薪资情况
def get_... | zhengbomo/python_practice | project/Lagou/Analyzer.py | Python | mit | 1,396 |
import sys
verbose = 1
def brute_force(txt, pat):
n = len(txt)
m = len(pat)
# assumption: n > m
i = 0 # store window current position
occ = []
while i < n-m+1:
if verbose:
print " %si=%d" % (i*" ", i)
print "T: %s" % txt
j = 0 # store how many matches ... | gppeixoto/pcc | kmp/paguso/kmp.py | Python | mit | 2,708 |
import unittest
import os
from Logger import Logger
class TestLoggerMethods(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
try:
os.remove('logfile.txt')
except OSError:
pass
def test_creation(self):
logger = Logger('log.txt')
... | avlec/tdo | testing/test_Logger.py | Python | mit | 972 |
import unittest
from omnikassa import Omnikassa
from omnikassa.exceptions import (
InvalidSeal,
InvalidResponseCode,
)
class OmnikassaTests(unittest.TestCase):
def setUp(self):
self.settings = {
'normalReturnUrl': 'https://example.com/omnikassa',
'automaticResponseUrl': 'h... | RobWouters/omnikassa | tests/test_omnikassa.py | Python | mit | 1,432 |
# orm/loading.py
# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""private module containing functions used to convert database
rows into object inst... | graingert/sqlalchemy | lib/sqlalchemy/orm/loading.py | Python | mit | 36,424 |
import math
import logging
from pymoku._instrument import MokuInstrument
from pymoku._instrument import to_reg_unsigned
from pymoku._instrument import from_reg_unsigned
from pymoku._instrument import to_reg_signed
from pymoku._instrument import from_reg_signed
from pymoku._instrument import to_reg_bool
from pymoku._in... | liquidinstruments/pymoku | pymoku/_frequency_response_analyzer.py | Python | mit | 22,648 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "openvpn_admin.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure tha... | alexsilva/openvpn-admin | manage.py | Python | mit | 811 |
"""
WSGI config for abracadjabra 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_APPLICATI... | gregdetre/abracadjabra | abracadjabra/wsgi.py | Python | mit | 1,437 |
import math
import random
import operator
import traceback
from .titanic import ndarray
from .fpbench import fpcparser
from .arithmetic import mpmf, ieee754, posit, fixed, evalctx, analysis
from .arithmetic.mpmf import Interpreter
from .sweep import search
from .sweep.utils import *
dotprod_naive_template = '''(FPCo... | billzorn/fpunreal | titanfp/vec_sweep.py | Python | mit | 11,896 |
"""
frontend_auth is a wrapper around the `django.contrib.auth.view` Views.
* **templates/** Contains the templates for login / pw change / pw reset views and the password_reset emails
* **auth_mixins.py** Provides a simple mixin that tests if `instance.agency == request.user.agencyemployee.agency`, more to come
... | phelmig/outside_ | mvp/outside/frontend_auth/__init__.py | Python | mit | 1,006 |
__author__ = 's7a'
# All imports
from enricher import Enricher | Somsubhra/Simplify | src/enrich/__init__.py | Python | mit | 63 |
#!/usr/bin/env python
import sys
import numpy as np
import math
A = np.matrix("1 2 3; 4 5 6; 7 8 9")
B = np.matrix("2 2 2; 2 2 2; 2 2 2")
print np.multiply(A,B)
| dquinteros/sscaThesis | tools/matrixMult.py | Python | mit | 168 |
# Arguments are:
# 1. Working directory.
# 2. Rope folder
import difflib
import io
import json
import os
import sys
import traceback
try:
import rope
from rope.base import libutils
from rope.refactor.rename import Rename
from rope.refactor.extract import ExtractMethod, ExtractVariable
import rope.... | jwatson/dotfiles | config/coc/extensions/node_modules/coc-python/pythonFiles/refactor.py | Python | mit | 10,906 |
from zen.fabric.service_client import ServiceClient
class BatchServiceClient(ServiceClient):
''' Batch Service Client
Service Client for batch / head-less processes
'''
pass
| SgtFlame/pyzen-fabric | src/zen/fabric/batch_service_client.py | Python | mit | 200 |
# The autocrab delete plugin command.
import shutil
from AutoCrab.AutoCrab2 import crabutil
# Hardcode /eos/uscms in here.
eos_root = "/eos/uscms"
def autocrab(dir):
config = crabutil.getCrabConfig(dir)
with open(config) as configFile:
configText = configFile.read()
remoteDir = configText[configText.find("use... | TC01/AutoCrab | AutoCrab2/python/commands/delete.py | Python | mit | 659 |
raise NotImplementedError("wave is not yet implemented in Skulpt")
| ArcherSys/ArcherSys | skulpt/src/lib/wave.py | Python | mit | 67 |
import pynotify
class myBubbles():
def __init__(self):
self.ApplicationName="Simple Remote Control"
pynotify.init("SimpleRemoteControl")
def CreateBubble(self,message):
self.ShowMessage(message)
def ShowMessage(self,message):
self.bubble=pynotify.Notification(self.ApplicationName, message)
... | helloIAmPau/SimpleRemoteControl | SimpleRemoteControl/applet/notifications.py | Python | mit | 341 |
from time import sleep
from pytest import raises, approx
import numpy as np
from tests.input.mockdevices import (Dummy, Timebomb, DummyList,
SometimesNot, StructObs, Incrementing,
NoData, NpStruct)
from toon.util import mono_clock
from toon.input... | aforren1/toon | tests/input/test_mpdevice.py | Python | mit | 4,589 |
#!/usr/bin/python
# -*- coding: latin-1 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version 3, or (at your option) any later
# version.
#
# This program is distributed in t... | SEA000/uw-empathica | empathica/gluon/contrib/pysimplesoap/server.py | Python | mit | 17,610 |
# -*- coding: utf-8 -*-
import socket
import struct
import signal
signal.signal(signal.SIGPIPE, signal.SIG_IGN)
class Connection(object):
"""
サーバとの通信用クラス
"""
BINARY_INT = '!1I'
BINARY_TABLE = '!120I'
def __init__(self, addr='127.0.0.1', port=42485):
self.sock = socket.socket(socket.A... | Hironsan/uecda-pyclient | src/connection.py | Python | mit | 1,996 |
# All the constants
# Get keys
import config
# All the Base Endpoints
STAGING_URL_HOST = 'test.deliver.opinioapp.com'
PRODUCTION_URL_HOST = 'deliver.opinioapp.com'
ACCESS_KEY = config.ACCESS_KEY
SECRET_KEY = config.SECRET_KEY
# Api Endpoints
API_BASE_ENDPOINT = '/api'
API_VERSION = 'v1'
API_ENDPOINT = API_BASE_ENDP... | anistark/opiniohll | OpinioDelivery/constants.py | Python | mit | 522 |
from .. import Provider as CurrencyProvider
class Provider(CurrencyProvider):
# Format: (code, name)
# See currency names in Russian: https://ru.wikipedia.org/wiki/Список_существующих_валют#Валюты
currencies = (
("AED", "Дирхам ОАЭ"),
("AFN", "Афгани"),
("ALL", "Лек"),
("AM... | danhuss/faker | faker/providers/currency/ru_RU/__init__.py | Python | mit | 7,994 |
class DumblrException(Exception):
"""Catch-all exception"""
| devty1023/dumblr | dumblr/exceptions.py | Python | mit | 64 |
"""
Django settings for sassafras project.
Generated by 'django-admin startproject' using Django 1.8.13.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build p... | mliudev/sassafras | sassafras/settings.py | Python | mit | 3,364 |
# encoding: utf-8
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'Template', fields ['name']
db.delete_unique('django_template', ['name'])
def backwards(self, orm):
# Adding uniqu... | tbtimes/checkup-survey | editorial_board/dbtemplates/south_migrations/0002_auto__del_unique_template_name.py | Python | mit | 1,636 |
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
in_1_pin = 18
in_2_pin = 23
in_3_pin = 24
in_4_pin = 25
en_pin = 22
GPIO.setup(in_1_pin, GPIO.OUT)
GPIO.setup(in_2_pin, GPIO.OUT)
GPIO.setup(in_3_pin, GPIO.OUT)
GPIO.setup(in_4_pin, GPIO.OUT)
GPIO.setup(en_pin, GPIO.OUT)
GPIO.output(en_pin, True)
period ... | simonmonk/electronics_cookbook | pi/ch_13_bi_stepper.py | Python | mit | 1,655 |
# Copyright (c) 2013-2016 Christian Geier et al.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, ... | dzoep/khal | khal/calendar_display.py | Python | mit | 7,480 |
from distutils.core import setup, Extension
module1 = Extension('hw_rand',
sources = ['hw_randmodule.c'])
setup (name = 'HwRand',
version = '1.0',
description = 'Interface for poking at intel\'s RDRAND',
ext_modules = [module1])
| richo/hw_rand | setup.py | Python | mit | 263 |
from datetime import datetime, timedelta
import json
import re
from django.core.cache import cache
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.utils.translation import ugettext_lazy as _
fro... | miketheman/opencomparison | package/models.py | Python | mit | 11,990 |
from django.core.management.base import BaseCommand
from django.db import connections, reset_queries
from ...models import *
class Command(BaseCommand):
def handle(self, *args, **options):
self.table_autocomplete()
def table_autocomplete(self):
#tabela cache para autocomplete
#pegand... | diegobill/django-cities | cities/management/commands/table_autocomplete.py | Python | mit | 1,726 |
from geojson_rewind import rewind
from geomet import wkt
import decimal
import statistics
def wkt_rewind(x, digits=None):
"""
reverse WKT winding order
:param x: [str] WKT string
:param digits: [int] number of digits after decimal to use for the return string.
by default, we use the mean num... | sckott/pygbif | pygbif/utils/wkt_rewind.py | Python | mit | 1,305 |
import os
import numpy as np
import pandas as pd
from lingam.rcd import RCD
def test_fit_success():
# causal direction: x5 --> x0, x3 --> x1 --> x2, x4 <-- x6
get_external_effect = lambda n: np.random.normal(0.0, 0.5, n) ** 3
n_samples = 100
x5 = get_external_effect(n_samples)
x6 = get_external_e... | cdt15/lingam | tests/test_rcd.py | Python | mit | 9,689 |
# -*- coding: utf-8 -*-
from ccxt.async.base.exchange import Exchange
import hashlib
class bit2c (Exchange):
def describe(self):
return self.deep_extend(super(bit2c, self).describe(), {
'id': 'bit2c',
'name': 'Bit2C',
'countries': 'IL', # Israel
'rateLimi... | tritoanst/ccxt | python/ccxt/async/bit2c.py | Python | mit | 6,650 |
""" XVM (c) www.modxvm.com 2013-2017 """
# PUBLIC
def initialize():
return _contacts.initialize()
def isAvailable():
return _contacts.is_available
def getXvmContactData(uid):
return _contacts.getXvmContactData(uid)
def setXvmContactData(uid, value):
return _contacts.setXvmContactData(uid, value)... | peterbartha/ImmunoMod | res_mods/mods/packages/xvm_contacts/python/contacts.py | Python | mit | 4,916 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement)
from builtins import (bytes, dict, int, list, object, range, str, ascii, chr, hex, input, next, oct, open, pow, round, super, filter, map, zip)
fr... | JoBrad/pyUtils | utils/futils.py | Python | mit | 10,454 |
# score.py
#
# A simple game scoring system
import mcpi.minecraft as minecraft
import time
score = 0
mc = minecraft.Minecraft.create()
while True:
time.sleep(1)
score += 1
mc.postToChat("score:" + str(score))
| whaleygeek/mcpi_recipes | scoring/score.py | Python | mit | 230 |
"""compute number of reads/alignments from BAM file
===================================================
This is a benchmarking utility script with limited functionality.
Compute simple flag stats on a BAM-file using
the pysam python interface.
"""
import sys
import pysam
assert len(sys.argv) == 2, "USAGE: {} filena... | bioinformed/pysam | benchmark/python_flagstat.py | Python | mit | 622 |
import json
import logging
from tornado.web import RequestHandler
from tornado import gen
import tornado.escape
from pycket.session import SessionMixin
logger = logging.getLogger(__name__)
class BaseHandler(RequestHandler, SessionMixin):
def __init__(self, application, request, **kwargs):
self._current_... | romansalin/calendio | apps/core/handlers.py | Python | mit | 2,260 |
from tests.unit.dataactcore.factories.staging import AppropriationFactory
from tests.unit.dataactcore.factories.domain import SF133Factory
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'a26_appropriations'
_TAS = 'a26_appropriations_tas'
def test_column_headers(database):
... | chambers-brian/SIG_Digital-Strategy_SI_ODP_Backend | tests/unit/dataactvalidator/test_a26_appropriations.py | Python | cc0-1.0 | 1,546 |
'''
Created on Mar 27,2015
@author: Yongxiang Qiu, Kay Kasemir
'''
try:
import xml.etree.cElementTree as ET
except:
import xml.etree.ElementTree as ET
from datetime import datetime
def getTimeSeries(data, name, convert='plain'):
'''Get values aligned by different types of time.
:param name: channel... | PythonScanClient/PyScanClient | scan/client/data.py | Python | epl-1.0 | 8,283 |
# -*- coding: utf-8 -*-
from AccessControl import Unauthorized
from plone.dexterity.content import Item
#from plone.dexterity.content import Container
from plone import api
from plone.i18n.normalizer import idnormalizer
from plone.i18n.normalizer import urlnormalizer
from z3c.form.interfaces import IValidator
from z3... | loechel/lmu.contenttypes.polls | src/lmu/contenttypes/polls/content/poll.py | Python | gpl-2.0 | 9,277 |
from __future__ import absolute_import
from Components.VariableValue import VariableValue
from Components.Renderer.Renderer import Renderer
from enigma import eSlider
class Progress(VariableValue, Renderer):
def __init__(self):
Renderer.__init__(self)
VariableValue.__init__(self)
self.__start = 0
self.__end ... | atvcaptain/enigma2 | lib/python/Components/Renderer/Progress.py | Python | gpl-2.0 | 1,048 |
from hashlib import sha1
import shutil
import re
import json
import time
from dateutil.parser import parse
from datetime import datetime as dtime
from datetime import timedelta as tdelta
from flask.ext.testing import TestCase
from app import db, app
import hactar.models
class BaseTest(TestCase):
_multiprocess_... | findgriffin/hactar | test/base.py | Python | gpl-2.0 | 6,991 |
from flask_security.core import RoleMixin
from hangman.models import db
class Role(db.Model, RoleMixin):
__tablename__ = 'roles'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), unique=True)
description = db.Column(db.String(255))
| jrichte43/hangman | hangman/models/role.py | Python | gpl-2.0 | 278 |
import asciiTable
class table_T_S_I_J_(asciiTable.asciiTable):
pass
| olivierdalang/stdm | third_party/FontTools/fontTools/ttLib/tables/T_S_I_J_.py | Python | gpl-2.0 | 76 |
# Copyright (C) 2012-2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will... | ignatenkobrain/dnf | tests/test_base.py | Python | gpl-2.0 | 9,603 |
# Beedraw/Hive network capable client and server allowing collaboration on a single image
# Copyright (C) 2009 Thomas Becker
#
# 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; eith... | skitzycat/beedraw | beesessionstate.py | Python | gpl-2.0 | 21,483 |
# -*- coding: utf-8 -*-
"""
Running the Gibbs sampler on flowcymetry data
http://www.physics.orst.edu/~rubin/nacphy/lapack/linear.html
matlab time: Elapsed time is 1.563538 seconds.
improve sample_mu:
python: 0.544 0.005 0.664
cython_admi: 0.469 0.005 0.493
moved_index_in_cyt... | JonasWallin/BayesFlow | examples/flowcymetry_normalMixture.py | Python | gpl-2.0 | 5,242 |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class Bottle(nn.Module):
def forward(self, input):
if len(input.size()) <= 2:
return super(Bottle, self).forward(input)
size = input.size()[:2]
out = super(Bottle, self).forw... | Air-Fighter/DecomposableAttModel_PyTorch | model.py | Python | gpl-2.0 | 2,524 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# log.py - Copyright (C) 2013 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; version... | ChinaMassClouds/copenstack-server | deploy/src/mplatform/utils/log.py | Python | gpl-2.0 | 2,418 |
#!/usr/bin/env python
from MAPI.Util import *
session = OpenECSession('SYSTEM','', os.getenv('ZARAFA_SOCKET', 'file:///var/run/zarafa'), flags=0)
def GetGuids(session, users = None, flags = 0):
"""<session> [<users>] [<flags>]
Returns the store guid for given user(s) within the current <session>.
"""
... | robertwbrandt/zarafa | zarafa-tools/mailstore/list-userguids.py | Python | gpl-2.0 | 1,363 |
#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Top Block
# Generated: Thu Oct 8 20:41:39 2015
##################################################
from datetime import datetime
from gnuradio import blocks
from gnuradio import digital
from gnuradio import e... | bitrat/alarm-fingerprint | AlarmGnuRadioFiles/Spectra_FileInput_To_BinarySlice_Local_only.py | Python | gpl-2.0 | 10,425 |
#!/usr/bin/python
# encoding: utf-8
import os
import glob
import pytest
from testlib import cmk_path, cmc_path
def test_find_debug_code():
scanned = 0
for base_path in [ cmk_path(), cmc_path() ]:
for dirpath, dirnames, filenames in os.walk("%s/web" % base_path):
scanned += 1
fo... | huiyiqun/check_mk | tests/git/test_find_debug_code_web.py | Python | gpl-2.0 | 620 |