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 |
|---|---|---|---|---|---|---|---|
d03254dabaac466edd697de38c3433475828bd4f | Add tests for has_changes | tests/functions/test_has_changes.py | tests/functions/test_has_changes.py | Python | 0.000001 | @@ -0,0 +1,698 @@
+import sqlalchemy as sa%0Afrom sqlalchemy.ext.declarative import declarative_base%0A%0Afrom sqlalchemy_utils import has_changes%0A%0A%0Aclass TestHasChanges(object):%0A def setup_method(self, method):%0A Base = declarative_base()%0A%0A class Article(Base):%0A __tablename__... | |
795cd6e190a1cc4d416c5524399780e586dc6c45 | Add better kitt script | kitt/kitt.py | kitt/kitt.py | Python | 0 | @@ -0,0 +1,891 @@
+from microbit import *%0A%0Adisplay.scroll(%22I am the Knight Industries 2000%22)%0A%0AMAX_ROWS = 4%0AMAX_BRIGHTNESS = 9%0AMIN_BRIGHTNESS = 2%0A%0Adef scan(reverse=False):%0A%0A for i in range(0, 9):%0A brightness = MAX_BRIGHTNESS%0A%0A row_range = range(0, i+1) if not reverse else r... | |
a6ac5055a1867259ab17997a076299731e57c45b | Add Android extractor | strings2pot/extractors/android.py | strings2pot/extractors/android.py | Python | 0.000001 | @@ -0,0 +1,1513 @@
+# -*- coding: utf-8 -*-%0A%0Aimport re%0Aimport xml.etree.ElementTree as ET%0A%0Aclass AndroidExtractor:%0A def __init__(self, source_file, destination_file, context_id_generator):%0A self.source_file = source_file%0A self.destination_file = destination_file%0A self._create_c... | |
c711f62ef96d67a6e42e3bbe10c0b3cd64a23444 | add moviepy - text_hineinzoomen | moviepy/text_hineinzoomen.py | moviepy/text_hineinzoomen.py | Python | 0.000001 | @@ -0,0 +1,1661 @@
+#!/usr/bin/env python%0A%0A# Video mit Text erzeugen, hineinzoomen (Text wird gr%C3%B6sser)%0A%0A# Einstellungen%0Atext = 'Text' # Text%0Atextgroesse = 150 # Textgroesse in Pixel%0Atextfarbe_r = 0 # Textfarbe R%0Atextfarbe_g = 0 # Textfarbe G%0Atextfar... | |
c61b1595709b6acd26cf7c43e7858e3ad5cb588f | Add missing module. | csvkit/headers.py | csvkit/headers.py | Python | 0 | @@ -0,0 +1,196 @@
+#!/usr/bin/env python%0A%0Adef make_default_headers(n):%0A %22%22%22%0A Make a set of simple, default headers for files that are missing them.%0A %22%22%22%0A return %5Bu'column%25i' %25 (i + 1) for i in range(n)%5D%0A
| |
9b50da16238d2f816199c8fb8a20ec558edf5d46 | Create oie_compress.py | oie_compress.py | oie_compress.py | Python | 0.000002 | @@ -0,0 +1,1013 @@
+# 1.0%09much%09be paid on%09insurance claim%0A# 1.0%09much%09is%09paid%0A# 1.0%09much%09is%09paid on insurance claim%0A# 1.0%09much%09be%09paid%0A# -----------------------------------------------------%0A# 1.0%09channel%09joining%09two bodies%0A# 1.0%09channel%09joining%09two larger bodies of water%... | |
302f98844487d894252d3dc3f4d30940fbcbd9e1 | Allow pex to be invoked using runpy (python -m pex). (#637) | pex/__main__.py | pex/__main__.py | Python | 0.000065 | @@ -0,0 +1,235 @@
+# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).%0A# Licensed under the Apache License, Version 2.0 (see LICENSE).%0A%0Afrom __future__ import absolute_import%0A%0Afrom pex.bin import pex%0A%0A__name__ == '__main__' and pex.main()%0A
| |
8f506c20ccad47ee6f2454a419145b1b2b48adba | Create bold-words-in-string.py | Python/bold-words-in-string.py | Python/bold-words-in-string.py | Python | 0.999987 | @@ -0,0 +1,1146 @@
+# Time: O(n * l), n is the length of S, l is the average length of words%0A# Space: O(t), t is the size of trie%0A%0Aclass Solution(object):%0A def boldWords(self, words, S):%0A %22%22%22%0A :type words: List%5Bstr%5D%0A :type S: str%0A :rtype: str%0A %22%2... | |
228f4325aa5f1c8b616f45462280b4a7cb0792dd | Add test for empty files to csvjoin | tests/test_utilities/test_csvjoin.py | tests/test_utilities/test_csvjoin.py | #!/usr/bin/env python
import sys
try:
from mock import patch
except ImportError:
from unittest.mock import patch
from csvkit.utilities.csvjoin import CSVJoin, launch_new_instance
from tests.utils import CSVKitTestCase
class TestCSVJoin(CSVKitTestCase):
Utility = CSVJoin
def test_launch_new_instanc... | Python | 0 | @@ -221,16 +221,32 @@
TestCase
+, EmptyFileTests
%0A%0A%0Aclass
@@ -272,16 +272,32 @@
TestCase
+, EmptyFileTests
):%0A U
@@ -312,16 +312,63 @@
CSVJoin
+%0A default_args = %5B'examples/dummy.csv', '-'%5D
%0A%0A de
|
dbb127a6fbadfa17f5faad45e8d7ebb6b943a77d | add basic test for vamp_spectral_centroid | tests/test_vamp_spectral_centroid.py | tests/test_vamp_spectral_centroid.py | Python | 0.000001 | @@ -0,0 +1,1047 @@
+#! /usr/bin/env python%0A%0Aimport unittest%0Afrom unit_timeside import TestRunner%0Afrom timeside.plugins.decoder.aubio import AubioDecoder as FileDecoder%0Afrom timeside.core import get_processor%0Afrom timeside.core.tools.test_samples import samples%0A%0A%0Aclass TestVampSpectralCentroid(unittest... | |
86c67f321ec4ee7c254fde4a7f942a83d5e35016 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/00734af980b920f9f963badf85fbeb12d576fde5. | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "d1caeb8bdba1851194baf06c28ea09b5b67e5623"
TFRT_SHA256 = "e480ad7451b9e3ce45da61d71079... | Python | 0 | @@ -228,133 +228,133 @@
= %22
-d1caeb8bdba1851194baf06c28ea09b5b67e5623%22%0A TFRT_SHA256 = %22e480ad7451b9e3ce45da61d7107953a4d55789bf6087442fd000a1ecb7c6604e
+00734af980b920f9f963badf85fbeb12d576fde5%22%0A TFRT_SHA256 = %220c136cdfb87ae3663c162ad807c57983a8119fa7097fb589c4a7d04b98d09d3d
%22%0A%0A
|
8cf5b328d7596a9b74490b7dfd4a1b8aa1577b55 | Merge remote-tracking branch 'origin' into AC-9512 | accelerator/migrations/0110_remove_bucket_list_program_role_20220707_1001.py | accelerator/migrations/0110_remove_bucket_list_program_role_20220707_1001.py | Python | 0 | @@ -0,0 +1,1079 @@
+from django.db import migrations%0A%0A%0Adef remove_bucket_list_program_roles(apps, schema_editor):%0A BucketState = apps.get_model('accelerator', 'BucketState')%0A ProgramRole = apps.get_model('accelerator', 'ProgramRole')%0A ProgramRoleGrant = apps.get_model('accelerator', 'ProgramRoleGra... | |
5945fe5c527b3f5cb2ed104eccdf9266dc702eb1 | add second order constraint | toppra/constraint/can_linear_second_order.py | toppra/constraint/can_linear_second_order.py | Python | 0.009653 | @@ -0,0 +1,2433 @@
+from .canonical_linear import CanonicalLinearConstraint%0Afrom .constraint import DiscretizationType%0Aimport numpy as np%0A%0A%0Aclass CanonicalLinearSecondOrderConstraint(CanonicalLinearConstraint):%0A %22%22%22 A class to represent Canonical Linear Generalized Second-order constraints.%0A%0A ... | |
3020472569a49f01331ebb150f004e2684196b8e | add expression to improve the domain | bin/tools/expression.py | bin/tools/expression.py | Python | 0.000012 | @@ -0,0 +1,2114 @@
+#!/usr/bin/env python%0A%0Adef _is_operator( element ):%0A return isinstance( element, str ) and element in %5B'&','%7C'%5D%0A%0Adef _is_leaf( element ):%0A return isinstance( element, tuple ) and len( element ) == 3 and element%5B1%5D in %5B'=', '%3C%3E', '!=', '%3C=', '%3C', '%3E', '%3E=', '... | |
0226bec54c30a31c0005e7318b69c58a379cfbc9 | refactor output function | mystarspilot/view.py | mystarspilot/view.py | Python | 0.998671 | @@ -0,0 +1,1565 @@
+from __future__ import print_function%0Afrom __future__ import absolute_import%0Afrom __future__ import unicode_literals%0Afrom colorama import Fore, Back, Style%0A%0Aclass SearchResultView(object):%0A %0A def print_search_result(self, search_result, keywords=None):%0A %0A if sea... | |
245e661c50df41942ca3f0c8ee794532e3c02c4c | Translate PowerShell sample NCM.ExecuteScript.ps1 to python | samples/ncm_execute_script.py | samples/ncm_execute_script.py | Python | 0.999999 | @@ -0,0 +1,1051 @@
+from __future__ import print_function%0Aimport re%0Aimport requests%0Afrom orionsdk import SwisClient%0Afrom time import sleep%0A%0Adef main():%0A%09npm_server = 'localhost'%0A%09username = 'admin'%0A%09password = ''%0A%0A%09swis = SwisClient(npm_server, username, password)%0A%09%0A%09ip = '10.199.2... | |
7e91549abc8d185deb231c937d7740606f9454ec | add pmi element unit test | test_pmi_element.py | test_pmi_element.py | Python | 0 | @@ -0,0 +1,740 @@
+#!/usr/bin/env python%0A# -*- coding: UTF-8 -*-%0A#%0A# The unit test case for pmi.TopkHeap and PMIElement%0A#%0A# @author: Jason Wu (Jasonwbw@yahoo.com)%0A%0Afrom pmi import PMIElement%0Aimport sys%0Aimport unittest%0A%0Aclass PMIElementTestCase(unittest.TestCase): %0A def setUp(self): %0A ... | |
3c52683e759f146ad247c6e397d5d49dd1cc9966 | Create __init__.py | testing/__init__.py | testing/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
a770c91ea6761d890387b4b6e130cb495817eea0 | Improve the sc2parse debugging script. | sc2reader/scripts/sc2parse.py | sc2reader/scripts/sc2parse.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import sc2reader
def main():
for replay in sc2reader.load_replays(sys.argv[1:], verbose=True):
pass
if __name__ == '__main__':
main() | Python | 0 | @@ -67,16 +67,33 @@
c2reader
+%0Aimport traceback
%0A%0Adef ma
@@ -107,17 +107,105 @@
for
+argument in sys.argv%5B1:%5D:%0A%09%09for path in sc2reader.utils.get_files(argument):%0A%09%09%09try:%0A%09%09%09%09
replay
-in
+=
sc2
@@ -226,45 +226,688 @@
play
-s(sys.argv%5B1:%5D, verbose=True):%0A%09%09pass
+(path,... |
98295608a2ba4519d12212532380253bba4372ed | Add script that recommends scrape task schedule based on recent run timings | scripts/frequency_analysis.py | scripts/frequency_analysis.py | Python | 0 | @@ -0,0 +1,2297 @@
+import asyncio%0Aimport attr%0Aimport pprint%0Aimport dateutil.parser%0Afrom datetime import timedelta%0Afrom bobsled.core import bobsled%0Afrom bobsled.base import Status%0A%0A%0Adef recommend_frequency_for_task(runs):%0A total_duration = timedelta(seconds=0)%0A longest_duration = timedelta(s... | |
dd22ea800dbbeffaace1927804d50da60ee77a30 | Fix TestPages.test_homepage_with_anonymous_giver. | tests/test_pages.py | tests/test_pages.py | from __future__ import print_function, unicode_literals
import datetime
from mock import patch
import pytz
from gittip.elsewhere.twitter import TwitterAccount
from gittip.testing import GITHUB_USER_UNREGISTERED_LGTEST, Harness
from gittip.testing.client import TestClient
from gittip.utils import update_homepage_quer... | Python | 0 | @@ -322,16 +322,65 @@
es_once%0A
+from aspen.http.request import UnicodeWithParams%0A
%0A%0Aclass
@@ -833,33 +833,72 @@
-TwitterAccount(%22bob%22
+self.platforms.twitter.get_account(UnicodeWithParams('bob'
, %7B%7D)
+)
.opt
|
39004c89a79b7932060e66ce3ad868156bdaf936 | set default deepmind lab env to demo_map | tensorforce/examples/lab_main.py | tensorforce/examples/lab_main.py | # Copyright 2017 reinforce.io. 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 applicable law or... | Python | 0 | @@ -895,16 +895,17 @@
ind_lab%0A
+%0A
from ten
@@ -1319,16 +1319,30 @@
efault='
+tests/demo_map
',help=%22
|
e6642dd9c9cad6aca3cb70e4cca53afe51494d4b | Add a test for checking setup.py | tests/test_setup.py | tests/test_setup.py | Python | 0.000002 | @@ -0,0 +1,121 @@
+r%22%22%22 Testspectra_gen functions%22%22%22%0A%0A%0Adef test_setup():%0A import os%0A cmd = %22python3 setup.py check%22%0A os.system(cmd)
| |
0424eb7dd8e55e2f88f088c3a84c8e962d89f06e | build perf from source | tools/perf_build.py | tools/perf_build.py | Python | 0 | @@ -0,0 +1,1170 @@
+#!/usr/bin/env python%0Aimport platform%0Aimport subprocess%0A%0Aif subprocess.call('which sudo', shell=True) == 0:%0A with_sudo = 'sudo ' %0Aelse:%0A with_sudo = '' %0A%0Amajor = int(platform.release().split('.')%5B0%5D)%0Aminor = int(platform.release().split('.')%5B1%5D)%0Arevision = int(pla... | |
ef3e07794d4245b9d4a1d0007a0b9099d5bafaf9 | Add asteval wrapper | project/asteval_wrapper.py | project/asteval_wrapper.py | Python | 0.000001 | @@ -0,0 +1,1694 @@
+from asteval import Interpreter%0A%0Aimport functools%0Aimport re%0A%0A%0Aclass Script(object):%0A def __init__(self):%0A %22%22%22%0A Sets up an interpreter.%0A %22%22%22%0A self.interpreter = Interpreter()%0A self.symtable%5B're'%5D = re%0A%0A @property%0A ... | |
126863fd6c2a13491b92d546d3e886d0e0da492b | Add experiment for nodejs. | swig/node/binding.gyp | swig/node/binding.gyp | Python | 0 | @@ -0,0 +1,1038 @@
+%7B%0A %22targets%22: %5B%0A %7B%0A %22target_name%22: %22velocypack%22,%0A %22sources%22: %5B %22../../src/asm-functions.cpp%22, %0A %22../../src/AttributeTranslator.cpp%22,%0A %22../../src/Builder.cpp%22,%0A %22../../src/Collectio... | |
ad0a1bf70dc2776c88115389400fd6958e49ecc8 | Add rsync package | var/spack/packages/rsync/package.py | var/spack/packages/rsync/package.py | Python | 0.000001 | @@ -0,0 +1,448 @@
+from spack import *%0A%0Aclass Rsync(Package):%0A %22%22%22rsync is an open source utility that provides fast incremental file transfer.%22%22%22%0A homepage = %22https://rsync.samba.org%22%0A url = %22https://download.samba.org/pub/rsync/rsync-3.1.1.tar.gz%22%0A%0A version('3.1.1', ... | |
d205284e21f5fad8195d796ad356042cb5c47894 | add log test | py_logging/test_logging.py | py_logging/test_logging.py | Python | 0.000001 | @@ -0,0 +1,1544 @@
+#!/usr/bin/env python%0A# encoding: utf-8%0A%0Aimport logging%0Aimport os%0Aimport time%0Afrom unittest import TestCase%0A%0A%0Aclass TestLogging(TestCase):%0A def setUp(self):%0A dir_path = os.path.dirname(__file__)%0A self.logfile = os.path.join(dir_path, %22tmp.log%22)%0A ... | |
2e2bae00f7b098e5fd20f2901b4f70554e250d2d | add program to plot offset distribution | python/plot_offset_dist.py | python/plot_offset_dist.py | Python | 0 | @@ -0,0 +1,2516 @@
+#!/usr/bin/env python%0Aimport argparse%0A%0Aimport numpy as np%0A%0Aimport glob%0A%0Aimport matplotlib as mpl%0Ampl.use('Agg')%0Ampl.rcParams.update(%7B'font.size': 10%7D)%0Aimport matplotlib.pyplot as plt%0A%0Adef add_stat_legend(x):%0A textstr = '$%5Cmathrm%7BN%7D=%25d$%5Cn$%5Cmathrm%7Bmean%7D... | |
091432b795e3b5571887eb924fb831060d2fd53b | Add logging setup | turbinia/config/logger.py | turbinia/config/logger.py | Python | 0.000001 | @@ -0,0 +1,1371 @@
+# Copyright 2017 Google Inc.%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... | |
f9998701bafa24fce25156751fefdfa97074c801 | Add protocol conformance map | utils/gyb_syntax_support/protocolsMap.py | utils/gyb_syntax_support/protocolsMap.py | Python | 0 | @@ -0,0 +1,541 @@
+SYNTAX_BUILDABLE_EXPRESSIBLE_AS_CONFORMANCES = %7B%0A 'ExpressibleAsConditionElement': %5B%0A 'ExpressibleAsConditionElementList'%0A %5D,%0A 'ExpressibleAsDeclBuildable': %5B%0A 'ExpressibleAsCodeBlockItem',%0A 'ExpressibleAsMemberDeclListItem',%0A 'ExpressibleAsS... | |
143eb4665e76065ec67b5dd42cfe84e238d50094 | use per post winner count if available to overide settings | candidates/constants.py | candidates/constants.py | Python | 0 | @@ -0,0 +1,81 @@
+ELECTION_ID_REGEX = r'(?P%3Celection%3E%5B%5E/%5D+)'%0APOST_ID_REGEX = r'(?P%3Cpost_id%3E%5B%5E/%5D+)'%0A
| |
6aef9ab419b09822b2255141349144ac8978e862 | Add migration for h5p kind. | kolibri/core/content/migrations/0025_add_h5p_kind.py | kolibri/core/content/migrations/0025_add_h5p_kind.py | Python | 0 | @@ -0,0 +1,925 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.23 on 2019-12-19 02:29%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0Afrom django.db import models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A (%22content%22, %220024_chann... | |
39b00572d7888895bcf552999f80b712c1738142 | Create BillboardIter.py | BillboardIter.py | BillboardIter.py | Python | 0 | @@ -0,0 +1,2374 @@
+from datetime import date, timedelta%0A%0A%0Aclass BillboardDates():%0A%0A '''Iterator over valid Billboard Chart weeks, which is%0A supposed to be a per-class singleton for start quantization'''%0A%0A def __init__(self, endDate=date.today()):%0A assert type(endDate) is str or type(e... | |
566850c873f6bdbed6632388330f8e4df6fbe613 | add migration for accordeon block on homepage | meinberlin/apps/cms/migrations/0021_add_accordeon_block.py | meinberlin/apps/cms/migrations/0021_add_accordeon_block.py | Python | 0 | @@ -0,0 +1,2269 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.16 on 2018-11-08 12:57%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0Aimport meinberlin.apps.cms.blocks%0Aimport wagtail.wagtailcore.blocks%0Aimport wagtail.wagtailcore.fields%0Aimport wagtail.wagtailimages.block... | |
be898f26984da4ee92da1a027e47775cd816fed5 | Fix typo (?) in authentication logic | nova/api/openstack/auth.py | nova/api/openstack/auth.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 OpenStack LLC.
# 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/... | Python | 0.026024 | @@ -4143,19 +4143,24 @@
ess_key(
-key
+username
)%0A
@@ -4182,24 +4182,21 @@
ser.
-name == username
+secret == key
:%0A
|
ecfadf8478b8775d8579812a7bd835f6ebb1ffd4 | Add file lister for rclone export | util/rclone-list-files.py | util/rclone-list-files.py | Python | 0 | @@ -0,0 +1,627 @@
+#!/usr/bin/env python3%0Aimport glob%0A%0A# For use with --files-from argument for Rclone%0A# This suits Edgar's structure with is%0A# SPECIESNAME/%7Boccurrences%7Cprojected-distributions%7D/%5B2nd-to-latest-file-is-the-latest%5D.zip%0Afor folder in glob.glob('*'):%0A occurrences = glob.glob(folde... | |
47e3a59dd05f30f1ce0c41e0aa531987fb33606c | Generate watersheds for new EM dataset | new-em-watersheds.py | new-em-watersheds.py | Python | 0.999865 | @@ -0,0 +1,783 @@
+from gala import morpho%0Afrom gala import imio%0Aimport numpy as np%0Apr = imio.read_image_stack('membrane/*.tiff')%0Aws = morpho.watershed_sequence(pr / pr.max(), axis=0, connectivity=2, smooth_thresh=0.02, minimum_seed_size=2)%0Aimio.write_h5_stack(ws, 'watershed.lzf.h5', compression='lzf')%0Aslic... | |
629bd006bfd7e6210dcc95198be9b65614e4f051 | Convert optimization_test.py to PyTorch | optimization_test_pytorch.py | optimization_test_pytorch.py | Python | 0.999999 | @@ -0,0 +1,1731 @@
+# coding=utf-8%0A# Copyright 2018 The Google AI Language Team Authors.%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/licens... | |
7da53597f9cb4117cecbaed1dbb77f4693289815 | add a test for well locations endpoint | app/backend/wells/tests/test_wells.py | app/backend/wells/tests/test_wells.py | Python | 0.000001 | @@ -0,0 +1,999 @@
+%22%22%22%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 applicable law o... | |
32f7fe6562f4d1592dfab5a9b065154dca51f1d3 | Add rsync module | pyIsis/rsync.py | pyIsis/rsync.py | Python | 0.000001 | @@ -0,0 +1,1794 @@
+# -*- coding: utf-8 -*-%0A%0Aimport os%0Aimport subprocess%0Aimport logging%0A%0A%0A#RSYNC_PATH = os.path.join(%0A# os.path.abspath (os.path.dirname(__file__)), 'bin', 'rsync')%0ARSYNC_PATH = '/opt/rsync/bin/rsync'%0ARSYNC_CMD = '%7Bcmd%7D %7Boptions%7D %22%7Bsource%7D%22 %22%7Bdestination%7D%22'... | |
49712dd43a2376c913e66cac7b52fc7247912e44 | Make disable_builtins schema a property | flexget/plugins/operate/disable_builtins.py | flexget/plugins/operate/disable_builtins.py | from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.plugin import priority, register_plugin, plugins
log = logging.getLogger('builtins')
def all_builtins():
"""Helper function to return an iterator over all builtin plugins."""
return (plug... | Python | 0.000003 | @@ -738,24 +738,154 @@
ema.
-%0A schema = %7B%0A
+ We need to change plugin loading to not access the schema until all plugins are loaded.%0A @property%0A def schema(self):%0A return %7B%0A
@@ -903,32 +903,36 @@
: %5B%0A
+
+
%7B'type': 'boolea
@@ -936,16 +936,20 @@
lean'%7D... |
902953d99259b621b0ca2f69d17bd5563b3defbc | Fix bugs in mopidy.models revealed by new tests | mopidy/models.py | mopidy/models.py | from copy import copy
class Artist(object):
"""
:param uri: artist URI
:type uri: string
:param name: artist name
:type name: string
"""
def __init__(self, uri=None, name=None):
self._uri = None
self._name = name
@property
def uri(self):
"""The artist URI. ... | Python | 0 | @@ -221,20 +221,19 @@
._uri =
-None
+uri
%0A
@@ -5884,16 +5884,27 @@
f.tracks
+%5Bstart:end%5D
, range(
|
790be842b1c2e752210d5328dad05acb05d337bb | add minimal test for serial.theaded | test/test_threaded.py | test/test_threaded.py | Python | 0.000015 | @@ -0,0 +1,1406 @@
+#!/usr/bin/env python%0A#%0A# This file is part of pySerial - Cross platform serial port support for Python%0A# (C) 2016 Chris Liechti %3Ccliechti@gmx.net%3E%0A#%0A# SPDX-License-Identifier: BSD-3-Clause%0A%22%22%22%5C%0ATest serial.threaded related functionality.%0A%22%22%22%0A%0Aimport os%0Aimp... | |
70683aabe3cebda02db62fc254b7ec7532a50618 | Add test_config.sample.py. | test_config.sample.py | test_config.sample.py | Python | 0 | @@ -0,0 +1,37 @@
+CREDENTIAL_FILE = ''%0ASHEET_NAME = ''%0A
| |
73603c24ee3955c331bcfe0ff0dba7d0b04b51b4 | Change Content-Encoding to gzip in memory_cache_http_server. | tools/telemetry/telemetry/core/memory_cache_http_server.py | tools/telemetry/telemetry/core/memory_cache_http_server.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import BaseHTTPServer
from collections import namedtuple
import mimetypes
import os
import SimpleHTTPServer
import SocketServer
import sys
import zlib
B... | Python | 0.000163 | @@ -216,16 +216,28 @@
edtuple%0A
+import gzip%0A
import m
@@ -310,19 +310,24 @@
ort
-sys
+StringIO
%0Aimport
zlib
@@ -322,20 +322,19 @@
%0Aimport
-zlib
+sys
%0A%0A%0AByteR
@@ -2181,15 +2181,12 @@
', '
-deflate
+gzip
')%0A
@@ -5490,44 +5490,203 @@
-response = zlib.compress(response, 9
+sio = StringIO.... |
499adce8b5c23d60073d4c92259e611609ee0c61 | Add initial draft script to analyse Maven deps | states/common/maven/artifacts/check_dependencies.py | states/common/maven/artifacts/check_dependencies.py | Python | 0 | @@ -0,0 +1,636 @@
+#!/usr/bin/env python%0A%0Aimport subprocess as sub%0Aimport yaml%0Aimport re%0A%0Adistrib_pom_path = '/home/uvsmtid/Works/maritime-singapore.git/clearsea-distribution/pom.xml'%0A%0A# Resolve (download) all dependencies locally so that next command%0A# can work offline.%0Asub.check_call(%0A %5B%0A... | |
1a065a251c3337ae7741af1916c51f2edcb9180f | add db.py | www/transwarp/db.py | www/transwarp/db.py | Python | 0.000002 | @@ -0,0 +1,1165 @@
+#/usr/bin/python%0A#_*_ coding:utf-8 _*_%0A%0Aimport threading%0A%0Aclass _Engine(object):%0A %22%22%22%0A %E6%95%B0%E6%8D%AE%E5%BA%93%E5%BC%95%E6%93%8E%E5%AF%B9%E8%B1%A1%0A %22%22%22%0A def __init__(self, connect):%0A self._connect = connect%0A def connect(self):%0A ret... | |
6fd75772efac321517a1d8c01addfa5cbbf7caf0 | Add test file for user functions. | tests/db/user_test.py | tests/db/user_test.py | Python | 0 | @@ -0,0 +1,694 @@
+from okcupyd.db import user%0A%0Adef test_have_messaged_before(T):%0A message_thread_model = T.factory.message_thread()%0A assert user.have_messaged_by_username(%0A message_thread_model.initiator.handle,%0A message_thread_model.respondent.handle%0A )%0A assert user.have_mess... | |
6d2480c5817a8ba7a4a810378ce8fabe0ede3cbf | check YAML examples | tests/testexamples.py | tests/testexamples.py | Python | 0.000001 | @@ -0,0 +1,210 @@
+#!/usr/bin/python%0A%0Aimport os%0Aimport yaml%0A%0Adef test_examples():%0A for filename in os.listdir(%22examples/%22):%0A with open(os.path.join(%22examples%22, filename)) as stream:%0A print(yaml.load(stream))%0A
| |
a9bb7c7c929b0e182160a700e0a3f23dc3e81765 | Update and rename exercises to exercises/12.py | exercises/12.py | exercises/12.py | Python | 0.000001 | @@ -0,0 +1,264 @@
+'''%0A%0ADefine a procedure histogram() that takes a list of%0Aintegers and prints a histogram to the screen.%0AFor example, histogram(%5B4, 9, 7%5D) should print the following:%0A%0A****%0A*********%0A*******%0A%0A'''%0A%0A%0Adef histogram(lst):%0A for item in lst:%0A print(item * '*')%0A
| |
a0d2e58a6eecf3427646f311e638c359706e806a | Add Energenie example code | energenie.py | energenie.py | Python | 0 | @@ -0,0 +1,1154 @@
+import RPi.GPIO as GPIO%0Afrom time import sleep%0A%0Abit1 = 11%0Abit2 = 15%0Abit3 = 16%0Abit4 = 13%0A%0AGPIO.setmode(GPIO.BOARD)%0AGPIO.setwarnings(False)%0A%0AGPIO.setup(bit1, GPIO.OUT)%0AGPIO.setup(bit2, GPIO.OUT)%0AGPIO.setup(bit3, GPIO.OUT)%0AGPIO.setup(bit4, GPIO.OUT)%0A%0AGPIO.setup(18, GPIO.... | |
c086b750c30c3a265821be02364f8670d71ebdc4 | remove "free" from list of customer types | corehq/apps/domain/forms.py | corehq/apps/domain/forms.py | import re
from django import forms
from django.contrib.auth.models import User
import django_tables as tables
from django.core.validators import validate_email
from django.forms.fields import ChoiceField, CharField
from django.utils.encoding import smart_str
from corehq.apps.domain.middleware import _SESSION_KEY_SELE... | Python | 0.000302 | @@ -4422,84 +4422,25 @@
=(('
-free', 'Free'), ('basic', 'Basic'),%0A
+basic', 'Basic'),
('p
|
8646929a913b77438bf58e48e672ea68492d3ac1 | Mark third_party/accessibility-developer-tools as a known license info issue. | android_webview/tools/known_issues.py | android_webview/tools/known_issues.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""List of known-incompatibly-licensed directories for Android WebView.
This is not used by the webview_licenses tool itself; it is effectively a
"cache... | Python | 0.000178 | @@ -1121,16 +1121,83 @@
SUES = %5B
+%0A 'third_party/accessibility-developer-tools', # crbug.com/165901%0A
%5D%0A%0AKNOWN
|
a5440305173c218ec785b0d5a2dfa8b02bb0b731 | Add package: py-fava (#21275) | var/spack/repos/builtin/packages/py-fava/package.py | var/spack/repos/builtin/packages/py-fava/package.py | Python | 0 | @@ -0,0 +1,1932 @@
+# Copyright 2013-2021 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 PyFava(PythonPackage):%0A %22%22%22Fava is a web interf... | |
c404981d3a1d18248d6fa2fa18cc16037353d377 | Update main.py | lib/main.py | lib/main.py | try:
import sys
import re
import subprocess
import os
from core.configparser import ConfigParser
from nmap import Nmap
from mount_detect import MountDetect
from core.threadpool import Worker,ThreadPool
from core.common import *
except ImportError,e:
import sys
sys.stdout.write("%s\n" %e)
... | Python | 0.000001 | @@ -1412,16 +1412,17 @@
h.isfile
+(
pkg):%0A
|
31342e58f914c057404fd35edfff42b95e5fb051 | Test #2 (with the current GitLab API syntax) | gitlabform/gitlabform/test/test_project_settings.py | gitlabform/gitlabform/test/test_project_settings.py | Python | 0 | @@ -0,0 +1,1153 @@
+import pytest%0A%0Afrom gitlabform.gitlabform import GitLabForm%0Afrom gitlabform.gitlabform.test import create_group, create_project_in_group, get_gitlab, GROUP_NAME%0A%0APROJECT_NAME = 'project_settings_project'%0AGROUP_AND_PROJECT_NAME = GROUP_NAME + '/' + PROJECT_NAME%0A%0A%0A@pytest.fixture(sco... | |
caf135f6c94146038ac9d9e77a808e30ea52f900 | make pyroma a runnable module (#62) | pyroma/__main__.py | pyroma/__main__.py | Python | 0 | @@ -0,0 +1,59 @@
+from . import main%0A%0A%0Aif __name__ == %22__main__%22:%0A main()%0A
| |
25a1d94b45980fbc78c162af2c81ad807ee954c9 | add test_vpr.py, add test functions and stubs | wradlib/tests/test_vpr.py | wradlib/tests/test_vpr.py | Python | 0 | @@ -0,0 +1,2037 @@
+#!/usr/bin/env python%0A# -------------------------------------------------------------------------------%0A# Name: test_vpr.py%0A# Purpose: testing file for the wradlib.vpr module%0A#%0A# Authors: wradlib developers%0A#%0A# Created: 26.02.2016%0A# Copyright: (c) wradlib develop... | |
9ad3b4e6ff5ec500fe1feeb841c4fe00e9267d19 | add sh_quote.py | python/sh_quote.py | python/sh_quote.py | Python | 0.000004 | @@ -0,0 +1,957 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A# Copyright (c) 2014 Tristan Cavelier %3Ct.cavelier@free.fr%3E%0A# This program is free software. It comes without any warranty, to%0A# the extent permitted by applicable law. You can redistribute it%0A# and/or modify it under the terms of the Do W... | |
bfd786dad5b19d46c8ce956b904fe23c378c9202 | Patch usage of period in key. (#4020) | src/sentry/tasks/merge.py | src/sentry/tasks/merge.py | """
sentry.tasks.merge
~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import logging
from django.db import DataError, IntegrityError, router, transaction
from django.db.models impo... | Python | 0 | @@ -5457,24 +5457,28 @@
'
+new_
group_id
.old': g
@@ -5473,15 +5473,15 @@
p_id
-.old':
+': new_
grou
@@ -5503,24 +5503,28 @@
'
+old_
group_id
.new': n
@@ -5519,27 +5519,19 @@
p_id
-.new': new_
+':
group.id
%0A
@@ -5518,32 +5518,33 @@
up_id': group.id
+,
%0A %7D)%0A
|
2273dfcdb2f311f39e1bffe4f40cdc6e3b753155 | add buildOffsetMap.py | buildOffsetMap.py | buildOffsetMap.py | Python | 0.000001 | @@ -0,0 +1,724 @@
+import sys, os, json%0Aimport frm%0A%0ADATA_PATH = %22data%22%0A%0Adef main():%0A%09if len(sys.argv) != 2:%0A%09%09print %22USAGE: %25s IMAGES_LIST%22 %25 sys.argv%5B0%5D%0A%09%09sys.exit(1)%0A%0A%09images = list(open(sys.argv%5B1%5D))%0A%09imageInfo = %7B%7D%0A%0A%09for image in images:%0A%09%09imag... | |
a62b4f70816b831a16973e861449b0c76761cf52 | Create Odd_Even_Linked_List.py | data_structures/Linked_list/Python/Odd_Even_Linked_List.py | data_structures/Linked_list/Python/Odd_Even_Linked_List.py | Python | 0 | @@ -0,0 +1,709 @@
+'''%0AGiven the head of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return the reordered list.%0A'''%0Aclass Solution(object):%0A def oddEvenList(self, head):%0A if head is None: return None%0A if head.next is None:... | |
dd0e335574afd936b5849186202aedc8500f2c5b | add build-front | organization/core/management/commands/build-front.py | organization/core/management/commands/build-front.py | Python | 0.000017 | @@ -0,0 +1,1660 @@
+# -*- coding: utf-8 -*-%0A#%0A# Copyright (c) 2016-2017 Ircam%0A# Copyright (c) 2016-2017 Guillaume Pellerin%0A# Copyright (c) 2016-2017 Emilie Zawadzki%0A%0A# This file is part of mezzanine-organization.%0A%0A# This program is free software: you can redistribute it and/or modify%0A# it under the te... | |
9b5db6d8edd9c65d5811f6bd64147e9d1b17b8c9 | Remove an unneeded platform check in lint_test_expectations.py | Tools/Scripts/webkitpy/layout_tests/lint_test_expectations.py | Tools/Scripts/webkitpy/layout_tests/lint_test_expectations.py | # Copyright (C) 2012 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | Python | 0.000016 | @@ -2048,160 +2048,8 @@
s):%0A
- # FIXME: Remove this when we remove the --chromium flag (crbug.com/245504).%0A if options.platform == 'chromium':%0A options.platform = None%0A%0A
|
cc2343a564572e6c0bd94279bf3907e9e85da79b | Create version.py | plotly-1.2.9/plotly/version.py | plotly-1.2.9/plotly/version.py | Python | 0.000001 | @@ -0,0 +1,22 @@
+__version__ = '1.2.9'%0A
| |
65239ce01df89ceaaed989b28f4623ac521ce2c3 | Add download_stats script | download_stats.py | download_stats.py | Python | 0 | @@ -0,0 +1,990 @@
+import argparse%0Afrom xmlrpclib import ServerProxy%0Aimport pickle%0A%0Aparser = argparse.ArgumentParser()%0Aparser.add_argument(%22-n%22, type=int)%0Aparser.add_argument(%22--package-list%22,%0A action=%22store%22)%0Aargs = parser.parse_args()%0A%0Aurl = 'https://pypi.python.org/... | |
95a26454173b59c8609ddb81027ed71005e9e86c | add module to handle exceptions | cno/misc/tools.py | cno/misc/tools.py | Python | 0.000001 | @@ -0,0 +1,170 @@
+__all__ = %5B%22CNOError%22%5D%0A %0A%0Aclass CNOError(Exception):%0A def __init__(self, value):%0A self.value = value%0A def __str__(self):%0A return repr(self.value)%0A%0A
| |
e1fc330ae40c5ca87958538982849db051f2947c | fix issue #55 - erase_data fails on Python 3.x | colorama/win32.py | colorama/win32.py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
# from winbase.h
STDOUT = -11
STDERR = -12
try:
import ctypes
from ctypes import LibraryLoader
windll = LibraryLoader(ctypes.WinDLL)
from ctypes import wintypes
except (AttributeError, ImportError):
windll = None
SetCon... | Python | 0.000001 | @@ -4059,16 +4059,25 @@
har(char
+.encode()
)%0A
|
bb58564dc400e91c132e3a26532595ec9de73958 | Create managers.py | managers.py | managers.py | Python | 0.000001 | @@ -0,0 +1,496 @@
+from django.db import models%0A%0A%0Aclass VisibilityManagerMixin(object):%0A %22%22%22%0A This manager should be used with a model that implements the Hideable%0A mixin.%0A %22%22%22%0A%0A def __init__(self, *args, **kwargs):%0A self.visible = kwargs.pop('visible', True)%0A ... | |
fbaaf3ba027ee9d18df7b1f48533c8847f084381 | Add harmonic mean estimator. | harmonicmean.py | harmonicmean.py | Python | 0.000003 | @@ -0,0 +1,2691 @@
+import numpy.random%0Aimport numpy as np%0Aimport lib%0Afrom math import log%0A%0A%0Adef compute_harmonicmean(lnlike_post, posterior_sample=None, lnlikefunc=None,%0A lnlikeargs=(), **kwargs):%0A %22%22%22%0A Computes the harmonic mean estimate of the marginal likelihood... | |
156a31c7aef3dfc07f5e3b0998b0957308abdd16 | Create getPrice.py | src/getPrice.py | src/getPrice.py | Python | 0.000001 | @@ -0,0 +1,939 @@
+import requests%0Aimport requests.auth%0Aimport time%0Aimport json%0A%0Adef getPrices():%0A print %22Grabbing price...%22%0A dogeprice = parsePrices(%22doge%22)%0A btcprice = parsePrices(%22btc%22)%0A ltcprice = parsePrices(%22ltc%22)%0A rddprice = parsePrices(%22rd... | |
082f11f5a24efd21f05b1d7cc7f1b1f1ab91fb0c | Add exercise 13: couplage | prologin-2014/13_couplage.py | prologin-2014/13_couplage.py | Python | 0.001185 | @@ -0,0 +1,1645 @@
+# http://www.prologin.org/training/challenge/demi2014/couplage%0Afrom sys import stdin%0A%0AnbBowlsFirst = int(stdin.readline())%0AnbBowlsSecond = int(stdin.readline())%0AbowlsFirst = %5Bint(x) for x in stdin.readline().split()%5D%0AbowlsSecond = %5Bint(x) for x in stdin.readline().split()%5D%0A%0Ad... | |
f8a0aa92c8e19bc11f8a609733644afe0efed5c8 | Update test script to do match testing. | decompose_test.py | decompose_test.py | Python | 0 | @@ -0,0 +1,1663 @@
+from util.decompose_graph import decompose_graph%0A%0Afrom core.himesis_utils import expand_graph, set_do_pickle, set_compression%0A%0Aset_do_pickle(True)%0Aset_compression(6)%0A%0Afile_name = %22226482067288742734644994685633991185819%22%0A%0Agraph = expand_graph(file_name)%0A%0Aprint(graph.name)%0... | |
8c98e313caeb82ee710d56399d5de7cf1eb1f7df | Add DNA Coding | python/src/dna/dna_coding.py | python/src/dna/dna_coding.py | Python | 0.000595 | @@ -0,0 +1,1083 @@
+import pandas as pd%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0Aimport src.mylib.mfile as mfile%0Afrom matplotlib import style%0A%0Astop =int('101010', 2) #101010 I Ching 63 After Completion%0Abefo =int('010101', 2) #101010 I Ching 64 Before Completion%0A%0Aguai =int('111110', 2) #10101... | |
1be041fd9bfc856fd59fba52501823d80d3ff037 | Create setup.py | neutron/setup.py | neutron/setup.py | Python | 0.000001 | @@ -0,0 +1 @@
+%0A
| |
a4f030cf10683aa949550e9922c3ea72421cf392 | Update PCI configuration options | nova/conf/pci.py | nova/conf/pci.py | # needs:check_opt_group_and_type
# Copyright (c) 2013 Intel, Inc.
# Copyright (c) 2013 OpenStack Foundation
# 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
#... | Python | 0.000002 | @@ -1330,59 +1330,246 @@
ame%22
-%0A * %22product_id%22%0A * %22vendor_id%22%0A * %22device_type%22
+: Name of the PCI alias.%0A * %22product_id%22: Product ID of the device in hexadecimal.%0A * %22vendor_id%22: Vendor ID of the device in hexadecimal.%0A * %22device_type%22: Type of PCI device. Valid values are:... |
08122e57235e836dbfd4230e9e3ad3f7c54072ff | add simple debug callback test case | pycurl/tests/test_debug.py | pycurl/tests/test_debug.py | Python | 0 | @@ -0,0 +1,209 @@
+# $Id$%0A%0Aimport pycurl%0A%0Adef test(**args):%0A print args%0A%0Ac = pycurl.init()%0Ac.setopt(pycurl.URL, 'http://curl.haxx.se/')%0Ac.setopt(pycurl.VERBOSE, 1)%0Ac.setopt(pycurl.DEBUGFUNCTION, test)%0Ac.perform()%0Ac.cleanup()%0A
| |
b70f16c8c9c967f64d45937fc057f0b3c09fd912 | test updates | searx/tests/test_webapp.py | searx/tests/test_webapp.py | # -*- coding: utf-8 -*-
import json
from urlparse import ParseResult
from mock import patch
from searx import webapp
from searx.testing import SearxTestCase
class ViewsTestCase(SearxTestCase):
def setUp(self):
webapp.app.config['TESTING'] = True # to get better error messages
self.app = webapp.... | Python | 0 | @@ -1749,17 +1749,41 @@
st %3C
-b
+span class=%22highlight%22
%3ETest%3C/
-b
+span
%3E%3C/a
@@ -1899,17 +1899,41 @@
st %3C
-b
+span class=%22highlight%22
%3Etest%3C/
-b
+span
%3E co
|
6e42855d527976dd8b1cdb272502ce3aa76f8c6e | Add dbee abstract base class. | dbeekeeper/dbee/base.py | dbeekeeper/dbee/base.py | Python | 0 | @@ -0,0 +1,4068 @@
+# Copyright 2013 VMware, Inc.%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... | |
7e96013f21bbb5003b30da1e04833dcf58650602 | Implement a ThriftHandler for tornado | freenoted/tasks/tornado_thrift.py | freenoted/tasks/tornado_thrift.py | Python | 0.000517 | @@ -0,0 +1,595 @@
+from __future__ import absolute_import%0A%0Aimport tornado.web%0Afrom thrift.transport.TTransport import TMemoryBuffer%0Afrom thrift.protocol.TBinaryProtocol import TBinaryProtocol%0A%0A%0Aclass TornadoThriftHandler(tornado.web.RequestHandler):%0A def initialize(self, processor):%0A self.pr... | |
c66e64556747736c1ee7461aa6ee8780a330481b | add sparse_to_dense_test | caffe2/python/sparse_to_dense_test.py | caffe2/python/sparse_to_dense_test.py | Python | 0.000006 | @@ -0,0 +1,3021 @@
+# Copyright (c) 2016-present, Facebook, Inc.%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# Unl... | |
29e8dce6fc2956dc9f942eca41fdb632c382fe8e | Create pylsy.py | pylsy/tests/pylsy.py | pylsy/tests/pylsy.py | Python | 0.000001 | @@ -0,0 +1,3050 @@
+# -*- coding: utf-8 -*-%0A%0Afrom __future__ import print_function%0A%0A%0Aclass PylsyTable(object):%0A%0A def __init__(self, attributes):%0A self.StrTable = %22%22%0A self.Attributes = attributes%0A self.Table = %5B%5D%0A self.AttributesLength = %5B%5D%0A self.... | |
d60c1f9a6e56472611a96779462b42e8505e7905 | Convert a PDF document to JPEG/PNG image via /pdftoimg endpoint | python/pdf_to_img.py | python/pdf_to_img.py | Python | 0.999999 | @@ -0,0 +1,463 @@
+import requests%0Aimport json%0A# Convert a PDF document to JPEG/PNG image via /pdftoimg endpoint - https://pixlab.io/cmd?id=pdftoimg%0Areq = requests.get('https://api.pixlab.io/pdftoimg',params=%7B%0A 'src':'https://www.getharvest.com/downloads/Invoice_Template.pdf',%0A 'export': 'jpeg',%0A 'key'... | |
198b54c9ff796cc98cccfdc530f0111739901b0d | Create base-7.py | Python/base-7.py | Python/base-7.py | Python | 0.000022 | @@ -0,0 +1,774 @@
+# Time: O(1)%0A# Space: O(1)%0A%0A# Given an integer, return its base 7 string representation.%0A#%0A# Example 1:%0A# Input: 100%0A# Output: %22202%22%0A# Example 2:%0A# Input: -7%0A# Output: %22-10%22%0A# Note: The input will be in range of %5B-1e7, 1e7%5D.%0A%0Aclass Solution(object):%0A def co... | |
50dc018891511ce34b4177a43cfcd678456444cf | test of quasiisothermaldf's meanvR | nose/test_qdf.py | nose/test_qdf.py | Python | 0 | @@ -0,0 +1,827 @@
+# Tests of the quasiisothermaldf module%0Aimport numpy%0A#fiducial setup uses these%0Afrom galpy.potential import MWPotential%0Afrom galpy.actionAngle import actionAngleAdiabatic, actionAngleStaeckel%0Afrom galpy.df import quasiisothermaldf%0AaAA= actionAngleAdiabatic(pot=MWPotential,c=True)%0AaAS= a... | |
660e53fa4505782a2d1484cc0b6e598edc851df0 | Initialize P05_stylingExcel | books/AutomateTheBoringStuffWithPython/Chapter12/P05_stylingExcel.py | books/AutomateTheBoringStuffWithPython/Chapter12/P05_stylingExcel.py | Python | 0.000002 | @@ -0,0 +1,351 @@
+# This program uses the OpenPyXL module to manipulate Excel documents%0A%0Aimport openpyxl%0Afrom openpyxl.styles import Font, Style%0A%0Awb = openpyxl.Workbook()%0Asheet = wb.get_sheet_by_name(%22Sheet%22)%0A%0Aitalic24Font = Font(size=24, italic=True)%0AstyleObj = Style(font=italic24Font)%0Asheet%5... | |
fb5ed0ea066c9bdb801a95e50d78529addffbed8 | add twitter url to video URL email | dj/scripts/email_url.py | dj/scripts/email_url.py | #!/usr/bin/python
# email_url.py
# emails the video URL to the presenters
from email_ab import email_ab
class email_url(email_ab):
ready_state = 7
subject_template = "[{{ep.show.name}}] Video up: {{ep.name}}"
body_body = """
The video of your talk is posted:
{{url}}
Look at it, make sure ... | Python | 0.000003 | @@ -236,20 +236,16 @@
y = %22%22%22%0A
-
The vide
@@ -282,21 +282,43 @@
%7B%7Burl%7D%7D%0A
-%0A
+%7B%25 if ep.state == 7 %25%7D%0A
Look at
@@ -361,39 +361,42 @@
ight
-, let me know if it is OK.%0A
+ and the audio sounds reasonable.%0A
If y
@@ -500,17 +500,9 @@
em.%0A
- %0A
+%0A
To a
@@ -90... |
b47369d43a0a85ac2bc32bfa77c6a4d9074ce700 | Add basic test case for retrieve_dns module | test/test_retrieve_dns.py | test/test_retrieve_dns.py | Python | 0 | @@ -0,0 +1,1606 @@
+import logging%0Aimport os%0Aimport tempfile%0Aimport unittest%0A%0Aimport mock%0A%0Aimport bin.retrieve_dns%0A%0A%0Alogging.basicConfig(level=logging.INFO)%0A%0A%0Aclass RetrieveDnsTestCase(unittest.TestCase):%0A%0A def setUp(self):%0A # Mock out logging%0A mock.patch('bin.retrieve... | |
4f9aaa4809c0ff083393088e205a48c3197b46f2 | add forgoten '\n' in `Usage` output | platform/platform-resources/src/launcher.py | platform/platform-resources/src/launcher.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket
import struct
import sys
import os
import time
# see com.intellij.idea.SocketLock for the server side of this interface
RUN_PATH = u'$RUN_PATH$'
CONFIG_PATH = u'$CONFIG_PATH$'
args = []
skip_next = False
for i, arg in enumerate(sys.argv[1:]):
if arg ==... | Python | 0.003142 | @@ -522,16 +522,18 @@
%3Cright%3E
+%5Cn
' +%0A
|
b97a9571478dc8c919e072734816b412dadc0da9 | Add maths plugin | plugins/maths.py | plugins/maths.py | Python | 0.000001 | @@ -0,0 +1,823 @@
+import io%0Aimport unittest%0A%0Afrom sympy.parsing import sympy_parser%0A%0Aclass Plugin:%0A def on_command(self, bot, msg, stdin, stdout, reply):%0A expr = %22 %22.join(msg%5B%22args%22%5D%5B1:%5D)%0A expr = sympy_parser.parse_expr(expr)%0A print(expr.evalf(), file=stdout)%0... | |
8ab44294c0dd7b95102bfa1d9e8437067813cd0f | Add basic document parser | vc2xlsx/doc_parser.py | vc2xlsx/doc_parser.py | Python | 0.000004 | @@ -0,0 +1,1156 @@
+import parsley%0A%0Aclass Goto (object):%0A%09def __init__(self, x, y):%0A%09%09self.x = x%0A%09%09self.y = y%0A%0A%09def __repr__(self):%0A%09%09return %22Goto(%7B%7D, %7B%7D)%22.format(repr(self.x), repr(self.y))%0A%0Aclass Entry (object):%0A%09def __init__(self, value):%0A%09%09self.value = value... | |
01bcda4326dc0204798f268bb1c60f06526aaba3 | add freebsd shadow module | salt/modules/freebsd_shadow.py | salt/modules/freebsd_shadow.py | Python | 0 | @@ -0,0 +1,1851 @@
+'''%0AManage the password database on FreeBSD systems%0A'''%0A%0A# Import python libs%0Aimport os%0Atry:%0A import pwd%0Aexcept ImportError:%0A pass%0A%0A# Import salt libs%0Aimport salt.utils%0A%0A%0Adef __virtual__():%0A return 'shadow' if __grains__.get('os', '') == 'FreeBSD' else False%... | |
9dab373023fa6b7767cd7555a533161752205eda | Test a weighted affine solver. | scripts/0-weighted-affine.py | scripts/0-weighted-affine.py | Python | 0.001095 | @@ -0,0 +1,429 @@
+#!/usr/bin/python%0A%0Aimport sys%0A%0Asys.path.append('../lib')%0Aimport transformations%0A%0Av0 = %5B%5B0, 1031, 1031, 0%5D, %5B0, 0, 1600, 1600%5D%5D%0Av1 = %5B%5B675, 826, 826, 677%5D, %5B55, 52, 281, 277%5D%5D%0A#weights = %5B1.0, 1.0, 1.0, 1.0%5D%0Aweights = %5B0.1, 0.01, 0.1, 0.2%5D%0Aprint %2... | |
260e0ef2bc37750dccea47d30110221c272e757a | Add script for automating analysis for all corpora | run_all_corpora.py | run_all_corpora.py | Python | 0 | @@ -0,0 +1,1180 @@
+import os%0Aimport argparse%0Aimport subprocess%0A%0Aparser = argparse.ArgumentParser()%0Aparser.add_argument(%22corpusdir%22, help = %22Path to the directory containing corpus directories%22)%0Aparser.add_argument(%22script%22, help = %22name of the script to be run%22)%0Aargs = parser.parse_args()... | |
593941ec42918a389a348a5d35e8c5033bb34e73 | Add 8ball plugin | plugins/ball8.py | plugins/ball8.py | Python | 0 | @@ -0,0 +1,1360 @@
+import random%0Afrom plugin import CommandPlugin, PluginException%0A%0A%0Aclass Ball8(CommandPlugin):%0A %22%22%22%0A 8ball command (by javipepe :))%0A %22%22%22%0A%0A def __init__(self, bot):%0A CommandPlugin.__init__(self, bot)%0A self.triggers = %5B'8ball'%5D%0A s... | |
d22ca6dbf7e8aa98b0f580b7972e157894925365 | Fix test output for combining filename and extension | tests/test_auto_moving.py | tests/test_auto_moving.py | import os
import shutil
from nose.tools import assert_equal
from .base import BaseTest
class TestAutoMoving(BaseTest):
organise = True
def teardown(self):
super(TestAutoMoving, self).teardown()
shutil.rmtree(self.organised)
os.mkdir(self.organised)
def test_using_organise_uses_... | Python | 0.000003 | @@ -1385,17 +1385,16 @@
ename, '
-.
'.join(%5B
|
98c658822cf6782ca0907ab7a68691922e701aa6 | Add unittest for pytesseract | tests/test_pytesseract.py | tests/test_pytesseract.py | Python | 0.000001 | @@ -0,0 +1,560 @@
+import unittest%0Aimport io%0Aimport pytesseract%0Aimport numpy as np%0Afrom wand.image import Image as wandimage%0A%0Aclass TestPytesseract(unittest.TestCase):%0A def test_tesseract(self):%0A # Open pdf with Wand%0A with wandimage(filename='/input/tests/data/test.pdf') as wand_image... | |
f8d8580dfffee35236478ec75116b291499c085c | Create maximum-average-subarray-i.py | Python/maximum-average-subarray-i.py | Python/maximum-average-subarray-i.py | Python | 0.999246 | @@ -0,0 +1,852 @@
+# Time: O(n)%0A# Space: O(1)%0A%0A# Given an array consisting of n integers,%0A# find the contiguous subarray of given length k that has the maximum average value.%0A# And you need to output the maximum average value.%0A#%0A# Example 1:%0A# Input: %5B1,12,-5,-6,50,3%5D, k = 4%0A# Output: 12.75%0A# E... | |
164ccb9206885b216e724b3618ebae5601ab0ac0 | Add parallel execution utility module. | parallel.py | parallel.py | Python | 0 | @@ -0,0 +1,199 @@
+import multiprocessing as mp%0A%0A%0Adef run_func(func, args, parallel=False):%0A if parallel:%0A mp.Pool(mp.cpu_count() - 1).map(func, args)%0A else:%0A for arg in args:%0A func(arg)%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.