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 |
|---|---|---|---|---|---|
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# spec/fixtures/responses/whois.nic.fo/status_registered
#
# and regenerate the tests with the following script
#
# $ scripts/generate_tests.py
#
from nose.tools import *
from dateutil.parser import parse ... | huyphan/pyyawhois | test/record/parser/test_response_whois_nic_fo_status_registered.py | Python | mit | 5,019 |
"""example URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | scailer/drf-docs-from-tests | example/project/urls.py | Python | mit | 830 |
from setuptools import setup, find_packages
import nodejs
setup(
name='nodejs',
version=nodejs.VERSION,
packages=find_packages(exclude=('tests',)),
install_requires=[
'optional-django==0.1.0',
],
description='Python bindings and utils for Node.js and io.js',
long_description='Docume... | markfinger/python-nodejs | setup.py | Python | mit | 500 |
# coding: utf-8
from django.conf.urls import include, url
from rest_framework import routers
from web_apps.api import views
from rest_framework.authtoken import views as authtoken_views
router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)
router.register(r'groups', views.GroupViewSet)
router... | fabrickit/fabkit | core/webapp/web_apps/api/urls.py | Python | mit | 490 |
def greeting(msg):
print(msg)
if __name__ == "__main__":
print("main")
| mbe9a/cs3240-labdemo | helper.py | Python | mit | 74 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import pytest
from sqlalchemy import create_engine
import journal
TEST_DATABASE_URL = os.environ.get(
'DATABASE_URL',
'postgresql://ndraper2@localhost:5432/test-learning-journal'
)
os.environ['DATABASE_URL'] = TEST_DATABASE_URL
os.envi... | ndraper2/learning-journal | tests/conftest.py | Python | mit | 966 |
# Run this from the folder of old bot
import time
import json
from pymongo import MongoClient
start = time.time()
client = MongoClient()
old = client.gw2
new = client.toothy
def update_keys():
for key in old.keys.find():
updated = {
"_id": int(key["_id"]),
"cogs": {
... | Maselkov/GW2Bot | migrate.py | Python | mit | 2,341 |
class Solution:
"""
@param A : a list of integers
@param target : an integer to be inserted
@return : an integer
"""
def searchInsert(self, A, target):
# write your code here
l, r = 0, len(A) - 1
while (l <= r):
i = (l + r) / 2
if (A[i] == target):... | Rhadow/leetcode | lintcode/Easy/060_Search_Insert_Position.py | Python | mit | 467 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-11-26 10:54
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('premises', '0001_initial'),
]
operations = [
... | amstart/demo | demoslogic/premises/migrations/0002_auto_20161126_1154.py | Python | mit | 1,443 |
for i in range(0,101):
print 100 - i | chunkman/mit-python | count.py | Python | mit | 37 |
from __future__ import print_function
import requests
from . import dict2xml, utils
class Crucible(object):
def __init__(self, baseurl):
self.baseurl = baseurl
def get_auth_token(self, username, password):
request = self.get_auth_token_request(username, password)
response = self.mak... | spookylukey/banter | banter/crucible.py | Python | mit | 3,576 |
#!/usr/bin/python
# this script creates a baseline submission using Gaussian Process Regression
# it will be properly commented later
import pandas as pd
import numpy as np
import datetime as dt
import os
pd.set_option('display.mpl_style', 'default')
pd.set_option('display.width', 10000)
pd.set_option('display.max_... | yanyuchka/bikesharing | baseline2.py | Python | mit | 4,575 |
# -*- coding: utf-8 -*-
#
# django-getpaid documentation build configuration file, created by
# sphinx-quickstart on Mon Jul 16 21:16:46 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
... | KrzysiekJ/django-getpaid | docs/source/conf.py | Python | mit | 8,465 |
"""
Data Grouper Processing Functions
============================
Created by: Chris Cadonic
For: Utility in Dr. Mandana Modirrousta's Lab
----------------------------
This file contains code necessary for processing excel files in the
grouper.py program. Functions here process files, the input of the
user, an... | Synapt1x/DataGrouper | processing.py | Python | mit | 7,347 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-03-21 08:40
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('app', '0121_auto_20160317_2102'),
]
operations = [
... | malaonline/Server | server/app/migrations/0122_auto_20160321_1640.py | Python | mit | 1,315 |
ignore = [ 'jmemansi.c', 'jmemdos.c', 'jmemmac.c' ]
StaticLibrary( 'jpeg', sources = ['src/' + file.name for file in Files( 'src/*.c' ) if not file.name in ignore] ) | dmsovetov/pygling | examples/jpeg9/Makefile.py | Python | mit | 166 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
from os.path import expanduser, join
import tempfile
import derpcon... | marcelometal/thumbor | thumbor/config.py | Python | mit | 20,520 |
from django.shortcuts import render
from .forms import TextForm
from .voikkotools import voikko_analyze
def index(request):
a = []
if request.method == "POST":
tf = TextForm(request.POST)
if tf.is_valid():
a = voikko_analyze(tf.cleaned_data.get("text"))
else:
tf = Text... | aapris/django-voikko-experiments | services/django_server/vanalyzer/views.py | Python | mit | 466 |
from dartcms.views import (DeleteMultipleObjectView, DeleteObjectView,
GridView, InsertObjectView,
InsertObjectWithInlinesView, UpdateObjectView,
UpdateObjectWithInlinesView)
from django.conf.urls import include, url
from django.forms impo... | astrikov-d/dartcms | dartcms/utils/config.py | Python | mit | 4,061 |
#!/usr/bin/env python
from wand.image import Image
import argparse
# get the arguments
parser = argparse.ArgumentParser(description='Rearranges the tiles in an AutoTileGen output file into a more human-friendly format.')
parser.add_argument('file', nargs=1, help='the name of AutoTileGen\'s output filename')
args = par... | FuzzyWuzzie/AutoTileGenRearranger | AutoTileGenRearranger.py | Python | mit | 1,422 |
# ----------------------------------------------------------------------
#
# Brad T. Aagaard, U.S. Geological Survey
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://geodynamics.org).
#
# Copyright (c) 2010-2017 University of California, Davis
#
# See COPYING for license... | geodynamics/spatialdata | spatialdata/spatialdb/__init__.py | Python | mit | 710 |
VERSION_ELMA = 'POT14'
VERSION_ACROSS = 'POT06'
END_OF_DATA_MARKER = 0x0067103A
END_OF_FILE_MARKER = 0x00845D52
END_OF_REPLAY_FILE_MARKER = 0x00492F75
TOP10_SINGLEPLAYER = [
21, 5, 106, 183, 137, 237, 89, 196, 72, 255, 143, 115, 118, 188, 112, 192,
223, 87, 180, 47, 13, 158, 7, 188, 99, 8, 111, 138, 9, 40, 173,... | sigvef/elma | elma/constants.py | Python | mit | 8,592 |
# Copyright (C) 2007 Alexandre Conrad, alexandre (dot) conrad (at) gmail (dot) com
#
# This module is part of FormAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from sqlalchemy import Column as SAColumn
from formalchemy import templates
from formalchemy import confi... | FormAlchemy/formalchemy | formalchemy/__init__.py | Python | mit | 1,805 |
# http://www.reddit.com/r/dailyprogrammer/comments/1qdw40/111113_challenge_141_easy_monty_hall_simulation/
import random
wins = [0, 0]
run_count = int(input())
for _ in range(run_count):
car_location = random.randint(0, 2)
choice = random.randint(0, 2)
winning_tactic = 0 if choice == car_location else 1
... | JackMorris/DailyProgrammerPython | 141 Monty Hall/main.py | Python | mit | 463 |
# 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 | CIM15/CDPSM/Connectivity/IEC61970/Core/PowerSystemResource.py | Python | mit | 1,988 |
"""Add autoincrement for id
Revision ID: 48c4c0104445
Revises: 150e17e5c774
Create Date: 2016-08-16 22:11:48.668749
"""
# revision identifiers, used by Alembic.
revision = '48c4c0104445'
down_revision = '150e17e5c774'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrad... | beslave/auto-collector | migrations/versions/48c4c0104445_add_autoincrement_for_id.py | Python | mit | 556 |
#!/usr/bin/env python
# coding=utf-8
# ======== 音声テスト用 =========
import pygame.mixer
import time
pygame.mixer.init()
pygame.mixer.music.load('/home/pi/project1/sounds/knock.wav')
pygame.mixer.music.play(3) # loop count
time.sleep(2) #10秒再生
pygame.mixer.music.stop() #停止
pygame.mixer.quit() #音源への電源停止:サーってノイズを消す | Garyuten/nasutoma_switch | examples/sounds_mp3.py | Python | mit | 375 |
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
import collections
import os
import platform
from concurrent.futures import ProcessPoolExecutor
from decimal import Decimal
from textwrap import dedent
import pytest
from path import Path
from pytablewriter import dumps_tabledata
from tabledata i... | thombashi/pytablereader | test/test_jsonlines_reader.py | Python | mit | 12,032 |
"""@author: Bryan Silverthorn <bcs@cargo-cult.org>"""
class SerialManager(object):
"""Manage in-process work."""
def __init__(self, tasks):
self._tasks = tasks
def manage(self):
"""Complete tasks."""
while self._tasks:
task = self._tasks.pop()
yield (task... | borg-project/utcondor | condor/managers/serial.py | Python | mit | 366 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from numap import NuMap
from itertools import izip
def left(element):
print "in left: %s" % (element,)
return element
def right(element):
print "in right: %s" % (element,)
return element
def root(element):
print "in root: %s" % (element,)
return e... | mcieslik-mctp/papy | doc/examples/branch.py | Python | mit | 834 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# called from wnf.py
# lib/wnf.py --install [rootpassword] [dbname] [source]
from __future__ import unicode_literals
import os, json
import frappe
import frappe.database
import getpass
from frappe.model.db_schema i... | gangadharkadam/tailorfrappe | frappe/installer.py | Python | mit | 6,527 |
from tsreceiver import main
main.receive()
| m4tx/techswarm-receiver | runreceiver.py | Python | mit | 44 |
__author__ = 'elsabakiu'
from crowdsourcing import models
from datetime import datetime
from rest_framework import serializers
import json
class TaskPropertiesSerializer(serializers.ModelSerializer):
class Meta:
model = models.Task
class TaskWorkerSerializer(serializers.ModelSerializer):
class Meta... | asmitagupta/crowdsource-platform | crowdsourcing/serializers/task.py | Python | mit | 674 |
from fabric.api import *
import os
import sys
import string
import time
# Custom Code Enigma modules
import common.Utils
import Drupal
# Override the shell env variable in Fabric, so that we don't see
# pesky 'stdin is not a tty' messages when using sudo
env.shell = '/bin/bash -c'
@task
def main(shortname, branch, ... | codeenigma/deployments | drupal/fabfile-drushcommand.py | Python | mit | 2,110 |
# -*- coding: utf-8 -*-
#
# precon_project documentation build configuration file, created by
# sphinx-quickstart on Sun Feb 17 11:46:20 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
... | kevinr/precon-project | docs/conf.py | Python | mit | 7,798 |
# Copyright (c) 2015 John Dewey
#
# 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... | retr0h/ansible-timer-callback | plugins/callbacks/timer.py | Python | mit | 1,327 |
import fileinput, math, collections
### ###
# utility func #
### ###
dbug = True
def btos(b):
return 'YES' if b else 'NO'
def pd(s, label=''):
global dbug
if dbug:
header = 'debug:'
if label != '':
header += ' (%s)\t' % label
print header, s
def stoi(s):
return([ int(x) for x in s.sp... | cripplet/practice | codeforces/471/attempt/b_things.py | Python | mit | 3,368 |
import xml.etree.ElementTree as ET
from .exceptions import UnpopulatedPropertyError
from .property_decorators import property_is_enum, property_not_empty, property_not_nullable
from .. import NAMESPACE
from ..datetime_helpers import parse_datetime
class UserItem(object):
class Roles:
Interactor = 'Interac... | Talvalin/server-client-python | tableauserverclient/models/user_item.py | Python | mit | 4,949 |
#!/usr/bin/env python
from six.moves import cPickle as pickle
import matplotlib.pyplot as plt
import os
import tensorflow as tf
import numpy as np
wd = os.getcwd()
file_name = wd+'/front_dist_data'
with open(file_name, 'rb') as f:
save = pickle.load(f)
pos_data = save['pos_data']
neg_data = save['neg_data... | ZhiangChen/bendix_dnn | front_radar/fc_net.py | Python | mit | 3,957 |
import pygame, math, game, entity, random, item
def rot_center(image, rect, angle):
"""rotate an image while keeping its center"""
rot_image = pygame.transform.rotate(image, angle)
rot_rect = rot_image.get_rect(center=rect.center)
return rot_image,rot_rect
def rotate_point(centerPoint,point,angle):
"""Rotates a ... | 602p/starfighter_revival | ship.py | Python | mit | 7,263 |
#!/usr/bin/python
import os
import psycopg2
dsn = os.getenv('CP_DSN', 'postgresql://')
schemafile = os.getenv('CP_SCHEMA', 'schema.sql')
db = psycopg2.connect(dsn)
c = db.cursor()
c.execute(open(schemafile, 'r').read())
db.commit()
c.close()
db.close()
| bnadland/cachepusher | ansible/backendsimulator/migrate.py | Python | mit | 257 |
import time
import socket
import pytest
from celery.contrib.testing.worker import start_worker
from django.test import LiveServerTestCase
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilitie... | MontrealCorpusTools/polyglot-server | tests/test_web.py | Python | mit | 5,872 |
from django.contrib import admin
from polls.models import Poll, Choice
class ChoiceInline(admin.TabularInline):
# class ChoiceInline(admin.StackedInline):
model = Choice
extra = 3
class PollAdmin(admin.ModelAdmin):
list_display = ('question', 'pub_date', 'was_published_recently')
list_filter = ['pub_d... | JonasAZou/hellodjango | hello/polls/admin.py | Python | mit | 689 |
from . controller import *
class NetworkController(Controller):
def __init__(self, scene, paddle):
super(NetworkController, self).__init__(scene)
self._paddle = paddle
self._left = False
self._right = False
def update(self, delta):
if self._left:
self._paddle.move(-500)
elif self._right:
... | cloostefis/quong | src/controller/network_controller.py | Python | mit | 627 |
#!/usr/bin/python
import scipy.stats as st
file = open("NormalDist.csv", "w")
i = -3.6
while(i<=3.6):
x = st.norm.cdf(i)
file.write(str(i) + ", " + str(x) + "\n")
i += 0.01
file.close()
| LukeBaal/PublicProjects | StatTables/Python Data Generation/zscoretable.py | Python | mit | 201 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-21 07:34
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0008_auto_20170821_0732'),
]
operations = [
migrations.AlterField... | sussexstudent/falmer | falmer/events/migrations/0009_auto_20170821_0734.py | Python | mit | 510 |
__author__ = 'Daniel'
from rest_framework import serializers
from glue.models import *
| Valchris/AngularJS-Django-Template | glue/serializers.py | Python | mit | 87 |
from django.db import models
from django.core.urlresolvers import reverse
from django.db.models.signals import pre_save
from django.utils.text import slugify
from django.conf import settings
from django.utils import timezone
from django.utils.safestring import mark_safe
from django.contrib.contenttypes.models import Co... | timle1/try_django_1_10 | posts/models.py | Python | mit | 3,173 |
# http://www.dataiku.com/blog/2015/08/24/xgboost_and_dss.html
import dataiku
import pandas as pd, numpy as np
from dataiku import pandasutils as pdu
from sklearn.metrics import roc_auc_score
import xgboost as xgb
from hyperopt import hp, fmin, tpe, STATUS_OK, Trials
train = dataiku.Dataset("train").get_dataframe()
va... | ipashchenko/ml4vs | ml4vs/xgb_hyperopt.py | Python | mit | 1,425 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
#load version number (can't just import the package since we might miss requirements)
filename = 'dnacol/version.py'
exec(compile(open(filename, "rb").read(), filename, 'exec')) #python2/3 compatible replacement for execfile()
... | koelling/dnacol | setup.py | Python | mit | 1,634 |
"""
.. function:: exaexplainscript(host, port, db, path:None)
:host: remote ip address,
:port: listening port
:db: remote db
:path: '</abs/path/to/script.sql>'
"""
registered = True
external_query = True
import functions
default_dict = {
'host': 'localhost',
'port': '9090',
'api': 'explain/',
'db':... | madgik/exareme | Exareme-Docker/src/exareme/exareme-tools/madis/src/functionslocal/vtable/exaexplainscript.py | Python | mit | 2,830 |
from datetime import datetime
import logging
from webapp2_extras.appengine.auth.models import User
from google.appengine.ext import ndb
from bp_includes.models import SocialUser
class User(User):
"""
Universal user model. Can be used with App Engine's default users API,
own auth or third party authenticati... | Bezoar/surrender-rides | bp_content/themes/default/handlers/models.py | Python | mit | 5,354 |
"""
Django settings for agt project.
Generated by 'django-admin startproject' using Django 1.8.12.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
import os
from ... | ArtGeekTech/Coding-Project-STEM-OPT-01 | agt/settings/base.py | Python | mit | 3,122 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from mezzanine.core.views import direct_to_template
admin.autodiscover()
# Add the urlpatterns for any custom Django applications here.
# You can also change the ``home`` view to add your own functionality
# to the project's homep... | vjousse/viserlalune | urls.py | Python | mit | 4,182 |
"""
The compat module provides support for backwards compatibility with older version of python.
"""
# flake8: noqa
try:
from urllib.parse import urlsplit
except ImportError:
from urlparse import urlsplit
try:
from tempfile import TemporaryDirectory
except ImportError:
from backports.tempfile import T... | Girbons/comics-scraper | comics/compat.py | Python | mit | 338 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.rst') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='Sajou',
version='0.1.0',
description='Simple structural analysis library for Python',
long_description=readme,
a... | cristobaltapia/sajou | setup.py | Python | mit | 519 |
from discord.ext import commands
import discord.utils
import dbaseConn
import discord
import random
bot = commands.Bot(command_prefix = ';')
class normalCommands:
def __init__(self,bot):
self.bot = bot
@bot.command()
async def stats(self):
""" stats about the bot """
await self.b... | Mik-the-koder/uberKewl | cogs/normalCommands.py | Python | mit | 3,346 |
#!/usr/bin/env python
# encoding: utf-8
"""Utilities."""
from ConfigParser import (NoOptionError, NoSectionError, ParsingError,
RawConfigParser)
from contextlib import contextmanager
from functools import wraps
from logging.handlers import TimedRotatingFileHandler
from os import close, remove
from shutil import rmt... | laserson/hdfs | hdfs/util.py | Python | mit | 6,938 |
#
----------------------------------------------
# Name: Do
# Description: Expand and execute command
## D20H-35 Expand and execute command
#
# Author: Philip S. Rist
# Date: 10/12/2010
# Copyright 2010 by St. Thomas Software
# ----------------------------------------------
# This program is freeware. It may be used
... | ActiveState/code | recipes/Python/577439_Simple_commsubmitter/recipe-577439.py | Python | mit | 9,229 |
from math import cos, sin, sqrt, pi, atan
import numpy as np
import random
from params import GOAL_NUMBER, USER_GOAL, V_MAX, ACC_MAX, MULT_SPEED
from Particle import Particle, TYPE_BOID, TYPE_GOAL
from model.model3 import bot
class Boid(Particle):
"Boid: particle that move according to the hord around it"
rej... | GuiCodron/roboid | Boid.py | Python | mit | 6,318 |
from lxml import etree as ET
from transunit import TransUnit
NAMESPACE = '{urn:oasis:names:tc:xliff:document:1.2}'
class XLIFFDict:
"Container for xliff document"
def __init__(self):
self.segments = dict()
self.header = dict()
self.document = None
@staticmethod
def create(do... | jakub-szczepaniak/xliff | xliffdict.py | Python | mit | 1,273 |
import numpy as np
from scipy.optimize import newton, brentq
from scipy.special import logsumexp, airy
from dppy.utils import check_random_state
def shift_pol(P, x0):
""" Return polynomial P(x-x0) as poly1d object
"""
X_x0 = np.poly1d([1, -x0])
return sum(X_x0**n * c_n for n, c_n in enumerate(P.co... | guilgautier/DPPy | dppy/beta_ensemble_polynomial_potential_core.py | Python | mit | 23,809 |
class SMSProvider:
providerName = None
config = {}
def getProviderName(self): # default
return self.providerName
def getBalance(self): # default
return None
def sendSMS(self): # default
return None
# define exception types
class SMSProviderNotConfiguredException(BaseE... | MomentumAS/pyMomentum | pyMomentum/sms/providers/providers.py | Python | mit | 456 |
"""
Compare two version numbers version1 and version2.
If version1 > version2 return 1, if version1 < version2 return -1, otherwise
return 0.
You may assume that the version strings are non-empty and contain only digits
and the . character.
The . character does not represent a decimal point and is used to separate
num... | ufjfeng/leetcode-jf-soln | python/165_compare_version_numbers.py | Python | mit | 1,451 |
import _plotly_utils.basevalidators
class OutlinewidthValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="outlinewidth", parent_name="streamtube.colorbar", **kwargs
):
super(OutlinewidthValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/streamtube/colorbar/_outlinewidth.py | Python | mit | 480 |
from collections import defaultdict
from datetime import datetime, timedelta
from lxml import etree
import pytz
import six
import warnings
from eemeter.structures import EnergyTrace
from eemeter.io.serializers import ArbitrarySerializer
class ESPIUsageParser(object):
""" Parse ESPI XML files.
Basic usage:
... | impactlab/eemeter | eemeter/io/parsers.py | Python | mit | 33,396 |
from math import sin, cos, sqrt, asin, isnan, isinf, pi
#Reference function -- gets reference at a time t
def ref(time,kernel,amplitude,frequency):
#frequency = 1*1.0/100.0
if kernel == 'butterfly1':
val = amplitude*cos(2*pi*time*frequency)*sin(4*pi*time*frequency)
elif kernel == 'butterfly2':
... | slremy/testingpubsub | myBallPlate/references.py | Python | mit | 701 |
from rpython.rlib.listsort import make_timsort_class
from rpython.rlib.objectmodel import specialize
from rpython.rlib.unroll import unrolling_iterable
from hippy.module.standard.strings.funcs import _strnatcmp
from hippy.locale import strcoll_u
NONE, KEY, VALUE = range(3)
(SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SO... | ericpp/hippyvm | hippy/sort.py | Python | mit | 6,006 |
from bs4 import BeautifulSoup
import urllib.request as urllib2
import praw
def findInfoYahoo(stockname):
#http://stackoverflow.com/questions/22330467/scraping-headlines-from-yahoo-finance-using-python
""" Will find the headlines from yahoo finance for a given stockname
"""
url = 'http://in.finance.ya... | aljohnso/Market_Dreams | test.py | Python | mit | 1,735 |
'''
Created on Mar 11, 2016
@author: cesar
'''
from random import choice,sample
from tag2hierarchy.hierarchy.treeHandlers import nodeNames, transverseTree
from tag2hierarchy.hierarchy import treeHandlers
import numpy as np
import copy
def randomSize(node):
"""
"""
sizeOfBranch = len(node.myBranch) - 1 #th... | cesarali/Tag2Hierarchy | tag2hierarchy/inference/tupleGenerator.py | Python | mit | 3,914 |
# engine/result.py
# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Define result set constructs including :class:`.ResultProxy`
and :class:`.RowProxy... | michaelBenin/sqlalchemy | lib/sqlalchemy/engine/result.py | Python | mit | 36,000 |
import subprocess
from config.config import ARDUINO
def rgb(words):
COLORS = [
"RED",
"ORANGE",
"YELLOW",
"GREEN",
"BLUE",
"PURPLE",
"INDIGO",
"WHITE",
"OFF",
"FADE"
]
index = words.index("GARDEN")
try:
color = words[index + 1]
if color.find('(') != -1:
color = color[:color.index('(')... | mddigaetano/AccessibleHomeAutomation | actions/rgb.py | Python | mit | 757 |
import socket
import ssl
import logging
import warnings
import datetime
import collections
from typing import Optional
from ..exceptions import SocketError, ListenerError
from ..compat import json
from .listener import BaseListener
logger = logging.getLogger(__name__)
class BetfairStream:
"""Socket holder, conn... | liampauling/betfair | betfairlightweight/streaming/betfairstream.py | Python | mit | 12,606 |
import _plotly_utils.basevalidators
class ColoraxisValidator(_plotly_utils.basevalidators.SubplotidValidator):
def __init__(
self, plotly_name="coloraxis", parent_name="choroplethmapbox", **kwargs
):
super(ColoraxisValidator, self).__init__(
plotly_name=plotly_name,
par... | plotly/plotly.py | packages/python/plotly/plotly/validators/choroplethmapbox/_coloraxis.py | Python | mit | 547 |
import sys
import site
import shutil
import hashlib
import base64
from pathlib import Path
import configparser
import urllib.request
import urllib.error
def _install(files, url=None):
"""
install one file package from GitHub or current directory
Parameters
----------
files : list... | salabim/salabim | install salabim from github.py | Python | mit | 8,081 |
import DeepFried2 as df
from .. import dfext
def mknet():
net = df.Sequential(
# -> 128x48
df.SpatialConvolutionCUDNN(3, 128, (7,7), border='same', bias=None, init=df.init.prelu()),
df.BatchNormalization(128, 0.95), df.ReLU(),
dfext.nextblock_b(128, cardin=16, chan_mid=4),
... | VisualComputingInstitute/towards-reid-tracking | lib/models/lunext.py | Python | mit | 1,521 |
from scipy import misc
from unittest import TestCase
from .src.algorithms.hiding import hide_data
from .src.algorithms.reading import uncover_data
from .src.iooperations import *
def to_bits(table):
ret = []
for x in table:
for i in range(8):
ret += [(x>>i)&1]
return ret
class TestSnd... | AdvenamTacet/Smuggler | test_simple.py | Python | mit | 2,096 |
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from time import gmtime, strftime
from google.appengine.api import mail
from models import *
from google.appengine.ext import blobstore
from google.appengine.ext.webapp import blobstore_handlers
from gaesessions import get... | nicodee/mestglobalcommunity | mestmentorplatform.py | Python | mit | 48,127 |
from setuptools import setup, find_packages
setup(
name='picobackup',
version='1.0',
packages=find_packages(),
url='https://github.com/davidfialho14/picobackup',
license='MIT License',
author='David Fialho',
author_email='fialho.david@gmail.com',
description='',
scripts=['bin/picob... | davidfialho14/picobackup | setup.py | Python | mit | 394 |
import numpy as np
# Preprocess pretrained text vectors
# and stores them in a suitable format (.npy)
# Parameters
ROOT_PATH = '/media/HDD_2TB/DATASETS/' # Data root path
base_path = ROOT_PATH + 'cnn_polarity/DATA/' # Binary vectors path
vectors_basename = 'word2vec.' # Name of the vectors file
language = 'fr' # ... | Sasanita/nmt-keras | utils/preprocess_text_word_vectors.py | Python | mit | 1,596 |
# -*- 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/market/v20191010/market_client.py | Python | mit | 3,478 |
#!/usr/bin/env python
# -*- coding: sjis -*-
import os, sys, fnmatch
import os.path
from shutil import ignore_patterns
from shutil import copystat
import errno
import re
class Error(EnvironmentError):
pass
kifuRegEx = re.compile(r'[+-][0-9]{2}[1-9]{2}(FU|KY|KE|GI|KI|KA|HI|OU|TO|NY|NK|NG|UM|RY)')
... | kimrin/COCOAnnotate | COCOAnnotate.py | Python | mit | 3,437 |
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param root: The root of the binary search tree.
@param node: insert this node into the binary search tree.
@return: The root of the new bina... | Rhadow/leetcode | lintcode/Easy/085_Insert_Node_in_a_Binary_Search_Tree.py | Python | mit | 1,275 |
from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
user = Table('user', post_meta,
Column('id', Integer, primary_key=True, nullable=False),
Column('username', String),
Column('password', String, nullable=False),
)
def upgrade(... | ericgarig/runner_tracker | db_repository/versions/018_migration.py | Python | mit | 788 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('jobs', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='jobpostingpage',
name='cac... | CIGIHub/greyjay | greyjay/jobs/migrations/0004_auto_20151007_1902.py | Python | mit | 764 |
# 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.
# ----------------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/metricsadvisor/azure-ai-metricsadvisor/tests/async_tests/base_testcase_async.py | Python | mit | 14,872 |
import pytest
from astropy.tests.helper import assert_quantity_allclose
from astropy import units as u
from astropy.time import Time
from poliastro.bodies import Earth, Sun
from poliastro.twobody import Orbit
from poliastro.twobody.propagation import kepler, mean_motion, cowell
import numpy as np
from poliastro.util... | anhiga/poliastro | src/poliastro/tests/tests_twobody/test_sample.py | Python | mit | 3,519 |
"""
[2015-10-30] Challenge #238 [Hard] Searching a Dungeon
https://www.reddit.com/r/dailyprogrammer/comments/3qtr01/20151030_challenge_238_hard_searching_a_dungeon/
# Description
Our hero is lost in a dungeon. You will be given ASCII maps of a few floors, her starting position, and her goal. On
some floors there are ... | DayGitH/Python-Challenges | DailyProgrammer/DP20151030C.py | Python | mit | 2,633 |
import praw
r = praw.Reddit(user_agent="clarus_tester")
submissions = r.get_subreddit('aww').get_hot(limit=5)
for x in submissions:
print(x.score)
print(x.url)
| gorygueye/python-reddit-test | download.py | Python | mit | 168 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2018-02-26 19:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tab', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='debater',
name='p... | jolynch/mit-tab | mittab/apps/tab/migrations/0002_auto_20180226_1925.py | Python | mit | 450 |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='django-ical',
version='1.3',
description="iCal feeds for Django based on Django's syndication feed framework.",
long_description=open('README.rst').read() + '\n' + open('CHANGES.rst').read(),
author='Ian Lewis',
aut... | rrader/django-ical | setup.py | Python | mit | 937 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This program collects Portugal weather observations from IPMA and uploads them to the Orion Context Broker.
It uses predefined list of stations (./stations.yml), that can be obtained by other harvester:
- https://github.com/FIWARE/dataModels/tree/master/... | Fiware/dataModels | specs/Weather/WeatherObserved/harvesters/portugal/portugal_weather_observed.py | Python | mit | 16,652 |
from setuptools import setup, find_packages
requirements = [
'Flask-Script',
'py2neo',
'cerberus',
]
test_requirements = [
'grapher',
'requests',
'nose',
'nose-parameterized',
'fake-factory',
'coverage',
'radon',
'coveralls'
]
setup(
name='grapher',
version='0.1',
... | lucasdavid/grapher | setup.py | Python | mit | 1,068 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from mock import MagicMock, patch
import os
from uiautomator import Adb
class TestAdb(unittest.TestCase):
def setUp(self):
self.os_name = os.name
def tearDown(self):
os.name = self.os_name
def test_serial(self):
seri... | fancylear/TestCaseExample | test_adb.py | Python | mit | 7,446 |
# -*- coding: utf-8 -*-
"""
Features
------
Extra features Elements.
"""
from jinja2 import Template
import json
from .utilities import color_brewer, _parse_size
from .element import Element, Figure, JavascriptLink, CssLink, Div, MacroElement
from .map import Map, TileLayer, Icon, Marker, Popup
class WmsTileLayer(T... | zhoujh30/folium | folium/features.py | Python | mit | 11,036 |
# -*- coding: utf-8 -*-
#
# westwing_sales documentation build configuration file, created by
# sphinx-quickstart.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values... | mateuszdargacz/westing_sales | docs/conf.py | Python | mit | 7,860 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from mutant.db.fields.generic import FieldDefinitionTypeField
class Migration(migrations.Migration):
dependencies = [
('mutant', '0001_initial'),
('contenttypes', '0001_initial'),
]
... | charettes/django-mutant | tests/migrations/0001_initial.py | Python | mit | 2,419 |
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
Tests for the Materials Project DFT mixing scheme
**NOTE FOR FUTURE DEVELOPERS**
PLEASE DO NOT CHANGE THESE TESTS WITHOUT READING THIS ENTIRE DOCUMENTATION!
The MP DFT mixing scheme is conceptually simple but highly int... | materialsproject/pymatgen | pymatgen/entries/tests/test_mixing_scheme.py | Python | mit | 76,508 |
from importlib import import_module
from django.conf import settings
from django.http import HttpResponseForbidden
from django.template import RequestContext, Template, TemplateDoesNotExist, loader
from django.utils.deprecation import MiddlewareMixin
"""
# Middleware to allow the display of a 403.html template when ... | dotKom/onlineweb4 | middleware/http.py | Python | mit | 2,002 |
from twisted.web import resource
class MyRequestHandler1(resource.Resource):
def render(self, request):
foo(request.uri)
response = do_stuff_with(request)
return response
def render_GET(self, request):
x = request
bar(x.uri)
do_stuff_with(request)
respon... | github/codeql | python/ql/test/library-tests/web/twisted/test.py | Python | mit | 1,441 |