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 |
|---|---|---|---|---|---|---|---|
f2ac12e66aa2209f98e6eed2283005f2a9e74768 | Create perm_missing_elem.py | codility/perm_missing_elem.py | codility/perm_missing_elem.py | """
https://codility.com/programmers/task/perm_missing_elem/
Given array A of integers. N = len(A). Integers are distinct and taken from
range 1..(N+1), which means exactly one integer from 1..(N+1) is missing from
A. Find the missing integer.
Runtime: O(N)
Extra Space: O(1)
"""
def solution(A):
total1 = sum... | Python | 0.00014 | |
785af4d73a158fdf43ceff8bb4c974a0215606fd | add missing test file | tests/test_set_long.py | tests/test_set_long.py | import cmemcached
import unittest
import subprocess
import time
TEST_SERVER = "localhost"
memcached_process = None
def setup():
global memcached_process
memcached_process = subprocess.Popen(['memcached'])
time.sleep(0.5)
def teardown():
memcached_process.terminate()
class TestCmemcached_for_long(u... | Python | 0.000001 | |
d59e49ddf95c20b51ac285dccb0a1b43936d97ef | Test that some credential setting properly switches endpoint schemes | tests/test_tpclient.py | tests/test_tpclient.py | # Copyright (c) 2009-2010 Six Apart Ltd.
# 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 conditions an... | Python | 0 | |
4008a230fb64d059d9449a39f32abe245692d582 | Create VirgilContext implementation | virgil_sdk/api/virgil_context.py | virgil_sdk/api/virgil_context.py | # Copyright (C) 2016 Virgil Security Inc.
#
# Lead Maintainer: Virgil Security Inc. <support@virgilsecurity.com>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# (1) Redistributions of ... | Python | 0 | |
9ad8a03eac3d9fc94122ee2494ff1f6398467cfc | Add files via upload | pque.py | pque.py | class Pque(object):
"""make as priority queue priority scale is 0 through -99
0 has greatest priority with ties being first come first pop"""
def __init__(self):
self.next_node = None
self.priority = 0
self.value = None
self.tail = None
self.head = None
s... | Python | 0 | |
1664559631443ea59c248f45140ee857dc9a5b35 | Add astro/fg_figsub.py: fit and subtract foreground by polynomial fitting | astro/fg_fitsub.py | astro/fg_fitsub.py | #!/usr/bin/env python3
#
# Copyright (c) 2017 Weitian LI <weitian@aaronly.me>
# MIT License
#
"""
Fit the spectral-smooth foreground along the frequency axis (i.e.,
line of sight for the 21 cm signal) using a polynomial in the linear
scale for a series of simulated images (e.g., made by WSClean), then
subtract the fit... | Python | 0.000002 | |
b480a21d58c1fc1b8ad66442bd65a7d892d8efa1 | Create Blink.py | Blink.py | Blink.py | import time
import mraa
###### Programe Begins ####
print (mraa.getVersion())
Led = mraa.Gpio(4)
Led.dir(mraa.DIR_OUT)
Led.write(1)
value = 0
while 1:
if value == 0:
value = 1
else:
value = 0
Led.write(value)
print "LED "+str(value)
time.sleep(1)
| Python | 0 | |
36af8c98005bfb6d51344b80a59cb6e48c8b55fb | Add outputter to display overstate stages | salt/output/overstatestage.py | salt/output/overstatestage.py | '''
Display clean output of an overstate stage
'''
#[{'group2': {'match': ['fedora17-2', 'fedora17-3'],
# 'require': ['group1'],
# 'sls': ['nginx', 'edit']}
# }
# ]
# Import Salt libs
import salt.utils
def output(data):
'''
Format the data for printing stage ... | Python | 0.000001 | |
c278a1659e488df5917d77dd7e002d065e1c7586 | test db mysql | tests/test_db_mysql.py | tests/test_db_mysql.py | # -*- coding: utf-8 -*-
import unittest
from fysql import *
database = MySQLDatabase('fysql', host='localhost', user='fysql', passwd='dev')
class DevTables(Table):
db = database
class User(DevTables):
firstname = CharColumn(max_length=150)
lastname = CharColumn(max_length=150)
role ... | Python | 0.000275 | |
1085114668dc13d86dac8de70557cd4242ab9d20 | Add tests for parse_csv, weighted_mode and weighted_replicate (#210) | tests/test_learning.py | tests/test_learning.py | import pytest
from learning import parse_csv, weighted_mode, weighted_replicate
def test_parse_csv():
assert parse_csv('1, 2, 3 \n 0, 2, na') == [[1, 2, 3], [0, 2, 'na']]
def test_weighted_mode():
assert weighted_mode('abbaa', [1,2,3,1,2]) == 'b'
def test_weighted_replicate():
assert weighted_replicate('ABC', [... | Python | 0 | |
d7766cb37bcbc8115aa74252288addadee4f1709 | add the import.py for importing firmwares to database | db/import.py | db/import.py | #!/usr/bin/env python
import tarfile
import getopt
import sys
import re
import hashlib
import psycopg2
import magic
import os
import shutil
wanted_mime = ['application/x-executable', 'application/x-object', 'application/x-sharedlib',
'text/x-php', 'text/x-shellscript']
def evaluate (f):
filename =... | Python | 0 | |
8d88336d831eeb5e6603b9ff66f2e4906c4f9e2e | Create test.py | test.py | test.py | print "Hello world!"
| Python | 0.000005 | |
a72a80ce70b8c08ef5e33c41ee467f6ad7157f71 | test contains scripts for making and trying out new colormaps | test.py | test.py | '''
Making and testing colormaps.
'''
import numpy as np
from matplotlib import cm, colors
import matplotlib.pyplot as plt
import pdb
import matplotlib as mpl
from skimage import color
def cmap(rgbin, N=10):
'''
Input an array of rgb values to generate a colormap.
Inputs:
rgbin is an [mx3] array... | Python | 0 | |
6aec92990790dd5ba04ca1079dbc5fe9106f8747 | Add test suite | test.py | test.py | import sys
import unittest
import pygooglesms
from pygooglesms import GoogleSMS
class TestPyGoogleSMS(unittest.TestCase):
GOOD_LOGIN = 'CHANGEME'
GOOD_PASSWD = 'CHANGEME'
TEST_NUMBER = 'CHANGEME'
BAD_LOGIN = 'nobody@gmail.com'
BAD_PASSWD = 'terrible'
BAD_AUTH_MSG = 'No auth token provided by... | Python | 0.000001 | |
197685058df0fdee0cefa0e59f0faa038d809730 | Rename and use Maze base class | Prims.py | Prims.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import random
from maze import *
from itertools import product
from collections import defaultdict
os.environ['SDL_VIDEO_WINDOW_POS'] = '600, 30'
class Prims(Maze):
def __init__(self):
super(Prims, self).__init__()
self.maze = list()
... | Python | 0 | |
b7ff7ee179f7d973051ca7f70a04f27322c07cf2 | Create Redis.py | Redis.py | Redis.py | #Intro to Redis (NoSql)
import redis
| Python | 0.000001 | |
7d8ad6124cd838f3b2507e43c2c89e8a4873465e | fix case with no provider | test.py | test.py | from genomepy.provider import ProviderBase
from genomepy import Genome
import sys
genome_name = "ce10"
genome = Genome(genome_name)
tax_id = genome.tax_id
#p = ProviderBase.create("UCSC")
#print(p.assembly_accession("ci3"))
#sys.exit()
p = ProviderBase.create("Ensembl")
name, accession, *rest = [row for row in p.se... | Python | 0.000002 | |
eabe6103860fd7b04e52f2e5181affbb55e93273 | add wsgi script | wsgi.py | wsgi.py | #!/usr/bin/env python3
# To run:
# gunicorn -b 0.0.0.0:5000 wsgi:app
import os
from server import create_app, generate
from server.models import db, User
env = os.environ.get('OK_ENV', 'dev')
app = create_app('settings/%s.py' % env)
| Python | 0 | |
623848955085a03d1de7e15863a7dd82e4d7f51a | fix import threading.Thread | Sound.py | Sound.py | import sublime, sublime_plugin
from subprocess import call
from os.path import join
from random import randrange
from threading import Thread
class EventSound(sublime_plugin.EventListener):
def __init__(self, *args, **kwargs):
super(EventSound, self).__init__(*args, **kwargs)
if sublime.platform()... | import sublime, sublime_plugin
from subprocess import call
from os.path import join
from random import randrange
import threading
class EventSound(sublime_plugin.EventListener):
def __init__(self, *args, **kwargs):
super(EventSound, self).__init__(*args, **kwargs)
if sublime.platform() == "osx":
... | Python | 0.000009 |
89c4f92d56ab445d86dfdd321bca6c7e0f30855e | Create admin.py | weibopub/admin.py | weibopub/admin.py | from __future__ import unicode_literals
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import truncatechars
from mezzanine.weibopub import get_auth_settings
FORMFIELD_HTML = """
<div class='send_weibo_container'>
<input id... | Python | 0 | |
626662f0f3ef2ce7de63c424da89263443243e97 | Fix SpiderState bug in Windows platforms | scrapy/contrib/spiderstate.py | scrapy/contrib/spiderstate.py | import os, cPickle as pickle
from scrapy import signals
class SpiderState(object):
"""Store and load spider state during a scraping job"""
def __init__(self, jobdir=None):
self.jobdir = jobdir
@classmethod
def from_crawler(cls, crawler):
obj = cls(crawler.settings.get('JOBDIR'))
... | import os, cPickle as pickle
from scrapy import signals
class SpiderState(object):
"""Store and load spider state during a scraping job"""
def __init__(self, jobdir=None):
self.jobdir = jobdir
@classmethod
def from_crawler(cls, crawler):
obj = cls(crawler.settings.get('JOBDIR'))
... | Python | 0 |
af6eef23e60b88209ce4e9601f0cf457ee421bdc | add zone no crawler | DataHouse/crawler/zone_no_crawler.py | DataHouse/crawler/zone_no_crawler.py | """
not finish yet
"""
import requests
from bs4 import BeautifulSoup
def crawl():
url = 'http://quhao.tianqi.com/'
headers = {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'Host': 'quhao.tianqi.com',
'Referer': 'https://www.baidu.c... | Python | 0.000002 | |
5fc6d9fc05bc4cae5588489c576744a518155461 | Add Sin, Cos and Tan function classes | trig.py | trig.py | import function
import math
class Sin(function.Function):
def _evaluate(self, x):
return math.sin(x)
class Cos(function.Function):
def _evaluate(self, x):
return math.cos(x)
class Tan(function.Function):
def _evaluate(self, x):
sin = Sin()
cos = Cos()
if cos(... | Python | 0 | |
6fd249591ef8551716c0338602e78f9563a49152 | move DF API to dlframe (#2269) | python/dllib/src/test/bigdl/dlframes/test_dl_classifier.py | python/dllib/src/test/bigdl/dlframes/test_dl_classifier.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 ... | Python | 0 | |
d101e1bae5b083b436411507ebe73f12f8088075 | Create solution.py | unit-3-mixed-reading-and-assignment-lessons/lesson-3-assignment-one-code-block/solutions/solution.py | unit-3-mixed-reading-and-assignment-lessons/lesson-3-assignment-one-code-block/solutions/solution.py | def convert_temperature(temperature, to='celsius'):
def to_fahrenheit():
return (temperature * 9 / 5) + 32
def to_celsius():
return (temperature - 32) * 5 / 9
return (to_celsius if to == 'celsius' else to_fahrenheit)()
| Python | 0.000018 | |
f375be2ac11aa9648c77392cec36900db900c6ef | Add Flask server. | serve.py | serve.py | import sys
import flask
import sqlalchemy as sa
import coils
import tables
app = flask.Flask(__name__)
@app.route('/')
def root():
# Load configuration file.
CONFIG = sys.argv[1] if len(sys.argv)>=2 else 'wabbit.cfg'
config = coils.Config(CONFIG)
# Connect to database engine.
engine = sa.create_... | Python | 0 | |
f3ab43a3c24851ca5a6e68c04e56af8c8f9a0fd1 | add setup.py | setup.py | setup.py | from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
#with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-... | Python | 0.000001 | |
1b77c721b53d59e1b6242906780941d262d070e8 | add basic setup.py | setup.py | setup.py | from setuptools import setup
from esipy import __version__
# install requirements
install_requirements = [
"requests",
"pyswagger",
"six"
]
# test requirements
test_requirements = [
"coverage",
"coveralls",
"httmock",
"nose",
"mock",
"future",
"python-memcach... | Python | 0.000001 | |
518e1d56a23eb1d5b4bb31ae46c958e519addfc0 | add setup file | setup.py | setup.py | #!/usr/bin/env python
from os.path import exists
from setuptools import setup, find_packages
setup(name='topik',
version='0.1.0',
description='A Topic Modeling high-level interface',
url='http://github.com/ContinuumIO/topik/',
author='Christine Doig',
author_email='christine.doig@continu... | Python | 0.000001 | |
07cda3fee1215f4d28e3885796c5d5f02ec28918 | add beginning for D4 qcodes wrapper | D4/D4.py | D4/D4.py | from qcodes import Instrument
from qcodes.utils.validators import Numbers
from .D4_module import D4_module
class D4(Instrument):
"""
Qcodes driver for the D4 ADC SPI-rack module.
"""
def __init__(self, name, spi_rack, module, **kwargs):
super().__init__(name, **kwargs)
self.d4 = D4_m... | Python | 0 | |
0cce9a108d97b61bc36c1d6873a801ae5a02ee10 | Add setup.py script. | setup.py | setup.py | from distutils.core import setup
setup(
name="booleanOperations",
version="0.1",
description="Boolean operations on paths.",
author="Frederik Berlaen",
url="https://github.com/typemytype/booleanOperations",
license="MIT",
packages=["booleanOperations"],
package_dir={"": "Lib"},
pack... | Python | 0 | |
6edea0e1f15c3905251793238fe88641a5935fed | Update version to 3.6.2 | setup.py | setup.py | from setuptools import setup
description = """
Full featured redis cache backend for Django.
"""
setup(
name = "django-redis",
url = "https://github.com/niwibe/django-redis",
author = "Andrei Antoukh",
author_email = "niwi@niwi.be",
version='3.6.2',
packages = [
"redis_cache",
... | from setuptools import setup
description = """
Full featured redis cache backend for Django.
"""
setup(
name = "django-redis",
url = "https://github.com/niwibe/django-redis",
author = "Andrei Antoukh",
author_email = "niwi@niwi.be",
version='3.6.1',
packages = [
"redis_cache",
... | Python | 0.000001 |
709aef34e608eb86dc7cbffd5635f78d8b5f59f3 | add fasta2bed.py | fasta2bed.py | fasta2bed.py | '''Credit: Elijah Lowe'''
'''Read in sequences in FASTA format and print out BED format.'''
import screed, sys
infile = sys.argv[1]
for n, record in enumerate(screed.open(infile)):
print record['name']+"\t0\t",len(record['sequence'])
| Python | 0.000077 | |
58e4c8c5cd3c47fb4dc4e6e772b0f300fe890225 | Add missed setup.py | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='myprefetch',
version='0.1',
description='MySQL Replication Prefetcher',
packages=find_packages(),
long_description=open('README.md').read(),
license=open('LICENSE').read(),
url='https://github.com/vine/mysql-pref... | Python | 0 | |
46b723ad4b48e29225cf8fcc44fa90bc9cfc3e21 | Enable distutils for package | setup.py | setup.py | from distutils.core import setup
setup(
name='Getty',
version='0.0.1',
author='Clemens Wolff',
author_email='clemens.wolff+pypi@gmail.com',
packages=['getty'],
url='https://github.com/c-w/Getty',
download_url='http://pypi.python.org/pypi/Getty',
license='LICENSE.txt',
description='S... | Python | 0 | |
b4a41b129a33361ebcb45de87a236952943ab3c3 | Create setup.py | setup.py | setup.py | #!/usr/bin/env python
#
# Copyright (c) 2009-2013 Kyle Gorman
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, cop... | Python | 0.000001 | |
3af11eab7373a937f8df9858efbc41cdc9cfc940 | Package Linehaul | setup.py | setup.py | from setuptools import setup, find_packages
install_requires = []
with open("requirements/main.in", "r") as fp:
for line in fp:
line.strip()
if line:
install_requires.append(line)
setup(
name="linehaul",
use_scm_version={
"local_scheme": lambda v: "+{.node}{}".format(v... | Python | 0 | |
f743220b6d6868b3a489a1843dda329ed0a7d5c4 | Add Python setup file | setup.py | setup.py | from setuptools import setup
setup(name='amaya',
version='0.1',
description='IRCv3 capable bot framework',
url='http://github.com/bookhorse/amaya',
author='Nicole Brennan',
author_email='twipony.ts@gmail.com',
license='ZLib',
packages=['amaya'])
| Python | 0.000001 | |
250261038893c7f5b004776c4aec01ebfc1d9012 | Fix a typo | setup.py | setup.py | # Copyright Hybrid Logic Ltd. See LICENSE file for details.
#
# Generate a Flocker package that can be deployed onto cluster nodes.
#
import os.path
from setuptools import setup
path = os.path.join(os.path.dirname(__file__), b"flocker/version")
with open(path) as fObj:
version = fObj.read().strip()
del path
se... | # Copyright Hybrid Logic Ltd. See LICENSE file for details.
#
# Generate a Flocker package that canbe deployed onto cluster nodes.
#
import os.path
from setuptools import setup
path = os.path.join(os.path.dirname(__file__), b"flocker/version")
with open(path) as fObj:
version = fObj.read().strip()
del path
set... | Python | 1 |
b46119ada62fbcb4791cd8ce210e34a43564df5b | Add setup_tools cruft | setup.py | setup.py | from distutils.core import setup
setup(name = 'MNML',
description = 'A very lightweight WSGI Python web framework',
author = 'Bradley Wright',
author_email = 'me@bradleywright.name',
url = 'http://github.com/bradleywright/mnml',
version = '0.1',
py_modul... | Python | 0 | |
328204f4158a829c6922019dcd83d3afbca2536d | bump to 0.4 | setup.py | setup.py |
from distutils.core import setup
setup(name='zencoder',
version='0.4',
description='Integration library for Zencoder',
author='Alex Schworer',
author_email='alex.schworer@gmail.com',
url='http://github.com/schworer/zencoder-py',
license="MIT License",
install_requires=['httpl... |
from distutils.core import setup
setup(name='zencoder',
version='0.3',
description='Integration library for Zencoder',
author='Alex Schworer',
author_email='alex.schworer@gmail.com',
url='http://github.com/schworer/zencoder-py',
license="MIT License",
install_requires=['httpl... | Python | 0.000024 |
e9b8c9489f4a43a43a865853f9bbdb246e445802 | Comment setup.py | setup.py | setup.py | #!/usr/bin/env python
import os
from glob import glob
import platform
if os.environ.get('USE_SETUPTOOLS'):
from setuptools import setup
setup # workaround for pyflakes issue #13
setup_kwargs = dict(zip_safe=0)
else:
from distutils.core import setup
setup_kwargs = dict()
data_files = [
('shar... | #!/usr/bin/env python
import os
from glob import glob
import platform
if os.environ.get('USE_SETUPTOOLS'):
from setuptools import setup
setup # workaround for pyflakes issue #13
setup_kwargs = dict(zip_safe=0)
else:
from distutils.core import setup
setup_kwargs = dict()
data_files = [
('shar... | Python | 0 |
bd41935801fb01d85d7f3f600c6b94f077cdf82f | Add solid motor utilities. | solid.py | solid.py | ''' Solid rocket motor equations.
Matt Vernacchia
proptools
2016 Aug 22
'''
def chamber_pressure(K_n, a, n, rho_solid, c_star):
''' Chamber pressure due to solid propellant combustion.
See equation 12-6 in Rocket Propulsion Elements 8th edition.
Args:
K_n (scalar): Ratio of burning area to throa... | Python | 0 | |
62d817cde6a8c58372125f551d8122cc303ac4b5 | Add a new gclient-new-workdir script which clones an existing gclient working directory much like git-new-workdir, but takes into account all sub projects as well. | gclient-new-workdir.py | gclient-new-workdir.py | #!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Usage:
# gclient-new-workdir.py <repository> <new_workdir> [<branch>]
#
import os
import shutil
import subprocess
import sys
d... | Python | 0.000226 | |
a45c78d0fcc6d8cd2d8e702917a2dabd7bfc0444 | Add command createaccount | saleor/account/management/commands/createserviceaccount.py | saleor/account/management/commands/createserviceaccount.py | import json
from typing import Any, Dict, List, Optional
import requests
from django.contrib.auth.models import Permission
from django.contrib.sites.models import Site
from django.core.management import BaseCommand, CommandError
from django.core.management.base import CommandParser
from requests.exceptions import Requ... | Python | 0.000016 | |
9e4d07ec0bbe3f29fd2823a441bcdf0566725e32 | add runner | src/rstcheck/runner.py | src/rstcheck/runner.py | """Runner of rstcheck."""
import multiprocessing
import os
import pathlib
import re
import sys
import typing
from . import _sphinx, checker, config, types as _types
class RstcheckMainRunner:
"""Main runner of rstcheck."""
def __init__(self, main_config: config.RstcheckConfig, overwrite_config: bool = True) ... | Python | 0.0008 | |
11b5b650596ccc11af292fd76746fe84a64cdf42 | add __main__ | 12306.py | 12306.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
from datetime import datetime
import pytz
import requests
from bs4 import BeautifulSoup
from icalendar import Calendar, Event
import clipboard
def get_travel(t):
dcc = []
m_c = re.compile(ur"\w\d*次").search(t) # 查找车次信息
# 获取车次... | Python | 0.000247 | |
b8029643ca5dd5d559b7411b6fbb20896502fd7b | Create solution.py | hackerrank/algorithms/implementation/medium/almost_sorted/py/solution.py | hackerrank/algorithms/implementation/medium/almost_sorted/py/solution.py | def solution(L):
def isAscending(L):
m = 1
while m < len(L):
if L[m] < L[m - 1]:
return False
m += 1
return True
buffer = list(L[:])
i = 1
while i < len(buffer):
if buffer[i] < buffer[i - 1]:
i -= 1
break... | Python | 0.000018 | |
e57c1b157b39eac278552fd6c9a16e004d8be501 | Create task_1_2.py | INBa/2014/Andreev_F_I/task_1_2.py | INBa/2014/Andreev_F_I/task_1_2.py | # Задача 1, Вариант 2
# Напишите программу, которая будет сообщать род деятельности и псевдоним под которым скрывается Мартин Андерсен. После вывода информации программа должна дожидаться пока пользователь нажмет Enter для выхода.
# Андреев Ф.И.
# 23.05.2016
print('Мартин Андерсен известный датский писатель-коммунист... | Python | 0.999998 | |
1d55ad8fb8309918e7d41b4f443e16ebefbb1895 | Add script for populating elasticsearch. | populate_elasticsearch.py | populate_elasticsearch.py | #!/usr/bin/env python
import os
import sys
import json
import requests
import multiprocessing
import mwparserfromhell as mwp
ES_URL = 'http://localhost:9200'
SECTIONS_TO_REMOVE = set([
'references', 'see also', 'external links', 'footnotes'
])
def put_document(path):
id = os.path.basename(path)
doc = js... | Python | 0 | |
1362703d4068a03c2970962ef2c05c3b128edcf1 | Create 5function.py | introduction/5function.py | introduction/5function.py | def fun():
name = "av"
age = int(19)
print("%s is %d years old."% (name, age))
return "end"
print(fun())
| Python | 0.000494 | |
2d4f6dd040d6f92b0865421cddf6c9ce16eff08e | add sample python module | my_amazing_python_module.py | my_amazing_python_module.py | def some_function(name):
return "Hello, %s!" % name | Python | 0.000001 | |
ff2b86d90ecbc2da25ddc05b0430555861104cac | Add an example for HybridContentsManager. | examples/hybrid_manager_example.py | examples/hybrid_manager_example.py | # This example shows how to configure Jupyter/IPython to use the more complex
# HybridContentsManager.
# A HybridContentsManager implements the contents API by delegating requests to
# other contents managers. Each sub-manager is associated with a root
# directory, and all requests for data within that directory are r... | Python | 0 | |
b53eec31cdb77690bebf17427a30ba6e36156cad | Add some tests for DestroyPool(). | tests/dbus/manager/test_destroy.py | tests/dbus/manager/test_destroy.py | # Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | Python | 0 | |
d68109c2fb7bb324c93506d26a1a7cf996134da3 | Allow `soulmate_finder` to be imported | soulmate_finder/__init__.py | soulmate_finder/__init__.py | # allow `soulmate_finder` to be imported
# FIXME: This is bad
from .__main__ import *
| Python | 0.000015 | |
44c846e88afe641094a7cdd550381eedeacfadd1 | Create functions.py | functions.py | functions.py | # This is a module containing functions for the language Floroid.
# Some code taken from the internet and the rest written by me.
# Not by any means meant to be readable.
from math import*
# Prime functions
def isPrime(n):
"""Returns True if n is prime."""
if n == 2:return True
if n == 3:return True
... | Python | 0 | |
79fe576ec71552633c7e5a2a646567beecfa3b5b | Add a test | test/pkgbuildtest.py | test/pkgbuildtest.py | #!/usr/bin/env python3
import sys
import os
import unittest
sys.path[0] = os.path.abspath('..')
import libaur.PKGBUILD as P
class PkgbuildTest(unittest.TestCase):
KNOWN_VALUES = [
('''pkgname=foobar\n''',
{'pkgname':['foobar']}),
('''pkgname=(foobar)\n''',
... | Python | 0 | |
44a785b456ad1d1bd9c866b79cadaec4c1d5bab5 | Add sample template file (#24) | samples/vsphere/common/sample_template.py | samples/vsphere/common/sample_template.py | #!/usr/bin/env python
"""
* *******************************************************
* Copyright (c) VMware, Inc. 2017. All Rights Reserved.
* SPDX-License-Identifier: MIT
* *******************************************************
*
* DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
* WARRANTIES OR CONDITIONS... | Python | 0 | |
7d5407a98ef8b0d025532d9675b7109a4c4713f4 | add send sms python post code | send-sms-text-messages-python/send_sms.py | send-sms-text-messages-python/send_sms.py | # we import the Twilio client from the dependency we just installed
from twilio.rest import TwilioRestClient
# the following line needs your Twilio Account SID and Auth Token
client = TwilioRestClient("ACxxxxxxxxxxxxxx", "zzzzzzzzzzzzz")
# change the "from_" number to your Twilio number and the "to" number
# to the p... | Python | 0 | |
9e200c1e5d666c3ab151c96fcc1190c70ddcb02c | Add pagination utility. | src/cadorsfeed/views/pagination.py | src/cadorsfeed/views/pagination.py | from werkzeug import cached_property
from flask import url_for
class Pagination(object):
def __init__(self, db, key, per_page, page, endpoint):
self.db = db
self.query = key
self.per_page = per_page
self.page = page
self.endpoint = endpoint
@cached_property
def cou... | Python | 0 | |
9f3c1ee68e6bb40c519e898a8a5aedd1ec42bc1f | add radar proxy | testing/ROS/serial_reader_radar.py | testing/ROS/serial_reader_radar.py | #!/usr/bin/env python
from __future__ import division
import serial
import rospy
import os
import sys
import math
import tf
from sensor_msgs.msg import Range
def RadianToDegree(rad):
return (rad * 4068) / 71.0
def DegreeToRadian(deg):
return (deg * 71) / 4068.0
if __name__=="__main__":
uid = str(os.get... | Python | 0 | |
c03b1c16938572aea70dd22b838459aeec585b0d | add tests for `dvc tag` | tests/test_tag.py | tests/test_tag.py | import os
import shutil
import filecmp
from dvc.main import main
from dvc.logger import logger
from tests.basic_env import TestDvc
from tests.utils import reset_logger_standard_output, reset_logger_error_output
from tests.utils.logger import MockLoggerHandlers, ConsoleFontColorsRemover
class TestTag(TestDvc):
... | Python | 0 | |
c4f95deabc67ba7da8aba1eea7cd28837d2f3c18 | Create utils.py | utils.py | utils.py | # MIT License
# Copyright (c) 2017 Rene Jean Corneille
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, m... | Python | 0.000001 | |
3506cb01b0ce03d834c61ff28dd5d35785b999d3 | add initial coverage implementation (#39) | tools/coverage.py | tools/coverage.py | #!/bin/env python
"""coverage.py
This script is for checking the code coverage of unit tests in the
oshinko-rest project. It is meant to be invoked from the top level of the
repository.
Example invocation:
$ tools/coverage.py -h
"""
import argparse
import copy
import re
import subprocess
oshinko_repo = 'githu... | Python | 0 | |
63eaadad7a5169ec6219d33f9b39ce27859684c2 | Add script to automate notebooks testing | notebooks/test_notebooks.py | notebooks/test_notebooks.py | # -*- coding: utf-8 -*-
'''
Checks notebook execution result.
Equal to this command + error management:
jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=60 --output executed_notebook.ipynb demo.ipynb
For jupyter configuration information, run: jupyter --path
'''
# Dependencies: nbformat, nbc... | Python | 0.000001 | |
37c151de6b2241e68f7287349b43f6dce1150093 | add an API module for core.ui | enthought/mayavi/core/ui/api.py | enthought/mayavi/core/ui/api.py | from enthought.mayavi.tools.mlab_scene_model import MlabSceneModel
from enthought.mayavi.core.ui.mayavi_scene import MayaviScene
from enthought.tvtk.pyface.scene_editor import SceneEditor
from enthought.mayavi.core.ui.engine_view import EngineView
from enthought.mayavi.core.ui.engine_rich_view import EngineRichView
| Python | 0.000002 | |
4fc098ade74a9b46f11937e229cba75b83f0c9a4 | Create Utils.py | Utils.py | Utils.py | class Batchable:
def __init__(self, X, y, batch_size = 256, seed = None):
import math
import numpy as np
if seed:
np.random.seed(seed)
idx = np.arange(X.shape[1])
np.random.shuffle(idx)
self.X = X[:, idx]
self.y = y[:, idx]
self.start = 0
... | Python | 0 | |
89c631a07c6f384b28a0f7eb7b699b704f0d275a | Add skeleton class. | stingray/multitaper.py | stingray/multitaper.py | import copy
from stingray.gti import check_gtis, cross_two_gtis
from stingray.crossspectrum import Crossspectrum
from stingray.powerspectrum import Powerspectrum
import warnings
from collections.abc import Iterable, Iterator
import numpy as np
import scipy
import scipy.optimize
import scipy.stats
from scipy import sig... | Python | 0 | |
bed08a0d3187f6b31f985d448598eb0ea231a1db | Python print dict tip | python/print_dict.py | python/print_dict.py | # print dictionary
import json
goo = {'name': 'honux', 'age': 25, 'favorite' : {'game': 'SF', 'movie': 'matrix', 'book': 'Galaxy hero'}}
print(goo)
print(json.dumps(goo, indent = 4, sort_keys = True))
| Python | 0.999031 | |
65bc771c1cff47fcd49486915a0ff27d635b4056 | Add Missionaries_and_cannibals_problem | data_structures/dictionary/missionaries_and_cannibals_problem.py | data_structures/dictionary/missionaries_and_cannibals_problem.py | shore = {1:['m1','m2','m3','c1','c2','c3'],2:[]}
boat = {1:True,2:False}
boat_cap = 0
boat_hold = []
choice = 'y'
count = 0
glob = 1
def pick():
print("Pick a person to put on boat/or press enter")
return input()
def check(person,flag,avail_p):
if(person in shore[flag] or person == "" or person in boat_hold... | Python | 0.001653 | |
87564dcb55e1130a0c4c306a241649d9f9bfd378 | Add categorize_forwarded_files_from_Sumologic.py | categorize_forwarded_files_from_Sumologic.py | categorize_forwarded_files_from_Sumologic.py | # --------------------------------------------------
# Author: Binh Nguyen
# Email: "binh@misfitwearables.com" or ntbinhptnk@gmail.com
# Feel free to ask me any question.
# --------------------------------------------------
# Description:
# When working with Sumologic, one usually uses the feature "Data Forwarding" fo... | Python | 0.000047 | |
4083cac3c0ec107df68cdecb8fc52c00e2684b08 | Add b3 format benchmark tests (#1489) | propagator/opentelemetry-propagator-b3/tests/performance/benchmarks/trace/propagation/test_benchmark_b3_format.py | propagator/opentelemetry-propagator-b3/tests/performance/benchmarks/trace/propagation/test_benchmark_b3_format.py | # Copyright The OpenTelemetry 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 ... | Python | 0 | |
4a5767c18b3d75420c5498341012fa98e74edba6 | Create 2string_join.py | string/2string_join.py | string/2string_join.py | s1="hello"
s2="world"
print(s1+s2)
print("\n"," ".join(s2),"\n")
print("length of s1=",len(s1))
| Python | 0.002004 | |
c1f02399ad3ce9c4009e297be58aa6e1f10337cb | Add utility getrecord.py to retrieve single records from lib | getrecord.py | getrecord.py | #!/usr/bin/python
#
# retrieve specified record from lib
#
import sys
import olypy.oio as oio
from olypy.oid import to_oid, to_int
import olypy.dbck as dbck
import pathlib
from jinja2 import Environment, PackageLoader, select_autoescape
from olymap.loc import build_complete_loc_dict
from olymap.ship import build_comp... | Python | 0 | |
502a95b4bcf54792b5755c9ea6f03a8f9572a271 | test resize | tests/test_resize.py | tests/test_resize.py | from tempfile import TemporaryFile
import pytest
from imgpy import Img
@pytest.mark.parametrize('image', ({
'sub': 'anima/bordered.gif',
'size': (100, 100)
}, {
'sub': 'anima/clear.gif',
'size': (100, 100)
}, {
'sub': 'fixed/bordered.jpg',
'size': (100, 100)
}, {
'sub': 'fixed/clear.jpg'... | Python | 0.000001 | |
f4bb4d17214f4e359455cf7b5fb7ab973508049b | Add missing module for merge script | bin/diffMatcher.py | bin/diffMatcher.py | #!/usr/bin/python
# coding=utf-8
import subprocess
class DiffMatcher(object):
def __init__(self, listA, listB):
self.listA = listA
self.listB = listB
def create_diff(self, listA, listB,case_sensitive):
new_list = []
#compare the two files
try:
if (cas... | Python | 0.000001 | |
7b0044d3ccb617e92ee8523be949966f1188c742 | add unittest | tests/unit/py2/nupic/encoders/utility_test.py | tests/unit/py2/nupic/encoders/utility_test.py | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditio... | Python | 0.000015 | |
2ac66bef27652dec67b90cb428031e4954da8e21 | Create download-search.py | lattes/download-search.py | lattes/download-search.py | import urllib2
import codecs
import os
try: os.makedirs('data')
except: pass
inc = 10000
offset = 0
limit = 211056
while (offset < 211057):
urlpath = 'http://buscatextual.cnpq.br/buscatextual/busca.do?metodo=forwardPaginaResultados®istros=' + str(offset) + ';' + str(inc) + '&query=%28+%2Bidx_particao%3A1+%2Bidx_... | Python | 0 | |
6a95d0df59f5ab03cb8537014e0102e5300a544a | Add Docker driver | docker.py | docker.py |
import random, string
import sys, subprocess
from log import logging
LOG = logging.getLogger(__name__)
class Driver(object):
def __init__(self, name, dockerfilepath):
self.name = name
self.dockerfilepath = dockerfilepath
self.tag = "rallyci:" + dockerfilepath
self.number = 0
... | Python | 0 | |
f3c622a3dc9573c8244bf01408c1ff4620080c99 | Create views module | views/__init__.py | views/__init__.py | Python | 0 | ||
07148136d8dcc165fc72d3ef264d721c652db025 | Test cases for ZPool | test/002_test_zpool.py | test/002_test_zpool.py | import unittest
import os
from .test_utils import _LibZFSHandleCase
from libzfs.zpool import ZPool, zpool_prop_t
LIBZFS_TEST_POOL = os.environ.get("LIBZFS_TEST_POOL", False)
@unittest.skipUnless(LIBZFS_TEST_POOL, "LIBZFS_TEST_POOL not set, so we do not test to a specific pool")
class Test_ZPool(_LibZFSHandleCase):
... | Python | 0 | |
ba8be59db72c958e2ff20b9ae7fe81c400b40f9c | Make start of ongoing and deadline activities just a date | bluebottle/time_based/migrations/0008_auto_20201023_1443.py | bluebottle/time_based/migrations/0008_auto_20201023_1443.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2020-10-23 12:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('time_based', '0007_auto_20201023_1433'),
]
operations = [
migrations.Alter... | Python | 0 | |
b869748e4bc0ee6986fa280aa69027aaf8607dcb | allow set_ev_handler without dispatchers | ryu/controller/handler.py | ryu/controller/handler.py | # Copyright (C) 2011, 2012 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2011, 2012 Isaku Yamahata <yamahata at valinux co 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
#
... | # Copyright (C) 2011, 2012 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2011, 2012 Isaku Yamahata <yamahata at valinux co 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
#
... | Python | 0 |
7f49a34e605d701168ee88c8cff0e3b8ed9a68d6 | Add GPG-related minor migration | storage_service/locations/migrations/0017_gpg_space_minor_migration.py | storage_service/locations/migrations/0017_gpg_space_minor_migration.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('locations', '0016_mirror_location_aip_replication'),
]
operations = [
migrations.AlterField(
model_name='space',... | Python | 0 | |
579d21e001f5cd61702dc086d36c1a5f764ffb45 | Add app.wsgi to run under Apache | app.wsgi | app.wsgi | import app
site = app.create_app()
site.run()
| Python | 0 | |
194abec2ae2066a4ab77db2d46822115350d8086 | Add script brand-exclusion.py | brand-exclusion.py | brand-exclusion.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from sys import getsizeof
from time import time
from codecs import open
from numpy import array, matrix
from numpy.random import random
from argparse import ArgumentParser
from itertools import combinations
from heapq import nlargest
BRAND_EXCLUDED = False
def duration(s... | Python | 0.000001 | |
38090ac06a48a4205cbc2318e3ad9296d5b08ea5 | Add migration to populate Broadcast.base_language | temba/msgs/migrations/0069_populate_broadcast_base_lang.py | temba/msgs/migrations/0069_populate_broadcast_base_lang.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from collections import defaultdict
from django.db import migrations
from temba.utils import chunk_list
def do_populate(Broadcast, FlowStep):
BroadcastSteps = FlowStep.broadcasts.through
broadcast_ids = list(Broadcast.objects.values_list('id', f... | Python | 0.000001 | |
42cc997aea3f71d9b0db37d36a895e68994616ea | Add Jansson (#2287) | var/spack/repos/builtin/packages/jansson/package.py | var/spack/repos/builtin/packages/jansson/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | Python | 0 | |
9cbcf5ce7b6363e267e8923fe88e4ebf78107f8a | Add extractor for synthesis of Symbtr scores | compmusic/extractors/makam/scoresynthesis.py | compmusic/extractors/makam/scoresynthesis.py | import json
import urllib2
import compmusic.dunya.conn
import compmusic.dunya.docserver
import compmusic.extractors
import pydub
from symbtrsynthesis.adaptivesynthesizer import AdaptiveSynthesizer
from symbtrsynthesis.musicxmlreader import MusicXMLReader
class ScoreSynthesis(compmusic.extractors.ExtractorModule):
... | Python | 0 | |
e63a623452d9aa64c2dd392442f1f09f8e0924ef | make it work on python 2.6 | compress/filters/css_url_replace/__init__.py | compress/filters/css_url_replace/__init__.py | import re
from django.conf import settings
from compress.filter_base import FilterBase
CSS_REPLACE = getattr(settings, 'COMPRESS_CSS_URL_REPLACE', [])
class CSSURLReplace(FilterBase):
def filter_css(self, css):
for pattern, repl in CSS_REPLACE.iteritems():
css = re.sub(pattern, repl, css)
... | import re
from django.conf import settings
from compress.filter_base import FilterBase
CSS_REPLACE = getattr(settings, 'COMPRESS_CSS_URL_REPLACE', [])
class CSSURLReplace(FilterBase):
def filter_css(self, css):
for pattern, repl in CSS_REPLACE.iteritems():
css = re.sub(pattern, repl, css, fla... | Python | 0.000324 |
feee17d37fdef9b2b511366f42599ceb1b7fdd50 | Add migration | corehq/apps/sms/migrations/0019_add_new_registration_invitation_fields.py | corehq/apps/sms/migrations/0019_add_new_registration_invitation_fields.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('sms', '0018_check_for_phone_number_migration'),
]
operations = [
migrations.AddField(
mo... | Python | 0.000002 | |
0002ec236c63bf64a112eb3767137588ebe83403 | Add band-pass fourier filter. | band_pass.py | band_pass.py | import numpy as np
import matplotlib.pyplot as plt
def next_length_pow2(x):
return 2 ** np.ceil(np.log2(abs(x)))
def filter(fft_data, filter_large_dia, filter_small_dia):
fft_data_shape = fft_data.shape
side_len = fft_data_shape[0]
filter_large = 2.0 * filter_large_dia / side_len
filter_small = 2... | Python | 0 | |
c54f7c8157b390aa73d3a395bd00a00de3b632c8 | Add twisted bot | ircLogBot.py | ircLogBot.py | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
An example IRC log bot - logs a channel's events to a file.
If someone says the bot's name in the channel followed by a ':',
e.g.
<foo> logbot: hello!
the bot will reply:
<logbot> foo: I am a log bot
Run this script with two argument... | Python | 0.000005 | |
1cee75aec336b6ba7d21cb9aa18b238e68ce2fd0 | add script to export data from database | website/scripts/export_pairs.py | website/scripts/export_pairs.py | from website.models import Annotation
nl_list = []
cm_list = []
for annotation in Annotation.objects.all():
nl_list.append(annotation.nl.str)
cm_list.append(annotation.cmd.str)
with open('nl.txt', 'w') as o_f:
for nl in nl_list:
o_f.write('{}\n'.format(nl.strip()))
with open('cm.txt', 'w') as o_f... | Python | 0 | |
74df88d572c8b6efabcde5e1803245d1bf31cc39 | Switch to GitHub-esque event names | src/sentry/models/auditlogentry.py | src/sentry/models/auditlogentry.py | """
sentry.models.auditlogentry
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
from django.db import models
from django.utils import timezone
from django.uti... | """
sentry.models.auditlogentry
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
from django.db import models
from django.utils import timezone
from django.uti... | Python | 0.00007 |
2457eaf72e0379d0e8915906ba7f7faa9b3f2f03 | add plotter for glitch offset | code/plot_glitchOffset.py | code/plot_glitchOffset.py | #!/bin/python
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
import numpy as np
import math
data = np.genfromtxt('GlitchOffsetOut.txt', delimiter=' ', skip_header=1,
skip_footer=1, names=['time', 'north', 'east'])
fig = plt.figure()
ax1 = fig.add_subplot(211)
ax1.set_tit... | Python | 0 | |
526faad8c83d1385cc31ed3db85249a9f5882893 | Create myproject.py | myproject.py | myproject.py | from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def home():
return render_template("home.html")
if __name__ == "__main__":
app.run(host='0.0.0.0', debug=True)
| Python | 0.000002 | |
c6fbea313571cff4383ce57c689e5aac25537144 | add command to run VCLWriter | run_vcl_writer.py | run_vcl_writer.py | # Copyright 2014 varnishapi authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import argparse
from feaas import api, vcl_writer
def run(storage):
parser = argparse.ArgumentParser("VCL Writer runner")
parser.add_argument("-i", ... | Python | 0.000008 | |
30bd54621ce649e90f4a1717d6709652a2c77351 | Add missing migration | humans/migrations/0013_auto_20201204_1807.py | humans/migrations/0013_auto_20201204_1807.py | # Generated by Django 2.2.13 on 2020-12-04 18:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('humans', '0012_remove_user_server_signed'),
]
operations = [
migrations.AlterField(
model_name='user',
name='last_n... | Python | 0.0002 | |
a8bf127b1e17b4ce9c2a5c4e6d2bbbc19faa0141 | Create snapper_chain.py | google-code-jam/snapper_chain.py | google-code-jam/snapper_chain.py | """
https://code.google.com/codejam/contest/433101/dashboard
"""
def light_on(n, k):
bits = bin(k)[2:]
if len(bits) < n:
return False
return all(b == '1' for b in list(reversed(bits))[:n])
def main():
T = int(raw_input())
for t in xrange(1, T+1):
n, k = map(int, raw_input().str... | Python | 0.000009 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.