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 |
|---|---|---|---|---|---|---|---|
b1a5764956e0f569b4955dbf43e5656873c903f6 | Create new package. (#7649) | var/spack/repos/builtin/packages/soapdenovo-trans/package.py | var/spack/repos/builtin/packages/soapdenovo-trans/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 | |
402004b1a0612e5b4eeb703f3787dd1b7f3def30 | make auto migration | yandex_kassa/migrations/0004_auto_20151209_0940.py | yandex_kassa/migrations/0004_auto_20151209_0940.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('yandex_kassa', '0003_auto_20151116_1530'),
]
operations = [
migrations.AlterModelOptions(
name='payment',
... | Python | 0.000001 | |
7ec4133b11ba91541e9ec9895e39a2c402c63087 | define the AVB loss separately | avb/models/avb_loss.py | avb/models/avb_loss.py | import keras.backend as ker
from keras.layers import Layer
from keras.losses import categorical_crossentropy
class AVBLossLayer(Layer):
def __init__(self, **kwargs):
self.is_placeholder = True
super(AVBLossLayer, self).__init__(**kwargs)
@staticmethod
def avb_loss(discrim_output_posterior... | Python | 0 | |
0c3b3ff095af2ccf6c3891a99170c982b1639f4e | test pickle retention adapted. | test/test_module_pickle_retention.py | test/test_module_pickle_retention.py | #!/usr/bin/env python2.6
#Copyright (C) 2009-2010 :
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
#
#This file is part of Shinken.
#
#Shinken is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Fr... | #!/usr/bin/env python2.6
#Copyright (C) 2009-2010 :
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
#
#This file is part of Shinken.
#
#Shinken is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Fr... | Python | 0 |
fd54c28be8d9ffd7e5711035bf5b5e1b7fe332cc | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/ab2e190c2bfe60b3b738c125ca9db1a2785cdcaa. | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "ab2e190c2bfe60b3b738c125ca9db1a2785cdcaa"
TFRT_SHA256 = "b097063dd10c010e827e58cc8e5a0e4008d99bcba1dcb2... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "285e48bc47db23a479637fd1e2767b9a35dc2c9b"
TFRT_SHA256 = "6f0067d0cb7bb407caeef060603b6e33f1231cddf1ce4c... | Python | 0.000003 |
c9c00a6a5ab267ab56dd147e6542cae6566061d8 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/dc109b725d8f36f8c7db7847f0c95a819c43f9e9. | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "dc109b725d8f36f8c7db7847f0c95a819c43f9e9"
TFRT_SHA256 = "e6a6359ecd731f7208f32402fac9... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "4bcf968d66a6bb2899b9d99917b916f6ec04c327"
TFRT_SHA256 = "9bd2cc2e7003f73f767e138ae477... | Python | 0.000001 |
d81a2b0328c86165b09c2d41aa2a4684c75388cd | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/78537f15f4873bbed59258bed4442225303f462a. | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "78537f15f4873bbed59258bed4442225303f462a"
TFRT_SHA256 = "87526ed2a287d7809b2cadf82f9d... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "a2f5e07760d2a888370d0686546b757ee9628494"
TFRT_SHA256 = "70653b94faa603befef83457482c... | Python | 0 |
8c1b20941c1216bb56fa55fe881962d2ea883366 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/c68238f982305e3618a2b5347e1e0a5663898c90. | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "c68238f982305e3618a2b5347e1e0a5663898c90"
TFRT_SHA256 = "b28ed95058c101a9d3203ddbaa271044de984f6b49c560... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "377c20166e8e1b5124493c1433b1df34ca62cf3f"
TFRT_SHA256 = "f0c3c03e7d9ca2e10c3256f28bf9c0aa0aa26d9aa4da53... | Python | 0.000002 |
5a8fde172f0fc7aff841e8059927ff126712b321 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/feffe7beb261f6dfe9af083e8f46dfea293ded54. | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "feffe7beb261f6dfe9af083e8f46dfea293ded54"
TFRT_SHA256 = "830492c8a9884e5ca84b15a4da953491f74b2ffbd45656... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "509cf2f10beb666002ece6a7b968fe2c7c0c1e4b"
TFRT_SHA256 = "14b22d39d3eebcf255e4dd8ee8630b4da3ecc786f5053a... | Python | 0.000005 |
e42862ce7bde45e90bec0980f3c35c5cef5c65b6 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/47a1de40f17e70f901238edfe99dc510a5db797a. | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "47a1de40f17e70f901238edfe99dc510a5db797a"
TFRT_SHA256 = "87631491c3fdd34b4d00b6999274468b89a98f23113aea... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "033f079420053002701271e4173bdcaf21bd1b73"
TFRT_SHA256 = "15c1c5a3617b91322d4ef96ce884676d27164cf94211f8... | Python | 0.000002 |
5ab54cf353cece6a8754a1869d8f342ba0a8b351 | Add a script to find and compare F* execution times | tools/scripts/collect-fstar-times.py | tools/scripts/collect-fstar-times.py | #!/usr/bin/python
import argparse
import os
import glob
import re
import time
import sys
import fnmatch
import pickle
from prettytable import PrettyTable # Install via: easy_install PrettyTable
def find_fstar_output_files(directory):
matches = []
extensions = ["vfsti", "vfst"]
# Based on: https://stackov... | Python | 0 | |
a6cc742a7272d1138031e26c61fd10617e6b0ac1 | Initialize transpositionTest | books/CrackingCodesWithPython/Chapter09/transpositionTest.py | books/CrackingCodesWithPython/Chapter09/transpositionTest.py | # Transposition Cipher Test
# https://www.nostarch.com/crackingcodes/ (BSD Licensed)
import random, sys, transpositionEncrypt, transpositionDecrypt
def main():
random.seed(42) # Set the random "seed" to a static value.
for i in range(20): # Run 20 tests.
# Generate random messages to test.
... | Python | 0.000001 | |
1c7daf0bd9801885d7740620b3e81faa03ce49d4 | add sign/verify json tests | test/crypto/olm_device_test.py | test/crypto/olm_device_test.py | from copy import deepcopy
from matrix_client.client import MatrixClient
from matrix_client.crypto.olm_device import OlmDevice
HOSTNAME = 'http://example.com'
class TestOlmDevice:
cli = MatrixClient(HOSTNAME)
user_id = '@user:matrix.org'
device_id = 'QBUAZIFURK'
device = OlmDevice(cli.api, user_id, d... | Python | 0.000001 | |
c4ffd77a56e09f3b418e6d13e8339fe693fffbdb | add fasd_cleanup script | misc/fasd_clean.py | misc/fasd_clean.py | #/usr/bin/env python
# Copyright (C) 2015 Ratheesh S<ratheeshreddy@gmail.com>
# 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 2
# of the License, or (at your option) any later v... | Python | 0 | |
2a45679c02e74ce7a63e259b1475d4190086084e | Add errors to zombase | zombase/errors.py | zombase/errors.py | # -*- coding: utf-8 -*-
class ZombaseRuntimeError(Exception):
pass
| Python | 0.000001 | |
629c9e330e6114680f22af125252d95fb6989201 | update migrations for link manager | webquills/linkmgr/migrations/0002_alter_linkcategory_site.py | webquills/linkmgr/migrations/0002_alter_linkcategory_site.py | # Generated by Django 3.2 on 2021-06-07 11:11
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wqsites', '0001_initial'),
('linkmgr', '0001_initial'),
]
operations = [
migrations.AlterField(
... | Python | 0 | |
24e2ddfd49aa2c05879460baeb67ed6cc75ffa87 | fix benchmark script | benchmark/benchmark.py | benchmark/benchmark.py | import pyqg
import time
import cProfile
import pstats
import numpy as np
tmax = 8000*1000
dtfac = 64 * 8000.
mynx = [32, 64, 128, 256, 512, 1024, 2048]
mynth = [1,2,4,8,16,32]
res = np.zeros((len(mynx), 5))
print 'nx, threads, timesteps, time'
for j, nx in enumerate(mynx):
dt = dtfac / nx
#for i, (use_ff... | from pyqg import qg_model, model
import time
import cProfile
import pstats
import numpy as np
tmax = 104000000
dtfac = (64 * 8000.)
mynx = [32, 64, 128, 256]
res = np.zeros((len(mynx), 5))
for j, nx in enumerate(mynx):
dt = dtfac / nx
for i, (use_fftw, nth) in enumerate([(False, 1), (True, 1),
(Tr... | Python | 0.000007 |
078727dcaba9f7861f84ab7ef61e653f28253226 | add script | mdm_vendor_sign.py | mdm_vendor_sign.py | # This is based loosely on Softthinker's java code found here
# http://www.softhinker.com/in-the-news/iosmdmvendorcsrsigning
# fuck java
import argparse
from plistlib import writePlistToString
import os
import subprocess
from base64 import b64encode
import sys
import urllib2
def p(s):
sys.stdout.write(s)
sys.stdout... | Python | 0.000001 | |
2347ee253f04fa87b28206b0ec00fd2a3fffb49f | Create hello_market_maker.py | hello_market_maker.py | hello_market_maker.py | class hello_market_maker():
def __init__(self, anchor_price, tick_increment, max_pos):
self.anchor_price = anchor_price
self.tick_increment = tick_increment
self.position = 0
self.upper_bound = anchor_price + ((max_pos + 1) * tick_increment)
self.lower_bound = anchor_price - ((max_pos + 1) * tick_... | Python | 0.999986 | |
819a47ce69164aa48f3b68e9ab997f6ee90e2292 | Add a index stats tool | index-stats.py | index-stats.py | """
This script prints some basic collection stats about the size of the
collections and their indexes.
"""
from prettytable import PrettyTable
import psutil
from pymongo import Connection
from pymongo import ReadPreference
connection = Connection(read_preference=ReadPreference.SECONDARY)
def compute_signature(index... | Python | 0 | |
372f4a988411e48a0c50cdc74fb2a7f4e5abf052 | Add a server identity test | tests/server-identity.py | tests/server-identity.py | import nose
import requests
import fixture
@nose.with_setup(fixture.start_tangelo, fixture.stop_tangelo)
def test_server_identity():
response = requests.get(fixture.url("/"))
assert response.headers["server"] == "Tangelo"
| Python | 0.000001 | |
19db4647257617992e9b195828baf39907cc5db1 | Add tests for exit codes | tests/test_exit_codes.py | tests/test_exit_codes.py | """Check that the CLI returns the appropriate exit code."""
import subprocess
def test_exit_code_demo():
"""Ensure that linting the demo returns an exit code of 1."""
try:
subprocess.check_output("proselint --demo", shell=True)
except subprocess.CalledProcessError as grepexc:
assert(grep... | Python | 0 | |
704a979b3be5d7949dd17c640aa429c34f6163b5 | add gp_algebra test | tests/test_gp_algebra.py | tests/test_gp_algebra.py | import time
import pytest
import numpy as np
from flare import gp, gp_algebra
from flare.env import AtomicEnvironment
from flare.struc import Structure
from flare.mc_simple import two_plus_three_body_mc, \
two_plus_three_body_mc_grad
from flare.gp_algebra import get_like_grad_from_mats
def get_random_traini... | Python | 0.00218 | |
787298889fd85dffb597dee6571dead42227c7d6 | add test to validate generated stub constants.pyi | tests/test_type_stubs.py | tests/test_type_stubs.py | """Test type stubs for correctness where possible."""
import os
import sys
import pytest
import xmlsec
black = pytest.importorskip('black')
if sys.version_info >= (3, 4):
from pathlib import Path
else:
from _pytest.pathlib import Path
constants_stub_header = """
import sys
from typing import NamedTuple
... | Python | 0 | |
f1e35886822a7ff7e7f19ef4f1db90c870e8d45d | Add file for remove nonterminal tests | tests/NonterminalRemoveTest.py | tests/NonterminalRemoveTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import TestCase, main
from grammpy import Grammar
from grammpy import Nonterminal
class TempClass(Nonterminal):
pass
class Second(Nonterminal):
pass
class Th... | Python | 0 | |
f3c9284bf7b5d9ae4acc413fd7feb824fdb7aca0 | create field to exclude recomputation of old invoices | l10n_it_fatturapa_in/migrations/12.0.1.18.3/pre-migration.py | l10n_it_fatturapa_in/migrations/12.0.1.18.3/pre-migration.py | from openupgradelib import openupgrade
@openupgrade.migrate()
def migrate(env, version):
if not version:
return
openupgrade.logged_query(
env.cr,
"""
ALTER TABLE fatturapa_attachment_in
ADD COLUMN IF NOT EXISTS invoices_date character varying
""",
)
| Python | 0 | |
60068d4deeba541b9518579d6d8473c4300e189d | Test killing onitu during a transfer | tests/functional/test_crash.py | tests/functional/test_crash.py | import os.path
from os import unlink
from utils.launcher import Launcher
from utils.entries import Entries
from utils.loop import CounterLoop, BooleanLoop
from utils.files import generate, checksum
from utils.tempdirs import TempDirs
launcher = None
dirs = TempDirs()
rep1, rep2 = dirs.create(), dirs.create()
json_fil... | Python | 0 | |
e541d2c6c9c71647201ad39eb8a774eabe243139 | Add gaussian smoothing example (#485) | examples/01-filter/gaussian-smoothing.py | examples/01-filter/gaussian-smoothing.py | """
Gaussian smoothing
~~~~~~~~~~~~~~~~~~
Perform a gaussian convolution.
"""
import pyvista as pv
from pyvista import examples
# Load dataset
data = examples.download_gourds()
# Define a good point of view
cp = [
(319.5, 239.5, 1053.7372980874645),
(319.5, 239.5, 0.0),
(0.0, 1.0, 0.0)
]
##############... | Python | 0.000001 | |
cdc457e7486c9d47f0db017864175f37a2054091 | Add a copy of prjtrellis SDF parser | timing/util/parse_sdf.py | timing/util/parse_sdf.py | """
Utilities for SDF file parsing to determine cell timings
"""
import sys
class SDFData:
def __init__(self):
self.cells = {}
class Delay:
def __init__(self, minv, typv, maxv):
self.minv = minv
self.typv = typv
self.maxv = maxv
class IOPath:
def __init__(self, from_pin,... | Python | 0 | |
59d435ab1d0e5347180f60633d316aa7f2a3abdb | add send_TWH_text module to package | timutils/send_TWH_txt.py | timutils/send_TWH_txt.py | """
short module to send a text message to Tim Hilton's phone using
Verizon's email-to-sms support and gmail's smtp mail server. I was
unable to get UC Merced's outlook.com server to accept the outgoing
message.
Timothy W. Hilton, UC Merced, 25 Feb 2014
"""
import smtplib
import getpass
def get_outgoing_mail_passwo... | Python | 0 | |
4ef17b96531a511b7ad620a0753594a2892af65c | Add monte_carlo_multigpu.py | examples/finance/monte_carlo_multigpu.py | examples/finance/monte_carlo_multigpu.py | import argparse
import contextlib
import sys
import time
import cupy
import numpy
from black_scholes import black_scholes_kernel
from monte_carlo import monte_carlo_kernel
# CuPy also implements a feature to call kernels in different GPUs.
# Through this sample, we will explain how to allocate arrays
# in different ... | Python | 0.998411 | |
2b4c065b986ca1e05d0755b2b64502861b17364d | add import script for Oldham | polling_stations/apps/data_collection/management/commands/import_oldham.py | polling_stations/apps/data_collection/management/commands/import_oldham.py | from data_collection.management.commands import BaseXpressCsvImporter
class Command(BaseXpressCsvImporter):
council_id = 'E08000004'
addresses_name = 'OldhamPropertyPostCodePollingStationWebLookup-2017-02-16.TSV'
stations_name = 'OldhamPropertyPostCodePollingStationWebLookup-2017-02-16.TSV'
ele... | Python | 0 | |
1064b7bc9e343f3ab9308172f6a3129745e7a548 | add test.py | test.py | test.py | #!/usr/bin/python
import smc
from pprint import pprint
import time
import logging
logger = logging.getLogger(__name__)
smc.login('http://172.18.1.150:8082', 'EiGpKD4QxlLJ25dbBEp20001')
#Example of using a search filter
#Response is a json record with a reference link to the object
#smc.get_element_by_href(href) ge... | Python | 0.000012 | |
fa2fd9cdab29a5736ae6b69c5f754f92a33c7f74 | add wsgi.py | wsgi.py | wsgi.py | from server import app
if __name__ == "__main__":
app.run() | Python | 0.00001 | |
f4e12493c000b6bb3051e9c201347d420c8dd687 | add basis for netcomp class | camoco/NetComp.py | camoco/NetComp.py | from .COB import COB
class NetComp(Camoco):
def __init__(self,name,networks):
self.networks = set()
# Add all the networks
for n in networks:
self.add_network(n)
def add_network(self,net):
'''
Add a network (COB) to the
NetComp object.
... | Python | 0 | |
b5d2b975e0566b90e6f52b9b3a4bf1b2e1fef8da | constrain tabled_committee_report.committee_id NOT NULL | migrations/versions/8cbc3d8dd55_add_soundcloudtrack_model.py | migrations/versions/8cbc3d8dd55_add_soundcloudtrack_model.py | """Add SoundcloudTrack model
Revision ID: 8cbc3d8dd55
Revises: 17570e7e200b
Create Date: 2016-08-31 10:19:49.128041
"""
# revision identifiers, used by Alembic.
revision = '8cbc3d8dd55'
down_revision = '17570e7e200b'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by ... | Python | 0.999995 | |
2a3b89f42cde7088b304a3f224eaf52894f544ec | Add an python example for stream testing | misc/utils/LSL_Tests/RecieveAppStatistics.py | misc/utils/LSL_Tests/RecieveAppStatistics.py | """Example program to show how to read a multi-channel time series from LSL."""
from pylsl import StreamInlet, resolve_stream
import sys
# first resolve an EEG stream on the lab network
print("looking for an Unity3D.AppStatistics stream...")
streams = resolve_stream('type', 'Unity3D.FPS.FT')
# create a new inlet to r... | Python | 0.000005 | |
52c7d6ba8f6dcb6c6f1bd02790ab9bb7fae8ebcd | add script | scripts/grabBAMrecs.py | scripts/grabBAMrecs.py | #!/usr/bin/env python
import sys
import pysam
import os
import re
from collections import defaultdict as dd
import logging
logger = logging.getLogger(__name__)
FORMAT = '%(asctime)s %(message)s'
logging.basicConfig(format=FORMAT)
logger.setLevel(logging.INFO)
def find_mate(read, bam):
''' AlignmentFile.mate() ... | Python | 0.000003 | |
6ad72a0c624abdda0df8d5c49366bfc597a12340 | Add tests for utils experiment module | cptm/tests/test_utils_experiment.py | cptm/tests/test_utils_experiment.py | from nose.tools import assert_equal, assert_false
from os import remove
from os.path import join
from json import dump
from cptm.utils.experiment import load_config, add_parameter, thetaFileName, \
topicFileName, opinionFileName, tarFileName, experimentName
def setup():
global jsonFile
global config
... | Python | 0 | |
f73800f8e4ccd76d858c08d8cc8a72a6f2274fb6 | Validate settings a tad later | mopidy/__main__.py | mopidy/__main__.py | import logging
import multiprocessing
import optparse
import os
import sys
sys.path.insert(0,
os.path.abspath(os.path.join(os.path.dirname(__file__), '../')))
from mopidy import get_version, settings, SettingsError
from mopidy.core import CoreProcess
from mopidy.utils import get_class
from mopidy.utils.log import... | import logging
import multiprocessing
import optparse
import os
import sys
sys.path.insert(0,
os.path.abspath(os.path.join(os.path.dirname(__file__), '../')))
from mopidy import get_version, settings, SettingsError
from mopidy.core import CoreProcess
from mopidy.utils import get_class
from mopidy.utils.log import... | Python | 0 |
69b715ab99522967a6b1bb8f4abfc4f2b1e60912 | check most of the analyzer code by importing the analyzer itself | tests/windows/test_analyzer.py | tests/windows/test_analyzer.py | # Copyright (C) 2017 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
def test_analyzer():
"""Simply imports the analyzer module to at least load most of the code."""
import analyzer
analyzer # Fake usage.
| Python | 0 | |
4853257696373d248884efd1532af8a81c34ee93 | Add LiveComposite creation helper script | tools/create_live_composite.py | tools/create_live_composite.py |
"""
Helper script for cropping images and creating a RenPy LiveComposite for them.
Quite specific and mostly useful for processing images exported from a
rendering program like Blender or from Photoshop layers.
Requires Pillow Python image processing library to be installed.
Command line example ... | Python | 0 | |
e74571c6505bdf99a94fc27dd1ea60e23f55db0a | Add strace_inputs.py to strace a test executable and detect its dependencies. | tools/isolate/strace_inputs.py | tools/isolate/strace_inputs.py | #!/usr/bin/env python
# Copyright (c) 2012 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.
"""Runs strace on a test and processes the logs to extract the dependencies from
the source tree.
Automatically extracts directori... | Python | 0.000008 | |
e94192a4c549e46ae0a155dbfa634ebde992903a | Create netntlm2hashcat.py | netntlm2hashcat.py | netntlm2hashcat.py | #!/usr/bin/env python
import sys
import re
import argparse
# Arg Input (Like a pirate)
p = argparse.ArgumentParser(description='Convert NetNTLM John Hashes to Hashcat Format')
p.add_argument('-i','--hash',action='store_true',help='Enter one-time hash input mode',required=False)
p.add_argument('-f','--file',dest='file... | Python | 0 | |
e3b025ae738b6aff8fb873bb41d1cc13e0845131 | Create geddit-backend.py | geddit-backend.py | geddit-backend.py | #!/usr/bin/python
import requests
import json
# Import modules for CGI handling
import cgi, cgitb
# Create instance of FieldStorage
form = cgi.FieldStorage()
# Get data from fields
user_title = form.getvalue('search_title')
print "Content-type: text/html\n\n";
# Setting attributes to send to Wikipedia API
ba... | Python | 0 | |
e6e5fbb671c2539f4f82c6eaca51fbf400133482 | Write a silly Python script to compute some hard coded info from the generated ARM match table, which is substantially more efficient than dealing with tblgen. | utils/Target/ARM/analyze-match-table.py | utils/Target/ARM/analyze-match-table.py | #!/usr/bin/env python
def analyze_match_table(path):
# Extract the instruction table.
data = open(path).read()
start = data.index("static const MatchEntry MatchTable")
end = data.index("\n};\n", start)
lines = data[start:end].split("\n")[1:]
# Parse the instructions.
insns = []
for ln ... | Python | 0.000138 | |
5b2c1650059f9e4b69b6bab1d8ce88177f449e02 | Add basic test for import | foyer/tests/test_external_forcefields.py | foyer/tests/test_external_forcefields.py | import pytest
def test_basic_import():
import foyer
assert 'external_forcefields' in dir(foyer)
import foyer.external_forcefields
| Python | 0.000001 | |
e5d58cc795541b5e4e8f791a441a4369df17ee19 | Add first exercise | cuadradoDentroDeRangoDado.py | cuadradoDentroDeRangoDado.py | #!/usr/bin/env python
def main():
def cuadr(num):
return num * num
def nom_cuad(num):
return ("%d -> %d") % (num, cuadr(num))
def promptCuadr():
myNum1 = input("Enter num1: ")
myNum2 = input("Enter num2: ")
minimum = min(myNum1, myNum2)
maximum = max(myNum1, myNum2)
arr = [nom_cua... | Python | 0.000142 | |
aab833a4a267ed46e83a5968e87d357ae3a5a12b | Add new DemoStream example corresponding to the LSL4Unity Project | utils/LSL_Tests/RecieveDemoStream.py | utils/LSL_Tests/RecieveDemoStream.py | """Example program to show how to read a marker time series from LSL."""
import sys
sys.path.append('./pylsl') # help python find pylsl relative to this example program
from pylsl import StreamInlet, resolve_stream
# first resolve an EEG stream on the lab network
targetStreamType = 'Unity.Quaternion'
print 'looking fo... | Python | 0 | |
897371dac52c38b96b6a1a92cd8ce36e9b2d1003 | Add django admin page for HQOauthApplication | corehq/apps/hqwebapp/admin.py | corehq/apps/hqwebapp/admin.py | from django.contrib import admin
from corehq.apps.hqwebapp.models import HQOauthApplication
@admin.register(HQOauthApplication)
class HQOauthApplicationAdmin(admin.ModelAdmin):
list_display = (
"id", "application_id", "application_name", "application_user", "application_client_type",
"application... | Python | 0 | |
09a8f4efcfc99f7add4d055465de621a47f06ee8 | Add management command to sanitize 2fa sessions | corehq/apps/hqadmin/management/commands/clean_2fa_sessions.py | corehq/apps/hqadmin/management/commands/clean_2fa_sessions.py | from getpass import getpass
from importlib import import_module
from packaging import version
from pkg_resources import DistributionNotFound, get_distribution
from django.conf import settings
from django.core.cache import caches
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help... | Python | 0.000001 | |
fb884d3453b42b68aa7ecc7b0523bf1460b6b9e0 | Add missing EFS patch | scripts/patches/efs.py | scripts/patches/efs.py | patches = [
{
"op": "replace",
"path": "/ResourceTypes/AWS::EFS::AccessPoint/Properties/AccessPointTags/ItemType",
"value": "Tag",
},
{
"op": "replace",
"path": "/ResourceTypes/AWS::EFS::FileSystem/Properties/FileSystemTags/ItemType",
"value": "Tag",
},
]
| Python | 0.000001 | |
1ae811c79b1cbc28b2f71e8f2bb01b44cc3aa2b9 | Improve import malware hashes cron | cron/import_malware_hashes.py | cron/import_malware_hashes.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
#
# Contributors:
# Brandon Myers bmyers@mozilla.com
imp... | Python | 0.000004 | |
58852970847bab30fee18e6ab824b24bc75d389f | Add the package-cleaning script | clean-packages.py | clean-packages.py | # WARNING: HERE BE DRAGONS
import yaml
import os.path
import urllib.parse
from copy import deepcopy
urllib.parse.uses_relative.append('github')
urllib.parse.uses_netloc.append('github')
with open('packages.yaml') as f:
package_db = yaml.load(f)
def strip_prefix(prefix, url):
for n in range(len(url) - 1, 0, ... | Python | 0 | |
2e0fbcb3ec1c2f0311d7ee4bbfeac33662f66089 | Monitor process using subprocess module | monitor_process.py | monitor_process.py | import subprocess
""" If the program is running "ps -ef | grep program" will return 2 or more rows
(one with the program itself and the second one with "grep program").
Otherwise, it will only return one row ("grep program")
You can trigger the alert on this if required.
"""
def monitor_process(name):
args=['ps',... | Python | 0.000001 | |
0d956a8137f5bd2cc30f5163c717858e4a1172ee | delete a module never used | nova/scheduler/filters/image_props_filter.py | nova/scheduler/filters/image_props_filter.py | # Copyright (c) 2011-2012 OpenStack, LLC
# Copyright (c) 2012 Canonical Ltd
# Copyright (c) 2012 SUSE LINUX Products GmbH
# 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 ... | # Copyright (c) 2011-2012 OpenStack, LLC
# Copyright (c) 2012 Canonical Ltd
# Copyright (c) 2012 SUSE LINUX Products GmbH
# 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 ... | Python | 0.000007 |
4a7680d783d38a4ee32b558f47532dc5b706cc05 | Add scheduler utils unit tests | nova/tests/scheduler/test_scheduler_utils.py | nova/tests/scheduler/test_scheduler_utils.py | # Copyright (c) 2013 Rackspace Hosting
# 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 req... | Python | 0.000004 | |
0ae60d170c3a8fd33fac3b1283e646a7018027df | Add expertise removal migration | qipr_approver/approver/migrations/0007_auto_20170227_1533.py | qipr_approver/approver/migrations/0007_auto_20170227_1533.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-27 15:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('approver', '0006_auto_20170222_1424'),
]
operations = [
migrations.RemoveFi... | Python | 0 | |
b629a8e6346359683e637fd8e2f34f1d704ad1bc | Add missing test | test/test_full.py | test/test_full.py | import numpy as np
from util.full import matrix
def assert_(this, ref):
print this
print ref
assert np.allclose(this, ref)
def test_diag():
ref = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
this = matrix.diag([1,1,1])
assert_(this, ref)
| Python | 0.000383 | |
5e9b804ef20d71aa84cb4d3cdd8b3bad9863cf11 | add validator | sections/validators.py | sections/validators.py | import re
from django.core.validators import RegexValidator
section_name_validator = RegexValidator(
r'^[a-zA-Z][a-zA-Z0-9]{1,19}$',
'This field can contain only characters a-zA-Z0-9 and be max 20 characters long',
code='invalid'
)
| Python | 0.000005 | |
e7db8f3dc4d945185a99b5b62ae0b528959651ac | add python version | versioncheck/python_version.py | versioncheck/python_version.py | from invoke import task
from subprocess import call
import invoke
def check_invoke_version(ctx):
minimal_verion = "0.15.0"
if minimal_verion > invoke.__version__:
print("Your python-invoke version is too old (currently "+invoke.__version__+"). Please update to version "+minimal_verion+" or higher.")
... | Python | 0.000002 | |
39cbea7183a77495173b10aef4d9f6ac10ad15f6 | Add initial layout of resources | objectset/resources.py | objectset/resources.py | from django.conf.urls import patterns, url
from django.http import HttpResponse
from restlib2.resources import Resource
from restlib2.http import codes
from restlib2.params import Parametizer, param_cleaners
from preserialize.serialize import serialize
SET_OPERATIONS = {
'and': '__and__',
'or': '__or__',
'... | Python | 0 | |
0dfe81fdbb89f65940c37437901d073021ecd899 | Add files via upload | chain_maker.py | chain_maker.py | import maya.cmds as cmds
import maya.mel as mel
import maya.OpenMaya as OpenMaya
import math
import re
from string import Template, zfill
from functools import partial
class Find_Out():
'''
multipurpose class for finding length of anything. Well, work in progress
'''
def edge_length(s... | Python | 0 | |
ca9ed2756a12a2587f5b4d021597d2229196da50 | Add migration to add china region | api/common/migrations/0007_add_china_region.py | api/common/migrations/0007_add_china_region.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-06-24 21:52
from __future__ import unicode_literals
from django.db import migrations
def forwards(apps, schema_editor):
Region = apps.get_model('common.Region')
region_to_add = 'China'
try:
Region.objects.get(name=region_to_add)
exc... | Python | 0 | |
7e113b5ec884c4a1e6da421a116e09b22939ae75 | Add old wiki backup script | python/graveyard/misc/mywiki-backup.py | python/graveyard/misc/mywiki-backup.py | #!/usr/bin/env python
import os
import os.path
import sys
import time
import urllib2
import urlparse
import lxml.etree
import lxml.html
debug = False
def main():
site_url = 'http://sites.google.com/site/bmaupinwiki'
#dest_path = '%s/Documents/misc/bmaupinwiki' % (home)
dest_path = '{0}/Desktop/bmaupinwi... | Python | 0 | |
680b2cb1488f83aef5b45476e23bd93a90069872 | Create Content Loader app to Herd/DM standards - Configure Pyinstaller | herd-code/herd-tools/herd-content-loader/herdcl/hook-otags.py | herd-code/herd-tools/herd-content-loader/herdcl/hook-otags.py | hiddenimports = [
'numpy',
'pandas._libs.tslibs.timedeltas',
'pandas._libs.tslibs.nattype',
'pandas._libs.tslibs.np_datetime',
'pandas._libs.skiplist'
]
| Python | 0 | |
56d14e7b0386588afd39f2413fafe0b9ba41806d | Access checking unit tests for SlotsTransferAdminPage. | tests/app/soc/modules/gsoc/views/test_slot_transfer_admin.py | tests/app/soc/modules/gsoc/views/test_slot_transfer_admin.py | # Copyright 2013 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 applicable law or agreed to in wr... | Python | 0 | |
db446bf6dc4255f556f20235d2bdc28fa056ad46 | Add list_owners.py to list shared folder owners | list_owners.py | list_owners.py | """List all shared folders and their owners."""
import logging
import os
from typing import Iterator
import dropbox
from backup import File, setup_logging, get_members, get_files
def get_folder_members(team: dropbox.DropboxTeam,
folder: File) \
-> Iterator[dropbox.shar... | Python | 0 | |
1c094fe58df0fa57884752be7f64ee9755e433f1 | Create __init__.py | tests/__init__.py | tests/__init__.py | Python | 0.000429 | ||
6edc4700f755380b8b9099ae78619cbd225a2790 | add API tests | tests/api_test.py | tests/api_test.py | import overview, unittest, mock, json
from overview.services import Services
class ApiV1Test(unittest.TestCase):
def send_patch_json(self, url, json_data):
return self.app.patch(url,
data = json.dumps(json_data),
headers = [('Content-Type', 'application/json')])
def se... | Python | 0.000001 | |
0347d82e55382b9618158c4c5809c360e729c245 | Create neworld_client.py | _src/om2py4w/4wex0/neworld_client.py | _src/om2py4w/4wex0/neworld_client.py | #/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
# sys.setdefaultencoding() does not exist, here!
reload(sys) # Reload does the trick!
sys.setdefaultencoding('UTF8')
from lxml import html
import requests
def read_note():
page = requests.get('http://localhost:8080/neworld')
tree = html.fromstring(... | Python | 0.000001 | |
faacc6dcef31cb22a87cd3184824b9785b21fdef | Jiffy application to test indexing of reflections from other experiments in an n^2 manner, to see if a matrix from one experiment has good predictive power for another as: | command_line/griddex.py | command_line/griddex.py | from __future__ import absolute_import, division, print_function
import libtbx.phil
import libtbx.load_env
help_message = '''
Cross reference indexing solutions.
Examples::
%s expts0.json refl0.json
''' % libtbx.env.dispatcher_name
phil_scope = libtbx.phil.parse("""
d_min = None
.type = float(value_min=0... | Python | 0.999997 | |
3a4c922d353df5f5b3f3cabe24b04090b0a3fd08 | test the serve command | tests/test_cli.py | tests/test_cli.py | # Copyright 2013 Donald Stufft
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | Python | 0.0001 | |
2299343d8b10658cc6682b23dbf9be9d5fd290f6 | Add unit test for data integrity. | tests/testdata.py | tests/testdata.py | import ConfigParser
import csv
import unittest
class DataTest(unittest.TestCase):
def setUp(self):
config = ConfigParser.RawConfigParser()
config.read('../app.config')
# Load the data from the csv into an array
self.data = []
with open('../data/%s' % config.get('data', ... | Python | 0 | |
78aebc48763b15dedc3aee65a18a2a39f46e5c30 | add run module | flagon/run.py | flagon/run.py |
def run_simple(hostname, port, application, use_reloader=False,
use_debugger=False):
from wsgiref.simple_server import make_server
from wsgiref.simple_server import WSGIRequestHandler, WSGIServer
pass
| Python | 0.000001 | |
ad6b9ebc0b9d9ec0ea5e24da240c09a5645dff2c | Add renamed file | flush_gui.pyw | flush_gui.pyw | # GUI component of the flush tool
import sys
import flush_tool
import configparser
from PyQt4 import QtCore, QtGui, uic
# set ui file
form_class = uic.loadUiType("flushtool_interface.ui")[0] # load ui file
class ErrorDialog(QtGui.QDialog):
def __init__(self, parent = None):
super(ErrorDialog, self).__init... | Python | 0.000002 | |
b9399dbdfff80fec21cfed926779b67589835047 | Create LettCombPhoneNum_002.py | leetcode/017-Letter-Combinations-of-a-Phone-Number/LettCombPhoneNum_002.py | leetcode/017-Letter-Combinations-of-a-Phone-Number/LettCombPhoneNum_002.py | class Solution(object):
def letterCombinations(self, digits):
"""
:type digits: str
:rtype: List[str]
"""
def comb(digits, d2l):
if not digits:
return [""]
res = []
for c in d2l[int(digits[0])]:
... | Python | 0.000001 | |
d92eff7e89e09167b126f99243986eae5792f705 | Add py-debtcollector (#25212) | var/spack/repos/builtin/packages/py-debtcollector/package.py | var/spack/repos/builtin/packages/py-debtcollector/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 PyDebtcollector(PythonPackage):
"""
A collection of Python deprecation patterns and st... | Python | 0 | |
6ed82eb673c2a95f5c349ab45dd8d17280db91c9 | Conversion of string to number | BankOCR.py | BankOCR.py | numbers = '''
_ _ _ _ _ _ _ _
| | | _| _||_||_ |_ ||_||_|
|_| ||_ _| | _||_| ||_| _|
'''
class Converter:
def __init__(self):
digits = self.splitDigits(numbers)
self.digitLineDicts = [{} for i in range(3)]
self.digitIdDict = {}
digitIndices = [0]*3
for d... | Python | 0.999999 | |
6bd4b7e4c2dac2817250f184114eea8c05fbefb7 | Add compat.py to get get_user_model working | cuser/compat.py | cuser/compat.py | from __future__ import unicode_literals
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
import django
from django.utils.functional import lazy
__all__ = ['User', 'AUTH_USER_MODEL']
# Django 1.5+ compatibility
if django.VERSION >= (1, 5):
AUTH_USER_MODEL = settings.AUTH_US... | Python | 0 | |
422390ff7eb4d97eaf0c5c1a1b250010ee766ec7 | Add tool for clean pyc files | tools/cleanPYC.py | tools/cleanPYC.py |
import re
import os
import sys
print("%s path\n" % sys.argv[0])
path = sys.argv[1]
for root, dirs, files in os.walk(path):
for file_ in files:
if re.match(".*.pyc$", file_):
abs_file = os.path.join(root, file_)
print("Clean %s" % abs_file)
os.remove(abs_file)
| Python | 0 | |
3aacdb44210ca5af86bc9258eaecc1bbbda4ea7f | Implement colorization in it's own file | tools/colorize.py | tools/colorize.py | """
mbed SDK
Copyright (c) 2016 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing... | Python | 0.000003 | |
0d0115ef5e088ed54a176e24cc94713b706f3d55 | include migration | awx/main/migrations/0015_v300_label_changes.py | awx/main/migrations/0015_v300_label_changes.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0014_v300_invsource_cred'),
]
operations = [
migrations.AlterField(
model_name='label',
name... | Python | 0.000111 | |
5db256e6ac4ee84e008afa8f94d767330e392709 | Increase coverage | test/test_vmcp.py | test/test_vmcp.py | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | Python | 0 | |
0a3e00b27606eda26917c3c69b0344dc301502f0 | Revert "will this fix tests?" | tests/__init__.py | tests/__init__.py | # log_support setups the default Logger class
# and so we need to ensure that it is also
# setup for the tests
from lbrynet.core import log_support
| Python | 0 | |
3dbef22cee9ea83c7e80756037209334da237d4c | Remove unused compat types from compat.py | twython/compat.py | twython/compat.py | import sys
_ver = sys.version_info
#: Python 2.x?
is_py2 = (_ver[0] == 2)
#: Python 3.x?
is_py3 = (_ver[0] == 3)
try:
import simplejson as json
except ImportError:
import json
if is_py2:
from urllib import urlencode, quote_plus
try:
from urlparse import parse_qsl
except ImportError:
... | import sys
_ver = sys.version_info
#: Python 2.x?
is_py2 = (_ver[0] == 2)
#: Python 3.x?
is_py3 = (_ver[0] == 3)
try:
import simplejson as json
except ImportError:
import json
if is_py2:
from urllib import urlencode, quote_plus
try:
from urlparse import parse_qsl
except ImportError:
... | Python | 0 |
f10049ae831570b54581c2a089218359febe5c50 | add command for exporting to csv | fecfilings/management/commands/fecfilings_to_csv.py | fecfilings/management/commands/fecfilings_to_csv.py | from django.core.management.base import NoArgsCommand
from fecfilings.models import Contributor
class Command(NoArgsCommand):
def handle(self, **options):
for c in Contributor.objects.all():
print c.to_csv()
| Python | 0.000001 | |
23165cbd1ac8ba1528649c04b56d598664e1da8b | Enhance mysensors binary sensor device classes (#13367) | homeassistant/components/binary_sensor/mysensors.py | homeassistant/components/binary_sensor/mysensors.py | """
Support for MySensors binary sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.mysensors/
"""
from homeassistant.components import mysensors
from homeassistant.components.binary_sensor import (
DEVICE_CLASSES, DOMAIN, BinarySe... | """
Support for MySensors binary sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.mysensors/
"""
from homeassistant.components import mysensors
from homeassistant.components.binary_sensor import (
DEVICE_CLASSES, DOMAIN, BinarySe... | Python | 0 |
60ffb1d13f00851377960eb76c90a7ef4592d03c | Create kivy_android_carousel.py | 009---Nine-Nine/kivy_android_carousel.py | 009---Nine-Nine/kivy_android_carousel.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import kivy
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.image import Image
from kivy.uix.label import Label
from kivy.uix.scatter import Scatter
from kivy.uix.screenmanager import Screen, ScreenManager, FadeTransition
from kivy.uix.floatlayout imp... | Python | 0.000647 | |
c9f70c7a4a24be0cdd9dcf044a06051b0978efff | add exceptions | jsonrpc/exceptions.py | jsonrpc/exceptions.py | class JSONRPCError(object):
""" Error for JSON-RPC communication.
When a rpc call encounters an error, the Response Object MUST contain the
error member with a value that is a Object with the following members:
code: A Number that indicates the error type that occurred.
This MUST be an intege... | Python | 0.000013 | |
2947a2c9b6348d248e3ae740722d6a7aa04327c0 | add reg d included definitions | regconfig/reg_d.py | regconfig/reg_d.py | from regparser.default_settings import *
#### Regulation D
INCLUDE_DEFINITIONS_IN_PART_1004 = [
('Alternative mortgage transaction', 'Alternative mortgage transaction'),
('Creditor', 'Creditor'),
('State', 'State'),
('State law', 'State law'),
]
INCLUDE_DEFINITIONS_IN['1004'] = INCLUDE_DEFINITIONS_IN... | Python | 0 | |
1e32a27b35e25e780e8af6cc76d1eb424328171b | add leetcode Populating Next Right Pointers in Each Node | leetcode/PopulatingNextRightPointersinEachNode/solution.py | leetcode/PopulatingNextRightPointersinEachNode/solution.py | # -*- coding:utf-8 -*-
# Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
# self.next = None
class Solution:
# @param root, a tree node
# @return nothing
def connect(self, root):
... | Python | 0 | |
b220410ad51413d52076bec84a3bf1a660f9883b | Add a program that says Hello Shikha | helloShikha.py | helloShikha.py | #This is my hello world program
print 'Hello Shikha!'
| Python | 0.999999 | |
5a120774bae2d9775493c6806841a97e790b266e | Create citreo_code_v2.py | Logistic-Regression/citreo_code_v2.py | Logistic-Regression/citreo_code_v2.py | from datetime import datetime
from csv import DictReader
from math import exp, log, sqrt
# parameters #################################################################
train = 'train.csv' # path to training file
test = 'test.csv' # path to testing file
D = 2 ** 20 # number of weights use for learning
alpha = .1... | Python | 0.000015 | |
557652d4b4297dd80d844915c3d57fc3e46ac83a | add graham's solution: | solutions/4_21_grsr.py | solutions/4_21_grsr.py | import sys
for line in sys.stdin:
line = line.rstrip()
pop, sample_id, sample_name, sex = line.split(",")
if (sample_id == sys.argv[1]):
print "Found", sample_id
| Python | 0.000033 | |
8db04e5d648c9e923f7977f456242d9ea9b80050 | Create pig_latin.py | solutions/pig_latin.py | solutions/pig_latin.py | def pig_latin(input_string):
new_string = []
for i in input_string.split():
if i[0] not in "aeiou":
i = i[1:]+i[0]
i +="ay"
new_string.append(i)
return ' '.join(new_string)
def main():
user_input = str(raw_input("Please give me a phrase: "))
print pig_latin(user_input)
if __name__ == '__main__':
main()... | Python | 0.001803 | |
f5460adbaeb87421a7f193a700d25e5a3c6e4351 | Create crypt.py | crypt.py | crypt.py | from itertools import cycle
def crypt(source,key):
result=""
a=cycle(key)
for ch in source:
result+=chr(ord(ch)^ord(next(a)))
return result
if __name__=="__main__":
source=input("输入想要加密/解密的字串:")
key=input("输入密钥:")
print("加密/解密成功!密码为:"+crypt(source,key))
| Python | 0.00091 | |
5ed7db70874f3ebfe9c946d38ccf12228dacac3a | Test if we tried to commit with an empty message, it should raise a ValueError | tests/test_git.py | tests/test_git.py | from unittest import TestCase
from mock import MagicMock, patch
from nose.tools import raises
from pyolite.git import Git
class TestGit(TestCase):
@raises(ValueError)
def test_commit_with_no_message(self):
mock_repo = MagicMock()
mock_index = MagicMock()
mock_remotes = MagicMock()
mock_repo.in... | Python | 0.000001 | |
1a3d9b3da91a5c87316e44498a876f70a49df8ad | add 70 | python/p070.py | python/p070.py | import utils
def is_perm(a, b):
return sorted(str(a)) == sorted(str(b))
best = (10000, 1)
primes = [ i for i in utils.primes(4000) if i > 2000 ]
for i in primes:
for j in primes:
n = i * j
if n > 10**7:
break
phi = (i - 1) * (j - 1)
ratio = (n * 1.0) / phi
... | Python | 0.999266 | |
c4764ef1aa1a1aaa0ae8dd909c3578705c7a2060 | add 77 | python/p077.py | python/p077.py | import utils
primes = utils.primes(100)
def count(target):
ways = [0] * (target + 1)
ways[0] = 1
for p in primes:
for j in xrange(p, target + 1):
ways[j] += ways[j - p]
return ways[target]
for target in xrange(2, 100):
if count(target) > 5000:
print target
b... | Python | 0.998768 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.