commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
59b00a4f5cc5aa5139492660206c99185df24f7b | create unittest for area serializer for #191 | Sinar/popit_ng,Sinar/popit_ng | popit/tests/test_area_api.py | popit/tests/test_area_api.py | from rest_framework.test import APITestCase
from rest_framework import status
from rest_framework.authtoken.models import Token
from popit.models import *
class AreaAPITestCase(APITestCase):
fixtures = [ "api_request_test_data.yaml" ]
def test_create_area_serializer(self):
pass
def test_fetch_ar... | agpl-3.0 | Python | |
a8274a5d5e4ec68f3ee594ffa741e90f11cf24db | Add tool to regenerate JSON files from P4 progs | p4lang/PI,p4lang/PI,p4lang/PI,p4lang/PI | tools/update_test_bmv2_jsons.py | tools/update_test_bmv2_jsons.py | #!/usr/bin/env python2
import argparse
import fnmatch
import os
import subprocess
import sys
def find_files(root):
files = []
for path_prefix, _, filenames in os.walk(root, followlinks=False):
for filename in fnmatch.filter(filenames, '*.p4'):
path = os.path.join(path_prefix, filename)
... | apache-2.0 | Python | |
f1d3717b45650244d9a4f44caf6f610636bb72ee | Add other_data_collections/2015ApJ...812...60B/biteau.py | gammapy/gamma-cat | other_data_collections/2015ApJ...812...60B/biteau.py | other_data_collections/2015ApJ...812...60B/biteau.py | """
Script to check and ingest Biteau & Williams (2015) data for gamma-cat.
"""
from astropy.table import Table
class Biteau:
def __init__(self):
filename = 'other_data_collections/2015ApJ...812...60B/BiteauWilliams2015_AllData_ASDC_v2016_12_20.ecsv'
self.table = Table.read(filename, format='ascii... | bsd-3-clause | Python | |
6f7fd163106ec5f4346eaaef04ed9726a3289801 | add wrong reversesubstring problem solution | 5outh/practice,5outh/practice | problems/reversesubstring.py | problems/reversesubstring.py | import sys
test = "aabbbbababaaabbab"
"""
Find a) the first occurrence of b in string
b) the longest list of only as in string, store final index
"""
def solution(string):
firstB = string.find('b')
print ((string, firstB))
if(firstB == -1):
return (0, 0)
longestA = 0
longestAIndex = ... | mit | Python | |
9ff1b6ffa297199dc73042382c369fc7af0813fc | Create stress_test1.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/moz4r/Test/stress_test1.py | home/moz4r/Test/stress_test1.py | # stress test
from time import sleep
import random
leftPort = "COM3"
i01 = Runtime.createAndStart("i01", "InMoov")
sleep(1)
i01.startMouth()
i01.startHead(leftPort)
i01.startLeftHand(leftPort)
i01.head.jaw.map(0,180,85,110)
i01.startMouthControl(leftPort)
i01.leftHand.thumb.setVelocity(random.randint(100,300))
M... | apache-2.0 | Python | |
a183922bd275414259800e75fd78db980604fa20 | create thread3 | wangwei7175878/tutorials | threading/thread3_join.py | threading/thread3_join.py | import threading
import time
def thread_job():
print('T1 start\n')
for i in range(10):
time.sleep(0.1)
print('T1 finish\n')
def T2_job():
print('T2 start\n')
print('T2 finish\n')
def main():
added_thread = threading.Thread(target=thread_job, name='T1')
thread2 = threading.Thread(ta... | mit | Python | |
143dbdb6d0d9840c4991eadbb2f5459398a6ddae | Add a 'cache' which only caches ETOPO1 files. | tilezen/joerd,mapzen/joerd | joerd/store/cache.py | joerd/store/cache.py | from joerd.mkdir_p import mkdir_p
from joerd.plugin import plugin
from os import link
import os.path
class CacheStore(object):
"""
Every tile that gets generated requires ETOPO1. Rather than re-download
it every time (it's 446MB), we cache that file only.
This is a bit of a hack, and would be better ... | mit | Python | |
679ae2966f44a071630934c7b7d9eeb550a59223 | Create balance_array.py | gnhuy91/python-utils | balance_array.py | balance_array.py | '''
`Balance Array`
Find i in array A where: A[1] + A[2]...A[i-1] = A[i+1] + A[i+2]...A[len(A)]
Write a `balanceSum` function which take an integer array as input,
it should return the smallest i, where i is an index in the array such that
the sum of elements to its left is equal to the sum of elements to its right.
... | mit | Python | |
19dd8b925b188bc09eb85952db1f9f11db4c570e | add batch pics | congminghaoxue/learn_python | batch_cut_pic.py | batch_cut_pic.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#function: 剪切更改图片尺寸大小
import os
import os.path
import sys, getopt, argparse
from PIL import Image
from change_pic_size_by_cut import CutImage
def main():
argc = len(sys.argv)
cmdargs = str(sys.argv)
parser = argparse.ArgumentParser(description="Tool for batch cut the ... | apache-2.0 | Python | |
a4c71bcefa255e3f2ec4fcbcd77e614669190250 | Set up change set delta lambda | PRX/Infrastructure,PRX/Infrastructure,PRX/Infrastructure,PRX/Infrastructure,PRX/Infrastructure | cd/lambdas/change-set-delta-notification/lambda_function.py | cd/lambdas/change-set-delta-notification/lambda_function.py | # Invoked by: CodePipeline
# Returns: Error or status message
#
# Published messages about deltas between a CloudFormation stack change set and
# the current version of the stack. The stack parameter values for both the
# stack and change set are queried, compared, and the differences are sent as a
# message to the Sla... | mit | Python | |
f36a0d1d53b4a15d8ead51a54260946f293a8718 | add mac free memory script | superhj1987/mac_useful_things,Suninus/mac_useful_things,Suninus/mac_useful_things,superhj1987/mac_useful_things | mac_free.py | mac_free.py | #!/usr/bin/python
'''
Created on Jun 1, 2014
@author: jay
'''
import subprocess
import re
# Get process info
ps = subprocess.Popen(['ps', '-caxm', '-orss,comm'], stdout=subprocess.PIPE).communicate()[0]
vm = subprocess.Popen(['vm_stat'], stdout=subprocess.PIPE).communicate()[0]
# Iterate processes
processLines ... | mit | Python | |
d9be75200af8c63a4457b6fb6ee107f4e8aa1048 | Create medium_BinaryConverter.py | GabrielGhe/CoderbyteChallenges,GabrielGhe/CoderbyteChallenges | medium_BinaryConverter.py | medium_BinaryConverter.py | """
Convert from binary string to
integer
"""
def BinaryConverter(str):
return int(str,2)
print BinaryConverter(raw_input())
| mit | Python | |
b9034ca499ae8c0366ac8cd5ee71641f39c0ffba | Add taxonomy model and initiation | Nesiehr/osf.io,binoculars/osf.io,pattisdr/osf.io,mattclark/osf.io,caseyrollins/osf.io,leb2dg/osf.io,baylee-d/osf.io,monikagrabowska/osf.io,monikagrabowska/osf.io,acshi/osf.io,icereval/osf.io,adlius/osf.io,leb2dg/osf.io,aaxelb/osf.io,chrisseto/osf.io,binoculars/osf.io,rdhyee/osf.io,alexschiller/osf.io,chennan47/osf.io,m... | website/project/taxonomies/__init__.py | website/project/taxonomies/__init__.py | import json
import os
from website import settings
from modularodm import fields, Q
from modularodm.exceptions import NoResultsFound
from framework.mongo import (
ObjectId,
StoredObject,
utils as mongo_utils
)
@mongo_utils.unique_on(['id', '_id'])
class Subject(StoredObject):
_id = fields.StringFie... | apache-2.0 | Python | |
e747714e16250f3c2e85d09520f36953b1c417c3 | Create HeapSort.py | salman-bhai/DS-Algo-Handbook,salman-bhai/DS-Algo-Handbook,salman-bhai/DS-Algo-Handbook,salman-bhai/DS-Algo-Handbook | Algorithms/Sort_Algorithms/Heap_Sort/HeapSort.py | Algorithms/Sort_Algorithms/Heap_Sort/HeapSort.py | # Python program for implementation of heap Sort
# To heapify subtree rooted at index i.
# n is size of heap
def heapify(arr, n, i):
largest = i # Initialize largest as root
l = 2 * i + 1 # left = 2*i + 1
r = 2 * i + 2 # right = 2*i + 2
# See if left child of root exists and is
# greate... | mit | Python | |
5c0730d7caef6503e3f97849d9df6825c289e9a0 | Fix check for valid emoji. | jrowan/zulip,PhilSk/zulip,JPJPJPOPOP/zulip,sonali0901/zulip,rht/zulip,rishig/zulip,cosmicAsymmetry/zulip,hackerkid/zulip,brockwhittaker/zulip,shubhamdhama/zulip,rishig/zulip,Galexrt/zulip,sonali0901/zulip,christi3k/zulip,rht/zulip,cosmicAsymmetry/zulip,sharmaeklavya2/zulip,JPJPJPOPOP/zulip,souravbadami/zulip,AZtheAsian... | zerver/views/reactions.py | zerver/views/reactions.py | from __future__ import absolute_import
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from typing import Text
from zerver.decorator import authenticated_json_post_view,\
has_request_variables, REQ, to_non_negative_int
from zerver.lib.actions import do_add_reac... | from __future__ import absolute_import
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from typing import Text
from zerver.decorator import authenticated_json_post_view,\
has_request_variables, REQ, to_non_negative_int
from zerver.lib.actions import do_add_reac... | apache-2.0 | Python |
122f24b24f16ab9ece5707919255371002929e8d | ADD RegisterTensorService | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | apps/domain/src/main/core/services/tensor_service.py | apps/domain/src/main/core/services/tensor_service.py | # stdlib
import secrets
from typing import List
from typing import Type
from typing import Union
# third party
from nacl.signing import VerifyKey
# syft relative
from syft.core.node.abstract.node import AbstractNode
from syft.core.node.common.service.auth import service_auth
from syft.core.node.common.service.node_se... | apache-2.0 | Python | |
17fcfd6d1962b23429d48a8a45dfb0944c2f1453 | Add constraints.py | PyconUK/ConferenceScheduler | conference_scheduler/constraints.py | conference_scheduler/constraints.py | from typing import Callable, List, Dict
class Constraint(NamedTuple):
function: Callable
args: List
kwargs: Dict
operator: Callable
value: int
| mit | Python | |
e9efb5e2ba19fcda77e35d0efdaa03b13d025df0 | create model of a feature | DevMine/devmine-core | devmine/app/models/feature.py | devmine/app/models/feature.py | from sqlalchemy import (
Column,
Integer,
String
)
from devmine.app.models import Base
class Feature(Base):
"""Model of a feature."""
__tablename__ = 'features'
id = Column(Integer, primary_key=True)
name = Column(String, nullable=False, unique=True)
def __init__(self):
pas... | bsd-3-clause | Python | |
7491f500c75850c094158b4621fdef602bce3d27 | Add benchmarks for custom generators | maxalbert/tohu | benchmarks/benchmarks/benchmark_custom_generators.py | benchmarks/benchmarks/benchmark_custom_generators.py | from tohu.v6.primitive_generators import Integer, HashDigest, FakerGenerator
from tohu.v6.derived_generators import Apply, Lookup, SelectOne, SelectMultiple
from tohu.v6.custom_generator import CustomGenerator
from .common import NUM_PARAMS
mapping = {
'A': ['a', 'aa', 'aaa', 'aaaa', 'aaaaa'],
'B': ['b', 'bb... | mit | Python | |
63d45b975d33227b65e79644622773a49dd7ccc6 | Add new package: libxcrypt (#18783) | LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/libxcrypt/package.py | var/spack/repos/builtin/packages/libxcrypt/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 Libxcrypt(AutotoolsPackage):
"""libxcrypt is a modern library for one-way hashing of passw... | lgpl-2.1 | Python | |
465b83e394c2bb90a85580946e291d0249fc754e | Fix model fields label | TamiaLab/carnetdumaker,TamiaLab/carnetdumaker,TamiaLab/carnetdumaker,TamiaLab/carnetdumaker | apps/accounts/migrations/0005_auto_20160101_1840.py | apps/accounts/migrations/0005_auto_20160101_1840.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0004_auto_20151227_1553'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
... | agpl-3.0 | Python | |
6c599caaf8a4daadfe287898901cad54fda37875 | add Post model | CyboLabs/XdaPy | XdaPy/model/post.py | XdaPy/model/post.py | # Copyright (C) 2014 cybojenix <anthonydking@slimroms.net>
#
# This file is part of XdaPy.
#
# XdaPy 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 l... | apache-2.0 | Python | |
698e46f7842e16124235365a180ddee7532d11ff | Create 2017-02-20-fundamentaltheoremofarithmetic.py | art-of-algorithm/art-of-algorithm.github.io,art-of-algorithm/art-of-algorithm.github.io | _posts/2017-02-20-fundamentaltheoremofarithmetic.py | _posts/2017-02-20-fundamentaltheoremofarithmetic.py | #Fundamental theorem of arithmetic states that:every positive integer greater
#than one can be expressed as unique product of primes.for ex,90=2*3*3*5
#Following is an application of above theorem
def primefactors(n):
i=0
factors=[]
#here primelist is list of all primes of a given no
p=primelist[i]
whil... | mit | Python | |
201ca88243bf8d0736c5f61b64abeacba82e7da7 | Add memory.py | niffler92/Bandit,niffler92/Bandit | bandit/memory.py | bandit/memory.py | import numpy as np
class Memory(object):
"""
This is a memory saver for contextual bandit
"""
def __init__(self):
pass
| apache-2.0 | Python | |
d720f0a50dce424ddbb319fd8cd518cc7adb3a1f | Add LBlock impementation | willir/cryptoResearch | lblockSimple.py | lblockSimple.py | #!/usr/bin/env python3
"""
POC implementation of LBlock Cipher (http://eprint.iacr.org/2011/345.pdf)
"""
s0 = [14, 9, 15, 0, 13, 4, 10, 11, 1, 2, 8, 3, 7, 6, 12, 5]
s1 = [4, 11, 14, 9, 15, 13, 0, 10, 7, 12, 5, 6, 2, 8, 1, 3]
s2 = [1, 14, 7, 12, 15, 13, 0, 6, 11, 5, 9, 3, 2, 4, 8, 10]
s3 = [7, 6, 8, 11, 0, 15, 3, 14, ... | mit | Python | |
f72af94f29a1797f9f23dbfe3431ec66ff36e6b4 | add example | ccxt/ccxt,ccxt/ccxt,ccxt/ccxt,ccxt/ccxt,ccxt/ccxt | examples/py/wazirx-create-cancel-orders.py | examples/py/wazirx-create-cancel-orders.py | # -*- coding: utf-8 -*-
import os
import sys
from pprint import pprint
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
import ccxt # noqa: E402
print('CCXT Version:', ccxt.__version__)
exchange = ccxt.wazirx({
'enableRateLimit': True,
... | mit | Python | |
48eb4604673513b771b6def05a1652ae1b66d4d0 | Add a script for storing a config variable | wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api | scripts/add_ssm_config.py | scripts/add_ssm_config.py | #!/usr/bin/env python
# -*- encoding: utf-8
"""
Store a config variable in SSM under the key structure
/{project_id}/config/{label}/{config_key}
This script can store a regular config key (unencrypted) or an encrypted key.
"""
import sys
import boto3
import click
ssm_client = boto3.client("ssm")
@click.com... | mit | Python | |
e85c07cfe614813180d9795e1fa4deda00e6b84e | add manual replication script my Max Dornseif | erikdejonge/rabshakeh-couchdb-python-progress-attachments,jur9526/couchdb-python,gcarranza/couchdb-python | couchdb/tools/manual_replication.py | couchdb/tools/manual_replication.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2009 Maximillian Dornseif <md@hudora.de>
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
"""
This script replicates databases from one CouchDB server to an other.
This is mainly f... | bsd-3-clause | Python | |
cf469dcba17d3a93bd4bb1651fff6a22de4bc5ba | add code to access database | trthanhquang/wayback-data-collector | louis-html-analyzer/database.py | louis-html-analyzer/database.py | import MySQLdb
class database:
def __init__(self, hostName="localhost", userName="root", password="", database="wbm"):
self.db = MySQLdb.connect(host = hostName, user = userName,
passwd = password, db = database)
self.db.autocommit(True)
self.cur = self.db.... | apache-2.0 | Python | |
4158b54244cda38b5643f07d9ad825877c7ff2d7 | Make subset module callable | fonttools/fonttools,googlefonts/fonttools | Lib/fontTools/subset/__main__.py | Lib/fontTools/subset/__main__.py | from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from fontTools.subset import main
main()
| mit | Python | |
bdfa3e67606e3bae243a64ad1e502edf552d2fdf | add problem 17 | branning/euler,branning/euler | euler017.py | euler017.py | #!/usr/bin/env python
# this barely works, but does output correct words up to 1000
def num2words(n):
onesteens = { 1 : "one",
2 : "two",
3 : "three",
4 : "four",
5 : "five",
6 : "six",
7 : "seven",
8 : ... | mit | Python | |
50dded21e316b6b8e6cb7800b17ed7bd92624946 | Add toy example of reading a large XML file | tiffanyj41/hermes,tiffanyj41/hermes,tiffanyj41/hermes,tiffanyj41/hermes | xml_to_json.py | xml_to_json.py | #!/usr/bin/env python
import xml.etree.cElementTree as ET
from sys import argv
input_file = argv[1]
NAMESPACE = "{http://www.mediawiki.org/xml/export-0.10/}"
with open(input_file) as open_file:
in_page = False
for _, elem in ET.iterparse(open_file):
# Pull out each revision
if elem.tag == NA... | apache-2.0 | Python | |
8176e8784247262d32e1adad5f86b181c1a202ca | Test echo sql | saguziel/incubator-airflow,preete-dixit-ck/incubator-airflow,sekikn/incubator-airflow,sekikn/incubator-airflow,akosel/incubator-airflow,artwr/airflow,spektom/incubator-airflow,saguziel/incubator-airflow,jhsenjaliya/incubator-airflow,storpipfugl/airflow,Tagar/incubator-airflow,danielvdende/incubator-airflow,airbnb/airfl... | airflow/settings.py | airflow/settings.py | import logging
import os
import sys
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy import create_engine
from airflow.configuration import conf
HEADER = """\
____________ _____________
____ |__( )_________ __/__ /________ __
____ /| |_ /__ ___/_ /_ __ /_ __ \_ | /| / ... | import logging
import os
import sys
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy import create_engine
from airflow.configuration import conf
HEADER = """\
____________ _____________
____ |__( )_________ __/__ /________ __
____ /| |_ /__ ___/_ /_ __ /_ __ \_ | /| / ... | apache-2.0 | Python |
17558f8f494627c287262ac2d5151d99fb9303e2 | Create getrekthagin.py | ChubbyPotato/Projects | getrekthagin.py | getrekthagin.py | mit | Python | ||
ab7324ba674038dde4581bcb5645c1dd828aa31f | Add seatgeek spider code. | quixey/scrapy-cluster,quixey/scrapy-cluster,quixey/scrapy-cluster | crawler/crawling/spiders/seatgeek_spider_example.py | crawler/crawling/spiders/seatgeek_spider_example.py | import scrapy
from scrapy.http import Request
from lxmlhtml import CustomLxmlLinkExtractor as LinkExtractor
from scrapy.conf import settings
from crawling.items import RawResponseItem
from redis_spider import RedisSpider
class SeatGeekSpider(RedisSpider):
'''
A spider that walks all links from the requested... | mit | Python | |
70815d8ac3ff8648b5db9ad6e38b1eb3be6fd0cb | Create examples.py | tobairsegais/DataAnalysis | examples.py | examples.py | import pandas as pd
| bsd-3-clause | Python | |
e0acea07d77d86313ee2436cdfc96a6258c1991c | Add admin for MembershipPersonRole | swcarpentry/amy,swcarpentry/amy,pbanaszkiewicz/amy,pbanaszkiewicz/amy,swcarpentry/amy,pbanaszkiewicz/amy | amy/fiscal/admin.py | amy/fiscal/admin.py | from django.contrib import admin
from fiscal.models import MembershipPersonRole
class MembershipPersonRoleAdmin(admin.ModelAdmin):
list_display = ("name", "verbose_name")
search_fields = ("name", "verbose_name")
admin.site.register(MembershipPersonRole, MembershipPersonRoleAdmin)
| mit | Python | |
71e66eaebab2dcb6f37ab6c1409bdd357b60db68 | Add create-DB script | kevana/ummbNet,kevana/ummbNet,kevana/ummbNet | createDb.py | createDb.py | from ummbNet import *
db.create_all()
| mit | Python | |
6b0f13d9d5a067c116a2f2b17381eadf322dd05b | Add more tests | kemskems/otdet | tests/test_evaluation/test_TopListEvaluator.py | tests/test_evaluation/test_TopListEvaluator.py | from nose.tools import assert_equal, assert_greater
from otdet.evaluation import TopListEvaluator
class TestAddResult:
def setUp(self):
self.sample_result = [(5.0, True), (4.0, False), (3.0, True),
(2.0, False), (1.0, False)]
self.M = len(self.sample_result)
... | mit | Python | |
60b01719e5780f9adb2cc25e3da60201822bb966 | Add SAT object code | VictorLoren/python-sat-solver | SATObject.py | SATObject.py | #
# SAT object that will have work done onto
class SATObject(object):
"""
"""
# SATObject has only a list of variables (for refrence) and a clause list
def __init__(self):
# Dictionary in case variable is greater than total number of variables
self.varDict = {}
# List of clause... | mit | Python | |
0a42c1144fbd7f89914aad2f05f7f1fba7aa3890 | Add cuds tests | simphony/simphony-common | simphony/cuds/tests/test_cuds.py | simphony/cuds/tests/test_cuds.py | """Tests for CUDS data structure."""
import unittest
import uuid
from simphony import CUDS
from simphony.cuds.particles import Particle, Particles
class CUDSTestCase(unittest.TestCase):
"""CUDS class tests."""
def setUp(self):
self.cuds = CUDS()
# TODO: use generated components
class... | bsd-2-clause | Python | |
63f9f87a3f04cb03c1e286cc5b6d49306f90e352 | Add solution for problem 4 | gidj/euler,gidj/euler | python/004_largest_palindrome_product/palindrome_product.py | python/004_largest_palindrome_product/palindrome_product.py | from itertools import combinations_with_replacement
from operator import mul
three_digit_numbers = tuple(range(100, 1000))
combinations = combinations_with_replacement(three_digit_numbers, 2)
products = [mul(*x) for x in combinations]
max_palindrome = max([x for x in products if str(x)[::-1] == str(x)])
| bsd-3-clause | Python | |
634d703f207d81f817c5bd834e6695d6a439e9a8 | fix ImportError with pytest.mark.tf2 (#6050) | yangw1234/BigDL,intel-analytics/BigDL,intel-analytics/BigDL,yangw1234/BigDL,intel-analytics/BigDL,yangw1234/BigDL,yangw1234/BigDL,intel-analytics/BigDL | python/chronos/test/bigdl/chronos/forecaster/tf/__init__.py | python/chronos/test/bigdl/chronos/forecaster/tf/__init__.py | #
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | apache-2.0 | Python | |
186442a5b50e760f0a3c814cb272c909606ad91a | Create find_factors_down_to_limit.py | Kunalpod/codewars,Kunalpod/codewars | find_factors_down_to_limit.py | find_factors_down_to_limit.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Find Factors Down to Limit
#Problem level: 8 kyu
def factors(integer, limit):
return [x for x in range(limit,(integer//2)+1) if not integer%x] + ([integer] if integer>=limit else [])
| mit | Python | |
aeeb0e6819439db84f3f7e16ac3f85fd36441315 | add unit test | jasonrbriggs/stomp.py,jasonrbriggs/stomp.py | stomp/test/utils_test.py | stomp/test/utils_test.py | import unittest
from stomp.utils import *
class TestUtils(unittest.TestCase):
def testReturnsTrueWhenLocalhost(self):
self.assertEquals(1, is_localhost(('localhost', 8000)))
self.assertEquals(1, is_localhost(('127.0.0.1', 8000)))
self.assertEquals(2, is_localhost(('192.168.1.92', 8000))) | apache-2.0 | Python | |
e9e06a0b85656eb8ce70aff1ac81737a7ffaece3 | Add migration for extended feedback; #909 | DMOJ/site,DMOJ/site,DMOJ/site,DMOJ/site | judge/migrations/0083_extended_feedback.py | judge/migrations/0083_extended_feedback.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-03-15 23:18
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0082_remove_profile_name'),
]
operations = [
migrations.AddField(... | agpl-3.0 | Python | |
d410fb26d3fb8bbd843234e90891bee5a5fff7e7 | Add local dev settings module | EmadMokhtar/halaqat,EmadMokhtar/halaqat,EmadMokhtar/halaqat | halaqat/settings/local_settings.py | halaqat/settings/local_settings.py | from .base_settings import *
DEBUG = True
LANGUAGE_CODE = 'en'
TIME_FORMAT = [
'%I:%M %p',
'%H:%M %p',
]
TIME_INPUT_FORMATS = [
'%I:%M %p',
'%H:%M %p'
]
| mit | Python | |
ce6c7a9e474c876829597861ce35b797b2509d42 | Add conftest.py for pytest | wcooley/python-gryaml | conftest.py | conftest.py | # This file must exist for pytest to add this directory to `sys.path`.
| mit | Python | |
cca26b50f02f098d3157501bd64e9f990fc061e2 | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | leetcode/easy/valid_anagram/py/solution.py | leetcode/easy/valid_anagram/py/solution.py | #
# Anagram definition:
# https://en.wikipedia.org/wiki/Anagram
#
# Classic solution to the anagram problem.
# Sort both strings and check if they are equal.
#
class Solution(object):
def isAnagram(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
return ... | mit | Python | |
477a57b108499184acb4d74f7aa14b7a8e10f6d8 | Create naturalreaderspeech-test.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/CheekyMonkey/naturalreaderspeech-test.py | home/CheekyMonkey/naturalreaderspeech-test.py | # cycle through NaturalReaderSpeech voices
# with i2c connected jaw servo
# Author: Acapulco Rolf
# Date: October 4th 2017
# Build: myrobotlab development build version 2555
from time import sleep
from org.myrobotlab.service import Speech
lang="EN" #for NaturalReaderSpeech
Voice="Ryan"
voiceType = Voice
speech = Run... | apache-2.0 | Python | |
2875ee60f30ca47a8dc957250125be505e5aee07 | Add build script | ruslo/leathers,ruslo/leathers | build.py | build.py | #!/usr/bin/env python3
# Copyright (c) 2014, Ruslan Baratov
# All rights reserved.
import argparse
import os
import re
import shutil
import subprocess
import sys
parser = argparse.ArgumentParser(description="Script for building")
parser.add_argument(
'--toolchain',
choices=[
'libcxx',
'xcode'... | bsd-2-clause | Python | |
53dcffd4677987e6186182484e58fccde1e93d60 | change file name | YzPaul3/h2o-3,michalkurka/h2o-3,h2oai/h2o-3,mathemage/h2o-3,spennihana/h2o-3,h2oai/h2o-3,jangorecki/h2o-3,h2oai/h2o-dev,YzPaul3/h2o-3,michalkurka/h2o-3,mathemage/h2o-3,mathemage/h2o-3,mathemage/h2o-3,h2oai/h2o-3,YzPaul3/h2o-3,h2oai/h2o-dev,jangorecki/h2o-3,YzPaul3/h2o-3,michalkurka/h2o-3,mathemage/h2o-3,mathemage/h2o-3... | h2o-py/test_hadoop/pyunit_hadoop.py | h2o-py/test_hadoop/pyunit_hadoop.py | import sys
sys.path.insert(1,"../")
import h2o
from tests import pyunit_utils
from h2o.estimators.glm import H2OGeneralizedLinearEstimator
import os
def test_hadoop():
'''
Test H2O read and write to hdfs
'''
hdfs_name_node = os.getenv("NAME_NODE")
h2o_data = h2o.import_file("hdfs://" + hdfs_name_n... | apache-2.0 | Python | |
8edf8bbd341c8b3e8395784667da5c577aba7ac6 | Add betting.py program | suriya/miscellaneous | ibm-ponder-this/2015-05/betting.py | ibm-ponder-this/2015-05/betting.py |
from __future__ import print_function
import itertools
import collections
import sys
class BettingGame(object):
def __init__(self, max_value=256, num_players=3):
self.max_value = max_value
self.num_players = num_players
self.STOP_STATE = tuple(0 for i in xrange(self.num_players))
def ... | mit | Python | |
61822398dbd2a3819a15b8c33f1cd69ff2953b5a | Move animation.fill from BiblioPixelAnimation | ManiacalLabs/BiblioPixel,rec/BiblioPixel,ManiacalLabs/BiblioPixel,rec/BiblioPixel,ManiacalLabs/BiblioPixel,rec/BiblioPixel,ManiacalLabs/BiblioPixel,rec/BiblioPixel | bibliopixel/animation/fill.py | bibliopixel/animation/fill.py | from . animation import BaseAnimation
from .. util import colors
class Fill(BaseAnimation):
"""
Fill the screen with a single color.
"""
def __init__(self, *args, color='black', **kwds):
super().__init__(*args, preclear=False, **kwds)
is_numpy = hasattr(self.color_list, 'dtype')
... | mit | Python | |
eb49c28b790bbf6ce6042f657beaf328a9e6b33f | Add inline sources | drcloud/arx | arx/sources/inline.py | arx/sources/inline.py | from collections import Container, Mapping, OrderedDict, Sequence
import math
from sh import chmod, Command, mkdir, tar
from ..err import Err
from ..decorators import signature
from . import onepath, Source, twopaths
class Inline(Source):
@onepath
def cache(self, cache):
"""Caching for inline source... | mit | Python | |
38651a6f690e39f5d5f64cdd389b031d653dcf95 | add migration for credit app status | thelabnyc/django-oscar-wfrs,thelabnyc/django-oscar-wfrs | src/wellsfargo/migrations/0028_auto_20190401_1213.py | src/wellsfargo/migrations/0028_auto_20190401_1213.py | # Generated by Django 2.2 on 2019-04-01 16:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wellsfargo', '0027_auto_20190208_1635'),
]
operations = [
migrations.AlterField(
model_name='cacreditapp',
name='statu... | isc | Python | |
0cfb4591a7754bcc08edddd17629006b5096d94d | Add handler for /sync API | illicitonion/synapse,howethomas/synapse,howethomas/synapse,matrix-org/synapse,matrix-org/synapse,iot-factory/synapse,iot-factory/synapse,rzr/synapse,howethomas/synapse,rzr/synapse,TribeMedia/synapse,rzr/synapse,matrix-org/synapse,TribeMedia/synapse,matrix-org/synapse,illicitonion/synapse,howethomas/synapse,illicitonion... | synapse/handlers/sync.py | synapse/handlers/sync.py | import collections
SyncConfig = collections.namedtuple("SyncConfig", [
"user",
"device",
"since",
"limit",
"gap",
"sort"
"backfill"
"filter",
)
RoomSyncResult = collections.namedtuple("RoomSyncResult", [
"room_id",
"limited",
"published",
"prev_batch",
"events",
... | apache-2.0 | Python | |
954b6d2152df52c330d59fe2b3b1cf65f5dd22cf | Create Str2Int_001.py | cc13ny/Allin,cc13ny/algo,cc13ny/Allin,Chasego/codi,Chasego/codirit,Chasego/cod,cc13ny/algo,cc13ny/algo,Chasego/codirit,Chasego/codi,cc13ny/Allin,Chasego/cod,cc13ny/algo,cc13ny/algo,Chasego/codi,Chasego/codi,Chasego/cod,Chasego/codirit,Chasego/codi,Chasego/codirit,Chasego/codirit,Chasego/cod,cc13ny/Allin,Chasego/cod,cc1... | leetcode/008-String-to-Integer/Str2Int_001.py | leetcode/008-String-to-Integer/Str2Int_001.py | #@author: cchen
#Terrible code, and it will be updated and simplified later.
class Solution:
# @param {string} str
# @return {integer}
def extractnum(self, ss):
num = 0
for i in range(len(ss)):
if ss[i].isdigit() == False:
break
else:
... | mit | Python | |
af6fb23f87651d5cdce3730d2cf2f2b10b571837 | test script for ngram matrix creation | juditacs/dsl,juditacs/dsl | dsl/features/create_ngram_matrix.py | dsl/features/create_ngram_matrix.py | from sys import argv
from featurize import Tokenizer, Featurizer
def main():
N = int(argv[1]) if len(argv) > 1 else 3
t = Tokenizer()
f = Featurizer(t, N=N)
docs = f.featurize_in_directory(argv[2])
m = f.to_dok_matrix(docs)
print m.shape
if __name__ == '__main__':
main()
| mit | Python | |
15ff98ef08fd45354f0df4b4566c240ad84d1c31 | add ProductCategory model test | byteweaver/django-eca-catalogue | eca_catalogue/tests/models_tests.py | eca_catalogue/tests/models_tests.py | from django.test import TestCase
from eca_catalogue.tests.models import ProductCategory
class ProductCategoryTestCase(TestCase):
def test_model(self):
obj = ProductCategory.add_root(name="cat1", slug="cat1")
self.assertTrue(obj.pk)
| bsd-3-clause | Python | |
ad74605039052c3dd7d343c84dd1ac24f068b34f | Bump version to 0.3.15 | tectronics/coil,tectronics/coil,kovacsbalu/coil,marineam/coil,marineam/coil,kovacsbalu/coil | coil/__init__.py | coil/__init__.py | # Copyright (c) 2005-2006 Itamar Shtull-Trauring.
# Copyright (c) 2008-2009 ITA Software, Inc.
# See LICENSE.txt for details.
"""Coil: A Configuration Library."""
__version_info__ = (0,3,15)
__version__ = ".".join([str(x) for x in __version_info__])
__all__ = ['struct', 'parser', 'tokenizer', 'errors']
from coil.par... | # Copyright (c) 2005-2006 Itamar Shtull-Trauring.
# Copyright (c) 2008-2009 ITA Software, Inc.
# See LICENSE.txt for details.
"""Coil: A Configuration Library."""
__version_info__ = (0,3,14)
__version__ = ".".join([str(x) for x in __version_info__])
__all__ = ['struct', 'parser', 'tokenizer', 'errors']
from coil.par... | mit | Python |
54a0ea2024cbfb4924642b5c23c321a0ae083e9e | Add epgen.py | kghoon/epgen | epgen/epgen.py | epgen/epgen.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
epgen runtime
~~~~~~~~~~~~~
:copyright: (c) 2016 by Jihoon Kang <kang@ghoon.net>
:license: Apache 2, see LICENSE for more details
'''
import os
import argparse
from cpgen import *
from confgen import *
from prgen import *
class EpgenRuntime:
TMPL_DIR = ... | apache-2.0 | Python | |
3498ddd7817e72b3f6f0b851fa94e82047cb9129 | Create the config file if doesn't exist | meetmangukiya/chubby,meetmangukiya/chubby | chubby/config.py | chubby/config.py | import os
def create_if_not_exists():
"""
Create the config file if doesn't exist already.
"""
# check if it exists
if not os.path.exists(os.path.join(os.path.expand("~"), '.chubby')):
os.chdir(os.path.expand("~"))
# create file
with open(".chubby", 'a'):
pass
| mit | Python | |
96476a32e545184908f64aac41b23987255138e2 | Create new package. (#6623) | tmerrick1/spack,iulian787/spack,EmreAtes/spack,tmerrick1/spack,mfherbst/spack,mfherbst/spack,mfherbst/spack,matthiasdiener/spack,matthiasdiener/spack,iulian787/spack,krafczyk/spack,tmerrick1/spack,krafczyk/spack,LLNL/spack,LLNL/spack,mfherbst/spack,krafczyk/spack,iulian787/spack,iulian787/spack,EmreAtes/spack,EmreAtes/... | var/spack/repos/builtin/packages/py-htseq/package.py | var/spack/repos/builtin/packages/py-htseq/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
5503e1f54298a5b6121e35794d43c6642b3af6e0 | Add lc0340_longest_substring_with_at_most_k_distinct_characters.py | bowen0701/algorithms_data_structures | lc0340_longest_substring_with_at_most_k_distinct_characters.py | lc0340_longest_substring_with_at_most_k_distinct_characters.py | """Leetcode 340. Longest Substring with At Most K Distinct Characters
Hard
URL: https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters/
Given a string, find the length of the longest substring T that contains at most k
distinct characters.
Example 1:
Input: s = "eceba", k = 2
Output: 3
Ex... | bsd-2-clause | Python | |
6da928b7e113e30af0da0aa5b18d48c9584a631d | add script | lukeolson/donut | ditto.py | ditto.py | #!/usr/local/bin/python3
"""
The purpose of this script is to update dot files somewhere. It works in the
following way. Two locations are set
dothome : ($HOME)
absolute path to the set the dotfiles
dotarchive : ($HOME/.dotarchive)
absolute path to the dot files (usually some git archive)
Then symlinks are... | mit | Python | |
0d0bf5b67f432fd4ee182b9026ea6e319babf9bd | Create ChamBus_create_database.py | cclauss/sql_o_matic | ChamBus_create_database.py | ChamBus_create_database.py | # coding: utf-8
# https://github.com/ChamGeeks/GetAroundChamonix/blob/master/www/js/services/TripPlanner.js
import datetime, os, requests, sqlite3
db_filename = 'ChamBus.db'
db_url = 'https://chx-transit-db.herokuapp.com/api/export/sql'
if os.path.exists(db_filename):
exit(db_filename + ' already exists. R... | apache-2.0 | Python | |
a7b31346835c8fdd1724432596650a6de137fe3f | test read_meta | shengqh/ngsperl,shengqh/ngsperl,shengqh/ngsperl,shengqh/ngsperl | test/Python/test_Func.py | test/Python/test_Func.py | import os, sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../bin')))
from file_def import read_meta
import unittest
class BasicTestSuite(unittest.TestCase):
def test_read_meta(self):
meta_file = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../data/SraRunTable.t... | apache-2.0 | Python | |
c8d48e9996f048b1844258ef427c4359645521c6 | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | leetcode/easy/length_of_last_word/py/solution.py | leetcode/easy/length_of_last_word/py/solution.py | class Solution(object):
def lengthOfLastWord(self, s):
"""
:type s: str
:rtype: int
"""
words = s.split()
if len(words) > 0:
return len(words[-1])
return 0
| mit | Python | |
a84f965e16e68cb8973d6cc91fbacec56bb92a64 | add lottery.py | lnmds/jose | ext/lottery.py | ext/lottery.py | import decimal
import logging
import discord
from discord.ext import commands
from .common import Cog
log = logging.getLogger(__name__)
PERCENTAGE_PER_TAXBANK = (0.2 / 100)
TICKET_PRICE = 20
class Lottery(Cog):
"""Weekly lottery.
The lottery works with you buying a 20JC lottery ticket.
Every Saturday... | mit | Python | |
210429b1acbb099479c06f5bd4ceddfabfa6ee5c | Create qualysguard_remediation_ignore_non-running_kernels.py | paragbaxi/qualysguard_remediation_ignore_by_report_template | qualysguard_remediation_ignore_non-running_kernels.py | qualysguard_remediation_ignore_non-running_kernels.py | #!/usr/bin/env python
| apache-2.0 | Python | |
c92954f240ef990eae06967c12426367f0eb6319 | Add migration | safwanrahman/readthedocs.org,tddv/readthedocs.org,safwanrahman/readthedocs.org,davidfischer/readthedocs.org,tddv/readthedocs.org,pombredanne/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,pombredanne/readthedocs.org,rtfd/readthedocs.org,davidfischer/readthedocs.org,safwanrahman/readthedo... | readthedocs/donate/migrations/0003_add-impressions.py | readthedocs/donate/migrations/0003_add-impressions.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('donate', '0002_dollar-drop-choices'),
]
operations = [
migrations.CreateModel(
name='SupporterImpressions',
... | mit | Python | |
dc7cf288c5c5c9733a59184770fbaa26db036833 | Add basic tests for custom_urls system | whalerock/ella,petrlosa/ella,WhiskeyMedia/ella,whalerock/ella,whalerock/ella,MichalMaM/ella,petrlosa/ella,MichalMaM/ella,ella/ella,WhiskeyMedia/ella | tests/unit_project/test_core/test_custom_urls.py | tests/unit_project/test_core/test_custom_urls.py | # -*- coding: utf-8 -*-
from djangosanetesting import UnitTestCase
from django.http import Http404
from ella.core.custom_urls import DetailDispatcher
# dummy functions to register as views
def view(request, bits, context):
return request, bits, context
def custom_view(request, context):
return request, cont... | bsd-3-clause | Python | |
861120c5ba7e6e126cac13497a489bc035d27026 | add partition show | you21979/mysql_batch | bin/partition_show.py | bin/partition_show.py | #!/usr/bin/python
import datetime
import MySQLdb
import json
import os
CONFIG_FILE="partition.json"
# -----------------------------------
def config_read(filename):
config = json.load(open(filename))
return config
# -----------------------------------
def date_show_all_partitions(conn, tablename):
lists... | apache-2.0 | Python | |
c50a7189e730fc3e95eb209eed00ebdcd7001bde | Create ImgurStorage.py | jmahmood/django-imgurstorage | ImgurStorage.py | ImgurStorage.py | import base64
import os
import tempfile
from django.core.exceptions import SuspiciousFileOperation
from django.core.files import File
from django.utils._os import safe_join
import requests
from django.core.files.storage import Storage
from imgurpython import ImgurClient
class ImgurStorage(Storage):
"""
Uses ... | mit | Python | |
c153bc9422308599d1354abf782273ca7bd78952 | Add a few unit tests for libvirt_conn. | n0ano/ganttclient | nova/tests/virt_unittest.py | nova/tests/virt_unittest.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2010 OpenStack 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... | apache-2.0 | Python | |
07500dbd92aa15540ddf77b96a7072c5f66d34b2 | Add files via upload | BenChehade/datasciences | heat_map.py | heat_map.py | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 21 17:27:18 2017
@author: DWyatt
"""
import pandas as pd
import seaborn as sns
import sys
df_train = pd.read_csv('train.csv')
target = 'SalePrice'
variables = [column for column in df_train.columns if column!=target]
corr = df_train.corr()
sns_heat= sns.h... | mit | Python | |
e755977ee0ada391149e55d3331bf2ffe045d243 | Add a build configuration test for zlib, for #187 | pycurl/pycurl,pycurl/pycurl,pycurl/pycurl | examples/tests/test_build_config.py | examples/tests/test_build_config.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vi:ts=4:et
import pycurl
import zlib
try:
from io import BytesIO
except ImportError:
try:
from cStringIO import StringIO as BytesIO
except ImportError:
from StringIO import StringIO as BytesIO
c = pycurl.Curl()
c.setopt(c.URL, 'http://pycurl... | lgpl-2.1 | Python | |
9f1c5612c717bac3690d093a27a0a362ff4793b4 | add parameters class for fitting data | licode/scikit-beam,scikit-xray/scikit-xray,Nikea/scikit-xray,licode/scikit-xray,CJ-Wright/scikit-beam,scikit-xray/scikit-xray,hainm/scikit-xray,ericdill/scikit-xray,danielballan/scikit-xray,licode/scikit-beam,licode/scikit-xray,tacaswell/scikit-xray,giltis/scikit-xray,tacaswell/scikit-xray,tacaswell/scikit-xray,giltis/... | nsls2/fitting/parameters.py | nsls2/fitting/parameters.py | # Copyright (c) Brookhaven National Lab 2O14
# All rights reserved
# BSD License
# See LICENSE for full text
# @author: Li Li (lili@bnl.gov)
# created on 07/20/2014
class ParameterBase(object):
"""
base class to save data structure
for each fitting parameter
"""
def __init__(self):
sel... | bsd-3-clause | Python | |
17de6f90ce081984cab528526fcf9d9e7008be14 | Create beta_scraping_get_users_honor.py | Orange9000/Codewars,Orange9000/Codewars | Solutions/beta/beta_scraping_get_users_honor.py | Solutions/beta/beta_scraping_get_users_honor.py | from bs4 import BeautifulSoup as BS
from urllib.request import urlopen
Url = 'https://www.codewars.com/users/leaderboard'
def get_honor(username):
html = urlopen(Url).read().decode('utf-8')
soup = BS(html, 'html.parser')
for i in soup.find_all('tr'):
try:
a = str(i).split('</t... | mit | Python | |
8c737c22ae5d896f5445995660d664d959ce1c08 | add ctc reader | qingqing01/models,PaddlePaddle/models,lcy-seso/models,Superjom/models-1,kuke/models,qingqing01/models,PaddlePaddle/models,Superjom/models-1,Superjom/models-1,PaddlePaddle/models,qingqing01/models,kuke/models,lcy-seso/models,kuke/models,lcy-seso/models,kuke/models | fluid/ocr_recognition/ctc_reader.py | fluid/ocr_recognition/ctc_reader.py | import os
import cv2
import numpy as np
from paddle.v2.image import load_image
class DataGenerator(object):
def __init__(self):
pass
def train_reader(self, img_root_dir, img_label_list):
'''
Reader interface for training.
:param img_root_dir: The root path of the image for trainin... | apache-2.0 | Python | |
90c7f90a8d409fd68ebe20ed4ac35fd378abfee5 | Create flush.py | jluzuria2001/codeSnippets,jluzuria2001/codeSnippets,jluzuria2001/codeSnippets,jluzuria2001/codeSnippets | flush.py | flush.py | f = open('out.log', 'w+')
f.write('output is ')
# some work
s = 'OK.'
f.write(s)
f.write('\n')
f.flush()
# some other work
f.write('done\n')
f.flush()
f.close()
| mit | Python | |
ea11ae8919139eae8eaa6b9b1dfe256726d3c584 | Copy SBSolarcell tests into individual file | jrsmith3/ibei,jrsmith3/tec,jrsmith3/tec | test/test_SBSolarcell.py | test/test_SBSolarcell.py | # -*- coding: utf-8 -*-
import numpy as np
import ibei
from astropy import units
import unittest
temp_sun = 5762.
temp_earth = 288.
bandgap = 1.15
input_params = {"temp_sun": temp_sun,
"temp_planet": temp_earth,
"bandgap": bandgap,
"voltage": 0.5,}
class CalculatorsRe... | mit | Python | |
a973b1daca340031c671070e0f102a6114f58fab | add files | MuzammilKhan/Ventriloquy,MuzammilKhan/Ventriloquy,MuzammilKhan/Ventriloquy,MuzammilKhan/Ventriloquy | mysite/wordclips/ventriloquy/test_ventriloquy.py | mysite/wordclips/ventriloquy/test_ventriloquy.py | from django.test import TestCase
from wordclips.ventriloquy.ventriloquy import Ventriloquy
from wordclips.models import Wordclip
class VentriloquyTestCase(TestCase):
def setUp(self):
self.ventriloquy = Ventriloquy()
# Put dummy object in databse for testing purpose
Wordclip.objects.create(... | mit | Python | |
8fd466ecd16db736177104902eb84f661b2b62cc | Create sitemap for google news | jeanmask/opps,opps/opps,YACOWS/opps,williamroot/opps,opps/opps,YACOWS/opps,williamroot/opps,williamroot/opps,opps/opps,YACOWS/opps,jeanmask/opps,YACOWS/opps,opps/opps,jeanmask/opps,williamroot/opps,jeanmask/opps | opps/sitemaps/googlenews.py | opps/sitemaps/googlenews.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib.sitemaps import GenericSitemap
from django.contrib.sites.models import Site
class GoogleNewsSitemap(GenericSitemap):
# That's Google News limit. Do not increase it!
limit = 1000
sitemap_template = 'sitemap_googlenews.xml'
def get_urls(... | mit | Python | |
2a106a12db2a59ccb0517a13db67b35f475b3ef5 | Add args to survey_data url | chispita/epiwork,chispita/epiwork,chispita/epiwork,chispita/epiwork,chispita/epiwork,chispita/epiwork,chispita/epiwork | apps/survey/urls.py | apps/survey/urls.py | from django.conf.urls.defaults import *
from . import views
urlpatterns = patterns('',
url(r'^profile/$', views.profile_index, name='survey_profile'),
url(r'^profile/electric/$', views.profile_electric, name='survey_profile_electric'),
url(r'^main/$', views.main_index),
url(r'^group_management/$', vie... | from django.conf.urls.defaults import *
from . import views
urlpatterns = patterns('',
url(r'^profile/$', views.profile_index, name='survey_profile'),
url(r'^profile/electric/$', views.profile_electric, name='survey_profile_electric'),
url(r'^main/$', views.main_index),
url(r'^group_management/$', vie... | agpl-3.0 | Python |
b85b8915b73433f74d8ee5c6f6ef9f88d8b82bd8 | add original py script | UC3Music/songbook-tools,UC3Music-e/genSongbook,UC3Music/genSongbook | genSongbook.py | genSongbook.py | #!/usr/bin/python
import os
f = open('songbook.tex', 'w')
s = """% songbook.tex
%\documentclass[11pt,a4paper]{article} % article format
\documentclass[11pt,a4paper,openany]{book} % book format
\usepackage[margin=0.7in]{geometry}
%\usepackage[utf8]{inputenc} % tildes
\usepackage{graphics}
\usepackage[dvips]{graph... | unlicense | Python | |
ac5b1181ff73b9d12c09731a646dac7fa23c342b | Add Weatherbit module | DesertBot/DesertBot | desertbot/modules/commands/weather/Weatherbit.py | desertbot/modules/commands/weather/Weatherbit.py | from collections import OrderedDict
from datetime import datetime
from twisted.plugin import IPlugin
from zope.interface import implementer
from desertbot.moduleinterface import IModule
from desertbot.modules.commands.weather.BaseWeatherCommand import BaseWeatherCommand, getFormattedWeatherData, \
getFormattedFor... | mit | Python | |
f3a6281098b11ddd353a394d914186d5c7683f9b | add jupyter module | RasaHQ/rasa_core,RasaHQ/rasa_nlu,RasaHQ/rasa_core,RasaHQ/rasa_nlu,RasaHQ/rasa_core,RasaHQ/rasa_nlu | rasa/jupyter.py | rasa/jupyter.py | import pprint as pretty_print
from typing import Any, Dict, Text, TYPE_CHECKING
from rasa_core.utils import print_success, print_error
if TYPE_CHECKING:
from rasa_core.agent import Agent
from rasa_core.interpreter import NaturalLanguageInterpreter
def pprint(object: Any):
pretty_print.pprint(object, inde... | apache-2.0 | Python | |
d8407723f9bf40ca166e5471e76c03c257bc71f9 | Add lc208_implement_trie_prefix_tree.py | bowen0701/algorithms_data_structures | lc208_implement_trie_prefix_tree.py | lc208_implement_trie_prefix_tree.py | """Leetcode 208. Implement Trie (Prefix Tree)
Medium
URL: https://leetcode.com/problems/implement-trie-prefix-tree/
Implement a trie with insert, search, and startsWith methods.
Example:
Trie trie = new Trie();
trie.insert("apple");
trie.search("apple"); // returns true
trie.search("app"); // returns false
tri... | bsd-2-clause | Python | |
8a7c3ad110c00e6049fa452634d06a6873a36f90 | Add an examples folder. | koenedaele/skosprovider | examples/api.py | examples/api.py | # -*- coding: utf-8 -*-
'''
This example demonstrates the skosprovider API with a simple
DictionaryProvider containing just three items.
'''
from skosprovider.providers import DictionaryProvider
from skosprovider.uri import UriPatternGenerator
from skosprovider.skos import ConceptScheme
larch = {
'id': '1',
'... | mit | Python | |
1b00a597d8145b2df05054fef8d072d452209463 | Make SurfaceHandler (for sfc data) | gciteam6/xgboost,gciteam6/xgboost | src/data/surface.py | src/data/surface.py | from glob import glob
# Third-party modules
import pandas as pd
# Hand-made modules
from base import LocationHandlerBase
SFC_REGEX_DIRNAME = "sfc[1-5]"
KWARGS_READ_CSV_SFC_MASTER = {
"index_col": 0,
}
KWARGS_READ_CSV_SFC_LOG = {
"index_col": 0,
"na_values": ['', ' ']
}
class SurfaceHandler(LocationHandle... | mit | Python | |
c025cd6649e2326ade7b81df8408c4363fdb2050 | add music handler | free-free/pyblog,free-free/pyblog,free-free/pyblog,free-free/pyblog | app/music_handler.py | app/music_handler.py | #-*- coding:utf-8 -*-
from tools.httptools import Route
from models import Music
@Route.get("/music")
def get_music_handler(app):
ret={};
ret['code']=200
ret['msg']='ok'
ret['type']=3
ret['data']=[
{'music_name':'CountrintStars','music_url':'http://7xs7oc.com1.z0.glb.clouddn.com/music%2FJason%20Chen%20-%20Count... | mit | Python | |
3091555ca7fc421f886a1df1ac28f677feb70a53 | Add default value for the fields object and field of the social network app model | rebearteta/social-ideation,rebearteta/social-ideation,rebearteta/social-ideation,joausaga/social-ideation,rebearteta/social-ideation,joausaga/social-ideation,joausaga/social-ideation,joausaga/social-ideation | app/migrations/0006_auto_20150825_1513.py | app/migrations/0006_auto_20150825_1513.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0005_auto_20150819_1054'),
]
operations = [
migrations.AlterField(
model_name='socialnetworkapp',
... | mit | Python | |
f05bd26c7a275c38c092c821e5ef62284c36e783 | Test transormation matrices | laputian/dml | test/test_interpolate.py | test/test_interpolate.py | import pywt
import sys
import numpy as np
from scipy.ndimage.interpolation import affine_transform
sys.path.insert(0, '../mlp_test')
from data_utils import load_mnist
from skimage import transform as tf
test_data = load_mnist()[2]
chosen_index = 7
test_x_chosen = test_data[0][chosen_index]
test_y_chosen = test_da... | mit | Python | |
47cbcf130e76604ed93306f02fc2221a276d3bbf | Split out | cropleyb/pentai,cropleyb/pentai,cropleyb/pentai | pentai/gui/spacer.py | pentai/gui/spacer.py | from kivy.uix.widget import Widget
class HSpacer(Widget):
pass
class VSpacer(Widget):
pass
| mit | Python | |
e37a616d23805ced7250d4cdd6422751d8ae5143 | Add populate_anticrispr.py | goyalsid/phageParser,mbonsma/phageParser,phageParser/phageParser,phageParser/phageParser,mbonsma/phageParser,mbonsma/phageParser,phageParser/phageParser,goyalsid/phageParser,goyalsid/phageParser,mbonsma/phageParser,phageParser/phageParser | phageAPI/populate_anticrispr.py | phageAPI/populate_anticrispr.py | #! /usr/bin/env python
import os
from Bio import SeqIO
import textwrap
def populate(sequences, AntiCRISPR):
for seq in sequences:
spacer, _ = AntiCRISPR.objects.get_or_create(
accession=seq.name,
sequence=str(seq.seq))
spacer.save()
def main():
import argparse
p... | mit | Python | |
333cbe13d8104934a924f223427fa06a60a8b080 | Create php4dvd_1.py | x0mak/test---project---python---Kurbatova | php4dvd/php4dvd_1.py | php4dvd/php4dvd_1.py | # -*- coding: utf-8 -*-
from selenium import webdriver
import unittest
class Untitled(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
self.driver.implicitly_wait(30)
self.base_url = "http://localhost:8080/"
self.verificationErrors = []
self.accept_next... | apache-2.0 | Python | |
d894e39e0280aaa45cef914f2202e978797b26fb | Update and rename 2 to 28.py | krzyszti/my_projects,krzyszti/my_projects,krzyszti/my_projects,krzyszti/my_projects | exercises/28.py | exercises/28.py | '''
Write a function find_longest_word()
that takes a list of words and returns
the length of the longest one.
Use only higher order functions.
'''
def find_longest_word(lst):
return len(max(lst, key=len))
| mit | Python | |
183b0c573478ff5e2480758abec629ddce4f0766 | Create missing migration for model Meta changes in 9d1e29150407e906bc651a8249c53e5e6d1fb1e7. | mozilla/telemetry-analysis-service,mozilla/telemetry-analysis-service,mozilla/telemetry-analysis-service,mozilla/telemetry-analysis-service | atmo/jobs/migrations/0035_auto_20170529_1424.py | atmo/jobs/migrations/0035_auto_20170529_1424.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-29 14:24
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('jobs', '0034_auto_20170529_1424'),
]
operations = [
migrations.AlterModelOptions(
... | mpl-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.