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 |
|---|---|---|---|---|---|---|---|
d26069ddbb35a10f4a368c855d94d1dde1872a82 | Add better solution for etl | etl/etl.better.py | etl/etl.better.py | Python | 0.000178 | @@ -0,0 +1,287 @@
+def transform(d):%0A '''Just reverse the dictionary'''%0A return %7Bl.lower(): p for p, letters in d.items() for l in letters%7D%0A%0Adef transform(strs):%0A result = %7B%7D%0A for k,v in strs.items():%0A for i in v:%0A result.update(%7Bi.lower():k%7D)%0A return dict(... | |
54b94346d2669347cf2a9a2b24df6b657cf80c5b | Mask computation utilities (from nipy). | nisl/mask.py | nisl/mask.py | Python | 0 | @@ -0,0 +1,2941 @@
+import numpy as np%0Afrom scipy import ndimage%0A%0A%0A###############################################################################%0A# Operating on connect component%0A###############################################################################%0A%0A%0Adef largest_cc(mask):%0A %22%22%22 Re... | |
8e6c1a296be39c5cd1e75d5ff9974f80449690e3 | Add VVT tool class | benchexec/tools/vvt.py | benchexec/tools/vvt.py | Python | 0 | @@ -0,0 +1,1594 @@
+%22%22%22%0ABenchExec is a framework for reliable benchmarking.%0AThis file is part of BenchExec.%0A%0ACopyright (C) 2007-2015 Dirk Beyer%0AAll rights reserved.%0A%0ALicensed under the Apache License, Version 2.0 (the %22License%22);%0Ayou may not use this file except in compliance with the License... | |
f333b9c5741a7ffbf49caa0a6130831a834b944f | Add unit tests for recent bugfix and move operation | test_dotfiles.py | test_dotfiles.py | Python | 0 | @@ -0,0 +1,2452 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Aimport os%0Aimport shutil%0Aimport tempfile%0Aimport unittest%0A%0Afrom dotfiles import core%0A%0A%0Adef touch(fname, times=None):%0A with file(fname, 'a'):%0A os.utime(fname, times)%0A%0A%0Aclass DotfilesTestCase(unittest.TestCase):%0A%... | |
2b0e13039dad8d116a5719540004bed317bb6960 | Add tests and fixtures for the Organizations API wrapper | tests/api/test_organizations.py | tests/api/test_organizations.py | Python | 0 | @@ -0,0 +1,1103 @@
+# -*- coding: utf-8 -*-%0A%0A%22%22%22pytest Licenses functions, fixtures and tests.%22%22%22%0A%0A%0Aimport pytest%0A%0Aimport ciscosparkapi%0A%0A%0A# Helper Functions%0A%0Adef list_organizations(api, max=None):%0A return list(api.organizations.list(max=max))%0A%0A%0Adef get_organization_by_id(a... | |
feea11952ceab35523052a93a8ca6ff822d1357c | add 141 | vol3/141.py | vol3/141.py | Python | 0.999994 | @@ -0,0 +1,664 @@
+import math%0A%0Adef gcd(a, b):%0A if a %25 b == 0:%0A return b%0A return gcd(b, a %25 b)%0A%0Adef is_square(n):%0A sqrt_n = int(math.sqrt(n))%0A return n == sqrt_n * sqrt_n%0A%0Aif __name__ == %22__main__%22:%0A L = 10 ** 12%0A s = set()%0A for a in xrange(2, 10000):%0A ... | |
284c29d257b7c6902b5973ca05278ee5b05571e9 | test subclassing! | tests/delivery/test_frontend.py | tests/delivery/test_frontend.py | Python | 0 | @@ -0,0 +1,533 @@
+from wizard_builder.tests import test_frontend as wizard_builder_tests%0A%0A%0Aclass EncryptedFrontendTest(wizard_builder_tests.FrontendTest):%0A secret_key = 'soooooo seekrit'%0A%0A def setUp(self):%0A super().setUp()%0A self.browser.find_element_by_css_selector(%0A '%... | |
bd9f509bbd97f3a28eb24740dc08bc153cf82613 | add voronoi cell class | order/avc.py | order/avc.py | Python | 0.000031 | @@ -0,0 +1,1428 @@
+###############################################################################%0A# -*- coding: utf-8 -*-%0A# Order: A tool to characterize the local structure of liquid water %0A# by geometric order parameters%0A# %0A# Authors: Pu Du%0A# %0A# Released under the MIT License%0A################... | |
6e199bec3816a4a36d891e72f8de9819848bda65 | Define ResourceDuplicatedDefinedError. | electro/errors.py | electro/errors.py | Python | 0 | @@ -0,0 +1,83 @@
+# -*- coding: utf-8 -*-%0A%0Aclass ResourceDuplicatedDefinedError(Exception):%0A pass%0A
| |
f527eeb4792ea5630965d72ae73b0331fd465dea | add indicator migration | indicators/migrations/0002_auto_20170105_0205.py | indicators/migrations/0002_auto_20170105_0205.py | Python | 0 | @@ -0,0 +1,1273 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.4 on 2017-01-05 10:05%0Afrom __future__ import unicode_literals%0A%0Afrom decimal import Decimal%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('indicators', '0001_in... | |
103de382d7c9c0dde7aa4bc2f4756dc71ee45335 | define pytest fixture for path to PR2 database | test/conftest.py | test/conftest.py | Python | 0 | @@ -0,0 +1,265 @@
+# content of conftest.py%0Aimport pytest%0A%0Adef pytest_addoption(parser):%0A parser.addoption(%22--uchime-ref-db-fp%22, action=%22store%22, help=%22path to PR2 database%22)%0A%0A@pytest.fixture%0Adef uchime_ref_db_fp(request):%0A return request.config.getoption(%22--uchime-ref-db-fp%22)%0A
| |
d15564cf234def0f37c958915e0d7a99cad439e4 | add a test for overflow | tests/test_jnitable_overflow.py | tests/test_jnitable_overflow.py | Python | 0.000001 | @@ -0,0 +1,219 @@
+# run it, and check with Java VisualVM if we are eating too much memory or not!%0Afrom jnius import autoclass%0A%0AStack = autoclass('java.util.Stack')%0Ai = 0%0Awhile True:%0A i += 1%0A stack = Stack()%0A stack.push('hello')%0A
| |
5d3918c885f430e79e8283533ad5eb3a84ffecc7 | Add migration code for updating lease status | blazar/db/migration/alembic_migrations/versions/75a74e4539cb_update_lease_status.py | blazar/db/migration/alembic_migrations/versions/75a74e4539cb_update_lease_status.py | Python | 0.000006 | @@ -0,0 +1,1248 @@
+# Copyright 2018 OpenStack Foundation.%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 req... | |
2248590ed1bcf33b17f46e4c61747f5a7cb5e92d | remove mutable argument: when a mutable value as list or dictionary is in a default value for an argument. Default argument values are evaluated only once at function definition time, which means that modifying the default value of the argument will affect all subsequent calls of the function. | src/collectors/tcp/test/testtcp.py | src/collectors/tcp/test/testtcp.py | #!/usr/bin/python
################################################################################
from test import *
from diamond.collector import Collector
from tcp import TCPCollector
################################################################################
class TestTCPCollector(CollectorTestCase):
d... | Python | 0 | @@ -327,16 +327,79 @@
Up(self,
+ allowed_names=None):%0A if not allowed_names:%0A
allowed
@@ -409,18 +409,16 @@
mes = %5B%5D
-):
%0A
|
308e34b686686d3c42466012c864d7cc5d0f6799 | Create go_fixup_fptrs.py | scripts/go/go_fixup_fptrs.py | scripts/go/go_fixup_fptrs.py | Python | 0.000001 | @@ -0,0 +1,1873 @@
+%22%22%22%0Awhen IDA's auto-discovery of functions in 64-bit Windows Go executables fails,%0Ascan for global (.rdata) pointers into the code section (.text) and assume these are function pointers.%0A%22%22%22%0Aimport idc%0Aimport ida_name%0Aimport ida_auto%0Aimport ida_bytes%0Aimport idautils%0A%0A... | |
08fcba713315b4ac29ed30f437b7c5c0b1da5a9d | Create make_upper_case.py | make_upper_case.py | make_upper_case.py | Python | 0.000391 | @@ -0,0 +1,230 @@
+def sillycase(string):%0A half = round(len(string)/2) // Find the half index%0A return string%5B:half%5D.lower() + string%5Bhalf:%5D.upper() // If you only want certain letters to be upper case //%0A
| |
9e986214aaf6beef5b1778254cc348006a828c04 | Create MaximalSquare_001.py | leetcode/221-Maximal-Square/MaximalSquare_001.py | leetcode/221-Maximal-Square/MaximalSquare_001.py | Python | 0.000018 | @@ -0,0 +1,1247 @@
+# brute force, optimized later%0Aclass Solution(object):%0A def maximalSquare(self, matrix):%0A %22%22%22%0A :type matrix: List%5BList%5Bstr%5D%5D%0A :rtype: int%0A %22%22%22%0A if len(matrix) == 0 or len(matrix%5B0%5D) == 0:%0A return 0%0A ... | |
6b6c5b836b282c53fc5a337942d187769d0a87ed | Add cli module. | fapistrano/cli.py | fapistrano/cli.py | Python | 0 | @@ -0,0 +1,1501 @@
+# -*- coding: utf-8 -*-%0A%0Aimport click%0Aimport yaml%0Afrom fabric.api import env as fabenv, local, execute%0Afrom fapistrano.app import init_cli%0Afrom fapistrano.utils import with_configs, register_role, register_env, _apply_env_role_config%0Afrom fapistrano import deploy%0A%0A@click.group()%0A... | |
9341d2192da8cbaea734641aec9567a1035aa1ee | Add suffix list | scripts/update-suffixlist.py | scripts/update-suffixlist.py | Python | 0.000004 | @@ -0,0 +1,1704 @@
+#!/usr/bin/env python%0Aimport os%0Aimport urllib2 as urllib%0Aimport anyjson as json%0A%0A%0AURL_LIST = %22http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/src/effective_tld_names.dat?raw=1%22%0A%0A# generate json%0Aprint 'downloading suffix list..'%0Arules = %7B%7D%0Alst = urllib.urlopen(... | |
a1d95beccd0f0f332005cd133bdd660fbe649467 | Add a benchmarking script. | benchmarking/perf_cmp.py | benchmarking/perf_cmp.py | Python | 0 | @@ -0,0 +1,1189 @@
+#!/usr/bin/env python%0A%0A%22%22%22%0ATODO: Change the module doc.%0A%22%22%22%0A%0Afrom __future__ import division%0A%0A__author__ = %22shyuepingong%22%0A__version__ = %220.1%22%0A__maintainer__ = %22Shyue Ping Ong%22%0A__email__ = %22shyuep@gmail.com%22%0A__status__ = %22Beta%22%0A__date__ = %221... | |
8de30c6d4b5784af406d75e04feeb7c6431243d6 | add fermi setup | astroquery/fermi/setup_package.py | astroquery/fermi/setup_package.py | Python | 0 | @@ -0,0 +1,220 @@
+# Licensed under a 3-clause BSD style license - see LICENSE.rst%0Aimport os%0A%0A%0Adef get_package_data():%0A paths_test = %5Bos.path.join('data', '*.html')%5D%0A%0A return %7B%0A 'astroquery.fermi.tests': paths_test,%0A %7D%0A
| |
59a05f592ffc4423023f1803efcf427896ab5d41 | Add lc0695_max_area_of_island.py | lc0695_max_area_of_island.py | lc0695_max_area_of_island.py | Python | 0.000004 | @@ -0,0 +1,1147 @@
+%22%22%22Leetcode 695. Max Area of Island%0AMedium%0A%0AURL: https://leetcode.com/problems/max-area-of-island/%0A%0AGiven a non-empty 2D array grid of 0's and 1's, an island is a group of 1's%0A(representing land) connected 4-directionally (horizontal or vertical.)%0AYou may assume all four edges of... | |
b8b191a380ef4ab0701793c2e0ac664b05c4c505 | Add simple word2vec to train model | analysis/word2vec.py | analysis/word2vec.py | Python | 0.000011 | @@ -0,0 +1,2326 @@
+import numpy as np%0Aimport re%0Afrom nltk.corpus import stopwords%0Aimport nltk%0Aimport logging%0Afrom gensim.models import word2vec%0A%0A%0Adef get_dataset():%0A files = %5B'./analysis/input/negative_tweets.txt', './analysis/input/neutral_tweets.txt', './analysis/input/positive_tweets.txt'%5D%... | |
07631b96d87013a22008e4a6ad94e751f5e0165b | Fix get_setting view | ckeditor_filebrowser_filer/views.py | ckeditor_filebrowser_filer/views.py | # -*- coding: utf-8 -*-
import json
from distutils.version import LooseVersion
from django import http
from django.conf import settings
from django.core import urlresolvers
from django.http import HttpResponseRedirect
from filer.models import File
from filer.server.views import server
try:
from filer.models impo... | Python | 0.000001 | @@ -966,16 +966,29 @@
upper()%0A
+ try:%0A
retu
@@ -1048,16 +1048,107 @@
alse)))%0A
+ except ValueError:%0A return http.HttpResponse(getattr(settings, setting, False))%0A
%0A%0Adef ur
|
a0333aa80dd6a6baeb24e32deeecd0288419328e | Initialize P3_seatingCards | books/AutomateTheBoringStuffWithPython/Chapter17/PracticeProjects/P3_seatingCards.py | books/AutomateTheBoringStuffWithPython/Chapter17/PracticeProjects/P3_seatingCards.py | Python | 0.000002 | @@ -0,0 +1,669 @@
+# Chapter%C2%A013 included a practice project to create custom invitations from a list of%0A# guests in a plaintext file. As an additional project, use the pillow module to%0A# create images for custom seating cards for your guests. For each of the guests listed%0A# in the guests.txt, generate an ima... | |
1e45df8375c4e72257defc82137fa570fbb44249 | add StringOperation to repository | StringOperation.py | StringOperation.py | Python | 0 | @@ -0,0 +1,1318 @@
+#encoding = utf-8%0A__author__ = 'lg'%0A%0Alist1 = %5B'java','python','ruby','perl','mac'%5D%0Alist2 = %5B'linux','mac','windows','ruby'%5D%0A%0A#%E4%B8%A4%E4%B8%AAlist%E7%9A%84%E4%BA%A4%E9%9B%86(%E6%B3%95%E4%B8%80) %E6%97%B6%E9%97%B4%E5%A4%8D%E6%9D%82%E5%BA%A6%E4%B8%BAO(n%5E2)%0Adef intersect(a,b):... | |
59d55a5911e99a0886b8c3cc48ee92f247e96e0a | add Voronoi | Voronoi/Voronoi.py | Voronoi/Voronoi.py | Python | 0 | @@ -0,0 +1,867 @@
+import numpy as np%0Aimport matplotlib.pyplot as plt%0Afrom scipy.spatial import Voronoi, voronoi_plot_2d%0A%0Aimport csv%0A%0ACOUNT_LIMIT = None%0ASAMPLE_LIMIT = 100%0A%0APoints = %5B%5D%0Awith open('cell_info.csv', 'r', encoding='utf_8') as obj_file:%0A csv_file = csv.reader(obj_file)%0A for ... | |
de0265b609ab56035544018e368a108b573ae503 | define the index of filters to prune by examining the classification activations | tools/prune_with_classification_guidance.py | tools/prune_with_classification_guidance.py | Python | 0 | @@ -0,0 +1,2476 @@
+import os.path%0Aimport numpy as np%0A%0A# define th CLASSES and indices%0ACLASSES = ('__background__',%0A 'aeroplane', 'bicycle', 'bird', 'boat',%0A 'bottle', 'bus', 'car', 'cat', 'chair',%0A 'cow', 'diningtable', 'dog', 'horse',%0A 'motorbike', 'person', 'po... | |
5068c02e50c54c08a6991e45584c6c9b9bdd5dba | add import script for Midlothian | polling_stations/apps/data_collection/management/commands/import_midlothian.py | polling_stations/apps/data_collection/management/commands/import_midlothian.py | Python | 0 | @@ -0,0 +1,852 @@
+from data_collection.management.commands import BaseScotlandSpatialHubImporter%0A%0Aclass Command(BaseScotlandSpatialHubImporter):%0A council_id = 'S12000019'%0A council_name = 'Midlothian'%0A elections = %5B'local.midlothian.2017-05-04'%5D%0A%0A def district_record_to_dict(self, record):... | |
db846aaa0f35e8888b0b3423539c0a70c9ae16fa | Add Source Files | source/GoogleSpreadsheets.py | source/GoogleSpreadsheets.py | Python | 0.000001 | @@ -0,0 +1,2208 @@
+%EF%BB%BF# -*- coding: utf-8 -*-%0Aimport sys%0Aimport requests%0Aimport easygui%0A%0A%0A%0Adef enum(*sequential, **named):%0A enums = dict(zip(sequential, range(len(sequential))), **named)%0A return type('Enum', (), enums)%0A%0A%0AMode = enum('PREVIEW', 'EDIT', 'REFRESH')%0Amode = 0%0Asize = ... | |
107f86c8c20c4d7cc4c81db464ac20607bb31ba9 | add DBusTube constants to constants.py | tests/twisted/constants.py | tests/twisted/constants.py | """
Some handy constants for other tests to share and enjoy.
"""
HT_CONTACT = 1
CHANNEL = "org.freedesktop.Telepathy.Channel"
CHANNEL_IFACE_GROUP = CHANNEL + ".Interface.Group"
CHANNEL_TYPE_TUBES = CHANNEL + ".Type.Tubes"
CHANNEL_IFACE_TUBE = CHANNEL + ".Interface.Tube.DRAFT"
CHANNEL_TYPE_STREAM_TUBE = CHANNEL + ".Ty... | Python | 0 | @@ -333,16 +333,74 @@
e.DRAFT%22
+%0ACHANNEL_TYPE_DBUS_TUBE = CHANNEL + %22.Type.DBusTube.DRAFT%22
%0A%0ACHANNE
@@ -1117,16 +1117,81 @@
Service'
+%0ADBUS_TUBE_SERVICE_NAME = CHANNEL_TYPE_DBUS_TUBE + '.ServiceName'
%0A%0ATUBE_C
|
b9b246e1feb728a257b343d4a07fc42ba10bac13 | Add a wsgi app to our test tg2 app | moksha/tests/quickstarts/tg2app/tg2app/wsgi.py | moksha/tests/quickstarts/tg2app/tg2app/wsgi.py | Python | 0 | @@ -0,0 +1,163 @@
+import os%0Afrom paste.deploy import loadapp%0Acfg_path = os.path.join(os.path.dirname(__file__), '..', 'development.ini')%0Aapplication = loadapp('config:' + cfg_path)%0A
| |
550ce185895a7b32f6bdb0750338ea6d2416ee2a | Add merged migration | organization/projects/migrations/0006_merge.py | organization/projects/migrations/0006_merge.py | Python | 0.000001 | @@ -0,0 +1,365 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.7 on 2016-09-07 14:02%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('organization-projects', '0005_auto_20160907_1046'),%0A ... | |
f6148d7a4e2d080da93d21de2f13b601465c7528 | Add tf.contrib.checkpoint.CheckpointableBase for isinstance checks. | tensorflow/contrib/checkpoint/__init__.py | tensorflow/contrib/checkpoint/__init__.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Python | 0 | @@ -890,16 +890,37 @@
intable%0A
+@@CheckpointableBase%0A
@@Checkp
@@ -1573,16 +1573,94 @@
intable%0A
+from tensorflow.python.training.checkpointable.base import CheckpointableBase%0A
from ten
@@ -2211,9 +2211,8 @@
name__)%0A
-%0A
|
7ef03c975566b92fd97b7071b39cf3d8c242e480 | Create brick.py | brick.py | brick.py | Python | 0.000004 | @@ -0,0 +1,2385 @@
+# Class: Brick%0A# Represents a single brick as displayed on screen.%0A# Used as a target for the Ball to break%0A%0A# Requires pygame%0Aimport pygame%0A%0Aclass Brick(pygame.sprite.Sprite):%0A __borderWidth = 2%0A __hitsRemaining = 1%0A __position = %7B%22x%22: 0, %22y%22: 0%7D%0A __siz... | |
c1d3a8d15d3e50a14ff765e7abd063cc1b390063 | add new test case TestAssociator | tests/unit/EventReader/test_Associator.py | tests/unit/EventReader/test_Associator.py | Python | 0.000001 | @@ -0,0 +1,1239 @@
+from AlphaTwirl.EventReader import Associator%0Aimport unittest%0A%0A##____________________________________________________________________________%7C%7C%0Aclass MockReader(object):%0A def __init__(self):%0A self.content = %5B %5D%0A%0A##____________________________________________________... | |
6a4152e805be0ba061529841fb84442d8a23ff9f | add label transform cpn | python/federatedml/components/label_transform.py | python/federatedml/components/label_transform.py | Python | 0 | @@ -0,0 +1,1081 @@
+#%0A# Copyright 2019 The FATE Authors. All Rights Reserved.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LIC... | |
99ab22cf5fcba719dd7d9d87c18c8d93de5591a4 | Add IO Class | whitepy/ws_io.py | whitepy/ws_io.py | Python | 0 | @@ -0,0 +1,625 @@
+import readchar%0Aimport sys%0A%0A%0Aclass IO(object):%0A def __init__(self, stack):%0A self.stack = stack%0A%0A def i_chr(self, heap):%0A self.stack.push(readchar.readchar())%0A heap.set()%0A%0A def i_int(self, heap):%0A num = None%0A while type(num) is no... | |
6279341682ae45a228302972dbd106a2e44e0b12 | Add example usage of the JsonTestResponse. | examples/example_test.py | examples/example_test.py | Python | 0 | @@ -0,0 +1,921 @@
+import unittest%0Afrom flask import Flask%0Afrom flask_json import json_response, FlaskJSON, JsonTestResponse%0A%0A%0Adef our_app():%0A app = Flask(__name__)%0A app.test_value = 0%0A FlaskJSON(app)%0A%0A @app.route('/increment')%0A def increment():%0A app.test_value += 1%0A ... | |
1fd997bc11b62cb760470fb749c2a4f0261b3e00 | Add db2es.py to sync data | db2es.py | db2es.py | Python | 0.000001 | @@ -0,0 +1,2573 @@
+#!/usr/bin/env python%0A# -*- coding: UTF-8 -*-%0A#%0A%0Afrom __future__ import unicode_literals, absolute_import%0A%0Aimport time%0A%0Afrom elasticsearch.helpers import scan%0Afrom elasticsearch.exceptions import NotFoundError%0A%0Afrom oclubs.app import app%0Afrom oclubs.access import database, el... | |
43e019ff26e04a6464cad3a10045ba600e98610e | Add __init__.py for monitorlib module. | monitorlib/__init__.py | monitorlib/__init__.py | Python | 0 | @@ -0,0 +1,161 @@
+### -*- coding: utf-8 -*-%0A###%0A### %C2%A9 2012 Krux Digital, Inc.%0A### Author: Paul Lathrop %3Cpaul@krux.com%3E%0A###%0A%0A%22%22%22Library for creating monitoring scripts/plugins.%22%22%22%0A
| |
2427dbad4fc0cfe7685dc2767069748d37262796 | Add initial version of identification algorithm | movienamer/identify.py | movienamer/identify.py | Python | 0.000001 | @@ -0,0 +1,2701 @@
+import os.path as path%0Aimport re%0A%0Aimport Levenshtein%0A%0Afrom .sanitize import sanitize%0Afrom .tmdb import search%0A%0A%0Adef _gather(filename, directory=None, titles=%7B%7D):%0A # Sanitize the input filename%0A name, year = sanitize(filename)%0A%0A # Start with a basic search%0A ... | |
2ac52ea39a7a8db6cab756e3af2f65b228bb1c09 | Add registration test | test/requests/test-registration.py | test/requests/test-registration.py | Python | 0 | @@ -0,0 +1,1926 @@
+import sys%0Aimport unittest%0Aimport requests%0Aimport logging%0Afrom elasticsearch import Elasticsearch, TransportError%0A#from utility.tools import ELASTICSEARCH_HOST, ELASTICSEARCH_PORT%0A%0AGN2_SERVER = None%0AES_SERVER = None%0A%0Aclass TestRegistration(unittest.TestCase):%0A %0A%0A def ... | |
ee3e0d444dd706858a3a30cf52ebc2a960bcfb56 | add a just for funsies pygame renderer | renderer-pygame.py | renderer-pygame.py | Python | 0 | @@ -0,0 +1,1755 @@
+import pygame%0A%0Aclass Palette():%0A def __init__(self, ppu):%0A self.ppu = ppu%0A self.colors = %5B(0x7C,0x7C,0x7C),(00,00,0xFC),(00,00,0xBC),(44,28,0xBC),(94,00,84),(0xA8,00,20),(0xA8,10,00),(88,14,00),(50,30,00),(00,78,00),(00,68,00),(00,58,00),(00,40,58),(00,00,00),(00,00,00),... | |
75f666ad189c5a799582ce567f0df8b7848066d5 | replace spy solved | Lesson3/replace_spy.py | Lesson3/replace_spy.py | Python | 0.002478 | @@ -0,0 +1,483 @@
+# Define a procedure, replace_spy,%0A# that takes as its input a list of%0A# three numbers, and modifies the%0A# value of the third element in the%0A# input list to be one more than its%0A# previous value.%0A%0Aspy = %5B0,0,7%5D%0A%0Adef replace_spy(spy):%0A spy%5B2%5D = spy%5B2%5D + 1%0A retur... | |
375a8f451538d0b426c8a8ddad8c37b1be1e8ceb | Use unicode for AdvanceSelect widget | oscar/forms/widgets.py | oscar/forms/widgets.py | import re
from django import forms
from django.forms.util import flatatt
from django.forms.widgets import FileInput
from django.template import Context
from django.template.loader import render_to_string
from django.utils.encoding import force_text, force_unicode
from django.utils.safestring import mark_safe
try:
... | Python | 0.000001 | @@ -5499,16 +5499,17 @@
at_html(
+u
'%3Coption
|
83e136a0e0d93d1dde4966322a3b51f453d0a1ba | Add simple CSV exporter to examples. | tcflib/examples/csv_exporter.py | tcflib/examples/csv_exporter.py | Python | 0 | @@ -0,0 +1,1675 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0Aimport csv%0Afrom io import StringIO%0Afrom collections import OrderedDict%0A%0Afrom tcflib.service import ExportingWorker, run_as_cli%0A%0A%0Aclass CSVExporter(ExportingWorker):%0A%0A def export(self):%0A%0A columns = OrderedDict()%0A ... | |
39809b37acc541f81dddbd69655d0c160e620f75 | Update __init__.py | tendrl/commons/jobs/__init__.py | tendrl/commons/jobs/__init__.py | import json
import traceback
import etcd
import gevent.event
from tendrl.commons.event import Event
from tendrl.commons.flows.exceptions import FlowExecutionFailedError
from tendrl.commons.message import Message, ExceptionMessage
from tendrl.commons.objects.job import Job
from tendrl.commons.utils import etcd_util
... | Python | 0.000072 | @@ -3212,391 +3212,8 @@
ve()
-%0A if %22integration_id%22 in raw_job%5B'payload'%5D:%0A raw_job%5B'payload'%5D%5B'parameters'%5D%5B'integration_id'%5D = %5C%0A raw_job%5B%0A 'payload'%5D%5B'integration_id'%5... |
a509828f5d5040b1b005fe602ad0e53675b8cb52 | add to test | test/solr_doc_manager_tester.py | test/solr_doc_manager_tester.py | Python | 0 | @@ -0,0 +1,2490 @@
+import unittest%0Aimport time%0Afrom solr_doc_manager import SolrDocManager%0Afrom pysolr import Solr%0A%0Aclass SolrDocManagerTester(unittest.TestCase):%0A%0A def __init__(self):%0A%0A super(SolrDocManagerTester, self).__init__()%0A self.solr = Solr(%22http://localhost:8080/solr/%2... | |
4ca2ca05232357776e64a1e6eb76c0b26663a59e | add semigroup law tester | testers/semigroup_law_tester.py | testers/semigroup_law_tester.py | Python | 0 | @@ -0,0 +1,605 @@
+class SemigroupLawTester:%0A%0A def __init__(self, semigroup, value1, value2, value3):%0A self.semigroup = semigroup%0A self.value1 = value1%0A self.value2 = value2%0A self.value3 = value3%0A%0A def associativity_test(self):%0A%0A x = self.semigroup(self.value... | |
95dea3ea1f39009303f91efd4b59648470b75e18 | Remove repr implementation | modularodm/storage/base.py | modularodm/storage/base.py |
import time
import random
from functools import wraps
import itertools
from ..translators import DefaultTranslator
class KeyExistsException(Exception): pass
class Logger(object):
def __init__(self):
self.listening = False
self.events = []
self.xtra = []
def listen(self, xtra=None)... | Python | 0 | @@ -5034,60 +5034,4 @@
ror%0A
-%0A def __repr__(self):%0A return str(self.store)%0A
|
1c5fef3a34ed421610a4e9a38feb07e6545e5d13 | Add tests for the `dirty_untar` rule | tests/rules/test_dirty_untar.py | tests/rules/test_dirty_untar.py | Python | 0.000003 | @@ -0,0 +1,1795 @@
+import os%0Aimport pytest%0Aimport tarfile%0Afrom thefuck.rules.dirty_untar import match, get_new_command, side_effect%0Afrom tests.utils import Command%0A%0A%0A@pytest.fixture%0Adef tar_error(tmpdir):%0A def fixture(filename):%0A path = os.path.join(str(tmpdir), filename)%0A%0A def... | |
c5276d469b08b3262490047f2372a477814cb2fc | add server test for statelessCompute | tests/stateless_compute_test.py | tests/stateless_compute_test.py | Python | 0 | @@ -0,0 +1,1067 @@
+# -*- coding: utf-8 -*-%0Au%22%22%22Test statelessCompute API%0A%0A:copyright: Copyright (c) 2021 RadiaSoft LLC. All Rights Reserved.%0A:license: http://www.apache.org/licenses/LICENSE-2.0.html%0A%22%22%22%0Afrom __future__ import absolute_import, division, print_function%0Afrom pykern.pkcollection... | |
9b8069f66988ccdbfc76fdbbc7efb78285ed9900 | Bump version to S22.1 | src/ggrc/settings/default.py | src/ggrc/settings/default.py | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
DEBUG = False
TESTING = False
# Flask-SQLAlchemy fix to be less than `wait_time` ... | Python | 0 | @@ -648,16 +648,18 @@
N = %22s22
+.1
%22%0A%0A# Ini
|
6c22f7bf2fe8db39446cddbd0fa9474486101a27 | Add __init__, as django test finder isn't very smart | toolkit/diary/tests/__init__.py | toolkit/diary/tests/__init__.py | Python | 0.000013 | @@ -0,0 +1,165 @@
+from __future__ import absolute_import%0A%0Afrom .test_edit_views import *%0Afrom .test_mailout_view import *%0Afrom .test_models import *%0Afrom .test_public_views import *%0A%0A
| |
623ea9e3d050f347eb404094d049a402b2bb367a | Create config.py | dasem/config.py | dasem/config.py | Python | 0.000002 | @@ -0,0 +1,123 @@
+%22%22%22config%22%22%22%0A%0A%0Afrom os.path import expanduser, join%0A%0A%0Adef data_directory():%0A return join(expanduser('~'), 'dasem_data')%0A
| |
e35586efcfc0af4dcfe02c005a1435767f5ab3ed | add merge_book_lists.py | douban_spider/merge_book_lists.py | douban_spider/merge_book_lists.py | Python | 0.000005 | @@ -0,0 +1,650 @@
+# -*- coding: UTF-8 -*-%0A%0Aimport bloom_filter%0Aimport sys%0A%0A# %E6%8A%8Astr%E7%BC%96%E7%A0%81%E7%94%B1%E9%BB%98%E8%AE%A4ascii%EF%BC%88python2%E4%B8%BAascii%EF%BC%8Cpython3%E4%B8%BAutf8%EF%BC%89%E6%94%B9%E4%B8%BAutf8%0Areload(sys)%0Asys.setdefaultencoding('utf8')%0A%0A%22%22%22%0AMerge book list... | |
62fb38d0860b5feeee39764b6c66f5ceed39b984 | Fix versions of protected/unprotected documents | alembic_migration/versions/077ddf78a1f3_fix_protected_docs_versions.py | alembic_migration/versions/077ddf78a1f3_fix_protected_docs_versions.py | Python | 0 | @@ -0,0 +1,736 @@
+%22%22%22Fix protected docs versions%0A%0ARevision ID: 077ddf78a1f3%0ARevises: 9739938498a8%0ACreate Date: 2017-10-30 12:05:51.679435%0A%0A%22%22%22%0Afrom alembic import op%0Aimport sqlalchemy as sa%0A%0A%0A# revision identifiers, used by Alembic.%0Arevision = '077ddf78a1f3'%0Adown_revision = '97399... | |
ebd8d2fb86b925f3c75ddfea0bbe9d7ab60b50b7 | add notes for subprocess module | abc/sub_process.py | abc/sub_process.py | Python | 0 | @@ -0,0 +1,334 @@
+# -*- coding: UTF-8 -*-%0A__author__ = 'mcxiaoke'%0A%0Aimport subprocess%0A%0A# %E5%88%9B%E5%BB%BA%E5%AD%90%E8%BF%9B%E7%A8%8B%E5%B9%B6%E7%AD%89%E5%BE%85%E5%AE%83%E8%BF%94%E5%9B%9E%EF%BC%8C%E5%8F%82%E6%95%B0%E6%98%AFlist%0Asubprocess.call(%5B'ls', '-a'%5D)%0A# %E5%90%8C%E4%B8%8A%EF%BC%8C%E4%BD%86%E6%9... | |
0e6fb27d26d5f0570baa414e679b96d6c3234491 | add correct loop file (#8) | looptogetdata2.py | looptogetdata2.py | Python | 0 | @@ -0,0 +1,2255 @@
+from urllib2 import Request, urlopen, URLError%0Aimport json%0Aimport pandas%0A%0Adef getValidTimeseriesKey(timerseries_keys, offering_id):%0A%09invalid_offering = '9999999999'%0A%09if offering_id == invalid_offering:%0A%09%09return timeseries_keys%5B1%5D%0A%09else:%0A%09%09return timeseries_keys%5B... | |
eb46f8046211eff81320faceda0c297b27bb419b | Add a new alert plugin for events from geomodel | alerts/geomodel.py | alerts/geomodel.py | Python | 0 | @@ -0,0 +1,995 @@
+#!/usr/bin/env python%0A%0A# This Source Code Form is subject to the terms of the Mozilla Public%0A# License, v. 2.0. If a copy of the MPL was not distributed with this%0A# file, You can obtain one at http://mozilla.org/MPL/2.0/.%0A# Copyright (c) 2015 Mozilla Corporation%0A#%0A# Contributors:%0A# Aa... | |
6898b9462823449e767aa75b7ab38c3e87b61cc1 | Check for page changes | macro/IsRecent.py | macro/IsRecent.py | Python | 0 | @@ -0,0 +1,872 @@
+# -*- coding: iso-8859-1 -*-%0D%0Au%22%22%22%0D%0A IsRecent - Check if a page was recently modified and highlight that fact%0D%0A%0D%0A @copyright: 2012 by Alan Snelson%0D%0A @license: BSD, see LICENSE for details.%0D%0A%0D%0A%22%22%22%0D%0A%0D%0Afrom datetime import datetime%0D%0Afrom MoinM... | |
e8c64cff4daa8f563a2b19b933f89099f8a1a9b6 | Remove socket session_id from all subscribed channels on disconnect. | django_socketio/views.py | django_socketio/views.py |
from atexit import register
from datetime import datetime
from traceback import print_exc
from django.http import HttpResponse
from django_socketio import events
from django_socketio.channels import SocketIOChannelProxy
from django_socketio.settings import MESSAGE_LOG_FORMAT
# Maps open Socket.IO session IDs to re... | Python | 0 | @@ -2512,24 +2512,170 @@
t, context)%0A
+ from django_socketio.channels import CHANNELS%0A for channel in socket.channels:%0A CHANNELS%5Bchannel%5D.remove(socket.session.session_id)%0A
del CLIE
|
3587666f209a9e88672e9520c033682fcd28035a | add l10n_br_purchase/procurement.py | l10n_br_purchase/procurement.py | l10n_br_purchase/procurement.py | Python | 0 | @@ -0,0 +1,1911 @@
+# -*- encoding: utf-8 -*-%0A###############################################################################%0A# #%0A# Copyright (C) 2014 Renato Lima - Akretion #%0A# ... | |
b1d643afb07cef02ab607943776ce120a7d47013 | move unit test for matrix-vector conversion to new superoperator test module | qutip/tests/test_superoperator.py | qutip/tests/test_superoperator.py | Python | 0 | @@ -0,0 +1,2219 @@
+# This file is part of QuTIP.%0A#%0A# QuTIP is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU General Public License as published by%0A# the Free Software Foundation, either version 3 of the License, or%0A# (at your option) any later version.%0A#%0... | |
b39dd2afea1f4662e17a927e7e6aa41e850f7470 | Add a script for generating jamo character table | lib/gen-hangul.py | lib/gen-hangul.py | Python | 0 | @@ -0,0 +1,1412 @@
+#!/usr/bin/python3%0A%0A# Input: https://www.unicode.org/Public/UNIDATA/Jamo.txt%0A%0Aimport io%0Aimport re%0A%0Aclass Builder(object):%0A def __init__(self):%0A pass%0A%0A def read(self, infile):%0A chars = %5B%5D%0A for line in infile:%0A if line.startswith('#... | |
415e3e1ae3a6c5689f3960d2b3f589cf2c733144 | Create conf.py | conf.py | conf.py | Python | 0.000001 | @@ -0,0 +1,905 @@
+# -*- coding: utf-8 -*-%0A#%0Aimport os%0A%0A# on_rtd is whether we are on readthedocs.org%0Aon_rtd = os.environ.get('READTHEDOCS', None) == 'True'%0A%0Aif not on_rtd: # only import and set the theme if we're building docs locally%0A import sphinx_rtd_theme%0A html_theme = 'sphinx_rtd_theme'%0... | |
72f1dab3fe50a552480df522f6c8c4a7002a0952 | Add TimestampsMixin exmples | examples/timestamp.py | examples/timestamp.py | Python | 0 | @@ -0,0 +1,1141 @@
+from __future__ import print_function%0A%0Aimport time%0Afrom datetime import datetime%0A%0Aimport sqlalchemy as sa%0Afrom sqlalchemy.ext.declarative import declarative_base%0Afrom sqlalchemy.orm import scoped_session, sessionmaker%0A%0Afrom sqlalchemy_mixins import TimestampsMixin%0A%0ABase = decla... | |
7799b7a3ea1b1774ce24376ee918376b422daebd | Create cube.py | cube.py | cube.py | Python | 0.000015 | @@ -0,0 +1,1679 @@
+import numpy as np%0Aimport pandas as pd%0Aimport keras%0Aimport pandas as pd%0Aimport keras.preprocessing.text%0Aimport somecode as some%0A%0Aclass Cube:%0A %0A '''%0A %0A INTENDED USE %3E to be called through FastText() class. %0A %0A Takes in pandas dataframe with at least two c... | |
67d3b321edab1fe50f666d0ada86c8392be07199 | add wire_callback | pyaudio/wire_callback.py | pyaudio/wire_callback.py | Python | 0.000001 | @@ -0,0 +1,718 @@
+#!/usr/bin/env python%0A%0A%22%22%22%0APyAudio Example: Make a wire between input and output (i.e., record a%0Afew samples and play them back immediately).%0A%0AThis is the callback (non-blocking) version.%0A%22%22%22%0A%0Aimport pyaudio%0Aimport time%0A%0AWIDTH = 2%0ACHANNELS = 2%0ARATE = 44100%0A%0... | |
34815186871e27b977082d9c35dd0adc76d3af9f | update stencilview doc (128 levels, not 8) | kivy/uix/stencilview.py | kivy/uix/stencilview.py | '''
Stencil View
============
.. versionadded:: 1.0.4
:class:`StencilView` limits the drawing of child widgets to the StencilView's
bounding box. Any drawing outside the bounding box will be clipped (trashed).
The StencilView uses the stencil graphics instructions under the hood. It
provides an efficient way to clip... | Python | 0 | @@ -430,16 +430,18 @@
re than
+12
8%0A st
|
e8798ac01d3baed6785ee0683ec4989b97e47003 | Implement local.shell operation | pyinfra/modules/local.py | pyinfra/modules/local.py | Python | 0.00018 | @@ -0,0 +1,1688 @@
+# pyinfra%0A# File: pyinfra/modules/local.py%0A# Desc: run stuff locally, within the context of operations%0A%0Afrom subprocess import Popen, PIPE%0A%0Aimport gevent%0Afrom termcolor import colored%0A%0Afrom pyinfra.api import operation%0Afrom pyinfra.api.util import read_buffer%0A%0A%0Adef _run_loc... | |
a2b9a17927d851b368d3ef8e869a295c8bd2e86b | add test for default clustering order of SELECT | test/cql-pytest/test_clustering_order.py | test/cql-pytest/test_clustering_order.py | Python | 0.000012 | @@ -0,0 +1,2357 @@
+# Copyright 2022-present ScyllaDB%0A#%0A# SPDX-License-Identifier: AGPL-3.0-or-later%0A%0A#############################################################################%0A# Tests for clustering key ordering, namely the WITH CLUSTERING ORDER BY%0A# setting in the table schema, and ORDER BY in select.%... | |
b602c3467ee5969bc3292b7e494d60b9ccdbbedb | remove sum or c number | qutip/tests/test_rand.py | qutip/tests/test_rand.py | #This file is part of QuTIP.
#
# QuTIP is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# QuTIP is distributed in the ho... | Python | 0.025778 | @@ -1558,12 +1558,8 @@
ual(
-sum(
R%5Bk%5D
@@ -1563,17 +1563,16 @@
%5Bk%5D.tr()
-)
-1.0%3C1e-
|
796561ed822d64be6fd2ef299093711a8534d0e9 | add package py-lmodule version 0.1.0 (#18856) | var/spack/repos/builtin/packages/py-lmodule/package.py | var/spack/repos/builtin/packages/py-lmodule/package.py | Python | 0 | @@ -0,0 +1,1035 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass PyLmodule(PythonPackage):%0A %22%22%22Lmodule is a Pyth... | |
f3bf91c8a9ba3a043f0ba4a11c2347e9b4a3c8be | Add linkins.script | linkins/script.py | linkins/script.py | Python | 0 | @@ -0,0 +1,767 @@
+import logging%0Aimport subprocess%0A%0Alog = logging.getLogger(__name__)%0Alog.propagate = False%0Ahandler = logging.StreamHandler()%0Afmt = logging.Formatter(%0A fmt='%25(script)s: %25(stream)s: %25(message)s',%0A )%0Ahandler.setFormatter(fmt)%0Alog.addHandler(handler)%0A%0Adef _logscript(fp,... | |
2ff8505db7ee0b4dbf08a2a61d00daaf681f5492 | Create dlpp.py | dlpp.py | dlpp.py | Python | 0.000001 | @@ -0,0 +1,2406 @@
+#!/usr/bin/env python%0A%0A# dl_poly_parse%0A# If ran as script, takes a DL_POLY OUTPUT file and returns the physical properties as a parsed%0A# file of simple columns, for easy readability by plotting software.%0A#%0A# To do:%0A# * give option to output as csv%0A# * give option to return properti... | |
e13ed4cfa39b366685d058501be2e65b5bbf1230 | Make language setup compatible with OSX Yosemite's `locale -a` output | dodo.py | dodo.py |
import os
import fnmatch
import locale
import subprocess
DOIT_CONFIG = {
'default_tasks': ['flake8', 'test'],
'reporter': 'executed-only',
}
def recursive_glob(path, pattern):
"""recursively walk path directories and return files matching the pattern"""
for root, dirnames, filenames in os.walk(path,... | Python | 0.000003 | @@ -1181,16 +1181,17 @@
if
+(
line.end
@@ -1204,16 +1204,44 @@
'.utf8')
+ or line.endswith('.UTF-8'))
and '_'
|
8967d4e0c5cd9adad7244cfc2ea78593be14b113 | Add regression test template | templates/tests/regression_test.py | templates/tests/regression_test.py | Python | 0.000001 | @@ -0,0 +1,379 @@
+# coding: utf-8%0Afrom __future__ import unicode_literals%0A%0Aimport pytest%0A%0A%0Adef test_issueXXX():%0A %22%22%22Provide a description of what you're testing for here.%22%22%22%0A%0A # to use spaCy components, add the fixture names as arguments to the test%0A # for more info, check out ... | |
ca85166164cb5ac726723b83c00c6f305d0a0b45 | Update forward compatibility horizon to 2022-05-16 | tensorflow/python/compat/compat.py | tensorflow/python/compat/compat.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Python | 0 | @@ -1335,17 +1335,17 @@
22, 5, 1
-5
+6
)%0A_FORWA
|
31da2ab1401b933e031a91aac2aa474e4099aa58 | Update forward compatibility horizon to 2019-01-31 | tensorflow/python/compat/compat.py | tensorflow/python/compat/compat.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Python | 0 | @@ -1139,17 +1139,17 @@
19, 1, 3
-0
+1
)%0A%0A%0A@tf_
|
47734733a7ccbd242979b3c7ac9d792f59ac10d8 | Test for HERMES spectra of HD22879 | code/test_hd22879.py | code/test_hd22879.py | Python | 0 | @@ -0,0 +1,1601 @@
+import cPickle as pickle%0A%0Afrom stellar_parameters import Star%0Afrom channel import SpectralChannel%0A%0A%0A%0A%0Aclass spectrum(object):%0A pass%0A%0Aimport sick%0Aspec = sick.specutils.Spectrum.load(%22spectra/hermes-sun.fits%22)%0A%0A%0Ablue_channel = spectrum()%0Ablue_channel.dispersion =... | |
1a6f702b670a4cad2ec1cd4044759ecfc656c9f2 | add thread | thread/thread.py | thread/thread.py | Python | 0 | @@ -0,0 +1,481 @@
+#!/usr/bin/env python %0A%0Aimport thread%0Afrom time import sleep, ctime%0A%0Adef thread0():%0A print '1 : start @ ', ctime()%0A sleep(4)%0A print '1 : end @ ', ctime()%0A%0Adef thread1():%0A print '2 : start @ ', ctime()%0A sleep(4)%0A print '2 : end @ ', ctime()%0A%0Adef main... | |
2feed8b291fd4c8081bb81458bedd736c08c448e | Add CNN example script. | usr/examples/09-Feature-Detection/cnn.py | usr/examples/09-Feature-Detection/cnn.py | Python | 0 | @@ -0,0 +1,1259 @@
+# CMSIS CNN example.%0Aimport sensor, image, time, os%0A%0Asensor.reset() # Reset and initialize the sensor.%0Asensor.set_contrast(3)%0Asensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)%0Asensor.set_framesize(sensor.QVGA) # Set frame s... | |
0080f3a4f93a22b9c563c20d2c93b00ce8b7c382 | Set up game structure | game.py | game.py | Python | 0.000003 | @@ -0,0 +1,1012 @@
+%22%22%22%0D%0AA variant of Conway's Game of Life on a hexagonal grid.%0D%0A%0D%0ARules: B2/S12%0D%0A - Dead cells with two live neighbours are born.%0D%0A - Live cells with one or two live neighbours survive.%0D%0A - All other live cells die.%0D%0A%0D%0A%22%22%22%0D%0A%0D%0A# Rule Configuration%0D%... | |
72e69f3535c7e2cd82cdda62636eabd7421ebddf | Add dump script for all hiddens | generative/tests/compare_test/concat_first/dump_hiddens.py | generative/tests/compare_test/concat_first/dump_hiddens.py | Python | 0 | @@ -0,0 +1,799 @@
+from __future__ import division%0Afrom __future__ import print_function%0Afrom __future__ import absolute_import%0A%0Aimport os%0Aimport subprocess%0A%0Aif __name__ == %22__main__%22:%0A for hiddens_dim in %5B512, 256, 128, 64, 32, 16%5D: %0A print('Dumping files for (%25d)' %25 hiddens_... | |
6e0202bb2385821907627046aef28b042961a2be | Create gate.py | gate.py | gate.py | Python | 0.000001 | @@ -0,0 +1 @@
+%0A
| |
e20e50c7cb1a22907bc83eec6c595a7bbaf8b8b9 | Add test_github.py | tests/core/backends/test_github.py | tests/core/backends/test_github.py | Python | 0.000004 | @@ -0,0 +1,1328 @@
+# -*- coding: utf-8 -*-%0Aimport pytest%0Aimport requests%0A%0Afrom kawasemi.backends.github import GitHubChannel%0Afrom kawasemi.exceptions import HttpError, ImproperlyConfigured%0A%0A%0Aconfig = %7B%0A %22_backend%22: %22kawasemi.backends.github.GitHubChannel%22,%0A %22token%22: %22token%22,... | |
aa1ca0b500af4ef89ba7ad7982b89ebe15252c1b | add heguilong answer for question3 | question_3/heguilong.py | question_3/heguilong.py | Python | 0.999995 | @@ -0,0 +1,1068 @@
+%22%22%22%0AFile: heguilong.py%0AAuthor: heguilong%0AEmail: hgleagle@gmail.com%0AGithub: https://github.com/hgleagle%0ADescription:%0A%E7%BB%9F%E8%AE%A1%E4%B8%80%E4%B8%AA%E6%96%87%E4%BB%B6%E4%B8%AD%E6%AF%8F%E4%B8%AA%E5%8D%95%E8%AF%8D%E5%87%BA%E7%8E%B0%E7%9A%84%E6%AC%A1%E6%95%B0%EF%BC%8C%E5%88%97%E5%... | |
69ba3715c762245e83d6b5388af4b77dfcc43dde | Create dataGenCore.py | bin/dataGenCore.py | bin/dataGenCore.py | Python | 0.000002 | @@ -0,0 +1,3126 @@
+#!/usr/bin python %0A%0Aimport time%0Aimport random%0Aimport base64%0Aimport os%0Aimport sys%0A%0Astart = time.time()%0A%0A# pwd = os.path.dirname(__file__)%0A# outputpath = os.path.normpath(pwd + '/../sample_data/' + sys.argv%5B1%5D)%0A%0Aoutputpath = os.path.normpath(sys.argv%5B1%5D)%0A# print ou... | |
df784323d0da737755def4015840d118e3c8e595 | Add test that detects censorship in HTTP pages based on HTTP body length | nettests/core/http_body_length.py | nettests/core/http_body_length.py | Python | 0.000001 | @@ -0,0 +1,2875 @@
+# -*- encoding: utf-8 -*-%0A#%0A# :authors: Arturo Filast%C3%B2%0A# :licence: see LICENSE%0A%0Afrom twisted.internet import defer%0Afrom twisted.python import usage%0Afrom ooni.templates import httpt%0A%0Aclass UsageOptions(usage.Options):%0A optParameters = %5B%0A %5B'url', '... | |
e546e055b33c776fddaa244075d59a99978265ea | add reading | vehicles/management/commands/import_reading.py | vehicles/management/commands/import_reading.py | Python | 0 | @@ -0,0 +1,1729 @@
+from ciso8601 import parse_datetime%0Afrom django.utils.timezone import make_aware%0Afrom django.contrib.gis.geos import Point%0Afrom busstops.models import Service%0Afrom ...models import VehicleLocation, VehicleJourney%0Afrom ..import_live_vehicles import ImportLiveVehiclesCommand%0A%0A%0Aclass Co... | |
3b00930f9c6e6552bef5b5939916a1b8e737287a | Add a snippet. | python/pyaudio/read.py | python/pyaudio/read.py | Python | 0.000002 | @@ -0,0 +1,703 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A# See http://people.csail.mit.edu/hubert/pyaudio/docs/#example-blocking-mode-audio-i-o%0A%0Aimport pyaudio%0Aimport wave%0A%0ACHUNK = 1024%0A%0Awf = wave.open(%22test.wav%22, 'rb')%0A%0Aprint(wf.getnchannels())%0Aprint(wf.getframerate())%0A%0Ap = ... | |
3601a0dc9d762e17c24e0dbf86ee1ef4a00c49cd | Add tests for the authorize_user function | yithlibraryserver/tests/test_security.py | yithlibraryserver/tests/test_security.py | Python | 0.000001 | @@ -0,0 +1,1704 @@
+from pyramid.httpexceptions import HTTPBadRequest, HTTPUnauthorized%0A%0Afrom yithlibraryserver import testing%0Afrom yithlibraryserver.security import authorize_user%0A%0A%0Aclass AuthorizationTests(testing.TestCase):%0A%0A clean_collections = ('access_codes', 'users')%0A%0A def test_authoriz... | |
66db96dc523ab838475eb3826766bb4278c18673 | Add tests for remove_display_attributes. | tests/test_assess_cloud_display.py | tests/test_assess_cloud_display.py | Python | 0 | @@ -0,0 +1,913 @@
+from tests import TestCase%0A%0Afrom assess_cloud_display import remove_display_attributes%0Afrom utility import JujuAssertionError%0A%0A%0Aclass TestRemoveDisplayAttributes(TestCase):%0A%0A def test_remove_display_attributes(self):%0A cloud = %7B%0A 'defined': 'local',%0A ... | |
6c12786f74c17ab8328fed9bfebbb003f2e9f282 | Add always true entry | zaifbot/rules/entry/always_true_entry.py | zaifbot/rules/entry/always_true_entry.py | Python | 0 | @@ -0,0 +1,282 @@
+from zaifbot.rules.entry.base import Entry%0A%0A%0Aclass AlwaysTrueEntry(Entry):%0A def __init__(self, currency_pair, amount, action, name=None):%0A super().__init__(currency_pair=currency_pair, amount=amount, action=action, name=name)%0A%0A def can_entry(self):%0A return True%0A
| |
34be21749a0e42563c2f1c6912a2ae2a7c26091c | 525. Contiguous Array. Array, TLE | p525_array_tle.py | p525_array_tle.py | Python | 0.998773 | @@ -0,0 +1,1373 @@
+import unittest%0A%0A%0Adef max_length(sums, lo, hi):%0A sum_ = (sums%5Bhi%5D - sums%5Blo%5D) %3C%3C 1%0A length = hi - lo%0A if sum_ %3E length:%0A more = 1%0A elif sum_ %3C length:%0A more = 0%0A else:%0A return length%0A if sums%5Blo%5D == more:%0A re... | |
93f0f573c40ed7878f744a9fee2b2a9e85157d5e | append elevations to GPX from SRTM dataset with gpxelevations util in SRTM.py package | src/gpx_elev_enhancer.py | src/gpx_elev_enhancer.py | Python | 0 | @@ -0,0 +1,509 @@
+# Append elevations to GPX files%0A# 2015-05-08%0A# Lu LIU%0A#%0A%0Afrom os import listdir%0Afrom os.path import isfile, join%0Aimport srtm%0Aimport gpxpy%0A%0Agpx_file_dir = %22/Users/user/Research/data/GPX/Munich%22%0Agpx_files = %5Bf for f in listdir(gpx_file_dir) if isfile(join(gpx_file_dir, f))%... | |
7e68ec932cb43fc5a98828a367a51593b419bee0 | Add batch normalization | thinc/neural/_classes/batchnorm.py | thinc/neural/_classes/batchnorm.py | Python | 0.000001 | @@ -0,0 +1,2206 @@
+%0A%0Afrom .model import Model%0A%0A%0Aclass BatchNormalization(Model):%0A def predict_batch(self, X):%0A N, mu, var = _get_moments(self.ops, X)%0A return _forward(self.ops, X, mu, var)%0A %0A def begin_update(self, X, dropout=0.0):%0A N, mu, var = _get_moments(self.ops, X... | |
c99a476b396422c0a673a78eb795df1cf94b8bb5 | Define base Frame object. | hyper/http20/frame.py | hyper/http20/frame.py | Python | 0 | @@ -0,0 +1,366 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0Ahyper/http20/frame%0A~~~~~~~~~~~~~~~~~~%0A%0ADefines framing logic for HTTP/2.0. Provides both classes to represent framed%0Adata and logic for aiding the connection when it comes to reading from the%0Asocket.%0A%22%22%22%0Aclass Frame(object):%0A def __init__... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.