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 |
|---|---|---|---|---|---|
#!/usr/bin/env python3
import torch
from torch.distributions.kl import kl_divergence
from ..distributions import Delta, MultivariateNormal
from ..lazy import MatmulLazyTensor, SumLazyTensor
from ..utils.errors import CachingError
from ..utils.memoize import pop_from_cache_ignore_args
from .delta_variational_distribut... | jrg365/gpytorch | gpytorch/variational/batch_decoupled_variational_strategy.py | Python | mit | 11,612 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Bien',
fields=[
('id', models.AutoField(verbose... | lanacioncom/ddjj_admin_lanacion | admin_ddjj_app/migrations/0001_initial.py | Python | mit | 15,375 |
#encoding: utf-8
from flask.ext.restful import Resource, reqparse
class Test(Resource):
def __init__(self):
self.parser = reqparse.RequestParser()
self.parser.add_argument('id', type=int)
super(AccountAPI, self).__init__()
def get(self):
return {'id': id}
def post(self)... | chenke91/ckPermission | app/api_v1/resources/tests.py | Python | mit | 403 |
# -*- coding: utf-8 -*-
"""
Helper functions used in views.
"""
from json import dumps
from functools import wraps
from flask import Response
def jsonify(function):
"""
Creates a response with the JSON representation of wrapped function result.
"""
@wraps(function)
def inner(*args, **kwargs):
... | sargo/exif-compare | src/exif_compare/utils.py | Python | mit | 446 |
#-------------------------------------------------------------------------
# The Azure Batch Apps Python Client
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated docu... | Azure/azure-batch-apps-python | batchapps/test/unittest_pool.py | Python | mit | 7,440 |
def AND(x1, x2):
w1, w2, theta = 0.5, 0.5, 0.7
tmp = x1 * w1 + x2 * w2
if tmp <= theta:
print(0)
elif tmp > theta:
print(1)
AND(0, 0)
AND(1, 0)
AND(0, 1)
AND(1, 1)
| yukihirai0505/tutorial-program | programming/python/machine-learning/ch02/and_gate01.py | Python | mit | 198 |
#!/usr/bin/env python3
def get_plist_text(cf_bundler_identifier, cf_bundle_name=None,
docset_platform_family=None):
"""TODO"""
cf_bundle_name = cf_bundle_name or cf_bundler_identifier.upper()
docset_platform_family = docset_platform_family or cf_bundle_name.upper()
return """
<?xml version="1... | cblair/docset_from_html | get_plist_text.py | Python | mit | 959 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_envcheckr
----------------------------------
Tests for `envcheckr` module.
"""
import pytest
from envcheckr import envcheckr
def test_parse_lines():
lines_a = envcheckr.parse_lines('tests/env')
assert len(lines_a) == 3
lines_b = envcheckr.parse_li... | adamjace/envcheckr | tests/test_envcheckr.py | Python | mit | 983 |
from django.template import Library
from django.conf import settings
if "django.contrib.sites" in settings.INSTALLED_APPS:
from django.contrib.sites.models import Site
current_domain = lambda: Site.objects.get_current().domain
elif getattr(settings, "SITE_DOMAIN", None):
current_domain = lambda: settings.... | Rootbuzz/Django-Socialtags | socialtags/templatetags/social_tags.py | Python | mit | 1,400 |
from django.db import models
class Salary(models.Model):
id = models.AutoField(primary_key = True)
bh = models.CharField(max_length = 10)
xm = models.CharField(max_length = 12)
status = models.CharField(max_length = 8)
class Meta:
db_table = 'swan_salary'
def __str__(self):
ret... | huaiping/pandora | salary/models.py | Python | mit | 332 |
#Pizza please
import pyaudiogame
from pyaudiogame import storage
spk = pyaudiogame.speak
MyApp = pyaudiogame.App("Pizza Please")
storage.screen = ["start"]
storage.toppings = ["cheese", "olives", "mushrooms", "Pepperoni", "french fries"]
storage.your_toppings = ["cheese"]
storage.did_run = False
def is_number(number,... | frastlin/PyAudioGame | examples/basic_tutorial/ex6.py | Python | mit | 2,789 |
from exterminate.Utilities import builtins
_range = range
def alt_range(start, stop, step=1):
return _range(start-2, stop+2, max(1, int(step/2)))
builtins.range = alt_range
| adtac/exterminate | exterminate/AltRange.py | Python | mit | 183 |
from collections import OrderedDict
class DataSet(object):
__slots__ = (
'events', # List of all events in this data set
'group', # Iterable containing groups of events
)
def __init__(self, query, group_function):
self.events = query.all()
if group_function is None:
... | ex-nerd/health-stats | health_stats/dataset.py | Python | mit | 1,067 |
import logging
from datetime import datetime
from core import app
from sqlalchemy import inspect
from flask.ext.sqlalchemy import SQLAlchemy
db = SQLAlchemy(app)
class Show(db.Model):
show_id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50))
link = db.Column(db.String(255))
c... | fahadshaon/tv_tracker | db.py | Python | mit | 3,213 |
import unittest
from .connected_graph import Node
class TestConnectedGraph(unittest.TestCase):
def test_acyclic_graph(self):
"""Example graph from https://upload.wikimedia.org/wikipedia/commons/0/03/Directed_acyclic_graph_2.svg"""
n9 = Node(9)
n10 = Node(10)
n8 = Node(8, [n9])
... | intenthq/code-challenges | python/connected_graph/test_connected_graph.py | Python | mit | 910 |
import _plotly_utils.basevalidators
class LocationssrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="locationssrc", parent_name="choropleth", **kwargs):
super(LocationssrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_n... | plotly/python-api | packages/python/plotly/plotly/validators/choropleth/_locationssrc.py | Python | mit | 456 |
# -*- coding: utf-8 -*-
"""
Test for: command line arguments
"""
from nose.tools import eq_, assert_raises
from m2bk import app, config, const
import os
def _get_arg_cfg_file_name(arg, filename):
try:
app.init_parsecmdline([arg, filename])
except FileNotFoundError:
pass
return config.get... | axltxl/m2bk | tests/test_app.py | Python | mit | 1,751 |
#!/usr/bin/python
# openvpn.py: library to handle starting and stopping openvpn instances
import subprocess
import threading
import time
class OpenVPN():
def __init__(self, config_file=None, auth_file=None, timeout=10):
self.started = False
self.stopped = False
self.error = False
... | ben-jones/centinel | centinel/vpn/openvpn.py | Python | mit | 2,675 |
from cocosCairo.cocosCairo import * # Convenience module to import all other modules
from splash import *
BACKGROUND_COLOR = Color(0.1, 0.3, 0.7)
MAZE_PATHS = ["maze01.maze", "maze02.maze", "maze03.maze"] # an ordered list of the maze files
PATH_INDEX = 0 # the index of the next maze file to load
class MazeScene(Sce... | jeremyflores/cocosCairo | oldTests/maze.py | Python | mit | 9,600 |
#!/usr/bin/python
import re, csv, sys
from urlparse import urlparse
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize, sent_tokenize
from nltk.text import TextCollection
#process command line arguments
if len(sys.argv) < 2:
print "ERROR: arg1: must specify the input file"
print " ... | satybald/twitter-modeling-lda | source code/preprocess.py | Python | mit | 5,802 |
# """SearchIndex classes for Django-haystack."""
from typing import List
from django.utils.html import format_html, mark_safe
from haystack import indexes
from projects.models import Project, Nomination, Claim
class ProjectIndex(indexes.SearchIndex, indexes.Indexable):
"""Django-haystack index of Project model.... | CobwebOrg/cobweb-django | projects/search_indexes.py | Python | mit | 4,143 |
# PRNG (Pseudo-Random Number Generator) Test
# PRNG info:
# http://en.wikipedia.org/wiki/Pseudorandom_number_generator
# FB - 201012046
# Compares output distribution of any given PRNG
# w/ an hypothetical True-Random Number Generator (TRNG)
import math
import time
global x
x = time.clock() # seed for the PRNG
# PRNG ... | ActiveState/code | recipes/Python/577484_PRNG_Test/recipe-577484.py | Python | mit | 1,669 |
from datetime import date
from . import GenericCalendarTest
from ..america import (
Argentina, Barbados, Chile, Colombia, Mexico, Panama, Paraguay
)
class ArgentinaTest(GenericCalendarTest):
cal_class = Argentina
def test_holidays_2018(self):
holidays = self.cal.holidays_set(2018)
# 1. Añ... | jaraco/calendra | calendra/tests/test_america.py | Python | mit | 20,047 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('deals', '0002_advertiser_logo'),
]
operations = [
migrations.RemoveField(
model_name='advertiser',
n... | andela/troupon | troupon/deals/migrations/0003_remove_advertiser_logo.py | Python | mit | 349 |
from networkx import DiGraph
from networkx.readwrite import json_graph
import cantera as ct
import numpy as np
import json
#from src.core.def_tools import *
import os
__author__ = 'Xiang Gao'
""" ----------------------------------------------
construction of the element flux graph
---------------------------------... | golsun/GPS | src/core/def_build_graph.py | Python | mit | 4,118 |
import argparse
import datetime
import pathlib
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from mushroom_rl.algorithms.value import AveragedDQN, CategoricalDQN, DQN,\
DoubleDQN, MaxminDQN, DuelingDQN, NoisyDQN, Rainbow
from mushroom_rl.approxim... | carloderamo/mushroom | examples/atari_dqn.py | Python | mit | 19,062 |
"""
WSGI config for django-example project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICA... | gen1us2k/django-example | config/wsgi.py | Python | mit | 1,453 |
"""
@package ssw_wrap
@brief Simple python wrapper for SSW align library
To use the dynamic library libssw.so you may need to modify the LD_LIBRARY_PATH environment
variable to include the library directory (export LD_LIBRARY_PATH=$PWD) or for definitive
inclusion of the lib edit /etc/ld.so.conf and add the path or the... | svviz/svviz | src/ssw/ssw_wrap.py | Python | mit | 15,367 |
import os
import re
import string
from itertools import chain
from .detector_morse import Detector
from .detector_morse import slurp
# from .penn_treebank_tokenizer import word_tokenize
import nlup
from pug.nlp.constant import DATA_PATH
from pug.nlp.util import generate_files
# regex namespace only conflicts with reg... | hobson/pug-nlp | pug/nlp/segmentation.py | Python | mit | 13,806 |
from .base import *
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '!i%7s@1+v&293zcy*kljuke=_l176nqpj2-3dtms()pw^et!we'
# SECURITY WARNING: don't run... | acdh-oeaw/dig_ed_cat | digital_editions/settings/dev.py | Python | mit | 533 |
""" """
from __future__ import unicode_literals, division, print_function, absolute_import
import argparse
import codecs
import sys
from sqlalchemy.engine import create_engine
from sqlalchemy.schema import MetaData
from sqlacodegen.codegen import CodeGenerator
import sqlacodegen
def main():
parser = argparse.Ar... | rflynn/sqlacodegen | sqlacodegen/main.py | Python | mit | 2,382 |
import re
import string
import sys
sys.path.append('/Users/exu/PlayGround/readinglists/')
from key.keys import *
from amazon.api import AmazonAPI
from html2text import html2text
pattern = re.compile("https?://.*amazon.com/gp/product/([0-9]+)/.*")
amazon = AmazonAPI(AMAZON_ACCESS_KEY_ID, AMAZON_SECRET_ACCESS_KEY, AMAZ... | xuy/readinglists | md_gen/parse.py | Python | mit | 1,942 |
from PyQt4 import QtCore
from PyQt4 import QtGui
from Action import Speech
from UI.ActionPushButton import ActionPushButton
class BaseStudy(QtGui.QWidget):
def __init__(self):
super(BaseStudy, self).__init__()
self._actionQueue = None
self._nao = None
self._widgets = None
s... | mattBrzezinski/Hydrogen | robot-controller/Study/BaseStudy.py | Python | mit | 6,141 |
class CodeBlock:
"""Code fragment for the readable format.
"""
def __init__(self, head, codes):
self._head = '' if head == '' else head + ' '
self._codes = codes
def _to_str_list(self, indent_width=0):
codes = []
codes.append(' ' * indent_width + self._head + '{')
... | cupy/cupy | cupy/_core/_codeblock.py | Python | mit | 966 |
import redis
from app.config import get_config_obj
from app.util.httputil import Http_util
class Component_access_token():
def __init__(self):
self.component_appid = get_config_obj().component_appid
self.component_appsecret = get_config_obj().component_secret
self.r = redis.Redis(host='lo... | CoderHito/wx_demo | app/util/component_access_token.py | Python | mit | 772 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Reference.year'
db.add_column(u'citations_reference', 'year',
self.gf(... | will-hart/django-citations | citations/migrations/0006_auto__add_field_reference_year.py | Python | mit | 2,201 |
from selenium import webdriver
from time import sleep
driver = webdriver.Firefox()
driver.get("https://www.baidu.com/")
#绝对路径定位
# driver.find_element_by_xpath("/html/body/div[1]/div[1]/div/div[1]/div/form/span[1]/input").send_keys("51zxw")
# a.根据input标签中的id属性定位元素
driver.find_element_by_xpath("//input[@id='kw']").se... | 1065865483/0python_script | four/Webdriver/FindElement/By_xpath_p1.py | Python | mit | 674 |
import unittest
from datetime import date
from binder.col import *
from binder.table import Table, SqlCondition, SqlSort, AND, OR
from bindertest.tabledefs import Foo, Bar
class TableTest(unittest.TestCase):
def test_init_2_AutoIdCols(self):
# Table can have only 1 AutoIdCol
try:
T... | divtxt/binder | bindertest/test_table.py | Python | mit | 9,815 |
""":mod:`cliche.celery` --- Celery_-backed task queue worker
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sometimes web app should provide time-consuming features that cannot
immediately respond to user (and we define "immediately" as "shorter than
a second or two seconds" in here). Such things should... | clicheio/cliche | cliche/celery.py | Python | mit | 7,480 |
from __future__ import absolute_import
from sqlalchemy import *
from migrate import *
meta = MetaData()
vieworderings = Table('vieworderings', meta,
Column('id', Integer, primary_key=True),
Column('tagset', Text()),
Column('timestamp', Float, index=True),
)
def upgrade(migrate_engine)... | inducer/synoptic | synoptic/schema_ver_repo/versions/001_Rename_tagset_column.py | Python | mit | 467 |
import _plotly_utils.basevalidators
class ShowexponentValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="showexponent", parent_name="parcats.line.colorbar", **kwargs
):
super(ShowexponentValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/parcats/line/colorbar/_showexponent.py | Python | mit | 569 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0002_auto_20141029_1945'),
]
operations = [
migrations.CreateModel(
name='Tag',
fields=[
... | bobisjan/django-shanghai | tests/project/blog/migrations/0003_auto_20141104_2232.py | Python | mit | 823 |
from distutils.core import setup
setup(
name='flashback',
packages=['flashback'],
version='0.4',
description='The handiest Flashback scraper in the game',
author='Robin Linderborg',
author_email='robin.linderborg@gmail.com',
install_requires=[
'beautifulsoup4==4.4.1',
'reques... | vienno/flashback | setup.py | Python | mit | 515 |
from ..gitpub import gitpub
def sort_repos(repo_list):
"""
Sort the repo_list using quicksort
Parameters
----------------------------------
repo_list : [gitpub.Repository()]
Array of friends (loaded from the input file)
=================================================
Returns:
... | Demfier/GitPub | build/lib/samples/most_popular_repo.py | Python | mit | 1,767 |
ACCESS_KEY = 'twitter_access_token'
REQUEST_KEY = 'twitter_request_token'
SUCCESS_URL_KEY = 'twitter_success_url'
USERINFO_KEY = 'twitter_user_info'
| callowayproject/django-tweeter | django_oauth_twitter/__init__.py | Python | mit | 149 |
# The scripts begin here
| odarbelaeze/dummy-project | firtFile.py | Python | mit | 26 |
# -*- coding:utf-8 -*-
import platform
import asyncio
import json
from base.logger import LOG
def singleton(cls, *args, **kw):
instances = {}
def _singleton(*args, **kw):
if cls not in instances:
instances[cls] = cls(*args, **kw)
return instances[cls]
return _singleton
def... | JanlizWorldlet/FeelUOwn | src/base/utils.py | Python | mit | 1,039 |
##################################################################################################
# Copyright (c) 2012 Brett Dixon
#
# 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 r... | theiviaxx/Frog | frog/management/commands/frog_queue_videos.py | Python | mit | 2,015 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_12_01/aio/operations/_public_ip_addresses_operations.py | Python | mit | 40,646 |
"""dryorm URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/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')
Class-bas... | omaraboumrad/djanground | backend/dryorm/urls.py | Python | mit | 971 |
import json
from feature_ramp import redis
class Feature(object):
"""
A class to control ramping features to a percentage of users
without needing to deploy to change the ramp.
Usage:
Feature("on_off_toggled").activate()
Feature("on_off_toggled").is_active
Feature("on_off_toggled").deac... | venmo/feature_ramp | feature_ramp/Feature.py | Python | mit | 9,312 |
# coding: utf-8
from unittest import TestCase
#import string
import json
import re
from grab import Grab, GrabMisuseError
from test.util import TMP_FILE, GRAB_TRANSPORT, get_temp_file
from test.server import SERVER
from grab.proxy import ProxyList
DEFAULT_PLIST_DATA = \
'1.1.1.1:8080\n'\
'1.1.1.2:8080\n'
cla... | subeax/grab | test/case/proxy.py | Python | mit | 3,521 |
#!/usr/bin/env python
# Jonas Schnelli, 2013
# make sure the Nichts-Qt.app contains the right plist (including the right version)
# fix made because of serval bugs in Qt mac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267)
from string import Template
from datetime import date
bitcoinDir = "./... | eysho/BestKnownGame-Coins---Source | share/qt/clean_mac_info_plist.py | Python | mit | 922 |
#implementation of radix sort in Python.
def RadixSort(A):
RADIX = 10
maxLength = False
tmp , placement = -1, 1
while not maxLength:
maxLength = True
buckets = [list() for _ in range(RADIX)]
for i in A:
tmp = i / placement
buckets[tmp % RADIX].append(i)
if maxLength and tmp > 0:
maxL... | applecool/Practice | Python/Sorting/RadixSort.py | Python | mit | 556 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Resources to make it easier and faster to implement and test game of life
#
# @author Mikael Wikström
# https://github.com/leakim/GameOfLifeKata
#
import pygame
class GameOfLife:
# still
BLOCK_0 = set([(0, 0), (0, 1), (1, 0), (1, 1)])
BLOCK_1 = BLOCK_0
... | leakim/GameOfLifeKata | python/resources.py | Python | mit | 1,181 |
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import numpy as np
def coefficient(slipValue, extremumValue, extremumSlip, asymptoteValue, asymptoteSlip):
coefficient = asymptoteValue;
absoluteSlip... | tommiseppanen/visualizations | tyre-model/old-plots/combined-slip-basic.py | Python | mit | 1,320 |
# -*- coding: utf-8 -*-
import os
import logging
from dotenv import find_dotenv, load_dotenv
from constants import *
import json
from utils import json_from_file, merge_json
import shutil
from settings import *
def prepare_train_data():
""" Runs data processing scripts to turn traning raw data from (../raw) into
... | iamhuy/rumour-veracity-verification | src/data/make_interim.py | Python | mit | 7,273 |
# mailstat.utils
# Utilities and functions for the mailstat package
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Sun Dec 29 17:27:38 2013 -0600
#
# Copyright (C) 2013 Bengfort.com
# For license information, see LICENSE.txt
#
# ID: __init__.py [] benjamin@bengfort.com $
"""
Utilities and function... | bbengfort/email-analysis | mailstat/utils/__init__.py | Python | mit | 513 |
import unittest
from .layer import *
class L(Layer):
L1 = LayerSpec("l1", "layer-1")
L2 = LayerSpec("l2", "layer-2", [L1])
class TestLayer(unittest.TestCase):
def testFromId(self):
self.assertEqual(L.FromId(L.L1.id_), L.L1)
self.assertEqual(L.FromId(L.L2.id_), L.L2)
def testFromName(self):
sel... | mthomure/glimpse-project | glimpse/models/base/layer_test.py | Python | mit | 741 |
import OOMP
newPart = OOMP.oompItem(9439)
newPart.addTag("oompType", "RESE")
newPart.addTag("oompSize", "0805")
newPart.addTag("oompColor", "X")
newPart.addTag("oompDesc", "O202")
newPart.addTag("oompIndex", "01")
OOMP.parts.append(newPart)
| oomlout/oomlout-OOMP | old/OOMPpart_RESE_0805_X_O202_01.py | Python | cc0-1.0 | 243 |
def circle(cx, cy, diameter):
radius = diameter / 2
oval(cx - radius, cy - radius, diameter, diameter)
# diameter = 254
# radius = diameter / 2
# cx, cy = (420, 532)
# oval(cx - radius, cy - radius, diameter, diameter)
circle(420, 532, 254)
# diameter = 154
# radius = diameter / 2
# cx, cy = (728, 414)
# ov... | shannpersand/cooper-type | workshops/Python Workshop/Just/2016-06-21 Cooper workshop day 2/14 circle function.py | Python | cc0-1.0 | 416 |
def countup(n):
if n >= 10:
print "Blastoff!"
else:
print n
countup(n+1)
def main():
countup(1)
main()
def countdown_from_to(start,stop):
if start == stop:
print "Blastoff!"
elif start <= stop:
print "Invalid pair"
else:
print start
countdown_from_to(start - 1,stop)
def main():
countdown_... | tonsom1592-cmis/tonsom1592-cmis-cs2 | recursion.py | Python | cc0-1.0 | 624 |
#Music Class and support functions
import pygame
import parameters
from filemanager import filemanager
from pygame.locals import *
from pygame import *
from pygame.mixer import *
#Pygame Module for Music and Sound
pigmusic = None
currentStdMusic=None
currentMenuMusic=None
currentType = None
def initmusic():
globa... | ilathid/ilathidEngine | engine/music.py | Python | epl-1.0 | 6,871 |
## This file is part of Invenio.
## Copyright (C) 2012 CERN.
##
## Invenio 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.
##
## Inv... | kntem/webdeposit | modules/bibworkflow/lib/tasks/simplified_data_tasks.py | Python | gpl-2.0 | 1,455 |
from pik.flights import Flight
import csv
import sys
reader = csv.reader(sys.stdin)
for flight in Flight.generate_from_csv(reader):
print flight
| tazle/pik-laskutin | import-flights.py | Python | gpl-2.0 | 151 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
#===============================================================================
#
# Dependencies
#
#-------------------------------------------------------------------------------
from layman.utils import path
from laym... | gentoo/layman | layman/overlays/modules/stub/stub.py | Python | gpl-2.0 | 1,731 |
import os
from flask import Flask
from flask import request
import requests
import random
import codecs
#API id
#move this to a config file
bot_id = ''
app = Flask(__name__)
#encode string as ASCII
def stripped(text):
text = text.lower()
return text.encode('ascii','replace_spc')
def send(text):
message = {
't... | marcb1/groupme_bot | src/groupme_bot.py | Python | gpl-2.0 | 891 |
from django.conf.urls import patterns, url
from django.contrib import admin
import views
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^$', views.HomeView.as_view(), name="home"),
url(r'^clues/$', views.CluesView.as_view(), name="clues"),
url(r'^test$', views.TestView.as_view(), name="test... | hillscottc/quest | questapp/urls.py | Python | gpl-2.0 | 484 |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# Convolve MTSS rotamers with MD trajectory.
# Copyright (c) 2011-2017 Philip Fowler and AUTHORS
# Published under the GNU Public Licence, version 2 (or higher)
#
# Includ... | MDAnalysis/RotamerConvolveMD | rotcon/library.py | Python | gpl-2.0 | 5,002 |
from django.http import HttpResponse, HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response
from omeroweb.webgateway.views import getBlitzConnection, _session_logout
from omeroweb.webgateway import views as webgateway_views
import settings
import logging
impor... | joshmoore/openmicroscopy | components/tools/OmeroWeb/omeroweb/webmobile/views.py | Python | gpl-2.0 | 20,846 |
from netfilterqueue import NetfilterQueue
from dpkt import ip, icmp, tcp, udp
from scapy.all import *
import socket
def print_and_accept(pkt):
data=pkt.get_payload()
res = ip.IP(data)
res2 = IP(data)
i = ICMP(data)
t = TCP(data)
u = UDP(data)
print "SOURCE IP: %s\tDESTINATION IP: %s" % (soc... | rafaelsilvag/pyNFRouter | test/teste.py | Python | gpl-2.0 | 798 |
########################################################################
# #
# Anomalous Diffusion #
# #
############################... | CNS-OIST/STEPS_Example | publication_models/API_2/Chen_FNeuroinf_2014/AD/AD_single.py | Python | gpl-2.0 | 2,125 |
from django.contrib.auth import authenticate, login, get_user_model
from mailin import Mailin
from string import punctuation
def authorize(request):
email = request.POST.get('Email')
password = request.POST.get('Password')
if len(email) < 6 or len(password) < 10:
return {'ERROR' : 'Too short'}
else:
user = a... | knoopr/ShotForTheHeart | ShotForTheHeart/utils.py | Python | gpl-2.0 | 2,874 |
# -*- mode: python; indent-tabs-mode: nil; tab-width: 3 -*-
# vim: set tabstop=3 shiftwidth=3 expandtab:
#
# Copyright (C) 2001-2005 Ichiro Fujinaga, Michael Droettboom,
# and Karl MacMillan
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU... | DDMAL/Gamera | gamera/fudge.py | Python | gpl-2.0 | 2,585 |
from tictactoe import game, player
import unittest
from unittest import mock
class GameTest(unittest.TestCase):
def setUp(self):
self.num_of_players = 2
self.width = 3
self.height = 3
self.game = game.Game(2, 3, 3)
def test_init(self):
self.assertEqual(self.game.board,... | jureslak/racunalniske-delavnice | fmf/python_v_divjini/projekt/test/test_game.py | Python | gpl-2.0 | 1,623 |
from django.template import RequestContext
from django.shortcuts import render_to_response, HttpResponse, HttpResponseRedirect
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.contrib import messages
from django.core.urlresolvers import reverse
... | dannysellers/django_orders | tracker/views/workorder_views.py | Python | gpl-2.0 | 5,164 |
#Es necesario cambiar estos datos por los parametros de nuestro servidor, usuarios, password
userDb = "userDb"
passDb = "passDb"
mail = "*********@gmail.com"
passMail = "passMail"
nameDb = "domotics_db"
urlDb = "urlDb"
serverPort = 8080
#Security Code Device
updateCode = "UPDATE device SET code = '%s' WHERE id = '%s... | PascualArroyo/Domotics | Server/myconfig.py | Python | gpl-2.0 | 9,785 |
from sys import exit
from random import randint
class Scene(object):
def enter(self):
print "This scene is not yet configured. Subclass it and implement enrer()."
exit(1)
class Engine(object):
def __init__(self, scene_map):
self.scene_map = scene_map
def play(self):
curr... | tridvaodin/Assignments-Valya-Maskaliova | LPTHW/ex43.py | Python | gpl-2.0 | 5,149 |
#!/usr/bin/env python
import rospy
import actionlib
from actionlib_msgs.msg import *
from geometry_msgs.msg import PoseStampted
import yaml
import os
import os.path
class GetLocals:
def __init__(self):
rospy.Subscriber('move_base_simple/goal', PoseStampted, self.goal_callback)
print('\nPLEASE, SEND A GOAL WITH... | amasiero/approach_control | approach_control_navigation/nodes/get_locals.py | Python | gpl-2.0 | 1,989 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (C) 2005-2008 Francisco José Rodríguez Bogado, #
# Diego Muñoz Escalante. #
# (pacoqueen@users.sourceforge.ne... | pacoqueen/ginn | ginn/formularios/formulacion_geotextiles.py | Python | gpl-2.0 | 34,430 |
#!/usr/bin/python
# plot interval CSV output from perf/toplev
# perf stat -I1000 -x, -o file ...
# toplev -I1000 -x, -o file ...
# intervalplotcompare.py file (or stdin)
# delimeter must be ,
# this is for data that is not normalized
# TODO: move legend somewhere else where it doesn't overlap?
from __future__ import di... | navaneethrameshan/PMU-burst | compareintervalplot.py | Python | gpl-2.0 | 16,603 |
import os
from twisted.python.compat import iteritems
from landscape.lib.fs import read_text_file
from landscape.constants import APT_PREFERENCES_SIZE_LIMIT
from landscape.client.monitor.plugin import DataWatcher
class AptPreferences(DataWatcher):
"""
Report the system APT preferences configuration.
""... | CanonicalLtd/landscape-client | landscape/client/monitor/aptpreferences.py | Python | gpl-2.0 | 2,007 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from argparse import ArgumentParser
from .core import Core
def getopt(argv):
parser = ArgumentParser(description='Another webui for youtube-dl')
parser.add_argument('-c', '--config', metavar="CONFIG_FILE", help="config fil... | d0u9/youtube-dl-webui | youtube_dl_webui/__init__.py | Python | gpl-2.0 | 755 |
# Standard Modules
import apt
from datetime import datetime
import decimal
import json
import os
import Queue
import random
import socket
import subprocess
import sys
import traceback
# Kodi Modules
import xbmc
import xbmcaddon
import xbmcgui
# Custom modules
__libpath__ = xbmc.translatePath(os.path.join(xbmcaddon.Ad... | fernandog/osmc | package/mediacenter-addon-osmc/src/script.module.osmcsetting.updates/resources/lib/update_service.py | Python | gpl-2.0 | 47,883 |
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# *************************************... | ljx0305/ice | allTests.py | Python | gpl-2.0 | 476 |
#!/usr/bin/env python3
###############################################################################
# #
# Copyright 2019. Triad National Security, LLC. All rights reserved. #
# This program was produced under U.S. Government contrac... | CSD-Public/stonix | src/tests/rules/unit_tests/zzzTestRuleConfigurePasswordPolicy.py | Python | gpl-2.0 | 7,397 |
#encoding=utf-8
import pymysql
import json
class MysqlHelper:
"""mysql 帮助类"""
@staticmethod
def insert(word,asymbol,esymbol,explain,cizu,liju,xiangguancihui,aspoken,espoken):
db=pymysql.connect(host="192.168.180.187",user="root",password="123456",db="lytest",charset="utf8")
cursor=db.curs... | skymyyang/YouDaoWord | MysqlHelper.py | Python | gpl-2.0 | 913 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"Fully test this module's functionality through the use of fixtures."
from megacosm.generators import Govt, Country, City
import unittest2 as unittest
import fakeredis
import fixtures
from config import TestConfiguration
class TestGovt(unittest.TestCase):
def setU... | CityGenerator/Megacosm-Generator | tests/test_govt.py | Python | gpl-2.0 | 2,530 |
# coding=utf-8
"""Writers test.
.. note:: 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.
"""
__author__ = 'ri... | tomchadwin/qgis2web | qgis2web/test/test_qgis2web_writers.py | Python | gpl-2.0 | 124,843 |
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
#
# module_dumper.py - WIDS/WIPS framework file dumper module
# Copyright (C) 2009 Peter Krebs, Herbert Haas
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2 as published by the
# Fr... | pkrebs/WIDPS | fw_modules/module_dumper.py | Python | gpl-2.0 | 3,313 |
#!/usr/bin/env python
# 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 in the hope that ... | narasimhan-v/avocado-misc-tests-1 | io/net/multicast.py | Python | gpl-2.0 | 5,757 |
import subprocess
import smtplib
import socket
from email.mime.text import MIMEText
import datetime
# Change to your own account information
to = 'rk.ryan.king@gmail.com'
gmail_user = 'rk.ryan.king@gmail.com'
gmail_password = 'nzwaahcmdzjchxsz'
smtpserver = smtplib.SMTP('smtp.gmail.com', 587)
smtpserver.ehlo()
smtpserv... | rkryan/seniordesign | pi/utils/startup_ip.py | Python | gpl-2.0 | 865 |
from django.contrib import admin
from Blogs.models import(Post, Comment)
admin.site.register(Post)
admin.site.register(Comment) | aliunsal/blog | Blogs/admin.py | Python | gpl-2.0 | 128 |
#===============================================================================
# Copyright 2012 NetApp, Inc. All Rights Reserved,
# contribution by Jorge Mora <mora@netapp.com>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published ... | rasky/nfstest | packet/link/ethernet.py | Python | gpl-2.0 | 3,670 |
# -*- coding: utf-8 -*-
# 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.
"""
bkr job-cancel: Cancel running Beaker jobs... | beaker-project/beaker | Client/src/bkr/client/commands/cmd_job_cancel.py | Python | gpl-2.0 | 2,402 |
import pytest
from spinner import transforms
from spinner import coordinates
from spinner import cabinet
from example_cabinet_params import exact
def test_hex_to_cartesian():
h = coordinates.Hexagonal
c = coordinates.Cartesian2D
# Test single element cases
o0 = "o0"
o1 = "o1"
o2 = "o2"
assert transforms.he... | SpiNNakerManchester/SpiNNer | tests/test_transforms.py | Python | gpl-2.0 | 4,699 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-22 21:06
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('statusboard', '0015_merge_20170222_2058'),
]
operations = [
migrations.AddF... | edigiacomo/django-statusboard | statusboard/migrations/0016_service_position.py | Python | gpl-2.0 | 464 |
import json
import sys
import urllib
keyword = sys.argv[1]
def getTimes(query,num):
"Questa funzione fa una ricerca su NY Times"
url = "http://query.nytimes.com/svc/cse/v2/sitesearch.json?query="+query.replace(" ","%20")+"&pt=article&page="+str(num)
jtext = urllib.urlopen(url)
return jtext
def search... | exedre/webscraping-course-2014 | esempi/esempio0_json.py | Python | gpl-2.0 | 845 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time
## PhysicalParameters
Density=2400
frictionAngle=radians(35)
tc = 0.001
en = 0.3
es = 0.3
## Import wall's geometry
params=utils.getViscoelasticFromSpheresInteraction(tc,en,es)
facetMat=O.materials.append(ViscElMat(frictionAngle=frictionAngle,**params)) # **param... | woodem/woo | obsolete/examples/baraban/baraban.py | Python | gpl-2.0 | 2,018 |
#!/usr/bin/python
import os
import re
import sys
import json
import urllib
import socket
import subprocess
import cgi, cgitb
from os import listdir
from os.path import isfile, join
#http://178.62.51.54:13930/event=CREATE&login_name=henrik&pathway_name=test_commit.pml
def peos_notify(patient_id):
EXECUTION_PATH =... | thysol/CS4098 | backend/peos_notify.py | Python | gpl-2.0 | 701 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.