commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
0a57a8ee692c8674f322196c7ffcbe8cb348abae | Add script for launching RTP | HERA-Team/hera_mc,HERA-Team/hera_mc | scripts/mc_launch_rtp.py | scripts/mc_launch_rtp.py | #!/usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
# Copyright 2021 The HERA Collaboration
# Licensed under the 2-clause BSD License
import os
import sys
import shutil
import subprocess
from hera_mc import mc
from hera_mc.rtp import RTPLaunchRecord
try:
import hera_opm.mf_tools as mt
except ImportError:
... | bsd-2-clause | Python | |
bdeb42effc4943d2c19047feecbca52b85d138eb | Add recess watcher | henare/parlparse,spudmind/parlparse,spudmind/parlparse,henare/parlparse,spudmind/parlparse,spudmind/parlparse,henare/parlparse,henare/parlparse,spudmind/parlparse,henare/parlparse | scripts/recesswatcher.py | scripts/recesswatcher.py | #!/usr/bin/env python2.3
# vim:sw=4:ts=4:et:nowrap
# Extact list of dates of recesses of parliament, and write a message out on
# the day of a recess start or end. So I know they are happening when called
# from a cron job. Writes out to a parl-recesses.txt file which we can load
# from elsewhere (PHP). To be run e... | agpl-3.0 | Python | |
a5e148489a10ed508ad081ab38b09d7bef7d4453 | Create loud-and-rich.py | kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015 | Python/loud-and-rich.py | Python/loud-and-rich.py | # Time: O(q + r)
# Space: O(q + r)
# In a group of N people (labelled 0, 1, 2, ..., N-1),
# each person has different amounts of money, and different levels of
# quietness.
#
# For convenience, we'll call the person with label x, simply "person x".
#
# We'll say that richer[i] = [x, y]
# if person x definitely has mo... | mit | Python | |
861f77134fbb93b08077e86e605b2c8fc5a04013 | add missing module | mandeep/conda-verify,ContinuumIO/anaconda-verify | conda_verify/fileinfo.py | conda_verify/fileinfo.py | MAGIC = {
'\xca\xfe\xba\xbe': 'MachO-universal',
'\xce\xfa\xed\xfe': 'MachO-i386',
'\xcf\xfa\xed\xfe': 'MachO-x86_64',
'\xfe\xed\xfa\xce': 'MachO-ppc',
'\xfe\xed\xfa\xcf': 'MachO-ppc64',
'MZ\x90\x00': 'DLL',
'\x7fELF': 'ELF',
}
DLL_Type = {
0x0: 'UNKNOWN', 0x1d3: 'AM33', 0x8664: 'AMD64'... | bsd-3-clause | Python | |
477501bb5183fb19f16a7a58d28dfbb3f1a20756 | Add views | gopla29/djangogirls,gopla29/djangogirls | blog/views.py | blog/views.py | from django.shortcuts import render
from django.utils import timezone
from .models import Post
from django.shortcuts import render, get_object_or_404
def post_list(request):
posts = Post.objects.filter(published_date__lte=timezone.now()).order_by('published_date')
return render(request, 'blog/post_list.html',... | mit | Python | |
b94b41fc37c3a7bd72aa5dc1e8f373418228b05d | add support for taobao | muhammad-ammar/python-social-auth,cmichal/python-social-auth,joelstanner/python-social-auth,lamby/python-social-auth,cmichal/python-social-auth,cjltsod/python-social-auth,chandolia/python-social-auth,ariestiyansyah/python-social-auth,MSOpenTech/python-social-auth,fearlessspider/python-social-auth,jneves/python-social-a... | social/backends/taobao.py | social/backends/taobao.py | import urllib2,urllib
from urllib2 import Request, urlopen, HTTPError
from urllib import urlencode
from urlparse import urlsplit
from social_auth.backends.exceptions import StopPipeline, AuthException, \
AuthFailed, AuthCanceled, \
... | bsd-3-clause | Python | |
8d926306b3e7823a5cef71c15705d821eff16b93 | Add new types module | jaj42/GraPhysio,jaj42/dyngraph,jaj42/GraPhysio | graphysio/types.py | graphysio/types.py | import os
from enum import Enum
class FootType(Enum):
none = 'None'
pressure = 'Pressure'
velocity = 'Velocity'
class CsvRequest():
def __init__(self, filepath = "",
seperator = ",",
decimal = ".",
dtfield = None,
... | isc | Python | |
02f7c8e6f374f2d570fb6256612393018b2d3064 | Add checking code for exercise 2 | Kaggle/learntools,Kaggle/learntools | learntools/computer_vision/ex2.py | learntools/computer_vision/ex2.py | from learntools.core import *
import tensorflow as tf
class Q1(CodingProblem):
_var = 'kernel'
_solution = CS("""
# This is just one possibility.
kernel = tf.constant([
[-2, -1, 0],
[-1, 1, 1],
[0, 1, 2],
])
""")
def check(self, kernel):
assert (isinstance(kernel, tf.Tensor))
a... | apache-2.0 | Python | |
2e59349b2e4bda54942cb96ba6bba9661ee89b4b | Add a minimal debugging tool to show the UI while device not in car (#1937) | commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot | selfdrive/debug/uiview.py | selfdrive/debug/uiview.py | #!/usr/bin/env python3
import time
import cereal.messaging as messaging
from selfdrive.manager import start_managed_process, kill_managed_process
services = ['controlsState', 'thermal'] # the services needed to be spoofed to start ui offroad
procs = ['camerad', 'ui']
[start_managed_process(p) for p in procs] # start... | mit | Python | |
9456944a66ded9bff986bdeda1cd8367d3a1ee37 | Add script to write text to a Roku Soundbridge. | andrewferrier/misc-scripts,andrewferrier/misc-scripts,jbreitbart/dropbox-cleanup | soundbridge-write.py | soundbridge-write.py | #!/usr/bin/python
#
# $Id$
"""
Write some text on a Roku soundbridge, using the telnet interface.
"""
import telnetlib
import syslog
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-H", "--hostname", dest="hostname", default="soundbridge")
parser.add_option("-t", "--text", dest="text",... | mit | Python | |
78e16bc5403901d3bd6a0c0a1ce426468faf2ca8 | Create riemann.py | richardsalt/linux-riemann-events,richardsalt/linux-riemann-events | riemann.py | riemann.py | #!/usr/bin/python
##################################################
# this script is launched by riemann.sh #
# dependencies: riemann.sh, riemann-get-stats.sh #
##################################################
import bernhard
import subprocess
c = bernhard.Client(host = 'monitor1')
_thisServer = subproc... | mit | Python | |
4302af3094f1c9b5005f8faa89b3198880b82bcd | Create GaussianNB.py | vidhyal/WitchMusic | GaussianNB.py | GaussianNB.py | #Copyright (c) 2016 Vidhya, Nandini
#Following code is available for use under MIT license. Please see the LICENSE file for details.
import numpy as np
from sklearn.naive_bayes import GaussianNB
from sklearn.metrics import *
from BalanceData import *
rootdir = os.getcwd()
if not os.path.exists('sklearnTry'):
... | mit | Python | |
3c6a8fdbb67f8204552cc530e88243772d43a90f | add asyncio version of irq demo | mvduin/py-uio,mvduin/py-uio,mvduin/py-uio,mvduin/py-uio,mvduin/py-uio | p9.12-irq-asyncio.py | p9.12-irq-asyncio.py | #!/usr/bin/python3
import asyncio
from uio import Uio
loop = asyncio.get_event_loop()
pin = Uio( "p9.12-irq", blocking=False )
def irq_callback():
pin.irq_recv()
print( "Ping!" )
loop.stop()
loop.add_reader( pin.fileno(), irq_callback )
pin.irq_enable()
loop.run_forever()
| mit | Python | |
d3d1e9eb32af7a38f99fc602e2e9e897460dfbec | Create migration for user field on fellow | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | fellowms/migrations/0022_fellow_user.py | fellowms/migrations/0022_fellow_user.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-02 16:22
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependen... | bsd-3-clause | Python | |
c3f589c42f611d6567721b165072aa503f806287 | Initialize littleKid | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter02/littleKid.py | books/AutomateTheBoringStuffWithPython/Chapter02/littleKid.py | # This program checks name and age
if name == 'Alice':
print('Hi, Alice.')
elif age < 12:
print('You are not Alice, kiddo.')
else:
print('You are neither Alice nor a little kid.')
| mit | Python | |
8237ac2728d5d8698d5941dfe5a760c6d6640e0b | implement 10 (10) 各行の2コラム目の文字列の出現頻度を求め,出現頻度の高い順に並べよ.ただし,(3)で作成したプログラムの出力(col2.txt)を読み込むプログラムとして実装せよ.確認にはcut, uniq, sortコマンドを用いよ. | mihyaeru21/nlp100 | set01/10.py | set01/10.py | # -*- coding: utf-8 -*-
# (10) 各行の2コラム目の文字列の出現頻度を求め,出現頻度の高い順に並べよ.ただし,(3)で作成したプログラムの出力(col2.txt)を読み込むプログラムとして実装せよ.確認にはcut, uniq, sortコマンドを用いよ.
import sys
import collections
freq = collections.defaultdict(int)
for line in sys.stdin:
word = line.decode('utf-8').rstrip(u'\r\n')
freq[word] += 1
for key, value in ... | unlicense | Python | |
595da87c91e3d68da37289255367ed0e76c4211e | Create settings.py | CWWhitman/codeday-game | settings.py | settings.py | ip = "enter ip"
port = "enter port"
controls = {"up" : "key", "down" : "key", "left" : "key", "right" : "key"}
| mit | Python | |
4c4e596ce7ca7dbc5e999a5066f0dd6f416c1ee5 | add initial file | kozistr/Awesome-GANs | DiscoGAN/train.py | DiscoGAN/train.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import tensorflow as tf
import numpy as np
import time
import discogan
import image_utils as iu
import dataset
dirs = {
'sample_output': './DiscoGAN/',
'checkpoint': './model/checkpoint',
'model'... | mit | Python | |
35f2cea484e2080e0b64fbcb995ef1adbc2d65dd | Read from serial, write to CSV | miahi/python.apcserial | read_serial.py | read_serial.py | __author__ = 'miahi'
## Logger for serial APC Smart UPS
import serial
import csv
import time
import datetime
PORT = 'COM2'
BAUDRATE = 2400
SLEEP_SECONDS = 3
class APCSerial(object):
def __init__(self, port, baudrate=2400):
# todo: check that port exists & init errors
self.serial = serial.Serial... | mit | Python | |
7a140935ee5537520e614282bbcc76717309165f | solve k71 | WatsonDNA/nlp100,wtsnjp/nlp100,WatsonDNA/nlp100,wtsnjp/nlp100 | chap08/k71.py | chap08/k71.py | #
# usage: python k71.py {file name}
#
import sys
from collections import Counter
from bisect import bisect_left
def stopwords(sl, fr):
c, st = Counter([w for s in sl for w in list(set(s))]), len(sl) * fr / 100
return sorted([k for k, v in c.items() if v > st])
def is_stopword(w, ss):
i, b = bisect_left(... | unlicense | Python | |
abbc860f69ea3c133728358a9cb8d50c8fbca255 | Add program | simplyianm/list-schools | list_schools.py | list_schools.py | print(sorted(set([email.split('@')[-1] for email in open('emails.txt').read().split('\n') if email.endswith('.edu')])))
| mit | Python | |
e1e68171aa82cf2ecf915820ea4b8cd0d6a4de24 | Solve 63 | mackorone/euler | src/063.py | src/063.py | from itertools import count
def ans():
limit = 1000
total = 0
for power in count(1):
for num in count(1):
length = len(str(num ** power))
if length == power:
total += 1
elif power < length:
break
if limit < power:
... | mit | Python | |
acc2bbc6a8223bcc810d142701fd476e0628d5e9 | deploy script | LynnCo/TumblrDevKit | deploy.py | deploy.py | from env import ENV
from time import sleep
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
select = driver.find_element_by_css_selector
driver.get('http://localhost:5000/static/index.html')
select('*').send_keys(Keys.CONTROL, 'a')
select('*').send_keys(Keys.... | mit | Python | |
369d370d0c5fd5eb9099b717d557858c781b5bba | Add latest version of libxrender (#4013) | matthiasdiener/spack,skosukhin/spack,LLNL/spack,matthiasdiener/spack,LLNL/spack,mfherbst/spack,tmerrick1/spack,matthiasdiener/spack,skosukhin/spack,skosukhin/spack,EmreAtes/spack,iulian787/spack,skosukhin/spack,TheTimmy/spack,matthiasdiener/spack,LLNL/spack,matthiasdiener/spack,tmerrick1/spack,EmreAtes/spack,krafczyk/s... | var/spack/repos/builtin/packages/libxrender/package.py | var/spack/repos/builtin/packages/libxrender/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python |
1e0382c9cf5f204ea79f548122ca3347acb7eb46 | Create basic Asteroid class. | RSteyn/Potatoes | potatoes/asteroid.py | potatoes/asteroid.py | __author__ = 'rileysteyn'
from .entity import *
import random
import math
class Asteroid(Entity, Movable, Renderable):
MAX_VEL = 5 # TODO: Balance this
MIN_VEL = 2 # TODO: Balance this
VEL_RANGE = MAX_VEL - MIN_VEL
def __init__(self, canvas):
Entity.__init__(self)
Movable.__init__(self)
... | mit | Python | |
e98f8847c84f83f312421506b9d4f9524c4422cc | add aimsun RL example | cathywu/flow,cathywu/flow | examples/aimsun/stabilizing_the_ring.py | examples/aimsun/stabilizing_the_ring.py | """Train a single AV to stabilize a variable density ring road."""
from rllab.envs.normalized_env import normalize
from rllab.misc.instrument import run_experiment_lite
from rllab.algos.trpo import TRPO
from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline
from rllab.policies.gaussian_mlp_policy im... | mit | Python | |
8e85e5074946beae0bec1840363ef81efa8b0a90 | Create seqgan.py | kozistr/Awesome-GANs | SeqGAN/seqgan.py | SeqGAN/seqgan.py | # initial python file
| mit | Python | |
7b35909083325ba6a22119b0f7a1cd352503cd93 | Add new one concept example that uses full syntax | ets-labs/python-dependency-injector,rmk135/objects,ets-labs/dependency_injector,rmk135/dependency_injector | examples/concept_full_syntax.py | examples/concept_full_syntax.py | """Concept example of `Dependency Injector`."""
import sqlite3
from dependency_injector import catalogs
from dependency_injector import providers
from dependency_injector import injections
class UsersService(object):
"""Users service, that has dependency on database."""
def __init__(self, db):
"""I... | bsd-3-clause | Python | |
0029c6eeed8e65d64f6e9c41ab483d476b3b0ae8 | Add regex cog from: | Naught0/qtbot | cogs/regex.py | cogs/regex.py | # https://github.com/decorator-factory/bot/blob/c46e728f8e27d93692087516ef902eeed5efb8b7/bot/cogs/regular_expressions.py
import re
from typing import Iterable, Optional, Union
from discord.ext import commands
from discord.ext.commands import BadArgument, Cog, Context, Converter, group
REGEX_TIMEOUT = 0.05 # maximu... | mit | Python | |
0ab4d614ac8ee6addf565764a7fc4dd6185c5ca4 | Create metrics.py | wrgeorge1983/Pystol | metrics.py | metrics.py | '''
Created on Dec 1, 2014
@author: William.George
'''
import time
DEBUG = False
METRICS = {}
VERBOSITY = 0
StartTime = 0
def UpdateMetric(metric='default'):
''' Given a metric name as a string, increment its counter'''
if metric not in METRICS:
METRICS[metric] = 0
METRICS[metric] += 1
if DE... | lgpl-2.1 | Python | |
2b750c581ef66aae867ae939043ff5f157ee60c0 | Create unvaulty.py | JohnDvorak/general-cryptanalysis | unvaulty.py | unvaulty.py | """
This program "decrypts" files that were saved in a Vaulty vault.
No password is needed to decrypt, as the files are not actually encrypted.
The filetypes are obscured, so decrypted files are temporarily moved to a
"Staging" directory to detect the filetype using `mimetypes`.
Usage: Change the "DIRECTORIES_TO_DE... | mit | Python | |
dac7b1697f2cfeef3b30afff000f4bb7d5f0d8fc | Add shortcut nodes module | jluttine/bayespy,fivejjs/bayespy,bayespy/bayespy,SalemAmeen/bayespy | bayespy/nodes/__init__.py | bayespy/nodes/__init__.py | ######################################################################
# Copyright (C) 2013 Jaakko Luttinen
#
# This file is licensed under Version 3.0 of the GNU General Public
# License. See LICENSE for a text of the license.
######################################################################
####################... | mit | Python | |
de9bd0fa4e2d9e26ffc5d94f26565b426a24dd5e | add instance dir | tomkralidis/GeoHealthCheck,tomkralidis/GeoHealthCheck,justb4/GeoHealthCheck,justb4/GeoHealthCheck,justb4/GeoHealthCheck,geopython/GeoHealthCheck,geopython/GeoHealthCheck,geopython/GeoHealthCheck,tomkralidis/GeoHealthCheck,geopython/GeoHealthCheck,tomkralidis/GeoHealthCheck,justb4/GeoHealthCheck | instance/config.py | instance/config.py |
# config values (overriding defaults)
DEBUG = False
SQLALCHEMY_DATABASE_URI = 'sqlite:////path/to/instance/data.db'
SQLALCHEMY_ECHO = False
| mit | Python | |
95ec3d29d314f12f596dff196d79469c82ba2a0d | Add unit test. | qusp/orange3,qPCR4vir/orange3,cheral/orange3,qPCR4vir/orange3,kwikadi/orange3,marinkaz/orange3,marinkaz/orange3,cheral/orange3,qPCR4vir/orange3,qPCR4vir/orange3,marinkaz/orange3,marinkaz/orange3,qPCR4vir/orange3,qusp/orange3,kwikadi/orange3,cheral/orange3,qPCR4vir/orange3,kwikadi/orange3,qusp/orange3,kwikadi/orange3,ch... | Orange/tests/test_discretization.py | Orange/tests/test_discretization.py | from unittest import TestCase
import numpy as np
import Orange
class TestEqualFreq(TestCase):
def test_equifreq(self):
X = np.random.randint(0, 2, (100, 1))
data = Orange.data.Table(X)
disc = Orange.feature.discretization.EqualFreq(n=4)
dvar = disc(data, data.domain.variables[0])... | bsd-2-clause | Python | |
6cc6526efc2de6dbb5d9cc73fc1ce1a3e682bcf4 | Add math module | raviqqe/tensorflow-extenteten,raviqqe/tensorflow-extenteten | nn/math.py | nn/math.py | import tensorflow as tf
from .util import funcname_scope, static_rank
@funcname_scope
def scalar_to_vec(scalar):
assert static_rank(scalar) == 1
return tf.expand_dims(scalar, [1])
@funcname_scope
def vec_to_mat(vec):
assert static_rank(vec) == 2
return tf.expand_dims(vec, [2])
| unlicense | Python | |
19dae7fe55f5477fbffb189e2cd63015c84b401c | Fix python_factorial in the polys to use factorial correctly | cswiercz/sympy,srjoglekar246/sympy,MridulS/sympy,aktech/sympy,drufat/sympy,ga7g08/sympy,maniteja123/sympy,kaushik94/sympy,jamesblunt/sympy,kaichogami/sympy,debugger22/sympy,Arafatk/sympy,kmacinnis/sympy,rahuldan/sympy,oliverlee/sympy,sahmed95/sympy,madan96/sympy,Vishluck/sympy,atsao72/sympy,AkademieOlympia/sympy,Vaibha... | sympy/polys/domains/groundtypes.py | sympy/polys/domains/groundtypes.py | """Ground types for various mathematical domains in SymPy. """
HAS_GMPY = True
try:
import gmpy
except ImportError:
HAS_GMPY = False
else:
try:
int(gmpy.mpz(2**256))
except OverflowError:
from warnings import warn
warn("gmpy library is too old, can't take advantage of it")
... | """Ground types for various mathematical domains in SymPy. """
HAS_GMPY = True
try:
import gmpy
except ImportError:
HAS_GMPY = False
else:
try:
int(gmpy.mpz(2**256))
except OverflowError:
from warnings import warn
warn("gmpy library is too old, can't take advantage of it")
... | bsd-3-clause | Python |
697bcbb87b32bb0f805cf76ae1b58b968c32323f | Create MRLTeensy_analog.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/Markus/MRLTeensy_analog.py | home/Markus/MRLTeensy_analog.py | from time import sleep
from org.myrobotlab.service import Speech
# Name it "speech".
speech = Runtime.create("speech","Speech")
speech.startService()
serial = Runtime.start('serial','Serial')
speech.setGoogleURI("http://thehackettfamily.org/Voice_api/api2.php?voice=Laura&txt=")
speech.speak("hello")
serial.c... | apache-2.0 | Python | |
0463f6f9242c514d1b1d02775d08c52edbbf7066 | Create phueoff.py | Emdubya/AlarmClock,Emdubya/AlarmClock | phueoff.py | phueoff.py | #! /usr/bin/python
from phue import Bridge
b = Bridge('192.168.1.120')
b.connect()
b.get_api()
tran = {'transitiontime' : 300, 'on' : False}
b.set_light([1,2,3], tran)
| mit | Python | |
8905993c0daa140b10cb04dca1e7bed7b813ea7a | Add UTC timezone to datetimes in the libs folder. | ahMarrone/solar_radiation_model,scottlittle/solar_radiation_model,gersolar/solar_radiation_model | imagedownloader/libs/console.py | imagedownloader/libs/console.py | import sys
import pyttsx
import aspects
from datetime import datetime
engine = pyttsx.init()
def show(*objs):
begin = '' if '\r' in objs[0] or '\b' in objs[0] else '\n'
sys.stdout.write(begin)
for part in objs:
sys.stdout.write(str(part))
sys.stdout.flush()
def say(speech):
#NOT engine.startLoop()
show(speec... | import sys
import pyttsx
import aspects
from datetime import datetime
engine = pyttsx.init()
def show(*objs):
begin = '' if '\r' in objs[0] or '\b' in objs[0] else '\n'
sys.stdout.write(begin)
for part in objs:
sys.stdout.write(str(part))
sys.stdout.flush()
def say(speech):
#NOT engine.startLoop()
show(speec... | mit | Python |
5acca0479a2ba346f7a1955d78b199aba70c359b | Test categories UI | lab2112/pretix,akuks/pretix,Flamacue/pretix,Unicorn-rzl/pretix,Flamacue/pretix,Unicorn-rzl/pretix,Flamacue/pretix,awg24/pretix,akuks/pretix,lab2112/pretix,Flamacue/pretix,awg24/pretix,Unicorn-rzl/pretix,Unicorn-rzl/pretix,lab2112/pretix,lab2112/pretix,akuks/pretix,awg24/pretix,akuks/pretix,awg24/pretix | src/tixlcontrol/tests/test_items.py | src/tixlcontrol/tests/test_items.py | import datetime
from tixlbase.models import User, Organizer, Event, OrganizerPermission, EventPermission, ItemCategory
from tixlbase.tests import BrowserTest, on_platforms
@on_platforms()
class ItemsTest(BrowserTest):
def setUp(self):
super().setUp()
self.user = User.objects.create_user('dummy@du... | apache-2.0 | Python | |
72aa9f98992908df952484773e735419848a6143 | Add utility function | usingnamespace/pyramid_authsanity | pyramid_authsanity/util.py | pyramid_authsanity/util.py |
def add_vary_callback(vary_by):
def vary_add(request, response):
vary = set(response.vary if response.vary is not None else [])
vary |= set(vary_by)
response.vary = list(vary)
return vary_add
| isc | Python | |
3f0ef7d273eaecad8f5b278e762a056bf17ffdb8 | Add test for MI tokens. This file tests the sequence of digits that can come before an MI command. | llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb | test/tools/lldb-mi/TestMiSyntax.py | test/tools/lldb-mi/TestMiSyntax.py | """
Test that the lldb-mi driver understands MI command syntax.
"""
import os
import unittest2
import lldb
from lldbtest import *
class MiSyntaxTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
myexe = "a.out"
@classmethod
def classCleanup(cls):
"""Cleanup the test byproducts."""
... | apache-2.0 | Python | |
0e2dda38e19523ab2c5ac935ee4f9886b2067d5b | Add migration for short name | lutris/website,lutris/website,lutris/website,lutris/website | platforms/migrations/0008_platform_short_name.py | platforms/migrations/0008_platform_short_name.py | # Generated by Django 2.2.12 on 2021-04-18 00:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('platforms', '0007_auto_20180515_2130'),
]
operations = [
migrations.AddField(
model_name='platform',
name='short_na... | agpl-3.0 | Python | |
8d8e464bbbf8f8eea03e170fdca0178328aa1b45 | Add example google oauth script | mailme/mailme.io,mailme/mailme.io,EnTeQuAk/doit,mailme/mailme.io,mailme/mailme.io,EnTeQuAk/doit,EnTeQuAk/doit | tests/google.py | tests/google.py |
# Credentials you get from registering a new application
client_id = '853034293084-mdami2i23c9dkqopbhfgopdua81croic.apps.googleusercontent.com'
client_secret = 'zoAfLdVkkFvKV4Bo-EwiQPva'
redirect_uri = 'https://localhost:8443/oauth2/google'
# OAuth endpoints given in the Google API documentation
authorization_base_u... | bsd-3-clause | Python | |
5398145d767fed25f4e294722e6fb90ed9dff4c9 | add unit test for smartd mngr | OpenSight/StorLever,OpenSight/StorLever,OpenSight/StorLever,OpenSight/StorLever | storlever/tests/mngr/utils/test_smartdmgr.py | storlever/tests/mngr/utils/test_smartdmgr.py | import sys
import os
if sys.version_info >= (2, 7):
import unittest
else:
import unittest2 as unittest
from storlever.mngr.utils.smartdmgr import smartd_mgr
class TestSnmpAgentMgr(unittest.TestCase):
def test_monitor(self):
mgr = smartd_mgr()
old_monitor_list = mgr.get_monitor_list()
... | agpl-3.0 | Python | |
d2375ebc4908d58c1a168619ed1e1e8eb59ebf25 | Add test model for dives | GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek | geotrek/diving/tests/test_models.py | geotrek/diving/tests/test_models.py | from django.test import TestCase
from geotrek.common.tests import TranslationResetMixin
from geotrek.diving.models import Dive
from geotrek.diving.factories import DiveFactory, DivingManagerFactory, PracticeFactory, LevelFactory
from mapentity.factories import SuperUserFactory
class DiveTest(TranslationResetMixin, ... | bsd-2-clause | Python | |
cc21e9853e6fffecc3aea9acd7be0fadbfbd7e36 | add gcj solution | py-in-the-sky/challenges,py-in-the-sky/challenges,py-in-the-sky/challenges | google-code-jam/cube_iv_memoized.py | google-code-jam/cube_iv_memoized.py | """
https://code.google.com/codejam/contest/6214486/dashboard
Max recursion depth exceeded on large input. This could be
avoided by visiting rooms in order of their assigned value,
largest value first.
"""
import itertools as it
FOUR_DOORS = ((1, 0), (-1, 0), (0, 1), (0, -1))
def memo(f):
"""memoization dec... | mit | Python | |
ec7dbefce5358460b99defcecd1f662cdd2450d7 | add superuser required decorator | tjcsl/director,tjcsl/director,tjcsl/director,tjcsl/director | web3/apps/authentication/decorators.py | web3/apps/authentication/decorators.py | from django.contrib.auth.decorators import user_passes_test
superuser_required = user_passes_test(lambda u: not u.is_anonymous and (u.superuser | | u.is_superuser))
| mit | Python | |
252cb363ee3d7f408c0679f6d61b6918271c12c4 | Create config4992.py | davidfergusonaz/davidtest,davidfergusonaz/davidtest | config4992.py | config4992.py | provider "aws" {
access_key = "AKIAJP3F56YACR3LMFXA"
secret_key = "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"
region = "${var.region}
}
| mit | Python | |
c864bd26e51f96fbab04e72c5f98908cae3b2dad | add 'proxmox_facts' module | serge-name/myansible,serge-name/myansible,serge-name/myansible | library/proxmox_facts.py | library/proxmox_facts.py | #!/usr/bin/python
PROXMOX_PKG_NAME = 'proxmox-ve'
import commands
def get_pkg_status(package):
_, status = commands.getstatusoutput("dpkg-query --show --showformat='${{Status}}' '{}' 2>/dev/null".format(package))
return (status == 'install ok installed')
def get_pkg_version(package):
_, version = com... | mit | Python | |
4889545b1b82e45ad708b435689a945e44682181 | Create streams.py | bm993a/ptwitch | streams.py | streams.py | apache-2.0 | Python | ||
933e418aa816df7de9107645567c756324196596 | Add main.py | surru/Three-Musketeers-Game | multiagent/main.py | multiagent/main.py | import view
try:
view.main()
except:
print('Invalid List Format')
view.terminate()
| mit | Python | |
7bc33d924afaf113d9d04b5d45cc5202dc897efd | update to work with new modules | LinkageIO/LocusPocus | locuspocus/exceptions.py | locuspocus/exceptions.py | # Exception abstract class
class Error(Exception):
pass
class ZeroWindowError(Exception): # pragma: no cover
def __init__(self,expr,message,*args):
self.expr = expr
self.message = (
'Operation requiring window, but window is 0:' + \
message.format(args)
)
class... | mit | Python | |
94d098eb2b3d3c30e54d6d9ae524edd2b9f66228 | move script file | achiku/jungle | jangle.py | jangle.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
import boto3
def get_tag_value(x, key):
result = [y['Value'] for y in x if y['Key'] == key]
if len(result) == 0:
return None
return result[0]
@click.group()
def cli():
pass
@cli.group()
def ec2():
pass
@ec2.command(help='List... | mit | Python | |
a0990c986635e4079b9c7145497e44fdbde48280 | Add test for AST integrity | ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang | tests/parser/test_ast_integrity.py | tests/parser/test_ast_integrity.py | import pytest
from tests.infrastructure.test_utils import parse_local, parse_full
from thinglang.compiler.errors import NoExceptionHandlers
from thinglang.parser.errors import StructureError
IN_THING_DEFINITION = '''
thing Person
{}
'''.strip()
IN_METHOD_DEFINITION = '''
thing Person
does something
{... | mit | Python | |
359d5bb5b40cb1a15b9b3ed6fb4710ed7a6e5f89 | Add integration tests for user resource | yola/yolapy | tests/test_integration/test_user_resource.py | tests/test_integration/test_user_resource.py | import demands
from tests.test_integration.helpers import create_user
from tests.test_integration.test_case import YolaServiceTestCase
class TestYolaUser(YolaServiceTestCase):
"""Yola: User resource"""
@classmethod
def setUpClass(cls):
super(TestYolaUser, cls).setUpClass()
cls.user = cls... | mit | Python | |
e246fcb629bd9c445f12e2a15795a4a680895e32 | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | leetcode/easy/add_digits/py/solution.py | leetcode/easy/add_digits/py/solution.py | class Solution(object):
def addDigits(self, num):
"""
:type num: int
:rtype: int
"""
x = num
while len(str(x)) != 1:
x = sum(map(int, str(x)))
return x
| mit | Python | |
ab754d5924168d027bfc2eeed7881b9b2e469535 | Add script to generate website board metadata. | adafruit/circuitpython,bvernoux/micropython,adafruit/circuitpython,adafruit/circuitpython,bvernoux/micropython,adafruit/circuitpython,bvernoux/micropython,adafruit/circuitpython,bvernoux/micropython,adafruit/circuitpython,bvernoux/micropython | tools/autobuild/build-downloads.py | tools/autobuild/build-downloads.py | #!/usr/bin/env python3
import glob
import json
import os
import sys
def main(repo_path, output_path):
boards_index = []
board_ids = set()
for board_json in glob.glob(os.path.join(repo_path, "ports/*/boards/*/board.json")):
# Relative path to the board directory (e.g. "ports/stm32/boards/PYBV11")... | mit | Python | |
26717b31a960681594716ec913f2657fda102320 | Check in `purge_user.py` | e-mission/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server | bin/debug/purge_user.py | bin/debug/purge_user.py | import logging
import common
import argparse
import emission.core.wrapper.user as ecwu
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG)
parser = argparse.ArgumentParser(prog="purge_user")
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument("-e", "--user_ema... | bsd-3-clause | Python | |
342f44a816d2e36e5dddd5dc79fc066efa15e8e3 | add admin for locations | dimagi/rapidsms,dimagi/rapidsms | lib/rapidsms/contrib/locations/admin.py | lib/rapidsms/contrib/locations/admin.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
from django.contrib import admin
from locations.models import Location, LocationType
class LocationAdmin(admin.ModelAdmin):
model = Location
class LocationTypeAdmin(admin.ModelAdmin):
model = LocationType
admin.site.register(Location, Locatio... | bsd-3-clause | Python | |
96bd6f12e23b46874ac5a6489e50eed1d6fa2f36 | add logger | eirki/gargbot_3000,eirki/gargbot_3000,eirki/gargbot_3000,eirki/gargbot_3000 | logger.py | logger.py | import logging
import os
import datetime as dt
log = logging.getLogger()
log.setLevel(logging.DEBUG)
formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")
log_path = os.path.join("/home", "eirki", "gargbot_3000", "logs", "gargbot")
if os.path.exists(log_path + ".log"):
os.rename(log_path + "... | mit | Python | |
eeffebcc66f13da35bf3a446e7db771388a7d105 | Create db_upgrade.py | ASpelling/mw-trading,ASpelling/mw-trading,ASpelling/mw-trading | db_upgrade.py | db_upgrade.py | #!venv/bin/python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
api.upgrade(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
print('Current database version: ' + str(v))
| apache-2.0 | Python | |
c596c2c1653ac3fe9fd61a1825a9f7dd0ca7da77 | Add runner | kiyomaro927/stdbt | source/build.py | source/build.py | #!/usr/bin/env python
| mit | Python | |
42695d54b8346268ea41c9b694ff4eda35bf4028 | Add markov.py. | Uberi/Moby-Bic,Uberi/Moby-Bic | markov.py | markov.py | import re, random
from collections import defaultdict
class Markov:
PUNCTUATION = r"[`~@#$%_\\'+\-/]" # punctuation that is a part of text
STANDALONE = r"(?:[!.,;()^&\[\]{}|*=<>?]|[dDpP][:8]|:\S)" # standalone characters or emoticons that wouldn't otherwise be captured
WORD_PATTERN = STANDALONE + r"\S*|htt... | mit | Python | |
0cd0e4a53594999a24ba70f1928be7dc5cf42033 | add draw_text.py | chongyangma/python-scripts | scripts/draw_text.py | scripts/draw_text.py | import os
import argparse
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
if __name__ == "__main__" :
parser = argparse.ArgumentParser(description='Draw test over the files in a folder.')
parser.add_argument('folder_path', type=str, help='Path to the folder')
args = parser.parse_... | unlicense | Python | |
340d7a794d69531d58794ce5c10b8d05774f75a7 | add unit test | desihub/desimodel,desihub/desimodel | py/desimodel/test/test_healpix.py | py/desimodel/test/test_healpix.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
"""Test desimodel.healpix
"""
from __future__ import print_function, division
import unittest
import numpy as np
from desimodel.healpix import tiles2pix
class TestHealpix(unittest.TestCase):
"""Test desimodel.healpix.
"""
... | bsd-3-clause | Python | |
a0e3d1c7bc0dfe321323f26db631747188218d1e | Test for module 1 and 2. | mzweilin/HashTag-Understanding,mzweilin/HashTag-Understanding,mzweilin/HashTag-Understanding | test_12.py | test_12.py | from lib.tweet.parseTwitter import retrieveTweetText
from lib.querygen.tweets2query import QueryGenerator
hashtag = "twitterblades"
tweets = retrieveTweetText(hashtag)
qgen = QueryGenerator()
query_list = qgen.gen_query_list(hashtag, tweets)
print("Query list for \"%s\" is " % hashtag)
print(query_list)
| apache-2.0 | Python | |
01e614ba117634470d2eda868de2388c4f94fc6c | add first test | FZJ-IEK3-VSA/tsam | test/test_hierarchical.py | test/test_hierarchical.py | import os
import time
import pandas as pd
import numpy as np
import tsam.timeseriesaggregation as tsam
def test_hierarchical():
raw = pd.read_csv(os.path.join('..','examples','testdata.csv'), index_col = 0)
results = pd.read_csv(os.path.join('..','examples','results','testperiods_hierarchical.csv'), inde... | mit | Python | |
da84e0baa34cba90246398d198d16015f2820027 | Add time lapse script | iabdalkader/openmv,openmv/openmv,kwagyeman/openmv,openmv/openmv,kwagyeman/openmv,openmv/openmv,iabdalkader/openmv,kwagyeman/openmv,openmv/openmv,iabdalkader/openmv,iabdalkader/openmv,kwagyeman/openmv | usr/examples/05-Snapshot/time_lapse_photos.py | usr/examples/05-Snapshot/time_lapse_photos.py | # Time Lapse Photos (Credit nedhorning)
#
# This example shows off how to take time lapse photos using your OpenMV
# Cam and using the RTC module along with a timer interrupt to achieve
# very low power operation.
#
# Note that if the USB is still plugged in when the camera is taking
# pictures it will run the bootload... | mit | Python | |
7f6c9d7f577424b02ddd08ce3b189d31575a01de | Add an LLDB data formatter script for llvm::SmallVector, maybe this is helpful to someone else. | lodyagin/bare_cxx,lodyagin/bare_cxx,lodyagin/bare_cxx,lodyagin/bare_cxx,lodyagin/bare_cxx | lldbDataFormatters.py | lldbDataFormatters.py | """
Load into LLDB with:
script import lldbDataFormatters
type synthetic add -x "^llvm::SmallVectorImpl<.+>$" -l lldbDataFormatters.SmallVectorSynthProvider
"""
# Pretty printer for llvm::SmallVector/llvm::SmallVectorImpl
class SmallVectorSynthProvider:
def __init__(self, valobj, dict):
self.valobj = valob... | bsd-3-clause | Python | |
5b12a829715b14fabe6c2de408a9a8af404c8229 | Remove known badies. | influence-usa/pupa,influence-usa/pupa,rshorey/pupa,mileswwatkins/pupa,datamade/pupa,datamade/pupa,mileswwatkins/pupa,rshorey/pupa,opencivicdata/pupa,opencivicdata/pupa | tools/remove-errorful-data.py | tools/remove-errorful-data.py | #!/usr/bin/env python
import json
import sys
from pupa.core import db
fatal_errors = [
"event-has-invalid-jurisdiction-id",
"vote-has-invalid-jurisdiction-id",
]
with open(*sys.argv[1:], mode='r') as fd:
data = json.load(fd)
for collection, entries in data.items():
for datum in entries:
i... | bsd-3-clause | Python | |
dc947c6a023b231bb215f9bc3b8a584e409674d7 | Add smoketest for config | rshipp/chaser,rshipp/chaser | tests/test_config.py | tests/test_config.py | import unittest
from chaser import config
class TestConfig(unittest.TestCase):
def test_smoke_default_config(self):
r = config.get('BuildDir')
self.assertEquals("~/ccr", r)
| bsd-3-clause | Python | |
5f2530fcac23722adcbb60448bba85ebeabb108c | Add tests | Kozea/WeasyPrint,Kozea/WeasyPrint | weasyprint/tests/test_variables.py | weasyprint/tests/test_variables.py | """
weasyprint.tests.test_variables
-------------------------------
Test CSS custom proproperties, also known as CSS variables.
:copyright: Copyright 2011-2019 Simon Sapin and contributors, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from .test_boxes import render_pages as parse
d... | bsd-3-clause | Python | |
4cb0692218f7c7648551691aa2270d31828b3db0 | add pack/unpack benchmark script | OctavianLee/thriftpy,dan-blanchard/thriftpy,itnihao/thriftpy,maralla/thriftpy,importcjj/thriftpy,OctavianLee/thriftpy,duydb2/thriftpy,OctavianLee/thriftpy,misakwa/thriftpy,mariusvniekerk/thriftpy,maralla/thriftpy,halfcrazy/thriftpy,adsharma/flattools,itnihao/thriftpy,maralla/thriftpy,halfcrazy/thriftpy,dan-blanchard/th... | tests/benchmark_pack.py | tests/benchmark_pack.py | import time
from thriftpy.protocol.binary import (
pack_i8,
pack_i16,
pack_i32,
pack_i64,
pack_double,
unpack_i8,
unpack_i16,
unpack_i32,
unpack_i64,
unpack_double,
)
def benchmark(n):
print("Benchmark pack/unpack for {} times.".format(n))
start = time.time()
bs =... | mit | Python | |
1c0a2ebeca404572bef2807dc697c90c1be1a65a | Add a line count script | xcgspring/AXUI,xcgspring/AXUI,xcgspring/AXUI | tools/count_lines.py | tools/count_lines.py |
import os
test_dir = ".."
total_lines = 0
for _root, _dirs, _files in os.walk(test_dir):
for _file in _files:
file_lines = sum(1 for line in open(os.path.join(_root, _file)))
total_lines += file_lines
print("total lines: %d" % total_lines)
| apache-2.0 | Python | |
a857bcaed27eec9909968068149af30804488533 | add travis ci script for testing all functions | viraintel/OWASP-Nettacker,viraintel/OWASP-Nettacker,viraintel/OWASP-Nettacker,viraintel/OWASP-Nettacker | scripts/__travis_test__.py | scripts/__travis_test__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
os.system('python nettacker.py --help')
os.system("python nettacker.py -i 127.0.0.1 -u user1,user2 -p pass1,pass2 -m all -g 21,25,80,443 -t 2")
| apache-2.0 | Python | |
4058574718dcca9ba8619c1db89159c2b965a996 | Copy imports script | sr-lab/verified-pam-cracklib,sr-lab/verified-pam-cracklib,sr-lab/verified-pam-cracklib | src/fiximports.py | src/fiximports.py | #!/usr/bin/env python
# preprocessor: add extra imports
# preprocessor: ghc -F -pgmF
import os, sys
imports = """
import qualified Data.Bits
import qualified Data.Char
import qualified GHC.Prim
"""
filename = sys.argv[2]
out = open(sys.argv[3], "w")
out.write("{-# LINE 1 \"%s\" #-}\n" % (filename))
for n, line in e... | bsd-3-clause | Python | |
978031be396dcfa4523cc7bfbf695734d38baaa7 | add src files | robinsonvoly/drone-rp0 | src/test.py | src/test.py | #!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7,GPIO.OUT)
for i in 10
GPIO.output(7,1)
time.sleep(1)
GPIO.output(7,0)
time.sleep(1)
GPIO.cleanup() | mit | Python | |
0886b6fbf6256f36a062448fda31fcd79da10d89 | Add ExternalLink Node type. | wikimedia/operations-debs-python-mwparserfromhell,gencer/mwparserfromhell,gencer/mwparserfromhell,gencer/mwparserfromhell,wikimedia/operations-debs-python-mwparserfromhell,jayvdb/mwparserfromhell,yuvipanda/mwparserfromhell,wikimedia/operations-debs-python-mwparserfromhell,yuvipanda/mwparserfromhell,kumasento/mwparserfr... | mwparserfromhell/nodes/external_link.py | mwparserfromhell/nodes/external_link.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2013 Ben Kurtovic <ben.kurtovic@verizon.net>
#
# 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 limitatio... | mit | Python | |
714f3a0947d403ff47905210392dd8a0ffd4148d | add example | arve0/matrixscreener,arve0/leicaexperiment,arve0/matrixscreener | merger.py | merger.py | #!/usr/bin/env python
# encoding: utf-8
"""
Example of how to use LeicaExperiment.
"""
from glob import glob
from tifffile import imsave, imshow
from leicaexperiment import LeicaExperiment
# get file names
experiments = glob('/path/to/experiment--*')
# create experiments in a list
leica_experiments = []
for e in exp... | mit | Python | |
41111a3933e0afd6c7dd473c8f8dc1027d9b8aa5 | Add __init__.py for package | rzzzwilson/morse_trainer,rzzzwilson/morse_trainer | morse_trainer/__init__.py | morse_trainer/__init__.py | #####
# Initialize the morse_trainer package
#####
import os
import sys
__version__ = '0.2'
from morse_trainer import *
| mit | Python | |
49f588ba82151d4f2a8c8cbe0123775ef2514cf5 | Add script to update course content. | pixyj/feel,pixyj/feel,pixyj/feel,pixyj/feel,pixyj/feel | django-server/feel/core/db/update_fixtures.py | django-server/feel/core/db/update_fixtures.py | import subprocess
from django.conf import settings
MY_APPS = settings.MY_APPS
COMMAND_FORMAT = "python manage.py dumpdata {app} > core/fixtures/{app}.json"
def update_fixtures():
for app in MY_APPS:
command = COMMAND_FORMAT.format(app=app)
print(command)
subprocess.check_output(command, s... | mit | Python | |
6a6214424e77e31eada21fb6a2a4531fecc908d9 | Add infernal wrapper | biocore/micronota,tkosciol/micronota,mortonjt/micronota,tkosciol/micronota,RNAer/micronota,mortonjt/micronota,biocore/micronota,RNAer/micronota | micronota/bfillings/infernal.py | micronota/bfillings/infernal.py | # ----------------------------------------------------------------------------
# Copyright (c) 2015--, micronota development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# ---------------------------------------------... | bsd-3-clause | Python | |
9b446c4f160652f8d2b3ffd49667fd711d35f616 | Enable administration of decks and cards | DummyDivision/Tsune,DummyDivision/Tsune,DummyDivision/Tsune | cardbox/admin.py | cardbox/admin.py | from django.contrib import admin
from deck_model import Deck
from card_model import Card
admin.site.register(Deck)
admin.site.register(Card) | mit | Python | |
2d57d39112e3abbc116f4a937c28711fa15ee89a | Add updated migration for our work with 1.7 | isotoma/django-waffle,isotoma/django-waffle,isotoma/django-waffle,isotoma/django-waffle | waffle/migrations/0002_auto_20150721_1437.py | waffle/migrations/0002_auto_20150721_1437.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('sites', '0001_initial'),
('waffle', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='f... | bsd-3-clause | Python | |
43b635160bbb4f3a3eb6cfbc1995370854ed331a | add python snippet | zer4tul/utf8-bom-strip,zer4tul/utf8-bom-strip,zer4tul/utf8-bom-strip | snippets/bomstrip.py | snippets/bomstrip.py | r"""
Strip leading byte-order-mark from utf-8 files.
"""
def bomstrip(string):
"""
Function to delete UTF-8 BOM character in "string"
"""
import sys
from binascii import hexlify
if sys.version_info.major == 2:
utf8bom = '\xef\xbb\xbf'
elif sys.version_info.major == 3:
utf8bom = b'\xef\xbb\xb... | mit | Python | |
326d0049e91ba6ae6df73b673b648ac570e0a25a | convert v0 tweets to v0.1 | rwsharp/statement_collector,rwsharp/statement_collector | update_old_tweets.py | update_old_tweets.py | import json
import tweepy
import sys
import os.path
import argparse
import datetime
import shutil
def get_file_name(data_path, file_name, create_path=False, warn=False):
# check the data path and file
data_file_name = os.path.join(data_path, file_name)
if create_path:
if not os.path.isdir(data_pa... | mit | Python | |
6f580f939995870540b9415c28e114f642988751 | Add dayBefore.py | jgwagg/jwag_tools | dayBefore.py | dayBefore.py | #!/usr/bin/python
import sys
import time
if len(sys.argv) == 1:
wday = time.localtime()[6] # weekday w/ 0 == Monday
if wday == 0:
numDays = 3
elif wday == 6:
numDays = 2
else:
numDays = 1
else:
numDays = int(sys.argv[1])
secs = time.time() - (60*60*24*numDays)
print time.strftime("%m-%d",time.loca... | apache-2.0 | Python | |
a5e5ec7b70ca8dc35c56989e984a50c99dabe5d4 | Add update status | FarhadurFahim/twitter-bot | update_status_bot.py | update_status_bot.py | import tweepy
#import twitter apps configaration file from config.py file
from config import *
#Authentication using keys & accesstoken
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
api.update_status(status="This is a sample ... | mit | Python | |
aa657eafe67b7c8aea9d61e42b68ead283ce9a3a | add tests | dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq | corehq/apps/domain/tests/test_domain_name_generation.py | corehq/apps/domain/tests/test_domain_name_generation.py | from __future__ import print_function, unicode_literals
from django.test import TestCase
from django.test.client import Client
from corehq.apps.domain.models import Domain
class DomainNameGenerationTestBase(TestCase):
def setUp(self):
self.client = Client()
self.domains = []
def add_domain(... | bsd-3-clause | Python | |
2c7f4f558f3d8f02f3f90ce35d7a85c03c47f483 | Create process.py | GaryBrittain/DB2S3,GaryBrittain/DB2S3 | process.py | process.py | import dropbox
import sys
from sqlsync import *
from boto.s3.connection import S3Connection
from boto.s3.key import Key
import os
from pushover import message
conn = S3Connection('', '')
pb = conn.get_bucket('backup--dropbox')
access_token = ''
client = dropbox.client.DropboxClient(access_token)
curr_cursor_file = o... | mit | Python | |
fbea05d2d13f462098e9aa44d4fe32b135e358a2 | Add database class (because of OOP) | Lgmrszd/ThesisBot | dbconnect.py | dbconnect.py | import urllib.parse as urlparse
from pg import DB
import time
import datetime
class BotDB:
def __init__(self, db_url):
self.__db_url = db_url
url = urlparse.urlparse(db_url)
self.__db = DB(
dbname=url.path[1:],
user=url.username,
passwd=url.password,
... | mit | Python | |
9aeeebbd721fc0a3e71ae598c299a1c37d943c76 | add simple example | DaisukeMiyamoto/swc2vtk | examples/simple.py | examples/simple.py | import swc2vtk
vtkgen = swc2vtk.VtkGenerator()
vtkgen.add_swc('../swc/Swc_BN_1056.swc')
vtkgen.write_vtk('bn1056.vtk')
| apache-2.0 | Python | |
d3dc4a68841e6b5a9483326cced62d3e833f9974 | Add Decorator pattern | jackaljack/design-patterns | decorator.py | decorator.py | """Decorator pattern
Decorator is a structural design pattern. It is used to extend (decorate) the
functionality of a certain object at run-time, independently of other instances
of the same class.
The decorator pattern is an alternative to subclassing. Subclassing adds
behavior at compile time, and the change affects... | mit | Python | |
0eec4d720fca5ee1216636df251a5184d41e3be2 | Create colorschemedesigner-desktop.py | frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying | python/colorschemedesigner-desktop.py | python/colorschemedesigner-desktop.py | #---License---
#This is free and unencumbered software released into the public domain.
#Anyone is free to copy, modify, publish, use, compile, sell, or
#distribute this software, either in source code form or as a compiled
#binary, for any purpose, commercial or non-commercial, and by any
#means.
#---Description---
... | mit | Python | |
22e401424f85cc7b6ee42382a6995b6c32195ccc | Add autoslug fix migration | dbinetti/barberscore,dbinetti/barberscore-django,dbinetti/barberscore,barberscore/barberscore-api,barberscore/barberscore-api,barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore-django | project/apps/api/migrations/0144_auto_20150709_0549.py | project/apps/api/migrations/0144_auto_20150709_0549.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0143_auto_20150708_0507'),
]
operations = [
migrations.AlterField('person', 'slug', models.CharField(max_length=255))... | bsd-2-clause | Python | |
359ea0dd38cdc2b48322a3ad21568176916dfede | Change the name of the model. | icyflame/test-taking-platform,icyflame/test-taking-platform | examsys/migrations/0003_auto_20150315_1936.py | examsys/migrations/0003_auto_20150315_1936.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('examsys', '0002_auto_20150315_1640'),
]
operations = [
migrations.RenameModel(
old_name='TestToAnswer',
... | mit | Python | |
cf881f35880f6d06e5929ef9733334583e694742 | Add print test | sklam/numba,numba/numba,seibert/numba,gmarkall/numba,stonebig/numba,numba/numba,cpcloud/numba,stefanseefeld/numba,stuartarchibald/numba,pitrou/numba,cpcloud/numba,IntelLabs/numba,stefanseefeld/numba,gmarkall/numba,gdementen/numba,gdementen/numba,pitrou/numba,pitrou/numba,ssarangi/numba,pitrou/numba,stonebig/numba,shiqu... | numba/tests/test_print.py | numba/tests/test_print.py | import unittest
from numba.minivect import minitypes
from numba import *
@autojit(backend='ast')
def print_(value):
print value
class TestPrint(unittest.TestCase):
def test_print(self):
# Test for no segfault :)
print_(10)
print_(10.0)
print_("hello!")
if __name__ == "__main_... | bsd-2-clause | Python | |
2c5dbf8fb147b9d9494de5f8abff52aeedf1cabf | Add temporary, not yet working client | EnTeQuAk/bilor,EnTeQuAk/bilor,EnTeQuAk/bilor,EnTeQuAk/bilor | src/bilor/core/handler.py | src/bilor/core/handler.py | import datetime
import logging
import sys
import traceback
import requests
from werkzeug.debug.tbtools import get_current_traceback
class BilorHandler(logging.Handler):
"""Logging handler for bilor.
Based on raven.
"""
def __init__(self, host, *args, **kwargs):
super(BilorHandler, self).__... | bsd-3-clause | Python | |
37b53f976e6159952ee28b6f36adf4c0fdc4ace4 | Create practicepython5.py | wesleigh/vigilant-happiness | practicepython5.py | practicepython5.py | import random
List_1 = [int(100*random.random()) for i in range(100)]
List_2 = [int(100*random.random()) for i in range(100)]
commonNumbers = []
for num in List_1:
if num in List_2:
if num not in commonNumbers:
commonNumbers.append(num)
print(str(commonNumbers) + " is in list 1 and list 2!")... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.