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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('booking', '0017_auto_20150309_1910'),
]
operations = [
migrations.AlterField(
model_name='booking',
... | bo858585/AbstractBooking | Booking/booking/migrations/0018_auto_20150310_1533.py | Python | mit | 1,427 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
file: __main__.py
Description: the entry point to SEM.
author: Yoann Dupont
MIT License
Copyright (c) 2018 Yoann Dupont
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), t... | YoannDupont/SEM | sem/__main__.py | Python | mit | 3,899 |
from django.conf.urls import patterns, include, url
from darkoob.book import views as book_views
urlpatterns = patterns('',
url(r'^(?P<book_id>\d+)/(?P<book_title>[a-zA-Z0-9\-_]+)/$', book_views.page, name='book_page'),
url(r'^look/$', book_views.book_lookup),
url(r'^author/$', book_views.author_lookup),
... | s1na/darkoob | darkoob/book/urls.py | Python | mit | 374 |
"""
Django settings for testproject project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...... | adamhaney/django-ipython-notebook-reports | testproject/testproject/settings.py | Python | mit | 1,987 |
"""
The consumer's code.
It takes HTML from the queue and outputs the URIs found in it.
"""
import asyncio
import json
import logging
from typing import List
from urllib.parse import urljoin
import aioredis
from bs4 import BeautifulSoup
from . import app_cli, redis_queue
_log = logging.getLogger('url_extractor')
... | butla/experiments | aiohttp_redis_producer_consumer/txodds_code_test/url_extractor.py | Python | mit | 2,896 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Legendgrouptitle(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "histogram2d"
_path_str = "histogram2d.legendgrouptitle"
_valid_props = {"font", "t... | plotly/plotly.py | packages/python/plotly/plotly/graph_objs/histogram2d/_legendgrouptitle.py | Python | mit | 4,724 |
# 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 dataclasses import dataclass, field
import itertools
import logging
import os
import numpy as np
import torch
from fairseq import metr... | pytorch/fairseq | examples/discriminative_reranking_nmt/tasks/discriminative_reranking_task.py | Python | mit | 17,731 |
"""Docstring violation definition."""
from collections import namedtuple
from functools import partial
from itertools import dropwhile
from typing import Any, Callable, Iterable, List, Optional
from .parser import Definition
from .utils import is_blank
__all__ = ('Error', 'ErrorRegistry', 'conventions')
ErrorParam... | GreenSteam/pep257 | src/pydocstyle/violations.py | Python | mit | 12,345 |
from typing import List, Optional
from fastapi import FastAPI, Header
app = FastAPI()
@app.get("/items/")
async def read_items(x_token: Optional[List[str]] = Header(None)):
return {"X-Token values": x_token}
| tiangolo/fastapi | docs_src/header_params/tutorial003.py | Python | mit | 216 |
import yaml
import tornado.web
import elephunk.handlers
import elephunk.database
import elephunk.ui_methods
import elephunk.ui_modules
def create(port, debug, config_file):
with open(config_file, 'r') as f:
config = yaml.load(f.read())
application = tornado.web.Application(
elephunk.handlers.... | pitluga/elephunk | elephunk/application.py | Python | mit | 630 |
#!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
readme = open('README.md').read()
with open('requirements.txt') as reqs:
requirements = reqs.read().split()
setup(
name='pagseguro',
version='0.3.4',
description='Pagseguro API v2 wr... | rochacbruno/python-pagseguro | setup.py | Python | mit | 1,420 |
from rest_framework import serializers
def serializer_factory(model, serializer_class=serializers.ModelSerializer, attrs=None, meta=None):
"""
Generate a simple serializer for the given model class.
:param model: Model class
:param serializer_class: Serializer base class
:param attrs: Serializer ... | kcsry/wurst | wurst/api/utils.py | Python | mit | 646 |
from django.conf.urls import url
from profiles import views
urlpatterns = [
url(
regex=r"^edit/$",
view=views.ProfileEditUpdateView.as_view(),
name="profile_edit"
),
url(
regex="^confirm_role/(?P<membership_id>[-\w]+)/(?P<action>verify|deny)/$",
view=views.profile_c... | noisy/steemprojects.com | profiles/urls.py | Python | mit | 1,096 |
from . import NamedEntity
class Application(NamedEntity):
def __init__(self, name, provider):
NamedEntity.__init__(self, name)
self.provider = provider
def get_descendants(self):
return []
| stlemme/python-dokuwiki-export | entities/application.py | Python | mit | 202 |
from shuttl.tests import testbase
from shuttl.Models.User import User, UserDataTakenException, NoOrganizationException, ToManyOrganizations
from shuttl.Models.organization import Organization
from shuttl.Models.Reseller import Reseller
class UserTestCase(testbase.BaseTest):
def _setUp(self):
self.reselle... | shuttl-io/shuttl | shuttl/tests/test_models/test_user.py | Python | mit | 1,929 |
# coding: utf-8
# Distributed under the terms of the MIT License.
import ababe
import sys, ast
import click
import yaml
from ababe.cmdline.apps import *
def run():
try:
ababe.cmdline.runabalib.exec_from_cmdline()
except KeyboardInterrupt:
pass
except EOFError:
pass
@click.group()
@... | unkcpz/ababe | ababe/cmdline/runabalib.py | Python | mit | 5,798 |
"""
Provide a common way to import Qt classes used by pytest-qt in a unique manner,
abstracting API differences between PyQt5 and PySide2/6.
.. note:: This module is not part of pytest-qt public API, hence its interface
may change between releases and users should not rely on it.
Based on from https://github.com/epag... | pytest-dev/pytest-qt | src/pytestqt/qt_compat.py | Python | mit | 6,366 |
# -*- coding: utf-8 -*-
"""
Test suite for django-staticshard.
"""
import uuid
from urlparse import urlparse
from django.conf import settings
from django.test import TestCase
from django.core.exceptions import ImproperlyConfigured
from ..settings import STATICSHARD_HOSTS
from ..utils import get_absolute_url
class S... | tomatohater/django-staticshard | staticshard/tests/__init__.py | Python | mit | 1,089 |
from __future__ import unicode_literals
from sqlalchemy import create_engine, Column, ForeignKey, Integer, String,\
Boolean, Unicode, Date, DateTime, and_, func
from sqlalchemy.orm import relationship, backref, sessionmaker
from sqlalchemy.engine.url import URL
from sqlalchemy.ext.declarative import declarative_bas... | lesh1k/VKStalk | src/core/models.py | Python | mit | 6,912 |
# This file is part of Indico.
# Copyright (C) 2002 - 2022 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 indico.core.db import db
from indico.util.string import format_repr
class SuggestedCategory(db.Mode... | indico/indico | indico/modules/users/models/suggestions.py | Python | mit | 2,202 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from flask import Flask, jsonify, request
app = Flask(__name__)
from charge.chargeManager import ChargeManager
from data.dataProvider import DataProvider
@app.route('/')
def hello_world():
return jsonify(testPreMa(['棉花'],20))
@app.route('/result')
def get_result():
na... | AlexYang1949/FuturesMeasure | restful/restfulApi.py | Python | mit | 837 |
import itertools
import os
import os.path as osp
import chainer
import numpy as np
import scipy.misc
from sklearn.model_selection import train_test_split
from base import APC2016DatasetBase
def ids_from_scene_dir(scene_dir, empty_scene_dir):
for i_frame in itertools.count():
empty_file = osp.join(
... | wkentaro/fcn | examples/apc2016/datasets/mit_benchmark.py | Python | mit | 3,797 |
import os
import socket
import struct
from OpenSSL import SSL
from mitmproxy import exceptions
from mitmproxy import flow
from mitmproxy.proxy.protocol import base
from mitmproxy.net import tcp
from mitmproxy.net import websockets
from mitmproxy.websocket import WebSocketFlow, WebSocketBinaryMessage, WebSocketTextMess... | dwfreed/mitmproxy | mitmproxy/proxy/protocol/websocket.py | Python | mit | 7,347 |
# force python 3.* compability
from __future__ import absolute_import, division, print_function
from builtins import (bytes, str, open, super, range,
zip, round, input, int, pow, object)
# regular imports below:
import unittest
from python_uptimer import up_check
import requests
from datetime impo... | sebnil/python_uptimer | tests/test_requests.py | Python | mit | 934 |
import stripe
import json
from django.conf import settings
from django.http import HttpResponse
from django.shortcuts import render
from django.views.generic import TemplateView, DetailView, ListView
from carton.cart import Cart
from .models import Sale, SaleProduct, SaleError
from products.models import Product
... | azul-cloud/serendipity | shopping/views.py | Python | mit | 6,846 |
#!/usr/bin/env python
from sys import argv
from GeekToolKickassTorrentFeed import GeekToolKickassTorrentFeed
if __name__ == "__main__" and len(argv) > 1:
mode = argv[1]
print(str.format("{0}{1}", "\t" * 4, mode.capitalize()))
feed = GeekToolKickassTorrentFeed(mode)
if feed:
feed_data = feed.... | abram777/torrents-from-xml | examples/geektool script/torrents.geektool.py | Python | mit | 449 |
"""empty message
Revision ID: 02ccb3e6a553
Revises: None
Create Date: 2016-05-17 22:15:03.881575
"""
# revision identifiers, used by Alembic.
revision = '02ccb3e6a553'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###... | answerrrrrrrrr/myflask | migrations/versions/02ccb3e6a553_.py | Python | mit | 2,065 |
"""
Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used.
Note:
All letters in hexadecimal (a-f) must be in lowercase.
The hexadecimal string must not contain extra leading 0s. If the number is zero, it is represented by a single zero character '... | franklingu/leetcode-solutions | questions/convert-a-number-to-hexadecimal/Solution.py | Python | mit | 1,481 |
# The MIT License (MIT)
# Copyright (c) 2017 Kinga Makowiecka
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation file
# (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,... | gynvael/zrozumiec-programowanie-cwiczenia | INT-int-to-negabinary-python/int-to-negabinary-coverter.py | Python | mit | 1,451 |
#import unittest
import mt
import queue
import _thread
import time
class DummySocket:
def __init__(self, ID):
self.id = ID
self.lastMsg = ""
def send(self, msg):
print(self.id+":",msg)
self.lastMsg = msg
def close(self):
print(self.id+": CLOSE CALLED")
self... | Griffiths117/TG-s-IRC | server/mtUnitTests.py | Python | mit | 1,945 |
"""Pytrafikverket module."""
# flake8: noqa
from pytrafikverket.trafikverket import (AndFilter, FieldFilter, FieldSort,
Filter, FilterOperation, NodeHelper,
OrFilter, SortOrder, Trafikverket)
from pytrafikverket.trafikverket_train import ... | AnderssonPeter/pytrafikverket | pytrafikverket/__init__.py | Python | mit | 708 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: omi
# @Date: 2014-08-24 22:08:33
# @Last Modified by: omi
# @Last Modified time: 2015-03-30 23:36:21
'''
__ ___________________________________________
| \ ||______ | |______|_____||______|______
| \_||______ | |______| |______||______
... | chaserhkj/musicbox | setup.py | Python | mit | 1,899 |
# -*- coding:utf8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from core.models import Post
from core.models import Category
from core.models import Comment
from core.models import Tag
from core.forms import PostForm
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
# raw_id_... | valbertovc/blog_django_bootstrap_ajax | core/admin.py | Python | mit | 481 |
#Project Euler Problem 4
#A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 * 99.
#Find the largest palindrome made from the product of two 3-digit numbers.
def palindrome(test):
while len(test) > 2:
if test[0] == test[-1]:
... | ieuan1630-cmis/ieuan1630-cmis-cs2 | pep4.py | Python | cc0-1.0 | 2,405 |
"""
Prosta klasa reprezentująca posiłek składający się z wielu innych
obiektów jadalnych.
"""
class BigMeal:
def __init__(self, edibles):
# TODO: zainicjuj obiekt przekazaną listą obiektów jadalnych
# "edibles"
def get_name(self):
# TODO: zaimplementuj metodę zwracającą nazwę obiektu
... | CodeCarrots/warsztaty | sesja07/bigmeal.py | Python | cc0-1.0 | 955 |
from operator import add
f = sc.textFile("data/README.md")
wc = f.flatMap(lambda x: x.split(' ')).map(lambda x: (x, 1)).reduceByKey(add)
wc.saveAsTextFile("wc_out")
| ceteri/intro_spark | src/02.wc.py | Python | cc0-1.0 | 167 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Cloudant のデータベース作成
#
# Copyright (C) 2016 International Business Machines Corporation
# and others. All Rights Reserved.
# ... | takara9/watson_chatbot | weather_report/load3_db_weather.py | Python | epl-1.0 | 1,717 |
#!/usr/bin/python
from txzookeeper.client import ZookeeperClient
from txzookeeper.retry import RetryClient
import zookeeper
import sys
from Crypto.Hash import SHA256
from Crypto.PublicKey import RSA
import os
from twisted.python import log
from twisted.internet import reactor, defer
log.startLogging(sys.stdout)
class... | Wallix-Resilience/LogMonitor | resilience/zookeeper/configure/config.py | Python | gpl-2.0 | 4,845 |
# Rekall Memory Forensics
# Copyright 2014 Google Inc. All Rights Reserved.
#
# 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 2 of the License, or (at
# your option) any later ver... | palaniyappanBala/rekall | rekall-core/rekall/plugins/linux/address_resolver.py | Python | gpl-2.0 | 2,567 |
# Copied from LMC documentation
# Modified to use MPI (but not enable parallelization), to increase the parameter degeneracy, and to disperse the start points
# Here is a simple example. As shown it will run in non-parallel mode; comments indicate what to do for parallelization.
from lmc import *
## for MPI
from mpi4... | drphilmarshall/StatisticalMethods | lessons/graphics/notparallel_chain_fit.py | Python | gpl-2.0 | 3,306 |
#!/usr/bin/env python
import time
import pyslurm
def reservation_display(reservation):
if reservation:
for key,value in reservation.items():
print("\t{}={}".format(key, value))
if __name__ == "__main__":
try:
end = time.time()
start = end - (30*24*60*60)
print("star... | Q-Leap-Networks/pyslurm | examples/listdb_reservations.py | Python | gpl-2.0 | 866 |
#!/usr/bin/python
from math import *
import sys
import string
k = (sqrt(2.)-1.)*4./3.
chars = []
encoding = []
count = 1
first = 1
def append(s):
chars.append(s)
def rint(x):
return int(round(x))
"""
if x>=0:
return int(x+0.5)
else:
return int(x-0.5)
"""
class vec:
def __init__(self, x, y=0)... | GeeXboX/mplayer-ui | TOOLS/subfont-c/osd/gen.py | Python | gpl-2.0 | 8,012 |
from Plugins.Plugin import PluginDescriptor
from Screens.Console import Console
from Screens.ChoiceBox import ChoiceBox
from Screens.MessageBox import MessageBox
from Screens.Screen import Screen
from Screens.Standby import TryQuitMainloop
from Screens.Ipkg import Ipkg
from Screens.SoftwareUpdate import UpdatePlugin
fr... | popazerty/dvbapp2-gui | lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py | Python | gpl-2.0 | 81,566 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
utils.py
---------------------
Date : November 2009
Copyright : (C) 2009 by Martin Dobias
Email : wonder dot sk at gmail dot com
************************... | fritsvanveen/QGIS | python/utils.py | Python | gpl-2.0 | 20,592 |
"""tifis_platform URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Cl... | Sezzh/tifis_platform | tifis_platform/tifis_platform/urls.py | Python | gpl-2.0 | 975 |
item_id = 4986168
user_id = 20000
item_category = 9656
time = 31
| CharLLCH/jianchi_alimobileR | ftrldata/TCReBuild/codes/mylibs/size.py | Python | gpl-2.0 | 65 |
#! /usr/bin/env python
"""
##############################################################################
##
##
## @Name : generateImageWebPage.py
##
## @license : MetPX Copyright (C) 2004-2006 Environment Canada
## MetPX comes with ABSOLUTELY NO WARRANTY; For details type see the file
## name... | khosrow/metpx | pxStats/bin/webPages/generateImageWebPage.py | Python | gpl-2.0 | 6,610 |
#!/usr/bin/python
import sys
import getopt
import time
import os
DATA_DIR='/local/devel/guppy/testing/'
opts, args = getopt.getopt(sys.argv[1:], 'c:t')
transfer = False
listdir = False
for opt, optarg in opts:
if opt == '-c':
if optarg == 'get' or optarg == 'put':
transfer = True
if optarg == 'dir':
lis... | ttsui/guppy | testing/fakepuppy.py | Python | gpl-2.0 | 959 |
# Copyright (c) 2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2007 Sippy Software, Inc. All rights reserved.
#
# This file is part of SIPPY, a free RFC3261 SIP stack and B2BUA.
#
# SIPPY is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pub... | lemenkov/sippy | sippy/SipReplaces.py | Python | gpl-2.0 | 2,867 |
#!/Library/Frameworks/Python.framework/Versions/Current/bin/python
import os
from os.path import join, getsize
from random import randint
def addEntry (XMLFile, finfo, dirs, NASPath):
#finfo[1].replace(' ', '_')
finfo[1] = finfo[1].replace('.', '_', finfo.count('.')-1)
title = finfo[1].split('.')[0]
... | trafferty/utils | python/buildVideoXML.py | Python | gpl-2.0 | 3,204 |
def comb(xs):
if len(xs) == 0:
return [""]
else:
return comb2(xs) + [""]
def comb2(xs):
if len(xs) == 1:
return [ xs ]
else:
subwo = comb2( xs[1:] )
head = xs[0]
subwith = [ head + zs for zs in subwo ]
return subwo + subwith + [ head ]
result = c... | greatmazinger/programming-interview-code | Python/comb.py | Python | gpl-2.0 | 382 |
# -*- coding: utf-8 -*-
#
# sympa documentation build configuration file, created by
# sphinx-quickstart on Mon Aug 25 18:11:49 2014.
#
# 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
# autogenerated file... | unistra/django-sympa | docs/conf.py | Python | gpl-2.0 | 8,528 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import print_function
import datetime
import glob
import os
import re
import sys
import subprocess
from picard import __version__, compat
if sys.version_info < (2, 6):
print("*** You need Python 2.6 or higher to use Picard.")
args = {}
try:
fro... | dufferzafar/picard | setup.py | Python | gpl-2.0 | 27,977 |
# -*- coding:utf-8 -*-
from django.conf.urls import url, patterns
from rango import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^about/$', views.about, name='about'),
# 匹配URL斜杠前所有的字母数字
# 例如 a-z, A-Z, 或者 0-9)和连字符(-
# 然后把这个值作为category_name_slug参数传递给views.category(),
... | chen2aaron/TangoWithDjangoProject | rango/urls.py | Python | gpl-2.0 | 646 |
__author__ = 'ramuta'
a = 1
b = 2
if a < b:
a = b
print a
print b
"""
Java equivalent
if (a < b) {
a = b;
}
If you delete parenthesis, brackets and semicolons you get python.
""" | ramuta/python101 | slide4.py | Python | gpl-2.0 | 193 |
# -*- coding: utf-8 -*-
from celery import Celery
from datetime import timedelta
import os
BROKER_URL = 'redis://localhost:6379/0'
celery = Celery('EOD_TASKS', broker=BROKER_URL)
# Loads settings for Backend to store results of tweets
celery.config_from_object('celeryconfig')
CELERY_RESULT_BACKEND = 'redis'
CELERY_... | nicolasteodosio/PySent | celeryconfig.py | Python | gpl-2.0 | 514 |
## begin license ##
#
# "Meresco Distributed" has components for group management based on "Meresco Components."
#
# Copyright (C) 2018, 2021 Seecr (Seek You Too B.V.) https://seecr.nl
# Copyright (C) 2021 Data Archiving and Network Services https://dans.knaw.nl
# Copyright (C) 2021 SURF https://www.surf.nl
# Copyright... | seecr/meresco-distributed | test/failover/matchesversiontest.py | Python | gpl-2.0 | 7,957 |
from jinja2 import Template
class SupervisorJob(object):
"""docstring for SupervisorJob"""
def __init__(self, config):
""" Specify the configuration options for a job.
'config' must be a dictionary containing the following keys:
- env_vars: dict containing the key/value pairs ... | jjuanda/cuco | cuco/SupervisorJob.py | Python | gpl-2.0 | 2,735 |
from distutils.core import setup
setup(
name = "cnccontrol-driver",
description = "CNC-Control device driver",
author = "Michael Buesch",
author_email = "m@bues.ch",
py_modules = [ "cnccontrol_driver", ],
)
| mbuesch/cnc-control | driver/setup_driver.py | Python | gpl-2.0 | 215 |
from xbmctorrentV2 import plugin
from xbmctorrentV2.scrapers import scraper
from xbmctorrentV2.ga import tracked
from xbmctorrentV2.caching import cached_route
from xbmctorrentV2.utils import ensure_fanart
from xbmctorrentV2.library import library_context
BASE_URL = "%s/" % plugin.get_setting("base_bitsnoop")
HEADERS... | Mafarricos/Mafarricos-modded-xbmc-addons | plugin.video.xbmctorrentV2/resources/site-packages/xbmctorrentV2/scrapers/bitsnoop.py | Python | gpl-2.0 | 1,646 |
"""
Python module defining a class for creating movies of matplotlib figures.
This code and information is provided 'as is' without warranty of any kind,
either express or implied, including, but not limited to, the implied
warranties of non-infringement, merchantability or fitness for a particular
purpose.
"""
from ... | david-zwicker/python-functions | movie_making.py | Python | gpl-2.0 | 8,083 |
__author__ = 'andrucuna'
# Ball motion with an explicit timer
import simplegui
# Initialize globals
WIDTH = 600
HEIGHT = 400
BALL_RADIUS = 20
init_pos = [WIDTH / 2, HEIGHT / 2]
vel = [0, 3] # pixels per tick
time = 0
# define event handlers
def tick():
global time
time = time + 1
def draw(canvas):
# ... | andrucuna/python | interactivepython-coursera/interactivepython/week4/Motion.py | Python | gpl-2.0 | 796 |
from supervisorerrormiddleware import SupervisorErrorMiddleware
import os
import sys
import paste.fixture
class DummyOutput:
def __init__(self):
self._buffer = []
def write(self, data):
self._buffer.append(data)
def flush(self):
self._buffer = []
def bad_app(environ, start_respon... | socialplanning/SupervisorErrorMiddleware | supervisorerrormiddleware/tests/test.py | Python | gpl-2.0 | 2,244 |
import os
import sys
import time
import numpy as np
import bge.logic as GameLogic
import settings
import nicomedilib as ncl
import arduino_serial
import serial
import xinput
import random
import copy
from PIL import Image
import gnoomcomm as gc
import gnoomio as gio
import gnoomutils as gu
import chooseWalls
if sett... | neurodroid/gnoom | py/gnoominit.py | Python | gpl-2.0 | 15,471 |
import Gears as gears
from .. import *
from .Base import *
class Solid(Base) :
def applyWithArgs(
self,
spass,
functionName,
*,
color : 'Solid pattern color, or Interactive.*'
= 'white'
) :
... | szecsi/Gears | GearsPy/Project/Components/Pif/Solid.py | Python | gpl-2.0 | 882 |
#!/usr/bin/python
# LICENSE: GPL2
# (c) 2013 Tom Schouten <tom@getbeep.com>
# (c) 2014, Kamil Wartanowicz <k.wartanowicz@gmail.com>
import logging
import os
import threading
import time
import usb
import plac
import sim_shell
import sim_ctrl_2g
import sim_ctrl_3g
import sim_reader
import sim_card
from util import t... | kamwar/simLAB | sim/sim_router.py | Python | gpl-2.0 | 28,870 |
import re
import sys
sys.path.append('..')
from src.link import Link
from src.node import Node
class Network(object):
def __init__(self, config):
self.config = config
self.nodes = {}
self.address = 1
self.build()
def build(self):
state = 'network'
with open(s... | ihartung/460-Lab1 | networks/network.py | Python | gpl-2.0 | 3,070 |
from frontend import views
from rest_framework import routers
from django.conf.urls import patterns, url, include
router = routers.DefaultRouter()
router.register(r'categories', views.CategoryViewSet)
router.register(r'packages', views.PackageViewSet)
router.register(r'files', views.FileViewSet)
router.register(r'clie... | michael-robbins/jobqueue_frontend | frontend/urls.py | Python | gpl-2.0 | 2,971 |
from olpc import db
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80))
email = db.Column(db.String(120), unique=True)
def __init__(self, name, email):
self.name = name
self.email = email
def __repr__(self):
return '<Name %r... | LeotisBuchanan/olpc-datavisualization- | models.py | Python | gpl-2.0 | 341 |
#!/usr/bin/env python
import distribute_setup
# User may not have setuptools installed on their machines.
# This script will automatically install the right version from PyPI.
distribute_setup.use_setuptools()
import setuptools
setuptools.setup(
name='gae-console',
description=('Powerful Interactive Console for A... | sadovnychyi/gae-console | setup.py | Python | gpl-2.0 | 723 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Unit tests for script argument utilities. """
from __future__ import print_function, unicode_literals
import pytest
import argparse
from Cerebrum.utils.scriptargs import build_callback_action
class CallbackCalled(Exception):
pass
def test_build_callback_action... | unioslo/cerebrum | testsuite/tests/test_core/test_utils/test_scriptargs.py | Python | gpl-2.0 | 925 |
###############################################################################
# This file is part of openWNS (open Wireless Network Simulator)
# _____________________________________________________________________________
#
# Copyright (C) 2004-2007
# Chair of Communication Networks (ComNets)
# Kopernikusstr. 16, D-... | creasyw/IMTAphy | framework/library/PyConfig/openwns/probebus.py | Python | gpl-2.0 | 9,523 |
#!/usr/bin/env python2.6
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
import cgi
import SocketServer
import ssl
import re
import setproctitle
import others.dict2xml as dict2xml
import sober.config
import sober.settings
import sober.rule
__version__ = 'Sober HTTP/1.0'
_... | theflockers/sober-filter | programs/webservice/__init__.py | Python | gpl-2.0 | 9,399 |
__author__ = 'eduardoluz'
| luzeduardo/antonov225 | flyer/flyerapp/templatetags/__init__.py | Python | gpl-2.0 | 26 |
#
# Copyright 2011-2017 Red Hat, Inc.
#
# 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | EdDev/vdsm | vdsm/hooking.py | Python | gpl-2.0 | 2,647 |
#
# Copyright 2016-2017 Red Hat, Inc.
#
# 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | EdDev/vdsm | tests/network/func_net_basic_test.py | Python | gpl-2.0 | 11,637 |
"""
WSGI config for yookan_todo project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_S... | ankitjavalkar/algosutra | yookan_todo_proj/yookan_todo/yookan_todo/wsgi.py | Python | gpl-2.0 | 399 |
#********************************************************************************
#* Dionaea
#* - catches bugs -
#*
#*
#*
#* Copyright (C) 2010 Markus Koetter & Tan Kean Siong
#* Copyright (C) 2009 Paul Baecher & Markus Koetter & Mark Schloesser
#*
#* This prog... | chenjj/dionaea | modules/python/scripts/ihandlers.py | Python | gpl-2.0 | 5,570 |
#
# This is a parser that generates the document tree for you.
#
# To use this parser, create an instance of XElementParser:
# parser = saxexts.make_parser()
# xp = XElementParser(parser)
#
# If you have defined classes in the current environment, you might want ot
# pass this environment *to* the parser, so your... | aarestad/gradschool-stuff | xml-class/python-xml/JobMarkupLanguage/xparser.py | Python | gpl-2.0 | 2,877 |
#!bin/python
# TSV to Dublin Core/McMaster Repository conversion tool
# Matt McCollow <mccollo@mcmaster.ca>, 2011
# Nick Ruest <ruestn@mcmaster.ca>, 2011
from DublinCore import DublinCore
import csv
from sys import argv
from xml.dom.minidom import Document
from os.path import basename
DC_NS = 'http://purl.org/dc/ele... | mmccollow/TSV-Convert | tsv-convert.py | Python | gpl-2.0 | 3,059 |
from abc import abstractmethod
class VIFDriver(object):
@abstractmethod
def after_device_destroy(self, environ, domxml):
return domxml
@abstractmethod
def after_device_create(self, environ, domxml):
return domxml
@abstractmethod
def after_network_setup(self, environ, json_co... | mmirecki/ovirt-provider-mock | vifdriver/vif_driver.py | Python | gpl-2.0 | 1,986 |
#!/usr/bin/env python
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import numpy as np
import os.path as op
import util
import yt
import MPI_taskpull2
import logging
logging.getLogger('yt').setLevel(logging.ERROR)
# Scan for files
dirs = ['/home/ychen/data/0only_0529_h1/',\
'/hom... | yihaochen/FLASHtools | grid_analysis/GridAnalysis_Vorticity.py | Python | gpl-2.0 | 2,344 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, absolute_import
"""JSON flat file database system."""
import codecs
import os
import os.path
import re
from fcntl import flock, LOCK_EX, LOCK_SH, LOCK_UN
import redis
import json
import time
from rophako.settings import Config
from roph... | kirsle/rophako | rophako/jsondb.py | Python | gpl-2.0 | 7,743 |
from pymuco.midiio import *
from pymuco.midi import representation
class MidiParser(MidiOutStream.MidiOutStream):
"""
This class listens to a select few midi events relevant for a simple midifile containing a pianomelody
"""
def __init__(self, midifile):
self.midifile = midifile
self.notes_on = {}
... | bjvanderweij/pymuco | pymuco/midi/parser.py | Python | gpl-2.0 | 3,303 |
# -*- coding: utf-8 -*-
# MouseTrap
#
# Copyright 2009 Flavio Percoco Premoli
#
# This file is part of mouseTrap.
#
# MouseTrap is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License v2 as published
# by the Free Software Foundation.
#
# mouseTrap is distributed ... | amberheilman/mousetrap | src/mousetrap/app/lib/settings.py | Python | gpl-2.0 | 3,450 |
from django.conf.urls import patterns, url
from iyoume.waybill import views as dr
urlpatterns = patterns('',
url(r'^add/', dr.make_waybill),
url(r'^del/', dr.remove_waybill),
url(r'^find/', dr.search_waybill),
url(r'^take/', dr.take_place),
url(r'^trips/', dr.trips),
url(r'^cancel_trip/', dr.ca... | rasmadeus/iyoume | iyoume/waybill/urls.py | Python | gpl-2.0 | 408 |
#! /usr/bin/env python
""" cryptopy.cipher.rijndael_test
Tests for the rijndael encryption algorithm
Copyright (c) 2002 by Paul A. Lambert
Read LICENSE.txt for license information.
"""
from cryptopy.cipher.rijndael import Rijndael
from cryptopy.cipher.base import noPadding
from binascii ... | repotvsupertuga/tvsupertuga.repository | script.module.cryptolib/lib/cryptopy/cipher/rijndael_test.py | Python | gpl-2.0 | 9,568 |
import csv, os
from Products.CMFCore.utils import getToolByName
def get_folder(self, type, name):
folder_brains = self.queryCatalog({'portal_type':type, 'title':name})[0]
return folder_brains.getObject()
def create_object_in_directory(self, container, type):
id = container.generateUniqueId(type)
conta... | uwosh/UWOshMusicRecruiting | Extensions/import_visits.py | Python | gpl-2.0 | 3,594 |
#!/usr/bin/python
import glob,re,sys,math,pyfits
import numpy as np
import utils
if len( sys.argv ) < 2:
print '\nconvert basti SSP models to ez_gal fits format'
print 'Run in directory with SED models for one metallicity'
print 'Usage: convert_basti.py ez_gal.ascii\n'
sys.exit(2)
fileout = sys.argv[1]
# try to... | drdangersimon/EZgal | examples/convert/convert_basti.py | Python | gpl-2.0 | 3,979 |
max = A[1]
for i in range(len(A)):
if A.count(A[i]) > A.count(max):
max = A[i]
print(max)
| chelberserker/mipt_cs_on_python | exes/ex4.py | Python | gpl-2.0 | 93 |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 29 15:52:33 2014
@author: raffaelerainone
"""
from time import clock
from math import sqrt
def is_prime(n):
check=True
i=2
while check and i<=sqrt(n):
if n%i==0:
check=False
i+=1
return check
start = clock()
lim=50*(10**6)... | raffo85h/projecteuler | 87. Prime power triples.py | Python | gpl-2.0 | 692 |
def main():
print "hola"
print "Como te llmas?"
nombre = raw_input()
print "Buenos dias", nombre
print "Que edad tienes?"
edad = raw_input()
print "que bien te conservas para tener", edad
main()
| Djhacker18/Python | Practica1Conver.py | Python | gpl-2.0 | 202 |
"""
EDENetworks, a genetic network analyzer
Copyright (C) 2011 Aalto University
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 2 of the License, or
(at your option) any later version... | bolozna/EDENetworks | netpython/dialogues.py | Python | gpl-2.0 | 64,787 |
import os
from glob import glob
from pyramid.path import AssetResolver
from reportlab.lib.units import mm
from reportlab.pdfgen import canvas
from ..models import generate_random_digest
__all__ = [
'generate_random_filename',
'delete_files',
'NumberedCanvas'
]
def generate_random_filename(path=None, ext... | dbbaleva/ERP-Forwarding | erp/reports/util.py | Python | gpl-2.0 | 1,516 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ExportGeometryInfo.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
********************... | GeoCat/QGIS | python/plugins/processing/algs/qgis/ExportGeometryInfo.py | Python | gpl-2.0 | 6,865 |
import vim
def func_header_snippet(row):
cmt = "//!"
cb = vim.current.buffer
start = row
while start >= 0:
line = cb[start-1].strip()
if not line.startswith(cmt):
break
start -= 1
print("HDR")
def select_snippet(line):
line = line.strip()
if line.star... | peter1010/my_vim | vimfiles/py_scripts/snippet.py | Python | gpl-2.0 | 569 |
#!/bin/env python
#-*- coding=utf-8 -*-
import yaml
data = """
f5:
# 蓝汛f5信息
- ip: 192.168.0.1
dc: lx
credentials:
username: huzichun
password: huzichun!@#
role: master
# 世纪互联f5信息
- ip: 192.168.0.2
dc: sjhl
credentials:
username: huzichun
password: huzichun!@#
role: slave
# 移动f5信息
- ip: 1... | huzichunjohn/2014 | test_yaml.py | Python | gpl-2.0 | 810 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('taxonomy', '0003_auto_20150720_1937'),
]
operations = [
migrations.AddField(
model_name='taxon',
nam... | wabarr/taxonomy | taxonomy/migrations/0004_auto_20150721_2058.py | Python | gpl-2.0 | 563 |
"""
Authorization module that allow users listed in
/etc/cobbler/users.conf to be permitted to access resources, with
the further restriction that cobbler objects can be edited to only
allow certain users/groups to access those specific objects.
Copyright 2008-2009, Red Hat, Inc and Others
Michael DeHaan <michael.deha... | shenson/cobbler | cobbler/modules/authz_ownership.py | Python | gpl-2.0 | 7,391 |
#Copyright Intrepidus Group 2010
#All Rights Reserved
#Released under the following license
#
#PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
#--------------------------------------------
#
#0. This Python Software Foundation License (the "License") applies to
#any original work of authorship (the "Software") whose owner... | ausarbluhd/EternalLLC | scripts/mallory/src/mallory.py | Python | gpl-2.0 | 21,144 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.