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 |
|---|---|---|---|---|---|---|---|
de4e54e1de5905600d539df781994612f03e0672 | Add files via upload | matrix.py | matrix.py | import numpy as np
def parse_to_matrix(input_file_path, div = '\t', data_type = int):
input_file = open(input_file_path, 'r')
matrix = [ map(data_type,line.strip().split('%s' % div)) for line in input_file if line.strip() != "" ]
input_file.close()
return np.array(matrix)
def parse_to_vectors(input_file_path, div... | Python | 0 | |
42e485b7367e1a707a73b834f39fc6d3f356b61d | remove valid config check | verbs/gdb.py | verbs/gdb.py | """implement 'gdb' verb (debugs a single target with gdb)
gdb
gdb [target]
gdb [target] [config]
"""
import subprocess
from mod import log, util, config, project, settings
#-------------------------------------------------------------------------------
def gdb(fips_dir, proj_dir, cfg_name, target=None) :
"""deb... | """implement 'gdb' verb (debugs a single target with gdb)
gdb
gdb [target]
gdb [target] [config]
"""
import subprocess
from mod import log, util, config, project, settings
#-------------------------------------------------------------------------------
def gdb(fips_dir, proj_dir, cfg_name, target=None) :
"""deb... | Python | 0.000001 |
0118316df964c09198747255f9f3339ed736066d | Create test.py | test/test.py | test/test.py | # TweetPy
# Test
import unittest
import tweet
class SampleTestClass(unittest.TestCase):
def sampleTest(self):
#do something
a = 1
if __name__ == '__main__':
unittest.main()
| Python | 0.000005 | |
ba180a1798296346116a7c11557ddbe4aa40da8b | Solving p20 | p020.py | p020.py | sum([int(digit) for digit in str(math.factorial(100))]) | Python | 0.999485 | |
1e96ec2104e6e30af3bcf7c9dd61bd8f157b7519 | Solving p028 | p028.py | p028.py | def spiral_corners(size):
yield 1
for x in range(3, size+1, 2):
base_corner = x**2
corner_diff = x-1
for corner in (3,2,1,0):
yield base_corner-corner_diff*corner
def solve_p026():
return sum(spiral_corners(1001))
if __name__ == '__main__':
print solve_p026()
| Python | 0.999362 | |
fa4b01102d1226ccc3dcf58119053bbc8839c36e | add ex42 | lpthw/ex42.py | lpthw/ex42.py | #!/usr/bin/env python
# Exercise 42: Is-A, Has-A, Objects, and Classes
## Animal is-a object (yes, sort of confusing) look at the extra credit
class Animal(object):
pass
## ??
class Dog(Animal):
def __init__(self, name):
## ??
self.name = name
## ??
class Cat(Animal):
def __init__(self... | Python | 0.998437 | |
94bc0d6596aba987943bf40e2289f34240081713 | Add lc0041_first_missing_positive.py | lc0041_first_missing_positive.py | lc0041_first_missing_positive.py | """Leetcode 41. First Missing Positive
Hard
URL: https://leetcode.com/problems/first-missing-positive/
Given an unsorted integer array, find the smallest missing positive integer.
Example 1:
Input: [1,2,0]
Output: 3
Example 2:
Input: [3,4,-1,1]
Output: 2
Example 3:
Input: [7,8,9,11,12]
Output: 1
Note:
Your algori... | Python | 0.998416 | |
1aba0e5ba6aa91c2aa608c2c94411c59e4a3eca5 | Create stack_plot.py | stack_plot.py | stack_plot.py | # -*- coding: utf-8 -*-
"""
Includes a function for visualization of data with a stack plot.
"""
from matplotlib import pyplot as plt
from matplotlib import ticker
import random
def stack(number_of_topics, TopicTitles, X, Y):
"""Creates a stack plot for the number of papers published from 2002 to 2014
for e... | Python | 0.000081 | |
d4ac57f3a328dd98b76f6c8924ddc9d735c32c04 | Add py-sphinxcontrib-qthelp package (#13275) | var/spack/repos/builtin/packages/py-sphinxcontrib-qthelp/package.py | var/spack/repos/builtin/packages/py-sphinxcontrib-qthelp/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PySphinxcontribQthelp(PythonPackage):
"""sphinxcontrib-qthelp is a sphinx extension which ... | Python | 0 | |
6b5587fc7856b5d03b3605e1a31234ff98df88e2 | add L3 quiz - Expressions | lesson3/quizExpressions/unit_tests.py | lesson3/quizExpressions/unit_tests.py | import re
is_correct = False
brace_regex = "{{.*}}"
color_regex = "(?:brick.)?color"
size_regex = "(?:brick.)?size"
price_regex = "(?:brick.)?price"
heading = widget_inputs["text1"]
brick_color = widget_inputs["text2"]
brick_size = widget_inputs["text3"]
brick_price = widget_inputs["text4"]
brick_description = widge... | Python | 0.000001 | |
6855bfdc910c0c74743906f195f430817f2399b3 | Add rel-fra creation | omwg/fra2tab.py | omwg/fra2tab.py | #!/usr/share/python
# -*- encoding: utf-8 -*-
#
# Extract synset-word pairs from the WOLF (Wordnet Libre du Français)
# Remap 'b' to 'r'
# Some clean up (remove ' ()', '|fr.*')
import sys, re
import codecs, collections
### Change this!
wndata = "../wordnet/"
wnname = "WOLF (Wordnet Libre du Français)"
wnurl = "http:... | Python | 0 | |
4731e99882d035a59555e5352311d00c4e122f09 | Print useful information about a GTFS feed | onestop/info.py | onestop/info.py | """Provide useful information about a GTFS file."""
import argparse
import geohash
import gtfs
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='GTFS Information')
parser.add_argument('filename', help='GTFS File')
parser.add_argument('--debug', help='Show helpful debugging information', a... | Python | 0 | |
335881f4644a6bb2b5f2abb5b193f39d304dbc71 | Fix user agent for the bnn_ sites | pages_scrape.py | pages_scrape.py | import logging
import requests
def scrape(url, extractor):
"""
Function to request and parse a given URL. Returns only the "relevant"
text.
Parameters
----------
url : String.
URL to request and parse.
extractor : Goose class instance.
An instance of Goose th... | import logging
import requests
def scrape(url, extractor):
"""
Function to request and parse a given URL. Returns only the "relevant"
text.
Parameters
----------
url : String.
URL to request and parse.
extractor : Goose class instance.
An instance of Goose th... | Python | 0.999201 |
dddf634f8445fac66aa25265c7f7e859dab4c000 | add test file for python | test/test.py | test/test.py | # Highlighter Demo
class Person:
def __init__(self, x):
self.x = x
def show(self):
print(self.x)
person = Person("Ken")
person.show()
| Python | 0.000001 | |
abcbe6443492ba2f011dec0132a0afb3b8cc9b0b | Create __init__.py | hello-world/__init__.py | hello-world/__init__.py | Python | 0.000429 | ||
8d36c444fe379b5901692485c2850e86ed714f89 | Add sql connection tester | sql_connection_test.py | sql_connection_test.py | import mysql.connector
import json
with open("config.json") as f:
config = json.load(f)
try:
conn = mysql.connector.connect(
user=config["database_connection"]["username"],
password=config["database_connection"]["password"],
host=config["database_connection"]["host"],
d... | Python | 0.000007 | |
05741f17ffac95d66290d2ec705cbfb66fc74ff9 | Add dummpy documentation/stats/plot_sky_locations.py | documentation/stats/plot_sky_locations.py | documentation/stats/plot_sky_locations.py | from bokeh.plotting import figure, output_file, show
output_file("example.html")
x = [1, 2, 3, 4, 5]
y = [6, 7, 6, 4, 5]
p = figure(title="example", plot_width=300, plot_height=300)
p.line(x, y, line_width=2)
p.circle(x, y, size=10, fill_color="white")
show(p)
| Python | 0 | |
fe4b226b9b3d6fbc7be7d545c185ed7950f3a5fd | Add Python benchmark | lib/node_modules/@stdlib/math/base/dist/beta/logpdf/benchmark/python/benchmark.scipy.py | lib/node_modules/@stdlib/math/base/dist/beta/logpdf/benchmark/python/benchmark.scipy.py | #!/usr/bin/env python
"""Benchmark scipy.stats.beta.logpdf."""
import timeit
name = "beta:logpdf"
repeats = 3
iterations = 1000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark summary.
# Arguments
* `total`:... | Python | 0.000138 | |
c36e390910b62e1ad27066a0be0450c81a6f87c6 | Add context manager for logging | d1_common_python/src/d1_common/logging_context.py | d1_common_python/src/d1_common/logging_context.py | # -*- coding: utf-8 -*-
"""Context manager that enables temporary changes in logging level.
Note: Not created by DataONE.
Source: https://docs.python.org/2/howto/logging-cookbook.html
"""
import logging
import sys
class LoggingContext(object):
def __init__(self, logger, level=None, handler=None, close=True):
s... | Python | 0 | |
4e36e520cb8fef8f07b545a3109e8507789e64bf | add tests, most are still stubbed out | tests/test.py | tests/test.py | import unittest
import urlparse
import sys
import os
import time
from datetime import datetime
FILE_PATH = os.path.dirname(os.path.realpath(__file__))
ROOT_PATH = os.path.abspath(os.path.join(FILE_PATH, '../'))
sys.path.append(ROOT_PATH)
from module.util import JSONTemplate
from module.graphite_utils import GraphSty... | Python | 0 | |
0ab60ca22a41db85632e39065d142f3de081b0b9 | Create thesaurus.py | thesaurus.py | thesaurus.py | """
First, we must develop an API for thesaurus.com, as all the current ones are crap.
When searching a word (ex: "small"), the synonyms are grouped into three
categories, differing in presentation by a change in the background color
of their <span> object.
The categories are as follows:
r... | Python | 0 | |
6c7a927e2fc0a054470c2a87fa98d07e993657ac | Add tests | test/test.py | test/test.py | import os
import unittest
try:
import directio
except ImportError:
import sys
sys.exit("""
Please install directio:
take a look at directio/README""")
class TestDirectio(unittest.TestCase):
def setUp(self):
super(TestDirectio, self).setUp()
flags = os.O_RDWR | os.O_DIRECT |... | Python | 0.000001 | |
45148b72cb69c49b2a6ef6e278f23d63328a7942 | Clean up and docs | testQuery.py | testQuery.py | #!/usr/bin/python
import unittest
import omniture
import sys
import os
import pprint
creds = {}
creds['username'] = os.environ['OMNITURE_USERNAME']
creds['secret'] = os.environ['OMNITURE_SECRET']
class QueryTest(unittest.TestCase):
def setUp(self):
self.analytics = omniture.authenticate(creds['username'... | Python | 0 | |
96a3fc178c9da5a8f917378e40454a0702d746e5 | Initialize construction module | drydock/construction.py | drydock/construction.py | """DryDock container construction."""
def construct(spec):
pass | Python | 0.000001 | |
4c33fe7a927cde83aa53374e9fcaedfa18e51e77 | Add function to delete collection | utilities.py | utilities.py | def delete_collection(ee, id):
if 'users' not in id:
root_path_in_gee = ee.data.getAssetRoots()[0]['id']
id = root_path_in_gee + '/' + id
params = {'id': id}
items_in_collection = ee.data.getList(params)
for item in items_in_collection:
ee.data.deleteAsset(item['id'])
ee.data... | Python | 0 | |
4d9d286ec96e834fcb9acf1f1f52876e81668996 | Test script | tools/test.py | tools/test.py | from fakturo.billingstack.client import Client
client = Client('http://localhost:9090/billingstack', username='ekarlso', password='secret0')
merchants = client.merchant.list()
| Python | 0.000001 | |
fabaea5e9f7b1e78887f91572540412182b8228c | add generic DTW algorithm | pyannote/algorithms/alignment/dtw.py | pyannote/algorithms/alignment/dtw.py | #!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2014 CNRS
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation ... | Python | 0.000002 | |
583b520a6dada6e7a8bf984469fd6d2e9d8eaf28 | add general methods to instruments | pysat/instruments/methods/general.py | pysat/instruments/methods/general.py | # -*- coding: utf-8 -*-
"""Provides generalized routines for integrating instruments into pysat.
"""
from __future__ import absolute_import, division, print_function
import pandas as pds
import pysat
import logging
logger = logging.getLogger(__name__)
def list_files(tag=None, sat_id=None, data_path=None, format_s... | Python | 0.000001 | |
6bf12f844bb67c0e97adab2b3a17f3c02f04259b | fix test runner compatibility with old pythons and weird tests (PY-1976) | python/helpers/pycharm/tcunittest.py | python/helpers/pycharm/tcunittest.py | import traceback, sys
from unittest import TestResult
import datetime
from pycharm.tcmessages import TeamcityServiceMessages
def strclass(cls):
return "%s.%s" % (cls.__module__, cls.__name__)
class TeamcityTestResult(TestResult):
def __init__(self, stream=sys.stdout):
TestResult.__init__(self)
... | import traceback, sys
from unittest import TestResult
import datetime
from pycharm.tcmessages import TeamcityServiceMessages
def strclass(cls):
return "%s.%s" % (cls.__module__, cls.__name__)
class TeamcityTestResult(TestResult):
def __init__(self, stream=sys.stdout):
TestResult.__init__(self)
... | Python | 0 |
79a236133ea00fa1d1af99426380392fe51ec0f4 | Create iis_shortname.py | middileware/iis/iis_shortname.py | middileware/iis/iis_shortname.py | #!/usr/bin/env python
# encoding: utf-8
from t import T
import re
import urllib2,requests,urllib2,json,urlparse
requests.packages.urllib3.disable_warnings()
class P(T):
def __init__(self):
T.__init__(self)
def verify(self,head='',context='',ip='',port='',productname={},keywords='',hackinfo='',verify... | Python | 0.000002 | |
4683bb493358452df35268508e2abdc44d6fd330 | Add UDp decoder | malware/core/decoder.py | malware/core/decoder.py | import dpkt
import socket
import binascii
def hexify(x):
h = binascii.hexlify(x)
tohex = " ".join(h[i:i+2] for i in range(0, len(h), 2))
return tohex
def truncate_dns(x):
return x[36:-12]
def _udp_iterator(pc):
for ts, pkt in pc:
try:
eth = dpkt.ethernet.Ethernet(pkt)
... | Python | 0.000004 | |
50af4f518912f758e7961055342642c9d31832a0 | Create 6-pwm2.py | Code/6-pwm2.py | Code/6-pwm2.py | # CamJam EduKit 3 - Robotics
# Worksheet 6 – Varying the speed of each motor with PWM
import RPi.GPIO as GPIO # Import the GPIO Library
import time # Import the Time library
# Set the GPIO modes
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
# Set variables for the GPIO motor pins
pinMotorAForwards = 10
pinMotorABac... | Python | 0.000013 | |
2d25c2329a9ae4d084671ab99cf53290fe7547ab | add tests for cython script | streams/simulation/tests/test_integrate_lm10.py | streams/simulation/tests/test_integrate_lm10.py | # coding: utf-8
"""
Test the Cython integrate code
"""
from __future__ import absolute_import, unicode_literals, division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os, sys
import glob
import time
# Third-party
import numpy as np
import pytest
import astropy.units as... | Python | 0 | |
af3333906125e9bde3cc5b3ebdb7209c25bcf6ff | Add pinger script | pinger.py | pinger.py | #!/usr/bin/python3
import requests
import datetime
import time
while True:
hour = datetime.datetime.now().hour
if hour > 7:
requests.get('https://biblion.se')
time.sleep(60*29) | Python | 0 | |
e140c21cd0b7d5b0e7cbe7895096476105d03f91 | Create update_sql.py | update_sql.py | update_sql.py | __author__ = 'userme865'
# ver 0.1
import MySQLdb
def update_db():
try: # start msql and creat stable at first time
conn = MySQLdb.connect(host='localhost', user='root', passwd='', port=3306)
cur = conn.cursor()
conn.select_db('python')
cur.execute('DROP TABLE dataexchange')
... | Python | 0.000002 | |
3921f1522851767444644d1dc3c126521476d9dc | add util script to help troll autoplot feature ideas | scripts/util/list_stale_autoplots.py | scripts/util/list_stale_autoplots.py | """Look into which autoplots have not been used in a while"""
import psycopg2
import re
import pandas as pd
QRE = re.compile("q=([0-9]+)")
pgconn = psycopg2.connect(database='mesosite', host='iemdb', user='nobody')
cursor = pgconn.cursor()
cursor.execute("""SELECT valid, appurl from feature WHERE appurl is not null
... | Python | 0 | |
faa6872cf008171afa3db6687d23c1bcc9b6dbac | Add views to the main files | Druid/views.py | Druid/views.py | from django.shortcuts import render
from gfx.models import Material
from django.template import RequestContext
def home( request ):
rc = RequestContext(request)
return render( request, 'Druid/index.html', context_instance=rc ) | Python | 0 | |
fc23860b1adbf7c75dfd53dc213c24a65b455597 | Create ExtractData.py | ExtractData.py | ExtractData.py | Python | 0.000001 | ||
ff3b36b4d64af54b6bd22f107a9d5dd5cf4f4473 | solve problem no.1152 | 1152/answer.py | 1152/answer.py | from sys import stdin
input = stdin.readline().strip()
if input == "":
print(0)
exit()
i = 1
for char in input:
if char == ' ':
i += 1
print(i) | Python | 0.999818 | |
f5706084caca2c6f6235914cb70e79c16438e1a0 | Create OverlappingAMR.py | src/Python/CompositeData/OverlappingAMR.py | src/Python/CompositeData/OverlappingAMR.py | #!/usr/bin/env python
import vtk
def MakeScalars(dims, origin, spacing, scalars):
# Implicit function used to compute scalars
sphere = vtk.vtkSphere()
sphere.SetRadius(3)
sphere.SetCenter(5, 5, 5)
scalars.SetNumberOfTuples(dims[0]*dims[1]*dims[2])
for k in range(0, dims[2]):
z = origin[... | Python | 0 | |
82bfe668b11ac76159f2a599734ba33c4ef57026 | Add another views_graph_service file | portal/views_graph_service.py | portal/views_graph_service.py | from flask import (flash, redirect, render_template, request,
session, url_for)
import requests
from portal import app, datasets
from portal.decorators import authenticated
from portal.utils import get_portal_tokens
@app.route('/graph', methods=['GET', 'POST'])
@authenticated
def graph():
if r... | Python | 0 | |
3684e8be098300006b09c6677a2805e10d623acd | Add GYP file tld_cleanup tool. | net/tools/tld_cleanup/tld_cleanup.gyp | net/tools/tld_cleanup/tld_cleanup.gyp | # Copyright (c) 2009 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.
{
'variables': {
'chromium_code': 1,
},
'includes': [
'../../../build/common.gypi',
],
'targets': [
{
'target_name': 'tld_cle... | Python | 0.000001 | |
5f9c7d10957c7b0b0da46b031120fe2434315d0d | Test of new persistence layer. | ndtable/persistence/simple.py | ndtable/persistence/simple.py | from ndtable.carray import carray, cparams
from bloscpack import pack_list, unpack_file
from numpy import array, frombuffer
def test_simple():
filename = 'output'
# hackish, just experimenting!
arr = carray(xrange(10000)).chunks
ca = [bytes(chunk.viewof) for chunk in arr]
pack_list(ca, {}, filenam... | Python | 0 | |
e6a4863d9663791fabc4bd6ccdf0ab45ba2a86eb | Add standalone benchmark runner | remote_bench.py | remote_bench.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Standalone benchmark runner
"""
import cProfile
import pstats
import profile
import numpy as np
print("Running Rust and Pyproj benchmarks\n")
# calibrate
pr = profile.Profile()
calibration = np.mean([pr.calibrate(100000) for x in xrange(5)])
# add the bias
profile.Pr... | Python | 0.000001 | |
b4042f23d02e77c45d772fe64ae5e98db8b5e4e4 | Add new package: re2 (#18302) | var/spack/repos/builtin/packages/re2/package.py | var/spack/repos/builtin/packages/re2/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Re2(CMakePackage):
"""RE2 is a fast, safe, thread-friendly alternative to backtracking
... | Python | 0.00009 | |
9c0bcd4e0317aa8b76ebbf3c9ecae82d1b90027d | Create initial night sensor code for Pi | night_sensor/night_feature.py | night_sensor/night_feature.py | """
@author: Sze "Ron" Chau
@e-mail: chaus3@wit.edu
@source: https://github.com/wodiesan/sweet-skoomabot
@desc Night sensor-->RPi for Senior Design 1
"""
import logging
import os
import RPi.GPIO as GPIO
import serial
import subprocess
import sys
import time
import traceback
# GPIO pins. Uses the BC... | Python | 0 | |
2aa2400678ac039a448d529b919c44694912ca2e | Add a useful method for hnadling configuration | conveyor/config.py | conveyor/config.py | import errno
import imp
import importlib
import os
import six
class Config(dict):
"""
Works exactly like a dict but provides ways to fill it from files
or special dictionaries. There are two common patterns to populate the
config.
Either you can fill the config from a config file::
app... | Python | 0.000014 | |
83d3f01c9f18c687a0348638431fba24d68db636 | Split components out of PCBBase. | Components.py | Components.py | import numpy as np
from PCBBase import PCBDrawer, PCBFeature
# From https://www.digikey.com/Web%20Export/Supplier%20Content/Vishay_8026/PDF/VishayBeyschlag_SolderPad.pdf?redirected=1
resistorsParams = {
"0102": (0.65, 1.10, 1.40, 2.85),
"0204": (1.50, 1.25, 1.75, 4.00),
"0207": (2.80, 2.20, 2.20, 7.20),
... | Python | 0 | |
b7e1e05bfe5aa7a8d91a4d8ee786e61b4aa7bd1b | Add ArrayQueue | ArrayQueue.py | ArrayQueue.py | class ArrayQueue:
def __init__(self, max=10):
self._data = [None] * max
self._size = 0
self._front = 0
self._max = max
def enqueue(self, e):
self._data[(self._front + self._size) % self._max] = e
self._size += 1
def dequeue(self):
rst, self._data[sel... | Python | 0.000001 | |
898d3ffe027a10ff91c0df66494dbddfcaee41d4 | add expect_column_values_to_be_valid_imei (#4753) | contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_imei.py | contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_imei.py | """
This is a template for creating custom ColumnMapExpectations.
For detailed instructions on how to use it, please see:
https://docs.greatexpectations.io/docs/guides/expectations/creating_custom_expectations/how_to_create_custom_column_map_expectations
"""
import json
from typing import Optional
from stdnum impo... | Python | 0 | |
55b6d19fc8c80e3d4ff7842f20d284879f5ea151 | Create BubbleSort.py | BubbleSort.py | BubbleSort.py | """
冒泡:
原始版本:将i由0开始,与后面每一个j=i+1 进行比较,交换
再i=1 ...这样好不容易换到前面第一位的容易被序列最后一个最小值直接怼到末尾去
现在的更新版:i由0开始
j = length-2 与 j = length-1 进行比较,换位
确保移到上面的较小值不会有太大的变动 -- 见P381 图
"""
def bubble_sort(lists):
count = len(lists)
for i in range(0, count):
for j i... | Python | 0.000001 | |
17966b6af3039aa6d6308e1592c14527513c70c1 | apply oa start date from journals to relative update requests - script | portality/migrate/3053_oa_start_date_from_journals_to_urs/migrate.py | portality/migrate/3053_oa_start_date_from_journals_to_urs/migrate.py | """
This script can be run to generate a CSV output of accounts which do not have their passwords set, along
with some useful account information, and possible explanations for the lack of password
```
python accounts_with_missing_passwords.py -o accounts.csv
```
"""
import csv
import esprit
from portality.core import... | Python | 0 | |
ab50818c18b4275c205419c4c844bfc9ecb7a4c8 | add rename.py | FileUtils/rename.py | FileUtils/rename.py | import os
import sys
import re
dirname, filename = os.path.split(os.path.abspath(sys.argv[0]))
os.chdir(dirname)
fileList = os.listdir(dirname)
print dirname
name='edge_effect_'
for fileItem in fileList:
dotIndex = fileItem.rfind('.')
fileName = fileItem[: dotIndex]
fileExt = fileItem[dotIndex : ]
print fileName,f... | Python | 0.000002 | |
68cc3555c510d835ded5cd9cbffc69129a8f7e64 | Add nrfconnect_firmware_utils.py (#5666) | scripts/flashing/nrfconnect_firmware_utils.py | scripts/flashing/nrfconnect_firmware_utils.py | #!/usr/bin/env python3
# Copyright (c) 2020-2021 Project CHIP 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 app... | Python | 0.000024 | |
dc993796fc15e3670c8a702f43fcb9a5d9b4c84e | Add forgotten file. | astrobin_apps_donations/utils.py | astrobin_apps_donations/utils.py | from subscription.models import UserSubscription
def user_is_donor(user):
if user.is_authenticated:
return UserSubscription.objects.filter(user = user, subscription__name = 'AstroBin Donor').count() > 0
return False
| Python | 0 | |
d459c39e00295664e184d4fcddbb0739ec6c77f2 | Add class for working with .lhe files | test/lheReader.py | test/lheReader.py | import xml.etree.ElementTree as ET
class lheReader(object):
ORIGINAL = 'original'
def __init__(self,fn=None):
self.tree = None
self.root = None
self.events = []
self.lhacode_map = {} # Maps the integer lhacode to the corresponding newcoup string name
self.skip = False... | Python | 0 | |
e51f3869b4a047489b9bb1e4b88af0e0bdc3078b | Add a command to list all the documents. | paper_to_git/commands/list_command.py | paper_to_git/commands/list_command.py | """
List the Documents and Folders
"""
from paper_to_git.commands.base import BaseCommand
from paper_to_git.models import PaperDoc, PaperFolder
__all__ = [
'ListCommand',
]
class ListCommand(BaseCommand):
"""List the PaperDocs and Folders
"""
name = 'list'
def add(self, parser, command_par... | Python | 0 | |
a797de9014a3d466bb10e9bc318c3e2edec328be | add base for rendering widgets | packages/SCIRun/renderbase.py | packages/SCIRun/renderbase.py | from core import system
from core.modules.module_registry import registry
from packages.spreadsheet.basic_widgets import SpreadsheetCell, CellLocation
class Render(SpreadsheetCell):
def compute(self):
pass
def registerRender():
registry.add_module(Render, abstract=True)
| Python | 0 | |
7beed056f9a44e6d99cb632b2ecb34bd6182cf06 | Create GeneratorDB.py | GeneratorDB.py | GeneratorDB.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import csv
import re
from glob import glob
from operator import itemgetter
from multiprocessing import Process
from sys import argv
def get_genomas_locus():
out_csv = open('genomas_locus.csv', 'w')
print('Starting get_genomas_locus')
genomas_locus = [tuple(f... | Python | 0.000001 | |
6a9fae290c8ce1618a7207efe669347b9503e3be | Add missing logparse file. | python/spinn/util/logparse.py | python/spinn/util/logparse.py | """
Really easy log parsing.
"""
try:
from parse import *
except:
pass
import json
FMT_TRAIN = "Train-Format: "
FMT_TRAIN_EXTRA = "Train-Extra-Format: "
FMT_EVAL = "Eval-Format: "
FMT_EVAL_EXTRA = "Eval-Extra-Format: "
IS_TRAIN = "Acc:"
IS_TRAIN_EXTRA = "Train Extra:"
IS_EVAL = "Eval acc:"
IS_EVAL_EXTRA =... | Python | 0 | |
8b1e6b226d925d7f2ef4890463122ec8046aa07a | add test | sensor/test_compass.py | sensor/test_compass.py | #! /usr/bin/python
from Adafruit_LSM303 import LSM303
lsm = LSM303()
while 1:
print lsm.read() | Python | 0.000002 | |
a5dbda3f429d0a1e6cb4fc28b2a620dc2b40fd59 | Resolve import dependency in consoleauth service | nova/cmd/consoleauth.py | nova/cmd/consoleauth.py | # Copyright (c) 2012 OpenStack Foundation
# 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 r... | # Copyright (c) 2012 OpenStack Foundation
# 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 r... | Python | 0.000014 |
23b2578fadd8a7ee0885e9956a10667d647acaf8 | add basic test for bist | test/test_bist.py | test/test_bist.py | #!/usr/bin/env python3
from litex.soc.tools.remote import RemoteClient
wb = RemoteClient(csr_data_width=8)
wb.open()
regs = wb.regs
# # #
test_size = 128*1024*1024
regs.generator_reset.write(1)
regs.generator_reset.write(0)
regs.generator_base.write(0)
regs.generator_length.write((test_size*8)//128)
regs.generator... | Python | 0.00044 | |
f070b3c9a97b16aebc8500af703ed713e170f519 | Fix Dask-on-Ray test: Python 3 dictionary .values() is a view, and is not indexable (#13945) | python/ray/tests/test_dask_scheduler.py | python/ray/tests/test_dask_scheduler.py | import dask
import numpy as np
import dask.array as da
import pytest
import ray
from ray.util.dask import ray_dask_get
def test_ray_dask_basic(ray_start_regular_shared):
@ray.remote
def stringify(x):
return "The answer is {}".format(x)
zero_id = ray.put(0)
def add(x, y):
# Can retri... | import dask
import numpy as np
import dask.array as da
import pytest
import ray
from ray.util.dask import ray_dask_get
def test_ray_dask_basic(ray_start_regular_shared):
@ray.remote
def stringify(x):
return "The answer is {}".format(x)
zero_id = ray.put(0)
def add(x, y):
# Can retri... | Python | 0.000001 |
8e91c1fa76382f3b2568c425b41339f5597f9268 | Add bound and brake solver (initial raw implementation) | solvers/BoundAndBrake.py | solvers/BoundAndBrake.py | #!/usr/bin/env python
# encoding: utf-8
from collections import deque
from copy import deepcopy
from itertools import permutations
from random import shuffle
from base_solver import BaseSolver
INF = float('inf')
class PartialSolution(object):
lower_bound = INF
upper_bound = INF
partial_route = []
... | Python | 0 | |
5e008ac92016a092c1ce9c9590a79d72f4cf1cf6 | Initialize tests | tests/__main__.py | tests/__main__.py | import unittest
if __name__ == '__main__':
unittest.main()
| Python | 0.000001 | |
0e3effc3a7402d3b4c1b2c91539c4d1004c5b0e3 | Add test_traitscli.py | test_traitscli.py | test_traitscli.py | import unittest
from traits.api import Event, Callable, Type
from traitscli import TraitsCLIBase
from sample import SampleCLI
class TestingCLIBase(TraitsCLIBase):
def do_run(self):
# Get trait attribute names
names = self.class_trait_names(
# Avoid 'trait_added' and 'trait_modified'... | Python | 0.000004 | |
31622652980f603ddc308dff514eae65635eb318 | Add serializers to serialize Image to: - A PIL image (optionally resized) - A binary object (optionally resized) | app/grandchallenge/retina_api/serializers.py | app/grandchallenge/retina_api/serializers.py | from io import BytesIO
import SimpleITK as sitk
from PIL import Image as PILImage
from django.http import Http404
from rest_framework import serializers
class PILImageSerializer(serializers.BaseSerializer):
"""
Read-only serializer that returns a PIL image from a Image instance.
If "width" and "height" ... | Python | 0.000002 | |
101a4c1288ddadbad6dbe0186adde3921ef2546f | add ctrl-c handler | lib/ctrlc.py | lib/ctrlc.py | import sys
import time
import signal
class CtrlC:
pressed = False
@classmethod
def handle(cls, signal, frame):
print('Ctrl-C pressed, will exit soon')
if cls.pressed:
print('Ctrl-C pressed twice. Committing violent suicide.')
sys.exit(1)
cls.pressed = True
... | Python | 0.000036 | |
1298cf9c7a40ce73d46067035ded2318c62f7380 | Add simple tests for DrsSymbol and DrsIndexed | tests/drs_test.py | tests/drs_test.py | """Tests for drudge scripts."""
from sympy import Symbol, IndexedBase
from drudge.drs import DrsSymbol
from drudge.utils import sympy_key
#
# Unit tests for the utility classes and functions
# ------------------------------------------------
#
def test_basic_drs_symb():
"""Test the symbol class for basic oper... | Python | 0 | |
a412295b09481113d6f42565520d03ce8bfd36b8 | Create ECIScraper.py | ECIScraper.py | ECIScraper.py | from bs4 import BeautifulSoup as bs
import httplib
class ECIScrapper:
def __init__(self, url):
self.url = url.split("/")[0]
self.getrequest = '/'.join(url.split('/')[1:])
print self.url, self.getrequest
self.connection = httplib.HTTPConnection(self.url)
self.connection.request("GET", '/'+self.getrequest)
... | Python | 0 | |
67018fa6dc38f0035b1ce17dee4a7840f37cab30 | Move documentation to Sphinx/RST | doc/conf.py | doc/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# libslax documentation build configuration file, created by
# sphinx-quickstart on Tue Oct 10 10:18:55 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# au... | Python | 0 | |
1753de3492b76d9c13d72bde7f13c0f696499e3a | Add configuration of pytest with some fixtures related to tests based on fantasy example | tests/conftest.py | tests/conftest.py | import json
import socket
import uuid
import docker as libdocker
import pathlib
import invoke
import psycopg2
import pytest
import time
from jsonschema import Draft4Validator
DSN_FORMAT = 'postgresql://{user}:{password}@{host}:{port}/{dbname}'
@pytest.fixture(scope='session')
def session_id():
return str(uuid.... | Python | 0 | |
82617f295ed21c179bab6ad3c3c2af5c417f40ba | Install pandas and scipy from Anaconda as part of upgrade process. Provides final installation fix for burden testing code. #167 #191 | gemini/gemini_update.py | gemini/gemini_update.py | """Perform in-place updates of gemini and databases when installed into virtualenv.
"""
import os
import subprocess
import sys
import gemini.config
def release(parser, args):
"""Update gemini to the latest release, along with associated data files.
"""
url = "https://raw.github.com/arq5x/gemini/master/req... | """Perform in-place updates of gemini and databases when installed into virtualenv.
"""
import os
import subprocess
import sys
import gemini.config
def release(parser, args):
"""Update gemini to the latest release, along with associated data files.
"""
url = "https://raw.github.com/arq5x/gemini/master/req... | Python | 0 |
7925c0a4536a221adc5c76eaccc0a1c79c9a7efa | Add bower module | lib/ansible/modules/extras/packaging/bower.py | lib/ansible/modules/extras/packaging/bower.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Michael Warkentin <mwarkentin@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of ... | Python | 0 | |
7259a1ea9f0d32249e96581ecc78bcdd81197f2e | add maxmind-importer (#3) | Ip-maxmind.py | Ip-maxmind.py | import base64
import codecs
from collections import namedtuple
import csv
import os
import io
import sys
import zipfile
import requests
import iptools
IP_VERSION = {'ipv4': 'IPv4', 'ipv6': 'IPv6'}
# Include or Exclude
ei_action = None
def error(text):
sys.stderr.write(text + "\n")
exit()
archive = requests... | Python | 0 | |
41553e2c2a9ad7f2396e8492ce11d053c2fe5c7a | Add a console application template | basic/template.py | basic/template.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
A template for writing Python application with MIT license.
Latest version can be found at https://github.com/letuananh/pydemo
References:
Python documentation:
https://docs.python.org/
argparse module:
https://docs.python.org/2/howto/argparse.html
PEP 257 - P... | Python | 0.000001 | |
f69de6e6cf63f9b3770ffdf4da32ca2149006a2e | add fit test for record, test is renamed so nose doesn't run it | scipy/stats/tests/test_fit.py | scipy/stats/tests/test_fit.py | # NOTE: contains only one test, _est_cont_fit, that is renamed so that
# nose doesn't run it
# I put this here for the record and for the case when someone wants to
# verify the quality of fit
# with current parameters:
import numpy.testing as npt
import numpy as np
from scipy import stats
from t... | Python | 0.000002 | |
6908f6cb06ed1d15510bc51780d4109f5bdb7423 | Add cs2cs_test.py to excercise the cs2cs binary via subprocess | python/third_party/proj/cs2cs_test.py | python/third_party/proj/cs2cs_test.py | # Copyright 2018 Google Inc. 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 applicable law or a... | Python | 0 | |
7c8650881879a2c60585b52d3154592621edbf52 | add rapdis | qm/grover3d/rapids/compute-grover3.py | qm/grover3d/rapids/compute-grover3.py | import cudf
iters=20
init=[1,0,1,0,-1,0,-1,0,1,0,1,0]
size=100
maxn = size*size*size
# vertices
n=range(maxn)
v=[]
for d in range(0,12):
v.append([0]*maxn)
center=int(maxn/2)
v[0][center]=init[0]
v[1][center]=init[1]
v[2][center]=init[2]
v[3][center]=init[3]
v[4][center]=init[4]
v[5][center]=init[5]
v[6][cen... | Python | 0.99997 | |
a911d8720ad7dd8bfff2fa4230e1a4cef1a232f5 | add logistic | logRegres.py | logRegres.py | '''
Created on Oct 27, 2015
Logistic Regression Working Module
@author: Gu
'''
from numpy import *
def loadDataSet():
dataMat = []; labelMat = []
fr = open('testSet.txt')
for line in fr.readlines():
lineArr = line.strip().split()
dataMat.append([1.0, float(lineArr[0]), float(lineArr[1])])
... | Python | 0.999956 | |
cbb41df3d458b22121eb044f06763fd6d1ed8120 | Working, outputs multiple passwords | passwordy.py | passwordy.py | import random
import string
import sys
# Better way for lots of imports other than import * ?
from PyQt5 import QtCore, QtGui
from PyQt5.QtGui import QBrush, QIcon, QPalette, QPixmap
from PyQt5.QtWidgets import QApplication, QCheckBox, QComboBox, QDesktopWidget, QGridLayout, QInputDialog, QLabel, QLineEdit, QMessageBo... | Python | 0.999794 | |
7720fbc1d8a81430c38598fd96b95d8b4da4a74c | fix a bug about can not import ChineseAnalyzer with change tab to 4 wihte spaces under PEP8 | jieba/analyse/__init__.py | jieba/analyse/__init__.py | import jieba
import os
try:
from analyzer import ChineseAnalyzer
except ImportError:
pass
_curpath=os.path.normpath( os.path.join( os.getcwd(), os.path.dirname(__file__) ) )
f_name = os.path.join(_curpath,"idf.txt")
content = open(f_name,'rb').read().decode('utf-8')
idf_freq = {}
lines = content.split('\n')
... | import jieba
import os
try:
from analyzer import ChineseAnalyzer
except ImportError:
pass
_curpath=os.path.normpath( os.path.join( os.getcwd(), os.path.dirname(__file__) ) )
f_name = os.path.join(_curpath,"idf.txt")
content = open(f_name,'rb').read().decode('utf-8')
idf_freq = {}
lines = content.split('\n')
for li... | Python | 0 |
ec96ce58076ba5aa54abeb423937a629cbe1e3d5 | Work in progress | logparser.py | logparser.py | #!/usr/bin/python
""" Log parser. """
from HTMLParser import HTMLParser
import urllib
class DailyParser(HTMLParser):
"""
HTML parser for the donations log of Wikimedia France
Attributes:
status (int): status variable of the parser.
donations (list data.Donation): list of donations read.
... | Python | 0.000003 | |
162b82b64d319e0c854c08b3bd2e412ab5e67d97 | add pytables testing file | blaze/compute/tests/test_pytables_compute.py | blaze/compute/tests/test_pytables_compute.py | from __future__ import absolute_import, division, print_function
import pytest
tables = pytest.importorskip('tables')
import numpy as np
import tempfile
from contextlib import contextmanager
import os
from blaze.compute.core import compute
from blaze.compute.pytables import *
from blaze.compute.numpy import *
from b... | Python | 0 | |
67df732067847af15e41b8eed05137b6ab2bb6d2 | add __version__ (forgot to commit) | libcutadapt/__init__.py | libcutadapt/__init__.py | __version__ = '0.9.2'
| Python | 0.000001 | |
188d583caea0e640f41e400839552fe593154eda | Set 2, challenge 9 completed. | set2/crypto9.py | set2/crypto9.py | #!/usr/local/bin/python
__author__ = 'Walshman23'
import sys
sys.path.insert(1, "../common") # Want to locate modules in our 'common' directory
# A block cipher transforms a fixed-sized block (usually 8 or 16 bytes) of plaintext into ciphertext.
# But we almost never want to transform a single block; we encrypt irr... | Python | 0 | |
ed33a8dc90468f2873a4a581c22027f10d9393d4 | Add Wordpress_2_Instances testcase | heat/tests/functional/test_WordPress_2_Intances.py | heat/tests/functional/test_WordPress_2_Intances.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# 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 applicabl... | Python | 0 | |
fb7bc8af34f3ed375d30b43655366e6368080e76 | Create Import_Libraries.py | home/INMOOV/Config/ExtraConfig/Import_Libraries.py | home/INMOOV/Config/ExtraConfig/Import_Libraries.py | from java.lang import String
from org.myrobotlab.net import BareBonesBrowserLaunch
from datetime import datetime
from subprocess import Popen, PIPE
#######################
import threading
import time
import random
import urllib, urllib2
import json
import io
import itertools
import textwrap
import codecs
import socket... | Python | 0 | |
4de971725601ed5f630ec103ad01cf5c624ad866 | Add the occupancy sensor_class (#3176) | homeassistant/components/binary_sensor/__init__.py | homeassistant/components/binary_sensor/__init__.py | """
Component to interface with binary sensors.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/binary_sensor/
"""
import logging
import voluptuous as vol
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.ent... | """
Component to interface with binary sensors.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/binary_sensor/
"""
import logging
import voluptuous as vol
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.ent... | Python | 0.000009 |
6f0b5a0dc44269d9e72f3698317604d90d6cecf3 | add script for migrate user mailchimp | scripts/fix_user_mailchimp.py | scripts/fix_user_mailchimp.py | import logging
import sys
from datetime import datetime
from django.db import transaction
from django.utils import timezone
from website.app import setup_django
setup_django()
from osf.models import OSFUser
from scripts import utils as script_utils
from website.mailchimp_utils import subscribe_mailchimp
from website ... | Python | 0 | |
9571acd941cb7ecac96676ead87c43fadda3e74f | Create TimeUpload.py | TimeUpload.py | TimeUpload.py | from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
import time
import csv
timeID='0B9ffTjUEqeFEZ28zdTRhMlJlY0k'
for i in range(10):
#get the curret time
date_time=time.asctime()
date_time_split=date_time.split(' ') #gives a list with the date and time components
time_only=date_time_... | Python | 0 | |
7c6bbe3860e7cce0f464dc0d95683de3c5ca57a5 | Add test of `ResNet50FeatureProducer()` | testci/test_resnet50_feature.py | testci/test_resnet50_feature.py | from PIL import Image
import collections
import datetime
import numpy as np
import pytest
from pelops.features.resnet50 import ResNet50FeatureProducer
@pytest.fixture
def img_data():
DATA = [[[ 0, 0, 0],
[255, 255, 255],
[ 0, 0, 0]],
[[255, 255, 255],
... | Python | 0 | |
d8a3f92a06971ba6fe24f71914a466ff91f00f5f | Create WikiBot3.5.py | WikiBot3.5.py | WikiBot3.5.py | import discord
import wikipedia
token = "Mjg3NjU2MjM1MjU0NDE1MzYx.C-5xKQ.khJ9dPouM9783FMA0Ht-92XkS6A"
language = "en"
client = discord.Client()
@client.event
async def on_ready():
print("Bot is ready")
print(client.user.name)
print(client.user.id)
@client.event
async def on_server_join(server):
a... | Python | 0 | |
3ef6866b39601dfafa10895a69c5d348a77ded3e | add test for eject and eject_all | mpf/tests/test_BallDevice_SmartVirtual.py | mpf/tests/test_BallDevice_SmartVirtual.py | from mpf.tests.MpfTestCase import MpfTestCase
class TestBallDeviceSmartVirtual(MpfTestCase):
def getConfigFile(self):
return 'test_ball_device.yaml'
def getMachinePath(self):
return 'tests/machine_files/ball_device/'
def get_platform(self):
return 'smart_virtual'
def test_ej... | Python | 0 | |
104fcfc4eed7f3233d329602283093c7f86484c3 | add development server | server.py | server.py | from http.server import HTTPServer, BaseHTTPRequestHandler
class StaticServer(BaseHTTPRequestHandler):
def do_GET(self):
root = 'html'
#print(self.path)
if self.path == '/':
filename = root + '/index.html'
else:
filename = root + self.path
self.send... | Python | 0 | |
e88ba0984f3e6045b407342fa7231887142380e2 | Add migration to create roles | corehq/apps/accounting/migrations/0031_create_report_builder_roles.py | corehq/apps/accounting/migrations/0031_create_report_builder_roles.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from corehq.apps.hqadmin.management.commands.cchq_prbac_bootstrap import cchq_prbac_bootstrap
from corehq.sql_db.operations import HqRunPython
class Migration(migrations.Migration):
dependencies = [
(... | Python | 0.000001 | |
df34c1a07fa6029efbd4df41cbd2009ac5031aca | Create matrixAlg.py | matrixAlg.py | matrixAlg.py | #!/usr/bin/python
#####################################
# Written by Gavin Heverly-Coulson
# Email: gavin <at> quantumgeranium.com
#####################################
# A set of matrix algebra functions for performing
# basic matrix algebra operations.
#
# Tested with Python 2.6/2.7
#
# This work is licensed under a... | Python | 0.000013 | |
7b7ec9cdd1f0ed213608a5c309702e49e44b36e2 | Add simple test. | tests/integration/test_smoke.py | tests/integration/test_smoke.py | from django.test import TestCase
URLS_PUBLIC = [
"/",
]
class SimpleTests(TestCase):
def test_urls(self):
for url in URLS_PUBLIC:
res = self.client.get(url)
self.assertEqual(res.status_code, 200)
| Python | 0.000001 | |
c44001ec697faf7552764f91e52fa927056b1538 | Add solution for porblem 31 | euler031.py | euler031.py | #!/usr/bin/python
LIMIT = 200
coins = [1, 2, 5, 10, 20, 50, 100, 200]
def rec_count(total, step):
if total == LIMIT:
return 1
if total > LIMIT:
return 0
c = 0
for x in coins:
if x < step:
continue
c += rec_count(total + x, x)
return c
count = 0
for x i... | Python | 0.000001 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.