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 |
|---|---|---|---|---|---|
#!/usr/bin/env python3
import logging
import threading
import time
logging.basicConfig(level = logging.DEBUG, format = '%(asctime)s.%(msecs)03d [%(levelname)s] (%(threadName)s) %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
s = threading.Event()
def worker(n):
logging.debug("waiting for signal")
s.wait()
logging.d... | dubrayn/dubrayn.github.io | examples/threading/example12.py | Python | mit | 509 |
# -*- config:utf-8 -*-
import logging
from datetime import timedelta
import os
project_name = "my_project"
class Config(object):
# Base path
APPLICATION_PATH = os.path.dirname(os.path.abspath(__file__))
# use DEBUG mode?
DEBUG = False
# use TESTING mode?
TESTING = False
# use server x... | Invoicy/invoicy | config.py | Python | mit | 2,280 |
"""
WSGI config for bilgecode 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bilgecode.settings")
from django.co... | BilgeCode/bilgecode.com | bilgecode/wsgi.py | Python | mit | 393 |
###############################################################################
#
# 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... | markope/AutobahnPython | autobahn/twisted/websocket.py | Python | mit | 22,863 |
# 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 ... | vulcansteel/autorest | AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/auto_rest_complex_test_service/operations/primitive.py | Python | mit | 32,219 |
# ----------------------------------------------------------------------
#
# Brad T. Aagaard, U.S. Geological Survey
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://geodynamics.org).
#
# Copyright (c) 2010-2017 University of California, Davis
#
# See COPYING for license... | geodynamics/spatialdata | spatialdata/spatialdb/generator/Shaper.py | Python | mit | 3,625 |
# coding: utf-8
import sys
from markov import LettersMarkovChain, WordsMarkovChain
from ngrams import LettersNGramsStats, WordsNGramsStats, write_stats_to_file, read_stats_from_file
__author__ = "Michał Ciołczyk"
_POSSIBLE_USAGES = ['prepare', 'letters', 'words']
_INPUT = 'data/pap.txt'
_STATS_WORDS = 'data/words_%s... | salceson/PJN | lab5/main.py | Python | mit | 2,044 |
# -*- test-case-name: xquotient.test.historic.test_rulefilter1to2 -*-
"""
Create a store with a RuleFilteringPowerup and its dependencies in it.
"""
from axiom.test.historic.stubloader import saveStub
from xquotient.filter import RuleFilteringPowerup
from axiom.tags import Catalog
from xquotient.mail import MessageSour... | twisted/quotient | xquotient/test/historic/stub_rulefilter1to2.py | Python | mit | 637 |
#
# Coinkite API Bindings
#
# Full docs at: https://docs.coinkite.com/
#
# Copyright (C) 2014 Coinkite Inc. (https://coinkite.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without ... | coinkite/coinkite-python | ckapi/__init__.py | Python | mit | 1,321 |
from rest_framework import serializers
from models import Session, Participant
class ParticipantSerializer(serializers.ModelSerializer):
"""Participant serializer."""
class Meta:
model = Participant
fields = ('id', 'participant', 'session', 'joined_date')
read_only_fields = ('joined... | andela/codango | codango/pairprogram/serializers.py | Python | mit | 706 |
from qgis.core import *
from qgis.gui import *
from PyQt4.QtCore import *
from PyQt4 import QtGui
from osgeo import gdal
# xml = """<GDAL_WMS>
# <Service name="TMS">
# <ServerUrl>http://tile.openstreetmap.org/${z}/${x}/${y}.png</ServerUrl>
# </Service>
# <DataWindow>
# <UpperLeftX>-20037508.34</UpperLeftX... | heltonbiker/MapComplete | PyQt/FeatureDemos/PyQgis/BingRasterLayerDemo.py | Python | mit | 2,651 |
# this is the sort of middleware as implemented by https://www.npmjs.org/package/koa-common
# and its individual dependencies (like https://www.npmjs.org/package/koa-logger,
# https://www.npmjs.org/package/koa-mount and so on). The koa.js devs explicitly split
# koa's core and koa-common into two separate npm packages,... | KjellSchubert/koa | koa/common.py | Python | mit | 16,813 |
"""
homeassistant.components.light.wink
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for Wink lights.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.wink/
"""
import logging
from homeassistant.components.light import ATTR_BRIGHTNESS
from homeassist... | toddeye/home-assistant | homeassistant/components/light/wink.py | Python | mit | 1,528 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This program is a demonstration of feature extraction function shape:360.
The following key bindings are available:
N - load next image
P - load previous image
Q - exit
"""
import argparse
import logging
import math
import mimetypes
import os
import sys
sys.pat... | naturalis/imgpheno | examples/shape360.py | Python | mit | 4,963 |
def present(self):
"""Start the presentation."""
pass
def unpresent(self):
"""Stop the presentation."""
pass
def present_section(self):
"""Present current song section."""
pass
| PeteCrighton/Praesence | praesence/present.py | Python | mit | 203 |
import sys
import paramiko
import util_uploader
class GetAixData():
def __init__(self, ip, SSH_PORT, TIMEOUT, usr, pwd, USE_KEY_FILE, KEY_FILE, \
GET_SERIAL_INFO, GET_HARDWARE_INFO, GET_OS_DETAILS, \
GET_CPU_INFO, GET_MEMORY_INFO, IGNORE_DOMAIN, UPLOAD_IPV6, DEBU... | GABeech/nix_bsd_mac_inventory | module_aix.py | Python | mit | 7,368 |
import os
import math
listOfFiles = []
#for eachfile in os.listdir(os.getcwd()+"/tabfiles"): #tabfiles - folder with original tabfiles
for eachfile in os.listdir(os.getcwd()+"/tabfiles"):
#if(eachfile.endswith(".tabn")):
if(eachfile.endswith(".tab")):
listOfFiles.append(eachfile)
def getcommongrams(n... | ramaganapathy1/AMuDA-Ir-back-end | production/JVcode/Scripts/features.py | Python | mit | 1,991 |
from core.himesis import Himesis
import uuid
class Hlayer1rule8(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule layer1rule8.
"""
# Flag this instance as compiled now
self.is_compiled = True
... | levilucio/SyVOLT | mbeddr2C_MM/transformation_from_eclipse/Hlayer1rule8.py | Python | mit | 4,948 |
from flask import current_app
from flask import _app_ctx_stack as stack
from webrpc.client import Client
class RPC(object):
def __init__(self, service_name):
self.service_name = service_name
def execute(self, cmd, *args, **kwargs):
ctx = stack.top
if ctx is not None:
if no... | yejianye/microblog | bomb/www/rpc_client.py | Python | mit | 960 |
#!/usr/bin/env python
import cv2
import numpy as np
import time
import classification
import operator
import math
from picamera.array import PiRGBArray
from picamera import PiCamera
#from pygame import mixer
#PARAMS
saveSize=100
numContrours=1000
approxAccuracy=0.03
class SignDetector():
def __init__(self):
... | stefanbo92/maleChildren | Raspi/SignDetector_piCam.py | Python | mit | 7,944 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/inventory/inventory_delta.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobu... | bellowsj/aiopogo | aiopogo/pogoprotos/inventory/inventory_delta_pb2.py | Python | mit | 3,352 |
# -*- coding: utf-8 -*-
#
# Dataverse Documentation build configuration file, created by
# sphinx-quickstart on Wed Apr 16 09:34:18 2014.
#
# 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.
#
#... | bencomp/dataverse.org | docs/community/source/conf.py | Python | mit | 13,483 |
#!/usr/local/bin/python
import sys
import json
import cgi
import re
import numpy #used for smoothing.
import copy
import decimal
import MySQLdb
import warnings
import hashlib
"""
#There are 'fast' and 'full' tables for books and words;
#that's so memory tables can be used in certain cases for fast, hashed matching, b... | Bookworm-project/BookwormAPI | bookworm/SQLAPI.py | Python | mit | 59,706 |
from PyQt4 import QtGui,QtCore
class MyWidget(QtGui.QWidget):
def __init__(self,parent=None):
super(MyWidget,self).__init__(parent)
self.resize(1000,1000)
#self.setStyleSheet(QString.fromLatin1("background:black"))
layout = QtGui.QHBoxLayout()
self.btn1 = QtGui.QP... | UpSea/midProjects | BasicOperations/01_01_PyQt4/KeyPressEvents.py | Python | mit | 1,102 |
from serpent.utilities import is_linux, is_windows
class WindowControllerError(BaseException):
pass
class WindowController:
def __init__(self):
self.adapter = self._load_adapter()()
def locate_window(self, name):
return self.adapter.locate_window(name)
def move_window(self, window... | SerpentAI/SerpentAI | serpent/window_controller.py | Python | mit | 1,341 |
from emailoto.token_client import TokenClient
from emailoto.authentication import EmailOtoAuthBackend
import time
from .test_base import EmailOtoTest
from django.core.urlresolvers import reverse
from emailoto.config import EmailOtoConfig, CONFIG
class TokenClientTest(EmailOtoTest):
def test_set_counter(self):
... | qdonnellan/django_emailoto | tests/tests.py | Python | mit | 5,390 |
import os
import time
import subprocess
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
class Maker(FileSystemEventHandler):
def on_modified(self, _):
Maker.lock = True
print 'make'
p = subprocess.Popen('make')
p.wait()
def main():
... | neuront/madmagia | webinterface/scripts/watch.py | Python | mit | 585 |
"""
Utility to execute map-reduce jobs on Amazon EMR.
Special notes:
WARNING! Requires Python >= 2.5
Written for the Rankmaniac competition (2014)
in CS/EE 144: Ideas behind our Networked World
at the California Institute of Technology.
Authored by: Max Hirschhorn (maxh@caltech.edu)
"""
from __future__ import w... | visemet/rankmaniac | uploader.py | Python | mit | 3,245 |
##
# Analysis.py
#
# Author: Vincent Steffens, vsteffen@ucsc.edu
# Date: 16 November 2014
#
# Produces a mean power spectrum of raw SEAD plug current
# data, normalized by total current.
# Outputs to spectrum in a numpy array to stdout or a text
# file, each array element on a line.
##
#For numerical analysis ... | seadsystem/Backend | Analysis and Classification/Analysis/Code/Vince's_Code/Analysis/Testing Data/Analysis.py | Python | mit | 9,748 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tempfile
import nose
from nose.tools import eq_, assert_true, assert_is_none
import PyQt5
from PyQt5.QtCore import QT_TRANSLATE_NOOP, qVersion, QFile
# import PySide as PyQt5
# from PySide.QtCore import QT_TRANSLATE_NOOP, qVersion, QFile
from qtpythonic import py... | uranusjr/qtpythonic | tests/test_class.py | Python | mit | 2,057 |
import unittest
from conans import tools
from conans.test.utils.tools import TestServer, TestClient
from conans.paths import CONANFILE
from conans.util.files import save
from conans.model.ref import ConanFileReference
import os
conan_content = """
from conans import ConanFile
class OpenSSLConan(ConanFile):
name ... | luckielordie/conan | conans/test/remote/auth_test.py | Python | mit | 5,832 |
'''
Created on Mar 8, 2016
@author: victor
'''
import json
import sys
import matplotlib.pyplot as plt
import seaborn as sns
import numpy
sns.set_style("whitegrid")
if __name__ == '__main__':
results = json.load(open(sys.argv[1]))
# get JSD values per k
ic_to_cc = []
md_to_ic = []
md_to_cc = ... | victor-gil-sepulveda/PhD-ANMPythonHelpers | nma_algo_char/confSpaceOverlapPlots.py | Python | mit | 4,567 |
"""
Given a binary tree, each node element contains a number. Find maximum possible sum
between two leaf nodes.
"""
"""
Approach:
1. We can do this in single traversal of the tree.
2. The idea is to return the maximum sum from a node to any leaf node from subtree rooted at that node.
3. Maximum sum between any two le... | prathamtandon/g4gproblems | Graphs/max_sum_path_between_leaves.py | Python | mit | 1,259 |
#!/usr/bin/env python3
'''
lib/util/str.py
Contains string utility functions. This includes conversions between `str` and
`bytes`, and hash calculations.
'''
import logging
logger = logging.getLogger('sublime-ycmd.' + __name__)
def str_to_bytes(data):
'''
Converts `data` to `bytes`.
If data is a `str`... | sublime-ycmd/sublime-ycmd | lib/util/str.py | Python | mit | 4,306 |
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.backends.postgresql.client import DatabaseClient
from django.db.backends.postgresql.features import DatabaseFeatures
from .creation import DatabaseCreation
from .introspection import DatabaseIntrospection
from .operations import DatabaseOperat... | David-Wobrock/django-fake-database-backends | django_fake_database_backends/backends/postgresql/base.py | Python | mit | 3,122 |
"""Tests for freeze/unfreeze"""
import unittest
| jackstanek/s3bot | tests/s3bot_/test_freeze.py | Python | mit | 49 |
import unittest
import munch
import basecrm
from basecrm.test.testutils import BaseTestCase
class OrdersServiceTests(BaseTestCase):
def test_service_property_exists(self):
self.assertTrue(hasattr(self.client, 'orders'))
def test_method_list_exists(self):
self.assertTrue(hasattr(self.client.o... | basecrm/basecrm-python | basecrm/test/test_orders_service.py | Python | mit | 1,933 |
import chainer.functions as F
import chainer.links as L
from chainer import Variable
from chainer.links import caffe
from chainer import computational_graph as c
from deel.tensor import *
from deel.network import *
import chainer.serializers as cs
import copy
from deel.deel import *
import chainer
import json
import o... | uei/deel | deel/network/nin.py | Python | mit | 2,646 |
#!/usr/bin/env python3
import os
import sys
import platform
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name = "ext-util",
version = "1.0",
packages = [],
scripts = ["scripts/ext"],
install_requires = [],
author ... | KoffeinFlummi/ext | setup.py | Python | mit | 847 |
# -*- coding: utf-8 -*-
"""
flask.session 说明:
- 基于 Werkzeug 的 secure cookie模块, 实现 session
"""
from werkzeug.contrib.securecookie import SecureCookie
class Session(SecureCookie):
"""扩展 session, 支持 持久 session 和 非持久 session 切换.
"""
def _get_permanent(self):
return self.get('_permanent', False)... | hhstore/flask-annotated | flask/flask-0.5/flask/session.py | Python | mit | 1,235 |
from __future__ import absolute_import
from __future__ import print_function
import inflection
import copy
import json
import requests
import pprint
from .exceptions import (
AuthenticationFailed,
BadRequest,
DoesNotExist,
Unauthorized
)
from .resource import DRESTResource
from six.moves.urllib.parse im... | AltSchool/dynamic-rest-client | dynamic_rest_client/client.py | Python | mit | 7,879 |
import unittest
from solution import *
class Test_234_Intermediate(unittest.TestCase):
def test_spellcheck(self):
self.assertEqual(spellcheck("foobar"), "foob<ar")
self.assertEqual(spellcheck("garbgae"), "garbg<ae")
if __name__ == "__main__":
unittest.main() | marcardioid/DailyProgrammer | solutions/234_Intermediate/test_solution.py | Python | mit | 284 |
from CRABClient.UserUtilities import config, getUsernameFromSiteDB
config = config()
config.General.requestName = 'AMPT7TeVstring_June2015_generation_run0pp13TeVv1'
#config.General.workArea = 'crab_projects'
config.General.transferOutputs = True
config.General.transferLogs = False
config.JobType.pluginName = 'Private... | tuos/FlowAndCorrelations | model/ampt/production/v1B/run0ppv1/energy13TeV/crab.py | Python | mit | 933 |
# Module: main
# Date: 12th July 2010
# Author: James Mills, prologic at shortcircuit dot net dot au
#
# Borrowed from sahriswiki (https://sahriswiki.org/)
# with permission from James Mills, prologic at shortcircuit dot net dot au
"""Main
Main entry point responsible for configuring and starting the applicat... | prologic/kdb | kdb/main.py | Python | mit | 1,081 |
"""
Test compiling and executing using the gdc tool.
"""
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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
#... | EmanueleCannizzaro/scons | test/D/Issues/2940_Ariovistus/sconstest-correctLinkOptions_dmd.py | Python | mit | 1,490 |
# coding: utf-8
from .visibility_flags import VisibilityFlags
| tiberiucorbu/av-website | main/model/common/__init__.py | Python | mit | 63 |
class Game2048Error(Exception):
pass
class Game2048NoFreeLocationsLeft(Game2048Error):
pass
| Peter-Slump/game-2048 | game_2048/exceptions.py | Python | mit | 102 |
import solveu
import numpy as np
def myfun():
a = 1.1
out = np.ones((1))
solveu.try1(a, out)
PETSc.Sys.Print(out)
if __name__ == '__main__':
myfun()
| pcmagic/stokes_flow | try_code/try_cython/try_solveu.py | Python | mit | 173 |
"""
A hexagonal number sequence is a sequence of figurate numbers
where the nth hexagonal number hₙ is the number of distinct dots
in a pattern of dots consisting of the outlines of regular
hexagons with sides up to n dots, when the hexagons are overlaid
so that they share one vertex.
Calculates the hexagon... | TheAlgorithms/Python | maths/series/hexagonal_numbers.py | Python | mit | 1,350 |
from .addressing_mode import AddressingMode
class ZeroPageAddressingMode(AddressingMode):
@property
def instruction_size(self):
return 2
def calculate_address(self, processor, parameter):
return parameter
| Hexadorsimal/pynes | nes/processors/cpu/instructions/addressing_modes/zero_page.py | Python | mit | 236 |
#!/usr/bin/env python3
# Copyright (c) 2010 ArtForz -- public domain half-a-node
# Copyright (c) 2012 Jeff Garzik
# Copyright (c) 2010-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# mininode.p... | elysiumd/windows-wallet-13.2 | qa/rpc-tests/test_framework/mininode.py | Python | mit | 54,390 |
from django.core.files.storage import FileSystemStorage
class OverwriteImageStorage(FileSystemStorage):
""" Storage that delete a previous file with the same name
and its copy at different resolution
"""
def get_available_name(self, name, max_length=None):
# If the filename already exists,
... | rphlo/django-seuranta | seuranta/storage.py | Python | mit | 688 |
import time
import asyncio
import aiohttp
import requests
from python_rucaptcha.config import app_key
from python_rucaptcha.decorators import api_key_check, service_check
from python_rucaptcha.result_handler import get_sync_result, get_async_result
class TextCaptcha:
def __init__(
self,
rucaptch... | AndreiDrang/python-rucaptcha | python_rucaptcha/TextCaptcha.py | Python | mit | 10,908 |
# coding: utf-8
"""
Talon.One API
The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #... | talon-one/talon_one.py | test/test_accept_referral_effect_props.py | Python | mit | 2,068 |
from django.contrib.sites import models
from django.db.models import signals
from django.dispatch import receiver
from themes.models import Theme
@receiver(signals.m2m_changed, sender=Theme.sites_enabled.through)
def post_save_handler(sender, instance, **kwargs):
if instance.__class__ is not Theme:
retur... | LimpidTech/django-themes | themes/signals.py | Python | mit | 453 |
import pygame
from src.GameMethods import GameMethods
from src.camera.Camera import Camera
from src.gui.Gui import Gui
from src.gui.elements.text.TextBlock import TextBlock
from src.level import Level
from behaviours import Collide
from behaviours.Collector import Collector
from tiles.base.Tile import Tile
class NoL... | cthit/CodeIT | src/Game.py | Python | mit | 3,842 |
"""
Functions for calculating the greatest common divisor of two integers or
their least common multiple.
"""
def gcd(a, b):
"""Computes the greatest common divisor of integers a and b using
Euclid's Algorithm.
gcd{𝑎,𝑏}=gcd{−𝑎,𝑏}=gcd{𝑎,−𝑏}=gcd{−𝑎,−𝑏}
See proof: https://proofwiki.org/wiki/GCD_fo... | keon/algorithms | algorithms/maths/gcd.py | Python | mit | 1,561 |
#!./venv/bin/python
import logging
from os import path
from poff import create_app, db
log_format = '%(asctime)s %(levelname)-10s %(name)s %(message)s'
logging.basicConfig(format=log_format, level=logging.DEBUG)
dev_config = path.abspath(path.join(path.dirname(__file__), 'dev_config.py'))
app = create_app(dev_conf... | thusoy/poff | devserver.py | Python | mit | 401 |
"""Simulation workflows."""
from .initialization import initialize
from .workflow_coop import workflow_crystal_orbital_overlap_population
from .workflow_coupling import workflow_derivative_couplings
from .workflow_single_points import workflow_single_points
from .workflow_stddft_spectrum import workflow_stddft
__all__... | SCM-NV/qmworks-namd | nanoqm/workflows/__init__.py | Python | mit | 472 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# To create a distribution package for pip or easy-install:
# python setup.py sdist
from os.path import join, dirname, realpath
from setuptools import setup, find_packages, Command
import subprocess as sp
from warnings import warn
author = u"Richard Hartmann"
authors = [au... | cimatosa/jobmanager | setup.py | Python | mit | 2,567 |
"""Marrow Schema metaclass definition.
This handles the irregularities of metaclass definition and usage across Python versions.
"""
from collections import OrderedDict as odict
class ElementMeta(type):
"""Instantiation order tracking and attribute naming / collection metaclass.
To use, construct subclasses of ... | marrow/schema | marrow/schema/meta.py | Python | mit | 4,894 |
"""
"""
import os
from distutils.core import Command as BaseCommand
from unittest import TestLoader, TextTestRunner
from setuptools import setup
class TestCommand(BaseCommand):
"""Runs the package tests."""
description = 'Runs all package tests.'
user_options = [
('junit=', None,
'outpu... | envi-idl/envipyarc | setup.py | Python | mit | 1,926 |
# Copyright (c) 2015 Pascal Junod <pascal@junod.info>
# Licensed under the MIT license (copy available at https://opensource.org/licenses/MIT)
from Crypto.Cipher import AES
import hashlib
pi = [2, 63317, 63331, 63337, 63347, 63353, 63361, 63367, 63377, 63389, 63391, 63397, 63409, 63419, 63421, 63439, 63443,
6346... | cryptopathe/CybSec15-CTF | 300/solve.py | Python | mit | 3,453 |
from __future__ import unicode_literals
from collections import defaultdict
import glob
import json
import os
from .metrics_core import Metric
from .mmap_dict import MmapedDict
from .samples import Sample
from .utils import floatToGoString
try: # Python3
FileNotFoundError
except NameError: # Python >= 2.5
... | sserrot/champion_relationships | venv/Lib/site-packages/prometheus_client/multiprocess.py | Python | mit | 6,474 |
from .lims_quantitationMethod_io import lims_quantitationMethod_io
from .lims_quantitationMethod_dependencies import lims_quantitationMethod_dependencies
#resources
#TODO:
from rpy2.robjects.packages import importr
import rpy2.robjects as robjects
class lims_quantitationMethod_execute(lims_quantitationMethod_io,
... | dmccloskey/SBaaS_quantification | SBaaS_quantification/lims_quantitationMethod_execute.py | Python | mit | 4,164 |
import asyncio
from asyncio import coroutine
from .unit import Unit, Parts, part, inport, outport, sync, async
from .ctx import Context, Setup
| wabu/zeroflo | zeroflo/core/__init__.py | Python | mit | 146 |
#!/usr/bin/env python3
import os
import unittest
import logging
import shutil
import tempfile
import pandas as pd
import ciftify.config
from ciftify.utils import run, TempDir
import pytest
from unittest.mock import patch
def get_test_data_path():
return os.path.join(os.path.dirname(os.path.dirname(__file__)), 'da... | edickie/ciftify | tests/functional/test_ciftify_pint_vertices.py | Python | mit | 7,021 |
# -*- coding: utf-8 -*-
""" This module provides additional tools for psiTurk users. """
from functools import wraps, update_wrapper
from flask import request, Response, make_response, current_app
# provides easy way to print to log in custom.py
# =========================================
def print_to_log(stuff_to_pr... | suchow/psiTurk | psiturk/user_utils.py | Python | mit | 2,231 |
'''Server front-end for running games/tournaments, served up to a web client.
'''
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Welcome to MBTAI'
if __name__ == '__main__':
app.run(host='0.0.0.0', debug=True)
| DouglasOrr/Snippets | mbtai/mbtai/server.py | Python | mit | 260 |
"""
Keras backend for QRNNs
=======================
This module implements the Keras backend for QRNNs.
"""
import copy
import logging
import os
import pickle
import numpy as np
from scipy.interpolate import CubicSpline
# Keras Imports
try:
import keras
from keras.models import Sequential, clone_model, Model... | atmtools/typhon | typhon/retrieval/qrnn/backends/keras.py | Python | mit | 30,923 |
"""
A multi-dimensional ``Vector`` class, take 4
"""
from array import array
import math
import reprlib
import numbers
class Vector:
typecode = 'd'
def __init__(self, components):
self._components = array(self.typecode, components)
def __len__(self):
return len(self._components)
de... | fluentpython/pythonic-api | examples/vector_v4.py | Python | mit | 1,431 |
from django.conf.urls import patterns, url
from storybase_messaging.views import (SiteContactMessageCreateView,
StoryNotificationDetailView)
urlpatterns = patterns('',
url(r'^contact/$',
SiteContactMessageCreateView.as_view(), name='contact'),
url(r'^notifications/(?P<pk>[0-9]+)/$',
Story... | denverfoundation/storybase | apps/storybase_messaging/urls.py | Python | mit | 390 |
import argparse
from flask import Flask
from flask_restful import Resource, Api, reqparse
import json
import urllib2
class getWeather(Resource):
def forecast(self, city):
answer = None
# calls the weather API and loads the response
res = urllib2.urlopen(weather_today + city)
data ... | hutomadotAI/Examples | SampleBots/WeatherBot/getWeather.py | Python | mit | 2,199 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2016 Christoph Reiter
#
# 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 right... | lazka/senf | setup.py | Python | mit | 3,922 |
import random
import string
from wopmars.models.ToolWrapper import ToolWrapper
class CarAssembler(ToolWrapper):
__mapper_args__ = {
"polymorphic_identity": __module__
}
def specify_output_file(self):
if not self.option("to_file"):
return []
else:
return ["... | aitgon/wopmars | wopmars/data/example/wrapper/CarAssembler.py | Python | mit | 2,936 |
#!/usr/bin/python
#from ansible.module_utils.azure_rm_common import *
DOCUMENTATION = '''
---
module:
'''
import os.path
import json
import base64
from urlparse import urlparse
from distutils.version import LooseVersion
from subprocess import check_output
try:
import time
import yaml
except ImportError as e... | adamkingit/troll-gate | ansible/library/bluemix_push.py | Python | mit | 1,584 |
import pytest
import os
from plantcv.plantcv import readimage
def test_plantcv_readimage_native(test_data):
"""Test for PlantCV."""
img, path, img_name = readimage(filename=test_data.small_rgb_img, mode='native')
expected = [3] + list(os.path.split(test_data.small_rgb_img))
# Assert that the image nam... | danforthcenter/plantcv | tests/plantcv/test_readimage.py | Python | mit | 1,720 |
import random
from ProbabilityDistribution import ProbabilityDistribution
class DiscreteProbability(ProbabilityDistribution):
'''
This class implements the discrete probability functions.
'''
def getSample(self, randomGenerator):
'''
Generates a random number uniformly distributed.
'''
# Gener... | lmarent/network_agents_ver2_python | agents/probabilities/DiscreteProbability.py | Python | mit | 902 |
# Copyright (C) 2016 Fan Long, Martin Rianrd and MIT CSAIL
# Prophet
#
# This file is part of Prophet.
#
# Prophet 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 y... | jyi/ITSP | prophet-gpl/tools/gzip-case-create.py | Python | mit | 2,877 |
from .STN import STN
| oarriaga/spatial_transformer_networks | src/models/__init__.py | Python | mit | 21 |
"""Stitches Monte Carlo files (different iters but same params) together."""
import copy
import pickle
import argparse
import numpy
from gewittergefahr.gg_utils import monte_carlo
from gewittergefahr.gg_utils import file_system_utils
TOLERANCE = 1e-6
INPUT_FILES_ARG_NAME = 'input_file_names'
OUTPUT_FILE_ARG_NAME = '... | thunderhoser/GewitterGefahr | gewittergefahr/scripts/stitch_monte_carlo_files.py | Python | mit | 5,729 |
"""
The MIT License (MIT)
Copyright (c) 2017 Louis-Philippe Querel l_querel@encs.concordia.ca
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... | louisq/staticguru | utility/commit.py | Python | mit | 1,273 |
# -*- coding: utf-8 -*-
"""
zenfig.api.color
~~~~~~~~
Utilities for color string manipulation
:copyright: (c) 2016 by Alejandro Ricoveri
:license: MIT, see LICENSE for more details.
"""
import re
import webcolors
import jinja2
from functools import wraps
from ..util import autolog, memoize
from . import _regist... | axltxl/zenfig | zenfig/api/color.py | Python | mit | 2,377 |
import unicodedata
import sqlalchemy as sa
from sqlalchemy import Computed
from sqlalchemy import DefaultClause
from sqlalchemy import event
from sqlalchemy import FetchedValue
from sqlalchemy import ForeignKey
from sqlalchemy import Identity
from sqlalchemy import Index
from sqlalchemy import inspect
from sqlalchemy ... | sqlalchemy/sqlalchemy | test/engine/test_reflection.py | Python | mit | 71,424 |
from django import forms
class FlagForm(forms.Form):
flag = forms.CharField(label='flag', max_length=256)
class SortOrderForm(forms.Form):
choices = [
(1, 'name'),
(2, 'score'),
(3, 'created'),
(4, 'modified')
]
sortorder = forms.ChoiceField(label='sort order', choice... | super1337/Super1337-CTF | challenges/forms.py | Python | mit | 419 |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from ... | bitcoinxt/bitcoinxt | qa/rpc-tests/invalidblockrequest.py | Python | mit | 5,030 |
"""superlists URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/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-... | HaoPatrick/tdd-pyhton | superlists/urls.py | Python | mit | 970 |
# Usage: $ python3 merge_bug_commit_data.py /home/kevin/Desktop/contribs-facebook-android-sdk/ /home/kevin/Desktop/merge_contrib.csv
# python3 merge_bug_commit_data.py <bug_commits_per_tag_directory> <output_file>
#
# Merges all the extracted contribution per tag data into one single file.
__author__ = 'feli... | megakevin/single-authored-code-evolution-analysis | merge_testwell_data.py | Python | mit | 2,804 |
from unittest import TestCase
from plivo import plivoxml
from tests import PlivoXmlTestCase
class NumberElementTest(TestCase, PlivoXmlTestCase):
def test_set_methods(self):
expected_response = '<Response><Dial><Number sendDigits="wwww2410" sendDigitsMode=""' \
' sendOnPreanswe... | plivo/plivo-python | tests/xml/test_numberElement.py | Python | mit | 949 |
from solver.output_handlers.animation_plotter import AnimationPlotterResultsHandler
import numpy as np
from solver.nonlinear_solver_wrappers import scipy_wrapper,\
petsc4py_wrapper
from solver.time_stepper import transient_solve
from solver.properties import GeometricProperties, PhysicalProperties,\
ConstantMap... | tarcisiofischer/heat_diffusion_experiment | experiments_and_demos/square_diffusion.py | Python | mit | 1,627 |
import requests
base_url = "http://thesession.org/tunes/%d/abc"
n_files = 14010
for k in range(1, n_files):
if k % 100 == 0:
print "Downloading file %d/%d" % (k, n_files)
try:
r = requests.get(base_url % k)
if r.status_code == 200:
f = open("abc/%d.abc" % k, "w")
... | jfsantos/trad-rnn | download_dataset.py | Python | mit | 401 |
from .search_products_results_response import SearchProductsResultsResponse
from .search_products_results_schema import SearchProductsResultsSchema
| willrp/willbuyer | backend/util/response/store/search_products_results/__init__.py | Python | mit | 148 |
# MIT License
#
# Copyright (c) 2015-2021 Iakiv Kramarenko
#
# 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, modif... | yashaka/selene | tests/acceptance/selene_element_test.py | Python | mit | 2,140 |
# -*- 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 model 'EmailVerificationToken'
db.create_table(u'maker_emailveri... | projectweekend/Links-API | links/maker/migrations/0009_auto__add_emailverificationtoken__add_field_maker_verified.py | Python | mit | 6,505 |
import numpy as np
import scipy.optimize as op
def Sigmoid(z):
return 1/(1 + np.exp(-z))
def Gradient(theta,x,y):
m , n = x.shape
theta = theta.reshape((n,1))
y = y.reshape((m,1))
sigmoid_x_theta = Sigmoid(x.dot(theta))
grad = ((x.T).dot(sigmoid_x_theta-y))/m
return grad.flatten()
def Cos... | pk-ai/training | machine-learning/coursera_exercises/ex2/in_python/exercises/advOptimize.py | Python | mit | 1,211 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import csv
import logging
import re
import sys
from closeio_api import Client as CloseIO_API
from dateutil.parser import parse as parse_date
OPPORTUNITY_FIELDS = [
'opportunity%s_note',
'opportunity%s_value',
'opportunity%s_value_period',
... | closeio/closeio-api-scripts | scripts/bulk_update_leads_info.py | Python | mit | 16,243 |
import pymysql
import rds_config
import argparse
rds_host = rds_config.db_host
username = rds_config.db_username
password = rds_config.db_password
db_name = rds_config.db_name
port = rds_config.db_port
server_address = (rds_host, port)
class AdminUtils:
def addJobs(self, displacements, parameters, group):
... | russellthackston/comp-chem-util | myriad/admin.py | Python | mit | 2,641 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2015 John Dewey
#
# 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
# t... | retr0h/demeter | demeter/__init__.py | Python | mit | 2,222 |
__author__ = 'JordSti'
from PyQt4 import QtGui, QtCore
import gui
import direction_sprite
import frame_widget
class direction_sprite_widget(QtGui.QWidget, gui.Ui_direction_sprite_widget):
def __init__(self, sprite, parent=None):
super(direction_sprite_widget, self).__init__(parent)
self.setupUi(s... | jordsti/stigame | tools/sprite-editor/direction_sprite_widget.py | Python | mit | 5,876 |
import _plotly_utils.basevalidators
class TicklenValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="ticklen", parent_name="histogram2dcontour.colorbar", **kwargs
):
super(TicklenValidator, self).__init__(
plotly_name=plotly_name,
p... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram2dcontour/colorbar/_ticklen.py | Python | mit | 473 |