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 |
|---|---|---|---|---|---|
# Copyright (c) 2012 Martin Garcia <newluxfero@gmail.com>
#
# This file is part of python-producteev, and is made available under
# MIT license. See LICENSE for the full details.
import re
import htmlentitydefs
def unescape(text):
"""
Removes HTML or XML character references and entities from a text string.
... | magarcia/python-producteev | producteev/utils.py | Python | mit | 1,036 |
import unittest
from charlesbot.slack.slack_channel_joined import SlackChannelJoined
from charlesbot.slack.slack_channel_left import SlackChannelLeft
from charlesbot.slack.slack_group_joined import SlackGroupJoined
from charlesbot.slack.slack_group_left import SlackGroupLeft
from charlesbot.slack.slack_message import S... | marvinpinto/charlesbot | tests/slack/test_slack_base_object_children.py | Python | mit | 1,314 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import codecs
import distutils.dir_util
import os
import shutil
import sys
def touch_file(file_path):
"""
Create a new empty file at file_path.
"""
parent_dir = os.path.abspath(os.path.join(file_path, os.pardir))
if... | geberl/droppy-workspace | Tasks/DropPy.Common/file_tools.py | Python | mit | 1,999 |
#!/usr/bin/env python
#########################################################################################
# KLEE-Unit
# Author: Jacob Torrey
# Date: 3/15/2016
#
# Script to auto-generate test harness and execute symbolically with KLEE for a passed C
# file
########################################################... | ranok/sledgehammer | klee-unit/klee-unit.py | Python | mit | 4,806 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('quotation', '0005_auto_20150828_2207'),
]
operations = [
migrations.CreateModel(
name='Orderingcompany',
... | lowitty/eeep | quotation/migrations/0006_orderingcompany.py | Python | mit | 542 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2016 Alex Forencich
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... | Diti24/python-ivi | ivi/tektronix/tektronixOA5012.py | Python | mit | 1,438 |
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | plaid/plaid-python | plaid/model/pay_period_details.py | Python | mit | 9,216 |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import Client
from django.test.utils import override_settings
@override_settings(AUTHENTICATION_BACKENDS=
('django.contrib.auth.backends.ModelBackend',))... | qdulab/OEMS | student/tests.py | Python | mit | 3,632 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2002-2009 Prof. William H. Green (whgreen@mit.edu) and the
# RMG Team (rmg_dev@mit.edu)
#
# Permission is hereby granted, free of charge, t... | KEHANG/RMG-Py | rmgpy/rmg/model.py | Python | mit | 87,614 |
from fabric import api as fab
from contextlib import contextmanager
@contextmanager
def with_vagrant():
with fab.settings(user="vagrant",host_string="127.0.0.1:2222",key_filename=".vagrant/machines/minecraft/virtualbox/private_key"):
yield
def ping(ip):
with with_vagrant():
return fab.run('pin... | ekozlowski/ansible-minecraft | fabfile.py | Python | mit | 717 |
# -*- encoding: utf8 -*-
# A daemon to keep SSH forwarding connected
from __future__ import print_function, absolute_import
import os
import sys
import time
import socket
import logging
class Daemon(object):
def __init__(self):
self.heartbeat = 50
def run(self):
logging.basicConfig(filename=... | dlutxx/memo | python/daemon.py | Python | mit | 1,497 |
UL_CATEGORY_LI = '//ul[@class="category"]/li'
H2_A_TITLELINK = './h2/a[@class="titlelink"]'
SPAN_A_TITLELINK = './span/a[@class="titlelink"]'
DIV_BODYFIELD_P = '//div[contains(@class,"bodyfield")]/p'
CATEGORY_H2_XPATH = [ UL_CATEGORY_LI, H2_A_TITLELINK ]
BODYFIELD_SPAN_XPATH = [ DIV_BODYFIELD_P, SPAN_A_TITLELINK ]
""... | RagtagOpen/bidwire | bidwire/scrapers/massgov/url_scraper_dict.py | Python | mit | 1,717 |
from flask_wtf import Form
from flask_wtf.file import FileRequired, FileAllowed, FileField
from wtforms import StringField, BooleanField, PasswordField, TextAreaField
from wtforms.validators import DataRequired, Email, Length
class SignUpForm(Form):
username = StringField('username', validators=[DataRequired(), L... | andersbogsnes/blog | app/forms.py | Python | mit | 1,224 |
from .fb2_parser import FB2NoteParser
from .pdf_parser import PDFNoteParser
from .stat_parser import StatsAccessor
__all__ = ("FB2NoteParser", "PDFNoteParser", "StatsAccessor")
| MrLokans/MoonReader_tools | moonreader_tools/parsers/__init__.py | Python | mit | 178 |
# /ciscripts/check/python/__init__.py
#
# Module loader file for /ciscripts/check/python.
#
# See /LICENCE.md for Copyright information
"""Module loader file for /ciscripts/check/python."""
| polysquare/polysquare-ci-scripts | ciscripts/check/python/__init__.py | Python | mit | 190 |
from merc.actor import Actor
from merc.collision import Collision
from merc.player import Player
from pprint import pprint
import sys
import json
import numpy
import itertools
from PIL import Image, ImageDraw, ImageColor
class Game:
NUM_TWEENS = 10
def __init__(self, data):
"""
`data` should contain the JSON o... | rustyfausak/merc | merc/old/game.py | Python | mit | 7,938 |
"""Train ILSVRC2017 Data using homemade scripts."""
import cv2
import os
import math
import tensorflow as tf
from multiprocessing import Process, Queue
import os
import sys
FILE_DIR = os.path.dirname(__file__)
sys.path.append(FILE_DIR + '/../')
import config as cfg
from img_dataset.ilsvrc2017_cls_multithread import ... | wenxichen/tensorflow_yolo2 | src/imagenet/imagenet_train_darknet.py | Python | mit | 4,911 |
import xml.sax
import xml.sax.handler
import types
try:
_StringTypes = [types.StringType, types.UnicodeType]
except AttributeError:
_StringTypes = [types.StringType]
START_ELEMENT = "START_ELEMENT"
END_ELEMENT = "END_ELEMENT"
COMMENT = "COMMENT"
START_DOCUMENT = "START_DOCUMENT"
END_DOCUMENT = "END_DOCUMENT"
... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.1/Lib/xml/dom/pulldom.py | Python | mit | 10,143 |
from django.conf import settings
IMAGE_URL = getattr(settings, 'AWARDS_IMAGE_URL', 'icons/awards/{slug}.png')
| fgmacedo/django-awards | awards/settings.py | Python | mit | 112 |
# Copyright (c) 2015 Daniel Garcia
#
# See the file LICENSE.txt for copying permission.
import unittest
import random
from gameboard.gameboard import Gameboard, Direction
from gameboard.coordinate import Coordinate
class TestBoard(unittest.TestCase):
def setUp(self):
self.board = Gameboard()
def tes... | gamda/gameboard | gameboard/tests/unit_tests.py | Python | mit | 14,863 |
#!/usr/bin/env python
import sip
sip.setapi('QVariant', 2)
import math
from PyQt4 import QtCore, QtGui, QtNetwork
from lib.Point import Point
from lib.tileOperations import *
TDIM = 256
class LightMaps(QtGui.QWidget):
def __init__(self, parent = None):
super(LightMaps, self).__init__(parent)
... | heltonbiker/MapComplete | PyQt/SlippyMapOriginal.py | Python | mit | 8,532 |
import logging
from wtforms import Form, SelectField, SelectMultipleField, validators
import savant.comparisons
import savant.sets
import savant.diffs
class DiffForm(Form):
diffs = SelectMultipleField('Diffs', [validators.Required()], choices=[])
class DiffNamingForm(DiffForm):
action = SelectField('Action'... | Doveps/mono | savant-web/forms.py | Python | mit | 4,267 |
#-----------------------------------------------------------------------------
# Copyright (c) 2008-2015, David P. D. Moss. All rights reserved.
#
# Released under the BSD license. See the LICENSE file for details.
#-----------------------------------------------------------------------------
"""
IEEE 48-bit EUI (M... | DaKnOb/mwhois | netaddr/strategy/eui48.py | Python | mit | 8,693 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Zhassulan Zhussupov
# Author zhzhussupovkz@gmail.com
# Tree class
import random
class Tree:
def __init__(self, world, screen, x, y):
self.world, self.pygame = world, world.pygame
self.screen = screen
model = random.choice(['tree.png', 'tree_1.pn... | zhzhussupovkz/taxi-py | core/tree.py | Python | mit | 1,125 |
"""Integration with the Rachio Iro sprinkler system controller."""
from abc import abstractmethod
from contextlib import suppress
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import ConfigEntry
from ho... | rohitranjan1991/home-assistant | homeassistant/components/rachio/switch.py | Python | mit | 19,041 |
import os
from twisted.trial import unittest
from lisa.server.plugins.PluginManager import PluginManagerSingleton
class LisaPluginTestCase(unittest.TestCase):
def setUp(self):
self.pluginManager = PluginManagerSingleton.get()
def test_a_install_plugin_ok(self):
answer = self.pluginManager.ins... | Seraf/LISA | lisa/server/tests/test_plugins.py | Python | mit | 2,790 |
# -*- coding: utf-8 -*-
class Item(object):
def __init__(self, uid, name, time):
self._uid = uid
self._name = name
self._time = time
@property
def name(self):
return self._name
@property
def uid(self):
return self._uid
def display(self, size):
... | NiZiL/clitube | clitube/model.py | Python | mit | 3,663 |
from marshmallow import Schema, fields, post_load, EXCLUDE
from ..resource import Resource
from collections import namedtuple
class Plan(Resource):
"""
https://dev.chartmogul.com/v1.0/reference#plans
"""
_path = "/plans{/uuid}"
_root_key = 'plans'
_many = namedtuple('Plans', [_root_key, "curre... | chartmogul/chartmogul-python | chartmogul/api/plan.py | Python | mit | 727 |
import os
import os.path
from django.db import transaction
from bibliotik import manage_bibliotik
from bibliotik.models import BibliotikTransTorrent, BibliotikTorrent
from home.models import LogEntry, DownloadLocation
def sync_instance_db(instance):
b_torrents = instance.get_b_torrents_by_hash()
t_torrents ... | davols/WhatManager2 | bibliotik/trans_sync.py | Python | mit | 3,346 |
# Copyright (c) 2012 Santosh Philip
# =======================================================================
# Distributed under the MIT License.
# (See accompanying file LICENSE or copy at
# http://opensource.org/licenses/MIT)
# =======================================================================
"""change the ... | pachi/eppy | eppy/useful_scripts/change_edges.py | Python | mit | 1,491 |
#encoding:utf-8
from utils import weighted_random_subreddit
t_channel = '@pythondaily'
subreddit = weighted_random_subreddit({
'flask': 3,
'Python': 6,
'django': 4,
'MachineLearning': 1,
'djangolearning': 1,
'IPython': 5,
'pystats': 4,
'JupyterNotebooks': 3
})
def send_post(submissi... | Fillll/reddit2telegram | reddit2telegram/channels/pythondaily/app.py | Python | mit | 822 |
# Third-party
import numpy as np
import astropy.units as u
import astropy.coordinates as coord
from astropy.coordinates import frame_transform_graph
from astropy.coordinates.matrix_utilities import matrix_transpose
__all__ = ["JhelumBonaca19"]
class JhelumBonaca19(coord.BaseCoordinateFrame):
"""
A Heliocent... | adrn/gala | gala/coordinates/jhelum.py | Python | mit | 3,688 |
import optparse
class CLI:
pass
CLI.parser = optparse.OptionParser()
CLI.parser.add_option("-q", "--queries", dest="queries", help="Queries csv file", metavar="FILE")
CLI.parser.add_option("-l", "--logs", dest="logs", help="Path to log files containing directory", metavar="DIR")
CLI.parser.add_option("-r", "--resu... | fire-uta/iiix-data-parser | cli.py | Python | mit | 1,078 |
import re
from main import sc
__author__ = 'minh'
class Utils:
def __init__(self):
pass
not_allowed_chars = '[\/*?"<>|\s\t]'
numeric_regex = r"\A((\\-)?[0-9]{1,3}(,[0-9]{3})+(\\.[0-9]+)?)|((\\-)?[0-9]*\\.[0-9]+)|((\\-)?[0-9]+)|((\\-)?[0" \
r"-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)... | alseambusher/SemanticTyping | lib/utils.py | Python | mit | 1,139 |
from avatar.templatetags.avatar_tags import avatar_url
from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from tastypie import fields
from tastypie.resources import ModelResource
from accounts.models import UserProfile
from main.api.authentication i... | Uberlearner/uberlearner | uberlearner/accounts/api/api.py | Python | mit | 1,436 |
from csacompendium.indicators.models import ResearchOutcomeIndicator
from csacompendium.utils.pagination import APILimitOffsetPagination
from csacompendium.utils.permissions import IsOwnerOrReadOnly
from csacompendium.utils.viewsutils import DetailViewUpdateDelete, get_http_request
from rest_framework.filters import Dj... | nkoech/csacompendium | csacompendium/indicators/api/researchoutcomeindicator/researchoutcomeindicatorviews.py | Python | mit | 2,693 |
# -*- coding: utf-8 -*-
"""
Terrain module providing step overlapping data containers
"""
import threading
world = threading.local() # pylint: disable=invalid-name
def pick(func):
"""
Picks the given function and add it to the world object
"""
setattr(world, func.__name__, func)
return... | SamuelYvon/radish | radish/terrain.py | Python | mit | 346 |
from goprocam import GoProCamera, constants
gpCam = GoProCamera.GoPro()
## Downloads all of the SD card's contents and then formats the sd card.
gpCam.downloadAll()
gpCam.delete("all") | KonradIT/gopro-py-api | examples/dump_sdcard.py | Python | mit | 186 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "badguys.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| mpirnat/lets-be-bad-guys | manage.py | Python | mit | 250 |
#! /usr/bin/env python2
# -*- coding: utf-8 -*-
#======================================================================
#
# playsnd.py - play sound with ctypes + mci
#
# Created by skywind on 2013/12/01
# Last change: 2014/01/26 23:40:20
#
#======================================================================... | skywind3000/collection | script/playmp3.py | Python | mit | 7,109 |
import sys
file_name = sys.argv[1]
with open(file_name) as open_file:
for line in open_file.readlines():
a, b, n = map(int, line.split())
output = ""
for i in xrange(1, n + 1):
out = ""
spacing = " "
if i == 1:
spacing = ""
if i % a == 0:
out += "F"
if i % b == 0:
out += "... | Widdershin/CodeEval | challenges/001-fizzbuzz.py | Python | mit | 379 |
MYSQL_DB = 'edxapp'
MYSQL_USER = 'root'
MYSQL_PSWD = ''
MONGO_DB = 'edxapp'
MONGO_DISCUSSION_DB = 'cs_comments_service_development'
| jaygoswami2303/course_dashboard_api | v2/dbv.py | Python | mit | 133 |
# coding: utf-8
"""
Gmail
Access Gmail mailboxes including sending user email.
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility library
fro... | CanopyIQ/gmail_client | gmail_client/apis/users_api.py | Python | mit | 459,442 |
#!/usr/bin/env python
from __future__ import print_function
import boto3
import time
from botocore.exceptions import ClientError
from datetime import datetime
def get_unix_timestamp():
"""
Generate a Unix timestamp string.
"""
d = datetime.now()
t = time.mktime(d.timetuple())
return str(int... | meredith-digops/awsops | amicreation/amicreation.py | Python | mit | 1,866 |
from allauth.socialaccount import providers
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth.provider import OAuthProvider
from allauth.socialaccount.models import SocialApp, SocialToken
import oauth2 as oauth
import urllib, urllib2, json
class TwitterAccount... | rawjam/django-allauth | allauth/socialaccount/providers/twitter/provider.py | Python | mit | 2,869 |
#!/usr/bin/env python
import json
import os
import consul
import sys
import time
from alertaclient.api import Client
CONSUL_HOST = os.environ.get('CONSUL_HOST', '127.0.0.1')
CONSUL_PORT = int(os.environ.get('CONSUL_PORT', 8500))
client = consul.Consul(host=CONSUL_HOST, port=CONSUL_PORT, token=None, scheme='http', c... | alerta/alerta-contrib | integrations/consul/consulalerta.py | Python | mit | 2,770 |
# 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 ... | Azure/azure-sdk-for-python | sdk/powerbiembedded/azure-mgmt-powerbiembedded/azure/mgmt/powerbiembedded/models/power_bi_embedded_management_client_enums.py | Python | mit | 660 |
"""
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, merg... | Rapptz/discord.py | discord/types/activity.py | Python | mit | 2,827 |
from django.apps import AppConfig
class TelegramBotConfig(AppConfig):
name = 'frekenbot'
| frekenbok/frekenbok | frekenbot/apps.py | Python | mit | 95 |
#
# Copyright: Copyright (c) MOSEK ApS, Denmark. All rights reserved.
#
# File: simple.py
#
# Purpose: Demonstrates a very simple example using MOSEK by
# reading a problem file, solving the problem and
# writing the solution to a file.
#
import mosek
import sys
def streamprinter(msg):
sys.stdout.write (msg)
... | edljk/Mosek.jl | deps/src/mosek/7/tools/examples/python/simple.py | Python | mit | 1,730 |
import cv2
import time
import numpy as np
MAX_TARGETS = 3
TOP = 0
BOTTOM = 1
LEFT = 0
RIGHT = 1
def __init_tracker(frame):
running_average_image = np.float32(frame)
running_average_in_display_color_depth = frame.copy()
difference = frame.copy()
last_target_count = 1
last_target_change_time = 0.0... | walkover/auto-tracking-cctv-gateway | gateway/camera/tracker.py | Python | mit | 13,148 |
from django.contrib import admin
from tsj.models import *
admin.site.register(Company)
admin.site.register(Resident)
admin.site.register(House)
admin.site.register(ServiceCompany)
admin.site.register(MeterType)
admin.site.register(MeterReadingHistory)
admin.site.register(Employer)
admin.site.register(Notification)
| dan4ik95dv/housemanagement | tsj/admin.py | Python | mit | 317 |
from __future__ import print_function
import aaf
import aaf.mob
import aaf.define
import aaf.iterator
import aaf.dictionary
import aaf.storage
import aaf.component
import aaf.util
from aaf.util import AUID, MobID
import unittest
import os
cur_dir = os.path.dirname(os.path.abspath(__file__))
sandbox = os.path.join(c... | markreidvfx/pyaaf | tests/test_CommentMarker.py | Python | mit | 4,264 |
import hashlib
from datetime import datetime
from flask import request
from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from . import db, login_manager
#pylint: disable-msg=E1101
@login_manager.user_loader
def load_user(user_id):
return User.query.get(in... | finnurtorfa/aflafrettir.is | app/models.py | Python | mit | 8,023 |
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
import time
from openerp import pooler
from openerp.osv import fields, osv
from openerp.tools.translate import _
class is_api(osv.osv):
_name = 'is_api'
_description = u'Fonctions générales'
def get_usagers_structure(self, cr... | tonygalmiche/ove_structure | is_api.py | Python | mit | 13,118 |
#!/usr/bin/env python3
# Distributed under CC0 1.0 Universal (CC0 1.0) Public Domain Dedication.
# pylint: disable=ungrouped-imports,wrong-import-position
import os
import sys
import pathlib
import asyncio
import logging
import importlib
import pyuavcan
# Production applications are recommended to compile their DSDL ... | UAVCAN/pyuavcan | demo/demo_app.py | Python | mit | 9,775 |
import string
from pyparsing import (
Literal, White, Word, alphanums, CharsNotIn, Forward, Group, SkipTo,
Optional, OneOrMore, ZeroOrMore, pythonStyleComment)
class Parser(object):
left_bracket = Literal("{").suppress()
right_bracket = Literal("}").suppress()
semicolon = Literal(";").suppress()
... | Nat-Lab/pac.py | lib/confParser.py | Python | mit | 3,119 |
# -*- coding: utf-8 -*-
from PyQt4.QtCore import Qt
from PyQt4 import QtCore, QtGui
class GetCoverTask(QtCore.QObject):
coverLoaded = QtCore.pyqtSignal(QtGui.QImage)
def __init__(self, coverPath):
super(GetCoverTask, self).__init__()
self._coverPath = coverPath
def run(self):
im... | lightcode/SeriesWatcher | serieswatcher/serieswatcher/tasks/getcover.py | Python | mit | 506 |
import os
import json
import tensorflow as tf
import numpy as np
def load_data(taxonomy):
data_list= list(filter(lambda x:x[-3:]=='npy', os.listdir(taxonomy)))
result=[]
for data_file in data_list:
result.append(np.load('%s/%s' %(taxonomy, data_file)))
if len(result)%1000== 0:
print("%s: %d/%d" %(taxonomy, l... | elwlwlwk/GeneSeq2Taxonomy | train.py | Python | mit | 3,062 |
import os
STIR_ROOT = os.path.normpath(os.path.dirname(__file__))
STIR_APP = os.path.normpath(os.path.join(STIR_ROOT, "application"))
STIR_LIB = os.path.normpath(os.path.join(STIR_ROOT, "library"))
# STIR_SCRIPT = os.path.normpath(os.path.join(STIR_ROOT, "script"))
| setsulla/stir | stir/define.py | Python | mit | 267 |
import logging
import socket
from unipath import Path
class BaseConfig(object):
DEBUG = False
TESTING = False
LOG_LEVEL = logging.INFO
SITE_ROOT = Path(__file__).absolute().parent
STDNET_DB_URL = "redis://localhost:6379?db=0"
GEOIP_DB_URL_IPV4 = "http://geolite.maxmind.com/download/geoip/data... | ulope/nearest_pypi | config.py | Python | mit | 1,600 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from os.path import join, isfile
from os import walk
import io
import os
import sys
from shutil import rmtree
from setuptools import find_packages, setup, Command
def read_file(filename):
with open(filename) as fp:
return fp.read().strip()
def read_requirem... | Gerapy/Gerapy | setup.py | Python | mit | 3,683 |
import functools
from pluss.app import app
from pluss.util.cache import Cache
RATE_LIMIT_CACHE_KEY_TEMPLATE = 'pluss--remoteip--ratelimit--1--%s'
def ratelimited(func):
"""Includes the wrapped handler in the global rate limiter (60 calls/min)."""
@functools.wraps(func)
def wrapper(*args, **kwargs):
... | ayust/pluss | pluss/util/ratelimit.py | Python | mit | 1,111 |
# -*- coding: utf-8 *-*
from collections import OrderedDict
from nicepy.utils import ljust_all, pretty_repr
def get_failed_msg(compare_method, values, expected_values, names=None, expected_names=None):
failed_list = []
names = names or map(str, range(len(values)))
expected_names = expected_names or [''] *... | katakumpo/nicepy | nicepy/assertions/helpers.py | Python | mit | 1,696 |
#! /usr/bin/env python
"""
Generate random MAC address
Inspired by http://www.linux-kvm.com/sites/default/files/macgen.py
"""
from sys import argv
import random
DEFAULT_OUI = '00-16-3e' # Xensource, Inc.
def random_mac(oui=None):
"""returns a random MAC address, with optional +oui+ override"""
mac_parts = ... | tardate/LittleCodingKata | python/random_mac_generation/random_mac.py | Python | mit | 558 |
from data import formats
class Player():
def __init__(self, name, position, team, champion=''):
self.name = name
self.position = position
self.team = team
self.champion = champion
def __str__(self):
return formats.player.format(name=self.name, position=self.position,
... | mvy/reddit_live_lcs | models/player.py | Python | mit | 396 |
# -*- coding: utf-8 -*-
""" Authentication, Authorization, Accouting
@requires: U{B{I{gluon}} <http://web2py.com>}
@copyright: (c) 2010-2012 Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated docum... | flavour/iscram | modules/s3/s3aaa.py | Python | mit | 198,273 |
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
return render(request, 'todo/index.html')
| deshmukhmayur/django-todo | todo/views.py | Python | mit | 166 |
from stard.services import BaseService
class Service(BaseService):
def init_service(self):
self.children = {self.service('child')}
| DexterLB/stard | src/stard/test_samples/father.py | Python | mit | 144 |
#!/usr/bin/python
import sys
import logging
import time
import subprocess
import shlex
import os
import StringIO
import tempfile
from watchdog.observers import Observer
from watchdog.events import FileCreatedEvent, RegexMatchingEventHandler
class CreatedFilesHandler(RegexMatchingEventHandler):
def on_created(sel... | hydrosolutions/irrigation-calc | file_watch.py | Python | mit | 2,693 |
##############################
# #
# Instructions #
# #
##############################
# To run, use the following command:
# $ python seating.py <input_file>
# where <input_file> is the filename with the question's input
import sys
import re
# Chec... | joseph-roque/advent-of-code | day_13/seatmyself.py | Python | mit | 2,768 |
from datetime import date, time
NO_TITLE = u"__NO_TITLE__"
NO_AUTHOR_NAME = 'None'
NO_CATEGORY_NAME = 'None'
NON_EXISTENT_ARTICLE_TITLE = 'NON_EXISTENT'
NO_DATE = date(1970, 01, 01)
NO_TIME = time(0, 0)
NO_URL = u"__NO_URL__"
UNFINISHED_TAG = u"unfinished"
GHOST_LINK_TAG = u"ghost link"
GHOST_LINK_TITLE = u"__GHOST_LI... | sevas/csxj-crawler | csxj/datasources/parser_tools/constants.py | Python | mit | 590 |
#
# (c) Dave Kirby 2001 - 2005
# mock@thedeveloperscoach.com
#
# Original call interceptor and call assertion code by Phil Dawes (pdawes@users.sourceforge.net)
# Call interceptor code enhanced by Bruce Cropley (cropleyb@yahoo.com.au)
#
# This Python module and associated files are released under the FreeBSD
# lice... | cropleyb/pentai | pentai/base/mock.py | Python | mit | 16,157 |
# encoding: utf-8
"""
Paging capabilities for IPython.core
Authors:
* Brian Granger
* Fernando Perez
Notes
-----
For now this uses ipapi, so it can't be in IPython.utils. If we can get
rid of that dependency, we could move it there.
-----
"""
#----------------------------------------------------------------------... | mattvonrocketstein/smash | smashlib/ipy3x/core/page.py | Python | mit | 12,350 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured
import os
FREEZE_ROOT = getattr(settings, 'FREEZE_ROOT', os.path.abspath(os.path.join(settings.MEDIA_ROOT, '../freeze/')) )
if not os.path.isabs(FREEZE_ROOT)... | fabiocaccamo/django-freeze | freeze/settings.py | Python | mit | 3,077 |
from flask_restful import marshal_with, reqparse
from flask import abort, g
from flask import Blueprint as FlaskBlueprint
from flask_restful import fields
from sqlalchemy.orm.session import make_transient
import logging
import uuid
from pebbles.models import db, BlueprintTemplate, Plugin
from pebbles.forms import Blu... | CSC-IT-Center-for-Science/pouta-blueprints | pebbles/views/blueprint_templates.py | Python | mit | 7,676 |
from ..workdays import *
from datetime import datetime, timedelta
from time import strptime
import math
import traceback
tests=[]
def test( fn ):
tests.append(fn)
return fn
def runTests():
for t in tests:
print t
try: t()
except Exception as e:
print e
trace... | mmahnic/trac-tickethistory | tickethistory/test/workdays_t.py | Python | mit | 4,805 |
#! /usr/bin/env python
"""Team Password Manager API
To simplify usage of Team Password Manager API.
You can authenticate with username and password
>>> import tpm
>>> URL = "https://mypasswordmanager.example.com"
>>> USER = 'MyUser'
>>> PASS = 'Secret'
>>> tpmconn = tpm.TpmApiv5(URL, username=USER... | peshay/tpm | tpm.py | Python | mit | 32,755 |
# -*- coding: utf-8 -*-
import ast
import os
import requests
import models
from config import config, sqla
from gevent.pool import Pool
from helpers import random_str, down
base_path = config.get('photo', 'path')
base_path = os.path.join(base_path, 'celebrity')
cookies = {
'bid': ''
}
def create_down(str_u... | billvsme/videoSpider | webs/douban/tasks/down_celebrity_images.py | Python | mit | 1,702 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
# Copyright 2012 Google, Inc.
#
# 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
#
# ... | wandb/client | wandb/vendor/watchdog/observers/inotify.py | Python | mit | 8,528 |
# Python3
from solution1 import multiplicationTable as f
qa = [
(5,
[[1, 2, 3, 4, 5],
[2, 4, 6, 8, 10],
[3, 6, 9, 12, 15],
[4, 8, 12, 16, 20],
[5, 10, 15, 20, 25]]),
(2,
[[1, 2],
[2, 4]]),
(4,
[[1, 2, 3, 4],
[2, 4, 6, 8],
[3, 6, 9, 12... | RevansChen/online-judge | Codefights/arcade/python-arcade/level-5/34.Multiplication-Table/Python/test.py | Python | mit | 2,320 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Ver 18 - 15 November 2017 -
import time
import serial
import string
import sys
import mysql.connector
from mysql.connector import errorcode, pooling
from db import *
import datetime
#from threading import Thread
import multiprocessing as mp
from multiprocessing import Queue... | theflorianmaas/dh | Python/dhproc/p_serial.py | Python | mit | 15,394 |
import os
from flask import current_app
from flask.cli import FlaskGroup, run_command
from opsy.db import db
from opsy.app import create_app, create_scheduler
from opsy.utils import load_plugins
DEFAULT_CONFIG = '%s/opsy.ini' % os.path.abspath(os.path.curdir)
def create_opsy_app(info):
return create_app(config=o... | derekmoyes/opsy | opsy/shell.py | Python | mit | 1,995 |
"""
sprintkit.services
==================
Implementations of most Developer Sandbox Services.
:Copyright: (c) 2011 by Sprint.
:License: MIT, see LICENSE for more details.
"""
from ConfigParser import SafeConfigParser
from datetime import datetime
from hashlib import md5
import json
import os
import time
import urlpa... | ericem/sprintkit | src/sprintkit/services.py | Python | mit | 44,648 |
import sys
import os
import cv2
import numpy as np
class Detector:
def detect(self, src):
raise NotImplementedError("Every Detector must implement the detect method.")
class SkinDetector(Detector):
"""
Implements common color thresholding rules for the RGB, YCrCb and HSV color
space. The val... | idf/FaceReader | facerec_py/facedet/detector.py | Python | mit | 5,760 |
from datetime import datetime
from django.test import TestCase
from django.contrib.auth.models import User
from apps.mountains.models import Mountain, Climb
class ClimbTest(TestCase):
def setUp(self):
User.objects.create(
username = "test_user",
email = "test@testemail.com",
... | tiradoe/fourteeners-updated | fourteeners/apps/mountains/tests.py | Python | mit | 2,841 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
import os.path
import pytest
import abclinuxuapi
from abclinuxuapi import shared
@pytest.fixture
def bp_url():
return "http://www.abclinuxu.cz/blog/bystroushaak/2015/2/bolest-proxy"
@pytest.fixture
def do_that_fucking_monkey_p... | Bystroushaak/abclinuxuapi | tests/test_blogpost.py | Python | mit | 4,767 |
from django.conf.urls import url
from .views import list_products
app_name = "producto"
urlpatterns = [
url(r'list-productos/$', list_products, name='list_products'),
]
| andree1320z/deport-upao-web | deport_upao/apps/productos/urls.py | Python | mit | 176 |
#
# The Multiverse Platform is made available under the MIT License.
#
# Copyright (c) 2012 The Multiverse Foundation
#
# 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 restrict... | longde123/MultiversePlatform | client/Scripts/AnimationState.py | Python | mit | 2,968 |
from classes import wunderpy_wrapper
from classes import grocerylist
from classes import grocerystore
wp = wunderpy_wrapper.wunderpy_wrapper('../data/tokens.csv')
obj = wp.get_task_positions_obj(wp.WUNDERLIST_GROCERY)
grocery_store = grocerystore.groceryStore('../data/store_order_zehrs.csv', '../data/ingredient_categ... | briancousins/RecipeBook | tests/test_grocerylist.py | Python | mit | 784 |
#!/usr/bin/env python
'''Test framework for pyglet. Reads details of components and capabilities
from a requirements document, runs the appropriate unit tests.
How to Run the Tests
--------------------
::
python tests/test.py top app graphics clock resource # these all run automatically
python tests/test.py... | vickenty/ookoobah | pyglet-c9188efc2e30/tests/test.py | Python | mit | 20,890 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# 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 t... | jcoady9/beets | beetsplug/bpd/__init__.py | Python | mit | 40,508 |
import sys
def solve():
moveList = sys.stdin.read().strip()
moves = {}
houseGrid = []
houseGrid.append([1])
moves['^'] = [-1, 0]
moves['v'] = [1, 0]
moves['<'] = [0, -1]
moves['>'] = [0, 1]
santa = {}
santa['x'] = 0
santa['y'] = 0
robo = {}
robo['x'] = 0
robo['y'] = 0
santaList = [(0,0)]
isSanta = Tr... | Jaemu/advent-of-code | python/day-3.py | Python | mit | 918 |
#!/usr/bin/env python3
from testUtils import Utils
from Cluster import Cluster
from WalletMgr import WalletMgr
from TestHelper import TestHelper
import random
###############################################################
# restart-scenarios-test
#
# Tests restart scenarios for nodeos. Uses "-c" flag to indicate "... | EOSIO/eos | tests/restart-scenarios-test.py | Python | mit | 5,013 |
# Use holoviews to plot the particle distribution at given time
from pathlib import Path
import numpy as np
import xarray as xr
import holoviews as hv
from postladim import ParticleFile
hv.extension("bokeh")
# --- Settings ---
tstep = 40 # Time step to show
# Output file (and type)
output_file = "line_hv.png"
#out... | bjornaa/ladim | examples/line/plot_holoviews.py | Python | mit | 1,481 |
import os
import random
import time
from flask import Flask, request, render_template, session, flash, redirect, \
url_for, jsonify
from flask.ext.mail import Mail, Message
from flask.ext.sqlalchemy import SQLAlchemy
from celery import Celery
app = Flask(__name__)
app.config['SECRET_KEY'] = 'top-secret!'
# Flask... | bdh1011/wau | app.py | Python | mit | 4,092 |
import re
from jinja2 import Markup, escape, evalcontextfilter
from app import app
_paragraph_re = re.compile(r'(?:\r\n|\r|\n){2,}')
@app.template_filter('nl2br')
@evalcontextfilter
def nl2br(eval_ctx, value):
result = u'\n\n'.join(u'<p>%s</p>' % p.replace('\n', '<br>\n')
for p in _para... | streety/Home | app/jinja_filters.py | Python | mit | 429 |
import django_tables2 as tables
from django_tables2 import RequestConfig
from django_tables2.utils import A # alias for Accessor
from django.shortcuts import render
import inspect
class DtTemplate(tables.Table):
#name_first = tables.Column(verbose_name="First Name")
#name_last = tables.LinkColumn('track:... | ziposoft/godiva | src/zs/view_dt.py | Python | mit | 582 |
#!/usr/bin/env python
""" MultiQC modules base class, contains helper functions """
from __future__ import print_function
from collections import OrderedDict
import io
import json
import mimetypes
import os
import random
import logging
from multiqc import config
logger = logging.getLogger(__name__)
letters = 'abcde... | moonso/MultiQC | multiqc/base_module.py | Python | mit | 16,214 |
#!/usr/bin/env python
#to create a file in codesnippets folder
import pyperclip
import os
import re
import subprocess
def get_extension(file_name):
if file_name.find('.')!=-1:
ext = file_name.split('.')
return (ext[1])
else:
return 'txt'
def cut(str, len1):
return str[len1 + ... | nikhilponnuru/codeCrumbs | code/create_file.py | Python | mit | 4,006 |