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
""" Script for building NodeBox Usage: python setup.py py2app """ from distutils.core import setup from setuptools.extension import Extension import py2app import nodebox NAME = 'NodeBox extended' VERSION = nodebox.__version__ AUTHOR = "Frederik De Bleser", AUTHOR_EMAIL = "frederik@pandora.be", URL = "http://...
karstenw/nodebox-pyobjc
setup_large.py
Python
mit
4,542
import codecs import re UTF8_BOM_PATTERN = re.compile("\\A(\\xFE\\xFF|\\xFF\\xFE)".encode('utf-8')) def read_unicode(filename,external_encoding='utf8'): data = codecs.open(filename,encoding=external_encoding).read() if UTF8_BOM_PATTERN.match(data): return unicode(UTF8_BOM_PATTERN.sub('',data)).encode('utf8') el...
OiNutter/rivets
rivets/utils.py
Python
mit
481
# encoding: UTF-8 # Copyright Krzysztof Sopyła (krzysztofsopyla@gmail.com) # # # Licensed under the MIT # Network architecture: # Five layer neural network, input layer 28*28= 784, output 10 (10 digits) # Output labels uses one-hot encoding # input layer - X[batch, 784] # 1 layer - W1[784,...
ksopyla/tensorflow-mnist-convnets
mnist_2.0_5_layer_nn.py
Python
mit
6,492
''' A socket.io bridge for Python This gives Python users access to socket.io, a node.js library. This library provides simple and efficient bidirectional communication between browsers and servers over a message-oriented socket. Transport is normalized over various technologies including WebSockets, Flash sockets, an...
behrat/ted
server/socket_io.py
Python
mit
8,066
#!/usr/bin/env python3 """Compute the CallSiteTypeId of some function types for clang CFI (Control Flow Integrity). When calling a function indirectly, clang could introduce a call to a function which checks the type of the called function: void __cfi_check(uint64 CallSiteTypeId, void *TargetAddr, void *DiagData)...
fishilico/shared
python/clang_cfi_typeid.py
Python
mit
16,141
import time, inspect try: from line_profiler import LineProfiler def do_profile(follow=[]): def inner(func): def profiled_func(*args, **kwargs): try: profiler = LineProfiler() profiler.add_function(func) for f in fo...
evidation-health/ContinuousTimeMarkovModel
src/ContinuousTimeMarkovModel/profilingUtil.py
Python
mit
2,046
# -*- coding: utf-8 -*- from datetime import datetime from app import db from app.models import components_tags from app.users.models import User from app.tags.models import Tag from app.util import unix_time class WebComponent(db.Model): __tablename__ = 'web_component' id = db.Column(db.Integer, primary_ke...
nrempel/rucksack-api
app/web_components/models.py
Python
mit
1,563
"""options.py defines the base option classes for steno3d""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from json import dumps import properties from .props import HasSteno3DProps class Options(HasSteno3DProps...
3ptscience/steno3dpy
steno3d/options.py
Python
mit
1,305
#!/usr/bin/python # Copyright (c) 2014 Wladimir J. van der Laan # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' Script to generate list of seed nodes for chainparams.cpp. This script expects two text files in the directory tha...
navcoindev/navcoin-core
contrib/seeds/generate-seeds.py
Python
mit
4,508
""" WSGI config for rossreckons 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.10/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_...
arosswilson/rossreckons
rossreckons/wsgi.py
Python
mit
400
try: import cPickle as pickle except ImportError: import pickle from srw.util import cache import os import unittest class TestCache(unittest.TestCase): cache_stub = 'cachestub' cache_name = '.{0}.cpickle'.format(cache_stub) def setUp(self): if os.path.isfile(self.cache_name): ...
mindriot101/srwmodule
testing/test_util_cache.py
Python
mit
1,169
import os class Config(): DEBUG = os.getenv('FLASK_DEBUG', default=False) ENV = os.getenv('FLASK_ENV', default='production') SECRET_KEY = os.getenv('SECRET_KEY') ALMA_API_KEY = os.getenv('ALMA_API_KEY') ALMA_API_URL = os.getenv('ALMA_API_URL') AWS_ACCESS_KEY_ID = os.getenv('AWS_ACCESS_KEY_ID...
MITLibraries/ebooks
ebooks/config.py
Python
mit
905
import _plotly_utils.basevalidators class SizemodeValidator(_plotly_utils.basevalidators.EnumeratedValidator): def __init__( self, plotly_name="sizemode", parent_name="scatterpolar.marker", **kwargs ): super(SizemodeValidator, self).__init__( plotly_name=plotly_name, pa...
plotly/python-api
packages/python/plotly/plotly/validators/scatterpolar/marker/_sizemode.py
Python
mit
537
from __future__ import print_function import numpy as np from stompy.grid import exact_delaunay, unstructured_grid Triangulation=exact_delaunay.Triangulation from stompy.spatial import robust_predicates def test_gen_intersected_elements(): dt = Triangulation() pnts = [ [0,0], [5,0], ...
rustychris/stompy
test/test_exact_delaunay2.py
Python
mit
2,185
from regularregioncontainer import * class Section(RegularRegionContainer): """ SECTION Start of cooling section region definition. The data must end with an ENDSECTION. It can enclose any number of other commands. If it is desired to repeat the section definitions, the control variable NSECTIONS s...
jon2718/ipycool_2.0
section.py
Python
mit
1,443
import unittest import os from bubi.mapper import DefaultMapper class DefaultMapperTestCase(unittest.TestCase): def setUp(self): self.mapper = DefaultMapper(colorize=False) self.color_mapper = DefaultMapper(colorize=True) # test the map method without color def test_mapping(self): ...
be-ndee/bubi-lang
tests/test_default_mapper.py
Python
mit
1,127
from .models import Academia, Atleta, Preta from django.shortcuts import render def index(request): return render(request, 'inicial/index.html') def ordenar_num(lista): for i in range(0,len(lista)): for j in range(i,len(lista)): if lista[i] >= lista[j]: lista[i], lista[j] =...
soonsam123/Django_FKSC
filiados/views.py
Python
mit
1,253
#!/usr/bin/env python import sys import tensorflow as tf import numpy as np from numpy import genfromtxt import requests import csv from sklearn import datasets from sklearn.cross_validation import train_test_split import sklearn from scipy import stats import getopt from StringIO import StringIO import requests # C...
yuriyminin/leap-gesture
machineLearning.py
Python
mit
3,079
################################################################################# # File Name : heartBleed.py # Created By : Jone Casper(xu.chenhui@live.com) # Creation Date : [2014-04-14 12:57] # Last Modified : [2014-04-20 12:57] # Description ...
xch89820/Heartbleed-Tester
heartBleed.py
Python
mit
10,504
#!/usr/bin/env python import Adafruit_BBIO.GPIO as GPIO import time red_pin = "P8_10" green_pin = "P8_12" blue_pin = "P8_14" GPIO.setup(red_pin, GPIO.OUT) GPIO.output(red_pin, GPIO.LOW) GPIO.setup(green_pin, GPIO.OUT) GPIO.output(green_pin, GPIO.LOW) GPIO.setup(blue_pin, GPIO.OUT) GPIO.output(blue_pin, GPIO.LOW) ...
swbooking/RobotMaria
snippets/rgb_led/rgb_led.py
Python
mit
701
def collatz(start): cur = start numbers = [start] while cur != 1: if cur < start: return counts[cur] + len(numbers)-1 if cur%2 == 0: numbers.append(int(cur/2)) else: numbers.append(3*cur + 1) cur = numbers[len(numbers)-1] return len(numbers) counts = [0] for j in range(1, 1000000): c...
karttrak/project-euler
14.py
Python
mit
380
from __future__ import print_function import sys import argparse import numpy as np def max3(x, y, z): return max(max(x, y), z) def lcs(s1, s2): m = len(s1) n = len(s2) t = np.zeros((n + 2, m + 2), dtype=int) for j in range(1, n + 1): for i in range(1, m + 1): is_same = 0 ...
yoriyuki/nksnd
nksnd/evaluate.py
Python
mit
2,104
#!/usr/bin/env python3 from pymongo import MongoClient import pymongo.errors from bson.objectid import ObjectId import hashlib import gridfs def hash_content(content): m = hashlib.md5() m.update(content) return m.hexdigest() username, password, host, dbname = 'admin0', 'pwd0', '127.0.0.1', 'admin' client = Mon...
dubrayn/dubrayn.github.io
examples/mongodb/gridfs_example.py
Python
mit
836
from bot import Command, categories class Fullwidth(Command): __version__ = '1.0.0' __author__ = 'makzk' __description__ = 'Translate a set of allowed characters (below) to the fullwidth format.' supported = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&()+,-./:;<=>?@[\\]^`{|}'...
jvicu2001/alexis-bot
modules/fullwidth.py
Python
mit
993
"""TESTS FOR SHOPPING LIST ITEMS""" import unittest from datetime import date from app import shopping_lists_items class TestCasesItems(unittest.TestCase): """TESTS FOR ITEMS CREATION AND BEHAVIOUR""" def setUp(self): self.item = shopping_lists_items.ShoppingListItems() def tearDown(self): ...
parseendavid/Andela-Developer-Challenge---Shopping-List-V2.0
tests/items_test.py
Python
mit
2,665
from ensemble_support import * from alad_simple import * from weight_inference import * from aatp_iterative_gradient import * from query_model import * class MetricsStructure(object): def __init__(self, train_aucs=None, test_aucs=None, train_precs=None, test_precs=None, train_aprs=None, test_aprs...
shubhomoydas/pyaad
pyalad/alad_support.py
Python
mit
21,754
from typing import Optional from thinc.api import Model from .stop_words import STOP_WORDS from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS from .lex_attrs import LEX_ATTRS from .lemmatizer import RussianLemmatizer from ...language import Language class RussianDefaults(Language.Defaults): tokenizer_excepti...
spacy-io/spaCy
spacy/lang/ru/__init__.py
Python
mit
905
import re import os import sys from jcompiler.token import tokenize from jcompiler.parse import Parser import jcompiler.xmlutil as xmlutil def remove_comments(s): return re.sub(r'(\s*//.*)|(\s*/\*(.|\n)*?\*/\s*)', '', s) if __name__ == '__main__': if len(sys.argv) < 2: print 'a input fil...
my-zhang/nand2tetris
ch10-frontend/jcompiler/cli.py
Python
mit
709
"""Tests for the :mod:`campy.datastructures.basicgraph` module."""
sredmond/acmpy
tests/datastructures/test_basicgraph.py
Python
mit
67
""" This module provides miscellaneous utilities. .. moduleauthor:: Fabian Hirschmann <fabian@hirschmann.email> .. moduleauthor:: Michael Markert <markert.michael@googlemail.com> :copyright: PenchY Developers 2011-2012, see AUTHORS :license: MIT License, see LICENSE """ from __future__ import print_function impo...
fhirschmann/penchy
penchy/util.py
Python
mit
6,303
# encoding: utf-8 """ Test suite for pptx.api module """ from __future__ import ( absolute_import, division, print_function, unicode_literals ) import os import pytest from pptx.api import Presentation from pptx.opc.constants import CONTENT_TYPE as CT from pptx.parts.presentation import PresentationPart from ...
biggihs/python-pptx
tests/test_api.py
Python
mit
1,552
#!/usr/bin/python # vim:sw=4:softtabstop=4:expandtab:set fileencoding=ISO8859-2 # # FleetPanel.py, part of the FleetPanel # # Copyright (c) 2008-2009 Pawe³ 'Reef' Polewicz # All rights reserved. # # This software is licensed as described in the file LICENSE, which # you should have received as part of this distribution...
malcolmpl/fleetpanel
FleetPanel.py
Python
mit
83,136
import Queue import copy laby = [] spots = [] def isInt(c): try: int(c) return True except: return False def shortestPath(map, start, dest): height = len(map[0]) width = len(map) dist = [[-1 for y in range(height)] for x in range(width)] prev = [[None for y in range(height)] for x in range...
tbjoern/adventofcode
Twentyfour/script.py
Python
mit
2,404
from django.urls import path, re_path, include from django.utils.translation import ugettext_lazy as _ from . import views as www urlpatterns = [ re_path(r'^$', www.Index.as_view(), name='index'), re_path(_('^topic_collections_url$'), www.TopicCollections.as_view(), name='topic_collections'), r...
WebArchivCZ/Seeder
Seeder/www/urls.py
Python
mit
3,183
#!bin/evn python # encoding:utf-8 from __future__ import print_function import os import sys from nude import Nude # from tests.python.nude import Nude import time import cv2 import cv2.cv as cv from PIL import Image ROOT = os.path.dirname(os.path.abspath(__file__)) # IMAGE_DIR = "/Users/fengxuting/Downloads/photo/p...
fffy2366/image-processing
nudetest.py
Python
mit
7,025
import numpy as np from square import Square from constants import SQUARE_SIZE, BOARD_SIZE class ChessboardFrame(): def __init__(self, img): self.img = img def square_at(self, i): y = BOARD_SIZE - ((i / 8) % 8) * SQUARE_SIZE - SQUARE_SIZE x = (i % 8) * SQUARE_SIZE return Square...
joeymeyer/raspberryturk
raspberryturk/core/vision/chessboard_frame.py
Python
mit
371
# 2016-7-1 # build by qianqians # tools def gentypetocsharp(typestr): if typestr == 'int': return 'Int64' elif typestr == 'string': return 'String' elif typestr == 'array': return 'ArrayList' elif typestr == 'float': return 'Double' elif typestr == 'bool': re...
yinchunlong/abelkhan-1
juggle/gen/csharp/tools.py
Python
mit
394
import _plotly_utils.basevalidators class TickcolorValidator(_plotly_utils.basevalidators.ColorValidator): def __init__( self, plotly_name="tickcolor", parent_name="parcats.line.colorbar", **kwargs ): super(TickcolorValidator, self).__init__( plotly_name=plotly_name, pa...
plotly/python-api
packages/python/plotly/plotly/validators/parcats/line/colorbar/_tickcolor.py
Python
mit
480
''' 20140213 Import CSV Data - Dict Save as JASON? Basic Stats Save to file Find Key Words Generate Reports... Generate Plots ''' import csv import numpy as np import matplotlib as mpl from scipy.stats import nanmean filename = '20140211_ING.csv' ###____________ Helper ___________### def number_fields(data): ...
Jim-Rod/csv_summary
csv_summary.py
Python
mit
2,979
# coding: utf-8 """ Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-...
artcz/euler
problems/02/2.py
Python
mit
1,241
# Generated by Django 1.11.2 on 2017-08-08 03:08 from django.db import migrations class Migration(migrations.Migration): dependencies = [("institutions", "0010_auto_20170808_0252")] operations = []
watchdogpolska/feder
feder/institutions/migrations/0011_auto_20170808_0308.py
Python
mit
211
# # Copyright (C) 2016 UAVCAN Development Team <uavcan.org> # # This software is distributed under the terms of the MIT License. # # Author: Pavel Kirienko <pavel.kirienko@zubax.com> # import datetime import time import os from functools import partial import pyuavcan_v0 from pyuavcan_v0.driver import CANFrame from ...
UAVCAN/gui_tool
uavcan_gui_tool/widgets/bus_monitor/window.py
Python
mit
16,283
class SpellingError: def __init__(self, file, word, line, line_number): """ Takes file_path, misspelled word, line where misspelling occurs, and line number of misspelling. :param file: str :param word: str :param line: str :param line_number: int """ ...
seales/spellchecker
spelling/spelling_error.py
Python
mit
1,021
#!/usr/bin/env python3 """ Created on 26 Sep 2016 @author: Bruno Beloff (bruno.beloff@southcoastscience.com) DESCRIPTION The eeprom_read utility presents a formatted copy of the South Coast Science digital front-end (DFE) board's EEPROM contents to stdout. The EEPROM contains information on vendor, product ID and a...
south-coast-science/scs_mfr
src/scs_mfr/eeprom_read.py
Python
mit
2,020
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Shinichi Nakagawa' from house import views from django.conf.urls import patterns, url, include from rest_framework.routers import DefaultRouter router = DefaultRouter() router.register(r'metrics', views.MetricsViewSet) urlpatterns = patterns('', url(r'...
Shinichi-Nakagawa/country-house-server
server/house/urls.py
Python
mit
349
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
Azure/azure-sdk-for-python
sdk/servicebus/azure-servicebus/tests/perf_tests/T1_legacy_tests/receive_message_batch.py
Python
mit
1,104
""" WSGI config for Binder 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.10/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTI...
Udayraj123/dashboard_IITG
Binder/Binder/wsgi.py
Python
mit
390
import numpy as np import minipnm as mini def test_scene(N=10): try: import vtk except ImportError: return scene = mini.Scene() network = mini.Cubic([10,10]) # draw a simple wired cubic going from red to white to blue script = [network.diagonals.data[0]*i for i in range(N)] ...
RodericDay/MiniPNM
unit_tests/test_graphics.py
Python
mit
974
# coding=utf-8 from django.contrib import admin from forum.models import ForumUser, Plane, Node, Topic, Reply, Favorite, Notification, Transaction, Vote class ForumUserAdmin(admin.ModelAdmin): list_display = ('username', 'email', 'is_active', 'is_staff', 'date_joined') search_fields = ('username', 'email', '...
zhu327/forum
forum/admin.py
Python
mit
1,293
import torch import ocnn class ResNet(torch.nn.Module): def __init__(self, depth, channel_in, nout, resblk_num): super(ResNet, self).__init__() self.depth, self.channel_in = depth, channel_in channels = [2 ** max(11 - i, 2) for i in range(depth + 1)] channels.append(channels[depth]) self.conv1 ...
microsoft/O-CNN
pytorch/ocnn/resnet.py
Python
mit
1,194
# coding: utf-8 from setuptools import setup with open('README.rst') as readme_file: readme = readme_file.read() with open('HISTORY.rst') as history_file: history = history_file.read() requirements = [ "pip==8.1.2", "future==0.15.2", "wheel==0.29.0", ] test_requirements = [ "pytest==2.9.2",...
douglas/shopidown
setup.py
Python
mit
1,547
import os import json import yaml import base64 import requests class TWAPI: def __init__(self, config_file='../config.yml'): #print os.getcwd() self.config_file = config_file self.key = '' self.secret = '' self.bearer = '' self.load_conf() #self.show_c...
gr33ndata/19898
nineteen898/twapi.py
Python
mit
3,510
""" Basic building blocks for generic class based views. We don't bind behaviour to http method handlers yet, which allows mixin classes to be composed in interesting ways. """ from __future__ import unicode_literals from django.http import Http404 from rest_framework import status from rest_framework.response import...
DeltaEpsilon-HackFMI2/FMICalendar-REST
venv/lib/python2.7/site-packages/rest_framework/mixins.py
Python
mit
6,556
import codecs import os import re from setuptools import setup def read(*parts): return codecs.open(os.path.join(os.path.dirname(__file__), *parts)).read() def find_version(*file_paths): version_file = read(*file_paths) version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", ...
ubergeek42/scribe
setup.py
Python
mit
917
""" Tests for new channel bot """ import datetime import time import unittest import mock import new_channel_bot def _make_fake_api(channels, posts): """ Construct a fake slack API Args: channels (dict): List of channels to mock in. posts (array): Collection of all calls to the postMessage api....
democrats/new-channel-bot
tests/test_new_channel_bot.py
Python
mit
4,261
import os from buildtest.defaults import BUILDTEST_ROOT from buildtest.menu.build import discover_buildspecs included_bp, excluded_bp = discover_buildspecs( buildspec=[os.path.join(BUILDTEST_ROOT, "tutorials")] ) print(f"discovered_buildspec: {included_bp} excluded buildspec: {excluded_bp}")
HPC-buildtest/buildtest-framework
docs/scripting_examples/ex1.py
Python
mit
300
"""Context processors, these get called and add things to template contexts""" from .models import Tag def pinned_tags(request): """ Adds the list of tags this user has pinned """ out = {} if request.user.is_authenticated(): out["pinned_tags"] = Tag.by_user(request.user).filter(pinned=True) ...
RossBrunton/BMAT
tags/context_processors.py
Python
mit
338
#!/usr/bin/python3 import os import os.path import cgi, cgitb import re import pickle #own packages import dbcPattern def dbc_main(): # NEW except for the call to processInput form = cgi.FieldStorage() # standard cgi script lines to here! # use format of next two lines with YOUR names and default data...
mauerflitza/Probieren2
Webpage/cgi-bin/upload.py
Python
mit
1,801
import os from email.utils import parseaddr from flask import g, request, abort from flask_restplus import Resource, fields import bcrypt from pyinfraboxutils import get_logger from pyinfraboxutils.ibflask import OK from pyinfraboxutils.ibrestplus import api from pyinfraboxutils.token import encode_user_token from...
InfraBox/infrabox
src/api/handlers/account/account.py
Python
mit
3,081
""" biobox login - Log in to a biobox container with mounted test data Usage: biobox login <biobox_type> <image> [<args>...] Options: -h, --help Show this screen. -r, --no-rm Don't remove the container after the process finishes -t, --no-tty Don't start a terminal emulator, used for scripted intera...
pbelmann/command-line-interface
biobox_cli/command/login.py
Python
mit
2,319
import os import platform import subprocess import datetime as dt import time import calendar import sys # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # General Parameters - Tools - Proxy Network - Output Directory # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Path declaratio...
HoboSci/OBIS-Capelin
1Loop_on_date_python_script.py
Python
mit
18,420
#!/usr/bin/env python from .base import LocatorWidget from .command import OpenCommand
diegomvh/pyqt
widgets/locator/__init__.py
Python
mit
87
from MaudeMiner.core.database import db from MaudeMiner.core.models import Device from MaudeMiner.utils import update_progress from MaudeMiner.core.loader.utils import * from MaudeMiner.settings import LINES_PER_DB_COMMIT EXPECTED_NUMBER_OF_FIELDS = 45 def load(): # ensure tables exists db.create_tables(["Devices...
tklovett/MaudeMiner
MaudeMiner/core/loader/devices.py
Python
mit
3,344
import time from twisted.internet import defer, reactor, protocol from twisted.python import log from twisted.enterprise import adbapi class SideloaderDB(object): def __init__(self): self.p = adbapi.ConnectionPool('psycopg2', database='sideloader', host='localhost', use...
praekelt/sideloader2
sideloader.worker/sideloader/worker/task_db.py
Python
mit
9,546
import os import json import enum class ConfigSource(enum.Enum): NOT_LOADED = 0 ENV_VARS = 1 CLOUD_FOUNDRY = 2 LOCAL_FILE = 3 class Configuration: def __init__(self): self.config_source = ConfigSource.NOT_LOADED self.application_port = None self.instance_id = None ...
angelosarto/ember-lightning-flask
ember-lightning-flask/configuration.py
Python
mit
3,832
"""devnull nethack tournament unique deaths""" from google.appengine.api import urlfetch from google.appengine.ext import ndb import collections import csv import re import os from cStringIO import StringIO import logging import webapp2 import jinja2 BLOCK_SIZE = 1024 * 400 JINJA_ENVIRONMENT = jinja2.Environment( ...
Wooble/devnullunique
app/main.py
Python
mit
5,223
# -*- coding: utf-8 -*- from tests import settings from tests.resources import BankingAliasIBAN, BankingAlias from tests.test_base import BaseTest, BaseTestLive import responses class BankingAliasesTest(BaseTest): @responses.activate def test_banking_alias(self): self.mock_natural_user() sel...
Mangopay/mangopay2-python-sdk
tests/test_banking_aliases.py
Python
mit
3,255
#!/usr/bin/python3 """ Given a sorted array, two integers k and x, find the k closest elements to x in the array. The result should also be sorted in ascending order. If there is a tie, the smaller elements are always preferred. Example 1: Input: [1,2,3,4,5], k=4, x=3 Output: [1,2,3,4] Example 2: Input: [1,2,3,4,5], k...
algorhythms/LeetCode
658 Find K Closest Elements.py
Python
mit
2,116
''' Created on Aug 12, 2014 @author: Chandan ''' from socket import * import subprocess hostAddress='127.0.0.1' port=51000 sock1=socket(AF_INET, SOCK_STREAM) sock1.bind((hostAddress,port)) sock1.listen(5) conn1, addr1=sock1.accept() data1=conn1.recv(1024) sys2=subprocess.Popen(data1,shell=False,stdout=subprocess.PIPE)...
hellfreak/testscripts
scripts1/servershell.py
Python
mit
399
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("/tmp/data/", one_hot = True) n_nodes_hl1 = 500 n_nodes_hl2 = 500 n_nodes_hl3 = 500 n_classes = 10 batch_size = 100 x = tf.placeholder('float', [None, 784]) y = tf.placeholder('float') def neural_net...
dualphase90/Learning-Neural-Networks
deep_net.py
Python
mit
2,387
""" Django settings for pyanalysis project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ import sys import os from path import path import dj_database_url # No...
nanchenchen/script-analysis
pyanalysis/settings/common.py
Python
mit
12,572
import numpy as np from scipy.optimize import leastsq class EDGE: """ Detect edges (i.e. borders) using the input contours. Parameters ---------- contours : array_like An array containing contour list. min_points : int, optional The number of minimum data points in each edge....
dwkim78/ASTRiDE
astride/utils/edge.py
Python
mit
13,521
#!env/bin/python """Migrate the database""" import imp from migrate.versioning import api from app import db from config import SQLALCHEMY_DATABASE_URI from config import SQLALCHEMY_MIGRATE_REPO v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO) migration = SQLALCHEMY_MIGRATE_REPO + ('/versions/%03d_...
dianvaltodorov/happy-commas
db_migrate.py
Python
mit
963
import nose from nose.tools import * from unittest import TestCase from datetime import datetime, timedelta from repo.date_iterator import DateIterator class DateIteratorTests(TestCase): def test_date_iterator_returns_self_on_iter(self): d = DateIterator(datetime.now(), datetime.now()) eq_(d, d._...
markdrago/caboose
src/test/repo/date_iterator_tests.py
Python
mit
1,409
# This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.tonic.to/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse...
huyphan/pyyawhois
test/record/parser/test_response_whois_tonic_to_status_available.py
Python
mit
2,350
from dilap.geometry.vec3 import vec3 from dilap.geometry.quat import quat from dilap.geometry.tform import tform import dilap.geometry.tools as dpr import matplotlib.pyplot as plt import unittest,numpy,math import pdb #python3 -m unittest discover -v ./ "*tests.py" class test_tform(unittest.TestCase): def s...
ctogle/dilapidator
test/geometry/tform_tests.py
Python
mit
1,264
import sys, os EMAIL = os.environ.get('FLASK_EMAIL', '') EMAIL_PASSWORD = os.environ.get('FLASK_EMAIL_PASSWORD', '') DB_PATH = 'sqlite:///test.db' if EMAIL == '' or EMAIL_PASSWORD == '': sys.exit('Please write email and password in server/config.py')
therightmandev/WebShop
server/config.py
Python
mit
257
import SV import os import re class CNVnator: match_calltype={'deletion':'DEL', 'duplication':'DUP'} CNVtype=0 coordinates=1 CNVsize=2 normalizedRD=3 eval1=4 eval2=5 eval3=6 eval4=7 q0=8 @staticmethod def parse_coordinates (coordinates): coord=re.sub (':', '-', coordinates) E=coord.split ('-') re...
bjtrost/TCAG-WGS-CNV-workflow
CNVnator.py
Python
mit
1,274
# coding: utf-8 # TODO raise StopIteration() instead of 'StopIteration' #$ header class StopIteration(public, hide) #$ header method __init__(StopIteration) #$ header method __del__(StopIteration) class StopIteration(object): def __init__(self): pass def __del__(self): pass #$ header class ...
ratnania/pyccel
pyccel/stdlib/parallel/openmp.py
Python
mit
2,492
from twisted.internet import reactor, protocol, defer from twisted.web import client from twisted.web.client import HTTPPageGetter, HTTPClientFactory from twisted.python import failure from twisted.web import error import feedparser, time, sys import md5, os # You can get this file from http://xoomer.virgilio...
jingriver/stocktracker
pytoolkit/rssReader/twistedRssReader.py
Python
mit
11,646
''' Copyright (C) 2013 Travis DeWolf This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope t...
Syralist/yet-another-hexapod
hexapy/Arm.py
Python
mit
6,538
"""This class manages dataset downloads concurrently and processes progress output.""" import wx from retriever.lib.download import DownloadThread class DownloadManager: def __init__(self, parent): self.dialog = None self.worker = None self.queue = [] self.downloaded = set() ...
embaldridge/retriever
app/download_manager.py
Python
mit
4,858
import importlib from kivy.animation import AnimationTransition from kivy.properties import StringProperty from kivy.uix.screenmanager import TransitionBase from kivy.uix.screenmanager import (WipeTransition, SwapTransition, FadeTransition, FallOutTransition, ...
missionpinball/mpf-mc
mpfmc/uix/transitions.py
Python
mit
5,152
#!/usr/bin/env python3 # Copyright (C) 2014 University Radio York # # 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, cop...
CaptainHayashi/permtools
roleperms.py
Python
mit
1,470
from s3v1 import * def filter_col_by_string(data_sample, field, filter_condition): filtered_rows = [] # create a new list col = int(data_sample[0].index(field)) # create a variable (col) and asign it to an integer which is pulled from the header row of the data_sample and which is the index (probably also an integer...
alexmilesyounger/ds_basics
s3v2.py
Python
mit
2,936
import urllib,urllib2,json,re,datetime,sys,cookielib from .. import models from pyquery import PyQuery class TweetManager: def __init__(self): pass @staticmethod def getTweets(tweetCriteria, receiveBuffer=None, bufferLength=100, proxy=None): refreshCursor = '' results = [] resultsAux = [] cookieJar...
AleksandraWozniak/GetOldTweets-python
got/manager/TweetManager.py
Python
mit
4,626
# Double pendulum formula translated from the C code at # http://www.physics.usyd.edu.au/~wheat/dpend_html/solve_dpend.c from numpy import sin, cos import numpy as np import matplotlib.pyplot as plt import scipy.integrate as integrate import matplotlib.animation as animation G = 9.8 # acceleration due to gravity, in...
bundgus/python-playground
matplotlib-playground/examples/animation/double_pendulum_animated.py
Python
mit
2,354
"""Calculate the liquid volume of a cylinder on its side""" from hcsr04sensor import sensor trig_pin = 17 echo_pin = 27 # default values # temperature = 20 celcius # unit = "metric" # gpio_mode = GPIO.BCM # Get litres in a cylinder cyl_length_metric = 300 # centimeters cyl_radius_metric = 48 # centimeters cyl_depth...
alaudet/hcsr04sensor
recipes/cylinder_volume_side_metric.py
Python
mit
844
## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD from distutils.core import setup from catkin_pkg.python_setup import generate_distutils_setup # fetch values from package.xml setup_args = generate_distutils_setup( packages=['cpr_mover_controller'], package_dir={'': 'scripts'}, requires=['std_...
pouyaAB/ros_teleoperate
CPR_mover/setup.py
Python
mit
391
from ryu.base import app_manager from ryu.controller import ofp_event from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER from ryu.controller.handler import set_ev_cls from ryu.ofproto import ofproto_v1_3 from ryu.lib.packet import packet from ryu.lib.packet import ethernet class SimpleSwitch(app_ma...
John-Lin/SDN-hands-on
examples/simple_switch/simple_switch.py
Python
mit
3,589
#!/usr/bin/python # -*- coding: utf-8 -*- # how to transform with pandas from pandas import Series from pandas import DataFrame from scipy.stats import boxcox from matplotlib import pyplot series = Series.from_csv( "airline-passengers.csv" , header=0) dataframe = DataFrame(series.values) dataframe.columns = ['passeng...
KrisCheng/ML-Learning
archive/Model/sequence/time_series/transform.py
Python
mit
938
import h5py import numpy as np import os class LeafNode(object): def __init__(self, arr, attrs={}): if isinstance(arr, h5py.Dataset): self._dataset = arr self.arr = arr self.attrs = arr.attrs else: self.arr = arr ...
bsmithyman/inversion-container
dsworks.py
Python
mit
5,527
__author__ = 'mFoxRU' import scipy.signal as sps from abstractwavelet import AbstractWavelet class Ricker(AbstractWavelet): name = 'Ricker(MHAT)' params = {} def fn(self): return sps.ricker
mFoxRU/cwaveplay
cwp/wavelets/ricker.py
Python
mit
215
# Released under the MIT license. See the LICENSE file for more information. # https://github.com/ololobster/cvidone from flask import request import datetime from calendar import monthrange import json import re class ValidationError(Exception): def __init__(self, name): self.name = name def __str_...
ololobster/cvidone
cvidone/util/validator.py
Python
mit
11,249
import os class Principal(): def __init__(self, valor): print(Principal.calculaValor(valor)) def calculaValor(valor): valor = valor + 10 return valor
Junior743/poc-pip_install
codigos/teste.py
Python
mit
194
# 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/network/azure-mgmt-network/azure/mgmt/network/v2020_08_01/aio/operations/_network_interfaces_operations.py
Python
mit
72,800
# -*- coding: utf-8 -*- # This technical data was produced for the U. S. Government under Contract No. W15P7T-13-C-F600, and # is subject to the Rights in Technical Data-Noncommercial Items clause at DFARS 252.227-7013 (FEB 2012) from django import forms from django.forms.widgets import (RadioSelect, CheckboxInput, ...
ngageoint/geoq
geoq/core/forms.py
Python
mit
8,191
#!/usr/bin/env python """Test Batchjob class """ import unittest import os from toil.lib.bioio import system from optparse import OptionParser from toil.common import setupToil from toil.job import Job from toil.test import ToilTest from toil.batchJob import BatchJob class JobTest(ToilTest): def setUp(self):...
BD2KGenomics/toil-old
src/toil/test/src/batchJobTest.py
Python
mit
2,389
import re import BaseHTTPServer class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): def do_GET(self): """ Handle incoming GET requests. We will only handle one request and an authorization_code GET parameter must be present. We don't really care about the path being requ...
kristinn/casanova
casanova/http.py
Python
mit
956
# encoding: utf-8 # Copyright 2013 maker # License """ Administration templatetags """ from coffin import template from maker.core.rendering import render_to_string from jinja2 import contextfunction, Markup from django.template import RequestContext register = template.Library() @contextfunction def administrati...
alejo8591/maker
core/templatetags/administration.py
Python
mit
2,069