code
stringlengths
6
947k
repo_name
stringlengths
5
100
path
stringlengths
4
226
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
6
947k
"""Responses.""" from io import StringIO from csv import DictWriter from flask import Response, jsonify, make_response from .__version__ import __version__ class ApiResult: """A representation of a generic JSON API result.""" def __init__(self, data, metadata=None, **kwargs): """Store input argumen...
jkpr/pma-api
pma_api/response.py
Python
mit
3,061
""" @file @brief Helpers to compress constant used in unit tests. """ import base64 import json import lzma import pprint def compress_cst(data, length=70, as_text=False): """ Transforms a huge constant into a sequence of compressed binary strings. :param data: data :param length: line length :pa...
sdpython/pyquickhelper
src/pyquickhelper/pycode/unittest_cst.py
Python
mit
1,760
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
yugangw-msft/azure-cli
src/azure-cli/azure/cli/command_modules/acs/tests/hybrid_2020_09_01/test_loadbalancer.py
Python
mit
3,509
# -*- coding: utf-8 -*- # # Shopeet documentation build configuration file, created by # sphinx-quickstart on Mon Dec 27 16:35:50 2010. # # 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. # # All...
comfortablynumb/shopeet
docs/tutorial/es/conf.py
Python
mit
6,377
import requests import json from collections import namedtuple from urllib.parse import urljoin from django.conf import settings from django.utils.translation import ugettext_lazy as _ from cinemair.common.exceptions import BaseException class GoogleApiError(BaseException): status_code = 400 default_detail...
Cinemair/cinemair-server
cinemair/users/connectors/google.py
Python
mit
4,872
# -*- coding: utf-8 -*- __author__ = 'degibenz' import logging log = logging.getLogger(__name__) log.setLevel(logging.DEBUG) import json from aiohttp import web from core.model import ObjectId from core.exceptions import * from models.chat import * from models.client import Client, Token __all__ = [ 'ChatWS'...
degibenz/vispa-chat
src/api/chat_ws.py
Python
mit
5,947
#!/usr/bin/python import sys import time import datetime import re import ConfigParser import os from operator import attrgetter scriptdir = os.path.abspath(os.path.dirname(sys.argv[0])) conffile = scriptdir + "/ovirt-vm-rolling-snapshot.conf" Config = ConfigParser.ConfigParser() if not os.path.isfile(conffile): ...
daelmaselli/ovirt-vm-hot-backup
ovirt-vm-rolling-snapshot.py
Python
mit
6,894
"""Plugin which add a copyright to the image. Settings: - ``copyright``: the copyright text. - ``copyright_text_font``: the copyright text font - either system/user font-name or absolute path to font.ttf file. If no font is specified, or specified font is not found, the default font is used. - ``copyright_text_f...
kontza/sigal
sigal/plugins/copyright.py
Python
mit
2,076
from django.shortcuts import render_to_response from django.template import RequestContext from apps.members.models import Member def show_all_current_members(request): members = Member.objects.filter(is_renegade=False).order_by('function', 'started_nsi_date') return render_to_response( 'show_all_curr...
nsi-iff/nsi_site
apps/members/views.py
Python
mit
1,044
# -*- coding: utf-8 -*- """ vtdiscourse ~~~~ This is g0v vTaiwan Project, it's can help develope easy create topic on talk vTaiwan web site from gitbook :copyright: (c) 2016 by chairco <chairco@gmail.com>. :license: MIT. """ import uuid from pip.req import parse_requirements from setuptool...
chairco/vtdiscourse
setup.py
Python
mit
1,822
# -*- coding: utf-8 -*- # Django from django.db import models from .mixins import SelfPublishModel from .serializers import TodoListSerializer, TodoItemSerializer class TodoList(SelfPublishModel, models.Model): serializer_class = TodoListSerializer channel_name = u"todo-list" name = models.CharField(ma...
aaronbassett/djangocon-pusher
talk/todo/models.py
Python
mit
891
#!/usr/bin/env python # -*- coding: utf-8 -*- import configparser import msvcrt import os import sys sys.path.append(os.path.dirname(os.path.realpath(__file__))) import TradeX TradeX.OpenTdx() class QA_Stock(): def set_config(self, configs): try: self.sHost = configs['host'] ...
EmmaIshta/QUANTAXIS
QUANTAXIS_Trade/QA_tradex/QA_Trade_stock_api.py
Python
mit
10,682
# -*- coding: utf-8 -*- # Generated by Django 1.11b1 on 2017-06-27 16:09 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('gwasdb', '0007_study_n_hits_thr'), ] operations = [ migrations.RemoveField( ...
1001genomes/AraGWAS
aragwas_server/gwasdb/migrations/0008_remove_study_easygwas_link.py
Python
mit
396
import _plotly_utils.basevalidators class FamilyValidator(_plotly_utils.basevalidators.StringValidator): def __init__( self, plotly_name="family", parent_name="scatter3d.marker.colorbar.title.font", **kwargs ): super(FamilyValidator, self).__init__( plotly_n...
plotly/plotly.py
packages/python/plotly/plotly/validators/scatter3d/marker/colorbar/title/font/_family.py
Python
mit
558
import json from watson_developer_cloud import ConversationV1 conversation = ConversationV1( username='c4129348-b14c-4d2d-80ca-25b1acc59ca7', password='dHfhKbO2pXH4', version='2016-09-20') # replace with your own workspace_id workspace_id = 'b42ee794-c019-4a0d-acd2-9e4d1d016767' response = conversation.m...
jpmunic/udest
watson_examples/conversation_v1.py
Python
mit
771
from .activity import ActivityCount
psolbach/metadoc
metadoc/social/__init__.py
Python
mit
35
# coding=utf-8 # """ word-o-mat is a RoboFont extension that generates test words for type testing, sketching etc. I assume no responsibility for inappropriate words found on those lists and rendered by this script :) v2.2.4 / Nina Stössinger / 31.05.2015 Thanks to Just van Rossum, Frederik Berlaen, Tobias Frere-Jones...
ninastoessinger/word-o-mat
word-o-mat.roboFontExt/lib/wordomat.py
Python
mit
30,817
""" :mod:`zsl.resource.model_resource` -- REST for a DB model. ---------------------------------------------------------- Resources provide a way how to directly access DB tables (raw models) and perform CRUD operations upon them. The default classes of the models should be overridden to provide more logic or restrict...
AtteqCom/zsl
src/zsl/resource/model_resource.py
Python
mit
19,715
import math class Solution(object): def isPalindrome(self, head): """ :type head: ListNode :rtype: bool """ if not head or not head.next: return True length = 0 forward = head backward = head while forward: forward = for...
andy-sheng/leetcode
234-Palindrome-Linked-List.py
Python
mit
998
from django.db.models.signals import post_save from django.dispatch import receiver from clothstream.user_profile.models import UserProfile @receiver(post_save, sender=UserProfile) def create_initial_collection(sender, created, instance, **kwargs): from clothstream.collection.models import Collection if creat...
julienaubert/clothstream
clothstream/collection/signals.py
Python
mit
404
from flask import (Blueprint, request, session, g, render_template, url_for, redirect, jsonify) from werkzeug.contrib.cache import SimpleCache from flask.ext.oauthlib.client import OAuth, OAuthException bp = Blueprint('user', __name__) oauth = OAuth() github = oauth.remote_app( 'github', app_...
flask-kr/githubarium
githubarium/user.py
Python
mit
2,165
import pkg_resources from timeseries.TimeSeries import * from timeseries.lazy import * try: __version__ = pkg_resources.get_distribution(__name__).version except: __version__ = 'unknown'
cs207-project/TimeSeries
timeseries/__init__.py
Python
mit
195
""" Created on September 18, 2015 @author: oleg-toporkov """ from functools import wraps import logging def log_exception(message, logger=None): """ Decorator for function execution in try/except with first logging what tried to do and then raising an exception """ def decorator(func): @wraps...
oleg-toporkov/python-bdd-selenium
core/decorators.py
Python
mit
790
import numpy as np import sys import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D if len(sys.argv) != 2: print "Correct usage: $ %s caustic_file" % sys.argv[1] exit(1) fig = plt.figure() ax = fig.add_subplot(111, projection="3d") rows = np.loadtxt(sys.argv[1]) rs = np.array(zip(*cols)[-1...
phil-mansfield/gotetra
render/scripts/plot_caustic_3d.py
Python
mit
637
import pytest from flex.constants import ( STRING, BOOLEAN, INTEGER, ) from flex.error_messages import MESSAGES from flex.exceptions import ValidationError from flex.loading.definitions.schema import schema_validator from tests.utils import ( assert_path_not_in_errors, assert_message_in_errors, ) ...
pipermerriam/flex
tests/loading/definition/schema/test_read_only.py
Python
mit
1,126
# External imports from flask import Flask from flask_socketio import SocketIO import dataset # Builtin imports import logging import sys try: import Queue except ImportError: import queue as Queue import os import json from logging.handlers import RotatingFileHandler import datetime import atexit import signa...
ironman5366/W.I.L.L
will.py
Python
mit
3,781
import unittest class TestGenearate(unittest.TestCase): def setUp(self): self.seq = range(10) def test_smoke(self): "Basic smoke test that should pickup any silly errors" import external_naginator external_naginator.__name__ == "external_naginator" if __name__ == '__main__':...
daniellawrence/external_naginator
tests/test_basic.py
Python
mit
341
#!/usr/bin/env python ######################################################################################### # # Get or set orientation of nifti 3d or 4d data. # # --------------------------------------------------------------------------------------- # Copyright (c) 2014 Polytechnique Montreal <www.neuro.polymtl.ca...
benjamindeleener/scad
scripts/sct_orientation.py
Python
mit
11,010
from office365.runtime.client_object_collection import ClientObjectCollection from office365.runtime.client_query import CreateEntityQuery from office365.runtime.resource_path_service_operation import ResourcePathServiceOperation from office365.sharepoint.field import Field class FieldCollection(ClientObjectCollectio...
vgrem/SharePointOnline-REST-Python-Client
office365/sharepoint/field_collection.py
Python
mit
1,572
import dices class skill(object): """ Contains a skill. calling is done by skill(bases,value,known=True) bases::string : attributes it depends on. (either ABCx2 or ABC+XYZ format) value: value of the skill. If left empty, standard is calculated. study(learned) --> learned is added to the valu...
kergely/Character-creator-szerep
src/skills.py
Python
mit
4,916
# -*- coding: utf-8 -*- from peewee import * from datetime import datetime baza = SqliteDatabase('adresy.db') class BazaModel(Model): # klasa bazowa class Meta: database = baza class Osoba(BazaModel): login = CharField(null=False, unique=True) haslo = CharField() class Meta: ord...
koduj-z-klasa/python101
docs/pyqt/todopw/baza_z5.py
Python
mit
2,242
from collections import defaultdict class Indicator(): def indicate(self, guess, answer): if(len(guess) != len(answer)): raise InvalidInput("Length of answer and guess are different.") aligned = 0; not_aligned = 0; chars_guess = defaultdict(int) chars_answer = ...
jinglundong/GuessGame
service/indicator.py
Python
mit
827
import json from django.test import TestCase, Client from django.core.urlresolvers import reverse from src.apps.hotel.models import City, Hotel class AjaxTestCase(TestCase): def setUp(self): setattr(self, 'client', Client()) amsterdam = City.objects.create(code="AMS", name="Amsterdam") Ho...
duplamatyi/python-demo
src/apps/hotel/tests/test_ajax.py
Python
mit
1,500
from __future__ import annotations import itertools import random import struct from abc import ABCMeta from math import cos, sin from pathlib import Path from typing import List, Optional, Union from PIL import Image import elma.packing from elma.constants import VERSION_ELMA from elma.render import LevelRenderer fr...
sigvef/elma
elma/models.py
Python
mit
27,072
from pingdomexport import checks from pingdomexport import configuration class TestPicker: def test_get_strategy_all(self): picker = checks.Picker( configuration.Checks('all', []), {"checks": [{"id":1}, {"id":2}]} ) assert picker.filter() == [{'id': 1}, {'id': 2}] ...
entering/pingdomexport
pingdomexport/tests/test_checks.py
Python
mit
1,453
#! /usr/bin/python # -*- coding: utf-8 -*- import os import sys import logging import time import logging.config dir_cur = os.path.normpath(os.path.dirname(os.path.abspath(__file__)).split('bin')[0]) if dir_cur not in sys.path: sys.path.insert(0, dir_cur) log_dir = os.path.normpath(dir_cur + os.path.sep + 'logs' ...
lowitty/zacademy
bin/trap_snmp_v2_v3.py
Python
mit
6,374
""" :mod:`zsl.tasks.asl.schedule_gearman_task` ------------------------------------------ """ from __future__ import unicode_literals from builtins import object from zsl.interface.celery.worker import create_celery_app, zsl_task from zsl.task.task_data import TaskData from zsl.task.task_decorator import json_input ...
AtteqCom/zsl
src/zsl/tasks/zsl/schedule_celery_task.py
Python
mit
671
# macs2 python wrapper # based on http://toolshed.g2.bx.psu.edu/view/modencode-dcc/macs2 import sys, subprocess, tempfile, shutil, glob, os, os.path, gzip from galaxy import eggs import json CHUNK_SIZE = 1024 #========================================================================================== #functions #====...
stemcellcommons/macs2
macs2_wrapper.py
Python
mit
9,144
######################################################################################### # # Resample data using nibabel. # # --------------------------------------------------------------------------------------- # Copyright (c) 2014 Polytechnique Montreal <www.neuro.polymtl.ca> # Authors: Julien Cohen-Adad, Sara Dup...
neuropoly/spinalcordtoolbox
spinalcordtoolbox/resampling.py
Python
mit
7,336
''' https://github.com/toomuchio/pycrc32combine ''' def gf2_matrix_square(square, mat): for n in range(0, 32): if (len(square) < (n + 1)): square.append(gf2_matrix_times(mat, mat[n])) else: square[n] = gf2_matrix_times(mat, mat[n]) return square def gf2_matrix_times(mat, vec): sum = 0 i = 0 while vec: ...
sweco-sepesd/gmlz
python/crc32_combine.py
Python
mit
980
from ctypes import * # Ether types that we handle # These are types that will be found in the frame header ET_ARP = 0x0806 ET_REV_ARP = 0x8035 ET_IPv4 = 0x0800 ET_IPv6 = 0x86DD # IP types that we handle # These types are found in the ipv4 header IPT_ICMP = 0x01 IPT_TCP = 0x06 IPT_UDP = 0x11 IPT_IPv6 = 0...
lattrelr7/cse881-pcap
ip_structs.py
Python
mit
4,002
import os # Django settings for Storefront project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NA...
CSC301H-Fall2013/JuakStore
Storefront/Storefront/settings.py
Python
mit
5,847
"""Pylons middleware initialization""" from beaker.middleware import CacheMiddleware, SessionMiddleware from paste.cascade import Cascade from paste.registry import RegistryManager from paste.urlparser import StaticURLParser from paste.deploy.converters import asbool from pylons import config from pylons.middleware imp...
ebroder/anygit
anygit/config/middleware.py
Python
mit
2,432
import pandas import pytest from formulaic.errors import FactorEncodingError, FormulaMaterializerNotFoundError from formulaic.materializers.types import ( EvaluatedFactor, FactorValues, ScopedFactor, ScopedTerm, ) from formulaic.materializers.base import FormulaMaterializer from formulaic.materializers...
matthewwardrop/formulaic
tests/materializers/test_base.py
Python
mit
6,711
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('pfss', '0028_specialability_isstat'), ] operations = [ migrations.AddField( model_name='attack', nam...
qu0zl/pfss
pfss/migrations/0029_auto_20150518_1019.py
Python
mit
731
""" Subspace is a modified implementation of the Kademlia protocol for `Twisted <http://twistedmatrix.com>`_. """ version_info = (0, 2) version = '.'.join(map(str, version_info))
cpacia/Subspace
subspace/__init__.py
Python
mit
179
""" Support for Vera sensors. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.vera/ """ import logging from homeassistant.const import ( TEMP_CELSIUS, TEMP_FAHRENHEIT) from homeassistant.helpers.entity import Entity from homeassistant.componen...
Julian/home-assistant
homeassistant/components/sensor/vera.py
Python
mit
2,662
from msl.equipment.connection_prologix import ConnectionPrologix from msl.equipment.connection_serial import ConnectionSerial from msl.equipment.connection_socket import ConnectionSocket from msl.equipment.connection_message_based import ConnectionMessageBased def test_parse_address(): for item in ['', 'Prologix'...
MSLNZ/msl-equipment
tests/test_connection_prologix.py
Python
mit
6,794
# Download the Python helper library from twilio.com/docs/python/install from twilio.rest import Client import json # Your Account Sid and Auth Token from twilio.com/user/account account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" auth_token = "your_auth_token" workspace_sid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" clie...
teoreteetik/api-snippets
rest/taskrouter/workflows/list/post/example-1/example-1.6.x.py
Python
mit
1,581
# -*- coding: utf-8 -*- '''Chemical Engineering Design Library (ChEDL). Utilities for process modeling. Copyright (C) 2016, 2017 Caleb Bell <Caleb.Andrew.Bell@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to...
CalebBell/thermo
tests/test_electrochem.py
Python
mit
36,985
#! /usr/bin/env python import argparse import logging import sys import os import json import re import tarfile from datetime import datetime from mass_api_client import ConnectionManager from mass_api_client.resources import Sample, FileSample, IPSample, URISample, DomainSample PROGRAM_NAME = "MASS Hash Request" PR...
mass-project/mass_hash_request
mass_hash_request.py
Python
mit
9,725
import cv2 import cv2.cv as cv import tesseract cv.NamedWindow("win") img = cv2.imread("GBIAe.jpg") # numpy.ndarray height, width, channels = img.shape # crop the image crop = (2*height/3, width/3) roi = img[crop[0]:height, crop[1]:2*width/3] # Convert the cropped area, which is a numpy.ndarray, to cv2.cv.iplimage...
nomuna/opencv_tesseract
ocr_on_cropped.py
Python
mit
780
from setuptools import setup, Extension from Cython.Build import cythonize import numpy setup( name = 'SEGD', version = '0.a1', description = 'A Python3 reader for SEG-D rev3.1 binary data.', url = 'https://github.com/drsudow/SEG-D.git', author = 'Mattias Südow', author_email = 'mat...
drsudow/SEG-D
setup.py
Python
mit
1,008
""" This module serves commands to retrieve Canadian News. Powered by http://www.statcan.gc.ca/, shows 4 actual news. Updated daily. """ from requests import get, RequestException, status_codes from ..commandbase import CommandBase class CanadaStatsCommand(CommandBase): name = '/canadastat' hel...
JulyJ/MindBot
mindbot/command/news/canadanews.py
Python
mit
1,352
#!/usr/bin/env python3 # Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST. # Basically, the deletion can be divided into two stages: # Search for a node to remove. # If the node is found, delete the node. # Not...
eroicaleo/LearningPython
interview/leet/450_Delete_Node_in_a_BST.py
Python
mit
2,059
from fabric.api import run, sudo, cd from shuttle.shared import apt_get_install, get_django_setting _GEOS_URL = 'http://archive.ubuntu.com/ubuntu/pool/universe/g/geos/geos_3.3.3.orig.tar.gz' _GEOS_DIR = 'geos-3.3.3' _PROJ4_URL = 'http://download.osgeo.org/proj/proj-4.8.0.tar.gz' _PROJ4_DIR = 'proj-4.8.0/nad' _PROJ4_...
mvx24/fabric-shuttle
shuttle/services/postgis.py
Python
mit
2,444
# -*- coding: utf-8 -*- from base_writer import BaseWriter class LuaWriter(BaseWriter): def begin_write(self): super(LuaWriter, self).begin_write() self.output("module(...)", "\n\n") def write_sheet(self, name, sheet): self.write_value(name, sheet) if name == "main_sheet": self.write_value("main_length...
youlanhai/ExcelToCode
xl2code/writers/lua_writer.py
Python
mit
2,039
#!/usr/bin/env python3 from pathlib import Path import rdflib from pyontutils.core import makeGraph from pyontutils.utils import relative_path from pyontutils.namespaces import makePrefixes, TEMP from pyontutils.namespaces import rdf, rdfs, owl from neurondm import * from neurondm.lang import * from neurondm.core impor...
tgbugs/pyontutils
neurondm/neurondm/models/phenotype_direct.py
Python
mit
4,341
#! /usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from tqdm import tqdm def wrap_iterator(iterator, progressbar): if progressbar: iterator = tqdm(iterator) return iterator def wrap_generator(g...
hirofumi0810/tensorflow_end2end_speech_recognition
utils/progressbar.py
Python
mit
441
class User(object): _instance = None def __new__(cls, *args): if not cls._instance: cls._instance = super(User, cls).__new__(cls, *args) return cls._instance @property def is_authenticated(self): return True @property def is_active(self): return Tru...
sanchopanca/rcblog
rcblog/user.py
Python
mit
509
""" WSGI config for p1 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_APPLICATION`` setti...
pablo-the-programmer/Registration
conference/conference/wsgi.py
Python
mit
1,415
#!/usr/bin/env python ''' This script merges all chromosomes into continuous genomic coordinates. Example input: CHROM POS SomeValues chr_1 1 2456 chr_1 2 36 chr_1 3 346 chr_1 4 36 chr_2 1 36 chr_2 2 2461 chr_2 3 6 chr_2 4 70 chr_2 5 2464 chr_3 1 46 chr_3 2 2466 chr_3 ...
evodify/genotype-files-manipulations
mergeChrPos_in_callsTab.py
Python
mit
2,578
from commands import getstatusoutput import json from os import chdir, mkdir import os.path from os.path import dirname from shutil import rmtree import sys from tempfile import mkdtemp import unittest from urllib2 import quote from nose.tools import eq_ try: from nose.tools import assert_in except ImportError: ...
erikrose/dxr
dxr/testing.py
Python
mit
7,767
# -*- coding: utf-8 -*- from text.classifiers import NaiveBayesClassifier from textblob import TextBlob import feedparser import time import redis import hashlib import json TIMEOUT = 60*60 REDIS_HOST = '127.0.0.1' REDIS_PORT = 6379 def feature_extractor(text): if not isinstance(text, TextBlob): text =...
tistaharahap/ds-for-me
extractor.py
Python
mit
7,464
""":mod:`UserInventory` -- Provides an interface for a user inventory .. module:: UserInventory :synopsis: Provides an interface for a user inventory .. moduleauthor:: Joshua Gilman <joshuagilman@gmail.com> """ from neolib.exceptions import parseException from neolib.exceptions import invalidUser from neolib.inven...
jmgilman/Neolib
neolib/inventory/UserInventory.py
Python
mit
2,623
from django.contrib import admin from frozenflower.frontend.models import * admin.site.register(Tag) admin.site.register(Article) admin.site.register(Comment) admin.site.register(Feed) admin.site.register(Repository)
washimimizuku/frozen-flower
frozenflower2/frontend/admin.py
Python
mit
218
from auto import auto from basis import basis from cross import cross from power_dep import power_dep
eoinmurray/icarus
Icarus/Algorithms/__init__.py
Python
mit
101
import ctypes import sys if sys.platform.startswith("win"): _dwf = ctypes.cdll.dwf elif sys.platform.startswith("darwin"): _dwf = ctypes.cdll.LoadLibrary("libdwf.dylib") else: _dwf = ctypes.cdll.LoadLibrary("libdwf.so") class _types(object): c_byte_p = ctypes.POINTER(ctypes.c_byte) c_double_p = ctypes.POINTER(ct...
asgeir/pydigilent
pydigilent/lowlevel/dwf.py
Python
mit
82,320
import _plotly_utils.basevalidators class ColorsrcValidator(_plotly_utils.basevalidators.SrcValidator): def __init__( self, plotly_name="colorsrc", parent_name="histogram.hoverlabel.font", **kwargs ): super(ColorsrcValidator, self).__init__( plotly_name=plotly_name, par...
plotly/python-api
packages/python/plotly/plotly/validators/histogram/hoverlabel/font/_colorsrc.py
Python
mit
473
""":mod:`ShopWizardResult` -- Provides an interface for shop wizard results .. module:: ShopWizardResult :synopsis: Provides an interface for shop wizard results .. moduleauthor:: Joshua Gilman <joshuagilman@gmail.com> """ from neolib.exceptions import parseException from neolib.inventory.Inventory import Inventor...
jmgilman/Neolib
neolib/inventory/ShopWizardResult.py
Python
mit
3,097
""" Controller to interface with Spotify. """ import logging import threading from . import BaseController from ..config import APP_SPOTIFY from ..error import LaunchError APP_NAMESPACE = "urn:x-cast:com.spotify.chromecast.secure.v1" TYPE_GET_INFO = "getInfo" TYPE_GET_INFO_RESPONSE = "getInfoResponse" TYPE_SET_CREDEN...
balloob/pychromecast
pychromecast/controllers/spotify.py
Python
mit
2,978
import unittest import env from linalg.vector import Vector class TestVectorOperations(unittest.TestCase): def test_vector_equality(self): a = Vector([1, 2, 3]) b = Vector([1, 2, 3]) self.assertEqual(a, b) def test_vector_inequality(self): a = Vector([1, 2, 3]) b = V...
jeancochrane/learning
linear-algebra/tests/test_vector_operations.py
Python
mit
5,540
# -*- coding:utf-8 -*- """ web基类 Author: huangtao Date: 2017/8/8 Update: 2017/12/12 1. 增加do_prepare/do_complete函数; 2017/12/17 1. 增加中间件; 2017/12/18 1. 修改错误返回类型; 2. 增加 query_params 及 data 属性方法; 3. 删除 do_http_error 方法; 2018/01/17 1. 跨域增加设置 Access-Contr...
Demon-Hunter/tbag
tbag/core/web.py
Python
mit
6,329
from pygametk.color import Color from pygametk.draw import crop from pygametk.geometry import Rect from pygametk.image import load_image from pylaunchr.builder.factory import DialogFactory from pylaunchr.builder.path import module_relative_path from ..data import MpdPlayerStatusListener from ..utils import get_player...
dstenb/pylaunchr-mpd
mpd/dialogs/info.py
Python
mit
2,671
#!/usr/bin/env python from __future__ import print_function from collections import defaultdict from collections import deque from itertools import islice #from subprocess import call import subprocess from optparse import OptionParser from tempfile import mkstemp import glob import os import random import re import sh...
cmhill/q-compression
src/compress.py
Python
mit
50,746
from unittest import TestCase EXAMPLES_PATH = '../examples' SKIPPED_EXAMPLES = {472, 473, 477} def _set_test_class(): import re from imp import load_module, find_module, PY_SOURCE from pathlib import Path def _load_module(name, file, pathname, description): try: load_module(name,...
yehzhang/RapidTest
tests/test_by_examples.py
Python
mit
1,535
#!/usr/bin/python """ Testing the database connection ------------------------------- Connect to the surver and request a list of device IDs """ from numpy import * set_printoptions(precision=5, suppress=True) from .db_utils import get_cursor def dev_ids(cur): try: cur.execute("""SELECT DIS...
aalto-trafficsense/regular-routes-server
pyfiles/prediction/run_test.py
Python
mit
836
#!/usr/bin/env python import boto from boto.s3.key import Key OrdinaryCallingFormat = boto.config.get('s3', 'calling_format', 'boto.s3.connection.OrdinaryCallingFormat') s3 = boto.connect_s3(host='localhost', port=10001, calling_format=OrdinaryCallingFormat, is_secure=False) b = s3.get_bucket('mocking') k_cool = Ke...
SivagnanamCiena/mock-s3
tests/push.py
Python
mit
652
#!/usr/bin/env python from __future__ import unicode_literals, absolute_import, division # TODO werkzeug reloader may crash, search for more reliable solution from werkzeug.serving import run_simple from app import create_app app = create_app() if __name__ == '__main__': #run_simple('127.0.0.1', 5000, api, use_...
diyan/falcon_seed
run_app.py
Python
mit
475
''' Created on 21 Dec 2013 @author: huw ''' from ConfigParser import ConfigParser class TftpudSettings: ''' A class to hold the settings for the TftpudServerGui application. ''' def __init__(self): ''' Constructor ''' self.saveLastUsed = False self.defaultDir...
javert/tftpudGui
src/tftpudgui/qt4/TftpudSettings.py
Python
mit
2,975
import pygame from pygame import event class Player: def __init__(self, p_id): self.points = None self.p_id = p_id def turn(self, nr): return pygame.event.get()
1uk/3tsqd
classes/Player.py
Python
mit
198
from control4.misc.console_utils import call_and_print,Message import os.path as osp from control4.core.rollout import rollout from control4.algs.save_load_utils import get_mdp,construct_agent,load_agent_and_mdp from control4.maths.discount import discount from control4.config import floatX import numpy as np from coll...
SFPD/rlreloaded
throwaway/reshaped_breakout.py
Python
mit
3,625
# -*- coding: utf-8 -*- import os import pytest import boto3 from pontus.exceptions import ValidationError from pontus.validators import FileSize class TestFileSizeValidator(object): @pytest.fixture def jpeg_key(self, bucket): with open(os.path.join( os.path.dirname(__file__), ...
fastmonkeys/pontus
tests/test_file_size_validator.py
Python
mit
2,007
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import scrapy class MemescrapersItem(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field() pass
jthurst3/MemeCaptcha
MemeScrapers/MemeScrapers/items.py
Python
mit
291
# -*- coding: utf-8 -*- # Copyright 2017-TODAY LasLabs Inc. # License MIT (https://opensource.org/licenses/MIT). from .api_common import ApiCommon, recorder class TestApisTags(ApiCommon): """Tests the Tags API endpoint.""" def setUp(self): super(TestApisTags, self).setUp() self.__endpoint__ ...
LasLabs/python-helpscout
helpscout/tests/test_apis_tags.py
Python
mit
1,513
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-07-28 14:18 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('materialmanager', '0003_remove_delivery_supplier'), ] ...
nick3085/CMTPRG01-5-praktijkopdracht-materialenapp
materialenapp/materialmanager/migrations/0004_auto_20170728_1418.py
Python
mit
874
import _plotly_utils.basevalidators class BgcolorValidator(_plotly_utils.basevalidators.ColorValidator): def __init__( self, plotly_name="bgcolor", parent_name="funnel.marker.colorbar", **kwargs ): super(BgcolorValidator, self).__init__( plotly_name=plotly_name, parent_...
plotly/plotly.py
packages/python/plotly/plotly/validators/funnel/marker/colorbar/_bgcolor.py
Python
mit
429
import json from bitmerchant.network import BitcoinMainNet, BlockCypherTestNet from bitmerchant.wallet import Wallet from bitmerchant.wallet.utils import ensure_bytes def _test_wallet(wallet, data): assert wallet.serialize_b58(private=True) == data['private_key'] assert wallet.serialize_b58(private=False) ==...
sbuss/bitmerchant
tests/test_bip32_vector.py
Python
mit
1,482
#!/usr/bin/env python #-*-coding=utf-8-*-
rockyzhengwu/mlpractice
algorithm/perceptron.py
Python
mit
44
# Copyright (C) 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 or agreed to in wri...
Eforcers/inbox-cleaner
src/lib/gdata/apps/audit/service.py
Python
mit
9,512
#!/usr/bin/env python import os import sys import inspect from functools import update_wrapper import getpass import copy import click import signals from .config_reader import read_config from .utils import version, dict_merge from .defaults import DEFAULT_CONFIG # add fixture feature to pocoo-click def _make_comm...
finklabs/aws-deploy
botodeploy/tool.py
Python
mit
3,485
''' Biggest Sum from Top left to Bottom Right ''' def find_sum(m): p = [0] * (len(m) + 1) for l in m: for i, v in enumerate(l, 1): p[i] = v + max(p[i-1], p[i]) return p[-1] matrix = [[20, 20, 10, 10], [10, 20, 10, 10], [10, 20, 20, 20], [10, 10, 10, 20]]...
anilpai/leetcode
Codewars/BiggestSum.py
Python
mit
353
from wutu.compiler.common import create_stream from wutu.compiler.service import create_service_js from wutu.compiler.controller import create_controller_js from wutu.util import * def handle_creation(module, stream): create_service_js(stream, module) create_controller_js(stream, module) def main(): mod...
zaibacu/wutu
wutu/bench/compiler_bench.py
Python
mit
535
from unittest import TestCase from mock import patch from railgun.engines.storage_engine import DummyEngine class StorageEngineTestCase(TestCase): def setUp(self): self.config = { 'field1': 'value1', 'field2': 'value2' } def test_init(self): with patch('railg...
clearcare/railgun
tests/engines/test_storage_engine.py
Python
mit
1,295
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('redirects', '0001_initial'), ] operations = [ migrations.AddField( model_name='redirect', name='regu...
onespacemedia/cms-redirects
redirects/migrations/0002_auto_20160805_1654.py
Python
mit
907
import re from setuptools import setup, find_packages with open('evarify/__init__.py', 'r') as fd: version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) if not version: raise RuntimeError('Cannot find version information') setup( name="e...
gtaylor/evarify
setup.py
Python
mit
1,220
from django.db import models class TimeStampable(models.Model): """TimeStampable""" STATUS_CHOICES = ( ('A', 'Active'), ('I', 'Inactive') ) created_at = models.DateTimeField(auto_now_add=True, auto_now=False) updated_at = models.DateTimeField(auto_now_add=False, auto_now=True) ...
sinner/testing-djrf
tutorial/snippets/models/TimeStampable.py
Python
mit
426
#coding:utf-8 from nadmin.sites import site from nadmin.views import BaseAdminPlugin, CommAdminView class MobilePlugin(BaseAdminPlugin): def _test_mobile(self): try: return self.request.META['HTTP_USER_AGENT'].find('Android') >= 0 or \ self.request.META['HTTP_USER_AGENT'].find...
A425/django-nadmin
nadmin/plugins/mobile.py
Python
mit
904
import json from urllib import request import pymongo connection = pymongo.MongoClient('mongodb://localhost') db = connection.reddit stories = db.stories # stories.drop() # req = request.Request('http://www.reddit.com/r/technology/.json') # req.add_header('User-agent', 'Mozilla/5.0') # reddit_page = request.urlopen(...
dossorio/python-blog
reddit-data-extractor.py
Python
mit
891
# -*- coding: utf-8 -*- import aiohttp.web import os import pytest import testfixtures from contextlib import contextmanager from subprocess import check_output @pytest.yield_fixture def http_client(event_loop): with aiohttp.ClientSession() as session: yield session @pytest.yield_fixture def storage(...
smartmob-project/gitmesh-deploy
tests/conftest.py
Python
mit
4,407