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 |
|---|---|---|---|---|---|
import pandas as pd
def assert_df_equal(df1, df2):
pd.options.mode.chained_assignment = None
if "Strand" in df1 and "Strand" in df2:
sort_on = "Chromosome Start End Strand".split()
df1.Strand = df1.Strand.astype("object")
df2.Strand = df2.Strand.astype("object")
else:
sor... | pyranges/pyrle | tests/helpers.py | Python | mit | 1,515 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# serialize.py
#
# Copyright 2013 tusharmakkar08 <tusharmakkar08@tusharmakkar08-Satellite-C660>
#
# 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 Fou... | tusharmakkar08/TRIE_Data_Structure | serialize.py | Python | mit | 1,972 |
import unittest
from summa.keywords import keywords
from summa.preprocessing.textcleaner import deaccent
from numpy import isclose
from .utils import get_text_from_test_data
class TestKeywords(unittest.TestCase):
def test_text_keywords(self):
text = get_text_from_test_data("mihalcea_tarau.txt")
... | summanlp/textrank | test/test_keywords.py | Python | mit | 7,150 |
#!/usr/bin/env python
from sys import stdout, stderr, exit
from optparse import OptionParser
from Bio import SeqIO, Seq, Alphabet
from cStringIO import StringIO
MINLEN_DEFAULT=10
if __name__ == '__main__':
usage = 'usage: %prog [options] <FASTA FILE>'
parser = OptionParser(usage=usage)
parser.add_option... | danydoerr/large_syn_workflow | remove_masked_regions.py | Python | mit | 1,172 |
from lxml import etree
import sys
REQUEST_BODY_PART_1 = '<![CDATA[actualEvent='
REQUEST_BODY_PART_2 = '&queryEmail='
REQUEST_BODY_PART_3 = ']]>'
CONTENT_TYPE = 'Content-type: application/x-www-form-urlencoded'
def usage():
print "python create_test_case [URL]"\
" [EVENT_NAME] [AMOUNT_CASES] [TEST_CASE_FI... | Ezetowers/AppEngine_EventsManagement | load_tests/QueryGuest_Case/query_guests.py | Python | mit | 1,268 |
" spar loading for gust case "
import os
from numpy import pi, hstack, array
from ad.admath import cos
import pandas as pd
from gpkit import parse_variables
from gpfit.fit_constraintset import FitCS
from .sparloading import SparLoading
#pylint: disable=invalid-name, no-member, arguments-differ, exec-used
#pylint: disa... | convexengineering/gplibrary | gpkitmodels/GP/aircraft/wing/gustloading.py | Python | mit | 2,004 |
#!/usr/bin/python
import os
from conans import SERVER_CAPABILITIES, REVISIONS
from conans.paths import conan_expand_user
from conans.server.conf import get_server_store
from conans.server.crypto.jwt.jwt_credentials_manager import JWTCredentialsManager
from conans.server.crypto.jwt.jwt_updown_manager import JWTUpDownA... | memsharded/conan | conans/server/launcher.py | Python | mit | 2,666 |
RMAS_BUS_WSDL='http://localhost:7789/?wsdl'
POLL_INTERVAL=5000
EVENTS=[] | UoK-Psychology/rmas_adapter | rmas_adapter/conf/adapter_template/settings.py | Python | mit | 75 |
#!/usr/bin/env python
# --------------------------------------------------------------
# Script used to write commit time for each file
# --------------------------------------------------------------
import os, sys
path_sct = os.environ.get("SCT_DIR", os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
sys.... | neuropoly/spinalcordtoolbox | dev/githook/pre_commit_hook.py | Python | mit | 2,812 |
__author__ = 'Brandon C. Kelly'
import numpy as np
import matplotlib.pyplot as plt
from scipy.linalg import solve
from scipy.optimize import minimize
import samplers
import multiprocessing
import _carmcmc as carmcmcLib
class CarmaModel(object):
"""
Class for performing statistical inference assuming a CARMA(... | guillaumelenoir/WAVEPAL | carmcmc/carma_pack.py | Python | mit | 72,802 |
from . import FloodError
class FloodWaitError(FloodError):
def __init__(self, **kwargs):
self.seconds = kwargs['extra']
super(Exception, self).__init__(
self,
'A wait of {} seconds is required.'
.format(self.seconds)
)
rpc_errors_420_all = {
'FLOOD... | kyasabu/Telethon | telethon/errors/rpc_errors_420.py | Python | mit | 351 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
from django import forms
from django.core.mail import send_mail
from django.template import Context
from ProyectoDeGrado.settings import MEDIA_ROOT
from apps.administrador.models import *
from django.contrib.auth.models import User
class PerfilForm(forms.M... | edwar/repositio.com | ProyectoDeGrado/forms.py | Python | mit | 2,750 |
import numpy as n, matplotlib.pyplot as p, scipy.special
import cosmolopy.perturbation as pb
import cosmolopy.density as cd
from scipy.integrate import quad, tplquad
import itertools
from scipy.interpolate import interp1d
from scipy.interpolate import RectBivariateSpline as RBS
import optparse, sys
from scipy.optimize ... | yunfanz/ReionBub | Choud14/Barrier.py | Python | mit | 11,268 |
import numpy as np
import scipy
import re
import os
import hashlib
import csb
from csb.bio.io.wwpdb import StructureParser
def chunks(l, n):
""" Yield successive n-sized chunks from l.
"""
for i in xrange(0, len(l), n):
yield l[i:i+n]
class ScatteringFactor(object):
"""
Cacluates the ... | mmechelke/bayesian_xfel | bxfel/core/structure_factor.py | Python | mit | 18,608 |
# -*- 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):
# Adding field 'Blog.has_template'
db.add_column('blogs_blog', 'has_template',
self.gf... | carquois/blobon | blobon/blogs/migrations/0049_auto__add_field_blog_has_template.py | Python | mit | 20,023 |
from pkg_resources import resource_filename
from pyramid.events import (
BeforeRender,
subscriber,
)
from pyramid.httpexceptions import (
HTTPMovedPermanently,
HTTPPreconditionFailed,
HTTPUnauthorized,
HTTPUnsupportedMediaType,
)
from pyramid.security import forget
from pyramid.settings import a... | philiptzou/clincoded | src/clincoded/renderers.py | Python | mit | 7,833 |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the MIT license. See the LICENSE file for details.
"""
import os
import shutil
import grp
import pwd
from cct.module import Module
from cct.lib.file_utils import create_dir
class File(Module):
... | containers-tools/base | base/file.py | Python | mit | 3,057 |
import re
from urllib import quote_plus
import math
from common import escape
_globals = {'__builtins__':{}}
_locals = vars(math)
try:
import cosmo
import smhm
except ImportError:
pass
else:
for k in cosmo.__all__:
_locals[k] = cosmo.__dict__[k]
for k in smhm.__all__:
_locals[k] = ... | yymao/slackbots | calc.py | Python | mit | 1,617 |
"""Tests for the CPU Speed config flow."""
from unittest.mock import AsyncMock, MagicMock
from homeassistant.components.cpuspeed.const import DOMAIN
from homeassistant.config_entries import SOURCE_USER
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import (
RESULT_TYPE_ABORT,
... | rohitranjan1991/home-assistant | tests/components/cpuspeed/test_config_flow.py | Python | mit | 2,642 |
import os
import sys
import shutil
import re
currentPath = os.path.dirname (os.path.abspath (__file__))
os.chdir (currentPath)
def PrintInfo (message):
print ('Info: ' + message)
def PrintError (error):
print ('Error: ' + error)
def ReplaceInFile (filePath, source, dest):
file = open (filePath, 'rb')
content = ... | EliasLi/JunctionHackathon | public/3odel_old/3d/tools/build.py | Python | mit | 2,656 |
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
from scrapy.item import Item, Field
class WorkabroadItem(Item):
# define the fields for your item here like:
# name = Field()
pass
class PostItem(Item):
href = Field()
id ... | staceytay/workabroad-scraper | workabroad/items.py | Python | mit | 490 |
# -*- coding: utf8 -*-
from __future__ import print_function
from unittest import TestCase
from indexdigest.test import DatabaseTestMixin, DatabaseWithMockedRow
from indexdigest.database import DatabaseBase
class TestDatabaseBase(TestCase, DatabaseTestMixin):
def test_database_connect(self):
conn = Dat... | macbre/index-digest | indexdigest/test/core/test_database.py | Python | mit | 12,002 |
"""
main.py
The central entry point of the auacm app.
"""
import requests, sys, textwrap
import auacm
import auacm.utils as utils
from auacm.exceptions import ConnectionError, ProblemNotFoundError, UnauthorizedException, InvalidSubmission, CompetitionNotFoundError
def main(args):
"""
Entry point for the auac... | BrandonLMorris/auacm-cli | src/auacm/main.py | Python | mit | 2,810 |
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
import pymongo
from tornado.options import define, options
define("port", default=8000, help="run on the given port", type=int)
# put your mongodb username and password
# "mongodb://username:password@staff.mongohq.com:someport... | avinassh/learning-tornado | tornado-book/databases/definitions_readwrite.py | Python | mit | 1,628 |
import _plotly_utils.basevalidators
class ConstraintextValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="constraintext", parent_name="waterfall", **kwargs):
super(ConstraintextValidator, self).__init__(
plotly_name=plotly_name,
parent_name... | plotly/plotly.py | packages/python/plotly/plotly/validators/waterfall/_constraintext.py | Python | mit | 500 |
# coding=utf-8
import os
import glob
import configuracao
def main():
for arquivo in glob.glob(configuracao.DATASET_PREPARADO + '/*.csv'):
linhas = 0
spam = 0
with open(arquivo, 'r') as arquivo_aberto:
tupla = arquivo_aberto.readline()
while tupla:
li... | ebertti/nospam | contador_linhas.py | Python | mit | 581 |
from django.test import TestCase
from bookstore.models import Book, Category
class InventoryModelTest(TestCase):
def test_string_representation_of_categories(self):
category = Category.objects.create(name="health", description="health category")
self.assertEqual(category.name, 'health')
def ... | andela-ijubril/book-search | booker/bookstore/tests/test_models.py | Python | mit | 527 |
from django.test import TestCase, Client, RequestFactory
from django.contrib.auth.models import User
from django.utils import timezone
from django.core.files.uploadedfile import SimpleUploadedFile
from django.urls import reverse_lazy
from imager_images.models import Image, Album
from imager_images.views import Librar... | ellezv/django_imager | imagersite/imager_images/tests.py | Python | mit | 30,691 |
import unittest
# procedural
def word_count(s):
if s == '':
return 0
words = 0
in_word = False
for c in s:
if c != ' ':
if in_word:
pass
else:
in_word = True
else:
if in_word:
words += 1
... | anokata/pythonPetProjects | exercises/word_count.py | Python | mit | 1,764 |
from datetime import datetime, timedelta
from pprint import pprint
from django import forms
from utils.functions import shift_years
from .models import (
NfEntrada,
PosicaoCarga,
)
class NotafiscalChaveForm(forms.Form):
chave = forms.CharField(
widget=forms.TextInput())
class NotafiscalRelFor... | anselmobd/fo2 | src/logistica/forms.py | Python | mit | 5,361 |
# The MIT License
#
# Copyright (c) 2008 James Piechota
#
# 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,... | redpawfx/massiveImporter | python/ns/tests/TestGenotype.py | Python | mit | 2,335 |
#!/usr/bin/env python2
class style:
@staticmethod
def bold(text):
return "\x02%s\x02" % text
@staticmethod
def underline(text):
return "\x1F%s\x1F" % text
| ryonsherman/rcbot | utils/text.py | Python | mit | 190 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class TwilioSmsHandlerConfig(AppConfig):
name = 'twilio_sms_handler'
| sandz-in/twilio_trello | twilio_sms_handler/apps.py | Python | mit | 174 |
from unittest import TestCase
class TestFoo( TestCase ):
def test_foo_1( self ):
self.assertTrue( True )
def test_foo_2( self ):
self.assertTrue( True )
def test_foo_3( self ):
self.assertTrue( True )
def test_foo_4( self ):
self.assertTrue( True )
def test_foo... | codepanda/pycicl | tests/fixtures/parallel/tests/testfoo.py | Python | mit | 2,035 |
from . import conn
class Contest(object):
def __init__(self, contestId, name, length, description, problems):
self._contestId = contestId
self._name = name
self._length = length
self._description = description
self._problems = problems
@classmethod
def load(cls, contestId):
with conn.cursor() as cur:
... | aioc/aminiaio | aminiaio/db/contest.py | Python | mit | 1,280 |
import pytest
from dlkit.abstract_osid.osid import errors
from dlkit.primordium.locale.types.calendar import get_type_data
class TestCalendar(object):
def test_get_type_data_with_celestial(self):
results = get_type_data('xhosa')
assert results['domain'] == 'Calendar Types'
assert results[... | mitsei/dlkit | tests/dlkit/primordium/locale/types/test_calendar.py | Python | mit | 1,400 |
import _plotly_utils.basevalidators
class ViolinmodeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="violinmode", parent_name="layout", **kwargs):
super(ViolinmodeValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name... | plotly/python-api | packages/python/plotly/plotly/validators/layout/_violinmode.py | Python | mit | 516 |
#/usr/bin/python
"""
Created on Apr 19, 2011
@author: ncliang
"""
import urllib
import urllib2
from zillowpy import zillow_response
class BaseRequest(object):
"""classdocs"""
REQ_SUCCESS = 0
SERVICE_ERROR = 1
INVALID_ZWSID = 2
SERVICE_UNAVAILABLE = 3
API_UNAVAILABLE = 4
API_URL_TEMPLATE = "http://w... | ncliang/zillowpy | zillowpy/base_request.py | Python | mit | 737 |
# -*- coding: utf-8 -*-
import scrapy
from scrapy.selector import Selector
from scrapy.loader import ItemLoader
from scrapy.xlib.pydispatch import dispatcher
from scrapy import signals
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import exp... | hbbhbbh/TmallSingleCrawler | TmallSingleCrawler/spiders/tmall.py | Python | mit | 11,888 |
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from deap import creator, base, tools, algorithms
from utils import get_training_data, get_evaluation_data,\
get_testing_data, normalise_data
from evaluation import EvaluationMetrics
from nn_manager import create_nn, call_nn
import... | JakeCowton/titanic | src/ga_for_rfc.py | Python | mit | 5,521 |
"""Provide fixtures for pytest-based unit tests."""
from click.testing import CliRunner
import pytest
from watson import Watson
@pytest.fixture
def config_dir(tmpdir):
return str(tmpdir.mkdir('config'))
@pytest.fixture
def watson(config_dir):
return Watson(config_dir=config_dir)
@pytest.fixture
def runn... | TailorDev/Watson | tests/conftest.py | Python | mit | 508 |
""" This class represents a Queue Node to store values and also
links others Nodes with values."""
class Node:
""" It starts with a value at all times. A note can not be
created without a value associated. """
def __init__(self, value):
self.value = value
self.next = None
""" This ... | ericxlive/abstract-data-types | abstract-data-types/adt_queue.py | Python | mit | 2,361 |
#!/usr/bin/env python
from objex import Objex
import os.path
import sys
import traceback
from bottle import debug, error, redirect, request, response, route, run, static_file
from jinja2 import Environment, PackageLoader, Template
from pygments import highlight
from pygments.lexers import PythonLexer
from pygments.fo... | johnthedebs/objex | objex/browser_test.py | Python | mit | 3,118 |
"""SisImports API Version 1.0.
This API client was generated using a template. Make sure this code is valid before using it.
"""
import logging
from datetime import date, datetime
from base import BaseCanvasAPI
from base import BaseModel
import os
class SisImportsAPI(BaseCanvasAPI):
"""SisImports API... | PGower/PyCanvas | pycanvas/apis/sis_imports.py | Python | mit | 28,128 |
"""
WSGI config for checkit 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.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETT... | reidswan/Checkit | checkit/wsgi.py | Python | mit | 392 |
from .base import *
env = os.environ.get('PFI_ENV', '')
if env == 'TESTING':
print('Using TESTING environment settings')
try:
from .testing import *
except:
pass
elif env == 'PRODUCTION':
print('Using PRODUCTION environment settings')
try:
from .production import *
exc... | eluttine/planette | planette/settings/__init__.py | Python | mit | 338 |
# <makedowncell>
# # Sentiment Analysis with an RNN
#
# In this notebook, you'll implement a recurrent neural network that performs sentiment analysis. Using an RNN rather than a feedfoward network is more accurate since we can include information about the *sequence* of words. Here we'll use a dataset of movie review... | xaibeing/cn-deep-learning | tutorials/sentiment-rnn/Sentiment_RNN_x.py | Python | mit | 8,810 |
from .test_apply_to_last import *
from .test_chunk_on import *
from .test_chunks import *
from .test_map_parallel import *
from .test_skip_errors import *
from .test_switch import * | CodyKochmann/generators | generators/tests/__init__.py | Python | mit | 182 |
#!/usr/bin/env python3
import os
import sys
import re
import math
import platform
import xml.etree.ElementTree as ET
################################################################################
# Config #
#######################################... | jejung/godot | doc/tools/doc_status.py | Python | mit | 15,221 |
#!/usr/bin/env python
from setuptools import setup
install_requires = [
'bandcamp-downloader==0.0.10',
'beautifulsoup4==4.10.0',
'Pafy==0.3.66',
'fudge==1.0.3',
'requests>=2.20.0',
'simplejson==3.6.5',
'slimit==0.8.1',
'stagger',
]
dependency_links = [
'git://github.com/ajduncan/stagger.git@master#... | ajduncan/downspout | setup.py | Python | mit | 721 |
# -*- coding: utf-8 -*-
from unittest.mock import patch
from datetime import timedelta
import unittest
import asyncio
import aschedule
class TestingExt(unittest.TestCase):
_multiprocess_shared_ = True
def setUp(self):
self.loop = asyncio.get_event_loop()
async def get_coro(self):
pass
... | eightnoteight/aschedule | tests/testing_ext.py | Python | mit | 2,983 |
def fizz_buzz(fizz, buzz, highest):
result = []
for i in range(1, highest + 1):
letter = ''
# If divisible by fizz or buzz, add F or B appropriately.
if i % fizz == 0:
letter += 'F'
if i % buzz == 0:
letter += 'B'
# If neither F or B has been la... | Goyatuzo/Challenges | CodeEval/Easy/Fizz Buzz/fizz_buzz.py | Python | mit | 460 |
# -*- coding: utf-8 -*-
#
# 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 configuration values have a default; values that are commented out
# serve to show the default.
import os
impo... | wireservice/agate-excel | docs/conf.py | Python | mit | 7,310 |
"""
A python neural network package based on gnumpy.
Yujia Li, 09/2014
TODO:
- right now YNeuralNet I/O only supports NeuralNet as the type for component
nets (network construction and forward/backward prop works for other types
of component nets just fine). Ideally this should be extended to
StackedNeuralNet ... | yujiali/pynn | pynn/nn.py | Python | mit | 20,622 |
"""Fields represent CronTrigger options which map to :class:`~datetime.datetime` fields."""
from __future__ import annotations
import re
from calendar import monthrange
from datetime import datetime
from typing import Any, ClassVar, Sequence
from .expressions import (
WEEKDAYS, AllExpression, LastDayOfMonthExpres... | agronholm/apscheduler | src/apscheduler/triggers/cron/fields.py | Python | mit | 4,680 |
# David Tsui 2.9.2016
# Human Languages and Technologies
# Dr. Rebecca Hwa
from Ngrams import *
#TRAIN
train_file = open("tokenized_train.txt","r")
train_str = train_file.read();
tri = Trigram(1)
print "Begin training vocabulary----------------------"
tri.trainVocabulary(train_str)
#tri.printVocabulary()
#Takes in q... | luckyleap/NLP_Projects | MSChallenge Ngrams/MSChallengeNGrams.py | Python | mit | 908 |
# -*- 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 ImgItem(scrapy.Item):
image_character = scrapy.Field()
image_titles = scrapy.Field()
image_urls = scrapy.Field()
image_paths = scr... | Justyer/KuaikanSpider | KuaikanSpider/KuaikanSpider/items.py | Python | mit | 537 |
# -*- coding: utf-8 -*-
#
# destiny_account documentation build configuration file, created by
# sphinx-quickstart on Tue Apr 15 00:23:55 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated fil... | Xaroth/plex-export | docs/conf.py | Python | mit | 9,091 |
'''
This script opens top today's trending github repos in your browser
if you have not previously visited them.
Repos are selected based on https://github.com/trending.
'''
import requests
import bs4
import webbrowser
import os
from optparse import OptionParser
parser = OptionParser('usage: trending-repos [options]')... | mkermani144/sudo-make-me-a-sandwitch | trending-repos.py | Python | mit | 1,796 |
import os
import re
from collections import defaultdict
from datetime import datetime
class Event(object):
def __init__(self, log_text):
# [1518-09-17 23:48] Guard #1307 begins shift
# [1518-09-17 23:48] falls asleep
# [1518-09-17 23:48] wakes up
self.raw_log = log_text
ma... | AustinTSchaffer/DailyProgrammer | AdventOfCode/2018/src/day-04/app.py | Python | mit | 4,830 |
from __future__ import unicode_literals
import copy
from ._compat import decode
from ._utils import merge_dicts
from .exceptions import KeyAlreadyPresent
from .exceptions import NonExistentKey
from .exceptions import ParseError
from .exceptions import TOMLKitError
from .items import AoT
from .items import Comment
fro... | kennethreitz/pipenv | pipenv/vendor/tomlkit/container.py | Python | mit | 24,835 |
# -*- coding: utf-8 -*-
from collections import Counter
from copy import deepcopy
from math import sqrt
from random import sample as random_sample
from string import ascii_uppercase
class SudokuBoard(object):
"""Create a Sudoku Board of variable size
The method will create the random sudoku Board
of vari... | MsStryker/Games | sudoku/default.py | Python | mit | 4,916 |
import threading
import pygame
# Char LCD plate button names.
SELECT = 32
RIGHT = 275
DOWN = 274
UP = 273
LEFT = 276
FONT_HEIGHT = 80
FONT_WIDTH = int(FONT_HEIGHT * 0.6)
class Adafruit_CharLCDPlate:
def __init__(self, width=16, height=2):
pygame.init()
self._width = width
self.screen = p... | nzjoel1234/sprinkler | driver/lcd_simulator.py | Python | mit | 2,457 |
import spidev
import RPi.GPIO as GPIO
import time
class DoorSensor:
def __init__(self, pin = None, verbose = False, dblogger = None):
self.results = ()
self.device = None
self.pin = pin
self.dblogger = dblogger
self.verbose = verbose
# assign default pin if none provided
if self.pin == ... | georgetown-analytics/classroom-occupancy | SensorDataCollection/Sensors/Asynchronous/DoorSensor.py | Python | mit | 2,071 |
from radical.ensemblemd import Kernel
from radical.ensemblemd import Pipeline
from radical.ensemblemd import EnsemblemdError
from radical.ensemblemd import SingleClusterEnvironment
#Used to register user defined kernels
from radical.ensemblemd.engine import get_engine
#Import our new kernel
from new_kernel import MyU... | radical-cybertools/ExTASY | doc/scripts/user_script.py | Python | mit | 1,886 |
# gameheart.urls
from django.conf.urls import patterns, include, url
from django.views.generic import RedirectView
from django.contrib import admin
#from paypay.standard.ipn import urls
from gameheart.entities import views
from gameheart.entities import forms
admin.autodiscover()
urlpatterns = patterns('',
# Exa... | undergroundtheater/gameheart | gameheart/urls.py | Python | mit | 12,257 |
"""
The MIT License (MIT)
Copyright (c) 2016 Stratos Goudelis
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, me... | sgoudelis/mybitbank | mybitbank/apps/login/forms.py | Python | mit | 2,092 |
'''Test gibson design module.'''
from nose.tools import assert_equal, assert_raises
from coral import design, DNA, Primer
def test_gibson_primers():
'''Test gibson_primers function.'''
# Fuse tdh3 promoter sequence to yfp (trimmed for readability)
tdh3_3prime = DNA('aaccagttccctgaaattattcccctacttgactaataa... | klavinslab/coral | tests/tests/test_design/test_gibson.py | Python | mit | 2,083 |
data = {}
def setup():
global data
from .schema import Ship, Faction
xwing = Ship(id="1", name="X-Wing")
ywing = Ship(id="2", name="Y-Wing")
awing = Ship(id="3", name="A-Wing")
# Yeah, technically it's Corellian. But it flew in the service of the rebels,
# so for the purposes of this ... | graphql-python/graphene | examples/starwars_relay/data.py | Python | mit | 1,593 |
from __future__ import absolute_import, division, print_function, unicode_literals
from builtins import *
from unittest import TestCase
try:
from i2p.crypto import crypto
except ImportError:
crypto = None
from i2p import datatypes
if crypto is not None:
DSA_ELGAMAL_KEY_CERT = b'BQAEAAAAAA=='
DSA_ELG... | majestrate/i2p.socket | i2p/test/test_datatypes.py | Python | mit | 8,496 |
#!/usr/bin/env python
#
# Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# noti... | aspectron/jsx | extern/v8/tools/js2c.py | Python | mit | 16,982 |
from collections import OrderedDict
import pytest
from javaproperties import loads_xml
@pytest.mark.parametrize(
"s,d",
[
("<properties></properties>", {}),
(
'<properties><entry key="key">value</entry></properties>',
{"key": "value"},
),
(
'... | jwodder/javaproperties | test/test_loads_xml.py | Python | mit | 4,001 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import cairo, Image
import gtk, gobject
from numpy import cos, sin, pi, sqrt, sort, square,array, zeros, diff,\
column_stack,ones, reshape, linspace, arctan2
from numpy import sum as npsum
from numpy.random import random, seed
from itertools import count
... | inconvergent/differential_ani | differential.py | Python | mit | 7,824 |
# Vasya Hobot
#
# Copyright (c) 2013-2014 Vyacheslav Slinko
# Licensed under the MIT License
from thrift.Thrift import TType
from api.skype.ttypes import Chat, User, Message
__all__ = ['remap_chat_object', 'remap_user_object', 'remap_message_object']
def mapper_factory(struct):
fields = []
for field in s... | vslinko-archive/vasya-hobot | src/server/mappers.py | Python | mit | 1,754 |
from .util import get_cached
__all__ = ("items", "recipes", "item_details", "recipe_details")
def items():
"""This resource returns a list of items that were discovered by players
in the game. Details about a single item can be obtained using the
:func:`item_details` resource.
"""
return get_ca... | hackedd/gw2api | gw2api/items.py | Python | mit | 4,068 |
#!/usr/bin/python
# coding=utf-8
from setuptools import setup, find_packages
setup(
name = "HEIGVD_TimetableParser",
version = "0.1",
packages = find_packages(),
install_requires = ['icalendar>=3.5', 'xlrd>=0.9.2'],
# metadata for upload to PyPI
author = "Leeroy Brun",
author_email = "lee... | leeroybrun/heigvd-timetable-parser | setup.py | Python | mit | 604 |
#!flask/bin/python
import zmq
import sys
import threading
import json
import settings
import utils
import os
from db import db
from images import images
from infra import infra
class KlapiServer(threading.Thread):
def __init__(self, sets):
threading.Thread.__init__(self)
self.port = 5555
s... | jroivas/klapi | klapi-backend.py | Python | mit | 6,207 |
#!/usr/bin/env python3
import re
import sys
import base64
_pac_line = re.compile(r"^var pac_(\S+) = '([a-zA-Z0-9+/]+=*)';$")
def parse_line(line):
match = _pac_line.match(line)
if not match:
return None
return (match.group(1), base64.b64decode(match.group(2)))
def extract_pac_files(source):
f... | upsuper/onenet-firefox | tools/extract_pac.py | Python | mit | 796 |
#-------------------------------------------------------------------------------
# Name: run_jensen
# Purpose: Automated execution of diatomic M-L computations in the form
# of Jensen et al. J Chem Phys 126, 014103 (2007)
#
# Author: Brian
#
# Created: 8 May 2015
# Copyright: ... | bskinn/run_jensen | run_jensen.py | Python | mit | 65,917 |
""" This module serves as the interface between the PYTHON code and the
FORTRAN implementations.
"""
import pandas as pd
import numpy as np
import subprocess
import os
from respy.python.shared.shared_auxiliary import dist_class_attributes
from respy.python.shared.shared_auxiliary import dist_model_paras
from respy.pyt... | restudToolbox/package | respy/fortran/interface.py | Python | mit | 11,491 |
from datetime import date, timedelta
from decimal import Decimal
from django.db.models import Q, Sum
from .models import Expense, Invoice
def get_monthly_totals(year, month):
totals = {}
start = date(year, month, 1)
if month == 12:
end = date(year+1, 1, 1)
else:
end = date(year, month... | soundgnome/django-rom | rom/invoices/calculator.py | Python | mit | 3,170 |
"""Request body processing for CherryPy.
.. versionadded:: 3.2
Application authors have complete control over the parsing of HTTP request
entities. In short,
:attr:`cherrypy.request.body<cherrypy._cprequest.Request.body>`
is now always set to an instance of
:class:`RequestBody<cherrypy._cpreqbody.RequestBody>`,
and *... | heytcass/homeassistant-config | deps/cherrypy/_cpreqbody.py | Python | mit | 37,427 |
def print_rangoli(size):
# your code goes here
if __name__ == '__main__':
n = int(input())
print_rangoli(n)
| jerodg/hackerrank-python | python/02.Strings/10.AlphabetRangoli/template.py | Python | mit | 118 |
import re, shlex
from ..silk.typeparse.parse import mask_characters
from .parse_slash0_utils import syntax_error, tokenize, doc_name, literal, \
append_node, find_node, quote_match
def parse_literal(word, lineno, l):
if word[0] == word[-1] == "'":
v = word[1:-1]
elif word[0] == word[-1] == '"':
... | sjdv1982/seamless | docs/archive/slash/parse_slash0_funcs.py | Python | mit | 15,684 |
from functools import partial
import time
from typing import List
from flask import Blueprint, Response, render_template, current_app, request
from core.job.helpers import expand_nodelist
from core.job.models import Job
from application.helpers import requires_auth
from core.monitoring.models import SENSOR_CLASS_MAP
... | srcc-msu/job_statistics | modules/job_analyzer/controllers.py | Python | mit | 1,969 |
# Spectral smoothing functionality
# To do:
# 3) add extra zero-padding for FFT algorithms so they don't go funky at the
# edges?
import numpy as np
from numpy.fft import fft, ifft, fftfreq, rfftfreq
__all__ = ["smoothspec", "smooth_wave", "smooth_vel", "smooth_lsf",
"smooth_wave_fft", "smooth_vel_fft",... | bd-j/prospector | prospect/utils/smoothing.py | Python | mit | 24,897 |
"""
# Pytess
Pure Python tessellation of points into polygons, including
Delauney/Thiessin, and Voronoi polygons. Built as a
convenient user interface for Bill Simons/Carson Farmer python port of
Steven Fortune C++ version of a Delauney triangulator.
## Platforms
Tested on Python version 2.x.
## Dependencies
Pu... | maxalbert/Pytess | pytess/__init__.py | Python | mit | 1,265 |
from django.apps import AppConfig
class CalcConfig(AppConfig):
name = 'apps.calc'
| IT-PM-OpenAdaptronik/Webapp | apps/calc/apps.py | Python | mit | 88 |
from __future__ import print_function, absolute_import
import os.path as osp
from ..utils.data import Dataset
from ..utils.osutils import mkdir_if_missing
from ..utils.serialization import write_json
class Market1501(Dataset):
url = 'https://drive.google.com/file/d/0B8-rUzbwVRk0c054eEozWG9COHM/view'
md5 = '6... | dapengchen123/code_v1 | reid/datasets/market1501.py | Python | mit | 3,563 |
#!/usr/bin/env python
"""plot_softmax_results.py: Plot results of mnist softmax tests."""
from helper_scripts.mnist_read_log import plot_results
import matplotlib.pyplot as plt
# Produce cross entropy and accuracy plots for softmax models.
# Requires the training data for each of the models.
files = [r"""../mnist_s... | hutcho66/imagerecognition | softmax_scripts/plot_softmax_results.py | Python | mit | 636 |
import requests
import json
import time
from collections import OrderedDict
from test_framework.test_framework import OpenBazaarTestFramework, TestFailure
class CompleteDirectOnlineTest(OpenBazaarTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 2
def run_test(self):
... | duomarket/openbazaar-test-nodes | qa/complete_direct_online.py | Python | mit | 9,485 |
# Copyright (c) 2011 matt
# Copyright (c) 2011 Paul Colomiets
# Copyright (c) 2011-2014 Tycho Andersen
# Copyright (c) 2012 dmpayton
# Copyright (c) 2012 hbc
# Copyright (c) 2012 Tim Neumann
# Copyright (c) 2012 uberj
# Copyright (c) 2012-2013 Craig Barnes
# Copyright (c) 2013 Tao Sauvage
# Copyright (c) 2014 Sean Vig
... | flacjacket/qtile | libqtile/widget/battery.py | Python | mit | 16,807 |
from utils import *
import sys
class FRISCProcessor:
def __init__( self, mem_size, program = None ):
self.MEM_SIZE = mem_size
self.SP = '111'
self.memory = []
self.annotations = []
self.registers = {}
self.last_changed_address = -1
self.flags = {
... | zjurelinac/pyFrisc | simulator.py | Python | mit | 11,657 |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import re
import fnmatch
import sys
import subprocess
import datetime
import os
#############################... | gautes/TrollCoinCore | contrib/devtools/copyright_header.py | Python | mit | 22,402 |
import logging
import os
import utils
def initialize(output_dir, reset=True):
all_path = os.path.join(output_dir, 'all.log')
error_path = os.path.join(output_dir, 'error.log')
if reset:
utils.safe_remove(all_path)
utils.safe_remove(error_path)
logger = logging.getLogger()
logger.... | arantes555/oblivious-movie-gharial | logger.py | Python | mit | 1,214 |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | levibostian/myBlanky | googleAppEngine/google/appengine/tools/dev_appserver_apiserver.py | Python | mit | 53,339 |
# -*- coding: utf-8 -*-
__version__ = "0.6.2"
from ._ranges import UNASSIGNED_RANGES
from .api import (
available_good_ports,
available_ports,
is_available,
good_port_ranges,
port_is_used,
select_random,
get_port,
)
from .store import PortStore
from .exceptions import PortForException
__al... | kmike/port-for | src/port_for/__init__.py | Python | mit | 548 |
import bencode
import hashlib
import math
import os
import sys
def main(argv):
announce = argv[1]
filename = argv[2]
piece_length = 2 ** int(argv[3])
length = os.path.getsize(filename)
data = {
'announce': announce.encode('ascii'),
'info': {
'length': length,
... | nickfrostatx/bt-demo | mktorrent.py | Python | mit | 785 |
import pytest
import os
def test_launch (launch):
serve = '../../atila/example/serve.py'
if not os.path.isfile (serve):
return
with launch (serve) as engine:
for i in range (2):
resp = engine.axios.get ('/apis/rest-api{}'.format (i == 1 and 2 or ''))
assert resp.sta... | hansroh/skitai | tests/level4/test_late_respond.py | Python | mit | 675 |
#!/usr/bin/env python
## Some necessary imports
from __future__ import print_function
from commands import getoutput
from time import sleep
from os.path import expanduser
import os
import re
from datetime import datetime
import process_lock as pl
###
## Configuration options
script_location = os.path.dirname(os.pa... | Bolt64/proxy_switcher | proxy_autoconfig.py | Python | mit | 3,103 |