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 |
|---|---|---|---|---|---|
"""Prepares the views for point scoreboard widget."""
import datetime
from apps.managers.score_mgr import score_mgr
from apps.managers.challenge_mgr import challenge_mgr
from apps.managers.resource_mgr import resource_mgr
from apps.widgets.resource_goal import resource_goal
from apps.managers.team_mgr.models import Te... | justinslee/Wai-Not-Makahiki | makahiki/apps/widgets/group_prizes/views.py | Python | mit | 632 |
import json
import sqlite3
def get_room(id, dbfile):
ret = None
con = sqlite3.connect(dbfile)
for row in con.execute("select json from rooms where id=?",(id,)):
jsontext = row[0]
# Outputs the JSON response
#print("json = " + jsontext)
d = json.loads(jsontext)... | mbramr/My-Zork | room.py | Python | mit | 1,035 |
# -*- coding: utf-8 -*-
"""pybooru.exceptions
This module contains Pybooru exceptions.
Classes:
* PybooruError -- Main Pybooru exception class.
* PybooruHTTPError -- Manages HTTP status errors.
* PybooruAPIError -- Manages all API errors.
"""
# __furute__ imports
from __future__ import absolute_import
... | LuqueDaniel/pybooru | pybooru/exceptions.py | Python | mit | 1,211 |
# -*- coding:utf8 -*-
# File : context.py
# Author : Jiayuan Mao
# Email : maojiayuan@gmail.com
# Date : 12/31/16
#
# This file is part of TensorArtist.
__all__ = ['EmptyContext']
class EmptyContext(object):
def __enter__(self):
return
def __exit__(self, exc_type, exc_val, exc_tb):
... | vacancy/TensorArtist | tartist/core/utils/context.py | Python | mit | 328 |
# -*- encoding: utf-8 -*-
from supriya.tools.synthdeftools.SignalRange import SignalRange
from supriya.tools.ugentools.UGen import UGen
class Dust(UGen):
r'''A unipolar random impulse generator.
::
>>> dust = ugentools.Dust.ar(
... density=23,
... )
>>> dust
Dus... | andrewyoung1991/supriya | supriya/tools/ugentools/Dust.py | Python | mit | 2,414 |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2015-2016 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 us... | jhgg/discord.py | discord/channel.py | Python | mit | 12,385 |
""" For beta/alpha/rc releases, the version number for a beta is X.Y.ZbN
**without dots between the last 'micro' number and b**. N is the number of
the beta released i.e. 1, 2, 3 ...
See PEP 440 https://www.python.org/dev/peps/pep-0440/
"""
version_info = (5, 0, 0, '')
__version__ = '.'.join(map(str, version_info[:... | lancezlin/ml_template_py | lib/python2.7/site-packages/jupyter_console/_version.py | Python | mit | 353 |
import unittest
import sys
import time
import CacheConnector
class TestInitializer(unittest.TestCase):
def testInitializerWithArgs(self):
cc = CacheConnector.CacheConnector()
cc[9] = 10
self.assertEqual(cc.get(9, 100), 10)
self.assertEqual(cc.pop(9, 'nonsense'), 10)
self.a... | odeke-em/mp | tests/testCacheConnector.py | Python | mit | 1,439 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
class TranslationType(models.Model):
created = models.DateTimeField(_('DTSM1'), auto_now_add=True, null=True, blank=True, help_text=_('DTST1'))
updated = models.DateTimeField(_('DTSM2'), auto_now=True, null=True, blank=True, ... | gdelnegro/django-translation-server | translation_server/models.py | Python | mit | 3,854 |
from pytest import fixture
@fixture(scope="session")
def config():
return dict(host="mongodb",
port=27017,
db_name="default")
| peterVorman/apartments-analyzer | tests/conftest.py | Python | mit | 164 |
import numpy as np
from scipy import signal
import math
def norm_matrix(matrix):
for i in range(np.shape(matrix)[0]):
if np.max(matrix[i]) <= 0:
matrix[i] = matrix[i]
else:
matrix[i] /= np.max(matrix[i])
return matrix
def pool_boundaries(boundaries, filter_size, coeff... | michaelStettler/HISI | HISI/boundaries.py | Python | mit | 16,880 |
"""Training and Predicting Cifar10 with Mutant Networks.
The networks mutate their architecture using genetic algorithms.
Author: Lucas David -- <ld492@drexel.edu>
Licence: MIT License 2016 (c)
"""
import logging
import artificial as art
import numpy as np
import tensorflow as tf
from artificial.utils.experiments i... | Comp-UFSCar/neural-networks-2 | mutant-networks/experiments/cifar-genetic/cifar-genetic.py | Python | mit | 2,889 |
from dyleps.utils.exceptions import Tier1Exception
class Tier1ParsingException(Tier1Exception):
pass | PhillsProgrammingExperiments/dyleps | dyleps/tier1/exceptions.py | Python | mit | 106 |
import requests
class YGOPricesAPI():
def __init__(self):
self.url = "http://yugiohprices.com/api"
def __make_request(self, url):
"""Request a resource from api"""
request = requests.get(url)
if request.status_code != 200:
status_code = request.status_code
... | mneary1/YGOPricesAPI | prices.py | Python | mit | 2,551 |
# coding: utf-8
from django.conf.urls import patterns, url
urlpatterns = patterns('',
url(r"^$", "quickstartup.website.views.index", name="index"),
)
| georgeyk/quickstartup | quickstartup/website/urls.py | Python | mit | 158 |
# -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <zearin@gonk.net> ... | iModels/ffci | github/tests/CommitStatus.py | Python | mit | 2,894 |
"Add a movie to Plex."
import sys
from pathlib import Path
from argparse import ArgumentParser
from tkinter import filedialog, messagebox, simpledialog, Tk, Frame, Label
from tkinter.ttk import Combobox, Button
class FeaturettePicker:
FEATURETTES = {
"Behind the Scenes": "behindthescenes",
"Delet... | stefco/dotfiles | winscripts/plexmovie.py | Python | mit | 4,386 |
#!/opt/python3.3/bin/python3.3
from threading import Thread
import RPi.GPIO as GPIO
import time
import datetime
import os
import sys
import dht11_sensor
import psycopg2
import copy
###-----------------Hardware Settings-----------------------
PIN_LC=25 #Light Sensor (GPIO.IN, pull_up_down=GPIO.PUD_UP)
PIN_MC=17 #Mo... | warkanum/warkanums-pi-device-snippets | build1/boot_special.py | Python | mit | 8,959 |
"""Test Pandoc module"""
#-----------------------------------------------------------------------------
# Copyright (C) 2014 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#----------------------------... | sserrot/champion_relationships | venv/Lib/site-packages/nbconvert/utils/tests/test_pandoc.py | Python | mit | 2,872 |
from gerencianet import Gerencianet
from credentials import CREDENTIALS
gn = Gerencianet(CREDENTIALS)
params = {
'txid': ''
}
body = {
'calendario': {
'expiracao': 3600
},
'devedor': {
'cpf': '',
'nome': ''
},
'valor': {
'original': '0.50'
},
'chave': '... | gerencianet/gn-api-sdk-python | examples/pix_create_charge.py | Python | mit | 463 |
from django.core.urlresolvers import reverse_lazy
from django.views.generic import View
from hopes.forms import StudentForm, SchoolForm, OneTimeForm, SpecificDateTimeForm
from hopes.models import Student, School, OneTime, SpecificDateTime
from vanilla import CreateView, DeleteView, ListView, UpdateView
class ListStu... | elcolie/fight | hopes/views.py | Python | mit | 2,543 |
#-*- coding:utf-8 -*-
from tornado.httpclient import HTTPClient, AsyncHTTPClient
import tornado.ioloop
from tornado.concurrent import Future
from tornado import gen
import time
from concurrent.futures import ThreadPoolExecutor
executor = ThreadPoolExecutor(max_workers=4)
#同步方法调用
def synchronous_fetch(url, callback):
... | zhyq0826/test-lab | tornado-lab/main4.py | Python | mit | 2,107 |
#!/usr/bin/env python2
"""
Copyright (c) 2015 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 rights
to use, copy, modify, mer... | alexforencich/hdg2000 | fpga/tb/test_wb_mcb_32.py | Python | mit | 10,990 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_network_security_rule.py | Python | mit | 5,618 |
"""
fileName: testing.py
Authors: Jacob Krantz
Date Modified: 3/14/17
Contains classes for testing the performance of Syllabifiers.
- CompareNIST
* compare
* viewDifferences
"""
from __future__ import print_function
# from utils import SyllabParser
class CompareNIST:
def __init__(self):
... | jacobkrantz/ProbSyllabifier | nist/testing.py | Python | mit | 4,197 |
# -*- coding: utf-8 -*-
######################################################################
## Filename: wikisplit.py
## Copyright: 2014, Zhicong Chen
## Version:
## Author: Zhicong Chen <zhicong.chen@changecong.com>
## Created at: Fri Feb 21 23:21:17 2014
## Modified at: Mon Mar 3 16:3... | changecong/wikisplit | wikisplit.py | Python | mit | 11,476 |
import asyncio
from aiohttp.web import Application
from Todos import handlers
def create_server(loop, handler, host, port):
srv = loop.create_server(handler, host, port)
return loop.run_until_complete(srv)
def create_app(loop):
app = Application(loop=loop)
handler = app.make_handler()
return app... | alexeyraspopov/aiohttp-mongodb-example | server.py | Python | mit | 1,357 |
# #!/usr/bin/env python
# -*- coding: utf-8 -*-
# <HTTPretty - HTTP client mock for Python>
# Copyright (C) <2011-2018> Gabriel Falcao <gabriel@nacaolivre.org>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to ... | andresriancho/HTTPretty | setup.py | Python | mit | 2,629 |
from templeplus.pymod import PythonModifier
from toee import *
import tpdp
#Lingering Song, Complete Adventurer: p. 111
print "Registering Lingering Song"
def QueryMaxBardicMusicExtraRounds(attachee, args, evt_obj):
#5 Extra Rounds from this feat
evt_obj.return_val += 5
return 0
LingeringSong = PythonModifi... | GrognardsFromHell/TemplePlus | tpdatasrc/tpgamefiles/scr/tpModifiers/lingering_song.py | Python | mit | 512 |
import unittest
from QuickSort import QuickSort
class QuickSortTester(unittest.TestCase):
def setUp(self):
self.qs = QuickSort()
def test_partition(self):
arr = [10, 5, 2, 90, 61, 32, 3]
#pivot point is 10
#after partition array should be
#[5, 2, 3, 10, 90, 61, 32]
... | nicangeli/Algorithms | arrays/quick_sort/tests.py | Python | mit | 1,602 |
"""sf_allow_declaration_reuse_add_column
create supplier_frameworks.allow_declaration_reuse column as nullable in an initial, small
transaction. we will backfill it with defaults later to minimize table locking time.
Revision ID: 1290
Revises: 1280
Create Date: 2019-06-10 17:00:02.464675
"""
from alembic import op
i... | alphagov/digitalmarketplace-api | migrations/versions/1290_sf_allow_declaration_reuse_add_column.py | Python | mit | 747 |
from core.mixins import XMLFromJSONView
from .views_api_json import UserListJSON, UserDetailJSON
class UserListXML(XMLFromJSONView, UserListJSON):
pass
class UserDetailXML(XMLFromJSONView, UserDetailJSON):
pass
| lotube/lotube | lotube/users/views_api_xml.py | Python | mit | 223 |
"""CMS apphook for the django-outlets app."""
from django.utils.translation import ugettext_lazy as _
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from . import menu
class OutletsApphook(CMSApp):
name = _("Outlets Apphook")
urls = ["outlets.urls"]
menus = [menu.OutletsMenu]
... | bitmazk/cmsplugin-django-outlets | cmsplugin_outlets/cms_app.py | Python | mit | 360 |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import ast
import platform
import sys
import traceback
from typing import Optional
from typing import Sequence
def main(argv=None): # type: (Optional[Sequence[str]]) -> int
parser... | Harwood/pre-commit-hooks | pre_commit_hooks/check_ast.py | Python | mit | 1,030 |
#!/usr/bin/env python
# ./postit.py http://localhost:5000/db/loadpost users fixtures/users.txt
# alternately, if you are running locally, visit
# http://localhost:5000/db/loadfixture/users/users.txt
# to drop the db go to
# http://localhost:5000/db/drop
# to show the db go to
# http://localhost:5000/db/show
import... | ejconlon/iwantaride | postit.py | Python | mit | 1,204 |
"""
Any operations to make img from img.
python celltk/preprocess.py -f gaussian_laplace -i c0/img_00000000*
"""
# from scipy.ndimage import imread
import argparse
from utils.file_io import make_dirs, imsave
from utils.util import imread
from utils.parser import ParamParser, parse_image_files
import logging
from uti... | braysia/CellTK | celltk/preprocess.py | Python | mit | 1,780 |
import poet
if __name__ == '__main__':
roger.tool.main()
| talbor49/Poet | web/__main__.py | Python | mit | 62 |
from .layer import Layer
from ..activation import Activation
import numpy as np
class Particle2Dipole(object):
"""
Dipole approximated as 2 coupled charges of equal magnitude, uncoupled
"""
def __init__(self, input_size=0, output_size=0, activation="sigmoid", k_bond=1.0, k_eq=0.1, s=1.0, cut=10.0,
... | awlange/brainsparks | src/calrissian/layers/particle2_dipole.py | Python | mit | 4,517 |
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from fluent_contents.models import ContentItem
from icekit.models import ICEkitFluentContentsMixin
from icekit.managers import... | ic-labs/django-icekit | icekit/plugins/location/models.py | Python | mit | 1,493 |
# Copyright (c) 2010 Mark Sandstrom
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, dis... | dnerdy/django-reroute | reroute/verbs.py | Python | mit | 4,764 |
import uuid
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.db import transaction
from asgiref.sync import async_to_sync
from channels.layers import get_channel_layer
class MessageQueryS... | vitorfs/bootcamp | bootcamp/messager/models.py | Python | mit | 3,617 |
import copy
import json
import os
import warnings
from enum import Enum
from typing import Any, Callable, Dict, List, Optional, Tuple
import gevent
import structlog
from eth_utils import (
decode_hex,
encode_hex,
is_checksum_address,
remove_0x_prefix,
to_canonical_address,
to_checksum_address,
... | hackaugusto/raiden | raiden/network/rpc/client.py | Python | mit | 34,000 |
#This program takes a raster image and produces its raster halftone using patterning algorithm.
"""
For each possible value in the image, we create and display a pattern of
pixels that approximates that value. Remembering the concept of spatial integration,
if we choose the appropriate patterns we can simulate the ap... | abhishek-sehgal954/SVG_Digital_Halftoning | patterning_algorithm/patterning_clustered_dot.py | Python | mit | 5,365 |
"""
This module manages the interface between webpack and Django.
It loads webpack bundle tracker stats files, and catalogues the different files
that need to be served in order to inject that frontend code into a Django template.
Originally, it was a monkeypatch of django-webpack-loader - but as our needs are somewhat... | MCGallaspy/kolibri | kolibri/core/webpack/utils.py | Python | mit | 1,718 |
# Accelerator for pip, the Python package manager.
#
# Author: Peter Odding <peter.odding@paylogic.com>
# Last Change: October 31, 2015
# URL: https://github.com/paylogic/pip-accel
"""
Support for multiple cache backends.
This module defines an abstract base class (:class:`AbstractCacheBackend`)
to be inherited by cu... | matysek/pip-accel | pip_accel/caches/__init__.py | Python | mit | 8,425 |
import xmltodict
import sys
src_file_name = sys.argv[1]
with open(src_file_name, 'r') as f:
data = xmltodict.parse(f.read(), dict_constructor=dict)
for entry in data['d:dictionary']['d:entry']:
emoji = ''
name = ''
if entry['@id'] != 'version':
for index in entry['d:index']:
if '@... | ensigma96/rime-emoji_s | src/converter/emojipedia.py | Python | mit | 513 |
from django.views import generic
class HomePage(generic.TemplateView):
template_name = "home.html"
class AboutPage(generic.TemplateView):
template_name = "about.html"
class GBNC(generic.TemplateView):
template_name = "menug.html"
| deeptir96/my_proj | src/my_proj/views.py | Python | mit | 248 |
import re
import six
from hashlib import sha1
from unidecode import unidecode
import normality
COLLAPSE = re.compile(r'\s+')
def transliterate(text):
""" Utility to properly transliterate text. """
text = unidecode(six.text_type(text))
text = text.replace('@', 'a')
return text
def coalesce(mapping... | pudo/jsonmapping | jsonmapping/transforms.py | Python | mit | 2,402 |
# -*- coding: utf-8 -*-
import pygame
from pygame.locals import *
import sys
class game:
def __init__(self, title, winSize = (800, 600), renderFps = 60, ogl = True, fs = True):
pygame.init()
self.calcClock = pygame.time.Clock()
self.renderClock = pygame.time.Clock()
pygame.disp... | evensource/fountain | gamesys.py | Python | mit | 1,427 |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... | onshape-public/onshape-clients | python/onshape_client/oas/models/bt_feature_filter127.py | Python | mit | 7,271 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from unittest import TestLoader, TextTestRunner, TestSuite
from hwt.simulator.simTestCase import SimTestCase
from hwtLib.abstract.busEndpoint_test import BusEndpointTC
from hwtLib.abstract.frame_utils.alignment_utils_test import FrameAlignmentUtilsTC
from hwtL... | Nic30/hwtLib | hwtLib/tests/all.py | Python | mit | 22,367 |
# -*- coding: utf-8 -*-
import logging
from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver
from .models import Student
@receiver(post_save, sender=Student)
def log_student_updated_added_event(sender, **kwargs):
"""Writes info about updated or newly added student into... | hddn/studentsdb | students/signals.py | Python | mit | 1,010 |
from config import Config
from models.usuario import Usuario
class Administrador:
tabla = "administradores"
def __init__(self, identificador):
self.id = identificador
self.privilegios = Usuario.getTipo(self.id)
'''
#actualizar (se puede actualizar un administrador actualizando como usuario)
def save(self):
... | carojasq/Evaluaciones-bases-de-datos-2 | models/administrador.py | Python | mit | 3,310 |
import argparse
import hashlib
import json
import requests
from pprint import pprint
class Colors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
class TestCase:
def __in... | RohanNagar/lightning | scripts/tester.py | Python | mit | 5,735 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from indico.modules.admin.views import WPAdmin
class WPAnnounce... | mic4ael/indico | indico/modules/announcement/views.py | Python | mit | 373 |
import pytest
from openff.toolkit.typing.chemistry import *
from openff.toolkit.utils.toolkits import OPENEYE_AVAILABLE
# TODO: Evaluate which tests in this file should be moved to test_toolkits
toolkits = []
if OPENEYE_AVAILABLE:
from openff.toolkit.utils.toolkits import OpenEyeToolkitWrapper, RDKitToolkitWrappe... | open-forcefield-group/openforcefield | openff/toolkit/tests/test_chemicalenvironment.py | Python | mit | 7,356 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# The MIT License (MIT)
# Copyright (c) 2015 Findspire
from django.conf.urls import patterns, url
from workflow.apps.workflow import views
urlpatterns = patterns('workflow.apps.workflow',
url(r'^$', 'views.index', name='index'),
url(r'^project/new/$', views.proj... | Findspire/workflow | workflow/apps/workflow/urls.py | Python | mit | 2,979 |
"""PS Move Restful Server
Usage:
server.py [--battery-saver]
Options:
--battery_saver If set, only allows a few seconds without a GET request before shutting off a controllers LEDs and rumble
"""
from docopt import docopt
import datetime
import time
from threading import Thread
from flask import Flask
from flas... | evanbrumley/psmove-restful | server.py | Python | mit | 3,841 |
import os
SCRIPT_PATH = os.path.dirname(__file__)
class Lua:
def __init__(self, redis):
self.redis = redis
scripts = filter(lambda s: s.endswith('.lua'), os.listdir(SCRIPT_PATH))
for scriptname in scripts:
with open(os.path.join(SCRIPT_PATH, scriptname)) as script:
... | getfleety/coralillo | coralillo/lua/__init__.py | Python | mit | 512 |
import re
import abc
import warnings
import collections
from functools import partial
from bridgy.error import MissingBastionHost
with warnings.catch_warnings():
# Thiw warns about using the slow implementation of SequenceMatcher
# instead of the python-Levenshtein module, which requires compilation.
# I'... | wagoodman/bridgy | bridgy/inventory/source.py | Python | mit | 6,467 |
# -*- coding: utf-8 -*-
#
# n98-magerun Documentation documentation build configuration file, created by
# sphinx-quickstart on Sun Oct 13 14:28:54 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogener... | netz98/n98-magerun-doc | docs/languages/en/conf.py | Python | mit | 8,208 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import atados_core.models.uploads
import django_resized.forms
class Migration(migrations.Migration):
dependencies = [
('atados_core', '0053_auto_20160728_1309'),
]
operations = [
mig... | atados/api | atados_core/migrations/0054_auto_20160731_1811.py | Python | mit | 1,722 |
import re
class Parser:
''' The Parser class represents a parser that parses text using specified
markup. Once the parser parses the text, HTML is generated as output.
'''
def __init__(self):
self.written_text = ''
self.remaining_text = ''
self.markup = { 'h1': '^[#]{1}(\s*)',
... | nerith/scribe | scribe/parser.py | Python | mit | 4,538 |
from rest_framework.decorators import api_view, parser_classes
from rest_framework.parsers import JSONParser, FormParser, MultiPartParser
from rest_framework.response import Response
from .serializers import *
import json
from urllib.parse import urlencode
from urllib.request import urlopen, Request
from urllib.error i... | stlim0730/glide | api/views.py | Python | mit | 35,037 |
from django.conf.urls.defaults import *
from california.views import *
urlpatterns = patterns('',
url(r'^counties/$', counties, name='counties'),
url(r'^places/$', places, name='places'),
url(r'^complex-county/$', complex_county, name='complex-county'),
url(r'^tiles-county/$', tiles_county, name='tile... | evz/demo | map_demo/california/urls.py | Python | mit | 445 |
#!/usr/bin/env python
from agate.aggregations.has_nulls import HasNulls
from agate.computations.base import Computation
from agate.data_types import Date, DateTime, Number, TimeDelta
from agate.exceptions import DataTypeError
from agate.warns import warn_null_calculation
class Change(Computation):
"""
Calcul... | onyxfish/agate | agate/computations/change.py | Python | mit | 2,638 |
'''
grayscottmodel.py: simulate Gray Scott model of reaction diffusion
'''
| MusicVisualizationUMass/TeamNameGenerator | src/musicvisualizer/pipeline/models/grayscottmodel.py | Python | mit | 75 |
import hmac,uuid
import time, struct, string
from base64 import b64encode, b64decode
from hashlib import sha1
NCT = 25 # Network Coherency Time in seconds
class CookieException(Exception):
pass
class CookieDescriptor(object):
def __init__(self, id=None, key=None):
self.id = id
self.key = key
... | yiannisy/network-cookies | lib/cookies.py | Python | mit | 6,064 |
# stdlib imports
import logging
# local imports
from stretch import config
def test_get_local_debug(monkeypatch):
monkeypatch.setenv('LOCAL_DEBUG', 'true')
assert config.get_local_debug()
def test_get_local_debug_not_set():
assert not config.get_local_debug()
def test_get_log_level(monkeypatch):
... | paddycarey/stretch | tests/stretch/test_config.py | Python | mit | 1,338 |
# -*- coding: utf-8 -*-
"""
@author: Kirill Python
@contact: https://vk.com/python273
@license Apache License, Version 2.0, see LICENSE file
Copyright (C) 2016
"""
try:
import simplejson as json
except ImportError:
import json
def search_re(reg, string):
""" Поиск по регулярке """
s = reg.search(st... | curly-brace/VkCheckerPy | vk_api/utils.py | Python | mit | 1,122 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | rjschwei/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/models/virtual_machine_scale_set_data_disk.py | Python | mit | 2,382 |
import numpy as np
from point import Point
from .fx import Fx
from .midi_event import MidiEvent
def make_key(note, channel):
return "{}-{}".format(note, channel)
colors = [
(.8, .2, .1),
(.3, .8, .3),
(.7, .2, .8),
(.1, .2, .3),
(.9, .2, .4),
(.8, .6, .1),
(.9, .2, .1),
(.5, .0,... | jsheedy/neopixel-framebuffer | fx/midi_note.py | Python | mit | 2,048 |
import log
import taglistener
import settings
if __name__ == '__main__':
try:
import time
logger = log.get_logger(__name__)
listener = taglistener.TagListener()
print('Started listening for {}'.format(settings.TAGS))
print('Press CTRL+C to exit. It may take a minute or t... | AAT-SP2017/tweet-miner | tweet-miner/main.py | Python | mit | 684 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('profiles', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='t... | pavelkuchin/tracktrains | profiles/migrations/0002_auto_20150509_1528.py | Python | mit | 982 |
x = raw_input(" Take your wand out:")
y = raw_input(" You're a wizard youngone: ")
z = raw_input(" Please come with me and become a wizard: ")
p = raw_input(" No, I am not a liar: " )
print str(x) + " and repeat " + str(y) + "I have never seen such potential in such a young boy" + str(z) + "Young one, you will be taken... | bruno1951/bruno1951-cmis-cs2 | play.py | Python | cc0-1.0 | 414 |
from contextlib import contextmanager
import os
import threading
import time
import pytest
from tests_python import debugger_unittest
from tests_python.debugger_unittest import get_free_port, overrides, IS_CPYTHON, IS_JYTHON, IS_IRONPYTHON, \
IS_PY3K
import sys
def get_java_location():
from java.lang impor... | Elizaveta239/PyDev.Debugger | tests_python/debugger_fixtures.py | Python | epl-1.0 | 14,176 |
# *****************************************************************************
# Copyright (c) 2016 TechBubble Technologies and other Contributors.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distr... | AdamMiltonBarker/TechBubble-Iot-JumpWay-Python-MQTT | src/techbubbleiotjumpwaymqtt/device.py | Python | epl-1.0 | 6,911 |
#!/usr/bin/python
import os
import shutil
import subprocess
import urllib2
OUTPUT = 'ij-latest.zip'
OUTPUT_BASEDIR = 'ImageJ'
OUTPUT_JAR = os.path.join(OUTPUT_BASEDIR, 'ij.jar')
URL = 'http://rsb.info.nih.gov/ij/'
ZIPS = URL + 'download/zips/'
JARS = URL + 'download/jars/'
VERSION_LIST = JARS + 'list.txt'
UPGRADE_JA... | cmusatyalab/imagejfind | get-latest-imagej.py | Python | epl-1.0 | 1,202 |
import sys
import signal
from threading import Thread
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
class PUTHandler(BaseHTTPRequestHandler):
def do_PUT(self):
print "----- SOMETHING WAS PUT!! ------"
print self.headers
length = int(self.headers['Content-Length'])
co... | fp7-netide/Tools | traffem/apps/http/serverPUT.py | Python | epl-1.0 | 819 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2015, 2016 CERN.
#
# Zenodo is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any l... | tiborsimko/zenodo | docs/conf.py | Python | gpl-2.0 | 10,857 |
from django.db import models
from instruments.base import BaseTable
class French_Quebecois_WG(BaseTable):
item_1_choices = [('understands', 'understands'), ('produces', 'produces')]
item_1 = models.CharField(max_length=11, choices=item_1_choices, null=True)
item_2_choices = [('understands', 'understands')... | langcog/wordbank | instruments/schemas/French_Quebecois_WG.py | Python | gpl-2.0 | 67,512 |
#
# PyNestML.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any lat... | kperun/nestml | PyNestML.py | Python | gpl-2.0 | 881 |
from tornado.web import RequestHandler
from homeweb.util import apply_template, write_return
class ChessBoardHandler(RequestHandler):
@write_return
@apply_template("demos/chess.html")
def get(self):
return {}
| fsufitch/homeweb | src/homeweb/handlers/demos/chess.py | Python | gpl-2.0 | 231 |
# -*- coding: UTF-8 -*-
#######################################################################
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# @tantrumdev wrote this file. As long as you retain this notice you
# can do whatever you want wit... | repotvsupertuga/tvsupertuga.repository | script.module.streamtvsupertuga/lib/resources/lib/sources/en/ultrahd.py | Python | gpl-2.0 | 6,083 |
#!/usr/bin/env python
def run(c, *channels):
server = c['MainWindow'].ui_plugins['ServerList'].active_server
connection = c['MainWindow'].ui_plugins['ServerList'].servers[server]['connection']
if isinstance(channels, str):
channels = [channels]
for channel in channels:
if channel.start... | Sjc1000/PyRC | Commands/join.py | Python | gpl-2.0 | 505 |
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# *************************************... | dayongxie/zeroc-ice-androidndk | js/allTests.py | Python | gpl-2.0 | 1,643 |
from selenium import webdriver
import unittest
class NewVisitorTest(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
self.browser.implicitly_wait(3)
def tearDown(self):
# Fulan closes his browser
self.browser.quit()
def test_can_start_a_form_and_re... | CodeForKuwait/reForm | reForm/functional_tests.py | Python | gpl-2.0 | 727 |
VERSION = 1
NAME = _("Slow")
DESCRIPTION = _("Decreases the speed of a unit.")
ABILITY_TYPE = ACTION
COST = 5
TARGET_TYPE = HOSTILE
RANGE = Diamond(1, 5, 16)
AOE = Single()
EFFECTS = [Status(Status.SLOW, power=1.0, hit=0.5, duration=5)]
| jemofthewest/GalaxyMage | data/core/abilities/slow.py | Python | gpl-2.0 | 246 |
import datetime, time
from src import ModuleManager, utils
TIMESTAMP_BOUNDS = [
[0, 59],
[0, 23],
[1, 31],
[1, 12],
[0, 6],
]
class Module(ModuleManager.BaseModule):
def on_load(self):
now = datetime.datetime.utcnow()
next_minute = now.replace(second=0, microsecond=0)
n... | jesopo/bitbot | src/core_modules/cron.py | Python | gpl-2.0 | 2,510 |
#!/usr/bin/env python
# this scripts runs everything on the bnl cluster
import os
import sys
from wqdriver import wqsubmit
if len(sys.argv) > 1:
lst = sys.argv[1:]
else:
lst = ['TakadaFlat']
for l in lst:
if l == 'TakadaFlat':
wqsubmit('pre', 'PolyOk', 'BBAO+SN', 5, 30000)
wqsubmit('pre'... | slosar/april | Run/wqdriver_eboss.py | Python | gpl-2.0 | 410 |
from __future__ import division
from sys import stdin, stdout
from collections import deque
def solve(n, edges, s):
def build_graph(n, edges):
graph = [[] for _ in range(n)]
for (a, b) in edges:
a, b = a - 1, b - 1
graph[a].append(b)
graph[b].append(a)
re... | m00nlight/hackerrank | algorithm/Graph-Theory/Breadth-First-Search-Shortest-Reach/main.py | Python | gpl-2.0 | 1,017 |
bot_user = 'U041TJU13'
irc_channel = 'C040NNZHT'
outputs = []
def process_message(data):
message_text = data.get('text')
if message_text:
if (bot_user in message_text) and ('source' in message_text):
outputs.append([irc_channel, '`https://github.com/paulnurkkala/comm-slackbot`'])
| paulnurkkala/comm-slackbot | plugins/get_source/get_source.py | Python | gpl-2.0 | 297 |
#!/usr/bin/python3
import sys
from optparse import OptionParser
import os
import zlib
import math
class Unbuffered(object):
def __init__(self, stream):
self.stream = stream
def write(self, data):
self.stream.write(data)
self.stream.flush()
def __getattr__(self, attr):
re... | Nemo112/brainf | bl2co.py | Python | gpl-2.0 | 11,003 |
def autoretry_datastore_timeouts(attempts=5.0, interval=0.1, exponent=2.0):
"""
Copyright (C) 2009 twitter.com/rcb
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
... | trosa/forca | gluon/contrib/gae_retry.py | Python | gpl-2.0 | 3,596 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
r_li_mps.py
-----------
Date : February 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : medspx at medspx dot fr
************************************... | alexbruy/QGIS | python/plugins/processing/algs/grass7/ext/r_li_mps.py | Python | gpl-2.0 | 1,280 |
"""
Python utility package for Zernike polynomials
This utility package supplies Zernike terms and derivatives.
"""
# Python utility package for Zernike polynomials
from __future__ import absolute_import
import Obit
from six.moves import range
# $Id$
#------------------------------------------------------------------... | kernsuite-debian/obit | python/ZernikeUtil.py | Python | gpl-2.0 | 4,098 |
#!/usr/bin/env python
import configuration
import login_manager
import event_repository
import guest_repository
import attendance_repository
class Model(object):
def __init__(self, configFile):
self.config = configuration.Configuration(configFile)
if(self.config.getProperty("mock_db") == "1"):
... | dario-ramos/tp3_cloud-events | src/model/model.py | Python | gpl-2.0 | 960 |
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
led = 19
GPIO.setup(led, GPIO.OUT)
x = 20
while x > 0:
GPIO.output(led, 1)
time.sleep(0.2)
GPIO.output(led, 0)
time.sleep(0.2)
x = x - 1
GPIO.cleanup()
| SerjDDD/ArcadeMachine | gpio/led.py | Python | gpl-2.0 | 246 |
__author__ = 'sjp1'
import math
CONVERT_TO_MILLI = 1e3
CONVERT_M_TO_CM = 1e2
print('Circuit:')
voltage = 5 # V
print('Voltage source:', voltage)
resistor = 50 # ohm
print('Resistor:', resistor)
I = voltage / resistor # A
print('Current:', I, 'C/s')
q = 1.602e-19 # C
print('Charge on electron:', q, 'C')
electron_per_... | JediStuart/PythonFirst | src/ElectronMass.py | Python | gpl-2.0 | 4,226 |
#!/usr/bin/env python
"""
Copyright [2016] [Mark Petschek mark@petschek.com]
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any la... | czechmark/neurioToCSV | neurioToCSV.py | Python | gpl-2.0 | 4,657 |