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 |
|---|---|---|---|---|---|
import RPi.GPIO as GPIO
import time
import utils
GPIO.setmode(GPIO.BOARD)
pwr = utils.PSU(13, 15)
pwr.on()
print "Power on"
fan = utils.Fan(32)
fan.setDC(90)
print "Fan set at 90%"
pump = utils.NMOS(11)
pump.on()
print "Pump on"
relay = utils.NMOS(16)
relay.on()
print "Peltier on"
t_amb = utils.Therm('28-000004... | Wollert/beer | test_run.py | Python | mit | 1,166 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns(
'',
# Examples:
# url(r'^$', 'chatter.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'', include('chatter.base.urls')),
url(r'^admin/', include(admin.site.urls)... | scott-w/pyne-django-tutorial | chatter/chatter/urls.py | Python | mit | 1,113 |
from tkinter import *
from PIL import Image, ImageTk
from mandelbrot import *
from julia_set import *
class App(object):
def __init__(self, master):
# CANVAS
self.ulx, self.uly, self.drx, self.dry, self.def_width = default_settings()[
:5]
self.image = ImageTk.PhotoImage(make_f... | KrozekGimVic/2013-Fraktali | main.py | Python | mit | 2,613 |
import unittest
import tests
import tests.test_logic
import tests.test_graph
import tests.test_output
| sambayless/monosat | src/monosat/api/python/tests/__init__.py | Python | mit | 102 |
# Create your views here.
from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404
from django.contrib.auth.models import User
from repository.models import PisiPackage
def show_user (request, name=None):
user = get_object_or_404 (User, username=name)
context = { 'user' : user }
... | SolusOS-discontinued/RepoHub | profiles/views.py | Python | mit | 785 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('photoplaces_web', '0003_photocluster_normalized_centers_dirty'),
]
operations = [
migrations.AddField(
model_nam... | joonamo/photoplaces | photoplaces/photoplaces_web/migrations/0004_auto_20141105_1236.py | Python | mit | 984 |
from app import app, grabber, merge, segment
from flask import render_template, request, url_for, jsonify
import cv2
import numpy as np
import os, re
def rm(dir, pattern):
for f in os.listdir(dir):
if re.search(pattern, f):
os.remove(os.path.join(dir, f))
@app.route('/')
@app.route('/index')
d... | ncmatson/OSTE | app/views.py | Python | mit | 2,380 |
import logging
from vcftoolbox import Genotype
from puzzle.models import Genotype as puzzle_genotype
logger = logging.getLogger(__name__)
class GenotypeExtras(object):
"""Class to store methods that deals with genotyping"""
def _add_genotype_calls(self, variant_obj, variant_line, case_obj):
"""Add ... | robinandeer/puzzle | puzzle/plugins/vcf/mixins/variant_extras/genotype.py | Python | mit | 1,708 |
from app.models import EMAIL_TYPES
from app.schema_validation.definitions import uuid, datetime, date
def email_types():
pattern = '|'.join(EMAIL_TYPES)
return {
"type": "string",
"pattern": pattern,
"validationMessage": "is not an email type",
}
post_create_email_schema = {
... | NewAcropolis/api | app/routes/emails/schemas.py | Python | mit | 3,656 |
#!/usr/bin/env python
import dataproc
import itertools
import numpy as np
import random
import time
import sys
import tensorflow as tf
from collections import defaultdict
from ltrdnn import LTRDNN
flags = tf.flags
FLAGS = flags.FLAGS
# model related:
flags.DEFINE_integer('vocab_size', 1532783, 'vocabulary size')
fla... | kn45/LTR-DNN | train.py | Python | mit | 6,330 |
def transform(old):
return {value.lower(): score for score, values in
old.items() for value in values}
| rootulp/exercism | python/etl/etl.py | Python | mit | 119 |
from flask import Flask, request, redirect, session
import twilio.twiml
import navigation
SECRET_KEY = 'donuts'
logging = True
app = Flask(__name__)
app.config.from_object(__name__)
def log(mesagge=""):
if logging:
print mesagge
@app.route("/", methods=['GET', 'POST'])
def main_reply():
# Log value... | stefanp312/chat-bot | run.py | Python | mit | 1,264 |
import pytest
@pytest.mark.parametrize("name", [
("apt-file"),
("apt-transport-https"),
("arandr"),
("atom"),
("blktrace"),
("ca-certificates"),
("chromium-browser"),
("cowsay"),
("cron"),
("curl"),
("deluge"),
("diod"),
("docker-ce"),
("dropbox"),
("fonts-font-awesome"),
("git"),
("g... | wicksy/laptop-build | test/test_packages.py | Python | mit | 1,214 |
#coding=utf8
import thread, time, sys, os, platform
try:
import termios, tty
termios.tcgetattr, termios.tcsetattr
import threading
OS = 'Linux'
except (ImportError, AttributeError):
try:
import msvcrt
OS = 'Windows'
except ImportError:
raise Exception('Mac i... | littlecodersh/EasierLife | Plugins/ChatLikeCMD/ChatLikeCMD.py | Python | mit | 7,974 |
class SquareFreeString:
def isSquareFree(self, s):
for i in range(0, len(s)):
for length in range(1, len(s)):
first = s[i:length + i]
second = s[i+length:i+length+length]
if second == first:
return "not square-free"
r... | mikefeneley/topcoder | src/SRM-701/square_free_string.py | Python | mit | 340 |
import vtk
import math
def get_screenshot(renWin, filename):
renWin.Render()
w2if = vtk.vtkWindowToImageFilter()
w2if.SetInput(renWin)
w2if.Update()
writer = vtk.vtkPNGWriter()
writer.SetFileName(filename)
writer.SetInput(w2if.GetOutput())
writer.Write()
renWin.Render()
##########... | DaisukeMiyamoto/visualize_silkmothbrain | draw_mothbrain.py | Python | mit | 7,186 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | AutorestCI/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_group_view_result.py | Python | mit | 1,116 |
import networkx as nx
from networkx.algorithms import bipartite
class User():
def __init__(self,userId):
self.userId=userId
def __key(self):
return (self.userId)
def __eq__(self,x, y):
return x.__key() == y.__key()
def __hash__(self):
return hash(sel... | sheetal158/Opinion_Spam_Detection | bipartiteGraph.py | Python | mit | 632 |
import _plotly_utils.basevalidators
class ArrayminussrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="arrayminussrc", parent_name="bar.error_x", **kwargs
):
super(ArrayminussrcValidator, self).__init__(
plotly_name=plotly_name,
pa... | plotly/plotly.py | packages/python/plotly/plotly/validators/bar/error_x/_arrayminussrc.py | Python | mit | 429 |
from django import template
from .. import forms
register = template.Library()
@register.filter
def dyn_form(forms, pk):
return forms[pk]
| ainterr/scoring_engine | engine/templatetags/dyn_form.py | Python | mit | 144 |
from django.contrib import admin
from django.contrib.admin.filters import RelatedFieldListFilter
from .models import ClientLog, Client, Feedback
def client_id(obj):
return obj.client.externid
class AliveClientsRelatedFieldListFilter(RelatedFieldListFilter):
def __init__(self, field, request, *args, **kwargs):... | ddalex/p9 | sign/admin.py | Python | mit | 1,555 |
# coding=utf-8
""" Module holding tools for ee.ImageCollections """
import ee
import ee.data
import pandas as pd
import math
from . import date, ee_list
from . import image as image_module
from . import collection as eecollection
from ..utils import castImage
from .. import composite
def add(collection, image):
"... | gee-community/gee_tools | geetools/tools/imagecollection.py | Python | mit | 39,458 |
# -*- coding: utf-8 -*-
"""
Tests for the backported class:`str` class.
"""
from __future__ import absolute_import, unicode_literals, print_function
from future.builtins import *
from future import utils
from future.tests.base import unittest, expectedFailurePY2
import os
TEST_UNICODE_STR = u'ℝεα∂@ßʟ℮ ☂ℯṧт υηḯ¢☺ḓ℮'
... | PythonCharmers/python-future | tests/test_future/test_str.py | Python | mit | 19,879 |
import re
from PyQt4.QtGui import QSyntaxHighlighter, QColor, QFont, QTextCharFormat
from PyQt4.QtCore import Qt
from .mdx_strkundr import DEL_RE, INS_RE, STRONG_RE, EMPH_RE
class MikiHighlighter(QSyntaxHighlighter):
WORDS = r'(?iu)[\w\']+'
def __init__(self, parent=None):
super(MikiHighlighter, se... | ckolumbus/mikidown | mikidown/highlighter.py | Python | mit | 4,883 |
#!/usr/bin/env python
import socket
TCP_IP = '127.0.0.1'
TCP_PORT = 5005
BUFFER_SIZE = 20 # Normally 1024, but we want fast response
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((TCP_IP, TCP_PORT))
s.listen(1)
conn, addr = s.accept()
print 'Connection address:', addr
while 1:
data = conn.recv(... | sean666888/The-Bomb | s.py | Python | mit | 430 |
from django.test import TestCase
from httmock import HTTMock
from jenkinsapi.jenkins import Jenkins
from jenkins.models import Build, JobType
from .helpers import mock_url
from .factories import BuildFactory, JenkinsServerFactory
class JenkinsServerTest(TestCase):
def test_get_client(self):
"""
... | timrchavez/capomastro | jenkins/tests/test_models.py | Python | mit | 1,239 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Font(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scatterternary.hoverlabel"
_path_str = "scatterternary.hoverlabel.font"
_valid_props = {"color... | plotly/python-api | packages/python/plotly/plotly/graph_objs/scatterternary/hoverlabel/_font.py | Python | mit | 11,245 |
# -*- coding: utf-8 -*-
""" Sahana Eden Document Library
@copyright: 2011-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 Software wi... | anubhav929/eden | modules/eden/doc.py | Python | mit | 14,543 |
from tornado import websocket, web, ioloop, autoreload
import json
import sys
new_msg=''
old_msg=''
def send_response():
print 'msg'
if new_msg<>old_msg:
print new_msg
class SocketHandler(websocket.WebSocketHandler):
''' websocket handler '''
def open(self):
''' ran once an open ws co... | mehmoodz/Influenzr | publishers/resources/simple_ws.py | Python | mit | 818 |
from Direction import Direction
class Position:
def __init__(self, direction=Direction.north):
self.x_coord = 0
self.y_coord = 0
self.direction = direction
def turn(self, turn):
self.direction = self.direction.turn(turn)
def walk_forward(self, steps):
self.x_coord... | tmct/adventOfCode2016 | problems/1/Position.py | Python | mit | 514 |
'''
Created on Aug 21, 2014
@author: Dean4Devil
'''
import mysql.connector
from pycore.sql_util import MySQLHelper
class SubmitTree():
'A tree of all submits to that standard. I.e. OpenDriver is a tree, OpenDriver 0.2 is a submit.'
def __init__(self, identifier):
'Create a new Tree in memory.'
... | OpenEngeneeringTaskForce/OETFDev | pycore/submit_util.py | Python | mit | 1,401 |
import matplotlib
import matplotlib.pyplot as plt
decisionNoe = dict(boxstyle="sawtooth", fc="0.8")
leafNode = dict(boxstyle="round4", fc="0.8")
arrow_args = dict(arrowstyle="<-")
def plotNoe(nodeTxt, centerPt, parentPt, nodeType):
createPlot.ax1.annotate(nodeTxt, xy=parentPt, xycoords='axes fraction',
... | qiyuangong/Machine_Learning_in_Action_QYG | 03_ID3/treePlotter.py | Python | mit | 3,229 |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:9332")
else:
access = Ser... | unitecoin-org/Unitecoin | contrib/bitrpc/bitrpc.py | Python | mit | 7,840 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
This module will define useful objects for conditional analysis
"""
import collections
import numpy as np
import pandas as pd
from tunacell.base.datatools import Coordinates
# define an object to handle heterogeneous types of time series
class TimeSeries(object):
... | LeBarbouze/tunacell | tunacell/base/timeseries.py | Python | mit | 8,945 |
import _plotly_utils.basevalidators
class TemplateitemnameValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="templateitemname",
parent_name="histogram2d.colorbar.tickformatstop",
**kwargs
):
super(TemplateitemnameValidator, self)._... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram2d/colorbar/tickformatstop/_templateitemname.py | Python | mit | 494 |
# -*- coding: utf-8 -*-
import typing as t
from PyQt5.QtCore import (
Qt,
QObject,
QSortFilterProxyModel,
QAbstractTableModel,
QModelIndex,
QVariant,
)
from . import utils
from . import settings
COLUMN_DATE = 0
COLUMN_DURATION = 1
class RecordsSortProxyModel(QSortFilterProxyModel):
d... | espdev/VoiceRecorder | voicerecorder/recordsmodel.py | Python | mit | 2,817 |
class CSharpReference():
def __init__(self,):
self.reference_object = None
self.line_in_file = -1
self.file_name = ''
| adrianogil/SublimeUnityIntel | unityparser/csharp/csharp_reference.py | Python | mit | 147 |
intervals = [[10,20],[6,15],[0,22]]
print(sorted(intervals)) | jackchi/interview-prep | leetcode/meeting_rooms.py | Python | mit | 61 |
from conans import ConanFile, AutoToolsBuildEnvironment, tools
import os
class LibHaruConn(ConanFile):
name = "libharu"
version = "2.3.0"
license = "ZLIB https://github.com/libharu/libharu/blob/master/LICENCE"
url = "https://github.com/trigger-happy/conan-packages"
description = "C library for gene... | trigger-happy/conan-packages | libharu/conanfile.py | Python | mit | 1,457 |
import sublime
import sublime_plugin
OPTIONS_LAST_REGEX = "jump_caret_last_regex"
class CaretJumpCommand(sublime_plugin.TextCommand):
def run(self, edit, jump=True, jump_to=None, repeat_previous_jump=False):
view = self.view
def get_next_sels(user_input):
new_sels = []
fo... | r-stein/sublime-text-caret-jump | caret_jump.py | Python | mit | 2,134 |
import argparse
import glob
import re
import cPickle as pickle
from dicom.sequence import Sequence
from log import print_to_file
from paths import LOGS_PATH, TRAIN_DATA_PATH, TEST_DATA_PATH
def read_slice(path):
return pickle.load(open(path))['data']
def convert_to_number(value):
value = str(value)
tr... | 317070/kaggle-heart | generate_metadata_pkl.py | Python | mit | 2,940 |
#!/usr/bin/env python
'''
Based on:
Gilson, Matthieu, Tomoki Fukai, and Anthony N. Burkitt.
Spectral Analysis of Input Spike Trains by Spike-Timing-Dependent Plasticity.
PLoS Comput Biol 8, no. 7 (July 5, 2012): e1002584. doi:10.1371/journal.pcbi.1002584.
Author: Aditya Gilra, Jun 2016. (with inputs from Matthieu Gils... | h-mayorquin/camp_india_2016 | tutorials/LTPinnetworks2/Step2aCorr_Gilson_etal_2012.py | Python | mit | 8,226 |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2017
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... | rogerscristo/BotFWD | env/lib/python3.6/site-packages/pytests/test_inlinequeryresultgame.py | Python | mit | 3,198 |
#!/usr/bin/env python
"""
This module has a function that matches django fields to the corresponding
random value generator.
"""
from django.db.models.fields import BigIntegerField
from django.db.models.fields import BinaryField
from django.db.models.fields import BooleanField
from django.db.models.fields import CharFi... | aelguindy/djenerator | djenerator/fields_generator.py | Python | mit | 5,111 |
"""This module provides an interface to the program Reduce.
Requires the reduce executable and reduce_wwPDB_het_dict.txt located
in a directory specified in global_settings. These can be downloaded
from: http://kinemage.biochem.duke.edu/software/reduce.php
For more information on Reduce, see [1].
References
--------... | woolfson-group/isambard | isambard/external_programs/reduce.py | Python | mit | 7,041 |
from zope import component
from zope import interface
from zope.interface.interfaces import IObjectEvent
from zope import location
from sparc.configuration.container import ISparcPyContainerConfiguredApplication
#EVENTS
class ISnippetAvailableForSecretsSniffEvent(IObjectEvent):
"""An object providing ISnippet is r... | CrowdStrike/mellon | mellon/interfaces.py | Python | mit | 4,243 |
#!/usr/bin/env python
"""PyQt4 port of the layouts/flowlayout example from Qt v4.x"""
from PyQt4 import QtCore, QtGui
# ------------------------------------------------------------------------
class FlowLayout(QtGui.QLayout):
"""
Standard PyQt examples FlowLayout modified to work with a scollable parent
"""
d... | tommo/gii | lib/gii/qt/controls/FlowLayout.py | Python | mit | 5,065 |
##########################################################################
#
# Copyright 2011 Jose Fonseca
# Copyright 2008-2009 VMware, Inc.
# All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to... | PeterLValve/apitrace | specs/d3d9types.py | Python | mit | 30,033 |
"""
Implementation of model
"""
import numpy as np
import numpy.random as npr
from scipy import ndimage
from configuration import get_config
config = get_config()
class LatticeState(object):
""" Treat 1D list as 2D lattice and handle coupled system
This helps with simply passing this object to scipy's... | kpj/PyWave | model.py | Python | mit | 5,052 |
from flask import render_template, flash, redirect, url_for, request
from flask_login import login_required, current_user
from ..models import User, Sensors, Sensor_data
from . import chart
from pytz import timezone
# import pygal
from pyecharts import Line
import os
from ..main.forms import SelectMultipleSensorForm
t... | Harold2017/myfirstflasky | app/chart/views.py | Python | mit | 2,433 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# main.py file is part of spman
#
# spman - Slackware package manager
# Home page: https://github.com/MyRequiem/spman
#
# Copyright (c) 2018 Vladimir MyRequiem Astrakhan, Russia
# <mrvladislavovich@gmail.com>
# All rights reserved
# See LICENSE for details.
"""
main.py... | MyRequiem/spman | src/main.py | Python | mit | 12,016 |
from django.conf import settings
def _get_backend():
return getattr(settings, 'SESSIONPROFILE_BACKEND', 'sessionprofile.backends.db')
| modelbrouwers/django-sessionprofile | sessionprofile/settings.py | Python | mit | 140 |
#!/usr/bin/env python
import os
from setuptools import find_packages, setup
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.rst'), encoding='utf-8') as fp:
README = fp.read()
with open(os.path.join(here, 'VERSION')) as version_file:
VERSION = version_file.read().strip(... | danhuss/faker | setup.py | Python | mit | 2,500 |
import os
import tarfile
from contextlib import closing
from archie import helpers
def find_backup(cfg):
files = []
rcfiles = cfg.options('rcfiles')
for rc in rcfiles:
backup = helpers.get_backupfile(cfg, rc)
rcfile = helpers.get_rcfile(cfg, rc)
if os.path.lexists(backup) and tarfil... | fudanchii/archie | archie/handlers/restore.py | Python | mit | 753 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'slice_visualization.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_slice_visualization_gui(object):
def setupUi(self, slice_v... | johanesmikhael/ContinuityAnalysis | slice_visualization_ui.py | Python | mit | 1,409 |
from csacompendium.research.models import ExperimentUnit
from csacompendium.utils.pagination import APILimitOffsetPagination
from csacompendium.utils.permissions import IsOwnerOrReadOnly
from csacompendium.utils.viewsutils import DetailViewUpdateDelete, CreateAPIViewHook
from rest_framework.filters import DjangoFilter... | nkoech/csacompendium | csacompendium/research/api/experimentunit/experimentunitviews.py | Python | mit | 2,054 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'menu.views.home', name='home'),
url(r'^hall/(?P<slug>[-\w]+)/$', 'menu.views.halldetail', name='halldetail'),
url(r'^admin/', include(admin.site.urls)),
)
| JOUR491-NewsApplications/JOUR491-FoodOnCampus | food/food/urls.py | Python | mit | 314 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
from datetime import timedelta, date
import glob
import os
import sys
import pyinotify
from evernote.edam.error.ttypes import EDAMUserException
from tomboy2evernote.tomboy2evernote import Evernote, convert_tomboy_to_evernote
__author__ = 'Denis Kovalev... | aikikode/tomboy2evernote | tomboy2evernote/command_line.py | Python | mit | 5,742 |
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2014-2018 Shi Chi(Mack Stone)
#
# 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 limit... | mackst/glm | glm/detail/func_geometric.py | Python | mit | 3,822 |
__author__ = 'jmoran'
from Asteroids import Object
class MovingObject(Object):
def __init__(self, window, game, init_point, slope):
Object.__init__(self, window, game)
self.point = init_point
self.slope = slope
| waddedMeat/asteroids-ish | Asteroids/MovingObject.py | Python | mit | 242 |
# -*- coding: utf-8 -*-
import config
from metodos import *
from mensagens import myid
def my_id(msg):
chat_id = msg['chat']['id']
try: user = '@' + msg['from']['username']
except:user = " "
if msg['text'] == '/id':
if msg['chat']['type'] == 'private':
sendMessage(chat_id, myid['p... | francis-taylor/Timotty-Master | cybot/plug/myid.py | Python | mit | 625 |
import sys
from pymongo import MongoClient
# Connecting to the mongo client
client = MongoClient('localhost',27017)
# Connecting to the database
db = client['rescueHomeless']
# Connecting to the required collection
collection = db['userDB']
userEmail = sys.argv[1]
result = collection.find({'email':userEmail})
pIDs =... | Four-Stooges/Server | public/resources/scripts/latestupload.py | Python | mit | 392 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo GmbH
#
# 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 with... | RyanHope/AutobahnPython | examples/twisted/wamp/rpc/arguments/frontend.py | Python | mit | 3,404 |
import _plotly_utils.basevalidators
class BgcolorsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="bgcolorsrc", parent_name="histogram.marker.pattern", **kwargs
):
super(BgcolorsrcValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram/marker/pattern/_bgcolorsrc.py | Python | mit | 433 |
from trie import Trie
#constructs a tree of this shape ('*' means root)
#
# *
# /|\
# a i o
# / /|\
# n f n u
# | |\
# e r t
#
#The LOUDS bit-string is then
#[1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0]
words = ['an', 'i', 'of', 'one', 'our', 'out']
test_set =... | IshitaTakeshi/Louds-Trie | python/test.py | Python | mit | 1,193 |
from collections import OrderedDict
def main():
net_prices = OrderedDict()
for _ in range(int(input())):
item, price = input().rsplit(maxsplit=1)
net_prices[item] = net_prices.get(item, 0) + int(price)
for item in net_prices:
print(item, net_prices[item])
if __name__ == '... | FireClaw/HackerRank | Python/py-collections-ordereddict.py | Python | mit | 342 |
import re
from blaze import resource, DataFrame
import pandas as pd
from snakemakelib.odo.pandas import annotate_by_uri
@resource.register('.+fastq.summary')
@annotate_by_uri
def resource_fastqc_summary(uri, **kwargs):
with open(uri):
data = pd.read_csv(uri, sep=",", index_col=["fileName"])
return Dat... | Oliver-Lab/snakemakelib-oliver | snakemakelib_oliver/odo/geo.py | Python | mit | 333 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from collections import namedtuple
from botocore.vendored.requests.exceptions import ReadTimeout
from py_swf.errors import NoTaskFound
__all__ = ['DecisionClient', 'DecisionTask']
DecisionTask = namedtuple('Dec... | quantsini/pyswf | py_swf/clients/decision.py | Python | mit | 9,074 |
from csp import *
from collections import Counter
class WordSquare:
"""
Find a word square of the given size from the given dictionary.
"""
alphabet = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
def __init__(self, wordsfile):
"""
Constructor.
Arguments:
wordsfile -- the ... | jharris119/ConstraintSatisfactionProblem | examples/wordsquare.py | Python | mit | 6,259 |
"""simpleplantms 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')
Cla... | dylan-reeves/Simple-Plant-MS | simpleplantms/urls.py | Python | mit | 1,905 |
#!/usr/bin/env python
import subprocess, random, sys, os
def randomrange():
try:
value1 = int(sys.argv[1])
value2 = int(sys.argv[2])
randvalue = random.randint(value1, value2)
return randvalue
except IndexError:
randvalue = random.randint(0,10000000)
return randvalue
def main():
value = randomran... | defunSM/code | pyth/randomword.py | Python | mit | 348 |
"""
The MIT License (MIT)
Copyright (c) 2014 Chris Wimbrow
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... | cwimbrow/veganeyes-api | app/api_1_0/errors.py | Python | mit | 1,089 |
import json
from mockito import *
import os
import shutil
import tempfile
import unittest
from ice.history import ManagedROMArchive
class ManagedROMArchiveTests(unittest.TestCase):
def setUp(self):
self.tempdir = tempfile.mkdtemp()
self.temppath = os.path.join(self.tempdir, "tempfile")
self.mock_user =... | scottrice/Ice | tests/managed_rom_archive_tests.py | Python | mit | 2,688 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sufwebapp1.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| sufhani/suf-webapp | manage.py | Python | mit | 253 |
# -*- coding: utf-8 -*-
import os
import codecs
import random
# this is the path of the folder that will contain the tweet files
tweets_folder = os.path.join("D:", os.sep, "Documents", "PycharmProjects",
"easy_group_classifier", "text_files")
# checks if previous path exists, ... | jluukvg/text-classifier | python/randomize_tweet_order.py | Python | mit | 957 |
from oplogreplayer import OplogReplayer | uberVU/mongo-oplogreplay | oplogreplay/__init__.py | Python | mit | 39 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# PySCUBA/src/PySCUBA/PySCUBA_design.py
# Author: Gregory Giecold for the GC Yuan Lab
# Affiliation: Harvard University
# Contact: g.giecold@gmail.com; ggiecold@jimmy.harvard.edu
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Att... | GGiecold/PySCUBA | src/PySCUBA/PySCUBA_design.py | Python | mit | 15,073 |
import numpy as np
import pandas as pd
from lazy_property import LazyProperty
from . import _describe_template
from .plot import Plotter
from .. import bin_counts
from .. import numeric_datatypes, _pretty_print
from ..util import seaborn_required
class Column(object):
"""
In Pandas, a column of a DataFrame i... | jackmaney/pg-utils | pg_utils/column/base.py | Python | mit | 10,187 |
from inventory import Inventory
import cmd
from room import get_room
from player import Player
import textwrap
import time
import random
class Controls(cmd.Cmd):
prompt = '> '
def __init__(self):
#-----------------------------------------------------------------------
#Here the game is initialized asking for... | kevin2314/TextGame | game/main.py | Python | mit | 4,805 |
# Copyright (c) 2020 Bartosz Szczesny <bszcz@bszcz.org>
# This program is free software under the MIT license.
print('\n# avoid new line at the beginning')
s = """\
test
"""
print(s)
print('\n# string are immutable')
s = 'string'
try:
s[1] = 'p'
except TypeError as e:
print(e)
print('\n# enumerate() functi... | bszcz/python | tutorial_notes.py | Python | mit | 4,575 |
#!/usr/bin/env python
from coveragit.application.console import Application
if __name__ == "__main__":
Application().run()
| felixcarmona/coveragit | run.py | Python | mit | 128 |
#from StreamReader import *
import numpy
import cv2
class ObjectDetecor :
#stream = None
#def __init__(self, stream) :
#self.stream = stream
minRadius = 15;
minContourArea = 500;
def findObjects(self, frame, npLower, npUpper) :
#convert image and colors to HSV
#hsvFrame = ... | linduine/RobotVYE | Test/PyQtTest/ObjectsDetector.py | Python | mit | 1,964 |
import unittest, tempfile, os.path
from gitdh.config import Config
from gitdh.git import Git
from subprocess import check_output
class GitdhConfigGitTestCase(unittest.TestCase):
def setUp(self):
self.cStr = """
[Git]
RepositoryPath = /var/lib/gitolite/repositories/test.git
[Database]
Engine = sqlite
DatabaseFile ... | seoester/Git-Deployment-Handler | gitdh/tests/configgit.py | Python | mit | 2,693 |
# coding=utf-8
"""
https://docs.python.org/3/howto/logging.html
https://fangpenlin.com/posts/2012/08/26/good-logging-practice-in-python/
"""
import logging
import logging.config
from logging import Formatter
import pathlib
import yaml
import time
from common.settings import AlgoSettings
def setup_logging(default_lev... | JavierGarciaD/AlgoTrader | algotrader/log/log_settings.py | Python | mit | 2,265 |
class Friend:
def walk(self,shravan=""):
'''
>>> Friend().walk()
walking
'''
print "walking",
def talk(self):
print "talking",
def fight(self):
print "fighting",
f1=Friend()
f1.walk()
import doctest
doctest.testmod() | shravanshandilya/catching-up-with-python | Recipes/class_example.py | Python | mit | 245 |
'''
The MIT License (MIT)
Copyright (c) 2016 Vasileios Kagklis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, m... | kagklis/profile-analysis | profile_analysis.py | Python | mit | 16,905 |
"""Module for displaying Terrain, both in 2D and 3D.
(Not accessible outside of package; use display methods of Terrain instead.)
"""
from Tkinter import Tk, Canvas, Frame, BOTH
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
class Terrain2D(Frame):
"""2D graphical re... | jackromo/RandTerrainPy | randterrainpy/terraindisplay.py | Python | mit | 3,444 |
from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
import profiles.urls
import accounts.urls
from . import views
urlpatterns = [
url(r'^$', views.HomePage.as_view(), name='home'),
url(r'^about/$', views.AboutPag... | triump0870/movie_task | src/mdb/urls.py | Python | mit | 812 |
"""Test diff."""
# --- import -------------------------------------------------------------------------------------
import numpy as np
import WrightTools as wt
# --- test ---------------------------------------------------------------------------------------
def test_ascending_1():
x = np.linspace(0, 10, 1... | wright-group/WrightTools | tests/kit/diff.py | Python | mit | 1,245 |
import numpy as np
from apvisitproc import despike
import pytest
import os
DATAPATH = os.path.dirname(__file__)
FILELIST1 = os.path.join(DATAPATH, 'list_of_txt_spectra.txt')
FILELIST2 = os.path.join(DATAPATH, 'list_of_fits_spectra.txt')
@pytest.fixture
def wave_spec_generate():
'''
Read in three small chunks... | mrawls/apVisitproc | apvisitproc/tests/test_despike.py | Python | mit | 2,736 |
# 1395. Count Number of Teams - LeetCode
# https://leetcode.com/problems/count-number-of-teams/
from typing import List
# 暴力搜索都 AC 了
# 其实有两次筛选的算法
class Solution:
def numTeams(self, rating: List[int]) -> int:
if len(rating) <= 2:
return 0
count = 0
for i in range(len(rating)):
... | heyf/cloaked-octo-adventure | leetcode/1395_count-number-of-teams.py | Python | mit | 775 |
# -*- coding: utf-8 -*-
import numpy as np
from pandas import read_csv as importDB
import pandas as pd
database = r'\\UBSPROD.MSAD.UBS.NET\UserData\ozsanos\RF\Desktop\Black\stockData.csv'
tickers = ['AAPL','ADBE','ADI','AMD','AXP','BRCM','C','GLD','GOOG','GS','HNZ','HPQ','IBM','MSFT','TXN','XOM']
dateRange = ... | BoasWhip/Black | Code/marketData.py | Python | mit | 5,694 |
from testkit.context import *
def test_context_user():
from contextlib import contextmanager
test_dict = dict(value='before')
@contextmanager
def test_context(test_dict):
test_dict['value'] = 'during'
yield 'test'
test_dict['value'] = 'after'
ctx = ContextUser(test_context... | ravenac95/testkit | tests/test_context.py | Python | mit | 2,056 |
from heapq import *
from typing import List
class Solution:
def findMaximizedCapital(self, k: int, wealth: int, profits: List[int], capitals: List[int]) -> int:
minCapitalHeap, maxProfitHeap = [], []
for i in range(len(capitals)):
heappush(minCapitalHeap, (capitals[i], profits[i]))
... | shobhitmishra/CodingProblems | LeetCode/Session3/ipo.py | Python | mit | 880 |
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'DESCRIPTION.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='jestocke-mangopaysdk',
version='3.0.6',
description='A clie... | chocopoche/mangopay2-python-sdk | setup.py | Python | mit | 1,575 |
from typing import Optional
from thinc.api import Model
from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS
from .stop_words import STOP_WORDS
from .lex_attrs import LEX_ATTRS
from .lemmatizer import UkrainianLemmatizer
from ...language import Language
class UkrainianDefaults(Language.Defaults):
tokenizer_ex... | spacy-io/spaCy | spacy/lang/uk/__init__.py | Python | mit | 903 |
from nose.tools import *
from tictactoe.ai_strategies.easy import Easy
from tictactoe.game_board import GameBoard
def easy_strategy_makes_any_opening_move_test():
ai = Easy("X", "O")
board = GameBoard()
move = ai.make_move(board)
assert_equal(True, move in list(range(0, 9)))
def easy_strategy_makes_mo... | rickerbh/tictactoe_py | tests/ai_easy_strategy_tests.py | Python | mit | 670 |
"""Largest product in a grid
In the 20×20 grid below, four numbers along a diagonal line have been marked in red.
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
52 70 95 23 04 60 11 42 ... | rlucioni/project-euler | euler/solutions/solution_11.py | Python | mit | 6,618 |
# docker-pipeline
#
# The MIT License (MIT)
#
# Copyright (c) 2015 Dan Leehr
#
# 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
# t... | Duke-GCB/docker-pipeline | docker-pipeline/runner.py | Python | mit | 4,468 |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
map_instance = client.sync \... | teoreteetik/api-snippets | sync/rest/maps/retrieve-map/retrieve-map.6.x.py | Python | mit | 441 |