commit stringlengths 40 40 | subject stringlengths 1 1.49k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | new_contents stringlengths 1 29.8k | old_contents stringlengths 0 9.9k | lang stringclasses 3
values | proba float64 0 1 |
|---|---|---|---|---|---|---|---|
f03f976696077db4146ea78e0d0b1ef5767f00ca | Add high level signing capabilities | tests/unit/test_sign.py | tests/unit/test_sign.py | # Import libnacl libs
import libnacl.sign
# Import pythonlibs
import unittest
class TestSigning(unittest.TestCase):
'''
'''
def test_sign(self):
msg = ('Well, that\'s no ordinary rabbit. That\'s the most foul, '
'cruel, and bad-tempered rodent you ever set eyes on.')
signe... | Python | 0 | |
f6609763f832cd5672e40d1dfe8f7dc7c58ca7c5 | Create diarygui.py | _src/om2py2w/2wex0/diarygui.py | _src/om2py2w/2wex0/diarygui.py | # -*- coding: utf-8 -*-
# ------------2w task:simple diary GUI-----------
# --------------created by bambooom--------------
from Tkinter import * # import Tkinter module
from ScrolledText import * # ScrolledText module = Text Widget + scrollbar
global newlog
class Application(Frame): # 基本框架
def __init... | Python | 0 | |
c43c7d523ddbb5b914748a20d55971fbf1c12496 | Create oauth2token.py | oauth2token.py | oauth2token.py | #!/usr/bin/python
'''
This script will attempt to open your webbrowser,
perform OAuth 2 authentication and print your access token.
It depends on two libraries: oauth2client and gflags.
To install dependencies from PyPI:
$ pip install python-gflags oauth2client
Then run this script:
$ ... | Python | 0.000016 | |
2de7f3d382c935d6b9036de58466ea03ab58c8fd | Add script to run registration task remotely. | bin/mujin_controllerclientpy_runregistrationtask.py | bin/mujin_controllerclientpy_runregistrationtask.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import time
import datetime
import argparse
from mujincontrollerclient.controllerclientbase import ControllerClient
from mujincontrollerclient import uriutils
import logging
log = logging.getLogger(__name__)
def _RunMain():
parser = argparse.ArgumentPars... | Python | 0 | |
31cdb65a8d370c6f309ad610aa3b969d5bfb8706 | Add follow_bot.py | follow_bot.py | follow_bot.py | """Follow bot, to follow some followers from an account
"""
__date__ = '08/01/2014'
__author__ = '@ismailsunni'
import tweepy
import constants
# constants
consumer_key = constants.consumer_key
consumer_secret = constants.consumer_secret
access_key = constants.access_key
access_secret = constants.access_secret
def ne... | Python | 0.00002 | |
91e84e0f47792b44a6cf8eddbb5fb1489879613e | Create WriteRecord.py | WriteRecord.py | WriteRecord.py | import json
class WriteRecord:
def create_data_file(self):
self.jsonrec = {
"ASXListedCompanies": {
"filename": "ASXListedCompanies.csv",
"source": "ASX",
"url": "http://www.asx.com.au/asx/research/ASXListedCompanies.csv",
"local_... | Python | 0.000001 | |
30f18a4be667b02f8d0f6c2f2bf97146992d3208 | Add first version of OpenCV core | opencv/core.py | opencv/core.py | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 1 18:19:38 2013
@author: matz
"""
import cvtype
import datatype
import document
import generator
import package
import test
# abbreviations
dt = test.Default()
# utilitiy functions
dcl = document.Document()
dcl.line("void checkEnumValue(const stromx::runtime::Enum & v... | Python | 0 | |
e26be1cdee6b40896e7ee5c2a894fba05fc58480 | Add traceview directory. | traceview/__init__.py | traceview/__init__.py | # -*- coding: utf-8 -*-
"""
TraceView API library
:copyright: (c) 2014 by Daniel Riti.
:license: MIT, see LICENSE for more details.
"""
__title__ = 'traceview'
__version__ = '0.1.0'
__author__ = 'Daniel Riti'
__license__ = 'MIT'
| Python | 0 | |
b28d2933ac1b5c6375f9dd5142f467a06bd69463 | add a simple plot script to visualize the distribution | Utils/py/BallDetection/Evaluation/plot_csv.py | Utils/py/BallDetection/Evaluation/plot_csv.py | import matplotlib.pyplot as plt
import sys
import numpy as np
scores = np.genfromtxt(sys.argv[1], usecols=(1), skip_header=1, delimiter=",")
scores = np.sort(scores)
plt.style.use('seaborn')
plt.plot(scores)
plt.show() | Python | 0 | |
6d910181758008d05de3917fdac5b35b34188a8e | add RebootNodeWithPCU call. fails gracefully if dependencies are not met. | PLC/Methods/RebootNodeWithPCU.py | PLC/Methods/RebootNodeWithPCU.py | import socket
from PLC.Faults import *
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.Nodes import Node, Nodes
from PLC.NodeNetworks import NodeNetwork, NodeNetworks
from PLC.Auth import Auth
from PLC.POD import udp_pod
try:
from pcucontrol import reboot
external_dependency = True... | Python | 0 | |
f75e1397735adcbd39dbc90a0446b9efd9532be4 | add initial python script to handle button events that trigger the node process | bin/selfie.py | bin/selfie.py | #!/usr/bin/python
import RPi.GPIO as GPIO
import time
from subprocess import call
GPIO.setmode(GPIO.BCM)
BUTTON = 18;
GPIO.setup(BUTTON, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
input_state = GPIO.input(BUTTON)
if input_state == False:
print('Button Pressed')
call(["node", "./index.js... | Python | 0 | |
fb83969c6467e288ff16661aec2eafc174bdf124 | correct fieldsight form issue fix | onadata/apps/fsforms/management/commands/set_correct_fxf_in_finstance.py | onadata/apps/fsforms/management/commands/set_correct_fxf_in_finstance.py | from django.db import transaction
from django.core.management.base import BaseCommand
from onadata.apps.fieldsight.models import Site
from onadata.apps.fsforms.models import FieldSightXF, FInstance
from onadata.apps.viewer.models.parsed_instance import update_mongo_instance
class Command(BaseCommand):
help = 'De... | Python | 0 | |
0f76875400ea1a03a23a4b266eb0ca9bf574922d | implement 9 (9) 各行を2コラム目,1コラム目の優先順位で辞書の逆順ソートしたもの(注意: 各行の内容は変更せずに並び替えよ).確認にはsortコマンドを用いよ(この問題は結果が合わなくてもよい). | set01/09.py | set01/09.py | # -*- coding: utf-8 -*-
# (9) 各行を2コラム目,1コラム目の優先順位で辞書の逆順ソートしたもの(注意: 各行の内容は変更せずに並び替えよ).確認にはsortコマンドを用いよ(この問題は結果が合わなくてもよい).
import sys
lines = [line.decode('utf-8').rstrip(u'\r\n') for line in sys.stdin.readlines()]
lines = sorted(lines, key = lambda l: l.split(u'\t')[0])
lines = sorted(lines, key = lambda l: l.split(u'... | Python | 0.000001 | |
d654bf0fb0c5e3fc7a11029a216c109b5f04d37b | Add __init__ file | taxdata/cps/__init__.py | taxdata/cps/__init__.py | # flake8: noqa
from taxdata.cps import benefits
from taxdata.cps import cps_meta
from taxdata.cps import cpsmar
from taxdata.cps.create import create
from taxdata.cps.finalprep import finalprep
from taxdata.cps import helpers
from taxdata.cps import impute
from taxdata.cps import pycps
from taxdata.cps import splitinco... | Python | 0.00026 | |
1fddb845ad99bb65aa7b86155d899043a64ebdcf | Update app/views/main/views.py | app/views/main/views.py | app/views/main/views.py | from flask import current_app as app
from flask import flash
from flask import redirect
from flask import render_template
from flask import url_for
from flask_login import current_user
from flask_login import login_required
from . import main
from .forms import SearchForm
from ..api.utils import _search
@main.route... | Python | 0 | |
9243f9264b0cc54cfe9a59be3f4435b2cd009875 | add analysis functions | scarce/analysis.py | scarce/analysis.py | r"""Helper functions for complex analysis """
import numpy as np
from scipy import integrate
from scarce import solver
def get_charge_planar(width, thickness, pot_descr, pot_w_descr, t_e_trapping=0., t_h_trapping=0., grid_x=5, grid_y=5, n_pairs=10, dt=0.001, n_steps=25000, temperature=300):
''' Cal... | Python | 0.000001 | |
938a9548b6503136b82fd248258df5f4e0523f8a | add sorting_algorithms.py | adv/sorting_algorithms.py | adv/sorting_algorithms.py | # Sorting Algorithms
import random
import time
my_list = range(10000)
random.shuffle(my_list)
#print sorted(my_list) #We have a way to sort information.
# But how did it do that?
###################################################################
# What does "efficiency" mean in terms of a program... | Python | 0.003966 | |
bb7031385af7931f9e12a8987375f929bcfb6b5a | Create script that checks for dev and docs dependencies. | scripts/devdeps.py | scripts/devdeps.py | from __future__ import print_function
import sys
try:
import colorama
def blue(text): return "%s%s%s" % (colorama.Fore.BLUE, text, colorama.Style.RESET_ALL)
def red(text): return "%s%s%s" % (colorama.Fore.RED, text, colorama.Style.RESET_ALL)
except ImportError:
def blue(text) : return text
def red... | Python | 0 | |
a23e08275652f7356863edada51e7dee345a2dfc | Add functools from Python trunk r65615 | test-tools/functools.py | test-tools/functools.py | """functools.py - Tools for working with functions and callable objects
"""
# Python module wrapper for _functools C module
# to allow utilities written in Python to be added
# to the functools module.
# Written by Nick Coghlan <ncoghlan at gmail.com>
# Copyright (C) 2006 Python Software Foundation.
# See C source co... | Python | 0 | |
d3a652111aa7df0a5ecc429db6aa639f9a667ff9 | Create imogen.py | imogen.py | imogen.py | Python | 0.000001 | ||
ca098b540b171460f41ea66c01d2b0d039feb073 | Add arrange combination algorithm | arrange_combination/arrange.py | arrange_combination/arrange.py | #!/usr/bin/env python
def range(input_list, step):
if step == 3:
print(input_list)
return
for i in range(step, len(input_list)):
input_list[step], input_list[i] = input_list[i], input_list[step]
range(input_list, step+1)
input_list[step], input_list[i] = input_list[i], input_list[step]
def ... | Python | 0.000036 | |
c28522ace1efc0d2c7545bbc742356f6f6428812 | Use argparse in the radare module. | modules/radare.py | modules/radare.py | # -*- coding: utf-8 -*-
# This file is part of Viper - https://github.com/botherder/viper
# See the file 'LICENSE' for copying permission.
import os
import sys
import shlex
import subprocess
from viper.common.abstracts import Module
from viper.core.session import __sessions__
ext = ".bin"
run_radare = {'linux2': 'r... | # -*- coding: utf-8 -*-
# This file is part of Viper - https://github.com/botherder/viper
# See the file 'LICENSE' for copying permission.
import os
import sys
import getopt
from viper.common.out import *
from viper.common.abstracts import Module
from viper.core.session import __sessions__
ext = ".bin"
run_radare =... | Python | 0 |
f0da1774514c839b4b97fa92d2202437932dc99a | Add a small driver for plotting skeletons. | analysis/plot-skeleton.py | analysis/plot-skeleton.py | #!/usr/bin/env python
import climate
import database
import plots
@climate.annotate(
root='plot data rooted at this path',
pattern=('plot data from files matching this pattern', 'option'),
)
def main(root, pattern='*/*block02/*trial00*.csv.gz'):
with plots.space() as ax:
for trial in database.Ex... | Python | 0 | |
060c8a4379aef14459929a47bf62a80a3e7eef67 | Create af_setJoints.py | af_scripts/tmp/af_setJoints.py | af_scripts/tmp/af_setJoints.py | import pymel.core as pm
curSel = pm.ls(sl=True,type='transform')[0]
bBox = pm.xform(curSel,ws=1,q=1,bb=1)
sizeX = abs(bBox[0]-bBox[3])
sizeY = abs(bBox[1]-bBox[4])
sizeZ = abs(bBox[2]-bBox[5])
curPvt = [(bBox[0]+sizeX/2),(bBox[1]+sizeY/2),(bBox[2]+sizeZ/2)]
ccUD = pm.circle(n='circle_rotUpDown',r=sizeY/2,nr=(1,0,0))... | Python | 0.000001 | |
bde8b61f419dd6e66a85cc92f3661de6aaadeb94 | ADD CHECK FOR YELLING | proselint/checks/misc/yelling.py | proselint/checks/misc/yelling.py | # -*- coding: utf-8 -*-
"""EES: Too much yelling..
---
layout: post
error_code: SCH
source: ???
source_url: ???
title: yelling
date: 2014-06-10 12:31:19
categories: writing
---
Too much yelling.
"""
from proselint.tools import blacklist
err = "MAU103"
msg = u"Too much yelling."
check = blacklist... | Python | 0 | |
26e7e7b270bfd5e08cf871f7d89b5a92b07df230 | add migration file | contmon/scraper/migrations/0001_initial.py | contmon/scraper/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
replaces = [('scraper', '0001_initial'), ('scraper', '0002_auto_20150706_2105'), ('scraper', '0003_auto_20150706_... | Python | 0.000001 | |
927c0d62ab289fc866ce80a3c2d6ff630a13d660 | add compatibility layer with older seabreeze | src/seabreeze/compat.py | src/seabreeze/compat.py | """seabreeze.compat compatibility layer with 0.6.x seabreeze
seabreeze 0.6.x
"""
import warnings
def _deprecation_warning(old_method, new_feature_method, version):
msg = "{old_method} will be deprecated in version {ver}, use {feature} feature via f.{feature}.{method} instead"
feature, method = new_feature_m... | Python | 0 | |
7fb2b02c7c08912f54ef3cc0f22c53daa34ec639 | Add accelerometer and crash analysis | analysis/plot_accelerometer.py | analysis/plot_accelerometer.py | """Plots the accelerometer readings for x, y, and z."""
from dateutil import parser as dateparser
from matplotlib import pyplot
import json
import sys
def main():
if sys.version_info.major <= 2:
print('Please use Python 3')
sys.exit(1)
if len(sys.argv) != 2:
print('Usage: plot_accele... | Python | 0 | |
1b0c33c01b179831edc29b0b13a3f60e96b54321 | Create joyent.py | joyent.py | joyent.py | #!/usr/bin/env python
import os
import sys
import cPickle as pickle
from datetime import datetime
from smartdc import DataCenter
try:
import json
except ImportError:
import simplejson as json
debug = False
CACHE_EXPIRATION_IN_SECONDS = 300
SERVER_FILENAME = "joyent_server_cache.txt"
##
PATH_TO_FILE = os.gete... | Python | 0.000005 | |
872dd45173e889db06e9b16105492c241f7badae | Add an example for dynamic RPC lookup. | examples/rpc_dynamic.py | examples/rpc_dynamic.py | import asyncio
import aiozmq
import aiozmq.rpc
class DynamicHandler(aiozmq.rpc.AttrHandler):
def __init__(self, namespace=()):
self.namespace = namespace
def __getitem__(self, key):
try:
return getattr(self, key)
except AttributeError:
return DynamicHandler(se... | Python | 0 | |
e0b1bea00c56657ef9fb4456203a522920375cc2 | add testLCMSpy.py script | software/ddapp/src/python/tests/testLCMSpy.py | software/ddapp/src/python/tests/testLCMSpy.py | from ddapp.consoleapp import ConsoleApp
from ddapp import lcmspy
from ddapp import lcmUtils
from ddapp import simpletimer as st
app = ConsoleApp()
app.setupGlobals(globals())
if app.getTestingInteractiveEnabled():
app.showPythonConsole()
lcmspy.findLCMModulesInSysPath()
timer = st.SimpleTimer()
stats = {}
ch... | Python | 0.000001 | |
cb2cc713c29c20ba239a60b6151c5e5c001c8e0b | Add joinkb.py | joinkb.py | joinkb.py | from __future__ import print_function
__module_name__ = 'Join Kickban'
__module_version__ = '0.1'
__module_description__ = 'Kickbans clients from specified channels on regex match against their nickname on join'
__author__ = 'Daniel A. J.'
import hexchat
import re
re = re.compile(r'\bfoo\b') # regex pattern to be ma... | Python | 0.000005 | |
f6864179a2dc1c531afc2c3ba6be300006e01fab | Create consecZero.py | Codingame/Python/Clash/consecZero.py | Codingame/Python/Clash/consecZero.py | import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
n = input()
# Write an action using print
# To debug: print("Debug messages...", file=sys.stderr)
c = 0
t = 0
for x in n:
if x == '0':
t += 1
else:
if t > c:
... | Python | 0.000001 | |
6a4fb74befd22c2bc814dbe51a1fa884a077be9d | Create django_audit_snippets.py | example_code/django_audit_snippets.py | example_code/django_audit_snippets.py | from django.conf import settings
from urls import urlpatterns
'''
Access shell via
./manage.py shell
(or shell_plus if you have django-extensions)
Dont forget you may need to set environment variables:
- DJANGO_SETTINGS_MODULE to the settings file (python module load syntax like settings.filename) and
- PYTHONPATH... | Python | 0.000004 | |
73819cea7150e15212a014f9c3a42a69d0351ab8 | Create cutrope.py | cutrope.py | cutrope.py | # Author: Vikram Raman
# Date: 08-15-2015
import time
# Given a rope with length n, how to cut the rope into m parts with length n[0], n[1], ..., n[m-1],
# in order to get the maximal product of n[0]*n[1]* ... *n[m-1]?
# We have to cut once at least. Additionally, the length of the whole length of the rope,
# as we... | Python | 0 | |
6b95af9822b9d94793eef503609b48d83066f594 | add test that causes KeyError for disabled text | test/test-text-diabled.py | test/test-text-diabled.py | from framework import *
root.title("Disabled text")
canv.create_text(200, 200,
text = "Test disabled text",
font = ("Times", 20),
state = DISABLED
)
thread.start_new_thread(test, (canv, __file__, True))
root.mainloop()
| Python | 0 | |
06efe8a8be913fb63f27016268d86f1ad0a5bcdf | Add test_engine_seed.py | tests/test_engine_seed.py | tests/test_engine_seed.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# 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
# Unles... | Python | 0.000039 | |
3de2b08133f6f721a3a30120a93b81be0eacefb6 | add tests for the scuba.filecleanup sub-module | tests/test_filecleanup.py | tests/test_filecleanup.py | from __future__ import print_function
from nose.tools import *
from unittest import TestCase
try:
from unittest import mock
except ImportError:
import mock
from scuba.filecleanup import FileCleanup
def assert_set_equal(a, b):
assert_equal(set(a), set(b))
class TestFilecleanup(TestCase):
@mock.patc... | Python | 0 | |
d41005d14239a93237fb839084f029208b94539d | Use the custom.js as served from the CDN for try | common/profile_default/ipython_notebook_config.py | common/profile_default/ipython_notebook_config.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Configuration file for ipython-notebook.
c = get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
# Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded-
# For headerssent by the upstream reverse proxy... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Configuration file for ipython-notebook.
c = get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
# Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded-
# For headerssent by the upstream reverse proxy... | Python | 0 |
2b380d501b80afad8c7c5ec27537bcc682ed2775 | Fix some scope mistakes. This fix was part of the reverted commit. | commands/handle.py | commands/handle.py | import commands.cmds as cmds
def handle(self, chat_raw):
self.logger.info("Handling command: " + chat_raw + " (for player" + self.fquid + ")")
_atmp1 = chat_raw.split(" ")
_atmp2 = list(_atmp1[0])
del _atmp2[0]
del _atmp1[0]
cmdobj = {
"base": _atmp2,
"args_raw": _atmp1,
... | import commands.cmds as cmds
def handle(self, chat_raw):
self.logger.info("Handling command: " + chat_raw + " (for player" + self.fquid + ")")
_atmp1 = chat_raw.split(" ")
_atmp2 = list(_atmp1[0])
del _atmp2[0]
del _atmp1[0]
cmdobj = {
"base": _atmp2,
"args_raw": _atmp1,
... | Python | 0 |
b37f31b5adbdda3e5d40d2d8a9dde19b2e305c2c | Add tests for the controller module | ckanext/wirecloudview/tests/test_controller.py | ckanext/wirecloudview/tests/test_controller.py | # -*- coding: utf-8 -*-
# Copyright (c) 2018 Future Internet Consulting and Development Solutions S.L.
# This file is part of CKAN WireCloud View Extension.
# CKAN WireCloud View Extension is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as publish... | Python | 0 | |
d1d1892551d805b5a73aaef07932c65fd375e342 | Add Rules unit test | py/desisurvey/test/test_rules.py | py/desisurvey/test/test_rules.py | import unittest
import numpy as np
import desisurvey.tiles
from desisurvey.rules import Rules
class TestRules(unittest.TestCase):
def setUp(self):
pass
def test_rules(self):
rules = Rules()
tiles = desisurvey.tiles.get_tiles()
completed = np.ones(tiles.ntiles, bool)
... | Python | 0 | |
6350092030d267621d2430d4505c01455d1de2d3 | Create Misha_rungaKutta.py | math/runge-kutta_method/Misha_rungaKutta.py | math/runge-kutta_method/Misha_rungaKutta.py | import matplotlib.pyplot as plt
# Python program to implement Runge Kutta method
def dydx(x, y):
return (18 * x + 1.33 * y) / (1.33 * x + 18 * y)
# Finds value of y for a given x using step size h
# and initial value y0 at x0.
def rungeKutta(x0, y0, x, h, Q1=0.5, Q2=0.5, w1=0.5, w2=0.5, c1=1, c2=2, c3=2, c4=1):
... | Python | 0 | |
3efa20e0d93c922bec6ae0f41774fd406532257a | Allow manually graded code cells | nbgrader/preprocessors/checkcellmetadata.py | nbgrader/preprocessors/checkcellmetadata.py | from nbgrader import utils
from nbgrader.preprocessors import NbGraderPreprocessor
class CheckCellMetadata(NbGraderPreprocessor):
"""A preprocessor for checking that grade ids are unique."""
def preprocess(self, nb, resources):
resources['grade_ids'] = ids = []
nb, resources = super(CheckCellM... | from nbgrader import utils
from nbgrader.preprocessors import NbGraderPreprocessor
class CheckCellMetadata(NbGraderPreprocessor):
"""A preprocessor for checking that grade ids are unique."""
def preprocess(self, nb, resources):
resources['grade_ids'] = ids = []
nb, resources = super(CheckCellM... | Python | 0 |
c6b9ef93b8d20589d454e2c63bba60fe383975b5 | Add files via upload | erasure.py | erasure.py | #!/usr/bin/env python
import numpy as np
import random
import hashlib
'''
Reed Solomon Encoding
data - column vector array
sz - integer length of data
Encodes data and returns a code that can be decoded
'''
class ErasureCoding():
def __init__(self):
pass
def _encode(self, x_vector, xform... | Python | 0.000001 | |
22e8cc6200cafd5cec386c35142cd742d4a2a735 | add problem 34 | problem_034.py | problem_034.py | #!/usr/bin/env python
#-*-coding:utf-8-*-
'''
145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
Find the sum of all numbers which are equal to
the sum of the factorial of their digits.
Note: as 1! = 1 and 2! = 2 are not sums they are not included.
'''
import math
import timeit
def calc():
eqs = []... | Python | 0.00477 | |
f64068b7b6e50f9280b51831715df8cb4c586daa | Update merge person tool | project/apps/api/management/commands/merge_persons.py | project/apps/api/management/commands/merge_persons.py | from optparse import make_option
from django.core.management.base import (
BaseCommand,
CommandError,
)
from apps.api.models import (
Person,
Singer,
Director,
Arranger,
)
class Command(BaseCommand):
help = "Merge selected singers by name"
option_list = BaseCommand.option_list + (
... | Python | 0.000001 | |
5940c705a390a73f5bef786ea9e3800a9d4cf7c9 | Create `serverless` module for handling Serverless Framework deploys (#3352) | lib/ansible/modules/extras/cloud/serverless.py | lib/ansible/modules/extras/cloud/serverless.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Ryan Scott Brown <ryansb@redhat.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the ... | Python | 0 | |
12bca37026ef4db41bd452dcb8cdc9022cdcf8c9 | Create pythonhelloworld.py | pythonhelloworld.py | pythonhelloworld.py | print "hello word"
| Python | 0.999993 | |
8e4240cd9bc2c06264ef23fddfc93ccf76e5ff9b | Create progressbar.py | progressbar.py | progressbar.py | ################################################################################
# Example usage:
# $ python
# >>> import Progress
# >>> total = 100
# >>> message = 'Doing this task '
# >>> with Progress.Bar(total, message) as bar:
# ... for n in range(total):
# ... time.sleep(0.1)
# ... bar.update(... | Python | 0.000001 | |
465c2c92da5db91bcc1f9149fbfa5722d30e10f9 | add some tests for the Basic Auth filter | test/test_basic_auth.py | test/test_basic_auth.py | import unittest
from libsaas import http
from libsaas.filters import auth
class BasicAuthTestCase(unittest.TestCase):
def test_simple(self):
auth_filter = auth.BasicAuth('user', 'pass')
req = http.Request('GET', 'http://example.net/')
auth_filter(req)
self.assertEqual(req.header... | Python | 0 | |
f6ea68d6a900eb33c2004aa65805b157b99c9ff8 | Remove beta. from hostname. | fabfile.py | fabfile.py | from fabric.api import *
from fabric.contrib.files import *
from fabric.colors import red
def deploy(branch='master'):
"Deploy the specified branch to the remote host."
root_dir = '/home/www-data'
code_dir = '%s/django_app' % root_dir
virtualenv_name = 'django_venv'
virtualenv_dir = '%s/%s' % (ro... | from fabric.api import *
from fabric.contrib.files import *
from fabric.colors import red
def deploy(branch='master'):
"Deploy the specified branch to the remote host."
root_dir = '/home/www-data'
code_dir = '%s/django_app' % root_dir
virtualenv_name = 'django_venv'
virtualenv_dir = '%s/%s' % (ro... | Python | 0.000007 |
4cac86aeb2d24a916fc5ae9ca98e3898f4729e1c | add protocol.py module | plumbca/protocol.py | plumbca/protocol.py | # -*- coding: utf-8 -*-
"""
plumbca.protocol
~~~~~~~~~~~~~~~~
Implements the protocol support for Plumbca.
:copyright: (c) 2015 by Jason Lai.
:license: BSD, see LICENSE for more details.
"""
import logging
import asyncio
from .message import Request
from .worker import Worker
actlog = logging.... | Python | 0.000001 | |
545af0493cf08cb15d262f3a5333df6d1fce6848 | Add util convenience functions for accessing data without decorators | brake/utils.py | brake/utils.py | from decorators import _backend
"""Access limits and increment counts without using a decorator."""
def get_limits(request, label, field, periods):
limits = []
count = 10
for period in periods:
limits.extend(_backend.limit(
label,
request,
field=field,
... | Python | 0 | |
a88986fa441b84aa0c5da76e63a08154ef243fab | Add error codes | quic/errors.py | quic/errors.py | import enum
class Error(enum.Enum):
# Connection has reached an invalid state.
QUIC_INTERNAL_ERROR = 0x80000001
# There were data frames after the a fin or reset.
QUIC_STREAM_DATA_AFTER_TERMINATION = 0x80000002
# Control frame is malformed.
QUIC_INVALID_PACKET_HEADER = 0x80000003
# Fra... | Python | 0.000002 | |
e0c3a46d1c3c13b5c956bf3cc6f30ad495f87ccd | put the logger config in a separate file for cleanliness | voglogger.py | voglogger.py | #!/usr/bin/python
"""
logger management for VOGLbot
writes out to both the console and a file 'voglbot.log'
"""
import sys
import logging
import time
logging.basicConfig(
filename = 'voglbot.log',
filemode = 'w',
level=logging.DEBUG,
format='%(asctime)s: %(message)s',
datefmt = '%d-%m %H:%M:%S',
stream = ... | Python | 0 | |
a984120bdb6c67a3dc2ca89ce9ae5498230015ea | Add initial runner | hug/run.py | hug/run.py | """hug/run.py
Contains logic to enable execution of hug APIS from the command line
"""
from wsgiref.simple_server import make_server
import falcon
import sys
import importlib
def server(module):
api = falcon.API()
for url, method_handlers in module.HUG_API_CALLS:
api.add_route(url, namedtuple('Route... | Python | 0.000003 | |
1578e1a129d91605148cf48f8793ac098ad0de7e | add command group | ibu/cli.py | ibu/cli.py | # -*- coding: utf-8 -*-
from __future__ import print_function
import click
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@click.group()
def ibu():
pass
@click.command(context_settings=CONTEXT_SETTINGS)
def test():
print("hello")
| Python | 0.000004 | |
33dc091a43d3868324631fdb420721ab35d1f6ce | Create dis_q.py | dis_q.py | dis_q.py | #!/usr/bin/python
import pymqi
queue_manager = "MQSD.TEST"
channel = "SYSTEM.DEF.SVRCONN"
host = "10.21.218.15"
port = "14123"
conn_info = "%s(%s)" % (host, port)
prefix = "*"
queue_type = pymqi.CMQC.MQQT_ALL
# queue_type = pymqi.CMQC.MQQT_LOCAL
excluded_prefix = ['SYSTEM', 'MSB', 'AMQ' , 'MQAI']
# excluded_prefix =... | Python | 0.000139 | |
b7541c063b6fc10fdd622cbd680ea4418c679f6b | Add NodeList iterator | d1_libclient_python/src/d1_client/iter/node.py | d1_libclient_python/src/d1_client/iter/node.py | # -*- coding: utf-8 -*-
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2016 DataONE
#
# Licensed under the Apache License, Version 2.0 ... | Python | 0.000001 | |
c00d49255187b6ac10c09f687bb8442f89b14142 | Fix and extend twisted.conch.ssh.keys.Key. Twisted's Key._fromString_PRIVATE_OPENSSH implementation supports only 3DES-CBC Our Key parses and loads the cipher specified in a DEK-Info header. Also, add Key.encrypt() and Key.decrypt() for general-use. | lib/crypto.py | lib/crypto.py | import re, sys
from hashlib import md5
from Crypto import Util
from Crypto.Cipher import AES, Blowfish, DES3
from Crypto.PublicKey import RSA, DSA
from pyasn1.codec.der import decoder as DERDecoder
from twisted.conch.ssh.keys import (
BadKeyError, EncryptedKeyError,
Key as _Key)
from twisted.conch.ssh ... | Python | 0 | |
2c900f8bddc9efb40d900bf28f8c6b3188add71e | Disable trix parser tests with Jython | test/test_trix_parse.py | test/test_trix_parse.py | #!/usr/bin/env python
from rdflib.graph import ConjunctiveGraph
import unittest
class TestTrixParse(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def testAperture(self):
g=ConjunctiveGraph()
g.parse("test/trix/aperture.trix",format="trix")
... | #!/usr/bin/env python
from rdflib.graph import ConjunctiveGraph
import unittest
class TestTrixParse(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def testAperture(self):
g=ConjunctiveGraph()
g.parse("test/trix/aperture.trix",format="trix")
... | Python | 0 |
0cb6474b8c02f2cb7af54f8321f82a53175e8345 | check for globals in the lib that are not prefixed with toku. addresses #74 | src/tokuglobals.py | src/tokuglobals.py | #!/usr/bin/python
import sys
import os
import re
def checkglobals(libname, exceptsymbols, verbose):
badglobals = 0
nmcmd = "nm -g " + libname
f = os.popen(nmcmd)
b = f.readline()
while b != "":
match = re.match("^([0-9a-f]+)\s(.?)\s(.*)$", b)
if match == None:
match = r... | Python | 0.00001 | |
24b8437003269ebd10c46d0fbdaa3e432d7535d6 | Add VCF -> non-reference likelihood table script. | genotype-likelihoods.py | genotype-likelihoods.py | from __future__ import print_function
import sys
import cyvcf
from argparse import ArgumentParser, FileType
import toolz as tz
description = ("Create a table of probability of a non reference call for each "
"genotype for each sample. This is PL[0]. -1 is output for samples "
"with a miss... | Python | 0 | |
6a9ddbf5d775df14c994c9af9e89195ca05a58f9 | Add pyjokes CLI test | tests/test_cli_error.py | tests/test_cli_error.py |
import pytest
import subprocess
from subprocess import Popen, PIPE
def test_pyjokes_call_exception():
pytest.raises(subprocess.CalledProcessError, "subprocess.check_call('pyjokes')")
def test_pyjokes_call_output():
try:
p = subprocess.Popen('pyjokes', stdin=PIPE, stdout=PIPE, stderr=PIPE)
exc... | Python | 0 | |
83a4c9bfa64543ecda65ed4c916fad8ad0a9233d | Create markov.py | markov.py | markov.py | # -*- coding: utf-8 -*-
import random
ngram = lambda text, n: [text[i:i+n] for i in xrange(len(text) - n + 1)]
flatten2D = lambda data: [flattened for inner in data for flattened in inner]
randelement = lambda x: x[random.randint(0, len(x) - 1)]
class Markov:
def __init__(self, data, n):
self.data = dat... | Python | 0.000001 | |
0970115f9bc1bab019c23ab46e64b26d5e754313 | Implement function for displaying tuning guidance on a DIY 8-segment LEDs display | led_display.py | led_display.py | import math
from gpiozero import LED
from time import sleep
g0 = LED(12)
f0 = LED(16)
a0 = LED(20)
b0 = LED(21)
e0 = LED(17)
d0 = LED(27)
c0 = LED(22)
g1 = LED(25)
f1 = LED(24)
a1 = LED(23)
b1 = LED(18)
e1 = LED(5)
d1 = LED(6)
c1 = LED(13)
PITCHES = {
'E2': ((a0, d0, e0, f0, g0), (b0, c0)),
'A2': ((a0, b0, ... | Python | 0 | |
64302511d7f517afb27511dcafead96b8c9c3e16 | Create submodularpick.py | lime/submodularpick.py | lime/submodularpick.py | class SubmodularPick(object):
"""Class for submodular pick"""
def __init__(self,
explainer,
data,
predict_fn,
method='sample',
sample_size=1000,
num_exps_desired=5,
... | Python | 0 | |
550d8bcd49e5ec591286f3f42de7dd54ef853bb8 | Add a utility script to print duplicates | find_dupes.py | find_dupes.py | #!/usr/bin/env python3
import json
import os
import random
scriptpath = os.path.dirname(__file__)
data_dir = os.path.join(scriptpath, 'data')
all_json = [f for f in os.listdir(data_dir) if os.path.isfile(os.path.join(data_dir, f))]
quotes = []
for f in all_json:
filename = os.path.join(data_dir, f)
with open(filena... | Python | 0.000003 | |
a02b2866a3bf6067a2ee7f6d194c52c0a4d4500e | Create welcome_email_daemon.py | 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... | Python | 0.000122 | |
a892a389cfc94ebf72579ed6888c02463cdf7e6d | add moviepy - text_erscheinen_lassen_rechts2links.py | 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... | Python | 0.000006 | |
5db0ef459f4b0f0d3903578ae89bef7d0de7bf98 | add terminal test file | 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... | Python | 0.000001 | |
3d8667d2bfd75fe076b15b171e5c942a2a358508 | add basic is_unitary tests | 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, ... | Python | 0.000017 | |
bf0a4ee5023cddd4072330e9a3e5a530aeea956e | test unit added | 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()
| Python | 0 | |
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... | 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... | Python | 0 | |
6764d0286f2386bef8ab5f627d061f45047956e9 | add logger | 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']),
... | Python | 0.000026 | |
6a426523186180a345777b7af477c12473fd3aa0 | add human moderator actions to file | 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... | Python | 0 | |
9cd3e1183b78f561751a638cf4e863703ec080d6 | add load ini file 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... | Python | 0.000001 | |
e559a0458d1e4b0ec578eb9bcfdcc992d439a35d | Add test cases for the backwards compatibility in #24 | 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... | Python | 0 | |
501c38ac9e8b9fbb35b64321e103a0dfe064e718 | Add a sequence module for optimizing gating | 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 : ... | Python | 0 | |
213d1e65ebd6d2f9249d26c7ac3690d6bc6cde24 | fix encoding | 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)
| Python | 0.274682 | |
6107d7fe1db571367a20143fa38fc6bec3056d36 | Fix port for activity script | 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... | Python | 0 |
df378f5c555f18ce48fb550ab07c85f779a31c60 | Add script to merge users with duplicate usernames | 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... | Python | 0.000001 | |
6c94617d8ea2b66bba6c33fdc9aa81c5161a53f8 | add yaml | 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"],... | Python | 0.000067 | |
78ea6bf390d2a2aa787c9bb37c12cf47a13357ce | Create marvin.py | marvin.py | marvin.py | """
Original code by Charles Leifer
https://github.com/coleifer/irc/blob/master/bots/markov.py
"""
#!/usr/bin/python
import os
import pickle
import random
import re
import sys
from irc import IRCBot, IRCConnection
class MarkovBot(IRCBot):
"""
Hacking on a markov chain bot - based on:
http://code.actives... | Python | 0.000001 | |
edbb41e1f897d5e0bab5460d971ffd5917e6d1e6 | add peer task | 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... | Python | 0 | |
9dcc635d0d5239928415ecab7a5ddb5387f98dea | add mail.py | 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)
| Python | 0.000002 | |
56ad587d21abe5251be5ce5fced8e42f1d89c2f4 | Create tutorial1.py | tutorial1.py | tutorial1.py | from ggame import App
myapp = App()
myapp.run()
| Python | 0 | |
83b3c5128d579cd23b4f81133175827adb8a92df | Send requests to ceilometer-api using multiple threads | ceilorunner.py | ceilorunner.py | #!/usr/bin/env python
from ceilometerclient.shell import CeilometerShell
from ceilometerclient import client as ceiloclient
from ceilometerclient.v2 import options
import threading
import argparse
import sys
import os
import time
import pdb
"""
Replace functions will call the non-printing version of functions
Add to p... | Python | 0 | |
ef8ad297634d2153d5a1675d7bb60b963f8c6abd | Add wrapper | 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... | Python | 0.000004 | |
e62a705d464df21098123ada89d38c3e3fe8ca73 | Define a channel interface | 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... | Python | 0.015718 | |
c19120e0123b76236d11f3523e2ebd64c00b9feb | Check import | homeassistant/components/thermostat/radiotherm.py | homeassistant/components/thermostat/radiotherm.py | """
homeassistant.components.thermostat.radiotherm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Adds support for Radio Thermostat wifi-enabled home thermostats.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/thermostat.radiotherm.html
"""
import loggin... | """
homeassistant.components.thermostat.radiotherm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Adds support for Radio Thermostat wifi-enabled home thermostats.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/thermostat.radiotherm.html
"""
import loggin... | Python | 0 |
10f7e5c8c1a2cdc84f706ccad041755b83c4953b | Create htmlsearch.py | 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']
'''
| Python | 0.00002 | |
46eb1c2d10316eae4d85b3d689307e32ed763d07 | add 6-17.py | 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... | Python | 0.998825 | |
7faff0ae9ea4b8d72b42d1af992bb4c72cc745ff | test program to immediately connect and disconnect | 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
| Python | 0 | |
5b6667de8b91232facec27bc11305513bb2ec3b3 | add demo tests for parameterization | 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... | Python | 0 | |
fe0acf649a8db08c0bafd00e76557e9b6020bc5a | Add example for spliting 2D variable from NetCDF | 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... | Python | 0 | |
4aecc9be1e2e8074a20606e65db3f9e6283eb8d3 | add utils | 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 | Python | 0.000004 | |
071aa9f5465847fdda517d1a78c37f1dbfe69f9f | test mock | 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()
| Python | 0.000002 | |
f3182c9651509d2e1009040601c23a78ed3e9b7c | Create laynger.py | 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
... | Python | 0.000001 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.