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 |
|---|---|---|---|---|---|---|---|
c556ac78efe4b9a9453016dfdf39219852b42676 | test app, certain to fail | tests/app.py | tests/app.py | Python | 0 | @@ -0,0 +1,268 @@
+import tornado.ioloop%0Aimport tornado.web%0Afrom graphnado import GraphQLHandler%0A%0Aif __name__ == '__main__':%0A application = tornado.web.Application(%5B%0A (r'/graphql', GraphQLHandler)%0A %5D)%0A application.listen(8888)%0A tornado.ioloop.IOLoop.current().start()%0A
| |
15eb41ba9ac22eb2ecc60b82807ca7f333f578b9 | Add basic methods for accessing user data | iatidq/dqusers.py | iatidq/dqusers.py | Python | 0.000005 | @@ -0,0 +1,1164 @@
+%0A# IATI Data Quality, tools for Data QA on IATI-formatted publications%0A# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith%0A#%0A# Copyright (C) 2013 Publish What You Fund%0A#%0A# This programme is free software; you may redistribute and/or modify%0A# it under the terms of the GN... | |
8c287ca7b3f184c692356c81a93007936a7a5b01 | fix import torngas but not found tornado | torngas/__init__.py | torngas/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'mqingyn'
__version__ = '1.8.1'
version = tuple(map(int, __version__.split('.')))
from settings_manager import settings
from webserver import Server, run
from exception import ConfigError, ArgumentError
from urlhelper import Url, route, include
from utils imp... | Python | 0 | @@ -81,17 +81,17 @@
= '1.8.
-1
+2
'%0A%0Aversi
@@ -135,17 +135,25 @@
('.')))%0A
-%0A
+try:%0A
from set
@@ -182,16 +182,20 @@
ettings%0A
+
from web
@@ -220,16 +220,20 @@
er, run%0A
+
from exc
@@ -273,16 +273,20 @@
ntError%0A
+
from url
@@ -319,16 +319,20 @@
include%0A
+
from uti
@@ -397,... |
19b588e4ac9811879fba7e98943cf5925a774a00 | add migration 102bbf265d4 | migrations/versions/102bbf265d4_.py | migrations/versions/102bbf265d4_.py | Python | 0.000004 | @@ -0,0 +1,606 @@
+%22%22%22empty message%0A%0ARevision ID: 102bbf265d4%0ARevises: 3d1138bbc68%0ACreate Date: 2015-06-12 01:35:12.398937%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '102bbf265d4'%0Adown_revision = '3d1138bbc68'%0A%0Afrom alembic import op%0Aimport sqlalchemy as sa%0A%0A%0Ad... | |
dd25e263b099b86e7b9538e474ad875798514be5 | Add StorageDevice class | Cura/StorageDevice.py | Cura/StorageDevice.py | Python | 0 | @@ -0,0 +1,863 @@
+%0A## Encapsulates a number of different ways of storing file data.%0A#%0Aclass StorageDevice(object):%0A def __init__(self):%0A super(StorageDevice, self).__init__()%0A self._properties = %7B%7D%0A %0A ## Open a file so it can be read from or written to.%0A # %5Cparam file... | |
dbc1e4c5348e1a64279018910d1e73542c016313 | Fix TestAccountElsewhere.test_github_oauth_url_not_susceptible_to_injection_attack. | tests/test_elsewhere.py | tests/test_elsewhere.py | from __future__ import print_function, unicode_literals
from aspen.website import Website
from gittip.elsewhere.twitter import TwitterAccount
from gittip.testing import Harness
from gittip.elsewhere import bitbucket, github, twitter
# I ended up using TwitterAccount to test even though this is generic
# functionality... | Python | 0 | @@ -2205,16 +2205,31 @@
ctual =
+self.platforms.
github.o
@@ -2229,32 +2229,44 @@
ithub.oauth_url(
+%0A
website=website
@@ -2265,16 +2265,17 @@
=website
+,
%0A
@@ -2278,39 +2278,16 @@
- ,
action=
@@ -2286,32 +2286,33 @@
action='opt-in'
+,
%0A
... |
0543bfa278e1bb2a8eb37bc0c8f065ddde2ed21f | Add object doubling as lxml Element and string #274 | judge/lxml_tree.py | judge/lxml_tree.py | Python | 0 | @@ -0,0 +1,266 @@
+from lxml import html%0A%0A%0Aclass HTMLTreeString(object):%0A def __init__(self, str):%0A self.tree = html.fromstring(str)%0A%0A def __getattr__(self, attr):%0A return getattr(self.tree, attr)%0A%0A def __unicode__(self):%0A return html.tostring(self.tree)%0A
| |
7082a99135811815c27c3d6ef484a7ee89e84008 | Manually backfill lti_config dicts | lti_consumer/migrations/0010_backfill-empty-string-lti-config.py | lti_consumer/migrations/0010_backfill-empty-string-lti-config.py | Python | 0.999895 | @@ -0,0 +1,1298 @@
+%22%22%22%0ABackfill empty lti_config records%0A%0AWe need to do this with raw SQL,%0Aotherwise the model fails upon instantiation,%0Aas the empty string is an invalid JSON dictionary.%0A%22%22%22%0Aimport uuid%0A%0Afrom django.db import connection%0Afrom django.db import migrations%0A%0A%0Asql_forw... | |
cf664a5dce20da4af5ce1962f38613c8122cb111 | reverse iqtreenames | iqtree_namefix.py | iqtree_namefix.py | Python | 0.999495 | @@ -0,0 +1,1722 @@
+#!/usr/bin/env python%0A%0Aimport sys%0Aimport os%0Aimport re%0Afrom sys import argv%0A%0A%0Adef name_catalog(logFile):%0A catalog = %7B%7D%0A switch = 0%0A try:%0A log= open(logFile, 'r')%0A except:%0A print %22There was a problem reading the file %25s%22 %25logFile%0A ... | |
1d5f23bf090e4a6d51beb310b5ecf4048afcc347 | add debug runner | tools/debug_run_game.py | tools/debug_run_game.py | Python | 0.000001 | @@ -0,0 +1,704 @@
+import logging%0Aimport sys%0Afrom mpf.core.config_loader import YamlMultifileConfigLoader%0A%0Afrom mpf.core.machine import MachineController%0A%0Amachine_path = sys.argv%5B1%5D%0A%0Aconfig_loader = YamlMultifileConfigLoader(machine_path, %5B%22config.yaml%22%5D, False, False)%0Aconfig = config_load... | |
d4a5feaaddb88b79809646b7ddab36d29ebf0830 | Create swig.py | wigs/swig.py | wigs/swig.py | Python | 0.000002 | @@ -0,0 +1,179 @@
+class swig(Wig):%0A tarball_uri = 'https://github.com/swig/swig/archive/rel-$RELEASE_VERSION$.tar.gz'%0A last_release_version = 'v3.0.10'%0A git_uri = 'https://github.com/swig/swig'%0A
| |
956aff18c4791e0fda10b8e0a1103f3a0d53e4f1 | Add simple performance test suite | tests/perf/perf.py | tests/perf/perf.py | Python | 0.000001 | @@ -0,0 +1,1718 @@
+import redact%0A%0A%0Aclass Prisoner(redact.BaseModel):%0A def __init__(self, key, name=None, password=None):%0A super(Prisoner, self).__init__(key)%0A self.name = redact.KeyValueField('n', name)%0A self.password = redact.KeyValueField('p', password)%0A%0Ai = 0%0A%0A%0Adef sa... | |
68c664117612b15dab5add78e7b5614daf1c2c18 | Add missing __init__.py | ivi/agilent/test/__init__.py | ivi/agilent/test/__init__.py | Python | 0.999965 | @@ -0,0 +1,1133 @@
+%22%22%22%0A%0APython Interchangeable Virtual Instrument Library%0A%0ACopyright (c) 2014 Alex Forencich%0A%0APermission is hereby granted, free of charge, to any person obtaining a copy%0Aof this software and associated documentation files (the %22Software%22), to deal%0Ain the Software without rest... | |
4f1b7b2a29fcb8802fbdee6ce832d9c5fb4a6f89 | add jobq tests | tests/test_jobq.py | tests/test_jobq.py | Python | 0.000001 | @@ -0,0 +1,2331 @@
+%22%22%22%0ATest JobQ%0A%22%22%22%0Afrom hstestcase import HSTestCase%0A%0A%0Aclass ActivityTest(HSTestCase):%0A%0A def setUp(self):%0A super(ActivityTest, self).setUp()%0A self.jobq = self.hsclient.get_jobq(self.projectid)%0A%0A def test_basic(self):%0A #authpos(JOBQ_PUSH... | |
ff698bf20eb400f9e6f6cadb3e809fcb684bdcc9 | Add simple main test | tests/test_main.py | tests/test_main.py | Python | 0 | @@ -0,0 +1,329 @@
+from unittest import TestCase%0Afrom src.main.main import main%0A%0A%0Aclass TestMain(TestCase):%0A def test_read_commands(self):%0A s0 = main(%5B%5D)%0A s1 = main(%5B%22one%22%5D)%0A s2 = main(%5B%22one%22, %22-2%22%5D)%0A%0A self.assertTrue(0 == 0, %22Testing if 0 equ... | |
a22f713ff4a366c0f05ffd6a7e513bc8fda7aa26 | add a maxcall test | tests/test_misc.py | tests/test_misc.py | Python | 0 | @@ -0,0 +1,894 @@
+import numpy as np%0Aimport dynesty%0A%22%22%22%0ARun a series of basic tests of the 2d eggbox%0A%22%22%22%0A%0A# seed the random number generator%0Anp.random.seed(56432)%0A%0Anlive = 100%0A%0A%0Adef loglike(x):%0A return -0.5 * np.sum(x**2)%0A%0A%0Adef prior_transform(x):%0A return (2 * x - 1)... | |
0ce616d3c787060c6d1bfeacb0a53c5085494927 | Create tutorial2.py | tutorial2.py | tutorial2.py | Python | 0 | @@ -0,0 +1,12 @@
+placeholder%0A
| |
287cd795c92a86ee16a623230d0c59732a2f767d | Add demo on how to write unstructured point meshes in Vtk. | examples/vtk-unstructured-points.py | examples/vtk-unstructured-points.py | Python | 0 | @@ -0,0 +1,896 @@
+import numpy as np%0Afrom pyvisfile.vtk import ( %0A UnstructuredGrid, DataArray,%0A AppendedDataXMLGenerator,%0A VTK_VERTEX, VF_LIST_OF_VECTORS, VF_LIST_OF_COMPONENTS)%0A%0An = 5000%0Apoints = np.random.randn(n, 3)%0A%0Adata = %5B%0A (%22p%22, np.random.randn(n)),%0A (%22vel%2... | |
8b050af9c5f680c67412271cd5744a2c60b288d5 | Remove test case for linux-32. | conda_smithy/tests/test_configure_feedstock.py | conda_smithy/tests/test_configure_feedstock.py | from contextlib import contextmanager
import os
import shutil
import tempfile
import unittest
import conda_build.metadata
import conda.api
import conda_smithy.configure_feedstock as cnfgr_fdstk
from conda_build_all.resolved_distribution import ResolvedDistribution
@contextmanager
def tmp_directory():
tmp_dir = ... | Python | 0 | @@ -3234,32 +3234,16 @@
kwargs)%0A
-
%0A
@@ -3864,95 +3864,8 @@
%5D)%0A%0A
- with cnfgr_fdstk.fudge_subdir('linux-32', config):%0A test()%0A%0A
|
11111351f67afd3dc8ee2ec904a9cea595d68fb3 | Add script to calculate perplexity results | DilipadTopicModelling/experiment_calculate_perplexity.py | DilipadTopicModelling/experiment_calculate_perplexity.py | Python | 0 | @@ -0,0 +1,1548 @@
+import pandas as pd%0Aimport logging%0A%0Afrom CPTCorpus import CPTCorpus%0Afrom CPT_Gibbs import GibbsSampler%0A%0A%0Alogger = logging.getLogger(__name__)%0Alogging.basicConfig(format='%25(levelname)s : %25(message)s', level=logging.INFO)%0A%0A# load corpus%0Adata_dir = '/home/jvdzwaan/data/tmp/gen... | |
2ed913c0add7740b9c8eb6ee8320b6924907e48f | Create q5.py | work/q5.py | work/q5.py | Python | 0.00005 | @@ -0,0 +1,591 @@
+import itertools%0A%0Adef max_array():%0A return %5Bx for x in range(0, 10)%5D%0Adef compute():%0A return %5B'+', '-', ''%5D%0A%0Adef sum(arr):%0A for i in itertools.product(compute(), repeat=10):%0A result = ''.join(map(str, union(max_array(), i)))%0A if result%5Blen(result) -... | |
240274ea82db24dca578692a609a262497107ccc | Prepare for interview questions | decorator_examples.py | decorator_examples.py | Python | 0.000002 | @@ -0,0 +1,759 @@
+def identity_decorator(fn):%0A def wrapper(*args):%0A return fn(*args)%0A return wrapper%0A%0A%0A@identity_decorator%0Adef stringify(obj):%0A return str(obj)%0A%0A%0Aprint(stringify(78))%0A%0A%0Adef uppercase(fn):%0A def wrapper(*args):%0A result = fn(*args)%0A return... | |
71a55a1252ef87629f10e48c1041416c34742ea7 | Add input handling for ssh connections | modules/juliet_input.py | modules/juliet_input.py | Python | 0 | @@ -0,0 +1,235 @@
+from threading import Thread%0A%0Aclass Juliet_Input (Thread):%0A def __init(self):%0A Thread.__init(self)%0A %0A def run(self):%0A while True:%0A char = raw_input()%0A if char == 'q':%0A break%0A%0A
| |
02887eb26b1c95abf6e26f30228c524d61335e40 | Add download_protected_file view | downloads/views.py | downloads/views.py | Python | 0.000001 | @@ -0,0 +1,1040 @@
+from sendfile import sendfile%0Afrom django.conf import settings%0Afrom django.core.exceptions import PermissionDenied%0A%0A%0Adef download_protected_file(request, model_class, path_prefix, path):%0A %22%22%22%0A This view allows download of the file at the specified path, if the user%0A is... | |
0115d088061595fe6c6f8589d0599d1b8e970813 | Add dummy Keras inputs builder | scripts/lwtnn-build-dummy-inputs.py | scripts/lwtnn-build-dummy-inputs.py | Python | 0.000001 | @@ -0,0 +1,1502 @@
+#!/usr/bin/env python3%0A%0A%22%22%22Generate fake NN files to test the lightweight classes%22%22%22%0A%0Aimport argparse%0Aimport json%0Aimport h5py%0Aimport numpy as np%0A%0Adef _run():%0A args = _get_args()%0A _build_keras_arch(%22arch.json%22)%0A _build_keras_inputs_file(%22inputs.json%... | |
ad1defca2f4d16cc5e13c579c945858b9f77c450 | Rename script | snippets/clean_users_data_frames.py | snippets/clean_users_data_frames.py | Python | 0.000001 | @@ -0,0 +1,755 @@
+import pandas as pd%0A%0Atrain_users = pd.read_csv('../datasets/processed/processed_train_users.csv')%0Atest_users = pd.read_csv('../datasets/processed/processed_test_users.csv')%0A%0Apercentage = 0.95%0A%0Atrain_mask = train_users.isnull().sum() %3E train_users.shape%5B0%5D * percentage%0Atrain_to_r... | |
874323b53790ee2121b82bd57b9941d4562995d0 | Add reddit downvoting script | reddit-downvoter.py | reddit-downvoter.py | Python | 0.000002 | @@ -0,0 +1,589 @@
+#!/usr/bin/env python%0A%0Aimport praw%0Aimport time%0A%0Asettings = %7B%0A 'username': 'username',%0A 'password': 'password',%0A 'user_agent': 'angry /r/politics robot',%0A 'subreddit': 'politics',%0A%7D%0A%0Ar = praw.Reddit(user_agent=settings%5B'user_agent'%5D)%0A%0Ar.login(settings%5B... | |
d7b7056b483d52e4d94321019f8e520c166511be | Add singleton decorator. | comrade/core/decorators.py | comrade/core/decorators.py | Python | 0 | @@ -0,0 +1,183 @@
+def singleton(cls):%0A instances = %7B%7D%0A def getinstance():%0A if cls not in instances:%0A instances%5Bcls%5D = cls()%0A return instances%5Bcls%5D%0A return getinstance%0A
| |
4bcc8ddb7df762155402cb1229f16849c03666c1 | Check DB consistence | DB_consist.py | DB_consist.py | Python | 0 | @@ -0,0 +1,2487 @@
+from mysql import mysql%0Afrom env_init import create_data_type%0Aimport os%0A%0Adef create_user_data_file():%0A print(%22check user_data dir and file...%22)%0A try:%0A if not os.path.exists(%22static/user_data%22):%0A print('create dir %22static/user_data%22')%0A ... | |
cb98b4a1580e4976de375722012483bf51ef9254 | Add interactive script to get papers from Mendeley API | scripts/get_mendeley_papers.py | scripts/get_mendeley_papers.py | Python | 0 | @@ -0,0 +1,2221 @@
+###%0A# Copyright 2015-2020, Institute for Systems Biology%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.... | |
731bc1308e94cdb341511618ba5739f6fd37b0b7 | Add a base regressions package | regressions/__init__.py | regressions/__init__.py | Python | 0 | @@ -0,0 +1,592 @@
+# regressions%0A%0A%22%22%22A package which implements various forms of regression.%22%22%22%0A%0Aimport numpy as np%0Atry:%0A import scipy.linalg as linalg%0A linalg_source = 'scipy'%0Aexcept ImportError:%0A import numpy.linalg as linalg%0A linalg_source = 'numpy'%0A%0Aclass ParameterErr... | |
2cdece43768e6bf9613020ae71785f9f158fd72d | Add lc0443_string_compression.py | lc0443_string_compression.py | lc0443_string_compression.py | Python | 0.000005 | @@ -0,0 +1,1472 @@
+%22%22%22Leetcode 443. String Compression%0AEasy%0A%0AURL: https://leetcode.com/problems/string-compression/%0A%0AGiven an array of characters, compress it in-place.%0A%0AThe length after compression must always be smaller than or equal to the%0Aoriginal array.%0A%0AEvery element of the array should... | |
e88ef8f047fc1c6d005f78a40da864a575c1cbe7 | Add tests from `index_brief` | tests/test_brief_utils.py | tests/test_brief_utils.py | Python | 0 | @@ -0,0 +1,1948 @@
+import mock%0Afrom app.brief_utils import index_brief%0Afrom app.models import Brief, Framework%0Afrom tests.bases import BaseApplicationTest%0A%0A%0A@mock.patch('app.brief_utils.index_object', autospec=True)%0Aclass TestIndexBriefs(BaseApplicationTest):%0A def test_live_dos_2_brief_is_indexed(se... | |
b9593297bef14fba20a0eaa4ce384c76447aa3ce | Add tests for deepgetattr | tests/test_deepgetattr.py | tests/test_deepgetattr.py | Python | 0 | @@ -0,0 +1,1468 @@
+from lumbda.collection import deepgetattr%0A%0A%0Aclass MyClass(object):%0A def __init__(self, **kwargs):%0A for key, value in kwargs.iteritems():%0A setattr(self, key, value)%0A%0A%0Adef test_object_hasattr():%0A %22%22%22%0A Test that the looked for attribute is found wh... | |
7abd4c3893e8c1ced664315ee561ae19d3b04191 | Add test_mods_import.py | tests/test_mods_import.py | tests/test_mods_import.py | Python | 0.000003 | @@ -0,0 +1,588 @@
+import pytest%0Aimport os%0Afrom pathlib import Path%0Afrom importlib import import_module%0A%0AHMMs = %5B%5D%0A%0Afor root, dir, files in os.walk(%22.%22):%0A if %22mods%22 in root:%0A for f in files:%0A if f.endswith(%22.py%22):%0A filepath = Path(root) / f%0A ... | |
c6c87e1aafa6b8a4f7929c491398574921417bd4 | Add initial framerate webcam test structure | tests/webcam_framerate.py | tests/webcam_framerate.py | Python | 0 | @@ -0,0 +1,1667 @@
+#!/usr/bin/env python%0A%0Aimport qrtools, gi, os%0Agi.require_version('Gtk', '3.0')%0Agi.require_version('Gst', '1.0')%0Afrom gi.repository import Gtk, Gst%0Afrom avocado import Test%0Afrom utils import webcam%0A%0Aclass WebcamReadQR(Test):%0A %22%22%22%0A Uses the camera selected by v4l2src ... | |
764f819d5288abcece33c75934bbaa43bf29e055 | Add merge migration | corehq/apps/users/migrations/0017_merge_20200608_1401.py | corehq/apps/users/migrations/0017_merge_20200608_1401.py | Python | 0.000001 | @@ -0,0 +1,325 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.28 on 2020-06-08 14:01%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('users', '0016_webappspermissions'),%0A ('users', '0... | |
db3db5819a36c6c4f3fec85a0150e5332e6fa8b1 | Fix FlagEnum print issue by using build-in getattr() function | construct/lib/container.py | construct/lib/container.py | """
Various containers.
"""
def recursion_lock(retval, lock_name = "__recursion_lock__"):
def decorator(func):
def wrapper(self, *args, **kw):
if getattr(self, lock_name, False):
return retval
setattr(self, lock_name, True)
try:
return fun... | Python | 0 | @@ -3551,24 +3551,24 @@
v =
-self.__dict__%5Bk%5D
+getattr(self, k)
%0A
|
b522fed0a1ca2570b8652ddb64b8c847d5964d11 | Add a script to generate all known codes and their decoding | list_all_codes.py | list_all_codes.py | Python | 0.000002 | @@ -0,0 +1,778 @@
+#!/usr/bin/env python%0A%0Aimport lsi_decode_loginfo as loginfo%0A%0Adef generate_values(data):%0A title = data%5B0%5D%0A mask = data%5B1%5D%0A sub = data%5B2%5D%0A%0A for key in sub.keys():%0A v = sub%5Bkey%5D%0A key_name = v%5B0%5D%0A key_sub = v%5B1%5D%0A ke... | |
a86150c016fd88da9849c8abe58e7a3cf9233521 | Add sleepytime plugin | smartbot/plugins/sleepytime.py | smartbot/plugins/sleepytime.py | Python | 0 | @@ -0,0 +1,800 @@
+from datetime import datetime, timedelta%0A%0Aimport smartbot.plugin%0A%0A%0Aclass Plugin(smartbot.plugin.Plugin):%0A %22%22%22Check when you should wake up.%22%22%22%0A%0A names = %5B'sleepytime', 'sleepyti.me'%5D%0A%0A @staticmethod%0A def calculate_wake_up_times(now=None, time_to_sleep... | |
86ea6884d381f9153d088c634f5353537b967403 | solve 1 problem | solutions/binary-tree-paths.py | solutions/binary-tree-paths.py | Python | 0.000027 | @@ -0,0 +1,1590 @@
+#!/usr/bin/env python%0A# encoding: utf-8%0A%0A%22%22%22%0Abinary-tree-paths.py%0A %0ACreated by Shuailong on 2016-03-04.%0A%0Ahttps://leetcode.com/problems/binary-tree-paths/.%0A%0A%22%22%22%0A%0Afrom collections import deque%0A# Definition for a binary tree node.%0Aclass TreeNode(object):%0A de... | |
6ef53e8c9a3543d8e2e03816d869d02120f004c7 | add __doc__ to plot_adaboost_hastie_10_2.py | examples/ensemble/plot_adaboost_hastie_10_2.py | examples/ensemble/plot_adaboost_hastie_10_2.py | """Figure 10.2 from Elements of Statistical Learning, Ed. 2.
.. author:: Peter Prettenhofer <peter.prettenhofer@gmail.com>
Noel Dawe <noel.dawe@gmail.com>
"""
import numpy as np
from sklearn import datasets
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import AdaBoostClassifier
impo... | Python | 0.000006 | @@ -1,24 +1,482 @@
%22%22%22
-Figure 10.2 from
+%0A=============================%0ADiscrete versus Real AdaBoost%0A=============================%0A%0AThis example is based on Figure 10.2 from Hastie et al 2009 %5B1%5D and illustrates%0Athe difference in performance between the discrete SAMME %5B2%5D boosting%0Aalgori... |
4f4ea5b8c76f35e70368fef0e932f1630788a64a | read json data from file and parse out the good stuff | parse_info_from_json.py | parse_info_from_json.py | Python | 0.000001 | @@ -0,0 +1,700 @@
+import json%0Afrom pprint import pprint%0Aimport re%0A%0Ajson_data=open('crashlacma.20140524-102001.json')%0A%0Adata = json.load(json_data)%0A%0A# TODO: handle test cases%0A# testcases:%0A# hollywood & vine, hollywood and vine%0A# order of operations: hashtag, img, address, other text.%0A# hashtag al... | |
510adb95228852456e7a8074aee10d6d1dad167a | add metadata class for handling guppy geometry attributes | vector/metadata.py | vector/metadata.py | Python | 0 | @@ -0,0 +1,2279 @@
+%22%22%22 Metadata management %22%22%22%0A%0A# Metadata objects should%0A# - maintain internal consistency%0A# - be concatenable%0A# - be iterable%0A%0Aimport copy%0A%0Aclass GeoMetadata(object):%0A %22%22%22 Class for handling collections of metadata %22%22%22%0A%0A _dict = %7B%7D%0A ... | |
093a029ae8607f15b9b446f54293e15f13d44c0e | Create led.py | Python/led.py | Python/led.py | Python | 0 | @@ -0,0 +1,404 @@
+import RPi.GPIO as GPIO%0Aimport time%0A%0A# blinking function%0Adef blink(pin):%0A GPIO.output(pin,GPIO.HIGH)%0A time.sleep(1)%0A GPIO.output(pin,GPIO.LOW)%0A time.sleep(1)%0A return%0A%0A# to use Raspberry Pi board pin numbers%0AGPIO.setmode(GPIO.BOARD)%0A%0A# set... | |
30bc00ce84355cc40e62b1f46d32a17c6b07ac0c | Create GreenHat.py | GreenHat.py | GreenHat.py | Python | 0.000001 | @@ -0,0 +1,1211 @@
+# Copyright (c) 2015 Angus H. (4148)%0A# Distributed under the GNU General Public License v3.0 (GPLv3).%0A%0Afrom datetime import date, timedelta%0Afrom random import randint%0Afrom time import sleep%0Aimport sys%0Aimport subprocess%0Aimport os%0A%0A# returns a date string for the date that is N day... | |
985f23ee5e107c647d5f5e5b245c3fb7ff2d411b | Write script to convert PMF-based result to expected value | bin/to_expected.py | bin/to_expected.py | Python | 0.000001 | @@ -0,0 +1,1275 @@
+#!/usr/bin/env python%0A%0Aimport argparse%0A%0Aimport numpy as np%0Aimport pandas as pd%0A%0A%0Aif __name__ == '__main__':%0A parser = argparse.ArgumentParser(description='Convert result from PMF'%0A ' to expected value')%0A parser.add_argument('file', type... | |
3f6ec1a3e9bcdd2dee714e74fac7215b19ae432f | Add an example of a blocking tcp server | blocking_socket.py | blocking_socket.py | Python | 0.00016 | @@ -0,0 +1,934 @@
+%22%22%22%0AA Simple example for testing the SimpleServer Class. A simple telnet server.%0AIt is for studying purposes only.%0A%22%22%22%0A%0Afrom server import SimpleServer%0A%0A%0A__author__ = %22Facundo Victor%22%0A__license__ = %22MIT%22%0A__email__ = %22facundovt@gmail.com%22%0A%0A%0Adef handle_... | |
22fd64e88700fb8cb0c86eef10df1ae0c5fb91c9 | Create parse_large_file.py | tools/parse_large_file.py | tools/parse_large_file.py | Python | 0.000005 | @@ -0,0 +1,2211 @@
+#!/usr/bin/evn python%0A# -*- encoding: utf-8 -*-%0A#%0A# Simple example for processing large file in multiple threads line by line%0A#%0A# Copyright 2019 Wanghong Lin%0A# %0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with... | |
3a11d1c5235fcc7f40aca4395a183d7e1316117a | Add documentation support for swagger | makiki/documentation.py | makiki/documentation.py | Python | 0 | @@ -0,0 +1,1818 @@
+# -*- coding: utf-8 -*-%0A%0Aimport json%0A%0A%0Aclass Documentation(object):%0A%0A HUG_TYPE_TRANSLATION = %7B%0A 'A Whole number': 'integer',%0A 'Accepts a JSON formatted data structure': 'object',%0A 'Basic text / string value': 'string',%0A 'Multiple Values': 'array... | |
591e9f15a3b9da59f80f81fcf0d6ddad4aeb7d6a | Add a snippet. | python/pyside/pyside6/widget_QSqlRelationalTableModel_sqlite_from_file.py | python/pyside/pyside6/widget_QSqlRelationalTableModel_sqlite_from_file.py | Python | 0.000002 | @@ -0,0 +1,2559 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A# Ref: https://doc.qt.io/qtforpython/PySide6/QtSql/QSqlRelationalTableModel.html?highlight=qsqlrelationaltablemodel%0A%0Aimport sys%0Aimport sqlite3%0Afrom PySide6 import QtCore, QtWidgets%0A%0Afrom PySide6.QtCore import Qt%0Afrom PySide6.QtWidge... | |
99ffed2a53c5266f312127b7a09f86254891234e | Create 4-LDR.py | Code/4-LDR.py | Code/4-LDR.py | Python | 0.000005 | @@ -0,0 +1,763 @@
+# Import Libraries%0Aimport time%0Aimport RPi.GPIO as GPIO%0A%0A# Set the GPIO Mode and set the pin to use for the %0AGPIO.setmode(GPIO.BCM)%0AGPIO.setwarnings(False)%0A%0A# A variable with the LDR reading pin number%0APINLDR = 27%0A %0Adef ReadLDR():%0A LDRCount = 0 # Sets the count to 0%0A GP... | |
0c4095d9b370da41f653927dc92cc4233aca2beb | Add untested LedStrip driver | LedStrip.py | LedStrip.py | Python | 0 | @@ -0,0 +1,1103 @@
+import RPi.GPIO as GPIO, time, os%0A%0Aclass RGB:%0A r = 0xff%0A g = 0xff%0A b = 0xff%0A def __init__(self, r, g, b):%0A self.r = r%0A self.g = g%0A self.b = b%0A%0A%0Aclass LedStrip:%0A spidev = None%0A height = 10%0A%0A def __init__(self):%0A self.s... | |
35e8133dbf0f95a511c2eb219ba408af464afc2b | Create file | jupyter_notebook_config_template.py | jupyter_notebook_config_template.py | Python | 0.000002 | @@ -0,0 +1,270 @@
+c.NotebookApp.ip = '*'%0Ac.NotebookApp.port = 8998%0Ac.NotebookApp.open_browser = False%0Ac.NotebookApp.keyfile = u'/home/ubuntu/.certificates/jupyterkey.pem'%0Ac.NotebookApp.certfile = u'/home/ubuntu/.certificates/jupytercert.pem'%0Ac.NotebookApp.password = u'sha2:PASSWORDHASH'%0A
| |
2d66bc24c883f135a9a22cd40a8b2682ec572373 | Add count_bits | node/count_bits.py | node/count_bits.py | Python | 0.000577 | @@ -0,0 +1,507 @@
+from nodes import Node%0A%0Aclass CountBits(Node):%0A char = %22./%22%0A args = 2%0A results = 1%0A contents = 2000%0A %0A @Node.test_func(%5B8,2%5D, %5B%5B1, 3%5D%5D)%0A @Node.test_func(%5B12, 3%5D, %5B%5B0, 2, 1%5D%5D)%0A def count_bits(self, num: int, base: int):%0A... | |
623115b7cb26c6402479845dd96e69c613ad4b98 | Create easy_23_DashInsert.py | easy_23_DashInsert.py | easy_23_DashInsert.py | Python | 0.000001 | @@ -0,0 +1,398 @@
+def odd(ch):%0A return ch in '13579'%0A%0A##############################%0A# Inserts dashes between odd #%0A# digits #%0A##############################%0Adef DashInsert(num):%0A result = %5B%5D%0A prev = ' '%0A for curr in str(num):%0A if odd(prev) and odd(curr): %0A r... | |
bfe073671910efdd932b92c2bb40dc24c230733a | fix migrations | apps/domain/migrations/0024_meta.py | apps/domain/migrations/0024_meta.py | Python | 0.000002 | @@ -0,0 +1,519 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9 on 2016-11-14 12:11%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('domain', '0023_fix_label'),%0A %5D%0A%0A operations = %5... | |
b35dc73429d8625b298017625b4521a2f3a00eea | Add testing module | maxwellbloch/testing.py | maxwellbloch/testing.py | Python | 0.000001 | @@ -0,0 +1,214 @@
+# -*- coding: utf-8 -*-%0A%0Aimport nose%0A%0Adef run():%0A %22%22%22%0A Run all tests with nose.%0A %22%22%22%0A%0A # runs tests in maxwellbloch.tests module%0A nose.run(defaultTest=%22maxwellbloch.tests%22, argv=%5B'nosetests', '-v'%5D)%0A
| |
cc04592ea5ea15944f668928d5b8e6f7d8e257a1 | Update prefix-and-suffix-search.py | Python/prefix-and-suffix-search.py | Python/prefix-and-suffix-search.py | # Time: ctor: O(w * l), l is the word length on average
# search: O(m + n), m is the number of prefix match, n is the number of suffix match
# Space: O(w * l), w is the number of words
class Trie(object):
def __init__(self):
_trie = lambda: collections.defaultdict(_trie)
self.__trie ... | Python | 0 | @@ -19,16 +19,42 @@
(w * l),
+ w is the number of words,
l is th
@@ -191,34 +191,8 @@
* l)
-, w is the number of words
%0A%0Acl
|
6718e97b23d67dda6e67cda8226030edd90f7fbd | add env.py for the migrations | migrations/env.py | migrations/env.py | Python | 0 | @@ -0,0 +1,2158 @@
+from __future__ import with_statement%0Afrom alembic import context%0Afrom sqlalchemy import engine_from_config, pool%0Afrom logging.config import fileConfig%0A%0A# this is the Alembic Config object, which provides%0A# access to the values within the .ini file in use.%0Aconfig = context.config%0A%0A... | |
0f04d1a7e641fc37b4550f4ba6d1034f2da1ea0d | Fix rebuild of iterables. | scripts/unpickle.py | scripts/unpickle.py | #!/usr/bin/env python
##########################################################################
#
# Copyright 2012 Jose Fonseca
# All Rights Reserved.
#
# 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 th... | Python | 0 | @@ -4266,23 +4266,24 @@
n klass(
-changed
+newItems
)%0A
|
cc3b29aaa2c0ffa3cde6b901bf4bdf3ce3fb4345 | Add code for pulling pitcher stats for specified date range | pybaseball/league_pitching_stats.py | pybaseball/league_pitching_stats.py | Python | 0 | @@ -0,0 +1,1193 @@
+import requests%0Aimport pandas as pd%0Afrom bs4 import BeautifulSoup%0A%0Adef get_soup(start_dt, end_dt):%0A%09# get most recent standings if date not specified%0A%09if((start_dt is None) or (end_dt is None)):%0A%09%09print('Error: a date range needs to be specified')%0A%09%09return None%0A%09url =... | |
bd60a99d832d839d7535a5232453afa807d6e3ee | Create __init__.py | Pi_Weather_Station/__init__.py | Pi_Weather_Station/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
f60123ea933cba6b57214ad335b244b48cc65fdf | Create valid-tic-tac-toe-state.py | Python/valid-tic-tac-toe-state.py | Python/valid-tic-tac-toe-state.py | Python | 0.998513 | @@ -0,0 +1,2303 @@
+# Time: O(1)%0A# Space: O(1)%0A%0A# A Tic-Tac-Toe board is given as a string array board. Return True%0A# if and only if it is possible to reach this board position%0A# during the course of a valid tic-tac-toe game.%0A#%0A# The board is a 3 x 3 array, and consists of characters %22 %22, %22X%22, %0... | |
ee7a48da3ef6486c3650f9bcc1f4b59c59642adc | Add unittest-based PyDbLite test | PyDbLite/test/test_pydblite.py | PyDbLite/test/test_pydblite.py | Python | 0.000001 | @@ -0,0 +1,2058 @@
+# -*- coding: iso-8859-1 -*-%0D%0A%0D%0Aimport datetime%0D%0Aimport unittest%0D%0Aimport random%0D%0A%0D%0Aimport os%0D%0Aimport sys%0D%0Asys.path.insert(0,os.path.dirname(os.getcwd()))%0D%0Aimport PyDbLite%0D%0A%0D%0Adb = None%0D%0Avals1 = %5B('simon',datetime.date(1984,8,17),26)%5D%0D%0Avals2 = %5... | |
403c724ffd9dab4ebdf3a58e02406969ed7a9fcb | Create front_back.py | Python/CodingBat/front_back.py | Python/CodingBat/front_back.py | Python | 0.000013 | @@ -0,0 +1,144 @@
+# http://codingbat.com/prob/p153599%0A%0Adef front_back(str):%0A if len(str) %3C= 1:%0A return str%0A %0A return str%5Blen(str)-1%5D + str%5B1:-1%5D + str%5B0%5D%0A
| |
4a48b9998961be268cbfe64726ea78f68cedce39 | Create not_string.py | Python/CodingBat/not_string.py | Python/CodingBat/not_string.py | Python | 0.002302 | @@ -0,0 +1,133 @@
+# http://codingbat.com/prob/p189441%0A%0Adef not_string(str):%0A if str.startswith(%22not%22):%0A return str%0A else:%0A return %22not %22 + str%0A
| |
4d41c5cd0ff73dc288d4a840780f46c53277f9e5 | Fix issue #3250 (#3253) | homeassistant/components/media_player/denon.py | homeassistant/components/media_player/denon.py | """
Support for Denon Network Receivers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.denon/
"""
import logging
import telnetlib
import voluptuous as vol
from homeassistant.components.media_player import (
PLATFORM_SCHEMA, SUPPORT_NE... | Python | 0 | @@ -2367,16 +2367,17 @@
except
+(
Connecti
@@ -2390,16 +2390,26 @@
sedError
+, OSError)
:%0A
|
2fc62908b2f0074a0e82a120809b80cb3e009999 | add __init__.py for distro | mint/distro/__init__.py | mint/distro/__init__.py | Python | 0.000016 | @@ -0,0 +1,64 @@
+#%0A# Copyright (c) 2005 Specifix, Inc.%0A#%0A# All rights reserved%0A#%0A
| |
976f7b4239a1ff21d0748f43e8224017084118b7 | make neuroimaging.visualization.tests into a package | lib/visualization/tests/__init__.py | lib/visualization/tests/__init__.py | Python | 0.000583 | @@ -0,0 +1,116 @@
+import test_visualization%0Aimport unittest%0A%0Adef suite():%0A return unittest.TestSuite(%5Btest_visualization.suite()%5D)%0A
| |
b58d7ae6b9887b326ba485ce885deb9c03054801 | Create Factorial_of_a_number.py | Python3-5/Factorial_of_a_number.py | Python3-5/Factorial_of_a_number.py | Python | 0.000016 | @@ -0,0 +1,477 @@
+#Write a program which can compute the factorial of a given numbers.%0A#We will first define a function%0Adef fact(x): #Define a function named 'fact()'%0A if x == 0: #We directly return 1 if input number is 0.%0A return 1 ;%0A return x * fact(x - 1); # We ... | |
a9f6caf863b5c3156c3200d33a6cdc29f0c2ad23 | Add new py-hacking package (#14027) | var/spack/repos/builtin/packages/py-hacking/package.py | var/spack/repos/builtin/packages/py-hacking/package.py | Python | 0 | @@ -0,0 +1,622 @@
+# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass PyHacking(PythonPackage):%0A %22%22%22OpenStack Hacking ... | |
e6641065af9078e2e50e99f657aa605d837d3976 | add new package (#20112) | var/spack/repos/builtin/packages/py-vcstool/package.py | var/spack/repos/builtin/packages/py-vcstool/package.py | Python | 0 | @@ -0,0 +1,778 @@
+# 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%0A%0Aclass PyVcstool(PythonPackage):%0A %22%22%22vcstool enables batch commands on multiple ... | |
701f6a06b8405620905a67b47c5702c100a1447a | Check to make sure the input file is sorted | scripts/check_sorted.py | scripts/check_sorted.py | Python | 0.000001 | @@ -0,0 +1,722 @@
+import sys%0A%0Aprev_val = 0%0Aprev_val2 = 0%0Acounter = 0%0A%0Afor line in sys.stdin:%0A parts = line.split()%0A curr_val = int(parts%5B0%5D)%0A curr_val2 = int(parts%5B1%5D)%0A%0A val1 = int(parts%5B0%5D)%0A val2 = int(parts%5B1%5D)%0A%0A if val1 %3E val2:%0A print %3E%3Esy... | |
0aa5466be1ba678f0428e825def010a5007059c7 | Modify tests to show Unicode handling regression | scss/tests/test_misc.py | scss/tests/test_misc.py | # -*- encoding: utf-8 -*-
"""Tests for miscellaneous features that should maybe be broken out into their
own files, maybe.
"""
from scss import Scss
def test_super_selector():
compiler = Scss(scss_opts=dict(style='expanded'))
input = """\
foo, bar {
a: b;
}
baz {
c: d;
}
"""
expected = """\
super foo... | Python | 0 | @@ -2144,16 +2144,32 @@
%E2%80%98%22 %22%E2%80%99%22;%0A
+ content: %22%E2%80%A2%22;%0A
%7D%0A%22%22%22%0A
|
b2532cfeb3541a64143ded6d86b635e2c9049080 | Clean up some pylint warnings | bindings/python-examples/example.py | bindings/python-examples/example.py | #! /usr/bin/env python
# -*- coding: utf8 -*-
#
# Link Grammar example usage
#
import locale
from linkgrammar import Sentence, ParseOptions, Dictionary
# from linkgrammar import _clinkgrammar as clg
locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
po = ParseOptions()
def desc(linkage):
print linkage.diagram()
... | Python | 0.000001 | @@ -69,17 +69,16 @@
le usage
-
%0A#%0Aimpor
@@ -274,22 +274,18 @@
f desc(l
-inkage
+kg
):%0A p
@@ -290,22 +290,18 @@
print l
-inkage
+kg
.diagram
@@ -338,22 +338,18 @@
print l
-inkage
+kg
.postscr
|
39473b1aa0d8c54b0fb43b5e97545596ed087d59 | Create set-intersection-size-at-least-two.py | Python/set-intersection-size-at-least-two.py | Python/set-intersection-size-at-least-two.py | Python | 0.000562 | @@ -0,0 +1,1561 @@
+# Time: O(nlogn)%0A# Space: O(n)%0A%0A# An integer interval %5Ba, b%5D (for integers a %3C b) is a set of all consecutive integers from a to b,%0A# including a and b.%0A#%0A# Find the minimum size of a set S such that for every integer interval A in intervals,%0A# the intersection of S with A has s... | |
208fed6d1e162dd0fcfa10c2b79d0d35ea813478 | Create intermediate-171.py | Challenge-171/Intermediate/intermediate-171.py | Challenge-171/Intermediate/intermediate-171.py | Python | 0.000318 | @@ -0,0 +1,1669 @@
+#Challenge 171 Intermediate%0A%0Ahexvalue = 'FF 81 BD A5 A5 BD 81 FF'.split(' ')%0Abinary = %5Bbin(int(line, 16))%5B2:%5D.zfill(8) for line in hexvalue%5D #Convert it to a list of binary lines%0Aimage = %5Bpixel.replace('1', '*').replace('0', ' ') for pixel in binary%5D #Convert it to a list of line... | |
752b5b43aa807e5431615219d40eafd38cacadeb | Increase length of report name on Report model | onmydesk/models.py | onmydesk/models.py | """
Required models to handle and store generated reports.
"""
from django.db import models
from django.conf import settings
from onmydesk.utils import my_import
ONMYDESK_FILE_HANDLER = getattr(settings, 'ONMYDESK_FILE_HANDLER', None)
def output_file_handler(filepath):
"""
Returns the output filepath (hand... | Python | 0.000001 | @@ -1091,10 +1091,11 @@
gth=
-30
+255
)%0A
|
bdf5cfb2a7b716d897dabd62e591caad8144a029 | Add election funding parsing script | utils/populate-funding.py | utils/populate-funding.py | Python | 0 | @@ -0,0 +1,2139 @@
+#!/usr/bin/python%0A%0Aimport os%0Aimport sys%0Aimport csv%0Afrom optparse import OptionParser%0A%0Afrom django.core.management import setup_environ%0A%0Amy_path = os.path.abspath(os.path.dirname(__file__))%0Aapp_path = os.path.normpath(my_path + '/..')%0Aapp_base = app_path + '/'%0A%0A# We need a p... | |
30b53c525b2319cc664d26d083c84bba1b63ff7c | add unit test for s3 cache | mapproxy/test/unit/test_cache_s3.py | mapproxy/test/unit/test_cache_s3.py | Python | 0 | @@ -0,0 +1,1421 @@
+# This file is part of the MapProxy project.%0A# Copyright (C) 2011 Omniscale %3Chttp://omniscale.de%3E%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#... | |
1d8f57ff9c6e2c9a38d1634fc14449ac401ea570 | document valid restful PUT status code | pyethereum/apiserver.py | pyethereum/apiserver.py | import logging
import threading
import json
import bottle
from pyethereum.chainmanager import chain_manager
from pyethereum.peermanager import peer_manager
import pyethereum.dispatch as dispatch
from pyethereum.blocks import block_structure
import pyethereum.signals as signals
from pyethereum.transactions import Tran... | Python | 0 | @@ -3355,16 +3355,789 @@
hash())%0A
+ %22%22%22%0A%0A HTTP status code 200 OK for a successful PUT of an update to an existing resource. No response body needed. (Per Section 9.6, 204 No Content is even more appropriate.)%0A HTTP status code 201 Created for a successful PUT of a new resource, with URIs and me... |
a332a057292e701e197b5ac2250e608ef953d631 | Add example config | pyfsw/config.example.py | pyfsw/config.example.py | Python | 0.000001 | @@ -0,0 +1,1102 @@
+# Database URI Scheme (Refer to the SQLAlchemy documentation for variations)%0ADB_URI = ''%0A%0A# Secret Key%0ASECRET_KEY = 'pyfsw'%0A%0A# Network Host%0ANET_HOST = '127.0.0.1'%0A%0A# Network Port%0ANET_PORT = 5000%0A%0A# Debug Mode%0ADEBUG = False%0A%0A# Debug Profiler%0ADEBUG_PROFILER = False%0A%0... | |
9bed52b93061fea7381492ffe0ce55c6929eab78 | Add tests.py to app skeleton. | lib/rapidsms/skeleton/app/tests.py | lib/rapidsms/skeleton/app/tests.py | Python | 0 | @@ -0,0 +1,543 @@
+from rapidsms.tests.scripted import TestScript%0Afrom app import App%0A%0Aclass TestApp (TestScript):%0A apps = (App,)%0A%0A # define your test scripts here.%0A # e.g.:%0A #%0A # testRegister = %22%22%22%0A # 8005551212 %3E register as someuser%0A # 8005551212 %3C Registered ... | |
4c78124a434d4f953d5811ee2708eaf051bd591e | Create setup_data_libraries.py | setup_data_libraries.py | setup_data_libraries.py | Python | 0.000004 | @@ -0,0 +1,2800 @@
+#!/usr/bin/env python%0A%0Aimport argparse%0Aimport logging as log%0Aimport sys%0Aimport time%0A%0Aimport yaml%0Afrom bioblend import galaxy%0A%0A%0Adef setup_data_libraries(gi, data):%0A %22%22%22%0A Load files into a Galaxy data library.%0A By default all test-data tools from all installe... | |
d78872da09bc67435a2662cce0b253ab149b2bad | Create 03.py | 02.5/03.py | 02.5/03.py | Python | 0 | @@ -0,0 +1,2300 @@
+# By Websten from forums%0A#%0A# Given your birthday and the current date, calculate your age in days. %0A# Compensate for leap days. %0A# Assume that the birthday and current date are correct dates (and no time travel). %0A# Simply put, if you were born 1 Jan 2012 and todays date is 2 Jan 2012 %0A#... | |
d2b3996edc1af3f7f491354a762b8bd34c8345a1 | Create remove_string_spaces.py | remove_string_spaces.py | remove_string_spaces.py | Python | 0.00025 | @@ -0,0 +1,142 @@
+#Kunal Gautam%0A#Codewars : @Kunalpod%0A#Problem name: Remove String Spaces%0A#Problem level: 8 kyu%0A%0Adef no_space(x):%0A return ''.join(x.split())%0A
| |
8ea44bc5daa099ccc2e48c606f38a424235b9f3d | Create a.py | abc001/a.py | abc001/a.py | Python | 0.000489 | @@ -0,0 +1,52 @@
+h1 = int(input())%0Ah2 = int(input())%0A%0Aprint(h1 - h2)%0A
| |
730b11a45696b4d4b8b0e56c0028ec6eeca7da4f | Create a.py | agc017/a.py | agc017/a.py | Python | 0.000489 | @@ -0,0 +1,745 @@
+import math%0A %0A %0Adef comb(n, r):%0A return math.factorial(n) / math.factorial(r) / math.factorial(n - r)%0A %0A %0Adef main():%0A n, p = map(int, input().split())%0A a = tuple(map(lambda x: int(x) %25 2, input().split()))%0A %0A if n == 1 and a%5B0%5D %25 2 != p:%0A print(0)%0... | |
15b1779475c7744a85e948c419de34be038fba94 | Add lc0314_binary_tree_vertical_order_traversal.py | lc0314_binary_tree_vertical_order_traversal.py | lc0314_binary_tree_vertical_order_traversal.py | Python | 0.000098 | @@ -0,0 +1,1259 @@
+%22%22%22Leetcode 314. Binary Tree Vertical Order Traversal%0AMedium%0A%0AURL: https://leetcode.com/problems/binary-tree-vertical-order-traversal/%0A%0AGiven a binary tree, return the vertical order traversal of its nodes' values.%0A(ie, from top to bottom, column by column).%0A%0AIf two nodes are i... | |
934e907180645e3dc618ff5c75a4982656310673 | Add the arrayfns compatibility library -- not finished. | numpy/oldnumeric/arrayfns.py | numpy/oldnumeric/arrayfns.py | Python | 0 | @@ -0,0 +1,2055 @@
+%22%22%22Backward compatible with arrayfns from Numeric%0A%22%22%22%0A%0A__all__ = %5B'array_set', 'construct3', 'digitize', 'error', 'find_mask', 'histogram', 'index_sort',%0A 'interp', 'nz', 'reverse', 'span', 'to_corners', 'zmin_zmax'%5D%0A%0Aimport numpy as nx%0Afrom numpy import asarr... | |
d5daa2376fadae0d6715b606a0c355b572efdd0c | Add Python benchmark | lib/node_modules/@stdlib/math/base/dist/beta/kurtosis/benchmark/python/benchmark.scipy.py | lib/node_modules/@stdlib/math/base/dist/beta/kurtosis/benchmark/python/benchmark.scipy.py | Python | 0.000138 | @@ -0,0 +1,1590 @@
+#!/usr/bin/env python%0A%22%22%22Benchmark scipy.stats.beta.stats.%22%22%22%0A%0Aimport timeit%0A%0Aname = %22beta:kurtosis%22%0Arepeats = 3%0Aiterations = 1000%0A%0A%0Adef print_version():%0A %22%22%22Print the TAP version.%22%22%22%0A%0A print(%22TAP version 13%22)%0A%0A%0Adef print_summary(... | |
7e7879eb5c0d547a56a082a9b3a444fea59e9156 | Create revEncry.py | Codingame/Python/Clash/revEncry.py | Codingame/Python/Clash/revEncry.py | Python | 0.000001 | @@ -0,0 +1,223 @@
+import sys%0Aimport math%0A%0A# Auto-generated code below aims at helping you parse%0A# the standard input according to the problem statement.%0A%0Aword = input()%0Afor x in word:%0A o = ord(x)%0A k = 122-o%0A print(chr(97+k),end='')%0A
| |
625548dfc54a7f0620a83f62435c6e246dc58d12 | Solve 18. | 018/solution.py | 018/solution.py | Python | 0.999773 | @@ -0,0 +1,1096 @@
+%22%22%22 Project Euler problem #18. %22%22%22%0A%0A%0Adef problem():%0A %22%22%22 Solve the problem.%0A%0A Find the maximum total from top to bottom of the triangle below.%0A%0A Answer:%0A%0A %22%22%22%0A triangle = %22%22%22%0A 75%0A 95 64%0A 17 47 82%0A ... | |
b647416b719c9f0b2534c13a67d3396fefaada47 | Add problem 1 sum muliples of 3 or 5 python solution | p001_multiples_of_3_and_5.py | p001_multiples_of_3_and_5.py | Python | 0.999989 | @@ -0,0 +1,1343 @@
+#%0A'''%0AProject Euler - Problem 1 - Multiples of 3 and 5%0Ahttps://projecteuler.net/problem=1%0A%0AIf we list all the natural numbers below 10 that are multiples of 3 or 5, we%0Aget 3, 5, 6 and 9. The sum of these multiples is 23.%0A%0AFind the sum of all the multiples of 3 or 5 below 1000.%0A'''%... | |
6c806f12129d132db17cf601335f638b82a814d6 | Create form.py | AutoMap/form.py | AutoMap/form.py | Python | 0 | @@ -0,0 +1,1981 @@
+import turtle%0Aimport Tkinter as tk%0A%0Adef desenha(distancia, angulo, lousa):%0A lousa.penup()%0A lousa.home()%0A lousa.left(angulo)%0A lousa.pendown()%0A lousa.forward(distancia)%0A %0Adef main():%0A app = tk.Tk()%0A app.title(%22Mapeamento 2D de ambiente %22)%0A a... | |
0c2f07fabb94698b8cf1b42a4f671ad0cd5e365f | Add migration for comment notification type | src/ggrc/migrations/versions/20160321011353_3914dbf78dc1_add_comment_notification_type.py | src/ggrc/migrations/versions/20160321011353_3914dbf78dc1_add_comment_notification_type.py | Python | 0 | @@ -0,0 +1,1748 @@
+# Copyright (C) 2016 Google Inc., authors, and contributors %3Csee AUTHORS file%3E%0A# Licensed under http://www.apache.org/licenses/LICENSE-2.0 %3Csee LICENSE file%3E%0A# Created By: miha@reciprocitylabs.com%0A# Maintained By: miha@reciprocitylabs.com%0A%0A%22%22%22%0AAdd comment notification type%... | |
2a6f3eca3187f8e4ca078cb592bb324a735cc246 | Create solution.py | hackerrank/algorithms/sorting/easy/find_the_median/py/solution.py | hackerrank/algorithms/sorting/easy/find_the_median/py/solution.py | Python | 0.000018 | @@ -0,0 +1,696 @@
+#!/bin/python%0A%0Adef partition(L, lo, hi):%0A # Lomuto partitioning.%0A #%0A i = j = lo%0A v = hi - 1%0A while i %3C hi:%0A if L%5Bi%5D %3C L%5Bv%5D:%0A L%5Bi%5D, L%5Bj%5D = L%5Bj%5D, L%5Bi%5D%0A j += 1%0A i += 1%0A L%5Bv%5D, L%5Bj%5D = L%5Bj%5D... | |
6f7ed6f3b082c7f6399ab456a6f6b291219c910f | ADD migration scripts for uom prices | product_uom_prices/migrations/8.0.0.5.0/pre-migration.py | product_uom_prices/migrations/8.0.0.5.0/pre-migration.py | Python | 0 | @@ -0,0 +1,962 @@
+# -*- encoding: utf-8 -*-%0Afrom openerp import SUPERUSER_ID%0Afrom openerp.modules.registry import RegistryManager%0A%0A%0Adef set_value(cr, model, table, field, value, condition):%0A print 'Set value %25s on field %25s on table %25s' %25 (%0A value, field, table)%0A cr.execute('SELECT ... | |
9b6f86cb2f4763625127a3d9d236238a4dd998ba | Create fileExamples.py | Bits/fileExamples.py | Bits/fileExamples.py | Python | 0 | @@ -0,0 +1,578 @@
+#!/usr/bin/env python%0A%0A# CREATING A NEW FILE%0Afile = open(%22newfile.txt%22, %22w%22)%0Afile.write(%22hello world in the new file%5Cn%22)%0Afile.write(%22and another line%5Cn%22)%0Afile.close()%0A%0A%0A# READING A FILE%0Afile = open('newfile.txt', 'r')%0Aprint file.read() #Put n for the first n ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.