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 |
|---|---|---|---|---|---|---|---|---|
a03da2611de32a38ab5b505f85136a3a9c5345f3 | add ycm config | chxuan/easyrpc,chxuan/easyrpc,chxuan/easyrpc,chxuan/easyrpc | .ycm_extra_conf.py | .ycm_extra_conf.py | # This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# 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... | mit | Python | |
7ce57e27265d4ea7639aaf6f806b9312d17c5c5a | Create HR_pythonSwapCase.py | bluewitch/Code-Blue-Python | HR_pythonSwapCase.py | HR_pythonSwapCase.py | #pythonSwapCase.py
def swap_case(s):
return s.swapcase()
| mit | Python | |
104ce4eb41a8d1d8307618f619dbf5336af1056d | Add CVE plugin. | sk89q/Plumeria,sk89q/Plumeria,sk89q/Plumeria | plumeria/plugins/cve.py | plumeria/plugins/cve.py | import re
import urllib.parse
from plumeria.command import commands, CommandError
from plumeria.util import http
from plumeria.util.ratelimit import rate_limit
CVE_PATTERN = re.compile("^(CVE-\\d{4,5}-\d+)$", re.IGNORECASE)
@commands.register("cve", category="Search")
@rate_limit()
async def cve(message):
"""
... | mit | Python | |
ac7c5f51e270e48d3be9363a7c65b4b2f019c90c | Add tests for xkcd bot. | shubhamdhama/zulip,shubhamdhama/zulip,verma-varsha/zulip,punchagan/zulip,vabs22/zulip,shubhamdhama/zulip,vaidap/zulip,brockwhittaker/zulip,rishig/zulip,punchagan/zulip,synicalsyntax/zulip,hackerkid/zulip,brainwane/zulip,jrowan/zulip,amanharitsh123/zulip,punchagan/zulip,brainwane/zulip,rishig/zulip,synicalsyntax/zulip,r... | contrib_bots/bots/xkcd/test_xkcd.py | contrib_bots/bots/xkcd/test_xkcd.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
import mock
import os
import sys
our_dir = os.path.dirname(os.path.abspath(__file__))
# For dev setups, we can find the API in the repo itself.
if os.path.exists(os.path.join(our_dir, '..')):
sys.path.insert(0, '..... | apache-2.0 | Python | |
552e2381b25c9d3591e7b4bf4a4c5796744b15ba | Add demo configuration | makinacorpus/Geotrek,mabhub/Geotrek,mabhub/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,Anaethelion/Geotrek,camillemonchicourt/Geotrek,mabhub/Geotrek,camillemonchicourt/Geotrek,Anaethelion/Geotrek,camillemonchicourt/Geotrek,johan--/Geotrek,GeotrekCE/Geotrek-admin,johan--/Geotrek,GeotrekCE/Geotrek-admin,makinaco... | .salt/files/demo.py | .salt/files/demo.py | from .prod import *
LEAFLET_CONFIG['TILES'] = [
(gettext_noop('Scan'), 'http://{s}.livembtiles.makina-corpus.net/makina/OSMTopo/{z}/{x}/{y}.png', 'OSM Topo'),
(gettext_noop('Ortho'), 'https://{s}.tiles.mapbox.com/v3/makina-corpus.i3p1001l/{z}/{x}/{y}.png', '© MapBox Satellite'),
]
LEAFLET_CONFIG['SRID'] ... | bsd-2-clause | Python | |
4b4bfd8d1bfb5e6db7ac5d24be526f188ceb6e68 | add payout exceptions | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/payouts_dorado/exceptions.py | bluebottle/payouts_dorado/exceptions.py | class PayoutException(Exception):
def __init__(self, message, error_list=None):
self.message = message
self.error_list = error_list
def __str__(self):
return str(self.message)
def __unicode__(self):
return unicode(self.message)
| bsd-3-clause | Python | |
5908d941fc113ee02b7d5962f0209a528ab9ecb1 | Add cross-site css module | jaeyung1001/phishing_site_detection,mjkim610/phishing-detection | core/modules/uses_stylesheet_naver.py | core/modules/uses_stylesheet_naver.py | from bs4 import BeautifulSoup
"""
Sites that are in the Naver domain are already checked by is_masquerading. So no need to check url again
"""
def uses_stylesheet_naver(resp):
print('uses_stylesheet_naver')
answer = "U"
current_page = BeautifulSoup(resp.text, 'lxml')
stylesheets = current_page.find_al... | bsd-2-clause | Python | |
d217ee9c830a6cccb70155ceff44746b4e5215d6 | Add missing csv migration | mociepka/saleor,mociepka/saleor,mociepka/saleor | saleor/csv/migrations/0004_auto_20200604_0633.py | saleor/csv/migrations/0004_auto_20200604_0633.py | # Generated by Django 3.0.6 on 2020-06-04 11:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("csv", "0003_auto_20200520_0247"),
]
operations = [
migrations.AlterField(
model_name="exportevent",
name="type",
... | bsd-3-clause | Python | |
2b86b727cd701464969de5679d30f9bea38a08f3 | Create TheDescent.py | Flavoured/CodinGamePuzzles,Flavoured/CodinGamePuzzles | Easy/TheDescent/TheDescent.py | Easy/TheDescent/TheDescent.py | import sys
import math
while True:
tallest_index = -1
tallest_height = -1
for i in range(8):
mountain_h = int(input()) # represents the height of one mountain.
if(tallest_height != -1):
if(mountain_h > tallest_height):
tallest_index = i
tal... | unlicense | Python | |
2a01ffdbac602873615925e6f99fab801a324fef | Create minesweeper.py | vzabazarnikh/minesweeper | minesweeper.py | minesweeper.py | import tkinter
import random
def pol_param():
size = 50
a = 8
b = 8
n = 10
return [size, a, b, n]
def perevod(a, v, d):
f = a*v + d
return f
def sozd_bomb(a, b, n):
m = []
for x in range(n):
k = (random.randrange(a * b))
while k in m:
k... | mit | Python | |
280aa4c8db7b5580b73ab6980f10d21a6ef2d761 | Add an audio output using the pygame mixer. This abuses pygame to a fair extent, but works reasonably with large-ish buffer sizes. | 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/PyGameOutput.py | Sketches/JT/Jam/library/trunk/Kamaelia/Apps/Jam/Audio/PyGameOutput.py | import numpy
import Numeric
import pygame
import Axon
import time
class PyGameOutput(Axon.ThreadedComponent.threadedcomponent):
bufferSize = 1024
sampleRate = 44100
def __init__(self, **argd):
super(PyGameOutput, self).__init__(**argd)
pygame.mixer.init(self.sampleRate, -16, 1, self.bufferS... | apache-2.0 | Python | |
4433cadaa39dd84b922329c84a7e791d81cac7c6 | Add a very simple test that *must* always pass. * Useful for testing the newstyle API | Karthikeyan-kkk/ooni-probe,lordappsec/ooni-probe,Karthikeyan-kkk/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,kdmurray91/ooni-probe,juga0/ooni-probe,Karthikeyan-kkk/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,hackerberry/ooni-probe,0xPoly/ooni-probe,kdmurray91/ooni-pr... | nettests/simpletest.py | nettests/simpletest.py | from ooni import nettest
class SimpleTest(nettest.TestCase):
inputs = range(1,100)
optParameters = [['asset', 'a', None, 'Asset file'],
['controlserver', 'c', 'google.com', 'Specify the control server'],
['resume', 'r', 0, 'Resume at this index'],
[... | bsd-2-clause | Python | |
124c4f30455d0892608622ddd09a0e7d83c3e8da | Create xmltodict_implementation.py | minesh1291/Learning-Python | Useful-Libs/xmltodict_implementation.py | Useful-Libs/xmltodict_implementation.py | import xmltodict
with open('path/to/file.xml') as fd:
doc = xmltodict.parse(fd.read())
doc['mydocument']['@has'] # == u'an attribute'
doc['mydocument']['and']['many'] # == [u'elements', u'more elements']
doc['mydocument']['plus']['@a'] # == u'complex'
doc['mydocument']['plus']['#text'] # == u'ele... | apache-2.0 | Python | |
3971a15aea15e097fac00f680068b505cc9047b8 | Add new descend functionality. | JohnReid/pyseqan,JohnReid/pyseqan,JohnReid/pyseqan,JohnReid/pyseqan | python/seqan/descend.py | python/seqan/descend.py | #
# Copyright John Reid 2014
#
"""
Code to descend indexes with top-down and top-down-history iterators.
"""
def depthpredicate(maxdepth):
"""Create a predicate that only descends the tree to a maximum depth.
"""
def predicate(it):
return it.repLength < maxdepth
return predicate
def suffixp... | mit | Python | |
1e6956fb793e12b720b521feb4c0eeabaf490cea | add cache.py to cleanup cache | owenwater/alfred-forvo | cache.py | cache.py | #!/usr/bin/python
import os
import time
from workflow import Workflow
AGE = 3600 * 24
LOG = None
class Cache(object):
def __init__(self):
global LOG
self.wf = Workflow()
LOG = self.wf.logger
self.cachedir = self.wf.cachedir
self.wf.cached_data_age = self.cached_data_age
... | mit | Python | |
25e09e4dbbc6dbc87c3b1cc2833021a9ae022a0e | Create compact/struct.py for python2/3 compatibility | hgrecco/pyvisa,MatthieuDartiailh/pyvisa,pyvisa/pyvisa | pyvisa/compat/struct.py | pyvisa/compat/struct.py | # -*- coding: utf-8 -*-
"""
pyvisa.compat.struct
~~~~~~~~~~~~~~~~~~~~~~~~~
Python 2/3 compatibility for struct module
:copyright: 2015, PSF
:license: PSF License
"""
from __future__ import division, unicode_literals, print_function, absolute_import
import sys
import struct
# we always want the ... | mit | Python | |
ef8bc0ddffa142e8580606377bff1d2737365711 | add various utilities in dog.util | slice/dogbot,sliceofcode/dogbot,slice/dogbot,slice/dogbot,sliceofcode/dogbot | dog/util.py | dog/util.py | import discord
def make_profile_embed(member):
embed = discord.Embed()
embed.set_author(name=f'{member.name}#{member.discriminator}',
icon_url=member.avatar_url)
return embed
def american_datetime(datetime):
return datetime.strftime('%m/%d/%Y %I:%M:%S %p')
def pretty_timedelta... | mit | Python | |
976eda9cbbce4a4fad759c4197b630209dd5a2bd | add programmer wrapper script | authmillenon/RIOT,kaspar030/RIOT,kYc0o/RIOT,jasonatran/RIOT,OTAkeys/RIOT,ant9000/RIOT,OTAkeys/RIOT,OlegHahm/RIOT,RIOT-OS/RIOT,miri64/RIOT,ant9000/RIOT,authmillenon/RIOT,RIOT-OS/RIOT,authmillenon/RIOT,kYc0o/RIOT,kaspar030/RIOT,kaspar030/RIOT,kaspar030/RIOT,RIOT-OS/RIOT,authmillenon/RIOT,OlegHahm/RIOT,jasonatran/RIOT,kYc... | dist/tools/programmer/programmer.py | dist/tools/programmer/programmer.py | #!/usr/bin/env python3
# Copyright (C) 2021 Inria
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import sys
import time
import shlex
import subprocess
import argparse
from contextlib import cont... | lgpl-2.1 | Python | |
d9c197840282c6bdedf5e001a1092aa707ae139c | update email field length | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/data_analytics/migrations/0008_auto_20161114_1903.py | corehq/apps/data_analytics/migrations/0008_auto_20161114_1903.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2016-11-14 19:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('data_analytics', '0007_auto_20160819_1423'),
]
operations = [
migrations.Al... | bsd-3-clause | Python | |
0c2f730ad2e4db7f53b2a867711e00048428d82d | add rest api | knodir/son-emu,knodir/son-emu,knodir/son-emu,knodir/son-emu | src/emuvim/examples/simple_topology_restapi.py | src/emuvim/examples/simple_topology_restapi.py | """
This is an example topology for the distributed cloud emulator (dcemulator).
(c) 2015 by Manuel Peuster <manuel.peuster@upb.de>
This is an example that shows how a user of the emulation tool can
define network topologies with multiple emulated cloud data centers.
The definition is done with a Python API which lo... | apache-2.0 | Python | |
8ccf3d937d25ec93d1ce22d60735ffbcaf776fe3 | Add a script for plotting distance to target. | lmjohns3/cube-experiment,lmjohns3/cube-experiment,lmjohns3/cube-experiment | analysis/plot-target-distance.py | analysis/plot-target-distance.py | import climate
import itertools
import lmj.plot
import numpy as np
import source as experiment
import plots
@climate.annotate(
root='plot data from this experiment subjects',
pattern=('plot data from files matching this pattern', 'option'),
markers=('plot data for these mocap markers', 'option'),
tar... | mit | Python | |
d8c18d9244ca09e942af57d74a407498c25d05ce | Add Linear Discriminant Analaysis. | prasanna08/MachineLearning | LDA.py | LDA.py | import numpy as np
from scipy import linalg as LA
class LDA(object):
def __init__(self, data_inputs, data_labels):
self.data_inputs = np.array(data_inputs)
self.data_labels = data_labels
self.test_cases = self.data_inputs.shape[0]
self.labels = np.unique(data_labels)
self.Sw = np.zeros((self.data_inputs.sha... | mit | Python | |
3cc1bceaca2fe74d3d9f9fa846f976ba99cc7dee | Create RDF.py | Shirui816/FTinMS | RDF.py | RDF.py | from sys import argv
import pandas as pd
import numpy as np
from functions import crdf
import time
import accelerate as acc
import matplotlib
from matplotlib import pyplot as plt
fn = argv[1]
print('Box origin must be at the center!')
pos = pd.read_csv(fn, delim_whitespace=True, squeeze=1, header=None).values
import ti... | bsd-3-clause | Python | |
10dbbe5b10abf954ab912fc3a2cdfe1532bf71cf | test file added | clemense/cortex-py | cortex-py/test/test_cortex.py | cortex-py/test/test_cortex.py | import time
import cortex
class MyDataHandler:
def __init__(self):
self.alldata = []
def MyErrorHandler(self, iLevel, msg):
print("ERROR: ")
print(iLevel, msg.contents)
return 0
def MyDataHandler(self, Frame):
print("got called")
try:
... | mit | Python | |
8b257c2a4b8f949f81965b7ffaa80d18c48974a4 | add app framework | aaronsamuel137/whats-up,aaronsamuel137/whats-up | app.py | app.py | import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
application = tornado.web.Application([
(r"/", MainHandler),
])
if __name__ == "__main__":
application.listen(8888)
tornado.ioloop.IOLoop.instance().start()
| mit | Python | |
e258b608c40b2abca30fbc85601e05c48558fff9 | add weird migration | Fisiu/calendar-oswiecim,hackerspace-silesia/calendar-oswiecim,Fisiu/calendar-oswiecim,firemark/calendar-oswiecim,Fisiu/calendar-oswiecim,hackerspace-silesia/calendar-oswiecim,firemark/calendar-oswiecim,firemark/calendar-oswiecim,hackerspace-silesia/calendar-oswiecim | webapp/calendars/migrations/0023_auto_20160109_1307.py | webapp/calendars/migrations/0023_auto_20160109_1307.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('calendars', '0022_auto_20151121_1628'),
]
operations = [
migrations.AlterModelOptions(
name='category',
... | agpl-3.0 | Python | |
7b15ad790631926030f8b0b6c32f214f2c8001b1 | Create __init__.py | cellnopt/cellnopt,cellnopt/cellnopt | cno/boolean/__init__.py | cno/boolean/__init__.py | bsd-2-clause | Python | ||
edf6e9ceacab9aa2d8795340089182ead07c30b3 | Add ipopt v3.12.4 package. | lgarren/spack,krafczyk/spack,matthiasdiener/spack,TheTimmy/spack,LLNL/spack,EmreAtes/spack,matthiasdiener/spack,krafczyk/spack,tmerrick1/spack,TheTimmy/spack,skosukhin/spack,lgarren/spack,lgarren/spack,LLNL/spack,EmreAtes/spack,EmreAtes/spack,tmerrick1/spack,mfherbst/spack,LLNL/spack,tmerrick1/spack,tmerrick1/spack,iul... | var/spack/repos/builtin/packages/ipopt/package.py | var/spack/repos/builtin/packages/ipopt/package.py | from spack import *
class Ipopt(Package):
"""Ipopt (Interior Point OPTimizer, pronounced eye-pea-Opt) is a
software package for large-scale nonlinear optimization."""
homepage = "https://projects.coin-or.org/Ipopt"
url = "http://www.coin-or.org/download/source/Ipopt/Ipopt-3.12.4.tgz"
versi... | lgpl-2.1 | Python | |
b69476c28ed3e67d77c93f8c1fc75fde0cb33f2a | Add WikiaSearch module | Didero/DideRobot | commands/WikiaSearch.py | commands/WikiaSearch.py | import requests
from CommandTemplate import CommandTemplate
from IrcMessage import IrcMessage
import Constants
class Command(CommandTemplate):
triggers = ['wikiasearch']
helptext = "Searches a wiki on Wikia.com. Usage: '{commandPrefix}wikiasearch [wiki-name] [search]'. Wiki names aren't case-sensitive, but searche... | mit | Python | |
533aeb6cdc045f7d4cbfc4bc20dd89da4179ab35 | Add application class to hold all the resources pertaining to an end-user application including RPC servers, HTTP servers etc. | supersaiyanmode/HomePiServer,supersaiyanmode/HomePiServer,supersaiyanmode/HomePiServer | app/core/services/application.py | app/core/services/application.py | from threading import RLock
from uuid import uuid4
from app.core.messaging import Sender
class Application(object):
APPLICATION_INFO_QUEUE = "/_system/applications"
def __init__(self):
self.unique_id = str(uuid4())
self.rpc_servers = {}
self.app_servers = {}
self.info_lock = ... | mit | Python | |
1df5619347b8f3e2a9fd49c95455e8b3aba07cf9 | Add example of desired new quick server usage | MuhammadAlkarouri/hug,giserh/hug,timothycrosley/hug,timothycrosley/hug,MuhammadAlkarouri/hug,MuhammadAlkarouri/hug,giserh/hug,timothycrosley/hug | examples/quick_server.py | examples/quick_server.py | import hug
@hug.get()
def quick():
return "Serving!"
if __name__ == '__main__':
__hug__.serve()
| mit | Python | |
ce1a080c01a5f792d128278fbb035f50e106e959 | set up general logging and twitter stream log | meyersj/geotweet,meyersj/geotweet,meyersj/geotweet | geotweet/log.py | geotweet/log.py | import logging
from logging.handlers import TimedRotatingFileHandler
import os
LOG_NAME = 'geotweet'
LOG_FILE = os.getenv('GEOTWEET_LOG', '/tmp/geotweet.log')
LOG_LEVEL = logging.DEBUG
TWITTER_LOG_NAME = 'twitter-stream'
def get_logger():
logger = logging.getLogger(LOG_NAME)
logger.setLevel(LOG_LEVEL)
f... | mit | Python | |
3b8d2cc0279e4da1ab758251f00fd065d951df53 | Add base for `help` command | 6180/foxybot | foxybot/commands/help.py | foxybot/commands/help.py | """Command to retrieve help for other commands and topics"""
from command import AbstractCommand, bot_command
from bot_help import HelpManager
@bot_command
class Help(AbstractCommand):
_aliases = ('help', 'h')
async def execute(self, shards, client, msg):
try:
args, extra = self._parser... | bsd-2-clause | Python | |
453df6abe7741fe0f24c03754b26c197fa282656 | Create ValidateBST_002_iter.py | Chasego/codi,Chasego/codi,Chasego/codirit,cc13ny/Allin,Chasego/codi,cc13ny/algo,Chasego/codi,cc13ny/Allin,Chasego/cod,Chasego/cod,Chasego/codirit,cc13ny/algo,cc13ny/Allin,cc13ny/Allin,cc13ny/algo,Chasego/codi,cc13ny/algo,Chasego/codirit,Chasego/cod,cc13ny/Allin,Chasego/cod,cc13ny/algo,Chasego/cod,Chasego/codirit,Chaseg... | leetcode/098-Validate-Binary-Search-Tree/ValidateBST_002_iter.py | leetcode/098-Validate-Binary-Search-Tree/ValidateBST_002_iter.py | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def isValidBST(self, root):
"""
:type root: TreeNode
:rtype: bool
"""
stack = [ro... | mit | Python | |
0e5bbc4df461c17ff7d1297ee4236afaa9e52a96 | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | leetcode/easy/remove_duplicates_from_sorted_array/py/solution.py | leetcode/easy/remove_duplicates_from_sorted_array/py/solution.py | class Solution(object):
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
# Without this check, the function
# will return slow + 1 when called
# with an empty array. This would
# be an error.
if len(n... | mit | Python | |
e8fa15603b275a690d96e37ab9dc560e68dedbb1 | Add tests | RomanKharin/lrmq | test/test_02.py | test/test_02.py | import unittest
import os
import sys
import lrmq
import timeout_decorator
import tempfile
import pickle
import struct
import asyncio
TEST_TIMEOUT = 5 # it can fail in slow environment
def read_log(fn):
logs = []
with open(fn, "rb") as f:
while True:
slen = f.read(4)
if not s... | mit | Python | |
011fd9f5414d9f824a2c120084b98a1dc34cba0f | Add github_stargazers.py | marius92mc/github-stargazers,marius92mc/github-stargazers | src/github_stargazers.py | src/github_stargazers.py | import typing
import os
from bs4 import BeautifulSoup
import click
from halo import Halo
import requests
class UsernameRepositoryError(Exception):
def __init__(self) -> None:
super().__init__("Argument should be of form username/repository.")
class GitHub:
"""Creates a GitHub instance for listing ... | mit | Python | |
74550ef0c76a941c473c8d024ccc0a0403631c49 | Add basic structure for "/glossary" routes test | zsloan/genenetwork2,zsloan/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,zsloan/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2 | wqflask/tests/integration/test_markdown_routes.py | wqflask/tests/integration/test_markdown_routes.py | "Integration tests for markdown routes"
import unittest
from bs4 import BeautifulSoup
from wqflask import app
class TestGenMenu(unittest.TestCase):
"""Tests for glossary"""
def setUp(self):
self.app = app.test_client()
def tearDown(self):
pass
def test_glossary_page(self):
... | agpl-3.0 | Python | |
5e1c48f9d00266290a8739f88085f050b1baa805 | Add test_backend.py in preparation for migrating backend to rigor's database layer | blindsightcorp/rigor-webapp,blindsightcorp/rigor-webapp,blindsightcorp/rigor-webapp | test_backend.py | test_backend.py | #!/usr/bin/env python
import types
import pprint
import backend
import config
from utils import *
DBNAME = config.CROWD_DB
debugMain('dbQueryDict')
sql = 'SELECT COUNT(*) FROM image;'
conn = backend.getDbConnection(DBNAME)
gen = backend.dbQueryDict(conn, sql)
assert isinstance(gen, types.GeneratorType)
rows = list... | bsd-2-clause | Python | |
986ff101ce224494a5cdb047a1aefd99c8a6d840 | Add an aioredis example | channelcat/sanic,yunstanford/sanic,ashleysommer/sanic,Tim-Erwin/sanic,lixxu/sanic,ashleysommer/sanic,ai0/sanic,yunstanford/sanic,r0fls/sanic,lixxu/sanic,Tim-Erwin/sanic,ai0/sanic,lixxu/sanic,jrocketfingers/sanic,jrocketfingers/sanic,yunstanford/sanic,channelcat/sanic,lixxu/sanic,yunstanford/sanic,r0fls/sanic,channelcat... | examples/sanic_aioredis_example.py | examples/sanic_aioredis_example.py | """ To run this example you need additional aioredis package
"""
from sanic import Sanic, response
import aioredis
app = Sanic(__name__)
@app.route("/")
async def handle(request):
async with request.app.redis_pool.get() as redis:
await redis.set('test-my-key', 'value')
val = await redis.get('test... | mit | Python | |
e355a926155355ccc5d8b545534f331bdb683f02 | Add management | wailashi/podcastsync,wailashi/podcastsync | podcastsync.py | podcastsync.py | import click
from getpass import getpass
from gposerver import create_app, db, User, Device, EpisodeAction
app = create_app()
@app.shell_context_processor
def make_shell_context():
return dict(app=app, db=db, User=User, Device=Device, EpisodeAction=EpisodeAction)
@app.cli.command()
def adduser():
"""Add new ... | mit | Python | |
1786ebacb85b2ddce816fb21b80285d991761695 | Implement classes to be used by the deserializer | hackebrot/poyo | poyo/_nodes.py | poyo/_nodes.py | # -*- coding: utf-8 -*-
class TreeElement(object):
"""Helper class to identify internal classes."""
def __init__(self, **kwargs):
pass
class ContainerMixin(object):
"""Mixin that can hold TreeElement instances.
Containers can be called to return a dict representation.
"""
def __init... | mit | Python | |
9f276fba97318431d85c08fc0718b30bf39ed1bf | Create add-one-row-to-tree.py | kamyu104/LeetCode,yiwen-luo/LeetCode,jaredkoontz/leetcode,kamyu104/LeetCode,jaredkoontz/leetcode,kamyu104/LeetCode,yiwen-luo/LeetCode,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-... | Python/add-one-row-to-tree.py | Python/add-one-row-to-tree.py | # Time: O(n)
# Space: O(h)
# Given the root of a binary tree, then value v and depth d,
# you need to add a row of nodes with value v at the given depth d. The root node is at depth 1.
#
# The adding rule is: given a positive integer depth d,
# for each NOT null tree nodes N in depth d-1, create two tree nodes
# with... | mit | Python | |
2e7e83a0c3b789a0d0ba89134b64a0f6b723c3af | add forgotten path-building test | INCF/pybids | bids/layout/tests/test_path_building.py | bids/layout/tests/test_path_building.py | import pytest
from bids.layout import BIDSLayout
from os.path import join, abspath, sep
from bids.tests import get_test_data_path
@pytest.fixture(scope='module')
def layout():
data_dir = join(get_test_data_path(), '7t_trt')
return BIDSLayout(data_dir)
def test_bold_construction(layout):
ents = dict(subje... | mit | Python | |
b447711c4396c36bc845184961d28660735c6f3d | Create window.py | mpjoseca/ate | src/new/window.py | src/new/window.py | # window draws
# editor window
class EditorWindow(Fl_Double_Window) :
search = ""
def __init__(self, w, h, label) :
Fl_Double_Window.__init__(self, w, h, label)
# set/update title
def set_title(win):
global filename, title
if len(filename) == 0:
title = "Untitled"
else:
title = os.path.basename(filename)
... | isc | Python | |
7ef6c8c3ea0e2481a424bcca91496ce14c0aec4a | add basic file verifier, just checks dimensions, need to add header and vlr checks. | blazbratanic/laspy,silyko/laspy,blazbratanic/laspy,silyko/laspy | misc/file_verify.py | misc/file_verify.py | #!/usr/bin/env python
import sys
sys.path.append("../")
from laspy import file as File
inFile1 = File.File(sys.argv[1],mode= "r")
inFile2 = File.File(sys.argv[2],mode= "r")
spec = inFile1.reader.point_format.lookup.keys()
def f(x):
return(list(inFile1.reader.get_dimension(x)) == list(inFile2.reader.get_dimension... | bsd-2-clause | Python | |
895571ec359e7571f8581f3635ae1c452ed911a5 | add a nova command | rajpushkar83/cloudmesh,rajpushkar83/cloudmesh,rajpushkar83/cloudmesh,rajpushkar83/cloudmesh,rajpushkar83/cloudmesh,rajpushkar83/cloudmesh,rajpushkar83/cloudmesh | cloudmesh_cmd3/plugins/cm_shell_nova.py | cloudmesh_cmd3/plugins/cm_shell_nova.py | from cmd3.shell import command
from cloudmesh_common.logger import LOGGER
import os
from cloudmesh_common.tables import row_table
log = LOGGER(__file__)
class cm_shell_nova:
"""opt_example class"""
def activate_cm_shell_nova(self):
self.register_command_topic('cloud','nova')
pass
@comm... | apache-2.0 | Python | |
2bf2a0849c1524f3ac56533d9f36eb907213f819 | Add WebAPI plugin | alama/PSO2Proxy,flyergo/PSO2Proxy,cyberkitsune/PSO2Proxy,alama/PSO2Proxy,alama/PSO2Proxy,cyberkitsune/PSO2Proxy,cyberkitsune/PSO2Proxy,flyergo/PSO2Proxy | proxy/plugins/WebAPI.py | proxy/plugins/WebAPI.py | from ..data import clients, blocks, players
from twisted.web.server import Site
from twisted.web.resource import Resource
import json, time
upStart = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime())
class WebAPI(Resource):
def render_GET(self, request):
currData = {'count' : len(clients.connectedClients... | agpl-3.0 | Python | |
19348f5d8e2832fbf378578d38516df66dc849b6 | Implement IRCv3.1 StartTLS | Heufneutje/PyHeufyBot,Heufneutje/PyHeufyBot | heufybot/modules/ircv3/starttls.py | heufybot/modules/ircv3/starttls.py | from twisted.internet.interfaces import ISSLTransport
from twisted.plugin import IPlugin
from heufybot.moduleinterface import BotModule, IBotModule
from zope.interface import implements
try:
from twisted.internet import ssl
except ImportError:
ssl = None
class IRCv3StartTLS(BotModule):
implements(IPlugin... | mit | Python | |
63e14ae4485bcca682b952e5ab7f125f58c3d960 | Add pwnypack ipython extension. | edibledinos/pwnypack,edibledinos/pwnypack | pwnypack/ipython_ext.py | pwnypack/ipython_ext.py | import functools
import shlex
import pwny
import pwnypack.main
__all__ = []
def call_main_func(func_name, ipython, line):
pwnypack.main.main([func_name] + shlex.split(line))
def load_ipython_extension(ipython):
ipython.push(vars(pwny))
for f_name in pwnypack.main.MAIN_FUNCTIONS:
ipython.define... | mit | Python | |
7fbfca47b2b435a0aa4df8d39699831f752f351d | Add initial code for scraping standings data | jldbc/pybaseball | pybaseball/standings.py | pybaseball/standings.py | from bs4 import BeautifulSoup
import requests
import datetime
def get_soup(date):
#year, month, day = [today.strftime("%Y"), today.strftime("%m"), today.strftime("%d")]
#url = "http://www.baseball-reference.com/boxes?year={}&month={}&day={}".format(year, month, day)
year = date.strftime("%Y")
url = 'http://www.bas... | mit | Python | |
d187c51ccd9dc1676b6f16eddecee6dce752d668 | Make class test-class name more specific | RaoUmer/distarray,enthought/distarray,RaoUmer/distarray,enthought/distarray | distarray/tests/test_client.py | distarray/tests/test_client.py | import unittest
from IPython.parallel import Client
from distarray.client import DistArrayContext
class TestDistArrayContext(unittest.TestCase):
def setUp(self):
self.client = Client()
self.dv = self.client[:]
def test_create_DAC(self):
'''Can we create a plain vanilla context?'''
... | import unittest
from IPython.parallel import Client
from distarray.client import DistArrayContext
class TestClient(unittest.TestCase):
def setUp(self):
self.client = Client()
self.dv = self.client[:]
def testCreateDAC(self):
'''Can we create a plain vanilla context?'''
dac = ... | bsd-3-clause | Python |
b5d8b29a34a4675ad5de33511bfca486f648a134 | Create _source.py | Manazius/blacksmith-bot,Manazius/blacksmith-bot | static/_source.py | static/_source.py | # coding: utf-8
# BlackSmith general configuration file
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Jabber server to connect
SERVER = 'example.com'
# Connecting Port
PORT = 5222
# Jabber server`s connecting Host
HOST = 'example.com'
# Using TLS (True - to enable, False - to disable)
SECURE ... | apache-2.0 | Python | |
647f0c1409dcd22d69a79d21571d2c03f794a2a8 | Test iter and yield | zzz0072/Python_Exercises,zzz0072/Python_Exercises | 99_misc/iterator.py | 99_misc/iterator.py | #/usr/bin/env python
# Test yield generator
def my_double(arr):
for i in arr:
yield i * 2
for i in my_double(range(1, 10)):
print("{0} ".format(i)),
print("\n"),
# Text iteration
i = iter(my_double(range(10, 21)))
print i
for j in range (1, 10):
print("{0} ".format(i.next())),
| bsd-2-clause | Python | |
28944376472130d53a05f7473e7213c917207cd4 | Add model representing a listing | rlucioni/craigbot,rlucioni/craigbot,rlucioni/apartments | apartments/models.py | apartments/models.py | from sqlalchemy import create_engine, Column, DateTime, Float, Integer, String
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Listing(Base):
__tablename__ = 'listings'
id = Column(Integer, primary_key=True)
craigslist_id = Column(Integer, unique=True)
name =... | mit | Python | |
38cbc73f70a9ca896a29d7fa2e000388bbf40d88 | Add script to generate data from an experiment | NLeSC/cptm,NLeSC/cptm | DilipadTopicModelling/experiment_get_results.py | DilipadTopicModelling/experiment_get_results.py | import logging
import os
import pandas as pd
from CPTCorpus import CPTCorpus
from CPT_Gibbs import GibbsSampler
logger = logging.getLogger(__name__)
logging.basicConfig(format='%(levelname)s : %(message)s', level=logging.INFO)
# select experiment to get parameters from
nTopics = 100
start = 80
end = 199
alpha = 50.... | apache-2.0 | Python | |
656d94c0375f6a96cc3a9d4b3227d8f19afe3dea | Add lemon drop elevator model | WesleyAC/toybox,WesleyAC/toybox,WesleyAC/toybox,WesleyAC/toybox,WesleyAC/toybox | control/systems/main.py | control/systems/main.py | import numpy as np
Kt = 1.41/89.0
Kv = 5840.0/3.0
G = 10.0
J = 4.0*(2.54**2.0)/2.0 # 4 kg on a 1 inch pully
R = 12.0/89.0
A = np.asarray([[0, 1],
[0, -(Kt*Kv)/((G**2)*J*R)]])
B = np.asarray([[0],
[Kt/(G*J*R)]])
| mit | Python | |
2ca0d97649529dfc66486dc1d3e7fa1e37d8ee91 | add integration test for api analytics | cmu-delphi/delphi-epidata,cmu-delphi/delphi-epidata,cmu-delphi/delphi-epidata,cmu-delphi/delphi-epidata,cmu-delphi/delphi-epidata,cmu-delphi/delphi-epidata | integrations/test_api_analytics.py | integrations/test_api_analytics.py | """Integration tests for internal analytics."""
# standard library
import unittest
# third party
import mysql.connector
import requests
# use the local instance of the Epidata API
BASE_URL = 'http://delphi_web_epidata/epidata/api.php'
class ApiAnalyticsTests(unittest.TestCase):
"""Tests internal analytics not s... | mit | Python | |
8cc622db293816fc96bb7df0139b57a2b5a2eaef | add scanning of live IP addresses with ping sweep, multi threading | rudolfvavra/network,rudolfvavra/network,rudolfvavra/network,rudolfvavra/network,rudolfvavra/network,rudolfvavra/network,rudolfvavra/network,rudolfvavra/network,rudolfvavra/network,rudolfvavra/network,rudolfvavra/network | Scan_IpAdds_ping.py | Scan_IpAdds_ping.py | import os, platform, collections
import socket, subprocess,sys
import threading
from datetime import datetime
class myThread (threading.Thread):
def __init__(self,startLastOctet,endLastOctet):
threading.Thread.__init__(self)
self.startLastOctet = startLastOctet
self.endLastOctet = endLastOctet
def run(... | mit | Python | |
1489e896952f5a3ea498618f615c5fd133a297c7 | Add test cases for pricing API with DiscountModules | suutari/shoop,shawnadelic/shuup,shoopio/shoop,suutari-ai/shoop,hrayr-artunyan/shuup,shawnadelic/shuup,suutari-ai/shoop,suutari/shoop,akx/shoop,akx/shoop,shoopio/shoop,akx/shoop,shawnadelic/shuup,shoopio/shoop,suutari/shoop,suutari-ai/shoop,hrayr-artunyan/shuup,hrayr-artunyan/shuup | shoop_tests/core/test_pricing_discounts.py | shoop_tests/core/test_pricing_discounts.py | # This file is part of Shoop.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
import decimal
import pytest
from django.conf import settings
from shoop.apps.provides import over... | agpl-3.0 | Python | |
e670de6ecb7be3da56acf2976148574165cb69aa | Add missing test module | h5py/h5py,h5py/h5py,h5py/h5py | h5py/tests/test_utils.py | h5py/tests/test_utils.py | #+
#
# This file is part of h5py, a low-level Python interface to the HDF5 library.
#
# Copyright (C) 2008 Andrew Collette
# http://h5py.alfven.org
# License: BSD (See LICENSE.txt for full license)
#
# $Date$
#
#-
import sys
import numpy
from common import HDF5TestCase, api_18
from h5py import *
from h5py import... | bsd-3-clause | Python | |
3fd4244dbfd33bbf2fa369d81756e82b1cf1c467 | Clear out unaligned NLCD19 GWLF-E results | WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed | src/mmw/apps/modeling/migrations/0041_clear_nlcd2019_gwlfe_results.py | src/mmw/apps/modeling/migrations/0041_clear_nlcd2019_gwlfe_results.py | # Generated by Django 3.2.13 on 2022-10-17 13:47
from django.db import migrations
def clear_nlcd2019_gwlfe_results(apps, schema_editor):
"""
Clear the results for all scenarios belonging to GWLF-E projects made after
the release of 1.33.0, which had incorrectly aligned NLCD19 2019 on
2022-01-17:
... | apache-2.0 | Python | |
34046e290842108212d71f6cf2445d7015bf2423 | Create text.py | fnielsen/dasem,fnielsen/dasem | dasem/text.py | dasem/text.py | """text."""
from nltk import sent_tokenize, word_tokenize
def sentence_tokenize(text):
"""Tokenize a Danish text into sentence.
The model from NTLK trained on Danish is used.
Parameters
----------
text : str
The text to be tokenized.
Returns
-------
sentences : list of str... | apache-2.0 | Python | |
477de06a99fc4998ec15442e5fae9b919be53392 | Initialize P2_scheduledComicDownloader | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter15/PracticeProjects/P2_scheduledComicDownloader.py | books/AutomateTheBoringStuffWithPython/Chapter15/PracticeProjects/P2_scheduledComicDownloader.py | # Write a program that checks the websites of several web comics and automatically
# downloads the images if the comic was updated since the program’s last visit.
#
# Your operating system’s scheduler (Scheduled Tasks on Windows, launchd on OS X,
# and cron on Linux) can run your Python program once a day.
#
# The Pyth... | mit | Python | |
960f32fb9f1f34caf0d851a370786f39864c15b2 | add conoha/dns.py | yuuki0xff/conoha-cli | conoha/dns.py | conoha/dns.py |
from .api import API, CustomList
from . import error
__all__ = 'Domain DomainList Record RecordList'.split()
class DNSAPI(API):
def __init__(self, token, baseURIPrefix=None):
super().__init__(token, baseURIPrefix)
self._serviceType = 'dns'
def _getHeaders(self, h):
headers={
'Content-Type': 'application... | mit | Python | |
5dad4f0e2d9732d7ff4a0feebff332f005cabf01 | Remove foreign keys from deprecated `progress-edx-platform-extensions` (#1874) | edx-solutions/edx-platform,edx-solutions/edx-platform,edx-solutions/edx-platform,edx-solutions/edx-platform | common/djangoapps/database_fixups/migrations/0002_remove_foreign_keys_from_progress_extensions.py | common/djangoapps/database_fixups/migrations/0002_remove_foreign_keys_from_progress_extensions.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
"""
The `progress-edx-platform-extensions` has been deprecated in favor of `edx-completion`.
The requirement was removed in the commit linked as (1) below. However its migration (2) had not been reverted.
That migration u... | agpl-3.0 | Python | |
9eb35140a1790625c32773af6b8a2d76699e86c6 | Move MapEntityForm to mapentity (ref #129) | Anaethelion/django-mapentity,makinacorpus/django-mapentity,makinacorpus/django-mapentity,Anaethelion/django-mapentity,makinacorpus/django-mapentity,Anaethelion/django-mapentity | mapentity/forms.py | mapentity/forms.py | from django.utils.translation import ugettext_lazy as _
import floppyforms as forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Submit, Div, Button
from crispy_forms.bootstrap import FormActions
class MapEntityForm(forms.ModelForm):
pk = forms.Field(required=False, widget=f... | bsd-3-clause | Python | |
2a5012f0b74fa025bbc909fd8bfb10aec272d148 | Create pawn-brotherhood.py | aureooms/checkio | home/pawn-brotherhood.py | home/pawn-brotherhood.py | def safe_pawns ( pawns ) :
n = 0
for file , rank in pawns :
if rank < "2" : continue
if file > "a" :
first = chr( ord(file) - 1) + str( int(rank) - 1 )
if first in pawns :
n += 1
continu... | agpl-3.0 | Python | |
ef026ce3b4bf7fc50499ce5ecb688c02bbc77544 | Add outline for orbital maneuver class | RazerM/orbital | orbital/maneuver.py | orbital/maneuver.py | class Maneuver:
def __init__(self):
pass
@classmethod
def raise_apocenter_by(cls, delta, orbit):
pass
@classmethod
def change_apocenter_to(cls, apocenter, orbit):
pass
@classmethod
def lower_apocenter_by(cls, delta, orbit):
pass
@classmethod
def ra... | mit | Python | |
c191959db6b1a14d527ec41f910682fd017421ee | fix for handling spaces in sys.executable and in sut_path (issue 166) | fingeronthebutton/robotframework,suvarnaraju/robotframework,kyle1986/robortframe,dkentw/robotframework,yonglehou/robotframework,ChrisHirsch/robotframework,ChrisHirsch/robotframework,stasiek/robotframework,rwarren14/robotframework,eric-stanley/robotframework,jorik041/robotframework,fingeronthebutton/robotframework,kurtd... | doc/quickstart/testlibs/LoginLibrary.py | doc/quickstart/testlibs/LoginLibrary.py | import os
import sys
class LoginLibrary:
def __init__(self):
sut_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'..', 'sut', 'login.py')
self._command_prefix = '"%s" "%s" ' % (sys.executable, sut_path)
self._status = ''
def create_user... | import os
import sys
class LoginLibrary:
def __init__(self):
sut_path = os.path.join(os.path.dirname(__file__),
'..', 'sut', 'login.py')
self._command_prefix = '%s %s ' % (sys.executable, sut_path)
self._status = ''
def create_user(self, username, pass... | apache-2.0 | Python |
ede05f2196dc7e96df01176f20b39772ac26e1ae | add python/logviewer.py | chenshuo/recipes,chenshuo/recipes,chenshuo/recipes,chenshuo/recipes,chenshuo/recipes,chenshuo/recipes | python/logviewer.py | python/logviewer.py | #!/usr/bin/python3
import io, os, re, sys
from http import HTTPStatus, server
FILE = None
INDEX = """<!DOCTYPE html>
<meta charset="utf-8">
<title>Log Viewer</title>
<script>
var logBox = null;
var lastOffset = 0;
function initialize() {
logBox = document.getElementById('log');
lastOffset = 0;
update();
}
fun... | bsd-3-clause | Python | |
3cbb02ebb1ba195f373c4b9238a49c30039f821e | revert changes | matanco/lottosend-sdk,matanco/lottosend-sdk | python/lottosend.py | python/lottosend.py | import json
import urllib2
class LottosendSDK:
#= Imports
#= Contrusctor
def __init__(self):
self.token = ''
self.lottosend_api = ''
self.results_api = ''
self.auto_login_url = ''
# signup user in lottosend system
def signupViaApi(self,first_name, last_name, prefix, phone, email, address, country... | mit | Python | |
490af74a5b52d8014a8c3e13cfa6f015a4927cf4 | add a merge migration to ensure the two lead nodes don't cause a crash during a deploy | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/migrations/0021_merge_20181011_1153.py | accelerator/migrations/0021_merge_20181011_1153.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-10-11 15:53
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accelerator', '0020_criterion_verbose_names'),
('accelerator', '0020_remove_is_open_from_pro... | mit | Python | |
ba25fafa6b4572f1b7c8c7a901f5f7b75753c3c6 | Add Exercise 8.7. | jcrist/pydy,oliverlee/pydy,jcrist/pydy,Shekharrajak/pydy,jcrist/pydy,Shekharrajak/pydy,oliverlee/pydy,jcrist/pydy,skidzo/pydy,Shekharrajak/pydy,skidzo/pydy,Shekharrajak/pydy,skidzo/pydy,skidzo/pydy,oliverlee/pydy,jcrist/pydy,jcrist/pydy,jcrist/pydy | Kane1985/Chapter4/Ex8.7.py | Kane1985/Chapter4/Ex8.7.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 8.7 from Kane 1985.
"""
from __future__ import division
from collections import OrderedDict
from sympy import diff, solve, simplify, symbols
from sympy import pi, sin, cos
from sympy.physics.mechanics import ReferenceFrame, Point
from sympy.physics.mechanics im... | bsd-3-clause | Python | |
46cef615f9d10279ea4907a542a87e4af22b37cd | Add A* pathfinding algorithm to utilities. | Beskhue/enactive-agents,Beskhue/enactive-agents,Beskhue/enactive-agents | enactiveagents/utilities/pathfinding.py | enactiveagents/utilities/pathfinding.py | """
Module containing pathfinding utilities.
"""
import model
import Queue
class Pathfinding(object):
@staticmethod
def get_neighbours(world, position):
"""
Get all neighbours of a given position (cell).
:param world: The world
:param position: The given position (cell)
... | mit | Python | |
0ba701bd4459273df726e33709ae0e441bd4a767 | migrate username field to 150 chars | nimbis/django-shop,divio/django-shop,nimbis/django-shop,khchine5/django-shop,jrief/django-shop,awesto/django-shop,khchine5/django-shop,awesto/django-shop,nimbis/django-shop,jrief/django-shop,divio/django-shop,jrief/django-shop,jrief/django-shop,khchine5/django-shop,khchine5/django-shop,divio/django-shop,nimbis/django-s... | email_auth/migrations/0003_django110.py | email_auth/migrations/0003_django110.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-27 09:08
from __future__ import unicode_literals
from django import VERSION
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('email_auth', '0002_auto_20160327_1119'),
]
operations = ... | bsd-3-clause | Python | |
ccb3d15521c89c52119e2df35c07d379b4f23940 | Add tkinter app | HackBinghamton/club,HackBinghamton/club,HackBinghamton/club | demo/tkinter/hello-tkinter.py | demo/tkinter/hello-tkinter.py | import tkinter as tk
class App(tk.Frame):
'''
A demo application.
The App is a subclass of tk.Frame.
tk.Frame is a widget that lets you 'pack in' other widgets.
This way we can add in more than one widget to our application.
'''
def __init__(self, parent=None):
self.parent = parent... | mit | Python | |
2cb7e09df0a8ec6fda707cccd1e9f8f00e15083c | Adjust the sorting of restaurants. | clementlefevre/hunger-game,clementlefevre/hunger-game,clementlefevre/hunger-game | migrations/versions/9ef49beab95_.py | migrations/versions/9ef49beab95_.py | """empty message
Revision ID: 9ef49beab95
Revises: 4b7b5a7ddc5c
Create Date: 2016-02-07 15:00:45.614000
"""
# revision identifiers, used by Alembic.
revision = '9ef49beab95'
down_revision = '4b7b5a7ddc5c'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - pl... | mit | Python | |
ed20a93e917cfdddc5cd49cc6446b6e80fb4573d | Migrate symbtr uuid field to django type | MTG/dunya,MTG/dunya,MTG/dunya,MTG/dunya | makam/migrations/0007_auto_20150812_1615.py | makam/migrations/0007_auto_20150812_1615.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('makam', '0006_auto_20150727_1631'),
]
operations = [
migrations.AlterField(
m... | agpl-3.0 | Python | |
e142530eef5754d4314d97f0d9e144f348d3909a | add docs_create_missing_stubs | madmongo1/hunter,ErniBrown/hunter,Knitschi/hunter,ruslo/hunter,mchiasson/hunter,dvirtz/hunter,tatraian/hunter,mchiasson/hunter,isaachier/hunter,dmpriso/hunter,fwinnen/hunter,dvirtz/hunter,dan-42/hunter,fwinnen/hunter,vdsrd/hunter,xsacha/hunter,akalsi87/hunter,ingenue/hunter,dan-42/hunter,ikliashchou/hunter,ErniBrown/hu... | maintenance/docs_create_missing_stubs.py | maintenance/docs_create_missing_stubs.py | import os
import subprocess
# hardcoded paths
HUNTER_DIR='..'
PACKAGES_DIR=os.path.join(HUNTER_DIR, 'cmake/projects')
DOCS_PKG_DIR=os.path.join(HUNTER_DIR, 'docs', 'packages', 'pkg')
# get all wiki entries
docs_filenames = [x for x in os.listdir(DOCS_PKG_DIR) if x.endswith('.rst')]
docs_entries = [x[:-4] for x in doc... | bsd-2-clause | Python | |
52c50ca6e4c5d2ee75300617c5da118fb1136e76 | Add custom plot style contour_image. | matthewwardrop/python-mplstyles,matthewwardrop/python-mplkit,matthewwardrop/python-mplstyles,matthewwardrop/python-mplkit | mplstyles/plots.py | mplstyles/plots.py | from matplotlib import cm
import matplotlib.pyplot as plt
from mplstyles import cmap as colormap
import numpy as np
def contour_image(x,y,Z,cmap=None,vmax=None,vmin=None,interpolation='nearest',contour_labelsize=9,contour_opts={},imshow_opts={},clegendlabels=[],label=False):
ax = plt.gca()
x_delta = float((x[-1]-x... | mit | Python | |
a3e06625c1e16a17c65aefc6bb570d769ec9f56a | Test for bot_update.py. | eunchong/build,eunchong/build,eunchong/build,eunchong/build | tests/bot_update_test.py | tests/bot_update_test.py | #!/usr/bin/env python
# Copyright 2014 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.
import imp
import json
import os
from subprocess import Popen, PIPE
import sys
import tempfile
import threading
import unittest
BUILD_... | bsd-3-clause | Python | |
e2a0a27e853e1e8c8913e9851d2a7aa0fb18b3ee | add exception test | benoitc/restkit,openprocurement/restkit | tests/exceptions_test.py | tests/exceptions_test.py | # -*- coding: utf-8 -
#
# Copyright (c) 2008 (c) Benoit Chesneau <benoitc@e-engura.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE... | mit | Python | |
9231511307631ad92b896941607c4e5f3c7704ce | Create new script for attaching and releasing the gripper's compressor glove. | thomasweng15/cs473-baxter-project | cs473_baxter/scripts/glove.py | cs473_baxter/scripts/glove.py | #!/usr/bin/env python
import argparse
import rospy
import baxter_interface
class Glove():
def __init__(self, gripper):
self.gripper = Gripper(gripper)
# Verify robot is enabled
print "Getting robot state..."
self._rs = baxter_interface.RobotEnable()
self._init_state = self._rs.state().enabled
print "E... | mit | Python | |
bc2a707ea12716612422959b107b72c84d9dc946 | add test for dump_table_to_json() | wdiv-scrapers/dc-base-scrapers | tests/test_dump_table.py | tests/test_dump_table.py | import scraperwiki
import unittest
from dc_base_scrapers.common import dump_table_to_json
class DumpTableTests(unittest.TestCase):
def test_dump_table(self):
# create tables with same columns in different order
scraperwiki.sqlite.execute("""CREATE TABLE foo (
b TEXT,
a INT... | mit | Python | |
5207d3c91d64170d783388a064334e495b3b562c | Add a new test for the latest RegexLexer change, multiple new states including '#pop'. | nsfmc/pygments,nsfmc/pygments,Khan/pygments,dbrgn/pygments-mirror,kirbyfan64/pygments-unofficial,nsfmc/pygments,dbrgn/pygments-mirror,kirbyfan64/pygments-unofficial,dbrgn/pygments-mirror,kirbyfan64/pygments-unofficial,nsfmc/pygments,Khan/pygments,kirbyfan64/pygments-unofficial,kirbyfan64/pygments-unofficial,kirbyfan64/... | tests/test_regexlexer.py | tests/test_regexlexer.py | # -*- coding: utf-8 -*-
"""
Pygments regex lexer tests
~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: 2007 by Georg Brandl.
:license: BSD, see LICENSE for more details.
"""
import unittest
from pygments.token import Text
from pygments.lexer import RegexLexer
class TestLexer(RegexLexer):
"""Test tuple st... | bsd-2-clause | Python | |
68afd4f71e1448017a7ed4775d7e70a26ff7c91b | add tests for new validation logic | fabianvf/scrapi,felliott/scrapi,erinspace/scrapi,jeffreyliu3230/scrapi,fabianvf/scrapi,alexgarciac/scrapi,mehanig/scrapi,CenterForOpenScience/scrapi,mehanig/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,felliott/scrapi | tests/test_validation.py | tests/test_validation.py | from __future__ import unicode_literals
import copy
import pytest
from jsonschema.exceptions import ValidationError
from scrapi.linter import NormalizedDocument
class TestValidation(object):
def test_validate_with_clean(self):
expected = {
"description": "This is a test",
"con... | apache-2.0 | Python | |
9445433b54fcbd7f56617fff853b761107bc94cc | Test add | goibibo/git-pylint-commit-hook,sebdah/git-pylint-commit-hook,evanunderscore/git-pylint-commit-hook | a.py | a.py | """
Comment
"""
print "apa"
| apache-2.0 | Python | |
c1b34a71306af1c38f305981dc1d50135b2887d8 | add the missing new executor.py file | overcastcloud/trollius,overcastcloud/trollius,overcastcloud/trollius | asyncio/executor.py | asyncio/executor.py | from .log import logger
__all__ = (
'CancelledError', 'TimeoutError',
'FIRST_COMPLETED', 'FIRST_EXCEPTION', 'ALL_COMPLETED',
)
# Argument for default thread pool executor creation.
_MAX_WORKERS = 5
try:
import concurrent.futures
import concurrent.futures._base
except ImportError:
FIRST_COMPLE... | apache-2.0 | Python | |
fad65e68b3fcfa736ba5d6e62fbe0588100dc153 | Create gdax-myTrades-pagination.py | ccxt/ccxt,ccxt/ccxt,ccxt/ccxt,ccxt/ccxt,ccxt/ccxt | examples/py/gdax-myTrades-pagination.py | examples/py/gdax-myTrades-pagination.py | # -*- coding: utf-8 -*-
import os
import sys
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
'''
Example snippet to traverse GDAX / CoinBase Pro pagination.
Useful for reaching back more than 100 myTrades, the same works
for fetchClosedOrders
'''
... | mit | Python | |
6cc59b5ad1b70e0b303680d9e58c8d8158bec1e6 | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | hackerrank/algorithms/implementation/easy/sock_merchant/py/solution.py | hackerrank/algorithms/implementation/easy/sock_merchant/py/solution.py | #!/bin/python3
import sys
import collections
n = int(input().strip())
c = map(int, input().strip().split(' '))
pairCount = sum(count // 2 for count in collections.Counter(c).values())
print(pairCount)
| mit | Python | |
bb37514e110892a8a896b43173fa6288ec1685d4 | Add script to count the number of times a boolean key occurs and also optionally emit a new YAML file containing only results where the key matches True, False or None. | symbooglix/boogie-runner,symbooglix/boogie-runner | analysis/count_boolean_key.py | analysis/count_boolean_key.py | #!/usr/bin/env python
# vim: set sw=2 ts=2 softtabstop=2 expandtab:
import argparse
import os
import logging
import sys
import yaml
try:
# Try to use libyaml which is faster
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
# fall back on python implementation
from yaml import Loader, D... | bsd-3-clause | Python | |
bf01ea13c046d711939c1bb0aaedf9fbbc7c638d | Add initial systemd module | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/modules/systemd.py | salt/modules/systemd.py | '''
Provide the service module for systemd
'''
def __virtual__():
'''
Only work on systems which default to systemd
'''
if __grains__['os'] == 'Fedora' and __grains__['osrelease'] > 15:
return 'service'
return False
def start(name):
'''
Start the specified service with systemd
CLI Example:... | apache-2.0 | Python | |
b1738d70e3a90e7bf27c9eeccb25b09403b74f1a | Add transport factory | devicehive/devicehive-python | devicehive/transport.py | devicehive/transport.py | def init(name, data_format, data_format_options, handler, handler_options):
transport_class_name = '%sTransport' % name.title()
transport_module = __import__('devicehive.transports.%s_transport' % name,
fromlist=[transport_class_name])
return getattr(transport_module, trans... | apache-2.0 | Python | |
9ba1dd92919fb37862e6e94bf55cc25e7be3b009 | add co.py | iimianmian/pyscripts | co.py | co.py | #!/bin/env python3
import functools
def coroutine(f):
@functools.wraps(f)
def _coroutine(*args, **kwargs):
active_coroutine = f(*args, **kwargs)
next(active_coroutine)
return active_coroutine
return _coroutine
@coroutine
def simple_coroutine():
print('Setting up the coroutine')
... | apache-2.0 | Python | |
02844d3a2ed329a02afaaf8dc1ad07407768a68b | Create app.py | evanscottgray/slackwow | app.py | app.py | # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
from flask import Flask
from flask import request
import requests
app = Flask(__name__)
def get_allergies():
URL = 'http://saallergy.info/today'
HEADERS = {'accept': 'application/json'}
r = requests.get(URL, headers=HEADERS)
data =... | mit | Python | |
43d73b7bdc8b38b3e2e583a0321936ab80c0f4e0 | Add bot.py | porglezomp/PyDankReddit,powderblock/PyDankReddit,powderblock/DealWithItReddit | bot.py | bot.py | import praw
r = praw.Reddit('/u/powderblock Glasses Bot')
for post in r.get_subreddit('all').get_new(limit=5):
print(str(post.url))
| mit | Python | |
42389c93d11de00b50b08fcd1eca74fbe3941365 | Create banner-generator.py | coonsmatthew/name-generator | banner-generator.py | banner-generator.py | #!/usr/bin/python
#####################################################
# grabs a banner image from flaming text
# and saves it to the project directory as banner.png
#####################################################
import urllib
import random
word_file = "words.txt"
WORDS = open(word_file).read().splitlines()
... | mit | Python | |
45b789010409e4e2e2afc88cb776c8b70e7768ec | Add unit test for DakotaBase | csdms/dakota,csdms/dakota | dakota/tests/test_dakota_base.py | dakota/tests/test_dakota_base.py | #!/usr/bin/env python
#
# Tests for dakota.dakota_base module.
#
# Call with:
# $ nosetests -sv
#
# Mark Piper (mark.piper@colorado.edu)
import os
import filecmp
from nose.tools import *
from dakota.dakota_base import DakotaBase
# Fixtures -------------------------------------------------------------
def setup_mo... | mit | Python | |
debca45d27e414d09c4814bec14d49b22e166274 | Add tool to process familyname and style data. | dougfelt/nototools,anthrotype/nototools,googlefonts/nototools,googlei18n/nototools,googlei18n/nototools,anthrotype/nototools,dougfelt/nototools,dougfelt/nototools,moyogo/nototools,googlei18n/nototools,googlefonts/nototools,googlefonts/nototools,moyogo/nototools,googlefonts/nototools,moyogo/nototools,googlefonts/nototoo... | nototools/check_familyname_and_styles.py | nototools/check_familyname_and_styles.py | # Copyright 2016 Google 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 required by applicable law or a... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.