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 |
|---|---|---|---|---|---|---|---|
7ea9bbd3315fed4d6fd319a865517a4f72228342 | Create test.py | Python/test.py | Python/test.py | Python | 0.000005 | ||
199b6bb0c62028d93e1204d96591500b0f76e834 | Add Robot_V002b.py Object Oriented Version | Robot_V002b.py | Robot_V002b.py | #!/usr/bin/python
import sys
sys.path.append("/home/pi/Documents/Robots/slcypi/MA") ### ADD PATH
sys.path.append("/home/pi/Documents/Robots/slcypi/HAT_Python3") ### ADD PATH
import time
from time import sleep
import atexit
import pygame
import pygame.camera
from PIL import Image
#from pylab import *
from Tank import T... | Python | 0.000006 | |
eeb0187b9d474b9b5d1710e8f45f8116894eb15c | Read Temperature from DS18B20. Post the data to data.sparkfun.com | temp-sensor02/main.py | temp-sensor02/main.py | from machine import Pin
from ds18x20 import DS18X20
import onewire
import time
import machine
import ujson
import urequests
def posttocloud(temperature):
keystext = open("sparkfun_keys.json").read()
keys = ujson.loads(keystext)
url = keys['inputUrl'] + "?private_key=" + keys['privateKey'] + "&temp=" + str(temper... | Python | 0 | |
d2e63dfc644e323bf23fbd6654f7493ed94d7991 | Use HTTPS for libchromiumcontent's URL | script/lib/config.py | script/lib/config.py | #!/usr/bin/env python
import errno
import os
import platform
import sys
BASE_URL = os.getenv('LIBCHROMIUMCONTENT_MIRROR') or \
'https://s3.amazonaws.com/github-janky-artifacts/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'cfbe8ec7e14af4cabd1474386f54e197db1f7ac1'
PLATFORM = {
'cygwin': 'win32',
'darwin':... | #!/usr/bin/env python
import errno
import os
import platform
import sys
BASE_URL = os.getenv('LIBCHROMIUMCONTENT_MIRROR') or \
'http://github-janky-artifacts.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'cfbe8ec7e14af4cabd1474386f54e197db1f7ac1'
PLATFORM = {
'cygwin': 'win32',
'darwin': ... | Python | 0 |
632f71651864517cc977f79dcdac7f3b0f516b49 | Add example script to post experiment and task data | scripts/post_data.py | scripts/post_data.py | #!/usr/bin/env python3
import requests
domain = 'http://dakis.gimbutas.lt/api/'
exp_data = {
"description": "First successful post through API",
"algorithm": "TestTasks",
"neighbours": "Nearest",
"stopping_criteria": "x_dist",
"stopping_accuracy": "0.01",
"subregion": "simplex",
"inner_pr... | Python | 0 | |
1c5ddc6803853e48eb77bd337fedbaabc56a0102 | Add empty MultiLayerPercetrsons file. | MultiLayerNeuralNetworks/MultiLayerPerceptrons/MultiLayerPerceptrons.py | MultiLayerNeuralNetworks/MultiLayerPerceptrons/MultiLayerPerceptrons.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
u"""
Copyright (c) 2016 Masaru Morita
This software is released under the MIT License.
See LICENSE file included in this repository.
"""
| Python | 0 | |
5fc6b3c64b29dc5b17fec90f331cc7a2ca22704f | add main file | sms2email.py | sms2email.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
Work at python2.5, iphone4(ios6) with cydia, using hotmail to send the message.
'''
import sqlite3 as sql
import email
import os
import sys
import codecs
import string
import datetime
from Queue import Queue
import time
import threading
import pymail
EMAIL_CONTENT =... | Python | 0.000001 | |
4e8d4f21749a329dd114926d3654512e9842a1e1 | Change FULL_NAME_FUNCTION to GET_FULL_NAME_FUNCTION. | idbase/views.py | idbase/views.py | from django.shortcuts import render, redirect
from django.conf import settings
from idbase.exceptions import InvalidSessionError
import logging
from importlib import import_module
logger = logging.getLogger(__name__)
def index(request, template=None):
"""Render the Identity home page."""
conf = {'urls': sett... | from django.shortcuts import render, redirect
from django.conf import settings
from idbase.exceptions import InvalidSessionError
import logging
from importlib import import_module
logger = logging.getLogger(__name__)
def index(request, template=None):
"""Render the Identity home page."""
conf = {'urls': sett... | Python | 0.000014 |
28749f1a0560411cfd6207563a29ff50a8bc014c | update wikinews family file from trunk r9996 | pywikibot/families/wikinews_family.py | pywikibot/families/wikinews_family.py | # -*- coding: utf-8 -*-
from pywikibot import family
__version__ = '$Id$'
# The Wikimedia family that is known as Wikinews
class Family(family.Family):
def __init__(self):
family.Family.__init__(self)
self.name = 'wikinews'
self.languages_by_size = [
'sr', 'en', 'pl', 'fr', ... | # -*- coding: utf-8 -*-
from pywikibot import family
__version__ = '$Id$'
# The Wikimedia family that is known as Wikinews
class Family(family.Family):
def __init__(self):
family.Family.__init__(self)
self.name = 'wikinews'
self.languages_by_size = [
'sr', 'en', 'pl', 'fr', ... | Python | 0 |
e04bf5dd12a1f5e28258541dcf9d2eb8c5567ad0 | Add tests for lead price | tests/lead_price_tests.py | tests/lead_price_tests.py | import unittest
import datetime
import json
import sys
sys.path.append('..')
import sabre_dev_studio
import sabre_dev_studio.sabre_exceptions as sabre_exceptions
'''
requires config.json in the same directory for api authentication
{
"sabre_client_id": -----,
"sabre_client_secret": -----
}
'''
class TestBasicLead... | Python | 0 | |
b7c22cddecb743e9597c92160e3aa0100e149e19 | Introduce hades test fixtures and first tests. | tests/model/test_hades.py | tests/model/test_hades.py | from datetime import datetime, timedelta
from pycroft.model import session
from pycroft.model.hades import radgroup_property_mappings, radcheck
from tests import FactoryDataTestBase
from tests.factories import PropertyGroupFactory, MembershipFactory, UserWithHostFactory, \
SwitchFactory, PatchPortFactory
class H... | Python | 0 | |
33bb7c4e026d46dda184d682c89fad7481ab1a77 | Add migration script. | contrib/migration/migrate-compose-file-v1-to-v2.py | contrib/migration/migrate-compose-file-v1-to-v2.py | #!/usr/bin/env python
"""
Migrate a Compose file from the V1 format in Compose 1.5 to the V2 format
supported by Compose 1.6+
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import argparse
import logging
import sys
import ruamel.yaml
log = logging.getLogger('migrate')
def migra... | Python | 0 | |
5fc72b0a6efcd14196d33c8e0ba9b4b763ebf4d1 | Add a parse_time example | examples/parse_time.py | examples/parse_time.py | """
================================================
Parsing times with sunpy.time.parse_time
================================================
Example to show some example usage of parse_time
"""
from datetime import datetime, date
import numpy as np
import pandas
from sunpy.time import parse_time
# dict used for c... | Python | 0.00019 | |
71e9a3a7e867b0670871ac46834988b87787c272 | Add import-hacks.py snippet file | import-hacks.py | import-hacks.py | # Can control the import mechanism in Python.
import importlib.abc
import logging
import sys
logging.getLogger().setLevel(logging.INFO)
class LoggingImporter(importlib.abc.Finder):
def find_module(self, name, path=None):
msg = "importing {} on {}".format(name, path)
logging.info(msg)
retur... | Python | 0.000001 | |
9d9e82487a6ad9494f65e484392334e89baf7b83 | Add AnalyzerResult class | coala/coalib/results/AnalyzerResult.py | coala/coalib/results/AnalyzerResult.py | import uuid
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
class AnalyzerResult:
def __init__(self,
origin,
language: str,
language_ver: str,
project_name: str,
project_version: str,
source_file_path: str,
... | Python | 0 | |
814b2aff88dcc775a34609b305b72733ffdc4aad | Add airtravel | src/airtravel.py | src/airtravel.py | '''Model for aircraft flights'''
class Flight:
'''a flight with airline number and aircraft
Arg
number - eg. BA312
aircraft - eg. AirBusA319("G-MNP")
'''
def __init__(self, number, aircraft):
if not number[:2].isalpha():
raise ValueError("No airline code in '{}'".for... | Python | 0.000854 | |
c087b8c5da7b97554e7461509cda298282dcde21 | Add sfp_openstreetmaps | modules/sfp_openstreetmaps.py | modules/sfp_openstreetmaps.py | # -*- coding: utf-8 -*-
# -------------------------------------------------------------------------------
# Name: sfp_openstreetmaps
# Purpose: SpiderFoot plug-in to retrieve latitude/longitude coordinates
# for physical addresses from Open Street Maps API.
#
# Author: Brendan Coles <bco... | Python | 0.00002 | |
60e4269027adc05db7b585ab51334c8d28cd7a1c | Add assignment writer | nbgrader/assignment_writer.py | nbgrader/assignment_writer.py | """Based on the FilesWriter class included with IPython."""
import io
import os
import glob
import shutil
from IPython.utils.traitlets import Unicode
from IPython.utils.path import ensure_dir_exists
from IPython.utils.py3compat import unicode_type
from IPython.nbconvert.writers.base import WriterBase
class Assignm... | Python | 0.000001 | |
a998eaec11c9ec53e593e2a25542eabab0f75890 | Create __init__.py | app/__init__.py | app/__init__.py | # app/__init__.py
from flask_api import FlaskAPI
from flask_sqlalchemy import SQLAlchemy
# local import
from instance.config import app_config
# initialize sql-alchemy
db = SQLAlchemy()
def create_app(config_name):
app = FlaskAPI(__name__, instance_relative_config=True)
app.config.from_object(app_config[con... | Python | 0.000429 | |
8abd31b54d4a767a3d04b82b3f6b8c9cae53222e | add build file | build.py | build.py | #! /usr/bin/env python
#
# build.py
#
# Created by Frederic DELBOS <fred.delbos@gmail.com> on Nov 22 2013.
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
#
import subprocess, argparse, sys, time, os
from watchdog.observers import Observ... | Python | 0.000001 | |
633b6f4c5cecda938f02ff6ccaa529de7b47ce67 | Initialize excelToCSV | books/AutomateTheBoringStuffWithPython/Chapter14/PracticeProject/excelToCSV.py | books/AutomateTheBoringStuffWithPython/Chapter14/PracticeProject/excelToCSV.py | # Using the openpyxl module, write a program that reads all the Excel files in the
# current working directory and outputs them as CSV files.
# A single Excel file might contain multiple sheets; you’ll have to create one CSV
# file per sheet. The filenames of the CSV files should be
# <excel filename>_<sheet title>.csv... | Python | 0.000001 | |
09181bd4c11501fa9e8274651370e45ac8d83316 | add vars01.py | trypython/basic/vars01.py | trypython/basic/vars01.py | # coding: utf-8
"""
vars()についてのサンプルです。
"""
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
class Sample(SampleBase):
def exec(self):
#
# vars() は、引数無しで呼ぶと locals() と同じ
# 引数を付与して呼ぶと、そのオブジェクトの __dict__ を返す
#
x = 10
y = 20
... | Python | 0.000001 | |
7577933c1e016ee6d4bca73bfa3434dc19c55315 | add basic initialization | circa.py | circa.py | import logging
import client
class Circa(client.Client):
def __init__(self, conf):
conf["autoconn"] = False
logging.basicConfig(filename=conf.get("log", "circa.log"), level=logging.INFO,
style="%", format="%(asctime)s %(levelname)s %(message)s")
if "log" in conf:
logging.basicConfig(filename=conf["log"])
... | Python | 0.00001 | |
ed479cf11540c6a67bb4b51eed42b91abd869090 | Add html_doc.py | tests/test_files/html_doc.py | tests/test_files/html_doc.py | doc = """<!DOCTYPE html>
<html>
<head>
<title>Html document</title>
</head>
<body>
<div>
<h1>H1 Tag</h1>
<h1 class='class-name'>H1 Tag with class</h1>
<h1 id='id-name'>H1 Tag with id</h1>
<p class='class-name'>P tag with class</p>
</div>
</body>
</html>""" | Python | 0.000105 | |
308744d8a022c7fc25af4f2ef8a6214cdcf014f9 | Add additional attributes to GPSLogger (#4755) | homeassistant/components/device_tracker/gpslogger.py | homeassistant/components/device_tracker/gpslogger.py | """
Support for the GPSLogger platform.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.gpslogger/
"""
import asyncio
from functools import partial
import logging
from homeassistant.const import HTTP_UNPROCESSABLE_ENTITY
from homeassistant... | """
Support for the GPSLogger platform.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.gpslogger/
"""
import asyncio
from functools import partial
import logging
from homeassistant.const import HTTP_UNPROCESSABLE_ENTITY
from homeassistant... | Python | 0 |
1ac75f4683c8920382d9cbd676d7a3ae5fefc2a1 | Create priority_queue_using_list.py (#2435) | data_structures/queue/priority_queue_using_list.py | data_structures/queue/priority_queue_using_list.py | """
Pure Python implementations of a Fixed Priority Queue and an Element Priority Queue
using Python lists.
"""
class OverFlowError(Exception):
pass
class UnderFlowError(Exception):
pass
class FixedPriorityQueue:
"""
Tasks can be added to a Priority Queue at any time and in any order but when Task... | Python | 0 | |
e9ccfeb5b1bc5e30756075c1afd229f3691ac5ac | add python translation of centered smd_nfw | smd_nfw.py | smd_nfw.py | from __future__ import absolute_import, division, print_function
import numpy as np
from astropy import units
rbins = np.loadtxt('smd_in1.dat')
nbins = rbins.shape[0]
rbins = rbins * units.Mpc
data = np.loadtxt('smd_in2.dat')
nlens = data.shape[0]
rs = data[:,0] * units.Mpc
delta_c = data[:,1] #dimensionless
rho_cr... | Python | 0.000002 | |
8f32a5be4ffc427a1fbc6bf700edc81b191e876f | add tests for basic funcionality | test/api/test_rest.py | test/api/test_rest.py | import json
from test.api import APIClient
from django.test import TestCase
from squad.core import models
from squad.ci import models as ci_models
class RestApiTest(TestCase):
def setUp(self):
self.group = models.Group.objects.create(slug='mygroup')
self.project = self.group.projects.create(slug=... | Python | 0 | |
86c6dcc8fe0ac739ed1ae1a7898ea609fe959c61 | add spectra extraction script | spectra.py | spectra.py | import sqlite3
import igraph
import os
from matplotlib import pyplot as plt
db = 'genome.leishmania.hp_assembly.db'
wordlen = 10
base_dir = 'spectra-%d' % wordlen
pos_dir = os.path.join(base_dir, 'positive')
neg_dir = os.path.join(base_dir, 'negative')
num_bins = 1000
ylim = (0,100)
xlim = (-15000,15000)
G = igraph.re... | Python | 0 | |
d42b2ee3eb60a0c11c1a973e030de909519ba662 | Add garage.argparse.add_bool_argument | garage/argparse.py | garage/argparse.py | __all__ = [
'add_bool_argument',
]
import argparse
def add_bool_argument(parser, *args, **kwargs):
kwargs = dict(kwargs) # Make a copy before modifying it...
kwargs['choices'] = (True, False)
kwargs['type'] = parse_bool
parser.add_argument(*args, **kwargs)
def parse_bool(string):
try:
... | Python | 0.000024 | |
10f9b0d1b02c2b5f4c4eeac0c1f803657c89764b | add example file for smooth OT | examples/plot_OT_1D_smooth.py | examples/plot_OT_1D_smooth.py | # -*- coding: utf-8 -*-
"""
====================
1D optimal transport
====================
This example illustrates the computation of EMD, Sinkhorn and smooth OT plans
and their visualization.
"""
# Author: Remi Flamary <remi.flamary@unice.fr>
#
# License: MIT License
import numpy as np
import matplotlib.pylab as ... | Python | 0 | |
82dda8f12060ba0d3f83b6a9ff92bfcfbb212e25 | Add utils | utils/extract_zipcodes.py | utils/extract_zipcodes.py | import json
from bbvalib import create_mongoclient
db = create_mongoclient()
zipcodes = set()
zipcodes.update(db.top_clients_week.find().distinct("shop_zipcode"))
zipcodes.update(db.top_clients_month.find().distinct("shop_zipcode"))
zipcodes.update(db.top_clients_week.find().distinct("home_zipcode"))
zipcodes.update(... | Python | 0.000016 | |
31110631d7fa43c695bc1f5504cd02c3d0cab745 | Add some tests | tests/test_error_handlers.py | tests/test_error_handlers.py | from testutils import app # noqa: F401
def test_not_found(client):
'''Test 404 error handler'''
results = client.get('/totally/made/up')
assert results.status_code == 404
assert results.json == {'error': 'Not found'}
def test_method_not_allowed(client):
'''Test 405 error handler'''
results ... | Python | 0 | |
5a77b2520f99219e1b0f51cdd0a44380a5577864 | Add first batch of unit tests | tests/unit/utils/test_dns.py | tests/unit/utils/test_dns.py | # -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import
# Python
# Salt
from salt._compat import ipaddress
from salt.utils.odict import OrderedDict
from salt.utils.dns import _to_port, _tree, _weighted_order, _data2rec, _data2rec_group
# Testing
from tests.support.unit import skipIf, TestCase... | Python | 0 | |
9d5be9d464168a3d9e9b3265a1581e0359f69f2a | test for #579 | test/test_issue579.py | test/test_issue579.py | # test for https://github.com/RDFLib/rdflib/issues/579
from rdflib import Graph, URIRef, Literal, Namespace
from rdflib.namespace import FOAF, RDF
g = Graph()
g.bind('foaf', FOAF)
n = Namespace("http://myname/")
g.add((n.bob, FOAF.name, Literal('bb')))
# query is successful.
assert len(g.query("select ?n where { ?n f... | Python | 0.000001 | |
d9b4b0d913304b19365854b0ffceab179237d8f8 | Add tests for float->int symbols (esp for 32-bit windows and linux) | numba/tests/test_floatsyms.py | numba/tests/test_floatsyms.py | from __future__ import print_function
import numba.unittest_support as unittest
from numba.compiler import compile_isolated
from numba import types
class TestFloatSymbols(unittest.TestCase):
"""
Test ftol symbols on windows
"""
def _test_template(self, realty, intty):
def cast(x):
... | Python | 0 | |
45a6e108418944026f6d67fa018573a831dc5107 | add mul_recds.py | test/sql/mul_recds.py | test/sql/mul_recds.py | import sqlite3
with sqlite3.connect("new.db") as connection:
c = connection.cursor()
cities = [
('Boston','MA',600000)
]
| Python | 0.00028 | |
aa320afb447ab8486720a05f0613cad446c9bea9 | Add graph module. | plumeria/plugins/graph.py | plumeria/plugins/graph.py | import asyncio
import io
import re
import matplotlib
import pkg_resources
from plumeria.command import commands, CommandError
from plumeria.message import Response, MemoryAttachment
from plumeria.util.ratelimit import rate_limit
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.font_manager as... | Python | 0 | |
8ff6f08a497adba17bd02eae9ec6425a71927e08 | Update admin.py | avatar/admin.py | avatar/admin.py | from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.utils import six
from django.template.loader import render_to_string
from avatar.models import Avatar
from avatar.signals import avatar_updated
from avatar.util import get_user_model
class AvatarAdmin(admin.ModelAdmi... | from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from avatar.models import Avatar
from avatar.signals import avatar_updated
from avatar.templatetags.avatar_tags import avatar
from avatar.util import get_user_model
class AvatarAdmin(admin.ModelAdmin):
list_display = ('get_a... | Python | 0.000015 |
8420ec302cc35c1e65544caecc177849f92b7cbd | intent_service is OBVIOUSLY not a package | skills-sdk-setup.py | skills-sdk-setup.py | from setuptools import setup
from mycroft.util.setup_base import get_version, place_manifest
__author__ = 'seanfitz'
place_manifest("skills-sdk-MANIFEST.in")
setup(
name="mycroft-skills-sdk",
version=get_version(),
install_requires=[
"mustache==0.1.4",
"configobj==5.0.6",
"pyee==... | from setuptools import setup
from mycroft.util.setup_base import get_version, place_manifest
__author__ = 'seanfitz'
place_manifest("skills-sdk-MANIFEST.in")
setup(
name="mycroft-skills-sdk",
version=get_version(),
install_requires=[
"mustache==0.1.4",
"configobj==5.0.6",
"pyee==... | Python | 0.999999 |
4f3854eaf8d6e4b0ad9a77e871a946916ab3fec6 | Migrate listings.syndication, FeedType.content_type should not be unique. | listings/syndication/migrations/0002_auto__del_unique_feedtype_content_type.py | listings/syndication/migrations/0002_auto__del_unique_feedtype_content_type.py | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'FeedType', fields ['content_type']
db.delete_unique('syndication_feedtype',... | Python | 0 | |
02b19f1d38ce16f1c22f62edb21b595fba037b30 | Add script to generate numeric conversion functions | gen_type_conversion.py | gen_type_conversion.py | """
Generate generated_conversions.c
Utilities adjusted from Cython/Compiler/PyrexTypes.pyx
"""
import os
func_name = "__Numba_PyInt_As%(SignWord)s%(TypeName)s"
header = "static %%(type)s %(FuncName)s(PyObject* x)" % { 'FuncName' : func_name}
c_int_from_py_function = """
%(Header)s {
const %(type)s neg_one = (%... | Python | 0.000001 | |
7b1fb0eb7f063c00c89b57ceca64a01881a7d4d9 | add const_thrust helper | crazyflie_demo/scripts/const_thrust.py | crazyflie_demo/scripts/const_thrust.py | #!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
if __name__ == '__main__':
rospy.init_node('crazyflie_demo_const_thrust', anonymous=True)
p = rospy.Publisher('cmd_vel', Twist)
twist = Twist()
r = rospy.Rate(50)
#for i in range(0, 100):
# p.publish(twist)
# r.sl... | Python | 0.000001 | |
50331d662d67d9f625f9f9198988522b38b2d1f0 | add task for midnight search index update, https://www.pivotaltracker.com/story/show/13730025 | apps/search/tasks.py | apps/search/tasks.py | from utils.celery_search_index import LogEntry
from utils.celery_utils import task
from celery.schedules import crontab
from celery.decorators import periodic_task
from django.core.management import call_command
@periodic_task(run_every=crontab(minute=0, hour=0))
def update_search_index():
call_command('update_ind... | Python | 0.000011 | |
3c2438049da743b53cb7a536ddc2db1a05302a33 | Add grab.tools.logs to configure logging module | grab/tools/logs.py | grab/tools/logs.py | import logging
def default_logging(grab_log='/tmp/grab.log'):
"""
Customize logging output to display all log messages
except grab network logs.
Redirect grab network logs into file.
"""
logging.basicConfig(level=logging.DEBUG)
glog = logging.getLogger('grab')
glog.propagate = False
... | Python | 0.000001 | |
4662b430087404dbf011cf9ad97ee1e3188bfb9d | create wrapper for c_curve | wrappers/preseq/observed_complexity/wrapper.py | wrappers/preseq/observed_complexity/wrapper.py | __author__ = "Behram Radmanesh"
__copyright__ = "Copyright 2016, Behram Radmanesh"
__email__ = "behram.radmanesh@nih.gov"
__license__ = "MIT"
# import snakemake's ability to execute shell commands
from snakemake.shell import shell
# execute preseq c_curve
shell("preseq c_curve {snakemake.params} {snakemake.input[0]} ... | Python | 0.000001 | |
ec1b3be5545d5ae530d3dc7dd8d90e6fe4730926 | add unittest for heap | tests/testIndexedHeap.py | tests/testIndexedHeap.py | '''
Created on 2017/9/29
:author: hubo
'''
import unittest
from random import randrange, sample
from vlcp.utils.indexedheap import IndexedHeap
class Test(unittest.TestCase):
def testRandomSort(self):
data = [(randrange(0,10000), randrange(0,10000)) for _ in range(0,1000)]
data = list((v,k)
... | Python | 0 | |
fb2292b58267d7d4d3c463879832d6327246155a | Add reflected magic methods | cupyx/fallback_mode/ndarray.py | cupyx/fallback_mode/ndarray.py | """
class ndarray is wrapper around cupy.ndarray
to support fallback of methods of type `ndarray.func()`
"""
import sys
import numpy as np
import cupy as cp
from cupyx.fallback_mode import data_transfer
try:
from cupyx.fallback_mode import fallback
except ImportError:
import sys
fallback = sys.modules[__... | """
class ndarray is wrapper around cupy.ndarray
to support fallback of methods of type `ndarray.func()`
"""
import sys
import numpy as np
import cupy as cp
from cupyx.fallback_mode import data_transfer
try:
from cupyx.fallback_mode import fallback
except ImportError:
import sys
fallback = sys.modules[__... | Python | 0.000001 |
5db58544133c66c5cbb4122c99a95a0ca6ddfa26 | Create RomeOculus.py | home/Alessandruino/RomeOculus.py | home/Alessandruino/RomeOculus.py | i01 = Runtime.createAndStart("i01","InMoov")
i01.startHead("/dev/tty.usbmodem1411")
#i01.startLeftArm("COM5")
#leftHand = i01.startLeftHand("COM5")
#i01.leftArm.bicep.setMinMax(5,80)
#i01.leftArm.bicep.moveTo(30)
oculus = Runtime.start("oculus","OculusDIY")
oculus.arduino.connect("/dev/tty.usbmodem14541")
def onOcul... | Python | 0.000007 | |
6b8e24485f28e1c0408cefdb989e078a332211d6 | Fix migration chain | src/ggrc/migrations/versions/20160202161748_37b2a060bdd6_remove_object_type_table.py | src/ggrc/migrations/versions/20160202161748_37b2a060bdd6_remove_object_type_table.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
"""Remove object type table
Revision ID: 37b2a060bdd6
Revises: 262bbe790f4c
Cr... | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
"""remove object type table
Revision ID: 37b2a060bdd6
Revises: 262bbe790f4c
Cr... | Python | 0.000025 |
c5fba0cc8acb482a0bc1c49ae5187ebc1232dba3 | Add tests for the different input variations. | tests/test_directions.py | tests/test_directions.py | import unittest
from shapely.geometry import LineString, Point
from directions.base import _parse_points
class DirectionsTest(unittest.TestCase):
def setUp(self):
self.p = [(1,2), (3,4), (5,6), (7,8)]
self.line = LineString(self.p)
def test_origin_dest(self):
result = _parse_points(s... | Python | 0 | |
635682c9d206cd9ae6ea184f9361937b0a272b90 | Add monadic utilities MonadicDict and MonadicDictCursor. | wqflask/utility/monads.py | wqflask/utility/monads.py | """Monadic utilities
This module is a collection of monadic utilities for use in
GeneNetwork. It includes:
* MonadicDict - monadic version of the built-in dictionary
* MonadicDictCursor - monadic version of MySQLdb.cursors.DictCursor
that returns a MonadicDict instead of the built-in dictionary
"""
from collection... | Python | 0 | |
d21e0721b614423e07e81809fb60dd936494bfff | Add validators test | tests/test_validators.py | tests/test_validators.py | import attr
from twisted.trial import unittest
import txnats
from txnats.validators import is_instance_of_nats_protocol
@attr.s
class Foo(object):
protocol = attr.ib(default=None,
validator=attr.validators.optional(
is_instance_of_nats_protocol
)
)
class IsNatsProtocolTest(unit... | Python | 0.000001 | |
45f26b56d177798efca4825f063372b505df6a76 | Add gameman test | tests/gameman_test.py | tests/gameman_test.py | import pytest
from savman import gameman
@pytest.fixture
def dir1(tmpdir):
return tmpdir.mkdir('dir1')
@pytest.fixture
def dir2(tmpdir):
return tmpdir.mkdir('dir2')
@pytest.fixture
def customfile(tmpdir, dir1, dir2):
file = tmpdir.join('custom.txt')
custom = '''
---
name: My Game
directory: {}
includ... | Python | 0 | |
1e3781bc3527f72053fdc4aad4f4887c567c457c | Add unicode test. | tests/unicode/unicode.py | tests/unicode/unicode.py | # Test a UTF-8 encoded literal
s = "asdf©qwer"
for i in range(len(s)):
print("s[%d]: %s %X"%(i, s[i], ord(s[i])))
# Test all three forms of Unicode escape, and
# all blocks of UTF-8 byte patterns
s = "a\xA9\xFF\u0123\u0800\uFFEE\U0001F44C"
for i in range(-len(s), len(s)):
print("s[%d]: %s %X"%(i, s[i], ord... | Python | 0.000002 | |
40154d7de207df9689ac220cc8966735cb3ed5af | Test asyncio in python 3.6 | tests/test_asyncio.py | tests/test_asyncio.py | import asyncio
async def routine0(s,n):
print('CRT:',s,':',n)
async def routine(id, n):
print('TEST[%s] %d'%(id,n))
if not n:
return
n -= 1
await routine(id, n)
await routine0(id, n)
loop = asyncio.get_event_loop()
tasks = [
asyncio.ensure_future(routine('a',5)),
asyncio.ensure_future(routine('b'... | Python | 0.000003 | |
c63651a5fba9dd67b345bfb95adef5d6206f5da3 | Add file lock | tagcache/lock.py | tagcache/lock.py | # -*- encoding: utf-8 -*-
import os
import fcntl
class FileLock(object):
def __init__(self, path):
self.path = path
self.fd = None
def acquire(self, write=False, block=True):
if self.fd is not None:
self.release()
try:
# open or create the file
... | Python | 0.000001 | |
3625646c34fed4c5081e73c175e257ee426a4c37 | Fix reproduce_state | homeassistant/helpers/state.py | homeassistant/helpers/state.py | """
homeassistant.helpers.state
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Helpers that help with state related things.
"""
import logging
from homeassistant.core import State
import homeassistant.util.dt as dt_util
from homeassistant.const import (
STATE_ON, STATE_OFF, SERVICE_TURN_ON, SERVICE_TURN_OFF,
SERVICE_MEDIA_PLAY,... | """
homeassistant.helpers.state
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Helpers that help with state related things.
"""
import logging
from homeassistant.core import State
import homeassistant.util.dt as dt_util
from homeassistant.const import (
STATE_ON, STATE_OFF, SERVICE_TURN_ON, SERVICE_TURN_OFF,
SERVICE_MEDIA_PLAY,... | Python | 0.000009 |
dfe833e811ed7e2a3860555ef75fb9c64c76cc28 | Create test_fitting.py | tests/test_fitting.py | tests/test_fitting.py | import numpy as np
from pyrho import Parameters, fitModels
from pyrho.datasets import loadChR2
def test_fit_3_state_model():
init_params = Parameters()
init_params.add_many(
# Name Value Vary Min Max Expr
('g0', 1e5, True, 0.001, 1e6, None),
('phi_m',1e18, T... | Python | 0.000014 | |
1fe84191c0f67af445e0b140efe67e90ae1e4c6f | Use set instead of ordered dict. | blues/slack.py | blues/slack.py | """
Slack Blueprint
===============
**Fabric environment:**
.. code-block:: yaml
settings:
slack:
# Single config:
endpoint: https://hooks.slack.com/... # (Required)
channels: # (Required)
- "#deploy"
username: deploybot
icon_emo... | """
Slack Blueprint
===============
**Fabric environment:**
.. code-block:: yaml
settings:
slack:
# Single config:
endpoint: https://hooks.slack.com/... # (Required)
channels: # (Required)
- "#deploy"
username: deploybot
icon_emo... | Python | 0 |
7963e426e2d1f58105d8712c0379114d93d32b07 | Add example with sklearn pipeline | examples/plot_feature_extraction_classification.py | examples/plot_feature_extraction_classification.py | """
UMAP as a Feature Extraction Technique for Classification
---------------------------------------------------------
The following script shows how UMAP can be used as a feature extraction
technique to improve the accuracy on a classification task. It also shows
how UMAP can be integrated in standard scikit-learn p... | Python | 0 | |
dbaf32db0f9a5c00731e2682dd171e00914d29f0 | implement AQOUT mean drawdown standard error calculation | timutils/std_error.py | timutils/std_error.py | """module to implement standard error calculation, with optional
effective sample size adjustment of Wilks (1995)
REFERENCES
Wilks, D. (1995), Statistical Methods in the Atmospheric Sciences: An
Introduction, Academic Press, New York.
"""
import numpy as np
import pandas as pd
class MeanStdError(object):
"""cl... | Python | 0 | |
a6bbcdd9a28b4ad3ebc5319ab849bd9116b2f0c6 | Create 7kyu_how_many_points.py | Solutions/7kyu/7kyu_how_many_points.py | Solutions/7kyu/7kyu_how_many_points.py | def get_los_angeles_points(results):
return sum(int(j.split(':')[0]) for i,j in results if __import__('re').fullmatch('Los\sAngeles\s[a-zA-Z]+$', i))
| Python | 0.012299 | |
7efa9d9e9c98fc15233cb9fea81ae13520c5e52d | Add example print queue manager | tools/queuemanager.py | tools/queuemanager.py | #!/usr/bin/env python3
"""
Manage the printing queue for local printers
"""
import argparse
import getpass
import time
import json
import requests
CLIENT = "ciab"
def connect(server, account, password):
''' Connect to a server '''
url = server+"/api/token"
param = {'grant_type':'password', 'username'... | Python | 0 | |
824623c9f836c1591d89f7292fc1f406a1af189a | add a stub test for job manipulation | test/jobstest.py | test/jobstest.py | #!/usr/bin/python2.4
#
# Copyright (c) 2004-2005 rpath, Inc.
#
import testsuite
testsuite.setup()
import rephelp
class ReleaseTest(rephelp.RepositoryHelper):
def testBasicAttributes(self):
client = self.getMintClient("testuser", "testpass")
projectId = client.newProject("Foo", "foo", "rpath.org")... | Python | 0.000001 | |
af205246543fbb874ebf20b530fac04a3ba9808c | Add some notes to graph script | graph.py | graph.py | from __future__ import unicode_literals
class Graph(object):
"""A class for a simple graph data structure."""
def __init__(self):
self.graph = {}
def __repr__(self): # Consider how we want to repr this.
return repr(self.graph)
def __len__(self):
return len(self.graph)
d... | Python | 0 | |
5d554573031f2f7b60d963c587aa650a025f6c45 | Create tutorial3.py | tutorial3.py | tutorial3.py | """
tutorial3.py
by E. Dennison
"""
from ggame import App, RectangleAsset, ImageAsset, SoundAsset, Sprite, Sound
from ggame import LineStyle, Color
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480
green = Color(0x00ff00, 1)
black = Color(0, 1)
noline = LineStyle(0, black)
bg_asset = RectangleAsset(SCREEN_WIDTH, SCREEN_HEIGHT, ... | Python | 0 | |
bcaa60ce73134e80e11e7df709e7ba7dbc07d349 | Add tests for systemd module | tests/test_systemd.py | tests/test_systemd.py | #!/usr/bin/env python3
import unittest
from unittest import mock
from unittest.mock import MagicMock, patch
from portinus import systemd
class testSystemd(unittest.TestCase):
def setUp(self):
systemd.subprocess.check_output = MagicMock(return_value=True)
self.unit = systemd.Unit('foo')
def ... | Python | 0 | |
0c3107739671398de1a206cfbb7673c25c543e60 | Update driver value in Seat model. | driver27/migrations/0009_populate_driver_in_seats.py | driver27/migrations/0009_populate_driver_in_seats.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def populate_driver_in_seats(apps, schema_editor):
Seat = apps.get_model("driver27", "Seat")
for seat in Seat.objects.all():
driver = seat.contender.driver
seat.driver = driver
sea... | Python | 0 | |
ba239762d34db9e13708d4e0828e2f8adba4e8bc | add sensapex accuracy test script | acq4/drivers/sensapex/accuracy_test.py | acq4/drivers/sensapex/accuracy_test.py |
from __future__ import print_function
import os, sys, time
import numpy as np
import acq4.pyqtgraph as pg
from acq4.drivers.sensapex import SensapexDevice, UMP, UMPError
ump = UMP.get_ump()
devids = ump.list_devices()
devs = {i:SensapexDevice(i) for i in devids}
print("SDK version:", ump.sdk_version())
print("Found ... | Python | 0 | |
3b4c811f0b45f5739ce7c0d64f31eb2c2c9a7f4b | add battery | ai/machine-learning/battery/battery.py | ai/machine-learning/battery/battery.py | from numpy import *
def loadData():
xArr, yArr = [], []
for i in open('trainingdata.txt'):
line = map(float, i.split(','))
if line[0] < 4:
xArr.append(line[:-1])
yArr.append(line[-1])
return xArr, yArr
def lineReg(xArr, yArr):
xMat = mat(xArr); yMat = mat(yArr).... | Python | 0.000003 | |
023e587e28e148be3a21d4cb34a702a68ef02a0b | test script to list root dirs of image files | testdir.py | testdir.py | #!/usr/local/bin/python
import sys
import disklib.mediageom
import disklib.validity
import msfat.dir
import msfat.volume
def main():
prog_errs = [ ]
for path in sys.argv[1:]:
print path
try:
validity = disklib.validity.read_validity_for_file(path)
with open(path, "rb") as stream:
geometry = diskli... | Python | 0 | |
87b2d15f1953d75c1a55259370f36f5ea4d3fea9 | Create testing.py | testing.py | testing.py | '''
Maybe an easier format?
http://web.stevens.edu/scheduler/cor 2015F/sched_plus_crsemtg.txt
Got there by going back to the "core" part of the url then going to that text file (plus course meeting?)
'''
courses = {\
'BT 353A' : ["M","1300","1350"] , \
'BT 353A' : ["W","1100","1240"] , \
'BT 353B' : ["M","1500","1... | Python | 0.000001 | |
ab979b0e7116667816c343fd1406d521df78c2cf | Add script to add locations to constituency area places already in database | pombola/south_africa/management/commands/south_africa_set_da_office_locations.py | pombola/south_africa/management/commands/south_africa_set_da_office_locations.py | # This script is intended to patch the data originally loaded in using the
# south_africa_import_constituency_offices command. When this was originally run
# the DA offices (or constituency areas) had not been geolocated. This script
# reads in a CSV with the list of offices and the location information and for
# each ... | Python | 0 | |
2ac46d538da103929e58c0500ca0baca391f39bc | Add distribution implement of image classification. (#7687) | python/paddle/v2/fluid/tests/book_distribute/notest_dist_image_classification.py | python/paddle/v2/fluid/tests/book_distribute/notest_dist_image_classification.py | #Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable l... | Python | 0 | |
338f8d95df785b49eb0c00209535bfde675b6ce9 | Create release_jobs_from_hold.py | release_jobs_from_hold.py | release_jobs_from_hold.py | #!/usr/bin/env perl
use strict;
use Getopt::Long;
my $usage = "\t\t --usage $0 job_id=<PBS JOB ID> min=<Start of array> max=<End of array>\n";
my $command = "releasehold -a";
my $job_id;
my $min;
my $max;
$\= "\n";
if (! scalar(@ARGV) ) {
die $usage . scalar @ARGV;
}
GetOptions ("job_id=i" => \$job_... | Python | 0 | |
01b105376dc3ddcfe528f3bf22d89a3e82d5f4c1 | add some negative tests for security group: | tempest/api/network/test_security_groups_negative.py | tempest/api/network/test_security_groups_negative.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack Foundation
# 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.apach... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack Foundation
# 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.apach... | Python | 0.9995 |
fb03cd60646e56a789e61471f5bb6772f7035d6e | add test for io | tests/test_io.py | tests/test_io.py | # -*- coding: utf-8 -*-
import os
import re
import unittest
from kisell.core import Origin, Pipe
from kisell import io
_license_file_path = os.path.join(
os.path.dirname(os.path.dirname(__file__)), 'LICENSE'
)
_license_file_content = None
with open(_license_file_path, 'r') as f:
_license_file_con... | Python | 0.000001 | |
f1e47cc7854b0cb98f384ec866571aeaab96edd7 | Add forgotten migration | src/ggrc/migrations/versions/20130805234925_4752027f1c40_create_directive_met.py | src/ggrc/migrations/versions/20130805234925_4752027f1c40_create_directive_met.py | """Create Directive.meta_kind
Revision ID: 4752027f1c40
Revises: 3a5ff1d71b9f
Create Date: 2013-08-05 23:49:25.621647
"""
# revision identifiers, used by Alembic.
revision = '4752027f1c40'
down_revision = '3a5ff1d71b9f'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import select, table, column,... | Python | 0.000004 | |
3c885004d579dacbe7a193576b21ee965a9d8e11 | add test file for images | iscc_bench/elastic_search/generate_image_hashes.py | iscc_bench/elastic_search/generate_image_hashes.py | # -*- coding: utf-8 -*-
import time
from PIL import Image
import os
import dhash
from elasticsearch import Elasticsearch
from elasticsearch import helpers
from iscc_bench import DATA_DIR
from iscclib.image import ImageID
es = Elasticsearch()
IMAGE_DIR = os.path.join(DATA_DIR, 'images\src')
mapping_image = '''
{
"... | Python | 0 | |
64fca89a9bb3bc0cd7725f4ad2ef0924c5c97859 | remove very large target coverage | lib/GATK4/fixCollectHsMetrics.py | lib/GATK4/fixCollectHsMetrics.py | import argparse
import sys
import logging
import os
import random
DEBUG=False
NotDEBUG=not DEBUG
parser = argparse.ArgumentParser(description="fixCollectHsMetrics",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-i', '--input', action='store'... | Python | 0 | |
ee928a52805ea8179277487e667947746985a2db | Create __init__.py | tools/dwx_zeromq_connector/v2.0.1/EXAMPLES/TEMPLATE/STRATEGIES/__init__.py | tools/dwx_zeromq_connector/v2.0.1/EXAMPLES/TEMPLATE/STRATEGIES/__init__.py | Python | 0.000429 | ||
8fe57fbbc5764d3e13c3513afcdb2c49d04b117e | Add a migration for php5-fpm pools to php7 | src/yunohost/data_migrations/0003_php5_to_php7_pools.py | src/yunohost/data_migrations/0003_php5_to_php7_pools.py | import os
import glob
from shutil import copy2
from moulinette.utils.log import getActionLogger
from yunohost.tools import Migration
from yunohost.service import _run_service_command
logger = getActionLogger('yunohost.migration')
PHP5_POOLS = "/etc/php5/fpm/pool.d"
PHP7_POOLS = "/etc/php/7.0/fpm/pool.d"
PHP5_SOCKE... | Python | 0 | |
935c77777d9d15269d2579f001c3abd97f8635e7 | add - module for communicating with redis. | flickipedia/redisio.py | flickipedia/redisio.py | """
Module for handling redis IO
"""
import redis
from flickipedia.config import log
__author__ = 'Ryan Faulkner'
__date__ = "2014-04-01"
class DataIORedis(object):
""" Class implementing data IO for Redis. """
DEFAULT_HOST = 'localhost'
DEFAULT_PORT = 6379
DEFAULT_DB = 0
def __init__(self, **... | Python | 0 | |
637165eef82d40abc240b1dc40edddabecbb6af3 | Create new package. (#6503) | var/spack/repos/builtin/packages/r-biocstyle/package.py | var/spack/repos/builtin/packages/r-biocstyle/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... | Python | 0 | |
b577b1b54cf8ba2f1b9184bda270e0bcd9613ef5 | Create wordcount-mapper.py | wordcount-mapper.py | wordcount-mapper.py | #!/usr/bin/env python
import sys
for line in sys.stdin: # Input is read from STDIN and the output of this file is written into STDOUT
line = line.strip() # remove leading and trailing whitespace
words = line.split() # split the line into words
for word in words:
print '%s\t%s' % (w... | Python | 0.000004 | |
64fdb1b101a7242b2fa8191c9d291740029a5272 | Add module to compute the inverse of the isochrone action-angle transformation (actions and angles --> x,v) | galpy/actionAngle_src/actionAngleIsochroneInverse.py | galpy/actionAngle_src/actionAngleIsochroneInverse.py | ###############################################################################
# actionAngle: a Python module to calculate actions, angles, and frequencies
#
# class: actionAngleIsochroneInverse
#
# Calculate (x,v) coordinates for the Isochrone potential from
# given actions-angle coor... | Python | 0.0001 | |
79a0302ed3cebc0b93775824f6bfa5ce17bdb371 | Create j34all_possible.py | j34all_possible.py | j34all_possible.py | import itertools
class ListOps():
def __init__(self, length=9, total=100):
self.length = length
self.total = total
temp_list = []
temp_value = [0, 1, -1]
temp_value = tuple(temp_value)
temp_list.append(temp_value)
for i in range(2, self.length):
... | Python | 0.00001 | |
be1b50a9780bc8d2114b8660687fd72bb9472949 | Implement new Lin similarity based query expansion in query_processing/wordnet_expansion.py | src/query_processing/wordnet_expansion.py | src/query_processing/wordnet_expansion.py | from nltk.corpus import wordnet as wn
from nltk.corpus import wordnet_ic
semcor_ic = wordnet_ic.ic('ic-semcor.dat')
from nltk.corpus import lin_thesaurus as thes
import heapq
# specifies number of top-scoring synonyms to use
NUMBER_SYNONYMS = 3
def expand_query(query):
# add weight of 1 for each original term
we... | Python | 0.000052 | |
1b810ec3fb2bdd241d831a3167d9ed8051fa29ca | Add to repo. | mapIt.py | mapIt.py | #!/usr/bin/python3
# mapIt.py - Launches a map in the browser using an address from the
# command line or clipboard.
import webbrowser
import sys
if len(sys.argv) > 1:
# Get address from command line.
address = ' '.join(sys.argv[1:])
else:
# Get address from clipboard.
address = pyperclip.paste()
we... | Python | 0 | |
3559faeceff06aee82409ca22158223aff696b07 | Create MajorityElement_004.py | leetcode/169-Majority-Element/MajorityElement_004.py | leetcode/169-Majority-Element/MajorityElement_004.py | class Solution(object):
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
num, cnt = nums[0], 1
for i in xrange(1, len(nums)):
if nums[i] == num:
cnt += 1
elif cnt == 0:
num = nums[i]
... | Python | 0.000001 | |
ba0d2ed9373df05eae280f8664214decddbd755c | add basic drawing tests for svg | kiva/tests/test_svg_drawing.py | kiva/tests/test_svg_drawing.py | import contextlib
import StringIO
import unittest
from xml.etree import ElementTree
from kiva.tests.drawing_tester import DrawingTester
from kiva.svg import GraphicsContext
class TestSVGDrawing(DrawingTester, unittest.TestCase):
def create_graphics_context(self, width, height):
return GraphicsContext((w... | Python | 0 | |
911baa4f700c34b2c2c3de8239a0fee60c12f1e9 | Create db.py | www/transwarp/db.py | www/transwarp/db.py | Python | 0.000002 | ||
c51d6fd5d12fd22391e792f8bb792a48b5bcda04 | Create yt-search-filter.py | yt-search-filter.py | yt-search-filter.py | """This program is designed to facilitate rapidly
finding a video and its link on YouTube. Instructions for use:
Install elementtree and gdata 2.0 APIs.
Run program through command prompt of choice and enter a query
to be searched on YouTube. Specific queries work best.
Then enter a second query to filter the results t... | Python | 0.000002 | |
fd1759b05c35d45bb6bf289f5267415e8c2a447e | Add missing superclass | rbuild/internal/rbuilder/rbuildercommand.py | rbuild/internal/rbuilder/rbuildercommand.py | #
# Copyright (c) 2008 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/permanent/... | Python | 0.999946 | |
5e005fab08da740a027dcc23ba1b53abc3efaec4 | add missing indices | ziggurat_foundations/migrations/versions/613e7c11dead_create_indices_on_resource_owners.py | ziggurat_foundations/migrations/versions/613e7c11dead_create_indices_on_resource_owners.py | """create indices on resource owners
Revision ID: 613e7c11dead
Revises: b5e6dd3449dd
Create Date: 2018-02-15 11:51:29.659352
"""
from __future__ import unicode_literals
# revision identifiers, used by Alembic.
revision = '613e7c11dead'
down_revision = 'b5e6dd3449dd'
from alembic import op
def upgrade():
op.cre... | Python | 0.000032 | |
88361e72624243b4e7fa45122e44a6843f21e2c6 | Add spider for Marriott hotels group | locations/spiders/marriott.py | locations/spiders/marriott.py | import json
import re
import scrapy
from scrapy.selector import Selector
from locations.items import GeojsonPointItem
class MarriottHotels(scrapy.Spider):
name = "marriott"
allowed_domains = ["marriott.com", "ritzcarlton.com"]
download_delay = 0.2
def start_requests(self):
start_urls = [
... | Python | 0 | |
02900e9135b26de835692aacdb5f1f332f582fa9 | Create main_menu_ui.py | main_menu_ui.py | main_menu_ui.py | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'main_menu.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):... | Python | 0.000012 | |
1b5a8307fd816c935f197993d1ead07cffc01892 | add simple consumer | samsa/rdsamsa/consumer.py | samsa/rdsamsa/consumer.py | from collections import namedtuple
from copy import copy
import logging
import rd_kafka
from samsa import abstract
logger = logging.getLogger(__name__)
Message = namedtuple("Message", ["topic", "payload", "key", "offset"])
# TODO ^^ namedtuple is just a placeholder thingy until we've fleshed out
# samsa.commo... | Python | 0 | |
46a652e13da604776d745d2f09e02e4f75dc3fd7 | test commit 1 | testfile.py | testfile.py | print("Hello")
| Python | 0.000004 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.