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
from multiprocessing import Pool import os, time, random def long_time_task(name): print 'Run task %s (%s)...' % (name, os.getpid()) start = time.time() time.sleep(random.random() * 3) end = time.time() print 'Task %s runs %0.2f seconds.' % (name, (end - start)) if __name__ == '__main__': p...
Jayin/practice_on_py
Process&Thread/PoolTest.py
Python
mit
1,094
# 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. # --------------------------------------------------------------------...
Azure/azure-sdk-for-python
sdk/storage/azure-storage-blob/tests/test_large_block_blob.py
Python
mit
16,306
# This file is part of Indico. # Copyright (C) 2002 - 2021 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. import os import re import subprocess import sys from datetime import date import click import yaml from...
ThiefMaster/indico
bin/maintenance/update_header.py
Python
mit
8,843
from django.shortcuts import redirect from django.views.decorators.csrf import csrf_exempt from django.http import HttpResponse from paste.models import Paste, Language @csrf_exempt def add(request): print "jojo" if request.method == 'POST': language = request.POST['language'] content = r...
spezifanta/Paste-It
api/v01/views.py
Python
mit
749
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wellspring.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
ushatil/wellness-tracker
ws/manage.py
Python
mit
253
class Sprite(object): def __init__(self, xPos, yPos): self.x = xPos self.y = yPos self.th = 32 self.tw = 32 def checkCollision(self, otherSprite): if (self.x < otherSprite.x + otherSprite.tw and otherSprite.x < self.x + self.tw and self.y < otherSpri...
kantel/processingpy
sketches/Apple_Invaders/sprites.py
Python
mit
2,805
# -*- coding: utf-8 -*- import unittest from hanspell import spell_checker from hanspell.constants import CheckResult from textwrap import dedent as trim class SpellCheckerTests(unittest.TestCase): def setUp(self): pass def test_basic_check(self): result = spell_checker.check(u'์•ˆ๋…• ํ•˜์„ธ์š”. ์ €๋Š” ํ•œ๊ตญ์ธ...
ssut/py-hanspell
tests.py
Python
mit
2,729
__author__ = 'brianoneill' from log_calls import log_calls global_settings = dict( log_call_numbers=True, log_exit=False, log_retval=True, ) log_calls.set_defaults(global_settings, args_sep=' $ ')
Twangist/log_calls
tests/set_reset_defaults/global_defaults.py
Python
mit
211
""" Given a string that contains only digits 0-9 and a target value, return all possibilities to add binary operators (not unary) +, -, or * between the digits so they evaluate to the target value. Examples: "123", 6 -> ["1+2+3", "1*2*3"] "232", 8 -> ["2*3+2", "2+3*2"] "105", 5 -> ["1*0+5","10-5"] "00", 0 -> ["0+0", "...
algorhythms/LeetCode
282 Expression Add Operators.py
Python
mit
1,769
from django.contrib import admin from .models import Question # Register your models here. admin.site.register(Question)
BeardedPlatypus/capita-selecta-ctf
ctf/players/admin.py
Python
mit
126
from django.conf.urls import patterns, include, url import views urlpatterns = patterns('', url(r'^logout', views.logout, name='logout'), url(r'^newUser', views.newUser, name='newUser'), url(r'^appHandler', views.appHandler, name='appHandler'), url(r'^passToLogin', views.loginByPassword, name='passToL...
odeke-em/restAssured
auth/urls.py
Python
mit
477
import sys import pytest from opentracing.ext import tags from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from opentracing_instrumentation.client_hooks import mysqldb as mysqldb_hooks from opentracing_instrumentation.request_context import span_in_context from .sql_common import metadata...
uber-common/opentracing-python-instrumentation
tests/opentracing_instrumentation/test_mysqldb.py
Python
mit
2,279
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting model 'Participant' db.delete_table(u'pa_participant') # Removing M2M table for field us...
Mathew/psychoanalysis
psychoanalysis/apps/pa/migrations/0002_auto__del_participant.py
Python
mit
7,476
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Advent of Code 2015 from http://adventofcode.com/2015/day/5 Author: James Walker Copyrighted 2017 under the MIT license: http://www.opensource.org/licenses/mit-license.php Execution: python advent_of_code_2015_day_05.py --- Day 5: Doesn't He Have Intern-Elves For ...
JDSWalker/AdventOfCode
2015/Day05/advent_of_code_2015_day_05.py
Python
mit
6,750
#!/bin/env/python # coding: utf-8 import logging import os import time import uuid from logging import Formatter from logging.handlers import RotatingFileHandler from multiprocessing import Queue from time import strftime import dill from .commands import * from .processing import MultiprocessingLogger class TaskP...
peepall/FancyLogger
FancyLogger/__init__.py
Python
mit
27,844
from simtk.openmm import app import simtk.openmm as mm from simtk import unit def findForce(system, forcetype, add=True): """ Finds a specific force in the system force list - added if not found.""" for force in system.getForces(): if isinstance(force, forcetype): return force if add==True: system....
mlund/pyha
pyha/openmm.py
Python
mit
2,333
from array import array import numpy as np import matplotlib.pyplot as plt from sklearn import datasets from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import AdaBoostClassifier from sklearn.metrics import classification_report, roc_auc_score, roc_curve from sklearn import tree import cPickle ...
yuraic/koza4ok
skTMVA/sci_bdt_electron_DecisionTree.py
Python
mit
1,980
# coding=utf-8 from setuptools import setup from Cython.Build import cythonize setup( name="cyfib", ext_modules=cythonize('cyfib.pyx', compiler_directives={'embedsignature': True}), )
tleonhardt/Python_Interface_Cpp
cython/wrap_c/setup.py
Python
mit
193
import random, math import gimp_be #from gimp_be.utils.quick import qL from gimp_be.image.layer import editLayerMask from effects import mirror import numpy as np import UndrawnTurtle as turtle def brushSize(size=-1): """" Set brush size """ image = gimp_be.gimp.image_list()[0] drawable = gimp_be.p...
J216/gimp_be
gimp_be/draw/draw.py
Python
mit
26,770
#!/usr/bin/env python # coding:utf-8 """ Database operation module. This module is independent with web module. """ import time, logging import db class Field(object): _count = 0 def __init__(self, **kw): self.name = kw.get('name', None) self.ddl = kw.get('ddl', '') self._default =...
boisde/Greed_Island
business_logic/order_collector/transwarp/orm.py
Python
mit
11,968
import pytest from tests.base import Author, Post, Comment, Keyword, fake def make_author(): return Author( id=fake.random_int(), first_name=fake.first_name(), last_name=fake.last_name(), twitter=fake.domain_word(), ) def make_post(with_comments=True, with_author=True, with_...
marshmallow-code/marshmallow-jsonapi
tests/conftest.py
Python
mit
1,521
# Declaring a Function def recurPowerNew(base, exp): # Base case is when exp = 0 if exp <= 0: return 1 # Recursive Call elif exp % 2 == 0: return recurPowerNew(base*base, exp/2) return base * recurPowerNew(base, exp - 1)
jabhij/MITx-6.00.1x-Python-
Week-3/L5/Prob3.py
Python
mit
268
''' Testing class for database API's course related functions. Authors: Ari Kairala, Petteri Ponsimaa Originally adopted from Ivan's exercise 1 test class. ''' import unittest, hashlib import re, base64, copy, json, server from database_api_test_common import BaseTestCase, db from flask import json, jsonify...
petterip/exam-archive
test/rest_api_test_course.py
Python
mit
16,344
#!/usr/bin/env python2.7 import sys for line in open(sys.argv[1]): cut=line.split('\t') if len(cut)<11: continue print ">"+cut[0] print cut[9] print "+" print cut[10]
ursky/metaWRAP
bin/metawrap-scripts/sam_to_fastq.py
Python
mit
173
# -*- coding: utf-8 -*- # Keyak v2 implementation by Jos Wetzels and Wouter Bokslag # hereby denoted as "the implementer". # Based on Keccak Python and Keyak v2 C++ implementations # by the Keccak, Keyak and Ketje Teams, namely, Guido Bertoni, # Joan Daemen, Michaรซl Peeters, Gilles Van Assche and Ronny Van Keer # # Fo...
samvartaka/keyak-python
utils.py
Python
mit
1,775
import _plotly_utils.basevalidators class BordercolorValidator(_plotly_utils.basevalidators.ColorValidator): def __init__( self, plotly_name="bordercolor", parent_name="sankey.hoverlabel", **kwargs ): super(BordercolorValidator, self).__init__( plotly_name=plotly_name, ...
plotly/plotly.py
packages/python/plotly/plotly/validators/sankey/hoverlabel/_bordercolor.py
Python
mit
482
import numpy as np import warnings from .._explainer import Explainer from packaging import version torch = None class PyTorchDeep(Explainer): def __init__(self, model, data): # try and import pytorch global torch if torch is None: import torch if version.parse(tor...
slundberg/shap
shap/explainers/_deep/deep_pytorch.py
Python
mit
16,170
# -*- coding: utf-8 -*- from __future__ import unicode_literals import time import curses from . import docs from .content import SubmissionContent, SubredditContent from .page import Page, PageController, logged_in from .objects import Navigator, Color, Command from .exceptions import TemporaryFileError class Subm...
shaggytwodope/rtv
rtv/submission_page.py
Python
mit
11,574
#!/usr/bin/env python import os import vtk from vtk.test import Testing from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() # Test label reading from an MNI tag file # # The current directory must be writeable. # try: fname = "mni-tagtest.tag" channel = open(fname, "wb") ...
timkrentz/SunTracker
IMU/VTK-6.2.0/IO/MINC/Testing/Python/TestMNITagPoints.py
Python
mit
3,826
import uuid from uqbar.objects import new from supriya.patterns.Pattern import Pattern class EventPattern(Pattern): ### CLASS VARIABLES ### __slots__ = () ### SPECIAL METHODS ### def _coerce_iterator_output(self, expr, state=None): import supriya.patterns if not isinstance(expr,...
Pulgama/supriya
supriya/patterns/EventPattern.py
Python
mit
1,545
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright: (c) 2017, F5 Networks Inc. # GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type DOCUMENTATION = r''' --- module: bigiq_regkey_license_as...
F5Networks/f5-ansible-modules
ansible_collections/f5networks/f5_modules/plugins/modules/bigiq_regkey_license_assignment.py
Python
mit
19,962
''' salt.utils ~~~~~~~~~~ ''' class lazy_property(object): ''' meant to be used for lazy evaluation of an object attribute. property should represent non-mutable data, as it replaces itself. http://stackoverflow.com/a/6849299/564003 ''' def __init__(self, fget): self.fget = fget ...
johnnoone/salt-targeting
src/salt/utils/__init__.py
Python
mit
537
import re from setuptools import setup def find_version(filename): _version_re = re.compile(r"__version__ = '(.*)'") for line in open(filename): version_match = _version_re.match(line) if version_match: return version_match.group(1) __version__ = find_version('librdflib/__init__....
tgbugs/pyontutils
librdflib/setup.py
Python
mit
1,448
"""This module contains examples of the op() function where: op(f,x) returns a stream where x is a stream, and f is an operator on lists, i.e., f is a function from a list to a list. These lists are of lists of arbitrary objects other than streams and agents. Function f must be stateless, i.e., for any lists u, v: f(u...
zatricion/Streams
ExamplesElementaryOperations/ExamplesOpNoState.py
Python
mit
4,241
## Close ### What is the value of the first triangle number to have over five hundred divisors? print max([len(m) for m in map(lambda k: [n for n in range(1,(k+1)) if k%n == 0], [sum(range(n)) for n in range(1,1000)])])
jacksarick/My-Code
Python/python challenges/euler/012_divisable_tri_nums.py
Python
mit
219
from errors import * from manager import SchemaManager
Livefyre/pseudonym
pseudonym/__init__.py
Python
mit
55
import random from datetime import datetime from multiprocessing import Pool import numpy as np from scipy.optimize import minimize def worker_func(args): self = args[0] m = args[1] k = args[2] r = args[3] return (self.eval_func(m, k, r) - self.eval_func(m, k, self.rt) - ...
ndt93/tetris
scripts/agent3.py
Python
mit
5,234
# -*- coding: utf-8 -*- """" ProjectName: pydemi Repo: https://github.com/chrisenytc/pydemi Copyright (c) 2014 Christopher EnyTC Licensed under the MIT license. """ # Dependencies import uuid from api import app from hashlib import sha1 from flask import request from flask import jsonify as JSON from api.models.user ...
chrisenytc/pydemi
api/controllers/users.py
Python
mit
1,151
team_mapping = { "SY": "Sydney", "WB": "Western Bulldogs", "WC": "West Coast", "HW": "Hawthorn", "GE": "Geelong", "FR": "Fremantle", "RI": "Richmond", "CW": "Collingwood", "CA": "Carlton", "GW": "Greater Western Sydney", "AD": "Adelaide", "GC": "Gold Coast", "ES": "Es...
bairdj/beveridge
src/scrapy/afltables/afltables/common.py
Python
mit
1,563
from keras.applications import imagenet_utils from keras.applications import mobilenet def dummyPreprocessInput(image): image -= 127.5 return image def getPreprocessFunction(preprocessType): if preprocessType == "dummy": return dummyPreprocessInput elif preprocessType == "mobilenet": ...
SlipknotTN/Dogs-Vs-Cats-Playground
deep_learning/keras/lib/preprocess/preprocess.py
Python
mit
511
#!/usr/bin/python # -*- coding: utf-8 -*- __author__ = 'ar' from layers_basic import LW_Layer, default_data_format from layers_convolutional import conv_output_length ############################################### class _LW_Pooling1D(LW_Layer): input_dim = 3 def __init__(self, pool_size=2, strides=None, padd...
SummaLabs/DLS
app/backend/core/models-keras-2x-api/lightweight_layers/layers_pooling.py
Python
mit
7,111
import sys tagging_filepath = sys.argv[1] following_filepath = sys.argv[2] delim = '\t' if len(sys.argv) > 3: delim = sys.argv[3] graph = {} for line in open(tagging_filepath): entry = line.rstrip().split('\t') src = entry[0] dst = entry[1] if not src in graph: graph[src] = {} graph[src][dst]...
yamaguchiyuto/icwsm15
tag_follow_disagreement.py
Python
mit
857
#!/usr/bin/env python # # Copyright 2010 Facebook # # 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 la...
Agnishom/ascii-art-007
facebook.py
Python
mit
20,087
# coding=utf-8 # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. import threading from typing import Optional, Tuple from pyqrllib.pyqrllib import bin2hstr from pyqryptonight.pyqryptonight import StringToUInt256, UInt256ToString fr...
jleni/QRL
src/qrl/core/ChainManager.py
Python
mit
23,847
#!/usr/bin/env python3 # Copyright (c) 2015-2020 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Utilities for manipulating blocks and transactions.""" import struct import time import unittest from...
yenliangl/bitcoin
test/functional/test_framework/blocktools.py
Python
mit
9,688
# 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; only version 2 of the License is applicable. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; witho...
alphagov/govuk-puppet
modules/collectd/files/usr/lib/collectd/python/redis_queues.py
Python
mit
4,100
from .DiscreteFactor import State, DiscreteFactor from .CPD import TabularCPD from .JointProbabilityDistribution import JointProbabilityDistribution __all__ = ['TabularCPD', 'DiscreteFactor', 'State' ]
khalibartan/pgmpy
pgmpy/factors/discrete/__init__.py
Python
mit
236
from crispy_forms.helper import FormHelper from crispy_forms.layout import Fieldset, Layout from django import forms from django.contrib.auth.forms import AuthenticationForm from django.contrib.auth.models import User from django.contrib.auth.password_validation import validate_password from django.core.exceptions impo...
eduardoedson/scp
usuarios/forms.py
Python
mit
8,823
#! python3 """ GUI for Ultrasonic Temperature Controller Copyright (c) 2015 by Stefan Lehmann """ import os import datetime import logging import json import serial from qtpy.QtWidgets import QAction, QDialog, QMainWindow, QMessageBox, \ QDockWidget, QLabel, QFileDialog, QApplication from qtpy.QtGui imp...
MrLeeh/jsonwatchqt
jsonwatchqt/mainwindow.py
Python
mit
19,071
# -*- coding: utf-8 -*- """ """ from datetime import datetime, timedelta import os from flask import request from flask import Flask import pytz import db from utils import get_remote_addr, get_location_data app = Flask(__name__) @app.route('/yo-water/', methods=['POST', 'GET']) def yowater(): payload = re...
YoApp/yo-water-tracker
server.py
Python
mit
1,851
from django.conf.urls import patterns, include, url from django.conf import settings from django.conf.urls.static import static from django.contrib import admin admin.autodiscover() import views urlpatterns = patterns('', url(r'^pis', views.pis), url(r'^words', views.words, { 'titles': False }), url(r'^p...
ctames/conference-host
webApp/urls.py
Python
mit
1,850
#!/usr/bin/env python # -*- coding: utf-8 -*- import base64 import json from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions from behave import * @step('I share first element in the history list') def step_impl(...
jsargiot/restman
tests/steps/share.py
Python
mit
2,709
#!/usr/bin/env python """ This script is used to run tests, create a coverage report and output the statistics at the end of the tox run. To run this script just execute ``tox`` """ import re from fabric.api import local, warn from fabric.colors import green, red if __name__ == '__main__': # Kept some files for ...
bitmazk/django-libs
runtests.py
Python
mit
1,182
from baroque.entities.event import Event class EventCounter: """A counter of events.""" def __init__(self): self.events_count = 0 self.events_count_by_type = dict() def increment_counting(self, event): """Counts an event Args: event (:obj:`baroque.entities.ev...
baroquehq/baroque
baroque/datastructures/counters.py
Python
mit
1,120
import numpy as np class Surface(object): def __init__(self, image, edge_points3d, edge_points2d): """ Constructor for a surface defined by a texture image and 4 boundary points. Choose the first point as the origin of the surface's coordinate system. :param image: image a...
yangshun/cs4243-project
app/surface.py
Python
mit
3,220
# coding: utf-8 """ ORCID Member No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: Latest Generated by: https://github.com/swagger-api/swagger-codegen.git """ from pprint import pformat from six import iteritems import r...
Royal-Society-of-New-Zealand/NZ-ORCID-Hub
orcid_api/models/contributor_orcid.py
Python
mit
3,922
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Page', fields=[ ('id', models.AutoField(verbose...
vollov/i18n-django-api
page/migrations/0001_initial.py
Python
mit
723
from behave import given, when, then from genosdb.models import User from genosdb.exceptions import UserNotFound # 'mongodb://localhost:27017/') @given('a valid user with values {username}, {password}, {email}, {first_name}, {last_name}') def step_impl(context, username, password, email, first_name, last_name): ...
jonrf93/genos
dbservices/tests/functional_tests/steps/user_service_steps.py
Python
mit
1,685
import unittest from src.data_structures.mockdata import MockData class TestMockData (unittest.TestCase): def setUp(self): self.data = MockData() def test_random_data(self): data = MockData() a_set = data.get_random_elements(10) self.assertTrue(len(a_set) == 10, "the data sh...
alcemirsantos/algorithms-py
tests/data_stuctures/test_mockdata.py
Python
mit
400
from rest_framework.filters import ( FilterSet ) from trialscompendium.trials.models import Treatment class TreatmentListFilter(FilterSet): """ Filter query list from treatment database table """ class Meta: model = Treatment fields = {'id': ['exact', 'in'], 'no_r...
nkoech/trialscompendium
trialscompendium/trials/api/treatment/filters.py
Python
mit
934
""" WSGI config for Carkinos 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.9/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETT...
LeeYiFang/Carkinos
src/Carkinos/wsgi.py
Python
mit
393
from io import BytesIO from django import forms from django.http import HttpResponse from django.template import Context, Template from braces.views import LoginRequiredMixin from django.views.generic import DetailView, ListView from django.views.decorators.http import require_http_methods from django.contrib import...
mooja/ssip3
app/members/views.py
Python
mit
4,530
import time import multiprocessing from flask import Flask app = Flask(__name__) backProc = None def testFun(): print('Starting') while True: time.sleep(3) print('looping') time.sleep(3) print('3 Seconds Later') @app.route('/') def root(): return 'Started a background pr...
wikomega/wikodemo
test.py
Python
mit
1,073
''' Created by auto_sdk on 2014-12-17 17:22:51 ''' from top.api.base import RestApi class SubusersGetRequest(RestApi): def __init__(self,domain='gw.api.taobao.com',port=80): RestApi.__init__(self,domain, port) self.user_nick = None def getapiname(self): return 'taobao.subusers.get'
CooperLuan/devops.notes
taobao/top/api/rest/SubusersGetRequest.py
Python
mit
303
# coding: utf-8 import unittest from config_reader import ConfigReader class TestConfigReader(unittest.TestCase): def setUp(self): self.config = ConfigReader(""" <root> <person> <name>ๅฑฑ็”ฐ</name> <age>15</age> </person> ...
orangain/jenkins-docker-sample
tests.py
Python
mit
681
# project/server/tests/test_user.py import datetime import unittest from flask_login import current_user from base import BaseTestCase from project.server import bcrypt from project.server.models import User from project.server.user.forms import LoginForm class TestUserBlueprint(BaseTestCase): def test_correc...
realpython/flask-skeleton
{{cookiecutter.app_slug}}/project/tests/test_user.py
Python
mit
4,811
inside = lambda x, y: 4*x*x+y*y <= 100 def coll(sx, sy, dx, dy): m = 0 for p in range(32): m2 = m + 2**(-p) if inside(sx + dx * m2, sy + dy * m2): m = m2 return (sx + dx*m, sy + dy*m) def norm(x, y): l = (x*x + y*y)**0.5 return (x/l, y/l) sx, sy = 0, 10.1 dx, dy = 1.4, -19.7 for ...
jokkebk/euler
p144.py
Python
mit
538
import sys MAX_NUM_STORED_LINES = 200 MAX_NUM_LINES = 10 LINEWIDTH = 80 class CmdText(object): """ Represents a command line text device. Text is split into lines corresponding to the linewidth of the device. """ def __init__(self): """ Construct empty object. """ s...
t-mertz/slurmCompanion
django-web/webcmd/cmdtext.py
Python
mit
4,609
""" Tests for a door card. """ import pytest from onirim import card from onirim import component from onirim import core from onirim import agent class DoorActor(agent.Actor): """ """ def __init__(self, do_open): self._do_open = do_open def open_door(self, content, door_card): retu...
cwahbong/onirim-py
tests/test_door.py
Python
mit
2,159
### This script fetches level-1 PACS imaging data, using a list generated by the ### archive (in the CSV format), attaches sky coordinates and masks to them ### (by calling the convertL1ToScanam task) and save them to disk in the correct ### format for later use by Scanamorphos. ### See important instructions below. ...
alvaroribas/modeling_TDs
Herschel_mapmaking/scanamorphos/PACS/general_script_L1_PACS.py
Python
mit
2,499
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from conans.model import Generator from conans.client.generators import VisualStudioGenerator from xml.dom import minidom from conans.util.files import load class VisualStudioMultiGenerator(Generator): template = """<?xml version="1.0" encoding="utf-8"?> <P...
lasote/conan
conans/client/generators/visualstudio_multi.py
Python
mit
2,436
# Scrapy settings for helloscrapy project # # For simplicity, this file contains only the most important settings by # default. All the other settings are documented here: # # http://doc.scrapy.org/en/latest/topics/settings.html # BOT_NAME = 'helloscrapy' SPIDER_MODULES = ['helloscrapy.spiders'] NEWSPIDER_MODULE ...
orangain/helloscrapy
helloscrapy/settings.py
Python
mit
525
""" Django settings for djangoApp project. Generated by 'django-admin startproject' using Django 1.10.5. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ """ import ...
reggieroby/devpack
frameworks/djangoApp/djangoApp/settings.py
Python
mit
3,105
import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/ # SECURITY WARNING: keep t...
seccom-ufsc/hertz
hertz/settings.py
Python
mit
3,237
import re import warnings import ctds from .base import TestExternalDatabase from .compat import PY3, PY36, unicode_ class TestTdsParameter(TestExternalDatabase): def test___doc__(self): self.assertEqual( ctds.Parameter.__doc__, '''\ Parameter(value, output=False) Explicitly de...
zillow/ctds
tests/test_tds_parameter.py
Python
mit
7,779
import copy import pytest from peek.line import InvalidIpAddressException, Line, InvalidStatusException # 127.0.0.1 - - [01/Jan/1970:00:00:01 +0000] "GET / HTTP/1.1" 200 193 "-" "Python" test_line_contents = { 'ip_address': '127.0.0.1', 'timestamp': '[01/Jan/1970:00:00:01 +0000]', 'verb': 'GET', ...
purrcat259/peek
tests/unit/test_line.py
Python
mit
1,585
import logging import requests from django.conf import settings from django.contrib.sites.models import Site from django.core.mail import EmailMultiAlternatives from django.template.loader import get_template from django.utils import timezone from invitations.models import Invitation logger = logging.getLogger('email...
phildini/logtacts
invitations/consumers.py
Python
mit
1,739
def burrows_wheeler(text): """Calculates the burrows wheeler transform of <text>. returns the burrows wheeler string and the suffix array indices The text is assumed to not contain the character $""" text += "$" all_permutations = [] for i in range(len(text)): all_permutations.append(...
alneberg/sillymap
sillymap/burrows_wheeler.py
Python
mit
567
#!/usr/bin/env python # coding: utf-8 import os,sys import ctypes import numpy as np from .hmatrix import _C_HMatrix, HMatrix class _C_MultiHMatrix(ctypes.Structure): """Holder for the raw data from the C++ code.""" pass class AbstractMultiHMatrix: """Common code for the two actual MultiHMatrix classes...
PierreMarchand20/htool
interface/htool/multihmatrix.py
Python
mit
10,354
import primes as py def lcm(a, b): return a * b / gcd(a, b) def gcd(a, b): while b != 0: (a, b) = (b, a % b) return a # Returns two integers x, y such that gcd(a, b) = ax + by def egcd(a, b): if a == 0: return (0, 1) else: y, x = egcd(b % a, a) return (x - (b ...
ioguntol/NumTy
numty/congruences.py
Python
mit
3,551
a = a # e 4 a = 1 # 0 int l = [a] # 0 [int] d = {a:l} # 0 {int:[int]} s = "abc" c = ord(s[2].lower()[0]) # 0 int # 4 (str) -> int l2 = [range(i) for i in d] # 0 [[int]] y = [(a,b) for a,b in {1:'2'}.iteritems()] # 0 [(int,str)] b = 1 # 0 int if 0: b = '' # 4 str else: b = str(b) # 4 str # 12 int ...
kmod/icbd
icbd/type_analyzer/tests/basic.py
Python
mit
1,818
# Copyright (c) 2016 nVentiveUX # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distri...
nVentiveUX/mystartupmanager
mystartupmanager/showcase/apps.py
Python
mit
1,233
import asyncio import email.utils import json import sys from cgi import parse_header from collections import namedtuple from http.cookies import SimpleCookie from urllib.parse import parse_qs, unquote, urlunparse from httptools import parse_url from sanic.exceptions import InvalidUsage from sanic.log import error_l...
lixxu/sanic
sanic/request.py
Python
mit
11,420
from .tile import Split, Stack, TileStack class Tile(Split): class left(Stack): weight = 3 priority = 0 limit = 1 class right(TileStack): pass class Max(Split): class main(Stack): tile = False class InstantMsg(Split): class left(TileStack): # or maybe no...
tailhook/tilenol
tilenol/layout/examples.py
Python
mit
657
hmm = [ "https://media3.giphy.com/media/TPl5N4Ci49ZQY/giphy.gif", "https://media0.giphy.com/media/l14qxlCgJ0zUk/giphy.gif", "https://media4.giphy.com/media/MsWnkCVSXz73i/giphy.gif", "https://media1.giphy.com/media/l2JJEIMLgrXPEbDGM/giphy.gif", "https://media0.giphy.com/media/dgK22exekwOLm/giphy.gif"...
garr741/mr_meeseeks
rtmbot/plugins/hmm.py
Python
mit
322
from djblets.cache.backend import cache_memoize class BugTracker(object): """An interface to a bug tracker. BugTracker subclasses are used to enable interaction with different bug trackers. """ def get_bug_info(self, repository, bug_id): """Get the information for the specified bug. ...
reviewboard/reviewboard
reviewboard/hostingsvcs/bugtracker.py
Python
mit
1,633
import sys from stack import Stack def parse_expression_into_parts(expression): """ Parse expression into list of parts :rtype : list :param expression: str # i.e. "2 * 3 + ( 2 - 3 )" """ raise NotImplementedError("complete me!") def evaluate_expression(a, b, op): raise NotImplementedErr...
tylerprete/evaluate-math
postfix.py
Python
mit
792
#!/usr/bin/python # -*- coding: utf-8 -*- # @author victor li nianchaoli@msn.cn # @date 2015/10/07 import baseHandler class MainHandler(baseHandler.RequestHandler): def get(self): self.redirect('/posts/last')
lncwwn/woniu
routers/mainHandler.py
Python
mit
224
from ab_tool.tests.common import (SessionTestCase, TEST_COURSE_ID, TEST_OTHER_COURSE_ID, NONEXISTENT_TRACK_ID, NONEXISTENT_EXPERIMENT_ID, APIReturn, LIST_MODULES) from django.core.urlresolvers import reverse from ab_tool.models import (Experiment, InterventionPointUrl) from ab_tool.exceptions import (EXPERIMENT...
penzance/ab-testing-tool
ab_tool/tests/test_experiment_pages.py
Python
mit
28,898
#-*- coding: utf-8 -*- from flask import current_app, flash, url_for, request from flask_admin import expose, BaseView from logpot.admin.base import AuthenticateView, flash_errors from logpot.admin.forms import SettingForm from logpot.utils import ImageUtil, getDirectoryPath, loadSiteConfig, saveSiteConfig import os...
moremorefor/Logpot
logpot/admin/setting.py
Python
mit
2,802
# TODO When raising an exception pass a lambda function, the function being the module/path/name thing ERROR = {'default': "Unknown engine error ({0})", 400: "Bad request sent to search API ({0})", 401: "Incorrect API Key ({0})", 403: "Correct API but request refused ({0})", 404: "B...
leifos/ifind
ifind/search/exceptions.py
Python
mit
2,524
#!/usr/bin/python import os import re from lxml import etree as et import pcbmode.config as config from . import messages as msg # pcbmode modules from . import utils from .point import Point def makeExcellon(manufacturer='default'): """ """ ns = {'pcbmode':config.cfg['ns']['pcbmode'], 'svg...
ddm/pcbmode
pcbmode/utils/excellon.py
Python
mit
4,661
"""Run tests for the kmeans portion of the kmeans module""" import kmeans.kmeans.kmeans as kmeans import numpy as np import random def test_1dim_distance(): """See if this contraption works in 1 dimension""" num1 = random.random() num2 = random.random() assert kmeans.ndim_euclidean_distance(num1, num...
moradology/kmeans
tests/testkmeans.py
Python
mit
1,642
""" Django settings for ross project. Generated by 'django-admin startproject' using Django 1.10.6. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ """ import os #...
rossplt/ross-django-utils
ross/settings.py
Python
mit
3,090
import re import hashlib FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data:// def getParentAndBase(path): match = PREFIX.match(path) if match is None: if path.endswith('/'): st...
algorithmiaio/algorithmia-python
Algorithmia/util.py
Python
mit
1,473
""" train supervised classifier with what's cooking recipe data objective - determine recipe type categorical value from 20 """ import time from features_bow import * from features_word2vec import * from sklearn.preprocessing import StandardScaler from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifie...
eifuentes/kaggle_whats_cooking
train_word2vec_rf.py
Python
mit
1,909
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2015-2018 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Configuration options for Invenio-Search. The documentation for the configuration...
inveniosoftware/invenio-search
invenio_search/config.py
Python
mit
3,755
from __future__ import unicode_literals from django.apps import AppConfig class RfhistoryConfig(AppConfig): name = 'RFHistory'
Omenia/RFHistory
ServerApp/apps.py
Python
mit
134
import unittest from polycircles import polycircles from nose.tools import assert_equal, assert_almost_equal class TestDifferentOutputs(unittest.TestCase): """Tests the various output methods: KML style, WKT, lat-lon and lon-lat.""" def setUp(self): self.latitude = 32.074322 self.longitude = ...
adamatan/polycircles
polycircles/test/test_different_outputs.py
Python
mit
1,881
# coding: utf-8 """ General utilities. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import collections import sys import logging import multiprocessing # Third-party import numpy as np __all__ = ['get_pool'] # Create logger logger = logging....
abonaca/gary
gary/util.py
Python
mit
3,607