code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
import os
from setuptools import setup, find_packages
version = __import__('readymap').__version__
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), ... | pelicanmapping/readymap-python | setup.py | Python | mit | 723 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2018-01-03 12:57
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('baza', '0002_auto_20151209_2246'),
]
operations = [
... | szymanskirafal/ab | baza/migrations/0003_auto_20180103_1357.py | Python | mit | 3,364 |
#!/usr/bin/env python
import glob
import os
import random
import vedit
import logging
logging.basicConfig()
log = logging.getLogger()
log.setLevel( logging.DEBUG )
def example01():
'''Clip 2 seconds out of the middle of a video.'''
# Clipping 2 seconds out of source video from 1.5 seconds to 3.5 second... | digitalmacgyver/vedit | examples.py | Python | mit | 16,762 |
import py
import errno
def test_error_classes():
for name in errno.errorcode.values():
x = getattr(py.error, name)
assert issubclass(x, py.error.Error)
assert issubclass(x, EnvironmentError)
def test_picklability_issue1():
e1 = py.error.ENOENT()
s = py.std.pickle.dumps(e1)
e2... | Magicjarvis/py | testing/root/test_error.py | Python | mit | 1,750 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
"jso... | sloev/pycorm | setup.py | Python | mit | 1,378 |
from textblob import TextBlob
def to_english(message, original_language=None):
blob = TextBlob(text)
if original_language is not None:
return blob.translate(from_lang=original_language, to="en")
else:
return blob.translate(to="en") | itsmeolivia/language-learner | translate.py | Python | mit | 241 |
# -*- coding: utf-8 -*-
# flake8: noqa
from __future__ import unicode_literals
from .__about__ import __version__, __description__, __author__, __url__
from .benchmark import Benchmark, RunResult, DEFAULT_TIMES
from .report import BaseReporter, JsonReporter, CsvReporter, MarkdownReporter, RstReporter, FileReporter, Fi... | noirbizarre/minibench | minibench/__init__.py | Python | mit | 365 |
import mUnit
from mUnit import UNIT_NONE, UNIT_SOLDIER, UNIT_BASE, UNIT_WORKER, UNITS, UNIT_RES
from mUnit import NoneUnit
from misc import mTimer
from misc.mLogger import log
from mCamp import Camp
LENGTH, HEIGTH = 20, 20
POPULATION_LIMIT = 20
class mArray(object):
def __init__(self, length, heigth):
self.lengt... | tristeen/RTS-Simulator | rts/mMap.py | Python | mit | 7,527 |
# coding: utf-8
from tapioca import (JSONAdapterMixin, TapiocaAdapter,
generate_wrapper_from_adapter)
from .resource_mapping import RESOURCE_MAPPING
class InstagramClientAdapter(JSONAdapterMixin, TapiocaAdapter):
api_root = 'https://api.instagram.com/v1/'
resource_mapping = RESOURCE_MAP... | vintasoftware/tapioca-instagram | tapioca_instagram/tapioca_instagram.py | Python | mit | 1,118 |
from .. import describe
import sys
init_parser = describe.init_parser
async def main(*args, **kwargs):
await describe.main_after_parsing(*args, **kwargs)
print('!!! `hailctl dataproc describe` is DEPRECATED. Please use `hailctl describe` instead. !!!', file=sys.stderr)
| hail-is/hail | hail/python/hailtop/hailctl/dataproc/describe.py | Python | mit | 281 |
from .pearson import Pearson
__all__ = ["Pearson"]
| madgik/exareme | Exareme-Docker/src/mip-algorithms/PEARSON_CORRELATION/__init__.py | Python | mit | 52 |
# -*- coding: utf-8 -*-
"""
tomorrow night blue
---------------------
Port of the Tomorrow Night Blue colour scheme https://github.com/chriskempson/tomorrow-theme
"""
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String, Error, Text, \
Number, Operator, Generic, Whitespace, ... | thergames/thergames.github.io | lib/tomorrow-pygments/styles/tomorrownightblue.py | Python | mit | 5,509 |
from django.conf.urls import url, include
from snippets.views import SnippetViewSet, UserViewSet
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register(r'snippets', SnippetViewSet)
router.register(r'users', UserViewSet)
urlpatterns = [
url(r'^', include(router.urls)),
]
| datyayu/cemetery | [Python][Django] Rest framework tutorial/snippets/urls.py | Python | mit | 314 |
# lesson4/exercises.py
# Control flow and conditionals
#
# This file contains exercises about Python conditionals.
# Last lesson, we encountered the boolean type.
# Python uses booleans to evaluate conditions.
# Last time, we directly assigned boolean values True and False, but booleans are
# also returned by compari... | vinaymayar/python-game-workshop | lesson4/exercises.py | Python | mit | 6,887 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_sku.py | Python | mit | 1,681 |
from thinglang.compiler.opcodes import OpcodeJump
from thinglang.parser.blocks.conditional import Conditional
from thinglang.parser.blocks.loop import Loop
from thinglang.parser.nodes import BaseNode
class BreakStatement(BaseNode):
"""
Jumps to the end of the currently executing loop or conditional
"""
... | ytanay/thinglang | thinglang/parser/statements/break_statement.py | Python | mit | 770 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = 'Ledstrain'
SITENAME = 'Ledstrain Wiki'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'America/Los_Angeles'
DEFAULT_LANG = 'en'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATO... | Ledstrain/ledstrain.github.io | pelicanconf.py | Python | mit | 988 |
import pytest
from pydockerfile.parser import DockerfileParser
DOCKERFILE_PATH = 'tests/dockerfiles/basic.Dockerfile'
DOCKERFILE_LINE_CONT_PATH = 'tests/dockerfiles/line-cont.Dockerfile'
DOCKERFILE_WITH_COMMENTS_PATH = 'tests/dockerfiles/with-comments.Dockerfile'
@pytest.fixture
def dockerfile_str():
with open... | sbuss/pydockerfile | tests/fixtures.py | Python | mit | 884 |
# Python - 3.6.0
Test.assert_equals(cube_checker(-12,2), False)
Test.assert_equals(cube_checker(8, 3), False)
Test.assert_equals(cube_checker(8, 2), True)
Test.assert_equals(cube_checker(-8,-2), False)
Test.assert_equals(cube_checker(0, 0), False)
Test.assert_equals(cube_checker(27, 3), True)
Test.assert_equals(cub... | RevansChen/online-judge | Codewars/8kyu/find-out-whether-the-shape-is-a-cube/Python/test.py | Python | mit | 579 |
"""Simple animation example using BlinkyTape.py"""
from BlinkyTape import BlinkyTape
from time import sleep
import optparse
parser = optparse.OptionParser()
parser.add_option("-p", "--port", dest="portname",
help="serial port (ex: /dev/ttyUSB0)", default=None)
(options, args) = parser.parse_args()
... | jpsingleton/BlinkyTape_Python | scanline.py | Python | mit | 734 |
# from ._config import load_js_libs
from ._proxy import Proxy
from ._highcharts import Highcharts
from ._highstock import Highstock
from ._global_options import GlobalOptions
from ._theme import Theme
from . import sample
from . import build
from ._clock import Clock
__all__ = ['Highcharts',
'Highstock'... | oscar6echo/ezhc | ezhc/__init__.py | Python | mit | 463 |
import numpy as np
import logging
import glob
import bandwise_features as BF
import time
import mir3.modules.features.stats as feat_stats
import mir3.modules.tool.to_texture_window as texture_window
import remove_random_noise as rrn
from multiprocessing import Pool
logger = logging.getLogger("birdclef_tza_bands")
logg... | pymir3/pymir3 | scripts/ismir2016/birdclef_tza_bands.py | Python | mit | 13,712 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-10 07:19
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailimages', '0019_delete_filter'),
('core', '00... | jordij/nzhuts | nzhuts/core/migrations/0003_auto_20170810_0719.py | Python | mit | 3,429 |
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 07 16:23:24 2016
@author: Xiaoqing
"""
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import BernoulliNB
from sklearn.naive_bayes import MultinomialNB
from sklearn.linear_model import LogisticRegression
from NaiveBayes_sp import ... | xiaoqing1993/kaggle_abstract_classification | try_scikit_package.py | Python | mit | 1,211 |
#* PYTHON EMAIL PROJECT *#
#* tests.py *#
#* Fordham CSS September 25 *#
#* ------------------------------------ *#
#* Unit tests for PyDate program *#
from Email_Object import Email
from Get_Emails import Set_Priority
import unittest
# Unit Tests for Set_Priorit... | nickdibari/pydate | tests.py | Python | mit | 1,632 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
from collections import namedtuple
from typing import List, Union
import numpy as np
from astropy.io import fits
TimeChunk = namedtuple('TimeChunk', 'start_time num_of_samples')
def split_time_range(time_length: float,
num_of_chunks: int,
... | ziotom78/stripeline | stripeline/timetools.py | Python | mit | 11,654 |
from openslides.utils.exceptions import OpenSlidesError
class ProjectorException(OpenSlidesError):
pass
class TagException(OpenSlidesError):
pass
class ConfigError(OpenSlidesError):
pass
class ConfigNotFound(ConfigError):
pass
| rolandgeider/OpenSlides | openslides/core/exceptions.py | Python | mit | 251 |
class Solution(object):
def countBattleships(self, board):
"""
:type board: List[List[str]]
:rtype: int
"""
ret = 0
for i in range(len(board)):
for j in range(len(board[i])):
if board[i][j] == 'X':
if i>0 and board[i-1][j] == 'X':
... | xingjian-f/Leetcode-solution | 419. Battleships in a Board.py | Python | mit | 487 |
#/usr/bin/python2.6
import unittest
import sys
sys.path.insert(0, '../')
simpleList = [('', , ), ('', , )]
complexList = [('', , ), ('', , )]
equalPopularity = [('', , ), ('', , )]
checkAllSongs = [('', , ), ('', , )]
class zipfSongTestCase(unittest.TestCase):
def setUp(self):
self.simpleList = simpleL... | gravyboat/spotify-puzzles | zipfsong/test/test_zipfSong.py | Python | mit | 1,421 |
# coding: utf-8
###################################################################
# Copyright (c) 2016-2022 European Synchrotron Radiation Facility #
# #
# Author: Marius Retegan #
# ... | mretegan/crispy | crispy/utils.py | Python | mit | 2,446 |
#!/usr/bin/env python
import pprint
import re
import os, sys
import unittest
sys.path[0:0] = ['.', '..']
from pycparser import c_parser
from pycparser.c_ast import *
from pycparser.c_parser import CParser, Coord, ParseError
_c_parser = c_parser.CParser(
lex_optimize=False,
yacc_debug... | rwbogl/gbg | pycparser/tests/test_c_parser.py | Python | mit | 63,146 |
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
from .application import *
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
STATIC_ROOT = os.path.join(PROJECT_BASE_DIR, 'dist', 'static')
MEDIA_ROOT = os.path.join(PROJECT_BASE_DIR, 'dist', 'media')
STATICFILES_STORAG... | paulsoh/moxie | moxie/moxie/settings/partials/static.py | Python | mit | 2,938 |
from rest_framework import serializers
from django.contrib.auth.models import User
from app1.models import Tweet
class TweetSerializer(serializers.ModelSerializer):
user = serializers.Field(source='user')
class Meta:
model = Tweet
fields = ('text', 'user', 'timestamp')
def validate_text... | aredmond/djangular | code/app1/serializers.py | Python | mit | 738 |
from settings import *
from binascii import hexlify, unhexlify
from util import upackHex, packHex, utfEncode, utfDecode
from settings import TYPE
from settings import ConnectReturn as CR
class Frame(object):
def __init__(self):
self.idx = 0
def getIncrement(self, payload):
data, idx = utfDecod... | ami-GS/pyMQTT | frame.py | Python | mit | 11,645 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-17 19:19
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):
dependencies = [
migrations.swappable_depende... | samitnuk/online_shop | apps/orders/migrations/0002_auto_20170317_2119.py | Python | mit | 1,976 |
from tests.compiler import compile_snippet, A_ID, LST_ID, SELF_ID, VAL1_ID, internal_call, A_INST, INNER_ID, \
CONTAINER_INNER_ID, STATIC_START
from thinglang.compiler.opcodes import OpcodePushLocal, OpcodePushMember, OpcodePushStatic, OpcodePop, \
OpcodeDereference, OpcodeCallVirtual
def test_direct_member_a... | ytanay/thinglang | tests/compiler/test_access_compilation.py | Python | mit | 1,587 |
#-*- coding:utf-8 -*-
from flask import render_template, redirect, request, url_for, flash
from flask.ext.login import login_user, logout_user, login_required, \
current_user
from . import auth
from .. import db
from ..models import User
from .forms import LoginForm, RegistrationForm
@auth.before_app_request
def ... | crosick/zhishu | app/auth/views.py | Python | mit | 1,613 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import icu
def all_glyphs(prop):
return [c.encode('utf-16', 'surrogatepass').decode('utf-16') for c in icu.UnicodeSetIterator(icu.UnicodeSet(r'[:{}:]'.format(prop)))]
def all_cps(prop):
return list(map(glyph_cp, all_glyphs(prop)))
def glyph_name(glyph, default=... | longnow/panlex-tools | libpython/ben/icu_tools.py | Python | mit | 2,046 |
# Copyright (c) 2015 Christian Alis
#
# See the file LICENSE for copying permission.
from __future__ import absolute_import
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from urllib import unquote
from scipy.stats import zscore
def plot_corr(results):
"""
Plot t... | ianalis/treepy | treepy/plotting.py | Python | mit | 2,994 |
from modeltranslation.translator import register, TranslationOptions
from .models import DayTemplateRule, RuleSet
@register(DayTemplateRule)
class SimpleRuleTranslation(TranslationOptions):
fields = ('name',)
@register(RuleSet)
class RuleSetTranslation(TranslationOptions):
fields = ('name',)
| alehenaff/prodplanner | planner/translation.py | Python | mit | 303 |
"""
# A Better Where
WHERE2 is a near-linear time top-down clustering alogithm.
WHERE2 updated an older where with new Python tricks.
## Standard Header Stuff
"""
from __future__ import division,print_function
import sys
sys.dont_write_bytecode = True
from lib import *
from numpy import var
from Models import *... | bigfatnoob/DISCAW | where2.py | Python | mit | 11,873 |
# Moothedata command.
import click
import fiona as fio
from fiona.fio.cli import cli
from fio_metasay import moothedata
@cli.command(short_help="Cowsay some dataset metadata.")
@click.argument(
'inputfile',
type=click.Path(resolve_path=True),
required=True,
metavar="INPUT")
@click.option('--item', ... | geowurster/fio-plugin-example | fio_metasay/scripts/cli.py | Python | mit | 575 |
#!/usr/bin/env python
import pstats
import sys
from subprocess import check_call
stat_file = '/tmp/profile_data'
check_call(['python', '-m', 'cProfile', '-o', stat_file] + sys.argv[1:])
p = pstats.Stats(stat_file)
p.sort_stats('cumulative').print_stats(8)
| ivanovwaltz/wavelet_sound_microscope | profileit.py | Python | mit | 261 |
from base64 import standard_b64encode, standard_b64decode
import nacl.bindings
import nacl.utils
from nacl.secret import SecretBox
from pymacaroons.field_encryptors.base_field_encryptor import (
BaseFieldEncryptor
)
from pymacaroons.utils import (
truncate_or_pad, convert_to_bytes, convert_to_string
)
class... | matrix-org/pymacaroons | pymacaroons/field_encryptors/secret_box_encryptor.py | Python | mit | 1,205 |
# -*- coding: utf-8 -*-
import unittest
from unittest import TestCase
from sklearn.naive_bayes import BernoulliNB
from tests.estimator.classifier.Classifier import Classifier
from tests.language.JavaScript import JavaScript
class BernoulliNBJSTest(JavaScript, Classifier, TestCase):
def setUp(self):
su... | nok/sklearn-porter | tests/estimator/classifier/BernoulliNB/BernoulliNBJSTest.py | Python | mit | 1,182 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
read the config file ,parse config
"""
import os
import ConfigParser
import re
# get config file
def get_config(section, key):
config = ConfigParser.ConfigParser()
path = os.path.split(os.path.split(os.path.realpath(__file__))[0])[0] + '/conf/oms_test.co... | guoxu3/oms_backend | oms/lib/config.py | Python | mit | 1,372 |
# -*- coding: utf-8 -*-
from flask import jsonify, request, g, abort, url_for, current_app
from ..models import Img, Permission
from . import api
from .decorators import permission_required
from .errors import bad_request
from ..img.tag_image import up_R_Img_Label
'''
@api.route('/images/')
#@auth.login_required
def ... | staneyffer/cnsoft_image | app/api_1_0/images.py | Python | mit | 2,522 |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses... | tzpBingo/github-trending | codespace/python/tencentcloud/iai/v20200303/iai_client.py | Python | mit | 65,319 |
import energykit
import tornado.web
class _Handler(tornado.web.RequestHandler):
def initialize(self, stream):
self.stream = stream
def get(self):
self.write_form()
def post(self):
value = self.get_argument('value', '50')
if value: self.stream.set_value(value)
self.write_form()
def write_... | interactiveinstitute/watthappened | energykit/fake/datastream.py | Python | mit | 1,290 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('editorial', '0049_auto_20171116_1526'),
]
operations = [
migrations.AlterField(
model_name='facet',
... | ProjectFacet/facet | project/editorial/migrations/0050_auto_20171117_1716.py | Python | mit | 437 |
class NRRDError(Exception):
"""Exceptions for NRRD class."""
pass
| mhe/pynrrd | nrrd/errors.py | Python | mit | 74 |
import collections
from supriya.enums import CalculationRate
from supriya.synthdefs import UGen
class Timer(UGen):
"""
::
>>> timer = supriya.ugens.Timer.ar(
... trigger=0,
... )
>>> timer
Timer.ar()
"""
### CLASS VARIABLES ###
_ordered_input_na... | josiah-wolf-oberholtzer/supriya | dev/etc/pending_ugens/Timer.py | Python | mit | 2,231 |
"""
WSGI config for Placeholder 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Placeholder.settings")
from djang... | seanmavley/DjangoHoldit | Placeholder/wsgi.py | Python | mit | 397 |
# Extension imports
from flask.ext.wtf import Form, RecaptchaField
from flask_wtf.html5 import TelField, IntegerField
from wtforms import StringField, PasswordField, BooleanField, SubmitField, TextAreaField, SelectField, DecimalField
from wtforms.validators import Email, DataRequired, EqualTo
#from flask_wtf.file imp... | takwas/flask_app_template | template_app/forms.py | Python | mit | 2,863 |
# ----------------------------------------------------------------------------------
# Electrum plugin for the Digital Bitbox hardware wallet by Shift Devices AG
# digitalbitbox.com
#
import base64
import binascii
import hashlib
import hmac
import json
import math
import os
import re
import struct
import sys
import ti... | neocogent/electrum | electrum/plugins/digitalbitbox/digitalbitbox.py | Python | mit | 32,370 |
import os
import textwrap
import pytest
from pip._internal.status_codes import ERROR
from tests.lib.path import Path
def fake_wheel(data, wheel_path):
data.packages.join(
'simple.dist-0.1-py2.py3-none-any.whl'
).copy(data.packages.join(wheel_path))
@pytest.mark.network
def test_download_if_request... | zvezdan/pip | tests/functional/test_download.py | Python | mit | 17,722 |
import retrying
import selenium
import selenium.webdriver.support.ui as ui
from . import exceptions as ex
@retrying.retry(wait_fixed=1000, retry_on_exception=ex.is_retry_exception)
def get(b, selector, not_found=None):
try:
obj = b.find_element_by_css_selector(selector)
except selenium.common.excepti... | alobbs/webest | webest/obj.py | Python | mit | 2,552 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('builder', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='problem',
name='date_... | kopringo/Scarky2 | Scarky2/builder/migrations/0002_auto_20150505_2035.py | Python | mit | 577 |
# Generated by Django 2.0.5 on 2018-05-07 09:24
from django.conf import settings
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import endpoints.models
class Migration(migrations.Migration):
dependencies = [
... | aapris/IoT-Web-Experiments | iotendpoints/endpoints/migrations/0003_datalogger.py | Python | mit | 1,762 |
from .settings_base import *
from config.keys import keys
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = keys['DJANGO']['LOCAL']
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Database
# https://docs.djangoproject.com/en/1.9/ref/se... | daisychainme/daisychain | daisychain/config/settings_local.py | Python | mit | 1,754 |
#! /usr/bin/env python
import utility_function as uf
import sys
import cv2
import numpy as np
def read_file_list(file_name):
# assume the first argument is the image name and the second one is the label
name_list = list()
label_list = list()
with open(file_name, "r") as f:
s = f.read()
... | polltooh/FineGrainedAction | nn/cal_accuracy_v3.py | Python | mit | 2,845 |
# -*- coding: utf-8 -*-
import unittest
from cwr.grammar.factory.config import rule_options
__author__ = 'Bernardo Martínez Garrido'
__license__ = 'MIT'
__status__ = 'Development'
class TestConfigOptions(unittest.TestCase):
def setUp(self):
self._rule = rule_options
def test_zero_options(self):
... | weso/CWR-DataApi | tests/grammar/config/test_options.py | Python | mit | 919 |
'''
nucleic.seq
Modules related to the creation and manupulation of DNA and RNA sequence
strings, including compact encoding schemes.
'''
from barcode import BarcodeGenerator
import binary
from manip import reverse, complement, reverse_complement
# Space efficient abbreviations
r = reverse
c = complement
rc = re... | glebkuznetsov/nucleic | nucleic/seq/__init__.py | Python | mit | 337 |
#exponent
#find 2^n
n = input("Enter n: ")
print 2**n
| yusufshakeel/Python-Project | example/expo.py | Python | mit | 55 |
#!/usr/bin/env python
import unittest
from day04 import find_integer
class Test(unittest.TestCase):
cases = (
('abcdef', 609043),
('pqrstuv', 1048970),
)
def test_gets_integer(self):
for (key, expected) in self.cases:
result = find_integer(key, zeroes=5)
... | mpirnat/adventofcode | day04/test.py | Python | mit | 521 |
""" process_model.py
Usage:
process_model.py <command> <project_code> <full_model_path> [options]
Arguments:
command action to be run on model, like: qc, audit or dwf
currently available: qc, audit, dwf
project_code unique project code consis... | hdm-dt-fb/rvt_model_services | process_model.py | Python | mit | 14,344 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'mobiconf.views.index', name='index'),
# url(r'^blog/', include('blog.urls')),
url(r'^mobi/', include('mobiconf.urls', namespace='mobiconf')),
... | chengyongyuan/dcs | lightin/lightin/urls.py | Python | mit | 443 |
import Remote
| MHendricks/Motionbuilder-Remote | arduinoremote.py | Python | mit | 14 |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from genericm2m.models import RelatedObjectsDescriptor
@python_2_unicode_compatible
class TModel(models.Model):
name = models.CharField(max_length=200)
test = RelatedObjectsDescriptor()
for_inline = models.Foreig... | shubhamdipt/django-autocomplete-light | test_project/select2_generic_m2m/models.py | Python | mit | 604 |
import urllib.request
import random
import re
from accordion.history_storage import FileHistoryStorage
from accordion.url_hash_provider import YouTubeUrlHashProvider
from accordion.short_link_resolver import ShortLinkResolver
from accordion.utils import calculate_hash
from telegram.ext import (MessageHandler, Filters, ... | izeigerman/accordion-bot | accordion/accordion_bot.py | Python | mit | 7,225 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
# Meta-info
Author: Nelson Brochado
Created: 09/09/2015
Updated: 07/03/2018
# Description
Selection sorting is conceptually probably the simplest sorting algorithm.
This algorithm first finds the smallest element in the list and exchanges it
with the element in ... | nbro/ands | ands/algorithms/sorting/comparison/selection_sort.py | Python | mit | 1,231 |
import pytest
import os, yaml
## SET UP THE DATABASE ENGINE
TEST_DIR = os.path.dirname(os.path.realpath(__file__))
BASE_DIR = os.path.join(TEST_DIR, "../")
ENV = os.environ['CS_ENV'] = "test"
from mock import Mock, patch
import unittest.mock
import simplejson as json
import sqlalchemy
from sqlalchemy import create_e... | c4fcm/CivilServant | tests/test_stylesheet_experiment_controller.py | Python | mit | 19,514 |
# 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/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/_configuration.py | Python | mit | 3,315 |
#!/usr/bin/env python
"""
Wraps genetrack.scripts.tabs2genetrack so the tool can be executed from Galaxy.
usage: %prog input output shift
"""
import sys
from galaxy import eggs
import pkg_resources
pkg_resources.require( "GeneTrack" )
from genetrack.scripts import tabs2genetrack
from genetrack import logger
if __n... | volpino/Yeps-EURAC | tools/visualization/genetrack_indexer.py | Python | mit | 980 |
# -*- coding: utf-8 -*-
from flask_bcrypt import Bcrypt
from flask_admin import Admin
from flask_cache import Cache
from flask_login import LoginManager
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
admin = Admin(name='Bookmarks')
bcrypt = Bcrypt()
cache = Cache()
db = SQLAlchemy()
migrate ... | mozillazg/bookmarks | bookmarks/extensions.py | Python | mit | 363 |
"""
Author: Shalin Shah
Project: DNA Cloud
Graduate Mentor: Dixita Limbachya
Mentor: Prof. Manish K Gupta
Date: 5 November 2013
Website: www.guptalab.org/dnacloud
This module contains method to decode the given dnac file.
"""
from cStringIO import StringIO
import sqlite3
import sqlite3 as lite
import unicodedata
impo... | dphiffer/dna-codec | lib/dnacloud/source/decode.py | Python | mit | 19,780 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_mistipy
----------------------------------
Tests for `mistipy` module.
"""
import pytest
# from contextlib import contextmanager
from click.testing import CliRunner
# from mistipy import mistipy
from mistipy import cli
@pytest.fixture
def response():
"""... | adebali/mistipy | tests/test_mistipy.py | Python | mit | 1,075 |
#!/usr/bin/env python
import os
import django
# Base paths
DJANGO_ROOT = os.path.dirname(os.path.realpath(django.__file__))
SITE_ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
# Debugging
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS =... | hacktyler/hacktyler_crime | config/settings.py | Python | mit | 4,568 |
import pytest
from click.testing import CliRunner
from ethcloud import cli
@pytest.fixture
def runner():
return CliRunner()
def test_cli(runner):
result = runner.invoke(cli.main)
assert result.exit_code == 0
assert not result.exception
assert result.output.strip() == 'Hello, world.'
def test_c... | kgritesh/ethcloud | tests/test_cli.py | Python | mit | 715 |
from umqtt.simple import MQTTClient
from machine import Pin
import ubinascii
import machine
import time
import network
# Default MQTT server to connect to
SERVER = "m11.cloudmqtt.com"
PORT = 15034
CLIENT_ID = ubinascii.hexlify(machine.unique_id())
TOPIC = b"hello/world"
USER = "oyqmvonl"
PASSWORD = "eCPIJkxVFWBU"
... | tonyldo/palestra_iot | main.py | Python | mit | 1,887 |
"""
Algorithm for conversion of .WAV audio to zero-crossing signal.
---------------
Myotisoft ZCANT
Copyright (C) 2012-2017 Myotisoft LLC, all rights reserved.
You may use, distribute, and modify this code under the terms of the MIT License.
"""
from __future__ import division
import io
import sys
imp... | riggsd/zcant | zcant/conversion.py | Python | mit | 16,713 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
In this example, we connect a signal
of a QSlider to a slot
of a QLCDNumber.
"""
import sys
from PySide.QtGui import *
from PySide.QtCore import *
class Example(QWidget):
def __init__(self):
super(Example, self).__init__()
lcd = QLCDNumber()
... | madoodia/codeLab | pyside/signal_slot_tests/test_signal_slot.py | Python | mit | 752 |
from bitcoingraph.bitcoind import BitcoinProxy, BitcoindException
from pathlib import Path
import json
TEST_DATA_PATH = "tests/data"
class BitcoinProxyMock(BitcoinProxy):
def __init__(self, host=None, port=None):
super().__init__(host, port)
self.heights = {}
self.blocks = {}
... | behas/bitcoingraph | tests/rpc_mock.py | Python | mit | 2,105 |
# cloudscope.simulation.workload
# Defines simulation processes that generate "work", e.g. accesses.
#
# Author: Benjamin Bengfort <bengfort@cs.umd.edu>
# Created: Wed Jul 27 10:21:57 2016 -0400
#
# Copyright (C) 2016 University of Maryland
# For license information, see LICENSE.txt
#
# ID: __init__.py [b9507c0] ben... | bbengfort/cloudscope | cloudscope/simulation/workload/__init__.py | Python | mit | 2,077 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-06-16 10:38
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('domain_api', '0041_auto_20170616_1037'),
]
operations = [
migrations.RemoveField(
... | heytrav/drs-project | domain_api/migrations/0042_remove_registereddomain_domain.py | Python | mit | 406 |
"""Benchmark for SQLAlchemy.
An adaptation of Robert Brewers' ZooMark speed tests. """
import datetime
import sys
import time
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.test import *
ITERATIONS = 1
dbapi_session = engines.ReplayableSession()
metadata = None
class ZooMarkTest(TestBase):
... | simplegeo/sqlalchemy | test/aaa_profiling/test_zoomark_orm.py | Python | mit | 13,694 |
#!/usr/bin/env python
import argparse
from collections import OrderedDict
import itertools
import sys
from phylotoast import util, graph_util as gu
errors = []
try:
from palettable.colorbrewer.qualitative import Set3_12
except ImportError as ie:
errors.append("No module named palettable")
try:
import matplo... | smdabdoub/phylotoast | bin/PCoA.py | Python | mit | 10,870 |
#!/usr/bin/env python2.7
from os.path import dirname, join, isfile, realpath, relpath, split, exists
from zipfile import ZipFile
import sys
sys.path.insert(0, 'buildlib/jinja2.egg')
sys.path.insert(0, 'buildlib')
from fnmatch import fnmatch
import tarfile
import os
import shutil
import subprocess
import time
import j... | kived/python-for-android | pythonforandroid/bootstraps/pygame/build/build.py | Python | mit | 18,072 |
# This file automatically generated from the python code generator of
# snowball project at https://github.com/shibukawa/snowball by Yoshiki Shibukawa
# using the Tamil stemmer description of Damodharan Rajalingam at https://github.com/rdamodharan/tamil-stemmer
#
# Copyright (c) 2013, Damodharan Rajalingam
#
# self f... | arcturusannamalai/open-tamil | tamilstemmer/tamil_stemmer.py | Python | mit | 131,981 |
import pyotherside
from firebase import firebase
firebase = firebase.FirebaseApplication('https://hacker-news.firebaseio.com', None)
responses = []
getItemsCount = 0
eventCount = 0
itemIDs = []
def getCommentsForItem(itemID):
itemID = int(itemID)
itemID = str(itemID)
item = firebase.get('/v0/item/'+ite... | neversun/sailfish-hackernews | src/main.py | Python | mit | 3,028 |
from perso.settings import *
# Parse database configuration from $DATABASE_URL
import dj_database_url
DATABASES['default'] = dj_database_url.config()
# Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
| arthurio/site_heroku | perso/settings/prod.py | Python | mit | 278 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2020_08_01/aio/operations/_application_gateways_operations.py | Python | mit | 70,561 |
import exifread
import os
import shutil
import dmcutils
from dmcutils import mylog
report = {}
trashFiles = [
'.DS_Store',
'Thumbs.db',
'.picasa.ini'
]
def processVideo(file):
vp = os.path.join(args.targetFolder,'videos')
if not os.path.exists(vp):
os.mkdir(vp)
outPath = os.path.j... | HaBaLeS/digital-mess-cleaner | filesorter.py | Python | mit | 4,411 |
from __future__ import unicode_literals
from django.contrib.auth.models import AnonymousUser
from django.db.models import Q
from haystack import indexes
from reviewboard.reviews.models import ReviewRequest
from reviewboard.search.indexes import BaseSearchIndex
class ReviewRequestIndex(BaseSearchIndex, indexes.Index... | chipx86/reviewboard | reviewboard/reviews/search_indexes.py | Python | mit | 5,009 |
""" A simple module to get the links of first
10 images displayed on google image search
"""
from googleapiclient.discovery import build
class GoogleImageSearch:
def __init__(self,api_key,cse_id):
self.my_api_key = api_key
self.my_cse_id= cse_id
def search(self,search_term,**kwargs):
... | shravan97/WordHunter | ImageSearch/image_searcher.py | Python | mit | 775 |
# Copyright 2004-2017 Tom Rothamel <pytom@bishoujo.us>
#
# 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, m... | kfcpaladin/sze-the-game | renpy/display/joystick.py | Python | mit | 1,793 |
"""Helper functions and view derivers for spynl.main."""
import json
import logging
import traceback
import sys
import os
import contextlib
from functools import wraps
from inspect import isclass, getfullargspec
import yaml
from tld import get_tld
from tld.exceptions import TldBadUrl, TldDomainNotFound
from pyramid.... | SoftwearDevelopment/spynl | spynl/main/utils.py | Python | mit | 18,906 |
#!/usr/bin/env python
"""
Use the Python DTrace consumer and count syscalls by zone.
Created on Oct 10, 2011
@author: tmetsch
"""
from __future__ import print_function
import time
from ctypes import cast, c_char_p, c_int
from dtrace_ctypes import consumer
SCRIPT = 'syscall:::entry { @num[zonename] = count(); }'
... | tmetsch/python-dtrace | examples/ctypes/syscall_by_zone.py | Python | mit | 925 |
import _plotly_utils.basevalidators
class UirevisionValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(self, plotly_name="uirevision", parent_name="scattercarpet", **kwargs):
super(UirevisionValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name... | plotly/plotly.py | packages/python/plotly/plotly/validators/scattercarpet/_uirevision.py | Python | mit | 408 |
from .base import CreateBaseCommand
class PutSearchTemplateCommand(CreateBaseCommand):
command_name = "elasticsearch:put-search-template"
def run_request(self, template_id=None):
if not template_id:
self.show_input_panel(
'Search Template Id: ', '', self.run)
r... | KunihikoKido/sublime-elasticsearch-client | commands/put_search_template.py | Python | mit | 474 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.