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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
import re
import glob
class FileReader(object):
OPTION_LINE_RE = re.compile(r'^#!\s*(.+?)\s*=(.+?)\s*$')
def __init__(self):
self.opts = {
'sep': ' ',
'cols': 'sum',
}
def read_option_line(self, l):
m = self.OPTION_LINE_RE.match(l)... | amiraliakbari/grade-analyzer | pan/pan.py | Python | mit | 414 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from multiprocessing import Process
import os
from Modules.Update import Update
from Modules.UpdateLog import UpdateLog
from Modules.UpdateUnicorn import UniCorn, UpdateIcon
from Modules.init_unicorn import unicorn_init
from Modules.update_matrix import *
processes_bar = []
... | LoveBootCaptain/WeatherPi | WeatherPi.py | Python | mit | 1,346 |
import sys
if sys.version_info.major == 2:
from .six_py2 import (
urlparse,
urlunparse,
Generator,
)
else:
from .six_py3 import ( # noqa: #401
urlparse,
urlunparse,
Generator,
)
| pipermerriam/web3.py | web3/utils/six/__init__.py | Python | mit | 245 |
#----------------------------------------------------------------------------
# Name: ColourSelect.py
# Purpose: Colour Box Selection Control
#
# Author: Lorne White, Lorne.White@telusplanet.net
#
# Created: Feb 25, 2001
# Licence: wxWindows license
#--------------------------------... | ktan2020/legacy-automation | win/Lib/site-packages/wx-3.0-msw/wx/lib/colourselect.py | Python | mit | 5,498 |
from flask import Flask,redirect
from flask import render_template
from flask import request
from twython import Twython
from redis import Redis
import settings
app = Flask(__name__)
r = Redis()
API_KEY = settings.API_KEY
API_SECRET = settings.API_SECRET
@app.route("/twitter", methods=["GET"])
def display():
#Creat... | zmallen/flock | twitter_app.py | Python | mit | 1,763 |
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 04 17:51:20 2014
@author: wy
"""
import numpy as np
def sigmoid(x):
x = np.sum(x)
return 1./(np.e**-x + 1)
class Graph(object):
def __init__(self,vs = [],es = []):
self.vs = set()
self.es = set()
for v in vs:
self.add_... | zwy1135/z_idea | graph.py | Python | mit | 4,756 |
# -*- coding: utf-8 -*-
__author__ = 'frank'
from flask import Flask, request, url_for, render_template, g, session, flash
from flask_wtf.csrf import CsrfProtect
from flask_debugtoolbar import DebugToolbarExtension
from flask.ext.login import LoginManager
from flask.ext.moment import Moment
from . import filters, pe... | Fansion/sharefun | sharefun/__init__.py | Python | mit | 5,284 |
#!/usr/bin/env python
"""
Regular Expression Matching
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatc... | weixsong/algorithm | leetcode/10.py | Python | mit | 1,638 |
# 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/synapse/azure-synapse-artifacts/azure/synapse/artifacts/operations/_spark_job_definition_operations.py | Python | mit | 45,127 |
# -*- coding: utf-8 -*-
"""
Cuttle, the simple, extendable ORM.
:license: MIT, see LICENSE for details.
"""
__version__ = '0.9.0.dev'
| smitchell556/cuttle | cuttle/__init__.py | Python | mit | 137 |
"""
This workload presents a simple interface that can be reused in other workloads.
It summary, it runs several subprocesses using the multiprocessing package,
makes the connections between them, and then starts working.
This particular workload spawns NETWORK_SIZE machines, two of which are
proposer. We can run wit... | victordomene/ram-paxos | workloads/workload_B.py | Python | mit | 4,156 |
from setuptools import setup
setup(
name = 'meerkat',
packages = ['meerkat'],
version = '0.3.7',
description = 'A program for reciprocal space reconstruction',
author = 'Arkadiy Simonov, Dmitry Logvinovich',
author_email = 'aglietto@gmail.com',
url = 'https://github.com/aglie/meerkat.git',
# download_url... | aglie/meerkat | setup.py | Python | mit | 480 |
#!/usr/bin/env python
# encoding: utf-8
from postcards.postcards import Postcards
from postcards.plugin_pexels.util.pexels import get_random_image_url, read_from_url
import sys
class PostcardsPexel(Postcards):
"""
Send postcards with random images from pexels.com
"""
def get_img_and_text(self, plugi... | abertschi/postcards | postcards/plugin_pexels/postcards_pexels.py | Python | mit | 618 |
from django.conf import settings
from councilmatic_core.models import Bill, Organization, Action
from datetime import datetime
import pytz
app_timezone = pytz.timezone(settings.TIME_ZONE)
class NYCBill(Bill):
class Meta:
proxy = True
def __str__(self):
return self.friendly_name
# NYC CU... | datamade/nyc-councilmatic | nyc/models.py | Python | mit | 4,078 |
# Problem: D. Parentheses Order (APAC 2015 Round B)
# Author: babhishek21
# Lang: Python 2.7
dp = [[0 for i in xrange(101)] for j in xrange(101)]
def prep():
global dp
for i in xrange(101):
dp[0][i] = 1
dp[1][1] = 1
for i in xrange(101):
for j in xrange(i,101):
dp[i][j] = dp[i-1][j] + dp[i][j-... | babhishek21/oj-sols | gcj/APAC 2015/Round B/D-Parentheses-Order.py | Python | mit | 2,013 |
#from api import *
| AlexSzatmary/bake | examples/poisson/myBake/__init__.py | Python | mit | 19 |
# -*- coding: utf-8 -*-
import pytest
import validators
@pytest.mark.parametrize(('value', 'min', 'max'), [
(12, 11, 13),
(12, None, 14),
(12, 11, None),
(12, 12, 12)
])
def test_returns_true_on_valid_range(value, min, max):
assert validators.between(value, min=min, max=max)
@pytest.mark.parame... | kvesteri/validators | tests/test_between.py | Python | mit | 863 |
import unittest
from katas.kyu_8.a_needle_in_the_haystack import find_needle
class FindNeedleTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(find_needle([
'3', '123124234', None, 'needle', 'world', 'hay', 2, '3',
True, False
]), 'found the needle at po... | the-zebulan/CodeWars | tests/kyu_8_tests/test_a_needle_in_the_haystack.py | Python | mit | 897 |
# -*- coding: utf-8 -*-
import sys,pymongo
from pymongo import MongoClient
from pymongo.errors import ConnectionFailure
from bson.code import Code
class MongoDBConfig:
def __init__(self, db_name, host):
self._db_name= db_name
self._host = host
class MongoDB:
'''Use mongo_client for a pooled m... | vollov/py-lab | src/mongodb/__init__.py | Python | mit | 1,550 |
"""
Derived module from filehandler.py to handle STereoLithography files.
"""
import numpy as np
from mpl_toolkits import mplot3d
from matplotlib import pyplot
from stl import mesh, Mode
import pygem.filehandler as fh
class StlHandler(fh.FileHandler):
"""
STereoLithography file handler class
:cvar string infile: ... | fsalmoir/PyGeM | pygem/stlhandler.py | Python | mit | 3,986 |
# # define Line class
import math
class Line(object):
def __init__(self, p1,p2):
self.p1 = p1
self.p2 = p2
def getP1(self):
return self.p1
def getP2(self):
return self.p2
def getDistance(self):
euclidean_dist = math.sqrt((self.p1.getXCoord() - self.p2.getXCoord())... | jskye/car-classifier-research | src/hyp.verification.tools/py/Line.py | Python | mit | 564 |
"""
2015 gupon.jp
Connector for C4D Python Generator
"""
import c4d, math, itertools, random
from c4d.modules import mograph as mo
#userdata id
ID_SPLINE_TYPE = 2
ID_SPLINE_CLOSED = 4
ID_SPLINE_INTERPOLATION = 5
ID_SPLINE_SUB = 6
ID_SPLINE_ANGLE = 8
ID_SPLINE_MAXIMUMLENGTH = 9
ID_USE_SCREEN_DIST = 10
ID_USE_MAXS... | gupon/ConnectorC4D | ConnectorC4D.py | Python | mit | 6,128 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Admin views for invenio-accounts."""
from flask import current_app, flash
from fl... | inveniosoftware/invenio-accounts | invenio_accounts/admin.py | Python | mit | 7,515 |
from unittest import mock
from unittest import TestCase
from sewer.dns_providers.rackspace import RackspaceDns
from . import test_utils
class TestRackspace(TestCase):
"""
"""
def setUp(self):
self.domain_name = "example.com"
self.domain_dns_value = "mock-domain_dns_value"
self.R... | komuW/sewer | sewer/dns_providers/tests/test_rackspace.py | Python | mit | 8,481 |
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
print('hello python!')
print('I like 6.00.1x') | coshkun/6.00.1x-MITx-Course-Training-Lab-Notes | anaconda/6.00.1x.hello.py | Python | mit | 126 |
from dynaconf import settings
print("EXAMPLE_ prefix")
settings.configure(ENVVAR_PREFIX_FOR_DYNACONF="EXAMPLE")
print(settings.VAR1)
print(settings.VAR2)
print("_ prefix")
settings.configure(ENVVAR_PREFIX_FOR_DYNACONF="")
print(settings.VAR1)
print(settings.VAR2)
print("no prefix at all")
settings.configure(ENVVAR_P... | rochacbruno/dynaconf | example/envvar_prefix/app.py | Python | mit | 548 |
import discord
import game_objects as rpg
import verb_parser as v
client = discord.Client()
client.login("login", "password")
@client.event
def on_message(message):
command = message.content.split()
if (len(command) <= 2) & (len(command) > 0):
verb_word = command[0]
if verb_word in v.verb_dic... | Tukes/DiscordRPG | discordBotRPG.py | Python | mit | 968 |
from unittest import TestLoader, TextTestRunner, TestSuite
from UnitTests.TableTest import TestTable
from UnitTests.DestinationTest import TestDestination
from UnitTests.CSVReaderTest import TestCSVReader
from UnitTests.ProxyExtractorTest import TestProxyExtractor
from UnitTests.NoProtocolTest import TestNoProtocol
fro... | Valentijn1995/Kn0ckKn0ck | Kn0ckKn0ckTestSuite.py | Python | mit | 1,092 |
from .test_ipuz import IPUZBaseTestCase
class IPUZSampleBlockTestCase(IPUZBaseTestCase):
def setUp(self):
self.puzzle = {
"version": "http://ipuz.org/v1",
"kind": ["http://ipuz.org/block"],
"dimensions": {"width": 3, "height": 3},
}
def test_slide_is_bool(... | svisser/ipuz | tests/test_block.py | Python | mit | 5,236 |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | SCM-NV/qmworks-namd | docs/conf.py | Python | mit | 6,473 |
# -*- coding: utf-8 -*-
r'''This module contains a base class for modeling computation graphs.'''
import downhill
import gzip
import hashlib
import numpy as np
import pickle
import theano
import time
import warnings
from . import layers
from . import losses
from . import regularizers
from . import trainer
from . imp... | lmjohns3/theanets | theanets/graph.py | Python | mit | 28,912 |
from flask import Blueprint
auth = Blueprint('auth', __name__)
from . import views # noqa: E402, F401
| TwilioDevEd/authy2fa-flask | twofa/auth/__init__.py | Python | mit | 105 |
# Copyright (c) 2006-2021 Andrey Golovizin
#
# 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, publi... | live-clones/pybtex | pybtex/style/formatting/__init__.py | Python | mit | 3,956 |
import zmq
import numpy as np
import theano
import theano.gpuarray
try:
from pygpu import collectives as gpu_coll
except ImportError as exc:
gpu_coll = None
from .reducers import reducers
sync = None
cpu = None
gpu = None
def connect_as_master(n_parallel, rank, master_rank, use_gpu,
m... | astooke/synkhronos | synkhronos/comm.py | Python | mit | 13,018 |
# -*- coding: utf-8 -*-
""" Sahana Eden Content Management System Model
@copyright: 2012 (c) Sahana Software Foundation
@license: MIT
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 S... | flavour/iscram | modules/eden/cms.py | Python | mit | 12,806 |
from django.contrib.auth import get_user_model, login, logout
from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
from django.db.models import Q # import for AJAX / dynamic searching
from django.http import HttpResponseRedirect, Http404, HttpResponse
from django.template import RequestCon... | martazaryn/green-roofs-mappping | Green_Roof_MapPy/warsaw/views.py | Python | mit | 3,276 |
# flake8: noqa
from .client import Client
from .compatpatch import ClientCompatPatch
from .errors import (
ClientError, ClientLoginError, ClientCookieExpiredError,
ClientConnectionError, ClientForbiddenError,
ClientThrottledError,ClientBadRequestError,
)
from .common import ClientDeprecationWarning
__ver... | ping/instagram_private_api | instagram_web_api/__init__.py | Python | mit | 337 |
import _plotly_utils.basevalidators
class HovertextValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name="hovertext", parent_name="violin", **kwargs):
super(HovertextValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/violin/_hovertext.py | Python | mit | 498 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from os.path import join as ojoin
import numpy as np
import sys
def read_accept(path):
outdict = dict()
with open(path) as f:
for line in f:
line = line.strip()
if not line: continue
line = line.split()
pape... | gfarnadi/FairPSL | debug/compare_map/compare.py | Python | mit | 2,282 |
# -*- encoding: utf-8 -*-
'''
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.
An example is the root-to-leaf path 1->2->3 which represents the number 123.
Find the total sum of all root-to-leaf numbers.
For example,
1
/ \
2 3
The root-to-leaf path 1->... | weixsong/algorithm | leetcode/129.py | Python | mit | 1,223 |
from django.test import TestCase
from django.test import Client
from common.models import User, Org
from emails.models import Email
from emails.forms import EmailForm
class UserCreation(TestCase):
def setUp(self):
self.client = Client()
self.org, _ = Org.objects.get_or_create(
name="te... | MicroPyramid/Django-CRM | emails/tests.py | Python | mit | 5,915 |
from django.conf.urls import url
from .viewsets import BookmarkViewSet
bookmark_list = BookmarkViewSet.as_view({
'get': 'list',
'post': 'create'
})
bookmark_detail = BookmarkViewSet.as_view({
'get': 'retrieve',
'patch': 'update',
'delete': 'destroy'
})
urlpatterns = [
url(r'^bookmarks/$', bo... | hnakamur/django-bootstrap-table-example | project/apiv2/urls.py | Python | mit | 430 |
## This file is part of Scapy
## Copyright (C) 2007, 2008, 2009 Arnaud Ebalard
## 2015, 2016, 2017 Maxence Tury
## This program is published under a GPLv2 license
"""
TLS server automaton. This makes for a primitive TLS stack.
Obviously you need rights for network access.
We support versions SSLv2 to TL... | CodeNameGhost/shiva | thirdparty/scapy/layers/tls/automaton_srv.py | Python | mit | 30,139 |
# -*- coding: utf-8 -*-
# ProjectEuler/src/python/problem388.py
#
# Distinct Lines
# ==============
# Published on Saturday, 9th June 2012, 02:00 pm
#
# Consider all lattice points (a,b,c) with 0 a,b,c N. From the origin
# O(0,0,0) all lines are drawn to the other lattice points. Let D(N) be the
# number of dis... | olduvaihand/ProjectEuler | src/python/problem388.py | Python | mit | 583 |
"""
sphinx.testing
~~~~~~~~~~~~~~
Sphinx test utilities
You can require sphinx.testing pytest fixtures in a test module or a conftest
file like this:
pytest_plugins = 'sphinx.testing.fixtures'
:copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS.
:license: BSD, see LICE... | lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/sphinx/testing/__init__.py | Python | mit | 341 |
"""Emoji config functions"""
import json
import os
import re
from logging import getLogger
from card_py_bot import BASEDIR
__log__ = getLogger(__name__)
# Path where the emoji_config.json will be stored
EMOJI_CONFIG_PATH = os.path.join(BASEDIR, "emoji_config.json")
# Dictionary that is keyed by the Discord short em... | nklapste/card-py-bot | card_py_bot/config.py | Python | mit | 4,162 |
# coding: utf-8
# In[1]:
get_ipython().magic(u'matplotlib inline')
# In[2]:
import pandas as pd
# In[3]:
import xray
# In[4]:
url = 'http://opendap-devel.ooi.rutgers.edu:8090/thredds/dodsC/eov-1/Coastal_Pioneer/CP05MOAS/02-FLORTM000/recovered_host/CP05MOAS-GL388-02-FLORTM000-flort_m_glider_recovered-recover... | rsignell-usgs/notebook | Untitled.py | Python | mit | 720 |
# ====================================================================
# Copyright (c) 2013 Carnegie Mellon University. All rights
# reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of... | robojamison/hello-git | lib/pocketsphinx/swig/python/test/lm_test.py | Python | mit | 3,092 |
import tensorflow as tf
import numpy as np
import cv2
img_original = cv2.imread('jack.jpg') #data.camera()
img = cv2.resize(img_original, (64*5,64*5))
# for positions
xs = []
# for corresponding colors
ys = []
for row_i in range(img.shape[0]):
for col_i in range(img.shape[1]):
xs.append([row_i, col_i])
ys.app... | iamharshit/ML_works | Photo Painter/NN.py | Python | mit | 2,722 |
from rest_framework import serializers
from ..models import Route
class RouteSerializer(serializers.ModelSerializer):
class Meta:
model = Route
fields = (
'pk',
'name',
'description',
'direction_main',
'direction_extra',
'zon... | sauli6692/ibc-server | rte/serializers/route.py | Python | mit | 337 |
'''
Created on 24 Feb 2015
@author: Ronny Andersson (ronny@andersson.tk)
@copyright: (c) 2015 Ronny Andersson
@license: MIT
'''
# Standard library
import unittest
# Third party
import nose
# Internal
from zignal.music import scales
class Test_midi_scales(unittest.TestCase):
# Benson, DJ. (2006). Music: A Math... | ronnyandersson/zignal | zignal/tests/test_music_scales.py | Python | mit | 5,855 |
from collections import deque
import sys
import time
from eventlet.pools import Pool
from eventlet import timeout
from eventlet import greenthread
class ConnectTimeout(Exception):
pass
class BaseConnectionPool(Pool):
def __init__(self, db_module,
min_size = 0, max_size = 4,
... | tavisrudd/eventlet | eventlet/db_pool.py | Python | mit | 15,932 |
# coding=utf-8
from webob.response import Response as WSGIResponse
from gevent.event import Event
from ..event_emitter import EventEmitter
class Response(WSGIResponse, EventEmitter):
"""
The Main reason for this class is make the response waitable. The primary event loop can listen on response
when end() ... | shuoli84/gevent_socketio2 | socketio/engine/response.py | Python | mit | 1,322 |
# Python - 3.6.0
Test.it('Basic tests')
Test.assert_equals(solve('abc'), True)
Test.assert_equals(solve('abd'), False)
Test.assert_equals(solve('dabc'), True)
Test.assert_equals(solve('abbc'), False)
| RevansChen/online-judge | Codewars/7kyu/consecutive-letters/Python/test.py | Python | mit | 203 |
from datanator_query_python.util import mongo_util
from datanator_query_python.config import config
class TransformMetabolitesMeta(mongo_util.MongoUtil):
def __init__(self, MongoDB=None,
db=None,
username=None,
password=None,
... | KarrLab/kinetic_datanator | datanator/schema_2/transform_metabolites_meta.py | Python | mit | 13,372 |
from database import db
import time
import datetime
ga_profiles_association = db.Table('user_profiles_association',
db.Column('user_id', db.Integer, db.ForeignKey('google_analytics_oauth_credentials.id')),
db.Column('profile_id', db.Integer, db.ForeignKey('google_analytics_profiles.id'))
)
class GoogleAnalyti... | wigginslab/lean-workbench | lean_workbench/google_analytics/google_analytics_models.py | Python | mit | 6,662 |
#! /usr/bin/env python
# This script converts the fits files from the NIRCam CRYO runs
# into ssb-conform fits files.
import sys, os,re,math
import optparse,scipy
from jwst import datamodels as models
from astropy.io import fits as pyfits
import numpy as np
class nircam2ssbclass:
def __init__(self):
... | JarronL/pynrc | dev_utils/DMS/nircam2ssb.py | Python | mit | 16,914 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2020 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Invenio module for previewing files."""
import os
from setuptools import find_pa... | inveniosoftware/invenio-previewer | setup.py | Python | mit | 3,916 |
# -*- coding: utf-8 -*-
# The MIT License (MIT)
# Copyright (c) 2015 Percy Li
# See LICENSE for details.
import struct
import threading
import copy
class FrameBuffer(object):
def __init__(self,decoder = None):
self.data_buffer = bytes([])
self.decoder = decoder
def s... | lzjever/pullot | pullot/framebuffer.py | Python | mit | 2,966 |
from django.db import models
class Topic(models.Model):
title = models.CharField(max_length=200)
def __unicode__(self):
return self.title
| mozillazg/django-simple-projects | projects/pagination/hello/models.py | Python | mit | 157 |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))
import files
import table
import genetics
def main(argv):
int_mass = table.integer_mass(argv[0])
lines = files.read_lines(argv[1])
leaderboard = [([int_mass[p] for p in peptide], peptide) for peptide in lin... | cowboysmall/rosalind | src/textbook/rosalind_ba4l.py | Python | mit | 569 |
#!/usr/bin/env python
import sys
import numpy as np
import json
import matplotlib.pyplot as plt
import matplotlib.animation as animation
def main():
json_data = open('moldy_argon.json')
data = json.load(json_data)
json_data.close()
num_t_steps = len(data)
num_atoms = data[0]['atoms']['num... | tommyogden/moldy-argon | plot/plot_moldy_argon.py | Python | mit | 1,728 |
from setuptools import setup
setup(
name='testcl-click',
version='1.0',
py_modules=['testcl'],
include_package_data=True,
install_requires=[
'click',
# Colorama is only required for Windows.
'colorama',
],
entry_points='''
[console_scripts]
testcl=tes... | RaphaelArkadyMeyer/LiveCoding | Student CL/setup.py | Python | mit | 338 |
from staffjoy.resource import Resource
class Manager(Resource):
"""Location managers"""
PATH = "organizations/{organization_id}/locations/{location_id}/managers/{user_id}"
ID_NAME = "user_id"
| Staffjoy/client_python | staffjoy/resources/manager.py | Python | mit | 206 |
#! /usr/bin/python3
import numpy
import scipy.special # for expit (a quick numpy-array-aware sigmoid)
# consider http://stackoverflow.com/questions/3985619/how-to-calculate-a-logistic-sigmoid-function-in-python
class RbmError(Exception):
pass
class rbm:
def __init__(self, i, j, rate, p=None): # i = |v|, j =... | boldingd/BadRbm | badrbm.py | Python | mit | 3,890 |
import time
import wx
class ShowBinding(object):
def __init__(self, field, trait, show_if_value=True):
self.field, self.trait, self.show_if_value = field, trait, show_if_value
trait[0].on_trait_change(self.update_view, trait[1], dispatch='ui')
self.update_view()
def update_view(self):... | Bouke/mvvm | mvvm/viewbinding/display.py | Python | mit | 6,057 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from .sitemap import BlogSitemap
from .views import RobotPageView, HumanPageView, GooglePageView
admin.autodiscover()
sitemaps = {
'blog': BlogSitemap,
}
urlpatterns = patterns('',
url(
regex=r"^robots\.txt$",
... | vandorjw/notes | vandorjw/vandorjw/urls.py | Python | mit | 1,049 |
import numpy as np
import numpy.core.multiarray as ma
encoding = 'utf8'
unicode_errors = 'strict'
import scipy.spatial.distance as dist
totalcount = 0
alignedcount = 0
from math import *
def square_rooted(x):
return round(sqrt(sum([a * a for a in x])), 3)
def cosine_similarity(x, y):
numerator = sum(a * b ... | eabdullin/nlp_mthesis | wordvectormix.py | Python | mit | 2,152 |
#!/usr/bin/env python
from EPPs.common import StepEPP, get_workflow_stage
class AssignWorkflowFinance(StepEPP):
# All samples for the artifacts in the step will be queued to finance workflow
def _run(self):
artifacts_to_route = set()
for art in self.artifacts:
sample = art.samples[... | EdinburghGenomics/clarity_scripts | scripts/assign_workflow_finance.py | Python | mit | 719 |
# -*- 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 'MeasuringMethod'
db.create_table(u'ddsc_core_measuringmethod', (
('id', self.gf(... | ddsc/ddsc-core | ddsc_core/migrations/0006_add_model_MeasuringMethod.py | Python | mit | 6,529 |
from collections import namedtuple
Datapoint = namedtuple("Datapoint", "phrase sentiment")
| ahmedshabib/evergreen-gainsight-hack | sentiment Analyser/samr/data.py | Python | mit | 93 |
# Got this from http://code.activestate.com/recipes/410692/
# This class provides the functionality we want. You only need to look at
# this if you want to know how this works. It only needs to be defined
# once, no need to muck around with its internals.
class switch(object):
def __init__(self, value):
se... | Tungul/pythonplayground | switch.py | Python | mit | 2,791 |
import base_verifier
import whiskey_parser
class HeaderVerifier(object):
def __init__(self):
pass
def verify(self, node):
if node.aid == whiskey_parser.ASTID.PAGE:
for i in node.fields["children"]:
self.verify(i)
elif node.aid == whiskey_parser.ASTID.TOPLEVEL_IMPORT: | allofhercats/whiskey | proto/header_verifier.py | Python | mit | 285 |
from __future__ import absolute_import, division, print_function
from code import InteractiveConsole
import json
import os
from os.path import dirname, exists, join, split
import pkgutil
from shutil import copyfile
import unittest
from electroncash import commands, daemon, keystore, simple_config, storage, tests, uti... | fyookball/electrum | android/app/src/main/python/electroncash_gui/android/console.py | Python | mit | 10,589 |
"""
returns tsv of word frequencies in revision comments
Usage:
revision_comment_word_extractor (-h|--help)
revision_comment_word_extractor <input> <output>
[--debug]
[--verbose]
Options:
-h, --help This help message is printed
<... | hall1467/wikidata_usage_tracking | python_analysis_scripts/revision_comment_word_extractor.py | Python | mit | 2,427 |
__version__ = "0.1.3"
get_version = lambda: __version__ | eternalfame/django-russian_fields | russian_fields/__init__.py | Python | mit | 56 |
__author__ = 'Val Neekman [neekware.com]'
__description__ = 'This application handles all common tasks.'
__version__ = '1.0.6'
| un33k/django-toolware | toolware/__init__.py | Python | mit | 127 |
from django.test import TestCase
from django.test import Client
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.contrib.auth import SESSION_KEY
from django.utils.six.moves.urllib.parse import urlparse
from users.models import User
class RegisterTestCase(TestCase... | ericmok/djangosimpleblog | users/test_views.py | Python | mit | 2,120 |
# vim: fileencoding=utf-8
from __future__ import unicode_literals
from __future__ import print_function
import subprocess
import sys
import site
import os
import platform
import shutil
import urllib2
from urllib2 import URLError
from urlparse import urlsplit
import time
import logging
logging.basicConfig(level=lo... | east825/youtube-dl-gui | src/installer.py | Python | mit | 10,702 |
from django.contrib import admin
from responseTemplates.models import ResponseTemplate, Paragraph
class ParagraphInline(admin.StackedInline):
model = Paragraph
extra = 1
class ResponseTemplateAdmin(admin.ModelAdmin):
inlines = [ParagraphInline]
admin.site.register(ResponseTemplate, ResponseTemplateAd... | wispwisp/supportNotebook | responseTemplates/admin.py | Python | mit | 325 |
import logging
class BaseResponseHandler:
def on_execution(self, event):
logging.debug(event)
return event
def on_exception(self, ex):
logging.exception(str(ex))
raise
def on_response(self, response):
logging.debug(response)
return response
| CloudHeads/lambda_utils | lambda_utils/response_handlers/__init__.py | Python | mit | 305 |
# start --- config.ini ---
# --*-- python --*--
enemy = "Dr. No"
salary = 100
def tax(salary):
return salary * 0.2
bond = employee(id = "007", salary=salary * 2, tax=tax(salary * 2))
# end --- config.ini ---
# start --- readconf.py ---
class employee:
def __init__(self, id, salary, tax):
self.id = ... | ActiveState/code | recipes/Python/231516_Using/recipe-231516.py | Python | mit | 802 |
from rig.place_and_route import Cores, SDRAM
import struct
from nengo_spinnaker.builder.ports import InputPort
from nengo_spinnaker.builder.netlist import netlistspec
from nengo_spinnaker.netlist import Vertex
from nengo_spinnaker.regions import Region
from nengo_spinnaker.regions.filters import make_filter_regions
fr... | project-rig/nengo_spinnaker | nengo_spinnaker/operators/sdp_transmitter.py | Python | mit | 3,555 |
from scipy.spatial.distance import cdist
import numpy as np
class KNNC1(object):
def fit(self, X, Y):
self.X = X
self.Y = Y
def predict(self, Z):
dists = cdist(self.X, Z, 'correlation')
indices = dists.argmin(axis = 0)
return self.Y[indices]
def predict_proba(self, Z):
predictions = self.predi... | maat25/brain-decoding | classifier/knn-correlation.py | Python | mit | 427 |
"""General utilities."""
import scipy.constants as sc
# Useful equations -----------------------------------------------------------
def get_beam_radius(z, w0, wavelength):
"""Get beam radius (w).
Requires distance (z) and beam waist (w0).
Note
----
All parameters should be defined in the sam... | garrettj403/GaussOpt | gaussopt/util.py | Python | mit | 3,966 |
from fastapi import FastAPI
from fastapi.responses import RedirectResponse
app = FastAPI()
@app.get("/typer")
async def redirect_typer():
return RedirectResponse("https://typer.tiangolo.com")
| tiangolo/fastapi | docs_src/custom_response/tutorial006.py | Python | mit | 199 |
from .constants import *
from ._xlcall import * | thatcr/cffi-xll | src/xlcall/templates/__init__.py | Python | mit | 47 |
from __future__ import unicode_literals, print_function
from django.urls import reverse
from rest_framework import status
from mezzanine.blog.models import BlogPost as Post
from tests.utils import TestCase
class TestPostViewSet(TestCase):
"""
Test the API resources for blog posts (read and write)
"""
... | gcushen/mezzanine-api | tests/test_post.py | Python | mit | 10,996 |
# -*- coding: utf-8 -*-
# Scrapy settings for ChineseCharCrawler project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.or... | jwecode/JWE | ChineseCharCrawler/ChineseCharCrawler/settings.py | Python | mit | 3,255 |
import os, sys, shutil
# change back to the build dir
if os.path.dirname( sys.argv[0] ) != "":
os.chdir( os.path.dirname( sys.argv[0] ) )
# find setuptools
scramble_lib = os.path.join( "..", "..", "..", "lib" )
sys.path.append( scramble_lib )
import get_platform # fixes fat python 2.5
from ez_setup import use_set... | volpino/Yeps-EURAC | scripts/scramble/scripts/generic.py | Python | mit | 1,149 |
from ackward import (Class,
InlineFunction,
Namespace,
Property,
TranslationUnit)
from_hex1='''
static UUID fromHex(const std::string& hex) {
try {
boost::python::object obj = UUID::cls()(hex);
return UUID(obj);
... | abingham/ackward | src/ackward/uuid/UUID.py | Python | mit | 7,755 |
from flask.ext.assets import Bundle
from . import wa
js_libs = Bundle('js/libs/jquery.min.js',
'js/libs/bootstrap.min.js',
'js/libs/lodash.min.js',
#filters='jsmin',
output='js/libs.js')
js_board = Bundle('js/libs/drawingboard.min.js',
... | luizdepra/sketch_n_hit | app/assets.py | Python | mit | 984 |
"""Create `voluntary_work_type` table
Revision ID: 597b5983e01c
Revises: 2e20f23a8ffd
Create Date: 2014-02-08 17:14:35.812815
"""
# revision identifiers, used by Alembic.
revision = '597b5983e01c'
down_revision = '2e20f23a8ffd'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table(
... | talkoopaiva/talkoohakemisto-api | talkoohakemisto/migrations/versions/597b5983e01c_create_voluntary_work_type_table.py | Python | mit | 546 |
"""Potential parameters for the Gupta potential."""
# Parameter sequence: [p, q, a, xi, r0]
PtY_parameters = {
'Pt': [10.710, 3.845, 0.27443, 2.6209, 2.77],
'Y': [8.95904, 2.01713, 0.14155, 1.60294, 3.65],
('Y','Pt'): [9.45600, 3.20800, 0.18908, 2.62700, 3.21],
}
| auag92/n2dm | Asap-3.8.4/Python/asap3/GuptaParameters.py | Python | mit | 278 |
import unittest
import os
from stampman.services import pool, sendgrid, mailgun
from stampman.helpers import config_, mail_
class PoolServiceTest(unittest.TestCase):
def test_creation(self):
pool.PooledService()
class TestSendgridEmailService(unittest.TestCase):
def setUp(self):
self._confi... | thunderboltsid/stampman | stampman/tests/test_services.py | Python | mit | 1,776 |
import psycopg2
import psycopg2.extras
# This is a wrapper around psycopg2 (python-postgreSQL)
class pyToPostgres:
_db_conn = None
_db_curs = None
def __init__(self,credentials):
# Credentials is a dict of access paramaters
# (dbname, user, host, password)
self.credenti... | chrischaplin/IngesTune | src/srcPostgres/db_classes.py | Python | mit | 6,970 |
import os, sys
import config
def notify_user(msg):
sys.stderr.write(msg+'\n')
raw_input('Press enter to exit ')
sys.exit(1)
def run_cmd(cmd):
if os.system(cmd) != 0:
notify_user('Command "%s" failed!'%cmd)
def run_cmds(*cmds):
for cmd in cmds:
run_cmd(cmd)
if config.current != config.pro... | JustinTulloss/harmonize.fm | uploader/publish_win.py | Python | mit | 800 |
import time
import picamera
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN)
GPIO.setup(18, GPIO.OUT)
GPIO.output(18, False)
while True:
if(GPIO.input(23) == 1):
print "motion"
GPIO.output(18, True)
with picamera.PiCamera() as camera:
# Turn the camera's ... | jmbott/test-repo | motion_cam.py | Python | mit | 1,069 |
# 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/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/__init__.py | Python | mit | 28,223 |
#@PydevCodeAnalysisIgnore
########################################################################
# This module is a direct copy of the current
# django.conf.project_template.settings
# Compare when the Django is upgraded. Make your project settings
# changes in settings modules that are importing this one.
#########... | tuttle/django-new-project-template | src/myproject/myproject/conf/base_settings.py | Python | mit | 5,761 |