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 |
|---|---|---|---|---|---|---|---|
5b57686868b595fb4e7b431822fe4c7bf2de6cfb | Add unittests for title handling methods | test/test_uploadbot.py | test/test_uploadbot.py | #!/usr/bin/env python
# -*- coding: latin-1 -*-
"""Unit tests."""
import unittest
from uploadlibrary.UploadBot import _cut_title
class TestUploadBot(unittest.TestCase):
"""Testing UploadBot methods."""
def test_cut_title_witout_cutting(self):
"""Test _cut_title() without cutting"""
inputs ... | Python | 0 | |
b15c7c044b0c514285bcb8c29b7bcfc8cf777c8b | Add tests for the signals | ormcache/tests/test_signals.py | ormcache/tests/test_signals.py | from django.core.cache import cache
from django.test import SimpleTestCase
from ormcache.signals import cache_hit, cache_missed, cache_invalidated
from ormcache.tests.testapp.models import CachedDummyModel
class SignalsTestCase(SimpleTestCase):
def setUp(self):
self.signal_called = False
self.in... | Python | 0.000002 | |
f07cdf5bd22dd352122d679a6e8c4cc213aad013 | Create multiarm_selector.py | multiarm_selector.py | multiarm_selector.py | from __future__ import division
import random
class MultiarmSelector(object):
def __init__(self):
self.versions_served = []
self.clicks = 0
self.missed = 0
self.success_count = {
"A": 0,
"B": 0
}
self.total_count = {
"A": 0,
... | Python | 0.000001 | |
bf2cc99162389c6b5c18051f01756e17d9d11ce6 | Add a test for rename. | tests/integration/test_rename.py | tests/integration/test_rename.py | """
Test 'rename'.
"""
import subprocess
import unittest
from ._constants import _CLI
from ._misc import Service
@unittest.skip("Wating for Rename")
class Rename1TestCase(unittest.TestCase):
"""
Test 'rename' when pool is non-existant.
"""
_MENU = ['rename']
_POOLNAME = 'deadpool'
_NEW_POOL... | Python | 0.000004 | |
4d661b0fcb6f4b130370c010d16a2afec2449456 | Create mergesort.py | aids/sorting_and_searching/mergesort.py | aids/sorting_and_searching/mergesort.py | '''
In this module, we implement merge sort
Time complexity: O(n * log n)
'''
def mergesort(arr):
'''
Sort array using mergesort
'''
pass
def _merge(arr):
pass
| Python | 0.000001 | |
b1d49a3a48d8aa501e3c1b2c0511f33bb6af633f | Add Implementation tests | tests/lsp/test_implementation.py | tests/lsp/test_implementation.py |
import unittest
from typing import List, Optional, Union
from pygls.lsp.methods import IMPLEMENTATION
from pygls.lsp.types import (ImplementationOptions, ImplementationParams, Location, LocationLink,
Position, Range, TextDocumentIdentifier)
from pygls.server import LanguageServer
from ..... | Python | 0 | |
c6ed5b2543a9d069ecc2f182ec2ec07a6018a7e8 | Add tests for shortest paths. | networkx/algorithms/shortest_paths/tests/test_generic.py | networkx/algorithms/shortest_paths/tests/test_generic.py | #!/usr/bin/env python
from nose.tools import *
import networkx as nx
from random import random, choice
class TestGenericPath:
def setUp(self):
from networkx import convert_node_labels_to_integers as cnlti
self.grid=cnlti(nx.grid_2d_graph(4,4),first_label=1,ordering="sorted")
self.cycle=nx.... | Python | 0.000332 | |
d199510ab03975832b262cbc2160c3d6f3371e8d | Add solution in Python | codeforces/dominated_subarray.py | codeforces/dominated_subarray.py | def read_first_line():
return int(input())
def read_cases(number_of_cases):
cases = []
for i in range(number_of_cases):
line = input()
if i % 2 == 1:
case = [int(string) for string in line.strip().split(' ')]
cases.append(case)
return cases
def updateHistory(i... | Python | 0.004351 | |
6a8ff154b8468d61b18d390db9e710fc0b224ac7 | Add Left-Handed toons crawler | comics/comics/lefthandedtoons.py | comics/comics/lefthandedtoons.py |
from comics.aggregator.crawler import CrawlerBase, CrawlerResult
from comics.meta.base import MetaBase
class Meta(MetaBase):
name = 'Left-Handed Toons'
language = 'en'
url = 'http://www.lefthandedtoons.com/'
start_date = '2007-01-14'
rights = 'Justin & Drew'
class Crawler(CrawlerBase):
histor... | Python | 0 | |
af12033a905f27d92f3e42f804058e44f584f1f0 | Add a script which sucks the router-dev database and creates a varnish template for puppet | modules/varnish/utils/create-varnish-template-from-mongodb.py | modules/varnish/utils/create-varnish-template-from-mongodb.py | #!/usr/bin/python
# This script can be run on a mongodb machine and will connect to the router-dev
# database. From that database, it will generate an erb template on stdout.
import re
from pymongo import Connection
connection = Connection()
db = connection['router-dev']
print "# Backends"
applications = db.applica... | Python | 0 | |
59e8fe848da5cfa3874c82776205082764efbe63 | Enable Jenkins Python3 monster for i19 | tests/test_python3_regression.py | tests/test_python3_regression.py | from __future__ import absolute_import, division, print_function
def test_no_new_python3_incompatible_code_is_introduced_into_this_module():
import i19
import pytest
import dials.test.python3_regression as py3test
result = py3test.find_new_python3_incompatible_code(i19)
if result is None:
pytest.skip('No... | Python | 0 | |
0c3f3c444d863ec4acff704efee71a29ab8cdf34 | Add ip_reverse module | plugins/modules/ip_reverse.py | plugins/modules/ip_reverse.py | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
from ansible.module_utils.basic import AnsibleModule
__metaclass__ = type
DOCUMENTATION = '''
---
module: ip_reverse
short_description: Modify reverse on IP
description:
- Modify reverse on IP
author: Synthesio SRE Team
requirem... | Python | 0 | |
fafba64d767c125af28b9b6c495917e7f4b69960 | add script to update BRIGHTstarinblob masks when star is in a neighbouring brick | py/legacypipe/bright-neighbors.py | py/legacypipe/bright-neighbors.py | from legacypipe.survey import LegacySurveyData, wcs_for_brick, MASKBITS
import numpy as np
import fitsio
from astrometry.util.fits import fits_table
from scipy.ndimage.morphology import binary_dilation
import matplotlib.pyplot as plt
from astrometry.util.plotutils import PlotSequence
from collections import Counter
de... | Python | 0 | |
c208263dcc40078e48f78565b37be7b601f0d817 | Add Python wrappers for the bibtex program. | pybtex/tests/run_bibtex.py | pybtex/tests/run_bibtex.py | #!/usr/bin/env python
# Copyright (C) 2006, 2007, 2008, 2009 Andrey Golovizin
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any late... | Python | 0 | |
c5ac422ff1e4628ad8ea53e4f1442e6a70bf959f | add first command test | tests/test_commands.py | tests/test_commands.py | import unittest
class CreateRangeVotingCommand():
def __init__(self, question, choices):
self.question = question
self.choices = choices
class CreateRangeVotingCommandTestCase(unittest.TestCase):
def test_has_choices_and_question(self):
question = 'Question ?'
choices = ['a',... | Python | 0.000016 | |
391e145b6e82aaa87e2ab23cfea53cb7ae98bc2a | Add a work-in-progress parser for the ClientHello message. | tlsenum/parse_hello.py | tlsenum/parse_hello.py | import construct
from tlsenum import hello_constructs
class ClientHello(object):
@property
def protocol_version(self):
return self._protocol_version
@protocol_version.setter
def protocol_version(self, protocol_version):
assert protocol_version in ["3.0", "1.0", "1.1", "1.2"]
... | Python | 0.000006 | |
2421007118ddaaa5e0d8bbb8c0a6512b27e22206 | implement expect column values valid cryptocurrency ticker (#4759) | contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_crypto_ticker.py | contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_crypto_ticker.py | from typing import Optional
import cryptocompare
from great_expectations.core.expectation_configuration import ExpectationConfiguration
from great_expectations.execution_engine import PandasExecutionEngine
from great_expectations.expectations.expectation import ColumnMapExpectation
from great_expectations.expe... | Python | 0 | |
12587b033ec803989bc477e823706b76a3ce7fb6 | add expect_column_values_ip_address_in_network (#4640) | contrib/experimental/great_expectations_experimental/expectations/expect_column_values_ip_address_in_network.py | contrib/experimental/great_expectations_experimental/expectations/expect_column_values_ip_address_in_network.py | """
This is a template for creating custom ColumnMapExpectations.
For detailed instructions on how to use it, please see:
https://docs.greatexpectations.io/docs/guides/expectations/creating_custom_expectations/how_to_create_custom_column_map_expectations
"""
import ipaddress
import json
from typing import Optional
... | Python | 0 | |
764bad33b598841333d4d1674bf5667957ada551 | Add a no-op measurement | tools/perf/measurements/no_op.py | tools/perf/measurements/no_op.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import page_measurement
class NoOp(page_measurement.PageMeasurement):
def __init__(self):
super(NoOp, self).__init__('no_op')
d... | Python | 0.000014 | |
a704a1964659a45b007e696ed1547b563dcffa4f | create 2.py | 2.py | 2.py | # content
| Python | 0 | |
a1db6c4379c787124d7ee825adbcc76d2069a3c6 | Add check to travis to make sure new boards are built, fix #1886 | tools/travis_new_boards_check.py | tools/travis_new_boards_check.py | #! /usr/bin/env python3
import os
import re
import json
import build_board_info
# Get boards in json format
boards_info_json = build_board_info.get_board_mapping()
# print(boards_info_json)
# TODO (Carlos) Find all the boards on the json format
# We need to know the path of the .travis.yml file
base_path = os.path... | Python | 0 | |
9a1c9e2cbe7f9b9decbe93d567458b6a6976e420 | complete 14 longest collatz sequence | 14-longest-collatz-sequence.py | 14-longest-collatz-sequence.py | from functools import lru_cache
def sequence(n):
'bad idea'
while n is not 1:
yield n
n = 3*n+1 if n%2 else n/2
yield n
def next_num(n):
if n % 2:
return 3 * n + 1
else:
return n / 2
@lru_cache(None)
def collatz_length(n):
if n == 1:
return 1
else:
... | Python | 0.000092 | |
aa301d8eaa3c3f89154103bce882501164756017 | Implement the ADMIN command | txircd/modules/rfc/cmd_admin.py | txircd/modules/rfc/cmd_admin.py | from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from zope.interface import implements
irc.RPL_ADMINLOC1 = "257"
irc.RPL_ADMINLOC2 = "258"
class AdminCommand(ModuleData):
implements(IPlugin, IModuleData)
... | Python | 0.000362 | |
00a3eb2ee30a3aea0912be79147a9a2045503f1d | Add an "API" version of the library which allows a game to be played programatically. | api.py | api.py | from blackjack import Blackjack
class APIBlackjack(Blackjack):
def __init__(self, **kwargs):
super(APIBlackjack, self).__init__(interactive=False, **kwargs)
def setup(self):
# Reset everything.
self.players = []
self.dealer = []
self.bets = []
assert len(self.... | Python | 0 | |
9392f7215c77749f94908e8f4c0899a712177bfe | Hello, Flask | app.py | app.py | from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return "Hello, world!"
if __name__ == '__main__':
app.run()
| Python | 0.999123 | |
3f5a752a7978c2432ce3106492d771c00a5f1279 | Create geo.py | geo.py | geo.py | import requests
def example():
# grab some lat/long coords from wherever. For this example,
# I just opened a javascript console in the browser and ran:
#
# navigator.geolocation.getCurrentPosition(function(p) {
# console.log(p);
# })
#
latitude = 35.1330343
longitude = -90.06250... | Python | 0.000006 | |
30debe34005280517f56795e1f0852dccf3cb7f2 | Add hip module computing hipster rank for a route | hip.py | hip.py | import numpy as np
from numpy import sin, cos, sqrt
import pandas as pd
from sklearn.neighbors import KDTree
fs_df = pd.read_csv('fs.csv')
fs_df.lat = fs_df.lat.apply(float)
fs_df.lng = fs_df.lng.apply(float)
def get_nearby(start, end, dist_meters=50):
x0, y0 = start
x1, y1 = end
dx, dy = x1 - x0, y1 - y... | Python | 0 | |
1110311ef90a45497af4cdfb8558d1b05fc799d0 | add a script to run the server | run.py | run.py | #!/usr/bin/env python
# coding: utf-8
import bottle
from logging import info
from devmine import Devmine
from devmine.config import (
environment,
settings
)
def main():
info('Devmine server started')
db_url = settings.db_url
server = settings.server
if not db_url:
db_url = environme... | Python | 0.000001 | |
e007695e38b2207c9229856c95f37a12e740cb91 | Add view demographics tests | radar/tests/permissions/test_can_user_view_demographics.py | radar/tests/permissions/test_can_user_view_demographics.py | from radar.permissions import can_user_view_demographics
from radar.roles import COHORT_RESEARCHER, COHORT_SENIOR_RESEARCHER, ORGANISATION_CLINICIAN
from helpers.permissions import make_cohorts, make_user, make_patient, make_organisations
def test_admin():
patient = make_patient()
user = make_user()
asse... | Python | 0 | |
a46f2b8e42852b3c51d31c9402328c82d5d1f78c | Create new package. (#8144) | var/spack/repos/builtin/packages/swap-assembler/package.py | var/spack/repos/builtin/packages/swap-assembler/package.py | ##############################################################################
# Copyright (c) 2013-2018, 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 | |
2904992eb431ac4a92442ccb1fcff5715ae8c7fa | add migrations for new policy parameters | webapp/apps/taxbrain/migrations/0035_auto_20161110_1624.py | webapp/apps/taxbrain/migrations/0035_auto_20161110_1624.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import webapp.apps.taxbrain.models
class Migration(migrations.Migration):
dependencies = [
('taxbrain', '0034_auto_20161004_1953'),
]
operations = [
migrations.AddField(
... | Python | 0 | |
b068e4f8c3e5e8d7a0f1c45d5f1b6ac424b44153 | Make validate recipients to ignore empty values | src/ggrc/models/comment.py | src/ggrc/models/comment.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: andraz@reciprocitylabs.com
# Maintained By: andraz@reciprocitylabs.com
"""Module containing comment model and comment related mixins."""
from sqla... | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: andraz@reciprocitylabs.com
# Maintained By: andraz@reciprocitylabs.com
"""Module containing comment model and comment related mixins."""
from sqla... | Python | 0.000001 |
8840340bbd8310cf03f12accbb51dd81921ccf86 | Fix use of `format` for unicode | src/ggrc/models/request.py | src/ggrc/models/request.py | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: vraj@reciprocitylabs.com
from ggrc import db
from .mixins import deferred, Base, Described
class Request(... | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: vraj@reciprocitylabs.com
from ggrc import db
from .mixins import deferred, Base, Described
class Request(... | Python | 0.001803 |
dbc761530b77c606038f62ed498c192b67321e8f | Test co2 load_data for Python 3. | statsmodels/datasets/tests/test_data.py | statsmodels/datasets/tests/test_data.py | from statsmodels.datasets import co2
def test_co2_python3():
# this failed in pd.to_datetime on Python 3 with pandas <= 0.12.0
dta = co2.load_pandas()
| Python | 0 | |
299bb8bccf8485a12bc341cb45b2d2c82771f5dd | add pentagon import | pentagon_import/gen_pentagon.py | pentagon_import/gen_pentagon.py | import os
import math
SRC_POS = '46,562, 82,562, 82,526, 46,526'
FILE_NAME = '角色5围表.csv'
OUTPUT = 'pentagon.lua'
EDGE = 300
INDEX = 19
START_ID = 0
def rotate(src, rad, dst):
dst[0] = src[0] * math.cos(rad) - src[1] * math.sin(rad)
dst[1] = src[0] * math.sin(rad) + src[1] * math.cos(rad)
def gen_vertex(edge, da... | Python | 0.999607 | |
efc935b030750c26e24217d5f97dde1dc8a7ea66 | add script to clone mvn dependency to local from gradle | python/mirror-mvn-dependency.py | python/mirror-mvn-dependency.py | #!/usr/bin/python
"""
This script is used to make a mirror maven repository from a gradle build
1. make sure your project can be build correctly
2. run this script in your project root directory
3. add following code to your gradle file
buildscript {
repositories {
maven { url "file://${rootProject.projectDir}/... | Python | 0 | |
1b2c67a0d4a237ce56dc40616b1a023b515aee0f | add setup.py | sldc/setup.py | sldc/setup.py | from distutils.core import setup
setup(name="sldc",
version="1.0",
description="Segment Locate Dispatch Classify workflow",
author="Romain Mormont",
author_email="romain.mormont@gmail.com",
)
| Python | 0.000001 | |
379d8b1fb828918f8d77b0acf0e270eb94e650e5 | Add example for `adapt_rgb` | doc/examples/plot_adapt_rgb.py | doc/examples/plot_adapt_rgb.py | """
=========================================
Adapting gray-scale filters to RGB images
=========================================
There are many filters that are designed work with gray-scale images but not
color images. To simplify the process of creating functions that can adapt to
RGB images, scikit-image provides ... | Python | 0.000001 | |
bb065a747215b6665eec78c5141b0a0d82296dac | Add migration to replace '<removed>' with '<removed>@{uuid}.com'.format(uuid=str(uuid4())) in contact_information.email to pass validation | migrations/versions/1400_repair_contact_information_emails_post_data_retention_removal.py | migrations/versions/1400_repair_contact_information_emails_post_data_retention_removal.py | """Replace '<removed>' with '<removed>@{uuid}.com'.format(uuid=str(uuid4())) in contact_information to pass validation.
Revision ID: 1400
Revises: 1390
Create Date: 2019-10-29 09:09:00.000000
"""
from uuid import uuid4
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, column
# revisio... | Python | 0.000054 | |
434827540d4e11254615cd52b7efb36b746f9d0d | Create tf_simple_LR.py | tf_simple_LR.py | tf_simple_LR.py | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 1 19:50:54 2016
@author: max
"""
import tensorflow as tf
import numpy as np
import matplotlib.pylab as m
x_data = np.linspace(0.0,1.0,num = 500,dtype='float32')
x_data = np.reshape(x_data,(500,))
y_data = np.linspace(0.0,1.0,num = 500,dtype='float32')
y_data = y_data ... | Python | 0.000401 | |
3fb15a0e2fd4b1c9d6fb90ea5db92e99fda578c7 | Create topKFrequent.py | topKFrequent.py | topKFrequent.py | #
# Given a non-empty array of integers, return the k most frequent elements.
#
# For example,
# Given [1,1,1,2,2,3] and k = 2, return [1,2].
#
# Note:
# You may assume k is always valid, 1 ≤ k ≤ number of unique elements.
# Your algorithm's time complexity must be better than O(n log n), whe... | Python | 0 | |
3190b1e90c4f5de71e766fc97acb6c03b5c6888b | Create tweet-ip.py | tweet-ip.py | tweet-ip.py | from twitter import *
import subprocess
from random import randint
import time
import urllib2
def internet_on():
try:
response=urllib2.urlopen('http://twitter.com',timeout=1)
return True
except urllib2.URLError as err: pass
return False
def getserial():
# Extract serial from cpuinfo fil... | Python | 0.002257 | |
d7a5743bf92627280c2067be7dc496cd81b8353c | add unit tests file | unit_tests.py | unit_tests.py | import pytest
r = pytest.main(["-s", "tests/unit"])
if r:
raise Exception("There were test failures or errors.") | Python | 0 | |
8dc6afa76f2dcfdba4d80c28e9fdfbc278bd8374 | add XFCC-related config tests for invalid values | python/tests/test_ambassador_module_validation.py | python/tests/test_ambassador_module_validation.py | from typing import List, Tuple
import logging
import pytest
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s test %(levelname)s: %(message)s",
datefmt='%Y-%m-%d %H:%M:%S'
)
logger = logging.getLogger("ambassador")
from ambassador import Cache, IR
from ambassador.compile import Compile
def ... | Python | 0 | |
5a2042ebd62cefdda82b6e288b4b6d5b0f527fcd | Add script to add uplaoders to a repo | repomgmt/management/commands/repo-add-uploader.py | repomgmt/management/commands/repo-add-uploader.py | #
# Copyright 2012 Cisco Systems, Inc.
#
# Author: Soren Hansen <sorhanse@cisco.com>
#
# 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... | Python | 0 | |
09c8399092c3c97be068051306fda057170cf290 | Add LPC residual computation. | scikits/talkbox/linpred/common.py | scikits/talkbox/linpred/common.py | from scipy.signal import lfilter
from scikits.talkbox.linpred import lpc
def lpcres(signal, order, axis = -1):
"""Compute the LPC residual of a signal.
The LPC residual is the 'error' signal from LPC analysis, and is defined
as:
res[n] = x[n] - xe[n] = 1 + a[1] x[n-1] + ... + a[p] x[n-p]
Whe... | Python | 0 | |
1afe54b237724ce8f06379ef461e5d849ddeec74 | Add Persian Badwords | revscoring/languages/persian.py | revscoring/languages/persian.py | import warnings
import enchant
from .language import Language, LanguageUtility
DICTIONARY = enchant.Dict("fa")
BADWORDS = set([
"کیرم", "ایتالیک", "کونی", "کیر", "فرمود", "آله", "فرموده", "فرمودند",
"جنده", "برووتو", "لعنت", "کون", "السلام", "جمهورمحترم", "کونی",
"کاکاسیاه", "آشغال", "گائیدم", "گوزیده", ... | import warnings
import enchant
from .language import Language, LanguageUtility
DICTIONARY = enchant.Dict("fa")
def is_misspelled_process():
def is_misspelled(word):
return not DICTIONARY.check(word)
return is_misspelled
is_misspelled = LanguageUtility("is_misspelled", is_misspelled_process,
... | Python | 0.999746 |
4fe8df5d09c554b45d5097ca0574b47703c9b581 | Add another simpler test for %f | tests/strings/string_format_f_simple.py | tests/strings/string_format_f_simple.py | a = 1.123456
b = 10
c = -30
d = 34
e = 123.456789
f = 892122.129899
# form 0
s = "b=%f" % a
print s
# form 1
s = "b,c,d=%f+%f+%f" % (a, e, f)
print s
| Python | 0.000159 | |
620dd5511b5be36523fadda4080c57afca292ee1 | mon_clock_skew_check.py: Check for clock skews on the monitors | teuthology/task/mon_clock_skew_check.py | teuthology/task/mon_clock_skew_check.py | import logging
import contextlib
import ceph_manager
import time
import gevent
import json
from teuthology import misc as teuthology
log = logging.getLogger(__name__)
class ClockSkewCheck:
"""
Periodically check if there are any clock skews among the monitors in the
quorum. By default, assume no skews are suppo... | Python | 0.999995 | |
215822f6edb48f156a15548ff40d21d76e14d692 | Add markdown as submodule | dash_core_components/markdown/__init__.py | dash_core_components/markdown/__init__.py | from .Markdown import Markdown
from .. import _js_dist
from .. import _css_dist
_js_dist.append(
{
'relative_package_path': 'highlight.pack.js',
'namespace': 'dash_core_components'
}
)
_css_dist.append(
{
'relative_package_path': 'highlight.css',
'namespace': 'dash_core_co... | Python | 0.000005 | |
e6ff67fc67e3c3f1a1513534088743a243e1257a | Add tests to the role logic | tests/app/soc/logic/models/test_role.py | tests/app/soc/logic/models/test_role.py | #!/usr/bin/env python2.5
#
# Copyright 2010 the Melange authors.
#
# 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 applic... | Python | 0 | |
3657eed1c0f0cf29be85bce03983e5b2c2581b9b | test showing bug in cyl mesh face inner product | tests/mesh/test_cylMeshInnerProducts.py | tests/mesh/test_cylMeshInnerProducts.py | from SimPEG import Mesh
import numpy as np
import sympy
from sympy.abc import r, t, z
import unittest
TOL = 1e-1
class CylInnerProducts_Test(unittest.TestCase):
def test_FaceInnerProduct(self):
# Here we will make up some j vectors that vary in space
# j = [j_r, j_z] - to test face inner products... | Python | 0 | |
8ad86651a9d07984c0b1afb0ec7e400288ac6d2e | add pyRpc2 | python/proto/pyRpc2/__init__.py | python/proto/pyRpc2/__init__.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2016 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyrig... | Python | 0.999108 | |
47c2a98d28c8e592035761b4ecfcd1026038fd14 | Add an option to not automatically record interaction for gesture actions. | tools/telemetry/telemetry/page/actions/gesture_action.py | tools/telemetry/telemetry/page/actions/gesture_action.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page.actions import page_action
from telemetry.page.actions import wait
from telemetry import decorators
from telemetry.page.actions import ac... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page.actions import page_action
from telemetry.page.actions import wait
from telemetry import decorators
from telemetry.page.actions import ac... | Python | 0.000018 |
20a191ad9325909434a6ca806ef69c515cbce6a8 | add new package (#24749) | var/spack/repos/builtin/packages/py-neurokit2/package.py | var/spack/repos/builtin/packages/py-neurokit2/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyNeurokit2(PythonPackage):
"""The Python Toolbox for Neurophysiological Signal Processing... | Python | 0 | |
2322b349aac06395382d26a95b5d965ab0f0b326 | Test save, load functionality in Statespace | statsmodels/tsa/statespace/tests/test_save.py | statsmodels/tsa/statespace/tests/test_save.py | """
Tests of save / load / remove_data state space functionality.
"""
from __future__ import division, absolute_import, print_function
import numpy as np
import pandas as pd
import os
from statsmodels import datasets
from statsmodels.tsa.statespace import (sarimax, structural, varmax,
... | Python | 0 | |
58624ba3b267fdc0e1ae6d8509c0a1315f22c22f | Initialize P4_autoDownloadTorrent | books/AutomateTheBoringStuffWithPython/Chapter16/PracticeProjects/P4_autoDownloadTorrent.py | books/AutomateTheBoringStuffWithPython/Chapter16/PracticeProjects/P4_autoDownloadTorrent.py | # Write a program that checks an email account every 15 minutes for any instructions
# you email it and executes those instructions automatically.
#
# For example, BitTorrent is a peer-to-peer downloading system. Using free BitTorrent
# software such as qBittorrent, you can download large media files on your home compu... | Python | 0.000004 | |
db2135d269058ed381239e725797322b95072d3f | Predict some data similar to problem on assignment | outlier_detection/svm_classification_with_synthetic_data.py | outlier_detection/svm_classification_with_synthetic_data.py | import numpy as np
from matplotlib import pyplot as plt
import matplotlib.font_manager
from sklearn import svm
def main():
tests = 20
# Generate train data
X = (np.random.randn(120, 2) *
np.array([0.08, 0.02]) +
np.array([0.3, 0.6]))
X_train = X[:-tests]
X_test = X[-tests... | Python | 0.999856 | |
f41585c0bccf63ad1d5d451c0eeb4bb091264416 | test factories stub | test/test_factories.py | test/test_factories.py | from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
__author__ = 'ahbbollen'
import pytest
from pyrefflat import Reader
from pyrefflat.factories import *
@pytest.fixture(scope="module")
def factory():
factory = RecordFactory()
r... | Python | 0 | |
a2f20be78ad54a6fe118b197cc416dcfdfb6dddf | add tf test file | TF-Demo/AlexNetDemo/test_tf.py | TF-Demo/AlexNetDemo/test_tf.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: violinsolo
# Created on 28/12/2017
import tensorflow as tf
import numpy as np
x = []
for i in range(0, 20):
x += [i]
print x
# trans to float32
x1 = np.asarray(x, dtype=np.float32)
print 'new x:'
print x1
with tf.Session() as sess:
m = np.reshape(x, [-1, ... | Python | 0 | |
f81a8d33c4865f51750ae4168e0646979e6eb262 | Translate original pseudocode algorithms | hearsay.py | hearsay.py | __all__ = ['Detect', 'DistToReference', 'Dist', 'ProbClass']
import math
def Detect(s_inf, N_obs, R_pos, R_neg, gamma=1, theta=1, D_req=1):
"""Algorithm 1
Perform online binary classification on the infinite stream s_inf using
sets of positive and negative reference signals R_pos and R_neg.
"""
... | Python | 0.999999 | |
9ad5cf7a663b83b725f0ae19d5190e0d6634fbb4 | exhaustive n by m test | blaze/api/tests/test_into_exhaustive.py | blaze/api/tests/test_into_exhaustive.py | from __future__ import absolute_import, division, print_function
from dynd import nd
import numpy as np
from pandas import DataFrame
from blaze.api.into import into, discover
from datashape import dshape
import blaze
from blaze import Table
import bcolz
L = [(1, 'Alice', 100),
(2, 'Bob', 200),
(3, 'Charli... | Python | 0.999616 | |
8026b091b1bae1a3b241b6b23b515ce8b5ec084e | Add openshift inventory plugin | plugins/inventory/openshift.py | plugins/inventory/openshift.py | #!/bin/python
# (c) 2013, Michael Scherer <misc@zarb.org>
#
# This file is part of Ansible,
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) a... | Python | 0 | |
5856ceb23cf639ee1cc3ea45d81a1917c0ef031d | Make a pnacl-finalize tool, that runs the final steps for pnacl ABI stability. | pnacl/driver/pnacl-finalize.py | pnacl/driver/pnacl-finalize.py | #!/usr/bin/python
# Copyright (c) 2013 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# IMPORTANT NOTE: If you make local mods to this file, you must run:
# % pnacl/build.sh driver
# in order for them to take eff... | Python | 0.000665 | |
73027d04a416f24dbaaf685da6eb1893c6c433ab | Add hanabank adapter | adapters/hana.py | adapters/hana.py | #-*- coding: utf-8 -*-
from datetime import datetime, timedelta
import json
from bs4 import BeautifulSoup
import urllib, urllib2
en_name = 'hana'
name = u'하나은행'
def query(account, password, resident):
"""
하나은행 계좌 잔액 빠른조회. 빠른조회 서비스에 등록이 되어있어야 사용 가능.
빠른조회 서비스: https://open.hanabank.com/flex/quick/quickServi... | Python | 0.000001 | |
7f65c70b786024e8213c56448f8d715bda8c0197 | add jsonrpc | skitai/saddle/jsonrpc_executor.py | skitai/saddle/jsonrpc_executor.py | from . import wsgi_executor
try:
import jsonrpclib
except ImportError:
pass
from aquests.protocols.http import respcodes
class Executor (wsgi_executor.Executor):
def __call__ (self):
request = self.env ["skitai.was"].request
data = self.env ["wsgi.input"].read ()
... | Python | 0.000002 | |
26ff3cbfcd9aee35da3645573c01717518467e8d | Create main.py | unit-3-mixed-reading-and-assignment-lessons/lesson-4-assignment-multiple-code-blocks/main.py | unit-3-mixed-reading-and-assignment-lessons/lesson-4-assignment-multiple-code-blocks/main.py | class Operation(object):
def __init__(self, *args):
# Do something here
pass
def operate(self):
raise NotImplementedError()
class AddOperation(Operation):
# The only method present in this class
def operate(self):
pass
class SubtractOperation(Operation):
def oper... | Python | 0.000001 | |
b589ab584cc1fdade736d0c166aae73978018dc5 | add channel out example | examples/channel_out/mnist_cnn.py | examples/channel_out/mnist_cnn.py | from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import itertools
import numpy as np
import sklearn.datasets
import sklearn.cross_validation
import sklearn.metrics
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
import treeano.la... | Python | 0 | |
c95772e8b3119f464dba4b8fd864812a525a4379 | add tests | tests/test_core.py | tests/test_core.py | # -*- coding: utf-8 -*-
from saltmill import Mill
from pepper import PepperException
import pytest
def test_login():
mill = Mill()
mill.login()
def test_auto_login():
mill = Mill()
MSG = 'This is a test.'
ret = mill.local('*', 'test.echo',MSG)
assert len(ret['return'][0]) > 0
for salt_id,... | Python | 0 | |
83cfb4d135b5eb3eaa4efb3f74ce13d44afb4c5a | Add a test for __main__ | tests/test_main.py | tests/test_main.py | import pytest
from cutadapt.__main__ import main
def test_help():
with pytest.raises(SystemExit) as e:
main(["--help"])
assert e.value.args[0] == 0
| Python | 0.00053 | |
0275556bcb29f4468c4a7e5b0771686c031e3c94 | Add context test. | demos/context.py | demos/context.py | #!/usr/bin/env python
import fluidsynth
settings = fluidsynth.FluidSettings()
settings["synth.chorus.active"] = "off"
settings["synth.reverb.active"] = "off"
settings["synth.sample-rate"] = 22050
synth = fluidsynth.FluidSynth(settings)
driver = fluidsynth.FluidAudioDriver(settings, synth)
player = fluidsynth.Flui... | Python | 0.000003 | |
eb15e17e99212f2d779ef33a1a9dfa7293ad96ad | Add `ProtectedFieldsMixin` for use with `ChangeProtected`s | shoop/core/utils/form_mixins.py | shoop/core/utils/form_mixins.py | # -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django.utils.translation import ugettext_lazy as _
class ProtectedFi... | Python | 0 | |
9a82eb7fe4f587b00cca155b84a36c6d590e0e16 | Add tests to patterns | tests/test_patterns.py | tests/test_patterns.py | from bottery import patterns
def test_message_handler_check_positive_match():
message = type('Message', (), {'text': 'ping'})
handler = patterns.MessageHandler(pattern='ping')
assert handler.check(message)
def test_message_handler_check_negative_match():
message = type('Message', (), {'text': 'Ping'... | Python | 0.000001 | |
2087394a69b3d4ca47e441b2561a0645c9a99e68 | Add test_recharge | tests/test_recharge.py | tests/test_recharge.py | import pastas as ps
import pandas as pd
def test_linear():
index = pd.date_range("2000-01-01", "2000-01-10")
prec = pd.Series([1, 2] * 5, index=index)
evap = prec / 2
rm = ps.RechargeModel(prec=prec, evap=evap, rfunc=ps.Exponential,
recharge="Linear", name="recharge")
retu... | Python | 0 | |
170373e6f0a1a416a50e16a3fbfb6a2da2b2e700 | Add Site traversal object | usingnamespace/api/traversal/v1/site.py | usingnamespace/api/traversal/v1/site.py | import logging
log = logging.getLogger(__name__)
from pyramid.compat import string_types
from .... import models as m
class Site(object):
"""Site
Traversal object for a site ID
"""
__name__ = None
__parent__ = None
def __init__(self, site_id):
"""Create the default root object
... | Python | 0 | |
97fe3384b0e614e17010623af5bccf515ce21845 | Migrate jupyter_{notebook => server}_config.py | .jupyter/jupyter_server_config.py | .jupyter/jupyter_server_config.py | # https://jupyter-server.readthedocs.io/en/stable/operators/migrate-from-nbserver.html
#c.ServerApp.browser = 'chromium-browser'
#c.ServerApp.terminado_settings = { "shell_command": ["/usr/bin/env", "bash"] }
c.ServerApp.open_browser = False
c.ServerApp.port_retries = 0
c.KernelSpecManager.ensure_native_kernel = False... | Python | 0.000001 | |
d4541113581433b63f19f23a9bde249acf8324a8 | Add a vizualization tool | tools/visualize.py | tools/visualize.py | #!/usr/bin/python
import matplotlib.pyplot as plt
import sys
if len(sys.argv) < 2:
print "Usage: vizualize.py file1[:label1] file2[:label2] ..."
colors = ['g', 'b', 'r', '#F800F0', '#00E8CC', '#E8E800']
markers = { 'I' : '*', 'P' : 's', 'B' : 'o' }
if len(sys.argv) - 1 > len(colors):
print "Too many files s... | Python | 0.000011 | |
5fc7fa839616213d07ad85e164f6639ff1225065 | Add override for createsuperuser | src/sentry/management/commands/createsuperuser.py | src/sentry/management/commands/createsuperuser.py | from __future__ import absolute_import, print_function
from django.core.management import call_command
from django.contrib.auth.management.commands.createsuperuser import Command
class Command(Command):
help = 'Performs any pending database migrations and upgrades'
def handle(self, **options):
call_... | Python | 0.000001 | |
4f2df39d909632e0d7a25c739daf8f2c1fa52cbb | Use prints and str.format | tvrenamr/config.py | tvrenamr/config.py | import logging
import sys
from yaml import safe_load
from .errors import ShowNotInConfigException
class Config(object):
def __init__(self, config):
self.log = logging.getLogger('Config')
self.config = self._load_config(config)
self.log.debug('Config loaded')
self.defaults = s... | import logging
import sys
from yaml import safe_load
from .errors import ShowNotInConfigException
class Config(object):
def __init__(self, config):
self.log = logging.getLogger('Config')
self.config = self._load_config(config)
self.log.debug('Config loaded')
self.defaults = s... | Python | 0.000001 |
7f860b23975150642bd6f8d244bce96d401603b0 | Improve the help text for the rdp options | nova/conf/rdp.py | nova/conf/rdp.py | # Copyright 2015 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.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | # Copyright 2015 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.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | Python | 0.957736 |
2a635a797a9828e047aff6c57b375138f0cd7ed0 | 206.reverse-ll | 206.reverse-ll/206.reverse-ll.py | 206.reverse-ll/206.reverse-ll.py | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
def show(head):
out = ""
while head:
out += " " + str(head.val)
head = head.next
print(out)
class Solution:
def reverseList(self, head):
"""
... | Python | 0.999977 | |
e7d86c77471d3b0890287e0ca32ecfb94b80abda | add util method for Leave One Out crossvalidation | scikits/learn/utils/crossval.py | scikits/learn/utils/crossval.py | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD Style.
# $Id: cd.py 473 2010-03-03 16:27:38Z twigster $
import numpy as np
import exceptions
class LOO:
"""
Leave-One-Out cross validation:
Provides train/test indexes to split data in train test sets
Examples:
import scik... | Python | 0.000005 | |
e42fcd8a7dfd213c3de8ccc925410ab3dfe68a3c | Test Lemniscate of Bernoulli trajectory | src/test/trajectory/test_lemniscate_trajectory.py | src/test/trajectory/test_lemniscate_trajectory.py | #!/usr/bin/env python
import unittest
from geometry_msgs.msg import Point
from trajectory.lemniscate_trajectory import LemniscateTrajectory
class LemniscateTrajectoryTest(unittest.TestCase):
def setUp(self):
self.trajectory = LemniscateTrajectory(5, 4)
self.expected_position = Point()
def ... | Python | 0.000123 | |
4322e8f487af673191cb042bd8f34d6c1526bb42 | Add a command for _accessibilityTraitsInspectorHumanReadable. | scripts/accessibility_traits.py | scripts/accessibility_traits.py | import lldb
import shlex
from helpers.environment_checks import EnvironmentChecks
from subprocess import call
def accessibility_traits(debugger, command, result, internal_dict):
"""Prints human readable strings of the a11y traits for a given object..
Note: This command can only be run while VoiceOver is runnin... | Python | 0 | |
7b4107cfb465faf70110b72da9b655758d62d9b3 | add extraction tool as per request from Renee | scripts/mec/extract_rshowers.py | scripts/mec/extract_rshowers.py | import pytz
import datetime
import psycopg2
pgconn = psycopg2.connect(host='127.0.0.1', port=5555, user='mesonet', database='mec')
cursor = pgconn.cursor()
dates = """06-02-2008 00z - 06-07-2008 06z
06-09-2008 00z - 06-14-2008 06z
06-23-2008 00z - 06-25-2008 06z
07-04-2008 00z - 07-06-2008 06z
08-15-2008 00z - 08-23-2... | Python | 0 | |
74bfc85ef4533e93a4edf4c16e5a7a6bb175f36b | Simplify the view as the validation logic has already moved to the model | onetime/views.py | onetime/views.py | from datetime import datetime
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseGone
from django.contrib import auth
from django.conf import settings
from onetime import utils
from onetime.models import Key
def cleanup(request):
utils.cleanup()
return HttpResponse('ok', content_type='te... | from datetime import datetime
from django.http import HttpResponseRedirect, HttpResponseGone
from django.contrib.auth import login
from django.conf import settings
from onetime import utils
from onetime.models import Key
def cleanup(request):
utils.cleanup()
def login(request, key, redirect_invalid_to=None, red... | Python | 0.000001 |
159b971ae95501f9093dedb881ed030eed74241e | Create __init__.py | docs/__init__.py | docs/__init__.py | # -*- coding: utf-8 -*-
"""
sphinxcontrib
~~~~~~~~~~~~~
This package is a namespace package that contains all extensions
distributed in the ``sphinx-contrib`` distribution.
:copyright: Copyright 2007-2009 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
__import__(... | Python | 0.000429 | |
b9be58f46fe40f471696dd153253781b7a873eda | Create secret_lottery_winning_no3.py | secret_lottery_winning_no3.py | secret_lottery_winning_no3.py | ### QUESTION:
'''
Mr. X is approached in the subway by a guy who claims to be an alien stranded on Earth and to possess time machine
that allows him to know the future. He needs funds to fix his flying saucer but filling in wiMAX_NOing numbers for next week's lottery
would create a time paradox. Therefore, he's wil... | Python | 0.000465 | |
88d4139fdfdcb11be7cbe42fe1223cfde5752950 | debug path | pyethereum/config.py | pyethereum/config.py |
import os
import uuid
import StringIO
import ConfigParser
from pyethereum.utils import default_data_dir
from pyethereum.packeter import Packeter
from pyethereum.utils import sha3
def default_config_path():
return os.path.join(default_data_dir, 'config.txt')
def default_client_version():
return Packeter.CLI... |
import os
import uuid
import StringIO
import ConfigParser
from pyethereum.utils import default_data_dir
from pyethereum.packeter import Packeter
from pyethereum.utils import sha3
def default_config_path():
return os.path.join(default_data_dir, 'config.txt')
def default_client_version():
return Packeter.CLI... | Python | 0.000001 |
7f0658ee700174bae100a12b8c8c22377e829d6f | Create BlepiInit.py | BlepiInit.py | BlepiInit.py | import sqlite3
connection = sqlite3.connect('/home/pi/blepimesh/data/client.db')
cursor = connection.cursor()
print "Adding Data To DB"
cursor.execute("INSERT INTO log(tagDate) values(date('now'))")
cursor.execute("INSERT INTO log values('5',date('now'),time('now'),'34','43','TagAddr','')")
connection.commit()
... | Python | 0 | |
b5fda5ff78f97c7bdd23f3ca4ed2b2d2ab33d101 | Create _init_.py | luowang/tools/tree-tagger-windows-3.2/TreeTagger/bin/_init_.py | luowang/tools/tree-tagger-windows-3.2/TreeTagger/bin/_init_.py | Python | 0.000145 | ||
f3fbb6ca517314ab7ac1330e766da1de89970e13 | Add debug plugin | plugins/debug.py | plugins/debug.py | import time
class Plugin:
def __call__(self, bot):
bot.on_respond(r"ping$", lambda bot, msg, reply: reply("PONG"))
bot.on_respond(r"echo (.*)$", lambda bot, msg, reply: reply(msg["match"].group(1)))
bot.on_respond(r"time$", lambda bot, msg, reply: reply(time.time()))
bot.on_help("de... | Python | 0.000001 | |
1a7acfd59f48522f0dda984b2f33d20d843ee8ba | set up role.py | pycanvas/role.py | pycanvas/role.py | from canvas_object import CanvasObject
from util import combine_kwargs
class Role(CanvasObject):
def __str__(self):
return ""
| Python | 0.000002 | |
799898b0cf26729e56a100509a243456f39c610b | Add tests for external snapshots | openpathsampling/tests/test_external_snapshots.py | openpathsampling/tests/test_external_snapshots.py | import pytest
import openpathsampling as paths
import numpy as np
from openpathsampling.engines.external_snapshots.snapshot import (
ExternalMDSnapshot
)
class MockEngine(object):
def __init__(self, sequences, sleep_ms=0):
self.sequences = sequences
self.sleep_ms = sleep_ms
def read_fram... | Python | 0 | |
d69bbcb2c34aaca6433cf6d8b835314248cd2aff | Add decorators.py, contains @local, @vectorize and their base class. | distarray/decorators.py | distarray/decorators.py | """
Decorators
"""
import functools
from distarray.client import Context, DistArray
from distarray.error import ContextError
from distarray.utils import has_exactly_one
class DecoratorBase(object):
"""
Base class for decorators, handles name wrapping and allows the
decorator to take an optional kwarg.
... | Python | 0 | |
0d85832a82c0973c89f3f321e1f2e2486a197882 | Add script to perform partial upload | bin/partial_upload.py | bin/partial_upload.py | #!/bin/env python
# -*- coding: utf8 -*-
""" Triggers a partial upload process with the specified raw.xz URL. """
import argparse
from fedimg.config import AWS_ACCESS_ID
from fedimg.config import AWS_SECRET_KEY
from fedimg.config import AWS_BASE_REGION, AWS_REGIONS
from fedimg.services.ec2.ec2copy import main as ec2c... | Python | 0 | |
1a49426497819c13ccf858d51e5fa333d95f1f7d | Add basic unit test for parseCommand | src/autobot/src/udpRemote_test.py | src/autobot/src/udpRemote_test.py | #!/usr/bin/env python
import unittest
from udpRemote import parseCommand
class MockDriveParam:
velocity = 0.0
angle = 0.0
class UdpRemoteTest(unittest.TestCase):
def testValidParse(self):
p = MockDriveParam()
p = parseCommand("V44.4", p)
self.assertEqual(p.velocity, 44.4)
... | Python | 0.000001 | |
5b899181f14c65778f23312ddd31078fac46cd9c | Fix template filter. | django_assets/filter.py | django_assets/filter.py | """Django specific filters.
For those to be registered automatically, make sure the main
django_assets namespace imports this file.
"""
from django.template import Template, Context
from webassets import six
from webassets.filter import Filter, register_filter
class TemplateFilter(Filter):
"""
Will compile ... | """Django specific filters.
For those to be registered automatically, make sure the main
django_assets namespace imports this file.
"""
from django.template import Template, Context
from webassets import six
from webassets.filter import Filter, register_filter
class TemplateFilter(Filter):
"""
Will compile ... | Python | 0 |
d843a2198b87a41d73ab19e09ac8d0c78a6e0ef9 | Create IC74139.py | BinPy/examples/ic/Series_7400/IC74139.py | BinPy/examples/ic/Series_7400/IC74139.py | from __future__ import print_function
from BinPy import *
print ('Usage of IC 74139:\n')
ic = IC_74139()
print ("""This is a dial 1:4 demultiplexer(2:4 decoder) with output being inverted input"""")
print ('\nThe Pin configuration is:\n')
p = {1:0,2:0,3:0,14:0,13:1,15:0}
print (p)
print ('\nPin initialization -using -... | Python | 0.000001 | |
dcd19e7982024f4f196f24b71fc2d73bef6723eb | add new package (#25505) | var/spack/repos/builtin/packages/cupla/package.py | var/spack/repos/builtin/packages/cupla/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Cupla(Package):
"""C++ User interface for the Platform independent Library Alpaka"""
... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.