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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
import urllib2
from bs4 import BeautifulSoup as BS
import re
import time
def getAgenciesList():
agenciesList_req = urllib2.Request('''http://services.my511.org/Transit2.0/GetAgencies.aspx?token=aeeb38de-5385-482a-abde-692dfb2769e3''')
xml_resp = urllib2.urlopen(agenciesList_req)
soup = BS(xm... | trthanhquang/bus-assistant | webApp/getBusTiming.py | Python | mit | 2,827 |
import sys
MAJOR = sys.version_info[0]
if MAJOR == 3:
cmp = lambda a, b: (a > b) - (a < b) # pragma: no cover
basestring = str # pragma: no cover
else: # hopefully MAJOR == 2
cmp = cmp # pragma: no cover
basestring = basestring # pragma: no cover
| pmuller/versions | versions/compat.py | Python | mit | 273 |
from __future__ import unicode_literals
import httplib
import wac
class BalancedError(Exception):
def __str__(self):
attrs = ', '.join([
'{0}={1}'.format(k, repr(v))
for k, v in self.__dict__.iteritems()
])
return '{0}({1})'.format(self.__class__.__name__, attrs)... | balanced/balanced-python | balanced/exc.py | Python | mit | 2,557 |
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------#
# Name: CalcLogitChoice
# Purpose: Utilities for various calculations of different types of choice models.
# a) CalcMultino... | joshchea/python-tdm | scripts/CalcLogitChoice.py | Python | mit | 12,741 |
# coding: utf-8
"""
Nordigen Account Information Services API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 2.0 (v2)
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ i... | ltowarek/budget-supervisor | third_party/nordigen/test/test_status6e6_enum.py | Python | mit | 933 |
# hack script to set the bad pixels to the right value for PPOL
import os
import glob
import numpy as np
import astroimage as ai
ai.set_instrument('Mimir')
bkgFreeDir = 'C:\\Users\\Jordan\\FITS_data\\Mimir_data\\pyPol_Reduced\\201611\\bkgFreeHWPimages'
fileList = glob.glob(
os.path.join(bkgFreeDir, '*.fits')
)
fo... | jmontgom10/Mimir_pyPol | hackScript_setBadPixForPPOL.py | Python | mit | 905 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'django_project.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^$', include('apps.home.urls', namespace='home', app_name='home')),
url(... | MDA2014/django-xpand | django_project/django_project/urls.py | Python | mit | 439 |
# coding:utf-8
'''
Created on 2017/11/7.
@author: chk01
'''
import math
import numpy as np
import h5py
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.python.framework import ops
from class_two.week_three.tf_utils import load_dataset, random_mini_batches, convert_to_one_hot, predict
np.random.... | sunyihuan326/DeltaLab | Andrew_NG_learning/class_two/week_three/Dxq_1.py | Python | mit | 3,691 |
from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns
from .provider import YleTunnusProvider
urlpatterns = default_urlpatterns(YleTunnusProvider)
| mikkokeskinen/tunnistamo | yletunnus/urls.py | Python | mit | 171 |
#!/usr/bin/env python
"""
Copyright (C) 2012 Bo Zhu http://zhuzhu.org
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rig... | zhuzhuor/auto-deploy | webhook.py | Python | mit | 1,995 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-01-05 14:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gradapp', '0027_auto_20161109_0925'),
]
operations = [
migrations.AlterFiel... | classgrade/classgrade | classgrade/gradapp/migrations/0028_auto_20170105_1435.py | Python | mit | 486 |
#!/usr/local/bin/python
#$Id: logsc.py,v 1.7 2013/11/15 15:07:06 kenji Exp $
from sqlite3 import dbapi2 as sqlite
import sys
# change integer to string if found
def int2str(p):
if type(p) == int:
return str(p)
else:
return p
if __name__ == '__main__':
con = sqlite.connect("/home/kenji/txt/hamradio/LOGS... | jj1bdx/bdxlog | scripts/logsc.py | Python | mit | 1,491 |
# -*- coding: utf-8 -*-
from timesheet.commands import Command
from timesheet.models import Subject, Task, DBSession
from timesheet.commands.completers import subject_completer, task_completer
import argparse
__author__ = 'vahid'
class StartCommand(Command):
name = 'start'
description = 'Starts a task'
@... | pylover/timesheet | timesheet/commands/start.py | Python | mit | 1,244 |
# coding: utf-8
from __future__ import division
class CharityItem(object):
def __init__(self, name, short_desc, long_desc, image_name, detail_image_name, rating, major, minor, objective_money, actual_money):
self.name = name
self.short_desc = short_desc
self.long_desc = long_desc
s... | hanks/Second_Hackson_Demo | BeaconCharityServer/app-server/models.py | Python | mit | 1,796 |
"provide contents of CoreLogic's code files"
import pandas as pd
import pdb
from pprint import pprint
import unittest
class Codes(object):
def __init__(self,
path_parcels='../data/input/corelogic-code-tables/2580_Code_Tables.csv',
path_deeds='../data/input/corelogic-code-tables... | rlowrance/re-local-linear | Codes.py | Python | mit | 6,954 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from sqlalchemy import engine_from_config
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm import configure_mappers
import zope.sqlalchemy
# import or define all models here to ensure they are attached to the
# Base.metadata prior to any initia... | bitedgeco/survivor-pool | survivor_pool/models/__init__.py | Python | mit | 2,411 |
import numpy as np
from vectoradd import printvec, addvec
if __name__ == '__main__':
n = 10
a = np.arange(n)
b = 2*np.flipud(a)
c = addvec(a,b)
printvec(c)
| gregvw/vector-addition | test.py | Python | mit | 180 |
# coding: utf-8
import random
import json
def full_sample(tar_f=None, res_f=None, res_size=50, start_pos=0, end_pos=100):
buff = []
if tar_f:
with open(tar_f, 'r') as reader:
cnt = 0
for line in reader:
buff.append(json.dumps({'text': line, 'id': cnt}))
... | AtmaHou/atma | sampler.py | Python | mit | 888 |
def MassFit(particle) :
if raw_input("Do %s mass fit? [y/N] " % (particle)) not in ["y", "Y"]:
return
print "************************************"
print "* Doing mass fit *"
print "************************************"
f = TFile.Open("workspace.root")
w = f.Get("w")
asse... | lbel/Maastricht-Masterclass-2015 | scripts/MassFit.py | Python | mit | 2,260 |
from resource_media_types import *
from ClientFile import ClientFile
from ClientFolder import ClientFolder
from queryResource import ClientQuery
class ResourcesTypeResolverUtil(object):
classes = {}
#classes[ClientAdhocDataView.__name__] = ResourceMediaType.ADHOC_DATA_VIEW_MIME
#classes[ClientAw... | saguas/jasperserverlib | jasperserverlib/core/ResourcesTypeResolverUtil.py | Python | mit | 2,430 |
import os
import pysam
import unittest
from TestUtils import checkFieldEqual
import copy
SAMTOOLS = "samtools"
WORKDIR = "pysam_test_work"
DATADIR = "pysam_data"
class ReadTest(unittest.TestCase):
def buildRead(self):
'''build an example read.'''
a = pysam.AlignedSegment()
a.query_name ... | nlhepler/pysam | tests/AlignedSegment_test.py | Python | mit | 17,059 |
import collections
import itertools
import nengo
import pacman103
from .config import Config
import connection
import ensemble
import node
import probe
import utils
class Assembler(object):
"""The Assembler object takes a built collection of objects and connections
and converts them into PACMAN vertices and... | ctn-archive/nengo_spinnaker_2014 | nengo_spinnaker/assembler.py | Python | mit | 6,294 |
import hashlib
import os
import random
import time
from django.utils.deconstruct import deconstructible
from django.utils.text import slugify
@deconstructible
class UploadToDir(object):
"""Generates a function to give to ``upload_to`` parameter in
models.Fields, that generates an name for uploaded files bas... | marcosgabarda/django-belt | belt/files.py | Python | mit | 1,514 |
from datetime import datetime
from json import load, dump
import logging
from logging import INFO
from os import listdir, makedirs, remove
from os.path import join, exists
import requests
import shelve
from static_aid import config
from static_aid.DataExtractor import DataExtractor, bytesLabel
def makeDir(dirPath):
... | GALabs/StaticAid | static_aid/DataExtractor_Adlib.py | Python | mit | 27,394 |
#!/usr/bin/env python
""" """
# Standard library modules.
import unittest
import logging
# Third party modules.
# Local modules.
from pyhmsa_gui.util.testcase import TestCaseQApp, QTest
from pyhmsa_gui.util.registry import \
(iter_entry_points,
iter_condition_widget_classes, iter_condition_widgets,
ite... | pyhmsa/pyhmsa-gui | pyhmsa_gui/util/test_registry.py | Python | mit | 1,342 |
import numpy as np
import os
from random import choice
from stego_lsb.WavSteg import hide_data, recover_data
import string
import unittest
import wave
class TestWavSteg(unittest.TestCase):
def write_random_wav(self, filename, num_channels, sample_width, framerate, num_frames):
if sample_width != 1 and sam... | ragibson/Steganography | tests/test_wavsteg.py | Python | mit | 3,422 |
def spiral_corners(size):
yield 1
for x in range(3, size+1, 2):
base_corner = x**2
corner_diff = x-1
for corner in (3,2,1,0):
yield base_corner-corner_diff*corner
def solve_p026():
return sum(spiral_corners(1001))
if __name__ == '__main__':
print(solve_p026())
| piohhmy/euler | p028.py | Python | mit | 315 |
from collections import defaultdict
import pandas as pd
import pickle
from sqlalchemy import create_engine, inspect, Table, Column
from sqlalchemy.engine.url import make_url
from sys import exit
class DatabaseClient:
""" Takes care of the database pass opening to find the url and can query
the respected ... | tgbugs/pyontutils | ilxutils/ilxutils/database_client.py | Python | mit | 2,525 |
import wx
import datetime
from time import strptime
from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, Date
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Engine = create_engine('sqlite:///pomodoros.db', echo=False)
Base = declarative_base()
... | raphonic/pomodorotimer | pomodoro.py | Python | mit | 3,109 |
"""
Django settings for accountant 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/
"""
import os
import sys
from decimal import Decimal
import accounting
V... | dulaccc/Accountant | accountant/settings/common.py | Python | mit | 5,873 |
# This function solves the Linear Assignment Problem by implementing the Jonker-Volgenant algorithm
# This code began as an effort to port the matlab code available at:
# http://www.mathworks.com/matlabcentral/fileexchange/26836-lapjv-jonker-volgenant-algorithm-for-linear-assignment-problem-v3-0
#
#
# Reference:
# R. J... | isi-nlp/gump | matching/LAPJV.py | Python | mit | 11,287 |
#!/usr/bin/env python3
# Copyright (c) 2019-2020 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 bitcoind aborts if can't disconnect a block.
- Start a single node and generate 3 blocks.
- Delet... | midnightmagic/bitcoin | test/functional/feature_abortnode.py | Python | mit | 1,738 |
"""
This class allows to modify json reponse structure
"""
from rest_framework.renderers import JSONRenderer
from rest_api_example.custom import utilities
# [TODO] - add comments on each logics
# [TODO] - extract each logics into a class
class ApiRenderer(JSONRenderer):
media_type ='application/vdn.bespoke.v2+... | masanorinyo/rest_django_api_boilerplate | api/v2/renderer.py | Python | mit | 2,435 |
from ctypes import Structure, c_int, c_uint8, c_uint16, c_char, POINTER, Array
from .atcab import get_cryptoauthlib
from .atcaenum import AtcaEnum
import binascii
class atcacert_cert_type_t(AtcaEnum):
"""Types of certificates"""
CERTTYPE_X509 = 0 # Standard X509 certificate
CERTTYPE_CUSTOM = 1 ... | PhillyNJ/SAMD21 | cryptoauthlib/python/cryptoauthlib/atcacert.py | Python | mit | 7,650 |
class LastpassSharedFolder:
def __init__(self, id, name, members=None, teams=None):
self.id = id
self.name = name
self.members = members
self.teams = teams
| Keeper-Security/Commander | keepercommander/importer/lastpass/shared_folder.py | Python | mit | 192 |
# https://www.reddit.com/r/dailyprogrammer/comments/3fva66/20150805_challenge_226_intermediate_connect_four/
import sys, string
xmoves = open(sys.argv[1]).read().translate(None, string.ascii_lowercase + ' \n')
omoves = open(sys.argv[1]).read().translate(None, string.ascii_uppercase + ' \n')
board = [[' ' for x in ra... | lw7360/dailyprogrammer | Intermediate/226/226.py | Python | mit | 1,541 |
def radixsort(mylist):
if mylist == []:
return []
answerdict = {}
for item in mylist:
try:
answerdict[item%10].append(item)
except KeyError:
answerdict[item%10] = [item, ]
i = 1
while len(answerdict.keys()) > 1:
answerdict = radixhelper(answerd... | sniboboof/data-structures | radixal.py | Python | mit | 1,895 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: vehicleType.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message a... | pallamidessi/mvrptw | gen/protobuf/vehicleType_pb2.py | Python | mit | 1,823 |
#!/usr/bin/env python
#
# spyne - Copyright (C) Spyne contributors.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later ve... | deevarvar/myLab | baidu_code/soap_mockserver/spyne/test/test_sqlalchemy.py | Python | mit | 25,512 |
"""
Author: Ali Hajimirza (ali@alihm.net)
Copyright Ali Hajimirza, free for use under MIT license.
"""
import csv
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
from algorithm import EM
import argparse
def line_plot(data_arrays, xlabel, ylabel, labels, title, f):
"""
Plots a scatter c... | A92hm/expectation-maximization | demo.py | Python | mit | 2,034 |
def zero():
print " __ "
print "| |"
print "|__|"
def one():
print " "
print " |"
print " |"
def two():
print " __"
print " __|"
print "|__ "
def three():
print " __ "
print " __|"
print " __|"
def four():
print "|_|"
print " |"
def f... | chrisortman/CIS-121 | projects/LCD.py | Python | mit | 1,100 |
from config import config
class AppSetting(object):
def __init__(self):
self.config = config.config
def get_password(self):
return self.config['app']['auth_password']
def change_password(self, oldpassword, newpassword):
if oldpassword != self.get_password():
return Non... | tztztztztz/SYMLeaveRequestServer | service/appsetting.py | Python | mit | 528 |
# MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from rest_framework import response, schemas
from rest_framework.decorators import (
api_view,
renderer_classes,
)
from drf_yasg.renderers import (
OpenAPIRenderer,
SwaggerUIRenderer,
)
@api_view()
@renderer_classes([OpenAPIRenderer, SwaggerUIRen... | masschallenge/impact-api | web/impact/impact/schema.py | Python | mit | 482 |
import bounds
from py3D import Vector, Ray, Color, Body
class Sphere(Body):
center = Vector()
radius = 0.0
R = 0.0
color = [0.01,0.01,0.01]
def p(self):
"""Returns the name of the type of body this is."""
return 'Sphere'
def set_position(self, c):
self.cen... | dburggie/py3D | bodies/Sphere.py | Python | mit | 2,470 |
# -*- coding: utf-8 -*-
"""
Newspaper treats urls for news articles as critical components.
Hence, we have an entire module dedicated to them.
"""
__title__ = 'newspaper'
__author__ = 'Lucas Ou-Yang'
__license__ = 'MIT'
__copyright__ = 'Copyright 2014, Lucas Ou-Yang'
import logging
import re
from urlparse import (
... | cantino/newspaper | newspaper/urls.py | Python | mit | 9,141 |
import pytest
from datapipelines import Query, QueryValidationError, QueryValidatorStructureError, validate_query
def test_has():
valid = Query.has("test")
with pytest.raises(QueryValidationError):
valid({})
with pytest.raises(QueryValidationError):
valid({"dog": "cat"})
assert val... | sserrot/champion_relationships | venv/Lib/site-packages/tests/test_queries.py | Python | mit | 13,676 |
import pytest
from cmdtree import INT, entry
from cmdtree import command, argument, option
@argument("host", help="server listen address")
@option("reload", is_flag=True, help="if auto-reload on")
@option("port", help="server port", type=INT, default=8888)
@command(help="run a http server on given address")
def run_s... | winkidney/cmdtree | src/cmdtree/tests/functional/test_command.py | Python | mit | 1,660 |
def test_nginx_package(Package):
package = Package('nginx')
assert package.is_installed
def test_nginx_working(Command):
response = Command('curl http://127.0.0.1/')
assert 'Automation for the People' in response.stdout
def test_nginx_service(Service, Socket):
service = Service('nginx')
sock... | dbryant4/stelligent | tests/test_default.py | Python | mit | 590 |
# def A(n,m):
# ret=1
# while m!=0:
# ret=ret*n
# n-=1
# m-=1
# return ret
# def mul(n):
# ret=1
# while n!=1:
# ret*=n
# n-=1
# return ret
# n,m=raw_input().split()
# n=int(n)
# m=int(m)
# print(mul(n)*(A(n+1,2)*A(n+3,m)+2*m*(n+1)*A(n+2,m-1)))
def mul(x, ... | Zhang-RQ/OI_DataBase | BZOJ/2729.py | Python | mit | 498 |
import signal
signal_names = {}
for signame in dir(signal):
if signame.startswith('SIG'):
signum = getattr(signal, signame)
if isinstance(signum, int):
signal_names[signum] = signame
def get_signal_name(signal_code):
name = signal_names.get(signal_code, '')
if name:
r... | Mimino666/tc-marathoner | marathoner/utils/ossignal.py | Python | mit | 765 |
__author__ = 'Andrew Williamson <axwilliamson@godaddy.com>'
| Atothendrew/XcodeBuildIncrementer | XcodeBuildIncrementer/__init__.py | Python | mit | 60 |
l, r = [int(x) for x in input().split()]
if max(l,r) == 0:
print("Not a moose")
elif l == r:
print("Even {}".format(l+r))
else:
print("Odd {}".format(max(l,r)*2))
| rvrheenen/OpenKattis | Python/judgingmoose/judgingmoose.py | Python | mit | 176 |
# We try to improve the previous 'math_operation.py' by reduce the code
# here we introduce a concept named list-comprehensive
# Knowledge points:
# 1. list-comprehensive, the [x for x in a-list]
# 2. dir() function to get the current environment variable names in space.
# 3. "in" check, we never user string.search() i... | laalaguer/pythonlearn | 01-basic/math_improved.py | Python | mit | 1,306 |
#!/dlmp/sandbox/cgslIS/rohan/Python-2.7.11/python
"""
setting up logging
"""
import logging
import time
import datetime
def main(filename):
logger = configure_logger(filename)
def configure_logger(filename):
"""
setting up logging
"""
logger = logging.getLogger(filename)
logger.setLevel(lo... | rohandavidg/CONCORD-VCF | bin/do_logging.py | Python | mit | 668 |
from django.conf.urls import url
from yell import views
from django.conf.urls.static import static
from django.conf import settings
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^testing/$', views.testing, name='testing'),
url(r'^results/$', views.restaurants, name='restaurants'),
url(r'^api/... | andrewjton/SHOUT | app/shout/yell/urls.py | Python | mit | 435 |
import sys
import os
import shutil
def import_package(name):
_filepath = os.path.abspath(__file__)
path = backup = os.path.dirname(_filepath)
while os.path.basename(path) != name:
path = os.path.join(path, '..')
path = os.path.abspath(path)
if path != backup:
sys.path.insert(0,... | ffunenga/virtuallinks | tests/core/core.py | Python | mit | 375 |
#!/usr/bin/env python3
import chipset
def read(reg):
reg = int(reg, 16)
val = chipset.intel_register_read(reg)
return val
def init():
pci_dev = chipset.intel_get_pci_device()
ret = chipset.intel_register_access_init(pci_dev, 0)
if ret != 0:
print("Register access init failed");
return False
return True
if... | ChrisCummins/intel-gpu-tools | tools/quick_dump/reg_access.py | Python | mit | 473 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Subscriber'
db.create_table(u'subscribers_subscriber', (
(u'id', self.gf('django... | jcalazan/glucose-tracker | glucosetracker/subscribers/migrations/0001_initial.py | Python | mit | 1,627 |
import typecat.font2img as f2i
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class FontBox(Gtk.FlowBoxChild):
def set_text(self, arg1):
if type(arg1) is str:
self.text = arg1
if type(arg1) is int:
self.font_size = arg1
try:
... | LordPharaoh/typecat | typecat/display/fontbox.py | Python | mit | 1,483 |
from django.apps import AppConfig
class IdeasiteConfig(AppConfig):
name = 'IdeaSite'
| andreyrobota/AndreyKosinskiy | IdeaSite/apps.py | Python | mit | 91 |
import ctypes
import enum
import logging
import sys
from six import add_metaclass, iteritems, string_types
from six.moves import range
from functools import partial
from collections import OrderedDict
from .registers import Registers, REGISTER_NAMES
from ..mm import u32_t, i32_t, UINT16_FMT, UINT32_FMT
from ..util im... | happz/ducky | ducky/cpu/instructions.py | Python | mit | 78,868 |
from django.conf.urls import url
from . import views
app_name = 'signals'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^process/$', views.process, name='process'),
url(r'^file_process_status/$', views.file_process_status,
name='file_process_status'),
url(r'^get_graph/$', views.... | yayoiukai/signalserver | signals/urls.py | Python | mit | 541 |
"""
lib is for underlying functionality driving Uranium, that is not
meant for public consumption.
"""
| toumorokoshi/uranium | uranium/lib/__init__.py | Python | mit | 103 |
# File generated from our OpenAPI spec
from __future__ import absolute_import, division, print_function
from stripe.api_resources.abstract import CreateableAPIResource
from stripe.api_resources.abstract import DeletableAPIResource
from stripe.api_resources.abstract import ListableAPIResource
from stripe.api_resources.... | stripe/stripe-python | stripe/api_resources/plan.py | Python | mit | 505 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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... | rwl/PyCIM | CIM14/ENTSOE/StateVariables/StateVariables/SvShuntCompensatorSections.py | Python | mit | 2,935 |
from lxml import html
from pathlib import Path
import pytest
from film2trello import csfd
@pytest.fixture()
def csfd_html():
path = Path(__file__).parent / 'csfd.html'
return html.fromstring(path.read_text())
@pytest.mark.parametrize('url', (
'http://csfd.cz/film/8283-posledni-skaut/',
'http://www... | honzajavorek/film2trello | tests/test_csfd.py | Python | mit | 2,770 |
import beanstalkc
import sqlite3
import os
import msgpack
from time import sleep
import zlib
class SeedMinimizer:
def __init__(self, config):
self.sql = sqlite3.connect(config['db_path'], check_same_thread=False)
self.c = self.sql.cursor()
self.min_dir = os.path.join(config['output_path']... | pyoor/distiller | server/minimizer.py | Python | mit | 2,802 |
__author__ = 'it'
import re
from encounter.models import base
"""Contains a models for NPCs and monsters."""
ABILITY_TEMPLATE = re.compile(r"([a-zA-Z]{3}) (\d+)")
SAVE_TEMPLATE = re.compile(r"([a-zA-Z]{3,4}) ([+-]\d+)")
def read_ability_scores(abilities_raw="Str 0, Dex 0, Con 0, "
... | ityaptin/encounter | encounter/models/npc.py | Python | mit | 924 |
# coding=utf-8
'''
Module: num2word_DE.py
Requires: num2word_base.py
Version: 0.4
Author:
Taro Ogawa (tso@users.sourceforge.org)
Copyright:
Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
Licence:
This module is distributed under the Lesser General Public Licence.
http://www.open... | guildenstern70/fablegenerator | fablegenerator/numtoword/num2word_DE.py | Python | mit | 5,299 |
from __future__ import division
from .module import Module, interact
class Servo(Module):
def __init__(self, id, alias, device):
Module.__init__(self, 'Servo', id, alias, device)
self._max_angle = 180.0
self._min_pulse = 0.0005
self._max_pulse = 0.0015
self._angle = 0.0
... | pollen/pyrobus | pyluos/modules/servo.py | Python | mit | 1,559 |
#!/usr/bin/env python
"""
Train a NNJM (with global context and extended architecture) model.
"""
usage = 'To train NNJM (with global context and extended architecture) using Theano'
import cPickle
import gzip
import os
import sys
import time
import re
import codecs
import argparse
import datetime
import numpy as n... | yuhaozhang/nnjm-global | code/train_nnjm_gplus.py | Python | mit | 15,583 |
from AppKit import NSBox, NSColor, NSFont, NSSmallControlSize, NSNoTitle, NSLineBorder, NSBoxSeparator
from vanilla.vanillaBase import VanillaBaseObject, _breakCycles, osVersionCurrent, osVersion10_10
class Box(VanillaBaseObject):
"""
A bordered container for other controls.
To add a control to a box, s... | moyogo/vanilla | Lib/vanilla/vanillaBox.py | Python | mit | 4,498 |
""" Local dev settings and globals. """
from base import *
""" DEBUG CONFIGURATION """
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG = DEBUG
""" LOGGING """
for logger_key in LOGGING['loggers'].ke... | WimpyAnalytics/django-readonly-schema | readonly/readonly/settings/local.py | Python | mit | 1,156 |
from helper import greeting
def useless_function(msg):
greeting(msg)
if __name__ == "__main__":
useless_function("hola")
| seamuslowry/cs3240-labdemo | hello.py | Python | mit | 125 |
"""repos_mean table
Revision ID: 4a7b02b0a63
Revises: b75a76936b
Create Date: 2015-11-05 11:25:32.920590
"""
revision = '4a7b02b0a63'
down_revision = 'b75a76936b'
branch_labels = None
depends_on = None
from alembic import op
from sqlalchemy.sql import func
import sqlalchemy as sa
def upgrade():
op.create_tabl... | kkamkou/gitmostwanted.com | migration/versions/4a7b02b0a63_repos_mean_table.py | Python | mit | 782 |
import copy
from typing import Any # noqa: F401
from typing import Dict # noqa: F401
from typing import Iterable # noqa: F401
from typing import List # noqa: F401
from typing import Optional # noqa: F401
from typing import Text # noqa: F401
import botocore.session
from botocore.exceptions import... | robotblake/pdsm | src/pdsm/glue.py | Python | mit | 6,425 |
"""
__MapVirtualDeviceFAULTY_overlap_MDL.py_____________________________________________________
Automatically generated AToM3 Model File (Do not modify directly)
Author: gehan
Modified: Tue Nov 5 10:14:40 2013
____________________________________________________________________________________________
"""
from stick... | levilucio/SyVOLT | GM2AUTOSAR_MM/overlap_rules/models/MapVirtualDeviceFAULTY_overlap_MDL.py | Python | mit | 7,044 |
from django.test import TestCase
try:
from django.contrib.staticfiles.templatetags.staticfiles import static
except ImportError:
from django.templatetags.static import static
try:
from django.core.urlresolvers import reverse
except ImportError:
from django.urls import reverse
from ..templatetags.adja... | snogaraleal/adjax | adjax/tests/test_templatetags.py | Python | mit | 1,451 |
import os
import serial
import cv2
import time
COTH = 130
while True:
os.system('fswebcam /home/pi/1.jpg')
color = cv2.imread('/home/pi/1.jpg')
b,g,r =color[160][170]
if (r >= COTH and g < COTH and b < COTH):
print 'red'
if (r < COTH and g >= COTH and b < COTH):
print 'green'
i... | Beck-Sisyphus/Robocup | RPi/Ultimate algorthm/DetectColor.py | Python | mit | 634 |
# -*- coding: utf-8 -*-
"""
pygments.formatters.html
~~~~~~~~~~~~~~~~~~~~~~~~
Formatter for HTML output.
:copyright: 2006-2007 by Georg Brandl, Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import sys, os
import StringIO
from pygments.formatter import Formatter
from pygments.to... | carlgao/lenga | images/lenny64-peon/usr/share/python-support/python-pygments/pygments/formatters/html.py | Python | mit | 22,285 |
# Enter your code here. Read input from STDIN. Print output to STDOUT
t = int(raw_input())
for i in range(t):
MOD = 10**9 + 7
s = int(input())
k = s/20
rem = s%20
if rem == 0:
print (42*k - 2)%MOD
else:
print (42*k + 2*rem)%MOD
# The following code times out on ... | ugaliguy/HackerRank | Mathematics/Algebra/wet-shark-and-42.py | Python | mit | 669 |
# -*- coding: utf-8 -*-
# Copyright (c) 2006-2012 Filip Wasilewski <http://en.ig.ma/>
# See COPYING for license details.
"""1D and 2D Wavelet packet transform module."""
from __future__ import division, print_function, absolute_import
__all__ = ["BaseNode", "Node", "WaveletPacket", "Node2D", "WaveletPacket2D"]
imp... | aaren/pywt | pywt/_wavelet_packets.py | Python | mit | 24,077 |
# Copyright (C) 2011 Brad Misik
#
# 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, distribu... | temugen/pipil | pipil.py | Python | mit | 10,540 |
from .. import Provider as InternetProvider
class Provider(InternetProvider):
user_name_formats = (
'{{last_name_female}}.{{first_name_female}}',
'{{last_name_male}}.{{first_name_male}}',
'{{last_name_male}}.{{first_name_male}}',
'{{first_name_male}}.{{last_name_male}}',
'... | danhuss/faker | faker/providers/internet/bg_BG/__init__.py | Python | mit | 1,900 |
import collections
from functools import partial
from itertools import chain
from types import MappingProxyType
from typing import Callable
from uuid import UUID
import iso8601
from foil.parsers import parse_iso_date as _parse_iso_date
def parse_uuid(value):
try:
value = UUID(value, version=4)
except... | portfoliome/foil | foil/deserializers.py | Python | mit | 2,317 |
import json
import csv
import pandas as pd
cred = pd.read_csv('credible.csv')
noncred = pd.read_csv('noncredible.csv')
noncred.reset_index(level=0, inplace=True)
cred.columns = ['site','type']
noncred.columns = ['site', 'lang', 'type','notes', 'tmp']
cred['clean_site'] = cred['site'].apply(lambda x: x.split('.')[0].lo... | aldengolab/fake-news-detection | data_cleaning/get_articles.py | Python | mit | 1,318 |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
from indra.databases import hgnc_client
from indra.util import unicode_strs
from nose.plugins.attrib import attr
def test_get_uniprot_id():
hgnc_id = '6840'
uniprot_id = hgnc_client.get_uniprot_id(hgnc_id)
... | sorgerlab/belpy | indra/tests/test_hgnc_client.py | Python | mit | 2,834 |
from rest_framework import serializers
from drf_haystack.serializers import HaystackSerializerMixin
from .models import {{ cookiecutter.model_name }}
from .search_indexes import {{ cookiecutter.model_name }}Index
class {{ cookiecutter.model_name }}Serializer(serializers.ModelSerializer):
class Meta:
mod... | rickydunlop/cookiecutter-django-app-template-drf-haystack | {{cookiecutter.app_name}}/serializers.py | Python | mit | 771 |
#!/usr/bin/python
# __init__.py file for batch-renamer-cli package
from .color import *
from .sort_by_name import *
| darko3/batch-renamer | batch_renamer_cli/__init__.py | Python | mit | 118 |
#/###################/#
# Import modules
#
#ImportModules
import ShareYourSystem as SYS
#/###################/#
# Build the model
#
#Definition an instance
MyNeurongrouper=SYS.NeurongrouperClass(
).neurongroup(
#NeurongroupingBrianDict
{
'N':10,
'model':
'''
dv/dt = (-(v+60*mV)+11*mV + 5.*mV*sqrt(2... | Ledoux/ShareYourSystem | Pythonlogy/draft/Simulaters/Neurongrouper/01_ExampleCell.py | Python | mit | 1,164 |
import pyhwtherm
mytest = pyhwtherm.PyHWTherm(
username="someuser@example.com",
password="mysecretpassword",
deviceid=123456
)
print "login successful: ",mytest.login()
print "Get thermostat data:", mytest.updateStatus()
beforeChange = mytest.status
print "Status: ", beforeChange
mytes... | texnofobix/pyhwtherm | example.py | Python | mit | 739 |
#! /usr/bin/env python3
from __future__ import print_function
import sys
from setuptools import setup
long_description = '''
*doit* comes from the idea of bringing the power of build-tools to execute any
kind of task
*doit* can be uses as a simple **Task Runner** allowing you to easily define ad hoc
tasks, helping... | pydoit/doit | setup.py | Python | mit | 5,484 |
"""
JSON-LD contexts.
"""
from .namespaces import ns_mgr, D
base = {
"@base": str(D),
"a": "@type",
"uri": "@id",
"label": "rdfs:label",
}
#set namespaces from the ns_mgr
for prefix, iri in ns_mgr.namespaces():
base[prefix] = iri.toPython()
#BCITE publications
publication = {
"title": "rdfs:l... | Brown-University-Library/vivo-data-management | vdm/context.py | Python | mit | 1,141 |
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from celery.decorators import task
from socialbeer.posts.models import Post
from socialbeer.core.utils import expand_urls
from socialbeer.members.models import Profile
from socialregistration.models import TwitterProfile
... | fxdgear/beersocial | socialbeer/core/tasks.py | Python | mit | 1,478 |
# -*- coding: utf-8 -*-
'''The app module, containing the app factory function.'''
from flask import Flask, render_template
# from country_update_demo.extensions import (
# #add as needed
# )
def asset_path_context_processor():
return {'asset_path': '/static/'}
def create_app(config_filename):
''' An ap... | openregister/country-update-demo | country_update_demo/factory.py | Python | mit | 1,157 |
try:
import urllib2 as urllib
except:
import urllib.request as urllib
import global_data
import sys
from global_data import GLOBALS
def setValues(response):
GLOBALS['RESPONSE'] = response.read()
GLOBALS['STATUS'] = response.code
GLOBALS['SETCOOKIE'] = response.info()['set-cookie']
def getURL():
... | Max00355/HTTPLang | httplang/make_request.py | Python | mit | 1,072 |
# -*- coding: utf-8 -*-
"""
Extension that integrates cookiecutter templates into PyScaffold.
"""
from __future__ import absolute_import
import argparse
from ..api.helpers import register, logger
from ..api import Extension
from ..contrib.six import raise_from
class Cookiecutter(Extension):
"""Additionally appl... | cpaulik/pyscaffold | src/pyscaffold/extensions/cookiecutter.py | Python | mit | 5,160 |
# 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 ... | rjschwei/azure-sdk-for-python | azure-mgmt-logic/azure/mgmt/logic/operations/integration_account_schemas_operations.py | Python | mit | 14,610 |
import sys
from .. import config
from . import nullRedirector
from . import flaskRedirector
from . import tornadoRedirector
ADAPTERS = {
'dict': 'nullRedirector',
'Flask': 'flaskRedirector',
'tornado': 'tornadoRedirector'
}
current_module = thismodule = sys.modules[__name__]
class rManager(object):
... | markleent/Guardian | auth/redirectors/redirectorManager.py | Python | mit | 513 |
"""Merge ee7bff1d660c and f6a9c7e6694b
Revision ID: 224dac8f951c
Revises: ee7bff1d660c, f6a9c7e6694b
Create Date: 2018-03-30 09:56:19.308323
"""
# revision identifiers, used by Alembic.
revision = '224dac8f951c'
down_revision = ('ee7bff1d660c', 'f6a9c7e6694b')
branch_labels = None
depends_on = None
from alembic imp... | fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/224dac8f951c_merge_ee7bf_f6a9c.py | Python | cc0-1.0 | 581 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.