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 |
|---|---|---|---|---|---|---|---|
c988d2b797661412983503fecafe5755c0540356 | Update script usage declaration method | tools/pfw-criteria-test/testGenerator/TestLauncher.py | tools/pfw-criteria-test/testGenerator/TestLauncher.py | #
# INTEL CONFIDENTIAL
# Copyright 2014 Intel
# Corporation All Rights Reserved.
#
# The source code contained or described herein and all documents related to
# the source code ("Material") are owned by Intel Corporation or its suppliers
# or licensors. Title to the Material remains with Intel Corporation or its
# sup... | Python | 0.000002 | @@ -4120,24 +4120,94 @@
criptFile)%0A%0A
+ self.__availableLaunchType = %5B%22asynchronous%22, %22synchronous%22%5D%0A%0A
self
@@ -6180,30 +6180,26 @@
script,
-isAsynchronous
+launchType
) = self
@@ -6225,16 +6225,453 @@
tName%5D%0A%0A
+ if not launchType in self.__availableLaunchType:%0A ... |
96d6dea52b4ed0f793364e8641ffbb452a23c599 | Extend tests use cases | partner_ref_unique/tests/test_res_partner_ref.py | partner_ref_unique/tests/test_res_partner_ref.py | # Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests import common
from odoo.exceptions import ValidationError
class TestResPartnerRefUnique(common.SavepointCase):
@classmethod
def setUpClass(cls):
super(TestResPartnerRefUniq... | Python | 0.000001 | @@ -398,16 +398,20 @@
+cls.
partner_
@@ -462,16 +462,20 @@
tner1 =
+cls.
partner_
@@ -553,16 +553,20 @@
tner2 =
+cls.
partner_
@@ -890,32 +890,183 @@
f.partner2.ref)%0A
+ # Here there shouldn't be any problem%0A self.partner_obj.create(%7B%0A 'name': 'other',%0A 're... |
0581e1731143c0acfea0c988cae4e19033f4aa1c | Update tests of demo projects | tests/test_demo.py | tests/test_demo.py | from django import VERSION
from lino import PYAFTER26
from lino.utils.pythontest import TestCase
class TestCase(TestCase):
def test_translate(self):
self.run_django_manage_test('docs/dev/translate')
# def test_hello(self):
# self.run_django_manage_test('docs/tutorials/hello')
# def tes... | Python | 0 | @@ -4604,36 +4604,39 @@
nage_test('lino_
-book
+welfare
/projects/gerd')
@@ -4632,12 +4632,107 @@
ects/gerd')%0A
+%0A def test_gerd(self):%0A self.run_django_manage_test('lino_welfare/projects/mathieu')%0A
|
224ba75113c0cff1f08a04bfb7d9dc099ef7925c | Fix tests on travis (possibly) | tests/test_file.py | tests/test_file.py | from unittest import TestCase
from mock import patch, mock_open, MagicMock
import pconf
from pconf.store.file import File
TEST_FILE_PATH = 'test'
TEST_FILE_DICT = {'file': 'result'}
TEST_FILE_RAW = '{"file": "result"}'
TEST_FILE_JSON = '{"file": "result"}'
def throw_ioerror(*args, **kwargs):
raise IOError('test... | Python | 0 | @@ -356,32 +356,27 @@
@patch('
-pconf.store.file
+__builtin__
.open')%0A
@@ -528,32 +528,27 @@
@patch('
-pconf.store.file
+__builtin__
.open',
@@ -817,38 +817,50 @@
@patch('
-pconf.store.file.open'
+__builtin__.open'.format(__name__)
, side_e
@@ -1148,32 +1148,27 @@
@patch('
-pconf.store.file
+__builtin__
.ope... |
62bfc80e55b2e72351f8bd20a6b5d2954632b01c | Remove the implicit default unregister event handler from all components. | circuits/core/components.py | circuits/core/components.py | # Package: components
# Date: 11th April 2010
# Author: James Mills, prologic at shortcircuit dot net dot au
"""
This module defines the BaseComponent and its subclass Component.
"""
from itertools import chain
from types import MethodType
from inspect import getmembers
from collections import Callable
from .... | Python | 0 | @@ -5852,163 +5852,8 @@
lf%0A%0A
- @handler('unregister')%0A def _on_unregister(self, component):%0A if component is not self:%0A return%0A return self.unregister()%0A%0A
|
550c7b5b36c7f8c35eb31c3a32887c59d3519f84 | Update pytest for new deepclean function (1 fewer input, reverse scan) | tests/test_load.py | tests/test_load.py | # -*- coding: utf-8 -*-
"""
Created 2/19/19
@author: cdeline
Using pytest to create unit tests for load.py
to run unit tests, run pytest from the command line in the bifacial_radiance directory
"""
import bifacial_radiance
import os, pytest
# try navigating to tests directory so tests run from here.
try:
os.c... | Python | 0 | @@ -2163,13 +2163,8 @@
, 2,
- 270,
aut
@@ -2236,17 +2236,17 @@
esults%5B5
-5
+4
%5D == pyt
|
394738e2a21737c23fdc67be399691341ca422fa | Add test for JSON preconvert step | tests/test_main.py | tests/test_main.py | import json
import os
import sys
from io import BytesIO, TextIOWrapper
import pytest
from hypothesis_auto import auto_pytest_magic
from isort import main
from isort._version import __version__
from isort.settings import DEFAULT_CONFIG, Config
from isort.wrap_modes import WrapModes
auto_pytest_magic(main.sort_imports... | Python | 0 | @@ -26,16 +26,46 @@
ort sys%0A
+from datetime import datetime%0A
from io
@@ -2174,16 +2174,231 @@
== %22%22%0A%0A%0A
+def test_preconvert():%0A assert main._preconvert(frozenset(%5B1, 1, 2%5D)) == %5B1, 2%5D%0A assert main._preconvert(WrapModes.GRID) == %22GRID%22%0A with pytest.raises(TypeError):%0A ... |
edea6cec717d2bbfd0dc078a447f2bd2a7e90054 | Add test for when local is empty and s3 is populated | tests/test_main.py | tests/test_main.py | # -*- coding: utf-8 -*-
import os
import shutil
import tempfile
import boto3
from faker import Faker
import moto
from s3backup import main
from s3backup.local_sync_client import LocalSyncClient
from s3backup.s3_sync_client import S3SyncClient
fake = Faker()
def setup_local_sync_client(target_folder, file_names... | Python | 0.000001 | @@ -18,16 +18,40 @@
-8 -*-%0A%0A
+import gzip%0Aimport json%0A
import o
@@ -52,16 +52,16 @@
port os%0A
-
import s
@@ -215,16 +215,26 @@
ncClient
+, traverse
%0Afrom s3
@@ -862,16 +862,16 @@
mock_s3%0A
-
def
@@ -887,16 +887,1218 @@
orm_sync
+_empty_local(self):%0A%0A client = boto3.client('s3')%0A ... |
99a445163450b8ae43c8241cb8dde41a95092292 | test only on python 3 | tests/test_plot.py | tests/test_plot.py | # -*- coding: utf-8 -*-
def test_basic_chart():
from os import path
import tempfile
import matplotlib.pyplot as plt
plt.switch_backend('Agg')
from genomics.plot import GridGenomePlot
from genomics.organism import genome_db
ggp = GridGenomePlot(genome_db['Ag'], 2)
with tempfile.Temporar... | Python | 0.000004 | @@ -18,16 +18,28 @@
-8 -*-%0A%0A
+import six%0A%0A
%0Adef tes
@@ -55,16 +55,47 @@
hart():%0A
+ if six.PY2:%0A return%0A
from
|
afede2a094d658cd3316151471498e2f693c7f78 | test new plotting featurez | tests/test_plot.py | tests/test_plot.py | # coding: utf-8
""" Test dynamics plotting """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os, sys
import logging
# Third-party
import matplotlib.pyplot as plt
import numpy as np
from astropy import log as logger
# Project
from ..plot im... | Python | 0 | @@ -1029,32 +1029,224 @@
e_orbit.png%22))%0A%0A
+ fig = plot_orbits(w, ix=0, linestyle='none', marker='.', alpha=0.25,%0A labels=(%22herp%22,%22derp%22,%22merp%22))%0A fig.savefig(os.path.join(plot_path, %22one_orbit_labels.png%22))%0A%0A
fig = plot_o
@@ -1289,32 +1289,32 @@
', marker=... |
710369096ecc70cf88c3d2c3798e2045354e08c1 | Add test for #4 | tests/test_sftp.py | tests/test_sftp.py | from copy import deepcopy
from paramiko import Transport
from paramiko.channel import Channel
from paramiko.sftp_attr import SFTPAttributes
from paramiko.sftp_client import SFTPClient
import pytest
import sys
from pytest_sftpserver.sftp.server import SFTPServer
CONTENT_OBJ = dict(
a=dict(
b="testfile1",
... | Python | 0.000001 | @@ -2328,24 +2328,281 @@
1%22, %222%22%5D)%0A%0A%0A
+def test_sftpserver_put_file(content, sftpclient, tmpdir):%0A tmpfile = tmpdir.join('test.txt')%0A tmpfile.write('Hello world')%0A sftpclient.put(str(tmpfile), '/a/test.txt')%0A assert set(sftpclient.listdir('/a')) == set(%5B'test.txt', 'b', 'c', 'f'%5D)... |
f874ab3c48926fa04558f1a862bb3de66934bce4 | rename test as test_url_to_all_params and remove paramater path as it was always the same value | tests/test_urls.py | tests/test_urls.py | import pytest
def test_cleanup_path():
from lektor.utils import cleanup_path
assert cleanup_path('/') == '/'
assert cleanup_path('/foo') == '/foo'
assert cleanup_path('/foo/') == '/foo'
assert cleanup_path('/////foo/') == '/foo'
assert cleanup_path('/////foo////') == '/foo'
assert cleanup_... | Python | 0.000001 | @@ -1046,22 +1046,16 @@
etrize(%22
-path,
alt, abs
@@ -1099,36 +1099,16 @@
%5B%0A (
-%22/projects/slave/%22,
%22de%22, No
@@ -1158,36 +1158,16 @@
),%0A (
-%22/projects/slave/%22,
%22de%22, Tr
@@ -1212,36 +1212,16 @@
),%0A (
-%22/projects/slave/%22,
%22de%22, Tr
@@ -1268,36 +1268,16 @@
#%0A (
... |
2fec479006e7349f692f3a978f359b3619d7713e | Create drop target widget | tvnamer/gui/__init__.py | tvnamer/gui/__init__.py | from PySide import QtCore, QtGui
class MainWindow(QtGui.QWidget):
pass
def main():
app = QtGui.QApplication(sys.argv)
window = MainWindow()
sys.exit(app.exec_())
| Python | 0.000001 | @@ -1,8 +1,20 @@
+import sys%0A%0A
from PyS
@@ -50,43 +50,917 @@
ass
-MainWindow(QtGui.QWidget):%0A pass
+DirectoryDropWidget(QtGui.QLabel):%0A def __init__(self):%0A super().__init__()%0A self.setAcceptDrops(True)%0A self.setStyleSheet(%22background-color:black;%22)%0A self.setText... |
06e8380159a3cb3c3882f236e24b75bf8b82aace | Remove trailing comma after **params | twine/commands/check.py | twine/commands/check.py | # Copyright 2018 Dustin Ingram
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | Python | 0 | @@ -3061,17 +3061,16 @@
**params
-,
%0A
|
d0c95f188e47d85d6b71198f18ff51cc84849fe3 | Add tth, tth_call (this is old uncommited code) | profile_collection/startup/10-endstation.py | profile_collection/startup/10-endstation.py | from ophyd.controls import EpicsMotor, PVPositioner
from ophyd.controls.positioner import MoveStatus,Positioner
from ophyd.controls.signal import EpicsSignal
from robot import RobotPositioner
from gas_switcher import XPDGasSwitcher
import time as ttime
robot_sample_number = EpicsSignal('XF:28IDC-ES:1{SM}ID:Tgt-SP',
... | Python | 0 | @@ -1190,16 +1190,157 @@
'He'%7D)%0A%0A
+%0Ath_cal = EpicsMotor('XF:28IDC-ES:1%7BDif:2-Ax:Th%7DMtr', name='th_cal')%0Atth_cal = EpicsMotor('XF:28IDC-ES:1%7BDif:2-Ax:2Th%7DMtr', name='tth_cal')%0A%0A
th = Epi
|
216b935f30baad28d6ff3fcc85c5d8e4acf2c84e | Bump version to 0.2.0 | tfopgen/version.py | tfopgen/version.py | # Do not edit this file, pipeline versioning is governed by git tags
__version__="0.1.0" | Python | 0.000001 | @@ -81,8 +81,8 @@
=%220.
-1
+2
.0%22
|
42a4a8b4480bc481e0467ae7ee46c60400d63f77 | Create tmp directory if it doesn't exist | theme-installer.py | theme-installer.py | #!/usr/bin/env python
import sys
from inc.functions import *
from PySide.QtGui import QApplication, QPixmap, QSplashScreen
from ui.mainwindow import MainWindow
# The app
if __name__ == '__main__':
# Create app
app = QApplication(sys.argv)
app.setApplicationName('LMMS Theme Installer')
# Show window
window = Mai... | Python | 0 | @@ -155,16 +155,161 @@
Window%0A%0A
+# Create tmp directory if it doesn't exist%0Aif not os.path.exists(os.path.join(os.getcwd(), 'tmp')):%0A%09os.mkdir(os.path.join(os.getcwd(), 'tmp'))%0A%0A
# The ap
|
79516222cc0077d88581121ff272a289882f39f6 | Fix for #20170 | salt/output/__init__.py | salt/output/__init__.py | # -*- coding: utf-8 -*-
'''
Used to manage the outputter system. This package is the modular system used
for managing outputters.
'''
# Import python libs
from __future__ import print_function
from __future__ import absolute_import
import os
import sys
import errno
import logging
import traceback
from salt.ext.six imp... | Python | 0 | @@ -1107,20 +1107,20 @@
ested',
-None
+opts
)(data).
|
6e48a888564c1714a652e3dd87b0df0619ac7b04 | delete `salt`. the sql statements, because "conn" is already specified in "_get_serv" function. If specify it again, the mysql.db in config.option is not efficacious | salt/returners/mysql.py | salt/returners/mysql.py | '''
Return data to a mysql server
:maintainer: Dave Boucha <dave@saltstack.com>, Seth House <shouse@saltstack.com>
:maturity: new
:depends: python-mysqldb
:platform: all
To enable this returner the minion will need the python client for mysql
installed and the following values configured in the min... | Python | 0.000005 | @@ -632,17 +632,19 @@
%60salt%60;
+
%0A
-
%0A --%0A
@@ -2608,23 +2608,16 @@
RT INTO
-%60salt%60.
%60salt_re
@@ -3072,23 +3072,16 @@
RT INTO
-%60salt%60.
%60jids%60%0A
@@ -3356,31 +3356,24 @@
T load FROM
-%60salt%60.
%60jids%60%0A
@@ -3731,31 +3731,24 @@
ll_ret FROM
-%60salt%60.
%60salt_return... |
f6b6d988d03927484f7e02da90e970eb17f93ae5 | Update models | salt_observer/models.py | salt_observer/models.py | from django.db import models
class Network(models.Model):
''' Representation of an Network '''
net = models.CharField(max_length=15)
subnet_mask = models.CharField(max_length=15)
class Minion(models.Model):
''' Representation of a Server in Salt '''
name = models.CharField(max_length=255)
| Python | 0 | @@ -23,16 +23,29 @@
models%0A%0A
+import json%0A%0A
%0Aclass N
@@ -286,12 +286,12 @@
-name
+fqdn
= m
@@ -322,8 +322,169 @@
th=255)%0A
+ grains = models.TextField()%0A%0A @property%0A def get_grains(self):%0A return json.loads(self.grains)%0A%0A def __str__(self):%0A return self.fqdn... |
68f99f11bd10d7f7e81704918711e6aff0d8dbe6 | Allow multiple security groups to be applied in AWS | saltcloud/clouds/aws.py | saltcloud/clouds/aws.py | '''
The AWS Cloud Module
====================
The AWS cloud module is used to interact with the Amazon Web Services system.
To use the AWS cloud module the following configuration parameters need to be
set in the main cloud config:
.. code-block:: yaml
# The AWS API authentication id
AWS.id: GKTADJGHEIQSXMK... | Python | 0 | @@ -3043,24 +3043,267 @@
'default'))%0A
+ securitygroups = vm_.get('securitygroup', __opts__.get('AWS.securitygroup', 'default'))%0A if not isinstance(securitygroups, list):%0A securitygroup = securitygroups%0A securitygroups = %5Bsecuritygroup%5D%0A return securitygroups%0A
%0A%0Adef ssh_us
|
88dd834e0ee1811a1d56b9d4e165ddcfaaa54009 | Allow providing a range of perms | saltpylint/fileperms.py | saltpylint/fileperms.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2015 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
====================================
PyLint File Permissions Check Plugin
===========... | Python | 0 | @@ -1824,35 +1824,351 @@
-desired_perm = desired_perm
+if '-' in desired_perm:%0A desired_perm = desired_perm.split('-')%0A else:%0A desired_perm = %5Bdesired_perm%5D%0A%0A if len(desired_perm) %3E 2:%0A raise RuntimeError('Permission ranges should be like XXXX-YYYY'... |
65bbcb1eeceb2dece074df4a427e26af81c3b707 | Fix typos and restore auth on custom API | servicerating/api.py | servicerating/api.py | from tastypie import fields
from tastypie.resources import ModelResource, Resource, ALL, Bundle
from tastypie.authentication import ApiKeyAuthentication
from tastypie.authorization import Authorization
from servicerating.models import Contact, Conversation, Response, UserAccount, Extra
import logging
# Get an instance ... | Python | 0 | @@ -3803,26 +3803,24 @@
ject%0A
- #
authenticat
@@ -3855,18 +3855,16 @@
%0A
- #
authori
@@ -3921,13 +3921,8 @@
ods
-will
need
@@ -3951,12 +3951,11 @@
of
-your
+the
%0A
@@ -4410,34 +4410,34 @@
count, we don't
-ex
+ac
cept everything%0A
@@ -4566,18 +4566,18 @@
e don't
-ex
+ac
cept eve... |
9d63c20b216549305b7753a24c8c8c77e678b3b5 | Add a simple logging config | settings_override.py | settings_override.py | try:
from settings_database import *
except ImportError:
pass
EXAMPLE_SCOPE = 'Canada'
EXAMPLE_BOUNDARY_SET = 'Federal Electoral District'
EXAMPLE_BOUNDARY_SETS = 'Federal Electoral Districts' # plural
EXAMPLE_BOUNDARY_SET_CODE = 'federal'
EXAMPLE_BOUNDARY_SET_CODE_BIS = 'example-boundary-set-b' # "bis" is lat... | Python | 0.000001 | @@ -62,16 +62,607 @@
pass
+%0A %0ALOGGING = %7B%0A 'version': 1,%0A 'disable_existing_loggers': False,%0A 'handlers': %7B%0A 'mail_admins': %7B%0A 'level': 'ERROR',%0A 'class': 'django.utils.log.AdminEmailHandler'%0A %7D,%0A 'console':%7B%0A 'level'... |
5d67fc2ba27174d0483e0706997091d1647addde | Fix AttributeError when no error message is set (#1) | upsmychoice/__init__.py | upsmychoice/__init__.py | """UPS My Choice."""
import json
from json.decoder import JSONDecodeError
import os
import pickle
from bs4 import BeautifulSoup
from dateutil.parser import parse
import requests
from requests.auth import AuthBase
LOGIN_URL = 'https://www.ups.com/one-to-one/login'
DELIVERIES_URL = 'https://wwwapps.ups.com/mcdp'
SERVI... | Python | 0.000001 | @@ -1960,15 +1960,8 @@
TTR)
-.string
%0A
@@ -1965,24 +1965,41 @@
if error
+ and error.string
:%0A ra
@@ -2013,24 +2013,31 @@
Error(error.
+string.
strip())%0A
|
87941d2cd7d7ce17eb73105f0c88f38c993db0bf | Update filters.py | flask_appbuilder/models/filters.py | flask_appbuilder/models/filters.py | class BaseFilter(object):
column_name = ''
datamodel = None
model = None
name = ''
""" The filter display name """
def __init__(self, column_name, datamodel):
"""
Constructor.
:param column_name:
Model field name
:param datamodel... | Python | 0.000001 | @@ -4714,16 +4714,18 @@
FILTERS
+%5Cn
%22%0A
@@ -4804,16 +4804,19 @@
tr + %22%25s
+.%25s
:%25s%5Cn%22 %25
@@ -4817,16 +4817,38 @@
s%5Cn%22 %25 (
+self.model.__table__,
str(flt)
|
70827cd770fc1df526f30d660f3d6a51988b750f | Fix requesting metrics for querysets with > 10 items | osf/metrics.py | osf/metrics.py | from elasticsearch_metrics import metrics
from django.db import models
class MetricMixin(object):
@classmethod
def _get_id_to_count(cls, size, metric_field, count_field, after=None):
"""Performs the elasticsearch aggregation for get_top_by_count. Return a
dict mapping ids to summed counts. If ... | Python | 0.000001 | @@ -567,16 +567,27 @@
c_field,
+ size=size,
order=%7B
|
a94fd20cff2c69dca2f8b8ca006893073b971e43 | Add command line parameter to toggle sequential parsing | parse_summaries.py | parse_summaries.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
import argparse
from dateutil.parser import parse
from dateutil.relativedelta import relativedelta
from parsers.main_parser import MainParser
FILENAME_REGEX = re.compile("^\d{4}\-\d{2}\-\d{2}$")
if __name__ == '__main__':
# retrievin... | Python | 0.000001 | @@ -1281,16 +1281,211 @@
maries%22)
+%0A parser.add_argument(%0A '-s', '--sequential', dest='sequential', required=False,%0A action='store_true',%0A help=%22Turn off multi-threaded parsing, turn on sequential parsing%22)
%0A%0A ar
@@ -2054,16 +2054,166 @@
s = None
+%0A # toggling simult... |
4b40c8207c8fc4003f5381299e7485a8e7ac04f9 | Update for release | tg/release.py | tg/release.py | """TurboGears project related information"""
version = "2.3.2"
description = "Next generation TurboGears"
long_description="""
TurboGears brings together a best of breed python tools
to create a flexible, full featured, and easy to use web
framework.
TurboGears 2 provides an integrated and well tested set of tools for... | Python | 0 | @@ -560,16 +560,17 @@
aWidgets
+2
)%0A * aut
@@ -1242,17 +1242,17 @@
2005-201
-3
+4
Kevin D
|
a8af5dd775731b05ebc92e0bdd7509736c9daa74 | Make progress.py test a bit nicer. | test/interface/progress.py | test/interface/progress.py | #!/usr/bin/env python
import sys, os, time
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import driver, http_admin, scenario_common
from memcached_workload_common import MemcacheConnection
from vcoptparse import *
op = OptParser()
scenario_common.prepare_option_par... | Python | 0 | @@ -712,16 +712,62 @@
refix),%0A
+ log_path = %22serve-output-%25d%22 %25 i,%0A
@@ -1358,16 +1358,55 @@
esses)%0A%0A
+ print %22Performing test queries...%22%0A
with
@@ -1631,16 +1631,82 @@
print%0A
+ print %22Done with test queries.%22%0A%0A print %22Adding a replica.%22
%0A ... |
18d93dfcc90c141caa2fcc19048de49e16cfeb57 | Use StringIO for PY3 | platformio/commands/home/rpc/handlers/piocore.py | platformio/commands/home/rpc/handlers/piocore.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | Python | 0.000001 | @@ -699,16 +699,26 @@
BytesIO
+, StringIO
%0A%0Aimport
@@ -908,16 +908,31 @@
t import
+ PY2, is_bytes,
string_
@@ -1582,34 +1582,40 @@
ytesIO()
-%0A try:%0A
+ if PY2 else StringIO()%0A
@@ -1656,105 +1656,65 @@
ite(
-value)%0A except TypeError:%0A return self._buffers%5Bthr... |
d21d9078156d81db5bf642fd6f5de90bde82778f | Downgrade different outputs to a warning. | benchmark.py | benchmark.py | #!/usr/bin/env python
import os
import subprocess
import itertools
import shutil
import sys
try:
import blessings
term = blessings.Terminal()
except ImportError:
class FakeTerminal(object):
def __getattr__(self, a):
return ''
term = FakeTerminal()
BINARIES_DIR = "bench-binaries"
i... | Python | 0.999998 | @@ -2256,16 +2256,19 @@
eak%0A%0Afor
+ i,
results
@@ -2273,26 +2273,37 @@
ts_lines in
+enumerate(
it
+)
:%0A for l
@@ -2528,26 +2528,22 @@
-assert l =
+if l !
= output
@@ -2556,29 +2556,158 @@
s%5B0%5D
-, %22different outputs%22
+:%0A bname = build_names%5Bi%5D%0A print %3E%... |
ab8756c6a1664a44fd7a41ebe0af5bc0445738c8 | remove unused import | keystone/common/sql/migrate_repo/versions/017_add_enabled_to_policy.py | keystone/common/sql/migrate_repo/versions/017_add_enabled_to_policy.py | import sqlalchemy as sql
import migrate
_POLICY_TABLE_NAME = 'policy'
def upgrade(migrate_engine):
meta = sql.MetaData()
meta.bind = migrate_engine
policy_table = sql.Table(_POLICY_TABLE_NAME, meta, autoload=True)
# adding new columns
policy_enabled = sql.Column('enabled', sql.Boolean, nullable=... | Python | 0.000001 | @@ -21,23 +21,8 @@
sql
-%0Aimport migrate
%0A%0A_P
|
028a42d8139521306896a9819364c007f43bbbae | add is_of_member_archetype filter | web/impact/impact/views/algolia_api_key_view.py | web/impact/impact/views/algolia_api_key_view.py | # MIT License
# Copyright (c) 2017 MassChallenge, Inc.
import time
from algoliasearch import algoliasearch
from django.conf import settings
from django.core.exceptions import PermissionDenied
from rest_framework import permissions
from rest_framework.response import Response
from rest_framework.views import APIView
... | Python | 0.000003 | @@ -1102,16 +1102,73 @@
t:true'%0A
+IS_NOT_MEMBER_FILTER = 'is_of_the_member_achetype:false'%0A
%0A%0Aclass
@@ -3046,16 +3046,38 @@
E_FILTER
+, IS_NOT_MEMBER_FILTER
)%0A%0A i
|
2e2104a33aacb6d23c4eab6ae47231992fcf0497 | raise exception | myuw/views/api/finance.py | myuw/views/api/finance.py | import logging
import traceback
from myuw.dao.finance import get_account_balances_for_current_user
from myuw.dao.notice import get_tuition_due_date
from myuw.dao.pws import is_student
from myuw.logger.timer import Timer
from myuw.logger.logresp import (
log_data_not_found_response, log_msg, log_success_response)
fr... | Python | 0.000003 | @@ -1285,8 +1285,52 @@
ceback)%0A
+ except Exception:%0A raise%0A
|
6ffd20d673aad664f22b18182eb4859d4c932240 | allow a custom logger. | diesel/protocols/zeromq.py | diesel/protocols/zeromq.py | import zmq
import diesel
from diesel import logmod
from errno import EAGAIN
from collections import deque
from diesel.util.queue import Queue
from diesel.util.event import Event, EventTimeout
zctx = zmq.Context()
class DieselZMQSocket(object):
'''Integrate zmq's super fast event loop with ours.
'''
def __... | Python | 0 | @@ -3330,16 +3330,29 @@
elf, uri
+, logger=None
):%0A
@@ -3418,16 +3418,26 @@
lf.log =
+ logger or
None%0A
@@ -3805,32 +3805,61 @@
_logging(self):%0A
+ if not self.log:%0A
log_name
@@ -3898,16 +3898,20 @@
_name__%0A
+
|
5174fe64a076de6ef5afc73278d457157eca8d69 | Update transpositionTest: fixed imports and PEP8 formatting | books/CrackingCodesWithPython/Chapter09/transpositionTest.py | books/CrackingCodesWithPython/Chapter09/transpositionTest.py | # Transposition Cipher Test
# https://www.nostarch.com/crackingcodes/ (BSD Licensed)
import random, sys, transpositionEncrypt, transpositionDecrypt
def main():
random.seed(42) # Set the random "seed" to a static value.
for i in range(20): # Run 20 tests.
# Generate random messages to test.
... | Python | 0 | @@ -101,52 +101,185 @@
sys
-, transpositionEncrypt, transpositionDecrypt
+%0Afrom books.CrackingCodesWithPython.Chapter07.transpositionEncrypt import encryptMessage%0Afrom books.CrackingCodesWithPython.Chapter08.transpositionDecrypt import decryptMessage%0A
%0A%0Ade
@@ -310,17 +310,16 @@
d(42) #
-
Set the
@@ -9... |
f585850e7c55354627707f1a307b623c17d0475d | remove defaultRedirect; add dataPath, set up reasonable defaults for paths, add configured flag | mint/config.py | mint/config.py | #
# Copyright (c) 2005 rPath, Inc.
#
# All rights reserved
#
import os
import sys
import mint
from conary import conarycfg
from conary.conarycfg import ConfigFile
from conary.conarycfg import CfgString, CfgDict, CfgBool
from urlparse import urlsplit
templatePath = os.path.dirname(sys.modules['mint'].__file__)
clas... | Python | 0 | @@ -448,16 +448,17 @@
website
+:
(Used i
@@ -635,16 +635,17 @@
service
+:
(Used h
@@ -687,306 +687,8 @@
%0A
- defaultRedirect = (CfgString, 'http://rpath.com',%0A %22The site to which users are redirected when visiting an invalid site %22%5C%0A %22(Used when a user tries to visit a ... |
e9ec3a7ea22540c10b6db3e78fe2c5299e127119 | update importer management command to prep for multiple importers | tx_highered/management/commands/tx_highered_import.py | tx_highered/management/commands/tx_highered_import.py | import os
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Import Data"
def handle(self, *args, **options):
# TODO handle THECB data
from tx_highered.scripts.import_customreport import generic
for path in args:
if os.path.isfile(pat... | Python | 0 | @@ -61,36 +61,140 @@
nd%0A%0A
-%0Aclass Command(BaseCommand):
+from tx_highered.scripts.import_customreport import generic%0A%0A%0Aclass Command(BaseCommand):%0A args = '(ipeds%7Cthecb) %3Cfile file ...%3E'
%0A
@@ -236,16 +236,31 @@
le(self,
+ importer_type,
*args,
@@ -304,24 +304,25 @@
CB data%0A
+%0A
... |
f2d363feb22a00e2d2d59b2deb7b9740829d354d | Fix a Typo in the comment of asift.py | samples/python/asift.py | samples/python/asift.py | #!/usr/bin/env python
'''
Affine invariant feature-based image matching sample.
This sample is similar to find_obj.py, but uses the affine transformation
space sampling technique, called ASIFT [1]. While the original implementation
is based on SIFT, you can try to use SURF or ORB detectors instead. Homography RANSAC
... | Python | 0.009193 | @@ -2437,16 +2437,17 @@
ne trans
+f
ormation
|
6da007881f57e311ac0ba8dadf6482a6a1edb834 | remove hacky jitter() logic to make wld files unique | util/ridge_processor.py | util/ridge_processor.py | """
I process activemq messages 10,000 at a time!
"""
import os
import subprocess
import random
import datetime
import json
import pytz
import pika
def jitter():
return "0" * random.randint(0,9)
def generate_image(ch, method, properties, body):
"""
Generate a Lite Image given the ActiveMQ message
@p... | Python | 0 | @@ -147,60 +147,8 @@
ka%0A%0A
-def jitter():%0A return %220%22 * random.randint(0,9)%0A%0A
def
@@ -1882,26 +1882,24 @@
.write(%22%25.6f
-%25s
%5Cn%22 %25 ((lowe
@@ -1927,32 +1927,24 @@
Lon)/1000.0,
-jitter()
)) # dx%0A
@@ -1955,35 +1955,19 @@
ite(%220.0
-%25s
%5Cn%22
- %25 (jitter(),)
)%0A o.
@@ -19... |
031a31de6c97e0ef338ef711bf2727062a2106e0 | add note on ContentItemQuerySet.clear_cache() | fluent_contents/models/managers.py | fluent_contents/models/managers.py | """
The manager classes are accessed via ``Placeholder.objects``.
"""
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import get_language
from parler.utils import get_language_title
from polymorphic import PolymorphicManager, PolymorphicQuerySet
cl... | Python | 0 | @@ -3054,16 +3054,175 @@
entries.
+%0A%0A This method is not available on the manager class, only the queryset%0A (similar to the :func:%60~django.db.models.query.QuerySet.delete%60 method).
%0A
|
d97b3b49cb916182550ada3e8e3384a29236a41a | Fix mongo queue test | test/spider_mongo_queue.py | test/spider_mongo_queue.py | # coding: utf-8
from random import shuffle
from unittest import TestCase, main
from grab.spider import Spider, Task
from util import FakeServerThread, RESPONSE, SLEEP, BASE_URL
class TestSpider(TestCase):
TASKS_COUNT = 10
def setUp(self):
FakeServerThread().start()
def test_spider(self):
... | Python | 0.000017 | @@ -1142,21 +1142,35 @@
if task.
-first
+get('first', False)
:%0A
|
dd40b392b73ddc1bcf88d932418b4f891bcc6a89 | Allow star imports from twine | twine/__init__.py | twine/__init__.py | # Copyright 2013 Donald Stufft
#
# 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 agreed to in writing, so... | Python | 0 | @@ -634,48 +634,8 @@
tion
-%0Afrom __future__ import unicode_literals
%0A%0A__
|
4988d4138994a392c2c558794d62af3b7c5ec2d8 | Add GPIO aliases to ZCU104 base overlay to match the Pynq-Z1/2 | boards/ZCU104/base/base.py | boards/ZCU104/base/base.py | import pynq
import pynq.lib
import time
from pynq.lib.video.clocks import *
from pynq import MMIO
class BaseOverlay(pynq.Overlay):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if self.is_loaded():
self.iop_pmod0.mbtype = "Pmod"
self.iop_pmod1.mbtype... | Python | 0 | @@ -490,16 +490,409 @@
lf.PMOD1
+%0A self.leds = self.gpio_leds.channel1%0A self.leds.setdirection('out')%0A self.leds.setlength(4)%0A self.buttons = self.gpio_btns.channel1%0A self.buttons.setdirection('in')%0A self.buttons.setlength(4)%0A s... |
825d5c36598f609b8b9c45ad6de3c10195c0ea4c | remove encoding as it does not seem to have any effect on score (submission score even got 1.5pt better ;) | process.py | process.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from utils import *
from sklearn.svm import SVR
from sklearn.grid_search import GridSearchCV
from sklearn.feature_selection import SelectKBest
from sklearn.feature_selection import f_regression
from sklearn.pipeline import Pipeline
... | Python | 0 | @@ -366,56 +366,8 @@
ler%0A
-from sklearn.preprocessing import OneHotEncoder%0A
from
@@ -413,16 +413,16 @@
gressor%0A
+
import s
@@ -1517,24 +1517,25 @@
ata%5B'BTB'%5D)%0A
+%0A
if train
@@ -1664,282 +1664,8 @@
Y%0A%0A
-def transform_features(X):%0A # map categorical features 1 and 10 to %5B0...n_values%5... |
cb5568bb4c4d02d2f325863f593b7b02344f013b | Change query constructor to return a sequence | pattsgui/editor.py | pattsgui/editor.py | ##
## patts-qt - Qt GUI client for PATTS
## Copyright (C) 2015 Delwink, LLC
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU Affero General Public License as published by
## the Free Software Foundation, version 3 only.
##
## This program is distributed i... | Python | 0.000006 | @@ -4749,16 +4749,17 @@
return
+(
(patts.q
@@ -4773,16 +4773,18 @@
query,))
+,)
%0A%0A de
@@ -4951,22 +4951,17 @@
ries
-.append(
+ +=
query
-)
%0A%0A
|
cddd4487c388cf5f010a39e36df1286568882135 | FIX CS-782 | wordpress_connector/models/request.py | wordpress_connector/models/request.py | ##############################################################################
#
# Copyright (C) 2019 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Christopher Meier <dev@c-meier.ch>
#
# The licence is in the file __manifest__.py
#
#####################... | Python | 0 | @@ -2286,16 +2286,40 @@
True%7D)%0A
+ if partner:%0A
|
10e4f30cbc4327b6ee51a600bba4304261c27ca0 | Update release script | utils/create_release.py | utils/create_release.py | import subprocess
import sys
from distutils.version import StrictVersion
def main():
git_clean = subprocess.check_output("git status --porcelain", universal_newlines=True).strip()
# if git_clean:
# raise RuntimeError("Error, git workspace is not clean: \n{0}".format(git_clean))
current_version = ... | Python | 0.000001 | @@ -15,19 +15,8 @@
ess%0A
-import sys%0A
from
@@ -109,16 +109,25 @@
_output(
+%0A
%22git sta
@@ -167,16 +167,21 @@
nes=True
+%0A
).strip(
@@ -185,18 +185,16 @@
ip()%0A
- #
if git_
@@ -207,10 +207,8 @@
%0A
- #
@@ -1020,16 +1020,20 @@
n isort
+-rc
src test
@@ -1045,32 +1045,32 @@
s%... |
1863cf894c96a917840876449e5c852609f27691 | Set Toolbar's style to 'icons only'. | panel/languagebar.py | panel/languagebar.py | # vim:set noet ts=4:
#
# ibus - The Input Bus
#
# Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the ... | Python | 0 | @@ -1405,24 +1405,61 @@
it__ (self)%0A
+%09%09self.set_style (gtk.TOOLBAR_ICONS)%0A
%09%09self.set_p
@@ -2902,17 +2902,18 @@
width +
-4
+32
, -1)%0A%0A%09
|
49f8a47dfc06484a4d9d767a10c07c47fe5e76d3 | Fix synthax error | flyingpigeon/processes/__init__.py | flyingpigeon/processes/__init__.py | from .wps_subset_countries import ClippingProcess
from .wps_subset_continents import ClipcontinentProcess
from .wps_subset_regionseurope import ClipregionseuropeProcess
from .wps_pointinspection import PointinspectionProcess
from .wps_landseamask import LandseamaskProcess
from .wps_climatefactsheet import FactsheetProc... | Python | 0.000011 | @@ -2478,16 +2478,17 @@
rocess()
+,
%0A Sub
|
b215e5a80ae38b069608eb9075f889dc2f844fc9 | update appliance set df handling | disaggregator/appliance.py | disaggregator/appliance.py | """
.. module:: appliance
:platform: Unix
:synopsis: Contains classes for representing appliances and appliance
traces.
.. moduleauthor:: Phil Ngo <ngo.phil@gmail.com>
.. moduleauthor:: Stephen Suffian <steve@invalid.com>
"""
import numpy as np
import pandas as pd
import pprint
from utils import order_tr... | Python | 0.000002 | @@ -3385,32 +3385,61 @@
te the metadata%0A
+ df = get_dataframe()%0A
total_us
@@ -3437,37 +3437,32 @@
total_usages =
-self.
df.sum(axis=0)%0A
@@ -4024,32 +4024,61 @@
te the metadata%0A
+ df = get_dataframe()%0A
total_us
@@ -4084,21 +4084,16 @@
sages =
-self.
df.sum(a
|
c29354ac1ef5805659ad20a30b9f78122f54012e | Include the active SDK version in --version output. | pebble_tool/__init__.py | pebble_tool/__init__.py | from __future__ import absolute_import, print_function
__author__ = 'katharine'
import atexit
import argparse
import logging
import sys
import requests.packages.urllib3 as urllib3
from .commands.base import register_children
from .commands.sdk import build, create
from .commands import (install, logs, screenshot, tim... | Python | 0 | @@ -739,16 +739,17 @@
info__%0A%0A
+%0A
def run_
@@ -936,16 +936,178 @@
ebble%22)%0A
+ version_string = %22Pebble Tool v%7B%7D%22.format(__version__)%0A if sdk_version() is not None:%0A version_string += %22 (active SDK: v%7B%7D)%22.format(sdk_version())%0A
pars
@@ -1165,43 +1165,16 @@
ion=
-%22Pe... |
3548e134f760b85b2b76d5cf3c8c3462f3885852 | update URLs (#5355) | var/spack/repos/builtin/packages/libsodium/package.py | var/spack/repos/builtin/packages/libsodium/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | Python | 0 | @@ -1548,17 +1548,17 @@
um-1.0.1
-1
+3
.tar.gz%22
@@ -1630,16 +1630,132 @@
s/old%22%0A%0A
+ version('1.0.13', 'f38aac160a4bd05f06f743863e54e499')%0A version('1.0.12', 'c308e3faa724b630b86cc0aaf887a5d4')%0A
vers
@@ -2294,16 +2294,96 @@
.0.4'):%0A
+ url += 'old/unsupported/'%0A elif versi... |
f378a90a70a500e20e2f700c27ed056fd395d05d | Make the runner a mixin | discover_jenkins/runner.py | discover_jenkins/runner.py | import inspect
from optparse import make_option
from django.core.exceptions import ImproperlyConfigured
from django.utils import unittest
from django.utils.importlib import import_module
try:
# Django 1.6
from django.test.runner import DiscoverRunner
except ImportError:
# Fallback to third-party app on D... | Python | 0.998792 | @@ -1512,24 +1512,16 @@
%0A%0Aclass
-Discover
CIRunner
@@ -1521,30 +1521,22 @@
IRunner(
-DiscoverRunner
+object
):%0A %22
@@ -1563,16 +1563,22 @@
runner
+mixin
that run
@@ -1606,24 +1606,28 @@
nd dumps the
+%0A
results to%0A
@@ -1625,20 +1625,16 @@
sults to
-%0A
an XML
@@ -2231,32 +2231,24 @@
... |
ad05128b5cf2cb6439f57c463716bae88038c9b3 | Version bumped to v2.0.0.16 | twork/__init__.py | twork/__init__.py | __import__('pkg_resources').declare_namespace(__name__)
version = "2.0.0.15"
version_info = (2, 0, 0, 15)
SERVER_NAME = 'TWS'
SERVER_INFO = '%s/%s' % (SERVER_NAME, version)
| Python | 0 | @@ -68,17 +68,17 @@
%222.0.0.1
-5
+6
%22%0Aversio
@@ -101,9 +101,9 @@
0, 1
-5
+6
)%0ASE
|
0158d4be9feffb65ed0cc08be5d854722e997894 | fix use_proxy | process.py | process.py | import sys
import os
import glob
import yaml
import logging
import time
processor_order = [ 'download_shitty_csv',
'spreadsheet_to_jsons',
'download_pending_changes',
'scrape_supports',
'scrape_exemptions',
'new_budget_... | Python | 0.000001 | @@ -64,16 +64,34 @@
ort time
+%0Aimport subprocess
%0A%0Aproces
|
ee61023d38054cad525f3312bf834cbd246a3427 | Add get_last_feed_entry() | thingspeak.py | thingspeak.py | #-----------------------------------------------------------------------
#
# Interfaces to thingspeak
#
# The MIT License (MIT)
#
# Copyright (c) 2015 William De Freitas
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software... | Python | 0.000001 | @@ -1632,19 +1632,35 @@
key_file
+, acc_channel_id
):%0A
-
@@ -1746,16 +1746,57 @@
y_file)%0A
+ self.channel_id = acc_channel_id%0A
@@ -2503,16 +2503,16 @@
t_addr)%0A
-
@@ -2685,16 +2685,766 @@
sponse%0A%0A
+ %0A #=============================================================... |
fded67e7120d79c619e541ccd3ba19898c194b5b | Use deterministic signatures for ECDSA keys. | paramiko/ecdsakey.py | paramiko/ecdsakey.py | # Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (a... | Python | 0.000003 | @@ -846,16 +846,32 @@
inascii%0A
+import hashlib%0A%0A
from ecd
@@ -3414,156 +3414,68 @@
-digest = SHA256.new(data).digest()%0A sig = self.signing_key.sign_digest(digest, entropy=rpool.read,%0A
+sig = self.signing_key.sign_deterministic(%0A data,
sig... |
cdba2653f1412a11da658ae4a9fe42db8d1f9da0 | add banner to `Shell.interact` | twosheds/shell.py | twosheds/shell.py | """
twosheds.shell
~~~~~~~~~~~~~~
This module implements the central user interface for access to an
operating system's kernel services.
"""
from __future__ import absolute_import
import atexit
import os
import readline
import sys
from .cli import CommandLineInterface
from .completer import Completer
from .grammar i... | Python | 0 | @@ -2795,24 +2795,37 @@
nteract(self
+, banner=None
):%0A %22
@@ -3451,10 +3451,16 @@
nteract(
+banner
)%0A
|
aa215e367e6acc394cbba19d99399e81ccf0803f | make DAYS_INACTIVE configurable (#5) | slack-autoarchive.py | slack-autoarchive.py | #!/usr/local/bin/python
from datetime import timedelta, datetime
import os
import requests
import sys
#
# This will archive inactive channels. The inactive period is in days as 'DAYS_INACTIVE'
# You can put this in a cron job to run daily to do slack cleanup.
#
ADMIN_CHANNEL = os.getenv('ADMIN_CHANNEL')
AUDIT_L... | Python | 0.000001 | @@ -364,10 +364,43 @@
=
-60
+int(os.getenv('DAYS_INACTIVE', 60))
%0AMIN
@@ -3896,20 +3896,16 @@
t(','))%0A
-
%0A cha
|
fe728a9741be7eb1cfa440bf5d9c9b008255f3d7 | Add py-future (#19195) | var/spack/repos/builtin/packages/py-future/package.py | var/spack/repos/builtin/packages/py-future/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyFuture(PythonPackage):
"""Clean single-source support for Python 3 and 2"""
homepag... | Python | 0.000004 | @@ -408,19 +408,19 @@
ture-0.1
-6.0
+8.2
.tar.gz%22
@@ -421,16 +421,113 @@
ar.gz%22%0A%0A
+ version('0.18.2', sha256='b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d')%0A
vers
|
0c84f6dd314ea62019356b09363f98118a4da776 | Use built-in IP address functionality to unmap IPv4 addresses | txircd/factory.py | txircd/factory.py | from twisted.internet.protocol import ClientFactory, Factory
from txircd.server import IRCServer
from txircd.user import IRCUser
from ipaddress import ip_address
import re
ipv4MappedAddr = re.compile("::ffff:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})")
def unmapIPv4(ip: str) -> str:
"""
Converts an IPv6-mapped IPv4 addres... | Python | 0 | @@ -159,279 +159,260 @@
ess%0A
-import re%0A%0Aipv4MappedAddr = re.compile(%22::ffff:(%5Cd%7B1,3%7D%5C.%5Cd%7B1,3%7D%5C.%5Cd%7B1,3%7D%5C.%5Cd%7B1,3%7D)%22)%0Adef unmapIPv4(ip: str) -%3E str:%0A%09%22%22%22%0A%09Converts an IPv6-mapped IPv4 address to a bare IPv4 address.%0A%09%22%22%22%0A%09mapped = ipv4MappedAddr.mat... |
d496568ff9615dbb69bb9d4edf971231232ff438 | add version 1.5 (#26731) | var/spack/repos/builtin/packages/py-gevent/package.py | var/spack/repos/builtin/packages/py-gevent/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyGevent(PythonPackage):
"""gevent is a coroutine-based Python networking library."""
... | Python | 0 | @@ -391,16 +391,112 @@
ar.gz%22%0A%0A
+ version('1.5.0', sha256='b2814258e3b3fb32786bb73af271ad31f51e1ac01f33b37426b66cb8491b4c29')%0A
vers
@@ -640,93 +640,331 @@
ild'
-)%0A depends_on('py-cython@0.27:', type='build')%0A depends_on('py-cffi@1.4.0
+, when='@:1.4')%0A depends_on('py-setuptools@40... |
b56954782859d27718f01e0347f8563bf6f66a0f | fix indentation | pandoc/core.py | pandoc/core.py | import subprocess
from os.path import exists
from tempfile import NamedTemporaryFile
import os
PANDOC_PATH = 'pandoc'
def set_path(path):
global PANDOC_PATH
PANDOC_PATH = path
class Document(object):
"""A formatted document."""
INPUT_FORMATS = (
'native', 'markdown', 'markdown+lhs', 'rst',
... | Python | 0.000358 | @@ -160,9 +160,12 @@
ATH%0A
-%09
+
PAND
|
d3a44726244185af86f3538baa2d18e79c7801b9 | fix move file | connector_importer_source_sftp/components/event_listeners.py | connector_importer_source_sftp/components/event_listeners.py | # Copyright 2019 Camptocamp SA
# @author: Sebastien Alix <sebastien.alix@camptocamp.com>
# Copyright 2020 ACSONE SA/NV (<http://acsone.eu>)
# @author: Simone Orsi <simahawk@gmail.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import functools
from odoo.addons.component.core import Component... | Python | 0 | @@ -1631,16 +1631,54 @@
lepath()
+%0A sftp_destination_path = False
%0A%0A
@@ -2244,24 +2244,62 @@
)%0A%0A
+ if sftp_destination_path:%0A
self
@@ -2323,16 +2323,20 @@
t_hook(%0A
+
@@ -2397,16 +2397,20 @@
on_path%0A
+
|
07004ba6e0ebf5bb144e68f8ea24ce0f4c0d8c9b | Remove newline characters in panel view | panel/panel.py | panel/panel.py | import os
import sublime
from ..lint.const import WARN_ERR
from ..lint import util, persist
PANEL_NAME = "SublimeLinter"
OUTPUT_PANEL_SETTINGS = {
"auto_indent": False,
"draw_indent_guides": False,
"draw_white_space": "None",
"gutter": False,
"is_widget": True,
"line_numbers": False,
"marg... | Python | 0 | @@ -3141,24 +3141,54 @@
start'%5D + 1%0A
+ msg = dic%5B'msg'%5D.rstrip()%0A
tmpl = %22
@@ -3249,19 +3249,19 @@
de:12%7D %7B
-msg
+MSG
%7D%22%0A r
@@ -3278,16 +3278,25 @@
.format(
+%0A
LINENO=l
@@ -3335,16 +3335,25 @@
or_type,
+ MSG=msg,
**dic)%0A
|
58472d21c46cfe4a24e31a5553019731479e1e0b | Update ssh_dispatcher.py | netmiko/ssh_dispatcher.py | netmiko/ssh_dispatcher.py | from cisco import CiscoIosSSH
from cisco import CiscoAsaSSH
from cisco import CiscoNxosSSH
from cisco import CiscoXrSSH
from arista import AristaSSH
from hp import HPProcurveSSH
CLASS_MAPPER = {
'cisco_ios' : CiscoIosSSH,
'cisco_xe' : CiscoIosSSH,
'cisco_asa' : CiscoAsaSSH,
'cisco_nxos' ... | Python | 0.000001 | @@ -434,16 +434,48 @@
rveSSH,%0A
+ 'f5_ltm_ssh' : F5LtmSSH,%0A
%7D%0A%0Adef s
|
46214b0caa1772b405d76c370882eb259579dca5 | Set r-chipseq to bioconductor format (#24315) | var/spack/repos/builtin/packages/r-chipseq/package.py | var/spack/repos/builtin/packages/r-chipseq/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RChipseq(RPackage):
"""A package for analyzing chipseq data"""
homepage = "https://bi... | Python | 0 | @@ -282,16 +282,87 @@
seq data
+%0A%0A Tools for helping process short read data for chipseq experiments
%22%22%22%0A%0A
@@ -448,11 +448,11 @@
-url
+git
@@ -456,32 +456,36 @@
= %22https://
+git.
bioconductor.org
@@ -498,54 +498,15 @@
ges/
-release/bioc/src/contrib/chipseq_1.40.0.tar.gz
+chip... |
bb3f39c6122878f983c1cb45a0aead3735bc4ccd | Reorder functions | parsenvy/parsenvy.py | parsenvy/parsenvy.py | """
Main Parsenvy module.
This module provides all of Parsenvy's functionality by exposing functions the
user is meant to utilize.
"""
import builtins
from functools import wraps
import os
from typing import Any, Callable, List, Optional, Set, Tuple
TRUES = ["true", "1"]
FALSES = ["false", "0"]
def default_if_no... | Python | 0.000001 | @@ -4163,477 +4163,8 @@
)%0A%0A%0A
-@default_if_none%0Adef str(%0A env_var: builtins.str,%0A default: Optional%5Bbuiltins.str%5D = None,%0A) -%3E Optional%5Bbuiltins.str%5D:%0A %22%22%22%0A Parse environment variable value into a str.%0A%0A Args:%0A env_var (str): Name of desired environment vari... |
cf83a6abc6709fadfe8dfa44408462e79bd8c1ff | Enable apache logging for uweb_info. | uweb_info/www/router.py | uweb_info/www/router.py | #!/usr/bin/python
"""An uweb info page and testcase."""
# Custom modules
from underdark.libs import uweb
from underdark.libs.uweb.uweb_info import pages
__author__ = 'Elmer de Looff <elmer@underdark.nl>'
__version__ = '0.2'
CONFIG = 'example.conf'
PACKAGE = 'uweb_info'
# PAGE_CLASS is the constant that defines the ... | Python | 0 | @@ -1390,11 +1390,10 @@
ing=
-Fals
+Tru
e)%0A
|
bee5ed1d9815a4c4291179d0de3ec54fe467b219 | Save sessions in JSON format instead of pickle. | project.py | project.py | import os, cPickle as pickle
import fileutil
class Project(object):
def __init__(self, name, rootdir, filename, session=None):
self.name = name
self.rootdir = rootdir
self.filename = filename
self.session = session
def read_project(filename, rootdir):
with open(filename, "rb") ... | Python | 0 | @@ -6,27 +6,21 @@
t os
-, cPickle as pickle
+%0Aimport json%0A
%0Aimp
@@ -331,22 +331,20 @@
ssion =
-pickle
+json
.loads(f
@@ -498,22 +498,20 @@
data =
-pickle
+json
.dumps(p
@@ -530,31 +530,16 @@
on,
-pickle.HIGHEST_PROTOCOL
+indent=2
)%0A
|
5b5ca9a25df66cef52d3e302a9bb135884f3981a | Update qt_translations.py | contrib/qt_translations.py | contrib/qt_translations.py | #!/usr/bin/env python
# Helpful little script that spits out a comma-separated list of
# language codes for Qt icons that should be included
# in binary bitcoin distributions
import glob
import os
import re
import sys
if len(sys.argv) != 3:
sys.exit("Usage: %s $QTDIR/translations $BITCOINDIR/src/qt/locale"%sys.arg... | Python | 0.000001 | @@ -285,10 +285,11 @@
s $B
-IT
+OWS
COIN
|
225a5987f4cdf494770321f4f37641902b0422d9 | add help command to help message | boxes/handlers/help_msg.py | boxes/handlers/help_msg.py | #Copyright (C) 2016 Zumium martin007323@gmail.com
#
#
#Licensed to the Apache Software Foundation (ASF) under one
#or more contributor license agreements. See the NOTICE file
#distributed with this work for additional information
#regarding copyright ownership. The ASF licenses this file
#to you under the Apache Lice... | Python | 0.000001 | @@ -2186,16 +2186,51 @@
n record
+%0Aboxes help%0A%09show this help message
%0A%0AThis s
|
14c7d797c3b327aa4e55efe832c536d14bee16fc | Update pelican config for the tag cloud | pelicanconf.py | pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import time
AUTHOR = u'Curtis Sand'
ABOUT_AUTHOR_URL = "pages/about-me.html"
SITENAME = u'Quizzical Silicon'
SITESUBTITLE=u'A charge carrier is not a wallet.'
SITEURL = 'http://curtissand.com/cs'
SITETHUMBNAIL_URL = SITEURL + '/ima... | Python | 0 | @@ -1229,17 +1229,21 @@
KS = (('
-t
+All T
ags', 'h
@@ -1290,17 +1290,17 @@
('
-a
+A
rchives'
@@ -1678,24 +1678,105 @@
c-popup/'),%0A
+ ('Tag Cloud', 'http://addywaddy.github.io/jquery.tagcloud.js/'),%0A
@@ -2213,9 +2213,10 @@
S =
-4
+10
%0ATAG
@@ -2239,10 +2239,9 @@
= 1
-00... |
5964a00279346f001fd4ddb0d6b13ddfd097bfc2 | Patch readme | ubelt/__init__.py | ubelt/__init__.py | # -*- coding: utf-8 -*-
"""
CommandLine:
# Partially regenerate __init__.py
mkinit ubelt
"""
# Todo:
# The following functions and classes are candidates to be ported from utool:
# * reload_class
# * inject_func_as_property
# * accumulate
# * rsync
# * ParamInfo - move to dtool
# * p... | Python | 0 | @@ -523,17 +523,17 @@
= '0.5.
-0
+1
'%0A%0A__sub
|
9344f45bdd9677ffe120bd3b9d96620fe8a9255e | fix pelican_dynamic name | pelicanconf.py | pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'jchen'
AUTHOR_FULLNAME = u'Jon Chen'
SITENAME = u'burrito'
SITEURL = 'http://burrito.sh'
SITETAGLINE = 'Excelling at mediocrity.'
TIMEZONE = 'Etc/UTC'
DEFAULT_LANG = u'en'
# theme stuff
THEME = './theme'
# plugins
PL... | Python | 0.015942 | @@ -410,17 +410,17 @@
'pelican
--
+_
dynamic'
|
b8dfd90bfa5b20dbfbc056ea5b461879bccfe6f8 | Improve smbio.util.pandas documentation. | smbio/util/pandas.py | smbio/util/pandas.py | """Utility functions for pandas."""
def dataframe_append(dataframe, rowdict):
"""
Shortcut method for appending a row to a DataFrame.
:param dataframe: The DataFrame to append to.
:param rowdict: A dictionary containing each column's value.
"""
newrow = len(dataframe)
dataframe.loc[newrow]... | Python | 0 | @@ -137,16 +137,17 @@
aFrame.%0A
+%0A
:par
@@ -149,16 +149,33 @@
:param
+pandas.DataFrame
datafram
@@ -216,16 +216,21 @@
:param
+dict
rowdict:
|
40dfaabfe07f3c18dba77d3d2fecbde0fbe62a8e | allow .(dot) in slug in path metadata | pelicanconf.py | pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'Siong-Ui Te'
SITENAME = u'Theory and Practice'
SITEURL = ''
PATH = 'content'
# avoid processing .html files
READERS = {'html': None}
# mix articles and static files in the same place
# @see https://github.com/getpelic... | Python | 0.000003 | @@ -845,16 +845,17 @@
-zA-Z0-9
+.
%5D*)%25(?P%3C
|
47734fedec22445506b6e95b0e1f466177105a7b | Fix logic in deletion of a version of a wiki page. Thanks to Keir Mierle for spotting this one. | trac/wiki/model.py | trac/wiki/model.py | # -*- coding: iso8859-1 -*-
#
# Copyright (C) 2003, 2004, 2005 Edgewall Software
# Copyright (C) 2003, 2004, 2005 Jonas Borgstrm <jonas@edgewall.com>
# Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
#
# Trac is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public Lice... | Python | 0.00058 | @@ -3284,16 +3284,24 @@
tchone()
+%5B0%5D == 0
:%0A
|
5f070174ea67966767b0ef9cf9ad6dcff24f245e | update copyright info | pelicanconf.py | pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import os
AUTHOR = u'Jayson Stemmler'
SITENAME = u'Jayson Stemmler'
SITEURL = ''
THEME_DIR = os.path.join(os.getenv("HOME"), 'Documents/Blogging/pelican-themes')
THEME = os.path.join(THEME_DIR, 'Flex')
USE_FOLDER_AS_CATEGORY = Tr... | Python | 0 | @@ -90,16 +90,32 @@
mport os
+%0Aimport datetime
%0A%0AAUTHOR
@@ -180,16 +180,112 @@
L = ''%0A%0A
+COPYRIGHT_NAME = %22Jayson Stemmler%22%0ACOPYRIGHT_YEAR = datetime.datetime.today().strftime('%25Y')%0A%0A#
THEME_DI
@@ -357,16 +357,18 @@
hemes')%0A
+#
THEME =
@@ -400,16 +400,39 @@
Flex')%0A%0A
+THEME = 'theme... |
ca45c0ff2b14c1d024a973fc45a74d42c910511b | Fix flushing | timid/main.py | timid/main.py | # Copyright 2015 Rackspace
# 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 app... | Python | 0.000299 | @@ -3528,16 +3528,43 @@
end='')
+%0A sys.stdout.flush()
%0A%0A
|
4c28879919e0b54738ddda804f0c1a0d0ebd70fd | Make request following safer | froide/foirequestfollower/views.py | froide/foirequestfollower/views.py | from django.shortcuts import get_object_or_404, redirect, render
from django.http import JsonResponse
from django.views.decorators.http import require_POST
from django.utils.translation import gettext_lazy as _
from django.contrib import messages
from froide.foirequest.models import FoiRequest
from froide.foirequest.v... | Python | 0.000011 | @@ -264,21 +264,20 @@
request.
-model
+view
s import
@@ -277,26 +277,20 @@
import
-FoiRequest
+show
%0Afrom fr
@@ -301,37 +301,36 @@
.foirequest.
-views
+auth
import
show%0Afrom fr
@@ -309,36 +309,60 @@
est.auth import
-show
+get_read_foirequest_queryset
%0Afrom froide.hel
@@ -500,24 +500,152 @@
quest, p... |
ba1be888b192386776901b1d9767f8f1adf1b5c5 | Version bump | verse/verse/__init__.py | verse/verse/__init__.py | """
verse
---
Check what's the latest version of your favorite open-source project
"""
from verse.celery import app as celery_app # noqa
__title__ = 'verse'
__version__ = '0.1.0'
__author__ = 'Paweł Adamczak'
__license__ = 'MIT'
__url__ = 'https://github.com/pawelad/verse'
| Python | 0.000001 | @@ -172,13 +172,13 @@
= '
+1.
0.1
-.0
'%0A__
@@ -224,11 +224,16 @@
= '
-MIT
+Apache 2
'%0A__
|
81e35a4cd97f34420b9b9bf0b59f245783df457d | Solve sum of multiples | python/sum-of-multiples/sum_of_multiples.py | python/sum-of-multiples/sum_of_multiples.py | def sum_of_multiples():
pass
| Python | 1 | @@ -18,16 +18,445 @@
les(
-):%0A pass
+limit, factors):%0A return sum(all_multiples(limit, factors))%0A%0A%0Adef all_multiples(limit, factors):%0A multiples = set()%0A for factor in factors:%0A multiples = multiples.union(get_multiples(limit, factor))%0A return multiples%0A%0Adef get_multiples(li... |
454b1718bf7daa6e224f911c9f807c3f4ed78981 | Set use_egg_info to True in freeze | pip2/commands/freeze.py | pip2/commands/freeze.py | """
Returns a dictionary containing all installed packages.
return: A dictionary, key is package name value is a dictionary with
information about package.
"""
from pip2.compat import packaging
def freeze():
results = list(packaging.database.get_distributions())
installed = dict()
for dist in re... | Python | 0.003129 | @@ -269,16 +269,33 @@
butions(
+use_egg_info=True
))%0A i
|
764b0125967fac2146e5b8cfb1e5d147bec862a8 | Add social links | pelicanconf.py | pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'Leonardo Zhou'
SITENAME = u'\u4e91\u7ffc\u56fe\u5357'
SITEURL = ''
TIMEZONE = 'Asia/Shanghai'
DEFAULT_LANG = u'zh'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = Non... | Python | 0 | @@ -370,57 +370,13 @@
= (
-('Pelican', 'http://getpelican.com/'),%0A
+%0A
-
('Py
@@ -413,34 +413,59 @@
'),%0A
- ('Jinja2
+)%0A%0A# Social widget%0ASOCIAL = (%0A ('twitter
', 'http
://j
@@ -464,213 +464,190 @@
http
+s
://
-jinja.pocoo.org/'),%0A ('You can modify those links in yo... |
507f90417338ffd3221723544bb68c680fbca1b8 | Add is in tree and fix is_in_tree | python_practice/graph/binary_search_tree.py | python_practice/graph/binary_search_tree.py |
class binary_search_tree(object):
def __init__(self, value):
self.value = value
self.right_node = None
self.left_node = None
def __str__(self):
print self.left_node
print self.value
print self.right_node
def insert_node(self, insert_value):
if insert_value == self.value:
retur... | Python | 0.000262 | @@ -1593,17 +1593,17 @@
esult =
-f
+F
alse%0A
@@ -1693,34 +1693,20 @@
re
-sult = (result and
+turn
self.le
@@ -1732,25 +1732,24 @@
earch_tree()
-)
%0A if self
@@ -1837,26 +1837,12 @@
re
-sult = (result and
+turn
sel
@@ -1880,77 +1880,345 @@
ee()
-)%0A return result%0A %0A def is_in_tree(s... |
6cda967d56a3cdf672576260af4d1e0218771855 | replace DummyDocument by DummyDocument{Odt, Weasyprint} | mapentity/tests/views.py | mapentity/tests/views.py | from mapentity import views as mapentity_views
from .models import DummyModel
class DummyList(mapentity_views.MapEntityList):
model = DummyModel
class DummyLayer(mapentity_views.MapEntityLayer):
model = DummyModel
class DummyJsonList(mapentity_views.MapEntityJsonList, DummyList):
pass
class DummyFo... | Python | 0.000003 | @@ -396,16 +396,19 @@
Document
+Odt
(mapenti
@@ -433,16 +433,120 @@
Document
+Odt):%0A model = DummyModel%0A%0A%0Aclass DummyDocumentWeasyprint(mapentity_views.MapEntityDocumentWeasyprint
):%0A m
|
80e59040dfdd14bf6af15e794cc06061236b924e | Fix auth.get_model. | django_authgroupex/auth.py | django_authgroupex/auth.py | # -*- coding: utf-8 -*-
# This code is distributed under the two-clause BSD license.
# Copyright (c) 2012-2013 Raphaël Barrois
from __future__ import absolute_import, unicode_literals
import logging
from django.db import models
from . import conf
PERM_USER = 'user'
PERM_GROUP_MEMBER = 'grpmember'
PERM_GROUP_ADM... | Python | 0 | @@ -665,24 +665,24 @@
if is
-subclass
+instance
(model_n
@@ -686,28 +686,61 @@
l_name,
-models.Model
+type) and issubclass(models.Model, model_name
):%0A
|
cdbbb74f61b2994f6dd100e23695515ec9e44b8d | fix typo | pathfinder/models.py | pathfinder/models.py | from couchdbkit.ext.django.schema import Document
from corehq.apps.reports.standard import CustomProjectReport
from corehq.apps.reports.fields import ReportField
from datetime import date
from pathfinder.views import retrieve_patient_group, get_patients_by_provider
from django.http import Http404
from dimagi.utils.couc... | Python | 0.999991 | @@ -2709,17 +2709,17 @@
rt_conte
-c
+x
t(self):
|
cbc9c3d075f8128e25aa4707998b89eeeff903a8 | Add check for mainConnection being None, which will set it | py/blog.py | py/blog.py | import database
import configmanager
mainConnection = database.ConnectionManager.getConnection("main")
def getPosts(connection = mainConnection):
posts = {} #Will be a dict formatted as such {postId: {post: $POST_OBJECT_FROM_DATABASE, tags: [$TAGS_FROM_DATABASE]}}
postsAndTags = connection.session.query(database.ta... | Python | 0.000007 | @@ -31,17 +31,24 @@
anager%0A%0A
-m
+def getM
ainConne
@@ -48,26 +48,35 @@
inConnection
- =
+():%0A%09return
database.Co
@@ -114,16 +114,55 @@
main%22)%0A%0A
+mainConnection = getMainConnection() %0A%0A
def getP
@@ -196,16 +196,169 @@
ction):%0A
+%09global mainConnection%0A%09if connection == mainConnection and... |
3aeaea75bd5b1db66e6dea9e5c1f41f3f9c6ed9e | Enable rudimentary logging to stderr in the Python start script. | bin/start.py | bin/start.py | #!/usr/bin/python
import sys, os
from paste.deploy import loadapp, loadserver
from paste import httpserver
if __name__ == '__main__':
realfile = os.path.realpath(__file__)
realdir = os.path.dirname(realfile)
pardir = os.path.realpath(os.path.join(realdir, os.pardir))
confdir = os.path.join(pardir, 'conf')
paste_... | Python | 0 | @@ -100,16 +100,31 @@
tpserver
+%0Aimport logging
%0A%0Aif __n
@@ -144,16 +144,39 @@
ain__':%0A
+%09logging.basicConfig()%0A
%09realfil
|
a587d48694690957934a159bad98cacd3f012a6a | Change contextlib import to handle the new location in Python 3. | cms/tests/test_externals.py | cms/tests/test_externals.py | from django.test import TestCase
from ..externals import External
from contextlib import GeneratorContextManager
from types import FunctionType
class TestExternals(TestCase):
def test_load(self):
external = External('foo')
with self.assertRaises(ImportError):
external._load('')
... | Python | 0 | @@ -61,16 +61,25 @@
ternal%0A%0A
+try:%0A
from con
@@ -117,16 +117,116 @@
Manager%0A
+except ImportError:%0A from contextlib import _GeneratorContextManager as GeneratorContextManager%0A%0A
from typ
|
9d57f85837d577e733cf1a45e560fc763a62be1f | Implement a custom exception type for undefined variable errors | cookiecutter/exceptions.py | cookiecutter/exceptions.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
cookiecutter.exceptions
-----------------------
All exceptions used in the Cookiecutter code base are defined here.
"""
class CookiecutterException(Exception):
"""
Base exception class. All Cookiecutter-specific exceptions should subclass
this class.
... | Python | 0.000004 | @@ -2125,16 +2125,500 @@
t fails%0A %22%22%22%0A
+%0A%0Aclass UndefinedVariableInTemplate(CookiecutterException):%0A %22%22%22Raised when a template uses a variable which is not defined in the%0A context.%0A %22%22%22%0A def __init__(self, message, error, context):%0A self.message = message%0A ... |
5558db6600e0d9c4c38419fa9bffc14fbe07eb42 | streamline conversion to pifset, update documentation | radiometric_normalization/transformation.py | radiometric_normalization/transformation.py | '''
Copyright 2015 Planet Labs, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwa... | Python | 0 | @@ -791,32 +791,33 @@
ghts, reference_
+g
img, candidate_i
@@ -815,16 +815,17 @@
ndidate_
+g
img,%0A
@@ -892,95 +892,121 @@
he l
-ook-up table that applies a radiometric transformation%0A to the candidate image based
+inear transformations (scale, offset) that%0A normalizes the candidate image to the refe... |
278069a0637f7f329ceaff0975e3b95d609a7b9f | Improve the command line interface | cosmoscope/cli.py | cosmoscope/cli.py | # -*- coding: utf-8 -*-
"""Console script for cosmoscope."""
import sys
import click
@click.command()
def main(args=None):
"""Console script for cosmoscope."""
click.echo("Replace this message by putting your code into "
"cosmoscope.cli.main")
click.echo("See click documentation at http://... | Python | 0.000219 | @@ -84,272 +84,406 @@
ck%0A%0A
-%0A@click.command()%0Adef main(args=None):%0A %22%22%22Console script for cosmoscope.%22%22%22%0A click.echo(%22Replace this message by putting your code into %22%0A %22cosmoscope.cli.main%22)%0A click.echo(%22See click documentation at http://click.pocoo.org/%22)... |
970791c262278ca8822fa821af7c9a27bf484e62 | Handle case when no rows are returned, but not done | couchbase/n1ql.py | couchbase/n1ql.py | #
# Copyright 2015, Couchbase, Inc.
# 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 l... | Python | 0.000008 | @@ -6066,16 +6066,169 @@
eturn %5B%5D
+%0A else:%0A # We can only get here if another concurrent query broke out the%0A # event loop before we did.%0A return %5B%5D
%0A%0A de
|
36c05c2239708bf385466a13cd909c6702a640f8 | Update core.py | pghero/core.py | pghero/core.py | from queries import Queries as q
from exceptions import NotPostgresEngine
try:
from sqlalchemy.exc import ProgrammingError
except ImportError:
print 'Sqlalchemy is not installed in this system.'
def pghero(toolkit, db):
if toolkit == 'sqlalchemy':
return SqlAlchemyPgHero(db)
class PgHeroBase():
... | Python | 0.000001 | @@ -1372,24 +1372,25 @@
e)%0A %0A
+#
def slow_que
@@ -1401,24 +1401,25 @@
(self):%0A
+#
if self.
@@ -1437,32 +1437,33 @@
_enabled():%0A
+#
return s
@@ -1493,24 +1493,25 @@
ueries)%0A
+#
return %5B
|
c3665ca2ff82fe2ae827f8d14a8322779714f503 | fix #2, pass through settings to db | peeringdb/localdb.py | peeringdb/localdb.py |
import django
import os
from django.conf import settings
from django.core.management import call_command
# lazy init for translations
_ = lambda s: s
def django_configure(cfg):
db_fields = (
'ENGINE',
'HOST',
'NAME',
'PASSWORD',
'PORT',
'USER',
)
db = {}
... | Python | 0 | @@ -567,16 +567,283 @@
%7D%0A%0A
+ extra = %7B%0A 'PEERINGDB_SYNC_URL': cfg%5B'peeringdb'%5D.get('url', ''),%0A 'PEERINGDB_SYNC_USERNAME': cfg%5B'peeringdb'%5D.get('user', ''),%0A 'PEERINGDB_SYNC_PASSWORD': cfg%5B'peeringdb'%5D.get('password', ''),%0A 'PEERINGDB_SYNC_STRIP_TZ': True... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.