commit stringlengths 40 40 | subject stringlengths 1 3.25k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | old_contents stringlengths 0 26.3k | lang stringclasses 3
values | proba float64 0 1 | diff stringlengths 0 7.82k |
|---|---|---|---|---|---|---|---|
5314f764dcfc62b3ec3fd29fdd86ae08dddfe08d | fix typo | main.py | main.py | import sys
from time import ctime
from tweepy import API
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
from credentials import *
from tweepy.utils import import_simplejson
import markovify
import random
import argparse
json = import_simplejson()
class Listener(... | Python | 0.999991 | @@ -1044,17 +1044,16 @@
print('
-'
%25s: Twee
@@ -1057,17 +1057,16 @@
weeted:'
-'
%25 (ctim
|
c99bee3628e55873e5bb9b6e98fd0455b6b45c64 | add examples for recipe 1.14 | code/ch_1-DATA_STRUCTURES_AND_ALGORITHMS/14-sorting_objects_without_native_comparison_support/main.py | code/ch_1-DATA_STRUCTURES_AND_ALGORITHMS/14-sorting_objects_without_native_comparison_support/main.py | Python | 0 | @@ -0,0 +1,551 @@
+def example_1():%0A class User:%0A def __init__(self, user_id):%0A self.user_id = user_id%0A def __repr__(self):%0A return 'User(%7B%7D)'.format(self.user_id)%0A%0A users = %5BUser(23), User(3), User(99)%5D%0A print(users)%0A print(sorted(users, key = l... | |
836d4ed6a3ddda4d381345a34358714db74af757 | Add an helper push program | share/examples/push.py | share/examples/push.py | Python | 0.000001 | @@ -0,0 +1,526 @@
+import sys%0Aimport zmq%0Afrom zmq.utils.strtypes import b%0A%0Adef main():%0A # Get the arguments%0A if len(sys.argv) != 4:%0A print(%22Usage: push.py url topic num_messages%22)%0A sys.exit(1)%0A%0A url = sys.argv%5B1%5D%0A topic = sys.argv%5B2%5D%0A num_messages = int(s... | |
a4924a6928facdda942844b1bac8f0a53eb9ff4b | add 1 OPP file: slots | use_slots.py | use_slots.py | Python | 0 | @@ -0,0 +1,324 @@
+#!/user/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0Aclass Student(object):%0A _slots_ = ('name', 'age')%0A%0A%0Aclass GraduateStudent(Student):%0A pass%0A%0A%0As = Student()%0As.name = 'Michael'%0As.age = 15%0Atry:%0A s.score = 88%0Aexcept AttributeError as e:%0A print('AttributeError:... | |
b6b2f268693764deb70553b00904af4aa6def15f | add lamp_genie.py - aladin 오프라인 매장을 검색해서 키워드의 책 ISBN번호를 알려준다. | lamp_genie.py | lamp_genie.py | Python | 0 | @@ -0,0 +1,1363 @@
+#-*- coding: utf-8 -*-%0Aimport requests%0Aimport BeautifulSoup%0Aimport sys%0Areload(sys)%0Asys.setdefaultencoding('utf-8')%0A%0Amobile_site_url = %22http://www.aladin.co.kr%22%0Asearch_url = %22http://off.aladin.co.kr/usedstore/wsearchresult.aspx?SearchWord=%25s&x=0&y=0%22%0Abook_url = %22http://o... | |
de4e54e1de5905600d539df781994612f03e0672 | Add files via upload | matrix.py | matrix.py | Python | 0 | @@ -0,0 +1,1120 @@
+import numpy as np%0A%0Adef parse_to_matrix(input_file_path, div = '%5Ct', data_type = int):%0A%09input_file = open(input_file_path, 'r')%0A%09matrix = %5B map(data_type,line.strip().split('%25s' %25 div)) for line in input_file if line.strip() != %22%22 %5D%0A%09input_file.close()%0A%09return np.ar... | |
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... | Python | 0.000001 | @@ -1203,269 +1203,8 @@
))%0A%0A
- if num_valid_configs != len(configs) :%0A log.error('%7B%7D out of %7B%7D configs failed!'.format(len(configs) - num_valid_configs, len(configs)))%0A return False%0A else :%0A log.colored(log.GREEN, '%7B%7D configs built'.format(num_valid_configs))%0A
... |
0118316df964c09198747255f9f3339ed736066d | Create test.py | test/test.py | test/test.py | Python | 0.000005 | @@ -0,0 +1,189 @@
+# TweetPy%0A# Test%0A%0Aimport unittest%0Aimport tweet%0A%0Aclass SampleTestClass(unittest.TestCase):%0A%0A def sampleTest(self):%0A #do something%0A a = 1%0A%0Aif __name__ == '__main__':%0A unittest.main()%0A
| |
ba180a1798296346116a7c11557ddbe4aa40da8b | Solving p20 | p020.py | p020.py | Python | 0.999485 | @@ -0,0 +1,55 @@
+sum(%5Bint(digit) for digit in str(math.factorial(100))%5D)
| |
1e96ec2104e6e30af3bcf7c9dd61bd8f157b7519 | Solving p028 | p028.py | p028.py | Python | 0.999362 | @@ -0,0 +1,314 @@
+def spiral_corners(size):%0A yield 1%0A for x in range(3, size+1, 2):%0A base_corner = x**2%0A corner_diff = x-1%0A for corner in (3,2,1,0):%0A yield base_corner-corner_diff*corner%0A%0Adef solve_p026():%0A return sum(spiral_corners(1001))%0A%0Aif __name__ == ... | |
fa4b01102d1226ccc3dcf58119053bbc8839c36e | add ex42 | lpthw/ex42.py | lpthw/ex42.py | Python | 0.998437 | @@ -0,0 +1,1108 @@
+#!/usr/bin/env python%0A%0A# Exercise 42: Is-A, Has-A, Objects, and Classes%0A%0A## Animal is-a object (yes, sort of confusing) look at the extra credit%0Aclass Animal(object):%0A pass%0A%0A## ??%0Aclass Dog(Animal):%0A%0A def __init__(self, name):%0A ## ??%0A self.name = name%0A... | |
1c230f224a34cf34a9d841fa79a092632c47c404 | Fix record_wpr.py against against an issue of --interactive. | tools/telemetry/telemetry/page/record_wpr.py | tools/telemetry/telemetry/page/record_wpr.py | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import logging
import os
import sys
import tempfile
import time
import urlparse
from telemetry import test
from telemet... | Python | 0.000055 | @@ -1349,32 +1349,41 @@
ionsForPage(page
+, options
):%0A for act
@@ -2438,27 +2438,36 @@
ForPage(page
+, options
):%0A
-
if sho
@@ -2641,24 +2641,33 @@
e(self, page
+, options
):%0A actio
@@ -2775,16 +2775,68 @@
ontinue%0A
+ interactive = options and options.interactive%0A
ac
@@ -2885... |
94bc0d6596aba987943bf40e2289f34240081713 | Add lc0041_first_missing_positive.py | lc0041_first_missing_positive.py | lc0041_first_missing_positive.py | Python | 0.998416 | @@ -0,0 +1,600 @@
+%22%22%22Leetcode 41. First Missing Positive%0AHard%0A%0AURL: https://leetcode.com/problems/first-missing-positive/%0A%0AGiven an unsorted integer array, find the smallest missing positive integer.%0A%0AExample 1:%0AInput: %5B1,2,0%5D%0AOutput: 3%0A%0AExample 2:%0AInput: %5B3,4,-1,1%5D%0AOutput: 2%0A... | |
1aba0e5ba6aa91c2aa608c2c94411c59e4a3eca5 | Create stack_plot.py | stack_plot.py | stack_plot.py | Python | 0.000081 | @@ -0,0 +1,1382 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0AIncludes a function for visualization of data with a stack plot.%0A%22%22%22%0Afrom matplotlib import pyplot as plt%0Afrom matplotlib import ticker%0Aimport random%0A%0Adef stack(number_of_topics, TopicTitles, X, Y):%0A %22%22%22Creates a stack plot for the n... | |
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 | Python | 0 | @@ -0,0 +1,788 @@
+# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass PySphinxcontribQthelp(PythonPackage):%0A %22%22%22sphinx... | |
6b5587fc7856b5d03b3605e1a31234ff98df88e2 | add L3 quiz - Expressions | lesson3/quizExpressions/unit_tests.py | lesson3/quizExpressions/unit_tests.py | Python | 0.000001 | @@ -0,0 +1,2472 @@
+import re%0A%0Ais_correct = False%0A%0Abrace_regex = %22%7B%7B.*%7D%7D%22%0Acolor_regex = %22(?:brick.)?color%22%0Asize_regex = %22(?:brick.)?size%22%0Aprice_regex = %22(?:brick.)?price%22%0A%0Aheading = widget_inputs%5B%22text1%22%5D%0Abrick_color = widget_inputs%5B%22text2%22%5D%0Abrick_size = wid... | |
4731e99882d035a59555e5352311d00c4e122f09 | Print useful information about a GTFS feed | onestop/info.py | onestop/info.py | Python | 0 | @@ -0,0 +1,731 @@
+%22%22%22Provide useful information about a GTFS file.%22%22%22%0Aimport argparse%0A%0Aimport geohash%0Aimport gtfs%0A%0Aif __name__ == %22__main__%22:%0A parser = argparse.ArgumentParser(description='GTFS Information')%0A parser.add_argument('filename', help='GTFS File')%0A parser.add_argument('-... | |
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... | Python | 0.999201 | @@ -614,32 +614,190 @@
_log')%0A try:%0A
+ headers = %7B'User-Agent': %22Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36%22%7D%0A%0A
page = r
@@ -811,16 +811,33 @@
.get(url
+, headers=headers
)%0A
@@ -1418,9 +1418,8 @@
... |
dddf634f8445fac66aa25265c7f7e859dab4c000 | add test file for python | test/test.py | test/test.py | Python | 0.000001 | @@ -0,0 +1,160 @@
+# Highlighter Demo%0A%0Aclass Person:%0A def __init__(self, x):%0A self.x = x%0A def show(self):%0A print(self.x)%0A%0Aperson = Person(%22Ken%22)%0Aperson.show()%0A
| |
abcbe6443492ba2f011dec0132a0afb3b8cc9b0b | Create __init__.py | hello-world/__init__.py | hello-world/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
8d36c444fe379b5901692485c2850e86ed714f89 | Add sql connection tester | sql_connection_test.py | sql_connection_test.py | Python | 0.000007 | @@ -0,0 +1,566 @@
+import mysql.connector%0Aimport json%0A%0Awith open(%22config.json%22) as f:%0A config = json.load(f)%0A%0Atry:%0A conn = mysql.connector.connect(%0A user=config%5B%22database_connection%22%5D%5B%22username%22%5D,%0A password=config%5B%22database_connection%22%5D%5B%22password... | |
05741f17ffac95d66290d2ec705cbfb66fc74ff9 | Add dummpy documentation/stats/plot_sky_locations.py | documentation/stats/plot_sky_locations.py | documentation/stats/plot_sky_locations.py | Python | 0 | @@ -0,0 +1,265 @@
+from bokeh.plotting import figure, output_file, show%0A%0Aoutput_file(%22example.html%22)%0A%0Ax = %5B1, 2, 3, 4, 5%5D%0Ay = %5B6, 7, 6, 4, 5%5D%0A%0Ap = figure(title=%22example%22, plot_width=300, plot_height=300)%0Ap.line(x, y, line_width=2)%0Ap.circle(x, y, size=10, fill_color=%22white%22)%0A%0Ash... | |
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 | Python | 0.000138 | @@ -0,0 +1,1566 @@
+#!/usr/bin/env python%0A%22%22%22Benchmark scipy.stats.beta.logpdf.%22%22%22%0A%0Aimport timeit%0A%0Aname = %22beta:logpdf%22%0Arepeats = 3%0Aiterations = 1000%0A%0A%0Adef print_version():%0A %22%22%22Print the TAP version.%22%22%22%0A%0A print(%22TAP version 13%22)%0A%0A%0Adef print_summary(t... | |
c36e390910b62e1ad27066a0be0450c81a6f87c6 | Add context manager for logging | d1_common_python/src/d1_common/logging_context.py | d1_common_python/src/d1_common/logging_context.py | Python | 0 | @@ -0,0 +1,911 @@
+# -*- coding: utf-8 -*-%0A%0A%22%22%22Context manager that enables temporary changes in logging level.%0ANote: Not created by DataONE.%0ASource: https://docs.python.org/2/howto/logging-cookbook.html%0A%22%22%22%0Aimport logging%0Aimport sys%0A%0A%0Aclass LoggingContext(object):%0A def __init__(self,... | |
6c7a927e2fc0a054470c2a87fa98d07e993657ac | Add tests | test/test.py | test/test.py | Python | 0.000001 | @@ -0,0 +1,1347 @@
+import os%0Aimport unittest%0A%0Atry:%0A import directio%0Aexcept ImportError:%0A import sys%0A sys.exit(%22%22%22%0A Please install directio:%0A take a look at directio/README%22%22%22)%0A%0A%0Aclass TestDirectio(unittest.TestCase):%0A%0A def setUp(self):%0A super(TestDir... | |
96a3fc178c9da5a8f917378e40454a0702d746e5 | Initialize construction module | drydock/construction.py | drydock/construction.py | Python | 0.000001 | @@ -0,0 +1,69 @@
+%22%22%22DryDock container construction.%22%22%22%0A%0A%0Adef construct(spec):%0A pass
| |
4c33fe7a927cde83aa53374e9fcaedfa18e51e77 | Add function to delete collection | utilities.py | utilities.py | Python | 0 | @@ -0,0 +1,336 @@
+def delete_collection(ee, id):%0A if 'users' not in id:%0A root_path_in_gee = ee.data.getAssetRoots()%5B0%5D%5B'id'%5D%0A id = root_path_in_gee + '/' + id%0A params = %7B'id': id%7D%0A items_in_collection = ee.data.getList(params)%0A for item in items_in_collection:%0A ... | |
4d9d286ec96e834fcb9acf1f1f52876e81668996 | Test script | tools/test.py | tools/test.py | Python | 0.000001 | @@ -0,0 +1,178 @@
+from fakturo.billingstack.client import Client%0A%0A%0Aclient = Client('http://localhost:9090/billingstack', username='ekarlso', password='secret0')%0Amerchants = client.merchant.list()%0A
| |
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)
... | Python | 0 | @@ -645,35 +645,127 @@
-return test._testMethodName
+if hasattr(test, '_testMethodName'):%0A return test._testMethodName%0A else:%0A return str(test)
%0A%0A
|
79a236133ea00fa1d1af99426380392fe51ec0f4 | Create iis_shortname.py | middileware/iis/iis_shortname.py | middileware/iis/iis_shortname.py | Python | 0.000002 | @@ -0,0 +1,1608 @@
+#!/usr/bin/env python%0A# encoding: utf-8%0Afrom t import T%0Aimport re%0Aimport urllib2,requests,urllib2,json,urlparse%0Arequests.packages.urllib3.disable_warnings()%0A%0A%0A%0A%0Aclass P(T):%0A def __init__(self):%0A T.__init__(self)%0A def verify(self,head='',context='',ip='',port=''... | |
b6ee9b5d7ece1f68e5278d62f11258d0ba6491c5 | Fix required language argument in cli | subliminal/cli.py | subliminal/cli.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import argparse
import datetime
import logging
import os
import re
import sys
import babelfish
import guessit
import pkg_resources
from subliminal import (__version__, PROVIDERS_ENTRY_POINT, cache_region, Video, Episode, Movie, scan_videos,... | Python | 0.000164 | @@ -582,32 +582,47 @@
ges', nargs='+',
+ required=True,
metavar='LANGUA
|
50af4f518912f758e7961055342642c9d31832a0 | Create 6-pwm2.py | Code/6-pwm2.py | Code/6-pwm2.py | Python | 0.000013 | @@ -0,0 +1,2668 @@
+# CamJam EduKit 3 - Robotics%0A# Worksheet 6 %E2%80%93 Varying the speed of each motor with PWM%0A%0Aimport RPi.GPIO as GPIO # Import the GPIO Library%0Aimport time # Import the Time library%0A%0A# Set the GPIO modes%0AGPIO.setmode(GPIO.BCM)%0AGPIO.setwarnings(False)%0A%0A# Set variables for the GPI... | |
2d25c2329a9ae4d084671ab99cf53290fe7547ab | add tests for cython script | streams/simulation/tests/test_integrate_lm10.py | streams/simulation/tests/test_integrate_lm10.py | Python | 0 | @@ -0,0 +1,1471 @@
+# coding: utf-8%0A%22%22%22%0A Test the Cython integrate code%0A%22%22%22%0A%0Afrom __future__ import absolute_import, unicode_literals, division, print_function%0A%0A__author__ = %22adrn %3Cadrn@astro.columbia.edu%3E%22%0A%0A# Standard library%0Aimport os, sys%0Aimport glob%0Aimport time%0A%0A# ... | |
af3333906125e9bde3cc5b3ebdb7209c25bcf6ff | Add pinger script | pinger.py | pinger.py | Python | 0 | @@ -0,0 +1,197 @@
+#!/usr/bin/python3%0Aimport requests%0Aimport datetime%0Aimport time%0A%0Awhile True:%0A hour = datetime.datetime.now().hour%0A if hour %3E 7:%0A requests.get('https://biblion.se')%0A time.sleep(60*29)
| |
e140c21cd0b7d5b0e7cbe7895096476105d03f91 | Create update_sql.py | update_sql.py | update_sql.py | Python | 0.000002 | @@ -0,0 +1,861 @@
+__author__ = 'userme865'%0A# ver 0.1%0A%0Aimport MySQLdb%0Adef update_db():%0A try: # start msql and creat stable at first time%0A conn = MySQLdb.connect(host='localhost', user='root', passwd='', port=3306)%0A cur = conn.cursor()%0A conn.select_db('python')%0A cur.exec... | |
3921f1522851767444644d1dc3c126521476d9dc | add util script to help troll autoplot feature ideas | scripts/util/list_stale_autoplots.py | scripts/util/list_stale_autoplots.py | Python | 0 | @@ -0,0 +1,854 @@
+%22%22%22Look into which autoplots have not been used in a while%22%22%22%0Aimport psycopg2%0Aimport re%0Aimport pandas as pd%0A%0AQRE = re.compile(%22q=(%5B0-9%5D+)%22)%0A%0Apgconn = psycopg2.connect(database='mesosite', host='iemdb', user='nobody')%0Acursor = pgconn.cursor()%0A%0Acursor.execute(%22... | |
faa6872cf008171afa3db6687d23c1bcc9b6dbac | Add views to the main files | Druid/views.py | Druid/views.py | Python | 0 | @@ -0,0 +1,229 @@
+from django.shortcuts import render%0Afrom gfx.models import Material%0Afrom django.template import RequestContext%0A%0Adef home( request ):%0A%09rc = RequestContext(request)%0A%09return render( request, 'Druid/index.html', context_instance=rc )
| |
bad89393891761334e37b611856449ede3a99470 | Fix typo blocking access to exmachina, and report the problem if unable to load the exmachina client library. | plinth.py | plinth.py | #!/usr/bin/env python
import os, sys, argparse
from gettext import gettext as _
import cfg
if not os.path.join(cfg.file_root, "vendor") in sys.path:
sys.path.append(os.path.join(cfg.file_root, "vendor"))
import cherrypy
from cherrypy import _cpserver
from cherrypy.process.plugins import Daemonizer
Daemonizer(cherr... | Python | 0 | @@ -4270,32 +4270,42 @@
from exmachina
+.exmachina
import ExMachin
@@ -4362,16 +4362,99 @@
= None%0A
+ print %22unable to import exmachina client library, but continuing anyways...%22%0A
else:
|
fc23860b1adbf7c75dfd53dc213c24a65b455597 | Create ExtractData.py | ExtractData.py | ExtractData.py | Python | 0.000001 | @@ -0,0 +1 @@
+%0A
| |
552fc246e055eb4a29390a89b04c9a8d796cfa12 | fix bug 'dtype' is an invalid keyword to ones_like | qutip/ptrace.py | qutip/ptrace.py | #This file is part of QuTIP.
#
# QuTIP is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# QuTIP is distributed in the ho... | Python | 0.000003 | @@ -1932,24 +1932,25 @@
M**2)%5D)%0A
+#
perm.data=on
@@ -1974,24 +1974,59 @@
,dtype=int)%0A
+ perm.data=ones_like(perm.rows)%0A
perm.toc
|
ff3b36b4d64af54b6bd22f107a9d5dd5cf4f4473 | solve problem no.1152 | 1152/answer.py | 1152/answer.py | Python | 0.999818 | @@ -0,0 +1,166 @@
+from sys import stdin%0Ainput = stdin.readline().strip()%0A%0Aif input == %22%22:%0A print(0)%0A exit()%0A%0Ai = 1%0Afor char in input:%0A if char == ' ':%0A i += 1%0A%0Aprint(i)
| |
82bfe668b11ac76159f2a599734ba33c4ef57026 | Add another views_graph_service file | portal/views_graph_service.py | portal/views_graph_service.py | Python | 0 | @@ -0,0 +1,2457 @@
+from flask import (flash, redirect, render_template, request,%0A session, url_for)%0Aimport requests%0A%0Afrom portal import app, datasets%0Afrom portal.decorators import authenticated%0Afrom portal.utils import get_portal_tokens%0A%0A%0A@app.route('/graph', methods=%5B'GET', 'POST... | |
3684e8be098300006b09c6677a2805e10d623acd | Add GYP file tld_cleanup tool. | net/tools/tld_cleanup/tld_cleanup.gyp | net/tools/tld_cleanup/tld_cleanup.gyp | Python | 0.000001 | @@ -0,0 +1,554 @@
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A%0A%7B%0A 'variables': %7B%0A 'chromium_code': 1,%0A %7D,%0A 'includes': %5B%0A '../../../build/common.gypi',%0A %5D,%0... | |
7b98a6bb0c2d1f1fc5c5265149b99e9d21cf784d | make engine.initialize n_chains argument a keyword argument | examples/dha_example.py | examples/dha_example.py | #
# Copyright (c) 2010-2013, MIT Probabilistic Computing Project
#
# Lead Developers: Dan Lovell and Jay Baxter
# Authors: Dan Lovell, Baxter Eaves, Jay Baxter, Vikash Mansinghka
# Research Leads: Vikash Mansinghka, Patrick Shafto
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may... | Python | 0.000003 | @@ -2626,16 +2626,25 @@
prior',
+n_chains=
num_chai
|
5f9c7d10957c7b0b0da46b031120fe2434315d0d | Test of new persistence layer. | ndtable/persistence/simple.py | ndtable/persistence/simple.py | Python | 0 | @@ -0,0 +1,882 @@
+from ndtable.carray import carray, cparams%0Afrom bloscpack import pack_list, unpack_file%0Afrom numpy import array, frombuffer%0A%0Adef test_simple():%0A filename = 'output'%0A%0A # hackish, just experimenting!%0A arr = carray(xrange(10000)).chunks%0A ca = %5Bbytes(chunk.viewof) for chun... | |
e6a4863d9663791fabc4bd6ccdf0ab45ba2a86eb | Add standalone benchmark runner | remote_bench.py | remote_bench.py | Python | 0.000001 | @@ -0,0 +1,766 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%22%22%22%0AStandalone benchmark runner%0A%22%22%22%0A%0Aimport cProfile%0Aimport pstats%0Aimport profile%0Aimport numpy as np%0A%0Aprint(%22Running Rust and Pyproj benchmarks%5Cn%22)%0A%0A# calibrate%0Apr = profile.Profile()%0Acalibration = np.mean(%... | |
b4042f23d02e77c45d772fe64ae5e98db8b5e4e4 | Add new package: re2 (#18302) | var/spack/repos/builtin/packages/re2/package.py | var/spack/repos/builtin/packages/re2/package.py | Python | 0.00009 | @@ -0,0 +1,718 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass Re2(CMakePackage):%0A %22%22%22RE2 is a fast, safe, thre... | |
9c0bcd4e0317aa8b76ebbf3c9ecae82d1b90027d | Create initial night sensor code for Pi | night_sensor/night_feature.py | night_sensor/night_feature.py | Python | 0 | @@ -0,0 +1,1274 @@
+%22%22%22%0A@author: Sze %22Ron%22 Chau%0A@e-mail: chaus3@wit.edu%0A@source: https://github.com/wodiesan/sweet-skoomabot%0A@desc Night sensor--%3ERPi for Senior Design 1%0A%22%22%22%0A%0Aimport logging%0Aimport os%0Aimport RPi.GPIO as GPIO%0Aimport serial%0Aimport subprocess%0Aimp... | |
b7e1e05bfe5aa7a8d91a4d8ee786e61b4aa7bd1b | Add ArrayQueue | ArrayQueue.py | ArrayQueue.py | Python | 0.000001 | @@ -0,0 +1,506 @@
+class ArrayQueue:%0A def __init__(self, max=10):%0A self._data = %5BNone%5D * max%0A self._size = 0%0A self._front = 0%0A self._max = max%0A%0A def enqueue(self, e):%0A self._data%5B(self._front + self._size) %25 self._max%5D = e%0A self._size += 1%0A%0... | |
2ec6caf58bd3295ae08e14e6ab2c01e347d17b2b | save OSA settings in render file metadata | Preferences/PresetList/Preset/Preset.py | Preferences/PresetList/Preset/Preset.py | #!/usr/bin/python3.4
# -*-coding:Utf-8 -*
'''module to manage preset'''
import xml.etree.ElementTree as xmlMod
from usefullFunctions import *
from Preferences.PresetList.Preset.Quality import *
from Preferences.PresetList.Preset.BounceSet import *
from Preferences.PresetList.Preset.Engine import *
from Preferences.Pres... | Python | 0 | @@ -3927,24 +3927,388 @@
posureB)+';'
+%5C%0A%09%09%09%09%09%09+'OSA:'+%7B True:'enabled', False:'disabled' %7D%5Bself.quality.OSA.enabled%5D+';'%0A%09%09%09%0A%09%09%09if self.quality.OSA.enabled:%0A%09%09%09%09metadata += 'OSA(set)'%0A%09%09%09%09%0A%09%09%09%09if self.quality.OSA.fullSample:%0A%09%09%09%09%09metada... |
55b6d19fc8c80e3d4ff7842f20d284879f5ea151 | Create BubbleSort.py | BubbleSort.py | BubbleSort.py | Python | 0.000001 | @@ -0,0 +1,462 @@
+%22%22%22%0A%E5%86%92%E6%B3%A1%EF%BC%9A%0A %E5%8E%9F%E5%A7%8B%E7%89%88%E6%9C%AC%EF%BC%9A%E5%B0%86i%E7%94%B10%E5%BC%80%E5%A7%8B%EF%BC%8C%E4%B8%8E%E5%90%8E%E9%9D%A2%E6%AF%8F%E4%B8%80%E4%B8%AAj=i+1 %E8%BF%9B%E8%A1%8C%E6%AF%94%E8%BE%83%EF%BC%8C%E4%BA%A4%E6%8D%A2%0A %E5%86%8Di=1 ...%E8%B... | |
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 | Python | 0 | @@ -0,0 +1,2196 @@
+%22%22%22%0AThis script can be run to generate a CSV output of accounts which do not have their passwords set, along%0Awith some useful account information, and possible explanations for the lack of password%0A%0A%60%60%60%0Apython accounts_with_missing_passwords.py -o accounts.csv%0A%60%60%60%0A%22... | |
ab50818c18b4275c205419c4c844bfc9ecb7a4c8 | add rename.py | FileUtils/rename.py | FileUtils/rename.py | Python | 0.000002 | @@ -0,0 +1,514 @@
+import os%0Aimport sys%0Aimport re%0A%0Adirname, filename = os.path.split(os.path.abspath(sys.argv%5B0%5D))%0Aos.chdir(dirname)%0AfileList = os.listdir(dirname)%0Aprint dirname%0Aname='edge_effect_'%0Afor fileItem in fileList:%0A%09dotIndex = fileItem.rfind('.')%0A%09fileName = fileItem%5B: dotIndex%... | |
dc993796fc15e3670c8a702f43fcb9a5d9b4c84e | Add forgotten file. | astrobin_apps_donations/utils.py | astrobin_apps_donations/utils.py | Python | 0 | @@ -0,0 +1,234 @@
+from subscription.models import UserSubscription%0A%0Adef user_is_donor(user):%0A if user.is_authenticated:%0A return UserSubscription.objects.filter(user = user, subscription__name = 'AstroBin Donor').count() %3E 0%0A return False%0A%0A
| |
e51f3869b4a047489b9bb1e4b88af0e0bdc3078b | Add a command to list all the documents. | paper_to_git/commands/list_command.py | paper_to_git/commands/list_command.py | Python | 0 | @@ -0,0 +1,1140 @@
+%22%22%22%0AList the Documents and Folders%0A%22%22%22%0A%0Afrom paper_to_git.commands.base import BaseCommand%0Afrom paper_to_git.models import PaperDoc, PaperFolder%0A%0A__all__ = %5B%0A 'ListCommand',%0A %5D%0A%0A%0Aclass ListCommand(BaseCommand):%0A %22%22%22List the PaperDocs and Folde... | |
a797de9014a3d466bb10e9bc318c3e2edec328be | add base for rendering widgets | packages/SCIRun/renderbase.py | packages/SCIRun/renderbase.py | Python | 0 | @@ -0,0 +1,286 @@
+from core import system%0Afrom core.modules.module_registry import registry%0Afrom packages.spreadsheet.basic_widgets import SpreadsheetCell, CellLocation%0A%0Aclass Render(SpreadsheetCell):%0A def compute(self): %0A pass%0A%0Adef registerRender():%0A registry.add_module(Render, abstract=Tru... | |
62ccbd84a2560a70c0964e2106a1a756dc060d96 | add comment to include just a suite and mark tests tagged as inprogress as noncritical | test/run_tests.py | test/run_tests.py | #!/usr/bin/env python
# Copyright 2008-2009 Nokia Siemens Networks Oyj
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | Python | 0 | @@ -1297,24 +1297,43 @@
g', 'none',%0A
+#'--suite', '...',%0A
'--loglevel'
@@ -1519,16 +1519,47 @@
ssion',%0A
+'--noncritical', 'inprogress',%0A
%5D%0AARG_VA
|
8b1e6b226d925d7f2ef4890463122ec8046aa07a | add test | sensor/test_compass.py | sensor/test_compass.py | Python | 0.000002 | @@ -0,0 +1,96 @@
+#! /usr/bin/python%0Afrom Adafruit_LSM303 import LSM303%0A%0Alsm = LSM303()%0Awhile 1:%0A%09print lsm.read()
| |
f0feed6b5e664bb4e8e63b8525f7438ee5e75b9f | clean up doc | inferno/lib/job_runner.py | inferno/lib/job_runner.py | from inferno.lib.disco_ext import get_disco_handle
from inferno.lib.job import InfernoJob
from inferno.lib.rule import (extract_subrules, deduplicate_rules, flatten_rules)
def _start_job(rule, settings, urls=None):
"""Start a new job for an InfernoRule
Note that the output of this function is a tuple of (Inf... | Python | 0 | @@ -112,17 +112,16 @@
import
-(
extract_
@@ -162,17 +162,16 @@
en_rules
-)
%0A%0A%0Adef _
@@ -832,16 +832,17 @@
-JobError
+Exception
, if
|
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... | Python | 0.000014 | @@ -730,16 +730,41 @@
config%0A
+from nova import objects%0A
from nov
@@ -1013,16 +1013,43 @@
(%22nova%22)
+%0A objects.register_all()
%0A%0A gm
|
23b2578fadd8a7ee0885e9956a10667d647acaf8 | add basic test for bist | test/test_bist.py | test/test_bist.py | Python | 0.00044 | @@ -0,0 +1,671 @@
+#!/usr/bin/env python3%0Afrom litex.soc.tools.remote import RemoteClient%0A%0Awb = RemoteClient(csr_data_width=8)%0Awb.open()%0Aregs = wb.regs%0A%0A# # #%0A%0Atest_size = 128*1024*1024%0A%0Aregs.generator_reset.write(1)%0Aregs.generator_reset.write(0)%0Aregs.generator_base.write(0)%0Aregs.generator_l... | |
633efb26b4ba0498413d7c203df51f78f1968478 | Add true/false values in condition regex | nyuki/utils/evaluate.py | nyuki/utils/evaluate.py | import re
import ast
from collections import defaultdict
import logging
log = logging.getLogger(__name__)
EXPRESSIONS = [
# Types of values
ast.Dict,
ast.List,
ast.NameConstant,
ast.Num,
ast.Set,
ast.Str,
ast.Tuple,
# Types of operations
ast.Compare,
ast.BoolOp,
ast.U... | Python | 0.001485 | @@ -2298,16 +2298,27 @@
*(@%5CS*%7C
+true%7Cfalse%7C
%5C'%5B%5E%5C'%5D*
@@ -2354,16 +2354,27 @@
+(@%5CS*%7C
+true%7Cfalse%7C
%5Cd+%7C%5C'%5B%5E
@@ -2799,17 +2799,17 @@
/hUueag/
-1
+2
%0A
|
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... | Python | 0.000001 | @@ -910,16 +910,35 @@
y_equal(
+%0A next(iter(
result.d
@@ -953,12 +953,19 @@
es()
-%5B0%5D,
+)),%0A
np.
|
5e008ac92016a092c1ce9c9590a79d72f4cf1cf6 | Initialize tests | tests/__main__.py | tests/__main__.py | Python | 0.000001 | @@ -0,0 +1,64 @@
+import unittest%0A%0Aif __name__ == '__main__':%0A unittest.main()%0A
| |
0e3effc3a7402d3b4c1b2c91539c4d1004c5b0e3 | Add test_traitscli.py | test_traitscli.py | test_traitscli.py | Python | 0.000004 | @@ -0,0 +1,2300 @@
+import unittest%0A%0Afrom traits.api import Event, Callable, Type%0A%0Afrom traitscli import TraitsCLIBase%0Afrom sample import SampleCLI%0A%0A%0Aclass TestingCLIBase(TraitsCLIBase):%0A%0A def do_run(self):%0A # Get trait attribute names%0A names = self.class_trait_names(%0A ... | |
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 | Python | 0.000002 | @@ -0,0 +1,1653 @@
+from io import BytesIO%0A%0Aimport SimpleITK as sitk%0Afrom PIL import Image as PILImage%0A%0Afrom django.http import Http404%0Afrom rest_framework import serializers%0A%0A%0Aclass PILImageSerializer(serializers.BaseSerializer):%0A %22%22%22%0A Read-only serializer that returns a PIL image fro... | |
101a4c1288ddadbad6dbe0186adde3921ef2546f | add ctrl-c handler | lib/ctrlc.py | lib/ctrlc.py | Python | 0.000036 | @@ -0,0 +1,470 @@
+import sys%0Aimport time%0Aimport signal%0A%0Aclass CtrlC:%0A pressed = False%0A%0A @classmethod%0A def handle(cls, signal, frame):%0A print('Ctrl-C pressed, will exit soon')%0A if cls.pressed:%0A print('Ctrl-C pressed twice. Committing violent suicide.')%0A ... | |
1298cf9c7a40ce73d46067035ded2318c62f7380 | Add simple tests for DrsSymbol and DrsIndexed | tests/drs_test.py | tests/drs_test.py | Python | 0 | @@ -0,0 +1,1725 @@
+%22%22%22Tests for drudge scripts.%22%22%22%0A%0Afrom sympy import Symbol, IndexedBase%0A%0Afrom drudge.drs import DrsSymbol%0Afrom drudge.utils import sympy_key%0A%0A%0A#%0A# Unit tests for the utility classes and functions%0A# ------------------------------------------------%0A#%0A%0A%0Adef test_b... | |
aa2a15c44228a8a27a5b3f91f25f38156a647457 | Update queries.py | blitzdb/backends/file/queries.py | blitzdb/backends/file/queries.py | import six
import re
if six.PY3:
from functools import reduce
def and_query(expressions):
def _and(query_function,expressions = expressions):
compiled_expressions = [compile_query(e) for e in expressions]
return reduce(lambda x,y: x & y,[e(query_function) for e in compiled_expressions])
... | Python | 0.000001 | @@ -2928,26 +2928,30 @@
return _
-n
e
+xists
%0A%0Adef regex_
@@ -3184,32 +3184,32 @@
n store_keys%5D %0A%0A
-
return _rege
@@ -3209,16 +3209,295 @@
n _regex
+%0A %0Adef eq_query(expression):%0A%0A def _eq(index,expression = expression):%0A ev = expression() if callable(expression) else expre... |
5abd80dd9d90c60190f7a170697301284c3731ec | Version 1 | rename.py | rename.py | Python | 0.000001 | @@ -0,0 +1,1410 @@
+#!/usr/bin/env python%0Afrom os import rename, listdir%0Aimport string%0A%0AuserInput = raw_input(%22Enter Command: %22)%0A%0Aextensions = %5B'jpg', 'JPG', 'png', 'PNG'%5D%0A%0Alist1 = %5B%5D%0A%0Afnames = listdir('.')%0Afor fname in fnames:%0A if fname%5B-3:%5D in extensions and fname%5B0%5D in ... | |
a412295b09481113d6f42565520d03ce8bfd36b8 | Create ECIScraper.py | ECIScraper.py | ECIScraper.py | Python | 0 | @@ -0,0 +1,821 @@
+from bs4 import BeautifulSoup as bs%0Aimport httplib%0A%0A%0Aclass ECIScrapper:%0A%09def __init__(self, url):%0A%09%09self.url = url.split(%22/%22)%5B0%5D%0A%09%09self.getrequest = '/'.join(url.split('/')%5B1:%5D)%0A%09%09print self.url, self.getrequest%0A%09%09self.connection = httplib.HTTPConnectio... | |
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... | Python | 0 | @@ -752,15 +752,50 @@
ml%22,
- %22pyzmq
+%0A %22pyzmq%22, %22pandas%22, %22scipy
%22%5D%0A
|
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 | Python | 0.000002 | @@ -0,0 +1,2610 @@
+# NOTE: contains only one test, _est_cont_fit, that is renamed so that%0D%0A# nose doesn't run it%0D%0A# I put this here for the record and for the case when someone wants to%0D%0A# verify the quality of fit%0D%0A# with current parameters: %0D%0A%0D%0A%0D%0Aimport numpy.testing as npt%0D%0Aimp... | |
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')
for li... | Python | 0 | @@ -21,17 +21,20 @@
os%0Atry:%0A
-%09
+
from ana
@@ -86,9 +86,12 @@
or:%0A
-%09
+
pass
|
ec96ce58076ba5aa54abeb423937a629cbe1e3d5 | Work in progress | logparser.py | logparser.py | Python | 0.000003 | @@ -0,0 +1,1468 @@
+#!/usr/bin/python%0A%22%22%22 Log parser. %22%22%22%0Afrom HTMLParser import HTMLParser%0Aimport urllib%0A%0A%0Aclass DailyParser(HTMLParser):%0A%0A %22%22%22%0A HTML parser for the donations log of Wikimedia France%0A%0A Attributes:%0A status (int): status variable of the parser.%0A... | |
162b82b64d319e0c854c08b3bd2e412ab5e67d97 | add pytables testing file | blaze/compute/tests/test_pytables_compute.py | blaze/compute/tests/test_pytables_compute.py | Python | 0 | @@ -0,0 +1,2494 @@
+from __future__ import absolute_import, division, print_function%0A%0Aimport pytest%0Atables = pytest.importorskip('tables')%0A%0Aimport numpy as np%0Aimport tempfile%0Afrom contextlib import contextmanager%0Aimport os%0A%0Afrom blaze.compute.core import compute%0Afrom blaze.compute.pytables import ... | |
67df732067847af15e41b8eed05137b6ab2bb6d2 | add __version__ (forgot to commit) | libcutadapt/__init__.py | libcutadapt/__init__.py | Python | 0.000001 | @@ -0,0 +1,22 @@
+__version__ = '0.9.2'%0A
| |
188d583caea0e640f41e400839552fe593154eda | Set 2, challenge 9 completed. | set2/crypto9.py | set2/crypto9.py | Python | 0 | @@ -0,0 +1,1036 @@
+#!/usr/local/bin/python%0A%0A__author__ = 'Walshman23'%0A%0Aimport sys%0Asys.path.insert(1, %22../common%22) # Want to locate modules in our 'common' directory%0A%0A%0A# A block cipher transforms a fixed-sized block (usually 8 or 16 bytes) of plaintext into ciphertext.%0A# But we almost never want t... | |
ed33a8dc90468f2873a4a581c22027f10d9393d4 | Add Wordpress_2_Instances testcase | heat/tests/functional/test_WordPress_2_Intances.py | heat/tests/functional/test_WordPress_2_Intances.py | Python | 0 | @@ -0,0 +1,2150 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0... | |
fb7bc8af34f3ed375d30b43655366e6368080e76 | Create Import_Libraries.py | home/INMOOV/Config/ExtraConfig/Import_Libraries.py | home/INMOOV/Config/ExtraConfig/Import_Libraries.py | Python | 0 | @@ -0,0 +1,389 @@
+from java.lang import String%0Afrom org.myrobotlab.net import BareBonesBrowserLaunch%0Afrom datetime import datetime%0Afrom subprocess import Popen, PIPE%0A#######################%0Aimport threading%0Aimport time%0Aimport random%0Aimport urllib, urllib2%0Aimport json%0Aimport io%0Aimport itertools%0A... | |
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... | Python | 0.000009 | @@ -998,16 +998,81 @@
stopped%0A
+ 'occupancy', # On means occupied, Off means not occupied%0A
'ope
|
6f0b5a0dc44269d9e72f3698317604d90d6cecf3 | add script for migrate user mailchimp | scripts/fix_user_mailchimp.py | scripts/fix_user_mailchimp.py | Python | 0 | @@ -0,0 +1,1501 @@
+import logging%0Aimport sys%0Afrom datetime import datetime%0A%0Afrom django.db import transaction%0Afrom django.utils import timezone%0A%0Afrom website.app import setup_django%0Asetup_django()%0Afrom osf.models import OSFUser%0Afrom scripts import utils as script_utils%0Afrom website.mailchimp_util... | |
9571acd941cb7ecac96676ead87c43fadda3e74f | Create TimeUpload.py | TimeUpload.py | TimeUpload.py | Python | 0 | @@ -0,0 +1,1898 @@
+from pydrive.auth import GoogleAuth%0Afrom pydrive.drive import GoogleDrive%0Aimport time%0Aimport csv%0A%0AtimeID='0B9ffTjUEqeFEZ28zdTRhMlJlY0k'%0Afor i in range(10):%0A#get the curret time%0A date_time=time.asctime()%0A date_time_split=date_time.split(' ') #gives a list with the date and ti... | |
7c6bbe3860e7cce0f464dc0d95683de3c5ca57a5 | Add test of `ResNet50FeatureProducer()` | testci/test_resnet50_feature.py | testci/test_resnet50_feature.py | Python | 0 | @@ -0,0 +1,1648 @@
+from PIL import Image%0Aimport collections%0Aimport datetime%0Aimport numpy as np%0Aimport pytest%0A%0Afrom pelops.features.resnet50 import ResNet50FeatureProducer%0A%0A%0A@pytest.fixture%0Adef img_data():%0A DATA = %5B%5B%5B 0, 0, 0%5D,%0A %5B255, 255, 255%5D,%0A %5B... | |
d8a3f92a06971ba6fe24f71914a466ff91f00f5f | Create WikiBot3.5.py | WikiBot3.5.py | WikiBot3.5.py | Python | 0 | @@ -0,0 +1,2437 @@
+import discord%0Aimport wikipedia%0A%0Atoken = %22Mjg3NjU2MjM1MjU0NDE1MzYx.C-5xKQ.khJ9dPouM9783FMA0Ht-92XkS6A%22%0A%0Alanguage = %22en%22%0A%0Aclient = discord.Client()%0A%0A%0A@client.event%0Aasync def on_ready():%0A print(%22Bot is ready%22)%0A print(client.user.name)%0A print(client.user... | |
3ef6866b39601dfafa10895a69c5d348a77ded3e | add test for eject and eject_all | mpf/tests/test_BallDevice_SmartVirtual.py | mpf/tests/test_BallDevice_SmartVirtual.py | Python | 0 | @@ -0,0 +1,1737 @@
+from mpf.tests.MpfTestCase import MpfTestCase%0A%0A%0Aclass TestBallDeviceSmartVirtual(MpfTestCase):%0A def getConfigFile(self):%0A return 'test_ball_device.yaml'%0A%0A def getMachinePath(self):%0A return 'tests/machine_files/ball_device/'%0A%0A def get_platform(self):%0A ... | |
104fcfc4eed7f3233d329602283093c7f86484c3 | add development server | server.py | server.py | Python | 0 | @@ -0,0 +1,1256 @@
+from http.server import HTTPServer, BaseHTTPRequestHandler%0A%0Aclass StaticServer(BaseHTTPRequestHandler):%0A%0A def do_GET(self):%0A root = 'html'%0A #print(self.path)%0A if self.path == '/':%0A filename = root + '/index.html'%0A else:%0A filena... | |
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 | Python | 0.000001 | @@ -0,0 +1,464 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0Afrom corehq.apps.hqadmin.management.commands.cchq_prbac_bootstrap import cchq_prbac_bootstrap%0Afrom corehq.sql_db.operations import HqRunPython%0A%0Aclass Migration(migrations.Migration)... | |
7b7ec9cdd1f0ed213608a5c309702e49e44b36e2 | Add simple test. | tests/integration/test_smoke.py | tests/integration/test_smoke.py | Python | 0.000001 | @@ -0,0 +1,239 @@
+from django.test import TestCase%0A%0AURLS_PUBLIC = %5B%0A %22/%22,%0A%5D%0A%0A%0Aclass SimpleTests(TestCase):%0A def test_urls(self):%0A for url in URLS_PUBLIC:%0A res = self.client.get(url)%0A self.assertEqual(res.status_code, 200)%0A
| |
c44001ec697faf7552764f91e52fa927056b1538 | Add solution for porblem 31 | euler031.py | euler031.py | Python | 0.000001 | @@ -0,0 +1,371 @@
+#!/usr/bin/python%0A%0ALIMIT = 200%0Acoins = %5B1, 2, 5, 10, 20, 50, 100, 200%5D%0A%0A%0Adef rec_count(total, step):%0A if total == LIMIT:%0A return 1%0A if total %3E LIMIT:%0A return 0%0A c = 0%0A for x in coins:%0A if x %3C step:%0A continue%0A c +... | |
84c5bfa0252814c5797cf7f20b04808dafa9e1fa | Create MergeIntervals_001.py | leetcode/056-Merge-Intervals/MergeIntervals_001.py | leetcode/056-Merge-Intervals/MergeIntervals_001.py | Python | 0 | @@ -0,0 +1,974 @@
+# Definition for an interval.%0A# class Interval:%0A# def __init__(self, s=0, e=0):%0A# self.start = s%0A# self.end = e%0A%0Aclass Solution:%0A # @param %7BInterval%5B%5D%7D intervals%0A # @return %7BInterval%5B%5D%7D%0A %0A def sortmeg(self, intervals):%0A ls =... | |
8471516294d5b28a81cae73db591ae712f44bc01 | Add failing cairo test | tests/pygobject/test_structs.py | tests/pygobject/test_structs.py | Python | 0.000002 | @@ -0,0 +1,830 @@
+# Copyright 2013 Christoph Reiter%0A#%0A# This library is free software; you can redistribute it and/or%0A# modify it under the terms of the GNU Lesser General Public%0A# License as published by the Free Software Foundation; either%0A# version 2.1 of the License, or (at your option) any later version... | |
c46e6d170f4d641c3bb5045a701c7810d77f28a6 | add update-version script | update-version.py | update-version.py | Python | 0 | @@ -0,0 +1,1092 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Aimport argparse%0Aimport os%0Aimport xml.etree.ElementTree as et%0A%0A%0ANS = %22http://maven.apache.org/POM/4.0.0%22%0APOM_NS = %22%7Bhttp://maven.apache.org/POM/4.0.0%7D%22%0A%0A%0Adef getModuleNames(mainPom):%0A pom = et.parse(mainPom)%0A ... | |
639106506be3f6b91a3e45cde88701625c077a28 | Update battery_model.py | pySDC/projects/PinTSimE/battery_model.py | pySDC/projects/PinTSimE/battery_model.py | import numpy as np
import dill
from pySDC.helpers.stats_helper import get_sorted
from pySDC.core import CollBase as Collocation
from pySDC.implementations.problem_classes.Battery import battery
from pySDC.implementations.sweeper_classes.imex_1st_order import imex_1st_order
from pySDC.implementations.controller_classes... | Python | 0.000001 | @@ -90,16 +90,28 @@
SDC.core
+.Collocation
import
|
1d3719bcd03b92d04efae10933928f953d95c7a4 | Add a simple basicmap python example | src/python/BasicMap.py | src/python/BasicMap.py | Python | 0.000014 | @@ -0,0 +1,584 @@
+%22%22%22%0A%3E%3E%3E from pyspark.context import SparkContext%0A%3E%3E%3E sc = SparkContext('local', 'test')%0A%3E%3E%3E b = sc.parallelize(%5B1, 2, 3, 4%5D)%0A%3E%3E%3E sorted(basicSquare(b).collect())%0A%5B1, 4, 9, 12%5D%0A%22%22%22%0A%0Aimport sys%0A%0Afrom pyspark import SparkContext%0A%0Adef ba... | |
41220718d0e9a32fc9e95d55acdb989b2f87563f | Add @job tasks | smsish/tasks.py | smsish/tasks.py | Python | 0.000791 | @@ -0,0 +1,505 @@
+import django_rq%0Afrom rq.decorators import job%0A%0ADEFAULT_QUEUE_NAME = %22default%22%0ADEFAULT_REDIS_CONNECTION = django_rq.get_connection()%0A%0A%0A@job(DEFAULT_QUEUE_NAME, connection=DEFAULT_REDIS_CONNECTION)%0Adef send_sms(*args, **kwargs):%0A%09from smsish.sms import send_sms as _send_sms%0A%... | |
6ee145c7af7084f228ee48754ef2a0bfc37c5946 | Add missing hooks.py module | pyqt_distutils/hooks.py | pyqt_distutils/hooks.py | Python | 0.000003 | @@ -0,0 +1,2465 @@
+%22%22%22%0AA pyqt-distutils hook is a python function that is called after the%0Acompilation of a ui script to let you customise its content. E.g. you%0Amight want to write a hook to change the translate function used or replace%0Athe PyQt imports by your owns if you're using a shim,...%0A%0AThe ho... | |
ff79343cb1feda5259244199b4f0d503da401f24 | Create quick_sort_iterativo.py | quick_sort_iterativo.py | quick_sort_iterativo.py | Python | 0.000004 | @@ -0,0 +1,1632 @@
+import unittest%0A%0A%0Adef _quick_recursivo(seq, inicio, final):%0A if inicio %3E= final:%0A return seq%0A indice_pivot = final%0A pivot = seq%5Bindice_pivot%5D%0A i_esquerda = inicio%0A i_direita = final - 1%0A%0A while i_esquerda%3C=i_direita:%0A while i_esquerda%3... | |
4324eaf427731db3943cf130e42e29509bdbd4df | Fix for Python 3 | asv/config.py | asv/config.py | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
import sys
from . import util
class Config(object):
"""
Manages the configuration for a benchmark pr... | Python | 0.000054 | @@ -493,24 +493,18 @@
%5B%22%7B0
-.major%7D.%7B0.minor
+%5B0%5D%7D.%7B0%5B1%5D
%7D%22.f
|
6a47c684012b98679c9274ca4087958c725a1fa7 | support extensions in tests | test/unit/dockerstache_tests.py | test/unit/dockerstache_tests.py | Python | 0 | @@ -0,0 +1,2218 @@
+#!/usr/bin/env python%0A%22%22%22%0Adockerstache module test coverage for API calls%0A%0A%22%22%22%0Aimport os%0Aimport tempfile%0Aimport json%0Aimport unittest%0Aimport mock%0A%0Afrom dockerstache.dockerstache import run%0A%0A%0Aclass RunAPITests(unittest.TestCase):%0A %22%22%22tests for run API... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.