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 |
|---|---|---|---|---|---|
'''
Author: Peter Chip (furamail001@gmail.com)
Date: 2015 03 25
Given: Positive integers n≤100 and m≤20.
Return: The total number of pairs of rabbits that will remain after the n-th month if all rabbits live for m months.
Theory: The standard fibonacci series : 1 1 2 3 5 8 13
fn = fn-1 + fn-2
In re... | amidoimidazol/bio_info | Rosalind.info Problems/Mortal Fibonacci Rabbits.py | Python | mit | 1,178 |
import _plotly_utils.basevalidators
class MetaValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(self, plotly_name="meta", parent_name="parcats", **kwargs):
super(MetaValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
array_ok=k... | plotly/plotly.py | packages/python/plotly/plotly/validators/parcats/_meta.py | Python | mit | 435 |
import logging
import traceback
import numpy as np
from eemeter.structures import EnergyTrace
logger = logging.getLogger(__name__)
class SplitModeledEnergyTrace(object):
''' Light wrapper around models applicable to a single trace which
fits and predicts multiple models for different segments.
Paramet... | impactlab/eemeter | eemeter/modeling/split.py | Python | mit | 7,118 |
#!/usr/bin/python
import sys
a = int(raw_input().strip())
b = int(raw_input().strip())
print (a / b)
print (float(a) / float(b))
| nabin-info/hackerrank.com | python-division.py | Python | mit | 132 |
"""empty message
Revision ID: c05ed437b768
Revises: 006a83e83b1a
Create Date: 2016-10-14 09:56:26.984816
"""
# revision identifiers, used by Alembic.
revision = 'c05ed437b768'
down_revision = '006a83e83b1a'
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
def upgrade():
### commands auto... | rafasis1986/EngineeringMidLevel | migrations/versions_/c05ed437b768_.py | Python | mit | 830 |
#!/usr/bin/python
import RPi.GPIO as GPIO
class keypad():
def __init__(self):
"""
Initialisiert Key-Matrix
Angepasst von Christian Mossberg
"""
GPIO.setmode(GPIO.BOARD)
self.KEYPAD = [
[1,2,3,"A"],
[4,5,6,"B"],
[7,... | MrMosi/TuersystemClient | Module/Keypad/keypad.py | Python | mit | 2,815 |
#!/usr/bin/env python
# -*- -*-
import requests
import json
members_file = open('members.json', 'r')
members_data = json.loads(members_file.read())
graph_url = "http://graph.facebook.com/"
data = {}
for member in members_data:
img_url = requests.get(
graph_url +
str(member['fbid']) + '/p... | manojpandey/devsoc-matrix | data_updater.py | Python | mit | 556 |
#!/usr/bin/env python
from pathlib import Path
import nbrun
default_notebook_name = 'smFRET-PAX_single_pop.ipynb'
def run_analysis(data_filename, input_notebook=None, save_html=False,
working_dir=None, suffix='', dry_run=False):
"""
Run analysis notebook on the passed data file.
Argume... | multispot-software/transfer_convert | analyze.py | Python | mit | 3,069 |
import sys
sys.path.append("..")
from deflate import fix_star_rating
# The beatmap that you are checking and fixing inflated patterns for
beatmap_path = "./necro.osu"
# The new difficulty name (Version) of the beatmap
new_difficulty_name = "star rating fix"
# The output file path of the beatmap
output_path = "./nec... | Swan/ManiaStarReducer | test/example.py | Python | mit | 398 |
import hashlib
import random
import urllib.parse
import os
from twisted.internet import defer, reactor, protocol
from twisted.python import log, failure
try:
from twisted.words.xish import domish, utility
except Exception:
from twisted.xish import domish, utility # noqa
from twisted.web import http
from twis... | twonds/punjab | punjab/httpb_client.py | Python | mit | 12,339 |
# encoding: utf8
from __future__ import unicode_literals
import re
_ALPHA_LOWER = """
a ä à á â ǎ æ ã å ā ă ą b c ç ć č ĉ ċ c̄ d ð ď e é è ê ë ė ȅ ȩ ẽ ę f g ĝ ğ h i ı
î ï í ī ì ȉ ǐ į ĩ j k ķ l ł ļ m n ñ ń ň ņ o ö ó ò ő ô õ œ ø ō ő ǒ ơ p q r ř ŗ s
ß ś š ş ŝ t ť u ú û ù ú ū ű ǔ ů ų ư v w ŵ x y ÿ ý ỳ ŷ ỹ z ź ž ż þ
"""
... | banglakit/spaCy | spacy/language_data/punctuation.py | Python | mit | 2,781 |
shortcuts = {}#{'/Users/zkbt/Cosmos/Data/Magellan/LDSS3':'...'}
import craftroom.Talker
craftroom.Talker.shortcuts = shortcuts
#craftroom.Talker.line = 200
Talker = craftroom.Talker.Talker
import astropy.io.fits, astropy.io.ascii, astropy.time
from astropy import time, coordinates as coord, units as u
import matplotl... | zkbt/mosasaurus | mosasaurus/imports.py | Python | mit | 1,446 |
#! /usr/bin/env python3
import ast
import glob
import warnings
import numpy as np
from typing import List, Tuple
from .observable_plotter import observable_file_reader
from .numerical_sort import numerical_sort
def _find_data_files(pattern: str) -> List[str]:
"""Find files that match the pattern."""
file_lis... | hmedina/KaSaAn | KaSaAn/functions/observable_coplotter.py | Python | mit | 6,362 |
"""Model definitions for MNIST"""
# pylint: disable = C0301, C0103, R0914, C0111
import os
import sys
import tensorflow as tf
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from mnist_vae.src import model_def as mnist_vae_model_def
from mnist_e2e.model_def import end_to_end
def construct_gen(hparams... | AshishBora/csgm | src/mnist_model_def.py | Python | mit | 867 |
# pytodo settings file
# project name
project_name = "pytodo"
# Extra Header
extra_header = ""
# Extra Footer
extra_footer = "-----------------------------\ngenereated with pytodo"
# add scripts that you want pytodo to process.
scripts = (#'script1',
#'script2',
#'path/to/script3',
... | beshrkayali/pytodo | pytodo/pytodo_settings.py | Python | mit | 343 |
"""
Django settings for project on Heroku. For more info, see:
https://github.com/heroku/heroku-django-template
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/
"""
i... | pannkotsky/groupmate | backend/settings/common.py | Python | mit | 6,088 |
import os
import simplejson as json
import datetime
from utils.common import PageType, DbEngine
from app.models import Base, SubredditPage, FrontPage
def construct_rank_vectors(pages):
rank_vectors = {} # {pid: {time: rank}}
for page in pages:
posts = json.loads(page.page_data)
for i,post ... | c4fcm/CivilServant | app/time_on_page_script.py | Python | mit | 3,564 |
# FILE: highlighter.py
# AUTHOR: Keita Nakamura
# License: MIT license
import os
import re
import subprocess
import neovim
@neovim.plugin
class Highlighter:
def __init__(self, vim):
self.vim = vim
self.is_started = False
def init_members(self):
self.vim.call('g:highlighter#initiali... | KeitaNakamura/highlighter.nvim | rplugin/python3/highlighter/__init__.py | Python | mit | 4,405 |
short_name = "godot"
name = "Godot Engine"
major = 2
minor = 1
patch = 4
status = "beta"
| pixelpicosean/my-godot-2.1 | version.py | Python | mit | 89 |
from StrongHold import Newick
def child_prob(a,b):
'''Returns the genotype probability for a child with parents who have genotype probabilities a and b.'''
# Comes from the conditional probability of each possible Punit square.
AA = a[0]*b[0] + 0.5*(a[0]*b[1] + a[1]*b[0] + 0.5*a[1]*b[1])
Aa = a[0]*b[2] + a[2]*b[0]... | crf1111/Bio-Informatics-Learning | Bio-StrongHold/src/Inferring_Genotype_from_a_Pedigree.py | Python | mit | 1,261 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-04 22:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('domain_api', '0009_remove_topleveldomain_slug'),
]
operations = [
migration... | heytrav/drs-project | domain_api/migrations/0010_topleveldomain_slug.py | Python | mit | 478 |
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from fontTools.misc.fixedTools import fixedToFloat, floatToFixed
from fontTools.misc.textTools import safeEval
import array
import io
import logging
import struct
import sys
# https://www.microsoft.com/typography/otspec... | Pal3love/otRebuilder | Package/otRebuilder/Dep/fontTools/ttLib/tables/TupleVariation.py | Python | mit | 21,422 |
class Cell:
def __init__(self, coord):
self._coord = coord
self._neighbors = [None, None, None, None]
self._value = None
self._initial_value = False
self._valid_values = None
self._marks = set()
self._active = False
self._valid = True
se... | basvandenberg/puzzlepy | puzzlepy/cell.py | Python | mit | 1,875 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
r"""
# .---. .-----------
# / \ __ / ------
# / / \( )/ ----- (`-') _ _(`-') <-. (`-')_
# ////// '\/ ` --- ( OO).-/( (OO ).-> .-> \( OO) ) .->
# //// / // : : --- (,------... | edonyM/emthesis | code/num2iter.py | Python | mit | 3,819 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/managementpartner/azure-mgmt-managementpartner/azure/mgmt/managementpartner/models/_models.py | Python | mit | 7,226 |
import os
from datetime import timedelta
ROLLBAR_ACCESS_TOKEN = os.environ.get('ROLLBAR_ACCESS_TOKEN')
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL', 'postgres:///dynoup')
FERNET_SECRET = os.environ.get('FERNET_SECRET')
CELERY_BROKER_URL = os.environ.get('REDIS_URL', 'redis://')
CELERY_TASK_SERIALIZER = ... | sibson/dynoup | settings.py | Python | mit | 470 |
from django.db import models
from aquaticore.databases.models import Database
from aquaticore.authors.models import Author
class Reference(models.Model):
title = models.CharField(max_length=200)
source = models.CharField(max_length=200)
year = models.IntegerField(4)
author = models.ForeignKey('authors.Author')
da... | rockerBOO/aquaticore | aquaticore/references/models.py | Python | mit | 542 |
import pkgutil
def get_plugins(plugins_module):
plugins = {}
prefix = plugins_module.__name__ + "."
for importer, modname, ispkg in pkgutil.iter_modules(plugins_module.__path__,
prefix):
module = importer.find_module(modname).load_module(mod... | Habidatum/slayer | slayer/plugin_loader.py | Python | mit | 421 |
from __future__ import division, absolute_import
import numpy as np
from numpy.matlib import eye
class matrixops():
def __init__(self):
self.LnDetPsi = None
self.Psi = np.zeros((self.n, self.n), dtype=np.float)
self.psi = np.zeros((self.n, 1))
self.one = np.ones(self.n)
se... | DailyActie/Surrogate-Model | 01-codes/pyKriging-master/pyKriging/matrixops.py | Python | mit | 4,375 |
# -*- coding: utf-8 -*-
import hook
import bnetprotocol
from misc import *
from config import config
#settings = config[__name__.split('.')[-1]]
def message_received(bn, d):
if d.event == bnetprotocol.EID_TALK:
msg_list = str(d.message).split(' ', 1)
try:
command, payload = msg_list
except ValueError:
... | w3gh/ghost.py | plugins/join.py | Python | mit | 716 |
from __future__ import print_function, unicode_literals
import argparse
import json
import sys
import textwrap
from tagalog import io, stamp, tag, fields
from tagalog import shipper
parser = argparse.ArgumentParser(description=textwrap.dedent("""
Ship log data from STDIN to somewhere else, timestamping and prepro... | nickstenning/tagalog | tagalog/command/logship.py | Python | mit | 1,992 |
################################################################################
# Copyright (C) 2014 Jaakko Luttinen
#
# This file is licensed under the MIT License.
################################################################################
"""
"""
import numpy as np
from bayespy.utils import misc
from .nod... | bayespy/bayespy | bayespy/inference/vmp/nodes/gate.py | Python | mit | 7,980 |
import numpy as np
from .cosmology import *
from ..Ks_Mstar_Estimate import zmeans
def func1(x):
return x * c_light
def func2(x):
return x + zmeans | gjsun/MPack | MPack_Core/utils/test.py | Python | mit | 153 |
## p7.py - parallel processing microframework
## (c) 2017 by mobarski (at) gmail (dot) com
## licence: MIT
## version: ex4 (simple fan-in of subprocess outputs)
from __future__ import print_function
# CONFIG ###################################################################################
HEAD_LEN_IN = 2
HEAD_LEN_... | mobarski/sandbox | parallel/p7ex4.py | Python | mit | 2,120 |
import unittest
class ATest(unittest.TestCase):
def setUp(self):
print("setup")
pass
def test_a(self):
self.assertTrue(True)
def tearDown(self):
print("tear down")
if __name__ == "__main__":
print("masher_test.py")
unittest.main() | bonattt/name-masher | tests/masher_test.py | Python | mit | 289 |
from undefined import unknown
k = 1
l = []
class OldStyle:
def meth1(self):
pass
a1 = k
a2 = l
a3 = unknown
l = l
class OldStyleDerived(OldStyle):
def meth2(self):
pass
class NewStyle(object):
def meth3(self):
pass
a1 = k
a2 = l
... | github/codeql | python/ql/test/library-tests/classes/attr/test.py | Python | mit | 1,199 |
def calc_approve( pool, area, age, group, amount, percent ):
debug=False
print("calculating results")
approve=0.65
decline=0.35
approve *= list_pool[pool][0]
decline *= list_pool[pool][1]
approve *= list_area[area][0]
decline *= list_area[area][1]
approve *= list_age[age][0]
decline *= list_age[age][1]... | mrcl/HakketyYaks | app/grant_hunter_vars.py | Python | mit | 2,621 |
from Card import Card
#Deck
class Deck(Card):
'''Definition of a card deck.'''
from random import shuffle as rShuffle
def __init__(self,hasJoker=False):
#Assemble deck
self.cards = [Card(v,s) for v in self.values for s in self.suits]
#Add Joker cards (2) as 'WW' if needed
#if(hasJoker):
# self.cards.exte... | VictorLoren/Crak-card-game-python | Deck.py | Python | mit | 803 |
#! /usr/bin/env python
import os
from function import function
import speech_recognition as sr
from server import EmailServer
from pygame import mixer
from subprocess import call
from send import SendEmail
from detect import face_rec
from face import face_detect
from trainer import face_train
mixer.init(... | yahya-idriss/Python-Personal-assistant | start.py | Python | mit | 4,231 |
# -*- coding: utf-8 -*-
import logging
from sipa.model.user import BaseUser
from sipa.model.finance import BaseFinanceInformation
from sipa.model.fancy_property import active_prop, connection_dependent, \
unsupported_prop, ActiveProperty, UnsupportedProperty, Capabilities
from sipa.model.misc import PaymentDetails... | agdsn/sipa | sipa/model/pycroft/user.py | Python | mit | 13,407 |
#!/usr/bin/python
def renderJson(status, body)
print "Status: ", status
print "Content-Type: application/json"
print "Content-Length: %d" % (len(body))
print ""
print body
renderJson("200 OK", "{foo: 'bar'}") | freizeitnerd/sprinkler | www/cgi-bin/cgi-switch-valve.py | Python | mit | 222 |
from flask.ext.wtf import Form
from wtforms import StringField, BooleanField, SelectField, PasswordField, TextField, FileField
from wtforms.fields.html5 import DateField
from wtforms.validators import DataRequired
class LoginForm(Form):
username = StringField('username', validators=[DataRequired()])
password ... | jvalinsky/Kumquat | app/forms.py | Python | mit | 1,886 |
import datetime
import unittest
import pytz
from ...rules.workdayrules import WorkDayRule
from ...businesstimedelta import BusinessTimeDelta
class RuleTest(unittest.TestCase):
def setUp(self):
self.pst = pytz.timezone('US/Pacific')
self.utc = pytz.timezone('UTC')
self.workdayrule = WorkDay... | seppemans/businesstimedelta | businesstimedelta/test/rules/rule_tests.py | Python | mit | 2,751 |
#!/usr/bin/env python
# Fan control mod for Raspberry Pi
import RPi.GPIO as GPIO, time, datetime, subprocess, os, logging
from daemon import runner
DEBUG = 1
GPIO.setmode(GPIO.BCM)
# Respective ports on the GPIO header
FAST = 18
SLOW = 25
# Default settings for fan control
MAX_TEMP = 50
MIN_TEMP = 40
POLL_TIME =... | zainag/RPi-Test-Projects | fan_control_daemon.py | Python | mit | 2,129 |
# -*- coding: utf-8 -*-
# <standard imports>
from __future__ import division
import random
import otree.models
import otree.constants
from otree.db import models
from otree import widgets
from otree.common import Currency as c, currency_range, safe_json
from otree.constants import BaseConstants
from otree... | NlGG/experiments | Experimental Games on Networks/otree_code/network/models.py | Python | mit | 3,635 |
# Author: Almero Gouws <14366037@sun.ac.za>
"""
This is a tutorial on how to create a Bayesian network, and perform
exact MAX-SUM inference on it.
"""
"""Import the required numerical modules"""
import numpy as np
"""Import the GrMPy modules"""
import models
import inference
import cpds
if __name__ == '_... | bhrzslm/uncertainty-reasoning | my_engine/others/GrMPy/lib/GrMPy/Examples/Discrete/BNET/Inference/Exact/Tut_BNET_maxsum.py | Python | mit | 3,090 |
"""Module grouping session scoped PyTest fixtures."""
import datetime
import glob
import os
import tempfile
import owslib
import pytest
from _pytest.monkeypatch import MonkeyPatch
from owslib.etree import etree
from owslib.feature.schema import _construct_schema, _get_elements
from owslib.iso import MD_Metadata
from ... | DOV-Vlaanderen/pydov | tests/conftest.py | Python | mit | 15,105 |
# python v. 3.3.2
import random
def genSuit():
suit = random.randint(1, 4)
if suit == 1:
return "Clubs"
if suit == 2:
return "Diamonds"
if suit == 3:
return "Hearts"
if suit == 4:
return "Spades"
return "Whoops!"
def genRank():
rank = random.randint(1, 13)
... | mddenton/Projects-my | Games/blackjack.py | Python | mit | 1,541 |
'''
Created on 16.11.2011
@author: michi
'''
from PyQt4.QtCore import pyqtSlot, QDateTime
from PyQt4.QtNetwork import QNetworkReply, QNetworkRequest
from ems.qt4.location.maps.tiled.geotiledmapreply import GeoTiledMapReply
class GeoMapReplyNokia(GeoTiledMapReply):
_m_reply = QNetworkReply
def __ini... | mtils/ems | ems/qt4/location/plugins/nokia/geomapreply_nokia.py | Python | mit | 2,504 |
from MorcoWrapper2D.mw2_Script import *
from MorcoWrapper2D.mw2_Input import *
from MorcoWrapper2D.mw2_Application import *
from MorcoWrapper2D.mw2_Text import *
class ExampleManager (mw2_Script):
def __init__(self):
mw2_Script.__init__(self)
self.mCamera = None
self.mBall = None
self.mCameraSpeed = 150
se... | MorcoFreeCode/2014__MorcoWrapper2D | full_project/2D/6. Cocos2D [Python2]/ProjectExample/ExampleManager.py | Python | mit | 2,691 |
#!/usr/bin/env python
#
# $Id: ImportTest.py 4183 2011-01-03 20:17:03Z dhh1969 $
#
# Proprietary and confidential.
# Copyright $Date:: 2011#$ Perfect Search Corporation.
# All rights reserved.
#
import unittest, os, tempfile, subprocess, sys
from testsupport import checkin, CODEROOT
CODE_FOLDER = CODEROOT + '/buildscr... | perfectsearch/sandman | test/buildscripts/import_test.py | Python | mit | 1,871 |
from checkio_referee import RefereeBase, ENV_NAME
import settings_env
from tests import TESTS
cover = """def cover(func, data):
return func(set(str(x) for x in data))
"""
def set_repr(data, f):
return repr("{}({})".format(f, set(data["input"])))
class Referee(RefereeBase):
TESTS = TESTS
ENVIRONME... | Empire-of-Code-Puzzles/checkio-empire-pawn-brotherhood | verification/src/referee.py | Python | mit | 594 |
#!/usr/bin/env python
import subprocess
# Example on how to use this script.
# ./tellWords.py [ and press enter]
# In the prompt line type what you want and press enter again.
command = "say"
text = raw_input("Enter word or a sentence and press enter: ")
characters = list(text)
for c1 in characters:
if c1 == " ... | Amitmund/quick_tools | tellWords/tellWords.py | Python | mit | 438 |
import autocomplete_light
from django.contrib.auth.models import User
autocomplete_light.register(User,
search_fields=['^first_name', 'last_name', 'username'],
autocomplete_js_attributes={'placeholder': 'aluno...'}
) | holocronifrn/fiji | refeicao/autocomplete_light_registry.py | Python | mit | 225 |
import tensorflow as tf
import sys, os, shutil
class Config(object):
def __init__(self, args):
self.codebase_root_path = args.path
sys.path.insert(0, self.codebase_root_path)
#### Directory paths ####
# Folder name and project name is the same
self.project_name = args.pro... | yashchandak/GNN | Sample_Run/path_attn/Config.py | Python | mit | 4,900 |
from models.keyword import Keyword
from models.document import Document
from models.collection import Collection
from bitmessage.bitmessage import Bitmessage
from models.fj_message import FJMessage
from models.signature import Signature
from cache.cache import Cache
from config import DOCUMENT_DIRECTORY_PATH, MAIN_CHAN... | FreeJournal/freejournal | controllers/controller.py | Python | mit | 15,637 |
# this is based in the audio recording example provided by omz (Ole Zorn)
from objc_util import *
import os
def main():
AVAudioSession = ObjCClass('AVAudioSession')
NSURL = ObjCClass('NSURL')
AVAudioRecorder = ObjCClass('AVAudioRecorder')
shared_session = AVAudioSession.sharedInstance()
category_set = shared_sess... | shaun-h/pythonista-objc-utils | Audio Recording.py | Python | mit | 1,104 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
from winsys._compat import unittest
import uuid
import winerror
import win32api
import win32con
import win32evtlog
import win32security
import pywintypes
from winsys.tests import utils as testutils
from winsys import event_logs, registry, uti... | operepo/ope | laptop_credential/winsys/tests/test_event_logs.py | Python | mit | 6,794 |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'PhotoPortfolio.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^[/]{0,1}$', 'photos.views.browse'),
url(r'^/gallery/([\w]*)', 'photos.views.gallery'),
) | tsitra/PhotoPortfolio | photos/urls.py | Python | mit | 304 |
docs = """django-angular-scaffold
=======================
[](https://travis-ci.org/mc706/django-angular-scaffold)
[](http://badge.fury.io/py/django-angular-scaffold... | mc706/django-angular-scaffold | angular_scaffold/_docs.py | Python | mit | 4,321 |
from selenium import webdriver
from SenseCells.tts import tts
def open_firefox():
tts('Aye aye captain, opening Firefox')
webdriver.Firefox()
| Melissa-AI/Melissa-Web | GreyMatter/open_firefox.py | Python | mit | 152 |
# /container-setup.py
#
# Initial setup script specific to polysquare-travis-container. Creates
# a cache dir in the container and sets the
# _POLYSQUARE_TRAVIS_CONTAINER_TEST_CACHE_DIR environment variable
# to point to it.
#
# See /LICENCE.md for Copyright information
"""Initial setup script specific to polysquare-ci... | polysquare/polysquare-travis-container | container-setup.py | Python | mit | 1,494 |
from ml_buff.database import session_scope
from ml_buff.models import feature, feature_value, input_data, base_feature_record
from ml_buff.helpers.feature_value_helper import FeatureValueHelper
class TestFeature1(base_feature_record.BaseFeatureRecord):
def calculate(self, input_data):
return [1]
class Tes... | tinenbruno/ml-buff | tests/helpers/feature_value_helper_test.py | Python | mit | 2,534 |
from flask import url_for
from app.testing import BaseTestCase
import json
class TodoTests(BaseTestCase):
def test_get_all_tasks(self):
"""Test intended to pull all tasks, ensure status 200 response,
and that the list is a lenght of 2"""
with self.client:
tasks = [{'title': "Ge... | configuresystems/restful-api-with-flask | app/modules/todo/tests.py | Python | mit | 5,136 |
#!/usr/bin/python
import sys
import socket
import traceback
import urllib
import struct
def build_exploit(shellcode):
req = "GET / HTTP/1.0\r\n" + \
"Evil: {evil}\r\n" + \
"Host: birk105.studby.uio.no:81\r\n\r\n"
# 536 is first address that causes the server to not return a valid response
req = req.rep... | nmahlangu/cs263-project-one | exploit-2c.py | Python | mit | 1,279 |
#!/usr/bin/env python2
import os, sys, time, subprocess, threading
from struct import pack
import kismetclient, netifaces, requests
led_device='/dev/serial/by-id/pci-FTDI_USB__-__Serial-if00-port0'
ppp_iface = 'ppp0'
ovpn_iface = 'tun.bukavpn'
uplink_usb_id = '1199:68a3'
storage_usb_id = '152d:2336'
external_url = 'h... | mgrela/whitestar | ansible/roles/whitestar/files/bin/whitestar-watchdog.py | Python | mit | 7,240 |
"""Classes required to create a Bluetooth Peripheral."""
# python-bluezero imports
from bluezero import adapter
from bluezero import advertisement
from bluezero import async_tools
from bluezero import localGATT
from bluezero import GATT
from bluezero import tools
logger = tools.create_module_logger(__name__)
class... | ukBaz/python-bluezero | bluezero/peripheral.py | Python | mit | 6,857 |
from .api import Projection, execute_etl
from .grammar import parse_query
from .nxprojx import (reset_index, match, traverse, project, transfer,
combine, build_subgraph, NXProjector)
from .utils import (test_graph, project_etl, transfer_etl, combine_etl,
multi_transform_etl, dr... | davebshow/projx | projx/__init__.py | Python | mit | 434 |
# -*- coding: utf-8 -*-
# Simple Bot (SimpBot)
# Copyright 2016-2017, Ismael Lugo (kwargs)
import re
import sys
import ssl
import time
import logging
import socket
from six import binary_type
from six import string_types
from six import PY3 as python3
from six.moves import _thread
from six.moves import queue
from . ... | IsmaelRLG/simpbot | simpbot/irc.py | Python | mit | 16,036 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-05-15 06:18
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pages', '0002_auto_20160512_0259'),
]
operations = [
migrations.CreateModel(... | samdowd/drumm-farm | pages/migrations/0003_auto_20160515_0618.py | Python | mit | 2,802 |
"""
@author: Gaetan Hadjeres
"""
import torch
from torch.autograd import Variable
def cuda_variable(tensor, volatile=False):
if torch.cuda.is_available():
return Variable(tensor.cuda(), volatile=volatile)
else:
return Variable(tensor, volatile=volatile)
def to_numpy(variable: Variable):
... | Ghadjeres/DeepBach | DeepBach/helpers.py | Python | mit | 816 |
import logging
from pip._internal.build_env import BuildEnvironment
from pip._internal.distributions.base import AbstractDistribution
from pip._internal.exceptions import InstallationError
from pip._internal.utils.subprocess import runner_with_spinner_message
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
... | nataddrho/DigiCue-USB | Python3/src/venv/Lib/site-packages/pip/_internal/distributions/sdist.py | Python | mit | 4,077 |
maze = {}
counter = 1
for i in range(input()):
u_i = raw_input()
u_i = [int(x) for x in u_i.split(" ")][::-1]
maze[counter] = u_i[1:]
counter += 1
def run_maze(start, path=[]):
global maze
graph = maze
for node in maze[start]:
path.append(node)
| jacksarick/My-Code | Events/CCC/Q2.py | Python | mit | 256 |
# Author: Edison Huang
# Email: hom.tao@yahoo.com
#
# Example:
# def main():
# from CmdArgumentsHelper import CmdArgumentsHelper;
# arg_helper = CmdArgumentsHelper();
# arg_helper.add_argument('query', 'q', 'query', 1);
# args = arg_helper.read_arguments();
#
# query_string = args['query'];
# ... mani... | crmauceri/VisualCommonSense | code/database_builder/tools/cmd_arguments_helper.py | Python | mit | 1,911 |
"""
Implementation of several spatial models running on a lattice
"""
import numpy as np
from tqdm import tqdm
class CellularAutomaton(object):
""" General CA class
"""
def __init__(self, lattice):
self.lattice = lattice
def setup(self):
""" This function is called before any itera... | kpj/PySpaMo | automata.py | Python | mit | 3,756 |
try:
entry=int(input("Enter the number: \n"))
i=entry
x=entry
#biggest number
status=[]
while(i!=1):
#end
status.append(i)
if i%2==0:
i=int(i/2)
else:
i=3*i+1
if(i>x):
x=i
status.append(i)
print(*status)
p... | ozturkemre/programming-challanges | 15-CollatzConjecture/CollatzConjecture.py | Python | mit | 409 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | rjschwei/azure-sdk-for-python | azure-mgmt-logic/azure/mgmt/logic/models/as2_message_connection_settings.py | Python | mit | 2,072 |
from __future__ import division
from libtbx.command_line import easy_qsub
from misc_scripts import helpers
from misc_scripts.r_factor_calc import *
from iotbx import pdb
import cPickle as pickle
import random
import os,sys
def run():
# convert the path to python format
directory_path = '/net/cci/youval/Work/work... | youdar/work | work/Clashes/Old work/submit_clashscore_compare_to_queue.py | Python | mit | 2,675 |
"""Stub for the zeroconf library.
As zeroconf does not provide a stub or mock, this implementation will serve as
stub here. It can fake immediate answers for any service.
"""
from zeroconf import ServiceInfo
class ServiceBrowserStub:
"""Stub for ServiceBrowser."""
def __init__(self, zeroconf, service_type, ... | postlund/pyatv | tests/zeroconf_stub.py | Python | mit | 1,543 |
#!/usr/bin/env python
import os.path
import sys
import argparse
from poretools.Fast5File import *
#logger
import logging
logger = logging.getLogger('poreminion')
# poreminion imports
import poreminion.version
def run_subtool(parser, args):
if args.command == 'uncalled':
import findUncalled as submodule
... | JohnUrban/poreminion | poreminion/poreminion_main.py | Python | mit | 59,570 |
import heapq
import sys
filename = "Median.txt"
lst = [int(l) for l in open(filename)]
H_low = []
H_high = []
sum = 0
for num in lst:
if len(H_low) > 0:
if num > -H_low[0]:
heapq.heappush(H_high, num)
else:
heapq.heappush(H_low, -num)
else:
heapq.heappush(H_low, -num)
if len(H_low) > len(H_high) + 1:
... | xala3pa/my-way-to-algorithms | graphs/hash/python/median.py | Python | mit | 489 |
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
from rest_framework.authtoken.models import Token
from workflows.models.workflow import Workflow
class UserProfile(models.Model):
user = models.OneToOneFiel... | xflows/clowdflows-backend | workflows/models/user_profile.py | Python | mit | 1,084 |
from .visitor import Visitor
from .metavisitor import MetaVisitor
from .experiments import ExperimentsVisitor
from .usedby import UsedByVisitor
from .testedscenarios import TestedScenariosVisitor
from .invalidentities import InvalidEntitiesVisitor
# from presenter.gesurvey import GESurveyPresenter
| stlemme/python-dokuwiki-export | visitor/__init__.py | Python | mit | 301 |
#!/usr/bin/python
# encoding: utf-8
import sys
from gist import create_workflow, set_github_token
from workflow import Workflow, web
from workflow.background import run_in_background, is_running
def main(wf):
arg = wf.args[0]
if len(arg) > 0:
token = wf.args[0]
set_github_token(wf, token)
i... | danielecook/gist-alfred | set_info.py | Python | mit | 400 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class MountPoint(type):
"""Base mount-point for every plugin.
See: http://martyalchin.com/2008/jan/10/simple-plugin-framework/
"""
def __init__(cls, name, bases, attrs):
if not hasattr(cls, 'plugins'):
# This branch only executes when... | michalbachowski/pyspd | src/pyspd/__init__.py | Python | mit | 839 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'MODEL1011090002.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/MODEL1011090002 | MODEL1011090002/model.py | Python | cc0-1.0 | 427 |
#!/usr/bin/python
import argparse
import requests,json
from requests.auth import HTTPBasicAuth
from subprocess import call
import time
import sys
import os
from vas_config_sw1 import *
DEFAULT_PORT='8181'
USERNAME='admin'
PASSWORD='admin'
OPER_OVSDB_TOPO='/restconf/operational/network-topology:network-topology/topo... | opendaylight/faas | demos/env_mininet/lsw1Demo.py | Python | epl-1.0 | 6,912 |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | sadanandb/pmt | src/pyasm/web/__init__.py | Python | epl-1.0 | 931 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import functools
views = {}
def collectView(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
self = args[0]
if hasattr(self, 'viewID'):
views.update({self.viewID: self})
func(*args, **kwargs)
return wrappe... | dragondjf/musicplayer | gui/utils/__init__.py | Python | gpl-2.0 | 619 |
# -*- coding: utf-8 -*-
import requests, re, json, time, datetime, traceback, random
from pyquery import PyQuery as pq
# host = "www.a.com:8000"
host = "www.zhixuan.com"
headers = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36"}... | lantianlz/zx | www/stock/sync_stock_data_client.py | Python | gpl-2.0 | 1,935 |
import unittest
class TestTeiTag(unittest.TestCase):
pass
class TestFmtTag(unittest.TestCase):
pass
class TestRendTag(unittest.TestCase):
pass
class TestDeleteMe(unittest.TestCase):
pass
class TestDontTouchMe(unittest.TestCase):
pass
class TestReplaceMeWText(unittest.TestCase):
pass
class... | thomasowenmclean/tei_transformer | tests/test_tags.py | Python | gpl-2.0 | 362 |
def a(*args, **kwargs):
print("hello world")
| softwaremechanic/Miscellaneous | Python/hw.py | Python | gpl-2.0 | 49 |
# Copyright (C) 2011 Michal Zielinski (michal@zielinscy.org.pl)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is d... | zielmicha/freeciv-android | lib/freeciv/client/actions.py | Python | gpl-2.0 | 10,344 |
# Distributed under the MIT licesnse.
# Copyright (c) 2013 Dave McCoy (dave.mccoy@cospandesign.com)
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without lim... | CospanDesign/verilog-visualizer | verilogviz/view/graph/graphics_view.py | Python | gpl-2.0 | 2,510 |
# Copyright (C) 2013-2014 Fox Wilson, Peter Foley, Srijay Kasturi, Samuel Damashek, James Forcier and Reed Koser
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the Licen... | sckasturi/saltlake | commands/time.py | Python | gpl-2.0 | 1,137 |
import os
import sys
import random
import logging
import signal
main_path = os.path.abspath (os.path.dirname (__file__))
prev_path = main_path + "/.."
sys.path.append (prev_path)
from utils import _redis_connect, log_init
from command import *
from RedisHelper import RedisServer
from Config import Config
from sipcore ... | sipdbg/sipdbg | server/main_server.py | Python | gpl-2.0 | 6,551 |
#!/usr/bin/python
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#|R|a|s|p|b|e|r|r|y|P|i|-|S|p|y|.|c|o|.|u|k|
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#
# ultrasonic_1.py
# Measure distance using an ultrasonic module
#
# Author : Matt Hawkins
# Date : 09/01/2013
# Import required Python libraries
import time
impor... | championswimmer/minor-1-piBot-videostream | control-codes/python/ultrasonic.py | Python | gpl-2.0 | 1,305 |
# This file should go to /usr/lib/python2.7/site-packages/PyRedPitaya/ directory on the device's SD card
import rpyc
import os
from raw_memory import BoardRawMemory
class MyService(rpyc.Service):
def on_connect(self):
print "CONNECTION"
self._mem = BoardRawMemory()
self._conn._config.update(dict(
allow_all... | daneos/Tango-RedPitaya | src/rp_board/service.py | Python | gpl-2.0 | 875 |
from inspect import isgenerator
import re
import copy
# version: 0.4.0
# author: Mats Julian Olsen
# license: MIT
# https://github.com/mewwts/addict/
class Dict(dict):
"""
Dict is a subclass of dict, which allows you to get AND SET(!!)
items in the dict using the attribute syntax!
When you previous... | ChainsAutomation/chains | lib/chains/common/addict.py | Python | gpl-2.0 | 7,719 |
#
# Copyright 2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in th... | EdDev/vdsm | lib/vdsm/virt/metadata.py | Python | gpl-2.0 | 17,301 |