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 |
|---|---|---|---|---|---|---|---|
f2f4accf304cfe1aaed042f7df35bc0ee86a6c59 | Add enums for service/record/assignment/transaction type | netsgiro/enums.py | netsgiro/enums.py | from enum import IntEnum
class ServiceType(IntEnum):
NONE = 0
OCR_GIRO = 9
AVTALEGIRO = 21
class RecordType(IntEnum):
TRANSMISSION_START = 10
ASSIGNMENT_START = 20
TRANSACTION_AMOUNT_1 = 30
TRANSACTION_AMOUNT_2 = 31
TRANSACTION_AMOUNT_3 = 32 # Only for TransactionType 20 and 21
... | Python | 0.000001 | |
ca16e36b79e9c7dcd5cb31d899ef9c50ebf602c1 | add unit test for _nearest_neighbor() | urbanaccess/tests/test_network.py | urbanaccess/tests/test_network.py | import pytest
import pandas as pd
from urbanaccess import network
@pytest.fixture
def nearest_neighbor_dfs():
data = {
'id': (1, 2, 3),
'x': [-122.267546, -122.264479, -122.219119],
'y': [37.802919, 37.808042, 37.782288]
}
osm_nodes = pd.DataFrame(data).set_index('id')
data = ... | Python | 0.000002 | |
7c5dbbcd1de6376a025117fe8f00516f2fcbb40d | Add regressiontest for crypto_onetimeauth_verify | tests/unit/test_auth_verify.py | tests/unit/test_auth_verify.py | # Import nacl libs
import libnacl
# Import python libs
import unittest
class TestAuthVerify(unittest.TestCase):
'''
Test onetimeauth functions
'''
def test_auth_verify(self):
msg = b'Anybody can invent a cryptosystem he cannot break himself. Except Bruce Schneier.'
key1 = libnacl.util... | Python | 0.004908 | |
80ccffb269b04af02224c1121c41d4e7c503bc30 | Add unit test for intersperse | tests/util/test_intersperse.py | tests/util/test_intersperse.py | # This file is part of rinohtype, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
from rinoh.util import intersperse
def test_interspers... | Python | 0.000001 | |
8f18a1b75b68d8c97efd57673b160a9ceda608a3 | Add Manifest class | manifest.py | manifest.py | __author__ = 'fervent'
| Python | 0 | |
e56d9337cc5c63ef61afe8ffdee2019e19af0963 | Add test for resolved issue 184 | test/test_issue184.py | test/test_issue184.py | from rdflib.term import Literal
from rdflib.term import URIRef
from rdflib.graph import ConjunctiveGraph
def test_escaping_of_triple_doublequotes():
"""
Issue 186 - Check escaping of multiple doublequotes.
A serialization/deserialization roundtrip of a certain class of
Literals fails when there are bo... | Python | 0 | |
0988a2a18688a8b8e07d94e1609405c17bbe717d | Add test suite for the playlist plugin | test/test_playlist.py | test/test_playlist.py | # -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Thomas Scholtes.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation ... | Python | 0 | |
71577ec62406c0119ea2282a3011ebbc368a3a04 | add test_pollbot.py | tests/test_pollbot.py | tests/test_pollbot.py | #!/usr/bin/env python3
import pytest
import poll_bot
class TestPollBot:
def test_extract_emoji(self):
lines_and_emojis = {
' M)-ystery meat': 'M',
'🐕 dog sandwiches': '🐕',
'3 blind mice': '3',
'🇺🇸 flags': '🇺🇸',
'<:python3:232720527448342530> python3!': '<:python3:232720527448342530>',
}
... | Python | 0.000007 | |
1e9980aff2370b96171011f7fa50d4517957fa86 | Add a script to check TOI coverage for a bbox and zoom range | tilepack/check_toi.py | tilepack/check_toi.py | import mercantile
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument('min_lon',
type=float,
help='Bounding box minimum longitude/left')
parser.add_argument('min_lat',
type=float,
help='Bounding box minimum latitude/bottom')
parser.add_argu... | Python | 0 | |
17654378a6039203ead1c711b6bb8f7fb3ad8680 | add Ermine ELF dumper. | tools/dump-ermine-elfs.py | tools/dump-ermine-elfs.py | #!/usr/bin/env python
#
# Copyright (C) 2013 Mikkel Krautz <mikkel@krautz.dk>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above copyrig... | Python | 0 | |
4a1e46d279df1d0a7eaab2ba8175193cd67c1f63 | Add some template filters: sum, floatformat, addslashes, capfirst, stringformat (copied from django), dictsort, get, first, join, last, length, random, sort. Needed to write tests for all those filters | lighty/templates/templatefilters.py | lighty/templates/templatefilters.py | '''Package contains default template tags
'''
from decimal import Decimal, ROUND_DOWN
import random as random_module
from filter import filter_manager
# Numbers
def sum(*args):
'''Calculate the sum of all the values passed as args and
'''
return reduce(lambda x, y: x + float(y), args)
filter_manager.reg... | Python | 0.000001 | |
654e2bf70b4a47adb53d8a0b17f0257e84c7bdf8 | read in data, check things look sensible. Note: need to change unknowns in group col so we have a more usable data type in the pandas dataframe. | main.py | main.py | # Data modelling challenge.
__author__ = 'Remus Knowles <remknowles@gmail.com>'
import pandas as pd
F_DATA = r'data challenge test.csv'
def main():
df = pd.read_csv(F_DATA)
print df.head()
if __name__ == '__main__':
main() | Python | 0 | |
0046f5276c9572fbc40080cc2201a89ee37b96b2 | Create mwis.py | mwis.py | mwis.py | weights = [int(l) for l in open('mwis.txt')][1:]
def mwis(weights):
n = len(weights)
weights = [0] + weights
maxsetweight = [0, weights[1]]
for i in range(2, n + 1):
maxsetweight.append(max(maxsetweight[i - 1], maxsetweight[i - 2] + weights[i] ))
i = n
maxset = []
while i > 1:... | Python | 0.000005 | |
837382f44d91a44c14884f87c580b969e5ef5a4a | add example for tensorboard | models/toyexample_03_tensorboard.py | models/toyexample_03_tensorboard.py | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True, reshape=False, validation_size=0)
K = 200
L = 100
M = 60
N = 30
# initialization
X = tf.placeholder(tf.float32, [None, 28, 28, 1])
# placeholder for correct answers
Y_ = t... | Python | 0 | |
572a47ab8b05f8e93ec5e1b415cb56387d4279ca | add m_restart.py | pyscf/nao/m_restart.py | pyscf/nao/m_restart.py |
#An HDF5 file is a container for two kinds of objects: datasets (array-like collections of data), and groups (folder-like containers that hold datasets).
#Groups work like dictionaries, and datasets work like NumPy arrays
def read_rst_h5py (filename=None):
import h5py ,os
if filename is None:
path = ... | Python | 0.000026 | |
a0c303e9c1f7ac75e078e6f3ae9586ba68a24f63 | add the solution | python/oj/mergeSort.py | python/oj/mergeSort.py | #!/usr/bin/python
# coding:utf8
'''
@author: shaoyuliang
@contact: mshao@splunk.com
@since: 7/16/14
'''
# https://oj.leetcode.com/problems/merge-sorted-array/
class Solution:
# @param A a list of integers
# @param m an integer, length of A
# @param B a list of integers
# @param n an integer, len... | Python | 0.000256 | |
863ec839e24f2f17ba9d1dfb1177592f34cfc5e3 | Create Transaction.py | pyvogue/Transaction.py | pyvogue/Transaction.py |
import requests
import json
import urllib
class Transaction():
def getall(self,trx,res,decode_content=False):
"""
Gets all your transactions
args:
trx -- the transaction id to be fetched
res -- the response type expected : json or xml
"""
url ... | Python | 0.000001 | |
3ae0ea21cc6b1afadb0dd72e29016385d18167ab | Add FifoReader class to utils | DebianDevelChangesBot/utils/fiforeader.py | DebianDevelChangesBot/utils/fiforeader.py | # -*- coding: utf-8 -*-
#
# Debian Changes Bot
# Copyright (C) 2008 Chris Lamb <chris@chris-lamb.co.uk>
#
# This program 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... | Python | 0 | |
5c3304ffbd78ee47b2c4d197165de08200e77632 | Fix the `week` behavour to match api2 | standup/apps/status/helpers.py | standup/apps/status/helpers.py | import re
from datetime import date, datetime, timedelta
from standup.database.helpers import paginate as _paginate
def paginate(statuses, page=1, startdate=None, enddate=None, per_page=20):
from standup.apps.status.models import Status
if startdate:
statuses = statuses.filter(Status.created >= start... | import re
from datetime import date, datetime, timedelta
from standup.database.helpers import paginate as _paginate
def paginate(statuses, page=1, startdate=None, enddate=None, per_page=20):
from standup.apps.status.models import Status
if startdate:
statuses = statuses.filter(Status.created >= start... | Python | 0.999933 |
6e096fc10c7eb580ec11fbee585dd2aa3210e2b3 | add settings example | blog/settings_example.py | blog/settings_example.py | SITE_URL = "http://project.com"
SITE_NAME = "Project Name"
COMMENTS_APP = 'threadedcomments' # for example
RECAPTCHA_PUBLIC_KEY = 'put-your-key-here'
RECAPTCHA_PRIVATE_KEY = 'put-your-key-here'
SOUTH_MIGRATION_MODULES = {
'taggit': 'taggit.south_migrations',
}
TAGGIT_TAGCLOUD_MIN = 1
TAGGIT_TAGCLOUD_MAX = 8
GRA... | Python | 0 | |
edfba32b5dd24c0fe58da9bbbe84267e81754233 | add demo.py | demo.py | demo.py | import pdb
import json
from pprint import pprint
from chrome_debugger import protocol
from chrome_debugger import interface
from chrome_debugger import websocket
context = protocol.connect("ws://localhost:9222/devtools/page/D08C4454-9122-6CC8-E492-93A22F9C9727")
header = websocket.parse_response(context["sock"].recv(... | Python | 0.000001 | |
863ae7a76567913f60a758a9fb974a27e9bc58d2 | add 21 | p021.py | p021.py | from utils import divisors
def d(n):
return sum(divisors(n))
print sum(filter(lambda n: n != d(n) and n == d((d(n))), range(1, 10000))) | Python | 0.999999 | |
a3a92435781300966ca59d5316693d0306abd600 | Create osrm_OD_matrix.py | osrm_OD_matrix.py | osrm_OD_matrix.py | # using osrm to create a big dirty OD matrix
import csv
import requests
import polyline
import time
import json
db_points = []
# grab points from csv file - just grab, x, y, and a unique ID
# the headers may be different depending on your data!
with open("db.csv", 'r') as csvfile:
reader = csv.DictReader(csvfile... | Python | 0.006322 | |
41a533ffddfebc3303a1e882bfaf1fcdd243828e | add api like test | myideas/core/tests/test_like_api.py | myideas/core/tests/test_like_api.py | from django.test import TestCase
from django.test.client import Client
from django.shortcuts import resolve_url as r
from django.contrib.auth.models import User
from myideas.core.models import Ideas
class LikeApiTest(TestCase):
def setUp(self):
self.client = Client()
self.username = 'diego'
... | Python | 0 | |
10c19d0c7d7cdb2c823a698db8ca128134f32c5a | Add beam potential generation | otz/Beam.py | otz/Beam.py | import pdb
import numpy as np
import scipy as sp
h = 6.626E-34
c = 3.0E8
def uniform(max_angle, intensity):
def profile(phi):
if (abs(phi) < max_angle):
return intensity
else:
return 0
return profile
def default_profile(angle):
return uniform(np.pi/8.0, 1)(angle)
... | Python | 0 | |
ad5018c045a14f2e8360e8118d73d021df10baab | add solution for Course Schedule II | algorithms/courseScheduleII/courseScheduleII.py | algorithms/courseScheduleII/courseScheduleII.py | class Solution:
# @param {integer} numCourses
# @param {integer[][]} prerequisites
# @return {integer[]}
def findOrder(self, numCourses, prerequisites):
g = {v: [] for v in xrange(numCourses)}
deg = {v: 0 for v in xrange(numCourses)}
s = set(range(numCourses))
for u, v in... | Python | 0 | |
4557cce84ff91e830f1f1fd241223cff70ceb46e | add directions and a script for how I found duplicate functions | deprecated/utils/tags-to-dup-functions.py | deprecated/utils/tags-to-dup-functions.py | # Run the below command to generate the TAGS file, then run this script with TAGS as stdin to see duplicate function names
#
# find . -name \*.c -not -path ./deprecated/\* -print0 | xargs -0 etags --declarations -D --no-globals -I --no-members
import collections
import sys
src_file = None
got_section_header = 0
# fu... | Python | 0 | |
4331b380e43751a7223e0ee1dee6c1c45ad09a67 | add levy function | robo/task/levy.py | robo/task/levy.py | '''
Created on 12.07.2015
@author: Aaron Klein
'''
import numpy as np
from robo.task.base_task import BaseTask
class Levy(BaseTask):
def __init__(self):
X_lower = np.array([-15])
X_upper = np.array([10])
opt = np.array([[1.0]])
fopt = 0.0
super(Levy, self).__init__(X_low... | Python | 0.000004 | |
f2c6e7cf6e60eac5222658d89baf28e1e7d12939 | Test minimal snoop2 | platforms/m3/programming/mbus_snoop_img2.py | platforms/m3/programming/mbus_snoop_img2.py | #!/usr/bin/python
import os
import sys
import logging
import csv
import time
import datetime
from datetime import datetime
import m3_common
#m3_common.configure_root_logger()
#logger = logging.getLogger(__name__)
from m3_logging import get_logger
logger = get_logger(__name__)
def Bpp_callback(address, data, cb0... | Python | 0.000001 | |
a8c7c6f08571449b618fd57f298546da6ef80ee9 | Add a pyastro16.py file to use as an auto doc demo | astrospam/pyastro16.py | astrospam/pyastro16.py | """
Python in Astronomy 2016 is the second iteration of the Python in Astronomy
conference series.
This is the docstring for the pyastro module, this gets included as the
description for the module.
"""
import numpy as np
def times(a, b):
"""
Multiply a by b.
Parameters
----------
a : `numpy.n... | Python | 0 | |
9af2a8341b59098d0ebb88f1e71a3452c338b191 | Add a plotting example. | Lib/sandbox/pyem/examples/plotexamples.py | Lib/sandbox/pyem/examples/plotexamples.py | #! /usr/bin/env python
# Last Change: Mon Jun 11 03:00 PM 2007 J
# This is a simple test to check whether plotting ellipsoides of confidence and
# isodensity contours match
import numpy as N
from numpy.testing import set_package_path, restore_path
import pylab as P
set_package_path()
import pyem
restore_path()
# Ge... | Python | 0.000001 | |
71ac93da2eed58bbd53bb13d4ade308404be18ad | Add auth0.v2.connection | auth0/v2/connection.py | auth0/v2/connection.py | from .rest import RestClient
class Connection(object):
"""Auth0 connection endpoints"""
def __init__(self, domain, jwt_token):
url = 'https://%s/api/v2/connections' % domain
self.client = RestClient(endpoint=url, jwt=jwt_token)
def all(self, strategy=None, fields=[], include_fields=True... | Python | 0 | |
ea0d9781f3bfb74d6678ca5e353a250a18c5f03e | Use Tilde organizer (with Berlinium GUI) as a bibliography manager | utils/add_pdf_articles.py | utils/add_pdf_articles.py | """
This script introduces how the Tilde organizer
can be used as a bibliography manager.
See https://github.com/tilde-lab/pycrystal/tree/master/papers
for an example usage for the CRYSTAL17 code online bibliography.
Two files are currently needed:
* bib_els_file (raw bibliography items as presented online)
* bib_data_... | Python | 0 | |
7e600a791bec2f8639aae417a1ea052ca94cf7b9 | Add a largish auto-generated test for the aligned bundling feature, along with the script generating it. The test should never be modified manually. If anyone needs to change it, please change the script and re-run it. | testgen/mc-bundling-x86-gen.py | testgen/mc-bundling-x86-gen.py | #!/usr/bin/python
# Auto-generates an exhaustive and repetitive test for correct bundle-locked
# alignment on x86.
# For every possible offset in an aligned bundle, a bundle-locked group of every
# size in the inclusive range [1, bundle_size] is inserted. An appropriate CHECK
# is added to verify that NOP padding occu... | Python | 0.000021 | |
15150516e1915948b10abed70e964a5b6109013b | Add ExtractAttribute | tohu/derived_generators_NEW.py | tohu/derived_generators_NEW.py | import logging
from operator import attrgetter
from .base_NEW import TohuUltraBaseGenerator
__all__ = ['ExtractAttribute']
logger = logging.getLogger('tohu')
class ExtractAttribute(TohuUltraBaseGenerator):
"""
Generator which produces items that are attributes extracted from
the items produced by a diff... | Python | 0.000001 | |
c9afc35d2be96adea47e79a4c0042235e4ffd594 | add ldap-filter-cut.py | python/python/openldap/ldap-filter-cut.py | python/python/openldap/ldap-filter-cut.py | #!/usr/bin/env python
'''
Copyright (C) 2011 Bryan Maupin <bmaupincode@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 3 of the License, or
(at your option) any later... | Python | 0.000001 | |
3a19187e8116e8dc20166786fb1ca4d14b527950 | Add missing IDL Visistor class | ppapi/generators/idl_visitor.py | ppapi/generators/idl_visitor.py | #!/usr/bin/python
#
# Copyright (c) 2011 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.
""" Visitor Object for traversing AST """
#
# IDLVisitor
#
# The IDLVisitor class will traverse an AST truncating portions of the tr... | Python | 0.999835 | |
bbed7b813b6c809ee9615eabf2fcf4d3156b1c36 | Add script to convert release notes from Markdown | tools/convert_release_notes.py | tools/convert_release_notes.py | import sys
import mistune
print(sys.argv[1])
with open(sys.argv[1], "r") as source_file:
source = source_file.read()
html = mistune.Markdown()
print()
print("HTML")
print("=====================================")
print("From the <a href=\"\">GitHub release page</a>:\n<blockquote>")
print(html(source))
print("</b... | Python | 0 | |
c16c04bde2ace97a2eec000c87e23cfc27bfd7ec | Print trace counters with trace events. | tools/perf/metrics/timeline.py | tools/perf/metrics/timeline.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import collections
from metrics import Metric
from telemetry.page import page_measurement
TRACING_MODE = 'tracing-mode'
TIMELINE_MODE = 'timeline-mode'
cla... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import collections
from metrics import Metric
from telemetry.page import page_measurement
TRACING_MODE = 'tracing-mode'
TIMELINE_MODE = 'timeline-mode'
cla... | Python | 0.000002 |
1db5cd0fddbbcc1d38a08bfe8ad6cfb8d0b5c550 | add migration to create new model fields | coupons/migrations/0004_auto_20151105_1456.py | coupons/migrations/0004_auto_20151105_1456.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('coupons', '0003_auto_20150416_0617'),
... | Python | 0 | |
3bd7c50acfc8044fc33002530a5fcaa0b5c2152e | add module 'job' for reset queue | libs/qpanel/job.py | libs/qpanel/job.py | import backend
import config
from redis import Redis
from rq_scheduler import Scheduler
import datetime
def reset_stats_queue(queuename, when, hour):
'''
Reset stat for a queue on backend
queuename: Name of queue to reset
when, hour parameters for more easy
control for exist... | Python | 0.000001 | |
b0c3ed39916e25bed2900b653974672a39fcb254 | Use CHROME_HEADLESS to check if download_sdk_extras.py is running on a bot. | build/download_sdk_extras.py | build/download_sdk_extras.py | #!/usr/bin/env python
# Copyright 2014 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.
"""Script to download sdk/extras packages on the bots from google storage.
The script expects arguments that specify zips file in the ... | #!/usr/bin/env python
# Copyright 2014 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.
"""Script to download sdk/extras packages on the bots from google storage.
The script expects arguments that specify zips file in the ... | Python | 0 |
80580b8667558e3a4034b31ac08773de70ef3b39 | Implement consumer for adjusting screen brightness. | display_control_consumer/run.py | display_control_consumer/run.py | from setproctitle import setproctitle
import json
import redis
import subprocess
import time
class DisplayControlConsumer(object):
STEP = 0.05
def __init__(self):
self.redis_instance = redis.StrictRedis()
self.env = {"DISPLAY": ":0"}
def get_brightness(self):
p = subprocess.Popen... | Python | 0 | |
5a376ef0d49193df46fc127323bfa50376e3c968 | add lqr sample | lqr_sample/main.py | lqr_sample/main.py | #! /usr/bin/python
# -*- coding: utf-8 -*-
u"""
Linear-Quadratic Regulator sample code
author Atsushi Sakai
"""
import matplotlib.pyplot as plt
import numpy as np
import scipy.linalg as la
simTime=3.0
dt=0.1
A=np.matrix([[1.1,2.0],[0,0.95]])
B=np.matrix([0.0,0.0787]).T
C=np.matrix([-2,1])
def Observation(x):
... | Python | 0 | |
e0b6db29ed260f4b54298c4d079f7fc6ce98a591 | Split out public room list into a worker process | synapse/app/client_reader.py | synapse/app/client_reader.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2016 OpenMarket Ltd
#
# 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.999988 | |
a3a022a184694cf95bbc37e22c4329c6b3e400cd | 566. Reshape the Matrix | python/ReshapeTheMatrix.py | python/ReshapeTheMatrix.py | # -*- coding:utf-8 -*-
# @Author zpf
"""
You're given a matrix represented by a two-dimensional array,
and two positive integers r and c representing the row number and column number of the wanted reshaped matrix, respectively.
The reshaped matrix need to be filled with all the elements of the original matrix in the s... | Python | 0.999779 | |
d83b18ec4faa513c7171a23af5ba46397141519e | add main __init__.py | wingstructure/__init__.py | wingstructure/__init__.py | from . import analysis
from . import data
from . import liftingline
from . import structure
| Python | 0.000588 | |
81df43350fdcbde85780dfbf1101e47fff04dc6c | Add missing migration | resolwe/flow/migrations/0025_set_get_last_by.py | resolwe/flow/migrations/0025_set_get_last_by.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-15 12:42
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('flow', '0024_add_relations'),
]
operations = [
migrations.AlterModelOptions(
... | Python | 0.0002 | |
7b2e28f9604347ff396b220c8d2ab7bdfdc671c8 | test hbase TSocket | test/test_hbase_TSocker0Err32/test_hbase.py | test/test_hbase_TSocker0Err32/test_hbase.py | import happybase
# gives error
# TSocket read 0 bytes
# [Errno 32] Broken pipe
if __name__ == "__main__":
conn = happybase.Connection(host="10.1.94.57")
table_name = "escorts_images_sha1_infos_dev"
hbase_table = conn.table(table_name)
batch_list_queries = ["000421227D83DA48DB4A417FCEFCA68272398B8E"]
rows = hbase... | Python | 0.000001 | |
6d8e47f0b1bc70de7464303d6ac3b7684588a7aa | Add mpmodel | mpmodel/mpmodel.py | mpmodel/mpmodel.py | import tensorflow as tf
| Python | 0 | |
ad6e67d382df1018e4ae55ebdcb6fae1cca9bffe | Add merge migration | osf/migrations/0081_merge_20180212_0949.py | osf/migrations/0081_merge_20180212_0949.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-02-12 15:49
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0080_ensure_schemas'),
('osf', '0079_merge_20180202_1206'),
]
operations = [... | Python | 0.000001 | |
ec6b65513baa4532af7cad1bd6c98e162b3db9ef | Add multiprocessing example | interfaces/cython/cantera/examples/transport/multiprocessing_viscosity.py | interfaces/cython/cantera/examples/transport/multiprocessing_viscosity.py | """
This example demonstrates how Cantera can be used with the 'multiprocessing'
module.
Because Cantera Python objects are built on top of C++ objects which cannot be
passed between Python processes, it is necessary to set up the computation so
that each process has its own copy of the relevant Cantera objects. One ... | Python | 0.000001 | |
3fbf2c29a54225e7d4dd882637e68cfe3a4d0101 | Add some tests for Message Queue | src/cobwebs/tests/test_mq.py | src/cobwebs/tests/test_mq.py | from cobwebs.mq.core import RPCLink, TopicsLink
from cobwebs.mq.backends.rabbitmq import driver
import pytest
import spider
import json
from unittest import mock
HOST = "127.0.0.1"
def test_driver_instance():
assert isinstance(driver.rpc, RPCLink)
assert isinstance(driver.topics, TopicsLink)
@mock.patch("c... | Python | 0 | |
144f867f91b637ccdb6b5535646f8884099b7a2f | add missing migration to make result of "migrate" match what the model file says | lava_scheduler_app/migrations/0010_auto__chg_field_testjob_description.py | lava_scheduler_app/migrations/0010_auto__chg_field_testjob_description.py | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'TestJob.description'
db.alter_column('lava_scheduler_app_testjob', 'description', self.g... | Python | 0.000001 | |
eca48495bdba121a0719bb442f5ec30b70233e74 | Add a snippet (Python OpenCV). | python/opencv/opencv_2/gui/opencv_trackbar.py | python/opencv/opencv_2/gui/opencv_trackbar.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)
"""
OpenCV - Trackbar widget.
Required: opencv library (Debian: aptitude install python-opencv)
See: https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/py_trackbar/py_trackbar.html#track... | Python | 0.000018 | |
9a17f2ec043ed8e3f61549104507a87d21ae39e1 | Create baike_spider.py | school/baike_spider.py | school/baike_spider.py | """
a web spider for baidu baike schools info in beijing
"""
import logging.handlers
import os
import urllib.parse
import pandas as pd
import pymysql.cursors
import requests
from bs4 import BeautifulSoup
from lxml import etree
LOG_FILE = 'baikespider.log'
handler = logging.handlers.RotatingFileHandler(LOG_FILE, maxB... | Python | 0.000267 | |
9469bcf60a199b96d1fec778c44346df744a1d60 | add jieba | jieba/test_jieba.py | jieba/test_jieba.py | #!/usr/bin/env python
# encoding=utf-8
import jieba
seg_list = jieba.cut("我来到北京清华大学", cut_all=True)
print("Full Mode: " + "/ ".join(seg_list)) # 全模式
seg_list = jieba.cut("我来到北京清华大学", cut_all=False)
print("Default Mode: " + "/ ".join(seg_list)) # 精确模式
seg_list = jieba.cut("他来到了网易杭研大厦") # 默认是精确模式
print(", ".join(seg_... | Python | 0.999974 | |
291e7c8b2a69f26f6343269aaac2b9e3cd517220 | Add tests | readthedocs/proxito/tests/test_proxied_api.py | readthedocs/proxito/tests/test_proxied_api.py | from readthedocs.rtd_tests.tests.test_footer import TestFooterHTML
from django.test import override_settings
@override_settings(ROOT_URLCONF='readthedocs.proxito.urls')
class TestProxiedFooterHTML(TestFooterHTML):
def setUp(self):
super().setUp()
self.host = 'pip.readthedocs.io'
def render(s... | Python | 0.00001 | |
081b5aabae205ad7c23c512be15ee26276dc8a29 | Check whether Azure CLI is in ARM mode | perfkitbenchmarker/providers/azure/util.py | perfkitbenchmarker/providers/azure/util.py | # Copyright 2016 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | Python | 0 | |
95a86efeadc15f3edc83cbfe64c6d725b1eaf0bd | revert unneeded None checks | web/scripts/load_agagd_data.py | web/scripts/load_agagd_data.py | from app.models import db, Game, GoServer, Player, User
from app.tokengen import generate_token
from flask.ext.script import Command, Option
from scripts.parsing import agagd_parser, pin_change_parser
from uuid import uuid4
"""Script which loads game and user data from an AGAGD SQL dump and file with PIN changes."""
... | from app.models import db, Game, GoServer, Player, User
from app.tokengen import generate_token
from flask.ext.script import Command, Option
from scripts.parsing import agagd_parser, pin_change_parser
from uuid import uuid4
"""Script which loads game and user data from an AGAGD SQL dump and file with PIN changes."""
... | Python | 0.000005 |
59edefb410b932a648347f76ca9a96013b40a08e | Add solution 303 | Problem_300_399/euler_303.py | Problem_300_399/euler_303.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Problem 303
For a positive integer n, define f(n) as the least positive multiple of n that, written in base 10, uses only digits ≤ 2.
Thus f(2)=2, f(3)=12, f(7)=21, f(42)=210, f(89)=1121222.
Also, . n = 1 ~ 100, f(n)/n = 11363107
Find . n = 1 ~ 10000, f(n)/n = ?
''... | Python | 0.999003 | |
6705e0e23d13a94726556714e11dfbb7a916877d | Add basic mechanism to override the default EntryAdmin | zinnia_wymeditor/admin.py | zinnia_wymeditor/admin.py | """EntryAdmin for zinnia-wymeditor"""
from django.contrib import admin
from zinnia.models import Entry
from zinnia.admin.entry import EntryAdmin
class EntryAdminWYMEditorMixin(object):
"""
Mixin adding WYMeditor for editing Entry.content field.
"""
pass
class EntryAdminWYMEditor(EntryAdminWYMEditor... | Python | 0.000001 | |
6193786bb2307550ab9dfb9c218f6d8b3f407156 | Create is-graph-bipartite.py | Python/is-graph-bipartite.py | Python/is-graph-bipartite.py | # Time: O(|V| + |E|)
# Space: O(|V|)
# Given a graph, return true if and only if it is bipartite.
#
# Recall that a graph is bipartite if we can split it's set of nodes into
# two independent subsets A and B such that every edge in the graph has
# one node in A and another node in B.
#
# The graph is given in the fol... | Python | 0.000326 | |
3204227799ce5f7a7d0df4cb6b480b42d6cdae1f | Add a snippet. | python/pyqt/pyqt5/widget_QPainter_OpenGL.py | python/pyqt/pyqt5/widget_QPainter_OpenGL.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# See https://doc.qt.io/archives/4.6/opengl-2dpainting.html
import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QPainter, QBrush, QPen
from PyQt5.QtCore import Qt
from PyQt5.QtOpenGL import QGLWidget
class MyPaintWidget(QGLWidget):
def __in... | Python | 0.000002 | |
ae3bd406736f9235b442c52bf584a97d0760a588 | add api | buildbot_travis/api.py | buildbot_travis/api.py | # Copyright 2012-2013 Isotoma 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 wr... | Python | 0 | |
d19ab50f2d3b259bd6c5cfb21b4087ca4d3ec248 | create theano 2 | theanoTUT/theano2_install.py | theanoTUT/theano2_install.py | # View more python tutorials on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
# 2 - Install theano
"""
requirements:
1. python 2 >=2.6 or python 3>=3.3
2. Numpy >= 1.7.1
3. Scipy >=0.11
If ... | Python | 0 | |
389adca1fd52747814f370de2d066a1743544469 | Solve Game Time in python | solutions/beecrowd/1046/1046.py | solutions/beecrowd/1046/1046.py | start, end = map(int, input().split())
if start == end:
result = 24
elif end - start >= 0:
result = end - start
else:
result = 24 + end - start
print(f'O JOGO DUROU {result} HORA(S)')
| Python | 0.999996 | |
3a9627f31846e06e04d7ae933712840d52616663 | Create main.py | main.py | main.py | import pygame
import game
file = 'music.mp3'
pygame.init()
pygame.mixer.init()
pygame.mixer.music.load(file)
pygame.mixer.music.play(loops=-1)
pygame.mixer.music.set_volume(0.5)
run = True
SuperHeroTower = game.Game()
while run:
run = SuperHeroTower.startScreen()
pygame.quit()
quit()
| Python | 0.000001 | |
8cf6b638a7f3bf229526451076dc27e990be5391 | increase hyperparam grid for TransE in FB15K (margin) | scripts/fb15k/UCL_FB15K_adv_v1.1.py | scripts/fb15k/UCL_FB15K_adv_v1.1.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import itertools
import os.path
import sys
import argparse
import logging
def cartesian_product(dicts):
return (dict(zip(dicts, x)) for x in itertools.product(*dicts.values()))
def summary(configuration):
kvs = sorted([(k, v) for k, v in configuration.items()... | Python | 0 | |
bc3f7e83bd35f1a6ae8add35932513c7da47076e | fix a typo. | restclients/test/util/datetime_convertor.py | restclients/test/util/datetime_convertor.py | from django.test import TestCase
from datetime import date, datetime
from restclients.util.datetime_convertor import convert_to_begin_of_day,\
convert_to_end_of_day
class DatetimeConvertorTest(TestCase):
def test_convert_to_begin_of_day(self):
self.assertEquals(convert_to_begin_of_day(date(2013, 4,... | from django.test import TestCase
from datetime import date, datetime
from restclients.util.datetime_convertor import convert_to_begin_of_day,\
convert_to_end_of_day
class DatetimeConvertorTest(TestCase):
def test_convert_to_begin_of_day(self):
self.assertEquals(convert_to_begin_of_day(date(2013, 4,... | Python | 0.03285 |
3b4f7b9792be0315aca7d71fafe1a972e5fd87f7 | Add Seh_bug_fuzzer.py | SEH_Fuzzer/Seh_bug_fuzzer.py | SEH_Fuzzer/Seh_bug_fuzzer.py | # -*- coding: utf-8 -*-
import time
import sys
import socket
import cPickle
import os
from pydbg import *
from pydbg.defines import *
from util import *
PICKLE_NAME = "fsws_phase1.pkl"
exe_path = "D:\\testPoc\\Easy File Sharing Web Server\\fsws.exe"
import threading
import time
host, port = "12... | Python | 0.000001 | |
2199f4c5ed563200d555315b9a8575e00486e667 | Add a simple script to generate monthly confirmed / fixed counts | script/confirmed-fixed-monthly-breakdown.py | script/confirmed-fixed-monthly-breakdown.py | #!/usr/bin/python
# A script to draw graphs showing the number of confirmed reports
# created each month, and those of which that have been fixed. This
# script expects to find a file called 'problems.csv' in the current
# directory which should be generated by:
#
# DIR=`pwd` rake data:create_problem_spreadshee... | Python | 0 | |
417f1832dbb6a1d0742b2f01d56429139f8885ef | add conversion script | scripts/conversionScripts/toValidationPP.py | scripts/conversionScripts/toValidationPP.py | # Copyright 2017 Battelle Energy Alliance, 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 t... | Python | 0.000001 | |
bbae3e9fee30634a659276732f16a883500e8f45 | Create memcache.py | cutout/cache/memcache.py | cutout/cache/memcache.py | # -*- coding: utf-8 -*-
import os
import re
import tempfile
from time import time
from .basecache import BaseCache
from .posixemulation import rename, _items
try:
import cPickle as pickle
except ImportError:
import pickle
try:
from hashlib import md5
except ImportError:
from md5 import new as md5
... | Python | 0.000001 | |
4fad6f5671d7957371db9d5bbdf9e65960a779b8 | output pairwise distances | pairdist.py | pairdist.py | #!/usr/bin/env python
"""Output pairwise distances between word vectors.
Prints lines with TAB-separated word indices (i, j) and the distance
of the corresponding word vectors under given metric.
Implementation avoids storing the distance matrix in memory, making
application to very large numbers of word vectors fea... | Python | 0.999999 | |
295af615c00a7b783e90c6979eab9decab7c1979 | add strategy.crossover module (WIP) | zephyrus/strategy/crossover.py | zephyrus/strategy/crossover.py | import random
class Crossover:
def __init__(self, probability):
self.probability = probability
def execute(self, *solutions):
# TODO: validate solutions, 2, with len of at least 3
parent1, parent2 = solutions
offspring1 = parent1[:]
offspring2 = parent2[:]
if r... | Python | 0 | |
3719a0371fa6fcc95ca65b6d759762f1f17a16be | Solving p025 | p025.py | p025.py | """
What is the first term in the Fibonacci sequence to contain 1000 digits?
"""
def solve_p025():
for i, num in enumerate(fib_generator()):
if len(str(num)) == 1000:
return i + i
def fib_generator():
prev = 1
curr = 1
yield prev
yield curr
while True:
prev, curr = ... | Python | 0.999768 | |
bd2a70930ba67f3dd510b172fe4e00ddc2dc23c2 | Create voxelmodel.py | odvm/voxelmodel.py | odvm/voxelmodel.py | from panda3d.core import *
from odvm.quads import Quads
class VoxelModel(Geom):
def __init__(self):
Geom.__init__( self, GeomVertexData( 'vertices', GeomVertexFormat.get_v3n3c4(), Geom.UH_static ) )
self.quads = Quads(self)
self.add_primitive(self.quads)
def add(self,p2s,i,j,k,c,p2i=0,p2j=0,p... | Python | 0.000002 | |
b4d82c21995fb2b9e2afd93eea8849ded8b7d489 | Update next-greater-element-iii.py | Python/next-greater-element-iii.py | Python/next-greater-element-iii.py | # Time: O(logn) = O(1)
# Space: O(logn) = O(1)
# Given a positive 32-bit integer n, you need to find the smallest 32-bit integer
# which has exactly the same digits existing in the integer n and is greater in value than n.
# If no such positive 32-bit integer exists, you need to return -1.
@
# Example 1:
# Input: 12
... | # Time: O(logn)
# Space: O(logn)
# Given a positive 32-bit integer n, you need to find the smallest 32-bit integer
# which has exactly the same digits existing in the integer n and is greater in value than n.
# If no such positive 32-bit integer exists, you need to return -1.
@
# Example 1:
# Input: 12
# Output: 21
#... | Python | 0.000007 |
c6af2c9f11204dde361a9b1f8b14113e90a272b3 | add py prototype | 1/hazi.py | 1/hazi.py | #!/usr/bin/env python
import sys, codecs
class Node:
def __init__(self, name, g, h):
self.name = name
self.f = g + h
self.g = g
self.h = h
def sort_node(a, b):
return cmp(a.f, b.f)
def name_in_list(y, l):
for i in l:
if y == i.name:
return True
return False
def node_from_list(y, l):
for i in l:
... | Python | 0 | |
d9ed78369e21b79e022e685ecb39babbb0c17315 | Create test_lcd.py | Raspberry_py/test_lcd.py | Raspberry_py/test_lcd.py | #!/usr/bin/python
#import
import RPi.GPIO as GPIO
import time
# Define GPIO to LCD mapping
LCD_RS = 7
LCD_E = 8
LCD_D4 = 25
LCD_D5 = 24
LCD_D6 = 23
LCD_D7 = 18
# Define some device constants
LCD_WIDTH = 16 # Maximum characters per line
LCD_CHR = True
LCD_CMD = False
LCD_LINE_1 = 0x80 # LCD RAM address for th... | Python | 0.000004 | |
f30c542a9714574dbcee15ca7f7b4ca4cdb9d965 | add atexit01.py | trypython/stdlib/atexit01.py | trypython/stdlib/atexit01.py | # coding: utf-8
"""
atexitモジュールについてのサンプルです。
"""
import atexit
import sys
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
class Sample(SampleBase):
def exec(self):
#
# atexitモジュールを利用するとシャットダウンフックを設定出来る
# register() で登録して、 unregister() で解除する
... | Python | 0.000001 | |
926fe25c4995b5ab1d2464159223e2c403b72570 | use python command line tool with tshark to parse pcap and convert to csv | pcap2csv.py | pcap2csv.py | import os
import csv
cmd = "tshark -n -r {0} -T fields -Eheader=y -e ip.addr > tmp.csv"
os.system(cmd.format("wireshark_sample.pcap"))
result = []
with open("tmp.csv", "r") as infile:
for line in infile:
if line == "\n":
continue
else:
result.append(line.strip().split(","... | Python | 0.000001 | |
81f4976645225b6cf4a422186a3419a06756bfc5 | add a set of test utils that will be useful for running tests | test/test_util.py | test/test_util.py | import contextlib
import os
import os.path
import mock
import requests
@contextlib.contextmanager
def mocked_requests(path):
"""mocks the requests library to return a given file's content"""
# if environment variable is set, then don't mock the tests just grab files
# over the network. Example:
# ... | Python | 0.000009 | |
0827fce61013172fa7183ee294189275030c0faf | Create code_5.py | MPI_Practice_Examples/code_5.py | MPI_Practice_Examples/code_5.py | #dotProductParallel_1.py
#"to run" syntax example: mpiexec -n 4 python26 dotProductParallel_1.py 40000
from mpi4py import MPI
import numpy
import sys
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
#read from command line
n = int(sys.argv[1]) #length of vectors
#arbitrary example vectors, gen... | Python | 0.001674 | |
6454548da01dbc2b9f772a5c0ffb11a03dc933e7 | Add module capable of rendering a circle when ran | draw_shape.py | draw_shape.py | import pygame
pygame.init()
#-- SCREEN CHARACTERISTICS ------------------------->>>
background_color = (255,255,255)
(width, height) = (300, 200)
#-- RENDER SCREEN ---------------------------------->>>
screen = pygame.display.set_mode((width, height))
screen.fill(background_color)
#pygame.draw.circle(canvas, color... | Python | 0 | |
469b28aec45c9832e4cfe658143316fb15e103d1 | Add server | server.py | server.py | print("Hola mundo")
| Python | 0.000001 | |
6ac6f9f3f933a98af8722561ba181ca50c6ad1fe | Add performance test | perftest.py | perftest.py | import resource
from time import clock
from sortedsets import SortedSet
def test(size):
tm = clock()
ss = SortedSet((str(i), i*10) for i in range(size))
create_time = clock() - tm
print("SORTED SET WITH", size, "ELEMENTS", ss._level, "LEVELS")
print("Memory usage", resource.getrusage(resource.RUSA... | Python | 0.000043 | |
a107d3c088e13c4bf1a600f0ebf2664321d6799f | add solution for Binary Tree Maximum Path Sum | src/binaryTreeMaximumPathSum.py | src/binaryTreeMaximumPathSum.py | # Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param root, a tree node
# @return an integer
def maxPathSum(self, root):
self.res = root.val if root else 0
... | Python | 0.000001 | |
4fdef464be6eabee609ecc4327493c277693c0e0 | Make content text mandatory | content/migrations/0023_auto_20160614_1130.py | content/migrations/0023_auto_20160614_1130.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-14 09:30
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('content', '0022_auto_20160608_1407'),
]
operations = [
migrations.AlterField... | Python | 0.999999 | |
b106bb6f346811181c9fde27147f7b1685827cbe | 436. Find Right Interval. Brute force | p436_bruteforce.py | p436_bruteforce.py | import sys
import unittest
# Definition for an interval.
class Interval(object):
def __init__(self, s=0, e=0):
self.start = s
self.end = e
class Solution(object):
def findRightInterval(self, intervals):
"""
:type intervals: List[Interval]
:rtype: List[int]
"""... | Python | 0.999464 | |
5a857703de5fc1e67e958afb41a10db07b98bfa1 | Add migration script to fix valid users with date_confirmed==None | scripts/migrate_unconfirmed_valid_users.py | scripts/migrate_unconfirmed_valid_users.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Script to migrate users with a valid date_last_login but no date_confirmed."""
import sys
import logging
from website.app import init_app
from website.models import User
from scripts import utils as script_utils
from tests.base import OsfTestCase
from tests.factories i... | Python | 0.000184 | |
e12371408af1682904483341fd1f41ef6034a17f | add test | OperateSystem/Ex1/Test/SellTest.py | OperateSystem/Ex1/Test/SellTest.py | # -*- coding: utf-8 -*-
__author__ = 'jayin'
import requests
import threading
def buy_ticket():
res = requests.get('http://localhost:8000/buy1')
print threading.currentThread().getName() + u' buy ticket ' + res.content
def main():
for x in range(1, 40):
t = threading.Thread(target=buy_ticket, n... | Python | 0.000002 | |
edeffbcbe8fb239553c73fa37e73c0188ffc2479 | Add unit test for retrieving credentials from environment variables | tests/test_cli.py | tests/test_cli.py | import sys
import fixtures
import imgurpython
import testtools
import imgur_cli.cli as cli
FAKE_ENV = {'IMGUR_CLIENT_ID': 'client_id',
'IMGUR_CLIENT_SECRET': 'client_secret',
'IMGUR_ACCESS_TOKEN': 'access_token',
'IMGUR_REFRESH_TOKEN': 'refresh_token',
'IMGUR_MASHAPE_K... | Python | 0 | |
4c148281ee8071ea8f150362388a44cf5c0895bf | Add exception classes. | tgif/exception.py | tgif/exception.py | """ All exceptions go here.
"""
class Friday(Exception):
""" Base exception in Friday game.
"""
class GameOver(Friday):
""" Indicats that the game is overed.
"""
| Python | 0 | |
ff079da977990b7d6e71c6d92c5a9299fa92d123 | Add module listtools implementing class LazyList. | photo/listtools.py | photo/listtools.py | """Some useful list classes.
**Note**: This module might be useful independently of photo-tools.
It is included here because photo-tools uses it internally, but it is
not considered to be part of the API. Changes in this module are not
considered API changes of photo-tools. It may even be removed from
future version... | Python | 0 | |
a6935d250dfdbc275ce450f813697b73ebc291e3 | Create addDigits.py | Puzzles/leetcode/April-9th-2016/addDigits.py | Puzzles/leetcode/April-9th-2016/addDigits.py | /*
[ref.href] leetcode.com/problems/add-digits
"
Given a non-negative integer num, repeatedly add all its digits
until the result has only one digit.
For example:
Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2.
Since 2 has only one digit, return it.
Credits:
Special thanks to @jianc... | Python | 0 | |
85142dd9f7413dcb7c214ec251d21c93517ce26c | add AcoraMatcher tool | AcoraMatcher.py | AcoraMatcher.py | # coding:utf-8
import cPickle
import json
import acora
from atma import tool
import collections
from itertools import groupby
class AcoraMatcher:
def __init__(self, spec_set, min_count=1, min_len=1):
key_lst = []
if type(spec_set) == dict or type(spec_set) == collections.Counter:
for s... | Python | 0 | |
7a880376e098f60b1666833bb6b14b359b0ebda5 | add fitness_spider.py | Exercise/fitness_spider.py | Exercise/fitness_spider.py | from bs4 import BeautifulSoup
import requests
from selenium import webdriver
import time
import sqlite3
from selenium import webdriver
import json
driver = webdriver.PhantomJS()
class Fitness:
i = 0
url = "http://www.hiyd.com/dongzuo/"
headers = {
'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT ... | Python | 0.00231 | |
a8fd0bfa974ff818ec105a42c585bae48030a086 | Create notebooknetc.py | _src/om2py3w/3wex0/notebooknetc.py | _src/om2py3w/3wex0/notebooknetc.py | # _*_coding:utf-8_*_
# 客户端程序
from socket import *
import time
import notebooknets
def main():
BUF_SIZE = 65565
ss_addr = ('127.0.0.1', 8800)
cs = socket(AF_INET, SOCK_DGRAM)
while True:
global data
data = raw_input('Please Input data>')
cs.sendto(data, ss_addr)
data, a... | Python | 0.000002 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.