commit stringlengths 40 40 | subject stringlengths 1 3.25k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | old_contents stringlengths 0 26.3k | lang stringclasses 3
values | proba float64 0 1 | diff stringlengths 0 7.82k |
|---|---|---|---|---|---|---|---|
e04bf5dd12a1f5e28258541dcf9d2eb8c5567ad0 | Add tests for lead price | tests/lead_price_tests.py | tests/lead_price_tests.py | Python | 0 | @@ -0,0 +1,1301 @@
+import unittest%0Aimport datetime%0Aimport json%0Aimport sys%0A%0Asys.path.append('..')%0Aimport sabre_dev_studio%0Aimport sabre_dev_studio.sabre_exceptions as sabre_exceptions%0A%0A'''%0Arequires config.json in the same directory for api authentication%0A%0A%7B%0A%09%22sabre_client_id%22: -----,%0A... | |
b7c22cddecb743e9597c92160e3aa0100e149e19 | Introduce hades test fixtures and first tests. | tests/model/test_hades.py | tests/model/test_hades.py | Python | 0 | @@ -0,0 +1,3153 @@
+from datetime import datetime, timedelta%0A%0Afrom pycroft.model import session%0Afrom pycroft.model.hades import radgroup_property_mappings, radcheck%0Afrom tests import FactoryDataTestBase%0Afrom tests.factories import PropertyGroupFactory, MembershipFactory, UserWithHostFactory, %5C%0A SwitchF... | |
33bb7c4e026d46dda184d682c89fad7481ab1a77 | Add migration script. | contrib/migration/migrate-compose-file-v1-to-v2.py | contrib/migration/migrate-compose-file-v1-to-v2.py | Python | 0 | @@ -0,0 +1,2967 @@
+#!/usr/bin/env python%0A%22%22%22%0AMigrate a Compose file from the V1 format in Compose 1.5 to the V2 format%0Asupported by Compose 1.6+%0A%22%22%22%0Afrom __future__ import absolute_import%0Afrom __future__ import unicode_literals%0A%0Aimport argparse%0Aimport logging%0Aimport sys%0A%0Aimport ruam... | |
5fc72b0a6efcd14196d33c8e0ba9b4b763ebf4d1 | Add a parse_time example | examples/parse_time.py | examples/parse_time.py | Python | 0.00019 | @@ -0,0 +1,1955 @@
+%22%22%22%0A================================================%0AParsing times with sunpy.time.parse_time%0A================================================%0A%0AExample to show some example usage of parse_time%0A%22%22%22%0A%0Afrom datetime import datetime, date%0Aimport numpy as np%0Aimport pandas%0... | |
71e9a3a7e867b0670871ac46834988b87787c272 | Add import-hacks.py snippet file | import-hacks.py | import-hacks.py | Python | 0.000001 | @@ -0,0 +1,1299 @@
+# Can control the import mechanism in Python.%0Aimport importlib.abc%0Aimport logging%0Aimport sys%0A%0Alogging.getLogger().setLevel(logging.INFO)%0A%0Aclass LoggingImporter(importlib.abc.Finder):%0A def find_module(self, name, path=None):%0A msg = %22importing %7B%7D on %7B%7D%22.format(n... | |
9d9e82487a6ad9494f65e484392334e89baf7b83 | Add AnalyzerResult class | coala/coalib/results/AnalyzerResult.py | coala/coalib/results/AnalyzerResult.py | Python | 0 | @@ -0,0 +1,1273 @@
+import uuid%0Afrom coalib.results.RESULT_SEVERITY import RESULT_SEVERITY%0A%0Aclass AnalyzerResult:%0A def __init__(self,%0A origin,%0A language: str,%0A language_ver: str,%0A project_name: str,%0A project_version: str,%0A... | |
60e4269027adc05db7b585ab51334c8d28cd7a1c | Add assignment writer | nbgrader/assignment_writer.py | nbgrader/assignment_writer.py | Python | 0.000001 | @@ -0,0 +1,3002 @@
+%22%22%22Based on the FilesWriter class included with IPython.%22%22%22%0A%0Aimport io%0Aimport os%0Aimport glob%0Aimport shutil%0A%0Afrom IPython.utils.traitlets import Unicode%0Afrom IPython.utils.path import ensure_dir_exists%0Afrom IPython.utils.py3compat import unicode_type%0A%0Afrom IPython.nb... | |
a998eaec11c9ec53e593e2a25542eabab0f75890 | Create __init__.py | app/__init__.py | app/__init__.py | Python | 0.000429 | @@ -0,0 +1,465 @@
+# app/__init__.py%0A%0Afrom flask_api import FlaskAPI%0Afrom flask_sqlalchemy import SQLAlchemy%0A%0A# local import%0Afrom instance.config import app_config%0A%0A# initialize sql-alchemy%0Adb = SQLAlchemy()%0A%0Adef create_app(config_name):%0A app = FlaskAPI(__name__, instance_relative_config=True... | |
633b6f4c5cecda938f02ff6ccaa529de7b47ce67 | Initialize excelToCSV | books/AutomateTheBoringStuffWithPython/Chapter14/PracticeProject/excelToCSV.py | books/AutomateTheBoringStuffWithPython/Chapter14/PracticeProject/excelToCSV.py | Python | 0.000001 | @@ -0,0 +1,1413 @@
+# Using the openpyxl module, write a program that reads all the Excel files in the%0A# current working directory and outputs them as CSV files.%0A# A single Excel file might contain multiple sheets; you%E2%80%99ll have to create one CSV%0A# file per sheet. The filenames of the CSV files should be%0A... | |
09181bd4c11501fa9e8274651370e45ac8d83316 | add vars01.py | trypython/basic/vars01.py | trypython/basic/vars01.py | Python | 0.000001 | @@ -0,0 +1,902 @@
+# coding: utf-8%0A%0A%22%22%22%0Avars()%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%E3%81%AE%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%81%A7%E3%81%99%E3%80%82%0A%22%22%22%0Afrom trypython.common.commoncls import SampleBase%0Afrom trypython.common.commonfunc import pr%0A%0A%0Aclass Sample(SampleBase):%0A def ... | |
7577933c1e016ee6d4bca73bfa3434dc19c55315 | add basic initialization | circa.py | circa.py | Python | 0.00001 | @@ -0,0 +1,359 @@
+import logging%0Aimport client%0A%0Aclass Circa(client.Client):%0A%09def __init__(self, conf):%0A%09%09conf%5B%22autoconn%22%5D = False%0A%09%09logging.basicConfig(filename=conf.get(%22log%22, %22circa.log%22), level=logging.INFO,%0A%09%09%09style=%22%25%22, format=%22%25(asctime)s %25(levelname)s %2... | |
ed479cf11540c6a67bb4b51eed42b91abd869090 | Add html_doc.py | tests/test_files/html_doc.py | tests/test_files/html_doc.py | Python | 0.000105 | @@ -0,0 +1,302 @@
+doc = %22%22%22%3C!DOCTYPE html%3E%0A%0A%3Chtml%3E%0A %3Chead%3E%0A %3Ctitle%3EHtml document%3C/title%3E%0A %3C/head%3E%0A%0A %3Cbody%3E%0A %3Cdiv%3E%0A %3Ch1%3EH1 Tag%3C/h1%3E%0A %3Ch1 class='class-name'%3EH1 Tag with class%3C/h1%3E%0A %3Ch1 id='id-name'%3EH1 Tag with id%3C/h... | |
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... | Python | 0 | @@ -1910,16 +1910,370 @@
ttery'%5D)
+%0A attrs = %7B%7D%0A if 'speed' in data:%0A attrs%5B'speed'%5D = float(data%5B'speed'%5D)%0A if 'direction' in data:%0A attrs%5B'direction'%5D = float(data%5B'direction'%5D)%0A if 'altitude' in data:%0A attrs%5B'altitude... |
8f32a5be4ffc427a1fbc6bf700edc81b191e876f | add tests for basic funcionality | test/api/test_rest.py | test/api/test_rest.py | Python | 0 | @@ -0,0 +1,2563 @@
+import json%0Afrom test.api import APIClient%0Afrom django.test import TestCase%0Afrom squad.core import models%0Afrom squad.ci import models as ci_models%0A%0A%0Aclass RestApiTest(TestCase):%0A%0A def setUp(self):%0A self.group = models.Group.objects.create(slug='mygroup')%0A self.... | |
86c6dcc8fe0ac739ed1ae1a7898ea609fe959c61 | add spectra extraction script | spectra.py | spectra.py | Python | 0 | @@ -0,0 +1,2437 @@
+import sqlite3%0Aimport igraph%0Aimport os%0Afrom matplotlib import pyplot as plt%0A%0Adb = 'genome.leishmania.hp_assembly.db'%0Awordlen = 10%0Abase_dir = 'spectra-%25d' %25 wordlen%0Apos_dir = os.path.join(base_dir, 'positive')%0Aneg_dir = os.path.join(base_dir, 'negative')%0Anum_bins = 1000%0Aylim... | |
d42b2ee3eb60a0c11c1a973e030de909519ba662 | Add garage.argparse.add_bool_argument | garage/argparse.py | garage/argparse.py | Python | 0.000024 | @@ -0,0 +1,515 @@
+__all__ = %5B%0A 'add_bool_argument',%0A%5D%0A%0Aimport argparse%0A%0A%0Adef add_bool_argument(parser, *args, **kwargs):%0A kwargs = dict(kwargs) # Make a copy before modifying it...%0A kwargs%5B'choices'%5D = (True, False)%0A kwargs%5B'type'%5D = parse_bool%0A parser.add_argument(*ar... | |
10f9b0d1b02c2b5f4c4eeac0c1f803657c89764b | add example file for smooth OT | examples/plot_OT_1D_smooth.py | examples/plot_OT_1D_smooth.py | Python | 0 | @@ -0,0 +1,2247 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0A====================%0A1D optimal transport%0A====================%0A%0AThis example illustrates the computation of EMD, Sinkhorn and smooth OT plans%0Aand their visualization.%0A%0A%22%22%22%0A%0A# Author: Remi Flamary %3Cremi.flamary@unice.fr%3E%0A#%0A# Licens... | |
82dda8f12060ba0d3f83b6a9ff92bfcfbb212e25 | Add utils | utils/extract_zipcodes.py | utils/extract_zipcodes.py | Python | 0.000016 | @@ -0,0 +1,433 @@
+import json%0Afrom bbvalib import create_mongoclient%0A%0A%0Adb = create_mongoclient()%0Azipcodes = set()%0Azipcodes.update(db.top_clients_week.find().distinct(%22shop_zipcode%22))%0Azipcodes.update(db.top_clients_month.find().distinct(%22shop_zipcode%22))%0Azipcodes.update(db.top_clients_week.find()... | |
31110631d7fa43c695bc1f5504cd02c3d0cab745 | Add some tests | tests/test_error_handlers.py | tests/test_error_handlers.py | Python | 0 | @@ -0,0 +1,669 @@
+from testutils import app # noqa: F401%0A%0A%0Adef test_not_found(client):%0A '''Test 404 error handler'''%0A results = client.get('/totally/made/up')%0A assert results.status_code == 404%0A assert results.json == %7B'error': 'Not found'%7D%0A%0A%0Adef test_method_not_allowed(client):%0A... | |
9d5be9d464168a3d9e9b3265a1581e0359f69f2a | test for #579 | test/test_issue579.py | test/test_issue579.py | Python | 0.000001 | @@ -0,0 +1,497 @@
+# test for https://github.com/RDFLib/rdflib/issues/579%0A%0Afrom rdflib import Graph, URIRef, Literal, Namespace%0Afrom rdflib.namespace import FOAF, RDF%0A%0Ag = Graph()%0Ag.bind('foaf', FOAF)%0An = Namespace(%22http://myname/%22)%0Ag.add((n.bob, FOAF.name, Literal('bb')))%0A# query is successful.%0... | |
d9b4b0d913304b19365854b0ffceab179237d8f8 | Add tests for float->int symbols (esp for 32-bit windows and linux) | numba/tests/test_floatsyms.py | numba/tests/test_floatsyms.py | Python | 0 | @@ -0,0 +1,1286 @@
+from __future__ import print_function%0Aimport numba.unittest_support as unittest%0Afrom numba.compiler import compile_isolated%0Afrom numba import types%0A%0A%0Aclass TestFloatSymbols(unittest.TestCase):%0A %22%22%22%0A Test ftol symbols on windows%0A %22%22%22%0A%0A def _test_template(... | |
45a6e108418944026f6d67fa018573a831dc5107 | add mul_recds.py | test/sql/mul_recds.py | test/sql/mul_recds.py | Python | 0.00028 | @@ -0,0 +1,160 @@
+import sqlite3%0A%0Awith sqlite3.connect(%22new.db%22) as connection:%0A c = connection.cursor()%0A%0A cities = %5B%0A ('Boston','MA',600000)%0A %5D%0A%0A
| |
aa320afb447ab8486720a05f0613cad446c9bea9 | Add graph module. | plumeria/plugins/graph.py | plumeria/plugins/graph.py | Python | 0 | @@ -0,0 +1,1912 @@
+import asyncio%0Aimport io%0Aimport re%0A%0Aimport matplotlib%0Aimport pkg_resources%0A%0Afrom plumeria.command import commands, CommandError%0Afrom plumeria.message import Response, MemoryAttachment%0Afrom plumeria.util.ratelimit import rate_limit%0A%0Amatplotlib.use('Agg')%0A%0Aimport matplotlib.p... | |
8ff6f08a497adba17bd02eae9ec6425a71927e08 | Update admin.py | avatar/admin.py | avatar/admin.py | 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 | @@ -81,16 +81,97 @@
azy as _
+%0Afrom django.utils import six%0Afrom django.template.loader import render_to_string
%0A%0Afrom a
@@ -243,59 +243,8 @@
ted%0A
-from avatar.templatetags.avatar_tags import avatar%0A
from
@@ -583,40 +583,251 @@
-return avatar(avatar_in.user, 80
+context = dict(%7B%0A 'u... |
3453d31f010c12757f72fe690b6bc6c5368a07ba | Use manufacturer id only for configure_reporting only when specified. (#19729) | homeassistant/components/zha/helpers.py | homeassistant/components/zha/helpers.py | """
Helpers for Zigbee Home Automation.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/zha/
"""
import asyncio
import logging
from .const import (
DEFAULT_BAUDRATE, REPORT_CONFIG_MAX_INT, REPORT_CONFIG_MIN_INT,
REPORT_CONFIG_RPT_CHANGE, RadioTy... | Python | 0 | @@ -2165,32 +2165,115 @@
er.ep_attribute%0A
+ kwargs = %7B%7D%0A if manufacturer:%0A kwargs%5B'manufacturer'%5D = manufacturer%0A
try:%0A
@@ -2462,33 +2462,16 @@
-manufacturer=manufacturer
+**kwargs
)%0A
|
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==... | Python | 0.999999 | @@ -623,49 +623,8 @@
n%22,%0A
- %22mycroft.skills.intent_service%22,%0A
|
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 | Python | 0 | @@ -0,0 +1,1886 @@
+# -*- coding: utf-8 -*-%0Aimport datetime%0Afrom south.db import db%0Afrom south.v2 import SchemaMigration%0Afrom django.db import models%0A%0A%0Aclass Migration(SchemaMigration):%0A%0A def forwards(self, orm):%0A # Removing unique constraint on 'FeedType', fields %5B'content_type'%5D%0A ... | |
1c6c32d453a1b2dd7011f05787e3a10a2a18bf62 | Version bump. | src/xworkflows/__init__.py | src/xworkflows/__init__.py | # -*- coding: utf-8 -*-
# Copyright (c) 2011-2012 Raphaël Barrois
__version__ = '0.4.0'
__author__ = 'Raphaël Barrois <raphael.barrois@polytechnique.org>'
from . import base
# Errors
AbortTransition = base.AbortTransition
ForbiddenTransition = base.ForbiddenTransition
InvalidTransitionError = base.InvalidTransitionE... | Python | 0 | @@ -79,17 +79,17 @@
= '0.4.
-0
+1
'%0A__auth
|
7b1fb0eb7f063c00c89b57ceca64a01881a7d4d9 | add const_thrust helper | crazyflie_demo/scripts/const_thrust.py | crazyflie_demo/scripts/const_thrust.py | Python | 0.000001 | @@ -0,0 +1,432 @@
+#!/usr/bin/env python%0A%0Aimport rospy%0Afrom geometry_msgs.msg import Twist%0A%0Aif __name__ == '__main__':%0A rospy.init_node('crazyflie_demo_const_thrust', anonymous=True)%0A p = rospy.Publisher('cmd_vel', Twist)%0A twist = Twist()%0A r = rospy.Rate(50)%0A #for i in range(0, 100):%... | |
50331d662d67d9f625f9f9198988522b38b2d1f0 | add task for midnight search index update, https://www.pivotaltracker.com/story/show/13730025 | apps/search/tasks.py | apps/search/tasks.py | Python | 0.000011 | @@ -0,0 +1,337 @@
+from utils.celery_search_index import LogEntry%0Afrom utils.celery_utils import task%0Afrom celery.schedules import crontab%0Afrom celery.decorators import periodic_task%0Afrom django.core.management import call_command%0A%0A@periodic_task(run_every=crontab(minute=0, hour=0))%0Adef update_search_inde... | |
3c2438049da743b53cb7a536ddc2db1a05302a33 | Add grab.tools.logs to configure logging module | grab/tools/logs.py | grab/tools/logs.py | Python | 0.000001 | @@ -0,0 +1,389 @@
+import logging%0A%0Adef default_logging(grab_log='/tmp/grab.log'):%0A %22%22%22%0A Customize logging output to display all log messages%0A except grab network logs.%0A%0A Redirect grab network logs into file.%0A %22%22%22%0A%0A logging.basicConfig(level=logging.DEBUG)%0A glog = l... | |
4662b430087404dbf011cf9ad97ee1e3188bfb9d | create wrapper for c_curve | wrappers/preseq/observed_complexity/wrapper.py | wrappers/preseq/observed_complexity/wrapper.py | Python | 0.000001 | @@ -0,0 +1,344 @@
+__author__ = %22Behram Radmanesh%22%0A__copyright__ = %22Copyright 2016, Behram Radmanesh%22%0A__email__ = %22behram.radmanesh@nih.gov%22%0A__license__ = %22MIT%22%0A%0A# import snakemake's ability to execute shell commands%0Afrom snakemake.shell import shell%0A%0A# execute preseq c_curve%0Ashell(%22... | |
ec1b3be5545d5ae530d3dc7dd8d90e6fe4730926 | add unittest for heap | tests/testIndexedHeap.py | tests/testIndexedHeap.py | Python | 0 | @@ -0,0 +1,1225 @@
+'''%0ACreated on 2017/9/29%0A%0A:author: hubo%0A'''%0Aimport unittest%0Afrom random import randrange, sample%0Afrom vlcp.utils.indexedheap import IndexedHeap%0A%0Aclass Test(unittest.TestCase):%0A%0A%0A def testRandomSort(self):%0A data = %5B(randrange(0,10000), randrange(0,10000)) for _ i... | |
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[__... | Python | 0.000001 | @@ -2230,32 +2230,24 @@
, '__mul__',
-%0A
'__truediv_
@@ -2261,24 +2261,32 @@
floordiv__',
+%0A
'__mod__',
@@ -2305,32 +2305,24 @@
, '__pow__',
-%0A
'__lshift__
@@ -2333,24 +2333,32 @@
__rshift__',
+%0A
'__and__',
@@ -2474,38 +2474,265 @@
__',
-%0A '__ifloordiv__', '__i... |
5db58544133c66c5cbb4122c99a95a0ca6ddfa26 | Create RomeOculus.py | home/Alessandruino/RomeOculus.py | home/Alessandruino/RomeOculus.py | Python | 0.000007 | @@ -0,0 +1,491 @@
+i01 = Runtime.createAndStart(%22i01%22,%22InMoov%22)%0Ai01.startHead(%22/dev/tty.usbmodem1411%22)%0A#i01.startLeftArm(%22COM5%22)%0A#leftHand = i01.startLeftHand(%22COM5%22)%0A#i01.leftArm.bicep.setMinMax(5,80)%0A%0A#i01.leftArm.bicep.moveTo(30)%0A%0Aoculus = Runtime.start(%22oculus%22,%22OculusDIY%2... | |
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... | Python | 0.000025 | @@ -237,17 +237,17 @@
om%0A%0A%0A%22%22%22
-r
+R
emove ob
@@ -635,28 +635,27 @@
sion = '
-262bbe790f4c
+6bed0575a0b
'%0A%0A%0Adef
|
c5fba0cc8acb482a0bc1c49ae5187ebc1232dba3 | Add tests for the different input variations. | tests/test_directions.py | tests/test_directions.py | Python | 0 | @@ -0,0 +1,1718 @@
+import unittest%0A%0Afrom shapely.geometry import LineString, Point%0A%0Afrom directions.base import _parse_points%0A%0Aclass DirectionsTest(unittest.TestCase):%0A def setUp(self):%0A self.p = %5B(1,2), (3,4), (5,6), (7,8)%5D%0A self.line = LineString(self.p)%0A%0A def test_origi... | |
635682c9d206cd9ae6ea184f9361937b0a272b90 | Add monadic utilities MonadicDict and MonadicDictCursor. | wqflask/utility/monads.py | wqflask/utility/monads.py | Python | 0 | @@ -0,0 +1,2462 @@
+%22%22%22Monadic utilities%0A%0AThis module is a collection of monadic utilities for use in%0AGeneNetwork. It includes:%0A%0A* MonadicDict - monadic version of the built-in dictionary%0A* MonadicDictCursor - monadic version of MySQLdb.cursors.DictCursor%0A that returns a MonadicDict instead of the ... | |
d21e0721b614423e07e81809fb60dd936494bfff | Add validators test | tests/test_validators.py | tests/test_validators.py | Python | 0.000001 | @@ -0,0 +1,810 @@
+import attr%0Afrom twisted.trial import unittest%0A%0Aimport txnats%0Afrom txnats.validators import is_instance_of_nats_protocol%0A%0A%0A@attr.s%0Aclass Foo(object):%0A protocol = attr.ib(default=None, %0A validator=attr.validators.optional(%0A is_instance_of_nats_protocol%0A ... | |
65e08089d6d89b25ca89a7f194ce1e4e72a9640b | Update cut-off-trees-for-golf-event.py | Python/cut-off-trees-for-golf-event.py | Python/cut-off-trees-for-golf-event.py | # Time: O(t * (logt + m * n)), t is the number of trees
# Space: O(t + m * n)
# You are asked to cut off trees in a forest for a golf event.
# The forest is represented as a non-negative 2D map, in this map:
#
# 0 represents the obstacle can't be reached.
# 1 represents the ground can be walked through.
# The place w... | Python | 0 | @@ -2189,16 +2189,17 @@
xpansion
+s
%0A
@@ -2340,16 +2340,8 @@
in
-another
deto
@@ -2352,16 +2352,17 @@
xpansion
+s
with ex
|
45f26b56d177798efca4825f063372b505df6a76 | Add gameman test | tests/gameman_test.py | tests/gameman_test.py | Python | 0 | @@ -0,0 +1,1024 @@
+import pytest%0Afrom savman import gameman%0A%0A@pytest.fixture%0Adef dir1(tmpdir):%0A return tmpdir.mkdir('dir1')%0A%0A@pytest.fixture%0Adef dir2(tmpdir):%0A return tmpdir.mkdir('dir2')%0A%0A@pytest.fixture%0Adef customfile(tmpdir, dir1, dir2):%0A file = tmpdir.join('custom.txt')%0A cus... | |
1e3781bc3527f72053fdc4aad4f4887c567c457c | Add unicode test. | tests/unicode/unicode.py | tests/unicode/unicode.py | Python | 0.000002 | @@ -0,0 +1,627 @@
+# Test a UTF-8 encoded literal%0As = %22asdf%C2%A9qwer%22%0Afor i in range(len(s)):%0A print(%22s%5B%25d%5D: %25s %25X%22%25(i, s%5Bi%5D, ord(s%5Bi%5D)))%0A%0A# Test all three forms of Unicode escape, and%0A# all blocks of UTF-8 byte patterns%0As = %22a%5CxA9%5CxFF%5Cu0123%5Cu0800%5CuFFEE%5CU000... | |
40154d7de207df9689ac220cc8966735cb3ed5af | Test asyncio in python 3.6 | tests/test_asyncio.py | tests/test_asyncio.py | Python | 0.000003 | @@ -0,0 +1,411 @@
+import asyncio%0A%0Aasync def routine0(s,n):%0A print('CRT:',s,':',n)%0A%0Aasync def routine(id, n):%0A print('TEST%5B%25s%5D %25d'%25(id,n))%0A if not n:%0A return%0A n -= 1%0A await routine(id, n)%0A await routine0(id, n)%0A%0Aloop = asyncio.get_event_loop()%0Atasks = %5B%0A asyncio.ensur... | |
c63651a5fba9dd67b345bfb95adef5d6206f5da3 | Add file lock | tagcache/lock.py | tagcache/lock.py | Python | 0.000001 | @@ -0,0 +1,1072 @@
+# -*- encoding: utf-8 -*-%0A%0Aimport os%0Aimport fcntl%0A%0A%0Aclass FileLock(object):%0A%0A def __init__(self, path):%0A%0A self.path = path%0A%0A self.fd = None%0A%0A def acquire(self, write=False, block=True):%0A%0A if self.fd is not None:%0A%0A self.release... | |
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,... | Python | 0.000009 | @@ -1786,32 +1786,38 @@
layer' and state
+.state
== STATE_PAUSED
@@ -1909,24 +1909,30 @@
r' and state
+.state
== STATE_PL
|
58d5d6b078abe524c51e6db7963cc5091b0e0835 | Remove failing test | tests/test_cmdline.py | tests/test_cmdline.py | # vim:fileencoding=utf-8:noet
'''Tests for shell.py parser'''
from powerline.shell import get_argparser, finish_args
from tests import TestCase
from tests.lib import replace_attr
import sys
if sys.version_info < (3,):
from io import BytesIO as StrIO
else:
from io import StringIO as StrIO # NOQA
class TestParser... | Python | 0.000005 | @@ -2054,80 +2054,8 @@
'),%0A
-%09%09%09%09(%5B'shell', '-R', 'abc'%5D, 'invalid %3Clambda%3E value'),%0A
%09%09%09%5D
|
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... | Python | 0 | @@ -671,44 +671,8 @@
nts%0A
-from collections import OrderedDict%0A
impo
@@ -1264,64 +1264,8 @@
nel)
-%0A channels = list(OrderedDict.fromkeys(channels))
%0A%0A
|
7963e426e2d1f58105d8712c0379114d93d32b07 | Add example with sklearn pipeline | examples/plot_feature_extraction_classification.py | examples/plot_feature_extraction_classification.py | Python | 0 | @@ -0,0 +1,2496 @@
+%22%22%22%0AUMAP as a Feature Extraction Technique for Classification%0A---------------------------------------------------------%0A%0AThe following script shows how UMAP can be used as a feature extraction%0Atechnique to improve the accuracy on a classification task. It also shows%0Ahow UMAP can be... | |
a6bbcdd9a28b4ad3ebc5319ab849bd9116b2f0c6 | Create 7kyu_how_many_points.py | Solutions/7kyu/7kyu_how_many_points.py | Solutions/7kyu/7kyu_how_many_points.py | Python | 0.012299 | @@ -0,0 +1,154 @@
+def get_los_angeles_points(results):%0A return sum(int(j.split(':')%5B0%5D) for i,j in results if __import__('re').fullmatch('Los%5CsAngeles%5Cs%5Ba-zA-Z%5D+$', i))%0A
| |
824623c9f836c1591d89f7292fc1f406a1af189a | add a stub test for job manipulation | test/jobstest.py | test/jobstest.py | Python | 0.000001 | @@ -0,0 +1,611 @@
+#!/usr/bin/python2.4%0A#%0A# Copyright (c) 2004-2005 rpath, Inc.%0A#%0A%0Aimport testsuite%0Atestsuite.setup()%0A%0Aimport rephelp%0A%0Aclass ReleaseTest(rephelp.RepositoryHelper):%0A def testBasicAttributes(self):%0A client = self.getMintClient(%22testuser%22, %22testpass%22)%0A pro... | |
af205246543fbb874ebf20b530fac04a3ba9808c | Add some notes to graph script | graph.py | graph.py | Python | 0 | @@ -0,0 +1,2304 @@
+from __future__ import unicode_literals%0A%0A%0Aclass Graph(object):%0A %22%22%22A class for a simple graph data structure.%22%22%22%0A def __init__(self):%0A self.graph = %7B%7D%0A%0A def __repr__(self): # Consider how we want to repr this.%0A return repr(self.graph)%0A%0A ... | |
5d554573031f2f7b60d963c587aa650a025f6c45 | Create tutorial3.py | tutorial3.py | tutorial3.py | Python | 0 | @@ -0,0 +1,1701 @@
+%22%22%22%0Atutorial3.py%0Aby E. Dennison%0A%22%22%22%0Afrom ggame import App, RectangleAsset, ImageAsset, SoundAsset, Sprite, Sound%0Afrom ggame import LineStyle, Color%0A%0ASCREEN_WIDTH = 640%0ASCREEN_HEIGHT = 480%0A%0Agreen = Color(0x00ff00, 1)%0Ablack = Color(0, 1)%0Anoline = LineStyle(0, black)... | |
bcaa60ce73134e80e11e7df709e7ba7dbc07d349 | Add tests for systemd module | tests/test_systemd.py | tests/test_systemd.py | Python | 0 | @@ -0,0 +1,2581 @@
+#!/usr/bin/env python3%0Aimport unittest%0Afrom unittest import mock%0Afrom unittest.mock import MagicMock, patch%0A%0Afrom portinus import systemd%0A%0Aclass testSystemd(unittest.TestCase):%0A%0A def setUp(self):%0A systemd.subprocess.check_output = MagicMock(return_value=True)%0A ... | |
0c3107739671398de1a206cfbb7673c25c543e60 | Update driver value in Seat model. | driver27/migrations/0009_populate_driver_in_seats.py | driver27/migrations/0009_populate_driver_in_seats.py | Python | 0 | @@ -0,0 +1,555 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0A%0A%0Adef populate_driver_in_seats(apps, schema_editor):%0A Seat = apps.get_model(%22driver27%22, %22Seat%22)%0A for seat in Seat.objects.all():%0A driver = seat.contender.dr... | |
3b4c811f0b45f5739ce7c0d64f31eb2c2c9a7f4b | add battery | ai/machine-learning/battery/battery.py | ai/machine-learning/battery/battery.py | Python | 0.000003 | @@ -0,0 +1,784 @@
+from numpy import *%0A%0Adef loadData():%0A xArr, yArr = %5B%5D, %5B%5D%0A for i in open('trainingdata.txt'):%0A line = map(float, i.split(','))%0A if line%5B0%5D %3C 4:%0A xArr.append(line%5B:-1%5D)%0A yArr.append(line%5B-1%5D)%0A return xArr, yArr%0A%0Ad... | |
023e587e28e148be3a21d4cb34a702a68ef02a0b | test script to list root dirs of image files | testdir.py | testdir.py | Python | 0 | @@ -0,0 +1,956 @@
+#!/usr/local/bin/python%0A%0Aimport sys%0A%0Aimport disklib.mediageom%0Aimport disklib.validity%0Aimport msfat.dir%0Aimport msfat.volume%0A%0A%0Adef main():%0A%09prog_errs = %5B %5D%0A%0A%09for path in sys.argv%5B1:%5D:%0A%09%09print path%0A%0A%09%09try:%0A%09%09%09validity = disklib.validity.read_va... | |
338f8d95df785b49eb0c00209535bfde675b6ce9 | Create release_jobs_from_hold.py | release_jobs_from_hold.py | release_jobs_from_hold.py | Python | 0 | @@ -0,0 +1,642 @@
+#!/usr/bin/env perl%0Ause strict;%0Ause Getopt::Long;%0A%0A%0Amy $usage = %22%5Ct%5Ct --usage $0 job_id=%3CPBS JOB ID%3E min=%3CStart of array%3E max=%3CEnd of array%3E%5Cn%22;%0Amy $command = %22releasehold -a%22;%0Amy $job_id;%0Amy $min;%0Amy $max;%0A$%5C= %22%5Cn%22;%0A%0A%0A%0Aif (! scalar(@A... | |
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... | Python | 0.9995 | @@ -674,16 +674,29 @@
cense.%0A%0A
+import uuid%0A%0A
from tem
@@ -809,28 +809,16 @@
rt attr%0A
-import uuid%0A
%0A%0Aclass
@@ -3118,16 +3118,748 @@
r(ex))%0A%0A
+ @attr(type=%5B'negative', 'smoke'%5D)%0A def test_create_additional_default_security_group_fails(self):%0A # Create security group named ... |
fb03cd60646e56a789e61471f5bb6772f7035d6e | add test for io | tests/test_io.py | tests/test_io.py | Python | 0.000001 | @@ -0,0 +1,2200 @@
+# -*- coding: utf-8 -*-%0D%0A%0D%0Aimport os%0Aimport re%0Aimport unittest%0D%0A%0Afrom kisell.core import Origin, Pipe%0Afrom kisell import io%0D%0A%0D%0A%0D%0A_license_file_path = os.path.join(%0D%0A os.path.dirname(os.path.dirname(__file__)), 'LICENSE'%0D%0A)%0D%0A_license_file_content = None%... | |
64fca89a9bb3bc0cd7725f4ad2ef0924c5c97859 | remove very large target coverage | lib/GATK4/fixCollectHsMetrics.py | lib/GATK4/fixCollectHsMetrics.py | Python | 0 | @@ -0,0 +1,1665 @@
+import argparse%0D%0Aimport sys%0D%0Aimport logging%0D%0Aimport os%0D%0Aimport random%0D%0A%0D%0ADEBUG=False%0D%0ANotDEBUG=not DEBUG%0D%0A%0D%0Aparser = argparse.ArgumentParser(description=%22fixCollectHsMetrics%22,%0D%0A formatter_class=argparse.ArgumentDefaultsHelpF... | |
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 | @@ -0,0 +1 @@
+%0A
| |
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 | Python | 0 | @@ -0,0 +1,2164 @@
+import os%0Aimport glob%0Afrom shutil import copy2%0A%0Afrom moulinette.utils.log import getActionLogger%0A%0Afrom yunohost.tools import Migration%0Afrom yunohost.service import _run_service_command%0A%0Alogger = getActionLogger('yunohost.migration')%0A%0APHP5_POOLS = %22/etc/php5/fpm/pool.d%22%0APH... | |
935c77777d9d15269d2579f001c3abd97f8635e7 | add - module for communicating with redis. | flickipedia/redisio.py | flickipedia/redisio.py | Python | 0 | @@ -0,0 +1,1825 @@
+%22%22%22%0AModule for handling redis IO%0A%22%22%22%0A%0Aimport redis%0Afrom flickipedia.config import log%0A%0A__author__ = 'Ryan Faulkner'%0A__date__ = %222014-04-01%22%0A%0A%0Aclass DataIORedis(object):%0A %22%22%22 Class implementing data IO for Redis. %22%22%22%0A%0A DEFAULT_HOST = 'loca... | |
637165eef82d40abc240b1dc40edddabecbb6af3 | Create new package. (#6503) | var/spack/repos/builtin/packages/r-biocstyle/package.py | var/spack/repos/builtin/packages/r-biocstyle/package.py | Python | 0 | @@ -0,0 +1,1949 @@
+##############################################################################%0A# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r... | |
b577b1b54cf8ba2f1b9184bda270e0bcd9613ef5 | Create wordcount-mapper.py | wordcount-mapper.py | wordcount-mapper.py | Python | 0.000004 | @@ -0,0 +1,383 @@
+#!/usr/bin/env python%0A%0Aimport sys%0A%0Afor line in sys.stdin: # Input is read from STDIN and the output of this file is written into STDOUT%0A line = line.strip() # remove leading and trailing whitespace%0A words = line.split() # split the line into words%0A %0A for word in wo... | |
86304649c06c15003df956c894560c8cc3b8e542 | fix stream name | src/streamlink/plugins/douyutv.py | src/streamlink/plugins/douyutv.py | import re
import time
import hashlib
from requests.adapters import HTTPAdapter
from streamlink.plugin import Plugin
from streamlink.plugin.api import http, validate, useragents
from streamlink.stream import HTTPStream, HLSStream, RTMPStream
API_URL = "https://capi.douyucdn.cn/api/v1/{0}&auth={1}"
VAPI_URL = "https:/... | Python | 0.000056 | @@ -463,33 +463,13 @@
%22m
-iddle%22: 720,%0A %22middle2
+edium
%22: 7
@@ -4500,24 +4500,89 @@
m, url=url)%0A
+ if 'middle' in name:%0A name = %22medium%22%0A
|
79a0302ed3cebc0b93775824f6bfa5ce17bdb371 | Create j34all_possible.py | j34all_possible.py | j34all_possible.py | Python | 0.00001 | @@ -0,0 +1,2574 @@
+import itertools%0A%0Aclass ListOps():%0A %0A def __init__(self, length=9, total=100):%0A self.length = length%0A self.total = total%0A temp_list = %5B%5D%0A temp_value = %5B0, 1, -1%5D%0A temp_value = tuple(temp_value)%0A temp_list.append(temp_value)%... | |
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 | Python | 0.000052 | @@ -0,0 +1,1684 @@
+from nltk.corpus import wordnet as wn%0Afrom nltk.corpus import wordnet_ic%0Asemcor_ic = wordnet_ic.ic('ic-semcor.dat')%0Afrom nltk.corpus import lin_thesaurus as thes%0Aimport heapq%0A%0A# specifies number of top-scoring synonyms to use%0ANUMBER_SYNONYMS = 3%0A%0A%0Adef expand_query(query):%0A%09%0... | |
1b810ec3fb2bdd241d831a3167d9ed8051fa29ca | Add to repo. | mapIt.py | mapIt.py | Python | 0 | @@ -0,0 +1,382 @@
+#!/usr/bin/python3%0A# mapIt.py - Launches a map in the browser using an address from the%0A# command line or clipboard.%0A%0Aimport webbrowser%0Aimport sys%0A%0A%0Aif len(sys.argv) %3E 1:%0A # Get address from command line.%0A address = ' '.join(sys.argv%5B1:%5D)%0Aelse:%0A # Get address fr... | |
3559faeceff06aee82409ca22158223aff696b07 | Create MajorityElement_004.py | leetcode/169-Majority-Element/MajorityElement_004.py | leetcode/169-Majority-Element/MajorityElement_004.py | Python | 0.000001 | @@ -0,0 +1,403 @@
+class Solution(object):%0A def majorityElement(self, nums):%0A %22%22%22%0A :type nums: List%5Bint%5D%0A :rtype: int%0A %22%22%22%0A num, cnt = nums%5B0%5D, 1%0A for i in xrange(1, len(nums)):%0A if nums%5Bi%5D == num:%0A cnt += 1... | |
ba0d2ed9373df05eae280f8664214decddbd755c | add basic drawing tests for svg | kiva/tests/test_svg_drawing.py | kiva/tests/test_svg_drawing.py | Python | 0 | @@ -0,0 +1,752 @@
+import contextlib%0Aimport StringIO%0Aimport unittest%0Afrom xml.etree import ElementTree%0A%0Afrom kiva.tests.drawing_tester import DrawingTester%0Afrom kiva.svg import GraphicsContext%0A%0A%0Aclass TestSVGDrawing(DrawingTester, unittest.TestCase):%0A%0A def create_graphics_context(self, width, h... | |
993d606bc69eef1ef821b121b96cf4076d73b4f4 | add logging on downloader start | lbrynet/lbryfilemanager/EncryptedFileDownloader.py | lbrynet/lbryfilemanager/EncryptedFileDownloader.py | """
Download LBRY Files from LBRYnet and save them to disk.
"""
import logging
from zope.interface import implements
from twisted.internet import defer
from lbrynet.core.client.StreamProgressManager import FullStreamProgressManager
from lbrynet.core.StreamDescriptor import StreamMetadata
from lbrynet.lbryfile.client.... | Python | 0.000001 | @@ -4287,32 +4287,97 @@
f _start(self):%0A
+ log.info('Starting Downloader for %25s', self.stream_hash)%0A
yield En
@@ -4872,32 +4872,113 @@
._save_status()%0A
+ log.info('Set Downloader status for %25s to %25s', self.stream_hash, status)%0A
defer.re
|
911baa4f700c34b2c2c3de8239a0fee60c12f1e9 | Create db.py | www/transwarp/db.py | www/transwarp/db.py | Python | 0.000002 | @@ -0,0 +1 @@
+%0A
| |
c51d6fd5d12fd22391e792f8bb792a48b5bcda04 | Create yt-search-filter.py | yt-search-filter.py | yt-search-filter.py | Python | 0.000002 | @@ -0,0 +1,2058 @@
+%22%22%22This program is designed to facilitate rapidly%0Afinding a video and its link on YouTube. Instructions for use:%0AInstall elementtree and gdata 2.0 APIs.%0ARun program through command prompt of choice and enter a query%0Ato be searched on YouTube. Specific queries work best.%0AThen enter a ... | |
fd1759b05c35d45bb6bf289f5267415e8c2a447e | Add missing superclass | rbuild/internal/rbuilder/rbuildercommand.py | rbuild/internal/rbuilder/rbuildercommand.py | Python | 0.999946 | @@ -0,0 +1,1891 @@
+#%0A# Copyright (c) 2008 rPath, Inc.%0A#%0A# This program is distributed under the terms of the Common Public License,%0A# version 1.0. A copy of this license should have been distributed with this%0A# source file in a file called LICENSE. If it is not present, the license%0A# is always available at... | |
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 | Python | 0.000032 | @@ -0,0 +1,515 @@
+%22%22%22create indices on resource owners%0A%0ARevision ID: 613e7c11dead%0ARevises: b5e6dd3449dd%0ACreate Date: 2018-02-15 11:51:29.659352%0A%0A%22%22%22%0Afrom __future__ import unicode_literals%0A%0A# revision identifiers, used by Alembic.%0Arevision = '613e7c11dead'%0Adown_revision = 'b5e6dd3449d... | |
1b5a8307fd816c935f197993d1ead07cffc01892 | add simple consumer | samsa/rdsamsa/consumer.py | samsa/rdsamsa/consumer.py | Python | 0 | @@ -0,0 +1,2438 @@
+from collections import namedtuple%0Afrom copy import copy%0Aimport logging%0A%0Aimport rd_kafka%0Afrom samsa import abstract%0A%0A%0Alogger = logging.getLogger(__name__)%0A%0A%0AMessage = namedtuple(%22Message%22, %5B%22topic%22, %22payload%22, %22key%22, %22offset%22%5D)%0A# TODO %5E%5E namedtuple... | |
8ae6a00e8cf851b46694cd4ab28a827d27fc8d65 | add contextual help for new select field feature | ForgeTracker/forgetracker/widgets/admin_custom_fields.py | ForgeTracker/forgetracker/widgets/admin_custom_fields.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (t... | Python | 0 | @@ -3620,16 +3620,44 @@
spaces;
+ quote if containing spaces;
prefix
|
46a652e13da604776d745d2f09e02e4f75dc3fd7 | test commit 1 | testfile.py | testfile.py | Python | 0.000004 | @@ -0,0 +1,15 @@
+print(%22Hello%22)%0A
| |
afaed1b9c6889312cc3e6fa992a03c500470e967 | add test for feature sequence | src/edge/tests/test_feature.py | src/edge/tests/test_feature.py | Python | 0 | @@ -0,0 +1,555 @@
+from django.test import TestCase%0A%0Afrom edge.models import Fragment%0A%0A%0Aclass FeatureTests(TestCase):%0A def setUp(self):%0A self.root_sequence = %22agttcgaggctga%22%0A self.root = Fragment.create_with_sequence(%22Foo%22, self.root_sequence)%0A%0A def test_sequence_positive... | |
bf34c1dbb37865e62e97e3463645c7df16a4ca08 | Add an interface for Markov Chains | markov_chain.py | markov_chain.py | Python | 0.000001 | @@ -0,0 +1,740 @@
+from random import choice%0A%0Aclass MarkovChain(object):%0A %22%22%22 An interface for signle-word states Markov Chains %22%22%22%0A%0A def __init__(self, text=None):%0A self._states_map = %7B%7D%0A %0A if text is not None:%0A self.add_text(text)%0A%0A def ad... | |
055c1b0d140e2c5659c2767fd123fc69d0f83859 | Create clean_up_d3s.py | clean_up_d3s.py | clean_up_d3s.py | Python | 0.000002 | @@ -0,0 +1,90 @@
+from globalvalues import RPI%0Aif RPI:%0A import RPi.GPIO as GPIO%0A %0A %0AGPIO.cleanup()%0A
| |
fb10273ee2007846fa760d36ebb6806b35407fa3 | add script/json/ts-urllib2.py | script/json/ts-urllib2.py | script/json/ts-urllib2.py | Python | 0.000001 | @@ -0,0 +1,1226 @@
+#!/usr/bin/env python%0A#%0A# ts-urllib2.py%0A#%0A# Author: Zex %3Ctop_zlynch@yahoo.com%3E%0A#%0Aimport urllib2%0Aimport json%0Afrom os import path, mkdir%0Afrom basic import *%0A%0Aif not path.isdir(RESPONSE_DIR):%0A mkdir(RESPONSE_DIR)%0A%0Adef case():%0A headers = %7B%0A #'Content-Ty... | |
65cc9fd3ada01790484469028875e580e8447c85 | Update migrations to current state (#65) | aa_stripe/migrations/0021_auto_20190906_1623.py | aa_stripe/migrations/0021_auto_20190906_1623.py | Python | 0 | @@ -0,0 +1,3154 @@
+# Generated by Django 2.1.11 on 2019-09-06 20:23%0A%0Aimport django_extensions.db.fields.json%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('aa_stripe', '0020_stripecharge_statement_descriptor'),%0A %5D%0A%0A op... | |
6f415dccb547cae95aeb9946e503cadd99f63bd6 | add backtest_files.py | scripts/backtest_files.py | scripts/backtest_files.py | Python | 0.000003 | @@ -0,0 +1,944 @@
+#!/usr/bin/python3%0A%0Aimport json%0Aimport sys%0Afrom pprint import pprint%0Aimport requests%0Aimport re%0Aimport os%0Aimport shutil%0A%0Alocation = os.path.dirname(os.path.realpath(__file__))%0Adata_dir = os.path.join(location, %22..%22, %22data%22)%0A%0Aconfig_name = sys.argv%5B1%5D%0Aitems = sys... | |
63ff0b3d0be5f34b8daea811b1eac33736a4c393 | args list can be simpelr | hack/prow/run_tests.py | hack/prow/run_tests.py | #!/usr/bin/env python
# Copyright 2019 The Kubernetes 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
#
# Unle... | Python | 0.999983 | @@ -4276,50 +4276,8 @@
w')%0A
- args = shlex.split('bash -x %25s' %25 test)%0A
p
@@ -4287,36 +4287,50 @@
ubprocess.Popen(
-args
+%5B'bash','-x',test%5D
, stdout=subproc
|
7e1058821f165e60d76eee1b07a7b411f3439408 | Create uber.py | modules/uber.py | modules/uber.py | Python | 0.000036 | @@ -0,0 +1,40 @@
+def uber(self):%0A self.send_chan(%22Moi%22)%0A
| |
98591c4385ae3f8e8093f6f97b57ef2c9a7284b4 | add label to expr_to_config sub-dicts | hyperopt/pyll_utils.py | hyperopt/pyll_utils.py | from functools import partial
from base import DuplicateLabel
from pyll.base import Apply
from pyll import scope
from pyll import as_apply
#
# Hyperparameter Types
#
@scope.define
def hyperopt_param(label, obj):
""" A graph node primarily for annotating - VectorizeHelper looks out
for these guys, and optimize... | Python | 0.000001 | @@ -5545,16 +5545,86 @@
tions,))
+,%0A 'label': label,%0A
%7D%0A el
|
b8795def87635aa8192f5f8cf64afe1a22ec30f1 | Add findCsetsIntersection.py script to find intersecting changesets in our knownBrokenRanges. | autobisect-js/findCsetsIntersection.py | autobisect-js/findCsetsIntersection.py | Python | 0 | @@ -0,0 +1,1784 @@
+#!/usr/bin/env python%0A#%0A# This Source Code Form is subject to the terms of the Mozilla Public%0A# License, v. 2.0. If a copy of the MPL was not distributed with this file,%0A# You can obtain one at http://mozilla.org/MPL/2.0/.%0A%0Aimport os%0Aimport sys%0Afrom optparse import OptionParser%0A%0A... | |
edd808ae5ef9b69dddaf522850ef1f55a295990e | Add tests for generating predictions | cf_predict/test/test_cf_predict.py | cf_predict/test/test_cf_predict.py | """Unit test cf_predict"""
import pytest
from cf_predict import __version__
from cf_predict.resources import get_db
@pytest.mark.usefixtures("client_class")
class TestCf_predict:
def test_catalogue(self):
rv = self.client.get("/")
assert rv.status_code == 200
assert rv.json == {
... | Python | 0.000001 | @@ -27,22 +27,130 @@
%0Aimport
-pytest
+json%0Aimport pickle%0A%0Aimport numpy as np%0Aimport pytest%0A%0Afrom mockredis import MockRedis%0Afrom .conftest import models
%0Afrom cf
@@ -428,76 +428,13 @@
%22
-predict_url%22: %22http://localhost/predict%22,%0A %22model_version
+model
_url
@@ -744,18 +74... |
e81f823a1542bf24caa081b299352e593e1a10c9 | Add a utility function | cohydra/util.py | cohydra/util.py | Python | 0.00008 | @@ -0,0 +1,971 @@
+import os%0A%0A%0Adef recursive_scandir(top_dir, dir_first=True):%0A %22%22%22Recursively scan a path.%0A%0A Args:%0A top_dir: The path to scan.%0A dir_first: If true, yield a directory before its contents.%0A Otherwise, yield a directory's contents before the%0A directo... | |
e29de047d770de70f3745ae410b62d0ddad4b0b4 | Add one test case for IOTOS-358 | lib/oeqa/runtime/misc/appFW.py | lib/oeqa/runtime/misc/appFW.py | Python | 0 | @@ -0,0 +1,310 @@
+from oeqa.oetest import oeRuntimeTest%0A%0Aclass AppFwTest(oeRuntimeTest):%0A%0A %22%22%22 App Framework testing %22%22%22%0A%0A def test_sqlite_integration(self):%0A%0A %22%22%22 test sqlite is integrated in image %22%22%22%0A%0A (status,output) = self.target.run(%22rpm -qa %7C g... | |
891a10c6dec653d36e7416698369e5e5566338d5 | Remove unused imports | pip/commands/configuration.py | pip/commands/configuration.py | import logging
import subprocess
from pip import cmdoptions
from pip.basecommand import Command
from pip.configuration import Configuration
from pip.exceptions import ConfigurationError
from pip.status_codes import SUCCESS, ERROR
logger = logging.getLogger(__name__)
class ConfigurationCommand(Command):
"""Manag... | Python | 0.000001 | @@ -31,35 +31,8 @@
ss%0A%0A
-from pip import cmdoptions%0A
from
|
1051ec35f33c3e7a3946af3cf8a11a86dc9265a0 | Create utility module | app_v2/utils.py | app_v2/utils.py | Python | 0 | @@ -0,0 +1,175 @@
+def map_range(x, in_min, in_max, out_min, out_max):%0A out_delta = out_max - out_min%0A in_delta = in_max - in_min%0A%0A return (x - in_min) * out_delta / in_delta + out_min%0A
| |
351d243ccf33b0dd979d84a67e6288621dd84227 | Fix --debug-shell | src/ostbuild/pyostbuild/vcs.py | src/ostbuild/pyostbuild/vcs.py | # Copyright (C) 2011 Colin Walters <walters@verbum.org>
#
# 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 of the License, or (at your option) any later version.
#
# Thi... | Python | 0 | @@ -2288,20 +2288,28 @@
ir(dest)
- and
+:%0A if
overwri
@@ -2312,32 +2312,36 @@
rwrite:%0A
+
shutil.rmtree(de
@@ -2336,32 +2336,70 @@
il.rmtree(dest)%0A
+ else:%0A return dest%0A
if not os.pa
|
c6d505ef6610ebb383e4f0a7a3d1b746f7fd5f75 | add group | conjur/group.py | conjur/group.py | Python | 0.000001 | @@ -0,0 +1,1429 @@
+#%0A# Copyright (C) 2014 Conjur Inc%0A#%0A# Permission is hereby granted, free of charge, to any person obtaining a copy of%0A# this software and associated documentation files (the %22Software%22), to deal in%0A# the Software without restriction, including without limitation the rights to%0A# use, ... | |
0fd4a7e33f67a2405362c2a57ba72f5f6c034651 | should be called daily | bin/generate_tsas.py | bin/generate_tsas.py | Python | 0.998713 | @@ -0,0 +1,2326 @@
+#!/usr/bin/python%0Afrom __future__ import print_function%0Aimport cProfile%0Aimport copy%0Aimport sys%0Aimport gc%0Aimport logging%0Alogging.basicConfig(level=logging.INFO)%0A# own modules%0Afrom datalogger import DataLoggerWeb as DataLoggerWeb%0Afrom commons import *%0A%0Adef main(project, tablena... | |
d14c0127a2489c03a50f49751b8b735202873e29 | Add RFID Reader example. | black_rfid_reader.py | black_rfid_reader.py | Python | 0 | @@ -0,0 +1,665 @@
+from keyboard_alike import reader%0A%0A%0Aclass RFIDReader(reader.Reader):%0A %22%22%22%0A This class supports common black RFID Readers for 125 kHz read only tokens%0A http://www.dx.com/p/intelligent-id-card-usb-reader-174455%0A %22%22%22%0A def extract_meaningful_data_from_chunk(self... | |
a14b5aad9f6f15cfd9bee32c689e023a5dc94f19 | Add very basic visualization tool in python until I find a go lib which can do the same | visualize.py | visualize.py | Python | 0 | @@ -0,0 +1,1138 @@
+'''%0ACreate a visual representation of the various DAGs defined%0A'''%0A%0Aimport requests%0Aimport networkx as nx%0Aimport matplotlib.pyplot as plt%0A%0A%0Aif __name__ == '__main__':%0A g = nx.DiGraph()%0A labels = %7B%0A 'edges': %7B%7D,%0A 'nodes': %7B%7D,%0A %7D%0A%0A ... | |
78c64d00df97edbec5f07213dc87ff30a7bb4ca9 | Create moveToObject.py | af_scripts/misc/moveToObject.py | af_scripts/misc/moveToObject.py | Python | 0.000001 | @@ -0,0 +1,624 @@
+# move to object%0A%0Aimport pymel.core as pm%0A%0Adef move_to_object():%0A%09get_sel = pm.ls(sl=1,fl=1)%0A%09if len(get_sel) == 2:%0A%09%09src = get_sel%5B1%5D%0A%09%09target = get_sel%5B0%5D%0A%09%09src_oc_x = pm.objectCenter(src,x=1)%0A%09%09src_oc_y = pm.objectCenter(src,y=1)%0A%09%09src_oc_z = p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.