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 |
|---|---|---|---|---|---|---|---|---|
96451643294003992e6d73ec34876badae177ed8 | Add PULSE support | pebble/libpebble2 | libpebble2/communication/transports/pulse.py | libpebble2/communication/transports/pulse.py | from __future__ import absolute_import
__author__ = 'Liam McLoughlin'
import struct
try:
import pulse2
except ImportError:
pass
from . import BaseTransport, MessageTargetWatch
from libpebble2.exceptions import ConnectionError, PebbleError
class PULSETransport(BaseTransport):
"""
Represents a direct... | mit | Python | |
4fd03b93f7c2ff31b6a7ab6bf6d404cc579a6bf8 | Rewrite download_hash in Python (#5995) | kubernetes-incubator/kubespray,kubernetes-sigs/kubespray,Atoms/kubespray,kubernetes-incubator/kubespray,kubernetes-incubator/kargo,kubernetes-sigs/kubespray,kubernetes-sigs/kubespray,Atoms/kubespray,kubernetes-sigs/kubespray,Atoms/kubespray,Atoms/kubespray,kubernetes-incubator/kargo | scripts/download_hash.py | scripts/download_hash.py | #!/usr/bin/env python3
# After a new version of Kubernetes has been released,
# run this script to update roles/download/defaults/main.yml
# with new hashes.
import hashlib
import sys
import requests
from ruamel.yaml import YAML
MAIN_YML = "../roles/download/defaults/main.yml"
def open_main_yaml():
yaml = YAML... | apache-2.0 | Python | |
3b27b1d6b1c4739b8d456703542ec8182ce12277 | Add a Wordpress+MySQL composed instance functional test case | gonzolino/heat,noironetworks/heat,steveb/heat,cwolferh/heat-scratch,noironetworks/heat,gonzolino/heat,maestro-hybrid-cloud/heat,citrix-openstack-build/heat,pshchelo/heat,cryptickp/heat,dragorosson/heat,rh-s/heat,Triv90/Heat,steveb/heat,rh-s/heat,srznew/heat,srznew/heat,openstack/heat,redhat-openstack/heat,rickerc/heat_... | heat/tests/functional/test_WordPress_Composed_Instances.py | heat/tests/functional/test_WordPress_Composed_Instances.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# 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 applicabl... | apache-2.0 | Python | |
1172287e38f623994b039cea0dab36ea68d18471 | add RabbitService | lielongxingkong/ics_demo,lielongxingkong/ics_demo | ics_demo/remote_services/demo.py | ics_demo/remote_services/demo.py | from base import Service
from ics_demo.helpers.base import uuidgen
class RabbitService(Service):
def it_is_my_warren(self, name):
cmd = 'mkdir -p /tmp/%s' % name
self.remote_cmd_quiet(cmd)
def put_carrot_bucket_in_my_warren(self, rabbit):
cmd = 'mkdir /tmp/%s/carrots' % rabbit.name
... | mit | Python | |
8de10ac1bf133c41cc1d0e330714e1659e42b092 | add script to write consul-manager ip to a text file | samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur,samuelclay/NewsBlur | consul/get_consul_manager_ip.py | consul/get_consul_manager_ip.py |
import os
import digitalocean
TOKEN_FILE = "/srv/secrets-newsblur/keys/digital_ocean.token"
with open(TOKEN_FILE) as f:
token = f.read().strip()
os.environ['DO_API_TOKEN'] = token
manager = digitalocean.Manager(token=token)
my_droplets = manager.get_all_droplets()
consul_manager_droplet = [d for d in my_dro... | mit | Python | |
32f4055b52c8768c80cf82451f6ace74af600d0c | test new analyze rewrite | alexis-roche/nipy,alexis-roche/nireg,alexis-roche/register,alexis-roche/nipy,arokem/nipy,arokem/nipy,nipy/nireg,nipy/nipy-labs,bthirion/nipy,alexis-roche/register,bthirion/nipy,alexis-roche/niseg,bthirion/nipy,alexis-roche/nipy,alexis-roche/nipy,nipy/nireg,alexis-roche/register,arokem/nipy,bthirion/nipy,nipy/nipy-labs,... | lib/neuroimaging/refactoring/tests/test_analyze.py | lib/neuroimaging/refactoring/tests/test_analyze.py | import unittest
from neuroimaging.refactoring.analyze import AnalyzeImage
from neuroimaging.tests.data import repository
from neuroimaging.visualization.arrayview import arrayview
class AnalyzeImageTest(unittest.TestCase):
def setUp(self):
self.image = AnalyzeImage("rho", datasource=repository)
def t... | bsd-3-clause | Python | |
6feae8e14b4e690cb0d5c71880b9d6c167ac978b | add stub for a csv scraping script | texastribune/ipeds_reporter | ipeds_reporter/scripts/scrape.py | ipeds_reporter/scripts/scrape.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
WIP thing to scrape ipeds for me.
"""
from selenium import webdriver
def main():
driver = webdriver.Firefox()
driver.close()
if __name__ == '__main__':
main()
| apache-2.0 | Python | |
4241d67149887f8edc0636f7cb4fdbcb22e8e98b | Create repeatings.py | vladshults/python_modules,vladshults/python_modules | job_interview_algs/repeatings.py | job_interview_algs/repeatings.py | TEXT = """abba com mother bill mother com
abba dog abba mother com"""
def secuenced_words(txt):
"""
Function identifies and displays the three words
most often repeated as a group, regardless of the
words order in the group
"""
word_list = txt.split()
collector = dict()
fo... | mit | Python | |
3bd95d8789871246fb90c6eb0487d9746ef5cb27 | Migrate all project contents blocks to activity contents blocks | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/cms/migrations/0056_auto_20191106_1041.py | bluebottle/cms/migrations/0056_auto_20191106_1041.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-11-06 09:41
from __future__ import unicode_literals
from django.db import migrations
def migrate_project_blocks(apps, schema_editor):
ProjectsContent = apps.get_model('cms', 'ProjectsContent')
ActivitiesContent = apps.get_model('cms', 'ActivitiesC... | bsd-3-clause | Python | |
06570a926bde2ea10730062b05a2348c3020745c | Add example: filtered ensemble average. | cfe316/atomic,ezekial4/atomic_neu,ezekial4/atomic_neu | examples/filter_ensemble_average.py | examples/filter_ensemble_average.py | import numpy as np
import matplotlib.pyplot as plt
import atomic
from ensemble_average import time_dependent_power
if __name__ == '__main__':
times = np.logspace(-7, 0, 50)
temperature = np.logspace(0, 3, 50)
density = 1e19
from atomic.pec import TransitionPool
ad = atomic.element('argon')
t... | mit | Python | |
d9985ec4fa37cf99e0e541c7affadd5ec9288a0c | Create multithread.py | run-dong-zhu/Algorithms,run-dong-zhu/Algorithms,run-dong-zhu/Algorithms,run-dong-zhu/Algorithms | APIs/multithread.py | APIs/multithread.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 15 22:59:02 2018
@author: zhurundong
"""
import time
import requests
import asyncio
import aiohttp
from concurrent.futures import ThreadPoolExecutor
NUMBERS = range(12)
URL = 'http://httpbin.org/get?a={}'
# Get http requests results
def fetch(a):... | epl-1.0 | Python | |
93f6ebde39ef0538624ad3eb94316bf8bdf69fd9 | Create N_QueensII.py | UmassJin/Leetcode | Array/N_QueensII.py | Array/N_QueensII.py | Follow up for N-Queens problem.
Now, instead outputting board configurations, return the total number of distinct solutions.
class Solution:
# @param {integer} n
# @return {integer}
def totalNQueens(self, n):
if n == 0: return 0
self.result = 0 # Here we should use the global variable, o... | mit | Python | |
38b4ec7164f07af7135c41c401c4f403c1061d66 | Add skeleton for parsing commands | Zillolo/lazy-todo | app/main.py | app/main.py | """lazy
Usage:
lazy (new|n)
lazy (show|s) [<id>]
lazy (delete|d) [<id>]
lazy (import|i) <path>
lazy (export|e) <path> [<id>]
Options:
-h, --help: Show this help message.
"""
from docopt import docopt
def main():
# Parse commandline arguments.
args = docop... | mit | Python | |
b0f4a0abb74bc9f1cf97a49d4501c48d666b6dfe | add qt3 | tuttleofx/sconsProject | autoconf/qt3.py | autoconf/qt3.py | from _external import *
import os
def unique(list):
return dict.fromkeys(list).keys()
def subdirs(files):
dirs = unique(map(os.path.dirname, files))
dirs.sort()
return dirs
def locateQt3Command(env, command, bindir):
#print 'locateQt3Command:', command
suffixes = [
'-qt3',
'3',
'',
]
progs = [command+s... | mit | Python | |
3ed9dd0ca03216311771cda5f9cd3eb954a14d4f | Add boilerplate with simple test sounds | Parisson/Telemeta,Parisson/Telemeta,ANR-kamoulox/Telemeta,ANR-kamoulox/Telemeta,Parisson/Telemeta,ANR-kamoulox/Telemeta,ANR-kamoulox/Telemeta,Parisson/Telemeta | telemeta/management/commands/telemeta-test-boilerplate.py | telemeta/management/commands/telemeta-test-boilerplate.py | from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from django.template.defaultfilters import slugify
import os
from telemeta.models import *
from timeside.core.tools.test_samples import generat... | agpl-3.0 | Python | |
eeea573c3ecf6aa2baacdda61c0f9a248a28780f | add missing migration | DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative | ynr/apps/uk_results/migrations/0034_auto_20180130_1243.py | ynr/apps/uk_results/migrations/0034_auto_20180130_1243.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-01-30 12:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uk_results', '0033_auto_20170506_2042'),
]
operations = [
migrations.AlterM... | agpl-3.0 | Python | |
59f0a18b5232e866f84fdaf6688ced5a1b4a9c44 | Add fedora.tg.widgets module containing a few proof-of-concept Fedora TurboGears widgets | fedora-infra/python-fedora | fedora/tg/widgets.py | fedora/tg/widgets.py | # Proof-of-concept Fedora TurboGears widgets
# Authors: Luke Macken <lmacken@redhat.com>
import re
import urllib2
import feedparser
import simplejson
from bugzilla import Bugzilla
from turbogears.widgets import Widget
class FedoraPeopleWidget(Widget):
template = """
<table xmlns:py="http://purl.org/kid/ns... | lgpl-2.1 | Python | |
046922c6b842e5ba78fc44848ddf24e6434dd799 | Add related options to floating ip config options | vmturbo/nova,gooddata/openstack-nova,klmitch/nova,vmturbo/nova,gooddata/openstack-nova,rahulunair/nova,hanlind/nova,jianghuaw/nova,Juniper/nova,klmitch/nova,Juniper/nova,rajalokan/nova,mahak/nova,Juniper/nova,gooddata/openstack-nova,rajalokan/nova,rajalokan/nova,mahak/nova,Juniper/nova,jianghuaw/nova,openstack/nova,phe... | nova/conf/floating_ips.py | nova/conf/floating_ips.py | # Copyright 2016 Huawei Technology corp.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | # needs:fix_opt_description
# Copyright 2016 Huawei Technology corp.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/license... | apache-2.0 | Python |
efee783cb87fe2015ab719699e80a661aa3b4d4b | Create main.py | cmcguinness/focusstack | main.py | main.py | import os
import cv2
import FocusStack
"""
Focus stack driver program
This program looks for a series of files of type .jpg, .jpeg, or .png
in a subdirectory "input" and then merges them together using the
FocusStack module. The output is put in the file merged.png
Author: Charles McGuinnes... | apache-2.0 | Python | |
3e0ababfeb0e22d33853d4bad68a29a0249e1a60 | Add script demonstrating thread deadlock | h5py/h5py,h5py/h5py,h5py/h5py | other/iterate_deadlock.py | other/iterate_deadlock.py |
"""
Demonstrates deadlock related to attribute iteration.
"""
from threading import Thread
import h5py
FNAME = "deadlock.hdf5"
def make_file():
with h5py.File(FNAME,'w') as f:
for idx in xrange(1000):
f.attrs['%d'%idx] = 1
def list_attributes():
with h5py.File(FNAME, 'r') as f:
... | bsd-3-clause | Python | |
b1517f63c3aa549170d77c6fb3546901fdbe744b | Remove the hard-coded extra 'cv' and 'program' fields | datamade/yournextmp-popit,datamade/yournextmp-popit,datamade/yournextmp-popit,datamade/yournextmp-popit,datamade/yournextmp-popit | candidates/migrations/0017_remove_cv_and_program_fields.py | candidates/migrations/0017_remove_cv_and_program_fields.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('candidates', '0016_migrate_data_to_extra_fields'),
]
operations = [
migrations.RemoveField(
model_name='personex... | agpl-3.0 | Python | |
5789cc585a69f3c73e63a36d99c02b119f593bc9 | Create accelerometer.py | somchaisomph/RPI.GPIO.TH | gadgets/navigators/accelerometer.py | gadgets/navigators/accelerometer.py | from spi.rpi_spi import rpi_spi_dev
from spi.adc.MCP3208 import MCP3208
class ACCEL_GY61():
# use chip ADXL335
def __init__(self,device=0,x_channel=0,y_channel=1,z_channel=2):
self.spi = rpi_spi_dev(device).spi
self.mcp = None
if self.spi is not None:
self.mcp = MCP3208(self.spi)
self.vrx_channel = x_cha... | mit | Python | |
c0da1aecb6e663d9586238e9d8f2b7a8abb40cf7 | Add transform module to place ongoing built in transformmers | timothycrosley/hug,MuhammadAlkarouri/hug,MuhammadAlkarouri/hug,MuhammadAlkarouri/hug,timothycrosley/hug,timothycrosley/hug | hug/transform.py | hug/transform.py | """hug/transform.py
Defines Hug's built-in output transforming functions
Copyright (C) 2015 Timothy Edmund Crosley
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... | mit | Python | |
3ed52b0a51ccb18b053ca69984d8072e1ffdec25 | Add 328 | cyandterry/Python-Study | Ninja/Leetcode/328_Odd_Even_Linked_List.py | Ninja/Leetcode/328_Odd_Even_Linked_List.py | """
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.
You should try to do it in place. The program should run in O(1) space complexity and O(nodes) time complexity.
Example 1:
Input: 1->2->3->4->... | mit | Python | |
732852ae19d3e7edbbfda9394808ca245456a69b | complete re and datetime sample | r569594043/PythonBeginner | 08.StandardLibrary.py | 08.StandardLibrary.py | #-*- encoding: utf-8 -*-
'''
Python Standard Library
See Also: http://docs.python.org/3/library/index.html
'''
import re
'''
re
See Also: http://docs.python.org/3/library/re.html
'''
'''
m = re.search('H(.*?)o', 'I Say: Hello World Hello World Hello World')
if m:
print(m.group(0)) # Hello
print(... | apache-2.0 | Python | |
bbd43a3af7fdd5eacea13fae9c1670aa5436e7bc | add data not sufficient exception that shall be raised when data provided to a feature is not sufficient | DevMine/devmine-core | features/exception_data_not_suffient.py | features/exception_data_not_suffient.py | """This exception shall be raised in case the data provided to a feature is not
sufficient"""
class DataNotSufficientError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
| bsd-3-clause | Python | |
e41d4fa8a61126495dc5cc42575fa5ce5b89f1b7 | add spiel on whitespace | ireapps/coding-for-journalists,ireapps/coding-for-journalists,ireapps/coding-for-journalists | 1_start/whitespace.py | 1_start/whitespace.py | # FUN WITH WHITESPACE IN PYTHON
# Whitespace is critical in Python. Unlike some other scripting languages,
# which use characters to tell the interpreter where functions and loops
# end, Python uses structured indentation for new lines, making "blocks" of
# code.
my_string = 'New York'
print "Start spreading the ne... | mit | Python | |
9760f81ce6cc7783f8fb097931e98f8234307a00 | add nilearn interface for correlations | HBClab/NiBetaSeries,HBClab/NiBetaSeries | src/nibetaseries/interfaces/nilearn.py | src/nibetaseries/interfaces/nilearn.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from nipype.interfaces.nilearn import NilearnBaseInterface
from nipype.interfaces.base import (
BaseInterfaceInputSpec, TraitedSpec,
File, SimpleInterf... | mit | Python | |
eee7862cead703d11405276c1a399466c9f102c5 | add shell.py | lachie83/contrail-kubernetes,rombie/contrail-kubernetes,pedro-r-marques/contrail-kubernetes,lachie83/contrail-kubernetes,pedro-r-marques/contrail-kubernetes,pupapaik/contrail-kubernetes,Juniper/contrail-kubernetes,pedro-r-marques/contrail-kubernetes,WIZARD-CXY/contrail-kubernetes,Juniper/contrail-kubernetes,Juniper/con... | scripts/opencontrail-kubelet/opencontrail_kubelet/shell.py | scripts/opencontrail-kubelet/opencontrail_kubelet/shell.py | #
# Copyright (c) 2015 Juniper Networks, Inc.
#
import subprocess
import logging
class Shell:
# Run a shell command. Log the command run and its output.
@staticmethod
def run(str):
logging.debug('sh: %s' % str)
cmd = subprocess.check_output(str, shell=True)
logging.debug('output: %... | apache-2.0 | Python | |
73369f23bd008331884d5644ba9923aae4809756 | add offline db comparison tool | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/DEV/postgresql/compare_counts.py | scripts/DEV/postgresql/compare_counts.py | import psycopg2
oldpg = psycopg2.connect(database='postgis', host='localhost', port=5555, user='mesonet')
cursor = oldpg.cursor()
dbs = []
cursor.execute("""SELECT datname FROM pg_database
WHERE datistemplate = false ORDER by datname""")
for row in cursor:
dbs.append(row[0])
for db in dbs:
if db <= 'cscap':
... | mit | Python | |
b61a423497c21fa4df818c8b5e5eaea788eb84ea | add ia_cdx_checker | ianmilligan1/WAHR,web-archive-group/WAHR,ianmilligan1/WAHR,ianmilligan1/WAHR,web-archive-group/WAHR,web-archive-group/WAHR,web-archive-group/WAHR,ianmilligan1/WAHR,web-archive-group/WAHR | scripts/ia_cdx_checker/ia_cdx_checker.py | scripts/ia_cdx_checker/ia_cdx_checker.py | #!/usr/bin/env python
"""
$ python ia_cdx_checker.py elxn42-tweets-urls-fixed-uniq-no-count.txt | cat > elx42_urls_in_ia.txt
"""
from __future__ import print_function
import sys
import json
import fileinput
import io
from urllib2 import Request, urlopen, URLError, HTTPError
for line in fileinput.input():
elx42_u... | mit | Python | |
f468ddbcf6bc752a3a7af877f5453271f7f2ea45 | add model processor script | whitingjp/whitgl,whitingjp/whitgl,whitingjp/whitgl,whitingjp/whitgl | scripts/process_model.py | scripts/process_model.py | #!/usr/bin/python
import struct
import argparse
import sys
import os.path
def process_mtl(filename):
materials = []
file = open(filename)
for line in file:
tokens = line.split()
if(len(tokens) == 0):
continue
ident = tokens.pop(0)
if(ident == 'newmtl'):
m = {}
m['name'] = tokens[0]
m['outer'] =... | mit | Python | |
22ba7e7bfce711257f055733ecd260b8e61ced91 | Add example script to parse CapnProto traces | mdlui/Sigil2,mikelui/Sigil2,mdlui/Sigil2,mikelui/Sigil2,mikelui/Sigil2,VANDAL/sigil2,mdlui/Sigil2,VANDAL/sigil2,mikelui/Sigil2,VANDAL/sigil2,mdlui/Sigil2 | src/Backends/SynchroTraceGen/scripts/stgen_capnp_parser.py | src/Backends/SynchroTraceGen/scripts/stgen_capnp_parser.py | #!/bin/python
"""
This script demonstrates parsing a CapnProto SynchroTrace event trace.
The 'STEventTrace.capnp' file must exist in the sys.path.
Add its directory to the PYTHONPATH environmental variable or
copy it to the current working directory.
The pycapnp library is required:
See http://jparyani.github.io/pycap... | bsd-3-clause | Python | |
a1d2023aa6e8baa89747497e69a0a79fe1a27bdd | Drop ProjectPlan table | dropbox/changes,dropbox/changes,wfxiang08/changes,bowlofstew/changes,bowlofstew/changes,dropbox/changes,wfxiang08/changes,dropbox/changes,wfxiang08/changes,wfxiang08/changes,bowlofstew/changes,bowlofstew/changes | migrations/versions/36d7c98ddfee_drop_projectplan_table.py | migrations/versions/36d7c98ddfee_drop_projectplan_table.py | """Drop ProjectPlan table
Revision ID: 36d7c98ddfee
Revises: 12569fada93
Create Date: 2014-10-14 11:25:48.151275
"""
# revision identifiers, used by Alembic.
revision = '36d7c98ddfee'
down_revision = '12569fada93'
from alembic import op
def upgrade():
### commands auto generated by Alembic - please adjust! ##... | apache-2.0 | Python | |
730b208b490290c84bde8aa017a8f556d457d729 | add list to integer | dragonwolverines/DataStructures,dragonwolverines/DataStructures,dragonwolverines/DataStructures | resource-4/combinatorics/digits/list-to-integer.py | resource-4/combinatorics/digits/list-to-integer.py | def listToInt(listt,base=2):
return reduce(lambda x,y:base*x+y,reversed(listt), 0)
| bsd-2-clause | Python | |
61e16d12bcd945b44896e87bcb21ce750cd507e5 | Add `bindings` module | NicolasT/tee-n-splice | bindings.py | bindings.py | '''
Bindings to the `tee` and `splice` system calls
'''
import os
import ctypes
import ctypes.util
#pylint: disable=C0103,R0903,R0913
__all__ = ['tee', 'splice']
_c_loff_t = ctypes.c_uint64
_libc = ctypes.CDLL(ctypes.util.find_library('c'), use_errno=True)
class Tee(object):
'''Binding to `tee`'''
def __... | apache-2.0 | Python | |
5e3bc841800bb4e92df5871d97559810d67d7660 | Create __init__.py | lyelindustries/IPM | cmd/__init__.py | cmd/__init__.py | __version__ = '0.0.0'
| mit | Python | |
2acb5d6da30c9b25eb05ca7a0da77bdaa45499a5 | Create cod_variable.py | nrikee/Compresion-indices | cod_variable.py | cod_variable.py | def encode_single_vb(n):
byts = []
while True:
byts.append(n % 128)
if n < 128:
break
n //= 128
byts = byts[::-1]
byts[-1] += 128
return [bin(n)[2:] for n in byts]
def encode_vb(numbers):
bytestream = []
for n in numbers:
bytestream.extend(encode... | mit | Python | |
624c133ba1afdb904e31742ac5f00a76859ab5b7 | Write some docs for the response object | bufferapp/buffer-python,vtemian/buffpy | buffer/response.py | buffer/response.py | class ResponseObject(dict):
'''
Simple data structure that convert any dict to an empty object
where all the atributes are the keys of the dict, but also preserve a dict
behavior
e.g:
obj = ResponseObject({'a':'b'})
obj.key = 'value'
obj.a => 'b'
obj => {'a': 'b', 'key'... | class ResponseObject(dict):
def __init__(self, *args, **kwargs):
super(ResponseObject, self).__init__(*args, **kwargs)
self.__dict__ = self._check_for_inception(self)
def _check_for_inception(self, root_dict):
for key in root_dict:
if type(root_dict[key]) == dict:
root_dict[key] = Re... | mit | Python |
d22242bda1a15cf59e395177c44b6d2701a5e246 | add code to replicate issue #376 | mmottahedi/nilmtk,nilmtk/nilmtk,josemao/nilmtk,pauldeng/nilmtk,AlexRobson/nilmtk,jaduimstra/nilmtk,HarllanAndrye/nilmtk,nilmtk/nilmtk | tests_on_large_datasets/redd_house3_f1_score.py | tests_on_large_datasets/redd_house3_f1_score.py | from __future__ import print_function, division
from nilmtk import DataSet, HDFDataStore
from nilmtk.disaggregate import fhmm_exact
from nilmtk.metrics import f1_score
from os.path import join
import matplotlib.pyplot as plt
"""
This file replicates issue #376 (which should now be fixed)
https://github.com/nilmtk/nilm... | apache-2.0 | Python | |
80bf877306a78a63cf7752975f980a2d435f7d5e | Add standard services and lazy service wrapper | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | polyaxon/libs/services.py | polyaxon/libs/services.py | import inspect
import itertools
import logging
from django.utils.functional import empty, LazyObject
from libs.imports import import_string
logger = logging.getLogger(__name__)
class InvalidService(Exception):
pass
class Service(object):
__all__ = ()
def validate(self):
"""Validate the sett... | apache-2.0 | Python | |
e204dd02b44066b28d09c0143cdeec557ff420fd | add a module for effects that can be applied to waveforms | fretboardfreak/potty_oh,fretboardfreak/potty_oh | potty_oh/effects.py | potty_oh/effects.py | # Copyright 2016 Curtis Sand
#
# 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 writi... | apache-2.0 | Python | |
b9a8d24048a5c5b83a996f9fb1b2b07857a56db0 | unwind the changes to tracker main | moomou/heron,cs564/heron,srkukarni/heron,srkukarni/heron,objmagic/heron,wangli1426/heron,zhangzhonglai/heron,lewiskan/heron,streamlio/heron,huijunwu/heron,srkukarni/heron,zhangzhonglai/heron,lukess/heron,tomncooper/heron,nlu90/heron,ashvina/heron,tomncooper/heron,cs564/heron,nlu90/heron,streamlio/heron,twitter/heron,hu... | heron/tracker/src/python/main.py | heron/tracker/src/python/main.py | import os
import sys
import tornado.httpserver
import tornado.ioloop
import tornado.web
from tornado.escape import json_encode, utf8
from tornado.options import define, options
from heron.tracker.src.python import handlers
from heron.tracker.src.python import log
from heron.tracker.src.python.log import Log as LOG
fro... | import os
import sys
import tornado.httpserver
import tornado.ioloop
import tornado.web
from tornado.escape import json_encode, utf8
from tornado.options import define, options
from heron.tracker.src.python import handlers
from heron.tracker.src.python import log
from heron.tracker.src.python.log import Log as LOG
fro... | apache-2.0 | Python |
3a6d41d8123b27ca5b22f7d7630e40faef3595c1 | Add a top-level script that replaces the top-level makefile. | sbc100/nativeclient-sdk,sbc100/nativeclient-sdk,sbc100/nativeclient-sdk,sbc100/nativeclient-sdk,sbc100/nativeclient-sdk,sbc100/nativeclient-sdk,sbc100/nativeclient-sdk | examples/run.py | examples/run.py | #!/usr/bin/python
#
# Copyright 2010, The Native Client SDK Authors. All Rights Reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.
#
"""Build and run the SDK examples.
This script tries to find an installed version of the Chrome Browser that can
run the SD... | bsd-3-clause | Python | |
451e8f3ea4765051088ea1c84f81e32691591d89 | Create __init__.py | simonlovgren/maustrobot | core/__init__.py | core/__init__.py | #!/usr/bin/env python
| mit | Python | |
65aa1424f7ea8e184180d93e790b1ece6705775d | fix missing coma | ccomb/OpenUpgrade,wangjun/odoo,dsfsdgsbngfggb/odoo,dezynetechnologies/odoo,NL66278/OCB,BT-rmartin/odoo,havt/odoo,florentx/OpenUpgrade,bkirui/odoo,funkring/fdoo,gorjuce/odoo,apanju/GMIO_Odoo,massot/odoo,demon-ru/iml-crm,grap/OpenUpgrade,jiachenning/odoo,makinacorpus/odoo,eino-makitalo/odoo,highco-groupe/odoo,JCA-Develop... | addons/purchase_requisition/__openerp__.py | addons/purchase_requisition/__openerp__.py | ##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | ##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | agpl-3.0 | Python |
72738366fa074b457021faab0c21c3b89070b5ad | Add first revision of Nautilus extension. | wizbit-archive/wizbit,wizbit-archive/wizbit | nautilus/wizbit-extension.py | nautilus/wizbit-extension.py | from urlparse import urlparse
from os.path import exists, split, isdir
import nautilus
from lxml import etree
WIZ_CONTROLLED = "wiz-controlled"
WIZ_CONFLICT = "wiz-conflict"
YES = "Yes"
NO = "No"
class WizbitExtension(nautilus.ColumnProvider, nautilus.InfoProvider):
def __init__(self):
pass
def get... | lgpl-2.1 | Python | |
2a9858381a78bd9ff9ff459a23f73630237e6669 | send vm | Heipiao/weibo,Heipiao/weibo | weibo_data_input.py | weibo_data_input.py | __author__ = 'heipiao'
# -*- coding: utf-8 -*-
from weibo import APIClient
import urllib2
import urllib
#APP_KEY和APP_SECRET,需要新建一个微博应用才能得到
APP_KEY = '3722673574'
APP_SECRET = '7a6de53498caf87e655a98fa2f8912bf'
#管理中心---应用信息---高级信息,将"授权回调页"的值改成https://api.weibo.com/oauth2/default.html
CALLBACK_URL = 'https://api.weibo.c... | mit | Python | |
7b899fbcf7a661758ab2a9cdca7ade6c461c8e65 | add c model | Oscarlight/PiNN_Caffe2,Oscarlight/PiNN_Caffe2,Oscarlight/PiNN_Caffe2,Oscarlight/PiNN_Caffe2 | transiNXOR_modeling/caffe2_tensor_to_c_array.py | transiNXOR_modeling/caffe2_tensor_to_c_array.py | import sys
sys.path.append('../')
import caffe2_paths
from caffe2.python import workspace
from pinn import exporter
from scipy.io import savemat
import numpy as np
import pickle
model_name = 'bise_h216_0'
init_net = exporter.load_init_net('./transiXOR_Models/'+model_name+'_init')
print(type(init_net))
with open("c_mo... | mit | Python | |
7be9e42f6c870004a5aa9b123b9f28c8f95f5b88 | Add Parser to analyse the results of the network tester. | TimothyGu/libilbc,ShiftMediaProject/libilbc,TimothyGu/libilbc,TimothyGu/libilbc,TimothyGu/libilbc,ShiftMediaProject/libilbc,TimothyGu/libilbc,ShiftMediaProject/libilbc,ShiftMediaProject/libilbc,ShiftMediaProject/libilbc | webrtc/tools/network_tester/parse_packet_log.py | webrtc/tools/network_tester/parse_packet_log.py | # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing proje... | bsd-3-clause | Python | |
f3cab8d72b9a070305f4f2c44922e381ea091205 | add context manager example | h2non/riprova | examples/context_manager.py | examples/context_manager.py | # -*- coding: utf-8 -*-
import riprova
# Store number of function calls for error simulation
calls = 0
# Register retriable operation with custom evaluator
def mul2(x):
global calls
if calls < 4:
calls += 1
raise RuntimeError('simulated call error')
return x * 2
# Run task via context... | mit | Python | |
24cf3c2676e4ea7342e95e6a37857c6fa687865e | Remove managers for article obj. | BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway | src/submission/migrations/0058_auto_20210812_1254.py | src/submission/migrations/0058_auto_20210812_1254.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-08-12 12:54
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('submission', '0057_merge_20210811_1506'),
]
operations = [
migrations.AlterModelMa... | agpl-3.0 | Python | |
9687ca646dd7ae5a7ff31e5b8657fb1ab88a0f5e | add buildbot | steinwurf/bourne,steinwurf/bourne | buildbot.py | buildbot.py | #!/usr/bin/env python
# encoding: utf-8
import sys
import json
import subprocess
project_name = 'bourne'
def run_command(args):
print("Running: {}".format(args))
# sys.stdout.flush()
# subprocess.check_call(args)
def get_tool_options(properties):
options = []
if 'tool_options' in properties:
... | bsd-3-clause | Python | |
0f6866a91e4d8af2faedf2af277ad0df573536aa | Set win_delay_load_hook to false | atom/node-runas,dbkaplun/node-runas,dustinblackman/node-runas,dbkaplun/node-runas,dustinblackman/node-runas,pombredanne/node-runas,atom/node-runas,pombredanne/node-runas | binding.gyp | binding.gyp | {
'target_defaults': {
'win_delay_load_hook': 'false',
'conditions': [
['OS=="win"', {
'msvs_disabled_warnings': [
4530, # C++ exception handler used, but unwind semantics are not enabled
4506, # no definition for inline function
],
}],
],
},
'targets'... | {
'target_defaults': {
'conditions': [
['OS=="win"', {
'msvs_disabled_warnings': [
4530, # C++ exception handler used, but unwind semantics are not enabled
4506, # no definition for inline function
],
}],
],
},
'targets': [
{
'target_name': 'runa... | mit | Python |
0d6da71cb759c3819133baa3d7c043fb92df425e | Create weibo.py | sanbaideng/GetWeiboInfoByPython | 2/weibo.py | 2/weibo.py | from bs4 import BeautifulSoup
import json
import ConfigParser
import urllib2
from util import get_content
link_id = 18
cf = ConfigParser.ConfigParser()
cf.read("config.ini")
weiyinUrl = 'http://wb.weiyin.cc/Book/BookView/W440164363452#' + str(link_id)
content = urllib2.urlopen(weiyinUrl)
html = content.read()
sou... | mit | Python | |
666caee40af2dccc30e78d52f8de962110408146 | Add fan device | XKNX/xknx,XKNX/xknx | xknx/devices/fan.py | xknx/devices/fan.py | """
Module for managing a fan via KNX.
It provides functionality for
* setting fan to specific speed
* reading the current speed from KNX bus.
"""
import asyncio
from .device import Device
from .remote_value_scaling import RemoteValueScaling
class Fan(Device):
"""Class for managing a fan."""
# pylint: disab... | mit | Python | |
eefa144b7a01f6beee1fcba30af32a967598d44f | add tests | sxslex/tabela_fipe,sxslex/tabela_fipe | tests/test_tabela_fipe.py | tests/test_tabela_fipe.py | # -*- coding: utf-8 -*-
#
# Copyright 2015 Alexandre Villela (SleX) <https://github.com/sxslex/sxtools/>
#
# This program 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 ... | apache-2.0 | Python | |
a467cf8e92a783112bcecc82acf7b33c31282c49 | Bump to 3.2.0.rc2 | jsma/django-cms,nimbis/django-cms,netzkolchose/django-cms,FinalAngel/django-cms,iddqd1/django-cms,FinalAngel/django-cms,mkoistinen/django-cms,netzkolchose/django-cms,keimlink/django-cms,nimbis/django-cms,rsalmaso/django-cms,timgraham/django-cms,dhorelik/django-cms,yakky/django-cms,datakortet/django-cms,vxsx/django-cms,... | cms/__init__.py | cms/__init__.py | # -*- coding: utf-8 -*-
__version__ = '3.2.0.rc2'
default_app_config = 'cms.apps.CMSConfig'
| # -*- coding: utf-8 -*-
__version__ = '3.2.0.dev4'
default_app_config = 'cms.apps.CMSConfig'
| bsd-3-clause | Python |
68a7f9faf1933bb224113d9fa5d0ddd362b2e5ea | Add script to generate the site documentation containing the sizes of the binary shellcodes. | computerline1z/win-exec-calc-shellcode,computerline1z/win-exec-calc-shellcode,ohio813/win-exec-calc-shellcode,ohio813/win-exec-calc-shellcode | SizeDocGenerator.py | SizeDocGenerator.py | import os, re;
# I got the actual size of the binary code wrong on the site once - this script should help prevent that.
dsDoc_by_sArch = {"w32": "x86", "w64": "x64", "win": "x86+x64"};
with open("build_info.txt", "rb") as oFile:
iBuildNumber = int(re.search(r"build number\: (\d+)", oFile.read(), re.M).group(1)... | bsd-3-clause | Python | |
d59b7d8ea46d86169ffc9423de0a88b9c7c64774 | Create BalanceData.py | vidhyal/WitchMusic | Scikit/BalanceData.py | Scikit/BalanceData.py | #Copyright (c) 2016 Vidhya, Nandini
import os
import numpy as np
import operator
from constants import *
FIX_DEV = 0.00000001
rootdir = os.getcwd()
newdir = os.path.join(rootdir,'featurefiles')
def LoadData():
data_file = open(os.path.join(newdir,'out_2.txt'),'r')
unprocessed_data = data_file.readlines()
... | mit | Python | |
45b77de143a6ffcc46091d7879da4fa3009bc3e0 | add jm client | Zex/juicemachine,Zex/juicemachine,Zex/juicemachine | python/jm_client.py | python/jm_client.py | #!/usr/bin/python
#
# jm_client.py
#
# Author: Zex <top_zlynch@yahoo.com>
#
import dbus
import dbus.service
import dbus.mainloop.glib
import gobject
from basic import *
def start_request():
"""
Start sending requests to server
"""
connection = dbus.SessionBus()
obj = connection.get_object(
... | mit | Python | |
4ea6def1bdeb332b1f530f359a333e4f95078b2b | Update docstrings and link to docs | xifle/home-assistant,hmronline/home-assistant,jnewland/home-assistant,florianholzapfel/home-assistant,betrisey/home-assistant,badele/home-assistant,tinloaf/home-assistant,miniconfig/home-assistant,aoakeson/home-assistant,florianholzapfel/home-assistant,justyns/home-assistant,nkgilley/home-assistant,ct-23/home-assistant... | homeassistant/components/updater.py | homeassistant/components/updater.py | """
homeassistant.components.updater
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Component that checks for available updates.
For more details about this platform, please refer to the documentation at
at https://home-assistant.io/components/updater/
"""
import logging
import requests
from homeassistant.const import __version__... | """
homeassistant.components.sensor.updater
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sensor that checks for available updates.
For more details about this platform, please refer to the documentation at
at https://home-assistant.io/components/sensor.updater/
"""
import logging
import requests
from homeassistant.const imp... | apache-2.0 | Python |
3c65f2c4d7e40d55f5afae22c7912bba7d3eef7b | add french version | twidi/pytimeago | pytimeago/french.py | pytimeago/french.py | # -*- coding: utf-8 -*-
# pytimeago -- library for rendering time deltas
# Copyright (C) 2006 Adomas Paltanavicius
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 ... | lgpl-2.1 | Python | |
01653b1130934b809816f7a5ad3c4b8c73d8d411 | Add a tool to fix (some) errors reported by gn gen --check. | TimothyGu/libilbc,ShiftMediaProject/libilbc,TimothyGu/libilbc,ShiftMediaProject/libilbc,TimothyGu/libilbc,TimothyGu/libilbc,TimothyGu/libilbc,ShiftMediaProject/libilbc,ShiftMediaProject/libilbc,ShiftMediaProject/libilbc | tools/gn_check_autofix.py | tools/gn_check_autofix.py | #!/usr/bin/env python
# Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All ... | bsd-3-clause | Python | |
7084442bb78098f05acbe3243231243543061bf6 | Create gloabl_moran.py | jamaps/arcpy_scripts | gloabl_moran.py | gloabl_moran.py | import arcpy
arcpy.env.workspace = r"C:\Users\allenje4\Desktop\GGRC32 Lab 4 Files\GGRC32 Lab 4 Files\Local Statistics Data"
m =
arcpy.SpatialAutocorrelation_stats("pop_sci.shp", "PDens2011","NO_REPORT", "CONTIGUITY_EDGES_CORNERS", "#",)
| mit | Python | |
bbc208548f0dd381f3045d24db3c21c4c8ee004e | Test all sensors at once | mmewen/UTSEUS-Binky,mmewen/UTSEUS-Binky,mmewen/UTSEUS-Binky,mmewen/UTSEUS-Binky,mmewen/UTSEUS-Binky | grovepi/scan.py | grovepi/scan.py | import time
import grove_i2c_temp_hum_mini # temp + humidity
import hp206c # altitude + temp + pressure
import grovepi # used by air sensor and dust sensor
import atexit # used for the dust sensor
import json
# Initialize the sensors
t= grove_i2c_temp_hum_mini.th02()
h= hp206c.hp206c()
grovepi.dust_sensor_en()
air_se... | mit | Python | |
c834082c59abe6ae6d2e065e1a5afac2d399a612 | Add unittests for the bridgedb.crypto module. | mmaker/bridgedb,pagea/bridgedb,mmaker/bridgedb,wfn/bridgedb,pagea/bridgedb,wfn/bridgedb | lib/bridgedb/test/test_crypto.py | lib/bridgedb/test/test_crypto.py | # -*- coding: utf-8 -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org>
# please also see AUTHORS file
# :copyright: (c) 2013, Isis Lovecruft
# (c) 2007-2013, The Tor Project, Inc.
# (c) 2007-201... | bsd-3-clause | Python | |
8373de2daf5c44c069b9312ad3a3b21e2f5c21e3 | Implement channel mode +l | ElementalAlchemist/txircd,Heufneutje/txircd,DesertBus/txircd | txircd/modules/cmode_l.py | txircd/modules/cmode_l.py | from twisted.words.protocols import irc
from txircd.modbase import Mode
class LimitMode(Mode):
def checkSet(self, user, target, param):
intParam = int(param)
if str(intParam) != param:
return False
return (intParam >= 0)
def commandPermission(self, user, cmd, data):
if cmd != "JOIN":
return data
ta... | bsd-3-clause | Python | |
a24844a20634354167511163870438c36581c656 | Add py-hpack (#19189) | LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/py-hpack/package.py | var/spack/repos/builtin/packages/py-hpack/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyHpack(PythonPackage):
"""Pure-Python HPACK header compression"""
homepage = "https:... | lgpl-2.1 | Python | |
5ed57df8d1e3b85bc27d5a834c9ec35b18055ba9 | Create codility.py | maxmedina05/gossip-algo,maxmedina05/gossip-algo,maxmedina05/gossip-algo | codility.py | codility.py | #lesson 1
def solution(N):
bstr = dectoBin(N)
arr = []
cnt = 0
for b in bstr:
if b == '0':
cnt = cnt + 1
if b != '0':
arr.append(cnt)
cnt = 0
return getMax(arr)
def dectoBin(N):
bstr = ""
while N > 0:
bstr = str(N % 2) + bstr
... | mit | Python | |
955bca3beb7808636a586bed43c37e5f74fba17f | Add Weather class (use forecastio, geopy) - forecase(current/daily) | DongjunLee/kino-bot | kino/functions/weather.py | kino/functions/weather.py | # -*- coding: utf-8 -*-
import datetime
import forecastio
from geopy.geocoders import GoogleV3
from kino.template import MsgTemplate
from slack.slackbot import SlackerAdapter
from utils.config import Config
class Weather(object):
def __init__(self):
self.config = Config()
self.slackbot = Slacker... | mit | Python | |
1005f983774392306ca10e5fb12b59eeb63a88c4 | add remote file inclusion exploit | UMD-SEAM/bugbox,UMD-SEAM/bugbox,UMD-SEAM/bugbox,UMD-SEAM/bugbox,UMD-SEAM/bugbox,UMD-SEAM/bugbox,UMD-SEAM/bugbox | framework/Exploits/OSVDB_82707_D.py | framework/Exploits/OSVDB_82707_D.py |
# Copyright 2013 University of Maryland. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE.TXT file.
import framework
import time
import selenium.common.exceptions
class Exploit (framework.Exploit):
attributes = {'Name' ... | bsd-3-clause | Python | |
2c1b393c347ffcf24d9584be800378a1b77fa86d | add example to test error handling | JohnLunzer/flexx,zoofIO/flexx,jrversteegh/flexx,JohnLunzer/flexx,zoofIO/flexx,JohnLunzer/flexx,jrversteegh/flexx | flexx/ui/examples/errors.py | flexx/ui/examples/errors.py | """
App that can be used to generate errors on the Python and JS side. These
errors should show tracebacks in the correct manner (and not crash the app
as in #164).
To test thoroughly, you should probably also set the foo and bar
properties from the Python and JS console.
"""
from flexx import app, event, ui
class ... | bsd-2-clause | Python | |
331308eedd37628f5419001fc48fc5a328c1bab9 | Add test_jsc | orezpraw/unnaturalcode,naturalness/unnaturalcode,naturalness/unnaturalcode,naturalness/unnaturalcode,naturalness/unnaturalcode,orezpraw/unnaturalcode,naturalness/unnaturalcode,naturalness/unnaturalcode,orezpraw/unnaturalcode,orezpraw/unnaturalcode,naturalness/unnaturalcode,orezpraw/unnaturalcode,orezpraw/unnaturalcode,... | unnaturalcode/test_jsc.py | unnaturalcode/test_jsc.py | #!/usr/bin/python
# Copyright 2017 Dhvani Patel
#
# This file is part of UnnaturalCode.
#
# UnnaturalCode 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 Licen... | agpl-3.0 | Python | |
a6495a05d4652beeefca9e383f5dd7b8fc4246d7 | Create simple_fun_91:unique_digit_products.py | Orange9000/Codewars,Orange9000/Codewars | Solutions/simple_fun_91:unique_digit_products.py | Solutions/simple_fun_91:unique_digit_products.py | from operator import mul
def unique_digit_products(a):
return len({reduce(mul, map(int, str(x))) for x in a})
| mit | Python | |
371545ecae0296f9274319c971be1378c3dafbbe | Add migration | theirc/ServiceInfo,theirc/ServiceInfo,theirc/ServiceInfo,theirc/ServiceInfo,theirc/ServiceInfo-ircdeploy | services/migrations/0036_auto_20150327_1434.py | services/migrations/0036_auto_20150327_1434.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('services', '0035_auto_20150325_1637'),
]
operations = [
migrations.AddField(
model_name='jiraupdaterecord',
... | bsd-3-clause | Python | |
7d061e698788a60f0e3b59559961408015d891ed | Add first iteration of message_producer | jdgillespie91/trackerSpend,jdgillespie91/trackerSpend | utils/message_producer.py | utils/message_producer.py | import argparse
import pika
def send_message(queue, body=None):
"""
Sends a message to the specified queue with specified body if applicable.
:param queue: Name of queue.
:type queue: str
:param body: Content of message body in the form "{'key': 'value'}".
:type body: str
"""
connecti... | mit | Python | |
49614576524e74cb2e8eaa6656c1e86bf546c8e6 | Create keystone_test.py | OpenAcademy-OpenStack/DorisXue | keystone_test.py | keystone_test.py | import keystoneclient.v2_0.client as ksclient
import novaclient.v1_1.client as nvclient
from novaclient import client as novaclient
import glanceclient
import os
def get_keystone_creds():
d = {}
d['username'] = 'admin'
d['password'] = 'password'
d['auth_url'] = 'http://10.0.2.15:5000/v2.0/'
d['tena... | apache-2.0 | Python | |
6789f2ea1862f4c30e8d60bd0b47640b7e5835c1 | Add script to count labels in a data set | NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts | count_labels.py | count_labels.py | """Count HEEM labels in data set.
Usage: python count_labels.py <dir with train and test files>
"""
import codecs
from glob import glob
import numpy as np
import argparse
from collections import Counter
def load_data(data_file):
data = [ln.rsplit(None, 1) for ln in open(data_file)]
X_data, Y_data = zip(*dat... | apache-2.0 | Python | |
f1e08341a6b9f8bf137c1642debe3d3eda4b2cdf | Add utility to load env from config file | cancerregulome/gidget,cancerregulome/gidget,cancerregulome/gidget | gidget/util/load_path_config.py | gidget/util/load_path_config.py | #!/usr/bin/env python
import os
from os.path import join as pthJoin
from ConfigParser import SafeConfigParser
import sys
from pipeline_util import expandPath as pthExpanded
COMMANDS_DIR = 'commands'
# mini spec that maps from config lines to gidget env var names
# [ (section, [ (option_name, env_name) ] ) ]
optionM... | mit | Python | |
2c4a2368d2dc1c6ee910358fedd6e85cdf4f043a | Add test from jasmine-core | jasmine/jasmine-py,jasmine/jasmine-py,jasmine/jasmine-py | test/jasmine_core_test.py | test/jasmine_core_test.py | from pytest import raises
import pytest
import subprocess
from jasmine_core import Core
import os
import pkg_resources
notwin32 = pytest.mark.skipif("sys.platform == 'win32'")
@notwin32
def test_js_files():
files = [
'jasmine.js',
'jasmine-html.js',
'json2.js',
'boot.js'
]
... | mit | Python | |
7b5b4fdf8d5801d6e87d1b39f46a5f868aa07110 | Add test | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | tests/cupy_tests/test_typing.py | tests/cupy_tests/test_typing.py | import cupy
class TestClassGetItem:
def test_class_getitem(self):
from typing import Any
cupy.ndarray[Any, Any]
| mit | Python | |
a9609a500a65cc0efb787f5d90e164bd6fa48c1a | Print the left view of a BST | arunkumarpalaniappan/algorithm_tryouts | leftViewofBST.py | leftViewofBST.py | class BST:
def __init__(self,val):
self.left = None
self.right = None
self.data = val
def insertToBst(root,value):
if root is None:
root = value
else:
if value.data < root.data:
if root.left is None:
root.left = value
else:
... | mit | Python | |
08e7103766ce684e849f23fac77792876fded586 | fix helper to use the actual lines form ceph.conf | guits/ceph-ansible,travmi/ceph-ansible,albertomurillo/ceph-ansible,jsaintrocc/ceph-ansible,WingkaiHo/ceph-ansible,albertomurillo/ceph-ansible,travmi/ceph-ansible,WingkaiHo/ceph-ansible,bengland2/ceph-ansible,fgal/ceph-ansible,guits/ceph-ansible,jsaintrocc/ceph-ansible,font/ceph-ansible,jtaleric/ceph-ansible,fgal/ceph-a... | tests/functional/tests/mon/test_initial_members.py | tests/functional/tests/mon/test_initial_members.py | import pytest
uses_mon_initial_members = pytest.mark.skipif(
'mon_initial_members' not in pytest.config.slaveinput['node_config']['components'],
reason="only run in monitors configured with initial_members"
)
class TestMon(object):
def get_line_from_config(self, string, conf_path):
with open(c... | import pytest
uses_mon_initial_members = pytest.mark.skipif(
'mon_initial_members' not in pytest.config.slaveinput['node_config']['components'],
reason="only run in monitors configured with initial_members"
)
class TestMon(object):
def get_line_from_config(self, string, conf_path):
with open(c... | apache-2.0 | Python |
5fad9d4fb60eb29d04d8d6a7fd967aad67ca28e2 | Create __init__.py | sheepeatingtaz/django-pagination-bootstrap,sheepeatingtaz/django-pagination-bootstrap,staticdev/django-pagination-bootstrap,staticdev/django-pagination-bootstrap | pagination_bootstrap/__init__.py | pagination_bootstrap/__init__.py | mit | Python | ||
379d2953c90610a48eb80d1cabedb63b8f948813 | Use `for_app` helper | scorphus/thefuck,mlk/thefuck,Clpsplug/thefuck,nvbn/thefuck,Clpsplug/thefuck,SimenB/thefuck,SimenB/thefuck,mlk/thefuck,scorphus/thefuck,nvbn/thefuck | thefuck/rules/fab_command_not_found.py | thefuck/rules/fab_command_not_found.py | from thefuck.utils import eager, get_closest, for_app
@for_app('fab')
def match(command):
return 'Warning: Command(s) not found:' in command.stderr
# We need different behavior then in get_all_matched_commands.
@eager
def _get_between(content, start, end=None):
should_yield = False
for line in content.s... | from thefuck.utils import eager, get_closest
def match(command):
return (command.script_parts[0] == 'fab'
and 'Warning: Command(s) not found:' in command.stderr)
# We need different behavior then in get_all_matched_commands.
@eager
def _get_between(content, start, end=None):
should_yield = False... | mit | Python |
df777bf0771fdd8aadfbb26fe13b51692f4c161d | Add autogen package (#3542) | LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,lgarren/spack,tmerrick1/spack,skosukhin/spack,EmreAtes/spack,TheTimmy/spack,matthiasdiener/spack,iulian787/spack,tmerrick1/spack,matthiasdiener/spack,TheTimmy/spack,mfherbst/spack,TheTimmy/spack,tmerrick1/spack,EmreAtes/spack,EmreAtes/spack,matthiasdiener/spack,iuli... | var/spack/repos/builtin/packages/autogen/package.py | var/spack/repos/builtin/packages/autogen/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
cbbf9f34d08897358023078d81be3fa798601b02 | add the repl.py | mitodl/bootcamp-ecommerce,mitodl/bootcamp-ecommerce,mitodl/bootcamp-ecommerce,mitodl/bootcamp-ecommerce | repl.py | repl.py | #!/usr/bin/env python3
"""Run Django shell with imported modules"""
if __name__ == "__main__":
import os
if not os.environ.get("PYTHONSTARTUP"):
from subprocess import check_call
import sys
base_dir = os.path.dirname(os.path.abspath(__file__))
sys.exit(
check_call(... | bsd-3-clause | Python | |
21799cbe81c57f80f66cb5a90992d6ff66c31e2d | Create new package. (#5919) | LLNL/spack,tmerrick1/spack,tmerrick1/spack,tmerrick1/spack,lgarren/spack,lgarren/spack,lgarren/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,matthiasdiener/spack,skosukhin/spack,krafczyk/spack,LLNL/spack,mfherbst/spack,lgarren/spack,matthiasdiener/spack,mfherbst/spack,iulian787/spack,LLNL/spack,skosu... | var/spack/repos/builtin/packages/r-hmisc/package.py | var/spack/repos/builtin/packages/r-hmisc/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
cf7c33e3b3d733f24376badac70392ecb5f5a323 | add more tests | objectified/vdist,objectified/vdist | tests/test_build_definitions.py | tests/test_build_definitions.py | from vdist.builder import Build
from vdist.source import git, directory, git_directory
def test_build_projectroot_from_uri():
build = Build(
name='my build',
app='myapp',
version='1.0',
source=git(
uri='https://github.com/objectified/vdist',
branch='release-... | mit | Python | |
e19097216c090c0e3f4b68c743d6427f012ab69e | Add migration for legislator change | texastribune/txlege84,texastribune/txlege84,texastribune/txlege84,texastribune/txlege84 | txlege84/legislators/migrations/0004_auto_20141201_1604.py | txlege84/legislators/migrations/0004_auto_20141201_1604.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('legislators', '0003_auto_20141120_1731'),
]
operations = [
migrations.AlterField(
model_name='legislator',
... | mit | Python | |
01327c49590641c8fe918d91a7877aa67fd56e88 | Add lc0172_factorial_trailing_zeroes.py | bowen0701/algorithms_data_structures | lc0172_factorial_trailing_zeroes.py | lc0172_factorial_trailing_zeroes.py | """Leetcode 172. Factorial Trailing Zeroes
Easy
URL: https://leetcode.com/problems/factorial-trailing-zeroes/
Given an integer n, return the number of trailing zeroes in n!.
Example 1:
Input: 3
Output: 0
Explanation: 3! = 6, no trailing zero.
Example 2:
Input: 5
Output: 1
Explanation: 5! = 120, one trailing zero.
N... | bsd-2-clause | Python | |
6a9b224834d1a523b03ce1e7c6ff4fa3ccea2583 | Add tests for parse_utils.extract_tables. | MattOates/pgcli,lk1ngaa7/pgcli,suzukaze/pgcli,TamasNo1/pgcli,darikg/pgcli,nosun/pgcli,thedrow/pgcli,johshoff/pgcli,thedrow/pgcli,j-bennet/pgcli,nosun/pgcli,koljonen/pgcli,janusnic/pgcli,bitmonk/pgcli,w4ngyi/pgcli,bitemyapp/pgcli,yx91490/pgcli,TamasNo1/pgcli,zhiyuanshi/pgcli,koljonen/pgcli,j-bennet/pgcli,zhiyuanshi/pgcl... | tests/test_parse_utils.py | tests/test_parse_utils.py | from pgcli.packages.parseutils import extract_tables
def test_simple_select_single_table():
tables = extract_tables('select * from abc')
assert tables == ['abc']
def test_simple_select_multiple_tables():
tables = extract_tables('select * from abc, def')
assert tables == ['abc', 'def']
def test_simple... | bsd-3-clause | Python | |
897843932937faa841220cde90bdc89603d95615 | Solve hackerrank linked list problem | honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice | hackerrank/linked-list/dedup.py | hackerrank/linked-list/dedup.py | # https://www.hackerrank.com/challenges/delete-duplicate-value-nodes-from-a-sorted-linked-list/problem
def RemoveDuplicates(head):
if head is None:
return None
curr = head
while curr.next is not None:
currentData = curr.data
next = curr.next;
nextData = next.data
... | mit | Python | |
7a25a38d7b53da6aadf5b0d45aa9aefdb639ae81 | Add python sample library | hughdavenport/rails-hmac-api,hughdavenport/rails-hmac-api,hughdavenport/rails-hmac-api,hughdavenport/rails-hmac-api | test.py | test.py | from datetime import datetime
from time import mktime
from wsgiref.handlers import format_date_time
from requests.auth import AuthBase
from base64 import b64encode
from urllib import urlencode
from urlparse import urlparse, parse_qs, ParseResult
import re
import requests
import hashlib
import hmac
public_token = "Ch7/... | mit | Python | |
b3a20379162a068cc8f9a0f314a21a46ec40e4c6 | Add simple unit test for snapshot iteration class | micxer/fix-time-machine-freenas | test.py | test.py | #!/usr/bin/env python
import unittest
from fix_time_machine_backup import SnapshotList
class TestSnapshotList(unittest.TestCase):
def setUp(self):
self.snapshot_list = SnapshotList([
'auto-20160820.2103-2m',
'auto-20160821.0003-2m',
'auto-20160821.1503-2m',
... | bsd-3-clause | Python | |
aaea97c5cab778174b45cb2557d819deb769a45e | Create instagram_checker.py | AlanBaumgartner/instagram_checker | instagram_checker.py | instagram_checker.py | import requests, argparse, sys
class checker:
def __init__(self):
#Declare some variables
self.headers = {'User-agent': 'Mozilla/5.0'}
self.loginurl = 'https://www.instagram.com/accounts/login/ajax/'
self.url = 'https://www.instagram.com/'
#Start a session and update heade... | mit | Python | |
16aa4a292fafa2a74f668a56c5cf1a66f923df24 | Make src.cm.tools a package | cc1-cloud/cc1,cc1-cloud/cc1,cc1-cloud/cc1,cc1-cloud/cc1 | src/cm/tools/__init__.py | src/cm/tools/__init__.py | """@package cm.tools
@date Jun 6, 2014
@author Zosia Sobocińska
"""
| apache-2.0 | Python | |
519d6052e3bf16c8028d39eab374cd2aa17ffd4e | add position field to user committee | dhosterman/hebrew_order_david,dhosterman/hebrew_order_david,dhosterman/hebrew_order_david | application/migrations/0014_usercommittee_position.py | application/migrations/0014_usercommittee_position.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('application', '0013_auto_20150313_2126'),
]
operations = [
migrations.AddField(
model_name='usercommittee',
... | mit | Python | |
557b0f30e0180a526433b65915d2a137144f2f05 | add test_logger.py | alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl | tests/unit/test_logger.py | tests/unit/test_logger.py | # Tai Sakuma <tai.sakuma@gmail.com>
import logging
import alphatwirl
##__________________________________________________________________||
def test_logger_exist():
assert 'alphatwirl' in logging.Logger.manager.loggerDict
def test_len_handlers():
logger = logging.getLogger('alphatwirl')
assert len(logger... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.