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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-10-27 09:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('images', '0002_alter_fields'),
]
operations = [
migrations.AlterField(
... | fidals/refarm-site | images/migrations/0003_auto_20161027_0940.py | Python | mit | 456 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
from dateutil import relativedelta
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect
from django.db.models import Q, Count
from django_tables2 import RequestConfig
from osnovni.forms import PredmetForm,... | mbranko/kartonpmv | osnovni/views.py | Python | mit | 9,507 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
DEVELOP = False
SITEURL = 'http://blog.feltnerm.com'
FE... | feltnerm/blog | publishconf.py | Python | mit | 620 |
'''
offsets = [[[originalx,originaly], [511,709],[498,707]],\
[[522,711], [508,709],[493,706]],\
[[522,714], [503,708],[488,705]]]
'''
def offsetter(length,dim,dx,dy,sx,sy,fx,fy):
x = x0 = sx
y = y0 = sy
arr = []
for i in range(dim):
... | luciencd/astrophotograpython | library/offsetter.py | Python | mit | 667 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('maximo', '0006_auto_20151111_2021'),
]
operations = [
migrations.AlterField(
model... | luiscberrocal/homeworkpal | homeworkpal_project/maximo/migrations/0007_auto_20151117_1038.py | Python | mit | 506 |
#!/usr/bin/env python
import logging
import inspect
import numpy as np
#from matplotlib import _cntr as cntr
#from contours.core import shapely_formatter as shapely_fmt
#from contours.quad import QuadContourGenerator
from astropy.coordinates import Angle
from astropy import constants as c
from astropy import wcs
fro... | astrofle/CRRLpy | crrlpy/imtools.py | Python | mit | 21,537 |
# views
# Routes for the ELMR web application
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Thu Apr 09 09:13:29 2015 -0400
#
# Copyright (C) 2015 University of Maryland
# For license information, see LICENSE.txt
#
# ID: views.py [] benjamin@bengfort.com $
"""
Routes for the ELMR web application
"... | bbengfort/jobs-report | elmr/views.py | Python | mit | 20,091 |
import os
import functools
import codecs
import pickle
from . import utils
class Memozo(object):
def __init__(self, path='./'):
self.base_path = path
memozo_file = os.path.join(self.base_path, utils.MEMOZO_FILE_NAME)
if not os.path.exists(memozo_file):
with codecs.open(memoz... | sotetsuk/memozo | memozo/memozo.py | Python | mit | 5,664 |
from __future__ import unicode_literals
import fnmatch
import glob
import io
import os
import re
import sys
from itertools import dropwhile
import django
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.core.management.utils import (
find... | diego-d5000/MisValesMd | env/lib/python2.7/site-packages/django/core/management/commands/makemessages.py | Python | mit | 22,994 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Скрипт извлекает слова из текстового файла и сортирует их по частоте.
# С помощью модуля pymorphy2 можно привести слова к начальной форме (единственное число, именительный падеж).
# Нужен pymorphy2 и русскоязычный словарь для него!
# pip install --user pymorphy2
# Прим... | Shadybloom/synch-profiler | wordfreq-morph.py | Python | mit | 7,594 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Una copia del programa que hice en python 2 para tomar el tiempo en
# una partida de ajedrez pero este es para python 3.
from tkinter import *
from tkinter import font
import datetime
class RelojAjedrez(Frame):
def __init__(self, master = None):
Frame.__init__... | programingfrik/randomPython | reloj3.py | Python | mit | 6,535 |
import http.server
import socketserver
import webbrowser as web
from urllib.parse import urlparse
import serial
import time
alertMsg = bytearray([2,0,0,0])
path = "C:\\code\\GpioPlayground\\UsbReadWrite\\" # need trailing slash
class GetHandler(http.server.BaseHTTPRequestHandler):
def do_GET(self):
p... | Seekatar/GpioPlayground | UsbReadWrite/HttpServerDumper.py | Python | mit | 1,207 |
import unittest
import logging
logging.getLogger().setLevel(logging.DEBUG)
from ...auction.worker import Worker
from ...database import Database
from ...rc import sql
class TestCase(unittest.TestCase):
def setUp(self):
self.db = Database.pymysql(**sql)
self.ob = Worker(self.db, fail=True)
def... | LegionXI/pydarkstar | pydarkstar/tests/auction/test_worker.py | Python | mit | 350 |
from django.contrib import admin
# Register your models here.
from .models import DbQuery, StarsFilter
admin.site.register(DbQuery)
admin.site.register(StarsFilter) | mavrix93/LightCurvesClassifier | lcc_web/web/interface/admin.py | Python | mit | 167 |
from collections import Counter
c = Counter(input())
print(min(c['t'], c['r'], c['e']//2))
| knuu/competitive-programming | yukicoder/yuki279.py | Python | mit | 91 |
# -*- coding: utf-8 -*-
import os
import re
import time
from django.template import RequestContext as RC
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response
from django.db.models import Q
from django_websocket import accept_websocket... | ikeikeikeike/rsyslog-monitor | rsyslogmonitor/views.py | Python | mit | 2,720 |
r"""
Main classes of OpenPNM
=======================
This module contains the main classes from which all other major objects
(Network, Geometry, Physics, Phase, and Algorithm) derive.
The Base class
--------------
The ``Base`` class is a ``dict`` that has added methods for indexing the pores
and throats, applying l... | PMEAL/OpenPNM | openpnm/core/__init__.py | Python | mit | 1,947 |
from pymuse.pipelinestages.pipeline_stage import PipelineStage
from pymuse.utils.stoppablequeue import StoppableQueue
from pymuse.signal import Signal
from pymuse.constants import PIPELINE_QUEUE_SIZE
class PipelineFork():
"""
This class is used to fork a Pipeline. Ex.: PipelineFork([stage1, stage2], [stage3])... | PolyCortex/pyMuse | pymuse/pipeline.py | Python | mit | 2,987 |
__author__ = 'vg'
import io
import dircache
import sys, os
#default path
base_dir = os.path.dirname('C:\\c-list\\country\\icu\\')
s = dircache.listdir(base_dir)
#creating country code list
our_codes = io.open('our_codes.txt', mode='r',encoding='utf8').readlines()
code_list = []
for k in our_codes:
code_list.ap... | HaideiGV/country-list | crawl.py | Python | mit | 1,601 |
import csv
import json
import numpy as np
import os
import pathlib
import navpy
from direct.showbase.ShowBase import ShowBase
from panda3d.core import CardMaker, LPoint3, NodePath, Texture, TransparencyAttrib
from direct.gui.DirectGui import *
from tkinter import *
class Annotations():
def __init__(self, render... | UASLab/ImageAnalysis | scripts/explore/annotations.py | Python | mit | 11,987 |
#Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Simple Fun #3: Late Ride
#Problem level: 7 kyu
def late_ride(n):
return sum([int(x) for x in list(str(n//60)+str(n%60))])
| Kunalpod/codewars | simple_fun_#3_late_ride.py | Python | mit | 178 |
'''
Use the Github API to get the most recent Gist for a list of users
Created on 5 Nov 2019
@author: si
'''
from datetime import datetime
import sys
import requests
class OctoGist:
def __init__(self):
self.base_url = 'https://api.github.com'
self.items_per_page = 100
self.gist_path = (f... | caffeinate/test-pylot | octo_gist/gogo_octogist.py | Python | mit | 3,870 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2015 Bartosz Janda
#
# 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 w... | bartoszj/Mallet | mallet/CFNetwork/NSCFBackgroundDownloadTask.py | Python | mit | 2,176 |
import tensorflow as tf
import numpy as np
import scipy.io
vgg_layers = [
'conv1_1', 'relu1_1', 'conv1_2', 'relu1_2', 'pool1',
'conv2_1', 'relu2_1', 'conv2_2', 'relu2_2', 'pool2',
'conv3_1', 'relu3_1', 'conv3_2', 'relu3_2', 'conv3_3', 'relu3_3', 'conv3_4', 'relu3_4', 'pool3',
'conv4_1', 'relu4_1', 'con... | everfor/Neural_Artistic_Style | vgg.py | Python | mit | 2,235 |
#!/usr/bin/env python3
# Copyright (c) 2017 The Sarielsaz Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test RPC calls related to net.
Tests correspond to code in rpc/net.cpp.
"""
import time
from test_frame... | sarielsaz/sarielsaz | test/functional/net.py | Python | mit | 4,213 |
import pytest
import eagerpy as ep
import foolbox as fbn
def test_plot(dummy: ep.Tensor) -> None:
# just tests that the calls don't throw any errors
images = ep.zeros(dummy, (10, 3, 32, 32))
fbn.plot.images(images)
fbn.plot.images(images, n=3)
fbn.plot.images(images, n=3, data_format="channels_fir... | bethgelab/foolbox | tests/test_plot.py | Python | mit | 1,086 |
import glob
from pythonforandroid.toolchain import (
CythonRecipe,
Recipe,
current_directory,
info,
shprint,
)
from os.path import join
import sh
class TwistedRecipe(CythonRecipe):
version = '17.9.0'
url = 'https://github.com/twisted/twisted/archive/twisted-{version}.tar.gz'
depends ... | ibobalo/python-for-android | pythonforandroid/recipes/twisted/__init__.py | Python | mit | 1,038 |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.111
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import sys # noqa: F401
... | onshape-public/onshape-clients | python/onshape_client/oas/models/btpl_value_var_reference252_all_of.py | Python | mit | 4,301 |
from .module1 import *
from .module4 import *
import sys | github/codeql | python/ql/test/3/library-tests/modules/package_members/test_package/__init__.py | Python | mit | 56 |
import nltk
import filemanager
import multiprocessing
import os
import ConfigParser
from assistant import Assistant, Messenger
from nltk.corpus import wordnet
resources_dir = 'resources\\'
login_creds = ConfigParser.SafeConfigParser()
if os.path.isfile(resources_dir + 'login_creds.cfg'):
login_creds.read(resour... | omn0mn0m/JARVIS | jarvis/jarvis.py | Python | mit | 3,867 |
# -*- coding: utf-8 -*-
"""
sphinx.ext.napoleon.iterators
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A collection of helpful iterators.
:copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import collections
class peek_iter(object):
"""An iterator... | ajbouh/tfi | src/tfi/parse/iterators.py | Python | mit | 7,857 |
# -*- coding: utf-8 -*-
# A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
#
# a² + b² = c²
# For example, 3² + 4² = 9 + 16 = 25 = 52.
#
# There exists exactly one Pythagorean triplet for which a + b + c = 1000.
# Find the product abc.
def resolve(n):
for a in range(1, n / 2 - 2):
... | songtao-yang/ProjectEuler-Python | 9.Special Pythagorean triplet/problem_9.py | Python | mit | 626 |
# coding: utf-8
"""
Swaggy Jenkins
Jenkins API clients generated from Swagger / Open API specification # noqa: E501
The version of the OpenAPI document: 1.1.2-pre.0
Contact: blah@cliffano.com
Generated by: https://openapi-generator.tech
"""
from openapi_client.api_client import ApiClient
from o... | cliffano/swaggy-jenkins | clients/python-experimental/generated/openapi_client/api/remote_access_api.py | Python | mit | 2,651 |
from util.runescape_util import get_users_stats, get_level_at_exp
from util.ascii_table import Table, Column
from util.image_util import text_to_image
from discord.ext import commands
from util.arguments import Arguments
from shlex import split
class Stats:
def __init__(self, bot):
self.bot = bot
@c... | duke605/RunePy | commands/stats.py | Python | mit | 3,080 |
"""
@created_at 2014-07-15
@author Exequiel Fuentes <efulet@gmail.com>
@author Brian Keith <briankeithn@gmail.com>
"""
# Se recomienda seguir los siguientes estandares:
# 1. Para codificacion: PEP 8 - Style Guide for Python Code (http://legacy.python.org/dev/peps/pep-0008/)
# 2. Para documentacion: PEP 257 - Docst... | efulet/pca | pca/main.py | Python | mit | 3,043 |
import ctds
from .base import TestExternalDatabase
class TestCursorFetchMany(TestExternalDatabase):
'''Unit tests related to the Cursor.fetchmany() method.
'''
def test___doc__(self):
self.assertEqual(
ctds.Cursor.fetchmany.__doc__,
'''\
fetchmany(size=self.arraysize)
Fetc... | zillow/ctds | tests/test_cursor_fetchmany.py | Python | mit | 6,714 |
# coding=utf-8
import unittest
from types import MethodType
from parameterized import parameterized
from six import StringIO
from conans.client.output import ConanOutput, colorama_initialize
from mock import mock
class ConanOutputTest(unittest.TestCase):
def test_blocked_output(self):
# https://github... | conan-io/conan | conans/test/unittests/client/conan_output_test.py | Python | mit | 3,440 |
#!/usr/bin/env python2
# coding=utf8 sw=1 expandtab ft=python
from __future__ import print_function
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks
from autobahn.twisted.wamp import ApplicationSession
from autobahn.wamp import auth
from autobahn.twisted.util import sleep
from ... | pch957/python-bts-v0.9 | scripts/bts_publish_market.py | Python | mit | 8,079 |
import os
from functools import lru_cache, wraps
from itertools import chain
import uglipyjs
from flask import current_app, request
def read_param(request, param, default=None, type=str):
try:
value = request.args.get(param, request.form.get(param, default))
return type(value.strip())
except ... | Cladis/wikilabels | wikilabels/wsgi/util.py | Python | mit | 2,938 |
# -*- coding: utf-8 -*-
import os
import sys
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
import ccxt # noqa: E402
exchange = ccxt.binance({
"apiKey": "YOUR_API_KEY",
"secret": "YOUR_SECRET",
'enableRateLimit': True,
})
orders ... | ccxt/ccxt | examples/py/binance-batch-orders.py | Python | mit | 696 |
def bradycardia(hr, lowerthresh):
"""
This module determines when in the ECG data there is bradycardia
:param hr: (ndarray) heart rate- used to determine when
bradycardia occurred in ECG trace
:param lowerthresh: (int or double) lower threshold for determining
bradycardia- user input or defa... | polortiz4/bme590_assignment02 | tachybradycardia.py | Python | mit | 1,295 |
from s3authbasic.testing import BaseAppTest, AUTH_ENVIRON
class ViewsTests(BaseAppTest):
def test_validpath(self):
for (path, expect) in (
('/', 'home'),
('/index.html', 'home'),
('/level1', 'level 1'),
('/level1/', 'level 1'),
('/level1/index.h... | ant30/s3authbasic | s3authbasic/tests/test_views.py | Python | mit | 1,402 |
"""
This file is part of the tractor library.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Created on Jan 06, 2012.
"""
from pkg_resources import resource_filename # pylint: disable=E0611
from tractor import AttachmentWrapper
from tractor import Base64Converter
from tractor import Tick... | helixyte/tractor | tractor/tests/test_api.py | Python | mit | 9,976 |
# -*- coding: utf-8 -*-
"""Transport functions for `Fraunhofer's OrientDB <http://graphstore.scai.fraunhofer.de>`_.
`Fraunhofer <https://www.scai.fraunhofer.de/en/business-research-areas/bioinformatics.html>`_ hosts
an instance of `OrientDB <https://orientdb.com/>`_ that contains BEL in a schema similar to
:mod:`pybe... | pybel/pybel | src/pybel/io/fraunhofer_orientdb.py | Python | mit | 7,079 |
# -*- coding: utf-8 -*-
"""
Fetches horoscopes from iltalehti.fi
Created on Oct 17, 2012
@author: huqa / pikkuhukka@gmail.com
"""
import re
horo_url = "http://www.iltalehti.fi/horoskooppi"
def command_horo(bot, user, channel, args):
"""Hakee päivittäisen horoskoopin. Käyttö !horo <horoskooppimerkki>"""
nick... | huqa/pyfibot_modules | module_horo.py | Python | mit | 933 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Vasicek parameter class
~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import print_function, division
import numpy as np
from .param_generic import GenericParam
__all__ = ['VasicekParam']
class VasicekParam(GenericParam):
"""Parameter storage for Vasicek model.... | khrapovs/diffusions | diffusions/param_vasicek.py | Python | mit | 2,899 |
from django.contrib import admin
import models
admin.site.register(models.Testimonial)
| gEndelf/cmsplugin-testimonials | cmsplugin_testimonials/admin.py | Python | mit | 88 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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... | rwl/PyCIM | CIM15/IEC61970/WiresPhaseModel/SwitchPhase.py | Python | mit | 3,967 |
book_1 = {
"ISBN": "0436203057",
"authors": [
"Howard Marks"
],
"genre": "non-fiction",
"pages": 466,
"title": "Mr. Nice"
}
book_2 = {
"ISBN": "0439708184",
"authors": [
"J. K. Rowling"
],
"genre": "fiction",
"pages": 322,
"title": "Harry Potter and the S... | Kalimaha/fake_data_crud_service | test_data_crud_services/resources/test_book.py | Python | mit | 338 |
import _plotly_utils.basevalidators
class LonsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="lonsrc", parent_name="scattermapbox", **kwargs):
super(LonsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/scattermapbox/_lonsrc.py | Python | mit | 441 |
from __future__ import absolute_import
from builtins import object
from .logger import create_logger
from future.utils import with_metaclass
class Meta(type):
def __str__(self):
return self.SERVICE_NAME
class BaseService(with_metaclass(Meta, object)):
SERVICE_NAME = None
GIT_CONFIG_API_KEY = None
... | ericforbes/post-review | postreview/BaseService.py | Python | mit | 994 |
# Problem 7
# 20.0 points possible (graded)
# Write a function called general_poly.
def general_poly(L):
""" L, a list of numbers (n0, n1, n2, ... nk)
Returns a function, which when applied to a value x, returns the value
n0 * x^k + n1 * x^(k-1) + ... nk * x^0
"""
numList = L[::-1]
def apply(number):
... | Kunal57/MIT_6.00.1x | final/problem7.py | Python | mit | 518 |
#!/usr/bin/env python
# Copyright (c) 2012-2013 Turbulenz Limited
from logging import basicConfig, CRITICAL, INFO, WARNING
import argparse
from urllib3 import connection_from_url
from urllib3.exceptions import HTTPError, SSLError
from simplejson import loads as json_loads, dump as json_dump
from gzip import GzipFile
... | turbulenz/turbulenz_tools | turbulenz_tools/tools/exportevents.py | Python | mit | 25,568 |
from django.db import models
from django.test import TestCase
from ..models.compat import YAMLField
class TestYAMLModel(models.Model):
yaml_field = YAMLField()
class TestYAMLField(TestCase):
...
def test_to_python(self):
yaml_data = """
main:
- 1
- 2
- 3
... | salexkidd/restframework-definable-serializer | definable_serializer/tests/test_compat.py | Python | mit | 985 |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACCOUNT_SID"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
event = client.monitor.events("AE21f24380625e4aa4ab... | teoreteetik/api-snippets | monitor/events/instance-get-example-phone-number/instance-get-example-phone-number.6.x.py | Python | mit | 370 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Tamas Gal <tgal@km3net.de>
# License: MIT
#!/usr/bin/env python
# vim: ts=4 sw=4 et
"""
=============================
UDP Forwarder for ControlHost
=============================
A simple UDP forwarder for ControlHost messages.
This application is used to forward... | tamasgal/km3pipe | examples/network/udp_dispatcher.py | Python | mit | 1,173 |
from test_base import BaseTest, load_msg
from mock import patch
from smtplib import SMTP
from deliver.send import Sender
class SendTest(BaseTest):
def setUp(self):
super(SendTest,self).setUp()
self.sender = Sender(self.config)
@patch('smtplib.SMTP')
@patch.object(SMTP, 'sendmail')
d... | sirech/deliver | deliver/tests/test_send.py | Python | mit | 852 |
import unittest
try:
from unittest import mock
except ImportError:
import mock
from pi3bar.plugins.uptime import get_uptime_seconds, uptime_format, Uptime
class GetUptimeSecondsTestCase(unittest.TestCase):
def test(self):
m = mock.mock_open(read_data='5')
m.return_value.readline.return_val... | knoppo/pi3bar | pi3bar/tests/plugins/test_uptime.py | Python | mit | 1,771 |
"""autogenerated by genpy from navfn/MakeNavPlanRequest.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import geometry_msgs.msg
import std_msgs.msg
class MakeNavPlanRequest(genpy.Message):
_md5sum = "2fe3126bd5b2d56edd5005220333d4fd"
_type = "na... | siketh/ASR | catkin_ws/devel/lib/python2.7/dist-packages/navfn/srv/_MakeNavPlan.py | Python | mit | 20,872 |
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can redistribute it and/or mo... | curiosityio/taiga-docker | taiga-back/taiga-back/taiga/searches/serializers.py | Python | mit | 2,043 |
from django.db import models
from django.core.urlresolvers import reverse
from jsonfield import JSONField
import collections
# Create your models here.
class YelpvisState(models.Model):
title=models.CharField(max_length=255)
slug=models.SlugField(unique=True,max_length=255)
description = models.CharField(max_lengt... | intuinno/vistalk | yelpvis/models.py | Python | mit | 881 |
import urllib2
url = r"http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing="
#number = '12345'
#number = '8022'
number = '63579'
data = urllib2.urlopen(url+number).read()
#while (data[0:3]=='and'):
#while (data[-8:-6]=='is'):
while data.find('nothing') != -1:
str = 'the next nothing is'
count = data.fi... | heyf/cloaked-octo-adventure | pythonchallenge/4-linkedlist.py | Python | mit | 433 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import tornadoredis
from repi_server import RepiServer
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-n', '--name', help='Name of Repi client', type=str,
default='master')
parser.add_argument('-H',... | vortec/repi-server | repi_server/command_line.py | Python | mit | 1,563 |
#!/usr/bin/env python
import os
import sys
try:
os.environ["DJANGO_SETTINGS_MODULE"] = "tests.settings"
test_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, test_dir)
except ImportError:
pass
else:
from django.core.management import execute_from_command_line
d... | aljosa/django-tinymce | tests/manage.py | Python | mit | 492 |
#!/usr/bin/env python
#!coding=utf-8
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Table,Column,Integer,String,Numeric,MetaData,DateTime,Date
from ._base import BaseInit,Base
'''
員工刷卡原始數據表
'''
class ATTTB(BaseInit,Base):
__tablename__='ATTTB'
TB001=Column(String(20),nullab... | mu2019/heysqlware | demo/tables/atttb.py | Python | mit | 1,087 |
# coding: utf-8
from fabkit import task
from fablib.mongodb import MongoDB
mongodb = MongoDB()
@task
def setup():
mongodb.setup()
return {'status': 1}
| syunkitada/fabkit-repo | fabscript/openstack/mongodb.py | Python | mit | 163 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
with open('README.md') as readme_file:
readme = readme_file.read()
with open('HISTORY.md') as history_file:
history = history_file.read()
requirements = [
'requests'
]
test_requirements = [
# TODO: put package test requireme... | Lobosque/python_wpapi | setup.py | Python | mit | 1,489 |
#!/usr/bin/env python3
import sys
def main(args):
#cnt = 2017
cnt = 50000000
n = 3
n = 345
size = 0
buf = [0]
pos = 0
at_1 = None
for i in range(cnt):
pos = (pos + n) % (i+1)
if pos == 0:
at_1 = i+1
pos += 1
print(at_1)
if __name__ == '__... | msullivan/advent-of-code | 2017/17b.py | Python | mit | 358 |
#!/usr/bin/env python3
# Copyright (c) 2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from test_... | sinraf96/electrum | qa/rpc-tests/bip9-softforks.py | Python | mit | 9,959 |
import os
import smtplib
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
class Email:
emailCount = 0;
def __init__(self, address, password):
self.address = address
self.password = password
email.emailCount += 1... | andykhov/got-my-pi-on-you | src/mail.py | Python | mit | 1,141 |
# coding: utf-8
"""
Qc API
Qc API # noqa: E501
The version of the OpenAPI document: 3.0.0
Contact: cloudsupport@telestream.net
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from telestream_cloud_qc.configuration import Configuration
class... | Telestream/telestream-cloud-python-sdk | telestream_cloud_qc_sdk/telestream_cloud_qc/models/header_byte_count_test.py | Python | mit | 4,912 |
#David Yuen
#September 11, 2017
#This program draws different shades of blue.
import turtle
turtle.colormode(255)
bob = turtle.Turtle()
bob.shape("turtle")
bob.backward(100)
for i in range(0,255,10):
bob.forward(10)
bob.pensize(i)
bob.color(0,0,i)
| davidy9000/CSCI-127 | Hunter CSCI 127/Python/David Yuen Shades of Blue.py | Python | mit | 262 |
from .hub import Hub
class Client(object):
def __init__(self, mac):
self.__mac__ = mac
def hub(self, hub):
return Hub(self.__mac__, hub)
| fancl20/pili-python | pili/client.py | Python | mit | 163 |
from .nuimo import ControllerManager, ControllerManagerListener, Controller, ControllerListener, GestureEvent, Gesture, LedMatrix
| getsenic/nuimo-linux-python | nuimo/__init__.py | Python | mit | 130 |
# -*- coding: utf-8; -*-
#
# @file models.py
# @brief coll-gate accession module models.
# @author Frédéric SCHERMA (INRA UMR1095), Medhi BOULNEMOUR (INRA UMR1095)
# @date 2016-09-01
# @copyright Copyright (c) 2016 INRA/CIRAD
# @license MIT (see LICENSE file)
# @details
import re
from django.contrib.auth.models impor... | coll-gate/collgate | server/accession/models.py | Python | mit | 31,423 |
'''
Training file with functions for
1) Taking in the inputs
2) Defining the model
3) Reading the input and generating batches
4) Defining the loss, learning rate and optimization functions
5) Running multiple epochs on training and testing
'''
import argparse
from read_input import *
from model import *
import tensor... | Kaushikpatnaik/LSTMChar2Char | train.py | Python | mit | 5,431 |
#-------------------------------------------------------------------------------
# coding=utf8
# Name: 模块1
# Purpose:
#
# Author: zhx
#
# Created: 10/05/2016
# Copyright: (c) zhx 2016
# Licence: <your licence>
#-------------------------------------------------------------------------------
import ... | vimilimiv/weibo-popularity_judge-and-content_optimization | 数据处理/get_keyword_feature.py | Python | mit | 3,446 |
'''
Problem 2
19 October 2001
Each new term in the Fibonacci sequence is generated by adding the
previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not
exceed four million, fin... | arturh85/projecteuler | python/src/problem002.py | Python | mit | 1,592 |
# -*- coding: utf-8 -*-
import unittest
import weakref
from pyopenapi.migration.scan import Scanner, Dispatcher, scan
from pyopenapi.migration.versions.v1_2.objects import (
ApiDeclaration, Authorization, Operation, ResponseMessage, Parameter)
from pyopenapi.migration.versions.v3_0_0.objects import (
Header as... | mission-liao/pyopenapi | pyopenapi/tests/migration/test_scan.py | Python | mit | 6,151 |
"""
Application urlconfig
"""
from __future__ import absolute_import
from django.conf.urls import url
from . import views
urlpatterns = [
url(
r"^(?P<uuid>[0-9a-f-]{36})/$",
views.RateView.as_view(),
name="rate"
),
url(
r"^2/(?P<uuid>[0-9a-f-]{36})/$",
views.Rate2... | RightToResearch/OpenCon-Rating-App | project/rating/urls.py | Python | mit | 365 |
#-*- coding: utf-8 -*-
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
SSL_DISVBLE = True
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_TRACK_MODIFICATIONS = True
SQLALCHEMY_RECORD_QUERIES = True
... | simpen/flaskz | config.py | Python | mit | 2,994 |
#!/usr/bin/env python
from . import vcexceptions
from . import vcsimdata
#-------------------------------------------------------------------------------
# The base class for Virtual California simulation objects.
#-------------------------------------------------------------------------------
class VCSys(object):
... | mksachs/PyVC | pyvc/vcsys.py | Python | mit | 605 |
import tensorflow as tf
class BaseGraph:
"""
A generic computation graph class, with only two constraints are
1. The requirements for net instance passed in:
- net should have method of define_net
- net should have method of get_placeholders
2. Losses can only be calculated w... | KleinYuan/cnn | core/base_graph.py | Python | mit | 2,591 |
from flask.ext.wtf import Form
from flask.ext.wtf.html5 import EmailField
from wtforms.validators import Required
from wtforms.fields import (
TextAreaField,
HiddenField
)
class LoginForm(Form):
email = EmailField('Email address', validators=[Required()])
next = HiddenField('next')
class FeedbackF... | crossgovernmentservices/csdigital-prototype | application/frontend/forms.py | Python | mit | 402 |
"""
Dummy Salesforce driver that simulates some parts of DB API 2
https://www.python.org/dev/peps/pep-0249/
should be independent on Django.db
and if possible should be independent on django.conf.settings
Code at lower level than DB API should be also here.
"""
from collections import namedtuple
import requests
import... | chromakey/django-salesforce | salesforce/backend/driver.py | Python | mit | 6,090 |
#! /usr/bin/env python
import numpy as np
import gc
import matplotlib.pyplot as plt
from random import seed, sample, randint
from ransac import LineModel, ransac
from time import time
random_seed = 0
num_iterations = 100
num_samples = 1000
noise_ratio = 0.8
num_noise = int(noise_ratio * num_sampl... | FredrikAppelros/ransac | test.py | Python | mit | 1,575 |
#!/usr/bin/env python3
import sys
import os
import random
from snakemake.utils import read_job_properties
jobscript = sys.argv[1]
job_properties = read_job_properties(jobscript)
with open("qsub.log", "w") as log:
print(job_properties, file=log)
print(random.randint(1, 100))
os.system("sh {}".format(jobscript))
| gusevfe/snakemake | tests/test14/qsub.py | Python | mit | 319 |
import blinker
from concurrency.fields import IntegerVersionField
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch.dispatcher import receiver
from game.apps.core.models.planet.models import Planet
from game.utils.models i... | piotrlewalski/birdstorm | game/apps/core/models/buildings.py | Python | mit | 2,036 |
from unittest import mock
from urllib.parse import urlparse
from django.contrib.auth.models import AnonymousUser, User
from django.core.exceptions import ImproperlyConfigured, MiddlewareNotUsed
from django.test import RequestFactory, TestCase, override_settings
from django.urls import resolve, reverse
from perimeter.... | yunojuno/django-perimeter | tests/test_middleware.py | Python | mit | 5,555 |
import tensorflow as tf
def f():
with tf.variable_scope('A') as scope:
print scope.reuse
f()
| b29308188/cs598vqa | src/CBP/reuse_test.py | Python | mit | 98 |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test transaction signing using the signrawtransaction RPC."""
from test_framework.test_framework impor... | aspaas/ion | test/functional/signrawtransactions.py | Python | mit | 7,930 |
#!/usr/bin/python3
# gather.py
lookup_terms = [
{'program' :'email_outlook.py',
'known_as':['email', 'mail', 'outlook', 'messages',
'sent items', 'inbox', 'spam']
},
{'program' :'sys_PC_usage.py',
'known_as':['PC usage', 'Application logging']
},
{'program' :'sys_process_windo... | acutesoftware/rawdata | rawdata/gather.py | Python | mit | 1,024 |
from PyQt4.QtGui import *
class QueryResultWindow:
def __init__(self):
self.__create_window_widget()
self.__create_ui()
def __create_window_widget(self):
self.__qt_widget_object = QWidget()
self.__qt_widget_object.resize(800, 600)
self.__qt_widget_object.setWindowTitle('Результат запроса')
def __create_... | d3adc0d3/simple-db-app | query_result_window.py | Python | mit | 1,046 |
import lmdb
from zounds.nputil import Growable, packed_hamming_distance
import numpy as np
from multiprocessing.dummy import Pool as ThreadPool
from multiprocessing import cpu_count
import os
import binascii
class HammingDb(object):
def __init__(self, path, map_size=1000000000, code_size=8, writeonly=False):
... | JohnVinyard/zounds | zounds/index/hammingdb.py | Python | mit | 7,331 |
# -*- coding: utf-8 -*-
"""
Resources:
https://pythonhosted.org/an_example_pypi_project/sphinx.html
https://github.com/djungelorm/sphinx-csharp
https://sublime-and-sphinx-guide.readthedocs.io/en/latest/code_blocks.html
https://docutils.sourceforge.net/docs/user/rst/quickref.html
"""
import sys
import os
extensions ... | r3c/cottle | docs/conf.py | Python | mit | 2,382 |
from Database.Controllers.Disciplina import Disciplina
class Prereq(object):
def __init__(self,dados=None):
if dados is not None:
self.id = dados ['id']
self.grupo = dados ['grupo']
self.id_disc_pre = dados ['id_disc_pre']
def getId(self):
return self.id
def setGrupo(self,grupo):
self.grupo = g... | AEDA-Solutions/matweb | backend/Database/Models/Prereq.py | Python | mit | 654 |
from django.contrib import admin
from .models import File, Folder
class ItemAdmin(admin.ModelAdmin):
def get_form(self, request, obj=None, **kwargs):
self.exclude = ("slug", )
form = super(ItemAdmin, self).get_form(request, obj, **kwargs)
return form
admin.site.register(File, ItemAdmin)
ad... | rit-sailing/website | files/admin.py | Python | mit | 357 |
#!/usr/bin/env python
import argparse
import Image, ImageDraw, ImageChops
import os
import sys
import util
# stitches a bunch of images together into a grid
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--x', type=int, default=3, help="output columns")
p... | matpalm/malmomo | stitch_imgs.py | Python | mit | 1,879 |
#!/usr/bin/env python
from setuptools import setup, find_packages
REPO_NAME = 'chickenzord/dotenvy'
VERSION = '0.2.0'
ARCHIVE_URL = 'https://github.com/%s/archive/v%s.tar.gz' % (REPO_NAME, VERSION)
setup(
# packaging
packages=find_packages('src'),
package_dir={'': 'src'},
package_data={},
instal... | chickenzord/dotenvy | setup.py | Python | mit | 1,627 |
"""empty message
Revision ID: e424d03ba260
Revises: ace8d095a26b
Create Date: 2017-10-12 11:25:11.775853
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'e424d03ba260'
down_revision = 'ace8d095a26b'
branch_labels = None
depends_on = None
def upgrade():
# ... | danielSbastos/gistified | migrations/versions/e424d03ba260_.py | Python | mit | 652 |