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 |
|---|---|---|---|---|---|---|---|
8d1ef1f33cc6f10a58cdeacc0fd840dea245e7a6 | Create typecheck.py with all the code | typecheck.py | typecheck.py | #!/usr/bin/env python3
from typing import (Union,
Tuple,
Any,
TypeVar,
Type,
List)
def check_type(obj, candidate_type, reltype='invariant') -> bool:
if reltype not in ['invariant', 'covariant', 'contravariant']:
... | Python | 0.000001 | |
1a9302d984e8fd0e467a04c87428b64d874e5f04 | refactor customerWallet | usermanage/views/customerWallet.py | usermanage/views/customerWallet.py | from django.shortcuts import render, redirect
from django.http import HttpResponseRedirect
from django.contrib.auth import login, authenticate, logout
from django.contrib.auth.models import User, Group
from django.contrib.auth.decorators import login_required, user_passes_test, permission_required
from django.contrib.a... | Python | 0.999998 | |
b9f28570ba619db5adacb05a7eadab77f140e876 | Create __init__.py | fake_data_crud_service/rest/__init__.py | fake_data_crud_service/rest/__init__.py | __package__ = 'rest'
__author__ = 'Barbaglia, Guido'
__email__ = 'guido.barbaglia@gmail.com;'
__license__ = 'MIT'
| Python | 0.000429 | |
192e60955051f8ffb34f6cc1f1e3f226acb1b5fb | add missing primary key constraints (#7129) | warehouse/migrations/versions/b5bb5d08543d_create_missing_primary_key_constraints.py | warehouse/migrations/versions/b5bb5d08543d_create_missing_primary_key_constraints.py | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | Python | 0 | |
a3d3040f16a604b534406d2f59a841d7ef6cebfa | Test HTTPMediaWikiAPI.get_content() | tests/test_api.py | tests/test_api.py | import requests
from unittest import TestCase
from mfnf.api import HTTPMediaWikiAPI
class TestHTTPMediaWikiAPI(TestCase):
def setUp(self):
self.api = HTTPMediaWikiAPI(requests.Session())
def test_get_content(self):
content = self.api.get_content("Mathe für Nicht-Freaks: Epsilon-Delta-Kriteri... | Python | 0.000001 | |
8139dc9e04025da001323122521951f5ed2c391b | Fix mysql encoding for users.profile.reason | users/migrations/0010_users-profile-encoding.py | users/migrations/0010_users-profile-encoding.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-09-25 01:43
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0009_remove_profile_active'),
]
operations = [
migrations.RunSQL("ALTER DAT... | Python | 0.001314 | |
328901c74d1ee103a1ee5b2f26aa391ddeda465b | Add unit test for webpage creation and description | tests/test_web.py | tests/test_web.py | """Test the AutoCMS web reporting functionality."""
import os
import shutil
import unittest
import re
from autocms.core import load_configuration
from autocms.web import (
produce_default_webpage
)
class TestWebPageCreation(unittest.TestCase):
"""Test the accurate creation of test webpages."""
def setU... | Python | 0 | |
e6b086f3baef34cf1e5278e930a034a92f4eee76 | Add test for DirectionalGridCRF | tests/test_directional_crf.py | tests/test_directional_crf.py | import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
#from nose.tools import assert_almost_equal
import pystruct.toy_datasets as toy
from pystruct.lp_new import lp_general_graph
from pystruct.inference_methods import _make_grid_edges
from pystruct.crf import DirectionalGridCRF
... | Python | 0 | |
439e4b740f6903341e81e158e6591c9cbd242a4c | Check in a tool that dumps graphviz output. | tools/graphviz.py | tools/graphviz.py | #!/usr/bin/python
# Copyright (c) 2011 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Using the JSON dumped by the dump-dependency-json generator,
generate input suitable for graphviz to render a dependency graph of
targets."""... | Python | 0 | |
80d9a407d76f11573af5ccb6783f837b939b5466 | Add Python benchmark | lib/node_modules/@stdlib/math/base/special/erfinv/benchmark/python/benchmark.scipy.py | lib/node_modules/@stdlib/math/base/special/erfinv/benchmark/python/benchmark.scipy.py | #!/usr/bin/env python
"""Benchmark scipy.special.erfinv."""
import timeit
name = "erfinv"
repeats = 3
iterations = 1000000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark summary.
# Arguments
* `total`: tota... | Python | 0.000138 | |
3133bbfcb5ee56c88ea20be21778519bffe77299 | Add another different type of book | literotica.py | literotica.py | from common import *
from sys import argv
from urlgrab import Cache
from re import compile, DOTALL, MULTILINE
cache = Cache()
url = argv[1]
titlePattern = compile("<h1>([^<]+)</h1>")
contentPattern = compile("<div class=\"b-story-body-x x-r15\">(.+?)</div><div class=\"b-story-stats-block\">" , DOTALL|MULTILINE)
nextP... | Python | 0.999663 | |
f31d6730a0cfbc50c55e9260391f399e77c3d631 | access the repository from console | utils/__init__.py | utils/__init__.py | __version__="0.1"
| Python | 0.000001 | |
893679baff0367538bdf3b52b04f8bae72732be8 | Add migration to remove system avatar source. | zerver/migrations/0031_remove_system_avatar_source.py | zerver/migrations/0031_remove_system_avatar_source.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('zerver', '0030_realm_org_type'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
n... | Python | 0 | |
ff89cda5f77bec569c7451c9ee72ef7c028f7552 | Add sample extraction script | extract_samples.py | extract_samples.py | import sys, os
import numpy as np
import pandas as pd
import datetime
if __name__ == '__main__':
infile = sys.argv[1]
csv_content = pd.read_csv(infile, [0])
| Python | 0 | |
73f47cc6a8a98b2026ee27985f8c3042352c941b | Add lc066_plus_one.py | lc066_plus_one.py | lc066_plus_one.py | """Leetcode 66. Plus One
Easy
URL: https://leetcode.com/problems/plus-one/
Given a non-empty array of digits representing a non-negative integer,
plus one to the integer.
The digits are stored such that the most significant digit is at the
head of the list, and each element in the array contain a single digit.
Yo... | Python | 0.000849 | |
a620cc46d97f80ef658c46130f0448c36844d847 | Add alembic revision | alembic/versions/63b625cf7b06_add_white_rabbit_status.py | alembic/versions/63b625cf7b06_add_white_rabbit_status.py | """add white rabbit status
Revision ID: 63b625cf7b06
Revises: e83aa47e530b
Create Date: 2019-12-06 02:45:01.418693+00:00
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '63b625cf7b06'
down_revision = 'e83aa47e530b'
branch_labels = None
depends_on = None
def u... | Python | 0.000001 | |
b51398d602a157ce55fd7e08eedd953051f716a1 | Add script to update uploaded files. | backend/scripts/updatedf.py | backend/scripts/updatedf.py | #!/usr/bin/env python
#import hashlib
import os
def main():
for root, dirs, files in os.walk("/mcfs/data/materialscommons"):
for f in files:
print f
if __name__ == "__main__":
main()
| Python | 0 | |
ba3582d1e4521c040ef9f43c3a4760eb4fd694da | add lib/config_loader.py | hokusai/lib/config_loader.py | hokusai/lib/config_loader.py | import os
import tempfile
import shutil
from urlparse import urlparse
import boto3
import yaml
from hokusai.lib.common import get_region_name
from hokusai.lib.exceptions import HokusaiError
class ConfigLoader
def __init__(self, uri):
self.uri = uri
def load(self):
uri = urlparse(self.uri)
if not ur... | Python | 0.000002 | |
21e766688e3cc4d08339f81c35dba43d26010a6d | edit vehicle form | vehicles/forms.py | vehicles/forms.py | from django import forms
class EditVehicleForm(forms.Form):
fleet_number = forms.CharField(label='Fleet number', required=False)
reg = forms.CharField(label='Registration', required=False)
vehicle_type = forms.CharField(label='Type', required=False)
colours = forms.CharField(label='Colours', required=... | Python | 0 | |
fbf36a2fb52b5ed1aceaec4c1d1075448584a97d | Test that modules can be imported in any order | tests/test_imports.py | tests/test_imports.py | """Test that all modules/packages in the lektor tree are importable in any order
Here we import each module by itself, one at a time, each in a new
python interpreter.
"""
import pkgutil
import sys
from subprocess import run
import pytest
import lektor
def iter_lektor_modules():
for module in pkgutil.walk_pac... | Python | 0 | |
e3bdccc8c7ef23b449a53043f4a048fe71cd642c | Use an explicit list due to the filter-object type of python3 | accounting/apps/connect/views.py | accounting/apps/connect/views.py | from django.views import generic
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from accounting.apps.books.models import Organization
from .steps import (
CreateOrganizationStep,
ConfigureTaxRatesStep,
ConfigureBusinessSettingsStep,
ConfigureFinancialSettingsS... | from django.views import generic
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from accounting.apps.books.models import Organization
from .steps import (
CreateOrganizationStep,
ConfigureTaxRatesStep,
ConfigureBusinessSettingsStep,
ConfigureFinancialSettingsS... | Python | 0.000005 |
b7fff47b228fbe8774c9f465c383ae1015c598fe | use cvmfs.py for openRootCatalog.py | add-ons/tools/openRootCatalog.py | add-ons/tools/openRootCatalog.py | #!/usr/bin/python
import cvmfs
import sys
def usage():
print sys.argv[0] + " <repository path | repository url>"
print "This script decompresses the root catalog file to a temporary storage"
print "and opens this directly with sqlite3."
print "WARNING: changes to this database will not persist, as it is only a t... | #!/usr/bin/python
import sys
import zlib
import tempfile
import subprocess
def getRootCatalogName(cvmfspublished):
try:
cvmfspubdata = open(cvmfspublished, 'rb').read()
except:
print "cannot open .cvmfspublished"
sys.exit(1)
lines = cvmfspubdata.split('\n')
if len(lines) < 1:
print ".cvmfspublished is m... | Python | 0 |
a8ca46a8d964907038f6c096a316175543bc2518 | add mask_iou test | tests/utils_tests/mask_tests/test_mask_iou.py | tests/utils_tests/mask_tests/test_mask_iou.py | from __future__ import division
import unittest
import numpy as np
from chainer import cuda
from chainer import testing
from chainer.testing import attr
from chainercv.utils import mask_iou
@testing.parameterize(
{'mask_a': np.array(
[[[False, False], [True, True]],
[[True, True], [False, Fal... | Python | 0.000069 | |
a377195fa95b819924ddfbd3fb564cffbe08f9ae | Add an example for solvent model to customize solvent cavity | examples/solvent/30-custom_solvent_cavity.py | examples/solvent/30-custom_solvent_cavity.py | #!/usr/bin/env python
'''
Custom solvent cavity
'''
import numpy
from pyscf import gto, qmmm, solvent
#
# Case 1. Cavity for dummy atoms with basis on the dummy atoms
#
mol = gto.M(atom='''
C 0.000000 0.000000 -0.542500
O 0.000000 0.000000 0.677500
H 0.000000 0.... | Python | 0 | |
97ecb8f7dbcb36cfa9e2d180f29d29002eea127e | add elasticsearch import | examples/ElasticsearchIntegrationWithSpark/import_from_elasticsearch.py | examples/ElasticsearchIntegrationWithSpark/import_from_elasticsearch.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | Python | 0 | |
d5585ff269868ed5407bc573a851860fdb35a5ec | Create vnrpc.py | vnpy/rpc/vnrpc.py | vnpy/rpc/vnrpc.py | import threading
import traceback
import signal
import zmq
from msgpack import packb, unpackb
from json import dumps, loads
import cPickle
p_dumps = cPickle.dumps
p_loads = cPickle.loads
# Achieve Ctrl-c interrupt recv
signal.signal(signal.SIGINT, signal.SIG_DFL)
class RpcObject(object):
"""
Referred to s... | Python | 0.000001 | |
8b419fefc93f9084b8d504b7382fd51087e4645f | add migration script that removes table 'regressions' | benchbuild/db/versions/001_Remove_RegressionTest_table.py | benchbuild/db/versions/001_Remove_RegressionTest_table.py | """
Remove unneeded Regressions table.
This table can and should be reintroduced by an experiment that requires it.
"""
from sqlalchemy import Table, Column, ForeignKey, Integer, String
from benchbuild.utils.schema import metadata
META = metadata()
REGRESSION = Table('regressions', META,
Column(
... | Python | 0.000138 | |
847232f2890a4700e4983cd971ef2cd1a76a4b1d | rebuild cases | corehq/apps/cleanup/management/commands/rebuild_cases.py | corehq/apps/cleanup/management/commands/rebuild_cases.py | from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
from django.core.management.base import BaseCommand
from corehq.form_processor.backends.sql.processor import FormProcessorSQL
from corehq.form_processor.models import RebuildWithReason
... | Python | 0.000002 | |
0919661333c8099a85e7c12c6ce9393ced8c985b | create the lib directory to hold vendored libraries | ceph_deploy/lib/__init__.py | ceph_deploy/lib/__init__.py | """
This module is meant for vendorizing Python libraries. Most libraries will need
to have some ``sys.path`` alterations done unless they are doing relative
imports.
Do **not** add anything to this module that does not represent a vendorized
library.
"""
import remoto
| Python | 0 | |
6303ffeee0118a2fef1cb0a9abfe931a04ee6974 | Fix web app. #79 | channelworm/web_app/wsgi.py | channelworm/web_app/wsgi.py | """
WSGI config for myproject project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "web_app.settings")
from django.core.w... | Python | 0.000048 | |
e5ed4497fd8aee709dd441cfcddc9a1a91c538d4 | add theilsen | chart-02-theilsen-median-of-root-median-squared-errors.py | chart-02-theilsen-median-of-root-median-squared-errors.py | # create files for chart-02-theilsen-median-of-root-mdian-squared-errors
# with these choices
# metric in median-root-median-squared-errors
# model in theilsen
# ndays in 30 60 ... 360
# predictors in act actlog ct ctlog
# responses in price logprice
# usetax in yes no
# year in 2008
# i... | Python | 0.999936 | |
2df737f2690925e2752ae7633f1db05f952209bc | Create led_record.py | led_record.py | led_record.py | #!/usr/bin/env python
import RPi.GPIO as GPIO
from time import sleep
import os
import subprocess
# Setup getting an image
def get_video(state):
folderName = "/home/pi/HumphreyData/"
if os.path.isdir(folderName)== False:
os.makedirs(folderName)
fileNumber = 1
filePath = folderName + str(fileNumber) + ".h2... | Python | 0.000001 | |
f68689e3b6caaad2d143d92af5395f7c12316525 | add simple test file | test.py | test.py | from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from pybasicbayes.distributions import Gaussian, Regression
from autoregressive.distributions import AutoRegression
from pyhsmm.util.text import progprint_xrange
from models import LDS
np.random.seed(0)
#########################
# s... | Python | 0 | |
2e4bb9ca00c992dab0967b3238d8aebd8710d79d | Create controller.py | src/controller.py | src/controller.py | #!/usr/bin/env python
import rospy
if __name__ == '__main__':
pass
| Python | 0.000001 | |
c3748579854ae06c995cb12ea45a1be4de8f827d | Add gallery migration | features/galleries/migrations/0003_auto_20170421_1109.py | features/galleries/migrations/0003_auto_20170421_1109.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-21 09:09
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('galleries', '0002_auto_20170421_0934'),
]
operations... | Python | 0 | |
a6381765ad8e15624a5dabb848283e92b0e90d8c | Create rpkm_bin.py | code_collection/rpkm_bin.py | code_collection/rpkm_bin.py | import sys
peak=[]
with open(sys.argv[1],'r') as f:
for line in f:
line=line.strip('\n').split('\t')
peak.append(line)
bed=[]
with open(sys.argv[2],'r') as f:
for line in f:
line=line.strip('\n').split('\t')
bed.append(line)
SIZE=int(sys.argv[3])
index=0
n=len(peak)
num=[0]*n
for read in bed:
mid=(int(re... | Python | 0.000003 | |
85202173cf120caad603315cd57fa66857a88b0b | Add missing migrations for institutions | feder/institutions/migrations/0013_auto_20170810_2118.py | feder/institutions/migrations/0013_auto_20170810_2118.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-08-10 21:18
from __future__ import unicode_literals
from django.db import migrations
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('institutions', '0012_auto_20170808_0309'),
]
operations = [
... | Python | 0.000006 | |
4bb5653f5f7f95bf28b2ee596c441cbc4c7fbf3a | Create whitefilterstr.py | whitefilterstr.py | whitefilterstr.py | def whiteListCharFilter(inStr, whiteListStr):
""" Sanatize a string with a list of allowed (white) characters
Input: inStr {string} String to be sanatized.
Input: whiteListStr {string} String with allowed characters.
Output: outStr {string} Sanatized string
"""
outStr = ""
if (isinstance(in... | Python | 0.000016 | |
4bfb560dc9f28d850a89c98590df032849cfc035 | Create zoql.py | zoql.py | zoql.py | #!/usr/local/bin/python3
import sys
import cmd
import csv
import pdb
import config
from zuora import Zuora
zuora = Zuora(config.zuoraConfig)
def zuoraObjectKeys(zouraObject):
if zouraObject:
return zouraObject.keys()
def dumpRecords(records):
if records:
firstRecord = records[0]
... | Python | 0.000164 | |
eb250318cf6933b4a037bd9ea238ce0fc7be58c2 | add first script | gitthemall.py | gitthemall.py | #! /usr/bin/env python2
import argparse
import os.path
import logging
import sys
logging.basicConfig(format='%(levelname)s: %(message)s')
def fail(msg):
'Fail program with printed message'
logging.error(msg)
sys.exit(1)
def update(repo, actions):
'Update repo according to allowed actions.'
repo =... | Python | 0.000018 | |
f9ea992353f2caa835ca2007eb07b470d1b782a3 | Fix migration colorfield | geotrek/trekking/migrations/0006_practice_mobile_color.py | geotrek/trekking/migrations/0006_practice_mobile_color.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2019-03-04 12:43
from __future__ import unicode_literals
import colorfield.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('trekking', '0005_auto_20181219_1524'),
]
operations = [
m... | Python | 0.000002 | |
3959ad4a4ddc4655c1acd8362de4284ba1e8d3e7 | Apply the hack that renames local_settings.py only when running setup.py | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
from setuptest import test
import os, sys
if sys.argv[1] == 'install':
'''
Rename local_settings.py in order to
be excluded from setup.py install command
'''
ORIG_NAME = 'cronos/local_settings.py'
TEMP_NAME = 'cronos/local_setti... | #!/usr/bin/env python
from setuptools import setup, find_packages
from setuptest import test
import os
'''
Rename local_settings.py in order to
be excluded from setup.py install command
'''
ORIG_NAME = 'cronos/local_settings.py'
TEMP_NAME = 'cronos/local_settings.py1'
try:
os.rename(ORIG_NAME, TEMP_NAME)
except:
... | Python | 0.000001 |
1c181eb7f9987d2147df48a762d34895593f031a | Add version for torch dependency | setup.py | setup.py | #!/usr/bin/env python
import io
import os
import shutil
import subprocess
from pathlib import Path
import distutils.command.clean
from setuptools import setup, find_packages
from build_tools import setup_helpers
ROOT_DIR = Path(__file__).parent.resolve()
def read(*names, **kwargs):
with io.open(ROOT_DIR.joinpat... | #!/usr/bin/env python
import io
import os
import shutil
import subprocess
from pathlib import Path
import distutils.command.clean
from setuptools import setup, find_packages
from build_tools import setup_helpers
ROOT_DIR = Path(__file__).parent.resolve()
def read(*names, **kwargs):
with io.open(ROOT_DIR.joinpat... | Python | 0 |
b187e844d667b14dcc7874b351ee3f82383be348 | Fix dependency reference error | setup.py | setup.py | import ast
import re
from setuptools import setup, find_packages
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('puckdb/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
setup(
name='puckdb',
author='Aaron Toth',
v... | import ast
import re
from setuptools import setup, find_packages
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('puckdb/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
setup(
name='puckdb',
author='Aaron Toth',
v... | Python | 0.000007 |
40c6a07808be26de0534a5b6f47ef28f591a500c | bump again | setup.py | setup.py | from setuptools import setup, find_packages
requires = []
dep_links = []
for dep in open('requirements.txt').read().split("\n"):
if dep.startswith('git+'):
dep_links.append(dep)
else:
requires.append(dep)
setup(
name='django-suave',
version="0.5.7",
description='Rather nice pages.... | from setuptools import setup, find_packages
requires = []
dep_links = []
for dep in open('requirements.txt').read().split("\n"):
if dep.startswith('git+'):
dep_links.append(dep)
else:
requires.append(dep)
setup(
name='django-suave',
version="0.5.6",
description='Rather nice pages.... | Python | 0 |
71fb2fc819c82e2db4075c6e5e32b2addc99c63a | Add platforms and classifiers | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
setup(name='gsmsapi',
version='0.10',
description='SMS API for (german) SMS providers',
author='Torge Szczepanek',
author_email='debian@cygnusnetworks.de',
maintainer='Torge Szczepanek',
maintainer_email='debian@cygnusnetworks.de',
lice... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
setup(name='gsmsapi',
version='0.10',
description='SMS API for (german) SMS providers',
author='Torge Szczepanek',
author_email='debian@cygnusnetworks.de',
maintainer='Torge Szczepanek',
maintainer_email='debian@cygnusnetworks.de',
lice... | Python | 0.000001 |
8b8383680e73496a73a3a520c3ebc85e2e01ce01 | fix version in setup.py | setup.py | setup.py | #!/usr/bin/env python
"""
Flask-REST4
-------------
Elegant RESTful API for your Flask apps.
"""
from setuptools import setup
setup(
name='flask_rest4',
version='0.1.3',
url='https://github.com/squirrelmajik/flask_rest4',
license='See License',
author='majik',
author_email='me@yamajik.com',
... | #!/usr/bin/env python
"""
Flask-REST4
-------------
Elegant RESTful API for your Flask apps.
"""
from setuptools import setup
setup(
name='flask_rest4',
version='0.1.0',
url='https://github.com/squirrelmajik/flask_rest4',
license='See License',
author='majik',
author_email='me@yamajik.com',
... | Python | 0 |
b03b6faea0470d867749c7b3bc3d6edc9c2406b9 | Remove pytest-Django | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
# Utility function to read file in the setup.py directory
def open_here(fname):
return open(os.path.join(os.path.dirname(__file__), fname))
def get_dependenci... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
# Utility function to read file in the setup.py directory
def open_here(fname):
return open(os.path.join(os.path.dirname(__file__), fname))
def get_dependenci... | Python | 0.000006 |
656d24c38c69891d8731ccf32852b66e32120eb7 | Bump dependency | setup.py | setup.py | #!/usr/bin/env python
from setuptools import find_packages, setup
project = "microcosm_pubsub"
version = "0.26.1"
setup(
name=project,
version=version,
description="PubSub with SNS/SQS",
author="Globality Engineering",
author_email="engineering@globality.com",
url="https://github.com/globality... | #!/usr/bin/env python
from setuptools import find_packages, setup
project = "microcosm_pubsub"
version = "0.26.1"
setup(
name=project,
version=version,
description="PubSub with SNS/SQS",
author="Globality Engineering",
author_email="engineering@globality.com",
url="https://github.com/globality... | Python | 0.000001 |
5e9fa7a1bb8601fb5629d7e7e92a894ab335ccf1 | update readme extension | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.md') as readme_file:
readme = readme_file.read()
requirements = [
"wheel>=0.23.0",
"requests>=2.7.0",
"pandas>=0.16.2",
"docopt>=0.6.2"
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read().replace('.. :changelog:', ... | Python | 0 |
187dbc9feab320c720c2632c4140a62e2c384328 | bump version | setup.py | setup.py | #!/usr/bin/env python
# Copyright 2016 IBM 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 appl... | #!/usr/bin/env python
# Copyright 2016 IBM 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 appl... | Python | 0 |
c95234c130435ddd116784ad1829f7bdaa9182c5 | ADD 138 solutions with A195615(OEIS) | 100_to_199/euler_138.py | 100_to_199/euler_138.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Problem 138
Consider the isosceles triangle with base length, b = 16, and legs, L = 17.
By using the Pythagorean theorem it can be seen that the height of the triangle, h = √(172 − 82) = 15, which is one less than the base length.
With b = 272 and L = 305, we get h ... | Python | 0 | |
2a74598f445c25f5227b19326e7bee160f285574 | Add the task class | cumulusci/tasks/setup.py | cumulusci/tasks/setup.py | import json
import re
import shutil
import os
import tempfile
from cumulusci.core.config import ServiceConfig
from cumulusci.core.exceptions import TaskOptionsError, ServiceNotConfigured
from cumulusci.core.utils import process_bool_arg
from cumulusci.tasks.sfdx import SFDXBaseTask, SFDX_CLI
from cumulusci.utils import... | Python | 0.999999 | |
e7b54968a67bda76546deff546baa49f836cfbaa | Add train_fcn32s | examples/voc/train_fcn32s.py | examples/voc/train_fcn32s.py | #!/usr/bin/env python
import chainer
from chainer.training import extensions
import fcn
def main():
gpu = 0
resume = None # filename
# 1. dataset
dataset_train = fcn.datasets.PascalVOC2012SegmentationDataset('train')
dataset_val = fcn.datasets.PascalVOC2012SegmentationDataset('val')
iter_... | Python | 0.000003 | |
b01bd1b21f1b12c9120845ec8a85355b038d6b20 | Add a basic Storage engine to talk to the DB | inventory_control/storage.py | inventory_control/storage.py | """
This is the Storage engine. It's how everything should talk to the database
layer that sits on the inside of the inventory-control system.
"""
import MySQLdb
class StorageEngine(object):
"""
Instantiate a DB access object, create all the necessary hooks and
then the accessors to a SQL database.
... | Python | 0 | |
5397bbe4a87dba82dc9fa57abf09a4346aa63f46 | Add 168 python solution (#38) | python/168_Excel_Sheet_Column_Title.py | python/168_Excel_Sheet_Column_Title.py | class Solution:
def convertToTitle(self, n: int) -> str:
res = ""
while n > 0:
n -= 1
res = chr(65 + n % 26) + res
n //= 26
return res
| Python | 0 | |
399daa8ebec14bc4d7ee6c08135e525190e1eb6f | Add short Python script that prints as many dummy divs as needed. | collections/show-test/print-divs.py | collections/show-test/print-divs.py | # print-divs.py
def printDivs(num):
for i in range(num):
print('<div class="item">Item ' + str(i+1) + '</div>')
printDivs(20) | Python | 0 | |
97883fa22dd8b1207cd533b4dd9e438c83a32a90 | Update version. | mixer/__init__.py | mixer/__init__.py | """
Description.
"""
# Module information
# ==================
__version__ = '0.2.0'
__project__ = 'mixer'
__author__ = "horneds <horneds@gmail.com>"
__license__ = "BSD"
| """
Description.
"""
# Module information
# ==================
__version__ = '0.1.0'
__project__ = 'mixer'
__author__ = "horneds <horneds@gmail.com>"
__license__ = "BSD" | Python | 0 |
2b80b358edd5bcf914d0c709369dbbcfd748772b | Add in a test for the marketing_link function in mitxmako | common/djangoapps/mitxmako/tests.py | common/djangoapps/mitxmako/tests.py | from django.test import TestCase
from django.test.utils import override_settings
from django.core.urlresolvers import reverse
from django.conf import settings
from mitxmako.shortcuts import marketing_link
from mock import patch
class ShortcutsTests(TestCase):
"""
Test the mitxmako shortcuts file
"""
... | Python | 0.000002 | |
7236d0358064968b9cbb0ab7f4ee9876dea02aaa | add python common functions | python/tcp_port_scan/tcp_port_scan.py | python/tcp_port_scan/tcp_port_scan.py | # -*- coding: utf-8 -*-
#!/usr/bin/python
##-------------------------------------------------------------------
## @copyright 2015 DennyZhang.com
## File : tcp_port_scan.py
## Author : DennyZhang.com <denny@dennyzhang.com>
## Description :
## --
## Created : <2016-01-15>
## Updated: Time-stamp: <2016-08-11 23:14:08>
##... | Python | 0.000222 | |
c61850de298a1f40dd84d95d758d3c3faed38160 | Add safe_decode utility function | nose2/util.py | nose2/util.py | import os
import re
import sys
try:
from compiler.consts import CO_GENERATOR
except ImportError:
# IronPython doesn't have a complier module
CO_GENERATOR=0x20
try:
from inspect import isgeneratorfunction # new in 2.6
except ImportError:
import inspect
# backported from Python 2.6
def isgen... | import os
import re
import sys
try:
from compiler.consts import CO_GENERATOR
except ImportError:
# IronPython doesn't have a complier module
CO_GENERATOR=0x20
try:
from inspect import isgeneratorfunction # new in 2.6
except ImportError:
import inspect
# backported from Python 2.6
def isgen... | Python | 0.000233 |
a119c9f53babd87f5e5adc1886256c59a21c19a5 | Move content_type formatting support to a different module | hug/format.py | hug/format.py | def content_type(content_type):
'''Attaches an explicit HTML content type to a Hug formatting function'''
def decorator(method):
method.content_type = content_type
return method
return decorator
| Python | 0.000001 | |
ef803b8ac95bb2440d1d312584376149573ac798 | Create bbgdailyhistory.py | BBG/bbgdailyhistory.py | BBG/bbgdailyhistory.py | # *- bbgdailyhistory.py -*
import os
import numpy as np
import pandas as pd
import blpapi
class BBGDailyHistory:
'''
Parameters
----------
sec : str
Ticker
fields : str or list
Field of list of fields ('PX_HIGH', 'PX_LOW', etc...)
start : str
Start date
end : stf
... | Python | 0.002245 | |
353868bc281ade826b48d2c5a79ad14986c0d35c | Create lowercaseLists.py | Bits/lowercaseLists.py | Bits/lowercaseLists.py | #!/usr/bin/env python
docs = ["The Corporation", "Valentino: The Last Emperor", "Kings of Patsry"]
movies = ["The Talented Mr. Ripley", "The Network", "Silence of the Lambs", "Wall Street", "Marie Antoinette", "My Mana Godfrey", "Rope", "Sleuth"]
films = [[docs], [movies]]
movies[5] = "My Man Godfrey"
docs[-1] = "Kin... | Python | 0 | |
c36bc5664f9bfd4d1d954f4aef0402abf9533e47 | add benchmark script | resources/evaluation/SoK/benchmark.py | resources/evaluation/SoK/benchmark.py | from collections import namedtuple
import os
import lancelot
import gzip
import json
import os.path
import yaml
import tabulate
import pandas
import collections
import tqdm
Layout = namedtuple("Layout", ["functions", "basic_blocks", "instructions"])
frameworks = {
"lancelot": "lancelot",
#... | Python | 0.000001 | |
9afd1a8d3584e45d32858c3b8fa44efd0f1a09f1 | add unit test for ofproto automatic detection | ryu/tests/unit/ofproto/test_ofproto.py | ryu/tests/unit/ofproto/test_ofproto.py | # Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2013 Isaku Yamahata <yamahata at private email ne jp>
#
# 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
#
# h... | Python | 0 | |
81afc4ed6d7390567dfe9949c9f332b36a6add9c | Add lang install es_ES | l10n_cr_base/l10n_cr_base.py | l10n_cr_base/l10n_cr_base.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# l10n_cr_base.py
# l10n_cr_base
# First author: Carlos Vásquez <carlos.vasquez@clearcorp.co.cr> (ClearCorp S.A.)
# Copyright (c) 2010-TODAY ClearCorp S.A. (http://clearcorp.co.cr). All rights reserved... | # -*- encoding: utf-8 -*-
##############################################################################
#
# l10n_cr_base.py
# l10n_cr_base
# First author: Carlos Vásquez <carlos.vasquez@clearcorp.co.cr> (ClearCorp S.A.)
# Copyright (c) 2010-TODAY ClearCorp S.A. (http://clearcorp.co.cr). All rights reserved... | Python | 0 |
e1810dcfd635198363838ed5c4dcd92c1cef1b07 | use wikistats lib to update languages_by_size | scripts/maintenance/wikimedia_sites.py | scripts/maintenance/wikimedia_sites.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""Script that updates the language lists in Wikimedia family files."""
#
# (C) xqt, 2009-2016
# (C) Pywikibot team, 2008-2016
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__version__ = '$Id$'
#
import codecs
... | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""Script that updates the language lists in Wikimedia family files."""
#
# (C) xqt, 2009-2014
# (C) Pywikibot team, 2008-2014
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__version__ = '$Id$'
#
import codecs
... | Python | 0 |
657591afce265521078a7cb2f84347c2319b6b33 | Add tests to help with autograding | nbgrader/tests.py | nbgrader/tests.py | import nose.tools
import numpy as np
def assert_unequal(a, b, msg=""):
if a == b:
raise AssertionError(msg)
def assert_same_shape(a, b):
a_ = np.array(a, copy=False)
b_ = np.array(b, copy=False)
assert a_.shape == b_.shape, "{} != {}".format(a_.shape, b_.shape)
def assert_allclose(a, b):
... | Python | 0 | |
5e7746d054f7762d93e1f70296fa3b43f882553c | Add synthtool scripts (#3765) | java-bigquerydatatransfer/google-cloud-bigquerydatatransfer/synth.py | java-bigquerydatatransfer/google-cloud-bigquerydatatransfer/synth.py | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | Python | 0.000001 | |
c13ec330194612832dfb0953d3e561a0ac151d69 | add irrigation baseline file gen scripts | scripts/RT/create_irrigation_files.py | scripts/RT/create_irrigation_files.py | """Create the generalized irrigation files, for now.
https://www.ars.usda.gov/ARSUserFiles/50201000/WEPP/usersum.pdf page 60
"""
from datetime import date
LASTYEAR = date.today().year
def main():
"""Create files."""
for ofecnt in range(1, 7): # Do we have more than 6 OFEs?
fn = f"/i/0/irrigation/of... | Python | 0 | |
dfdbadbd83d41ccf71be74c7add6e04513a752d2 | Add Custom Field Change Report script | scripts/custom_field_change_report.py | scripts/custom_field_change_report.py | import sys
import argparse
from closeio_api import Client as CloseIO_API, APIError
import csv
reload(sys)
sys.setdefaultencoding('utf-8')
parser = argparse.ArgumentParser(description='Export a list of custom field changes for a specific custom field')
parser.add_argument('--api-key', '-k', required=True, help='API Ke... | Python | 0 | |
1b9aa5ccd500e17aa32c315e212068c8be96216c | Add profiler, now not import. thanks @tweekmoster! | rplugin/python3/deoplete/sources/deoplete_go/profiler.py | rplugin/python3/deoplete/sources/deoplete_go/profiler.py | import functools
import queue
try:
import statistics
stdev = statistics.stdev
mean = statistics.mean
except ImportError:
stdev = None
def mean(l):
return sum(l) / len(l)
try:
import time
clock = time.perf_counter
except Exception:
import timeit
clock = timeit.default_timer... | Python | 0 | |
6df31f3b1049071bf5112521de8876d94e8a959a | Add support for the TinyOS 2.x serial forwarder protocol | python/smap/iface/tinyos.py | python/smap/iface/tinyos.py | """
Copyright (c) 2013 Regents of the University of California
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 copyright
notice, this list of ... | Python | 0 | |
e9f2e966361d8a23c83fbbbb4a4b3d4046203a16 | Test script for the heart container | CERR_core/Contouring/models/heart/test/test.py | CERR_core/Contouring/models/heart/test/test.py | #Test script for heart container testing if all the imports are successful
import sys
import os
import numpy as np
import h5py
import fnmatch
from modeling.sync_batchnorm.replicate import patch_replication_callback
from modeling.deeplab import *
from torchvision.utils import make_grid
from dataloaders.utils import dec... | Python | 0 | |
b223c8be2bcb11d529a07997c05a9c5ab2b183b2 | Add basic tests for run length encoding printable | csunplugged/tests/resources/generators/test_run_length_encoding.py | csunplugged/tests/resources/generators/test_run_length_encoding.py | from unittest import mock
from django.http import QueryDict
from django.test import tag
from resources.generators.RunLengthEncodingResourceGenerator import RunLengthEncodingResourceGenerator
from tests.resources.generators.utils import BaseGeneratorTest
@tag("resource")
class RunLengthEncodingResourceGeneratorTest(Ba... | Python | 0 | |
24c3166906c8431523c641721e635fdc28fd91ce | add server that tests if a cookie was set | cookiescheck-test-server.py | cookiescheck-test-server.py | import sys
from flask import Flask, request, send_from_directory, make_response, abort
app = Flask(__name__)
filepath = None
mainpath = None
@app.route('/<path:path>')
def get(path):
ret = make_response(send_from_directory(filepath, path))
if path == mainpath:
ret.set_cookie('auth', '1')
elif re... | Python | 0.000001 | |
c011154135a73db2c5bba247fc33f94032553f2e | Correct package files | janitor/__init__.py | janitor/__init__.py | import utils
utils = utils
logger, logger_api = utils.logger.setup_loggers(
"janitor"
)
| Python | 0.000082 | |
1c692359231f97c3b398861fef9d5c695e8ff5f8 | Add config file module using Property List backed files. | core/pycopia/plistconfig.py | core/pycopia/plistconfig.py | #!/usr/bin/python2
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
#
# Copyright (C) 2010 Keith Dart <keith@dartworks.biz>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Fre... | Python | 0 | |
b6aedc1589c754bb867381e309aba5ae19f7bb1a | Create GDAL_SaveRaster.py | GDAL_SaveRaster.py | GDAL_SaveRaster.py |
from osgeo import gdal
def save_raster ( output_name, raster_data, dataset, driver="GTiff" ):
"""
A function to save a 1-band raster using GDAL to the file indicated
by ``output_name``. It requires a GDAL-accesible dataset to collect
the projection and geotransform.
"""
# Open the reference... | Python | 0 | |
cf066fd373f0d12a43bad24db9e645e257617306 | add consts | drda/consts.py | drda/consts.py | ##############################################################################
# The MIT License (MIT)
#
# Copyright (c) 2016 Hajime Nakagami
#
# 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... | Python | 0.000002 | |
542731f7fb3f5d09c4de4340f7ce18b7cbf41172 | Create Client.py | Client.py | Client.py | from Networking import Client
client = Client()
client.connect('10.42.42.25', 12345).send({'Ordre':'Timelapse', 'Action':["/home/pi/photo3", 24, 30, 0.25, False]})
reponse = client.recv()
client.close()
| Python | 0.000001 | |
745adf9898e6dc80d37f1a0c3c4361acf76f2feb | Create main.py | main.py | main.py | import webapp2
import logging
import json
import utils
import re
import advanced
class show_search_results(utils.BaseHandler):
def post(self):
#get info about slack post
token = self.request.get('token')
channel = self.request.get('channel')
text = self.request.g... | Python | 0.000001 | |
1c1ce1c3ba35c546828392dd69bd07176e2888ce | add MIDI renderer | midi.py | midi.py | #!/usr/bin/env python
import argparse
import colorsys
import math
import socket
import sys
import time
EARTH_RADIUS = 6371000
PURGE_TIME = 10
UPDATE_INTERVAL = 5.0 # seconds
last_update = time.time()
MAX_ALTITUDE = 40000
MAX_DISTANCE = 200000
MIDI_NOTES_COUNT = 127
MIDI_VOLUME_MAX = 127
all_aircraft = {} # Maps... | Python | 0 | |
42753fc71b6a7cbe8697ba0eb053fdbc39c852a1 | add test_eval | misc/test_eval.py | misc/test_eval.py |
# eval
def main():
dictString = "{'Define1':[[63.3,0.00,0.5,0.3,0.0],[269.3,0.034,1.0,1.0,0.5]," \
"[332.2,0.933,0.2,0.99920654296875,1],[935.0,0.990,0.2,0.1,1.0]]," \
"'Define2':[[63.3,0.00,0.5,0.2,1.0],[269.3,0.034,1.0,0.3,0.5]," \
"[332.2,0.933,0.2, 0.4,0.6],[9... | Python | 0 | |
293f0dde7f329399648317b8d67322604f2e9292 | Add window_title_async.py module | py3status/modules/window_title_async.py | py3status/modules/window_title_async.py | """
Display the current window title with async update.
Uses asynchronous update via i3 IPC events.
Provides instant title update only when it required.
Configuration parameters:
- format : format of the title, default: "{title}".
- empty_title : string that will be shown instead of the title
... | Python | 0.000004 | |
a9da84352d6ff8b26a8e25ac9d15d5737c84225f | Add problem 12 | problem_12.py | problem_12.py | from crypto_library import ecb_aes
from problem_11 import distinguish_encryption_mode
from string import printable
'''
from crypto_library import BLOCKSIZE
import random
ENCRYPTION_KEY = ''.join(random.choice(printable) for _ in range(BLOCKSIZE))
'''
def new_encryption_oracle(adversary_input):
ENCRYPTION_KEY = '... | Python | 0.000203 | |
0ecc153d3946258f7daddd48bfc2870cb497b5db | Add IPlugSession interface | pyramid_pluggable_session/interfaces.py | pyramid_pluggable_session/interfaces.py | from zope.interface import Interface
class IPlugSession(Interface):
""" In interface that describes a pluggable session
"""
def loads(session, request):
""" This function given a ``session`` and ``request`` should using the
``session_id`` attribute of the ``session``
This function... | Python | 0 | |
a0d8eff20cfd8b60be005e31692af74837ca16f5 | test math.ceil() function | pythonPractiseSamples/mathExcercises.py | pythonPractiseSamples/mathExcercises.py | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 Damian Ziobro <damian@xmementoit.com>
import unittest
import math
class TestMathMethods(unittest.TestCase):
def setUp(self):
self.number = 3.5
def test_ceil(self):
self.assertEqual(math.ceil(self.number), 4... | Python | 0.000099 | |
5d2af781b84676815a2e742bf1acc4c5633ed46e | Create exponential_weathering_integrated.py | landlab/components/weathering/exponential_weathering_integrated.py | landlab/components/weathering/exponential_weathering_integrated.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Created on Fri Apr 8 08:32:48 2016.
@author: RCGlade
Integrated version created by D. Ward on Tue Oct 27 2020
"""
import numpy as np
from landlab import Component
class ExponentialWeathererIntegrated(Component):
r"""
This component implements exponential ... | Python | 0.002747 | |
44130357b98001790547d53b7e1080e79842a058 | add group recorded | test_add_group.py | test_add_group.py | # -*- coding: utf-8 -*-
from selenium.webdriver.firefox.webdriver import WebDriver
from selenium.webdriver.common.action_chains import ActionChains
import time, unittest
def is_alert_present(wd):
try:
wd.switch_to_alert().text
return True
except:
return False
class test_add_group(unitt... | Python | 0 | |
4569c22d2d0245641e0c2696f798f273405c6bee | Test recorded and exported to the project | test_add_group.py | test_add_group.py | # -*- coding: utf-8 -*-
from selenium.webdriver.firefox.webdriver import WebDriver
from selenium.webdriver.common.action_chains import ActionChains
import time, unittest
def is_alert_present(wd):
try:
wd.switch_to_alert().text
return True
except:
return False
class test_add_group(unitt... | Python | 0 | |
1ce8285228c29370ad4230f7968abdd7436ff250 | update nth stair | IK/DP/nth_stair.py | IK/DP/nth_stair.py | # http://www.geeksforgeeks.org/count-ways-reach-nth-stair/
# This problem is simpl extension of Fibonacci Number
# Case 1 when person can take 1 or 2 steps
def fibonacci_number(n):
if n <= 1:
return n
return fibonacci_number(n-1) + fibonacci_number(n-2)
def count_ways(s):
# ways(1) = fib(2) = 1
... | Python | 0.000001 | |
d5a42bd23e7227e041aa3d748765b056e3294a0d | Create infogan.py | InfoGAN/infogan.py | InfoGAN/infogan.py | # initial python file
| Python | 0 | |
af5c39347863f2804bb1e36cb0bf6f1a049530c2 | add 15-26 | src/training/Core2/Chapter15RegularExpressions/exercise15_26.py | src/training/Core2/Chapter15RegularExpressions/exercise15_26.py | import re
def replace_email(a_string, new_email):
return re.sub('\w+@\w+\.\w+', new_email, a_string)
if __name__ == '__main__':
assert 'wd@wd.wd xx wd@wd.wd b' == replace_email('abc@126.com xx a@133.com b', 'wd@wd.wd')
assert 'abb' == replace_email('abb', 'wd@wd.wd')
print 'all passed.'
| Python | 0.999988 | |
f730a8cfd6700eeedf1cbcc5df8b3b97f918f0fa | Add filterset for tag page, refs #450 | grouprise/features/tags/filters.py | grouprise/features/tags/filters.py | from django.forms.widgets import CheckboxInput
from django_filters import BooleanFilter
from django_filters.widgets import BooleanWidget
from grouprise.features.associations.filters import ContentFilterSet
class TagContentFilterSet(ContentFilterSet):
tagged_only = BooleanFilter(
label='nur verschlagw... | Python | 0 | |
42c7db3f9422d38b0d7273ad8f95db8183b69a9c | Add a python version of the lineset_test ... it demonstrates how one has to run eve from python. | tutorials/eve/lineset_test.py | tutorials/eve/lineset_test.py | ## Translated from 'lineset_test.C'.
## Run as: python -i lineset_test.py
import ROOT
ROOT.PyConfig.GUIThreadScheduleOnce += [ ROOT.TEveManager.Create ]
def lineset_test(nlines = 40, nmarkers = 4):
r = ROOT.TRandom(0)
s = 100
ls = ROOT.TEveStraightLineSet()
for i in range(nlines):
ls.AddLine... | Python | 0.000423 | |
73f3fa2657485c4fce812f67c3430be553307413 | Include fixtures for setting up the database | tests/conftest.py | tests/conftest.py | # Copyright 2013 Donald Stufft
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | Python | 0 | |
f681f6ac7764b0944434c69febb2b3b778f2aad7 | add 2 | leetcode/2.py | leetcode/2.py | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
... | Python | 0.999999 | |
45686564547ccf1f40516d2ecbcf550bb904d59c | Create lc1032.py | LeetCode/lc1032.py | LeetCode/lc1032.py | import queue
class Node:
def __init__(self, s=''):
self.s = s
self.end = False
self.fail = None
self.children = None
def get(self, index):
if self.children == None:
return None
return self.children[index]
def set(self, index, node):
if se... | Python | 0.000002 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.