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 |
|---|---|---|---|---|---|---|---|---|
ee2a0cb96aa08fff7162dd4064fd1fa3516037f5 | Create main.py | imughal/EmployeeScript | main.py | main.py | #!/usr/bin/python
from menuclass import *
from empClass import *
from functions import *
employees = []
mainMenu = MainMenu()
while True:
cmd = raw_input("What you want to DO: ")
br()
if cmd.lower() == "q":
print "Quiting Now......"
waits()
exit()
elif cmd.lower() == "m":
while True:
sldOpt = ""
... | mit | Python | |
ae0a9cf969168f6d6c1d5740b3dae7104e526ab4 | Create plot.py | styra/python-handy | plot.py | plot.py | import numpy as np
import pylab as p
__all__ = ['circles', 'mid', 'compare']
def mid(x):
x = np.asarray(x)
= lambda x:(x[1:] + x[:-1])/2.
def circles(x, y, s, c='b', ax=None, vmin=None, vmax=None, **kwargs):
"""
Make a scatter of circles plot of x vs y, where x and y are sequence
like objects of the... | bsd-3-clause | Python | |
c8dbed13a7d1c0358a7a63f75f2f1b416c01a4d8 | add migrate module | FederatedAI/FATE,FederatedAI/FATE,FederatedAI/FATE | federatedml/protobuf/model_migrate/model_migrate.py | federatedml/protobuf/model_migrate/model_migrate.py | from typing import List
def check_party_ids(new_id_list, old_id_list):
for id0, id1 in zip(new_id_list, old_id_list):
if type(id0) != int or type(id1) != int:
raise ValueError('id must be an integer')
def model_migration(model_contents: dict,
old_guest_list: List[int],
... | apache-2.0 | Python | |
0ac7a79dda372763c88b237e269aa9f955b88fdd | Add A new Folder and file @AnaniSkywalker | AnaniSkywalker/UDACITY_Machine_Learning,AnaniSkywalker/UDACITY_Machine_Learning | Titanic_Survival_Exploration/Titanic_Surv_Expl.py | Titanic_Survival_Exploration/Titanic_Surv_Expl.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 16 15:53:32 2017
@author: Anani Assoutovi
"""
import numpy as np
import pandas as pd | mit | Python | |
8644bc8438f9a37607b8a3be7be446f791362c62 | add CNF in docstrings | ContinuumIO/pycosat,sandervandorsten/pycosat,ContinuumIO/pycosat,sandervandorsten/pycosat | test_pycosat.py | test_pycosat.py | import unittest
import pycosat
tests = []
class TestSolver(unittest.TestCase):
def test_sat_1(self):
"""
p cnf 5 3
1 -5 4 0
-1 5 3 4 0
-3 -4 0
"""
res = pycosat.solve(5, [[1, -5, 4],
[-1, 5, 3, 4],
... | import unittest
import pycosat
tests = []
class TestSolver(unittest.TestCase):
def test_sat_1(self):
res = pycosat.solve(5, [[1, -5, 4],
[-1, 5, 3, 4],
[-3, -4]])
self.assertEqual(res, [True, False, False, False, True])
def te... | mit | Python |
d73dfec24b2b77edcab5a1daf1acb35640320aa4 | Add a rudimentary test for the platform module that at least calls each documented function once. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/test/test_platform.py | Lib/test/test_platform.py | import unittest
from test import test_support
import platform
class PlatformTest(unittest.TestCase):
def test_architecture(self):
res = platform.architecture()
def test_machine(self):
res = platform.machine()
def test_node(self):
res = platform.node()
def test_platform(self):... | mit | Python | |
f15b15efc47caa9cf9fcc51904f90996ece93ada | Create __init__.py | NoahCristino/robloxlib | testing/robloxlib/__init__.py | testing/robloxlib/__init__.py | mit | Python | ||
53bac8e86973d8efbbc41f8344039f93211f2bcf | Add testcase for str.center(). | chrisdearman/micropython,bvernoux/micropython,dmazzella/micropython,MrSurly/micropython-esp32,adafruit/circuitpython,oopy/micropython,redbear/micropython,TDAbboud/micropython,pramasoul/micropython,tralamazza/micropython,pozetroninc/micropython,blazewicz/micropython,ryannathans/micropython,TDAbboud/micropython,swegener/... | tests/basics/string_center.py | tests/basics/string_center.py | try:
str.center
except:
import sys
print("SKIP")
sys.exit()
print("foo".center(0))
print("foo".center(1))
print("foo".center(3))
print("foo".center(4))
print("foo".center(5))
print("foo".center(6))
print("foo".center(20))
| mit | Python | |
2f7e2f7dcd463f8b25b1c546ce24c1ec3d106b6d | add loosely equal doc schema | puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq | dimagi/utils/couch/__init__.py | dimagi/utils/couch/__init__.py | from datetime import timedelta
from dimagi.utils.couch.delete import delete
from dimagi.utils.couch.safe_index import safe_index
from couchdbkit.ext.django.schema import DateTimeProperty, DocumentSchema
from couchdbkit.exceptions import ResourceConflict
import json
LOCK_EXPIRATION = timedelta(hours = 1)
class Lockabl... | from datetime import timedelta
from dimagi.utils.couch.delete import delete
from dimagi.utils.couch.safe_index import safe_index
from couchdbkit.ext.django.schema import DateTimeProperty, DocumentSchema
from couchdbkit.exceptions import ResourceConflict
LOCK_EXPIRATION = timedelta(hours = 1)
class LockableMixIn(Docum... | bsd-3-clause | Python |
cb85d50a5a7f69e1605a3e8280a81c4eaa5ebd91 | Add a wsgi.py file, which is useful for using gunicorn | fzadow/CATMAID,fzadow/CATMAID,htem/CATMAID,htem/CATMAID,fzadow/CATMAID,fzadow/CATMAID,htem/CATMAID,htem/CATMAID | django/projects/mysite/wsgi.py | django/projects/mysite/wsgi.py | import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings_apache")
# This application object is used by the development server
# as well as any WSGI server configured to use this file.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
| agpl-3.0 | Python | |
3a06a24c5ce0e5357dfc87eccfc198fd05e881e4 | Write a basic test for filtering by user data | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/es/tests/test_user_es.py | corehq/apps/es/tests/test_user_es.py | import uuid
from django.test import TestCase
from pillowtop.es_utils import initialize_index_and_mapping
from corehq.apps.domain.shortcuts import create_domain
from corehq.apps.es import UserES
from corehq.apps.es.tests.utils import es_test
from corehq.apps.users.dbaccessors.all_commcare_users import delete_all_user... | bsd-3-clause | Python | |
2e7c773d77392621c363258b628b791e7f9f3dd2 | Create basic nn structure | kirnap/Neural-Networks-Playground | nn.py | nn.py | import math
class Neuron(object):
"""
Hold the neuron data
Value represents the z valu of a neuron
"""
def __init__(self, is_bias=False, value=0):
self.is_bias = is_bias
if is_bias:
value = 1
self.value = value
def calculate_sigmoid(self):
"""
... | mit | Python | |
13048c489751e6e15fdfeeda8490a67efde1b72d | Solve task #292 | Zmiecer/leetcode,Zmiecer/leetcode | 292.py | 292.py | class Solution(object):
def canWinNim(self, n):
"""
:type n: int
:rtype: bool
"""
return n % 4 != 0
| mit | Python | |
8e3fea362c42f97a272bd21942f778c806766dcc | Create gol.py | DisFox/asciigameoflife | gol.py | gol.py | import copy,sys,getopt,os,time
class newgame:
def __init__(self,size,livecell,deadcell):
self.size = size
self.livecell = livecell
self.deadcell = deadcell
self.board = [copy.deepcopy([self.deadcell for y in range(self.size)]) for x in range(self.size)]
def flip(self,cell):
if cell == self.deadcell:
... | mit | Python | |
82e8b03e577662703ad325d939e3024e740aa93c | Revert r64932 to bring back src/third_party/libvpx. | gavinp/chromium,ropik/chromium,adobe/chromium,adobe/chromium,yitian134/chromium,yitian134/chromium,Crystalnix/house-of-life-chromium,yitian134/chromium,Crystalnix/house-of-life-chromium,yitian134/chromium,yitian134/chromium,gavinp/chromium,adobe/chromium,adobe/chromium,Crystalnix/house-of-life-chromium,gavinp/chromium,... | third_party/libvpx/libvpx.gyp | third_party/libvpx/libvpx.gyp | # Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
# libvpx_lib is not currently being used since we use libvpx inside
# libavcodec. Keeping this just in case we need this later.
... | bsd-3-clause | Python | |
23140d0cde2292a73e7b00179f59d59aa7030ad6 | Add fnmatch module to stdlib (#141) | corona10/grumpy,aisk/grumpy,pombredanne/grumpy,google/grumpy,S-YOU/grumpy,m4ns0ur/grumpy,m4ns0ur/grumpy,trotterdylan/grumpy,pombredanne/grumpy,S-YOU/grumpy,trotterdylan/grumpy,corona10/grumpy,aisk/grumpy,google/grumpy | third_party/stdlib/fnmatch.py | third_party/stdlib/fnmatch.py | """Filename matching with shell patterns.
fnmatch(FILENAME, PATTERN) matches according to the local convention.
fnmatchcase(FILENAME, PATTERN) always takes case in account.
The functions operate by translating the pattern into a regular
expression. They cache the compiled regular expressions for speed.
The function... | apache-2.0 | Python | |
ce04327f9c36071e941f6b94592988e0b712e5c2 | Add manual sender | AnilRedshift/votefortay,AnilRedshift/votefortay | send.py | send.py | from slackclient import SlackClient
import os
import sys
def send(message):
sc = SlackClient(os.environ['SLACK_KEY'])
sc.api_call('chat.postMessage', channel='#aoeu', text=message, as_user=True)
if __name__ == '__main__':
send(sys.argv[1])
| mit | Python | |
4c141d84996d1702a2c73516e55d6a8a47d8cf0f | Initialize P01_delete | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter09/P01_delete.py | books/AutomateTheBoringStuffWithPython/Chapter09/P01_delete.py | # This program permanently deletes files ending with a .txt extension
#
# Note:
# - Do not run this program for numerous reasons.
# - Demonstrates testing with delete functions
import os
for filename in os.listdir():
if filename.endswith('.rxt'):
#os.unlink(filename)
print(filename) # DEBUG
| mit | Python | |
9bf9f551dabea47cad1a028241e613b4e026c423 | Transform bookmarks to HTML | bertrandvidal/stuff,bertrandvidal/stuff,bertrandvidal/stuff,bertrandvidal/stuff | bookmark_categorization/bookmarks_to_html.py | bookmark_categorization/bookmarks_to_html.py | #!/usr/bin/env python3
import json
import os
import sys
from typing import Dict
from bs4 import BeautifulSoup, Tag, NavigableString
bookmark_file = sys.argv[1]
LINKS = {}
# extract all href from bookmark file
with open(os.path.abspath('bookmarks_10_23_21.html')) as f:
cleaned_up_lines = [line.strip("\n ") for li... | unlicense | Python | |
41e04240f09744c39f4a6639f5917f016b8f844e | move version logic into a module | trevor/calendarserver,trevor/calendarserver,trevor/calendarserver | support/version.py | support/version.py | #!/usr/bin/env python
##
# Copyright (c) 2006-2007 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | apache-2.0 | Python | |
63ebc6e04c226f7a192b978b4760a38d618e0441 | Add celery management command with hot-reload support | vintasoftware/django-react-boilerplate,vintasoftware/django-react-boilerplate,vintasoftware/django-react-boilerplate,vintasoftware/django-react-boilerplate | common/management/commands/celery.py | common/management/commands/celery.py | import shlex
from subprocess import PIPE # nosec
from django.core.management.base import BaseCommand
from django.utils import autoreload
import psutil
def restart_celery():
for proc in psutil.process_iter():
if proc.name() == 'celery':
proc.kill()
cmd = "celery worker -A {{project_name}... | mit | Python | |
5b333f9547908db05663afacc7487749dda168fc | Add tests for tuple option to nd.as_py | pombredanne/dynd-python,pombredanne/dynd-python,ContinuumIO/dynd-python,insertinterestingnamehere/dynd-python,izaid/dynd-python,pombredanne/dynd-python,izaid/dynd-python,insertinterestingnamehere/dynd-python,insertinterestingnamehere/dynd-python,mwiebe/dynd-python,michaelpacer/dynd-python,aterrel/dynd-python,cpcloud/dy... | dynd/tests/test_array_as_py.py | dynd/tests/test_array_as_py.py | import sys
import unittest
from dynd import nd, ndt
class TestArrayAsPy(unittest.TestCase):
def test_struct_or_tuple(self):
a = nd.array((3, "testing", 1.5), type='{x:int, y:string, z:real}')
self.assertEqual(nd.as_py(a), {'x': 3, 'y': "testing", 'z': 1.5})
self.assertEqual(nd.as_py(a, tupl... | bsd-2-clause | Python | |
008f959c5ff2f2ebd2ebabd807fb02cc15a1744f | Create spider.py | zifeo/Food-habits,zifeo/Food-habits,zifeo/Food-habits,zifeo/Food-habits | spider.py | spider.py | import scrapy
from scrapy.crawler import CrawlerProcess
from twisted.internet import reactor
class CitiesSpider(scrapy.Spider):
name = "cities"
start_urls = [
'https://www.lafourchette.com/toutes-les-villes',
'https://www.lafourchette.ch/toutes-les-villes'
]
def parse(self, response):
... | apache-2.0 | Python | |
93953f16228d651807ee31e2ba0a022e9af18bf3 | Add Lists.py | mcsoo/Exercises | Lists.py | Lists.py | __author__ = "ClaytonBat"
class Node:
def __init__(self,initdata):
self.data = initdata
self.next = None
def getData(self):
return self.data
def getNext(self):
return self.next
def setData(self,newdata):
self.data = newdata
def setNext(self,newnext):
... | mit | Python | |
c847dd43259e6206d94b691c8c1624d914319394 | Update Perspective.py | jdf/processing.py,mashrin/processing.py,mashrin/processing.py,jdf/processing.py,jdf/processing.py,mashrin/processing.py,tildebyte/processing.py,tildebyte/processing.py,tildebyte/processing.py | examples.py/3D/Camera/Perspective.py | examples.py/3D/Camera/Perspective.py | """
Perspective.
Move the mouse left or right to change the field of view (fov).
Click to modify the aspect ratio. The perspective() function
sets a perspective projection applying foreshortening, making
distant objects appear smaller than closer ones. The parameters
define a viewing volume with the shape of truncate... | """
Perspective.
Move the mouse left or right to change the field of view (fov).
Click to modify the aspect ratio. The perspective() function
sets a perspective projection applying foreshortening, making
distant objects appear smaller than closer ones. The parameters
define a viewing volume with the shape of trunca... | apache-2.0 | Python |
f4d17bb598c6c18001f98f5f0641f17bc44c9e48 | Update Perspective.py | jdf/processing.py,tildebyte/processing.py,jdf/processing.py,mashrin/processing.py,tildebyte/processing.py,mashrin/processing.py,mashrin/processing.py,tildebyte/processing.py,jdf/processing.py | examples.py/3D/Camera/Perspective.py | examples.py/3D/Camera/Perspective.py | """
Perspective.
Move the mouse left or right to change the field of view (fov).
Click to modify the aspect ratio. The perspective() function
sets a perspective projection applying foreshortening, making
distant objects appear smaller than closer ones. The parameters
define a viewing volume with the shape of trunca... | """
* Perspective.
*
* Move the mouse left and right to change the field of view (fov).
* Click to modify the aspect ratio. The perspective() function
* sets a perspective projection applying foreshortening, making
* distant objects appear smaller than closer ones. The parameters
* define a viewing volume with t... | apache-2.0 | Python |
96379c9390481d39c8e2f46f54ae4948e3737019 | Add RTOutput component for using the RtAudio python bindings when they're working | sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia | Sketches/JT/Jam/library/trunk/Kamaelia/Apps/Jam/Audio/RTOutput.py | Sketches/JT/Jam/library/trunk/Kamaelia/Apps/Jam/Audio/RTOutput.py | import Axon
import RtAudio
class RTOutput(Axon.Component.component):
channels = 2
type = 0x2 # INT16 - will add these into binding
sampleRate = 44100
bufferSize = 1024
def __init__(self, **argd):
super(RTOutput, self).__init__(**argd)
self.io = RtAudio.RtAudio()
self.io.sho... | apache-2.0 | Python | |
b3fcd2b4bf5c0c27579508fca2721e756386469f | Create StepperMotorDriver.py | Anton04/RaspPy-StepperMotor-Driver | StepperMotorDriver.py | StepperMotorDriver.py | import time
import RPi.GPIO as GPIO
class MotorControl:
def __init__(self,Pins = [24,25,8,7]):
GPIO.setmode(GPIO.BCM)
self.StepPins = Pins
self.Counter = 0
self.Setup()
def Setup(self):
for pin in self.StepPins:
print "Setup pins"
GPIO.setup(pin,GPIO.OUT)
GPIO.output(pin, False)
def Sh... | mit | Python | |
dd3d8f781a416a38834f31b48700b17021825811 | Create QSort.py | Progyan1997/Data-Structure-Algorithm,Progyan1997/Data-Structure-Algorithm,Progyan1997/Data-Structure-Algorithm | QSort.py | QSort.py | '''
QUICK SORT
DIVIDE AND COMPARE ALGORITHM
BEST CASE RUNTIME : O(N logN)
WORST CASE RUNTIME: O(N²)
SPACE COMPLEXITY : O(N)
'''
def partition(A, left, right, pivot):
lIndex = left
rIndex = right - 1
while True:
while(A[lIndex] < pivot): # Skip where el... | mit | Python | |
71174a9b1264d8cb1add9ab87d87652145810cde | add 2021 day 2 part 2 | kmcginn/advent-of-code | 2021/day01/depth2.py | 2021/day01/depth2.py | #! python3
"""
from: https://adventofcode.com/2021/day/1
--- Part Two ---
Considering every single measurement isn't as useful as you expected: there's just too much noise
in the data.
Instead, consider sums of a three-measurement sliding window. Again considering the above example:
199 A
200 A B
208 A ... | mit | Python | |
21fe48849c7c988cc1b2ee43ad05dc91048132df | Create lcddriver.py | bradgillap/I2C-LCD-Display | 20x4LCD/lcddriver.py | 20x4LCD/lcddriver.py | import i2c_lib
from time import *
# LCD Address
ADDRESS = 0x27
# commands
LCD_CLEARDISPLAY = 0x01
LCD_RETURNHOME = 0x02
LCD_ENTRYMODESET = 0x04
LCD_DISPLAYCONTROL = 0x08
LCD_CURSORSHIFT = 0x10
LCD_FUNCTIONSET = 0x20
LCD_SETCGRAMADDR = 0x40
LCD_SETDDRAMADDR = 0x80
# flags for display entry mode
LCD_ENTRYRIGHT = 0x00
... | apache-2.0 | Python | |
79e6a0ce5852f722188287578be86cf63c5574c3 | add dev-http-server.py | pastleo/dotSetting,pastleo/dotSetting,chgu82837/dotSetting,pastleo/dotSetting | home/.bin/dev-http-server.py | home/.bin/dev-http-server.py | #!/usr/bin/env python
# https://gist.github.com/ccoenen/8038234
# https://gist.github.com/dustingetz/5348582
import http.server # python3
# import SimpleHTTPServer # python2
class MyHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
def end_headers(self):
self.send_my_headers()
http.server... | cc0-1.0 | Python | |
55017eadf948fb951e6303cd4c914c968d6f60b2 | Add an auto-generated missing migration | maccesch/cmsplugin-contact,maccesch/cmsplugin-contact | cmsplugin_contact/migrations_django/0003_auto_20161107_1614.py | cmsplugin_contact/migrations_django/0003_auto_20161107_1614.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-11-07 15:14
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cmsplugin_contact', '0002_auto_20160810_1130'),
]
o... | bsd-2-clause | Python | |
82bc65cce89d40e9dff074a784fe051146c88749 | fix typo | devlights/try-python | trypython/stdlib/itertools02.py | trypython/stdlib/itertools02.py | # coding: utf-8
"""
itertools モジュールについてのサンプル
以下の処理についてのサンプルです。
- cycle()
"""
import itertools as it
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr, hr
class Sample(SampleBase):
def exec(self):
# -----------------------------------------------
# iter... | # coding: utf-8
"""
itertools モジュールについてのサンプル
以下の処理についてのサンプルです。
- cycle()
"""
import itertools as it
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr, hr
class Sample(SampleBase):
def exec(self):
# -----------------------------------------------
# iter... | mit | Python |
b18738e03d0792bb6fa909cea8f626a28d99338c | Add gawk (GNU awk) (#2625) | mfherbst/spack,TheTimmy/spack,EmreAtes/spack,krafczyk/spack,tmerrick1/spack,krafczyk/spack,TheTimmy/spack,iulian787/spack,matthiasdiener/spack,TheTimmy/spack,EmreAtes/spack,lgarren/spack,skosukhin/spack,tmerrick1/spack,skosukhin/spack,lgarren/spack,matthiasdiener/spack,TheTimmy/spack,mfherbst/spack,matthiasdiener/spack... | var/spack/repos/builtin/packages/gawk/package.py | var/spack/repos/builtin/packages/gawk/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... | lgpl-2.1 | Python | |
dccd8403a93a0c86054d61142198643d30b8d9af | Add migration that sets score.user_id appropriately | Cal-CS-61A-Staff/ok,Cal-CS-61A-Staff/ok,Cal-CS-61A-Staff/ok,Cal-CS-61A-Staff/ok,Cal-CS-61A-Staff/ok | migrations/versions/0c98b865104f_add_score_user_id_column.py | migrations/versions/0c98b865104f_add_score_user_id_column.py | """Add score.user_id column
Revision ID: 0c98b865104f
Revises: 7b6a65c708b9
Create Date: 2016-10-27 19:03:44.901639
"""
# revision identifiers, used by Alembic.
revision = '0c98b865104f'
down_revision = '7b6a65c708b9'
from alembic import op
import sqlalchemy as sa
import server
def upgrade():
op.add_column('s... | apache-2.0 | Python | |
1055ecf65c4beed35cba83a28de8dd2940be7f40 | Create a User view | bertjwregeer/alexandria,cdunklau/alexandria,cdunklau/alexandria,bertjwregeer/alexandria,cdunklau/alexandria | alexandria/views/user.py | alexandria/views/user.py | from pyramid.view import (
view_config,
view_defaults,
)
from pyramid.security import (
remember,
forget,
)
@view_defaults(accept='application/json', renderer='json', context='..traversal.User')
class User(object):
def __init__(self, context, request):
self.... | isc | Python | |
9bdc260cb9684a5d4133187c38b953f61c4b6db5 | Add open-floating-on-ws example | xenomachina/i3ipc-python,acrisci/i3ipc-python,chrsclmn/i3ipc-python,nicoe/i3ipc-python | examples/open-floating-on-ws.py | examples/open-floating-on-ws.py | #!/usr/bin/env python3
# This example shows how to make any window that opens on a workspace floating
# All workspaces that start with a string in this list will have their windows
# open floating
FLOATING_WORKSPACES = [ '3' ]
def is_ws_floating(name):
for floating_ws in FLOATING_WORKSPACES:
if name.star... | bsd-3-clause | Python | |
b2bef05e0490d161ecec07b4403964c19875ee5d | Add new case for function resolution of fp16 unary and binary operators | numba/numba,cpcloud/numba,cpcloud/numba,cpcloud/numba,numba/numba,numba/numba,numba/numba,cpcloud/numba,numba/numba,cpcloud/numba | numba/cuda/tests/nocuda/test_function_resolution.py | numba/cuda/tests/nocuda/test_function_resolution.py | from numba.cuda.testing import unittest, skip_on_cudasim
import operator
from numba.core import types, typing
@skip_on_cudasim("Skip on simulator due to use of cuda_target")
class TestFunctionResolutionNoCuda(unittest.TestCase):
def test_fp16_binary_operators(self):
from numba.cuda.descriptor import cuda_... | bsd-2-clause | Python | |
8a4f381195b435f327b8b02c70b69ffc5e6c2d72 | add example | francois-berder/PyLetMeCreate | examples/rpisensehat_example.py | examples/rpisensehat_example.py | #!/usr/bin/env python3
"""This example shows how to use the RpiSenseHat wrapper of the LetMeCreate
library.
It reads the temperature, humidity and pressure from sensors on the board.
Then, it displays a rainbow on the led matrix for 5 seconds.
The RpiSenseHat must be inserted in the RpiSenseHat header before running ... | bsd-3-clause | Python | |
4ef254ef55f2f112272fce13f3800c8f2ca80482 | add wsgi.py to be used with gunicorn in a production env | gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine | openquake/server/wsgi.py | openquake/server/wsgi.py | import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "openquake.server.settings")
from openquake.engine.db import models
models.getcursor('job_init').execute(
# cleanup of the flag oq_job.is_running
'UPDATE uiapi.oq_job SET is_running=false WHERE is_runni... | agpl-3.0 | Python | |
c456ec0a5dd4c48b13d82930eab32c85bcc0e7be | Add short_url column to Graph | stardust66/math3d,ChristopherChudzicki/math3d,ChristopherChudzicki/math3d,stardust66/math3d,ChristopherChudzicki/math3d,ChristopherChudzicki/math3d,stardust66/math3d,stardust66/math3d | migrations/versions/75f579d01f0d_.py | migrations/versions/75f579d01f0d_.py | """empty message
Revision ID: 75f579d01f0d
Revises: 25f4f234760c
Create Date: 2017-05-06 23:15:02.228272
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '75f579d01f0d'
down_revision = '25f4f234760c'
branch_labels = None
depends_on = None
def upgrade():
# ... | mit | Python | |
82830195bea0283bf07d17d0879a6581e1f1fec7 | add urls fixing as well | SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,gmimano/commcaretest,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,gmimano/commcaretest,gmimano/commcaretest,dimagi/commcare-hq,d... | django-hq/projects/cchq_main/urls.py | django-hq/projects/cchq_main/urls.py | from django.conf.urls.defaults import *
from django.conf.urls import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Example:
(r'^$', 'views.homepage'),
(r'^accounts/login/$', 'django.contrib.auth.views.login'),
(... | from django.conf.urls.defaults import *
from django.conf.urls import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Example:
(r'^$', 'views.homepage'),
(r'^accounts/login/$', 'django.contrib.auth.views.login'),
(... | bsd-3-clause | Python |
9d1e16d68d4212819587e5fcdfb303b688275322 | add test_build_image_abspath test | ImageIntelligence/mimiron | test/vendor/test_dockerhub.py | test/vendor/test_dockerhub.py | # -*- coding: utf-8 -*-
from collections import namedtuple
import pytest
from mimiron.vendor import dockerhub
class TestDockerHub(object):
def setup_method(self):
DockerAuthMock = namedtuple('DockerAuthMock', ['username', 'password', 'org'], verbose=True)
self.auth = DockerAuthMock('example-usern... | mit | Python | |
27a9d63de501e6468e4aa0d852ee3bccc783f837 | Create metric_queue_to_limit_time.py | pseudo-cluster/pseudo-cluster,pseudo-cluster/pseudo-cluster | scripts/pseudo_cluster/metrics/metric_queue_to_limit_time.py | scripts/pseudo_cluster/metrics/metric_queue_to_limit_time.py | # -*- coding: utf-8 -*-
import datetime
metric_short_description=\
_("вычисляет среднее отношение времени в очереди к запрошенному времени.")
metric_description=\
_("""
требует параметров:
count_mode - возможные значения: (user, day, total)
""")
class Metric_counter(object):
"""
Класс задающ... | lgpl-2.1 | Python | |
b6822410231893038b40f1623fabb91869d95b19 | add large scale example | neurospin/pylearn-epac,neurospin/pylearn-epac | examples/large_toy.py | examples/large_toy.py | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 23 10:06:54 2013
@author: edouard.duchesnay@cea.fr
@author: benoit.da_mota@inria.fr
"""
from sklearn import datasets
from sklearn.svm import SVC
from sklearn.feature_selection import SelectKBest
X, y = datasets.make_classification(n_samples=100, n_features=500,
... | bsd-3-clause | Python | |
e57798d17c11f4c5596abd60b86b515dc32acad6 | Add phonetic product calculation | kdelwat/LangEvolve,kdelwat/LangEvolve,kdelwat/LangEvolve | app/metrics.py | app/metrics.py | from collections import Counter
from functools import reduce
import operator
BILABIAL = (0, {'positive': ['labial'], 'negative': ['syllabic']})
APICAL = (1, {'positive': ['coronal', 'anterior'], 'negative': ['syllabic']})
PALATAL = (2, {'positive': ['distributed'], 'negative': ['anterior', 'syllabic']})
VELAR = (3, {'... | mit | Python | |
e5e46f1c270770fe291d9d33f584a4900b59c5dd | add needle_haystack.py task from week7 | pepincho/Python101-and-Algo1-Courses,pepincho/HackBulgaria,pepincho/HackBulgaria,pepincho/Python101-and-Algo1-Courses | Algo-1/week7/2-Needle-Haystack/needle_haystack.py | Algo-1/week7/2-Needle-Haystack/needle_haystack.py | class NeedleHaystack:
# d - length of alphabet
# q - some prime number
@staticmethod
def Rabin_Karp_Matcher(text, pattern, d, q, result):
n = len(text)
m = len(pattern)
h = 1
p = 0
t = 0
for i in range(1, m):
h = (h * d) % q
for i in... | mit | Python | |
189ec6dabc25eb91335568a7e6547483f9ec2960 | Add tool to extract routing from planning debug | ApolloAuto/apollo,ycool/apollo,ApolloAuto/apollo,xiaoxq/apollo,xiaoxq/apollo,ycool/apollo,ycool/apollo,ycool/apollo,jinghaomiao/apollo,wanglei828/apollo,wanglei828/apollo,ycool/apollo,ApolloAuto/apollo,jinghaomiao/apollo,jinghaomiao/apollo,jinghaomiao/apollo,xiaoxq/apollo,wanglei828/apollo,wanglei828/apollo,xiaoxq/apol... | modules/tools/extractor/extractor.py | modules/tools/extractor/extractor.py | #!/usr/bin/env python
###############################################################################
# Copyright 2017 The Apollo Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy ... | apache-2.0 | Python | |
594307f48e3dd1ab62bc4bfb5fce623fc2730885 | fix matroska test, other valid extensions are 'mks', 'mk3d', 'mka' | mcpv/PyAV,danielballan/PyAV,mikeboers/PyAV,mikeboers/PyAV,pupil-labs/PyAV,danielballan/PyAV,markreidvfx/PyAV,danielballan/PyAV,markreidvfx/PyAV,pupil-labs/PyAV,xxr3376/PyAV,PyAV-Org/PyAV,pupil-labs/PyAV,pupil-labs/PyAV,xxr3376/PyAV,markreidvfx/PyAV,mcpv/PyAV,mcpv/PyAV,PyAV-Org/PyAV,xxr3376/PyAV | tests/test_containerformat.py | tests/test_containerformat.py | from .common import *
from av.format import ContainerFormat, names
class TestContainerFormats(TestCase):
def test_matroska(self):
fmt = ContainerFormat('matroska')
self.assertTrue(fmt.is_input)
self.assertTrue(fmt.is_output)
self.assertEqual(fmt.name, 'matroska')
self.asse... | from .common import *
from av.format import ContainerFormat, names
class TestContainerFormats(TestCase):
def test_matroska(self):
fmt = ContainerFormat('matroska')
self.assertTrue(fmt.is_input)
self.assertTrue(fmt.is_output)
self.assertEqual(fmt.name, 'matroska')
self.asse... | bsd-3-clause | Python |
4b5a93be1ccca63aaac22203f07ac4ea882c609b | remove unused import | 916253/Kurisu,ihaveamac/Kurisu,thedax/Kurisu | addons/blah.py | addons/blah.py | from discord.ext import commands
class Blah:
"""
Custom addon to make announcements.
"""
def __init__(self, bot):
self.bot = bot
print('Addon "{}" loaded'.format(self.__class__.__name__))
@commands.has_permissions(ban_members=True)
@commands.command(hidden=True, pass_context=Tr... | import discord
from discord.ext import commands
class Blah:
"""
Custom addon to make announcements.
"""
def __init__(self, bot):
self.bot = bot
print('Addon "{}" loaded'.format(self.__class__.__name__))
@commands.has_permissions(ban_members=True)
@commands.command(hidden=True, ... | apache-2.0 | Python |
1e572b33e958a655e3a8245e648482b00d393bfb | Add workspace unit tests | Mariocj89/hubsync | tests/unit/workspace_tests.py | tests/unit/workspace_tests.py | """Tests for hubsync.workspace module"""
import unittest
import git
import mock
from hubsync.workspace import Organization, InvalidPath, Workspace, Repo
class WorkspaceTestCase(unittest.TestCase):
def setUp(self):
self.path = "/the/org/path/"
self.ws = Workspace(self.path)
def test_ws_repr(se... | mit | Python | |
1d2a13a0359d489341097a924e65104f5941a528 | Add kids game --until10 | jacksing/fourdirections | until10.py | until10.py | # coding: utf-8
import Tkinter
from random import sample
class Until10(object):
question_format = '%d可以分成( %d )和( %s )'
def __init__(self):
self.init_form()
def init_form(self):
'''Initialize form and its inside controls.'''
self.form = Tkinter.Tk()
self.form.title('Until... | mit | Python | |
2f3f4e804e3cd2af1f45f07097cdc56b99c6e5c3 | Add a snippet (Tkinter). | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/tkinter/python3/geometry_manager_grid.py | python/tkinter/python3/geometry_manager_grid.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Jérémie DECOCK (http://www.jdhp.org)
# 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 witho... | mit | Python | |
7dfd62f18382ca70367413c50dadda50af6fc60d | add a dummy class to describe a python package. | abadger/Bento,abadger/Bento,cournape/Bento,abadger/Bento,abadger/Bento,cournape/Bento,cournape/Bento,cournape/Bento | toydist/package.py | toydist/package.py | class PackageDescription:
def __init__(self, name, version=None, summary=None, url=None,
author=None, author_email=None, license=None, description=None,
platforms=None, packages=None, py_modules=None):
# XXX: should we check that we have sequences when required
# (py_modules,... | bsd-3-clause | Python | |
86998efa9b76e025d0727ef68cf13f4fff2af197 | Add Repository resource | dmm92/troposphere,horacio3/troposphere,pas256/troposphere,cloudtools/troposphere,pas256/troposphere,johnctitus/troposphere,alonsodomin/troposphere,alonsodomin/troposphere,johnctitus/troposphere,ikben/troposphere,7digital/troposphere,horacio3/troposphere,cloudtools/troposphere,ikben/troposphere,Yipit/troposphere,dmm92/t... | troposphere/ecr.py | troposphere/ecr.py | from . import AWSObject
try:
from awacs.aws import Policy
policytypes = (dict, Policy)
except ImportError:
policytypes = dict,
class Repository(AWSObject):
resource_type = "AWS::ECR::Repository"
props = {
'RepositoryName': (basestring, False),
'RepositoryPolicyText': (policytypes, ... | bsd-2-clause | Python | |
ba185308919bf8b9cddfd7e139d3a2343d6e9863 | Add predict.py | aidiary/keras_examples,aidiary/keras_examples | vgg16/dogs_vs_cats/predict.py | vgg16/dogs_vs_cats/predict.py | import os
import sys
from keras.applications.vgg16 import VGG16
from keras.models import Sequential, Model
from keras.layers import Input, Activation, Dropout, Flatten, Dense
from keras.preprocessing import image
import numpy as np
if len(sys.argv) != 2:
print("usage: python predict.py [filename]")
sys.exit(1)... | mit | Python | |
24f9aa93309463fa54e6b0c7afccbd4d8c927811 | Build script. | mgsdk/CKAN-Utilities | build.py | build.py | # -*- coding: utf-8 -*-
import os
import shutil
import subprocess
def main():
# Get the path of the root CKAN directory.
root_path = os.path.abspath(os.path.join(os.path.curdir, ".."))
# Build each repository.
build_repository("core", root_path)
build_repository("GUI", root_path)
build_re... | mit | Python | |
0208944a3e38e8c96dd4eea866bb89effd8406ae | Create build.py | madd-games/apocalypse,madd-games/apocalypse,madd-games/apocalypse,madd-games/apocalypse,madd-games/apocalypse | build.py | build.py | #! /usr/bin/python
# Build the engine and the game.
"""
Copyright (c) 2014, Madd Games.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright ... | bsd-2-clause | Python | |
1c045a06dbbcb8c1e4af817b73f9794430299c70 | Create create_random_nexus.py | SimonGreenhill/phylogemetric | phylogemetric/create_random_nexus.py | phylogemetric/create_random_nexus.py | """
Generate random data for performance benchmark.
"""
from random import choice
import argparse
N_SEQUENCES = 100
SEQ_LEN = 100
CHARACTERS = list("agct")
HEADER = """#NEXUS
Begin data;
Dimensions ntax={} nchar={};
Format datatype=dna missing=? gap=-;
Matrix
"""
FOOTER = """;
End;
"""
def create_nex(nseq, seql... | bsd-3-clause | Python | |
de605d849cccfe1237792a427d75c9e2d15c37b1 | Add RBAC test cases for the new service regstry API endpoints. | Plexxi/st2,nzlosh/st2,StackStorm/st2,Plexxi/st2,Plexxi/st2,nzlosh/st2,nzlosh/st2,nzlosh/st2,StackStorm/st2,StackStorm/st2,StackStorm/st2,Plexxi/st2 | st2api/tests/unit/controllers/v1/test_service_registry_rbac.py | st2api/tests/unit/controllers/v1/test_service_registry_rbac.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | apache-2.0 | Python | |
76b6266af4052f43895b838d5c25419747301530 | add run_multiple_ai | FluxLemur/citybash,FluxLemur/citybash,FluxLemur/citybash | ai/run_multiple_ai.py | ai/run_multiple_ai.py | #! /usr/bin/python
import argparse
import subprocess
import sys; sys.path.append('../clients/')
from utils import send_command
parser = argparse.ArgumentParser("Start up several citybash AIs")
parser.add_argument('host')
parser.add_argument('port', type=int)
parser.add_argument('admin_key')
parser.add_argument('num... | mit | Python | |
0e98d0fae4a81deec57ae162b8db5bcf950b3ea3 | Move mimetype column from module_files to files | Connexions/cnx-archive,Connexions/cnx-archive | cnxarchive/sql/migrations/20160128110515_mimetype_on_files_table.py | cnxarchive/sql/migrations/20160128110515_mimetype_on_files_table.py | # -*- coding: utf-8 -*-
"""\
- Add a ``media_type`` column to the ``files`` table.
- Move the mimetype value from ``module_files`` to ``files``.
"""
from __future__ import print_function
import sys
def up(cursor):
# Add a ``media_type`` column to the ``files`` table.
cursor.execute("ALTER TABLE files ADD COL... | agpl-3.0 | Python | |
a6b884dd685ff746ca93f4a8f00d014f854d5f83 | test integration against scipy | abonaca/gary,abonaca/gary,abonaca/gary | gary/integrate/tests/test_1d.py | gary/integrate/tests/test_1d.py | # coding: utf-8
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os
import time
import logging
# Third-party
import numpy as np
from astropy import log as logger
from scipy.integrate import simps
# Project
from ..simpsgauss import simpson
logg... | mit | Python | |
f40b6fc1375aaa1b8fd0bc6c6cfacd8bc97febb0 | Add the call retry | xgfone/xutils,xgfone/pycom | xutils/retry.py | xutils/retry.py | # -*- coding: utf-8 -*-
import time
import functools
class Retry(object):
def __init__(self, max_retries=2, retry_interval=1, max_retry_interval=5,
increase_retry_interval=True, exceptions=(IOError, OSError)):
self._max_retries = max_retries
self._retry_interval = retry_interval
... | mit | Python | |
d713d227336d456ff999edbb3ea1103b4f6be713 | update : add item_post model | deadlylaid/book_connect,deadlylaid/book_connect,deadlylaid/book_connect | wef/items/models/item_post.py | wef/items/models/item_post.py | from django.db import models
from django.conf import settings
class ItemPost(models.Model):
user = models.foreignKey(
settings.AUTH_USER_MODEL,
)
title = models.TextField(
)
created_at = models.DateTimeField(
auto_now_add=True,
)
updated_... | mit | Python | |
47522f2b473018fc8e8986b7bfa77035548d4060 | correct content | macauleycheng/AOS_OF_Example,macauleycheng/AOS_OF_Example | 000-Netconf/03-VxLAN/06_create_vtap/edit-config-creat-vtap.py | 000-Netconf/03-VxLAN/06_create_vtap/edit-config-creat-vtap.py | from ncclient import manager
import ncclient
import xml.etree.ElementTree as ET
host = "192.168.1.1"
username="root"
password="root"
#due to ofconfig design problem, it need fill port feature
#but we won't use it currently.
config_xml="""
<config>
<capable-switch xmlns="urn:onf:of111:config:yang"... | apache-2.0 | Python | |
fbeda46ab84e24c155558c310d0b1e281146d402 | support running biothings.web as a module | biothings/biothings.api,biothings/biothings.api | biothings/web/__main__.py | biothings/web/__main__.py | """
Biothings API
Support running biothings.web as a module
>> python -m biothings.web
>> python -m biothings.web --dir=~/mygene.info/src
>> python -m biothings.web --dir=~/mygene.info/src --conf=config_web
>> python -m biothings.web --conf=biothings.web.settings.default
See more supp... | apache-2.0 | Python | |
a42f73e2092b473f17635362b53fd2b528038aaa | Create basic_deployment.py | TransCirrus/charm-trove,JonathanArrance/charm-trove | src/tests/basic_deployment.py | src/tests/basic_deployment.py | apache-2.0 | Python | ||
10a3dbeb56e60f572b92769957a11669ddd267c6 | Add synthesis example | JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton | src/examples/python/synthesizing_obfuscated_code.py | src/examples/python/synthesizing_obfuscated_code.py | #!/usr/bin/env python
## -*- coding: utf-8 -*-
import sys
from triton import *
# int f(unsigned a, unsigned b) {
# unsigned n = (a & ~(-((((b & a) * (b | a) + (b & ~a) * (~b & a)) & b) * \
# (((b&a)*(b|a) + (b& ~a)*(~b&a))|b) + (((b&a)*(b| a) + (b & ~a) * \
# ... | apache-2.0 | Python | |
7169271674b0df6235e7d490fb8b799a48c4a8c4 | Add Video resource | gadventures/gapipy | gapipy/resources/tour/video.py | gapipy/resources/tour/video.py | # -*- coding: utf-8 -*-
# Python 2 and 3
from __future__ import unicode_literals
from ..base import Resource
class Video(Resource):
_resource_name = 'videos'
_as_is_fields = [
'id',
'href',
'url',
'code',
'source',
'title',
'description',
'im... | mit | Python | |
24d4790b8017c23705c3e50155ae1d5ae8530736 | Add script to generate batch of model runs, one for each ensemble realisation Issue #363 | tomalrussell/smif,nismod/smif,tomalrussell/smif,tomalrussell/smif,tomalrussell/smif,nismod/smif,nismod/smif,nismod/smif | src/smif/sample_project/write_variant_model_runs_from_template.py | src/smif/sample_project/write_variant_model_runs_from_template.py | """
Script that generate nb_model_runs model run config files from a template
model run file template_model_run, for each nb_model_runs variants of a scenario.
Command line arguments:
----------------------
template_model_run: name of the template file
scenario_name: Name of the scenario that is varied
nb_model_runs:... | mit | Python | |
e8b5ff092c9891fe25dfa0282fb9bf9a3e83b56d | Fix migrations | MasterFacilityList/mfl_api,MasterFacilityList/mfl_api,MasterFacilityList/mfl_api,MasterFacilityList/mfl_api,MasterFacilityList/mfl_api | chul/migrations/0002_merge.py | chul/migrations/0002_merge.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('chul', '0001_auto_20150924_0941'),
('chul', '0001_churating'),
]
operations = [
]
| mit | Python | |
3fdd0f6f196b716238f7d400b6d2511db1f723ea | Add basic keyboard control | atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot | src/autobot/src/keySteer.py | src/autobot/src/keySteer.py | #!/usr/bin/env python
import rospy
from autobot.msg import drive_param
import curses
global velocity
global steerAngle
global multiplier
velocity = 0
steerAngle = 0
multiplier = 5
stdscr = curses.initscr()
curses.cbreak()
curses.noecho()
stdscr.keypad(1)
stdscr.refresh()
stdscr.addstr(0, 5, "AUTOBOT CONTROL - \
U... | mit | Python | |
ce9657eec421eb626f22405ab744f1554d8c376f | Add script to clean Wikipedia categories | tiffanyj41/hermes,tiffanyj41/hermes,tiffanyj41/hermes,tiffanyj41/hermes | src/utils/clean_categories.py | src/utils/clean_categories.py | import re
def clean_categories(text):
"""Replace Wikipedia category links with the name of the category in the
text of an article.
Text like "[[Category:Foo]]" will be replaced with "Foo". Sorting hints are
thrown away during this cleaning, so text like "[[Category:Bar|Sorting
hint]]" will be repla... | apache-2.0 | Python | |
63d6b744b91dfaed7e468fe0f79c90ba289bb889 | Create executable_identifier.py | Bindernews/TheHound | identifiers/executable_identifier.py | identifiers/executable_identifier.py | from identifier import
EXE_PATTERNS = [
'4D 5A 50 00',
'4D 5A 90 00',
]
class ExeResolver
def identify(self, stream):
return Result('exe')
def load(hound):
hound.add_matches(EXE_PATTERNS, ExeResolver())
| mit | Python | |
d794b46002889d66089a8bef48e415694319523c | Create Tarea2.py | AristidesOrtega/uip-prog3 | tareas/Tarea2.py | tareas/Tarea2.py | #Tarea2
#Una ambulancia se mueve con una velocidad de 120 km/h y
#necesita recorrer un tramo recto de 60km.
#Calcular el tiempo necesario, en segundos,
#para que la ambulancia llegue a su destino.
#La fórmula a utilizar es: velocidad = distancia / tiempo.
velocidad = 120
distancia = 60
tiempo = distancia / veloci... | mit | Python | |
510d8821e5e7d59481b1c8e882226aa5cec1a3b7 | add new package (#16290) | LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-nltk/package.py | var/spack/repos/builtin/packages/py-nltk/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PyNltk(PythonPackage):
"""The Natural Language Toolkit (NLTK) is a Python package for
natural language proc... | lgpl-2.1 | Python | |
2095d398563f824dab4c744fb0c0100954d511e0 | Create json-2-yaml.py | ramitsurana/jenkins-docker-workflow,ramitsurana/jenkins-docker-workflow,ramitsurana/jenkins-docker-workflow | cloudformation/json-2-yaml.py | cloudformation/json-2-yaml.py | import yaml
import json
import argparse
import sys
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--json', help='Input file (JSON)', required=True)
parser.add_argument('--yaml', help='Output file (YAML)', required=True)
if len(sys.argv) == 1:
parser.print_help... | mit | Python | |
ec38e1360f7325a63a69fae5c58c1725074843bb | Add find_jobs_between.py. | aaichsmn/tacc_stats,aaichsmn/tacc_stats,TACC/tacc_stats,ubccr/tacc_stats,aaichsmn/tacc_stats,dimm0/tacc_stats,rtevans/tacc_stats_old,aaichsmn/tacc_stats,dimm0/tacc_stats,ubccr/tacc_stats,dimm0/tacc_stats,sdsc/xsede_stats,sdsc/xsede_stats,dimm0/tacc_stats,dimm0/tacc_stats,sdsc/xsede_stats,ubccr/tacc_stats,rtevans/tacc_s... | monitor/find_jobs_between.py | monitor/find_jobs_between.py | #!/usr/bin/env python
import datetime, glob, os, sge_acct, subprocess, sys, time
prog_name = os.path.basename(sys.argv[0])
acct_path = '/share/sge6.2/default/common/accounting'
host_list_dir = '/share/sge6.2/default/tacc/hostfile_logs'
def FATAL(str):
print >>sys.stderr, "%s: %s" % (prog_name, str)
sys.exit(1... | lgpl-2.1 | Python | |
d77aba6210f44f9cb5828670aef93305594474ca | Add more tests | kennethreitz/tablib | tests/test_tablib_dbfpy_packages_utils.py | tests/test_tablib_dbfpy_packages_utils.py | #!/usr/bin/env python
"""Tests for tablib.packages.dbfpy."""
import datetime
import unittest
from tablib.packages.dbfpy import utils
class UtilsUnzfillTestCase(unittest.TestCase):
"""dbfpy.utils.unzfill test cases."""
def test_unzfill_with_nul(self):
# Arrange
text = b"abc\0xyz"
# ... | mit | Python | |
438009ba94421c51fdaa341406f84acfb472da0c | add test for equal_chance_permutation | ibmibmibm/beets,SusannaMaria/beets,beetbox/beets,shamangeorge/beets,jackwilsdon/beets,sampsyo/beets,ibmibmibm/beets,beetbox/beets,shamangeorge/beets,beetbox/beets,SusannaMaria/beets,jackwilsdon/beets,beetbox/beets,sampsyo/beets,jackwilsdon/beets,sampsyo/beets,sampsyo/beets,shamangeorge/beets,SusannaMaria/beets,ibmibmib... | test/test_random.py | test/test_random.py | # -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2019, Carl Suster
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the r... | mit | Python | |
d12a5c8a891e6d3dccad6cc9003d51da5f55e2e4 | Add crv_coeffs.py with OCRed coeffs from page 400 of the paper | ergs/transmutagen,ergs/transmutagen | tests/crv_coeffs.py | tests/crv_coeffs.py | """
exp(-t) best CRAM coefficients from the appendix of the paper
"Extended Numerical Computations on the '1/9' Conjecture in Rational
Approximation Theory", A. J. Carpenter, A. Ruttan, and R.S. Varga
The coefficients have been OCRed from https://finereaderonline.com which uses
Abbyy, and verified by hand.
"""
coeffs... | bsd-3-clause | Python | |
446001a03803bdf9f17278d7640c92dfb2458f2f | Create test_rules.py | sevenbigcat/wthen | tests/test_rules.py | tests/test_rules.py | import wthen
def test_rule_filter():
scope = {
'bb' : 3,
'cc' : 5,
'dd' : 6,
}
assert wthen.run_all('tests/rules_filter.yaml', scope) == True
def test_rule_action():
scope = {
'bb' : 3,
'cc' : 5,
'dd' : 6,
}
assert wthen.run_all('tests/rules_... | mit | Python | |
190153d06864b64275fbd515c2f1a2b8c8a5cdba | Add test to ensure sourceless specs are falsy | tawanda/django-imagekit,FundedByMe/django-imagekit,FundedByMe/django-imagekit,tawanda/django-imagekit | tests/test_specs.py | tests/test_specs.py | from imagekit.cachefiles import ImageCacheFile
from nose.tools import assert_false
from .imagegenerators import TestSpec
def test_no_source():
"""
Ensure sourceless specs are falsy.
"""
spec = TestSpec(source=None)
file = ImageCacheFile(spec)
assert_false(bool(file))
| bsd-3-clause | Python | |
17064d129888f207c94cee9b796a31bb93eff3b5 | Add custom minifying function | stev-0/bustimes.org.uk,stev-0/bustimes.org.uk,jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk,stev-0/bustimes.org.uk,jclgoodwin/bustimes.org.uk,stev-0/bustimes.org.uk,jclgoodwin/bustimes.org.uk,stev-0/bustimes.org.uk | buses/utils.py | buses/utils.py | import re
def minify(template_source):
return re.sub(r'(\n *)+', '\n', template_source)
| mpl-2.0 | Python | |
8dec010743b2de6efa351e6bd0245c8f1e46519b | Add UDP service example | facundovictor/non-blocking-socket-samples | connectionless_service.py | connectionless_service.py | """
A Simple example for testing the SimpleServer Class. A simple connectionless
server. It is for studying purposes only.
"""
from server import SimpleServer
__author__ = "Facundo Victor"
__license__ = "MIT"
__email__ = "facundovt@gmail.com"
def handle_message(sockets=None):
"""
Handle a simple UDP client... | mit | Python | |
c831bfb8e5e28fdcf0dff818dd08274fa2fdb5cd | Refactor of migration script for migrating invalid Guid objects | lyndsysimon/osf.io,binoculars/osf.io,doublebits/osf.io,rdhyee/osf.io,arpitar/osf.io,brandonPurvis/osf.io,abought/osf.io,erinspace/osf.io,chennan47/osf.io,felliott/osf.io,aaxelb/osf.io,Ghalko/osf.io,leb2dg/osf.io,cldershem/osf.io,mattclark/osf.io,SSJohns/osf.io,baylee-d/osf.io,cslzchen/osf.io,felliott/osf.io,zamattiac/o... | scripts/consistency/fix_tag_guids.py | scripts/consistency/fix_tag_guids.py | """Removes legacy Tag objects from the Guid namespace.
Tags were once GuidStoredObjects, but are no longer. The Guid table was not
cleaned of these references.
This caused a specific issue where "project" was a Tag id, and therefore was
resolveable to a Guid object, thereby breaking our routing system for URLs
beginn... | apache-2.0 | Python | |
f6ff767d9d9d717749e705975f48c4565e018376 | Add extract_unsourced_pageids. | eggpi/citationhunt,eggpi/citationhunt,guilherme-pg/citationhunt,guilherme-pg/citationhunt,guilherme-pg/citationhunt,eggpi/citationhunt,eggpi/citationhunt,guilherme-pg/citationhunt | scripts/extract_unsourced_pageids.py | scripts/extract_unsourced_pageids.py | #!/usr/bin/env python
import sys
import itertools
import collections
import multiprocessing
UNSOURCED_STMTS_CAT_ID = '9329647' # not really needed
UNSOURCED_STMTS_CAT_NAME = 'All articles with unsourced statements'
UNSOURCED_STMTS_CAT_NAME_ = UNSOURCED_STMTS_CAT_NAME.replace(' ', '_')
def sql_val_parser(values):
... | mit | Python | |
b4e119fccf5eb5df44fe02347808ad72732308e9 | Test basic read/load and save from ctd.py. | ocefpaf/python-ctd,pyoceans/python-ctd | test/test_ctd.py | test/test_ctd.py | # -*- coding: utf-8 -*-
#
# test_ctd.py
#
# purpose: Test basic read/load and save from ctd.py
# author: Filipe P. A. Fernandes
# e-mail: ocefpaf@gmail
# web: http://ocefpaf.tiddlyspot.com/
# created: 01-Mar-2013
# modified: Sat 20 Jul 2013 05:02:14 PM BRT
#
# obs: TODO: to_nc test.
#
import bz2
import gzip... | bsd-3-clause | Python | |
5482ab85d73191e86265ac4a27a11055b280dc9f | add tests? | Ayase-252/auto-anime-downloader | test/test_net.py | test/test_net.py | """
Tests for Net interface module
It requires requests-mock
"""
import unittest
import os
import requests_mock
import net
requests_mock.Mocker.TEST_PREFIX = 'test_'
@requests_mock.Mocker()
class NetInterfaceTests(unittest.TestCase):
def test_make_get_request(self, mocker):
mocker.register_uri('GET', ... | mit | Python | |
b24d8352c01d9196fba826f7b0a1335457e2df4c | add missed file | emory-libraries/eulcore-history,emory-libraries/eulcore-history | test/testcore.py | test/testcore.py | import unittest
def main(testRunner=unittest.TextTestRunner, *args, **kwargs):
try:
import xmlrunner
testRunner = xmlrunner.XMLTestRunner(output='test-results')
except ImportError:
pass
unittest.main(testRunner=testRunner, *args, **kwargs)
| apache-2.0 | Python | |
efc21569590e90bddaf9d06ea3747f3dd3476253 | Create a new util function that computes precision for floating-point quantization. | google-research/google-research,google-research/google-research,google-research/google-research,google-research/google-research,google-research/google-research,google-research/google-research,google-research/google-research,google-research/google-research,google-research/google-research,google-research/google-research,... | aqt/utils/common.py | aqt/utils/common.py | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | apache-2.0 | Python | |
1cd6fcd1b1c0fc00cf02f0f83896a5e1dee2aa90 | add context manager for capturing stdout/stderr | lmtierney/watir-snake | tests/support.py | tests/support.py | import sys
from contextlib import contextmanager
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
@contextmanager
def captured_output():
new_out, new_err = StringIO(), StringIO()
old_out, old_err = sys.stdout, sys.stderr
try:
sys.stdout, sys.stderr = new_out,... | mit | Python | |
972d5a2fafc2133df6519530373b2c2d4ab66294 | Add example application | nitipit/appkit | example/quickstart.py | example/quickstart.py | from appkit.app import App
app = App()
@app.route('/$')
def root():
return '<a href="app:///greeting/hello/world/">Welcome</a>'
@app.route('/greeting/(.+)/(.+)/')
def greeting(text1, text2):
return text1 + ' ' + text2
app.run()
| mit | Python | |
4688b6f3262b1e80323df10774ef9dff357222d0 | add bytes to bytes | metaodi/ckanapi,xingyz/ckanapi,wardi/ckanapi,perceptron-XYZ/ckanapi,eawag-rdm/ckanapi,LaurentGoderre/ckanapi | ckanapi/cli/action.py | ckanapi/cli/action.py | """
implementation of the action cli command
"""
from ckanapi.cli.utils import compact_json, pretty_json
def action(ckan, arguments):
"""
call an action with KEY=VALUE args, yield the result
"""
action_args = {}
for kv in arguments['KEY=VALUE']:
key, p, value = kv.partition('=')
a... | """
implementation of the action cli command
"""
from ckanapi.cli.utils import compact_json, pretty_json
def action(ckan, arguments):
"""
call an action with KEY=VALUE args, yield the result
"""
action_args = {}
for kv in arguments['KEY=VALUE']:
key, p, value = kv.partition('=')
a... | mit | Python |
3209a38b795cb5519f92bbfc2651df5b69ba0f76 | Add a forgotten migration (to add 'ignore' as a decision choice) | mysociety/yournextmp-popit,datamade/yournextmp-popit,YoQuieroSaber/yournextrepresentative,neavouli/yournextrepresentative,DemocracyClub/yournextrepresentative,neavouli/yournextrepresentative,DemocracyClub/yournextrepresentative,mysociety/yournextrepresentative,YoQuieroSaber/yournextrepresentative,mysociety/yournextrepr... | moderation_queue/migrations/0008_add_ignore_to_decision_choices.py | moderation_queue/migrations/0008_add_ignore_to_decision_choices.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('moderation_queue', '0007_auto_20150303_1420'),
]
operations = [
migrations.AlterField(
model_name='queuedimage',... | agpl-3.0 | Python | |
0f52e5f962d9d2af6032babb799ace1600814ed3 | Create 0218_country_capital_character.py | boisvert42/npr-puzzle-python | 2018/0218_country_capital_character.py | 2018/0218_country_capital_character.py | #!/usr/bin/python
'''
NPR 2018-02-18
https://www.npr.org/2018/02/18/585772621/sunday-puzzle-end-rhymes
Take the start of the name of a country and the end of that country's capital.
Put the parts together, one after the other, and you'll get the last name of a
character in a very popular movie. It's a character ever... | cc0-1.0 | Python | |
1a052e832c0e813a50350fb96b564a6fca827045 | Create prime_digit_sums.py | py-in-the-sky/challenges,py-in-the-sky/challenges,py-in-the-sky/challenges | hackerrank/prime_digit_sums.py | hackerrank/prime_digit_sums.py | """
This solution was written after reading the editorial for:
https://www.hackerrank.com/contests/world-codesprint-8/challenges/prime-digit-sums
This dynamic-programming solution is reminiscent of my solution to the Google Code
Jam problem in welcome_to_code_jam.py.
CONCETPS
* Let S be a string that satisfies all t... | mit | Python | |
883707309447fa4edd47459b4f2d8e7d449afd41 | Remove Duplicates from Sorted Array II | MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode | array/80.py | array/80.py | class Solution:
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums:
return 0
length = len(nums)
pre = 0
cur = 1
flag = False #False 1连续 True 2连续
while cur < length:
i... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.