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 |
|---|---|---|---|---|---|
"""
The MIT License (MIT)
Copyright (c) 2015 Mat Leonard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge,... | EinfInPython-SS2017-LaJuTo/AbschlussProjekt | src/lib/Vector.py | Python | mit | 5,995 |
"""
Package for soldajustica.
"""
| patrickporto/soldajustica | soldajustica/soldajustica/__init__.py | Python | mit | 34 |
"""
RendererResult
"""
class RendererResult(object):
def __init__(self):
self.string_stream = ''
def append(self, s):
self.string_stream += s
def pop_back(self, index=1):
self.string_stream = self.string_stream[:-index]
def get_string(self):
return self.string_stream
| svperbeast/plain_data_companion | src/templates/renderer_result.py | Python | mit | 320 |
#!/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.
from segwit import send_to_witness
from test_framework.test_framework import BitcoinTestFramework
from test_fr... | svost/bitcoin | qa/rpc-tests/bumpfee.py | Python | mit | 14,241 |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 17 11:50:47 2015
@author: teichman
"""
import tensorflow as tf
from tensorflow.python.framework import ops
from tensorflow.python.framework import dtypes
from tensorflow.python.training import queue_runner
import os
import numpy as np
# Global constants describing out ... | MarvinTeichmann/tensorflow_examples | input/input.py | Python | mit | 8,318 |
import os
from unittest import TestCase
from cookiejar.client import CookiejarClient
class ClientTests(TestCase):
maxDiff = None
def test_pagination(self):
index = os.path.join((os.path.dirname(os.path.abspath(__file__))), 'index.1.json')
client = CookiejarClient(index=index)
... | fcurella/cookiejar | tests/test_client.py | Python | mit | 2,942 |
from django.db.models import Sum
from django.contrib.auth.mixins import LoginRequiredMixin
from tasks.models import TimeLog
def get_total_project_spend_time(tasks):
unpaid_tasks = tasks.filter(paid=False)
total_time = (
TimeLog.objects.filter(comment__task__in=unpaid_tasks)
.aggregate(Sum('spe... | polarkac/TaskTracker | tasks/utils.py | Python | mit | 837 |
# -*- coding: utf-8 -*-
from unittest import TestCase
from measures import Measure
from mock import patch
import json
import socket
class MeasureTestCase(TestCase):
def test_must_create_a_measure_object_with_correct_attributes(self):
measure = Measure('myclient', ('localhost', 1984))
self.assert... | wpjunior/measures | tests/unit/test_measure.py | Python | mit | 9,373 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# UECda-PyClient documentation build configuration file, created by
# sphinx-quickstart on Fri Oct 7 17:02:01 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in th... | Hironsan/uecda-pyclient | docs/conf.py | Python | mit | 9,234 |
#!/usr/bin/env python3
# Copyright (C) 2017-2021 The btclib developers
#
# This file is part of btclib. It is subject to the license terms in the
# LICENSE file found in the top-level directory of this distribution.
#
# No part of btclib including this file, may be copied, modified, propagated,
# or distributed except... | fametrano/BitcoinBlockchainTechnology | tests/mnemonic/test_entropy.py | Python | mit | 10,702 |
from backend import app
if __name__ == '__main__':
app.run('0.0.0.0',port=8080, threaded=True, debug=True)
| zpurcey/bestbuy-demo | runbackend.py | Python | mit | 112 |
#!/usr/bin/python3 -S
# -*- coding: utf-8 -*-
from cargo.fields import Double
from unit_tests.fields.Numeric import TestNumeric, TestEncNumeric
from unit_tests import configure
class TestDouble(TestNumeric):
'''
value: value to populate the field with
not_null: bool() True if the field cannot be Null
... | jaredlunde/cargo-orm | unit_tests/fields/Double.py | Python | mit | 1,916 |
#!/usr/bin/env python
"""Test for the command line interface."""
import unittest
from bogglesolver.cli import main
class TestCli(unittest.TestCase):
"""Tests for the cli."""
def test_main(self):
"""Verify 'bogglesolver' can be called."""
self.assertIs(None, main([]))
def test_main_h... | theovoss/BoggleSolver | bogglesolver/test/test_cli.py | Python | mit | 548 |
# -*- coding: utf-8 -*-
import json
import os
import urllib.parse
from functools import wraps
import bottle
from bottle import (
route,
run,
jinja2_template as template,
redirect,
request,
response,
static_file,
BaseTemplate,
)
import tweepy
BASE_DIR = os.path.dirname(os.path.abspath(_... | kk6/tssm | app.py | Python | mit | 5,552 |
"""Entity and System Managers."""
import six
from ecs.exceptions import (
NonexistentComponentTypeForEntity, DuplicateSystemTypeError,
SystemAlreadyAddedToManagerError)
from ecs.models import Entity
class EntityManager(object):
"""Provide database-like access to components based on an entity key."""
... | seanfisk/ecs | ecs/managers.py | Python | mit | 8,344 |
#
# @lc app=leetcode id=594 lang=python3
#
# [594] Longest Harmonious Subsequence
#
# https://leetcode.com/problems/longest-harmonious-subsequence/description/
#
# algorithms
# Easy (51.44%)
# Total Accepted: 97.9K
# Total Submissions: 190.2K
# Testcase Example: '[1,3,2,2,5,2,3,7]'
#
# We define a harmonious array ... | vermouth1992/Leetcode | python/594.longest-harmonious-subsequence.py | Python | mit | 1,636 |
class Solution(object):
def candy_2(self, ratings):
"""
:type ratings: List[int]
:rtype: int
"""
n = len(ratings)
cdy = [1,] * n
# climb from left -> right
v, p = 0, 0
while p < n:
# local min
v = p
... | sogapalag/problems | leetcode/135.Candy.py | Python | mit | 1,335 |
#!/usr/bin/env python
from __future__ import division
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib as mpl
import matplotlib.pyplot as plt
from scipy import linalg
import csv
import codecs
import copy
def comparison(trajOne, trajTwo):
segmentOne=np.array(trajOne)
segmentTwo=np.... | smorante/continuous-goal-directed-actions | guided-motor-primitives/src/roman14_primitive.py | Python | mit | 5,788 |
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic import TemplateView
from django.views.generic.detail import DetailView
from django.views.generic.edit import UpdateView
from django.views.generic.list import ListView
from places.models import Restaurant
class HomeView(TemplateView):... | huangsam/ciscochef | places/views.py | Python | mit | 778 |
import itertools
import pydoc
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import matplotlib.offsetbox as offsetbox
from mpl_toolkits.axes_grid.anchored_artists import AnchoredText
from functools import wraps
def _decorate_all(decorators):
""" Decorate a function with all decorators
""... | baxen/fishbowl | fishbowl/decorator.py | Python | mit | 9,156 |
# coding: utf-8
import os
from os.path import abspath, dirname
import tornado.web
import tornado.httpserver
import tornado.ioloop
from tornado.log import app_log
from tornado.options import define, options
from mongoengine import connect
from tt.handle import MainHandler, MongoBackboneHandler, LoginHandler, Re... | yunlzheng/tomatodo | tt/application.py | Python | mit | 1,854 |
# -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod
from random import randint
"""
Dice classes.
These are just plain dice, not dice notation, even thought they may be used
for handling that too.
The classes in this file will allow creating and using dice and rollable
entities, which are able to generat... | Bernardo-MG/dice-notation-python | dice_notation/dice.py | Python | mit | 3,766 |
#!/usr/bin/env python
# encoding: utf-8
"""
Author(s): Matthew Loper
See LICENCE.txt for licensing and contact information.
"""
import sys
import os
import unittest
import chumpy as ch
from chumpy import Ch
import numpy as np
from util_tests import get_earthmesh
class TestGeometry(unittest.TestCase):
def setUp(... | dimatura/opendr | test_geometry.py | Python | mit | 1,656 |
from setuptools import setup
setup(
name='pyqode-uic',
version='0.1.1',
py_modules=['pyqode_uic'],
url='https://github.com/pyQode/pyqode-pyuic',
license='MIT',
author='Colin Duquesnoy',
author_email='colin.duquesnoy',
description='pyQode Qt ui compiler',
entry_points={
'cons... | pyQode/pyqode-uic | setup.py | Python | mit | 958 |
import re
from django.contrib import admin, messages
from django.utils.translation import ugettext_lazy as _
from django.utils.text import mark_safe
from imagekit.admin import AdminThumbnail
class DontShowInAdmin(admin.ModelAdmin):
def get_model_perms(self, request):
return {}
class ReadOnlyAdminMixi... | Dybov/real_estate_agency | real_estate_agency/real_estate/admin.py | Python | mit | 3,751 |
from flask_dance.consumer.storage import BaseStorage
import flask
class SessionStorage(BaseStorage):
"""
The default storage backend. Stores and retrieves OAuth tokens using
the :ref:`Flask session <flask:sessions>`.
"""
def __init__(self, key="{bp.name}_oauth_token"):
"""
Args:
... | singingwolfboy/flask-dance | flask_dance/consumer/storage/session.py | Python | mit | 1,085 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-27 06:09
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0005_auto_20160327_0029'),
]
operations = [
migrations.AddField(
... | henriquenogueira/aedes | aedes_server/core/migrations/0006_auto_20160327_0309.py | Python | mit | 866 |
import _plotly_utils.basevalidators
class AlignsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="alignsrc", parent_name="bar.hoverlabel", **kwargs):
super(AlignsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/bar/hoverlabel/_alignsrc.py | Python | mit | 403 |
# -*- coding: utf-8 -*-
__author__ = 'James Gardner'
__email__ = 'james@pythonweb.org'
__version__ = '0.1.0'
| threeaims/browserstep | browserstep/__init__.py | Python | mit | 110 |
#!/usr/bin/env python2
# Copyright (c) 2013-2014 The Bitcredit Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
BUILDDIR="/root/2.0/dragos/bitcredit-2.0"
EXEEXT=".exe"
# These will turn into comments if they were d... | dragosbdi/bitcredit-2.0 | qa/pull-tester/tests_config.py | Python | mit | 413 |
# -*- 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):
# Removing M2M table for field guests on 'Event'
db.delete_table(db.shorten_name(u'rsvp_event_guests'))
... | gboone/wedding.harmsboone.org | rsvp/migrations/0020_auto__add_field_guest_hotel.py | Python | mit | 8,280 |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Fujicoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test coinbase transactions return the correct categories.
Tests listtransactions, listsinceblock, and... | fujicoin/fujicoin | test/functional/wallet_coinbase_category.py | Python | mit | 2,302 |
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function
import os
import re
import sys
# Check Sphinx version
import sphinx
if sphinx.__version__ < "1.0.1":
raise RuntimeError("Sphinx 1.0.1 or newer required")
needs_sphinx = '1.0'
# ---------------------------------------------... | DailyActie/Surrogate-Model | 01-codes/numpy-master/doc/source/conf.py | Python | mit | 9,985 |
SECRET_KEY = 'KEY GENERATED BY KEY GEN FUNCTION IN settings.py'
| naelstrof/PugBot-Discord-Django | sample_secret_key.py | Python | mit | 64 |
#!/usr/bin/env python
from flask import Flask
from flask import render_template
import pandas as pd
import numpy as np
import datetime as datetime
app = Flask(__name__)
if not app.debug:
import logging
file_handler = logging.FileHandler('error.log')
file_handler.setLevel(logging.WARNING)
app.logger.a... | kgorman/WMG_speed | app/app.py | Python | mit | 5,559 |
from collections import defaultdict
import serviceprovider
import textservice
import hashlib
import os
class Auth(serviceprovider.ServiceProvider, textservice.TextService):
salts = dict()
users = dict()
async def REQ_Salt(self, headers, msg):
conn = headers["cid"]
headers["salt"] = self.s... | simonwittber/middleman | clients/py/auth.py | Python | mit | 1,290 |
"""
Script which define fabric's methods.
"""
from fabric.api import local, task, lcd
from utils import create_bundle_server as create_bs, create_bundle_client as create_bc
@task
def create_bundle_server(bundle_name=None):
"""
Creates bundle for server-side of the application.
"""
create_bs(bundle_n... | PearsonIOKI/ioki-social | fabfile.py | Python | mit | 1,897 |
#!/usr/bin/env python3
import os
import sys
import re
import tempfile
from subprocess import run
from shutil import copyfile
args = sys.argv[1:]
in_dir = args[0] if len(args) == 1 else os.getcwd()
if not os.path.isabs(in_dir):
in_dir = os.path.abspath(in_dir)
if not os.path.isdir(in_dir):
print('"{}" is not... | kyclark/misc | tacc_manifest_upload/copy_from_manifest.py | Python | mit | 1,866 |
import re
from bs4 import BeautifulSoup
from ..const import constant
from ..bsopener import BSOpener
class RGArtist(object):
"""RapGeniusArtist"""
class _Const(object):
""" Contains constants used in outter class """
@constant
def RG_ARTIST_BASE_URL():
return "http://genius... | iluxonchik/lyricist | lyricist/rapgenius/rgartist.py | Python | mit | 5,427 |
from ai import action
class MoveAction(action.Action):
def __init__(self, performer, direction):
super().__init__(performer)
self.direction = direction
def prerequisite(self):
if not self.direction:
return False
return self.performer.can_move(*self.direction)
... | JoshuaSkelly/lunch-break-rl | ai/actions/moveaction.py | Python | mit | 385 |
#!/usr/bin/env python
import json
import datetime
from influxdb import InfluxDBClient
with open('/tmp/temperature.json') as temp_json:
data = json.load(temp_json)
cd = []
m_time = datetime.datetime.today()
data_s = sorted(data, key=lambda x: x['created_at'], reverse=True)
for m in data_s:
m_time = m_time - d... | thiagodasilva/home_automation | sample/transform_load.py | Python | mit | 663 |
from pyrsistent import pvector
from toolz import pipe
from toolz.curried import reduce, map
from toolz.dicttoolz import iterkeys, itervalues
from lib.value_objects.src.string_value_object import StringValueObject
__WHITESPACE = StringValueObject(" ")
__VERTICAL_SEPARATOR = StringValueObject("|")
__LINE_BREAK = String... | RamonAranda/ConfusionMatrix | lib/formatter/src/_formatter.py | Python | mit | 3,826 |
from compare_mlp import calculate_distance_pairs, load_models,get_filenames, plot_distance_pairs, plot_distances_from_target
import unittest
class DistanceTestCase(unittest.TestCase):
def setUp(self):
self.afiles = load_models(get_filenames("best_model_mlp", "zero_blur_a.pkl"))
self.bfiles = load_... | laputian/dml | mlp_test/test_compare_mlp_unit.py | Python | mit | 1,003 |
import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class NewVisitorTest(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
def tearDown(self):
self.browser.quit()
def test_can_show_main_menu_and_go_to_each_section(self):
... | baile/infojoiner | infojoiner/datacenter/functional_test.py | Python | mit | 2,451 |
from flask import request, render_template
import lib.es as es
import web.util.tools as tools
def get(p):
host = p['c']['host']; index = p['c']['index'];
# load workflow
workflow_id = p['nav'][-1]
p['workflow'] = es.get(host, index, 'workflow', workflow_id)
if not p['workflow']:
return too... | unkyulee/elastic-cms | src/web/modules/post/controllers/workflow/edit.py | Python | mit | 1,230 |
from __future__ import print_function
import os
import subprocess
class PyRDF2Ntriples(object):
def __init__(self):
pass
def convertTTL2NT(self, filepath):
#Save to the same folder with .nt extension
(outputDir, outputFile) = os.path.split(os.path.abspath(filepath))
outputFil... | earthquakesan/pyrdf2nt | pyrdf2nt/converter.py | Python | mit | 1,329 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)
# 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 witho... | jeremiedecock/snippets | python/tkinter/python3/button_color.py | Python | mit | 1,422 |
from setuptools import setup, find_packages
setup(
name='django-flatpage-meta',
version='0.0.2',
description='A simple app to add meta tag support to flatpages',
author="Ben Sinclair",
packages=find_packages(),
classifiers=[
'Development Status :: 1 - Alpha',
'Environment :: Web... | moopet/django-flatpage-meta | setup.py | Python | mit | 607 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "src.web.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) | CIRALabs/DSAP | manage.py | Python | mit | 249 |
import os
from django.core.files.storage import FileSystemStorage
from django.conf import settings
class OverwriteStorage(FileSystemStorage):
def get_available_name(self, name):
"""Returns a filename that's free on the target storage system, and
available for new content to be written to.
... | alexhayes/django-toolkit | django_toolkit/storage.py | Python | mit | 1,108 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-23 02:11
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migration... | chronossc/notes-app | notes/migrations/0001_initial.py | Python | mit | 993 |
from lbrynet.core.Strategy import get_default_strategy, OnlyFreeStrategy
from lbrynet import conf
from decimal import Decimal
class BasePaymentRateManager(object):
def __init__(self, rate=None, info_rate=None):
self.min_blob_data_payment_rate = rate if rate is not None else conf.settings['data_rate']
... | zestyr/lbry | lbrynet/core/PaymentRateManager.py | Python | mit | 4,661 |
class HelpMixin:
@property
def help(self):
from .Help import HelpCell
if self._path[:1] == ("HELP",):
raise AttributeError("Help cells can't have help")
return HelpCell(self)
@help.setter
def help(self, value):
from .Help import HelpCell
wrapper = Hel... | sjdv1982/seamless | seamless/highlevel/HelpMixin.py | Python | mit | 688 |
"""Contain the setup for other test cases."""
from flask_testing import TestCase
from app import db
from start import app
from bucketlist.models import User, Bucketlist, Item
from configuration.config import app_config
app.config.from_object(app_config["testing"])
class BaseTest(TestCase):
"""Base configuration... | jacksono/Bucketlist_API_Jxn | tests/base_test.py | Python | mit | 1,193 |
import py
from rpython.jit.backend.zarch.test.support import JitZARCHMixin
from rpython.jit.metainterp.test.test_float import FloatTests
from rpython.jit.backend.detect_cpu import getcpuclass
CPU = getcpuclass()
class TestFloat(JitZARCHMixin, FloatTests):
# for the individual tests see
# ====> ../../../metaint... | oblique-labs/pyVM | rpython/jit/backend/zarch/test/test_float.py | Python | mit | 467 |
from io import BytesIO
from nose.tools import assert_equal
from netlib import tcp, tutils
from netlib.http.http2.frame import *
def hex_to_file(data):
data = data.decode('hex')
return tcp.Reader(BytesIO(data))
def test_invalid_flags():
tutils.raises(
ValueError,
DataFrame,
flags... | pombredanne/netlib | test/http/http2/test_frames.py | Python | mit | 21,418 |
# -*- coding:utf-8 -*-
from ...errors.httpforbiddenexception import HttpForbiddenException
import saklient
# module saklient.cloud.errors.dontcreateinsandboxexception
class DontCreateInSandboxException(HttpForbiddenException):
## 要求された操作は許可されていません。ゾーンをまたぐ一部のリソースは課金対象です。料金をご確認の上、他のゾーンで作成してください。
## @param... | hnakamur/saklient.python | saklient/cloud/errors/dontcreateinsandboxexception.py | Python | mit | 899 |
# System imports
import os
from os.path import join
import pytest
from git import *
from PyGitUp.git_wrapper import RebaseError
from PyGitUp.tests import basepath, write_file, init_master, update_file, testfile_name
test_name = 'rebase_error'
repo_path = join(basepath, test_name + os.sep)
def setup():
master_pa... | msiemens/PyGitUp | PyGitUp/tests/test_rebase_error.py | Python | mit | 1,166 |
'''
Video player
============
.. versionadded:: 1.2.0
The video player widget can be used to play video and let the user control the
play/pausing, volume and position. The widget cannot be customized much because
of the complex assembly of numerous base widgets.
.. image:: images/videoplayer.jpg
:align: center
... | kivy/kivy | kivy/uix/videoplayer.py | Python | mit | 22,745 |
# -*- coding: utf-8 -*-
# quiz/quiz.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return 'Cześć, tu Python!'
if __name__ == '__main__':
app.run(debug=True)
| koduj-z-klasa/python101 | docs/webflask/quiz/quiz2.py | Python | mit | 204 |
from unittest.mock import patch
from django.http import HttpRequest
from django.test import override_settings
from django.utils.timezone import now
from axes.attempts import get_cool_off_threshold
from axes.models import AccessAttempt
from axes.utils import reset, reset_request
from tests.base import AxesTestCase
c... | jazzband/django-axes | tests/test_attempts.py | Python | mit | 5,846 |
import gdb
import pwndbg.decorators
import pwndbg.events
import pwndbg.gdbutils
import pwndbg.memoize
from pwndbg.color import disable_colors
from pwndbg.color import message
funcs_list_str = ', '.join(message.notice('$' + f.name) for f in pwndbg.gdbutils.functions.functions)
hint_lines = (
'loaded %i commands. ... | pwndbg/pwndbg | pwndbg/prompt.py | Python | mit | 1,730 |
# -*- coding: utf-8 -*-
#
# nanomsg-python documentation build configuration file, created by
# sphinx-quickstart on Fri Jan 23 17:17:17 2015.
#
# 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... | tonysimpson/nanomsg-python | docs/conf.py | Python | mit | 8,357 |
import sys
from random import randint
def generate_tests(N, P):
for i in range(N):
MAX_M = 10**exponent
MIN_SHIT = 5
m = randint(10**(exponent-1), MAX_M)
b = randint(5, m-2)
print("{0} {1}".format(m, b))
if len(sys.argv) < 2:
print("Ai uitat de numarul de exponent")
else:
generate_t... | palcu/rotopcoder | telina/teste/generator.py | Python | mit | 361 |
'''The script reads an annotation files from Eel
pond protocol and outputs unannotated transcripts.
'''
import sys
from pandas import read_csv
from Bio import SeqIO
def main():
seq = read_csv(sys.argv[1], header=0)
# removed transcripts with no orthologs
seq_ortho = seq[seq.ortholog.notnull()]
# re... | likit/seal-protocol | scripts/get_unannot.py | Python | mit | 1,179 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
import sys
import time
import os
import itertools
from termcolor import colored
import sys
frames = {
'tetris': ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧'... | walidsa3d/pirouette | pirouette/core.py | Python | mit | 1,843 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
import sys, os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
## This example uses a ViewBox to create a PlotWidget-like interface
#from scipy import random
import numpy as np
from pyqtg... | robertsj/poropy | pyqtgraph/examples/ViewBox.py | Python | mit | 2,670 |
# madoodia@gmail.com
# This tool created for using in composite, for Hossein Bayat
import os
import nuke
# add our paths to the plugins path of nuke
current_dir = os.path.dirname(os.path.abspath(__file__))
icons_path = current_dir + r"\icons"
nuke.pluginAddPath(icons_path)
gizmos_path = current_dir + r"\gizmos"
nu... | madoodia/codeLab | nuke_sdk/CompoTool/menu.py | Python | mit | 630 |
# coding=utf-8
import requests
import time
from pychroner import PluginMeta, PluginType
@PluginMeta(PluginType.Thread)
def do(pluginApi):
db = pluginApi.getMongoDB().getCollection("bot")
slack = pluginApi.getSlack()
while True:
url = f"https://api.foursquare.com/v2/users/63379277/scoreboard?oauth_... | SlashNephy/PyChroner-Bot | plugins/SlashNephy/Swarm.py | Python | mit | 3,264 |
"""
Tools for dealing with drifter stuff.
Functions include:
* interpolate2d
* interpolate3d
* find_final
* convert_indices
* check_points
* seed
"""
import numpy as np
from scipy import ndimage
import time
import matplotlib.tri as mtri
# from matplotlib.mlab import Path, find
from matplotlib.path import Path
def ... | kthyng/tracpy | tracpy/tools.py | Python | mit | 18,989 |
from .app import console_app, run_app
| janpipek/hlava | hlava/cli/__init__.py | Python | mit | 39 |
# Copyright (c) 2013 Jordan Halterman <jordan.halterman@gmail.com>
# See LICENSE for details.
import sys, os
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
from active_redis import ActiveRedis
redis = ActiveRedis()
# Create an unnamed set.
myset = redis.set()
# Add items to the set.
myset.add('foo')
... | kuujo/active-redis | examples/set.py | Python | mit | 554 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from core.sessionManager.Video import Video
class Project(object):
def __init__(self, name, path):
super(Project, self).__init__()
self._name = name
self._path = path
self._videos = []
self._sketchBoardVideos = [] #/!\ Unique ... | clejeu03/EWP | core/sessionManager/Project.py | Python | mit | 3,334 |
import logging
from sen.docker_backend import DockerContainer, RootImage
from sen.exceptions import NotifyError
from sen.tui.commands.base import Command
from sen.tui.views.disk_usage import DfBufferView
from sen.tui.views.help import HelpBufferView, HelpCommandView
from sen.tui.views.main import MainListBox
from sen.... | TomasTomecek/sen | sen/tui/buffer.py | Python | mit | 10,717 |
# encoding: 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 'Completion.predictions'
db.add_column('sqp_completion', 'predictions', self.gf('sqp.fields... | recsm/SQP | sqp/migrations/0032_auto__add_field_completion_predictions.py | Python | mit | 22,967 |
#!/usr/bin/env python
# file: git-origdate.py
# vim:fileencoding=utf-8:fdm=marker:ft=python
#
# Copyright © 2015-2018 R.F. Smith <rsmith@xs4all.nl>.
# SPDX-License-Identifier: MIT
# Created: 2015-01-03T16:31:09+01:00
# Last modified: 2020-12-16T00:25:34+0100
"""Report when arguments were checked into git."""
import os... | rsmith-nl/scripts | git-origdate.py | Python | mit | 1,260 |
__author__ = 'Aaron J. Masino'
def plot_ROC(y_actual, y_scores, title='ROC'):
fpr, tpr, _ = roc_curve(y_actual, y_scores)
roc_auc = auc(fpr, tpr)
# Plot ROC curve
plt.figure()
plt.plot(fpr, tpr, label='Area = {0:0.2f}'''.format(roc_auc))
plt.grid()
plt.plot([0, 1], [0, 1], 'k--')
plt.x... | chop-dbhi/arrc | learn/plotters.py | Python | mit | 2,963 |
import os
import json
import re
import os.path
import filecmp
import pipes
import fnmatch
import subprocess
import sublime
import sublime_plugin
import tempfile
import hashlib
from shutil import copyfile, rmtree
class SpyOnGemsCommand(sublime_plugin.WindowCommand):
def __init__(self, window):
self.setting... | naiyt/gem-spy | gem-spy.py | Python | mit | 5,667 |
from django.shortcuts import render, render_to_response
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.core.urlresolvers import reverse
from blogs.models import Post
from django.http import Http404
def postlist(request):
posts = Post.objects.all().order_by("-created")
paginator... | babraham123/mysite | blogs/views.py | Python | mit | 842 |
# -*- coding: utf-8 -*-
"""
Custom exceptions for sipa
OperationalError for MySQL and SERVER_DOWN for LDAP are global app handlers!
"""
class UserNotFound(Exception):
pass
class PasswordInvalid(Exception):
pass
class DBQueryEmpty(Exception):
pass
class LDAPConnectionError(Exception):
pass
| fgrsnau/sipa | sipa/utils/exceptions.py | Python | mit | 316 |
#!/usr/bin/env python
from distutils.core import setup
setup(name='minimalisp',
version='1.0',
description='An implementation of a small lisp language',
author='Joe Jordan',
author_email='tehwalrus@h2j9k.org',
url='https://github.com/joe-jordan/minimalisp',
packages=['minimalisp'],
scripts... | joe-jordan/minimalisp | setup.py | Python | mit | 377 |
#!/usr/bin/python2.7
print "__init__"
# __all__ = ['p2']
from big import *
| qrsforever/workspace | python/learn/base/module/l1/pack/__init__.py | Python | mit | 78 |
"""
This script trains a model based on different regions of chromosome 1,
and evaluates the model as the likelihood of it for the whole chromosome 2.
Useful to know whether it is sufficient to train only based on smaller data
"""
import os
import numpy as np
from config import RES_DIR
from data_provider import SeqL... | eranroz/dnase | src/scripts/HMMTrainRegions.py | Python | mit | 2,526 |
import libtcodpy as libtcod
from menu import Menu
from menu_manager import MenuStatus
from menu_game import MenuGame
from ui.frame_main_menu import FrameMainMenu
class MenuMain(Menu):
def __init__(self, width, height):
Menu.__init__(self, width, height)
self.menu_frame = FrameMainMenu(width, height)
def update... | RCIX/RogueP | logic/menu_main.py | Python | mit | 668 |
# Generated by Django 2.2.18 on 2021-03-27 18:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('workshops', '0238_task_seat_public'),
]
operations = [
migrations.AddField(
model_name='organization',
name='affili... | pbanaszkiewicz/amy | amy/workshops/migrations/0239_organization_affiliated_organizations.py | Python | mit | 441 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division,print_function,absolute_import,unicode_literals
import sys
import os
if sys.version_info.major == 2:
import urllib
if sys.version_info.major == 3:
import urllib.request
import zipfile
import datetime
import re
from LTsv_time import *... | ooblog/yonmoji_ge | LTsv/LTsv_file.py | Python | mit | 29,666 |
#!/usr/bin/env python
import os
COV = None
if os.environ.get('FLASK_COVERAGE'):
import coverage
COV = coverage.coverage(branch=True, include='app/*')
COV.start()
from app import create_app, db
from app.models import User, Follow, Role, Permission, Post, Comment
from flask_script import Manager, Shell
from ... | itachigiotto/flasky | manage.py | Python | mit | 2,224 |
# coding: utf-8
from django.conf.urls import patterns, url
urlpatterns = patterns('canaa.blog.views',
url(r'^$', 'blog', name='blog'),
url(r'^(?P<slug>[\w\-]+)/$', 'post', name='post'),
)
| klebercode/canaa | canaa/blog/urls.py | Python | mit | 198 |
"""Convert a Decimal Number to an Octal Number."""
import math
# Modified from:
# https://github.com/TheAlgorithms/Javascript/blob/master/Conversions/DecimalToOctal.js
def decimal_to_octal(num: int) -> str:
"""Convert a Decimal Number to an Octal Number.
>>> all(decimal_to_octal(i) == oct(i) for i
... ... | TheAlgorithms/Python | conversions/decimal_to_octal.py | Python | mit | 1,211 |
from django.db import models
from datetime import datetime
class Customer(models.Model):
"""
purpose: expose all customer data
author: Meg Ducharme
"""
first_name = models.CharField(max_length=55)
last_name = models.CharField(max_length=55)
date_account_created = models.CharField(max_lengt... | PythonicPenguins/bangazon_api | bangazon/bangazon_api/models.py | Python | mit | 3,851 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-30 01:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='USER',
... | meliora000/eb_django_app | django_eb/users/migrations/0001_initial.py | Python | mit | 796 |
#!/usr/bin/env python
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
#
# Name: goodness_of_fit.py
#
# Author: Constantin Weisser (weisser@mit.edu)
#
# Purpose: This is the main file of the Dalitz hirarchy. It takes in two
# data files and uses either classifier_eval (sciki... | weissercn/MLTools | Dalitz/goodness_of_fit.py | Python | mit | 4,498 |
from unittest import TestCase
import msal
from office365.graph_client import GraphClient
from tests import load_settings
def acquire_token_by_username_password():
settings = load_settings()
authority_url = 'https://login.microsoftonline.com/{0}'.format(settings.get('default', 'tenant'))
app = msal.Publi... | vgrem/Office365-REST-Python-Client | tests/graph_case.py | Python | mit | 1,515 |
"""Record video frames to disk, and mark the timestamps in database.
Parameters: <duration_sec> [<config_file>]
"""
# Import standard modules.
from multiprocessing import Process
import datetime as dt
import os
import sys
import time
import logging
# Import 3rd party modules.
import cv2
import mpipe
import coils
#... | vmlaker/wabbit | src/py/record.py | Python | mit | 3,650 |
# Generated by Django 3.0.8 on 2020-07-11 03:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("places", "0007_auto_20200711_0104"),
]
operations = [
migrations.CreateModel(
name="Category",
fields=[
... | huangsam/chowist | places/migrations/0008_category.py | Python | mit | 852 |
"""
Plots Arctic sea ice extent from June 2002-present using JAXA metadata
Website : https://ads.nipr.ac.jp/vishop/vishop-extent.html
Author : Zachary M. Labe
Date : 4 August 2016
"""
### Import modules
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import matplo... | zmlabe/IceVarFigs | Scripts/SeaIce/JAXA_seaice_movinglines.py | Python | mit | 6,992 |
import unittest
import os
from unipass.controller import controller
from unipass.model.models import initdb
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
class ControllerTest(unittest.TestCase):
def setUp(self):
initdb()
def tearDown(self):
try:
os.remove('sqlite3.db')... | jherrlin/unipass | tests/test_controller.py | Python | mit | 1,722 |
'''
Function decorator for rate limiting.
This module provides a function decorator that can be used to wrap a function
such that it will raise an exception if the number of calls to that function
exceeds a maximum within a specified time window.
For examples and full documentation see the README at
https://github.co... | tomasbasham/ratelimit | ratelimit/__init__.py | Python | mit | 681 |
import os
import subprocess
import sys
__version__ = '0.0.1'
__author__ = 'Jeroen Seegers'
__license__ = 'MIT'
HOME_DIR = os.path.expanduser('~')
HISTORY_FILE = HOME_DIR + '/.git-history.log'
def ensure_history_file():
"""Ensure the history file exists"""
if not os.path.isfile(HISTORY_FILE) and os.access(... | jeroenseegers/git-history | git_history.py | Python | mit | 1,296 |
from django.core.urlresolvers import reverse, reverse_lazy
from django.shortcuts import render, redirect
from django.views import generic
from common.models import Discipline, Performance
# renders index / home page
def index(request):
return redirect(reverse('tournaments.main'))
# renders todo page
def proces... | saechtner/turn-events | Turnauswertung-py3/common/views.py | Python | mit | 2,597 |