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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
class ArchTracker(object):
pass
| MrKiven/REST_ARCH | rest_arch/tracker.py | Python | mit | 62 |
"""
Django settings for classics project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
i... | caterpillar/classics | classics/settings.py | Python | mit | 2,470 |
from json import JSONEncoder
class ModelParaJson(JSONEncoder):
def default(self, o):
return o.__dict__ | AEDA-Solutions/matweb | backend/Framework/ModelParaJson.py | Python | mit | 115 |
from setuptools import setup
setup(name="waveasr",
author="Patrick Tesh",
description="Waveform-based Automatic Speech Recognition with Kaldi and Tensorflow",
url="https://github.com/PaddyT/waveform-asr",
packages=['waveasr'],
version=0.1)
| PaddyT/waveform-asr | setup.py | Python | mit | 271 |
<<<<<<< HEAD
<<<<<<< HEAD
#!K:\ArcherVMPeridot\htdocs\Scripts\python.exe
# $Id: rst2odt.py 5839 2009-01-07 19:09:28Z dkuhlman $
# Author: Dave Kuhlman <dkuhlman@rexx.com>
# Copyright: This module has been placed in the public domain.
"""
A front end to the Docutils Publisher, producing OpenOffice documents.
"""
impo... | ArcherSys/ArcherSys | Scripts/rst2odt.py | Python | mit | 2,516 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Random geometry utilities useful for kinematics and interpolation.
Author: tennessee
Created on: 2017-03-21
Copyright 2017, Tennessee Carmel-Veilleux.
"""
from __future__ import print_function
from numpy import sqrt, pi, sin, cos, floor
from numpy import arctan2 as a... | tcarmelveilleux/CheapDrawBot | Software/utils/geometry.py | Python | mit | 13,000 |
import re
import os
import sys
from Bio import Seq
from Bio import SeqIO
from Bio import SeqUtils
import numpy as np
import pandas as pd
import cairi
from multiprocessing import Pool
import matplotlib.pyplot as plt
#MAYBE WE DONT NEED THAT ANYMORE ...
# # STUPID FIX TO AVOID OLDER PANDAS HERE ...
# # PYTHONPATH seems ... | sergpolly/Thermal_adapt_scripts | BOOTSTRAPS/Equal_Cherry_extract_analyse_CAI_Rnd.py | Python | mit | 7,375 |
"""
Set of "markup" template filters for Django. These filters transform plain text
markup syntaxes to HTML; currently there is support for:
* Textile, which requires the PyTextile library available at
http://loopcore.com/python-textile/
* Markdown, which requires the Python-markdown library from
... | zeraien/odb_shared_django | templatetags/markup.py | Python | mit | 4,253 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
def get_field_types():
"""Get a dict with all registration f... | mic4ael/indico | indico/modules/events/registration/fields/__init__.py | Python | mit | 911 |
#!/usr/bin/env python
#
# Generate pnSeed[] from Pieter's DNS seeder
#
NSEEDS=600
import re
import sys
from subprocess import check_output
def main():
lines = sys.stdin.readlines()
ips = []
pattern = re.compile(r"^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3}):4429")
for line in lines:
m = patte... | DOGECOINCASH/DOGEC | contrib/seeds/makeseeds.py | Python | mit | 708 |
#!/usr/bin/python
DOCUMENTATION = '''
---
module: elasticbeanstalk_env
short_description: create, update, delete beanstalk application environments
description:
- creates, updates, deletes beanstalk environments.
options:
app_name:
description:
- name of the beanstalk application you wish to manage the... | skorochkin/ansible-elastic-beanstalk-with-cleanup | library/elasticbeanstalk_env.py | Python | mit | 12,266 |
'''
Sample: Speudogap model with r = 1
'''
from builtins import input
from numpy import *
from matplotlib.pyplot import *
import time,pdb
from nrgmap.hybri_sc import get_hybri_skew
from nrgmap.discretization import quick_map,check_disc
from nrgmap.chainmapper import map2chain,check_spec
from nrgmap.utils import get_wl... | GiggleLiu/nrg_mapping | samples/sample_superconductor.py | Python | mit | 2,483 |
import util
def decrypt(c1, c2, c3, n1, n2, n3):
"""
Decrypt by executing a Low Public Exponent Attack based on the Chinese Remainder Theorem.
For a good explanation:
http://crypto.stackexchange.com/questions/6713/low-public-exponent-attack-for-rsa
"""
t1 = c1 * (n2 * n3) * util.modinv(n2 ... | historical-ctf/historical-ctf.github.io | static/scripts/task3/solution.py | Python | mit | 867 |
import unittest
from sound.rtttl_parser import RtttlParser
class TestRtttlParser(unittest.TestCase):
SONG = {
'rtttl': 'The Simpsons:d=4,o=5,b=160:c.6,e6,f#6,8a6,g.6,e6,c6,8a,8f#,8f#,8f#,2g,8p,8p,8f#,8f#,8f#,8g,a#.,8c6,8c6,8c6,c6',
'name': 'The Simpsons',
'defaults': ['d=4', 'o=5', 'b=160']... | hertzwhenip/virtual-hammond | server/tests/test_rtttl_parser.py | Python | mit | 2,592 |
import cPickle
import numpy as np
import h5py
from numpy.linalg import norm
from numpy import sqrt
import multiprocessing
import time
tp='real'
#fr = open('dat/db.dat','rb')
#imask = cPickle.load(fr)
#umask = cPickle.load(fr)
#fr.close()
#fr = open('dat/training.dat','rb')
#cPickle.load(fr)
#sm = cPickle.load(fr)
#tm... | wattlebird/Chi | sim/training.py | Python | mit | 2,961 |
#!/usr/bin/python
from manager import Packet, Manager
from threading import Event, Lock
import cherrypy
import datetime
class RequestManager(Manager):
def __init__(self):
Manager.__init__(self, 'RequestManager')
def process(self, packet):
request_id = packet.payload.get('request_id', None)
... | rickbassham/videoencode | requestmanager.py | Python | mit | 8,078 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | Stargrazer82301/CAAPR | CAAPR/CAAPR_AstroMagic/PTS/pts/modeling/data/component.py | Python | mit | 1,631 |
import os
import logging
from . import loader
from nose import plugins
LOG = logging.getLogger('nose.' + __name__)
class NoseScriptUnit(plugins.Plugin):
name = "jscriptunit"
def options(self, parser, env):
super(NoseScriptUnit, self).options(parser, env)
parser.add_option("--jscriptunit-pat... | simpoir/nosescript | nosescript/unit.py | Python | mit | 828 |
"""
A Genpolar task about generators
Eunice Chen 1/3/2014
"""
import numpy as np
def rtpairs(R,N):
'''generates r,n pairs
r and n are lists of the same amount of numbers
'''
for i in range(len(R)):
r=R[i]
n=N[i]
theta = 0.0 #starting with theta = 0
for j in range(N[i]):
... | EuniceChen1/Raytracer-project | genpolar.py | Python | mit | 544 |
import sys
import MonkeyLex
import MonkeyParser
import MonkeyInterpreter
if __name__ == '__main__':
if len(sys.argv) == 2:
data = open(sys.argv[1], 'r').read()
prog = MonkeyParser.parse(data, 1)
print prog
mintp = MonkeyInterpreter.MonkeyInterpreter(prog, "Hello.py")
mintp.... | ideaworld/FHIR_Tester | FHIR_Tester_backend/services/monkey/Monkey.py | Python | mit | 352 |
#!/usr/bin/env python3
# Copyright (c) 2018-2020 The Dash Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.mininode import *
from test_framework.test_framework import DashTestFramework
from test_... | nmarley/dash | test/functional/p2p-instantsend.py | Python | mit | 5,807 |
from django.conf import settings
from django.utils.timezone import now
from {{ project_name }}.conf import config
from .utils import intspace, set_param
def extra(request):
ctx = {
'dir': dir, 'list': list, 'len': len, 'enumerate': enumerate, 'range': range,
'settings': settings, 'config': confi... | pinkevich/django-project-template | project_name/core/context_processors.py | Python | mit | 404 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-25 20:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('talks_keeper', '0002_auto_20161224_1512'),
]
operations = [
migrations.Alte... | samitnuk/talks_keeper | talks_keeper/migrations/0003_auto_20161225_2036.py | Python | mit | 505 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('arm_settings', '0007_authsettings_admin'),
]
operations = [
migrations.AddField(
model_name='authsettings_admin'... | shwetams/arm-samples-py | arm_basic_samples/arm_settings/migrations/0008_authsettings_admin_user_id.py | Python | mit | 448 |
#!/usr/bin/env python
import sys, os, random, pickle, json, codecs, fileinput
import numpy as np
from model import AutumnNER
import sklearn.metrics as skm
import argparse
import conlleval
parser = argparse.ArgumentParser(description='Train and evaluate BiLSTM on a given dataset')
parser.add_argument('files', metavar='... | tttr222/autumn_ner | annotate.py | Python | mit | 3,940 |
#!/usr/bin/env python3
# Copyright (c) 2015-2020 The Fujicoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Functionality to build scripts, as well as signature hash functions.
This file is modified from pytho... | fujicoin/fujicoin | test/functional/test_framework/script.py | Python | mit | 28,869 |
# The MIT License (MIT)
# Copyright (c) 2016 Chris Webb
# 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, ... | chriswebb/sublime-psql-tools | psql_config.py | Python | mit | 1,463 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('disease', '0008_auto_20150814_0740'),
... | jiivan/genoomy | genoome/disease/migrations/0009_auto_20150821_1638.py | Python | mit | 945 |
import os
import signal
def exit_code_str(exception_name, command, exit_code):
"""String representation for an InvocationError, with exit code
NOTE: this might also be used by plugin tests (tox-venv at the time of writing),
so some coordination is needed if this is ever moved or a different solution for ... | Avira/tox | src/tox/exception.py | Python | mit | 2,795 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Squid Bot documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 13 08:47:18 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 this
# ... | bsquidwrd/Squid-Bot | docs/source/conf.py | Python | mit | 5,099 |
# Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.
# click to show follow up.
# Follow up:
# Did you use extra space?
# A straight forward solution using O(mn) space is probably a bad idea.
# A simple improvement uses O(m + n) space, but still not the best solution.
# Coul... | abawchen/leetcode | solutions/073_set_matrix_zeroes.py | Python | mit | 1,406 |
# -*- coding: utf-8 -*-
"""
MapTool.py - base class for map tool
======================================================================
AUTHOR: Wei Wan, Purdue University
EMAIL: rcac-help@purdue.edu
Copyright (c) 2016 Purdue University
See the file "license.terms" for information on usage and
redistribution ... | waneric/PyMapLib | src/gabbs/controls/MapTool.py | Python | mit | 12,950 |
from ..benchmark import run
from lib import sink
import config
import os
import numpy as np
import math
from lib.geo.point import Point
def get_matrix_dimensions():
nx = 25
ny = 25
return (nx, ny,)
def execute():
config.count_hubs = 1
config.sink_dir = '%s/sink' % os.path.dirname(_... | mauzeh/formation-flight | runs/multihub/L_Z_1hub/run.py | Python | mit | 986 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The nealcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the getchaintips RPC.
- introduce a network split
- work on chains of different lengths
- join t... | appop/bitcoin | qa/rpc-tests/getchaintips.py | Python | mit | 2,209 |
from pymongo import MongoClient
from corrdb.common.core import setup_app
from flask.ext.testing import TestCase
import time
import twill
class MongodbTest(TestCase):
def create_app(self):
try:
browser = twill.get_browser()
browser.go("http://localhost:5200/")
app = setu... | wd15/corr | corr-db/corrdb/tests/test_mongodb.py | Python | mit | 1,750 |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 17 20:36:34 2013
This file calls function from the ACS C library wrapper
@author: Pete
"""
from __future__ import division, print_function
import numpy as np
import matplotlib.pyplot as plt
import acsc
import time
axes = {'y':0, 'z':1, 'turbine':4, 'tow':5}
axis = 5
... | petebachant/ACSpy | examples/acsc_mpoint_test.py | Python | mit | 1,462 |
import json
import re
from urllib.request import urlopen
from urllib.error import HTTPError
import psycopg2
from bs4 import BeautifulSoup
from psycopg2 import IntegrityError
from psycopg2.extras import Json
class Scraper:
def __init__(self, db, user, password, api_key, min_congress, max_congress,
... | rbshaffer/gpo_tools | build/lib/gpo_tools/scrape.py | Python | mit | 17,070 |
from geyser.tests.permissions import *
from geyser.tests.models import *
from geyser.tests.query import *
from geyser.tests.managers import *
from geyser.tests.views import *
| MidwestCommunications/django-geyser | geyser/tests/__init__.py | Python | mit | 175 |
"""User objects."""
from collections import namedtuple
import enum
import logging
logger = logging.getLogger(__name__)
DEFAULT_NAME = 'Unknown'
UserID = namedtuple('UserID', ['chat_id', 'gaia_id'])
"""A user ID, consisting of two parts which are always identical."""
NameType = enum.IntEnum('NameType', dict(DEFAUL... | das7pad/hangups | hangups/user.py | Python | mit | 7,978 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
try:
from html.parser import HTMLParser # py3
except ImportError:
from HTMLParser import HTMLParser # py2
from django.forms import widgets
from django.utils.html import format_html
from django.utils.translation import ungettext_lazy, ug... | jtiki/djangocms-cascade | cmsplugin_cascade/bootstrap3/carousel.py | Python | mit | 8,063 |
#coding:utf-8
#########################
#Copyright(c) 2014 dtysky
#########################
def EditFormat(US,UT):
tmp={
'sc':[
0,('k'),{'k':'None'},
('cp','sc'),{'cp':'None','sc':'None'}
],
'sw':[
0,(),{},
('s',),{'s':'None'}
],
'chrlast':[
1,('l','t'),{'l':'None','t':'None'}... | dtysky/Gal2Renpy | Sublime_Plugin/EditFormat.py | Python | mit | 1,765 |
from io import BytesIO, TextIOWrapper
from uuid import uuid4
import os
import stat
from pyrsistent import pmap, pset
import attr
from filesystems import Path, common, exceptions
class _BytesIOIsTerrible(BytesIO):
def __repr__(self):
return "<BytesIOIsTerrible contents={!r}>".format(self.bytes)
def ... | Julian/Filesystems | filesystems/memory.py | Python | mit | 11,660 |
#
# Naive Bayes Classifier
#
# _____________________________________________________________________
import math
class Classifier:
def __init__(self, bucketPrefix, testBucketNumber, dataFormat):
""" a classifier will be built from files with the bucketPrefix
excluding the file with textBuc... | applecool/AI | Naive Bayes/naiveBayesDensityFunctionTrainingSolution.py | Python | mit | 5,448 |
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
INVALID_EMAIL_TO_MSG = 'The email to field should contain valid value'
def main():
try:
incident = demisto.incidents()[0]
custom_fields = incident.get('CustomFields', {})
emailto = custom_fields.get... | VirusTotal/content | Packs/Campaign/Scripts/SendEmailToCampaignRecipients/SendEmailToCampaignRecipients.py | Python | mit | 821 |
# vi: ts=8 sts=4 sw=4 et
#
# __init__.py: draco2.draw package definition
#
# This file is part of Draco2. Draco2 is free software and is made available
# under the MIT license. Consult the file "LICENSE" that is distributed
# together with this file for the exact licensing terms.
#
# Draco2 is copyright (c) 1999-2007 b... | geertj/draco2 | draco2/draw/__init__.py | Python | mit | 679 |
"""
File Adapter Module
"""
from .main import FileAdapter
| noahziheng/freeiot | libfreeiot/adapters/file/__init__.py | Python | mit | 62 |
#project euler 9
def find_triplet_prod(sum):
for b in range(1,sum/2):
a = (sum**2/2 - sum*b)/(sum-b)
if a%1==0 and a**2+b**2==(sum-a-b)**2:
print a,b,sum-a-b
return a*b*(sum-a-b)
return 0
print find_triplet_prod(1000) | joemathai/problems | Project Euler/9.py | Python | mit | 236 |
""" Script to generate a json file containing book name, number of
chapters, number of chunks """
import json
import urllib.request
import re
import os
ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
# with open("catalog.json") as file:
# DATA = json.load(file)
# Get catalog.json
URL_CAT = "https://a... | WycliffeAssociates/translationRecorder | translationRecorder/app/src/scripts/download_chunks.py | Python | mit | 1,111 |
import pytest
def test_boil_unique(porridge, password):
assert porridge.boil(password) != porridge.boil(password)
def test_boil_invalid_password_type(porridge):
with pytest.raises(TypeError) as exception:
porridge.boil(1)
assert exception.value.args[0].startswith("'password' must be a str")
| thusoy/porridge | tests/test_boil.py | Python | mit | 317 |
from supriya.commands.Response import Response
class QueryTreeResponse(Response):
### CLASS VARIABLES ###
__slots__ = ("_node_id", "_query_tree_group")
### INITIALIZER ###
def __init__(self, node_id=None, osc_message=None, query_tree_group=None):
Response.__init__(self, osc_message=osc_mes... | Pulgama/supriya | supriya/commands/QueryTreeResponse.py | Python | mit | 38,279 |
from .models import Address
from rest_framework import serializers
from rest_framework_gis.serializers import GeoModelSerializer
class AddressSerializer(GeoModelSerializer):
formatted_address = serializers.Field(source='formatted_address')
def __init__(self, *args, **kwargs):
super(AddressSerializer... | ministryofjustice/addressfinder | addressfinder/apps/address/serializers.py | Python | mit | 1,182 |
import argparse
import os
import pdb
import sys
import seaborn
try:
import trilegal
except ImportError:
print('May need IsoTrack reader')
pass
import matplotlib.pylab as plt
import numpy as np
from .. import fileio
from ..eep.critical_point import Eep
seaborn.set()
__all__ = ['interp_match_grid', 'inte... | philrosenfield/padova_tracks | interpolate/interpolate_match_grid.py | Python | mit | 16,902 |
from unittest.mock import Mock, patch
from file_transfer.send_file import send_file
@patch("socket.socket")
@patch("builtins.open")
def test_send_file_running_as_expected(file, sock):
# ===== initialization =====
conn = Mock()
sock.return_value.accept.return_value = conn, Mock()
f = iter([1, None])
... | TheAlgorithms/Python | file_transfer/tests/test_send_file.py | Python | mit | 1,013 |
# -*- coding: utf-8 -*-
# Synchronization core module for Storj GUI Client #
import time
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
import threading, csv
HANDLE_ON_MOVE_EVENT = True
HANDLE_ON_DELETE_EVENT = True
SYNC_DIRECTORIES_FILE = "storj_sync_dirs.csv"
class ... | lakewik/storj-gui-client | UI/utilities/synchronization_core.py | Python | mit | 2,901 |
#!/home/ubuntu/muddev/pyenv/bin/python
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| whitehorse-io/encarnia | pyenv/bin/django-admin.py | Python | mit | 145 |
import os
import io
import math
import random
import numpy as np
import pandas as pd
import sklearn
from sklearn.preprocessing import StandardScaler
import requests
from tqdm import tqdm
import tensorflow as tf
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM
from keras.l... | samuxiii/prototypes | learning/stock-app/stock.py | Python | mit | 4,798 |
from aitools import *
#from state import *
import time
class Government:
def __init__(self): # All stats 0-100
self.military = 0 # Military Power
self.resources = 0 # Available raw resources
self.funds = 0 # Available money
self.tech = 0 # Technological su... | remremrem/EV-Tribute | world/ai.py | Python | mit | 1,661 |
from system.core.controller import *
from time import strftime
class TimeDisplay(Controller):
def __init__(self, action):
super(TimeDisplay, self).__init__(action)
def timedate(self):
time_date = strftime('%b %d, %Y %I %p')
def index(self):
time_date = strftime('%b %d, %Y %I %p')
return self.load_view('/tim... | authman/Python201609 | Guerrero_Melissa/Assignments/Time_Display_assignment/controllers/TimeDisplay.py | Python | mit | 361 |
from world import BinaryFeatureObject as Obj
from world import BinaryFeatureWorld as World
features = ["red", "round", "hard"]
apple = Obj("apple", ["red", "round", "hard"])
orange = Obj("orange", ["round", "hard"])
blood = Obj("blood", ["red"])
water = Obj("water", [])
ball = Obj("ball", ["round", "hard"])
bird = Ob... | leonxlin/concept-learner | test_world.py | Python | mit | 968 |
import webbrowser
url = 'http://www.wsb.com/Assignment2/case29.php?secret="/><script>alert(document.cookie)</script>'
new = 2
webbrowser.open(url, new=new)
| vhazali/cs5331 | assignment2/scripts/exploit29/exploit29.py | Python | mit | 158 |
import unittest
import unittest.mock as mock
from auto_peering.session_store import SessionStore
from test import mocks, randoms, builders
class TestSessionStore(unittest.TestCase):
def test_creates_session_for_provided_account_id(self):
sts_client = mocks.build_sts_client_mock()
peering_role_na... | tobyclemson/terraform-aws-vpc-auto-peering | lambdas/auto_peering/test/test_session_store.py | Python | mit | 2,204 |
from ..structure import *
from ..utils import *
class Gibbs(MCMC):
def __init__(self, problem, verbose_int = 100, N = 1000, T = 10000, record_start = 3000):
MCMC.__init__(self, problem, "Gibbs", verbose_int, N, T, record_start)
def particle_to_tuple(self, p):
return p
def init_particle(se... | SsnL/amcmc | inference/gibbs.py | Python | mit | 669 |
#!/usr/bin/env python
# This file is protected via CODEOWNERS
import os
import re
import sys
from setuptools import setup
CURRENT_PYTHON = sys.version_info[:2]
REQUIRED_PYTHON = (3, 7)
# This check and everything above must remain compatible with Python 2.7.
if CURRENT_PYTHON < REQUIRED_PYTHON:
sys.stderr.write... | sigmavirus24/urllib3 | setup.py | Python | mit | 4,062 |
#!/Users/Drake/dev/LouderDev/louderdev/bin/python3
# -*- coding: utf8 -*-
# :Copyright: © 2015 Günter Milde.
# :License: Released under the terms of the `2-Clause BSD license`_, in short:
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provide... | drakeloud/louderdev | louderdev/bin/rst2html5.py | Python | mit | 1,171 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of Karesansui Core.
#
# Copyright (C) 2009-2012 HDE, Inc.
#
# 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 restric... | karesansui/karesansui | karesansui/lib/parser/network.py | Python | mit | 3,123 |
from django.conf.urls import patterns, url
urlpatterns = patterns('core.views',
url(r'^list_drivers/$', 'list_drivers'),
url(r'^client_sign_up/$', 'client_sign_up'),
url(r'^activate_app/(?P<activation_string>.+)/$', 'activate_app'),
... | cmpe-295/project-backend | safe_ride/core/urls.py | Python | mit | 611 |
"""Generate a table of brightness and contrast options for uvccapture.
Uvccapture works okay for taking webcam snapshots, but you have to tell it the
brightness, contrast, and saturation settings it should use. It's hard to guess
the right brightness and contrast settings, so this makes a table of options to
pick from... | wsnook/sandbox | webcam/webcam.py | Python | mit | 2,308 |
import os
import os.path
import fnmatch
import logging
import ycm_core
import re
BASE_FLAGS = [
'-Wall',
'-Wextra',
'-Werror',
'-Wno-long-long',
'-Wno-variadic-macros',
'-fexceptions',
'-ferror-limit=10000',
'-DNDEBUG',
'-std=c++11',
'-xc+... | YanShenChun/dotfiles | ycm_extra_conf.py | Python | mit | 5,086 |
'''
The Q-learning algorithm is used to learn a function approximator
for the state-action values of Tic-Tac-Toe positions.
'''
from capstone.game.games import TicTacToe
from capstone.game.players import RandPlayer
from capstone.rl import Environment, GameMDP, FixedGameMDP
from capstone.rl.learners import ApproximateQL... | davidrobles/mlnd-capstone-code | experiments/tic_ql_fa.py | Python | mit | 1,429 |
#!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Classes that represent a portion of the state of an OpenMM context.
"""
# ====================================... | choderalab/openmmtools | openmmtools/states.py | Python | mit | 165,224 |
# -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/spider-middleware.html
import random
import base64
from comment.settings import PROXIES
proxyServer = "http://proxy.abuyun.com:9020"
# 代理隧道验证信息
proxyUser = "H575H2K6SEG... | zh-angle-i/review-analysis | review_analysis/spidering/comment/middlewares.py | Python | mit | 1,174 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('speaker_list', '0003_auto_20160213_1850'),
]
operations = [
migrations.AlterModelOptions(
name='speakerlist',
... | I-sektionen/i-portalen | wsgi/iportalen_django/speaker_list/migrations/0004_auto_20160218_1353.py | Python | mit | 587 |
import os
import sys
import socket
import json
import uuid
import imp
import threading
import time
import random
import math
import shutil
import hashlib
import signal
import traceback
import cStringIO
import bisect
import requests as rq
import shlex
import subprocess
import tempfile
import tarfile
import base64
import... | pombredanne/kunai | kunai/gossip.py | Python | mit | 28,201 |
import re
from flask_wtf import Form
from flask.ext.babel import gettext,lazy_gettext
from wtforms import TextField, PasswordField, BooleanField
from wtforms.validators import InputRequired, Email, EqualTo, Length
from app.data.models import User
from app.fields import Predicate
def username_is_available(username):
... | kua-hosi-GRUp/Flask-Bones | app/public/forms/user.py | Python | mit | 3,934 |
# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_blob_containers_operations.py | Python | mit | 46,817 |
import music21 # type: ignore
from typing import List
import matplotlib.pyplot as plt # type: ignore
bcl = music21.corpus.chorales.ChoraleListRKBWV()
num_chorales = max(bcl.byRiemenschneider.keys(), key=int)
bwv_to_rs_num_map = {} # type: Dict[str,str]
rs_numbers = [] # type: List[int]
min_pitches = [] # type: List[... | alexcoplan/p2proj | src/script/analyse_corpus.py | Python | mit | 4,091 |
# coding:utf-8
import requests
from bs4 import BeautifulSoup
from multiprocessing.dummy import Pool as tp
import os
from ebooklib import epub
import base64
pool = tp(processes=16)
dirn = os.getcwd()
hd = {'User-Agent': 'Mozilla/5.0 (MSIE 9.0; Windows NT 6.1; Trident/5.0)'}
p = None
# p = {"http": "http://127.0.0.1:80... | tongyuantongyu/Syosetsu-EPUB-Maker | Syosetu.py | Python | mit | 6,683 |
from sqlalchemy.ext.associationproxy import association_proxy
from server.models.db import db
from server.models.user import User
class Project(db.Model):
__tablename__ = 'projects'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.Text)
description = db.Column(db.Text)
source = db... | ganemone/ontheside | server/models/project.py | Python | mit | 1,665 |
# use greenlets for greater concurrency
#from gevent import monkey; monkey.patch_all()
import bottle
import json
import os
from bottle import request, response, static_file
from simfile import SMParser
from urllib.parse import parse_qsl
PROD = True
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
SIMFILES_D... | zachwalton/truebpm | app.py | Python | mit | 2,017 |
import os
import sys
import glob
import sched
import serial
import signal
import struct
import time
import thread
port = None
baud = 2000000
commands = {
'CTRL': chr(0),
'READSECTION': chr(1),
'WRITESECTION': chr(2)
}
countries = [
'Japan (NTSC)','USA (NTSC)','Europe, Oceania, Asia (PAL)','Sweden (PA... | cthill/SNESDump | desktop/snesdump.py | Python | mit | 9,518 |
import six
import pytest
from unittest.mock import Mock
from crabpy.gateway.exception import (
GatewayRuntimeException,
GatewayResourceNotFoundException
)
from crabpy.gateway.crab import (
Gewest, Provincie,
Gemeente, Deelgemeente, Taal,
Bewerking, Organisatie,
Aardsubadres, Aardadres,
Aar... | OnroerendErfgoed/crabpy | tests/gateway/test_crab.py | Python | mit | 88,239 |
from bs4 import BeautifulSoup
def cap_xml_to_dict(cap_xml):
# This function assumes that it’s being passed valid CAP XML
cap = BeautifulSoup(cap_xml, "xml")
return {
"msgType": cap.alert.msgType.text,
"reference": cap.alert.identifier.text,
"references": (
# references ... | alphagov/notifications-api | app/broadcast_message/translators.py | Python | mit | 1,183 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Said Sef'
import os
import json
import requests as r
from optparse import OptionParser
tkn = os.environ.get("tkn", None)
email = os.environ.get("email", None)
parser = OptionParser()
parser.add_option("-s", "--site", dest="site", help="site name - abc.co... | saidsef/cloudflare | lib/cf_api.py | Python | mit | 1,490 |
import numpy as np
import re
import itertools
from collections import Counter
import numpy as np
import time
import gc
from tensorflow.contrib import learn
from gensim.models.word2vec import Word2Vec
import gzip
from random import random
from preprocess import MyVocabularyProcessor
import sys
reload(sys)
sys.setdefault... | dhwajraj/deep-siamese-text-similarity | input_helpers.py | Python | mit | 8,232 |
from astropy import units as u
from astropy.coordinates import (
HCRS,
ITRS as _ITRS,
BaseRADecFrame,
FunctionTransform,
TimeAttribute,
frame_transform_graph,
)
from astropy.coordinates.builtin_frames.utils import DEFAULT_OBSTIME
from astropy.coordinates.matrix_utilities import rotation_matrix
... | poliastro/poliastro | src/poliastro/frames/fixed.py | Python | mit | 6,869 |
# -*- coding: utf-8 -*-
import sys
import os
import inspect
from datetime import datetime
__all__ = ["Logger"]
class Logger(object):
EMERG = 0
ALERT = 1
CRIT = 2
ERR = 3
ERROR = 3
WARNING = 4
WARN = 4
NOTICE = 5
INFO = 6
DEBUG = 7
severities = [
"Emergency",... | sciapp/pyMolDyn | src/util/logger.py | Python | mit | 2,378 |
from direct.gui.DirectGui import *
from pandac.PandaModules import *
from direct.directnotify import DirectNotifyGlobal
from direct.showbase.DirectObject import DirectObject
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownTimer
from direct.ta... | ksmit799/Toontown-Source | toontown/pets/PetshopGUI.py | Python | mit | 30,460 |
""" main user entry point for mooshimeter bluetooth multimeter """
import ui
import dialogs
from pymooshi import Mooshimeter
from pymooshi.genlibpy import multimeter as mm
from pymooshi.genlibpy import tls
import time
print(tls.set_logger())
def update_results(results):
vrslt['rsltVal1'].text ='%4f' % results[0]
... | HJvA/Mooshimeter-Pythonista-IOS | uiMeter.py | Python | mit | 2,849 |
import argparse
import subprocess
import os
import collections
import pylev
from seqtools.utils import revcomp,fileOpen
from seqtools.fastq import Fastq
def isIndexRevComp(indexfile,indexes,n=500000):
"""Determine if the indexes are reverse complemented or not
:param indexfile: filename of the Fastq ind... | lowks/SDST | seqtools/demultiplexer.py | Python | mit | 7,927 |
import wx
_ = wx.GetTranslation | conradoplg/navi | appcommon/i18n/__init__.py | Python | mit | 32 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf.urls import patterns, url
from django.contrib import admin
from django.http import JsonResponse
from cmsplugin_cascade.models import CascadePage
@admin.register(CascadePage)
class CascadePageAdmin(admin.ModelAdmin):
def get_model_pe... | rfleschenberg/djangocms-cascade | cmsplugin_cascade/admin.py | Python | mit | 1,152 |
import numpy as np
import inspect
from cStringIO import StringIO
from _to_native_converter import to_native_class_converter
from _inference_parameter_injector import \
_injectGenericInferenceParameterInterface
from _inference_injector import _injectGenericInferenceInterface
from _misc import defaultAccumulator
imp... | yanlend/opengm | src/interfaces/python/opengm/_inference_interface_generator.py | Python | mit | 27,300 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, print_function
import os
import re
import sys
import uuid
import codecs
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
from pip.req import parse_requirements
class Tox(TestCommand):
... | jthi3rry/uniauth | setup.py | Python | mit | 2,280 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
r"""
# .---. .-----------
# / \ __ / ------
# / / \( )/ ----- (`-') _ _(`-') <-. (`-')_
# ////// '\/ ` --- ( OO).-/( (OO ).-> .-> \( OO) ) .->
# //// / // : : --- (,------.... | edonyM/toolkitem | fileprocess/mergefile/batfile.py | Python | mit | 5,919 |
from core.himesis import Himesis
import uuid
class HSon2Man(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule Son2Man.
"""
# Flag this instance as compiled now
self.is_compiled = True
super(HSon2Man, self).... | levilucio/SyVOLT | ExFamToPerson/transformation/no_contains/HSon2Man.py | Python | mit | 2,616 |
import targets
import testlib
import spike64 # pylint: disable=import-error
class spike64_2_rtos(targets.Target):
harts = [spike64.spike64_hart(), spike64.spike64_hart()]
openocd_config_path = "spike-rtos.cfg"
timeout_sec = 60
def create(self):
return testlib.Spike(self)
| timtian090/Playground | RISC-V/riscv-tests/debug/targets/RISC-V/spike64-2-rtos.py | Python | mit | 300 |
"""empty message
Revision ID: 52cf5973de2
Revises: 2ecc9f25f6
Create Date: 2015-01-06 11:14:08.980499
"""
# revision identifiers, used by Alembic.
revision = '52cf5973de2'
down_revision = '2ecc9f25f6'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please... | hreeder/WHAuth | migrations/versions/52cf5973de2_.py | Python | mit | 601 |
# coding=utf-8
from __future__ import unicode_literals
import unittest
import pykka
from mopidy_soundcloud import actor, SoundCloudExtension
from mopidy_soundcloud.soundcloud import safe_url
from mopidy_soundcloud.library import SoundCloudLibraryProvider, new_folder, \
simplify_search_query
class ApiTest(unit... | yakumaa/mopidy-soundcloud | tests/test_library.py | Python | mit | 3,430 |
x = int(input('Insira o primeiro número inteiro, por favor: '))
y = int(input('Insira o segundo número inteiro, por favor: '))
z = int(input('Insira o terceiro número inteiro, por favor: '))
if z > y and y > x:
print('crescente')
else:
print('não está em ordem crescente')
| marcelomiky/PythonCodes | Coursera/CICCP1/ordenacao.py | Python | mit | 288 |
import L2
def test_L2_result():
assert L2.vector_len([1,1,1,1,1],[1,2,3,4,5])==7.416198487095663
def test_L2_no_weight():
assert L2.vector_len([1,1,1,1,1])==2.2360679774997898
def test_L2_dimensions():
try:
L2.vector_len([1,1,1,1,1,1],[1,2,3])
except ValueError as err:
assert(type(err... | crystalzhaizhai/cs207_yi_zhai | lectures/L7/test_L2.py | Python | mit | 339 |