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 |
|---|---|---|---|---|---|---|---|---|
a02b2866a3bf6067a2ee7f6d194c52c0a4d4500e | Create welcome_email_daemon.py | rupertsmall/food_coop | welcome_email_daemon.py | welcome_email_daemon.py | #send new members a welcome email
from smtplib import SMTP as smtp
from time import sleep
def welcome_bot():
fp = open('busters','r')
np = open('welcomed','a')
for eachline in fp:
if not is_in(eachline.strip()):
send_welcome(eachline.strip())
np.write(eachline.strip()+'\n')
fp.close()
np.clos... | mit | Python | |
a892a389cfc94ebf72579ed6888c02463cdf7e6d | add moviepy - text_erscheinen_lassen_rechts2links.py | openscreencast/video_snippets,openscreencast/video_snippets | moviepy/text_erscheinen_lassen_rechts2links.py | moviepy/text_erscheinen_lassen_rechts2links.py | #!/usr/bin/env python
# Video mit Text erzeugen, Text von rechts nach links erscheinen lassen
# Einstellungen
text = 'Text' # Text
textgroesse = 150 # Textgroesse in Pixel
textfarbe_r = 0 # Textfarbe R
textfarbe_g = 0 # Textfarbe G
textfarbe_b = 0 # Textfarb... | cc0-1.0 | Python | |
5db0ef459f4b0f0d3903578ae89bef7d0de7bf98 | add terminal test file | fouric/lightning-cd | termtest.py | termtest.py | #!/usr/bin/python3
import termbox
t = termbox.Termbox()
t.clear()
width = t.width()
height = t.height()
cell_count = width * height
char = ord('a')
for c in range(1):
for i in range(26):
for y in range(height):
for x in range(width):
t.change_cell(x, y, char, termbox.WHITE, t... | mit | Python | |
3d8667d2bfd75fe076b15b171e5c942a2a358508 | add basic is_unitary tests | cjwfuller/quantum-circuits | test_gate.py | test_gate.py | import numpy as np
import unittest
import gate
class TestGate(unittest.TestCase):
def test_is_unitary(self):
qg = gate.QuantumGate(np.matrix('0 1; 1 0', np.complex_))
self.assertTrue(qg.is_unitary())
def test_is_not_unitary(self):
matrix = np.matrix('1 1; 1 0', np.complex_)
self.failUnlessRaises(Exception, ... | mit | Python | |
bf0a4ee5023cddd4072330e9a3e5a530aeea956e | test unit added | laxect/scale,laxect/scale | test_unit.py | test_unit.py | class test_output:
def run(self, queue):
while True:
item = queue.get()
print(item)
def mod_init():
return test_output()
| mit | Python | |
33e2f5a0a11d5474b7a9f1ad3989575831f448ee | Add initial version of 'testbuild.py'. Currently this tests compilation of the CRYENGINE repo in win_x86/profile mode. Installed VS versions are discovered by querying the registry. Settings are in the script itself in the USED_* variables (to be abstracted later). Support for additional platforms and configs will be a... | patsytau/ce_tools | testbuild.py | testbuild.py | import os
import platform
import subprocess
# Group these here for transparency and easy editing.
USED_REPOSITORY = 'CRYENGINE'
USED_TARGET = 'win_x86'
USED_CONFIG = 'Profile'
USED_BRANCH = 'release'
USED_VS_VERSION = '14.0'
TARGET_TO_SLN_TAG = {
'win_x86': 'Win32',
'win_x64': 'Win64'
}
def get_installed_v... | mit | Python | |
6764d0286f2386bef8ab5f627d061f45047956e9 | add logger | saltastro/timDIMM,saltastro/timDIMM,saltastro/timDIMM,saltastro/timDIMM | logger.py | logger.py | #!/usr/bin/env python
import logging
import os
from termcolor import colored
class ColorLog(object):
colormap = dict(
debug=dict(color='grey', attrs=['bold']),
info=dict(color='green'),
warn=dict(color='yellow', attrs=['bold']),
warning=dict(color='yellow', attrs=['bold']),
... | bsd-3-clause | Python | |
6a426523186180a345777b7af477c12473fd3aa0 | add human moderator actions to file | conversationai/conversationai-moderator-reddit,conversationai/conversationai-moderator-reddit,conversationai/conversationai-moderator-reddit,conversationai/conversationai-moderator-reddit | perspective_reddit_bot/check_mod_actions.py | perspective_reddit_bot/check_mod_actions.py | # Copyright 2018 Google LLC
#
# 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 agreed to in writing, s... | apache-2.0 | Python | |
9cd3e1183b78f561751a638cf4e863703ec080d6 | add load ini file config | eplaut/nagios-config,eplaut/nagios-config | load_config.py | load_config.py | #!/usr/bin/env python
"""
conf file example
[elk-server]
ip = elk.server.ip
kibana = check_http
elasticsearch = check_http!-p 9200
logstash-3333 = check_tcp!3333
logstash-3334 = check_tcp!3334
load = check_nrpe!check_load
"""
import os, sys
try:
from ConfigParser import ConfigParser
except ImportError:
from c... | apache-2.0 | Python | |
e559a0458d1e4b0ec578eb9bcfdcc992d439a35d | Add test cases for the backwards compatibility in #24 | mathcamp/flywheel,stevearc/flywheel,stevearc/flywheel,mathcamp/flywheel | tests/test_backwards.py | tests/test_backwards.py | """ Test backwards-compatible behavior """
import json
from flywheel import Field, Model
from flywheel.fields.types import TypeDefinition, DictType, STRING
from flywheel.tests import DynamoSystemTest
class JsonType(TypeDefinition):
""" Simple type that serializes to JSON """
data_type = json
ddb_data_t... | mit | Python | |
501c38ac9e8b9fbb35b64321e103a0dfe064e718 | Add a sequence module for optimizing gating | calebjordan/PyQLab,Plourde-Research-Lab/PyQLab,BBN-Q/PyQLab,rmcgurrin/PyQLab | QGL/BasicSequences/BlankingSweeps.py | QGL/BasicSequences/BlankingSweeps.py | """
Sequences for optimizing gating timing.
"""
from ..PulsePrimitives import *
from ..Compiler import compile_to_hardware
def sweep_gateDelay(qubit, sweepPts):
"""
Sweep the gate delay associated with a qubit channel using a simple Id, Id, X90, X90
seqeuence.
Parameters
---------
qubit : ... | apache-2.0 | Python | |
213d1e65ebd6d2f9249d26c7ac3690d6bc6cde24 | fix encoding | Geode/Geocoding,Geode/Geocoding,Geode/Geocoding | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "geode_geocoding.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| agpl-3.0 | Python | |
6107d7fe1db571367a20143fa38fc6bec3056d36 | Fix port for activity script | vmalloc/mailboxer,getslash/mailboxer,getslash/mailboxer,getslash/mailboxer,vmalloc/mailboxer,vmalloc/mailboxer | scripts/activity.py | scripts/activity.py | #!/usr/bin/env python
import argparse
import collections
import itertools
import os
import random
import sys
import time
from contextlib import contextmanager
import logbook
sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(__file__)), ".."))
from flask_app import app
from flask_app.smtp import smtpd_co... | #!/usr/bin/env python
import argparse
import collections
import itertools
import os
import random
import sys
import time
from contextlib import contextmanager
import logbook
sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(__file__)), ".."))
from flask_app import app
from flask_app.smtp import smtpd_co... | mit | Python |
df378f5c555f18ce48fb550ab07c85f779a31c60 | Add script to merge users with duplicate usernames | Nesiehr/osf.io,felliott/osf.io,CenterForOpenScience/osf.io,monikagrabowska/osf.io,chrisseto/osf.io,icereval/osf.io,laurenrevere/osf.io,caneruguz/osf.io,pattisdr/osf.io,CenterForOpenScience/osf.io,adlius/osf.io,brianjgeiger/osf.io,caneruguz/osf.io,sloria/osf.io,erinspace/osf.io,adlius/osf.io,mfraezz/osf.io,Johnetordoff/... | scripts/merge_duplicate_users.py | scripts/merge_duplicate_users.py | """Merge User records that have the same username. Run in order to make user collection
conform with the unique constraint on User.username.
"""
import sys
import logging
from modularodm import Q
from website.app import init_app
from website.models import User
from framework.mongo import database
from framework.trans... | apache-2.0 | Python | |
6c94617d8ea2b66bba6c33fdc9aa81c5161a53f8 | add yaml | chck/nlp,chck/nlp | marcov.py | marcov.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#twitterBot.py
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
#use python-twitter
import twitter
import MeCab
import random
import re
import yaml
_var = open("../API.yaml").read()
_yaml = yaml.load(_var)
api = twitter.Api(
consumer_key = _yaml["consumer_key0"],... | mit | Python | |
edbb41e1f897d5e0bab5460d971ffd5917e6d1e6 | add peer task | dmick/teuthology,robbat2/teuthology,ceph/teuthology,tchaikov/teuthology,yghannam/teuthology,zhouyuan/teuthology,tchaikov/teuthology,ceph/teuthology,dreamhost/teuthology,caibo2014/teuthology,t-miyamae/teuthology,ktdreyer/teuthology,dreamhost/teuthology,dmick/teuthology,michaelsevilla/teuthology,caibo2014/teuthology,ivot... | teuthology/task/peer.py | teuthology/task/peer.py | import logging
import ceph_manager
import json
from teuthology import misc as teuthology
log = logging.getLogger(__name__)
def rados(remote, cmd):
log.info("rados %s" % ' '.join(cmd))
pre = [
'LD_LIBRARY_PATH=/tmp/cephtest/binary/usr/local/lib',
'/tmp/cephtest/enable-coredump',
'/tmp... | mit | Python | |
9dcc635d0d5239928415ecab7a5ddb5387f98dea | add mail.py | T620/globe,T620/globe,T620/globe | globe/mail.py | globe/mail.py | from flask_mail import Message
from globe import app, mail
def send_email(subject, sender, recipients, text_body, html_body):
msg = Message(subject, sender=sender[0], recipients=recipients)
msg.body = text_body
msg.html = html_body
mail.send(msg)
| mit | Python | |
56ad587d21abe5251be5ce5fced8e42f1d89c2f4 | Create tutorial1.py | davidwilson826/empty-app | tutorial1.py | tutorial1.py | from ggame import App
myapp = App()
myapp.run()
| mit | Python | |
ef8ad297634d2153d5a1675d7bb60b963f8c6abd | Add wrapper | ryansb/cfn-wrapper-python | cfn_wrapper.py | cfn_wrapper.py | # MIT Licensed, Copyright (c) 2015 Ryan Scott Brown <sb@ryansb.com>
import json
import logging
import urllib2
logger = logging.getLogger()
logger.setLevel(logging.INFO)
"""
Event example
{
"Status": SUCCESS | FAILED,
"Reason: mandatory on failure
"PhysicalResourceId": string,
"StackId": event["StackI... | mit | Python | |
e62a705d464df21098123ada89d38c3e3fe8ca73 | Define a channel interface | Laeeth/zerorpc-python,joequant/zerorpc-python,lucius-feng/zerorpc-python,jiajie999/zerorpc-python,tempbottle/zerorpc-python,rainslytherin/zerorpc-python,faith0811/zerorpc-python,topbrightwen/zerorpc-python,virqin/zerorpc-python,winggynOnly/zerorpc-python,gmarceau/zerorpc-python,stdrickforce/zerorpc-python,bombela/zeror... | zerorpc/channel_base.py | zerorpc/channel_base.py | # -*- coding: utf-8 -*-
# Open Source Initiative OSI - The MIT License (MIT):Licensing
#
# The MIT License (MIT)
# Copyright (c) 2014 François-Xavier Bourlet (bombela@gmail.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "S... | mit | Python | |
10f7e5c8c1a2cdc84f706ccad041755b83c4953b | Create htmlsearch.py | nesbit/BerryStone | htmlsearch.py | htmlsearch.py | import glob
print glob.glob("*.html")
arr = glob.glob("*.html")
i=0
k=[]
ray =[]
while i < len(arr):
file = open(arr[i], "r")
#print file.read()
k.append(file.read())
i = i+1
print k
'''
Outputs:
print print glob.glob("*.html")
['source.html', 'so.html']
print k
['google.com', 'socorop.com']
'''
| mit | Python | |
46eb1c2d10316eae4d85b3d689307e32ed763d07 | add 6-17.py | gbjuno/coreprogramming | chapter6/6-17.py | chapter6/6-17.py | #!/usr/bin/env python
def myPop(myList):
if len(myList) == 0:
print "no more element to pop"
exit(1)
else:
result = myList[len(myList)-1]
myList.remove(result)
return result
def myPush(myList,element):
myList.append(element)
def main():
myList = []
for... | mit | Python | |
7faff0ae9ea4b8d72b42d1af992bb4c72cc745ff | test program to immediately connect and disconnect | darrenjs/wampcc,darrenjs/wampcc,darrenjs/wampcc,darrenjs/wampcc,darrenjs/wampcc | test/client_immediate_disconnect.py | test/client_immediate_disconnect.py | #!/usr/bin/env python
import socket
host = socket.gethostname() # Get local machine name
port = 55555 # Reserve a port for your service.
s = socket.socket()
s.connect((host, port))
s.send("x")
s.close
| mit | Python | |
5b6667de8b91232facec27bc11305513bb2ec3b3 | add demo tests for parameterization | bnx05/pytest-selenium | test_parameters.py | test_parameters.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
import time
from selenium import webdriver
browser = webdriver.Firefox()
email_addresses = ["invalid_email", "another_invalid_email@", "not_another_invalid_email@blah"]
passwords = ["weak_password", "generic_password", "shitty_password"]
@pytest.mark.para... | mit | Python | |
fe0acf649a8db08c0bafd00e76557e9b6020bc5a | Add example for spliting 2D variable from NetCDF | tsherwen/AC_tools,tsherwen/AC_tools | Scripts/netCDF_splitter2var_2D.py | Scripts/netCDF_splitter2var_2D.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from netCDF4 import Dataset
import numpy as np
import pylab as pl
import calendar
# add extra's for copied function...
import os, sys, argparse
import datetime
"""
Split off 2D variable from file with other variables
Notes
----
- based on software carpentary example.
htt... | mit | Python | |
4aecc9be1e2e8074a20606e65db3f9e6283eb8d3 | add utils | chhantyal/exchange,chhantyal/exchange,chhantyal/exchange | uhura/exchange/utils.py | uhura/exchange/utils.py | """
Utilities and helper functions
"""
def get_object_or_none(model, **kwargs):
try:
return model.objects.get(**kwargs)
except model.DoesNotExist:
return None | bsd-3-clause | Python | |
071aa9f5465847fdda517d1a78c37f1dbfe69f9f | test mock | kaiocesar/tdd-python | tests/mock_bank.py | tests/mock_bank.py | #!/usr/bin/python
# -*- encoding: utf-8 -*-
import sys
import os.path
sys.path.append(os.path.join(os.path.dirname(__file__),'..'))
from src.bank import Bank
from mock import MagicMock
thing = Bank()
| mit | Python | |
f3182c9651509d2e1009040601c23a78ed3e9b7c | Create laynger.py | amaslenn/Laynger | laynger.py | laynger.py | #import sublime
import sublime_plugin
class laynger(sublime_plugin.TextCommand):
def run(self, edit, opt='center'):
window = self.view.window()
layout = window.get_layout()
if len(layout['cols']) > 3:
return
if opt == u'center':
layout['cols'][1] = 0.5
... | mit | Python | |
7a64fb0c3093fd23eeed84799c1590a72f59a96c | Create boafiSettings.py | fnzv/Boafi,fnzv/Boafi,fnzv/Boafi | webGUI/boafiSettings.py | webGUI/boafiSettings.py | #!/usr/bin/python
import os,time,argparse
parser = argparse.ArgumentParser()
parser.add_argument('-intf', action='store', dest='intf',default="none",
help='Select interface')
parser.add_argument('-ip', action='store', dest='ip',default="none",
help='Use given ip address')
... | mit | Python | |
fdd2a50445d2f2cb92480f8f42c463b312411361 | Add a simple command to print all areas in all generations | Sinar/mapit,chris48s/mapit,chris48s/mapit,Code4SA/mapit,opencorato/mapit,New-Bamboo/mapit,Sinar/mapit,opencorato/mapit,New-Bamboo/mapit,chris48s/mapit,Code4SA/mapit,opencorato/mapit,Code4SA/mapit | mapit/management/commands/mapit_print_areas.py | mapit/management/commands/mapit_print_areas.py | # For each generation, show every area, grouped by type
from django.core.management.base import NoArgsCommand
from mapit.models import Area, Generation, Type, NameType, Country, CodeType
class Command(NoArgsCommand):
help = 'Show all areas by generation and area type'
def handle_noargs(self, **options):
... | agpl-3.0 | Python | |
9dee7d8d253847758d3252401c01215f972a22b1 | Add synthtool scripts (#3765) | googleapis/java-monitoring,googleapis/java-monitoring,googleapis/java-monitoring | google-cloud-monitoring/synth.py | google-cloud-monitoring/synth.py | # Copyright 2018 Google LLC
#
# 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 agreed to in writing, s... | apache-2.0 | Python | |
92f799d0584b598f368df44201446531dffd7d13 | Copy paste artist from filename1 to filename2 | daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various | python/utilities/transform_mp3_filenames.py | python/utilities/transform_mp3_filenames.py | # Extract the artist name from songs with filenames in this format:
# (number) - (artist) - (title).mp3
# and add the artists name to songs with filenames in this format:
# (number)..(title).mp3
# to make filenames in this format:
# (number)..(artist)..(title).mp3
#
# eg.: 14 - 13th Floor Elevators -... | mit | Python | |
ec0ee6ffc7b72ba50846bac60ec63e1188bf0481 | test parser | DylanGreene/Froogle-Search-Engine,DylanGreene/Froogle-Search-Engine,DylanGreene/Froogle-Search-Engine,DylanGreene/Froogle-Search-Engine | parser.py | parser.py | #!/usr/bin/python3
import requests
import sys
from bs4 import BeautifulSoup
#filters through text from soup and strips text of whitespace
def filterText(text):
if text.parent.name in ['style', 'script', '[document]', 'head', 'title']:
return False
if text in ['\n', ' ', '\r', '\t']:
return Fals... | mit | Python | |
c6afa2826d6b1ad425919c0b4bc64101d2d4a2d1 | add first file | dojobo/deepthought_web,wkerzendorf/deepthought_web,wkerzendorf/deepthought_web,dojobo/deepthought_web | deepthought_web.py | deepthought_web.py | import random
import string
import pickle
import cherrypy
import numpy as np
import pandas as pd
from scipy.sparse import csr_matrix
cherrypy.server.socket_host = '0.0.0.0'
cherrypy.config.update({'server.socket_port': 7071})
class DeepThought(object):
def __init__(self):
self.all_identifiers = pickle.load... | bsd-3-clause | Python | |
58e0ea4b555cf89ace4f5d97c579dbba905e7eeb | Add script to list objects | pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc | jsk_arc2017_common/scripts/list_objects.py | jsk_arc2017_common/scripts/list_objects.py | #!/usr/bin/env python
import os.path as osp
import rospkg
PKG_PATH = rospkg.RosPack().get_path('jsk_arc2017_common')
object_names = ['__background__']
with open(osp.join(PKG_PATH, 'data/names/objects.txt')) as f:
object_names += [x.strip() for x in f]
object_names.append('__shelf__')
for obj_id, obj in enumer... | bsd-3-clause | Python | |
04feafc2b3a13b394d5b510e9bc48e542d4880c5 | Create pfkill.py | vanzhiganov/pf | pfkill.py | pfkill.py | """
how to it use:
$ python pfkill <port number>
what doing:
1. read <port number>.pid file
2. send signal to running app
3. delete <port number>.rule
4. delete <port number>.pid
"""
import os
import sys
import signal
# import logging
port = sys.argv[1]
# read <port>.pid
pid = int(open("%s.pid" % port, 'r').read().... | apache-2.0 | Python | |
e988a10ea18b644b9bc319286d75cb2a15079c59 | add case owners endpoint | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/reports/v2/endpoints/case_owner.py | corehq/apps/reports/v2/endpoints/case_owner.py | from __future__ import absolute_import
from __future__ import unicode_literals
from corehq.apps.reports.filters.controllers import (
CaseListFilterOptionsController,
)
from corehq.apps.reports.v2.models import BaseOptionsEndpoint
class CaseOwnerEndpoint(BaseOptionsEndpoint):
slug = "case_owner"
@propert... | bsd-3-clause | Python | |
458091fe923038fe8537bf3b9efbff6157a7e57a | add tests for riakcached.clients.ThreadedRiakClient | brettlangdon/riakcached | riakcached/tests/test_threadedriakclient.py | riakcached/tests/test_threadedriakclient.py | import mock
import unittest2
from riakcached.clients import ThreadedRiakClient
import riakcached.pools
class TestThreadedRiakClient(unittest2.TestCase):
def test_get_many(self):
pool = mock.Mock(spec=riakcached.pools.Pool)
pool.request.return_value = 200, "result", {"content-type": "text/plain"}
... | mit | Python | |
1d388bf1a38eaaafa4d79287ce7aabb59f84e649 | Add initial img module | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/modules/img.py | salt/modules/img.py | '''
Virtual machine image management tools
'''
def mnt_image(location):
'''
Mount the named image and return the mount point
CLI Example::
salt '*' img.mount_image /tmp/foo
'''
if 'guestfs.mount' in __salt__:
return __salt__['guestfs.mount'](location)
elif 'qemu_nbd' in __salt... | apache-2.0 | Python | |
ae5407acd1fb93fe04747a10b7bda2fc1ec91790 | add smf module to support virtual service module on solaris 10+ | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/modules/smf.py | salt/modules/smf.py | '''
Service support for Solaris 10 and 11, should work with other systems
that use SMF also. (e.g. SmartOS)
'''
def __virtual__():
'''
Only work on systems which default to SMF
'''
# Don't let this work on Solaris 9 since SMF doesn't exist on it.
enable = [
'Solaris',
... | apache-2.0 | Python | |
a91a942c45921b64fe0d740d81604dba921c214e | Create folder for QC and CNV cutoff codes | suzannerohrback/somaticCNVpipeline,suzannerohrback/somaticCNVpipeline | bin/cutoffs/__init__.py | bin/cutoffs/__init__.py | mit | Python | ||
e40b92966762dfadff53355e9e38636a4769543f | Add intermediate tower 2 | arbylee/python-warrior | pythonwarrior/towers/intermediate/level_002.py | pythonwarrior/towers/intermediate/level_002.py | # ----
# |@s |
# | sS>|
# ----
level.description("Another large room, but with several enemies "
"blocking your way to the stairs.")
level.tip("Just like walking, you can attack_ and feel in multiple "
"directions ('forward', 'left', 'right', 'backward').")
level.clue("Call warrior.feel(... | mit | Python | |
71d66fb3bdbcb38d29accb6bdfbf4ac8b2996e89 | Add intermediate tower 3 | arbylee/python-warrior | pythonwarrior/towers/intermediate/level_003.py | pythonwarrior/towers/intermediate/level_003.py | # ---
# |>s |
# |s@s|
# | C |
# ---
level.description("You feel slime on all sides, you're surrounded!")
level.tip("Call warrior.bind_(direction) to bind an enemy to keep him "
"from attacking. Bound enemies look like captives.")
level.clue("Count the number of enemies around you. Bind an enemy if "
... | mit | Python | |
260cb76132bfe618b58cf34ad8dd61f59e847f90 | create table | techbureau/zaifbot,techbureau/zaifbot | zaifbot/models/nonce.py | zaifbot/models/nonce.py | from sqlalchemy import Column, Integer, String, DateTime
from datetime import datetime
from zaifbot.models import Base
class Nonce(Base):
__tablename__ = 'nonces'
id = Column(Integer, primary_key=True)
key = Column(String, nullable=False)
secret = Column(String, nullable=False)
nonce = Column(Inte... | mit | Python | |
a72567202e9b4024758706c00f016153ec04a53d | Create render.py | duboviy/pymolecule | render.py | render.py | #! /usr/bin/python3
from random import random
import pyglet
from pyglet.window import key, Window
from pyglet.gl import *
from pyglet.gl.glu import *
window = Window()
@window.event
def on_draw():
pass # TODO: implement!
@window.event
def on_resize(width, height):
pass # TODO: implement!
@window.event
d... | mit | Python | |
77dca533f2d2fe94b233bd48561e1ed887928265 | add sample.py | elliot79313/line-bot-without-bot-account | sample.py | sample.py | #-*- coding: UTF-8 -*-
# https://github.com/carpedm20/LINE
from line import LineClient, LineGroup, LineContact
f = open("credentials")
ID = f.readline().strip()
PASSWD = f.readline().strip()
f.close()
client = LineClient(ID, PASSWD, com_name="line_api_demo")
friends = client.contacts
for i, friend in enumerate(fri... | bsd-3-clause | Python | |
db195957288ef7b6c5c9de6551689d4d06db28c1 | Create add_digits.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | lintcode/naive/add_digits/py/add_digits.py | lintcode/naive/add_digits/py/add_digits.py | class Solution:
# @param {int} num a non-negative integer
# @return {int} one digit
def addDigits(self, num):
while len(str(num)) > 1:
num = sum(map(int, str(num)))
return num
| mit | Python | |
836845abde53ee55bca93f098ece78880ab6b5c6 | Use same variable names as testing environment | pombredanne/PyMISP,iglocska/PyMISP | examples/events/create_massive_dummy_events.py | examples/events/create_massive_dummy_events.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import url, key
import argparse
import tools
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Create a given number of event containing a given number of attributes eachh.')
parser.add_argument("-l", "--... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import misp_url, misp_key, misp_verifycert
import argparse
import tools
def init(url, key):
return PyMISP(url, key, misp_verifycert, 'json')
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Create a give... | bsd-2-clause | Python |
2d12c640e42e83580ee27933f0ad9bed2ebcc169 | add allauth and make owner of audio required | saanobhaai/apman,saanobhaai/apman | satsound/migrations/0007_auto_20170115_0331.py | satsound/migrations/0007_auto_20170115_0331.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-15 03:31
from __future__ import unicode_literals
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('satsound', '0006_auto_20161... | mit | Python | |
a635a8d58e46cf4ef1bc225f8824d73984971fee | Add the answer to the sixth question of Assignment 3 | SuyashD95/python-assignments | countVowels.py | countVowels.py | """ Q6- Write a program that counts up the number of vowels contained in the string s. Valid vowels are: 'a', 'e', 'i',
'o', and 'u'. For example, if s = 'azcbobobegghakl', your program should print: Number of vowels: 5
"""
# Using the isVowel function from isVowel.py module (Answer of fifth question of Assignment 3)
... | mit | Python | |
58fabd7929a4c712f5e87a39aaf8c34bae8759b8 | Add photos to the admin | blancltd/django-quick-photos,kmlebedev/mezzanine-instagram-quickphotos | quickphotos/admin.py | quickphotos/admin.py | from django.contrib import admin
from .models import Photo
@admin.register(Photo)
class PhotoAdmin(admin.ModelAdmin):
list_display = ('user', 'caption', 'created')
list_filter = ('created',)
date_hierarchy = 'created'
readonly_fields = (
'photo_id', 'user', 'image', 'created', 'caption', 'lin... | bsd-3-clause | Python | |
f7035a6c328bb237dd3c9be5d9da805606e059ae | Create adjust_xml_impath.py | grehujt/SmallPythonProjects,grehujt/SmallPythonProjects,grehujt/SmallPythonProjects | object_detection/adjust_xml_impath.py | object_detection/adjust_xml_impath.py | import os
import glob
import re
import argparse
ap = argparse.ArgumentParser()
ap.add_argument('-i', '--input_xml_dir', type=str, default='./annot', help='path to root dir of xmls')
ap.add_argument('-s', '--subfolder', type=str, default='images', help='name of image subfolder')
args = vars(ap.parse_args())
xmls = glo... | mit | Python | |
0266a6cec641f244a8788f50f80ac3f11f87e1e4 | Add back fix_root script | brianjgeiger/osf.io,CenterForOpenScience/osf.io,CenterForOpenScience/osf.io,mfraezz/osf.io,HalcyonChimera/osf.io,icereval/osf.io,laurenrevere/osf.io,binoculars/osf.io,laurenrevere/osf.io,CenterForOpenScience/osf.io,HalcyonChimera/osf.io,adlius/osf.io,mfraezz/osf.io,felliott/osf.io,CenterForOpenScience/osf.io,mfraezz/os... | scripts/fix_root.py | scripts/fix_root.py | import sys
import logging
from website.app import setup_django
setup_django()
from scripts import utils as script_utils
from osf.models import AbstractNode
from framework.database import paginated
logger = logging.getLogger(__name__)
def main(dry=True):
count = 0
for node in paginated(AbstractNode, increment=... | apache-2.0 | Python | |
ecc15e50967f61e9e8ba8a96d4b8f6855c77b401 | Create geoprocess_exposure.py | wfclark/hamlet,wfclark/hamlet | hurricane/geoprocess_exposure.py | hurricane/geoprocess_exposure.py | import sys
import os
import datetime
import psycopg2
import pandas
from subprocess import call, Popen
conn_string = "dbname='hamlethurricane' user=postgres port='5432' host='127.0.0.1' password='password'"
os.system("exit")
os.system("exit")
print "Connecting to database..."
try:
conn = psycopg2.connect(conn_strin... | bsd-3-clause | Python | |
ac3a3b583b028e53d80749eaaee58b4eb80d1c6a | Implement stack functionality | MikeDelaney/CodeEval | stack/stack.py | stack/stack.py |
class Node(object):
def __init__(self, value=None, next_node=None):
self.value = value
self.next_node = next_node
class Stack(object):
def __init__(self, head=None):
self.head = head
def push(self, data):
self.head = Node(data, self.head)
def pop(self):
if se... | mit | Python | |
a6137714c55ada55571759b851e1e4afa7818f29 | Add cli tool to delete documents. | kernelci/kernelci-backend,joyxu/kernelci-backend,kernelci/kernelci-backend,joyxu/kernelci-backend,joyxu/kernelci-backend | app/utils/scripts/delete-docs.py | app/utils/scripts/delete-docs.py | #!/usr/bin/python
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope t... | lgpl-2.1 | Python | |
c71a3f1adbf310c63ce9ab7611cf0e198ffe69da | Add load test | Calysto/metakernel | metakernel/magics/tests/test_load_magic.py | metakernel/magics/tests/test_load_magic.py |
from metakernel.tests.utils import get_kernel
def test_load_magic():
kernel = get_kernel()
ret = kernel.do_execute("%%load %s" % __file__)
assert 'def test_load_magic' in ret['payload'][0]['text']
| bsd-3-clause | Python | |
e575f343f55fd54994fdb1f4d02fe6e2e52ba056 | add phonetizer.py - really | bhallen/icelandic-transcriber | phonetizer.py | phonetizer.py | import re
class Phonetizer():
# Define shorthands for phonological classes
ph_classes = {
'C' : 'p|t|k|b|d|g',
'V' : 'a|e|i|o|u|y'
}
def __init__(self, mappings_filename):
with open(mappings_filename) as mfile:
self.read_mfile(mfile)
def read_mfile(self, mfile):
... | bsd-3-clause | Python | |
163da52a48eb0d84cde47f7cfe99e1188350db47 | Add MOBIB Basic reader script | bparmentier/mobib-reader | mobib_basic.py | mobib_basic.py | #!/bin/env python3
import sys
from smartcard.System import readers
CALYPSO_CLA = [0x94]
SELECT_INS = [0xA4]
READ_RECORD_INS = [0xB2]
GET_RESPONSE_INS = [0xC0]
TICKETING_COUNTERS_FILE_ID = [0x20, 0x69]
def main():
local_readers = readers()
if local_readers:
if len(local_readers) == 1:
re... | mit | Python | |
97531bdb1501748c7039d194e98408245dc5d2b2 | Make graphflow loading script | guoarthur/btc-viz,guoarthur/btc-viz,guoarthur/btc-viz,guoarthur/btc-viz | load-tx-to-graphflow.py | load-tx-to-graphflow.py | from constants import *
import csv
walletsMap={} #address -> number OR transaction_id->number
lastNumber = 0
with open(IN_TRANSACTION_CSV_LOCATION, 'rb') as tx_in_file:
in_reader = csv.reader(tx_in_file, delimiter=",")
for row in in_reader:
tx_hash = row[0]
wallet_addr = row[1]
tx_amt ... | apache-2.0 | Python | |
7f6aab7dc177dc1178eca30e0ba40874b217e7cf | Create *variable.py | joshavenue/python_notebook | *variable.py | *variable.py | def num(*nums): // One * takes in any number of single data type, in this case : Int
sum = 0
for x in nums:
sum += x
return sum
sum(22,33,44,55,66) // You can type as many numbers as you wish
def whatever(**kwargs): // Double ** take more than just a type of data, in t... | unlicense | Python | |
70da5f3657ee847f315b0d0dfbe5adb393c55ca6 | add system_info.py | simomarsili/ndd | system_info.py | system_info.py | # -*- coding: utf-8 -*-
"""System info"""
import platform
import subprocess
import sys
import numpy
class SystemInfo:
"""Collect system info."""
@property
def platform(self):
"""Info on the underlying platform."""
return platform.platform()
@property
def architecture(self):
... | bsd-3-clause | Python | |
2910f54c75e3f7cc9d7be08886547060a7e69b69 | Implement basic CLI control | joushou/dispatch,joushou/dispatch | pusher.py | pusher.py | from __future__ import print_function, absolute_import, unicode_literals, division
from stackable.stack import Stack
from stackable.utils import StackablePickler
from stackable.network import StackableSocket, StackablePacketAssembler
from stackable.stackable import StackableError
from runnable.network import RunnableSe... | mit | Python | |
e10ed243f6cae2e020d468bbd13a619e45ed0c5d | Add a forgotten migration | WebCampZg/conference-web,WebCampZg/conference-web,WebCampZg/conference-web | sponsors/migrations/0011_auto_20170629_1208.py | sponsors/migrations/0011_auto_20170629_1208.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-29 10:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sponsors', '0010_auto_20170627_2001'),
]
operations = [
migrations.AlterFie... | bsd-3-clause | Python | |
ca5d47f3749c188d0858e996ba0253077260cd6c | Create GetUserGraphInstagram.py | haddadi/Instagram,haddadi/Instagram | GetUserGraphInstagram.py | GetUserGraphInstagram.py | #! /bin/bash
for (( i=1; i <= 5; i++ ))
do
userid=$i
curl https://api.instagram.com/v1/users/$userid/follows?access_token=XXXXXX > followers/$userid.followers
curl https://api.instagram.com/v1/users/$userid/followed-by?access_token=XXXXXX > followedby/$userid.followedby
done
| mit | Python | |
a8f4f0aa06e1469e758d5775bfea4176c7561e9f | Create stop_playlist.py | CTarel/homeassistant,CTarel/homeassistant | HA/syno/stop_playlist.py | HA/syno/stop_playlist.py | #!/usr/bin/python
import sys
import http.cookiejar, urllib.request, urllib.error, urllib.parse
import json
import codecs
cj = http.cookiejar.CookieJar()
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
IP_syno = "IP_OF_YOUR_NAS"
LOGIN = "********"
PASSWORD = "********"
player = sys.argv[1]... | mit | Python | |
b6daa366a38f224132c8f276d3fbc212964900c2 | add currency | anokata/pythonPetProjects,anokata/pythonPetProjects,anokata/pythonPetProjects,anokata/pythonPetProjects | zametki/currency.py | zametki/currency.py | import requests as req
def getUSD_RUB():
currency_url = 'http://api.fixer.io/latest?symbols=RUB&base=USD'
res = req.get(currency_url).json()
return res['rates']['RUB']
#print(getUSD_RUB())
| mit | Python | |
df5884cd07d30f8b027b193bc819b61f7a6bdd31 | Create cap_sense_test.py | tinkernauts/raspberrypi | MPR121/cap_sense_test.py | MPR121/cap_sense_test.py | #!/usr/bin/python
######################################################################
"""
cap_sense_test.py - demo to use 12-channel MPR121 capacitive touch
sensor controller as a sound board.
Bart Spainhour <bart@tinkernauts.org>
From Freescale Semiconductor whitepaper:
Proximity Capacitive Touch Sensor Contro... | mit | Python | |
16883c227549707ef2a66d7e6020809fe9ecd909 | Add visitor base class | twneale/tater,twneale/tater | tater/visit.py | tater/visit.py | from tater.utils import CachedAttr
class _MethodDict(dict):
'Dict for caching visitor methods.'
def __init__(self, visitor):
self.visitor = visitor
def __missing__(self, node):
name = node.__class__.__name__
method = getattr(self.visitor, 'visit_' + name, None)
self[name] ... | bsd-3-clause | Python | |
f291633a4a24aed310f46798ffa2472db4539aaf | Add a pyunit test for type-checking utilities | michalkurka/h2o-3,spennihana/h2o-3,mathemage/h2o-3,h2oai/h2o-dev,jangorecki/h2o-3,h2oai/h2o-3,michalkurka/h2o-3,michalkurka/h2o-3,h2oai/h2o-3,h2oai/h2o-dev,h2oai/h2o-3,spennihana/h2o-3,h2oai/h2o-3,h2oai/h2o-dev,h2oai/h2o-3,spennihana/h2o-3,michalkurka/h2o-3,spennihana/h2o-3,jangorecki/h2o-3,michalkurka/h2o-3,h2oai/h2o-... | h2o-py/tests/testdir_misc/pyunit_typechecks.py | h2o-py/tests/testdir_misc/pyunit_typechecks.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""Pyunit for h2o.utils.typechecks."""
from __future__ import absolute_import, division, print_function
from h2o.exceptions import H2OTypeError, H2OValueError
from h2o.utils.typechecks import (U, assert_is_type, assert_matches, assert_satisfies)
def test_asserts():
"... | apache-2.0 | Python | |
7dd4919809c626d83cfc17447396aff98e636cfe | Add problem 13 | dimkarakostas/matasano-cryptochallenges | problem_13.py | problem_13.py | from collections import OrderedDict
from crypto_library import ecb_aes_encrypt, ecb_aes_decrypt
from problem_12 import find_blocksize
from crypto_library import apply_pkcs_7_padding
ENCRYPTION_KEY = ',y!3<CWn@1?wwF]\x0b'
def oracle(adversary_input):
profile = profile_for(adversary_input)
return ecb_aes_encry... | mit | Python | |
253ad82c316bd6d11dcf798e626b7eaf638867bd | add simple font comparison tool in examples | mammadori/pyglet,mammadori/pyglet,mammadori/pyglet,mammadori/pyglet | examples/font_comparison.py | examples/font_comparison.py | #!/usr/bin/env python
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are me... | bsd-3-clause | Python | |
8416f73011ff2d2e53a46e6b575faca919c61de7 | Create rockpaperScissors.py | henrydambanemuya/pygames | rockpaperScissors.py | rockpaperScissors.py | #!/usr/bin/env/ python
#Henry Kudzanai Dambanemuya presents: Rock, Paper, Scissors
#Created: 10/13/2015
#Location: Notre Dame, Indiana
import random
import time
rock = 1
paper = 2
scissors = 3
names = { rock: "Rock", paper: "Paper", scissors: "Scissors" }
rules = { rock: scissors, paper: rock, scissors: paper }
pla... | mit | Python | |
a1ba3031171992e4c07bef13b6edcdb1b80e32e6 | Create psyko-ddos.py | bhammond101p/psyko-ddos | psyko-ddos.py | psyko-ddos.py | """
Title: Psyko DDoS
Type: Hacking Tool
Version: 1.0
Author: Brandon Hammond
Summary: Psyko DDoS is a Python DDoS
tool that uses TCP packets
to conduct a layer 4 DDoS
attack on the target IP
address at the given port.
It uses multithreading to
distribute the DDoS ... | cc0-1.0 | Python | |
dd36aef29cd1e45ec447260f9ac8848a86a430dc | Create ptb_reader.py | cjratcliff/adaptive-regularization | ptb_reader.py | ptb_reader.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import os
import sys
import tensorflow as tf
def _read_words(filename):
with open(filename, "r") as f:
if sys.version_info[0] >= 3:
return f.read().replace("\n", "<eos>").split()
e... | apache-2.0 | Python | |
532fdfa4a0fa4f0f5f441a572eef739f081e6522 | Create hello.py | komeiy/jenkins_cron | hello.py | hello.py | #!/usr/bin/env python
print 'hello world'
| mit | Python | |
98d956b6a249caeaee76732a0679c2dd3384cda7 | Create pytemplate.py | ismaproco/pytemplate | pytemplate.py | pytemplate.py | import os,sys,string
file_name = ""
if sys.argv[1] == "":
file_name = "template.tf"
else:
file_name = sys.argv[1]
path = []
def build_path():
s_path = ""
for i in path:
s_path += i + "\\"
return s_path
type_state = []
def manage_state(word,operation):
if operation == "append":
... | mit | Python | |
f4d70c81c55e744ef6ff4dd9fded2ca6e771fe30 | add missing profiles migration | openstates/openstates.org,openstates/openstates.org,openstates/openstates.org,openstates/openstates.org | profiles/migrations/0003_auto_20210225_1754.py | profiles/migrations/0003_auto_20210225_1754.py | # Generated by Django 2.2.16 on 2021-02-25 17:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("profiles", "0002_auto_20200903_1942"),
]
operations = [
migrations.AlterField(
model_name="profile",
name="api_tier... | mit | Python | |
14caf06fe4f30be96f0397f935df1daf48d40d81 | Create report.py | ferdiaz/python-quickbooks,ZachGoldberg/python-quickbooks,troolee/quickbooks-python,sidecars/python-quickbooks,porn/python-quickbooks,emburse/python-quickbooks | report.py | report.py | """
This module is for API consumer-side reporting on QBOv3-querried transactions.
In addition to mimmicking such features as "QuickReport," "General Ledger,"
"Profit & Loss," et al, it provides some helpful functions, such as finding
the starting and ending balance of a particular account as of a particular
date a... | mit | Python | |
79acf77b7d711c88ea0ca8a733721ce5285f9a00 | Create Randomkick.py | Jake0720/XChat-Scripts | Randomkick.py | Randomkick.py | __module_name__ = 'Random Kick Reason'
__module_version__ = '0.1'
__module_description__ = 'Kicks the designated player with a random kick reason.'
__module_author__ = 'Jake0720'
rkickhelp = '\x02USAGE: /rk <nick>'
import xchat
import random
def rk(word, word_eol, userdata):
rkicks = (('Goodbye','See you later'... | mit | Python | |
d021c05e483f556122d0f3251c2a299e0c47792c | add language detection code (even if it's not used) | ma2rten/kaggle-evergreen | src/detect_language.py | src/detect_language.py | def determine_language(item):
import langid
# latin my ass
def classify(s):
rank = langid.rank(s)
if rank[0][0] == 'la':
return rank[1][0]
return rank[0][0]
# extract text
soup = boil_soup(item)
for tag in ['script', 'style']:
for el in soup.find_all... | mit | Python | |
f0392ebda49fa0222a3b317f50002d7e03659f47 | Test we can approve Flutterwave bank accounts | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/funding_flutterwave/tests/test_states.py | bluebottle/funding_flutterwave/tests/test_states.py | from bluebottle.files.tests.factories import PrivateDocumentFactory
from bluebottle.funding.tests.factories import FundingFactory, PlainPayoutAccountFactory, \
BudgetLineFactory
from bluebottle.funding_flutterwave.tests.factories import FlutterwaveBankAccountFactory
from bluebottle.test.utils import BluebottleTestC... | bsd-3-clause | Python | |
9c3449cdfa7b39069b691b31ff75defa7cf9b302 | add example.py | daler/metaseq,mrGeen/metaseq,agrimaldi/metaseq,mrGeen/metaseq,agrimaldi/metaseq,daler/metaseq,daler/metaseq,mrGeen/metaseq,agrimaldi/metaseq | doc/example.py | doc/example.py | import numpy as np
import os
import metaseq
ip_filename = metaseq.helpers.example_filename(
'wgEncodeHaibTfbsK562Atf3V0416101AlnRep1_chr17.bam')
input_filename = metaseq.helpers.example_filename(
'wgEncodeHaibTfbsK562RxlchV0416101AlnRep1_chr17.bam')
ip_signal = metaseq.genomic_signal(ip_filename, 'bam')
input... | mit | Python | |
c1fc0121b02656de7bc99c587743485b5e45e416 | Create angelbambi.py | majikpig/ubtech | angelbambi.py | angelbambi.py | #the following lines will allow you to use buttons and leds
import btnlib as btn
import ledlib as led
import time
#the led.startup() function cycles through the leds
led.startup()
time.sleep(1)
print("All on and off")
#to turn on all leds, use the led.turn_on_all(2) function:
led.turn_on_all()
time.sleep(2)
#to turn ... | mit | Python | |
0135ce760bb3bf8f2fd828fdb195bcdc4e4c3117 | Add sample.py | tkf/traitscli,tkf/traitscli | sample.py | sample.py | from traitscli import TraitsCLIBase
from traits.api import Bool, Float, Int, Str, Enum, Event
class SampleCLI(TraitsCLIBase):
"""Sample CLI using `traitscli`."""
not_configurable_from_cli = Bool
yes = Bool(config=True)
fnum = Float(config=True)
inum = Int(config=True)
string = Str(config=Tru... | bsd-3-clause | Python | |
1706531082d75f7d6522b4f7d409df8d4fb2b3d7 | Create __init__.py | stiphyMT/plantcv,danforthcenter/plantcv,danforthcenter/plantcv,danforthcenter/plantcv,stiphyMT/plantcv,stiphyMT/plantcv | plantcv/plantcv/visualize/eCDF/__init__.py | plantcv/plantcv/visualize/eCDF/__init__.py | from plantcv.plantcv.visualize.eCDF.obj_size import obj_size
__all__ = ["obj_size"]
| mit | Python | |
4d4120d6982a02a01b8dd2a4853eab47d7fe6f83 | Create tests.py | blackseabass/django-polls,blackseabass/django-polls | polls/tests.py | polls/tests.py | import datetime
from django.utils import timezone
from django.test import TestCase
from .models import Question
# Create your tests here.
class QuestionMethodTests(TestCase):
def test_was_published_recently_with_future_question(self):
"""
was_published_recently() should return False for question... | bsd-3-clause | Python | |
15aa7efa3dfdade3001cdb6b5ac4c2f3c5cc2461 | Test Commit | SharedKnowledge/SharkPython,SharedKnowledge/SharkPython,SharedKnowledge/SharkPython | raspberry/asip/RelationSemanticTag.py | raspberry/asip/RelationSemanticTag.py | from SemanticTag import *
#Test | agpl-3.0 | Python | |
95c34b9ad7ca6c425853642353a2d56282cc94d1 | add script | hadim/fiji_tools,hadim/fiji_scripts,hadim/fiji_tools,hadim/fiji_scripts,hadim/fiji_scripts | plugins/Scripts/Plugins/Convert_To_8bit.py | plugins/Scripts/Plugins/Convert_To_8bit.py | # @DatasetIOService ds
# @ConvertService convert
# @UIService ui
import os
from ij import IJ
from ij import ImagePlus
d = "/home/hadim/Insync/Data/Microscopy/PSF/2016.04.12.T1/raw"
files = os.listdir(d)
for fname in files:
fpath = os.path.join(d, fname)
print(fpath)
print(fpath)
dataset = ds.open(fpath)
ui.... | bsd-3-clause | Python | |
8cdbda5c0694f4137c1b8a92bafd7f33a6a84d78 | solve pep_751 | filippovitale/pe,filippovitale/pe,filippovitale/pe,filippovitale/pe | pe-solution/src/main/python/pep_751.py | pe-solution/src/main/python/pep_751.py | from typing import Tuple
from decimal import Decimal, ROUND_FLOOR
def b_a(b: Decimal) -> Tuple[Decimal, Decimal]:
a = b.to_integral_exact(ROUND_FLOOR)
b = a * (b % 1 + 1)
return a, b
def th_tau(th: Decimal, n: int) -> Decimal:
a1, b = b_a(th)
l = []
for _ in range(2, n + 1):
a, b = ... | mit | Python | |
0428d4889b34568a5b5397532dfd0091029b64de | Create problem-10.py | vnbrs/project-euler | problem-10.py | problem-10.py | import math
def is_prime(next):
if n == 2:
return True
if n == 3:
return True
if n % 2 == 0:
return False
if n % 3 == 0:
return False
i = 5
w = 2
while math.pow(i, 2) <= n:
if n % i == 0:
return False
i += w
w = 6 - w
... | mit | Python | |
4fe4cad49367b462c2201b98cce4382bff3a0206 | Add a script which use the iterative parsing to process the map file and find out not only what tags are there, but also how many, to get the feeling on how much of which data you can expect to have in the map. | aguijarro/DataSciencePython | DataWrangling/CaseStudy/mapparser.py | DataWrangling/CaseStudy/mapparser.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Your task is to use the iterative parsing to process the map file and
find out not only what tags are there, but also how many, to get the
feeling on how much of which data you can expect to have in the map.
Fill out the count_tags function. It should return a dictionar... | mit | Python | |
3d18f6e3ba3519422aa30bd25f3511f62361d5ca | Add test to ensure no mutable default arguments | wkentaro/chainer,niboshi/chainer,chainer/chainer,niboshi/chainer,wkentaro/chainer,pfnet/chainer,niboshi/chainer,hvy/chainer,wkentaro/chainer,chainer/chainer,okuta/chainer,wkentaro/chainer,okuta/chainer,okuta/chainer,chainer/chainer,chainer/chainer,hvy/chainer,niboshi/chainer,hvy/chainer,okuta/chainer,hvy/chainer | tests/chainer_tests/test_chainer_objects.py | tests/chainer_tests/test_chainer_objects.py | import importlib
import inspect
import pkgutil
import types
import six
import unittest
import chainer
from chainer import testing
def walk_modules():
root = chainer.__path__
for loader, modname, ispkg in pkgutil.walk_packages(root, 'chainer.'):
# Skip modules generated by protobuf.
if '_pb2'... | mit | Python | |
fcb07c7cd94f96cd533c55d18a657673f9eeac7f | Move log related functions over to this file | NekoGamiYuki/SpicyTwitch | SpicyTwitch/Log_tools.py | SpicyTwitch/Log_tools.py | # Imports-----------------------------------------------------------------------
import logging
import os
from inspect import stack, getmodulename
from . import Storage
# Base setup--------------------------------------------------------------------
log_to_stdout = True
log_to_file = True
logging_level = logging.DEBU... | mit | Python | |
7ec36d0a1d0a757d0c914e4857ae06f4fece88f8 | Add HexTerrain | jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools | problem/pop_map/hexagon/hex_terrain.py | problem/pop_map/hexagon/hex_terrain.py | #! /usr/bin/env python
# Copyright 2020 John Hanley.
#
# 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 rights to use, copy, modify, me... | mit | Python | |
4061e5db7097a680405282e371ab3bf07758648a | Add simple unit tests to validate all configs | facebookresearch/detectron2,facebookresearch/detectron2,facebookresearch/detectron2 | projects/DensePose/tests/test_setup.py | projects/DensePose/tests/test_setup.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import os
import unittest
from detectron2.config import get_cfg
from detectron2.engine import default_setup
from densepose import add_densepose_config
_CONFIG_DIR = "configs"
_QUICK_SCHEDULES_CONFIG_SUB_DIR = "quick_schedules"
_CONFIG_FILE_PREF... | apache-2.0 | Python | |
d1bc6c3fd5741c5c8d3d6dd2ee5c5c28c2764ba3 | add Tumblr.py | xiahei/Daily_scripts,x1ah/Daily_scripts,xiahei/Daily_scripts,x1ah/Daily_scripts,x1ah/Daily_scripts,x1ah/Daily_scripts,xiahei/Daily_scripts,x1ah/Daily_scripts | TumblrResource/Tumblr.py | TumblrResource/Tumblr.py | #!/usr/bin/env python
# coding:utf-8
| mit | Python | |
a0d196af4d3854365bedb581d25d73af3271cb1a | add python script file | hadacchi/mydatetime | mydatetime.py | mydatetime.py | #!/usr/bin/python
from datetime import datetime,timedelta
import numpy
# -----------------------------------------------------------------
# mydatetime v0.2 for python
# Copyright (c) 2007 t.hada
# -----------------------------------------------------------------
###
# This script is convert from/into date in... | bsd-3-clause | Python | |
3129819c7d2ff3b35dd0270c0a27ef694a7e4d9e | Add regularizers.py | EderSantana/seya | seya/regularizers.py | seya/regularizers.py | from keras.regularizers import Regularizer
class GaussianKL(Regularizer):
def set_param(self, p):
self.p = p
def set_layer(self, layer):
self.layer = layer
def __call__(self, loss):
# See Variational Auto-Encoding Bayes by Kingma and Welling.
mean, sigma = self.layer.get_... | bsd-3-clause | Python | |
e0eb68fa33dc6dea9f1b4a0f6cb1161e4128cfd7 | add paper sim by summary | gchen/recop | recommendation/paper_sim_by_summary.py | recommendation/paper_sim_by_summary.py | import MySQLdb
import sys
sys.path.append("../../include/python/")
from paper import Paper
import math
from operator import itemgetter
def getWordFreq():
connection1 = MySQLdb.connect(host = "127.0.0.1", user = "recop", passwd = "recop", db = "recop")
cursor1 = connection1.cursor()
cursor1.execute("select id, titil... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.