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 |
|---|---|---|---|---|---|---|---|
d7cd9951581df833ac3e6eecd099035f2d30df0e | Add initial Starling mapping | csv2ofx/mappings/starling.py | csv2ofx/mappings/starling.py | from __future__ import (
absolute_import, division, print_function, unicode_literals)
from operator import itemgetter
def fixdate(ds):
dmy = ds.split('/')
# BUG (!?): don't understand but stolen from ubs-ch-fr.py
return '.'.join((dmy[1], dmy[0], dmy[2]))
mapping = {
'has_header': True,
'date... | Python | 0 | |
67a5e2797e362bb5a38b8af5b05cf72d1e28a262 | add import script for Wokingham (closes #795) | polling_stations/apps/data_collection/management/commands/import_wokingham.py | polling_stations/apps/data_collection/management/commands/import_wokingham.py | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E06000041'
addresses_name = 'parl.2017-06-08/Version 1/merged.tsv'
stations_name = 'parl.2017-06-08/Version 1/merged.tsv'
elections = ['parl.2017-06-08']
... | Python | 0 | |
6972c0c7050bc68c10361dce02fb227df6426fe9 | convert LUNA16 to jpg and png | convert_mhd2jpg_png_LUNA16.py | convert_mhd2jpg_png_LUNA16.py | #!/usr/bin/env python
# This script belongs to https://github.com/
import os,glob
import argparse
import numpy as np
import SimpleITK as sitk
from PIL import Image
import cv2
import scipy.misc
DATA_DIRECTORY = '/home/zack/Data/LUNA16/'
OUT_DIRECTORY = "/home/zack/Data/LUNA16/"
def mhd2ndarray(data_file):
itk... | Python | 0.999999 | |
c86b61a23ad9b3a152bb6644cb5dde5a4b42fbc9 | Add Management Command to Dump Project and RemoteRepository Relationship in JSON format | readthedocs/projects/management/commands/dump_project_remote_repo_relation.py | readthedocs/projects/management/commands/dump_project_remote_repo_relation.py | import json
from django.core.management.base import BaseCommand
from readthedocs.projects.models import Project
class Command(BaseCommand):
help = "Dump Project and RemoteRepository Relationship in JSON format"
def handle(self, *args, **options):
data = []
queryset = Project.objects.filter... | Python | 0 | |
03733ada2ec1ea7b9aeca76d9dc1a0ebfc1c0db7 | Add script to mask out a region of interest in an image | FindingLaneLines/ColorRegionCombined.py | FindingLaneLines/ColorRegionCombined.py | # Code uses to mask out a region of interest in an image
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
# Read in the image and print out some stats
# Note: in the previous example we were reading a .jpg
# Here we read a .png and convert to 0,255 bytescale
image = (mpimg.imread('t... | Python | 0 | |
64c7bb3d9e924c5651e85229ea5451c8a808bf04 | add show_graph.py | goldberg/show_graph.py | goldberg/show_graph.py | #! /usr/bin/python
# -*- coding: utf-8 -*-
import cPickle as pickle
import matplotlib.pyplot as plt
import numpy as np
import seaborn
import pandas as pd
import matplotlib.cm as cm
def pitch(height):
""" Calculate pitch of given height. """
cde_list = ["c","d","e","f","g","a","b"]
return cde_list[height %... | Python | 0.000002 | |
0f92843ec20007dc4379ff88d2e711bdad5e9125 | Add ftp module, the backend for salt-ftp | salt/cli/ftp.py | salt/cli/ftp.py | '''
The ftp module is used to execute the logic used by the salt-ftp command
line application, salt-ftp is NOT intended to broadcast large files, it is
intened to handle text files.
Salt-ftp can be used to distribute configuration files
'''
# Import python modules
import os
import stat
import sys
# Import salt modules
... | Python | 0.000001 | |
2baeb63940e3b552efbca082ab4c45e16259b572 | add yield01.py | trypython/advanced/yield01.py | trypython/advanced/yield01.py | # coding: utf-8
"""yieldについてのサンプルです。
元ネタは、stackoverflowの以下のページ。
https://stackoverflow.com/questions/231767/what-does-the-yield-keyword-do-in-python/231855#231855
回答がとてもわかり易いので、自分用のメモとしても残しておく。
"""
import time
from datetime import datetime
from trypython.common.commoncls import SampleBase
from trypython.common.common... | Python | 0.000002 | |
b6e0daa9ee06961743ad5a5f728f3385bfdb0b4c | Add a helper script to apply changes in zuul | playbooks/roles/ironic-install/files/parse_zuul_changes.py | playbooks/roles/ironic-install/files/parse_zuul_changes.py | #!/usr/bin/env python
# (c) 2015, Hewlett-Packard Development Company, L.P.
#
# This module 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 later ver... | Python | 0 | |
bc40b4c25c4f45d8d1e75963bb84fad2e1008762 | Past 12, should ideally be in day 9 | day8/stringCompression.py | day8/stringCompression.py | import unittest
from collections import Counter
def stringCompression(str1):
dicty = dict(Counter(str1))
result = []
for x in sorted(dicty.keys()):
temp = x + str(dicty[x])
result.append(temp)
result = ''.join(result)
if(len(result)>len(str1)):
return str1
return result
... | Python | 0.999977 | |
855fe9e95651626c2737c65424ad1067f253e28a | Implement invisible user mode | txircd/modules/rfc/umode_i.py | txircd/modules/rfc/umode_i.py | from twisted.plugin import IPlugin
from txircd.module_interface import IMode, IModuleData, Mode, ModuleData
from txircd.utils import ModeType
from zope.interface import implements
class InvisibleMode(ModuleData, Mode):
implements(IPlugin, IModuleData, IMode)
name = "InvisibleMode"
core = True
affe... | Python | 0.000047 | |
cfec967be4602dff636adb951b582d1db114f578 | Add single dataset doc gen | tensorflow_datasets/scripts/document_dataset_version.py | tensorflow_datasets/scripts/document_dataset_version.py | # coding=utf-8
# Copyright 2020 The TensorFlow Datasets 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 appl... | Python | 0.000001 | |
ba5a251896e51bab70fa6b664e6974d3c42ff7b4 | add asciidoctor gem (#9905) | var/spack/repos/builtin/packages/asciidoctor/package.py | var/spack/repos/builtin/packages/asciidoctor/package.py | # Copyright 2013-2018 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 Asciidoctor(Package):
"""Modern asciidoc tool based on ruby"""
homepage = "https://as... | Python | 0 | |
a189203bf2dc7ddd925ed8cfbeb191ee52d43711 | Add Python script to investigate s3 speeds | src/aws_scripts/benchmark_s3.py | src/aws_scripts/benchmark_s3.py | from __future__ import print_function
import boto3
import subprocess
import os
import pandas as pd
import time
def DownloadFile(local_file, bucket, bucket_path):
print("Downloading file...", end="")
s3 = boto3.resource('s3')
s3.Bucket(bucket).download_file(bucket_path, local_file)
print("Done!")
def U... | Python | 0.000001 | |
a78e2566d26b229192e94fecb3c89801afbdce02 | Create MQTT.py | service/MQTT.py | service/MQTT.py | from time import sleep
topic = "mrl"
qos = 2
broker = "tcp://iot.eclipse.org:1883" //if you have your own just change the hostname/IP
clientID = "MRL MQTT python"
mqtt1 = Runtime.createAndStart("mqtt", "MQTT")
mqtt1.startService()
print mqtt1.getDescription()
mqtt1.startClient(topic, qos, broker, clientID)
sleep(1)
... | Python | 0 | |
40907535fcae6771dad5f4ee5825fef56bfe7fa0 | Add test for teuthology.suite.build_email_body() | teuthology/test/test_suite.py | teuthology/test/test_suite.py | #!/usr/bin/env python
from nose.tools import (
eq_ as eq,
assert_equal,
assert_raises,
with_setup,
)
import os
import shutil
import random
import yaml
from .. import suite
archive_base_dir = 'test_archive'
def get_random_metadata(name, hung=False):
"""
Generate a random info dict for a fake... | Python | 0 | |
2f0be29357a8b649b59cd685eb6dea646813feac | Add discovery example (#361) | examples/discovery_example.py | examples/discovery_example.py | """
Example that shows how to receive updates on discovered chromecasts.
"""
import argparse
import logging
import time
import pychromecast
parser = argparse.ArgumentParser(description="Example on how to receive updates on discovered chromecasts.")
parser.add_argument("--show-debug", help="Enable debug log", action="... | Python | 0 | |
182d4229f6293eec791a5eba716917ace3bcfaca | Make looking for outliers easier | cal_pipe/manual_outlier_flag.py | cal_pipe/manual_outlier_flag.py |
import sys
'''
Check for garbage points in a MS by SPW.
'''
try:
vis_name = sys.argv[1]
corrstring = sys.argv[2]
starting_spw = int(sys.argv[3])
except IndexError:
vis_name = raw_input("MS Name? : ")
corrstring = raw_input("Corrstring? : ")
starting_spw = int(raw_input("SPW to start at? : "))... | Python | 0.000013 | |
0c6ce9d5752dfe1f4306c87c2b25a529175ff106 | Add comicpull. A basic comic pull-list manager. | comicpull.py | comicpull.py | #!/usr/bin/python
# Copyright 2013 Russell Heilling
# pylint: disable=C0103
'''Comic pull-list management.
Manage titles on pull-list and add new titles to toread list.
'''
import logging
import os
import sqlite3
import sys
import args
from calibredb import CalibreDB, set_log_level
ARGS = args.ARGS
args.add_argumen... | Python | 0 | |
9f6c1306e443f74dbf108def2a25c44c33f2bec1 | Add a serial test | src/test-serial.py | src/test-serial.py | # RobotMain - Simon Lees simon@simotek.net
# Copyright (C) 2015 Simon Lees
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any l... | Python | 0.000023 | |
8bf7b5ae2464721be8270b159b99cd728109f000 | Create __init__.py | Python_Version/Ex7.K-Means_PCA_-_Clustering/__init__.py | Python_Version/Ex7.K-Means_PCA_-_Clustering/__init__.py | Python | 0.000429 | ||
13056d362fceb0aa20487a440c7347ad4231ea97 | Add tiltoc.py | tiltoc.py | tiltoc.py | import os
from datetime import datetime
# Directory
root = os.getcwd()
# Exclude
excludes = (root, "drafts")
def relative(root, path):
return '/'.join(path.replace(root, '').split(os.path.sep)[1:])
def tils(root):
for (path, dirs, files) in os.walk(root):
dirs[:] = [d for d in dirs if d not in exclu... | Python | 0.001485 | |
7fa62ea8374c839f8f188f34505de4d3114e6b56 | Create app.py | channels/r_BetterEveryLoop/app.py | channels/r_BetterEveryLoop/app.py | #encoding:utf-8
from utils import get_url, weighted_random_subreddit
# Subreddit that will be a source of content
subreddit = weighted_random_subreddit({
'BetterEveryLoop': 1.0,
# If we want get content from several subreddits
# please provide here 'subreddit': probability
# 'any_other_subreddit': 0.... | Python | 0.000003 | |
7a8c6520beb7dfb086d1c9b5254e7083d694f35c | check for globals in the lib that are not prefixed with toku. addresses #74 | src/tokuglobals.py | src/tokuglobals.py | #!/usr/bin/python
import sys
import os
import re
def checkglobals(libname, exceptsymbols, verbose):
badglobals = 0
nmcmd = "nm -g " + libname
f = os.popen(nmcmd)
b = f.readline()
while b != "":
match = re.match("^([0-9a-f]+)\s(.?)\s(.*)$", b)
if match == None:
match = r... | Python | 0.00001 | |
f709f00e5c4e112774cebbc7ab3f546354290da8 | Create human_readable_time.py | human_readable_time.py | human_readable_time.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Human Readable Time
#Problem level: 5 kyu
def make_readable(seconds):
s = '{:0>2}'.format(seconds%60)
m = '{:0>2}'.format((seconds//60)%60)
h = '{:0>2}'.format(seconds//3600)
return ':'.join([h,m,s])
| Python | 0.002008 | |
17d1bb1e381a1bfcbf0a4dab866dedf2840d1d26 | substrings must be of length 3 | 043_sub_string_divisibility.py | 043_sub_string_divisibility.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# A Solution to "Sub-string divisibility" – Project Euler Problem No. 43
# by Florian Buetow
#
# Sourcecode: https://github.com/fbcom/project-euler
# Problem statement: https://projecteuler.net/problem=43
import itertools
def is_substring_divisible(n):
n = str(n)
... | Python | 0.999999 | |
56e51e48de854c83870549c1cab2893c24116734 | add tests | check_mk_web_api/test_WebApi.py | check_mk_web_api/test_WebApi.py | import os
import pytest
from check_mk_web_api import WebApi, CheckMkWebApiException
api = WebApi(
os.environ['CHECK_MK_URL'],
os.environ['CHECK_MK_USER'],
os.environ['CHECK_MK_SECRET']
)
def setup():
api.delete_all_hosts()
def test_add_host():
api.add_host('host00')
assert 'host00' in api... | Python | 0 | |
bb638c49f0a73289392e63dff7bec6e9b49b8199 | Add a simple wrapper around losetup | datapath/raw+file/losetup.py | datapath/raw+file/losetup.py | #!/usr/bin/env python
import xapi
import commands
def log(txt):
print >>sys.stderr, txt
# [run dbg cmd] executes [cmd], throwing a BackendError if exits with
# a non-zero exit code.
def run(dbg, cmd):
code, output = commands.getstatusoutput(cmd)
if code <> 0:
log("%s: %s exitted with code %d: %s"... | Python | 0 | |
79f7a947d9fbf1903957aea0ef459bee53d2ba82 | use subnet_service_types extension from neutron-lib | neutron/extensions/subnet_service_types.py | neutron/extensions/subnet_service_types.py | # 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, software
# d... | # 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, software
# d... | Python | 0.000003 |
cd8110b0ca4d53477b8331af2317e267da057df6 | add example 'audit' where chat is replicated in a secondary space | examples/audit.py | examples/audit.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, ... | Python | 0 | |
3379f3a7b8e15f0a91a04807b595418b7ab70d4f | Add optimization utility functions. | dit/algorithms/optutil.py | dit/algorithms/optutil.py | """
Various utilities that can be helpful for optimization problems.
"""
from __future__ import division
from collections import defaultdict
import itertools
import numpy as np
import dit
def as_full_rank(A, b):
"""
From a linear system Ax = b, return Bx = c such that B has full rank.
In CVXOPT, linea... | Python | 0 | |
0229c868a8f204759c76ecae92cecc4e7a6312b5 | Add link module + Link class stub | flask_hal/link.py | flask_hal/link.py | #!/usr/bin/env python
# encoding: utf-8
"""
flask_hal.link
==============
Implements the ``HAL`` Link specification.
"""
class Link(object):
"""
"""
def __init__(
self,
href,
name=None,
title=None,
link_type=None,
deprecation=None,... | Python | 0 | |
34206ab96b5546e617b1478f59357a6a3f7ed8b6 | Add a custom gunicorn Sync worker implementation which works around some issues which occur when eventlet monkey patching is used with sync worker. | st2common/st2common/util/gunicorn_workers.py | st2common/st2common/util/gunicorn_workers.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | Python | 0 | |
1650824ef5886a12715bd0004e95ab3bf4dc5dfd | Add new package: phoenix (#18143) | var/spack/repos/builtin/packages/phoenix/package.py | var/spack/repos/builtin/packages/phoenix/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Phoenix(Package):
"""Apache Phoenix is a SQL skin over HBase delivered as a client-embedde... | Python | 0 | |
7b688747a02f9ac29d4f119bf142f7ef0ad805e9 | Test for COM collections; IEnumVariant so far only. | comtypes/test/test_collections.py | comtypes/test/test_collections.py | import unittest
from comtypes.client import CreateObject, GetModule #, Constants
from find_memleak import find_memleak
from ctypes import ArgumentError
class Test(unittest.TestCase):
def test_IEnumVARIANT(self):
# The XP firewall manager.
fwmgr = CreateObject('HNetCfg.FwMgr')
# apps has a ... | Python | 0 | |
5ca144d2610107e97cfda3a67210211d2ae6105d | Update app/extensions/json/__init__.py | app/extensions/json/__init__.py | app/extensions/json/__init__.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import datetime
import decimal
import io
import uuid
from flask import current_app
from flask import json as _json
from flask import request
import arrow
import pendulum
import phonenumbers
text_type = str
def _wrap_reader_for_text(fp, encoding):
... | Python | 0 | |
f45848477043d933119180e1229b841372b86240 | Add sensor for Dweet.io | homeassistant/components/sensor/dweet.py | homeassistant/components/sensor/dweet.py | """
homeassistant.components.sensor.dweet
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Displays values from Dweet.io..
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.dweet/
"""
from datetime import timedelta
import logging
import homeassistant.util as u... | Python | 0 | |
c0cc954686c7ababe2d3fba6e563e955e85d9caf | add individual migration script | xbrowse_server/base/management/commands/transfer_missing_family_individuals_to_different_project.py | xbrowse_server/base/management/commands/transfer_missing_family_individuals_to_different_project.py | from django.core.management.base import BaseCommand
from seqr.views.apis.pedigree_image_api import update_pedigree_images
from xbrowse_server.base.models import Project as BaseProject, Family as BaseFamily, Individual as BaseIndividual
from xbrowse_server.base.model_utils import create_xbrowse_model, update_xbrowse_mo... | Python | 0 | |
e055cc963eb5eb05c2685ae75d1614c81ef3c59a | load qld data into elasticsearch | injest/search_index.py | injest/search_index.py | # -*- coding: utf-8 -*-
"""
This module contains the code for putting heritage places into a search index.
"""
from elasticsearch import Elasticsearch
ES_HOST = "192.168.10.200"
es = Elasticsearch(ES_HOST)
def add_heritage_place(place):
"""Add a heritage place to the search index
:param place: Dictionar... | Python | 0 | |
7cc0f1cc461d6ccd4c191ec243184deab7f1028f | Create strings.py | strings/strings.py | strings/strings.py | Python | 0.999865 | ||
b8345be15c7f65e97f6bc148ad6c35ff80ff3870 | add printing demo | demos/gtk-demo/demos/printing.py | demos/gtk-demo/demos/printing.py | #!/usr/bin/env python
# -*- Mode: Python; py-indent-offset: 4 -*-
# vim: tabstop=4 shiftwidth=4 expandtab
#
# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri <johnp@redhat.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License a... | Python | 0 | |
6917e3b8689ace77bda912f82163f0f91a1a881b | Solve conflict in DB schema for circle CI | digikey/migrations/0022_merge.py | digikey/migrations/0022_merge.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('digikey', '0019_merge'),
('digikey', '0021_auto_20151125_1353'),
]
operations = [
]
| Python | 0.001334 | |
2067c07cf1dc9029bf3cea372d7cc70297c7743e | Add jsonable_boundaries module | jsonable_boundaries.py | jsonable_boundaries.py | """
`jsonable` is just a cute shortening of JSON-serializable,
but it also means that the object is pure data, and does not
drag any (publicly-accessible) behavior with it.
Anything that can be serialized by the default simplejson
http://simplejson.readthedocs.org/en/latest/#encoders-and-decoders
serializer would cou... | Python | 0.000001 | |
0e5e8a4da2e983d0b997043637b1049fbc68f9aa | Add file I forgot! Thanks to J. Hunter for report. | IPython/testing/globalipapp.py | IPython/testing/globalipapp.py | """Global IPython app to support test running.
We must start our own ipython object and heavily muck with it so that all the
modifications IPython makes to system behavior don't send the doctest machinery
into a fit. This code should be considered a gross hack, but it gets the job
done.
"""
from __future__ import ab... | Python | 0 | |
875ca73c4cab4c3d036f824c3942589f0ced935f | Test password update | tests/services/authentication/test_update_password_hash.py | tests/services/authentication/test_update_password_hash.py | """
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from byceps.services.authentication.password.models import Credential
from byceps.services.authentication.password import service as password_service
from byceps.services.user import event_service
from tests.base impor... | Python | 0.000001 | |
4b040fd365c2a8609b2943525b87c2e27924eb19 | add novaclient sample | test-novaclient.py | test-novaclient.py | from novaclient.v1_1.client import Client
context = {
'user': 'admin',
'auth_token': '22b07d939fa544769bf625753ecaec18',
'tenant': '7dfd3b6a98664f7cb78808f57b7984da',
}
# nova_compute_url
url = 'http://192.168.242.10:8774/v2/7dfd3b6a98664f7cb78808f57b7984da'
PROXY_AUTH_URL = 'http://192.168.242.10:5000/v2... | Python | 0 | |
1d355343700bd74ebc2944053e5086a22c1c0b5c | add post-commit.py | git/post-commit.py | git/post-commit.py | #!/usr/bin/python
import os
import re
import subprocess as sp
def up_version(ver, idx):
ver[idx] += 1
return ver[:idx + 1] + [0] * (3 - idx)
commands = {
'#vtwe++': lambda ver: up_version(ver, 3),
'#vpat++': lambda ver: up_version(ver, 2),
'#vmin++': lambda ver: up_version(ver, 1),
'#vmaj++':... | Python | 0 | |
2b5500154b8be9ee7760bb1cb883775a604a2d8f | Create appleproduct_checker.py | tools/scripts/python/appleproduct_checker.py | tools/scripts/python/appleproduct_checker.py | #!/usr/bin/python
import sys
import os
class IParser:
def __init__():
pass
def parse(self, doc, out_file):
self._doc = doc
self._out_file = out_file
class JSONParser(IParser):
def __init__(self):
pass
def parse(self, doc, out_file, model):
import json
out_arr = []
IParser.parse... | Python | 0.999499 | |
b778e3438909d290ce88bbb0d187aa793652ff5e | Create euler2.py | euler2.py | euler2.py | Python | 0.000001 | ||
fe7e82257703e3c5773d3e321435cb4443eed46d | Add gunicorn configuration file | gunicorn_config.py | gunicorn_config.py | import multiprocessing, os.path
command = '/usr/local/bin/gunicorn'
pythonpath = os.path.dirname( os.path.abspath(__file__) )
bind = '127.0.0.1:9000'
workers = multiprocessing.cpu_count() * 2 + 1
user = 'nobody'
| Python | 0 | |
91370b54e4a974fe51f563edda75e2738d3fb00c | Add noise sensor | haffmpeg/sensor.py | haffmpeg/sensor.py | """For HA camera components."""
from .core import HAFFmpegQue
class SensorNoise(HAFFmpegQue):
"""Implement a noise detection on a autio stream."""
def __init__(self, ffmpeg_bin):
"""Init CameraMjpeg."""
HAFFmpegQue.__init__(self, ffmpeg_bin=ffmpeg_bin)
self._peak = -30
self._... | Python | 0.000004 | |
65f05e93edc2e9a7033edb8d54bd25b04c32d084 | test script.. | test_elemaccess.py | test_elemaccess.py | from cern import cpymad
lhc=cpymad.model('lhc')
print lhc.get_sequences()
all_elements=lhc.get_element_list('lhcb1')
print lhc.get_element('lhcb1',all_elements[3])
| Python | 0 | |
10ac7ea7a67b7a15146ae7c9c0ba9ba74876df81 | Add a testcase for RubyGems | tests/test_gems.py | tests/test_gems.py | from tests.helper import ExternalVersionTestCase
class RubyGemsTest(ExternalVersionTestCase):
def test_gems(self):
self.assertEqual(self.sync_get_version("example", {"gems": None}), "1.0.2")
| Python | 0.000005 | |
28927f62f0cbc172f0a2131156a372c2185090ae | Introduce add_license.py to fix python file headers. | build/add_license.py | build/add_license.py | #!/usr/bin/env python2.5
# ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
from __future__ import with_statement
import re
import sys
import os
from subprocess import Popen, PIPE
from datetime import date
# Could act like a quine and take this info from the bits above... | Python | 0 | |
e9115cb3c52386dc7b74b4d06070b44697725811 | Add manage.py | tests/manage.py | tests/manage.py | import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| Python | 0.000001 | |
9eaf735bcdba9f3fd8a51219d0eebb61f8b2f166 | add 20.6.7 | var/spack/repos/builtin/packages/py-setuptools/package.py | var/spack/repos/builtin/packages/py-setuptools/package.py | from spack import *
class PySetuptools(Package):
"""Easily download, build, install, upgrade, and uninstall Python packages."""
homepage = "https://pypi.python.org/pypi/setuptools"
url = "https://pypi.python.org/packages/source/s/setuptools/setuptools-11.3.tar.gz"
version('20.6.7', '45d6110f3ec14... | from spack import *
class PySetuptools(Package):
"""Easily download, build, install, upgrade, and uninstall Python packages."""
homepage = "https://pypi.python.org/pypi/setuptools"
url = "https://pypi.python.org/packages/source/s/setuptools/setuptools-11.3.tar.gz"
version('20.5', 'fadc1e1123ddbe3... | Python | 0.000002 |
bcc48ecba38450bd77b5dcce7ae60d2966cbd7d2 | Migrate object_sections to relationships | src/ggrc/migrations/versions/20150521150652_23880aa43323_migrate_object_sections_to_relationships.py | src/ggrc/migrations/versions/20150521150652_23880aa43323_migrate_object_sections_to_relationships.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: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
"""Migrate object_sections to relationships
Revision ID: 23880aa43323
Revises: ... | Python | 0.000103 | |
2f0bf45ec747778d38801892e97d5a902443841d | Define "Assessment updated" notification type | src/ggrc/migrations/versions/20170207134238_562ec606ff7c_add_assessment_updated_notification_type.py | src/ggrc/migrations/versions/20170207134238_562ec606ff7c_add_assessment_updated_notification_type.py | # Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""
Add Assessment updated notification type
Create Date: 2017-02-07 13:42:38.921370
"""
# disable Invalid constant name pylint warning for mandatory Alembic variables.
# pylint: disable=invalid-name
from ... | Python | 0.000001 | |
3ec80d1a0de750af7831cca5a29294558600e88f | Add python_bootstrap.py | xunit-autolabeler-v2/ast_parser/python/python_bootstrap.py | xunit-autolabeler-v2/ast_parser/python/python_bootstrap.py | # Copyright 2020 Google LLC.
#
# 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.999875 | |
3ccc8357d5d5466acc97f1b065f500e9b096eeb7 | add exception for cursor | addons/mrp/wizard/wizard_procurement.py | addons/mrp/wizard/wizard_procurement.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
#... | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
#... | Python | 0 |
f1145fc98f825b20452dd924d287349b4a8ae628 | Update templates.py | infra/templates.py | infra/templates.py | # Copyright 2016 Google Inc.
#
# 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,... | # Copyright 2016 Google Inc.
#
# 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.000001 |
4efc039389b9aab3813a3815a58281c898f1acfd | Create user_exceptions.py | user_exceptions.py | user_exceptions.py | #/bin/python
# Python program for playing around with user defined exceptions
class TooSmallError(Exception):
message = "Too small! Try again ;)"
class TooBigError(Exception):
message = "Too big! Try again ;)"
class ExactError(Exception):
def __init__(self):
print "HAHAHA You hit the trap"
class unhand... | Python | 0.000005 | |
fe11a1b638b1779e51da87eaa30f1f12b2d0911c | Add a module for known data models: CDS, ECMWF, etc. | cf2cdm/datamodels.py | cf2cdm/datamodels.py | #
# Copyright 2017-2018 European Centre for Medium-Range Weather Forecasts (ECMWF).
#
# 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... | Python | 0 | |
b6303a18051f5bc050c141b72935b9a87c752a59 | move into separate module | utils/rms_paths.py | utils/rms_paths.py | import pathlib
from collections import namedtuple
def get_paths(prj_root):
"""
Maps path structure into a namedtuple.
:return:dict: namedtuple paths
"""
root_dir = pathlib.Path(prj_root).absolute().parent
RMSPaths = namedtuple("RMSPaths", "root logs warnings commands journals com_warnings com_... | Python | 0.000001 | |
1a1ee9eff1f04d6e40c9288e15dc3fad7515c2b8 | Make a unittest for CArray class | tests/cupy_tests/core_tests/test_carray.py | tests/cupy_tests/core_tests/test_carray.py | import unittest
import cupy
from cupy import testing
class TestCArray(unittest.TestCase):
def test_size(self):
x = cupy.arange(3).astype('i')
y = cupy.ElementwiseKernel(
'raw int32 x', 'int32 y', 'y = x.size()', 'test_carray_size',
)(x, size=1)
self.assertEqual(int(y[... | Python | 0.000011 | |
2cf5f7baf115511c9dd8a8a0333a9b579455b9a3 | Add file for rule's symbol tests | tests/rules_tests/FromSymbolComputeTest.py | tests/rules_tests/FromSymbolComputeTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import main, TestCase
from grammpy import Rule
class FromSymbolComputeTest(TestCase):
pass
if __name__ == '__main__':
main()
| Python | 0 | |
3f63b647d9f1e3c0ea8c83a869db8fc0028127c5 | Create 05.FibonacciNumbers.py | TechnologiesFundamentals/ProgrammingFundamentals/MethodsAndDebugging-Excercises/05.FibonacciNumbers.py | TechnologiesFundamentals/ProgrammingFundamentals/MethodsAndDebugging-Excercises/05.FibonacciNumbers.py | def fibonacci(n):
if n == 0 or n == 1:
return 1
else:
return fibonacci(n - 1) + fibonacci(n - 2)
if __name__ == '__main__':
number = int(input())
print(fibonacci(number))
| Python | 0.000008 | |
f5a0227042b64c6e8a8d85b9e0bc9cf437dc11b8 | resolve migration conflict | ovp_users/migrations/0012_merge_20170112_2144.py | ovp_users/migrations/0012_merge_20170112_2144.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-01-12 21:44
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ovp_users', '0011_auto_20170111_1633'),
('ovp_users', '0011_auto_20170112_1417'),
]
... | Python | 0.000008 | |
0145c8e9c3c528fb3870e6367ee630d58786203b | Add files via upload | extract_font.py | extract_font.py | import Image, ImageFont, ImageDraw
import time
import os
from scipy import ndimage
import Image, ImageDraw
import matplotlib.image as mpimg
import numpy as np
import math
def convert_im(code, image1):
image1 = image1.crop(image1.getbbox())
w1, h1 = image1.size
image2 = Image.new("RGB", (28, 28), (255, 255, 255))... | Python | 0 | |
3247ff26cbe63d875a493382c3f567f112de8b58 | Add maintenance script to fix missing menu links | bin/maintenance/update_menus.py | bin/maintenance/update_menus.py | from __future__ import division
from collections import Counter
from indico.core.db import DBMgr
from indico.util.console import conferenceHolderIterator, success
from MaKaC.conference import ConferenceHolder
from MaKaC.webinterface.displayMgr import ConfDisplayMgrRegistery
def update_menus(dbi):
links = ('coll... | Python | 0 | |
f791288603c56cfde478377ee9f143197fcee670 | Add example showing the usage of WindFarms and WindTurbineClusters | example/further_example.py | example/further_example.py | """
The ``further_example`` module shows a further usage of the windpowerlib.
In this example uses functions from the ``basic_example`` module where the
basic usage of the windpowerlib is shown.
"""
__copyright__ = "Copyright oemof developer group"
__license__ = "GPLv3"
try:
from matplotlib import pyplot as pl... | Python | 0 | |
1324ae9a6ba9d57841df3f7b729036120eee3d47 | delete easyui | exercise/file/somecript.py | exercise/file/somecript.py | import sys
text = sys.stdin.read()
words = text.split()
wordcount = len(words)
print() | Python | 0.000001 | |
3e23bf784a75de688811a4655e29bd2ae9bc163a | condense utility | topicmodel/interpret/condense_doctopics.py | topicmodel/interpret/condense_doctopics.py | # condense_doctopics.py
# The doctopics file produced by MALLET can be very
# bulky. This script condenses it by keeping only the
# rows needed to evaluate our preregistered hypotheses.
import sys, csv, os
def getdoc(anid):
'''
Gets the docid part of a character id
'''
if '|' in anid:
thedoc... | Python | 0.999754 | |
b333deae9db90a193d274bf235dca8d6dddff5c2 | Add script for getting milestone contributors (#4396) | docs/_bin/get-milestone-contributors.py | docs/_bin/get-milestone-contributors.py | #!/usr/bin/env python3
import json
import sys
import requests
# tested with python 3.6 and requests 2.13.0
if len(sys.argv) != 2:
sys.stderr.write('usage: program <milestone-number>\n')
sys.stderr.write('Provide the github milestone number, not name. (e.g., 19 instead of 0.10.1)\n')
sys.exit(1)
milestone_num... | Python | 0 | |
28377ff5ac680cb5c97997f01b6300debe1abd80 | add missing migration. fix #118 | waliki/migrations/0006_auto_20170326_2008.py | waliki/migrations/0006_auto_20170326_2008.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-26 20:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('waliki', '0005_auto_20141124_0020'),
]
operations = [
migrations.AlterField... | Python | 0.000706 | |
648c51c41b51fe7919798de755ab1f04f40502a7 | Add Simple File Example | examples/simple_file_instance.py | examples/simple_file_instance.py | #!/usr/bin/env python
"""Creates the CybOX content for CybOX_Simple_File_Instance.xml
"""
from cybox.common import Hash
from cybox.core import Observable, Observables
from cybox.objects.file_object import File
def main():
h = Hash("a7a0390e99406f8975a1895860f55f2f")
f = File()
f.file_name = "bad_file24.e... | Python | 0 | |
47e7d9fc28214e69ed9b0a36104feed80422a5b7 | Create molecule.py | molecule.py | molecule.py | import numpy as np
def grab_iter_dual(i, bond_hash, mol_used, body_hash=None):
s = [i]
r = []
while s:
v = s.pop()
if not mol_used[v]:
r.append(v)
mol_used[v] = True
# for w in bond_hash[v]:
# s.append(w)
s.extend(bond_hash[v])... | Python | 0.000493 | |
7cdeb30d5beefbed8d44e3b8eb5384ff05a1f09e | change logg buff, but no save | class4/class4_ex2.py | class4/class4_ex2.py | #!/usr/bin/env python
import paramiko
import time
from getpass import getpass
def prevent_paging(remote_conn):
''' stop pagination '''
remote_conn.send("\n")
remote_conn.send("term len 0\n")
time.sleep(1)
''' clear output buffer '''
output = remote_conn.recv(1000)
return output
def cl... | Python | 0 | |
dfb4b3ab679a5c8767bd7571da0fdd40850d2d84 | Add __main__.py | crox/__main__.py | crox/__main__.py | #!/usr/bin/env python
from __future__ import division, print_function, absolute_import
import os
import sys
sys.path = [os.path.join(os.path.abspath(os.path.dirname(__file__)), "..")] + sys.path
from crox.core import main
if __name__ == '__main__':
main()
| Python | 0.000019 | |
2a81e39a843e31181af455a89ad2b200b7d2f024 | Add migrations for session changes | director/sessions_/migrations/0005_auto_20160316_2124.py | director/sessions_/migrations/0005_auto_20160316_2124.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-03-16 21:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sessions_', '0004_auto_20160124_0931'),
]
operations = [
migrations.AddField... | Python | 0 | |
6a5efced71110c49f8866a09b94e2a4c335fed13 | Copy ompt test into its own file. | integration/test/test_ompt.py | integration/test/test_ompt.py | #!/usr/bin/env python
#
# Copyright (c) 2015, 2016, 2017, 2018, 2019, 2020, Intel Corporation
#
# 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 | |
48eb8de9a10b870aa3d0f26386a67c9d8f5e47c1 | Add basic extruder implementation | cura/Extruder.py | cura/Extruder.py | # Copyright (c) 2016 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
import re #To parse container registry names to increment the duplicates-resolving number.
import UM.Settings.ContainerRegistry #To search for nozzles, materials, etc.
import UM.Settings.ContainerStack #To create a contain... | Python | 0 | |
92c7efdfd0a1a70081d6dd5e3c318432124bc87d | Add disk caching so we don't have to always wait for closure | util/builder.py | util/builder.py | import os
import subprocess
import zipfile
import hashlib
import re
from zipfile import ZipFile
from StringIO import StringIO
class RainbowBuilder(object):
def __init__(self, js_path, closure_path):
self.js_path = js_path
self.closure_path = closure_path
self.js_files_to_include = []
... | import os
import subprocess
import zipfile
from zipfile import ZipFile
from StringIO import StringIO
# Helper class for generating custom builds of rainbow
class RainbowBuilder(object):
def __init__(self, js_path, closure_path):
self.js_path = js_path
self.closure_path = closure_path
self.j... | Python | 0 |
43d2045611320bbe78c1167e6505135425bf9499 | Add customfilters.py to theme | customfilters.py | customfilters.py | #!/usr/bin/env python
import bs4
def menu_filter(pelican_pages, direct_templates):
"""
Jinja filter for Pelican page object list
Structures pages into a three-level menu that can be parsed by Jinja2
templating. Reads page metadata of the form:
:menu: <parent>, <name>, <weight>; <parent2>, <name2>,... | Python | 0 | |
9968aad924fee0c80b895bc24e1452f5c525ee9e | add invite sender | invite.py | invite.py | from auth import init_manager_for_invite
import sys
def main():
m = init_manager_for_invite()
res = m.send_invite(sys.argv[1],
email_template='templates/emailinvite.html',
host='http://localhost:8088')
if res:
print('Success')
else:
print(... | Python | 0.000001 | |
1780ea557d8b01804bf716887d820b340eff3931 | Create split-array-into-fibonacci-sequence.py | Python/split-array-into-fibonacci-sequence.py | Python/split-array-into-fibonacci-sequence.py | # Time: O(n^3)
# Space: O(n)
# Given a string S of digits, such as S = "123456579",
# we can split it into a Fibonacci-like sequence [123, 456, 579].
#
# Formally, a Fibonacci-like sequence is a list F of non-negative
# integers such that:
#
# 0 <= F[i] <= 2^31 - 1,
# (that is, each integer fits a 32-bit signed integ... | Python | 0.999864 | |
5d789bc0829f46fd3bf86c923e2f53280c7ee530 | add a library for dealing fastq files | iron/pythonlib/FASTQBasics.py | iron/pythonlib/FASTQBasics.py | import re, sys
import subprocess
import FileBasics
import math
class QualityFormatConverter:
def __init__(self,type):
self.observed_to_Q = {}
self.observed_to_probability = {}
self.type = type
if type == 'S':
start = 33
for i in range(0,41):
self.observed_to_Q[i+33] = i
for... | Python | 0 | |
b7fd9a4bbb78e99a939322fc8cd373a6b16dd9a4 | Update and rename Python to Python/Applications/TSP/tsp.py | Python/Applications/TSP/tsp.py | Python/Applications/TSP/tsp.py | """
This application will solve TSP problem with simple evolution algorithm.
The result will be shown in pyglet window.
"""
import pyglet
import random
import sys
import math
class Evolution(object):
def __init__(self):
self.file_path = 'example.dat'
self.base = []
self.iterations = 100
... | Python | 0.981383 | |
e16043547bb43476f56195d5652881ebeb684e57 | Add new create_realm management command. | zerver/management/commands/create_realm.py | zerver/management/commands/create_realm.py | import argparse
from typing import Any
from django.core.management.base import CommandError
from zerver.lib.actions import do_create_realm, do_create_user
from zerver.lib.management import ZulipBaseCommand
from zerver.models import UserProfile
class Command(ZulipBaseCommand):
help = """\
Create a new Zulip orga... | Python | 0 | |
059a29aede4fb1b4db914131b0aad9ca581201fe | Create followers.py | followers.py | followers.py | from twython import Twython
import datetime
print datetime.datetime.now()
players = ["fabiofogna",
"richardgasquet1",
"JohnIsner",
"keinishikori",
"andy_murray",
"milosraonic",
"GrigorDimitrov",
"delpotrojuan",
"DavidFerrer87",
"t... | Python | 0 | |
0c775a1bb685ff5a77f7f4fb3bbde58d0f1f4334 | add missing catalogo app migration | indicarprocess/catalogo/migrations/0002_catalogorapideye.py | indicarprocess/catalogo/migrations/0002_catalogorapideye.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.contrib.gis.db.models.fields
class Migration(migrations.Migration):
dependencies = [
('catalogo', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | Python | 0 | |
c994cfda927353c195048b7c5ac42ed557d8ac0a | Create setup.py | swift/setup.py | swift/setup.py | Python | 0.000001 | ||
ffa99e9ae77a2b651e29dcdbf6abf7a2c9c142a6 | Create DP_Coin_Change_Problem_ctci.py | DP_Coin_Change_Problem_ctci.py | DP_Coin_Change_Problem_ctci.py | #!/bin/python
'''Given a number of dollars, N, and a list of dollar values for C = {C0,C1,C2,...CM} distinct coins, M, find
and print the number of different ways you can make change for N dollars if each coin is available in an infinite quantity.'''
import sys
def make_change(coins, n):
result = dfs(coins,n) ... | Python | 0.000003 | |
8bf1838af917a82b6ee0272c5d990efbbc9f2e4d | add mfcc | test/MFCC.py | test/MFCC.py | ###############################################################################
# Module for MFCC extraction
# By Maigo Yun Wang, 02/08/2012
###############################################################################
# Quick tutorial:
# import MFCC
# x = ... # x is a wave signal saved in a... | Python | 0.000014 | |
67ee018391df9682e5fe96dd0beba687517f1bf1 | Create autoclearbuf.py | HexChat/autoclearbuf.py | HexChat/autoclearbuf.py | import hexchat
__module_name__ = 'autoclearbuf'
__module_author__ = 'fladd & TingPing'
__module_version__ = '1.0'
__module_description__ = 'Auto clear buffer of closed queries with znc'
# TODO:
# Don't run on non-znc networks
# Actually check for channel type (currently crashes)
recently_cleared = []
def privms... | Python | 0.000001 | |
fdc1145b91175673552d21abbfb7ba41c034c426 | Add blaze css | wdom/themes/blaze.py | wdom/themes/blaze.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from wdom.tag import NewTagClass as NewTag
from wdom.tag import *
css_files = [
'//cdn.jsdelivr.net/blazecss/latest/blaze.min.css',
]
Button = NewTag('Button', bases=Button, class_='button')
DefaultButton = NewTag('DefaultButton', 'button', Button, class_='button--... | Python | 0.000169 | |
3caa3f617e493ec0e6226e2553ff785f53aa849d | Add monitor scripts to check pods status on compute node | scripts/monitoring/cron-send-node-pods-status.py | scripts/monitoring/cron-send-node-pods-status.py | #!/usr/bin/env python
""" Check all the customer pods status on every compute node, send status code "1" if all pods on a compute node are not running status """
# Adding the ignore because it does not like the naming of the script
# to be different than the class name
# pylint: disable=invalid-name
# pylint: disable... | Python | 0 | |
0c44e2527004bbb3000c2f3cbe06648ff04f0c92 | Fix python 2.6 'zero length field name in format' error | stripe/error.py | stripe/error.py | # Exceptions
class StripeError(Exception):
def __init__(self, message=None, http_body=None, http_status=None,
json_body=None, headers=None):
super(StripeError, self).__init__(message)
if http_body and hasattr(http_body, 'decode'):
try:
http_body = http_... | # Exceptions
class StripeError(Exception):
def __init__(self, message=None, http_body=None, http_status=None,
json_body=None, headers=None):
super(StripeError, self).__init__(message)
if http_body and hasattr(http_body, 'decode'):
try:
http_body = http_... | Python | 0.001793 |
ece35f891ffd976a7ecfd191e9fbad1e416650d2 | TEST added for phantom | dipy/sims/tests/test_phantom.py | dipy/sims/tests/test_phantom.py | import numpy as np
import nose
import nibabel as nib
from nose.tools import assert_true, assert_false, assert_equal, assert_almost_equal
from numpy.testing import assert_array_equal, assert_array_almost_equal
from dipy.core.geometry import vec2vec_rotmat
from dipy.data import get_data
from dipy.viz import fvtk
from... | Python | 0 | |
1b0207786bdc5488790d971c3772ff4825d49a00 | add kmeans | kmeans.py | kmeans.py | '''
Simple k-means with random initial starting points (ver 0)
(c) Duong Nguyen nguyen@sg.cs.titech.ac.jp
'''
import math
import random
from collections import defaultdict
import matplotlib.pyplot as plt
def edist(p, q):
"""
Compute the Euclidean distance between two points p, q.
"""
if len(p) != len(q):
raise ... | Python | 0.999978 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.