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 |
|---|---|---|---|---|---|---|---|
06f66859c305465c3f6f38617ecada4da94d41ff | set up skeleton | algorithms/sorting/quicksort.py | algorithms/sorting/quicksort.py | Python | 0.000002 | @@ -0,0 +1,612 @@
+from random import randint%0A%0Adef quicksort(unsorted):%0A if len(unsorted) %3C= 1:%0A return unsorted%0A %0A start = 0%0A end = start + 1%0A pivot = choose_pivot(start, end)%0A %0A sort(unsorted, start, pivot, end)%0A %0A %0A%0Adef choose_pivot(start, end):%0A ... | |
0e31b15e4dae95b862fd4777659a9210e5e4ec86 | change of file path | preprocessing/python_scripts/renpass_gis/simple_feedin/renpassgis_feedin.py | preprocessing/python_scripts/renpass_gis/simple_feedin/renpassgis_feedin.py | Python | 0.000002 | @@ -0,0 +1,1163 @@
+%22%22%22%0A%0AToDO:%0A * Greate one scaled time series%0A * %0A %0ADatabase table: %0A * model_draft.ego_weather_measurement_point%0A * model_draft.ego_simple_feedin_full%0A%0A%0AChange db.py and add ego_simple_feedin_full%0A%0A%0A%22%22%22 %0A%0A__copyright__ = %22ZNES%22%0A__license__ = %22GNU Af... | |
cbd64641f30c1a464528a2ec6d5323d29766830d | Add word embedding | hazm/embedding.py | hazm/embedding.py | Python | 0.00733 | @@ -0,0 +1,2437 @@
+from . import word_tokenize%0Afrom gensim.models import KeyedVectors%0Afrom gensim.scripts.glove2word2vec import glove2word2vec%0Aimport fasttext, os%0A%0Asupported_embeddings = %5B'fasttext', 'keyedvector', 'glove'%5D%0A%0A%0Aclass WordEmbedding:%0A def __init__(self, model_type, model=None):%0A... | |
13851dd6f2101ceea917504bd57540a4e54f0954 | Create __init__.py | fb_nsitbot/migrations/__init__.py | fb_nsitbot/migrations/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
14647b71fec7a81d92f044f6ac88304a4b11e5fd | create http server module | src/step1.py | src/step1.py | Python | 0 | @@ -0,0 +1,99 @@
+%22%22%22A simple HTTP server.%22%22%22%0A%0A%0Adef response_ok():%0A %22%22%22Testing for 200 response code.%22%22%22%0A pass%0A
| |
0a97f34b4ae4f7f19bfe00c26f495f399f827fab | Add file_regex | python/file_regex/tmp.py | python/file_regex/tmp.py | Python | 0.000001 | @@ -0,0 +1,405 @@
+# -*- coding: utf-8 -*-%0Aimport re%0A%0Afile_name = 'hogehoge'%0A%0Aorg_file = open(file_name + '.txt')%0Alines = org_file.readlines()%0Aorg_file.close()%0A%0Adist_file = open(file_name + '_after.txt', 'w')%0Apattern = r'title=%5C%22.+?%5C%22'%0Aall_title = re.findall(pattern, ''.join(lines))%0Aif a... | |
0297e8b1762d495ffd696106bc6498def0ddf600 | Add membership.utils.monthRange to calculate start and end dates of months easily | spiff/membership/utils.py | spiff/membership/utils.py | Python | 0 | @@ -0,0 +1,442 @@
+import datetime%0Aimport calendar%0Afrom django.utils.timezone import utc%0A%0Adef monthRange(today=None):%0A if today is None:%0A today = datetime.datetime.utcnow().replace(tzinfo=utc)%0A lastDayOfMonth = calendar.monthrange(today.year, today.month)%5B1%5D%0A startOfMonth = datetime.datetime(t... | |
fb16bb12e12fd820856ca0397a2cb4a857d2c7ca | chatbot function | src/tuling.py | src/tuling.py | Python | 0.999999 | @@ -0,0 +1,332 @@
+# coding:utf-8%0Aimport requests%0A%0A%0Adef chatbot(body):%0A resp = requests.post(%22http://www.tuling123.com/openapi/api%22, data=%7B%0A # %22key%22: %22d59c41e816154441ace453269ea08dba%22,%0A %22key%22: %22ff772ad12e0c421f98da2dd7f6a9289c%22,%0A %22info%22: body,%0A... | |
0a079e378fcb4994a2e1fd9bc8c71e22d4342901 | Generate HTML snippet for Jekyll | kuveja-html.py | kuveja-html.py | Python | 0.999999 | @@ -0,0 +1,427 @@
+#!/usr/bin/env python3%0Aimport json%0A%0AFILE = 'kuveja.json'%0APREFIX = 'http://joneskoo.kapsi.fi/kuveja/'%0AHEADER = %22%22%22---%0Alayout: main%0Atitle: joneskoon kuvafeedi%0A---%22%22%22%0AHTML = %22%22%22%3Cdiv class=%22kuva%22%3E%0A %3Ch3%3E%25(title)s%3C/h3%3E%0A %3Cimg src=%22%25(url)s... | |
e30f1c21363e96801f75ee6bf913d2ea3366d8f2 | add browserid | settings.py | settings.py | LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
# If you set ... | Python | 0.000001 | @@ -1687,16 +1687,160 @@
er',%0A)%0A%0A
+TEMPLATE_CONTEXT_PROCESSORS = (%0A 'django.contrib.auth.context_processors.auth',%0A 'django_browserid.context_processors.browserid_form',%0A)%0A%0A
MIDDLEWA
@@ -2850,17 +2850,16 @@
s',%0A
-#
'django.
@@ -2874,16 +2874,117 @@
admin',%0A
+ 'django_browserid',%0A... |
0ec3fd40c85f2a61eee5960031318c7f5ab06bc5 | Allow whitelisted shell calls in transforms | humfrey/update/transform/shell.py | humfrey/update/transform/shell.py | Python | 0.000001 | @@ -0,0 +1,1323 @@
+import logging%0Aimport subprocess%0Aimport tempfile%0A%0Afrom django.conf import settings%0A%0Afrom .base import Transform, TransformException%0A%0ASHELL_TRANSFORMS = getattr(settings, 'SHELL_TRANSFORMS', %7B%7D)%0A%0Alogger = logging.getLogger(__name__)%0A%0Aclass Shell(Transform):%0A def __ini... | |
2a1b46740c4cf14f7db4f344431aced9bf06d1e7 | Add a little program that calls sync until is is done | scripts/sync_for_real.py | scripts/sync_for_real.py | Python | 0.000001 | @@ -0,0 +1,608 @@
+#!/usr/bin/env python3%0A%0Aimport subprocess%0Aimport sys%0Afrom time import time%0A%0A%0A%0Adef eprint(*args, **kwargs):%0A print(*args, file=sys.stderr, **kwargs)%0A%0A%0Adef main():%0A nr_fast = 3%0A while nr_fast %3E 0:%0A eprint('syncing... ', end='', flush=True)%0A start... | |
3e2c4f19d1eb5d66430ea46abe18a6a7022e13ef | Create svg_filter.py | svg_filter.py | svg_filter.py | Python | 0.000006 | @@ -0,0 +1,1104 @@
+f = open(%22domusdomezones.svg%22, %22r%22)%0Asvg = %5B%5D%0Afor line in f:%0A line = line.strip()%0A svg.append(line)%0Af.close()%0A%0Avector_paths = %5B%5D%0Afor i in range(0, len(svg)):%0A if svg%5Bi%5D == %22%3Cpath%22:# spot the paths location %0A i = i+1 %0A svg%5Bi%5D =... | |
353d717c425cca9941d650d715c3ed8caf0aae64 | Reset tooltip timer also when cell editor is closed | src/robotide/editor/tooltips.py | src/robotide/editor/tooltips.py | # Copyright 2008-2009 Nokia Siemens Networks Oyj
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | Python | 0 | @@ -608,16 +608,31 @@
mport wx
+%0Aimport wx.grid
%0A%0Afrom p
@@ -1063,16 +1063,91 @@
ToolTip)
+%0A grid.Bind(wx.grid.EVT_GRID_EDITOR_HIDDEN, self.OnGridEditorHidden)
%0A%0A de
@@ -1211,32 +1211,38 @@
)%0A self._
+start_
tooltip_timer.St
@@ -1242,45 +1242,112 @@
imer
-.Start(500, True)%0A ... |
86434fb902caeea7bb740c35607dc6f9f7766d88 | Fix searching for notes in the django admin | notes/admin.py | notes/admin.py | #
# Copyright (c) 2009 Brad Taylor <brad@getcoded.net>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# This... | Python | 0 | @@ -981,12 +981,15 @@
= %5B'
-body
+content
', '
|
75717747ffbc36f306e0f771a65ed101bd3ca9be | Create parser.py | parser.py | parser.py | Python | 0.000011 | @@ -0,0 +1,1294 @@
+from HTMLParser import HTMLParser%0A%0A# create a subclass and override the handler methods%0Aclass Parser(HTMLParser):%0A tag = %22%22%0A doc = new Document()%0A %0A def handle_starttag(self, tag, attrs):%0A tag = tag%0A print %22Encountered a start tag:%22, tag%0A%0A d... | |
ecde3b823724e612fd4e5cc575eb75f0d3652a4b | add script for running test | test/run-test.py | test/run-test.py | Python | 0.000001 | @@ -0,0 +1,843 @@
+import imp%0Aimport json%0Aimport os%0Amustache = imp.load_source('mustache', '../src/mustache.py')%0A%0A#test_files = %5B'comments.json',%0A #'delimiters.json',%0A #'interpolation.json',%0A #'inverted.json',%0A #'~lambdas.json',%0A #'partials.json',%0A #'sections.json'%5D%0A%0Atest... | |
0feb8f3ae65fadaf600e7681349cfa537b41a8c3 | Add ParseBigCSV.py | parseBigCSV.py | parseBigCSV.py | Python | 0.000001 | @@ -0,0 +1,221 @@
+import csv%0Aimport json%0A%0Awith open(%22evidata.csv%22, %22r%22) as bigCSV:%0A with open(%22file.json%22, %22w%22) as outFile:%0A reader = csv.DictReader(bigCSV)%0A output = json.dumps(list(reader))%0A outFile.write(output)%0A
| |
3536b98a3adf5087c78b92432585654bec40d64e | add problem 045 | problem_045.py | problem_045.py | Python | 0.000294 | @@ -0,0 +1,444 @@
+#!/usr/bin/env python%0A#-*-coding:utf-8-*-%0A%0A'''%0A'''%0A%0Aimport math%0Aimport timeit%0A%0A%0Adef is_pentagonal(n):%0A if (1+math.sqrt(1+24*n)) %25 6 == 0:%0A return True%0A else:%0A return False%0A%0A%0Adef calc():%0A i = 143%0A while True:%0A i += 1%0A ... | |
ef95e8f3c9c9f12b7073b02e95c2a464ed26c8df | hard code the value of the service url | ceph_installer/cli/constants.py | ceph_installer/cli/constants.py | Python | 0.999698 | @@ -0,0 +1,43 @@
+%0Aserver_address = 'http://localhost:8181/'%0A
| |
91bb7506bd20ed22b8787e7a8b9975cc07e97175 | Add owners client to depot_tools. | owners_client.py | owners_client.py | Python | 0.000001 | @@ -0,0 +1,1195 @@
+# Copyright (c) 2020 The Chromium Authors. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A%0A%0Aclass OwnersClient(object):%0A %22%22%22Interact with OWNERS files in a repository.%0A%0A This class allows you to inter... | |
beae2bdc47949f78e95e3444d248ce035766e719 | Add ascii table test | smipyping/_asciitable.py | smipyping/_asciitable.py | Python | 0.000007 | @@ -0,0 +1,2717 @@
+# (C) Copyright 2017 Inova Development Inc.%0A# All Rights Reserved%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/L... | |
672e4378421d2014644e23195706ef011934ffdb | test for fixes on #55 | category_encoders/tests/test_basen.py | category_encoders/tests/test_basen.py | Python | 0 | @@ -0,0 +1,431 @@
+import category_encoders as ce%0Aimport unittest%0Aimport pandas as pd%0A%0A__author__ = 'willmcginnis'%0A%0A%0Aclass TestBasen(unittest.TestCase):%0A %22%22%22%0A %22%22%22%0A%0A def test_basen(self):%0A df = pd.DataFrame(%7B'col1': %5B'a', 'b', 'c'%5D, 'col2': %5B'd', 'e', 'f'%5D%7D... | |
a4c8818225941b84e6958dcf839fc78c2adc5cee | Create test_pxssh.py | test_pxssh.py | test_pxssh.py | Python | 0.000005 | @@ -0,0 +1,684 @@
+# commandsshbotnet.py%0A# author: @shipcod3%0A# %0A# %3E%3E used for testing the pxssh module%0A%0Aimport pxssh%0Aimport getpass%0Atry:%0A s = pxssh.pxssh()%0A hostname = raw_input('SET HOST: ')%0A username = raw_input('SET USERNAME: ')%0A password = getpass.getpass('SET PASSWORD: ')%0A ... | |
1be4e6f97b3d062c4fa07f70b05305bf32593fd4 | Add test cases for smudge | dotbriefs/tests/test_smudge.py | dotbriefs/tests/test_smudge.py | Python | 0.000002 | @@ -0,0 +1,1471 @@
+import unittest%0A%0Afrom dotbriefs.smudge import SmudgeTemplate%0A%0A%0Aclass TestCleanSecret(unittest.TestCase):%0A%0A def setUp(self):%0A self.secrets = %7B%7D%0A self.secrets%5B'password'%5D = 's3cr3t'%0A self.secrets%5B'question'%5D = 'h1dd3n 4g3nd4'%0A self.templ... | |
aa2d97dfe52628e1bb7ab123890a895f7f630cda | add problem 070 | problem_070.py | problem_070.py | Python | 0.000962 | @@ -0,0 +1,1737 @@
+#!/usr/bin/env python%0A#-*-coding:utf-8-*-%0A%0A'''%0A'''%0A%0Afrom fractions import Fraction%0Aimport itertools%0Aimport math%0Aimport timeit%0A%0A%0A%0Aprimes = %5B2, 3, 5, 7%5D%0A%0A%0Adef is_prime(n):%0A for p in primes:%0A if n %25 p == 0:%0A return False%0A for i in ra... | |
16ccb2a670461e8ceb9934fd4ba8823b866c9d8e | Create plot.py | src/plot.py | src/plot.py | Python | 0.000021 | @@ -0,0 +1,721 @@
+import pandas as pd%0Afrom matplotlib import pyplot as plt%0Afrom abc import ABCMeta, abstractmethod%0A%0A%0Aclass Plot(metaclass=ABCMeta):%0A @abstractmethod%0A def show(self):%0A plt.show()%0A%0A%0Aclass CsvPlot(Plot):%0A def __init__(self, parent_path):%0A self.parent_path =... | |
254239102955bb8916aab98530251b5cdd79ce50 | Add script to write base signatures | cypher/siggen.py | cypher/siggen.py | Python | 0.000001 | @@ -0,0 +1,1261 @@
+#!/usr/bin/env python%0Aimport argparse%0Aimport subprocess%0Aimport os%0Aimport shutil%0Aimport sys%0A%0Afrom util import write_signature%0A%0Aparser = argparse.ArgumentParser()%0Aparser.add_argument(%0A %22-l%22,%0A %22--language%22,%0A help=%22Source code language.%22,%0A required=Tru... | |
19b13f0fb9b86ec99025bd1baf2c4d5fe757f809 | Add a test to make sure exception is raised | tests/test_tests.py | tests/test_tests.py | Python | 0 | @@ -0,0 +1,600 @@
+import pytest%0A%0A%0Adef test_BeautifulSoup_methods_are_overridden(%0A client_request,%0A mock_get_service_and_organisation_counts,%0A):%0A client_request.logout()%0A page = client_request.get(%22main.index%22, _test_page_title=False)%0A%0A with pytest.raises(AttributeError) as except... | |
1f4190a6d4ef002e75a8ac5ef80d326c712c749c | add test to verify the trace assignment | tests/test_trace.py | tests/test_trace.py | Python | 0 | @@ -0,0 +1,1016 @@
+from __future__ import absolute_import%0A%0Aimport pytest%0A%0Afrom tchannel import TChannel, schemes%0Afrom tchannel.errors import BadRequestError%0Afrom tchannel.event import EventHook%0A%0A%0A@pytest.mark.gen_test%0Adef test_error_trace():%0A tchannel = TChannel('test')%0A%0A class ErrorEve... | |
7fa8417cb7635e238f1e95971fa0a86a95b64dca | Migrate deleted_at fields away | aleph/migrate/versions/aa486b9e627e_hard_deletes.py | aleph/migrate/versions/aa486b9e627e_hard_deletes.py | Python | 0 | @@ -0,0 +1,1033 @@
+%22%22%22Hard delete various model types.%0A%0ARevision ID: aa486b9e627e%0ARevises: 9dcef7592cea%0ACreate Date: 2020-07-31 08:56:43.679019%0A%0A%22%22%22%0Afrom alembic import op%0Aimport sqlalchemy as sa%0A%0Arevision = %22aa486b9e627e%22%0Adown_revision = %229dcef7592cea%22%0A%0A%0Adef upgrade():%... | |
c61d3d5b4b31912c48e86425fe7e4861fc2f8c28 | test for read_be_array that fails in Python 2.x (see GH-6) | tests/test_utils.py | tests/test_utils.py | Python | 0 | @@ -0,0 +1,284 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import absolute_import%0Afrom io import BytesIO%0A%0Afrom psd_tools.utils import read_be_array%0A%0Adef test_read_be_array_from_file_like_objects():%0A fp = BytesIO(b%22%5Cx00%5Cx01%5Cx00%5Cx05%22)%0A res = read_be_array(%22H%22, 2, fp)%0A assert lis... | |
eb82e816e4dece07aeebd7b9112156dacdb2d9bc | Add set_global_setting.py, not sure how this file dissapeared | commands/set_global_setting.py | commands/set_global_setting.py | Python | 0.000002 | @@ -0,0 +1,144 @@
+from .command import CmakeCommand%0A%0A%0Aclass CmakeSetGlobalSettingCommand(CmakeCommand):%0A%0A def run(self):%0A self.server.global_settings()%0A
| |
96bea6812919067c28e0c28883226434d81f6e8d | add locusattrs class | locuspocus/locusattrs.py | locuspocus/locusattrs.py | Python | 0 | @@ -0,0 +1,1475 @@
+%0Aclass LocusAttrs():%0A # a restricted dict interface to attributes%0A def __init__(self,attrs=None):%0A self._attrs = attrs%0A%0A def __len__(self):%0A if self.empty:%0A return 0%0A else:%0A return len(self._attrs)%0A%0A def __eq__(self, othe... | |
cebb3a9cdbdee7c02b0c86e1879d0c20d36b4276 | add example | examples/example_cityfynder.py | examples/example_cityfynder.py | Python | 0.000002 | @@ -0,0 +1,659 @@
+# Which city would like to live?%0A# Created by City Fynders - University of Washington%0A%0Aimport pandas as pd%0Aimport numpy as np%0Aimport geopy as gy%0Afrom geopy.geocoders import Nominatim%0A%0Aimport data_processing as dp%0Afrom plotly_usmap import usmap%0A%0A%0A%0A# import data%0A(natural, hu... | |
9269afee9099ef172ac2ef55ea0af85b0c77587a | Add databases.py | py/database.py | py/database.py | Python | 0.000001 | @@ -0,0 +1,1583 @@
+import sqlalchemy%0Aimport sqlalchemy.orm%0Aimport uuid%0Aimport configmanager%0A%0Aclass ConnectionManager():%0A%09_connections = %7B%7D%0A%0A%09@staticmethod%0A%09def addConnection(self, connection, connectionName = uuid.uuid4().hex):%0A%09%09if type(connectionName) == str:%0A%09%09%09if type(conn... | |
5dfb7ad67216b31544c5f4dc785930ef0d9ffd56 | add faceAssigned tester | python/medic/plugins/Tester/faceAssigned.py | python/medic/plugins/Tester/faceAssigned.py | Python | 0 | @@ -0,0 +1,810 @@
+from medic.core import testerBase%0Afrom maya import OpenMaya%0A%0A%0Aclass FaceAssigned(testerBase.TesterBase):%0A Name = %22FaceAssigned%22%0A%0A def __init__(self):%0A super(FaceAssigned, self).__init__()%0A%0A def Match(self, node):%0A return node.object().hasFn(OpenMaya.MF... | |
971570b4288c9ac7131a1756e17574acbe6d1b9a | Add script for converting a solarized dark file to solarized dark high contrast | python/misc/solarized-dark-high-contrast.py | python/misc/solarized-dark-high-contrast.py | Python | 0 | @@ -0,0 +1,2126 @@
+#!/usr/bin/env python%0A%0Aimport sys%0A%0Aif sys.version_info %3C (3, 4):%0A sys.exit('ERROR: Requires Python 3.4')%0A%0Afrom enum import Enum%0A%0Adef main():%0A Cases = Enum('Cases', 'lower upper')%0A infile_case = None%0A %0A if len(sys.argv) %3C 2:%0A sys.stderr.write('ERR... | |
b72c421696b5714d256b7ac461833bc692ca5354 | Add an autonomous mode to strafe and shoot. Doesn't work | robot/robot/src/autonomous/hot_aim_shoot.py | robot/robot/src/autonomous/hot_aim_shoot.py | Python | 0.000002 | @@ -0,0 +1,3122 @@
+%0D%0Atry:%0D%0A import wpilib%0D%0Aexcept ImportError:%0D%0A from pyfrc import wpilib%0D%0A%0D%0Aimport timed_shoot%0D%0A%0D%0Aclass HotShootAutonomous(timed_shoot.TimedShootAutonomous):%0D%0A '''%0D%0A Based on the TimedShootAutonomous mode. Modified to allow%0D%0A shooting ... | |
3c046062af376603145545f37b917a5c927b3aba | Create mergesort_recursive.py | recursive_algorithms/mergesort_recursive.py | recursive_algorithms/mergesort_recursive.py | Python | 0.000004 | @@ -0,0 +1,622 @@
+def merge_sort(array):%0A temp = %5B%5D%0A if( len(array) == 1):%0A return array;%0A %0A half = len(array) / 2%0A lower = merge_sort(array%5B:half%5D)%0A upper = merge_sort(array%5Bhalf:%5D)%0A lower_len = len(lower)%0A upper_len = len(upper)%0A i = 0%0A j = 0%... | |
06b0f93ecd5fac8eda02fce96c1e4ec0306a7989 | Increase coverage | test/test_google.py | test/test_google.py | Python | 0 | @@ -0,0 +1,2173 @@
+# -*- coding: utf8 -*-%0A# This file is part of PyBossa.%0A#%0A# Copyright (C) 2013 SF Isle of Man Limited%0A#%0A# PyBossa is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as published by%0A# the Free Software Foundation, either ... | |
17e2b9ecb67c8b1f3a6f71b752bc70b21584092e | Add initial tests for scriptserver. | tests/test_scriptserver.py | tests/test_scriptserver.py | Python | 0 | @@ -0,0 +1,2156 @@
+import unittest%0Afrom mock import patch, Mock%0A%0Aimport sys%0Asys.path.append(%22.%22)%0Afrom scriptserver import ZoneScriptRunner%0A%0Aclass TestZoneScriptRunner(unittest.TestCase):%0A @classmethod%0A def setUpClass(cls):%0A cls.mongoengine_patch = patch('scriptserver.me')%0A ... | |
e5243d0fb792e82825633f1afdd6e799238a90f3 | Add portable buildtools update script (#46) | tools/buildtools/update.py | tools/buildtools/update.py | Python | 0 | @@ -0,0 +1,1345 @@
+#!/usr/bin/python%0D%0A# Copyright 2017 The Chromium Authors. All rights reserved.%0D%0A# Use of this source code is governed by a BSD-style license that can be%0D%0A# found in the LICENSE file.%0D%0A%0D%0A%22%22%22Pulls down tools required to build flutter.%22%22%22%0D%0A%0D%0Aimport os%0D%0Aimport... | |
d1f02226fe805fb80a17f1d22b84b748b65b4e7f | add sam2fq.py | sam2fq.py | sam2fq.py | Python | 0.001125 | @@ -0,0 +1,994 @@
+import sys%0Afrom collections import namedtuple%0A%0ARead = namedtuple('Read', %5B'name','qual','seq'%5D)%0A%0Aread1 = None%0Aleft = open('pe_1.fq', 'w')%0Aright = open('pe_2.fq', 'w')%0Aunpaired = open('unpaired.fq', 'w')%0Afor line in sys.stdin:%0A items = line.split('%5Ct')%0A name, qual, se... | |
dbdfb1b5a703e0392ca67a03113e607678015a66 | add kattis/settlers2 | Kattis/settlers2.py | Kattis/settlers2.py | Python | 0.001804 | @@ -0,0 +1,2176 @@
+%22%22%22%0AProblem: settlers2%0ALink: https://open.kattis.com/problems/settlers2%0ASource: NWERC 2009%0A%22%22%22%0Afrom collections import defaultdict%0Aimport math%0A%0AMAXN = 10000%0A%0AcurrentPosition = (0,0)%0AcurrentNum = 1%0Acounter = defaultdict()%0Alayers = 1%0Adirection = 0%0AdirectionCou... | |
48443f8a8f5a15b3116ba7b4a842189f5e659f26 | test script for pymatbridge | test_pymatbridge.py | test_pymatbridge.py | Python | 0 | @@ -0,0 +1,249 @@
+#!/usr/bin/python%0A%0Afrom pymatbridge import Matlab%0A%0Amlab = Matlab()%0Amlab.start()%0Aprint %22Matlab started?%22, mlab.started%0Aprint %22Matlab is connected?%22, mlab.is_connected()%0A%0Amlab.run_code(%22conteo = 1:10%22)%0Amlab.run_code(%22magica = magic(5)%22)%0A%0Amlab.stop()%0A%0A
| |
4d08d50d73e8d3d3a954c9ef8ddffc23444d7d28 | Create script.py | script.py | script.py | Python | 0.000002 | @@ -0,0 +1,817 @@
+#!/usr/bin/env python3%0A%0A# premi%C3%A8re tentative de documenter l'API de coco.fr%0A%0Aimport random%0Aimport requests%0A%0Apseudo = %22caecilius%22 # doit %C3%AAtre en minuscule et de plus de 4 caract%C3%A8res%0Aage = %2222%22 # minimum %2218%22%0Asexe = %221%22 # %221%22 pour... | |
dbacf8cd0c2bae394b6c67a810836668d510787d | test for index (re)generation | tests/test_index.py | tests/test_index.py | Python | 0 | @@ -0,0 +1,1280 @@
+from cheeseprism.utils import resource_spec%0Afrom itertools import count%0Afrom path import path%0Afrom pprint import pprint%0Aimport unittest%0A%0A%0Aclass IndexTestCase(unittest.TestCase):%0A counter = count()%0A base = %22egg:CheesePrism#tests/test-indexes%22%0A %0A def make_one(self... | |
554c6490330760690fbbd1cd5ece3da563e342eb | update queen4.py | python/queen4.py | python/queen4.py | Python | 0.000001 | @@ -0,0 +1,384 @@
+f = lambda A, x, y: y %3C 0 or (not (A%5By%5D in (A%5Bx%5D, A%5Bx%5D + (x - y), A%5Bx%5D - (x - y))))%0D%0Ag = lambda A, x, y: (not x) or (f(A, x, y) and ((y %3C 0) or g(A, x, y - 1)))%0D%0Ah = lambda A, x: sum(%5B g(A, x, x - 1) and 1 or 0 for A%5Bx%5D in range(len(A)) %5D)%0D%0Aq = lambda A, x: h(A... | |
076fcbb4876bd76887f7d64b533fec66f8366b70 | Add tests for cancellation | openprocurement/tender/esco/tests/cancellation.py | openprocurement/tender/esco/tests/cancellation.py | Python | 0 | @@ -0,0 +1,2582 @@
+# -*- coding: utf-8 -*-%0Aimport unittest%0A%0Afrom openprocurement.api.tests.base import snitch%0A%0Afrom openprocurement.tender.belowthreshold.tests.cancellation import (%0A TenderCancellationResourceTestMixin,%0A TenderCancellationDocumentResourceTestMixin%0A)%0Afrom openprocurement.tender.... | |
abe586ac1275901fc9d9cf1bde05b225a9046ab7 | add admin tests | test/test_admin.py | test/test_admin.py | Python | 0 | @@ -0,0 +1,2112 @@
+from werkzeug.exceptions import Unauthorized%0Afrom flask import url_for%0Afrom flask_login import current_user%0A%0Afrom .conftest import logged_in, assert_logged_in, assert_not_logged_in, create_user%0Afrom app.user import random_string%0Afrom app.form.login import ERROR_ACCOUNT_DISABLED%0A%0A%0AU... | |
b63e65b1a41f809caf1c2dcd689955df76add20f | Add a plot just of backscatter phase vs. diameter. | test/test_delta.py | test/test_delta.py | Python | 0 | @@ -0,0 +1,1140 @@
+import matplotlib.pyplot as plt%0Aimport numpy as np%0Aimport scattering%0Aimport scipy.constants as consts%0A%0Adef plot_csec(scatterer, d, var, name):%0A plt.plot(d / consts.centi, var,%0A label='%25.1f cm' %25 (scatterer.wavelength / consts.centi))%0A plt.xlabel('Diameter (cm)')%... | |
55768b5133d8155b16e798a335cc0f46930aab12 | create my own .py for question 5 | totaljfb/Q5.py | totaljfb/Q5.py | Python | 0.000092 | @@ -0,0 +1,1828 @@
+#-------------------------------------------------------------------------------%0A# Name: module1%0A# Purpose:%0A#%0A# Author: Jason Zhang%0A#%0A# Created: 15/11/2017%0A# Copyright: (c) Jason Zhang 2017%0A# Licence: %3Cyour licence%3E%0A#---------------------------------------... | |
3cb42b54fa8ed2cac6e05aa521a3a61a037a35ee | add rest cliant on python | rest/client.py | rest/client.py | Python | 0 | @@ -0,0 +1,376 @@
+# pip install requests%0Aimport requests%0Aresp = requests.post(%22http://127.0.0.1:8008/api/v1/addrecord/3%22, json='%7B%22id%22:%22name%22%7D')%0Aprint resp.status_code%0Aprint resp.text%0A%0Aresp = requests.get(%22http://127.0.0.1:8008/api/v1/getrecord/3%22)%0Aprint resp.status_code%0Aprint resp.j... | |
277f026f96ba94b7c7fa0ba3cde4c6e425fe4853 | Make use of the cached decorator instead of manually memoizing get_style | rinoh/style.py | rinoh/style.py | # This file is part of RinohType, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
"""
Base classes and exceptions for styled document eleme... | Python | 0.000001 | @@ -851,16 +851,41 @@
Element%0A
+from .util import cached%0A
%0A%0A__all_
@@ -6823,39 +6823,20 @@
yle%0A
- self.cached_style = %7B%7D%0A
+%0A @cached
%0A
@@ -7100,102 +7100,8 @@
ry:%0A
- return self.cached_style%5Battribute%5D%0A except KeyError:%0A try:%0A
@@ -... |
d0f6167cb7e95c17997bc42af6cd1766b1ac7864 | add related_name migration | paralapraca/migrations/0005_auto_20171204_1006.py | paralapraca/migrations/0005_auto_20171204_1006.py | Python | 0.000002 | @@ -0,0 +1,753 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('paralapraca', '0004_contract_classes'),%0A %5D%0A%0A operations = %5B%0A migrations.Alter... | |
e84d19bdc580f4d392f5b7abdc4eb8eb30919cf5 | add example: negative binomial maximum likelihood via newton's method | examples/negative_binomial_maxlike.py | examples/negative_binomial_maxlike.py | Python | 0.003656 | @@ -0,0 +1,2041 @@
+from __future__ import division, print_function%0Aimport autograd.numpy as np%0Aimport autograd.numpy.random as npr%0Afrom autograd.scipy.special import gammaln%0Afrom autograd import grad%0A%0Aimport scipy.optimize%0A%0A%0A# The code in this example implements a method for finding a stationary poin... | |
6d96e9d67e50d7806be175577968ec8fed8393d7 | Create libBase.py | test/libBase.py | test/libBase.py | Python | 0.000001 | @@ -0,0 +1,2440 @@
+# ./test/testCommon.py%0A''' There are some assumptions made by this unittest%0Athe directory structure%0A+ ./%0A%7C files -%3E lib*.py %0A+----./local/*%0A%7C %7C files -%3E *.ini%0A%7C %7C files -%3E *.json%0A%7C %7C files -%3E*.csv%0A+----./log/*%0A%7C %7C files -%3E *.... | |
4172b35bfdd1b4b12592d81b07843ca2c902a732 | solved 45 | 045/eul045.py | 045/eul045.py | Python | 0.999983 | @@ -0,0 +1,705 @@
+#! /usr/bin/python%0Afrom __future__ import print_function%0Afrom time import time%0Afrom math import sqrt%0A%0A%0A# Project Euler # 45%0A%0A# Since an integer x is triangular if and only if 8x + 1 is a square%0Adef is_triangle(x):%0A return sqrt(8 * x + 1).is_integer()%0A%0A%0Adef is_pentagonal(x... | |
b209c45fe32ee7b73bddff5419c1931a16da0bbd | Test file request.py | test/request.py | test/request.py | Python | 0.000003 | @@ -0,0 +1,271 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0A%0Aimport urllib2%0Aimport threading%0A%0A%0Adef worker():%0A urllib2.urlopen('http://localhost:8080').read()%0A%0A%0Aif __name__ == '__main__':%0A for i in xrange(1024):%0A threading.Thread(target=worker).start()%0A print 'Partiti...'%0A%... | |
be544817908ba3f9377d24a61047496c3dbf4f7a | Add test | test_rlev_model.py | test_rlev_model.py | Python | 0.000005 | @@ -0,0 +1,586 @@
+import os%0Aimport unittest%0A%0Afrom click.testing import CliRunner%0A%0Afrom rlev_model import cli%0A%0A%0Aclass TestCli(unittest.TestCase):%0A def test_cli(self):%0A runner = CliRunner()%0A sample_filename = os.path.join('data', 'sample-data.txt')%0A result = runner.invoke(... | |
da2a4fa9e618b212ddbb2fcbc079fa37970ae596 | Add handler for concurrently logging to a file | tfd/loggingutil.py | tfd/loggingutil.py | Python | 0 | @@ -0,0 +1,1865 @@
+%0A'''%0AUtilities to assist with logging in python%0A'''%0A%0Aimport logging%0A%0A%0Aclass ConcurrentFileHandler(logging.Handler):%0A %22%22%22%0A A handler class which writes logging records to a file. Every time it%0A writes a record it opens the file, writes to it, flushes the buffer, ... | |
ba599deb23c75a6dbcbc0de897afedc287c2ea94 | Create 02str_format.py | 02str_format.py | 02str_format.py | Python | 0.000019 | @@ -0,0 +1,137 @@
+age = 38%0Aname = 'Murphy Wan'%0Aprint('%7B0%7D is %7B1%7D yeaers old'.format(name, age))%0Aprint('why is %7B0%7D playing with that python?'.format(name))%0A
| |
464f011b2a87d18ea3e8d16339898987cf190a72 | Task2_1 | test_example.py | test_example.py | Python | 0.999999 | @@ -0,0 +1,820 @@
+import pytest%0Afrom selenium import webdriver%0Afrom selenium.webdriver.support.wait import WebDriverWait%0A#from selenium.webdriver.support import expected_conditions as EC%0A%0A%0A@pytest.fixture%0Adef driver(request):%0A wd = webdriver.Safari()%0A print(wd.capabilities)%0A request.addfin... | |
700db5c742be8a893b1c362ae0955a934b88c39b | Add test_learning_journal.py with test_app() for configuring the app for testing | test_journal.py | test_journal.py | Python | 0.000005 | @@ -0,0 +1,535 @@
+# -*- coding: utf-8 -*-%0Afrom contextlib import closing%0Aimport pytest%0A%0Afrom journal import app%0Afrom journal import connect_db%0Afrom journal import get_database_connection%0Afrom journal import init_db%0A%0ATEST_DSN = 'dbname=test_learning_journal'%0A%0A%0Adef clear_db():%0A with closing(... | |
59d51e90203a20f9e0b01eda43afc268311009e7 | Comment about JSON | firefox/src/py/extensionconnection.py | firefox/src/py/extensionconnection.py | # Copyright 2008-2009 WebDriver committers
# Copyright 2008-2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | Python | 0 | @@ -800,28 +800,80 @@
%0A%0A#
-FIXME: What is this?
+Some old JSON libraries don't have %22dumps%22, make sure we have a good one
%0Aif
|
1f3c1af308be68393ac8f7caab17d04cdd632d2b | Add the get_arguments function in include | survey_creation/include/get_arguments.py | survey_creation/include/get_arguments.py | Python | 0.000027 | @@ -0,0 +1,914 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Aimport sys%0Aimport getopt%0A%0A%22%22%22%0AShort script to parse%0Athe argments from the command line%0A%22%22%22%0A%0A%0Adef get_arguments(argv):%0A %22%22%22%0A %22%22%22%0A country = None%0A year = None%0A try:%0A opts, ar... | |
4276e1b991ea923a2a3bdd227bb3d98ced1fd4e2 | add alias function | thefuck/main.py | thefuck/main.py | from imp import load_source
from pathlib import Path
from os.path import expanduser
from subprocess import Popen, PIPE
import os
import sys
from psutil import Process, TimeoutExpired
import colorama
from . import logs, conf, types
def setup_user_dir():
"""Returns user config dir, create it when it doesn't exist."... | Python | 0.000005 | @@ -3324,24 +3324,98 @@
h('fuck')%0A%0A%0A
+def alias():%0A print(%22%5Cnalias fuck='eval $(thefuck $(fc -ln -1))'%5Cn%22)%0A%0A%0A
def main():%0A
|
7a3e53ec0537e7e63bfbc8caf1a30a350c2e9eea | Allow turning of the human timestamp format after it's been turned on. | shinken/log.py | shinken/log.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you c... | Python | 0 | @@ -5866,24 +5866,33 @@
_format(self
+, on=True
):%0A %22
@@ -5893,16 +5893,25 @@
%22%22%22
+%0A
Set the
@@ -5932,16 +5932,142 @@
n format
+.%0A%0A If the optional parameter %60on%60 is False, the timestamp format%0A will be reset to the default format.%0A
%22%22%22%0A ... |
d7945d85dcce968d6430e079662b1ef9fc464c97 | update ukvi org branding spelling | migrations/versions/0047_ukvi_spelling.py | migrations/versions/0047_ukvi_spelling.py | Python | 0 | @@ -0,0 +1,638 @@
+%22%22%22empty message%0A%0ARevision ID: 0047_ukvi_spelling%0ARevises: 0046_organisations_and_branding%0ACreate Date: 2016-08-22 16:06:32.981723%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '0047_ukvi_spelling'%0Adown_revision = '0046_organisations_and_branding'%0A%0Afrom... | |
be3acc4a869c9e45e4d1fdd563571da0d12ae85f | Add modify code Hello World code | HelloWorld.py | HelloWorld.py | Python | 0.000857 | @@ -0,0 +1,55 @@
+print(%22HelloWorld%22)%0A%0Atext=%22HelloWorld_Text%22%0Aprint(text)
| |
f2864289f02a6e221d6fafbb1885d20aa26417fd | Add default conftest | test/unit/conftest.py | test/unit/conftest.py | Python | 0.000001 | @@ -0,0 +1,1519 @@
+# :coding: utf-8%0A%0Aimport os%0Aimport shutil%0Aimport tempfile%0Aimport uuid%0A%0Aimport pytest%0A%0A%0A@pytest.fixture()%0Adef unique_name():%0A %22%22%22Return a unique name.%22%22%22%0A return %22unique-%7B0%7D%22.format(uuid.uuid4())%0A%0A%0A@pytest.fixture()%0Adef temporary_file(reques... | |
1dba0fb24f98bb09bd0c918439c0457c603e1386 | Create ullman.py | ullman.py | ullman.py | Python | 0.000001 | @@ -0,0 +1,847 @@
+import requests%0Afrom multiprocessing import Pool%0Aimport time%0A%0AstartURL = 'http://i.stanford.edu/~ullman/focs/ch'%0Aextension = '.pdf'%0AsavePath = '' #enter the path for the pdfs to be stored on your system%0Achapters = range(1,15) #chapters 1-14%0A%0Adef chapterStringManipulate(chapter):%0A ... | |
9d3925c4809791d2366bc1d6fd6b04bc8a710c9b | add fmt to repo | toolshed/fmt.py | toolshed/fmt.py | Python | 0 | @@ -0,0 +1,450 @@
+import re%0A%0Adef fmt2header(fmt):%0A %22%22%22%0A Turn a python format string into a usable header:%0A %3E%3E%3E fmt = %22%7Bchrom%7D%5Ct%7Bstart:d%7D%5Ct%7Bend:d%7D%5Ct%7Bpvalue:.4g%7D%22%0A %3E%3E%3E fmt2header(fmt)%0A 'chrom start end pvalue'%0A %3E%3E%3E fmt.format(chro... | |
dd9b683b24cea02c93a6e23a163065c0f26f6a68 | Test manager | tests/test.manager.py | tests/test.manager.py | Python | 0.000003 | @@ -0,0 +1,634 @@
+import opensim%0A%0Amodel_path = %22../osim/models/arm2dof6musc.osim%22%0Amodel = opensim.Model(model_path)%0Amodel.setUseVisualizer(True)%0Astate = model.initSystem()%0Amanager = opensim.Manager(model)%0AmuscleSet = model.getMuscles()%0Astepsize = 0.01%0A%0Afor i in range(10):%0A for j in range(m... | |
5d18f7c7145bf8d5e7248392d644e521222929b8 | add tests for _extras | tests/test__extras.py | tests/test__extras.py | Python | 0.000001 | @@ -0,0 +1,2077 @@
+%22%22%22Tests for %60%60_extras%60%60 module.%22%22%22%0Aimport pytest%0A%0Afrom rstcheck import _compat, _extras%0A%0A%0Aclass TestInstallChecker:%0A %22%22%22Test %60%60is_installed_with_supported_version%60%60.%22%22%22%0A%0A @staticmethod%0A @pytest.mark.skipif(_extras.SPHINX_INSTALLED... | |
eb1c7d1c2bfaa063c98612d64bbe35dedf217143 | Add initial tests for alerter class | tests/test_alerter.py | tests/test_alerter.py | Python | 0 | @@ -0,0 +1,892 @@
+import unittest%0Aimport datetime%0Aimport Alerters.alerter%0A%0A%0Aclass TestAlerter(unittest.TestCase):%0A%0A def test_groups(self):%0A config_options = %7B'groups': 'a,b,c'%7D%0A a = Alerters.alerter.Alerter(config_options)%0A self.assertEqual(%5B'a', 'b', 'c'%5D, a.groups)... | |
33658163b909073aae074b5b2cdae40a0e5c44e8 | Add unit tests for asyncio coroutines | tests/test_asyncio.py | tests/test_asyncio.py | Python | 0.000001 | @@ -0,0 +1,1969 @@
+from trollius import test_utils%0Afrom trollius import From, Return%0Aimport trollius%0Aimport unittest%0A%0Atry:%0A import asyncio%0Aexcept ImportError:%0A from trollius.test_utils import SkipTest%0A raise SkipTest('need asyncio')%0A%0A%0A# %22yield from%22 syntax cannot be used directly, ... | |
72ff3bfcbfb9e4144d43ca03c77f0692cccd0fc2 | add small interface for DHT Adafruit lib (in rpi.py) | gsensors/rpi.py | gsensors/rpi.py | Python | 0 | @@ -0,0 +1,1200 @@
+#-*- coding:utf-8 -*-%0A%22%22%22 Drivers for common sensors on a rPi%0A%22%22%22%0Aimport sys%0Aimport gevent%0A%0Afrom gsensors import AutoUpdateValue%0A%0A%0Aclass DHTTemp(AutoUpdateValue):%0A def __init__(self, pin, stype=%222302%22, name=None):%0A update_freq = 10 #seconds%0A s... | |
28d764994b8abd821b6cec4682cd8e4efa4e2f18 | Fix tvdb online test. | tests/test_thetvdb.py | tests/test_thetvdb.py | from __future__ import unicode_literals, division, absolute_import
from nose.plugins.attrib import attr
from flexget.manager import Session
from flexget.plugins.api_tvdb import lookup_episode
from tests import FlexGetBase
class TestThetvdbLookup(FlexGetBase):
__yaml__ = """
templates:
global:
... | Python | 0.000001 | @@ -1852,39 +1852,30 @@
vdb_
-genres'%5D == %5B'Comedy', 'Drama'%5D
+absolute_number'%5D == 3
%0A
|
3bc341036730ab8e9fd5ac61e10556af028813e2 | Add migration -Remove dupes -Add index preventing dupe creation | osf/migrations/0044_basefilenode_uniqueness_index.py | osf/migrations/0044_basefilenode_uniqueness_index.py | Python | 0 | @@ -0,0 +1,3385 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0Aimport logging%0A%0Afrom django.db import connection%0Afrom django.db import migrations%0A%0Alogger = logging.getLogger(__name__)%0A%0Adef remove_duplicate_filenodes(*args):%0A from osf.models.files import BaseFileNode%0A sql ... | |
e322daa6d92a9dad8db9b8c9b6085aded90bef39 | add beta release script | scripts/release_beta.py | scripts/release_beta.py | Python | 0 | @@ -0,0 +1,1266 @@
+%0Aimport argparse%0Aimport subprocess%0A%0A%0Aparser = argparse.ArgumentParser(description='Release Mixpanel Objective-C SDK')%0Aparser.add_argument('--old', help='old version number', action=%22store%22)%0Aparser.add_argument('--new', help='new version number for the release', action=%22store%22)%... | |
c783c26c6362cdd0702211552578a09f380e9dac | Add tags module. | src/pu/tags.py | src/pu/tags.py | Python | 0 | @@ -0,0 +1,1123 @@
+#%0A# Copyright (c) 2013 Joshua Hughes %3Ckivhift@gmail.com%3E%0A#%0Aimport sys%0A%0Aclass Tag(object):%0A _name = ''%0A def __init__(self, *a, **kw):%0A super(Tag, self).__init__()%0A self.content = list(a)%0A self.attributes = kw%0A%0A def __str__(self):%0A nam... | |
9c6130b5f9337b428f530cfae7036b7be2a9eea4 | test commit | etk2/DefaultDocumentSelector.py | etk2/DefaultDocumentSelector.py | Python | 0.000001 | @@ -0,0 +1,3356 @@
+import json%0Aimport jsonpath_rw%0Aimport re%0Afrom document import Document%0A%0A%0Aclass DefaultDocumentSelector(DocumentSelector):%0A%0A def __init__(self):%0A pass%0A %22%22%22%0A A concrete implementation of DocumentSelector that supports commonly used methods for%0A selectin... | |
e5f77ccc2f51fdcaa32c55b56f6b801b3ae2e0e2 | Add triggered oscilloscope example | example/pyaudio_triggerscope.py | example/pyaudio_triggerscope.py | Python | 0.000001 | @@ -0,0 +1,1843 @@
+%22%22%22%0ASimple demonstration of streaming data from a PyAudio device to a QOscilloscope%0Aviewer.%0A%0ABoth device and viewer nodes are created locally without a manager.%0A%22%22%22%0A%0Afrom pyacq.devices.audio_pyaudio import PyAudio%0Afrom pyacq.viewers import QTriggeredOscilloscope%0Aimport ... | |
5c5c2e9ae69b6543830975239068d34620205119 | add context logger | logging/logger_reload_with_context.py | logging/logger_reload_with_context.py | Python | 0.000007 | @@ -0,0 +1,1089 @@
+import logging%0Aimport traceback%0Afrom yaml_config import yaml_config%0A%0Ayaml_config('yaml.conf')%0A%0A%0Aclass ContextLogger(object):%0A def __init__(self, name):%0A self.logger = logging.getLogger(name)%0A%0A def _context(self):%0A stack = traceback.extract_stack()%0A ... | |
bc7f1363a7da1375b62f70caf441423af2718641 | Create example.py | BMP085/example.py | BMP085/example.py | Python | 0.000001 | @@ -0,0 +1,432 @@
+# Continuously polls the BMP180 Pressure Sensor%0Aimport pyb%0Aimport BMP085 %0A%0A# creating objects%0Ablue = pyb.LED(4)%0Abmp180 = BMP085.BMP085(port=2,address=0x77,mode=3,debug=False)%0Awhile 1:%0A blue.toggle()%0A temperature = bmp180.readTemperature()%0A print(%22%25f celcius%22 %25 temperatu... | |
153d36cd0c9eb4229156ac944c2ba64f2f9e72d6 | fix test | msmbuilder/tests/test_featurizer.py | msmbuilder/tests/test_featurizer.py | import numpy as np
from mdtraj import compute_dihedrals, compute_phi
from mdtraj.testing import eq
from msmbuilder.example_datasets import fetch_alanine_dipeptide
from msmbuilder.featurizer import get_atompair_indices, FunctionFeaturizer, \
DihedralFeaturizer, AtomPairsFeaturizer, SuperposeFeaturizer, \
RMSDFe... | Python | 0.000002 | @@ -2256,32 +2256,72 @@
m(trajectories)%0A
+ n_frames = trajectories%5B0%5D.n_frames%0A
assert X_all
@@ -2334,20 +2334,24 @@
ape == (
-9999
+n_frames
, 36), (
@@ -2593,12 +2593,16 @@
== (
-9999
+n_frames
, 20
|
6c08209ee26210df07b9d80da45d815b595205ae | test for new Wigner function | test_wigner.py | test_wigner.py | Python | 0.000001 | @@ -0,0 +1,516 @@
+from qutip import *%0Afrom mpl_toolkits.mplot3d import Axes3D%0Afrom matplotlib import cm%0Afrom pylab import *%0AN = 20;%0Apsi=(coherent(N,-2-2j)+coherent(N,2+2j)).unit()%0A#psi = ket2dm(basis(N,0))%0Axvec = linspace(-5.,5.,200)%0Ayvec = xvec%0AX,Y = meshgrid(xvec, yvec)%0AW = wigner(psi,xvec,xvec);... | |
1ffdfc3c7ae11c583b2ea4d45b50136996bcf3e3 | Add mock HTTP server to respond to requests from web UI | tests/mocks.py | tests/mocks.py | Python | 0 | @@ -0,0 +1,2149 @@
+from http.server import BaseHTTPRequestHandler, HTTPServer%0Aimport json%0Aimport socket%0Afrom threading import Thread%0A%0Aimport requests%0A%0A# https://realpython.com/blog/python/testing-third-party-apis-with-mock-servers/%0A%0Aclass MockHTTPServerRequestHandler(BaseHTTPRequestHandler):%0A%0A ... | |
481b822125de1d29de09975a6607c4fa038b98df | Add model List | todo/models.py | todo/models.py | Python | 0.000001 | @@ -0,0 +1,370 @@
+from django.db import models%0Afrom django.utils.text import slugify%0A%0Afrom common.models import TimeStampedModel%0A%0A%0Aclass List(TimeStampedModel):%0A name = models.CharField(max_length=50)%0A slug = models.CharField(max_length=50, editable=False)%0A%0A def save(self, *args, **kwargs)... | |
744d7971926bf7672ce01388b8617be1ee35df0e | Add missing test data folder | xunit-autolabeler-v2/ast_parser/core/test_data/parser/exclude_tags/exclude_tags_main.py | xunit-autolabeler-v2/ast_parser/core/test_data/parser/exclude_tags/exclude_tags_main.py | Python | 0.000001 | @@ -0,0 +1,729 @@
+# Copyright 2020 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... | |
156c0b09930bd7700cb7348197a9e167831dca6d | ADD initial syft.lib.util tests | packages/syft/tests/syft/lib/util_test.py | packages/syft/tests/syft/lib/util_test.py | Python | 0 | @@ -0,0 +1,593 @@
+#absolute%0Afrom syft.lib.util import full_name_with_name%0Afrom syft.lib.util import full_name_with_qualname%0A%0Aclass TSTClass:%0A pass%0A%0Aclass FromClass:%0A%0A @staticmethod%0A def static_method():%0A pass%0A %0A def not_static_method(self):%0A pass%0A%0Aclass ToCl... | |
2eb849578b7306762f1e9dc4962a9db2ad651fc9 | add solution for Linked List Cycle II | src/linkedListCycleII.py | src/linkedListCycleII.py | Python | 0 | @@ -0,0 +1,642 @@
+# Definition for singly-linked list.%0A# class ListNode:%0A# def __init__(self, x):%0A# self.val = x%0A# self.next = None%0A%0A%0Aclass Solution:%0A # @param head, a ListNode%0A # @return a list node%0A%0A def detectCycle(self, head):%0A slow = fast = head%0A ... | |
855f9afa6e8d7afba020dc5c1dc8fabfc84ba2d4 | add new package : jafka (#14304) | var/spack/repos/builtin/packages/jafka/package.py | var/spack/repos/builtin/packages/jafka/package.py | Python | 0 | @@ -0,0 +1,1340 @@
+# 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 Jafka(Package):%0A %22%22%22%0A Jafka is a distribut... | |
665a373f12f030d55a5d004cbce51e9a86428a55 | Add the main rohrpost handler | rohrpost/main.py | rohrpost/main.py | Python | 0.00017 | @@ -0,0 +1,1274 @@
+import json%0Afrom functools import partial%0A%0Afrom . import handlers # noqa%0Afrom .message import send_error%0Afrom .registry import HANDLERS%0A%0A%0AREQUIRED_FIELDS = %5B'type', 'id'%5D%0A%0A%0Adef handle_rohrpost_message(message):%0A %22%22%22%0A Handling of a rohrpost message will vali... | |
8084a3be60e35e5737047f5b2d2daf8dce0cec1a | Update sliding-window-maximum.py | Python/sliding-window-maximum.py | Python/sliding-window-maximum.py | # Time: O(n)
# Space: O(k)
# Given an array nums, there is a sliding window of size k
# which is moving from the very left of the array to the
# very right. You can only see the k numbers in the window.
# Each time the sliding window moves right by one position.
#
# For example,
# Given nums = [1,3,-1,-3,5,3,6,7], an... | Python | 0.000001 | @@ -1248,17 +1248,17 @@
d dq%5B0%5D
-%3C
+=
= i - k:
|
f8bd2205e57e7a3b457e20b678d69065b620c965 | Create __init__.py | votesim/__init__.py | votesim/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
24baf3e5e7a608d0b34d74be25f96f1b74b7622e | Add feed update task for social app | web/social/tasks.py | web/social/tasks.py | Python | 0.000014 | @@ -0,0 +1,393 @@
+from celery.task import PeriodicTask%0Afrom datetime import timedelta%0A%0Afrom social.utils import FeedUpdater, UpdateError%0A%0Aclass UpdateFeedsTask(PeriodicTask):%0A run_every = timedelta(minutes=15)%0A%0A def run(self, **kwargs):%0A logger = self.get_logger()%0A updater = Fee... | |
115145da5063c47009e93f19aa5645e0dbb2580f | add missing migration for tests | tests/migrations/0002_auto_20210712_1629.py | tests/migrations/0002_auto_20210712_1629.py | Python | 0.000001 | @@ -0,0 +1,1951 @@
+# Generated by Django 2.2.24 on 2021-07-12 21:29%0A%0Aimport django.contrib.gis.db.models.fields%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('tests', '0001_initial'),%0A %5D%0A%0A operations = %5B%0A mi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.