code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
import utils
from flask import render_template, redirect, request, session, url_for, json, jsonify
from . import murmurbp
from .User import User
# User Views
@murmurbp.route("/users", methods = ['GET'])
def get_all_users():
u = User()
ul = utils.obj_to_dict(u.get_all())
data = [{'UserId': k, 'UserName': v... | aqisnotliquid/minder2 | app/murmur/views.py | Python | mit | 2,492 |
from collections import OrderedDict
import astropy.coordinates as coord
import astropy.units as u
import matplotlib.pyplot as plt
#import mpl_toolkits.basemap as bm
import numpy as np
import spherical_geometry.polygon as sp
from astropy.table import Table
import astropy.time as time
from .gbm_detector import BGO0, BG... | drJfunk/gbmgeometry | gbmgeometry/gbm.py | Python | mit | 10,575 |
from django.db import models
from django.template.defaultfilters import truncatechars
class Setting(models.Model):
name = models.CharField(max_length=100, unique=True, db_index=True)
value = models.TextField(blank=True, default='')
value_type = models.CharField(max_length=1, choices=(('s', 'string'), ('i'... | moodpulse/l2 | appconf/models.py | Python | mit | 902 |
# run scripts/jobslave-nodatabase.py
import os
os.environ["SEAMLESS_COMMUNION_ID"] = "simple-remote"
os.environ["SEAMLESS_COMMUNION_INCOMING"] = "localhost:8602"
import seamless
seamless.set_ncores(0)
from seamless import communion_server
communion_server.configure_master(
buffer=True,
transformation_job=Tru... | sjdv1982/seamless | tests/lowlevel/simple-remote.py | Python | mit | 1,438 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import os
import sys
import re
from setuptools import setup
if sys.argv[-1] == "publish":
os.system("python setup.py sdist upload")
sys.exit()
packages = [
"the_big_username_blacklist"
]
# Handle requirements
install_requires = []
tests_requires... | marteinn/The-Big-Username-Blacklist-Python | setup.py | Python | mit | 1,848 |
#-*- coding: utf-8 -*-
""" This script contains the abstract animation object that must be implemented
by all animation extension.
"""
class AbstractAnimation(object):
""" An abstract animation that defines method(s) that must be implemented
by animation extensions.
"""
def __init__(self, drive... | juliendelplanque/lcddaemon | animations/abstractanimation.py | Python | mit | 814 |
#!/usr/bin/python
# Author: Jon Trulson <jtrulson@ics.com>
# Copyright (c) 2016 Intel Corporation.
#
# 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 l... | andreivasiliu2211/upm | examples/python/bmp280.py | Python | mit | 2,069 |
from django.db.backends import BaseDatabaseIntrospection
class DatabaseIntrospection(BaseDatabaseIntrospection):
def get_table_list(self, cursor):
"Returns a list of table names in the current database."
cursor.execute("SHOW TABLES")
return [row[0] for row in cursor.fetchall()]
| ikeikeikeike/django-impala-backend | impala/introspection.py | Python | mit | 310 |
import csv
import loremipsum
import random
import re
from encoded.loadxl import *
class Anonymizer(object):
"""Change email addresses and names consistently
"""
# From Colander. Not exhaustive, will not match .museum etc.
email_re = re.compile(r'(?i)[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}')
random... | ENCODE-DCC/encoded | src/encoded/commands/extract_test_data.py | Python | mit | 4,920 |
from cast.analysers import log, mainframe
class EmptyParagraphEndOfSection(mainframe.Extension):
def __init__(self):
self.program = None
def start_program(self, program):
self.program = program
def end_program(self, _):
self.program = None
def start_section(self... | CAST-projects/Extension-SDK | samples/analyzer_level/mainframe/mainframe.quality_rule/empty_paragraph_end.py | Python | mit | 1,192 |
# -*- coding: utf-8 -*-
"""This module contains some functions for EM analysis.
"""
__author__ = 'Wenzhi Mao'
__all__ = ['genPvalue', 'calcPcutoff', 'showPcutoff', 'transCylinder',
'showMRCConnection', 'showMRCConnectionEach', 'gaussian3D']
def interpolationball(matrix, index, step, r, **kwargs):
"""I... | wzmao/mbio | mbio/EM/analysis.py | Python | mit | 39,422 |
# Link: https://leetcode.com/problems/longest-common-prefix/
class Solution:
# @param {string[]} strs
# @return {string}
def longestCommonPrefix(self, strs):
if not len(strs):
return ''
if len(strs) == 1:
return strs[0]
ret = []
for i in range(0, len(... | ibigbug/leetcode | longest-common-prefix.py | Python | mit | 542 |
from __future__ import absolute_import
import numpy as np
from keras import backend as K
from .utils import utils
def negate(grads):
"""Negates the gradients.
Args:
grads: A numpy array of grads to use.
Returns:
The negated gradients.
"""
return -grads
def absolute(grads):
... | raghakot/keras-vis | vis/grad_modifiers.py | Python | mit | 1,247 |
import parser
import logging
def test(code):
log = logging.getLogger()
parser.parser.parse(code, tracking=True)
print "Programa con 1 var y 1 asignacion bien: "
s = "program id; var beto: int; { id = 1234; }"
test(s)
print "Original: \n{0}".format(s)
print "\n"
print "Programa con 1 var mal: "
s = "program ;... | betoesquivel/PLYpractice | testingParser.py | Python | mit | 1,412 |
# -*- coding: utf-8 -*-
#
# CoderDojo Twin Cities Python for Minecraft documentation build configuration file, created by
# sphinx-quickstart on Fri Oct 24 00:52:04 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present ... | CoderDojoTC/python-minecraft | docs/conf.py | Python | mit | 8,611 |
# -*- coding: utf-8 -*-
import unittest
from wechatpy.constants import WeChatErrorCode
class WeChatErrorCodeTestCase(unittest.TestCase):
"""ensure python compatibility"""
def test_error_code(self):
self.assertEqual(-1000, WeChatErrorCode.SYSTEM_ERROR.value)
self.assertEqual(42001, WeChatErro... | wechatpy/wechatpy | tests/test_constants.py | Python | mit | 527 |
from pudzu.charts import *
from pudzu.sandbox.bamboo import *
flags = pd.read_csv("../dataviz/datasets/countries.csv").filter_rows("organisations >> un").split_columns('country', "|").split_rows('country').set_index('country').drop_duplicates(subset='flag', keep='first')
def flag_image(c):
return Image.from_url_w... | Udzu/pudzu | photosets/averageflags.py | Python | mit | 3,300 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from rcr.robots.dagucar.DaguCar import DaguCar
def main():
car = DaguCar( "/dev/rfcomm1", 500 )
car.MoveForward( 15 )
car.Pause( 1000 )
car.MoveBackward( 15 )
car.Pause( 1000 )
car.MoveLeft( 15 )
car.Pause( 1000 )
car.MoveRight( 15 )
ca... | titos-carrasco/DaguCar | Python/TestDaguCar.py | Python | mit | 591 |
from django.conf.urls import url
from cats.views.cat import (
CatList,
CatDetail
)
from cats.views.breed import (
BreedList,
BreedDetail
)
urlpatterns = [
# Cats URL's
url(r'^cats/$', CatList.as_view(), name='list'),
url(r'^cats/(?P<pk>\d+)/$', CatDetail.as_view(), name='detail'),
# Bre... | OscaRoa/api-cats | cats/urls.py | Python | mit | 475 |
import os
import sys
import yaml
from etllib.conf import Conf
from etllib.yaml_helper import YAMLHelper
from plugins import PluginEngine
class RulesEngine(list):
def __init__(self):
self.rules_path = os.path.dirname(os.path.realpath(__file__))
self.conf = Conf()
self.load()
self.f... | gr33ndata/rivellino | ruleset/__init__.py | Python | mit | 4,470 |
import py
from rpython.rlib.signature import signature, finishsigs, FieldSpec, ClassSpec
from rpython.rlib import types
from rpython.annotator import model
from rpython.rtyper.llannotation import SomePtr
from rpython.annotator.signature import SignatureError
from rpython.translator.translator import TranslationContext,... | oblique-labs/pyVM | rpython/rlib/test/test_signature.py | Python | mit | 10,192 |
from fabric.api import task, local, run
from fabric.context_managers import lcd
import settings
@task(default=True)
def build():
"""
(Default) Build Sphinx HTML documentation
"""
with lcd('docs'):
local('make html')
@task()
def deploy():
"""
Upload docs to server
"""
build()
... | brady-vitrano/full-stack-django-kit | fabfile/docs.py | Python | mit | 877 |
import threading
import upnp
import nupnp
class DiscoveryThread(threading.Thread):
def __init__(self, bridges):
super(DiscoveryThread, self).__init__()
self.bridges = bridges
self.upnp_thread = upnp.UPnPDiscoveryThread(self.bridges)
self.nupnp_thread = nupnp.NUPnPDiscoveryThread(... | mpolednik/reddit-button-hue | app/discovery/bridges.py | Python | mit | 649 |
"""
This module is responsible for doing all the authentication.
Adapted from the Google API Documentation.
"""
from __future__ import print_function
import os
import httplib2
import apiclient
import oauth2client
try:
import argparse
flags = argparse.ArgumentParser(
parents=[oauth2client.tools.argpar... | Anmol-Singh-Jaggi/gDrive-auto-sync | gDrive-auto-sync/api_boilerplate.py | Python | mit | 1,850 |
import numpy as np
import pandas as pd
from ElectionsTools.Seats_assignation import DHondt_assignation
from previous_elections_spain_parser import *
import os
pathfiles = '../data/spain_previous_elections_results/provincia/'
pathfiles = '/'.join(os.path.realpath(__file__).split('/')[:-1]+[pathfiles])
fles = [pathfil... | tgquintela/ElectionsTools | ElectionsTools/cases/previous_elections_spain_analysis.py | Python | mit | 2,527 |
from django.utils.translation import ugettext_lazy as _
# Legend Position
def get_legend_class(position):
return 'legend-' + str(position)
class LEGEND_POSITIONS:
BOTTOM = _('bottom')
TOP = _('top')
LEFT = _('left')
RIGHT = _('right')
get_choices = ((get_legend_class(BOTTOM), BOTTOM),
... | mcldev/DjangoCMS_Charts | djangocms_charts/base/consts.py | Python | mit | 824 |
from enum import Enum
from typing import List, Union
import logging
import math
try:
from flask_babel import _
except ModuleNotFoundError:
pass
class VehicleType(Enum):
CAR = 1
TRUCK_UPTO_4 = 2
PICKUP_UPTO_4 = 3
TRUCK_4_TO_10 = 4
TRUCK_12_TO_16 = 5
TRUCK_16_TO_34 = 6
TRUCK_ABOVE_3... | hasadna/anyway | anyway/vehicle_type.py | Python | mit | 7,301 |
#!/usr/bin/env python
def get_secret_for_user(user, ipparam):
print("Looking up user %s with ipparam %s" % (user, ipparam))
return "user_secret"
def allowed_address_hook(ip):
return True
def chap_check_hook():
return True
def ip_up_notifier(ifname, localip, remoteip):
print("ip_up_notifier")
de... | metricube/pppd_pyhook | hooks.py | Python | mit | 495 |
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 5, 0.1)
y = np.sin(x)
plt.plot(x, y)
plt.show() | kantel/python-schulung | sources/hallowelt/hallomatplotlib01.py | Python | mit | 117 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons 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 restriction, including
# without limitation the rights to us... | EmanueleCannizzaro/scons | test/Configure/ConfigureDryRunError.py | Python | mit | 3,514 |
# -*- coding: utf-8 -*-
# Copyright © 2012-2016 Roberto Alsina and others.
# 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... | wcmckee/nikola | nikola/plugins/compile/rest/listing.py | Python | mit | 7,496 |
""" Python expresses functional and modular scope for variables.
"""
# Global to the module, not global in the builtin sense.
x = 5
def f1():
"""If not local, reference global.
"""
return x
def f2():
"""Local references global.
"""
global x
x = 3
return x
# Should print 5.
print f1(... | jeremyosborne/python | scope/scope.py | Python | mit | 548 |
#!/usr/bin/env python3
# python setup.py sdist --format=zip,gztar
from setuptools import setup
import os
import sys
import platform
import imp
import argparse
version = imp.load_source('version', 'lib/version.py')
if sys.version_info[:3] < (3, 4, 0):
sys.exit("Error: Electrum requires Python version >= 3.4.0...... | digitalbitbox/electrum | setup.py | Python | mit | 2,673 |
from django.conf.urls.defaults import patterns, url
from django.contrib.auth.decorators import login_required
from views import PollDetailView, PollListView, PollVoteView
urlpatterns = patterns('',
url(r'^$', PollListView.as_view(), name='list'),
url(r'^(?P<pk>\d+)/$', PollDetailView.as_view(), name='detail'... | Mercy-Nekesa/sokoapp | sokoapp/polls/urls.py | Python | mit | 411 |
from django.db import transaction
from .base import BaseForm
from .composite import CompositeForm
from .formset import FormSet
class BaseModelForm(BaseForm):
def save(self, commit=True):
retval = []
with transaction.atomic():
for form in self._subforms:
if form.empty_p... | lovasb/django-smart-forms | smartforms/models.py | Python | mit | 1,341 |
HTBRootQdisc = """\
tc qdisc add dev {interface!s} root handle 1: \
htb default {default_class!s}\
"""
HTBQdisc = """\
tc qdisc add dev {interface!s} parent {parent!s} handle {handle!s} \
htb default {default_class!s}\
"""
NetemDelayQdisc = """\
tc qdisc add dev {interface!s} parent {parent!s} handle {handle!s} \
ne... | praus/shapy | shapy/framework/commands/qdisc.py | Python | mit | 537 |
from flask import request, abort, session
from functools import wraps
import logging
import urllib.request as urllib2
import numpy as np
import cv2
import random
from annotator_supreme.views import error_views
from io import StringIO
from PIL import Image
from annotator_supreme import app
import os
import base64
def r... | meerkat-cv/annotator-supreme | annotator_supreme/views/view_tools.py | Python | mit | 5,904 |
# by Art FY Poon, 2012
# modified by Rosemary McCloskey, 2014
from Bio import Phylo
from numpy import zeros
import math
import multiprocessing as mp
class PhyloKernel:
def __init__(self,
kmat=None,
rotate='ladder',
rotate2='none',
subtree=False,
... | sdwfrost/pangea-round2 | villagetraining/phyloK2.py | Python | mit | 8,205 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import List
import torch
from torch import nn
from fairseq.modules.quant_noise import quant_noise
class AdaptiveInput(nn.Modu... | pytorch/fairseq | fairseq/modules/adaptive_input.py | Python | mit | 2,565 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import argparse
import numpy
import math
class Image:
def __init__(self, matrix=[[]], width=0, height=0, depth=0):
self.matrix = matrix
self.width = width
self.height = height
self.depth = depth
def set_width_and_height(self, width, height):
self.w... | stollcri/Research-Matrices | pgm/svd-pgm-avg.py | Python | mit | 8,300 |
"""Tests for mongodb backend
Authors:
* Min RK
"""
#-------------------------------------------------------------------------
# Copyright (C) 2011 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.
#--... | mattvonrocketstein/smash | smashlib/ipy3x/parallel/tests/test_mongodb.py | Python | mit | 1,544 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def ExtendedElementDescription(vim, *args, **kwargs):
''''''
obj = vim.client.fa... | xuru/pyvisdk | pyvisdk/do/extended_element_description.py | Python | mit | 1,021 |
#!/usr/bin/env python3
#coding:utf-8
__author__ = 'zhuzhezhe'
'''
功能实现:命令行下发布微博,获取最新微博
'''
from weibo import Client
import getopt
import sys
import configparser
versions = '0.1.5'
# 写入用户数据
def write_data(uname, pwd):
conf = configparser.ConfigParser()
conf['LOGIN'] = {}
conf['LOGIN']['username'] = uname... | zhuzhezhe/weibobash | weibo_bash/weibo_bash.py | Python | mit | 2,831 |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the MIT license. See the LICENSE file for details.
"""
import logging
def setup_logging(name="cct", level=logging.DEBUG):
# create logger
logger = logging.getLogger(name)
logger.hand... | goldmann/cct | cct/__init__.py | Python | mit | 696 |
from datetime import datetime
import structlog
from flask import Blueprint, request
from conditional.util.ldap import ldap_get_intro_members
from conditional.models.models import FreshmanCommitteeAttendance
from conditional.models.models import CommitteeMeeting
from conditional.models.models import FreshmanAccount
... | RamZallan/conditional | conditional/blueprints/intro_evals.py | Python | mit | 6,796 |
"""
Django settings for jstest project.
Generated by 'django-admin startproject' using Django 1.10.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
... | motobyus/moto | module_django/jstest/jstest/settings.py | Python | mit | 3,255 |
from itertools import count
from typing import Union
from dataclasses import dataclass, field
from OnePy.constants import ActionType, OrderType
from OnePy.sys_module.components.exceptions import (OrderConflictError,
PctRangeError)
from OnePy.sys_module.metabase_env ... | Chandlercjy/OnePy | OnePy/sys_module/models/signals.py | Python | mit | 4,404 |
#!/usr/bin/env python
import json
import sys
import web
from coloredcoinlib import BlockchainState, ColorDefinition
blockchainstate = BlockchainState.from_url(None, True)
urls = (
'/tx', 'Tx',
'/prefetch', 'Prefetch',
)
class ErrorThrowingRequestProcessor:
def require(self, data, key, message):
... | elkingtowa/alphacoin | Bitcoin/ngcccbase-master/server/run.py | Python | mit | 2,469 |
import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="color", parent_name="heatmapgl.hoverlabel.font", **kwargs
):
super(ColorValidator, self).__init__(
plotly_name=plotly_name,
parent_nam... | plotly/plotly.py | packages/python/plotly/plotly/validators/heatmapgl/hoverlabel/font/_color.py | Python | mit | 472 |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.cm
fig = plt.figure()
ax = {}
ax["DropOut"] = fig.add_subplot(121)
ax["NoDropOut"] = fig.add_subplot(122)
dList = {}
dList["DropOut"] = ["DropOut1","DropOut2","DropOut3"]
dList["NoDropOut"] = ["NoDropOut1","NoDropOut2"]
d... | ysasaki6023/NeuralNetworkStudy | cifar02/analysis_DropTest.py | Python | mit | 925 |
from wordbook.domain.models import Translation
def test_translation_dto():
t = Translation(
id=1,
from_language='en',
into_language='pl',
word='apple',
ipa='ejpyl',
simplified='epyl',
translated='jabłko',
)
assert t.dto_autocomplete() == dict(
... | lizardschool/wordbook | tests/test_domain_translation.py | Python | mit | 436 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import Cookie
import base64
import calendar
import datetime
import email.utils
import functools
import gzip
import hashlib
import hmac
import httplib
import logging
import mimetypes
import os.path
import re
import stat
import sys
import time
import types
import urllib
impo... | tonghuashuai/42qu-notepad | lib/_tornado.py | Python | mit | 3,187 |
from setuptools import setup, find_packages
setup(
name="RaspberryRacer",
version="0.1",
description="Raspberry Racer",
author="Diez B. Roggisch",
author_email="deets@web.de",
entry_points= {
'console_scripts' : [
'rracer = rracer.main:main',
]},
install... | deets/raspberry-racer | python/setup.py | Python | mit | 559 |
#vim
import sqlite3
from flask import Flask, request, g, redirect, url_for, abort, \
render_template, flash, session
from wtforms import Form, TextField, validators
from model import QueueEntry
import os
from sqlobject import connectionForURI, sqlhub
#configuration
DATABASE = 'bifi.db'
DEBUG = True
SECRET... | silsha/bifibits-web | bifibits.py | Python | mit | 1,341 |
# -*- coding: utf-8 -*-
"""Test package."""
| jayvdb/flake8-putty | tests/__init__.py | Python | mit | 44 |
import cProfile
import unittest
import pstats
if __name__ == '__main__':
suite = unittest.TestLoader().discover('.')
def runtests():
# set verbosity to 2 to see each test
unittest.TextTestRunner(verbosity=1, buffer=True).run(suite)
cProfile.run(
'runtests()', filename='test_cprof... | wanqizhu/mtg-python-engine | test.py | Python | mit | 466 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-16 16:41
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('campaign', '0005_auto_20160716_1624'),
]
operations = [... | toast38coza/FlashGiving | campaign/migrations/0006_auto_20160716_1641.py | Python | mit | 895 |
# vim: set fileencoding=utf-8 :
"""python-opscripts setup
"""
# Standard library
from __future__ import absolute_import, division, print_function
import os.path
import re
import site
import sys
import glob
# Third-party
from setuptools import find_packages, setup
setup_path = os.path.dirname(os.path.realpath(__fil... | ClockworkNet/OpScripts | setup.py | Python | mit | 2,971 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-19 07:46
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('photos', '0002_auto_20160919_0737'),
]
operations = [
migrations.CreateMode... | WillWeatherford/mars-rover | photos/migrations/0003_rover.py | Python | mit | 852 |
#!/usr/bin/env python
print "HANDLING IMPORTS...",
import os
import time
import random
import operator
import argparse
import numpy as np
import cv2
from sklearn.utils import shuffle
import itertools
import scipy.io.wavfile as wave
from scipy import interpolate
import python_speech_features as psf
from pydub impo... | kahst/BirdCLEF2017 | birdCLEF_test.py | Python | mit | 10,275 |
from exchanges import helpers
from exchanges import kraken
from decimal import Decimal
### Kraken opportunities
#### ARBITRAGE OPPORTUNITY 1
def opportunity_1():
sellLTCbuyEUR = kraken.get_current_bid_LTCEUR()
sellEURbuyXBT = kraken.get_current_ask_XBTEUR()
sellXBTbuyLTC = kraken.get_current_ask_XBTLTC()
oppor... | Humantrashcan/prices | exchanges/opportunity_kraken.py | Python | mit | 658 |
import six
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
class EnumField(serializers.ChoiceField):
default_error_messages = {"invalid_choice": _('"{input}" is not a valid choice.')}
def __init__(self, enum, **kwargs):
self.enum = enum
choices =... | 5monkeys/django-enumfield | django_enumfield/contrib/drf.py | Python | mit | 1,336 |
import _plotly_utils.basevalidators
class TickformatValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="tickformat",
parent_name="scattercarpet.marker.colorbar",
**kwargs
):
super(TickformatValidator, self).__init__(
plo... | plotly/python-api | packages/python/plotly/plotly/validators/scattercarpet/marker/colorbar/_tickformat.py | Python | mit | 516 |
#! /usr/bin/python
from TOSSIM import *
from sets import Set
import sys
from optparse import OptionParser
parser = OptionParser(usage="usage: %prog [options] filename",
version="%prog 1.0")
parser.add_option("-g", "--gainfile",
action="store",
dest="gainfile",
default="topology.txt",
help="file containing gains ... | w1lq/MacPerformance | Simulation.py | Python | mit | 2,721 |
"""
XKCD plot generator
-------------------
Author: Jake Vanderplas
This is a script that will take any matplotlib line diagram, and convert it
to an XKCD-style plot. It will work for plots with line & text elements,
including axes labels and titles (but not axes tick labels).
The idea for this comes from work by Da... | OpenBookProjects/ipynb | XKCD-style/xkcdplot.py | Python | mit | 8,352 |
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import ObjectProperty
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.uix.widget import Widget
from kivy.clock import Clock
import os
import dynamixel
import sys
import subprocess
import optparse
import yaml
import cinematica
... | jandrikus/BAMM | deltaApp.py | Python | mit | 26,395 |
from django.conf.urls import include, url
from article import views
urlpatterns = [
url(r'^$', views.articles, name='articles'),
url(r'^add/?$', views.add_articles, name='add-articles'),
] | anush7/django-article-project | article/urls.py | Python | mit | 197 |
from __future__ import absolute_import, print_function, unicode_literals
from django.views.generic.base import TemplateView
class CoachToolsView(TemplateView):
template_name = "coach/coach.html"
| aronasorman/kolibri | kolibri/plugins/coach/views.py | Python | mit | 201 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" Log Config
"""
__author__ = 'Zagfai'
__date__ = '2018-06'
SANIC_LOGGING_CONFIG = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'default': {
'format':
'%(levelname)s [%(asctime)s %(name)s:%(lineno)d] %(me... | zagfai/webtul | webtul/log.py | Python | mit | 1,135 |
#! /usr/bin/env python
import os
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
import django_openS3
with open(os.path.join(os.path.dirname(__file__), "README.rst")) as file:
README = file.read()
with open(os.path.join(os.path.dirname(__file__), 'LICENSE')) as ... | logston/django_openS3 | setup.py | Python | mit | 2,012 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 生成器表达式----一边循环一边计算
# 列表元素可以在循环的过程中不断推算出后续的元素
# 这样就不必创建完整的list,从而节省大量的空间
from collections import Iterable
import array
# 第一种方法:将列表生成式最外面的[] 改成()
# 列表生成式
list_comp = [x * x for x in range(10)]
# 生成器表达式
list_gene = (x * x for x in range(10))
# 生成器是可迭代对象
print(isinstance(... | felix9064/python | Demo/liaoxf/do_generator.py | Python | mit | 2,677 |
from helper import greeting
greeting('Hello') | MRaiti/cs3240-labdemo | hello.py | Python | mit | 46 |
#----------------------------------------------------------------------
#This utility sets up the python configuration files so as to
#allow Python to find files in a specified directory, regardless
#of what directory the user is working from. This is typically
#used to create a directory where the user will put resou... | CommonClimate/teaching_notebooks | GEOL351/CoursewareModules/setpath.py | Python | mit | 5,073 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-08 18:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('content', '0004_ediimages'),
]
operations = [
migrations.AlterModelOptions(... | CT-Data-Collaborative/edi-v2 | edi/content/old_mig/0005_auto_20170808_1832.py | Python | mit | 584 |
import importlib
from flask import render_template
import lib.es as es
def get(p):
# get data source definiton
query = 'name:{}'.format(p['nav'][3])
p['ds'] = es.list(p['host'], 'core_data', 'datasource', query)[0]
# load service
path = "web.modules.dataservice.services.{}".format(p['ds']['type'])... | unkyulee/elastic-cms | src/web/modules/dataservice/controllers/json.py | Python | mit | 392 |
#!/usr/bin/env python
from __future__ import print_function,division
from astropy.io import fits
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
from pint.templates import lctemplate,lcprimitives,lcfitters
from pint.eventstats import z2m,sf_z2m, hm, sf_hm, sig2sigma
import sys
from astropy import ... | paulray/NICERsoft | scripts/fitharms.py | Python | mit | 11,515 |
#! /usr/bin/env python
# example of for loop
words = ['this', 'is', 'an', 'ex', 'parrot']
for word in words:
print word,
print '\n'
# example of for loop in dictionary
d = {'x': 1, 'y': 2, 'z': 3}
for key in d:
print key, 'corresponds to', d[key]
# additional sequence unpacking in for loop
for key, value in d... | IPVL/Tanvin-PythonWorks | chapter5/codes/forLoop.py | Python | mit | 353 |
from __future__ import absolute_import
import codecs
import re
import types
import sys
from .constants import EOF, spaceCharacters, asciiLetters, asciiUppercase
from .constants import encodings, ReparseException
from . import utils
from io import StringIO
try:
from io import BytesIO
except ImportError:
Bytes... | rcarmo/soup-strainer | html5lib/inputstream.py | Python | mit | 32,655 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from nagu import (get_color, pack_color, pack, reset,
sequence, parse_line, html)
def test_get_color():
"""
>>> assert get_color(0) == ""
>>> assert get_color(13) == "color: #ff0;"
>>> assert get_color(64) == 'background-color: #ff0;'
>>> assert ge... | SirAnthony/nagu | tests.py | Python | mit | 2,974 |
import io
import pytest
from contextlib import redirect_stdout
from mock import patch
from mythril.mythril import MythrilLevelDB, MythrilConfig
from mythril.exceptions import CriticalError
@patch("mythril.ethereum.interface.leveldb.client.EthLevelDB.search")
@patch("mythril.ethereum.interface.leveldb.client.ETH_DB",... | b-mueller/mythril | tests/mythril/mythril_leveldb_test.py | Python | mit | 2,235 |
#!python
import math
import fractions
import pygame
import argparse
import os.path
import sys
import subprocess
import time
from itertools import combinations,islice
from ntracer import NTracer,Material,ImageFormat,Channel,BlockingRenderer,CUBE
from ntracer.pygame_render import PygameRenderer
ROT_SENSITIVITY = 0.005... | Rouslan/NTracer | scripts/polytope.py | Python | mit | 24,145 |
from growler_guys import scrape_growler_guys
| ryanpitts/growlerbot | scrapers/__init__.py | Python | mit | 45 |
# coding: utf-8
from __future__ import absolute_import
from apscheduler.jobstores.base import BaseJobStore, JobLookupError, ConflictingIdError
from apscheduler.util import datetime_to_utc_timestamp
class MemoryJobStore(BaseJobStore):
"""
Stores jobs in an array in RAM. Provides no persistence support.
P... | cychenyin/windmill | apscheduler/jobstores/memory.py | Python | mit | 3,664 |
import pygame
from pygame.locals import *
class Application:
def __init__(self, screen_size, caption="PyGame"):
pygame.init()
self.display_surface = pygame.display.set_mode(screen_size)
pygame.display.set_caption(caption)
self.is_run = False
self.update_func = self.__update_... | Plambir/pyclicker | game/Application.py | Python | mit | 3,037 |
from __future__ import absolute_import
from .activation_maximization import visualize_activation_with_losses
from .activation_maximization import visualize_activation
from .saliency import visualize_saliency_with_losses
from .saliency import visualize_saliency
from .saliency import visualize_cam_with_losses
from .sa... | raghakot/keras-vis | vis/visualization/__init__.py | Python | mit | 1,680 |
# -*- coding: UTF-8 -*-
"""
Package-wide constants.
"""
CALL = 'C'
PUT = 'P'
| zzzoidberg/landscape | finance/consts.py | Python | mit | 78 |
from distutils.core import setup
setup( name='dramatis',
version='0.1.1',
author='Steven Parkes',
author_email='smparkes@smparkes.net',
url='http://dramatis.mischance.net',
description="an actor library for ruby and python",
package_dir = {'':'lib'},
packages=[
... | dramatis/dramatis | setup.py | Python | mit | 633 |
#!/usr/bin/python
import cgi
from redis import Connection
from socket import gethostname
from navi import *
fields = cgi.FieldStorage()
title = "Message Box"
msg_prefix = 'custom.message.'
def insert_msg(cust, tm, msg):
conn = Connection(host=gethostname(),port=6379)
conn.send_command('set', msg_prefix+cust... | Zex/Starter | cgi-bin/leave_message.py | Python | mit | 1,575 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from __future__ import division, absolute_import
import os
import sys
from textwrap import dedent
from twisted.trial import unittest
from twisted.persisted import sob
from twisted.python import components
from twisted.persisted.styles import Ep... | whitehorse-io/encarnia | pyenv/lib/python2.7/site-packages/twisted/test/test_sob.py | Python | mit | 5,632 |
#! flask/bin/python
from os.path import abspath
from flask import current_app
from flask.ext.script import Manager
from flask.ext.assets import ManageAssets
from flask.ext.migrate import Migrate, MigrateCommand
from bluespot import create_app
from bluespot.extensions import db
app = create_app(mode='development')
m... | unifispot/unifispot-free | manage.py | Python | mit | 510 |
# coding=utf-8
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import re
from io import StringIO
from .strings import escape
EMBEDDED_NEWLINE_MATCHER = re.compile(r'[^\n]\n+[^\n]')
class PoFile(object):
def __init__(self):
self.header... | kmichel/po-localization | po_localization/po_file.py | Python | mit | 6,436 |
import sys
try:
data = map(int, sys.stdin.readline().split())
except ValueError:
sys.stdout.write("NO" + '\n')
exit()
if not data:
sys.stdout.write("NO" + '\n')
exit()
if len(data) != 2:
sys.stdout.write("NO" + '\n')
exit()
if data[0] < 1 or data[0] > 1000:
sys.stdout.write("NO" + '\... | Arnukk/IEEE-XTREME-8.0-Problems | IEEEXTREME/rano.py | Python | mit | 1,429 |
#!/usr/bin/env python
"""alerts.py Classes for sendings alerts
"""
__author__ = "Jean-Martin Archer"
__copyright__ = "Copyright 2013, MIT License."
import smtplib
from twilio.rest import TwilioRestClient
from vendors.pushbullet.pushbullet import PushBullet
import configuration
class Alerts(object):
"""<ac:im... | j-martin/raspberry-gpio-zmq | raspzmq/alerts.py | Python | mit | 3,371 |
# -*- coding: utf-8 -*-
from flask import Flask
from flask.views import http_method_funcs
from .auth import secure
from .config import config_autoapi
from .messages import message
from .operations import invalid_operation, login, logout, password, roles, user
from .views import get, post, delete, put, patch
class Au... | fvalverd/AutoApi | auto_api/__init__.py | Python | mit | 2,932 |
from django.db import models
from django.contrib.auth.models import User
class IntegerRangeField(models.IntegerField):
def __init__(self, verbose_name=None, name=None, min_value=None, max_value=None, **kwargs):
self.min_value, self.max_value = min_value, max_value
models.IntegerField.__init__(self,... | bath-hacker/binny | binny/db/models.py | Python | mit | 1,478 |
from .viewsets import *
from rest_framework import routers
# Routers provide an easy way of automatically determining the URL conf.
router = routers.DefaultRouter()
router.register(r'person', PersonViewSet)
router.register(r'skill', SkillViewSet)
router.register(r'mycontent', MyContentViewSet)
router.register(r'job', ... | italomandara/mysite | myresume/routers.py | Python | mit | 456 |
# encoding: utf8
from __future__ import print_function
import argparse
import os
import sys
import pokedex.cli.search
import pokedex.db
import pokedex.db.load
import pokedex.db.tables
import pokedex.lookup
from pokedex import defaults
def main(junk, *argv):
if len(argv) <= 0:
command_help()
retu... | mschex1/pokedex | pokedex/main.py | Python | mit | 10,768 |
from django.apps import AppConfig
class ScrapperConfig(AppConfig):
name = 'scrapper'
| shashank-sharma/mythical-learning | scrapper/apps.py | Python | mit | 91 |
from setuptools import setup, find_packages
setup(
name = "FreeCite",
version = "0.1",
py_modules = ['freecite'],
#install requirements
install_requires = [
'requests==1.1.0'
],
#author details
author = "James Ravenscroft",
author_email = "ravenscroftj@gmail... | ravenscroftj/freecite | setup.py | Python | mit | 446 |
from django.conf.urls import patterns, url, include
urlpatterns = patterns('',
('', include('imago.urls')),
url(r'^report/(?P<module_name>[a-z0-9_]+)/$', 'reports.views.report', name='report'),
url(r'^represent/(?P<module_name>[a-z0-9_]+)/$', 'reports.views.represent', name='represent'),
url(r'^warning... | datamade/scrapers_ca_app | scrapers_ca_app/urls.py | Python | mit | 423 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.