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 |
|---|---|---|---|---|---|
'''
Text
====
An abstraction of text creation. Depending of the selected backend, the
accuracy of text rendering may vary.
.. versionchanged:: 1.10.1
:meth:`LabelBase.find_base_direction` added.
.. versionchanged:: 1.5.0
:attr:`LabelBase.line_height` added.
.. versionchanged:: 1.0.7
The :class:`LabelBas... | akshayaurora/kivy | kivy/core/text/__init__.py | Python | mit | 38,510 |
from math import log
def sort(a_list, base):
"""Sort the input list with the specified base, using Radix sort.
This implementation assumes that the input list does not contain negative
numbers. This algorithm is inspired from the Wikipedia implmentation of
Radix sort.
"""
passes = int(log(ma... | isubuz/zahlen | algorithms/sorting/radix_sort.py | Python | mit | 805 |
# vim: set ts=2 expandtab:
# -*- coding: utf-8 -*-
"""
Module: info.py
Desc: print current stream info
Author: on_three
Email: on.three.email@gmail.com
DATE: Sat, Oct 4th 2014
This could become very elaborate, showing stream status (up/down)
and number of viewers, etc, but at present i'm just going to
display... | on-three/weeabot | weeabot/info.py | Python | mit | 2,639 |
from django.contrib import admin
from .models import Line
# Register your models here.
admin.site.register(Line)
| MirzaBaig715/DjangoURLShortner | urlshortenerapp/admin.py | Python | mit | 114 |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import re
import time
from mcrouter.test.McrouterTestCase import McrouterTestCase
class TestMcrouterToMcrouterTko(M... | facebook/mcrouter | mcrouter/test/test_mcrouter_to_mcrouter_tko.py | Python | mit | 1,294 |
import sublime_plugin
import sublime
SUB_RE = '\d\d:\d\d:\d\d,\d\d\d'
def find_subtitles(view):
subs = []
sel = view.sel()
for match in view.find_all(SUB_RE):
if sel.contains(match):
subs.append(match)
# sel.clear()
# sel.add_all(subs)
return subs
def convert_to_time(s... | apiad/sublime-subtitle-sync | subtitle_sync.py | Python | mit | 1,030 |
from LSP.plugin.core.typing import Any, Callable
from types import MethodType
import weakref
__all__ = ['weak_method']
# An implementation of weak method borrowed from sublime_lib [1]
#
# We need it to be able to weak reference bound methods as `weakref.WeakMethod` is not available in
# 3.3 runtime.
#
# The reason ... | dmilith/SublimeText3-dmilith | Packages/lsp_utils/st3/lsp_utils/_util/weak_method.py | Python | mit | 1,266 |
# -*- coding: UTF-8 -*-
"""
Options quotes.
"""
import os
import json
import logging
from datetime import datetime
import collections
import requests
from landscape.finance import consts, database, dates, utils
from landscape.finance.volatility import math
OptionQuote = collections.namedtuple(
'OptionQuote',
... | zzzoidberg/landscape | finance/quotes/options.py | Python | mit | 7,159 |
import sys
import os
import unittest
import time
from mock import Mock, patch
sys.path.append(os.path.abspath("."))
sys.path.append(os.path.abspath("rpirobot"))
from rpirobot.robot import Robot
class TestRobot(unittest.TestCase):
"""Tests for Robot class."""
def setUp(self):
self.robot = Robot()
... | climbus/RPiRobot | tests/test_robot.py | Python | mit | 10,802 |
from grslra import testdata
from grslra.grslra_online import grslra_online
from grslra.structures import Hankel
from grslra.scaling import Scaling
import numpy as np
# The goal of this experiment is to identify an LTI system and to predict its impulse response in an online manner
PROFILE = 0
if PROFILE:
import cP... | clemenshage/grslra | experiments/6_grslra/forecasting_lti/forecasting_lti.py | Python | mit | 959 |
import logging
from time import sleep
from tools.audiosink import AudioSink
demo = logging.getLogger('Demo')
logging.basicConfig(level=logging.DEBUG)
p = AudioSink()
with open("sample.wav", 'rb') as f:
a = f.read()
demo.info("add the first track")
p.add(a, "a")
sleep(2)
with open("sample.wav", 'rb') as f:
... | loult-elte-fwere/termiloult | tests/test_multiple_play.py | Python | mit | 559 |
# -*- coding: utf-8 -*-
from datetime import date, timedelta
from subprocess import check_output
from celery import task
from django.template.loader import render_to_string
from django.db.models import Sum
from django.conf import settings
from django.contrib.auth.models import User
from django.core.mail import send_ma... | MSA-Argentina/relojito_project | relojito/app/tasks.py | Python | mit | 6,517 |
from . import *
from udsoncan.Response import Response
from udsoncan.exceptions import *
class SecuredDataTransmission(BaseService):
_sid = 0x84
class Code:
GeneralSecurityViolation = Response.Code.GeneralSecurityViolation - 0x38
SecuredModeRequested = Response.Code.SecuredMo... | pylessard/python-udsoncan | udsoncan/services/SecuredDataTransmission.py | Python | mit | 2,392 |
import json
import unittest
from logging import INFO, LogRecord
from foil.logger import JSONFormatter
class TestLogFormatter(unittest.TestCase):
def test_json_formatter(self):
name = 'name'
line = 42
module = 'some_module'
func = 'some_function'
msg = {'content': 'sample l... | portfoliome/foil | tests/test_logger.py | Python | mit | 936 |
import os
import logging
import django
from django.test import TestCase, Client, modify_settings, override_settings
from applicationinsights import TelemetryClient
from applicationinsights.channel import TelemetryChannel, SynchronousQueue, SenderBase, NullSender, AsynchronousSender
from applicationinsights.channel.Se... | Microsoft/ApplicationInsights-Python | django_tests/tests.py | Python | mit | 16,940 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: data_augmentation.py
Author: Wen Li
Email: spacelis@gmail.com
Github: http://github.com/spacelis
Description: Augmenting data with some sythetic negative examples.
"""
# pylint: disable=invalid-name
from __future__ import print_function
import sys
import re
impo... | spacelis/hrnn4sim | hrnn4sim/data_augmentation.py | Python | mit | 3,901 |
from typing import Optional, Dict, Union, List
from .singleton import Singleton
class Arguments(metaclass=Singleton):
"""
Arguments singleton
"""
class Name:
SETTINGS_FILE: str = 'settings_file'
SETTINGS: str = 'settings'
INIT: str = 'init'
VERBOSE: str = 'verbose'
... | PetterKraabol/Twitch-Chat-Downloader | tcd/arguments.py | Python | mit | 3,199 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#======================================================================
#
# pocketsnes_cht.py -
#
# Created by skywind on 2020/06/17
# Last Modified: 2020/06/17 20:26:39
#
#======================================================================
from __future__ im... | skywind3000/collection | script/pocketsnes_cht.py | Python | mit | 8,764 |
from tornado.web import HTTPError
import datetime
import threading
from astral.api.client import TicketsAPI
from astral.api.handlers.base import BaseHandler
from astral.api.handlers.tickets import TicketsHandler
from astral.models import Ticket, Node, Stream, session
import logging
log = logging.getLogger(__name__)
... | peplin/astral | astral/api/handlers/ticket.py | Python | mit | 4,822 |
from dronekit import connect, VehicleMode, LocationGlobal, LocationGlobalRelative
from pymavlink import mavutil # Needed for command message definitions
from Find_serial_ports import serial_ports
import time
import math
import argparse
parser = argparse.ArgumentParser(description='Control Copter and send comm... | sassystacks/DASS | Simulation/Test_userInput_roll.py | Python | mit | 5,053 |
from firebase import firebase
from flask import request
from flask.ext.restful import Resource
class BaseAlert(Resource):
db = firebase.FirebaseApplication(
dsn='https://stockdelta.firebaseio.com/',
authentication=None)
class Alerts(BaseAlert):
def get(self):
result = self.db.get(url... | kienpham2000/stockdelta-api | stockdelta/api/alerts.py | Python | mit | 717 |
# -*- coding: utf-8 -*-
from unittest import TestLoader, TextTestRunner
try:
import pymongo
except ImportError:
print('Pymongo module is required')
try:
import gst
except ImportError:
print('Gst python binding is required')
if __name__ == "__main__":
test_loader = TestLoader()
suit = test_l... | DrunkenPandaFans/dj-panda | run_tests.py | Python | mit | 459 |
#!/usr/bin/python3 -S
# -*- coding: utf-8 -*-
import netaddr
from cargo.fields import Cidr
from unit_tests.fields.Field import TestField
from unit_tests import configure
class TestCidr(configure.NetTestCase, TestField):
@property
def base(self):
return self.orm.cidr
def test___call__(self):
... | jaredlunde/cargo-orm | unit_tests/fields/Cidr.py | Python | mit | 2,247 |
import time
while True:
try:
time.sleep(1) # do something here
print '.',
except KeyboardInterrupt:
print '\nPausing... (Hit ENTER to continue, type quit to exit.)'
try:
response = raw_input()
if response == 'quit':
break
pr... | xR86/ml-stuff | labs-python/gists/stub-graceful-shutdown.py | Python | mit | 581 |
import os, sys, socket, hashlib, pickle
hashedword = "4f9c4e19748be021372db6d5e10cfd02"
def main():
target = '127.0.0.1'
port = 5555
chars = "abcdefghijklmnopqrstuvwxyz"
charl = len(chars)
while True:
s = socket.socket()
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.conn... | Kuwagata/md5crack | LocallyThreaded/client_mod.py | Python | mit | 1,033 |
import csv
import math
from CSHLDAP import CSHLDAP #get this from the wiki
from subprocess import call
your_gender_list = []
with open('match_scores.csv', 'rb') as f:
reader = csv.reader(f)
your_gender_list = list(reader)
print(your_gender_list)
tempList = [0] * len(your_gender_list)
peopleList = [... | sherrardTr4129/FaceHarold | getCSVData.py | Python | mit | 2,092 |
from proteus import *
from ls_p import *
if timeDiscretization=='vbdf':
timeIntegration = VBDF
timeOrder=2
stepController = Min_dt_cfl_controller
elif timeDiscretization=='flcbdf':
timeIntegration = FLCBDF
#stepController = FLCBDF_controller
stepController = Min_dt_cfl_controller
time_tol... | erdc-cm/air-water-vv | 2d/hydraulicStructures/sharp_crested_weir/deprecated/sharp_crested_weir_AV_V1/ls_n.py | Python | mit | 1,536 |
# -*- coding: utf-8 -*-
__author__ = 'boonya'
from flask import Blueprint
from ...utils.request import Request
from ...utils.response import Response
from ...utils.fs import Fs
from ...utils.fs.exception import NotExistsException
from .post import Post
from .post import PostSerializer
from werkzeug.exceptions import N... | boonya/Djangyll | backend/app/blueprints/post/view.py | Python | mit | 2,104 |
import tweepy
from pymongo import MongoClient
class RaffleSlave:
"The class responsbile for a single raffle, a new instance for each individual raffle"
Params = None
api = None
alive = True
def __init__(self, hashtag, max, id, owner ):
self.Params = {}
self.Params['max'] = max
... | asmi92/odu-acm | raffleslave.py | Python | mit | 1,668 |
for _ in range(int(input())):
A, B, C, D = map(int, input().split())
if A < B or C + D < B:
print("No")
continue
elif C >= B - 1:
print("Yes")
continue
ret = []
s_set = set()
now = A
while True:
now %= B
if now in s_set:
print("Yes"... | knuu/competitive-programming | atcoder/agc/agc026_b.py | Python | mit | 517 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
from setuptools.command.test import test as TestCommand
import re
import os
import sys
# This command has been borrowed from
# https://github.com/getsentry/sentry/blob/master/setup.py
class PyTest(TestCommand):
def finalize_options(self):... | jlafon/django-rest-framework-oauth | setup.py | Python | mit | 2,889 |
import wx
import Globals
from BaseWidget import BaseWidget
class TestWidget ( BaseWidget ):
def __init__( self, parent ):
BaseWidget.__init__ ( self, parent )
m_mainSizer = wx.BoxSizer( wx.VERTICAL )
m_mainSizer.AddSpacer( ( 0, 30), 0, 0, 5 )
m_statusSizer = wx.BoxSizer( wx.VERTICAL )
m_statusCont =... | ghbenjamin/TestingGui | TestingGui/TestWidget.py | Python | mit | 3,581 |
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 23 18:45:19 2016
@author: aarora
"""
import os
import csv
from bs4 import BeautifulSoup
from common import globals as glob
# Map colors
### GRAYSCALE
# colors = ["#ffffff", "#f0f0f0", "#d9d9d9", "#bdbdbd", "#969696", "#737373", "#525252", "#252525"]
# colors = ["#f7f7f7",... | aarora79/sb_study | visualize/sb_by_counties.py | Python | mit | 3,126 |
import os
import sys
import time
from StringIO import StringIO
from os.path import join as opj
from twisted.python import log
from twisted.internet import defer
from twisted.mail import smtp
from twisted.internet import reactor
def sendmail(smtphost, port, from_addr, to_addrs, msg):
msg = StringIO(str(msg))
d... | twisted/quotient | xquotient/stressmtp.py | Python | mit | 3,190 |
#################################################################################
# MODULE: bol-interface
#################################################################################
from bs4 import BeautifulSoup
from urllib2 import urlopen
import urllib
def scrape_isbn_list(category='thrillers', test=True):
... | mblaauw/CollectDutchBookFeatures | bol-interface.py | Python | mit | 2,397 |
from django.test import TestCase
class AnimalTestCase(TestCase):
def setUp(self):
print 2
def test_animals_can_speak(self):
"""Animals that can speak are correctly identified"""
print 3
| inmagik/contento | contento/tests/__init__.py | Python | mit | 220 |
"""Cloud Storage
:copyright: (c) 2018 by Scott Werner.
:license: MIT, see LICENSE for more details.
"""
import logging
from enum import Enum, unique
from cloudstorage.base import Blob, Container, Driver
from cloudstorage.exceptions import CloudStorageError
from cloudstorage.typed import Drivers
__all__ = [
"Blob... | scottwernervt/cloudstorage | src/cloudstorage/__init__.py | Python | mit | 3,311 |
'''
Copyright 2013 Cosnita Radu Viorel
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute... | rcosnita/fantastico | fantastico/rendering/tests/itest_component_reusage.py | Python | mit | 3,406 |
#!/usr/bin/env micropython
from time import sleep
from sys import stderr
from os import listdir
from ev3dev2.console import Console
"""
Used to iterate over the system console fonts (in /usr/share/consolefonts) and show the max row/col.
Font names consist of three parameters - codeset, font face and font size. The cod... | dwalton76/ev3dev-lang-python | utils/console_fonts.py | Python | mit | 2,278 |
#!/usr/bin/env python
import threading
from threading import Thread
from flask import jsonify
from flask import render_template
from flask import Flask, redirect
from flask.ext.socketio import SocketIO, emit
from time import sleep
import json
import rethinkdb as r
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secr... | ampasowa/factstream | webapp/run.py | Python | mit | 4,469 |
from .base import DataWizardBackend
from django.core.cache import cache
import threading
import uuid
CACHE_PREFIX = "data-wizard-"
def is_uuid(task_id):
if not task_id:
return False
if len(task_id) != 36:
return False
return True
class Backend(DataWizardBackend):
current_state = No... | wq/django-data-wizard | data_wizard/backends/threading.py | Python | mit | 1,186 |
from ConfigParser import SafeConfigParser
import requests
class Client(object):
def __init__(self, configFileName):
self.config = SafeConfigParser()
self.config.read(configFileName)
def send(self, recepient, message):
if message.platform == "facebook":
return self.sendFacebookMessage(recepient, message)
... | yaohongkok/py-one-chat | onechat/client.py | Python | mit | 747 |
import os
import sys
import unittest2
import mitogen
import mitogen.ssh
import mitogen.utils
import testlib
import plain_old_module
def get_sys_executable():
return sys.executable
def get_os_environ():
return dict(os.environ)
class LocalTest(testlib.RouterMixin, unittest2.TestCase):
stream_class =... | ConnectBox/wifi-test-framework | ansible/plugins/mitogen-0.2.3/tests/local_test.py | Python | mit | 1,663 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'Multipass.ui'
#
# Created: Tue Feb 04 23:58:25 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Attr... | marclr/passwordGenerator | Multipass.py | Python | mit | 8,642 |
import os
import re
import urllib
import urlparse
from django.http import HttpResponseRedirect
from facetools.url import translate_url_to_facebook_url, facebook_redirect
GET_REDIRECT_PARAM = 'facebook_redirect'
class FandjangoIntegrationMiddleware(object):
def process_response(self, request, response):
... | bigsassy/django-facetools | facetools/middleware.py | Python | mit | 3,207 |
# -*- coding: utf-8 -*-
import datetime
import constants
# Choose and configure the browser of your choice
def get_browser():
return webdriver.Chrome()
# The host and port where the tested ap shoud listen.
HOST = '127.0.0.1'
PORT = 8080
# The host alias set in the /etc/hosts file.
# The actual tests will navi... | viksvampire19/Twigle | authomatic-master/tests/functional_tests/config-template.py | Python | mit | 6,344 |
from setuptools import setup
setup(
name='ipy',
packages=['ipy'],
include_package_data=True,
install_requires=[
'flask'
],
)
| rmcintosh/ipy | setup.py | Python | mit | 155 |
# -*- coding: utf-8 -*-
""" MPR Missing Persons Registry
@author: nursix
@see: U{http://eden.sahanafoundation.org/wiki/BluePrintVITA}
"""
module = "mpr"
if deployment_settings.has_module(module):
#
# Settings --------------------------------------------------------------------
#
resource =... | luisibanez/SahanaEden | models/mpr.py | Python | mit | 5,652 |
import os
from datetime import datetime
from HinetPy import Client
username = os.environ["HINET_USERNAME"]
password = os.environ["HINET_PASSWORD"]
client = Client(username, password)
starttime = datetime(2017, 1, 1, 0, 0)
client.get_continuous_waveform("0101", starttime, 20, threads=4)
| seisman/HinetPy | tests/localtest_client_multi_threads.py | Python | mit | 289 |
import logging
import redis
from django.conf import settings
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.views import PasswordChangeView
from django.http import H... | hoelsner/product-database | django_project/views.py | Python | mit | 7,479 |
from maracas import add_noise, asl_meter, rms_energy
from maracas.utils import wavread
import numpy as np
def test_add_noise_rms():
x, fs = wavread('tests/sp10.wav')
n, _ = wavread('tests/ssn.wav')
y, n_scaled = add_noise(x, n, fs, 5.0)
snr = rms_energy(x) - rms_energy(n_scaled)
assert np.isclos... | jfsantos/maracas | tests/test_add_noise.py | Python | mit | 663 |
import functools
import flask_login
import signals
import inspect
from mocha import (utils,
abort,
request,
)
from mocha.core import apply_function_to_members
from . import (is_authenticated,
not_authenticated,
ROLES_ADMIN,
... | mardix/Mocha | mocha/contrib/auth/decorators.py | Python | mit | 5,732 |
#
# The Python Imaging Library.
# $Id$
#
# PCX file handling
#
# This format was originally used by ZSoft's popular PaintBrush
# program for the IBM PC. It is also supported by many MS-DOS and
# Windows applications, including the Windows PaintBrush program in
# Windows 3.
#
# history:
# 1995-09-01 fl Cr... | robiame/AndroidGeodata | pil/PcxImagePlugin.py | Python | mit | 4,834 |
from flask_wtf import Form
from wtforms import ValidationError
from wtforms.fields import StringField, SubmitField, SelectField
from wtforms.fields.html5 import EmailField, TelField
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from wtforms.validators import Length, Email, Optional, InputRequired
from ..cu... | hack4impact/vision-zero-philly | app/admin/forms.py | Python | mit | 2,108 |
"""
Exceptions:
mccabehalsted: there are triple curly brackets ({{{) in jm1 that jekyll doesn't like
spe: is in "other" directory in terapromise
reuse: double curly brackets in reuse
dump: links end like "/ABACUS2013" without closing slash
"""
relativePath = "defect/ck/"
import os, re, datetime
from types import Non... | opensciences/var | Import from googlecode/importAutomation.py | Python | mit | 4,045 |
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import argparse
import re
import shutil
class Colour(object):
"""Utility class for colour printing messages"""
RED = '\033[91m'
WHITE = '\033[97m'
END = '\033[0m'
@staticmethod
def print(colour, msg, end="\n"):
... | ElliottH/tvrename | tvrename.py | Python | mit | 7,125 |
from auth import authenticate
import sample_upload
def check():
asdf = auth.authenticate()
return asdf
check()
| LockScreen/Backend | test.py | Python | mit | 121 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('tester', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='MySimpleModel',
fields=[
... | akaariai/drf-fast-serializer | benchmark/tester/migrations/0002_mysimplemodel.py | Python | mit | 651 |
# -*- coding: utf-8 -*-
import os,logging
from google.appengine.api import users
from google.appengine.ext import db
from google.appengine.ext.db import Model as DBModel
from google.appengine.api import memcache
from google.appengine.api import mail
from google.appengine.api import urlfetch
from google.appengi... | mozillazg/mzgblog | model.py | Python | mit | 30,298 |
from PIL import ImageGrab
from StringIO import StringIO
import pyautogui
class RemoteDesktop:
def __init__(self):
self.size = pyautogui.size()
self.quality = 50
def changeQuality(self, quality):
self.quality = quality
return quality
def getPicture(self... | vuquangtam/WebAPI-Flask | app/mod_remote/api/remotedesktop.py | Python | mit | 696 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import unittest
import os
import re
import json
try:
from mock import patch, MagicMock, ANY
except ImportError:
from unittest.mock import patch, MagicMock, ANY
from .context import pydatajson
from pydatajson.federation import *
from pydatajson.... | datosgobar/pydatajson | tests/test_federation.py | Python | mit | 38,400 |
# clean-copy-trials.py
# old bailey
#
# given a directory of trial files each marked with XML
# create a parallel directory of files with all tagging stripped
import os, sys, re
# given a directory string, return a list of file names
def getFileNames(dirstr):
dircommand = 'dir ' + dirstr + ' /B'
filelist = os... | williamjturkel/Digital-History-Hacks--2005-08- | clean-copy-trials.py | Python | mit | 2,219 |
#_*_ coding: utf-8 _*_
t1 = ()
print type(t1)
t3 = 1,2,3
print type(t3)
r1 = (1)
print r1
print type(r1)
r1 = (1,)
print r1
print type(r1)
t = (1,2,3)
print t*2
print t+('aaa','bbb')
print t
print
print t[0], t[1:3]
print len(t)
print 1 in t
print range(1,3)
t= (12345,54321,'hhh')
u = t,(1,2,3,4,5)
print u
t2 ... | JaeGyu/PythonEx_1 | 20160124_1.py | Python | mit | 473 |
import os
import sys
import cgi
import json
import tarfile
import tempfile
import urllib.parse
import arrow
import requests
from requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor
import bush.meta
INFO = 0
LOW = 1
MODERATE = 2
HIGH = 3
EXTREME = 4
class BushFile():
def __init__(self, tag, nam... | BestPig/bush | client/bush/api.py | Python | mit | 9,693 |
from .todict import *
from .toxml import *
class Dyslexml:
def __init__(self):
self.toDict = todict.parse
self.toXml = toxml.translate
| ccubed/Dyslexml | dyslexml/__init__.py | Python | mit | 157 |
from distutils.core import setup, Extension
import numpy
from Cython.Distutils import build_ext
setup(
name='MCores',
version='1.0',
cmdclass={'build_ext': build_ext},
ext_modules=[Extension("MCores",
sources=["kernelModesCluster.pyx"],
language="c++",
... | hhjiang/mcores | setup.py | Python | mit | 436 |
import unittest
from etk.extractors.language_identification_extractor import LanguageIdentificationExtractor
class TestLanguageIdentificationExtractor(unittest.TestCase):
def test_langid(self):
extractor = LanguageIdentificationExtractor()
text_en = "langid.py comes pre-trained on 97 languages (I... | usc-isi-i2/etk | etk/unit_tests/test_language_identification_extractor.py | Python | mit | 1,687 |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://moltres:sertlom@localhost/moltres_radio'
db = SQLAlchemy(app)
class UserDAO(db.Model):
__tablename__ = 'users'
username = db.Column(db.String(), primary_key=True)
active =... | henry-chao/moltres-radio | dbInit.py | Python | mit | 668 |
import os
import transfert
from transfert import Resource
import transfert.actions
import transfert.exceptions
from .utils import delete_files
def test_copy(tmpdir, storages):
f = tmpdir.join('alpha')
f.write_binary(os.urandom(1024 * 40))
f_http = Resource(storages['http']('index.html'))
f_file = Reso... | rbernand/transfert | tests/fonct/test_copy.py | Python | mit | 916 |
from typing import Any
from typing import Dict
from sqlalchemy.orm import declarative_base
from sqlalchemy.orm import declared_attr
Base = declarative_base()
class Foo(Base):
@declared_attr
def __tablename__(cls) -> str:
return "name"
@declared_attr
def __mapper_args__(cls) -> Dict[Any, An... | sqlalchemy/sqlalchemy | test/ext/mypy/plugin_files/issue_7321.py | Python | mit | 427 |
#coding: utf-8
import re
import pymorphy
import pymorphy.utils
text = u'''
Сяпала Калуша по напушке и увазила бутявку. И волит:
— Калушата, калушаточки! Бутявка!
Калушата присяпали и бутявку стрямкали. И подудонились.
А Калуша волит:
— Оее, оее! Бутявка-то некузявая!
Калушата бутявку вычучили.
Бутявка вздребезнулась, ... | artemrizhov/pymorphy | example.py | Python | mit | 1,319 |
#!/usr/bin/python3
import cgi
import json
import sqlite3 as lite
class GetAllPlaylist():
def __init__(self):
db_loc = "/usr/share/ampyche/db/ampychePlaylist.db"
self.db_loc = db_loc
ppll = ''
self.ppll = ppll
ppllpp = ''
self.ppllpp = ppllpp
def _make_a_list(self, genlist):
agen = []
for gen in gen... | ampyche/ampyche | amp-cgi-bin/getters/getallplaylists.py | Python | mit | 1,063 |
# aiosc - a minimalistic OSC communication module using asyncio
#
# Copyright (c) 2014 Artem Popov <artfwo@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, in... | artfwo/aiosc | aiosc.py | Python | mit | 6,724 |
from django.contrib import admin
from .models import BoardGame
admin.site.register(BoardGame)
| fbentz/vedasboardgame | vedasboardgame/boardgame/admin.py | Python | mit | 95 |
from django.db import models
from django.db.models import Q
MECHANISM_CHOICES = (
('phone', 'Fixed phone'),
('mobile', 'Mobile phone'),
('email', 'E-Mail'),
('other', 'Other'),
)
class Company(models.Model):
name = models.CharField(max_length=255)
website = models.URLField(max_length=255, nu... | drf-forms/ember_sample | back/crm/models.py | Python | mit | 1,850 |
import smtplib
from pymongo import MongoClient
import hashlib
import re
from random import randrange
import datetime
from calendar import monthrange
#test
connection = MongoClient("localhost", 27017, connect=False)
db = connection['database']
collection = db['rooms']
"""
Returns hashed password
Args:
text - strin... | stuysu/roomres.stuysu.org | utils/utils.py | Python | mit | 7,391 |
"""A simple ctypes Wrapper of FlyCapture2_C API. Currently this only works with
graysale cameras in MONO8 or MONO16 pixel format modes.
Use it as follows:
>>> c = Camera()
First you must initialize.. To capture in MONO8 mode and in full resolution
run
>>> c.init() #default to MONO8
Init also turns... | andrej5elin/camera | camera/bfly.py | Python | mit | 32,554 |
#!/usr/bin/env python
#To find epsilon of machine
eps = 1.0
while 1.0+eps > 1.0:
eps = eps/2.0
print eps
| cheekujodhpur/ae320 | a1/eps.py | Python | mit | 112 |
import datetime
import time
import re
from .spec import Spec
from .util import InvalidSpecError, UnconvertedValue
class Date(Spec):
def __init__(self, fmt):
self._fmt = fmt
self._width = _formatter_width(fmt)
@property
def width(self):
return self._width
def from_bytes(self, ... | jeremylowery/stypes | stypes/date.py | Python | mit | 6,085 |
"""Admin functionality for services."""
from django.contrib import admin
from django.contrib.admin import site
from leaflet.admin import LeafletGeoAdmin
from .models import Service, ServiceImage
class ServiceImageInline(admin.TabularInline):
"""The inline for service images."""
model = ServiceImage
ex... | empowerhack/HealthMate | healthmate/services/admin.py | Python | mit | 530 |
from django.contrib import admin
from .models import Recipe, IngredientRequirement, Ingredient
admin.site.site_header = 'TJ White\'s website admin panel'
admin.site.site_title = 'TJ White\'s personal website'
admin.site.index_title = 'Administration'
class IngredientRequirementInline(admin.TabularInline):
model ... | thjwhite/personal_website | personal_website/recipes/admin.py | Python | mit | 700 |
import socket
import json
import logging
from clearskies.exc import TransportException
log = logging.getLogger(__name__)
class Transport(object):
def __init__(self, control_path):
self.control_path = control_path
def connect(self):
raise NotImplementedError()
def send(self, js):
... | shish/python-clearskies | clearskies/transport.py | Python | mit | 3,430 |
#!/usr/bin/env python3
###############################################################################
# Copyright (c) 2015 Jamis Hoo
# Distributed under the MIT license
# (See accompanying file LICENSE or copy at http://opensource.org/licenses/MIT)
#
# Project: Distributed Image Search Engine
# Filename:... | JamisHoo/Distributed-Image-Search-Engine | src/storage_node/storage_node.py | Python | mit | 2,071 |
from django import template
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter(needs_autoescape=True)
def goallist(s, autoescape=True):
result = []
for line in (l.strip() for l in s.split('\n')):
if line:
... | Code4SA/ndp | ndp/templatetags/sectors.py | Python | mit | 480 |
"""
Database Models Library
"""
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
# Model to store information about devices
class Device(db.Model):
__tablename__ = 'clients'
id = db.Column(db.Integer, primary_key = True)
name = db.Column(db.Text)
api_key = db.Column(db.Text)
active ... | How2Compute/SmartHome | hub/Models.py | Python | mit | 2,593 |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 7 00:16:31 2016
@author: Dennis
"""
import numpy as np
import transformations
import utm
import gmplot
from geopy.distance import vincenty
def readINS(filename):
results = []
f = open(filename, 'r')
c = 0
for line in f:
if c < ... | dennissv/forestvision | Python/ReadCompute.py | Python | mit | 8,907 |
# -*- coding: utf-8 -*-
from irc3.plugins.command import command
from irc3 import asyncio
import irc3
import time
__doc__ = '''
===============================================
:mod:`irc3.plugins.pager` Paginate large output
===============================================
Usage
=====
.. literalinclude:: ../../examples... | mrhanky17/irc3 | irc3/plugins/pager.py | Python | mit | 2,886 |
import pytest
from .utils import digit_float
import numpy as np
vowel_data_y_dimension = 11
@pytest.fixture
def vowel_data():
from esl_model.datasets import VowelDataSet
data = VowelDataSet()
return data.return_all()
@pytest.fixture
def SAHeart_data():
from esl_model.datasets import SAHeartDataSet... | littlezz/ESL-Model | tests/test_ch4.py | Python | mit | 5,437 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
"""
(c) 2015 Ronan Delacroix
Python Job Manager Server API
:author: Ronan Delacroix
"""
from flask import Flask, request, Response, render_template, url_for
from functools import wraps
import json
from flask.views import MethodView
import mo... | ronhanson/python-jobmanager-api | jobmanager/api.py | Python | mit | 16,531 |
"""
WSGI config for twitter-tools project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... | jparicka/twitter-tools | twitter-tools/wsgi.py | Python | mit | 403 |
#!/usr/local/bin/python3.4
# encoding: utf-8
import os
import sys
import string
import warnings
import numpy as NP
from functools import partial
warnings.filterwarnings('ignore')
def levenshtein_dist(w1, w2, LuT):
'''
returns: levenshtein distance as int
pass in: two words as python strings;
this fn for the e... | alexland/levenshtein-in-cython | levpy/levenshtein.py | Python | mit | 791 |
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'scrapers'))
sys.path.append("..")
from datetime import datetime
from pymongo import MongoClient
from database import *
import error
import sync
import team_accounting as teamAccountingApi
def importTeamAccounting ( school_id, branch_id, team... | boh1996/LectioAPI | importers/importTeamAccounting.py | Python | mit | 1,725 |
"""HOOMD simulation format."""
import itertools
import operator
import warnings
from collections import namedtuple
import numpy as np
import parmed as pmd
import mbuild as mb
from mbuild.utils.conversion import RB_to_OPLS
from mbuild.utils.io import import_
from mbuild.utils.sorting import natural_sort
from .hoomd_s... | iModels/mbuild | mbuild/formats/hoomd_simulation.py | Python | mit | 16,626 |
#!/usr/bin/env python3
# Copyright (c) 2016-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test NULLDUMMY softfork.
Connect to a single node.
Generate 2 blocks (save the coinbases for later).
G... | syscoin/syscoin | test/functional/feature_nulldummy.py | Python | mit | 7,351 |
import collections
from supriya import CalculationRate
from supriya.ugens.PureUGen import PureUGen
class LFTri(PureUGen):
"""
A non-band-limited triangle oscillator unit generator.
::
>>> supriya.ugens.LFTri.ar()
LFTri.ar()
"""
### CLASS VARIABLES ###
__documentation_sect... | Pulgama/supriya | supriya/ugens/LFTri.py | Python | mit | 542 |
"""
Utility functions for testing
"""
import os
import pathlib
import platform
import re
import subprocess
import tempfile
import unittest
from urllib.request import urlopen
import warnings
import enum
from typing import Iterable, Union, List, Optional
TMPDIR = pathlib.Path(tempfile.gettempdir())
ARCH = (os.getenv("... | hugsy/gef | tests/utils.py | Python | mit | 11,501 |
from itertools import product
import matplotlib.pyplot as plt
from neupy import algorithms, utils, init
from utils import plot_2d_grid, make_circle, make_elipse, make_square
plt.style.use('ggplot')
utils.reproducible()
if __name__ == '__main__':
GRID_WIDTH = 4
GRID_HEIGHT = 4
datasets = [
mak... | itdxer/neupy | examples/competitive/sofm_compare_weight_init.py | Python | mit | 1,754 |
from __future__ import absolute_import
class Ngram(object):
def __init__(self, token):
self.token = token
self.count = 1
self.after = []
def __str__(self):
return str({
'after': self.after,
'count': self.count
})
def __repr__(self):
... | pennetti/voicebox | server/src/voicebox/ngram.py | Python | mit | 878 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Prospector runner for beardo-control
"""
# stdlib imports
import sys
# third-party imports
from prospector import run
# this looks like an unused import, but we're only using it to do some path
# manipulation on import so you can safely ignore it (even though your lint... | paddycarey/beardo-control | app/run-prospector.py | Python | mit | 715 |
from flask import render_template
def home():
return render_template('index.html') | andymitrich/pygask | application/views.py | Python | mit | 88 |