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 |
|---|---|---|---|---|---|
def override(target):
def wrapper(func):
func.target_name = target
return func
return wrapper
| voidpp/python-tools | voidpp_tools/mocks/file_system/utils.py | Python | mit | 119 |
#!/usr/bin/env python
# encoding: utf-8
"""
tests.py
TODO: These tests need to be updated to support the Python 2.7 runtime
"""
import os
import io
import json
import unittest
from google.appengine.ext import testbed
from application import app
class TestCases(unittest.TestCase):
def setUp(self):
# Fl... | rsyvarth/Schemify | tests/tests.py | Python | mit | 6,249 |
from __future__ import (absolute_import, print_function, unicode_literals)
from acli.services.vpc import (vpc_list, vpc_info)
from acli.config import Config
from moto import mock_ec2
from acli.connections import get_client
import pytest
from boto3.session import Session
session = Session(region_name="eu-west-1")
con... | jonhadfield/acli | tests/test_vpc.py | Python | mit | 1,941 |
from owslib.waterml.wml import SitesResponse, TimeSeriesResponse, VariablesResponse, namespaces
from owslib.etree import etree
def ns(namespace):
return namespaces.get(namespace)
class WaterML_1_0(object):
def __init__(self, element):
if isinstance(element, str) or isinstance(element, str):
... | jikuja/wms-get-map | lib/owslib/waterml/wml10.py | Python | mit | 1,099 |
import abc
import random as rnd
import numpy as np
import neuralnet as nn
class TicTacToeAI(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def takeTurn(self, board):
"""Takes one turn."""
pass
class RandomAI(TicTacToeAI):
def takeTurn(self, board):
"""Randoml... | m0baxter/tic-tac-toe-AI | pyVers/tttAI.py | Python | mit | 1,585 |
from behave import given, when, then
@given(u'que sou direcionado ao formulário de conexão')
def step_login(context):
raise NotImplementedError(u'STEP: Given que sou direcionado ao formulário de conexão')
@when(u'eu preencher meu "Nome de usuário" e "Senha"')
def step_fill_login(context):
raise NotImplement... | hilam/ninmah | features/steps/steps.py | Python | mit | 6,386 |
# -*- coding: utf-8 -*-
"""
magrathea.cli
~~~~~~~~~~~~~
:copyright: Copyright 2014 by the RootForum.org team, see AUTHORS.
:license: MIT License, see LICENSE for details.
"""
from .dispatch import CommandDispatcher
def execute(argv=None):
"""
Function being called from the executable to launc... | RootForum/magrathea | magrathea/cli/__init__.py | Python | mit | 820 |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2017
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... | rogerscristo/BotFWD | env/lib/python3.6/site-packages/pytests/test_photo.py | Python | mit | 9,677 |
import sys
for i in range(1,int(sys.argv[1])+1):
print ((10**i - 1)/9)**2 # 11**2 = 121: 111**2 = 12321: 1111**2 = 1234321
| ComputoCienciasUniandes/MetodosComputacionalesLaboratorio | 2018-1/Hw2/Sol/pyramid.py | Python | mit | 127 |
#!/bin/python3
import sys
def minimum_absolute_difference(array):
sorted_pairs = zip(sorted(array)[:-1], sorted(array)[1:])
differences = [abs(a - b) for a, b in sorted_pairs]
return min(differences)
if __name__ == "__main__":
_ = int(input().strip())
array = list(map(int, input().strip().split... | rootulp/hackerrank | python/minimum-absolute-difference-in-an-array.py | Python | mit | 374 |
"""
WipeDown Pattern
"""
from .pattern import Pattern
import time
class WipeDown(Pattern):
"""
WipeDown pattern class
"""
def __init__(self):
super(Pattern, self).__init__()
@staticmethod
def __get_time():
return time.time() * 1000
@classmethod
def get_id(self):
... | Chris-Johnston/Internet-Xmas-Tree | lights/patterns/wipedown.py | Python | mit | 1,238 |
from trac.core import *
from trac.web.api import ITemplateStreamFilter
from trac.ticket.api import ITicketManipulator
from genshi.filters.transform import Transformer, StreamBuffer
class EvaluationFieldHider(Component):
"""Hides and protects evaluation field."""
implements(ITemplateStreamFilter, ITicketMani... | mpc-hc/evaluation-workflow | evaluation/hider.py | Python | mit | 979 |
import logging
import re
from collections import deque
from datetime import datetime
from time import sleep
import requests
from praw.helpers import submission_stream
from praw.errors import AlreadySubmitted, APIException, HTTPException
from images_of import settings, AcceptFlag
from images_of.subreddit import Subred... | amici-ursi/ImagesOfNetwork | images_of/bot.py | Python | mit | 6,244 |
# -*- coding: utf-8 -*-
# This module contains some defaults for the logging system.
import logging
import sys
LOG_FORMATTER = logging.Formatter(
"%(asctime)s :: %(name)s :: %(levelname)-7s :: %(message)s",
datefmt='%a, %d %b %Y %H:%M:%S')
CONSOLE_HANDLER = logging.StreamHandler(sys.stdout)
CONSOLE_HANDLER... | zacharyvoase/zenqueue | zenqueue/log.py | Python | mit | 1,077 |
from time import time
import json
from webob import Request
class ForensicMiddleware(object):
"""
Log ALL request information as JSON, one request per line.
NOTE: Needs to set some reasonable restrictions on request content length
in order to be usable in production. Request bodies which are too lar... | storborg/maitai | maitai/forensic.py | Python | mit | 1,004 |
import hid
class MauvaisTypeDonneesHID(Exception):
pass
class AucunPheripheriqueDisponible(Exception):
pass
class SimpleHID:
def __init__(self, chemin):
self._chemin = chemin
self._device = hid.device()
self._device.open_path(self._chemin)
@property
def chemin(self):... | Ousret/pyBA63 | ba63/simple_hid.py | Python | mit | 1,276 |
"""
Django settings for dndproject project.
Generated by 'django-admin startproject' using Django 1.9.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os... | dndtoolsnet/dndtools | dndtools/dndproject/settings.py | Python | mit | 3,963 |
from distutils.core import setup, Extension
setup(name="PositionWeightMatrix", version="1.0",
ext_modules = [
Extension("PositionWeightMatrix", ["PositionWeightMatrix.c"])
])
| tbepler/MESS | setup.py | Python | mit | 180 |
import numpy as arr
n,m=map(int,input().split())
ar=([list(map(int,input().split()))for _ in range(n)])
arr1=arr.min(ar,axis=1)
print(max(arr1))
| manishbisht/Competitive-Programming | Hackerrank/Practice/Python/15.numpy/10.Min and Max.py | Python | mit | 150 |
# -*- coding: utf-8 -*-
from __future__ import division, print_function
import pytest
import numpy as np
from ...autocorr import integrated_time, AutocorrError
__all__ = ["test_nd", "test_too_short"]
def get_chain(seed=1234, ndim=3, N=100000):
np.random.seed(seed)
a = 0.9
x = np.empty((N, ndim))
x[... | dfm/emcee3 | emcee3/tests/unit/test_autocorr.py | Python | mit | 1,109 |
# -*- coding: utf-8 -*-
#
# Foo Bar documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 26 19:50:10 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't picklea... | obeattie/sqlalchemy | doc/build/conf.py | Python | mit | 6,386 |
#!/usr/bin/env python3
import requests
from bs4 import BeautifulSoup as bs
import re
import time
import json
# Scrapes http://dynasties.operationsports.com/team-colors.php?sport=ncaa
with open('ncaa_football_team_names.txt') as myFile:
url = 'http://dynasties.operationsports.com/team-colors.php?sport=ncaa'
... | thefotes/PJFScripts | fetch_ncaa_colors.py | Python | mit | 973 |
from django.conf.urls import url, include
from rest_framework import routers, serializers, viewsets, mixins
from .views import ServiceViewSet, InstanceViewSet, ShiftViewSet, StatusCheckViewSet
from . import legacy_views
import logging
logger = logging.getLogger(__name__)
router = routers.DefaultRouter()
router.regist... | bonniejools/cabot | cabot/api/urls.py | Python | mit | 1,043 |
from guardian.states import get_state
def main():
next_state, arguments = get_state('tutorial').run()
while True:
return_state, return_arguments = get_state(next_state).run(arguments)
next_state = return_state
arguments = return_arguments
if __name__ == '__main__':
main()
| alisonbnt/watchtower | guardian.py | Python | mit | 313 |
import io
import sys
import json
try:
import rfc822
except Exception as e:
import email.utils as rfc822
from .smtpapi import SMTPAPIHeader
class Mail(object):
"""SendGrid Message."""
def __init__(self, **opts):
"""
Constructs SendGrid Message object.
Args:
... | Khan/sendgrid-python | sendgrid/message.py | Python | mit | 6,749 |
from tulip import *
import tulipplugins
import math
class EdgeDistance(tlp.DoubleAlgorithm):
def __init__(self, context):
tlp.DoubleAlgorithm.__init__(self, context)
def check(self):
return (True, "")
def run(self):
vL = self.graph["viewLayout"]
for e in self.graph.getEdges():
pS = vL[self.graph.source... | renoust/TulipPythonPluginFarm | Algorithms/edgeDistance.py | Python | mit | 786 |
'''
Week-2:Exercise-Square
Write a Python function, square, that takes in one number and returns the square of that number.
This function takes in one number and returns one number.
'''
#code
def square(x):
'''
x: int or float.
'''
# Your code here
return x * x
| ahmedkareem999/MITx-6.00.1x | square.py | Python | mit | 283 |
import unittest
import mock
from utils.dummy_adapter import DummyAdapter
class DummyAdapterTest(unittest.TestCase):
def setUp(self):
self.dummy = DummyAdapter()
@mock.patch('utils.dummy_adapter.randint')
def test_get_randint(self, mock_randint):
mock_randint.return_value = 3
self.a... | Atihinen/serial2sqlite | unittests/dummy_adapter_tests.py | Python | mit | 356 |
import glob
import pandas as pd
import numpy as np
pd.set_option('display.max_columns', 50) # print all rows
import os
os.chdir("/gpfs/commons/home/biederstedte-934/evan_projects/correct_phylo_files")
cw154 = glob.glob("binary_position_RRBS_cw154*")
trito = glob.glob("binary_position_RRBS_trito_pool*")
print(len(... | evanbiederstedt/RRBSfun | trees/chrom_scripts/cll_chr18.py | Python | mit | 8,247 |
# molecule.py: An object that represents a molecule.
class Molecule():
residue = ""
atoms = []
bonds = []
connectivities = []
angles = []
def __init__(self):
self.residue = ""
self.atoms = []
self.bonds = []
self.connectivities = []
self.angles = []
def addAtom(self, atom):
self.atoms.append(ato... | KenNewcomb/Topologist | classes/molecule.py | Python | mit | 818 |
from django.forms import ModelForm
from pastebin.models import Paste
class PasteForm(ModelForm):
class Meta:
model = Paste
fields = ['text_field', 'expiration']
labels = {
'text_field': ('Paste'),
}
help_texts = {
'text_field': 'Paste your text here... | johannessarpola/django-pastebin | pastebin/forms/paste_forms.py | Python | mit | 493 |
from .entity_base import EntityBase
class EntityItem(EntityBase):
def __init__(self, game, item):
super().__init__(game)
self.item = item
self.game.world.add(self, True)
@property
def name(self):
return self.item.name
| trashbyte/hungryboys | foodgame/entities/entity_item.py | Python | mit | 266 |
import redis
import urllib2
from multiprocessing import Process
from utils import urlfetch
from jobs import cache_url
class RedisBank(object):
def __init__(self, host='localhost'):
self.pool = redis.ConnectionPool(host=host)
self.redis_client = redis.Redis(connection_pool=self.pool)
def set(s... | Tagtoo/cookie_atm | urlcache/core.py | Python | mit | 2,443 |
""" This code is used to report traces to LightStep servers.
"""
import atexit
import contextlib
import random
from socket import error as socket_error
import ssl
import sys
import threading
import time
import warnings
from thrift import Thrift
from .crouton import ttypes
from . import constants, version as cruntime... | traceguide/api-python | lightstep/instrument.py | Python | mit | 8,422 |
import numpy as np
from lcc.utils.data_analysis import to_PAA, to_ekvi_PAA, compute_bins, fix_missing
def test_to_PAA():
for _ in range(100):
x = np.random.random_sample(np.random.randint(30, 700))
bins = np.random.randint(5, 30)
assert len(to_PAA(x, bins)[0]) == bins
def test_to_ekvi_P... | mavrix93/LightCurvesClassifier | test/utils/test_data_analysis.py | Python | mit | 2,705 |
from web3.module import (
Module,
)
class Personal(Module):
"""
https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal
"""
def importRawKey(self, private_key, passphrase):
return self.web3.manager.request_blocking(
"personal_importRawKey",
[private_ke... | pipermerriam/web3.py | web3/personal.py | Python | mit | 1,799 |
# --------------------------------------------------------------------------
# rem_findVector.py - Python
#
# Remi CAUZID - remi@cauzid.com
# Copyright 2013 Remi Cauzid - All Rights Reserved.
# --------------------------------------------------------------------------
#
#
# snpas joint on a 2 curve using motion path
... | ejekt/rigging-system | scripts/rem_jointSnapOnCurve.py | Python | mit | 14,447 |
"""Alpha probability distribution."""
import numpy
from scipy import special
import chaospy
from ..baseclass import SimpleDistribution, ShiftScaleDistribution
class alpha(SimpleDistribution):
"""Standard Alpha distribution."""
def __init__(self, a=1):
super(alpha, self).__init__(dict(a=a))
def ... | jonathf/chaospy | chaospy/distributions/collection/alpha.py | Python | mit | 1,953 |
from tsbp.consts import operations, operation_results, classes, statuses
USER_SYSTEM = 1
USER_ROOT = 2
| lvercelli/pytsbp | tsbp/consts/__init__.py | Python | mit | 104 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
from RosalindLib import seq_utils as s
rosalind_id = "prot"
rosalind_num = "010"
dataset = "./data/rosalind_" + rosalind_id + ".txt"
output = "./results/" + rosalind_num + "_" + rosalind_id.upper() + ".txt"
with open(dataset) as input_file:
rna = input... | Guilz/rosalind | 010_PROT.py | Python | mit | 455 |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | jonatanSh/django-easy-rest | docs/conf.py | Python | mit | 4,796 |
# flake8: noqa
from fuel.datasets.base import (Dataset, IterableDataset,
IndexableDataset)
from fuel.datasets.hdf5 import H5PYDataset
from fuel.datasets.binarized_mnist import BinarizedMNIST
from fuel.datasets.cifar10 import CIFAR10
from fuel.datasets.cifar100 import CIFAR100
from fuel.... | EderSantana/fuel | fuel/datasets/__init__.py | Python | mit | 473 |
import argparse
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
from learntools.libs.logger import gen_log_name, log_me, set_log_file
from learntools.kt.data import cv_split
import learntools.deploy.config as config
@log_me()
def run(task_num=0, **kwargs):
from learntools.kt.deepkt... | yueranyuan/vector_edu | chinese_driver.py | Python | mit | 1,765 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
import six
def make_random_body(size):
return six.b("".join(["%i" % random.randint(0, 9)
for x in range(0, size)]))
| thefab/tbucket | tests/support.py | Python | mit | 209 |
# -*- coding: utf-8 -*-
# Copyright (C) Vincent BESANCON <besancon.vincent@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the... | bigbrozer/monitoring.nagios | monitoring/nagios/plugin/secureshell.py | Python | mit | 3,521 |
"""@package auglag_factory
Functions to build augmented Lagrangian optimization problems.
"""
from .rpl_constraint import RPLConstraint
from .uvc_model import error_single_test_uvc
from .RESSPyLab import errorTest_scl
from .log_barrier import LogBarrier
from .reciprocal_barrier import ReciprocalBarrier
from .auglag_gen... | AlbanoCastroSousa/RESSPyLab | RESSPyLab/auglag_factory.py | Python | mit | 3,393 |
#Interactive console
from model import Utxo
f = open('batch/inputs/testUtxoMain.txt', 'r')
for utxo in f:
splitted=utxo.splitlines()[0].split(',') # Quitamos el newline del final de cada linea
if splitted!='': # Por si hay lineas vacias
Utxo.new(splitted[0],int(splitted[1]),int(splitted[2]),splitted... | Udala/docforever | batch/importUtxo.py | Python | mit | 326 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-26 21:57
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('produtos', '0004_auto_20170227_0031'),
]
operation... | tyagow/FacebookBot | src/produtos/migrations/0005_auto_20170326_1857.py | Python | mit | 580 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from docutils import nodes
from docutils.parsers.rst import directives
from sphinx.util.compat import Directive
class codeio(nodes.General, nodes.Element): pass
def visit_codeio_node(self, node):
p_attrs = {
'data-height': node['height'],
'... | Lemma1/MAC-POSTS | doc_builder/sphinx-contrib/codeio/sphinxcontrib/codeio.py | Python | mit | 2,377 |
# 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/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/__init__.py | Python | mit | 4,100 |
from .solve import create_file_and_upload_to_s3,\
create_staging_file_and_upload_to_s3, \
ans_from_s3_ans_bucket, delete_job
__all__ = ['create_file_and_upload_to_s3',
'create_staging_file_and_upload_to_s3',
'ans_from_s3_ans_bucket', 'delete_job']
| kanghj/dinner-tables-planner | tables/__init__.py | Python | mit | 279 |
# Generated by Django 1.10.1 on 2018-03-22 19:56
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ticket', '0016_add_voucher_note_20180213_2307'),
]
operations = [
migrations.AlterField(
model_na... | Karspexet/Karspexet | karspexet/ticket/migrations/0017_positive_integers_20180322_2056.py | Python | mit | 1,177 |
import collections
from PySide import QtGui, QtCore
from views.ui_settingswindow import Ui_SettingsWindow
class SettingsDialog(QtGui.QDialog, Ui_SettingsWindow):
def __init__(self, MainWindow, parent=None):
super(SettingsDialog, self).__init__(parent)
self.ui = Ui_SettingsWindow()
self.u... | GunfighterJ/cargoscan | src/cargoscan/settingsdialog.py | Python | mit | 6,217 |
from copy import deepcopy
from datetime import datetime
from portality.dao import DomainObject as DomainObject
from portality.core import app
'''
Define models in here. They should all inherit from the DomainObject.
Look in the dao.py to learn more about the default methods available to the DomainObject which is a v... | g4he/g4he | portality/default_models.py | Python | mit | 26,911 |
from .network import SendPackage, RecvPackage, package, \
ThreadedTCPRequestHandler, ThreadedTCPServer, Endpoint
from .protocol import DataBlock, serialize, deserialize, \
HEADER_FORMAT, DATA_DICT_KEY, DATA_BLOCK_KEY, DFLT_ENCODING, DFLT_ERRORS
| jepayne1138/python-json-network | json_network/__init__.py | Python | mit | 253 |
#!flask/bin/python
from __future__ import division
from flask import Flask, request
from flask_restful import Api, Resource, reqparse
import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.preprocessing import LabelEncoder
from sklearn.externals import joblib
app = Fla... | orangganjil/lendingclub-default-predictor | lc-app.py | Python | mit | 3,616 |
from django.conf.urls import url
urlpatterns = [
url(r'^remove/(?P<obj_id>\S+)/$', 'remove_comment', prefix='cripts.comments.views'),
url(r'^(?P<method>\S+)/(?P<obj_type>\S+)/(?P<obj_id>\S+)/$', 'add_update_comment', prefix='cripts.comments.views'),
url(r'^activity/$', 'activity', prefix='cripts.comments.v... | lakiw/cripts | cripts/comments/urls.py | Python | mit | 802 |
#!/usr/bin/env python2
import pygame
from random import random
class Colors:
RED = pygame.Color(255, 0, 0)
GREEN = pygame.Color(0, 255, 0)
BLUE = pygame.Color(0, 0, 255)
BLACK = pygame.Color(0, 0, 0)
WHITE = pygame.Color(255, 255, 255)
TRANSPARENT = pygame.Color(0, 0, 0, 255)
def getRandColor():
return (int(r... | ld35-europa/europa | lib/Colors.py | Python | mit | 372 |
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""
FILE:... | Azure/azure-sdk-for-python | sdk/eventgrid/azure-eventgrid/samples/publish_samples/publish_with_shared_access_signature_sample.py | Python | mit | 2,432 |
# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | mnahm5/django-estore | Lib/site-packages/awscli/customizations/datapipeline/translator.py | Python | mit | 7,212 |
"""
Django settings for phoenix project.
Generated by 'django-admin startproject' using Django 1.10.1.
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... | amyth/phoenix | config/settings.py | Python | mit | 4,945 |
"""
This is the "example" module.
The example module supplies one function, factorial(). For example,
>>> factorial(5)
120
"""
def factorial(n):
"""Return the factorial of n, an exact integer >= 0.
If the result is small enough to fit in an int, return an int.
Else return a long.
>>> [factorial(n... | wgx731/2014-nus-orbital-mission-control-8 | test-examples/doctest_example.py | Python | mit | 1,511 |
# -*- encoding: utf-8 -*-
__author__ = 'kotaimen'
__date__ = '1/14/15'
import unittest
import hashlib
from stonemason.pyramid import Tile, TileIndex
class TestTileIndex(unittest.TestCase):
def test_init(self):
index1 = TileIndex()
self.assertEqual(index1.x, 0)
self.assertEqual(index1.y,... | Kotaimen/stonemason | tests/pyramid/test_tile.py | Python | mit | 2,209 |
import unittest
from conans.test.utils.tools import TestClient, TestServer
import os
from conans.test.utils.cpp_test_files import cpp_hello_conan_files
from conans.paths import CONANFILE
from conans.model.ref import ConanFileReference, PackageReference
from conans.util.files import load
class InstallSelectedPackagesT... | mropert/conan | conans/test/integration/install_selected_packages_test.py | Python | mit | 5,020 |
import wfdb
from wfdb.plot import plot
import unittest
class TestPlot(unittest.TestCase):
def test_get_plot_dims(self):
sampfrom = 0
sampto = 3000
record = wfdb.rdrecord('sample-data/100', physical=True, sampfrom=sampfrom, sampto=sampto)
ann = wfdb.rdann('sample-data/100', 'atr', s... | MIT-LCP/wfdb-python | tests/test_plot.py | Python | mit | 1,153 |
# Wrapper for ApiGen (PHP)
import sys
import platform
from subprocess import call
def invokeApiGen(File):
cmd = ['apigen', '--quiet', '--source', File, '--destination', 'doc']
if platform.system() == 'Windows': cmd[0] = 'apigen.cmd'
print('ApiGen ~ Documenting PHP file: {0}'.format(File))
call(cmd)
invokeApiGen(s... | stpettersens/sublimetext-buildtools | ApiGen/apigen.py | Python | mit | 332 |
#!/usr/bin/python
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
import sys
import re
import os
import shutil
import commands
"""Copy Special exercise
"""
#... | bourneagain/pythonBytes | google-python-exercises/copyspecial/copyspecial.py | Python | mit | 2,005 |
import numpy as np
import time
class MemoryBlock(object):
InitialEFactor = 2.5
def __init__(self, question=None, response=None, priority=1.0):
# should internal state just be a dict? easier to publish state
self.redundid = int(time.time() - 365.25 * 10 * 24 * 60 * 60)
self.question = question
self.response... | doktorspaceman/hyper-memo | hypermemorize/memory_block.py | Python | mit | 1,856 |
"""
Tests for ``polymorphic_auth`` app.
"""
# WebTest API docs: http://webtest.readthedocs.org/en/latest/api.html
from django.core.urlresolvers import reverse
from django_dynamic_fixture import G
from django_webtest import WebTest
class Sample(WebTest):
def test_sample(self):
pass
| whembed197923/django-polymorphic-auth | polymorphic_auth/tests/tests.py | Python | mit | 298 |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from app.openapi_server.models.base_model_ import Model
from app.openapi_server.models.cause_action import CauseAction # noqa: F401,E501
from app.openapi_server.models... | cliffano/swaggy-jenkins | clients/python-blueplanet/generated/app/openapi_server/models/free_style_build.py | Python | mit | 14,005 |
from setuptools import setup
REQUIREMENTS = [
"requests >= 2.4.3",
]
DEV_REQUIREMENTS = [
"black",
"flake8",
"isort",
"pytest-cov==3.*",
"pytest-vcr==1.*",
"pytest==7.*",
"pytz", # TODO: Remove when we overhaul the test suite
"vcrpy==4.*",
]
with open("README.md", encoding="utf-8... | EasyPost/easypost-python | setup.py | Python | mit | 1,666 |
#########################################################################
## This program is part of 'MOOSE', the
## Messaging Object Oriented Simulation Environment.
## Copyright (C) 2014 Upinder S. Bhalla. and NCBS
## It is made available under the terms of the
## GNU Lesser General Public License version 2... | h-mayorquin/camp_india_2016 | tutorials/chemical switches/moose/helloMoose.py | Python | mit | 1,492 |
version_info = (1, 0, 2)
__version__ = '.'.join(map(str, version_info))
| portfoliome/cenaming | cenaming/_version.py | Python | mit | 73 |
from django.shortcuts import render
# Create your views here.
def index(request):
return HttpResponse("Produkti") | tryoha/peterfrost | src/apps/products/views.py | Python | mit | 118 |
def Setup(Settings, DefaultModel):
# set5-osm-model-variable-widths-depths/set5_w256_depth1_d1.py
Settings["experiment_name"] = "set5_w256_depth1_d1"
Settings["graph_histories"] = [] # ['all','together',[],[1,0],[0,0,0],[]]
n = 0
#d1 5556x_markable_640x640 SegmentsData_marked_R100... | previtus/MGR-Project-Code | Settings/set5-osm-model-variable-widths-depths/set5_w256_depth1_d1.py | Python | mit | 1,673 |
#!/usr/bin/python
import sys
from subprocess import Popen
port = sys.argv[1]
mongoport=sys.argv[2]
print port, mongoport
try:
c = Popen(["ssh", "-L", ("%s:localhost:%s" %(mongoport, mongoport)), "oolite", "-N"])
except:
print "not linking mongodb"
b = Popen(["ipython", "notebook", "--no-browser", "--port", ... | YeoLab/gscripts | gscripts/ipython_server/serve_ipython.py | Python | mit | 450 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('notebooks', '0002_auto_20141026_1858'),
]
operations = [
migrations.RemoveField(
model_name='profile',
... | marcwebbie/hnotebook | hnotebook/notebooks/migrations/0003_auto_20141026_1903.py | Python | mit | 429 |
from __future__ import division, print_function
print(23/5)
| timm/timmnix | demo.py | Python | mit | 76 |
from __future__ import absolute_import
import traceback
import json
import datadog
from flask import request
from flask import _app_ctx_stack as app_context
from flask.signals import got_request_exception, request_finished
from werkzeug.exceptions import ClientDisconnected
try:
from flask_login import current_user... | mindflayer/flask-breathalyzer | flask_breathalyzer/breathalyzer.py | Python | mit | 5,600 |
import os
import numpy as np
import pickle
from simplenet.layers import LinearLayer
def test_can_activate_on_multiple_samples_with_complex_shape():
# Dead simple inputs. The key is that output arrays are correctly shaped.
input_nodes = 2
layer_nodes = 3
layer = LinearLayer(input_nodes, layer_nodes)
... | rileymcdowell/simplennet | tests/unit/layers/linear_layer_test.py | Python | mit | 3,386 |
# Top K Frequent Words
# Challange
"""
I threw myself at this one, not really any time to "study"
the solution was stupid simple in hind sight. It took only 5 lines of code to solve this riddle.
Given a non-empty list of words, return the k most frequent elements.
Your answer should be sorted by frequency from hig... | bluewitch/Code-Blue-Python | topk.py | Python | mit | 2,647 |
from __future__ import absolute_import
import copy
import hashlib
import inspect
import json
import multiprocessing
import re
import traceback
from typing import TYPE_CHECKING
import simpleflow.task as base_task
import swf.exceptions
import swf.models
import swf.models.decision
from simpleflow import compat, exceptio... | botify-labs/simpleflow | simpleflow/swf/executor.py | Python | mit | 56,031 |
import re
from pathvalidate import unprintable_ascii_chars
from pathvalidate.error import ErrorReason, ValidationError
__SQLITE_VALID_RESERVED_KEYWORDS = [
"ABORT",
"ACTION",
"AFTER",
"ANALYZE",
"ASC",
"ATTACH",
"BEFORE",
"BEGIN",
"BY",
"CASCADE",
"CAST",
"COLUMN",
... | thombashi/SimpleSQLite | simplesqlite/_validator.py | Python | mit | 4,280 |
import csp
rgb = ['R', 'G', 'B','O']
d2 = { 'Racine' : ['R'], 'Kenosha' : rgb, 'Walworth' : rgb, 'Waukesha' : rgb,'Washington' : rgb, 'Ozaukee': rgb,
'Rock': rgb, 'Jefferson': rgb, 'Dodge':rgb ,'Milwaukee' : rgb}
v2 = d2.keys()
wisconsin2d = {'Milwaukee': ['Racine', 'Waukesha', 'Ozaukee'],
'Racine' : [... | WmHHooper/aima-python | submissions/Gutierrez/myCSPs.py | Python | mit | 2,266 |
#coding:utf-8
def j(lst1,lst2):
if lst1==[] or lst2==[]:
return lst1+lst2
elif lst1[0]<lst2[0]:
return [lst1[0]]+j(lst1[1:],lst2)
else:
return [lst2[0]]+j(lst1,lst2[1:])
| RafaelPAndrade/LEIC-A-IST | FP/LAB/05/teste.py | Python | mit | 182 |
import re
from classify.util.logger import Logger
from classify.util.timer import Timer
class Loader:
"""Loads input and output data for use in model."""
def __init__(self, indexer):
self.log = Logger.create(self)
self.indexer = indexer
def load_file(self, file_name):
with open(f... | kupospelov/classify | classify/loader.py | Python | mit | 1,333 |
# -*- coding: utf-8 -*-
# Copyright JS Foundation and other contributors, https://js.foundation/
#
# 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
# ... | mp-coder/translate-dev-tools | esprima/nodes.py | Python | mit | 16,196 |
# Durand-Kerner method for solving polynomial equations
# http://en.wikipedia.org/wiki/Durand%E2%80%93Kerner_method
# http://en.wikipedia.org/wiki/Horner%27s_method
# http://en.wikipedia.org/wiki/Properties_of_polynomial_roots
# FB - 20130428
import random
import math
def bound(coefficients):
coefficients.reverse(... | ActiveState/code | recipes/Python/577865_DurandKerner_method_solving_polynomial/recipe-577865.py | Python | mit | 2,160 |
"""
Django settings for linkclone project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
... | gchandrasa/linkclone | linkclone/settings/base.py | Python | mit | 2,881 |
from marshmallow import Schema, fields
from theatrics.scoring import get_default_score_functions
from theatrics.utils.handlers import with_params, json_response
from ..helpers import get_item, get_list
__all__ = ['place', 'place_list']
class PlaceListParams(Schema):
location = fields.String()
@json_response... | despawnerer/theatrics | api/theatrics/handlers/v1/places.py | Python | mit | 1,265 |
"""
This module implements a set of :class:`~revscoring.features.Feature`
for use in scoring revisions. :class:`~revscoring.features.Feature`
lists can be provided to a :func:`~revscoring.dependencies.functions.solve`, or
more commonly, to a :class:`~revscoring.extractors.extractor.Extractor` to
obtain simple numerica... | aetilley/revscoring | revscoring/features/__init__.py | Python | mit | 1,350 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-06-17 14:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ossuo', '0032_jobindexpagejob_job_intro'),
]
operations = [
migrations.AddFi... | spketoundi/CamODI | waespk/core/migrations/0033_homepagehero_colour.py | Python | mit | 578 |
"""
Convert JSON file of token counts per category
per episode to .tsv with top-k words in each
category per episode.
"""
import json
import pandas as pd
import argparse, os
EPISODES=10
SEASONS=6
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--token_counts',
defaul... | fredhohman/a-viz-of-ice-and-fire | scripts/get_top_category_words_per_episode.py | Python | mit | 1,834 |
# depends on bleeding edge http://code.google.com/p/python-twitter/
# depends on http://github.com/simplegeo/python-oauth2
# which depends on http://pypi.python.org/packages/source/s/setuptools/
#
# Due to the fact that twitter uses oauth, you need to do this dance to use this bot.
#
# 0. create twitter account, if y... | softcert/vsroom | vsroom/common/twitterbot.py | Python | mit | 6,409 |
import uuid
from copy import deepcopy
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models.query import QuerySet
from django.db import transaction
from ..settings import SESSION_USID_KEY_LENGTH, GRID_USID_KEY_LENGTH
from .error.userAlreadyParticipating import ... | danrg/RGT-tool | src/RGT/gridMng/models.py | Python | mit | 32,601 |
import sys
import os
import math
from tqdm import tqdm
import boto3
import io
class AWSSync:
def __init__(self, bucket='bucketname', root='FolderName/', aws_access_key_id = '', aws_secret_access_key = ''):
print('Workspace is being initialized ...')
self.__s3_client = boto3.client('s3',\
aws_access_key... | xR86/ml-stuff | scripts/utils_aws.py | Python | mit | 3,559 |
#!/usr/local/bin/python
from io import open
import os
import time
import useful
# --- barparse ----------------------------------------------------------
class ArgList(object):
def __init__(self, line):
self.llist = []
line = line.strip()
if len(line) and line[0] != '#':
se... | ddierschow/bamca | bin/bfiles.py | Python | mit | 6,728 |
from .base import Resource
class Labels(Resource):
"""
An interface for interacting with the NewRelic label API.
"""
def list(self, page=None):
"""
This API endpoint returns a paginated list of the Labels
associated with your New Relic account.
:type page: int
... | ambitioninc/newrelic-api | newrelic_api/labels.py | Python | mit | 4,227 |
import sys
import petsc4py
petsc4py.init(sys.argv)
# from scipy.io import savemat, loadmat
# from src.ref_solution import *
# import warnings
# from memory_profiler import profile
# from time import time
from src.myio import *
from src.objComposite import *
from src.StokesFlowMethod import *
from src.geo import *
fro... | pcmagic/stokes_flow | HelicodsParticles/obj_helicoid_disk.py | Python | mit | 5,183 |
#!/usr/bin/env python
###########################################################################
# author: JanKalin
#
# Calculates an estimate of mining rate on this computer
###########################################################################
import argparse
import datetime
import matplotlib.pyplot as plt
im... | JanKalin/zcutils | miningrate.py | Python | mit | 7,729 |