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 |
|---|---|---|---|---|---|---|---|
8c4833dbf9f4ae32afbfbe6a3cb8e4630abc3d25 | Add test for local login | test/requests/test_login_local.py | test/requests/test_login_local.py | Python | 0 | @@ -0,0 +1,1936 @@
+import requests%0Afrom wqflask import user_manager%0Afrom parametrized_test import ParametrizedTest%0A%0Aclass TestLoginLocal(ParametrizedTest):%0A%0A def setUp(self):%0A super(TestLoginLocal, self).setUp()%0A self.login_url = self.gn2_url +%22/n/login%22%0A data = %7B%0A ... | |
008711b6d5506aed60a693c296a7a01180c2ea86 | Create dss.py | dss.py | dss.py | Python | 0.000001 | @@ -0,0 +1,1959 @@
+from functions import *%0Aimport multiprocessing%0Aimport time%0A%0Awith open(%22config.txt%22) as f:%0A lines = f.readlines()%0Amax_instances = int(lines%5B0%5D.split(' ')%5B1%5D)%0A%0A%0Aclass machine():%0A 'Class for the instance of a machine'%0A %0A q = %5Bmultiprocessing.Queue() fo... | |
c0e7393c5cc3f1095891a35b552e4a69733c83b6 | add a simple example | demos/helloworld.py | demos/helloworld.py | Python | 0.999997 | @@ -0,0 +1,248 @@
+#!/usr/bin/env python%0D%0Afrom __future__ import with_statement%0D%0A%0D%0Aimport PyV8%0D%0A%0D%0Aclass Global(PyV8.JSClass):%0D%0A def writeln(self, arg):%0D%0A print arg%0D%0A %0D%0Awith PyV8.JSContext(Global()) as ctxt:%0D%0A ctxt.eval(%22writeln('Hello World');%22)%0D%0A
| |
5669960952104b811df34fa9229d7e597407c753 | add basic unit testing for appliance instances (incomplete) | tests/test_appliance_instance.py | tests/test_appliance_instance.py | Python | 0.000017 | @@ -0,0 +1,769 @@
+import sys%0Asys.path.append('..')%0Aimport disaggregator as da%0Aimport unittest%0Aimport pandas as pd%0Aimport numpy as np%0A%0Aclass ApplianceInstanceTestCase(unittest.TestCase):%0A%0A def setUp(self):%0A indices = %5Bpd.date_range('1/1/2013', periods=96, freq='15T'),%0A ... | |
18103afcc20dcf9ada357b36d58a62756ddb3e3e | Fix tests | tests/storage/dav/test_main.py | tests/storage/dav/test_main.py | # -*- coding: utf-8 -*-
import datetime
import os
from textwrap import dedent
import pytest
import requests
import requests.exceptions
from tests import EVENT_TEMPLATE, TASK_TEMPLATE, VCARD_TEMPLATE
import vdirsyncer.exceptions as exceptions
from vdirsyncer.storage.base import Item
from vdirsyncer.storage.dav impo... | Python | 0.000003 | @@ -4614,75 +4614,16 @@
rl,
-data=None, headers=None, auth=None,%0A verify=None
+**kwargs
):%0A
|
54f7cdf15d3fdbd70a5f06ec38aa84dfd828c7e7 | Add simple gui | gui.py | gui.py | Python | 0.000001 | @@ -0,0 +1,1047 @@
+from tkinter import Tk, LEFT, SUNKEN, X%0Afrom tkinter.ttk import Frame, Button, Style%0Afrom PIL import Image, ImageTk%0A%0A%0Adef main():%0A root = Tk()%0A root.geometry(%22300x300%22)%0A%0A separator = Frame(root, height=200, relief=SUNKEN)%0A separator.pack(fill=X, padx=10)%0A%0A ... | |
5af36bbe29a8a7a7418fc535c5647c9be511f0b4 | Add script to write user counts to csv. | scripts/userCounts.py | scripts/userCounts.py | Python | 0 | @@ -0,0 +1,782 @@
+%22%22%22%0AScript to write user counts for each region to CSV.%0A%0A%22%22%22%0A%0Aimport twitterproj%0A%0Adef main():%0A%0A db = twitterproj.connect()%0A filenames = %5B'grids/counties.user_counts.bot_filtered.csv',%0A 'grids/states.user_counts.bot_filtered.csv',%0A ... | |
fb15c992a286abe066333abfdabbb13646d383d6 | Create final_P7_Frob.py | final_P7_Frob.py | final_P7_Frob.py | Python | 0.000866 | @@ -0,0 +1,1208 @@
+class Frob(object):%0A def __init__(self, name):%0A self.name = name%0A self.before = None%0A self.after = None%0A def setBefore(self, before):%0A # example: a.setBefore(b) sets b before a%0A self.before = before%0A def setAfter(self, after):%0A # e... | |
0c18bb0993be77059aa75015cc5433eaacbe8999 | Add barebones RFC downloader and renderer. | rfc.py | rfc.py | Python | 0 | @@ -0,0 +1,436 @@
+import pydoc%0Aimport sys%0A%0Atry:%0A from urllib.request import urlopen%0Aexcept ImportError:%0A from urllib2 import urlopen%0A%0A%0Adef get_rfc(rfc):%0A url = %22http://www.ietf.org/rfc/rfc%7B0%7D.txt%22.format(rfc)%0A f = urlopen(url)%0A data = f.read()%0A if isinstance(data, by... | |
681c21a5fbf3bc713468e33bb10dfa9bf6d62850 | Add migration to fix admin users with roles | corehq/apps/users/migrations/0004_rm_role_id_from_admins.py | corehq/apps/users/migrations/0004_rm_role_id_from_admins.py | Python | 0 | @@ -0,0 +1,1377 @@
+from django.db import migrations%0A%0Afrom corehq.apps.es import UserES%0Afrom corehq.apps.users.models import WebUser%0Afrom corehq.util.couch import DocUpdate, iter_update%0Afrom corehq.util.django_migrations import skip_on_fresh_install%0Afrom corehq.util.log import with_progress_bar%0A%0A%0A@ski... | |
3134e22eb5da9bd7104c199f788288e0fc823db2 | Add basic endopoints powered by bottle | app.py | app.py | Python | 0 | @@ -0,0 +1,1456 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Aimport bottle%0Afrom bottle import route, run, template, request, response%0A%0Aimport os%0Aimport uuid%0A%0A@route('/')%0Adef get_simple_form():%0A %22%22%22%0A Returns simple images upload form%0A :return:%0A %22%22%22%0A return (... | |
07442bd7ddd07635002493bafb6ac16a24fd5d82 | Add script for http live streaming | hls.py | hls.py | Python | 0 | @@ -0,0 +1,2715 @@
+var http = require('http');%0Avar fs = require('fs');%0Avar url = require('url');%0Avar path = require('path');%0Avar zlib = require('zlib');%0A%0APORT = 8000;%0A%0Ahttp.createServer(function (req, res) %7B%0A var uri = url.parse(req.url).pathname;%0A%0A if (uri == '/player.html') %7B%0A ... | |
4596c0a54457ee515d164bafc399010af190eaa9 | Add basic http service to turn a led ON-OFF | led.py | led.py | Python | 0 | @@ -0,0 +1,369 @@
+from flask import Flask%0Aimport RPi.GPIO as GPIO%0A%0A%0Aapp = Flask(__name__)%0A%0A%0A@app.route(%22/led/on/%22)%0Adef led_on():%0A GPIO.output(11, GPIO.HIGH)%0A return %22Led ON%22%0A%0A%0A@app.route(%22/led/off/%22)%0Adef led_off():%0A GPIO.output(11, GPIO.LOW)%0A return %22Led OFF%22... | |
3492ffd5ffa0c7d1dfb5a9f4a587777245044685 | add test cases of ruamel.yaml backend | tests/backend/yaml/ruamel_yaml.py | tests/backend/yaml/ruamel_yaml.py | Python | 0 | @@ -0,0 +1,1414 @@
+#%0A# Copyright (C) - 2018 Satoru SATOH %3Cssato @ redhat.com%3E%0A# License: MIT%0A#%0A# pylint: disable=missing-docstring,invalid-name,too-few-public-methods%0A# pylint: disable=ungrouped-imports%0Afrom __future__ import absolute_import%0A%0Aimport os%0Aimport anyconfig.backend.yaml.pyyaml as TT%0... | |
3f9a8ee16e47f4ce0d75a1b856341c05436c2aff | Create sending_email.py | sending_email.py | sending_email.py | Python | 0.000005 | @@ -0,0 +1,2415 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on Wed May 10 16:32:22 2017%0AThis scripts are used to send out data from Pasture to Wenlong from field.%0A%0AKey features:%0A- Parse and send out all .par files%0A- Send out email at certain intervals: such as one day.%0A@author: wliu14%0A%22%22%22%0A%0... | |
03f46b0d6867bcb8a88e53b26089705cb1667bbd | Add script to generate images from all samples | tools/create_from_sample_texts.py | tools/create_from_sample_texts.py | Python | 0 | @@ -0,0 +1,356 @@
+#!/usr/bin/env python%0A%0Aimport teetime%0Aimport os%0A%0A%0Adef main():%0A with open('samples/sample-texts.txt') as fh:%0A for line in fh:%0A print line.strip()%0A path = teetime.create_typography(line.strip(), colors=False)%0A os.rename(path, os.path.join... | |
08c0c68ed52e9644cc92ad8afdc423b43b4c1326 | Add Fractal_Tree.py. | Fractal_Tree.py | Fractal_Tree.py | Python | 0 | @@ -0,0 +1,454 @@
+__author__ = %22ClaytonBat%22%0Aimport turtle%0A%0Adef tree(branchLen,t):%0A if branchLen %3E 5:%0A t.forward(branchLen)%0A t.right(20)%0A tree(branchLen-15,t)%0A t.left(40)%0A tree(branchLen-15,t)%0A t.right(20)%0A t.backward(branchLen)%0A%0Adef ma... | |
b575394351209239b754b99b3839ba4c799fc831 | Use _pb2_grpc module to access gRPC entities | src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py | src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py | # Copyright 2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | Python | 0 | @@ -2498,32 +2498,37 @@
r(reflection_pb2
+_grpc
.ServerReflectio
|
1893473729acd938a0657127b82892af1bdb987b | Create AbortMultipartUploads.py | obs/cleanUnmergedFragments/AbortMultipartUploads.py | obs/cleanUnmergedFragments/AbortMultipartUploads.py | Python | 0 | @@ -0,0 +1,1088 @@
+#!/usr/bin/python%0A# -*- coding: UTF-8 -*-%0Aimport sys%0Aimport commands%0A%0Aif __name__ == '__main__':%0A if len(sys.argv%5B1:%5D) %3E 0:%0A bucket_nameurl = str(sys.argv%5B1:%5D%5B0%5D)%0A else:%0A bucket_nameurl = %22%22%0A print(%22bucket name should be specified%5C... | |
6dca2d95144ebe22f58cb4dafb00a3f8a402316e | add answer for question 4 | question_4/heguilong.py | question_4/heguilong.py | Python | 0.999999 | @@ -0,0 +1,1646 @@
+#!/usr/bin/env python3%0A%22%22%22%0AFile: heguilong.py%0AAuthor: heguilong%0AEmail: hgleagle@gmail.com%0AGithub: https://github.com/hgleagle%0ADescription:%0A %E6%96%90%E6%B3%A2%E9%82%A3%E5%A5%91%E6%95%B0%E5%88%97%E7%94%B10%E5%92%8C1%E5%BC%80%E5%A7%8B%EF%BC%8C%E4%B9%8B%E5%90%8E%E7%9A%84%E6%96%90... | |
a50ce7117e4c1300410b74b5511722e4d7d57be4 | Implement script to automate setting scope location and time | set_when_and_where.py | set_when_and_where.py | Python | 0 | @@ -0,0 +1,1098 @@
+#!/usr/bin/env python%0A%0Aimport config%0Aimport configargparse%0Aimport math%0Aimport time%0Aimport nexstar%0Aimport ephem%0A%0Aparser = configargparse.ArgParser(default_config_files=config.DEFAULT_FILES)%0Aparser.add_argument('--scope', help='serial device for connection to telescope', default='/... | |
1212677ac1087498fa83a3d4d9e8ba9d13c35b20 | Add the basic structure for the notification handler. | handler/notification.py | handler/notification.py | Python | 0 | @@ -0,0 +1,32 @@
+class ListHandler(BaseHandler):%0A
| |
77fc04ddf6dbc9cb618b427b36628adb019b2f43 | add import script | scripts/import.py | scripts/import.py | Python | 0 | @@ -0,0 +1,1083 @@
+#!/usr/bin/python%0A#%0A# Copyright (c) 2008 rPath, Inc.%0A#%0A# This program is distributed under the terms of the Common Public License,%0A# version 1.0. A copy of this license should have been distributed with this%0A# source file in a file called LICENSE. If it is not present, the license%0A# is... | |
42a9c36d711f2550cc68fdba96b6af36d3d31d8d | Create grasshopperDebug.py | CodeWars/8kyu/grasshopperDebug.py | CodeWars/8kyu/grasshopperDebug.py | Python | 0.00002 | @@ -0,0 +1,283 @@
+def weather_info (temp):%0A c = convertToCelsius(temp)%0A if (c %3C= 0):%0A return (str(c) + %22 is freezing temperature%22)%0A else:%0A return (str(c) + %22 is above freezing temperature%22)%0A %0Adef convertToCelsius (temp):%0A temp = (((float(temp) - 32) * 5) / 9)%0A re... | |
88fe01b543aeb9e022a2a23df9a2877a6eaaed15 | Add analysis path for the IRAM scripts | paths.py | paths.py | import os
import socket
from functools import partial
import glob
'''
Common set of paths giving the location of data products.
'''
def name_return_check(filename, path, no_check=False):
full_path = os.path.join(path, filename)
if not os.path.exists(full_path) and not no_check:
raise OSError("{} doe... | Python | 0 | @@ -1404,16 +1404,138 @@
ysis')%0A%0A
+iram_co21_analysispath = %5C%0A partial(name_return_check,%0A path=os.path.join(ancillary_path, 'IRAM30m_CO21'))%0A%0A
# Pipeli
|
9ba0ff62572dcfd7912c9b58091b59844f8e1753 | Add script for Helmholtz rates | results/sccg-table.py | results/sccg-table.py | Python | 0 | @@ -0,0 +1,1430 @@
+import os%0Aimport sys%0Aimport pandas as pd%0A%0A%0Ap4_data = %22helmholtz-results/helmholtz_conv-d-4.csv%22%0Ap5_data = %22helmholtz-results/helmholtz_conv-d-5.csv%22%0Ap6_data = %22helmholtz-results/helmholtz_conv-d-6.csv%22%0Ap7_data = %22helmholtz-results/helmholtz_conv-d-7.csv%22%0Adata_set = ... | |
248c738b31e43ef456d47045bc5f5b2d58d35d98 | add autocomplete with a German-Korean dictionary | workflow/dedic_naver_search.py | workflow/dedic_naver_search.py | Python | 0.000003 | @@ -0,0 +1,1729 @@
+# Naver Search Workflow for Alfred 2%0A# Copyright (C) 2013 Jinuk Baek%0A# This program is free software; you can redistribute it and/or%0A# modify it under the terms of the GNU General Public License%0A# as published by the Free Software Foundation; either version 2%0A# of the License, or (a... | |
4137bdd36fa4a1b4e194c2c61f803cecdebe8f69 | Implement MySQL driver | lib/mysql_driver.py | lib/mysql_driver.py | Python | 0.000001 | @@ -0,0 +1,1329 @@
+import mysql.connector%0A%0Aimport sql_driver%0Aimport screen_buffer%0A%0Aclass MySQLDriver(sql_driver.SqlDriver):%0A class Factory(object):%0A def __init__(self, **mysql_conf):%0A self._mysql_conf = mysql_conf%0A if 'port' in self._mysql_conf:%0A self.... | |
6a29e9f963af4920b21c64d157ca90b0d7d081c4 | implement parallelForLoop.py | pythonPractiseSamples/parallelForLoop.py | pythonPractiseSamples/parallelForLoop.py | Python | 0.000064 | @@ -0,0 +1,368 @@
+#! /usr/bin/env python%0A# -*- coding: utf-8 -*-%0A# vim:fenc=utf-8%0A#%0A# Copyright %C2%A9 2017 Damian Ziobro %3Cdamian@xmementoit.com%3E%0A#%0A%0Afrom joblib import Parallel, delayed%0Aimport multiprocessing%0A%0An=1000000%0A%0Adef squareRoot(i):%0A return i*i%0A%0Acpus = multiprocessing.cpu_co... | |
b9711e4fd82441669fdd97b1e5eeb12f03e995a5 | Make srrun use the proper executable on windows | srrun.py | srrun.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
import copy
import os
import subprocess
import sys
mypath = os.path.abspath(__file__)
mydir = os.... | Python | 0.000083 | @@ -237,16 +237,32 @@
port os%0A
+import platform%0A
import s
@@ -271,16 +271,16 @@
process%0A
-
import s
@@ -351,16 +351,99 @@
ath)%5B0%5D%0A
+if platform.system().lower() == 'windows':%0A srpython = sys.executable%0Aelse:%0A
srhome =
@@ -469,16 +469,20 @@
, '..')%0A
+
srhome =
@@ -506,16 +506,20 @@... |
a0dfe319ae8c834cc4257ef7be4aa0982490d9a0 | Add protocol support for null Arrays | kafka/protocol/types.py | kafka/protocol/types.py | from __future__ import absolute_import
from struct import pack, unpack, error
from .abstract import AbstractType
def _pack(f, value):
try:
return pack(f, value)
except error:
raise ValueError(error)
def _unpack(f, data):
try:
(value,) = unpack(f, data)
return value
... | Python | 0 | @@ -3908,32 +3908,94 @@
e(self, items):%0A
+ if items is None:%0A return Int32.encode(-1)%0A
return b
@@ -4003,16 +4003,16 @@
'.join(%0A
-
@@ -4170,32 +4170,81 @@
32.decode(data)%0A
+ if length == -1:%0A return None%0A
return %5B
@@ -4295,16 +4295,16 @@... |
5d1da267791456f6c5e386d6e7204d02371c2eb2 | Add tests for gold projects | readthedocs/rtd_tests/tests/test_gold.py | readthedocs/rtd_tests/tests/test_gold.py | Python | 0 | @@ -0,0 +1,2175 @@
+from django.contrib.auth.models import User%0Afrom django.core.urlresolvers import reverse%0Afrom django.test import TestCase%0A%0Afrom django_dynamic_fixture import get%0Afrom django_dynamic_fixture import new%0A%0Afrom readthedocs.gold.models import GoldUser, LEVEL_CHOICES%0Afrom readthedocs.proje... | |
680ab5562e2b4599c74b9605b688538c1da1479d | add profiler helper function | lib/util/profile.py | lib/util/profile.py | Python | 0.000001 | @@ -0,0 +1,367 @@
+import cProfile%0A%0Adef profile_this(fn):%0A def profiled_fn(*args, **kwargs):%0A fpath = fn.__name__ + '.profile'%0A prof = cProfile.Profile()%0A ret = prof.runcall(fn, *args, **kwargs)%0A prof.dump_stats(fpath)%0A return ret%0A return profiled_fn%0A%0A# Jus... | |
73479f2efe46623f40ea4a49edfc79de0725a291 | Create cdbhelp.py | cdbhelp.py | cdbhelp.py | Python | 0.000029 | @@ -0,0 +1,1172 @@
+%22%22%22cdbhelp.py%0A%0AThis file will define a window which displays help information.%0A%22%22%22%0A%0Afrom tkinter import *%0Afrom tkinter import ttk%0A%0Aclass cdbHelp:%0A def __init__(self, tag):%0A %0A self.bgcolor = 'lavender'%0A %0A self.helpwin = Tk()%0A ... | |
426afb06904b2e4ebab380b6d5ea79c2f481cb44 | add text encoder | rlp/sedes/text.py | rlp/sedes/text.py | Python | 0.000039 | @@ -0,0 +1,1964 @@
+from rlp.exceptions import SerializationError, DeserializationError%0Afrom rlp.atomic import Atomic%0A%0A%0Aclass Text:%0A %22%22%22A sedes object for encoded text data of certain length.%0A%0A :param min_length: the minimal length in encoded characters or %60None%60 for no lower limit%0A :... | |
c83e946a2b5205c7246b1cfbde7b6e84759b3876 | add potentiometer script | potentiometer.py | potentiometer.py | Python | 0.000001 | @@ -0,0 +1,585 @@
+#from pydcpf.appliances.quido import Device as QuidoDevice%0A#from pydcpf.appliances.ad4xxx_drak4 import Device as AD4Device%0A#from pydcpf.appliances.evr116 import Device as EVRDevice%0A#from pydcpf.appliances.AC250Kxxx import Device as AC250KDevice%0A%0ATELNET = %22telnet 192.168.2.243 10001%22%0At... | |
4b67b82daab0b42bcd452c00e13ad47f918e9e38 | Fix the Android build. | gyp/opts.gyp | gyp/opts.gyp | {
'targets': [
# Due to an unfortunate intersection of lameness between gcc and gyp,
# we have to build the *_SSE2.cpp files in a separate target. The
# gcc lameness is that, in order to compile SSE2 intrinsics code, it
# must be passed the -msse2 flag. However, with this flag, it may
# emit SSE... | Python | 0.000053 | @@ -5024,62 +5024,8 @@
S',%0A
- '../src/opts/SkBitmapProcState_arm_neon.cpp',%0A
|
eb3510933b356c5b97e7a0cce9ebad563f21bf3c | Create BinTreeInTraversal_002.py | leetcode/094-Binary-Tree-Inorder-Traversal/BinTreeInTraversal_002.py | leetcode/094-Binary-Tree-Inorder-Traversal/BinTreeInTraversal_002.py | Python | 0 | @@ -0,0 +1,733 @@
+class Solution:%0A # @param root, a tree node%0A # @return a list of integers%0A def iterative_inorder(self, root, list):%0A stack = %5B%5D%0A while root or stack:%0A if root:%0A stack.append(root)%0A root = root.left%0A else:... | |
7ac77a2f95bebad6a13e1d538c366c8688c9d0a6 | Create __init__.py | crispy/localevents/__init__.py | crispy/localevents/__init__.py | Python | 0.000429 | @@ -0,0 +1,12 @@
+import core%0A
| |
aafdd253bc818d605023dd2a22164d2ac3cdc911 | Add first draft of outdoor map (for issue #3) | examples/outdoor.py | examples/outdoor.py | Python | 0 | @@ -0,0 +1,1031 @@
+#!/usr/bin/python%0A%22%22%22Example map generator: Outdoor%0A%0AThis script demonstrates vmflib by generating a map with a 2D skybox and%0Asome terrain (a displacement map).%0A%0A%22%22%22%0Afrom vmf import *%0Afrom vmf.types import Vertex%0Afrom vmf.tools import Block%0A%0Am = vmf.ValveMap()%0A%0A... | |
1c228a8de02c81df8d22bde75ac22b902ee39c77 | Add oedb connection helper | data_processing/tools/io.py | data_processing/tools/io.py | Python | 0 | @@ -0,0 +1,1064 @@
+from sqlalchemy import create_engine%0A%0Adef oedb_session(section='oedb'):%0A %22%22%22Get SQLAlchemy session object with valid connection to OEDB%22%22%22%0A%0A # get session object by oemof.db tools (requires .oemof/config.ini%0A try:%0A from oemofof import db%0A conn = db.... | |
f7742c3ffcd86667e86e7cb80977f24eddc5444c | add wrapper for `gr1x` that circumvents entry point | examples/wrapper.py | examples/wrapper.py | Python | 0 | @@ -0,0 +1,367 @@
+#!/usr/bin/env python%0A%22%22%22Wrapper to circumvent the entry point.%0A%0ABecause, if development versions of dependencies are installed,%0Abut %60install_requires%60 contains no local identifiers,%0Athen the entry point raises a %60VersionConflict%60 for its context.%0A%22%22%22%0Aimport sys%0Afr... | |
00c8c165e3f9a136a8950ca1fb0f2d9ade6731d6 | Add a regression test for whitespace normalization in the BibTeX parser. | pybtex/tests/bibtex_parser_test.py | pybtex/tests/bibtex_parser_test.py | Python | 0 | @@ -0,0 +1,789 @@
+from pybtex.database import BibliographyData%0Afrom pybtex.core import Entry%0Afrom pybtex.database.input.bibtex import Parser%0Afrom cStringIO import StringIO%0A%0Atest_data = %5B%0A (%0A '''%0A ''',%0A BibliographyData(),%0A ),%0A (%0A '''@ARTICLE%7B%0A ... | |
3a6725103b3d39701cf4f71f911b2a4f5484eb1e | Improve the repr for the BaseEstimator | scikits/learn/base.py | scikits/learn/base.py | """
Base class for all estimators.
"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD Style
import inspect
import numpy as np
from .metrics import zero_one, mean_square_error
################################################################################
class BaseEstimator(object):
"... | Python | 0 | @@ -1897,16 +1897,59 @@
__name__
+%0A%0A # Do a multi-line justified repr:
%0A
@@ -1960,15 +1960,84 @@
ams_
+li
st
-r
=
-(
+list()%0A this_line_length = len(class_name)%0A line_sep =
',%5Cn
@@ -2062,20 +2062,15 @@
ame)
+/2
)*' '
-).join(
%0A
@@ -2070,35 +2070,84 @@
' '%0A ... |
337928d30d96146cb8033e3ccb15d7d6d0c85d5a | add managed_layer_test | python/tests/managed_layer_test.py | python/tests/managed_layer_test.py | Python | 0.000091 | @@ -0,0 +1,370 @@
+import neuroglancer%0A%0Adef test_visible():%0A layer = neuroglancer.ManagedLayer('a', %7B'type': 'segmentation', 'visible': False%7D)%0A assert layer.name == 'a'%0A assert layer.visible == False%0A assert layer.to_json() == %7B'name': 'a', 'type': 'segmentation', 'visible': False%7D%0A ... | |
38903c6b6e4dec9fd2fe73b0c468a8b3f2ab870a | Add multi np array | python_practice/numpy_exercise2.py | python_practice/numpy_exercise2.py | Python | 0.999987 | @@ -0,0 +1,188 @@
+import numpy as np%0A%0AMatrix_A = np.array( %5B%5B1,1%5D,%5B0,1%5D%5D )%0AMatrix_B = np.array( %5B%5B2,0%5D,%5B3,4%5D%5D )%0A%0Aprint Matrix_A*Matrix_B%0A%0Aprint Matrix_A.dot(Matrix_B) %0A%0Aprint np.dot(Matrix_A, Matrix_B) %0A
| |
46393dca28abe0df421066e76b26f198ad790690 | Create NimGame_001.py | leetcode/NimGame_001.py | leetcode/NimGame_001.py | Python | 0.000001 | @@ -0,0 +1,150 @@
+class Solution(object):%0A def canWinNim(self, n):%0A %22%22%22%0A :type n: int%0A :rtype: bool%0A %22%22%22%0A return not (n %25 4 == 0)%0A
| |
648df0127879804041e795cb9479e08ddfd6459b | fix syntax errors | family.py | family.py | #!/usr/bin/env python
"""This module defines the family class.
"""
import person
class Family:
"""Class Person
TBD - document class
"""
def __init__(self):
self.adults = []
self.children = []
def AddAdultsFromCombinedField(self, teacher, name_field, grade):
paren... | Python | 0.000009 | @@ -2337,17 +2337,16 @@
%0A
-
def AddC
@@ -3884,16 +3884,17 @@
_found =
+=
len(sel
|
0a1ef74350a1d06a6f7fb10f6bf7f0621968766b | load 'jinja2.ext.do' extension by default | jinja2cli/cli.py | jinja2cli/cli.py | """
jinja2-cli
==========
License: BSD, see LICENSE for more details.
"""
from jinja2cli import __version__
class InvalidDataFormat(Exception): pass
class InvalidInputData(Exception): pass
class MalformedJSON(InvalidInputData): pass
class MalformedINI(InvalidInputData): pass
class MalformedYAML(InvalidInput... | Python | 0 | @@ -2761,16 +2761,25 @@
ronment(
+%0A
loader=F
@@ -2825,16 +2825,60 @@
e_path))
+,%0A extensions=%5B'jinja2.ext.do'%5D,%0A
)%0A ou
|
0aa078c8beb6bad3dd0f30463f2925f01282e353 | add merge script | scripts/merge.py | scripts/merge.py | Python | 0.000001 | @@ -0,0 +1,333 @@
+#! /usr/bin/env python%0A%0Aimport gzip%0Aimport json%0Aimport sys%0A%0Aret = %7B%0A %22samples%22: %5B%5D%0A%7D%0A%0Adef opn(fn):%0A if fn.endswith('.gz'):%0A return gzip.open(fn)%0A return open(fn)%0A%0Afor file_name in sys.argv%5B1:%5D:%0A with opn(file_name) as f:%0A file_content = json... | |
9a045ac0c5cfe39689d8e1446674193e8862d269 | add IPLookup | cogs/ip.py | cogs/ip.py | Python | 0 | @@ -0,0 +1,1039 @@
+#!/bin/env python%0A%0Aimport discord%0Afrom discord.ext import commands%0Afrom utils import aiohttp_wrap as aw%0A%0Aclass IPLookup:%0A def __init__(self, bot):%0A self.bot = bot%0A self.aio_session = bot.aio_session%0A self.api_uri = 'http://ip-api.com/json/%7B%7D'%0A%0A ... | |
314fcab1904cd0c5e434789bef09766d33e2d6ef | add synth.py for generation | packages/google-cloud-asset/synth.py | packages/google-cloud-asset/synth.py | Python | 0 | @@ -0,0 +1,1288 @@
+# copyright 2018 google LLC%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%0A#%0A# unless required by a... | |
37f7ab9435939a144b08fdbb52e1e519ad139318 | add some field definitions | ldapdb/models/fields.py | ldapdb/models/fields.py | Python | 0.000003 | @@ -0,0 +1,1250 @@
+# -*- coding: utf-8 -*-%0A# %0A# django-ldapdb%0A# Copyright (C) 2009 Bollor%C3%A9 telecom%0A# See AUTHORS file for a full list of contributors.%0A# %0A# This program is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU General Public License as published by%0A# ... | |
c5fd2a7bccb45325acdf7f0800843ddb9ad82b64 | split Natura2000 pdf files | migrations/split_pdf.py | migrations/split_pdf.py | Python | 0 | @@ -0,0 +1,887 @@
+#use http://pybrary.net/pyPdf/%0A%0Afrom pyPdf import PdfFileWriter, PdfFileReader%0Aimport re%0A%0Apattern = re.compile(r%22RO(SCI%7CSPA)%5Cd%7B4%7D%22) %0A%0Asource_path = %22/Users/cornel/Downloads/2011-10-20_protectia_naturii_RO_SPA_SDF_2011.pdf%22%0Apdf = PdfFileReader(file(source_path, %22rb%22... | |
8ffcf96b5b270fa77026c8c62ee267363ae2e7b1 | Add virtualenv plugin: build python environment. | fapistrano/plugins/virtualenv.py | fapistrano/plugins/virtualenv.py | Python | 0 | @@ -0,0 +1,1878 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0Avirtualenv plugin provide%0A%0A2 virtualenv environment:%0A%0A1. virtualenvwrapper in /home/depploy/.virtulaenvs/%25(project_name)s%0A2. virtualenv in each release directory%0A%0A2 pip install:%0A%0A1. pip%0A2. pip wheel%0A%0A%22%22%22%0Afrom fabric.api import r... | |
4987e1722f8b55e99fbc9455eafe0210b5973060 | create server bootstrap script | server/server.py | server/server.py | Python | 0.000001 | @@ -0,0 +1,438 @@
+#! /usr/bin/python%0A# encoding=utf-8%0A%0Aimport os%0Aimport cherrypy%0Afrom http.router import Router%0A%0Adef bootstrap():%0A api_config = os.path.abspath(os.path.join(os.getcwd(), 'config/api.conf'))%0A router = Router()%0A%0A cherrypy.tools.CORS = cherrypy.Tool('before_handler', router.... | |
45c81e268df7f01fdeb64b053583b2946739eebe | add pactest with pacparser lib | pactest.py | pactest.py | Python | 0.000126 | @@ -0,0 +1,986 @@
+#!/usr/bin/python%0A#-*- coding: utf-8 -*-%0A%0A'''%0AYou have to install pacparser before runing this script.%0AYou can get pacparser from https://code.google.com/p/pacparser.%0A'''%0A%0Aimport pacparser%0Aimport time%0A%0Adef get_pac_result(filename, url, host):%0A%09pacparser.init()%0A%09pacparser... | |
a68d89a4f351f8df2bfceeac77540b23e29827be | Add failing test for bug #1375 -- no out-of-bounds error for token.nbor() | spacy/tests/regression/test_issue1375.py | spacy/tests/regression/test_issue1375.py | Python | 0 | @@ -0,0 +1,488 @@
+from __future__ import unicode_literals%0Aimport pytest%0Afrom ...vocab import Vocab%0Afrom ...tokens.doc import Doc%0A%0A@pytest.mark.xfail%0Adef test_issue1375():%0A '''Test that token.nbor() raises IndexError for out-of-bounds access.'''%0A doc = Doc(Vocab(), words=%5B'0', '1', '2'%5D)%0A ... | |
6418326667f0819a028606dee1683965a0092e0a | add functions to find the data dir | cs251tk/specs/dirs.py | cs251tk/specs/dirs.py | Python | 0.000001 | @@ -0,0 +1,205 @@
+import os%0A%0A%0Adef get_specs_dir():%0A return os.path.join(get_data_dir(), 'cs251tk', 'specs')%0A%0A%0Adef get_data_dir():%0A return os.getenv('XDG_DATA_HOME', os.path.join(os.getenv('HOME'), '.local', 'share'))%0A
| |
4af8e31da47b321cfbd84223619379167c9c7d3b | Add config file with list of programs | app/config.py | app/config.py | Python | 0.000001 | @@ -0,0 +1,1394 @@
+programs = %7B%0A %22ascii_text%22: %7B%0A %22title%22: %22ASCII Text%22,%0A %22path%22: %22programs/ascii_text.py%22,%0A %7D,%0A %22blink_sun%22: %7B%0A %22title%22: %22Blink Sun%22,%0A %22path%22: %22programs/blink_sun.py%22%0A %7D,%0A %22cheertree%22: %7... | |
7749a3531cc2985112b7ef60421dd9c07e742bcb | Add fabfile.py file to project | fabfile.py | fabfile.py | Python | 0 | @@ -0,0 +1,373 @@
+#! /usr/bin/env python2%0A# -*- coding: utf-8 -*-%0A%0A%22%22%22The jupyterhub stack fabric file%22%22%22%0A%0Afrom fabric.api import local%0A%0Adef git():%0A %22%22%22Setup Git%22%22%22%0A%0A local(%22git remote rm origin%22)%0A local(%22git remote add origin https://korniichuk@github.com/k... | |
c6d47e22825da4516f313f4a8bef6237c17b48b9 | Clear user's profile id cache on organization change. | judge/signals.py | judge/signals.py | from django.core.cache.utils import make_template_fragment_key
from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver
from django.core.cache import cache
from .models import Problem, Contest, Submission, Organization, Profile, NavigationBar, MiscConfig, Language, Judge, \
B... | Python | 0 | @@ -2667,32 +2667,173 @@
instance.id,)))%0A
+ for user in instance.members.values_list('id', flat=True):%0A cache.delete(make_template_fragment_key('user_org_on_rank', (user,)))%0A
%0A%0A@receiver(post
|
fcea7c42c7b793a84febd29112b50fc89b5fd6f4 | Add fabfile to generate documentation | fabfile.py | fabfile.py | Python | 0.000001 | @@ -0,0 +1,1163 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0A fabfile%0A%0A Fab file to build and push documentation to github%0A%0A :copyright: %C2%A9 2013 by Openlabs Technologies & Consulting (P) Limited%0A :license: BSD, see LICENSE for more details.%0A%22%22%22%0Aimport time%0A%0Afrom fabric.api import lo... | |
1e82283cc85b2eb449969849d23c4ffa2c090426 | Add script to batch convert a directory recursively | scripts/directory_batch_convert.py | scripts/directory_batch_convert.py | Python | 0.000001 | @@ -0,0 +1,1503 @@
+import os%0Aimport sys%0Aimport re%0Afrom pathlib import Path%0A%0Aimport argparse%0A%0Afrom convert2netcdf4 import parseandconvert%0A%0Aparser = argparse.ArgumentParser(description='Recursively batch convert Vaisala old-binary format to NetCDF files. Keeps directory structure.')%0Aparser.add_argume... | |
8a3caf06f146ff9d3cf20d0d739c78cb93c16325 | Add migrations | ureport/polls/migrations/0049_auto_20160810_1823.py | ureport/polls/migrations/0049_auto_20160810_1823.py | Python | 0.000001 | @@ -0,0 +1,498 @@
+# -*- 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 ('polls', '0048_populate_age_and_gender_on_poll_results'),%0A %5D%0A%0A operations = %5B%0A ... | |
b69643de7f9ec207949e0054d2b1e98dbb81d898 | Add new package: librelp (#18779) | var/spack/repos/builtin/packages/librelp/package.py | var/spack/repos/builtin/packages/librelp/package.py | Python | 0 | @@ -0,0 +1,1065 @@
+# 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 Librelp(AutotoolsPackage):%0A %22%22%22Librelp is an ea... | |
860f8224bf8ef2f1553a17842d1389491f43bfa5 | Add missing migration for wagtail.tests | wagtail/tests/migrations/0008_auto_20141113_2125.py | wagtail/tests/migrations/0008_auto_20141113_2125.py | Python | 0 | @@ -0,0 +1,703 @@
+# -*- 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 ('tests', '0007_registerdecorator'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterField... | |
78420caaac5c5055d9264e9905c5e14e9756a064 | Add Cli_server_tcp, just like Cli_server_local, but using TCP socket. | sippy/Cli_server_tcp.py | sippy/Cli_server_tcp.py | Python | 0 | @@ -0,0 +1,2115 @@
+# Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.%0A# Copyright (c) 2006-2014 Sippy Software, Inc. All rights reserved.%0A#%0A# All rights reserved.%0A#%0A# Redistribution and use in source and binary forms, with or without modification,%0A# are permitted provided that the following cond... | |
057173c48a56c0c858212233ee60dcbb88e22838 | Add tests.py, including one failure | mysite/profile/tests.py | mysite/profile/tests.py | Python | 0.000002 | @@ -0,0 +1,1498 @@
+import django.test%0Afrom search.models import Project%0A%0Aimport twill%0Afrom twill import commands as tc%0Afrom twill.shell import TwillCommandLoop%0Afrom django.test import TestCase%0Afrom django.core.servers.basehttp import AdminMediaHandler%0Afrom django.core.handlers.wsgi import WSGIHandler%0... | |
bfc386c1a894811532ccfc65ce45339a964c5ac0 | Create batch_clip.py | batch_clip.py | batch_clip.py | Python | 0.000003 | @@ -0,0 +1,464 @@
+# clips all .shps in folder to a boundary polygon%0A%0Afrom subprocess import call%0Aimport os%0A%0A# in dir of to be clipped shps and boundary file%0Ashp_folder = %22nrn_rrn_on_shp_en%22%0Aclip_poly = %22clip_bound.shp%22%0A%0A#output dir name%0A# os.mkdir(%22clipped%22)%0A%0Ac = 0%0Afor subdir, dir... | |
d1e403fce1affd0c7da1753fda441dd9a9c1d9ff | copy ISON settings for BBC | net/settings_bbc.py | net/settings_bbc.py | Python | 0 | @@ -0,0 +1,267 @@
+# settings_ison.py%0Afrom settings_common import *%0A%0ATEMPDIR = '/data2/tmp'%0ADATABASES%5B'default'%5D%5B'NAME'%5D = 'an-ison'%0A%0ALOGGING%5B'loggers'%5D%5B'django.request'%5D%5B'level'%5D = 'WARN'%0A%0ASESSION_COOKIE_NAME = 'IsonAstrometrySession'%0A%0Assh_solver_config = 'an-ison'%0Asitename = ... | |
f20ed3b4941fef84e95afce4db0349ed8da3070e | Create Hour_Rain_Map.py | Hour_Rain_Map.py | Hour_Rain_Map.py | Python | 0.000001 | @@ -0,0 +1,2077 @@
+#############################################################################%0A# Name: Elizabeth Rentschlar #%0A# Assistantce from: #%0A# Purpose: Use Hourly rain totals condensed in Hours.py to c... | |
d8ad74b80f214ca313d01533ea6f15082cbb3af2 | Add tests for calibration procedure (draft) | srttools/core/tests/test_calibration.py | srttools/core/tests/test_calibration.py | Python | 0 | @@ -0,0 +1,1596 @@
+from ..calibration import CalibratorTable%0Afrom ..read_config import read_config%0Afrom ..scan import list_scans%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0Aimport unittest%0Afrom astropy.table import Table%0Afrom ..imager import ScanSet%0Aimport os%0Aimport glob%0A%0A%0Aclass Test2_Ca... | |
427f4562dc2a4fa7b805154e3ffd732381ed6e8d | Add dbwriter.py | dbwriter.py | dbwriter.py | Python | 0.000001 | @@ -0,0 +1,1116 @@
+from pymongo import MongoClient%0Aimport os%0Afrom pathlib import Path%0Adef main():%0A client = MongoClient('localhost', 27017)%0A db = client%5B'thesis-database'%5D%0A #tfidf-cv-category%0A collection = db%5B'tfidf-cv-category'%5D%0A path = 'Calculated/tfidf/cv-category'%0A for f... | |
afcd636772952c8b6d2cca51e1851af29f5b6707 | Create PostForm. | blog/forms.py | blog/forms.py | Python | 0 | @@ -0,0 +1,226 @@
+from django import forms%0A%0Afrom .models import Post%0A%0A%0Aclass PostForm(forms.ModelForm):%0A class Meta:%0A model = Post%0A fields = '__all__'%0A%0A def clean_slug(self):%0A return self.cleaned_data%5B'slug'%5D.lower()%0A
| |
e39290b71299843eff858fb51543b99a06178a1d | Add a simple 8x benchmark script | ice40/picorv32_benchmark.py | ice40/picorv32_benchmark.py | Python | 0 | @@ -0,0 +1,1566 @@
+#!/usr/bin/env python3%0Aimport os, sys, threading%0Afrom os import path%0Aimport subprocess%0Aimport re%0A%0Anum_runs = 8%0A%0Aif not path.exists(%22picorv32.json%22):%0A os.remove(%22picorv32.json%22)%0A subprocess.run(%5B%22wget%22, %22https://raw.githubusercontent.com/cliffordwolf/picorv32... | |
30081b470fc3522afc4af3a4fc33eb28bc85d6d6 | Add project config manager | polyaxon_cli/managers/project.py | polyaxon_cli/managers/project.py | Python | 0.000001 | @@ -0,0 +1,434 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import absolute_import, division, print_function%0A%0Afrom polyaxon_schemas.project import ProjectConfig%0A%0Afrom polyaxon_cli.managers.base import BaseConfigManager%0A%0A%0Aclass ProjectConfigManager(BaseConfigManager):%0A %22%22%22Manages access token c... | |
8e1a117c0d0bf3614beed0410862d1dc1a91b306 | Create shp2zip.py | upload-geospatial-data/python/shp2zip.py | upload-geospatial-data/python/shp2zip.py | Python | 0.000007 | @@ -0,0 +1,1480 @@
+import os%0Aimport shutil%0Aimport zipfile%0A%0A# Creates a zip file containing the input shapefile%0A# inShp: Full path to shapefile to be zipped%0A# Delete: Set to True to delete shapefile files after zip%0Adef ZipShp (inShp, Delete = True):%0A #List of shapefile file extensions%0A exten... | |
06804460f2b0e70b7b08d6657353c1c172a0df4c | add examples/tube-stream-private.py | examples/tube-stream-private.py | examples/tube-stream-private.py | Python | 0 | @@ -0,0 +1,1390 @@
+import sys%0A%0Afrom stream_tube_client import StreamTubeJoinerPrivateClient, %5C%0A StreamTubeInitiatorPrivateClient%0A%0Adef usage():%0A print %22Usage:%5Cn%22 %5C%0A %22Offer a stream tube to %5Bcontact%5D using the trivial stream server:%5Cn%22 %5C%0A %22%5Ctpytho... | |
d304c1cd9b35f92a6f5bb1c739402b8f3a6c22c8 | Create cigar_party.py | Python/CodingBat/cigar_party.py | Python/CodingBat/cigar_party.py | Python | 0.000357 | @@ -0,0 +1,224 @@
+# http://codingbat.com/prob/p195669%0A%0Adef cigar_party(cigars, is_weekend):%0A if is_weekend and cigars %3E= 40:%0A return True%0A elif not is_weekend and (cigars %3E= 40 and cigars %3C= 60):%0A return True%0A else:%0A return False%0A
| |
dbf1d68fd3c3681b1aa7673b1cfd8a2cc3417edf | Create problem5.py | Project-Euler/Problem5/problem5.py | Project-Euler/Problem5/problem5.py | Python | 0.000048 | @@ -0,0 +1,1001 @@
+%22%22%22%0A%5Bref.href%5D https://projecteuler.net/problem=5%0A%0ASmallest multiple.%0A%0A2520 is the smallest number that can be divided by each%0Aof the numbers from 1 to 10 without any remainder.%0A%0AWhat is the smallest positive number that is evenly%0Adivisible by all of the numbers from 1 to... | |
b76b64ae3914d66bcf0e3eef60390c96c2cd1a43 | Clean up W601 error | wagtail/contrib/wagtailsitemaps/tests.py | wagtail/contrib/wagtailsitemaps/tests.py | from django.test import TestCase
from django.core.cache import cache
from wagtail.wagtailcore.models import Page, PageViewRestriction, Site
from wagtail.tests.testapp.models import SimplePage, EventIndex
from .sitemap_generator import Sitemap
class TestSitemapGenerator(TestCase):
def setUp(self):
self.h... | Python | 0.000006 | @@ -3086,38 +3086,30 @@
sert
-False
+NotIn
(cache
-.has
_key
-(
+,
cache
-_key)
)%0A%0A
@@ -3394,37 +3394,27 @@
sert
-True
+In
(cache
-.has
_key
-(
+,
cache
-_key)
)%0A%0A
|
d441cfd92cd8d843f22f181d485786fe1ed8948f | Add herokustatus plugin | plugins/herokustatus.py | plugins/herokustatus.py | Python | 0 | @@ -0,0 +1,598 @@
+import urllib.parse%0Aimport requests%0A%0Aclass Plugin:%0A def __call__(self, bot):%0A bot.on_respond(r%22heroku st(atus)?$%22, self.on_respond)%0A bot.on_help(%22herokustatus%22, self.on_help)%0A%0A def on_respond(self, bot, msg, reply):%0A url = %22https://status.heroku.... | |
0af447c0371bd157c03fc5097ac8c0e0a5873ff7 | Add temporary satellites analysis example. | examples/satellites_analyze.py | examples/satellites_analyze.py | Python | 0 | @@ -0,0 +1,1733 @@
+assert __name__ == '__main__'%0A%0Aimport bayeslite.bql as bql%0Aimport bayeslite.core as core%0Aimport bayeslite.parse as parse%0Aimport crosscat.LocalEngine as localengine%0Aimport getopt%0Aimport sys%0A%0A# XXX This is wrong -- should be part of bayesdb proper. But it, and%0A# copypasta of it, w... | |
034cb3a0fe2a2c0c8b47fd631ca28bbfa7091902 | add recursive preOrder BST | BST/bst.py | BST/bst.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
class Node(object):
def __init__(self, value):
self.left = None
self.right = None
self.value = value
# iterative
def preOrder(root):
... | Python | 0.000046 | @@ -281,16 +281,213 @@
value%0A%0A%0A
+# recursive%0Adef preOrderRecur(root):%0A if not root:%0A return%0A print(root.value)%0A if root.right:%0A preOrderRecur(root.right)%0A if root.left:%0A preOrderRecur(root.left)%0A%0A%0A
# iterat
|
fdb768c9dbfca33a013b9588e0dadc8c68abc992 | Simplify smartplaylist flow | beetsplug/smartplaylist.py | beetsplug/smartplaylist.py | # This file is part of beets.
# Copyright 2015, Dang Mai <contact@dangmai.net>.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the right... | Python | 0 | @@ -884,142 +884,8 @@
os%0A%0A
-# Global variable so that smartplaylist can detect database changes and run%0A# only once before beets exits.%0Adatabase_changed = False%0A%0A
%0Adef
@@ -3443,16 +3443,119 @@
%7D)%0A%0A
+ if self.config%5B'auto'%5D:%0A self.register_listener('database_change', se... |
bdfbea2e5896a6a20ae15f053b80b664e946eb88 | Solved task 2 on bio algorithms | Stepic/BioinformaticsAlgorithms/ReverseComplement.py | Stepic/BioinformaticsAlgorithms/ReverseComplement.py | Python | 0.998269 | @@ -0,0 +1,524 @@
+# Reverse Complement Problem: Reverse complement a nucleotide pattern%0A%0Adef main():%0A dna = ''%0A with open('dna.txt', 'r') as f:%0A dna = f.read()%0A%0A comp_dna = ''%0A%0A for i in dna%5B::-1%5D:%0A if i == 'A':%0A comp_dna += 'T'%0A elif i == 'T':%0A... | |
aa52332d622e16b3d1524eb2dc12047cec02fb33 | Create calculator.py | calculator.py | calculator.py | Python | 0.000001 | @@ -0,0 +1,1673 @@
+# my-first-calculator%0A#Description is in the name%0A%0A%0A#calculator%0A%0Aprint %22For addition press 1%22%0Aprint %22For subtraction press 2%22%0Aprint %22For multiplication press 3%22%0Aprint %22For division press 4%22%0Aprint %22If you're all done press 5%22%0A%0Acmd=float(int(raw_input(%22Ent... | |
069a5758b16624ac2b547ede44123b64c89baf96 | Add simple script mapping YTID to KA URLs. | map_ytids_to_ka_urls.py | map_ytids_to_ka_urls.py | Python | 0 | @@ -0,0 +1,1782 @@
+#!/usr/bin/env python3%0Afrom kapi import *%0Afrom utils import *%0Aimport argparse, sys%0Aimport time%0A%0A%0Adef read_cmd():%0A %22%22%22Function for reading command line options.%22%22%22%0A desc = %22Program for mapping YouTube IDs to KA URLs to Crowdin WYSIWYG editor.%22 %0A parser = argp... | |
41265e02f47a55d11dcc921aeeebebba290ed61f | Fix Dee. | game/migrations/0008_fix_dee.py | game/migrations/0008_fix_dee.py | Python | 0 | @@ -0,0 +1,484 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0A%0A%0Adef fix_dee(apps, schema_editor):%0A%0A Character = apps.get_model('game', 'Character')%0A%0A dee = Character.objects.get(name='Dee')%0A dee.en_face = 'characters/front_vie... | |
6d0f78ccdb8587d5a35ee297198a664274598747 | Create run_test.py | recipes/pytest-sugar/run_test.py | recipes/pytest-sugar/run_test.py | Python | 0.000004 | @@ -0,0 +1,199 @@
+import django%0Afrom django.conf import settings%0Asettings.configure(INSTALLED_APPS=%5B'pytest_sugar', 'django.contrib.contenttypes', 'django.contrib.auth'%5D) %0Adjango.setup() %0A %0Aimport pytest_sugar%0A
| |
e50dc18525e0e4cbbef56cd16ba4e2d9690464f1 | Add solution for problem 34 | euler034.py | euler034.py | Python | 0 | @@ -0,0 +1,344 @@
+#!/usr/bin/python%0A%0Afrom math import factorial, log%0Avalues = %5B0%5D*10%0A%0Afor i in range(10):%0A values%5Bi%5D = factorial(i)%0A%0Atotal = 0%0Afor i in range(10, factorial(9) * 7):%0A target = 0%0A test = i%0A while test != 0:%0A x = test %25 10%0A target += values%5... | |
427752b4ee3d63d1bf29a9a2a9be011662df8556 | add login handler | jupyterhub_login.py | jupyterhub_login.py | Python | 0.000001 | @@ -0,0 +1,787 @@
+from sandstone.lib.handlers.base import BaseHandler%0Aimport requests%0Aimport os%0A%0Aclass JupyterHubLoginHandler(BaseHandler):%0A def get(self):%0A api_token = os.environ%5B'JUPYTERHUB_API_TOKEN'%5D%0A%0A url = '%7Bprotocol%7D://%7Bhost%7D/hub/api/authorizations/token/%7Btoken%7D'... | |
8bd8ae1daa432bce9881214c4d326ac8a38e2046 | Correct MAPE loss | keras/objectives.py | keras/objectives.py | from __future__ import absolute_import
import theano
import theano.tensor as T
import numpy as np
from six.moves import range
epsilon = 1.0e-9
def mean_squared_error(y_true, y_pred):
return T.sqr(y_pred - y_true).mean(axis=-1)
def mean_absolute_error(y_true, y_pred):
return T.abs_(y_pred - y_true).mean(axis=... | Python | 0.000002 | @@ -408,22 +408,55 @@
pred) /
-y_true
+T.clip(T.abs_(y_true), epsilon, np.inf)
).mean(a
@@ -468,16 +468,17 @@
1) * 100
+.
%0A%0Adef me
|
29aa26f553633fbe4a5ae37721e1da0ecca4139c | Create MyaiBot-Pictures.py | home/moz4r/MyaiBot-Pictures.py | home/moz4r/MyaiBot-Pictures.py | Python | 0 | @@ -0,0 +1,1293 @@
+#PICTURE FIND AND DISPLAY BOT%0A#LONK AT http://www.myai.cloud/%0A#FOR SERVER NAME AND BOT STATUS%0A#IT S A SMALL COMPUTER FOR NOW SORRY IF PROBLEMS%0Afrom java.lang import String%0Aimport random%0Aimport threading%0Aimport itertools%0A%0Ahttp = Runtime.createAndStart(%22http%22,%22HttpClient%22)%0A... | |
147374971ad21406d61beb1512b5a702298fc3dc | add a generic seach module (relies on sqlalchemy) | cartoweb/plugins/search.py | cartoweb/plugins/search.py | Python | 0.000001 | @@ -0,0 +1,3037 @@
+from sqlalchemy.sql import select%0Afrom sqlalchemy.sql import and_%0Afrom sqlalchemy.sql import func%0A%0Afrom shapely.geometry.point import Point%0Afrom shapely.geometry.polygon import Polygon%0A%0Aclass Search:%0A EPSG = 4326%0A UNITS = 'degrees'%0A%0A def __init__(self, idColumn, geomCo... | |
6078617684edbc7f264cfe08d60f7c3d24d2898f | add test for handle_conversation_before_save | plugin/test/test_handle_conversation_before_save.py | plugin/test/test_handle_conversation_before_save.py | Python | 0.000001 | @@ -0,0 +1,2144 @@
+import unittest%0Aimport copy%0Afrom unittest.mock import Mock%0A%0Aimport chat_plugin%0Afrom chat_plugin import handle_conversation_before_save%0A%0A%0Aclass TestHandleConversationBeforeSave(unittest.TestCase):%0A%0A def setUp(self):%0A self.conn = None%0A chat_plugin.current_user_... | |
943e162eee203f05b5a2d5b19bcb4a9c371cc93b | Add new script to get comet velocity from kymograph | plugins/Scripts/Plugins/Kymograph_Comet_Velocity.py | plugins/Scripts/Plugins/Kymograph_Comet_Velocity.py | Python | 0 | @@ -0,0 +1,1590 @@
+# @Float(label=%22Time Interval (s)%22, value=1) dt%0A# @Float(label=%22Pixel Length (um)%22, value=1) pixel_length%0A# @Boolean(label=%22Do you want to save results files ?%22, required=False) save_results%0A# @Boolean(label=%22Do you want to save ROI files ?%22, required=False) save_roi%0A# @Image... | |
c426c773ee36d2872f79ff01d3bed615245e61b3 | add nbconvert.utils.pandoc | IPython/nbconvert/utils/pandoc.py | IPython/nbconvert/utils/pandoc.py | Python | 0 | @@ -0,0 +1,1726 @@
+%22%22%22Utility for calling pandoc%22%22%22%0A#-----------------------------------------------------------------------------%0A# Copyright (c) 2013 the IPython Development Team.%0A#%0A# Distributed under the terms of the Modified BSD License.%0A#%0A# The full license is in the file COPYING.txt, dis... | |
5b951c91a7d054958d819bf19f97a5b33e21ff2d | add in some forms | lib/buyers/forms.py | lib/buyers/forms.py | Python | 0.000001 | @@ -0,0 +1,301 @@
+from django import forms%0Afrom .models import Buyer%0A%0A%0Aclass BuyerValidation(forms.ModelForm):%0A%0A class Meta:%0A model = Buyer%0A%0A%0Aclass PreapprovalValidation(forms.Form):%0A start = forms.DateField()%0A end = forms.DateField()%0A return_url = forms.URLField()%0A ca... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.