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 |
|---|---|---|---|---|---|---|---|
6892fd5e15ce65aac45b4e28f0a12fa88fd0dae2 | Update instructions to fix cairocffi if broken | setup.py | setup.py | #!/usr/bin/env python
# Copyright (c) 2008 Aldo Cortesi
# Copyright (c) 2011 Mounier Florian
# Copyright (c) 2012 dmpayton
# Copyright (c) 2014 Sean Vig
# Copyright (c) 2014 roger
# Copyright (c) 2014 Pedro Algarvio
# Copyright (c) 2014-2015 Tycho Andersen
#
# Permission is hereby granted, free of charge, to any perso... | Python | 0 | @@ -1775,17 +1775,20 @@
-L
+It l
ooks lik
@@ -1843,14 +1843,22 @@
rt.
-Please
+ To fix this:%0A
%0A
@@ -1870,15 +1870,28 @@
-e
+ - E
nsure
+a recent
xcff
@@ -1909,69 +1909,141 @@
lled
-, and then run:%0A%0A pip --no-deps --ignore-
+ (pip install 'xcffib%3E=0.3.2')%0A ... |
b8bab32410d866f9f547c4bd04de942e2e809816 | Add a setup.py. | setup.py | setup.py | Python | 0 | @@ -0,0 +1,382 @@
+#!/usr/bin/env python3%0A%0Afrom distutils.core import setup%0A%0Akwargs = %7B%0A %22name%22: %22python-mpv%22,%0A %22author%22: %22Lars Gust%C3%A4bel%22,%0A %22author_email%22: %22lars@gustaebel.de%22,%0A %22url%22: %22http://github.com/gustaebel/python-mpv/%22,%0A... | |
adba5f0aef9a7bfbe9e239726fa627f126db8efd | Split into two packages #30 | setup.py | setup.py | '''
Nereid
Nereid - Tryton as a web framework
:copyright: (c) 2010-2013 by Openlabs Technologies & Consulting (P) Ltd.
:license: GPLv3, see LICENSE for more details
'''
import re
from setuptools import setup, Command
class RunTests(Command):
description = "Run tests"
user_options = []
... | Python | 0.000002 | @@ -184,19 +184,8 @@
'''%0A
-import re%0A%0A
from
@@ -212,979 +212,60 @@
etup
-, Command%0A%0Aclass RunTests(Command):%0A description = %22Run tests%22%0A%0A user_options = %5B%5D%0A%0A def initialize_options(self):%0A pass%0A%0A def finalize_options(self):%0A pass%0A%0A def run(self):%0... |
9fa978c6673759142a875d9b05a4f9c110f13718 | add setup.py | setup.py | setup.py | Python | 0.000001 | @@ -0,0 +1,1041 @@
+import os%0Afrom setuptools import find_packages, setup%0A%0Awith open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:%0A README = readme.read()%0A%0A# allow setup.py to be run from any path%0Aos.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))%0A%0Ase... | |
6ae505c2b6d8ad65b6cc61587b28a8de81ecb488 | Add setup.py file | setup.py | setup.py | Python | 0.000001 | @@ -0,0 +1,1655 @@
+from distutils.core import setup%0Asetup(%0A name = %22twilio%22,%0A py_modules = %5B'twilio'%5D,%0A version = %223.0.0%22,%0A description = %22Twilio API client and TwiML generator%22,%0A author = %22Twilio%22,%0A author_email = %22help@twilio.com%22,%0A url = %22http://github.... | |
ff48d7a242e1b8c67faa7a4b5ab43e641a1dd910 | add setup.py | setup.py | setup.py | Python | 0.000001 | @@ -0,0 +1,849 @@
+# -*- coding:utf-8 -*-%0A%0Afrom setuptools import find_packages, setup%0A%0AREADME = %22%22%22# tpl%0A%22%22%22%0A%0A%0Asetup(%0A name='tpl',%0A version='0.1.0',%0A description='Command line utility for generating files or directories from template',%0A long_description=README,%0A aut... | |
6df13e80a4684a11ccbc53d9b30bb54067ce8196 | correct app URL | setup.py | setup.py | import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='yak-server',
version='0.1',
pac... | Python | 0 | @@ -1168,29 +1168,32 @@
http
+s
://
-www.
+yeti.co/
yeti
+-
app
+-
kit
-.com
/',%0A
@@ -1684,8 +1684,9 @@
%5D,%0A)
+%0A
|
7f9dee365f27bf288fae513739651462b8c78071 | Create setup.py | setup.py | setup.py | Python | 0.000001 | @@ -0,0 +1,719 @@
+from setuptools import setup%0A%0Adef readme():%0A%09with open('README.rst') as f:%0A%09%09return f.read()%0A%09%09%0Asetup(name='setbadge',%0A%09%09%09version='0.0.1',%0A%09%09%09description='Set the Pythonista app%5C's badge value to a custom text string!',%0A%09%09%09long_description=readme(),%0A%... | |
17e66f79118f87aea452f7ca658142e6d5d71a1b | Add shell.py | shell.py | shell.py | Python | 0.000005 | @@ -0,0 +1,117 @@
+import pymongo as pm%0A%0Aclient = pm.MongoClient()%0Adb = client.kasm%0Aredirects = db.redirects%0A%0A## list(redirects.find())%0A
| |
1348f5c9068aa4059ed41ee03635c7da6f5b04f0 | add max_path_sum | tree/max_path_sum.py | tree/max_path_sum.py | Python | 0.000121 | @@ -0,0 +1,840 @@
+# http://www.geeksforgeeks.org/find-maximum-path-sum-in-a-binary-tree/%0A%0A%0Aclass Node:%0A def __init__(self, value):%0A self.value = value%0A self.left = None%0A self.right = None%0A%0A%0Adef run(root, s):%0A if not root:%0A return 0%0A%0A max_child = max(run(... | |
71bfe8974e3274c80c2fd6d1be4c54a24345a0e7 | add test_rgw | src/test/pybind/test_rgw.py | src/test/pybind/test_rgw.py | Python | 0 | @@ -0,0 +1,725 @@
+from nose.tools import eq_ as eq, assert_raises%0Afrom rgw import Rgw%0A%0Adef test_rgw():%0A rgw = Rgw()%0A xml = %22%22%22%3CAccessControlPolicy xmlns=%22http://s3.amazonaws.com/doc/2006-03-01/%22%3E%0A %3COwner%3E%0A %3CID%3Efoo%3C/ID%3E%0A %3CDisplayName%3EMrFoo%3C/DisplayName%3E%0A ... | |
15c7b734bcd830b819bfbafdf94da48931dd7b7b | Create get-img.py | get-img.py | get-img.py | Python | 0.000002 | @@ -0,0 +1,2211 @@
+import urllib, json, sys, os.path, argparse%0Aimport hashlib%0Aimport time%0Aimport re%0A%0A%0A%0A# //==== EDIT THIS ====%5C%5C%0A%0Alog_file = open('log.txt', 'r+')%0Ausername = 'dronenerds'%0Asleep_time = 120%0Adownload_img = False%0Aconsole_log = True%0Adownload_img1 = True%0Apath_name = 'images/... | |
f4504fdb70cff7089164f0cc9ae30e972d61ec30 | add lux.py | lux/lux.py | lux/lux.py | Python | 0.000524 | @@ -0,0 +1,1378 @@
+import logging%0Aimport serial%0Aimport time%0A%0Alogger = logging.getLogger(__name__)%0A%0Aclass SingleLuxDevice(object):%0A%0A def __init__(self, port, baudrate=115200):%0A self.ser = serial.Serial(port, baudrate)%0A self.addresses = %7B%7D%0A%0A def close(self):%0A self... | |
4bbabb1e71676c2dc0763748ab6b43c1ce0f33ae | fix returning None with catch_returns | snippets/python/threadpool.py | snippets/python/threadpool.py | from Queue import Queue
import threading
import traceback
import inspect
import os, stat
class stack_size:
def __init__(self, stack_size):
self.stack_size = stack_size
self.old_size = threading.stack_size()
def __enter__(self):
threading.stack_size(self.old_size)
def __exit__(self, type, value, traceback):
... | Python | 0.000022 | @@ -3446,25 +3446,8 @@
ns:%0A
-%09%09%09%09%09if result:%0A%09
%09%09%09%09
@@ -3472,25 +3472,24 @@
ult, dict):%0A
-%09
%09%09%09%09%09%09self.r
@@ -3509,17 +3509,16 @@
t)%0A%09%09%09%09%09
-%09
elif ins
@@ -3549,17 +3549,16 @@
:%0A%09%09%09%09%09%09
-%09
for x in
@@ -3566,17 +3566,16 @@
result:%0A
-%09
%09%0... |
80b47093f6ccbe75be7e4382e0cfd948c868763d | add new log of media test (#3265) | functional_tests/core/05-log-media.py | functional_tests/core/05-log-media.py | Python | 0 | @@ -0,0 +1,732 @@
+#!/usr/bin/env python%0A%22%22%22Base case - logging sequence of media types multiple times%0A%0A---%0Aid: 0.core.05-log-media%0Aplugin:%0A - wandb%0A - numpy%0Aassert:%0A - :wandb:runs_len: 1%0A - :wandb:runs%5B0%5D%5Bconfig%5D: %7B%7D%0A - :wandb:runs%5B0%5D%5Bsummary%5D%5Bmedia%5D%5... | |
ee6ab9fc5f580267f089108dc9c27a8a0208ebf0 | Add __init__.py to make it work like a module | pySMOTE/__init__.py | pySMOTE/__init__.py | Python | 0.000033 | @@ -0,0 +1,25 @@
+from .smote import SMOTE%0A
| |
76ce99ba04151a00ee1101ebed4f883fd1112433 | Create mad-lib.py | mad-lib.py | mad-lib.py | Python | 0 | @@ -0,0 +1,637 @@
+skill = raw_input(%22What's a skill you want to learn?:%22)%0Aadverb = raw_input(%22Enter an adverb:%22)%0Aanimal = raw_input(%22Name an animal:%22)%0Abody = raw_input(%22Name a body part:%22)%0Aevent = raw_input(%22Name a fun event:%22)%0Aemotion1 = raw_input(%22Name a positive emotion (past tense):... | |
55cd92fe67d0a4e4ef332680b58482e35d6569e8 | allow domains with 'reports' other than at the end of the name | corehq/apps/hqwebapp/templatetags/hq_shared_tags.py | corehq/apps/hqwebapp/templatetags/hq_shared_tags.py | from datetime import datetime, timedelta
import json
from django import template
from django.conf import settings
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from corehq.apps.domain.models import Domain
from dimagi.utils.l... | Python | 0.000004 | @@ -1887,24 +1887,167 @@
g(request):%0A
+ # todo: change this to takes_context=True and check the active_tab context%0A # variable to see exactly whether the reports tab is active%0A
if 'repo
@@ -2073,16 +2073,33 @@
h_info:%0A
+ try:%0A
@@ -2174,16 +2174,66 @@
', ' ')%0A
+ exce... |
c20abf6b2ae6cb2518971ea03b7edbf7035b1661 | send email to system managers about gst setup | erpnext/patches/v8_1/setup_gst_india.py | erpnext/patches/v8_1/setup_gst_india.py | import frappe
def execute():
frappe.reload_doc('regional', 'doctype', 'gst_hsn_code')
for report_name in ('GST Sales Register', 'GST Purchase Register',
'GST Itemised Sales Register', 'GST Itemised Purchase Register'):
frappe.reload_doc('regional', 'report', frappe.scrub(report_name))
if frappe.db.get_single... | Python | 0 | @@ -6,16 +6,69 @@
t frappe
+%0Afrom frappe.email import sendmail_to_system_managers
%0A%0Adef ex
@@ -472,8 +472,699 @@
setup()%0A
+%09%09send_gst_update_email()%0A%0Adef send_gst_update_email():%0A%09message = %22%22%22Hello,%0A%0A%3Cp%3EERPNext is now GST Ready.%3C/p%3E%0A%0A%3Cp%3ETo start making GST Invoices from... |
0c1ef1267a67ce103f5ba0545bae690ce77c8180 | Add a deploy script | deploy.py | deploy.py | Python | 0.000002 | @@ -0,0 +1,849 @@
+#!/usr/bin/env python%0A%0A%22%22%22%0AScript for deploying a new version of the python-asana library.%0A%22%22%22%0A%0Aimport argparse%0Aimport re%0Aimport subprocess%0Aimport sys%0A%0Aif __name__ == '__main__':%0A parser = argparse.ArgumentParser()%0A parser.add_argument(%0A 'version',%0A h... | |
8255772770e20f51338da36dc7fa027b4dc0f07e | Allow photos in pages | awesomeshop/photo.py | awesomeshop/photo.py | Python | 0.000002 | @@ -0,0 +1,2250 @@
+import os.path, uuid%0Afrom PIL import Image%0A%0Afrom flask.ext.babel import lazy_gettext%0A%0Afrom . import app, db%0A%0A%0Athumb_size = app.config%5B'THUMBNAIL_SIZE'%5D%0Apreview_size = app.config%5B'PREVIEW_SIZE'%5D%0Aclass Photo(db.EmbeddedDocument):%0A filename = db.StringField(db_field='fn... | |
6c52676493bbf4d8f64a65712034b18bbee279ba | Create syracuse.py | python/syracuse/syracuse.py | python/syracuse/syracuse.py | Python | 0.000002 | @@ -0,0 +1,177 @@
+n = int(input(%22Veuillez saisir un entier : %22))%0Avol = 0%0A%0Awhile(n != 1):%0A%09if(n %25 2 == 0):%0A%09%09n /= 2%0A%09else:%0A%09%09n = n*3 + 1%0A%09vol +=1%0Aprint(%22Le temps de vol du nombre %22,n,%22 est %22,vol)%0A
| |
1064634cb9f3752e890b56bfddb49e51e70e530b | add munin alert script | python/utils/munin_alert.py | python/utils/munin_alert.py | Python | 0 | @@ -0,0 +1,1528 @@
+#! /usr/bin/env python3%0A%22%22%22%0AScript to send email alert for munin%0A%0AMunin Config: munin.conf%0Acontact.admin.command %7C /path/to/munin_alert.py%0Acontact.admin.max_messages 1%0A%0A@author: cuongnb14@gmail.com %0A%22%22%22%0A%0Aimport smtplib%0Aimport fileinput%0Aimport logging%0A%0Alogg... | |
d2e2b33f6118c24e42500a9eab6969f2fe217978 | version 5.0 with utils | utils.py | utils.py | Python | 0 | @@ -0,0 +1,366 @@
+from config import templateDir%0Aimport os%0A%0Adef readTemplate(fileName): %0A with open(os.path.join(templateDir,fileName)) as f:%0A return f.read()%0A%0Adef couldBeHash(stringTest):%0A if len(stringTest) == 32:%0A for char in stringTest:%0A if char not in %2201... | |
23ad0bf077c846e13e8b970f8928f06d02d658a3 | Make initial migration | students/migrations/0001_initial.py | students/migrations/0001_initial.py | Python | 0.000015 | @@ -0,0 +1,2381 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('master_data', '0001_initial'),%0A ('back_office', '0007_teacher_nationality'),%0A %5D%0A%0A... | |
1334b085f76db914ede6b941c23ea61329df1fbd | Create relaycontrol.py | raspberrypi/relaycontrol.py | raspberrypi/relaycontrol.py | Python | 0.000001 | @@ -0,0 +1,1611 @@
+import paho.mqtt.client as mqtt%0Aimport json, time%0A%0Aimport RPi.GPIO as GPIO%0Afrom time import sleep%0A%0A# The script as below using BCM GPIO 00..nn numbers%0AGPIO.setmode(GPIO.BCM)%0A%0A# Set relay pins as output%0AGPIO.setup(24, GPIO.OUT)%0A%0A%0A%0A# ----- CHANGE THESE FOR YOUR SETUP -----%... | |
f5ca504a390b8db3432dc7d67f934cd29daf3086 | add openssl recipe | recipes/openssl/__init__.py | recipes/openssl/__init__.py | Python | 0.000001 | @@ -0,0 +1,1605 @@
+from toolchain import Recipe, shprint%0Afrom os.path import join, exists%0Aimport sh%0Aimport os%0A%0A%0Aarch_mapper = %7B'i386': 'darwin-i386-cc',%0A 'x86_64': 'darwin64-x86_64-cc',%0A 'armv7': 'iphoneos-cross',%0A 'arm64': 'iphoneos-cross'%7D%0A%0A%0Aclass... | |
e4bf4091ea267cae2c584c8a442f57d3dda0cbf8 | Create wksp2.py | wksp2.py | wksp2.py | Python | 0.000002 | @@ -0,0 +1,491 @@
+%22%22%22Rx Workshop: Observables versus Events.%0APart 1 - Little Example.%0AUsage:%0A python wksp2.py%0A%22%22%22%0Afrom __future__ import print_function%0Aimport rx%0A%0Aclass Program:%0A %22%22%22Main Class.%0A %22%22%22%0A S = rx.subjects.Subject()%0A%0A @staticmethod%0A def ma... | |
a1744d6a6f4c369403ac2ed67f167ca1ecd9cb5e | add input output outline | input-output.py | input-output.py | Python | 0.000037 | @@ -0,0 +1,68 @@
+# input-output.py%0A%0A# review console I/O%0A# CLI parameters%0A# file I/O%0A
| |
72a6ca31ac313b89b5e4ce509c635f675484cf3e | Create solution.py | data_structures/linked_list/problems/find_length/py/solution.py | data_structures/linked_list/problems/find_length/py/solution.py | Python | 0.000018 | @@ -0,0 +1,491 @@
+import LinkedList%0A%0A# Problem description: Find the length of a linked list.%0A# Solution time complexity: O(n)%0A# Comments: %0A%0A# Linked List Node inside the LinkedList module is declared as:%0A#%0A# class Node:%0A# def __init__(self, val, nxt=None):%0A# ... | |
ed6958f477c65a2973d43d669035de80b7cbd7a5 | Change needs_auth ZeroConf key | homeassistant/components/zeroconf.py | homeassistant/components/zeroconf.py | """
This module exposes Home Assistant via Zeroconf.
Zeroconf is also known as Bonjour, Avahi or Multicast DNS (mDNS).
For more details about Zeroconf, please refer to the documentation at
https://home-assistant.io/components/zeroconf/
"""
import logging
import socket
from homeassistant.const import (EVENT_HOMEASSIS... | Python | 0.000001 | @@ -879,18 +879,29 @@
%22
-needs_auth
+requires_api_password
%22: (
|
1079fcc08ede0fe1530448ff6d1c7c61ce650ffb | Fix for py2exe optimizer that discards docstrings | rdflib/py3compat.py | rdflib/py3compat.py | """
Utility functions and objects to ease Python 3 compatibility.
"""
import sys
try:
from functools import wraps
assert wraps
except ImportError:
# No-op wraps decorator
def wraps(f):
def dec(newf):
return newf
return dec
def cast_bytes(s, enc='utf-8'):
if isinstance(... | Python | 0 | @@ -1260,32 +1260,123 @@
a decorator.%22%22%22%0A
+ # s may be None if processed by Py2exe%0A if s is None:%0A return ''%0A
return s
@@ -2469,32 +2469,123 @@
a decorator.%22%22%22%0A
+ # s may be None if processed by Py2exe%0A if s is None:%0A return ''%0A
... |
9aa368d528448c485c940c646394b44dafd1e62f | Create iomanager.py | basemod/iomanager.py | basemod/iomanager.py | Python | 0.000002 | @@ -0,0 +1 @@
+%0A
| |
1a37c09fe0ba755dac04819aea0a6d02327330db | Add files via upload | module3.py | module3.py | Python | 0 | @@ -0,0 +1,1715 @@
+import psycopg2%0D%0A%0D%0Atry:%0D%0A conn = psycopg2.connect(%22dbname=battleport user=postgres host=localhost password=gregory123%22)%0D%0Aexcept:%0D%0A print(%22cannot connect to the database%22)%0D%0A%0D%0Acur=conn.cursor()%0D%0Aconn.set_isolation_level(0)%0D%0A%0D%0A#cur.execute(%22INSERT... | |
f60b3f00b7a4675f1bfc4cab1b9d1b5c150d9dfc | Add simple utility class that extends a dictionary but can be used as object. | phyhlc/util.py | phyhlc/util.py | Python | 0 | @@ -0,0 +1,449 @@
+# encoding: UTF-8%0A%0A%22%22%22Utilities that are used throughout the package.%0A%0A..moduleauthor:: Dylan Maxwell %3Cmaxwelld@frib.msu.edu%3E%0A%22%22%22%0A%0Aclass ObjectDict(dict):%0A %22%22%22Makes a dictionary behave like an object, with attribute-style access.%0A %22%22%22%0A def __ge... | |
c9e4c18ea54de5c168994b47f70f0bdac0a76c73 | add ocr_pdf.py | ocr_pdf.py | ocr_pdf.py | Python | 0.000001 | @@ -0,0 +1,1974 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0A%22%22%22%0A ocr_pdf.py%0A ~~~~~~~~~~~~~~%0A%0A A brief description goes here.%0A%22%22%22%0Aimport subprocess%0A%0Adef call(cmd, check=True, stdout=None, stderr=None):%0A %22%22%22%0A Args:%0A check: check return code or no... | |
32fa82e983e88cc902cd75d7c3059dec2a08f524 | Wrong variable | judge/bridge/judgelist.py | judge/bridge/judgelist.py | from operator import attrgetter
from random import choice
class JudgeList(object):
def __init__(self):
self.queue = []
self.judges = []
self.submission_map = {}
def register(self, judge):
self.judges.append(judge)
for elem in self.queue:
id, problem, langua... | Python | 0.978879 | @@ -1248,24 +1248,24 @@
n judge.
-language
+executor
s and no
|
d58a021704669a8bb6b7d36d068ca596fc0f813e | add problem0010.py | python3/problem0010.py | python3/problem0010.py | Python | 0.000608 | @@ -0,0 +1,119 @@
+from problem0003 import primes%0Afrom itertools import takewhile%0A%0Aprint(sum(takewhile(lambda x: x %3C 2000000, primes())))%0A
| |
91927b441425703463f0ee1e08293ad942a26a93 | Add debounce.py and implementation. | pythonicqt/debounce.py | pythonicqt/debounce.py | Python | 0 | @@ -0,0 +1,2911 @@
+%22%22%22module contains datastructures needed to create the @debounce decorator.%22%22%22%0Aimport time%0Afrom functools import wraps, partial%0Afrom PySide import QtCore%0A%0Aclass DebounceTimer(QtCore.QTimer):%0A %22%22%22Used with the debounce decorator, used for delaying/throttling calls.%22... | |
50795568e35669916f1654d50e5f1bdd1800d41e | Create imposto.py | imposto.py | imposto.py | Python | 0.000007 | @@ -0,0 +1,839 @@
+numero = float(input('Digite o valor Bruto: '))%0Ainss = numero * 11/100%0Aif (inss %3E= 482.93 ):%0A real = 482.93%0Aelse:%0A real = inss%0A %0APissqn = numero - real%0Aissqn = Pissqn * 3/100%0APissqn = numero - real - issqn%0A%0Aif (numero %3C= 1787.77 ):%0A num = 'N%C3%A3o desconta inpo... | |
cebe8dffbf9819c370257b7030848ef0ea4e971c | Initialize stuff | ghlist.py | ghlist.py | Python | 0 | @@ -0,0 +1,170 @@
+import requests%0A%0Aapi = 'https://api.github.com/users/%7B%7D/repos'%0A%0Arepos = data = requests.get(url=api.format('kshvmdn')).json()%0A%0Afor repo in repos:%0A print(repo%5B'name'%5D)%0A
| |
62c02c185063465e51bd40e648f75d519e68c1d2 | Create Euler2.py | Euler2.py | Euler2.py | Python | 0.000175 | @@ -0,0 +1,286 @@
+def sequence(n):%0A if n %3C= 1:%0A return n%0A else:%0A return(sequence(n-1) + sequence(n-2))%0A%0A%0Ai = 1%0Aj = 0%0Atotal = 0%0Awhile j %3C 4000000:%0A j = sequence(i)%0A if j%252:%0A print(j)%0A else:%0A print(j)%0A total = total + j%0A i+=1%0Aprin... | |
25b5b8fc89164dc386218ae1edd660735781241d | add simple font comparison tool in examples | examples/font_comparison.py | examples/font_comparison.py | Python | 0 | @@ -0,0 +1,3054 @@
+#!/usr/bin/env python%0A# ----------------------------------------------------------------------------%0A# pyglet%0A# Copyright (c) 2006-2008 Alex Holkner%0A# All rights reserved.%0A#%0A# Redistribution and use in source and binary forms, with or without%0A# modification, are permitted provided that... | |
d300081826f7ebffefb4eeb8ca1077f028b40852 | Add fractal shader example. | examples/shader_onscreen.py | examples/shader_onscreen.py | Python | 0 | @@ -0,0 +1,1312 @@
+from scikits.gpu.api import *%0Aimport pyglet.window%0Afrom pyglet import gl%0A%0A# GLSL code based on http://nuclear.sdf-eu.org/articles/sdr_fract%0A# by John Tsiombikas%0A%0Av_shader = VertexShader(%22%22%22%0Auniform vec2 offset;%0Auniform float zoom;%0Auniform float width_ratio;%0A%0Avarying vec... | |
522201ec9e00ed2fe135a621bde1b288c59ddd25 | Add test utils | keras/utils/test_utils.py | keras/utils/test_utils.py | Python | 0.000001 | @@ -0,0 +1,1079 @@
+import numpy as np%0A%0Adef get_test_data(nb_train=1000, nb_test=500, input_shape=(10,), output_shape=(2,), %0A classification=True, nb_class=2):%0A '''%0A classification=True overrides output_shape %0A (i.e. output_shape is set to (1,)) and the output %0A consists in inte... | |
bd02fd2d163a2f044029ddb0adef031c2dcd824a | Remove deprecated function call | kivy/core/clipboard/clipboard_sdl2.py | kivy/core/clipboard/clipboard_sdl2.py | '''
Clipboard SDL2: an implementation of the Clipboard using sdl2.
'''
__all__ = ('ClipboardSDL2', )
from kivy.utils import platform
from kivy.core.clipboard import ClipboardBase
if platform() not in ('win', 'linux', 'macosx', 'android', 'ios'):
raise SystemError('unsupported platform for pygame clipboard')
try... | Python | 0.000037 | @@ -186,18 +186,16 @@
platform
-()
not in
@@ -460,15 +460,15 @@
t co
+m
piled?
-?
')%0A%0A
|
04b96b35d8d6e56eb1d545bafedc1af4d5914577 | add Proxy pattern | proxy/Proxy.py | proxy/Proxy.py | Python | 0 | @@ -0,0 +1,886 @@
+#%0A# Python Design Patterns: Proxy%0A# Author: Jakub Vojvoda %5Bgithub.com/JakubVojvoda%5D%0A# 2016%0A#%0A# Source code is licensed under MIT License%0A# (for more details see LICENSE)%0A# %0A%0Aimport sys%0A%0A#%0A# Subject%0A# defines the common interface for RealSubject and Proxy%0A# so that a Pr... | |
2f82c96257af5e5596c02348621572b08ff99b64 | test mixed returns | pychecker2/utest/returns.py | pychecker2/utest/returns.py | Python | 0 | @@ -0,0 +1,735 @@
+from pychecker2.TestSupport import WarningTester%0Afrom pychecker2 import ReturnChecks%0A%0Aclass ReturnTestCase(WarningTester):%0A def testReturnChecks(self):%0A w = ReturnChecks.MixedReturnCheck.mixedReturns%0A self.silent('def f(): return%5Cn')%0A self.silent('def f(): retu... | |
83580051da3ad427c815dca0ca88cc8005c014f2 | add nightly script to perform test over a wide range of parameters | nightly.py | nightly.py | Python | 0 | @@ -0,0 +1,1382 @@
+import itertools%0Aimport os%0Aimport subprocess%0A%0A# the range of each parameter%0Aparam_range = %7B 'n': %5B'2', '10', '100', '1000', '10000', '100000', '1000000', '10000000'%5D,%0A 'P': %5B'4', '10', '20', '30', '40'%5D,%0A 't': %5B'0.5', '0.4', '0.3', '0.2'%5D,%0A... | |
e7bbd7f975d478846843e14e83e238294feaee86 | Create mc_tools.py | mc_tools.py | mc_tools.py | Python | 0.000004 | @@ -0,0 +1,1915 @@
+%22%22%22%0AFilename: mc_tools.py%0AAuthors: John Stachurski and Thomas J. Sargent%0A%22%22%22%0A%0Aimport numpy as np%0Afrom discrete_rv import DiscreteRV%0A%0Adef mc_compute_stationary(P):%0A %22%22%22%0A Computes the stationary distribution of Markov matrix P.%0A%0A Parameters %0A ===... | |
a3e9097247f4abe660696e5bd19f06e7e5756249 | Add start of Python solution for day 9 (parsing only) | python/day9.py | python/day9.py | Python | 0 | @@ -0,0 +1,939 @@
+#!/usr/local/bin/python3%0A%0A%0Adef parse_input(text):%0A %22%22%22Parse a list of destinations and weights%0A%0A Returns a list of tuples (source, dest, weight).%0A%0A Edges in this graph and undirected.%0A%0A The input contains multiple rows appearing like so:%0A A to B = W%0A ... | |
1f5bd0236e3fd97287891c37bf64cadcae38c444 | add python | python/exmo.py | python/exmo.py | Python | 0.998891 | @@ -0,0 +1,679 @@
+import httplib%0D%0Aimport urllib%0D%0Aimport json%0D%0Aimport hashlib%0D%0Aimport hmac%0D%0Aimport time%0D%0A %0D%0Aapi_key = %22your_key%22%0D%0Aapi_secret = %22your_secret%22%0D%0A%0D%0Anonce = int(round(time.time()*1000))%0D%0A %0D%0Aparams = %7B%22nonce%22: nonce%7D%0D%0Aparams = urllib.urlencod... | |
5ba61a7898a8fe70bd19993f8b0f8c502f514621 | add batch cp | batchmv.py | batchmv.py | Python | 0.000003 | @@ -0,0 +1,892 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A__author__ = 'xilei'%0A%0Aimport os%0Aimport sys%0Aimport hashlib%0Aimport shutil%0A%0Adef md5hex(s):%0A m = hashlib.md5()%0A m.update(s.encode('UTF-8'))%0A return m.hexdigest()%0A%0A%0Aif __name__ == '__main__':%0A if len(sys.argv) %3... | |
422baea7ea6120dae3f7ac0d412a19b66958e3ad | Add migration | project/apps/api/migrations/0074_catalog_song_name.py | project/apps/api/migrations/0074_catalog_song_name.py | Python | 0.000002 | @@ -0,0 +1,413 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('api', '0073_auto_20151027_1111'),%0A %5D%0A%0A operations = %5B%0A migrations.AddField(%0... | |
67d44755557347a390ede3a4b5f872dc08b73805 | add tests for weighting angles | tests/test_angle_weights.py | tests/test_angle_weights.py | Python | 0 | @@ -0,0 +1,2660 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%22%22%22 Tests backpropagation algorithm%0A%22%22%22%0Afrom __future__ import division, print_function%0A%0Aimport numpy as np%0Aimport os%0Afrom os.path import abspath, basename, dirname, join, split, exists%0Aimport platform%0Aimport sys%0Aimport ... | |
594df6d33eaa66acc5d232b9ea3fcbb8917ca26e | Update user tests | tests/test_user_security.py | tests/test_user_security.py | Python | 0.000001 | @@ -0,0 +1,598 @@
+from unittest import TestCase%0Afrom app import create_app, db%0Afrom app.api.models import User%0A%0A%0Aclass UserModelTestCase(TestCase):%0A%0A def setUp(self):%0A self.app = create_app('default')%0A self.app_context = self.app.app_context()%0A self.app_context.push()%0A ... | |
2f127de7520a0b689bfe5082360eeb53a05d6e2d | Add "repo overview" command. | subcmds/overview.py | subcmds/overview.py | Python | 0.000008 | @@ -0,0 +1,2549 @@
+#%0A# Copyright (C) 2012 The Android Open Source Project%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.... | |
9da427f7b1345ba140561a213cb24f857c3f3482 | Add partial spamhandling tests | test/test_spamhanding.py | test/test_spamhanding.py | Python | 0 | @@ -0,0 +1,2290 @@
+from spamhandling import *%0Aimport pytest%0A%0A@pytest.mark.parametrize(%22title, body, username, site, match%22, %5B%0A ('18669786819 gmail customer service number 1866978-6819 gmail support number', '', '', '', True),%0A ('Is there any http://www.hindawi.com/ template for Cloud-Oriented D... | |
8979c2122abc6f37b31fe9d4193ef9df350d73f0 | Add bwt implementation | bwt/bwt.py | bwt/bwt.py | Python | 0 | @@ -0,0 +1,559 @@
+%0A%0A%0Adef encode(s):%0A shifts = %5B%5D%0A for i in range(len(s)):%0A shifts.append(s%5Bi:%5D + s%5B:i%5D)%0A shifts.sort()%0A encoded = ''.join(shifted%5B-1%5D for shifted in shifts)%0A return encoded, shifts.index(s)%0A%0A%0Adef decode(s, indx):%0A table = %5B'' for ch i... | |
b81825eb66bd5a9dac6a1e3ff4dfb99e6addd5ac | add ex0 template | ch3/ex0.py | ch3/ex0.py | Python | 0 | @@ -0,0 +1,263 @@
+#!/usr/bin/env python%0A#%0A# To be used as an exercise template for all the rest of the exercises.%0A#%0A# Style guide to be used: https://google.github.io/styleguide/pyguide.html%0A#%0A%0Adef main():%0A print %22Hello world!%22%0A return%0A%0Aif __name__ == '__main__':%0A main()%0A
| |
9572f256d57bb43cac63cbf0325226d36426eb8d | Add urls file for pods. | casepro/pods/urls.py | casepro/pods/urls.py | Python | 0 | @@ -0,0 +1,85 @@
+from casepro.pods.registry import get_url_patterns%0A%0Aurlpatterns = get_url_patterns()%0A
| |
b95e5cd706a1cf81e41debae30422345cef3a1ee | Add simple parser to return some activity numbers from our git log. | tests/committerparser.py | tests/committerparser.py | Python | 0 | @@ -0,0 +1,2582 @@
+#!/usr/bin/python%0Aimport sys%0Aimport getopt%0Aimport re%0Aimport email.utils%0Aimport datetime%0A%0Aclass Usage(Exception):%0A def __init__(self, msg):%0A self.msg = msg%0A%0Adef parse_date(datestr):%0A d = email.utils.parsedate(datestr)%0A%0A return datetime.datetime(d%5B0%5D,d%5... | |
666582ff2edf201102e88038e8053908b8020472 | add player data test | tests/test_playerData.py | tests/test_playerData.py | Python | 0 | @@ -0,0 +1,707 @@
+from unittest import TestCase%0A%0Afrom nba_data.data.player_data import PlayerData%0A%0A%0Aclass TestPlayerData(TestCase):%0A def test_instantiation(self):%0A player_id = '1234'%0A name = 'jae'%0A jersey = 0%0A team_seasons = list()%0A self.assertIsNotNone(Playe... | |
19bff8fb2141e9e389e4af057c4ea1623a07ac47 | Add serializer test | tests/test_serializer.py | tests/test_serializer.py | Python | 0.000001 | @@ -0,0 +1,751 @@
+from datetime import datetime%0A%0Afrom tinydb import TinyDB, where%0Afrom tinydb.middlewares import SerializationMiddleware%0Afrom tinydb.serialize import Serializer%0Afrom tinydb.storages import MemoryStorage%0A%0A%0Aclass DateTimeSerializer(Serializer):%0A OBJ_CLASS = datetime%0A FORMAT = '%... | |
3020b2084b24f1e00f0b9fc1d06186b1e697647e | Test long jid passed on CLI | tests/unit/utils/args.py | tests/unit/utils/args.py | Python | 0 | @@ -0,0 +1,747 @@
+# -*- coding: utf-8 -*-%0A%0A# Import Salt Libs%0Afrom salt.utils import args%0A%0A# Import Salt Testing Libs%0Afrom salttesting import TestCase, skipIf%0Afrom salttesting.mock import NO_MOCK, NO_MOCK_REASON%0Afrom salttesting.helpers import ensure_in_syspath%0A%0Aensure_in_syspath('../../')%0A%0A@sk... | |
8f597e766e9ef8014da4391a7109d9b77daf127e | Add tests for user utilities sum_ and prod_ | tests/user_utils_test.py | tests/user_utils_test.py | Python | 0 | @@ -0,0 +1,504 @@
+%22%22%22Tests for user utility functions.%22%22%22%0A%0Afrom drudge import Vec, sum_, prod_%0Afrom drudge.term import parse_terms%0A%0A%0Adef test_sum_prod_utility():%0A %22%22%22Test the summation and product utility.%22%22%22%0A%0A v = Vec('v')%0A vecs = %5Bv%5Bi%5D for i in range(3)%5D%0... | |
49b3bc23edfb3016228c4f39e4af6e8909eb183f | Create the_supermarket_queue.py | the_supermarket_queue.py | the_supermarket_queue.py | Python | 0.000513 | @@ -0,0 +1,275 @@
+#Kunal Gautam%0A#Codewars : @Kunalpod%0A#Problem name: The Supermarket Queue%0A#Problem level: 6 kyu%0A%0Adef queue_time(customers, n):%0A if not customers: return 0%0A li=customers%5B:n%5D%0A for customer in customers%5Bn:%5D:%0A li%5Bli.index(min(li))%5D+=customer%0A return ma... | |
06c3a417f0270d76a7fcc9e94fdb40f9952b9d12 | Add a login view that automatically starts the oauth2 flow for authenticating using the IdM server | src/wirecloud/fiware/views.py | src/wirecloud/fiware/views.py | Python | 0 | @@ -0,0 +1,1193 @@
+# -*- coding: utf-8 -*-%0A%0A# Copyright (c) 2012-2013 CoNWeT Lab., Universidad Polit%C3%A9cnica de Madrid%0A%0A# This file is part of Wirecloud.%0A%0A# Wirecloud is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as published by%0... | |
ba0ee66177f11fb1c13b00167b04e0ddd23f4e28 | Update bulma | wdom/themes/bulma.py | wdom/themes/bulma.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from wdom.tag import NewTagClass as NewTag
from wdom.tag import *
css_files = [
'//cdnjs.cloudflare.com/ajax/libs/bulma/0.0.20/css/bulma.min.css',
]
js_files = []
headers = []
Button = NewTag('Button', bases=Button, class_='button')
DefaultButton = NewTag('Default... | Python | 0.000001 | @@ -1466,16 +1466,60 @@
umns')%0A%0A
+Col = NewTag('Col', 'div', class_='column')%0A
Col1 = N
@@ -1529,32 +1529,37 @@
ag('Col', 'div',
+ Col,
class_='is-1')%0A
@@ -1577,32 +1577,37 @@
ag('Col', 'div',
+ Col,
class_='is-2')%0A
@@ -1625,32 +1625,37 @@
ag('Col', 'div',
+ Col,
class_='is-3')%0A
@@ -1673,32 +1673... |
07b01296bcbc8c8b9220c93d9014973704d88caa | add script/json/ts-pycurl.py | script/json/ts-pycurl.py | script/json/ts-pycurl.py | Python | 0.000003 | @@ -0,0 +1,897 @@
+#!/usr/bin/env python%0A#%0A# ts-pycurl.py%0A#%0A# Author: Zex %3Ctop_zlynch@yahoo.com%3E%0A#%0Aimport pycurl%0A#import json%0Afrom os import path, mkdir%0Afrom basic import *%0Afrom StringIO import StringIO%0A%0Aif not path.isdir(RESPONSE_DIR):%0A mkdir(RESPONSE_DIR)%0A%0Adef case():%0A%0A hea... | |
c51bb87714ade403aeabc9b4b4c62b4ee3a7a8c5 | Add test script for checking to see if scrobbling works on new installs | scripts/test-scrobble.py | scripts/test-scrobble.py | Python | 0 | @@ -0,0 +1,451 @@
+#!/usr/bin/env python%0A%0A##### CONFIG #####%0A%0ASERVER = %22turtle.libre.fm%22%0AUSER = %22testuser%22%0APASSWORD = %22password%22%0A%0A%0A##################%0A%0Aimport gobble, datetime%0A%0Aprint %22Handshaking...%22%0Ags = gobble.GobbleServer(SERVER, USER, PASSWORD, 'tst')%0Atime = datetime.dat... | |
ff1da8b72e0b40d48e6d740bd9eee3fb8f391a58 | add NYU hyperopt search script | scripts/hyperopt/hyperopt_search.py | scripts/hyperopt/hyperopt_search.py | Python | 0 | @@ -0,0 +1,1281 @@
+#!/usr/bin/env python%0A%0Afrom __future__ import print_function%0A%0Aimport sys%0Aimport math%0A%0Afrom hyperopt import fmin, tpe, hp%0Afrom hyperopt.mongoexp import MongoTrials%0A%0A%0Adef get_space():%0A space = (hp.quniform('numTrees', 1, 10, 1),%0A hp.quniform('samplesPerImage', ... | |
379171e30269cfa219bddb481a9300514941f083 | update header | homeassistant/components/switch/demo.py | homeassistant/components/switch/demo.py | """ Demo platform that has two fake switches. """
from homeassistant.helpers.entity import ToggleEntity
from homeassistant.const import STATE_ON, STATE_OFF, DEVICE_DEFAULT_NAME
# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
""" Find and return demo s... | Python | 0.000001 | @@ -1,12 +1,87 @@
%22%22%22
-
+%0Ahomeassistant.components.switch.demo%0A~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0A%0A
Demo pla
@@ -109,25 +109,26 @@
ke switches.
-
+%0A%0A
%22%22%22%0Afrom hom
|
05948850d76626f3b29a80a447280bbd693a93cb | Update HeadingAnchors to receive config options. | wok/contrib/hooks.py | wok/contrib/hooks.py | # vim: set fileencoding=utf8 :
"""Some hooks that might be useful."""
import os
import subprocess
from StringIO import StringIO
import logging
from wok.exceptions import DependencyException
from wok.util import slugify
try:
from lxml import etree
except ImportError:
etree = None
class HeadingAnchors(object... | Python | 0 | @@ -731,16 +731,24 @@
__(self,
+ config,
page):%0A
|
17966c940aacf8a3a9edfae28bb9700a7f58bd1d | Move SSD image to docker | libnetwork/cmd/ssd/ssd.py | libnetwork/cmd/ssd/ssd.py | #!/usr/bin/python
import sys, signal, time, os
import docker
import re
import subprocess
import json
import hashlib
ipv4match = re.compile(
r'(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9]).' +
r'(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9]).' +
r'(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9]).' +
r'(25[0-5]|2[0-4][0-9]|[01]... | Python | 0 | @@ -5347,15 +5347,14 @@
ge='
-sanimej
+docker
/ssd
|
76c4f9b4acbedab7606ddca4c6456db47e68a744 | Add Currency model | game/currencies/__init__.py | game/currencies/__init__.py | Python | 0 | @@ -0,0 +1,723 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0AEnchants%0A - CurrencyTypes.dbc%0A%22%22%22%0A%0Afrom .. import *%0A%0A%0Aclass Currency(Model):%0A%09%0A%09def getTooltip(self):%0A%09%09return CurrencyTooltip(self)%0A%0A%0Aclass CurrencyTooltip(Tooltip):%0A%09def tooltip(self):%0A%09%09self.append(%22name%22, ... | |
91628a8222538286fb84e5870b10acefb57040ae | use psutil 3 compatible children func | checks.d/gunicorn.py | checks.d/gunicorn.py | """
Collects metrics from the gunicorn web server.
http://gunicorn.org/
"""
# stdlib
import time
# 3rd party
import psutil
# project
from checks import AgentCheck
class GUnicornCheck(AgentCheck):
# Config
PROC_NAME = 'proc_name'
# Number of seconds to sleep between cpu time checks.
CPU_SLEEP_SECS... | Python | 0.000007 | @@ -1114,20 +1114,16 @@
er_proc.
-get_
children
|
f2b6d7cb70a0a5b4f1a96657ba66455cdab67b45 | Add search for weird memories | weird.py | weird.py | Python | 0 | @@ -0,0 +1,2372 @@
+%EF%BB%BF#%0D%0A# Author: Brent Nelson%0D%0A# Created: 18 Dec 2020%0D%0A# Description:%0D%0A# Given a directory, will analyze all the MDD files%0D%0A%0D%0Aimport glob%0D%0Aimport patch_mem%0D%0Aimport parseutil.parse_mdd as mddutil%0D%0Afrom collections import namedtuple%0D%0A%0D%0AMdd = namedtup... | |
0312a4210d07618755b6ad9caf49b144e7bec58c | add en-gb format tests | babybuddy/tests/formats/tests_en_gb.py | babybuddy/tests/formats/tests_en_gb.py | Python | 0.000002 | @@ -0,0 +1,2750 @@
+# -*- coding: utf-8 -*-%0Aimport datetime%0A%0Afrom django.core.exceptions import ValidationError%0Afrom django.forms.fields import DateTimeField%0Afrom django.test import TestCase, override_settings, tag%0Afrom django.utils.formats import date_format, time_format%0A%0Afrom babybuddy.middleware impo... | |
f14ca27897ade9b4a19aa29b869a845486f67829 | Create audit object class | market/audit.py | market/audit.py | Python | 0.000001 | @@ -0,0 +1,794 @@
+__author__ = 'hoffmabc'%0A%0Afrom log import Logger%0A%0A%0Aclass Audit(object):%0A %22%22%22%0A A class for handling audit information%0A %22%22%22%0A%0A def __init__(self, db):%0A self.db = db%0A%0A self.log = Logger(system=self)%0A%0A self.action_ids = %7B%0A ... | |
83a7b19d33c9dac43e103933c9b4a734304ed2a1 | Add some unit tests. | HearthStone2/test/utils/test_misc.py | HearthStone2/test/utils/test_misc.py | Python | 0 | @@ -0,0 +1,730 @@
+#! /usr/bin/python%0A# -*- coding: utf-8 -*-%0A%0Aimport os%0Aimport sys%0Aimport unittest%0A%0Asys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..'))%0A%0Aimport MyHearthStone.utils.misc as misc%0A%0A__author__ = 'fyabc'%0A%0A%0Aclass TestMisc(unittest.TestCase):%0A... | |
3f1e21e1d2a3d1418c19e454f77071686d21f7b9 | add external project | meinberlin/apps/extprojects/admin.py | meinberlin/apps/extprojects/admin.py | Python | 0 | @@ -0,0 +1,562 @@
+from django.contrib import admin%0A%0Afrom . import models%0A%0A%0A@admin.register(models.ExternalProject)%0Aclass ExternalProjectAdmin(admin.ModelAdmin):%0A fields = (%0A 'name', 'url', 'description', 'tile_image', 'tile_image_copyright',%0A 'is_archived'%0A )%0A list_display ... | |
be30299c1e9013a99bf7e828700741c1ce3fe386 | Create a contrib rule for creating docker_push defaults. (#92) | docker/contrib/with-defaults.bzl | docker/contrib/with-defaults.bzl | Python | 0 | @@ -0,0 +1,2128 @@
+# Copyright 2017 The Bazel Authors. All rights reserved.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%... | |
40136d00bb5f81fa35d2240511c02ea2f6d26fd7 | 792. Number of Matching Subsequences | LeetCode/NumberOfMatchingSubsequences.py | LeetCode/NumberOfMatchingSubsequences.py | Python | 0.999999 | @@ -0,0 +1,735 @@
+%22%22%22%0ANaive solution counting matches was too slow (O(sum # letters in words)).%0ASped it up just enough by preventing recalculation on duplicate words.%0A%22%22%22%0A%0Afrom collections import Counter%0A%0Adef is_subsequence(subs, s):%0A if len(subs) == 0:%0A return True%0A if len... | |
42b4ca440ea785ae764f2c50fa0ca96539c2db8d | Create ShuffleLabel.py | histomicstk/ShuffleLabel.py | histomicstk/ShuffleLabel.py | Python | 0 | @@ -0,0 +1,1068 @@
+import numpy as np%0Afrom skimage import measure as ms%0A%0A%0Adef ShuffleLabel(Label):%0A %22%22%22%0A Shuffles labels in a label image to improve visualization and enhance%0A object boundaries.%0A%0A Parameters%0A ----------%0A Label : array_like%0A A label image generated... | |
9c185b4e81deee0aede8e66b2ef258ea0dbd00d8 | Fix LXDContainerImage.fetch_image | nclxd/nova/virt/lxd/container_image.py | nclxd/nova/virt/lxd/container_image.py | # Copyright 2015 Canonical Ltd
# 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... | Python | 0.000002 | @@ -2007,32 +2007,35 @@
+if
self.lxd.image_d
@@ -2064,144 +2064,8 @@
ref)
-%0A except lxd_exceptions.APIError as e:%0A if e.status_code == 404:%0A pass%0A else
:%0A
@@ -2224,24 +2224,139 @@
y exists.'))
+%0A except lxd_excep... |
dcd83ea781ad8de1111984c8972b314f6f88e4d0 | add orm-1 | www/transwarp/orm.py | www/transwarp/orm.py | Python | 0.004123 | @@ -0,0 +1,1156 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A__author__ = 'Jeff Chen'%0A%0A'''%0A%E5%B0%81%E8%A3%85orm%E6%93%8D%E4%BD%9C%0A'''%0A%0Aimport db%0A%0Aclass Field(object):%0A '''%0A db%E7%9A%84%E5%AD%97%E6%AE%B5%E5%90%8D%E5%92%8C%E7%B1%BB%E5%9E%8B%0A '''%0A def __init__(self, name, c... | |
5e1ba2f9a14634fb1e8a7eaadbad370b97beb383 | Add Middle English | cltk/corpus/middle_english/alphabet.py | cltk/corpus/middle_english/alphabet.py | Python | 0.000002 | @@ -0,0 +1,1611 @@
+%22%22%22%0ASources:%0A From Old English to Standard English: A Course Book in Language Variation Across Time, Dennis Freeborn%0A https://web.cn.edu/kwheeler/documents/ME_Pronunciation.pdf%0A https://en.wikipedia.org/wiki/Middle_English_phonology%0A%22%22%22%0A%0AALPHABET = %5B'... | |
51dc6dc1ebe6babb468f0ef607ff750327a366ba | Enable the change tracking tables in admin. | pubsubpull/admin.py | pubsubpull/admin.py | Python | 0 | @@ -0,0 +1,169 @@
+%22%22%22%0A Enable admin%0A%22%22%22%0Afrom django.contrib import admin%0Afrom pubsubpull.models import Request, UpdateLog%0A%0A%0Aadmin.site.register(Request)%0Aadmin.site.register(UpdateLog)%0A
| |
bce4656156b4f04655f38099a4b577651dc794d5 | make python -m crossbar work, using the same console script | crossbar/__main__.py | crossbar/__main__.py | Python | 0.000001 | @@ -0,0 +1,1641 @@
+#####################################################################################%0A#%0A# Copyright (C) Tavendo GmbH%0A#%0A# Unless a separate license agreement exists between you and Tavendo GmbH (e.g. you%0A# have purchased a commercial license), the license terms below apply.%0A#%0A# Shou... | |
6798e3460e573b06bbf941f96102ef4ce196ca49 | add channel for rpc | python/proto/pyRpc2/channler.py | python/proto/pyRpc2/channler.py | Python | 0.000001 | @@ -0,0 +1,3654 @@
+#!/usr/bin/env python%0A# -*- encoding: utf-8 -*-%0A#%0A# Copyright (c) 2016 ASMlover. All rights reserved.%0A#%0A# Redistribution and use in source and binary forms, with or without%0A# modification, are permitted provided that the following conditions%0A# are met:%0A#%0A# * Redistributions of sou... | |
23da66a6a36ab82b7cb356d110c26ef9a0412932 | Create EVE-FAG-DETECTOR.py | EVE-FAG-DETECTOR.py | EVE-FAG-DETECTOR.py | Python | 0.00013 | @@ -0,0 +1,322 @@
+print(%22EVE FAG DETECTOR v2.2.3%22)%0AeveName = input(%22What is the character's name?%22)%0Aif(eveName == %22Raven Null%22):%0A%09print(%22Raven Null is not a fag.%22)%0Aelif(eveName ==%22raven null%22):%0A%09print(%22Learn how to use the shift key dumbass. Also, no faggotry was detected for Raven ... | |
6214758e0a4b7140454a4ef244521e87541307e5 | Add python3 template | python3.py | python3.py | Python | 0 | @@ -0,0 +1,1040 @@
+#!/usr/bin/env python3%0A%0Aimport warnings%0Awith warnings.catch_warnings():%0A import re%0A import sys%0A import argparse%0A import os%0A import os.path%0A import logging%0A%0Ascript_dir=os.path.abspath(os.path.dirname(__file__))%0A %0Adef create_preferences_directory():%0A ... | |
aea51be0e9428ddb4f72b3382fea1ae1cd99f1a9 | add crude performance test script | test/performance.py | test/performance.py | Python | 0.000001 | @@ -0,0 +1,1563 @@
+# -*- coding: utf-8 -*-%0A#%0Aimport time%0A%0Aimport numpy%0Aimport pytest%0A%0Aimport meshio%0A%0A%0Adef generate_mesh():%0A '''Generates a fairly large mesh.%0A '''%0A import pygmsh%0A geom = pygmsh.built_in.Geometry()%0A%0A geom.add_circle(%0A %5B0.0, 0.0, 0.0%5D,%0A ... | |
478a78494199b8282b635323128c07f2661df58b | add pong | pong/pong.py | pong/pong.py | Python | 0.001045 | @@ -0,0 +1,2307 @@
+#TKinterPongGame.py%0Afrom tkinter import *%0Aimport random%0Aimport time%0Aclass Ball:%0A def __init__(self, canvas, paddle, color):%0A self.canvas = canvas%0A self.paddle = paddle%0A self.id = canvas.create_oval(10, 10, 25, 25, fill=color)%0A self.canvas.move(self.id... | |
12c72bbd41b7f42b1962bd17f6d80549478d4b3a | Version bump | sendgrid/version.py | sendgrid/version.py | version_info = (1, 2, 1)
__version__ = '.'.join(str(v) for v in version_info)
| Python | 0.000001 | @@ -15,17 +15,17 @@
(1, 2,
-1
+2
)%0A__vers
|
97b9ee00277fa35c92886b1ed39864eba3707dce | Add organizer permissions to staff group | bluebottle/activities/migrations/0020_auto_20200224_1005.py | bluebottle/activities/migrations/0020_auto_20200224_1005.py | Python | 0 | @@ -0,0 +1,702 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.15 on 2019-11-11 12:19%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0Afrom bluebottle.utils.utils import update_group_permissions%0A%0A%0Adef add_group_permissions(apps, schema_editor):%0A group_perms = %7B%0A ... | |
f2ec232ce654a645e5d243cc2a794b7a69fd438d | use your RPI for powerpoint presentations! | presenter.py | presenter.py | Python | 0 | @@ -0,0 +1,754 @@
+%22%22%22%0Athis script uses XAutomation, i.e. the xte command. install it with:%0A%3Esudo apt-get install xautomation%0A%0A%22%22%22%0Aimport RPi.GPIO as GPIO%0Aimport subprocess%0Aimport time%0A%0A%0AbtnPin1 = 27%0AbtnPin2 = 22%0A%0A%0AGPIO.setwarnings(False)%0AGPIO.setmode(GPIO.BCM)%0AGPIO.setup(b... | |
9ce799511701f1d8f06ce2555253325ad8c76cc2 | add abstract action class | rprpg/battle/action.py | rprpg/battle/action.py | Python | 0.000538 | @@ -0,0 +1,243 @@
+import abc%0A%0Aclass Action(object):%0A __metaclass__ = abc.ABCMeta%0A%0A def __init__(self, requires_target):%0A self.target = None%0A self.requires_target = requires_target%0A%0A @abc.abstractmethod%0A def execute(self):%0A pass%0A
| |
b2b09ffd38a05f7a9a065dc0a2b23ee292efee12 | fix NameError in impute | Engine.py | Engine.py | import inspect
#
import numpy
#
import cython.State as State
class Engine(object):
def __init__(self):
self.seed = 0
def initialize(self, M_c, M_r, T, i):
p_State = State.p_State(numpy.array(T))
X_L = p_State.get_X_L()
X_D = p_State.get_X_D()
return M_c, M_r, X_L, X_D... | Python | 0.000003 | @@ -1494,32 +1494,128 @@
X_D, Y, q, n):%0A
+ # FIXME: actually implement %0A # FIXME: just spitting out random normals for now %0A
SEED = s
@@ -1757,17 +1757,16 @@
n(q)).to
-_
list()%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.