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 |
|---|---|---|---|---|---|---|---|
bfbb7af883da0c3387ed29118d2bc203e9b09898 | Fix tests to accomodate replacement of degree symbol in ingredients | tests/test_base_recipes.py | tests/test_base_recipes.py | '''Testing script for basic recipe conversion from json'''
import sys
import json
import pytest
import urllib.request
import bs4 as bs
sys.path.insert(0, 'website_generator')
import webpageGenerator as gen
def get_html_from_url(url):
url_open = urllib.request.urlopen(url)
raw_page = url_open.read()
page ... | Python | 0 | @@ -2440,16 +2440,211 @@
string)%0A
+ output_string = gen.replace_degrees_in_string(output_string)%0A # Replace html coded degree symbol with unicode symbol for comparison%0A output_string = output_string.replace('°', '%C2%B0')%0A
retu
|
68b65c294d824b1ce89f43786b4f3feede28b7d9 | use correct advection equations | tests/test_condensation.py | tests/test_condensation.py | from gusto import *
from firedrake import as_vector, Constant, sin, cos, \
PeriodicIntervalMesh, ExtrudedMesh, Expression, \
SpatialCoordinate
import json
from math import pi
def setup_condens(dirname):
# declare grid shape, with length L and height H
L = 1000.
H = 1000.
nlayers = int(H / 100.... | Python | 0.00013 | @@ -3245,22 +3245,23 @@
n_dict%5B%22
-tracer
+water_v
%22%5D = SSP
@@ -3271,22 +3271,89 @@
(state,
-tracer
+water_v0, thetaeqn)%0A advection_dict%5B%22water_c%22%5D = SPPRK3(state, water_c
0, theta
|
e9cdd0a05a6ea144b029cb893d00aa4caf055c4b | Remove unused imports. | tests/test_examplefiles.py | tests/test_examplefiles.py | # -*- coding: utf-8 -*-
"""
Pygments tests with example files
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import unittest
from pygments import highlight
from pygments.lexers import get_lexer... | Python | 0 | @@ -232,55 +232,8 @@
os%0A
-import unittest%0A%0Afrom pygments import highlight
%0Afro
|
49feeac25b33ebf79cc103e12d0ed4623c96ec71 | Add transaction.to_hex() test | tests/test_transactions.py | tests/test_transactions.py | from __future__ import unicode_literals
import unittest
from transactions import Transaction
class TransactionTests(unittest.TestCase):
def setUp(self):
inputs = [
('b0ff74bb0dd894797153ccb862c9f9a488e657452647ada440fe1006ece95c78', 0),
('683d180645632d45f23baf2fb2897241321c1af7... | Python | 0.00001 | @@ -1248,20 +1248,412 @@
-pass
+self.assertEqual(%0A self.tx.to_hex(),%0A '0100000002785ce9ec0610fe40a4ad47264557e688a4f9c962b8cc53717994d80dbb74ffb00000000000ffffffff226aae7b51aa24bd4e06f379f71a1c32417289b22faf3bf2452d634506183d680000000000ffffffff02e8030000000000001a76a94c1492340420497... |
540498265c706232d645c96c04c774c0b04ccc84 | remove test_featurewise_anomaly_score_notfitted method temporarily | kenchi/outlier_detection/tests/test_reconstruction_based.py | kenchi/outlier_detection/tests/test_reconstruction_based.py | import unittest
import matplotlib
import matplotlib.axes
import numpy as np
from sklearn.exceptions import NotFittedError
from sklearn.utils.estimator_checks import check_estimator
from kenchi.datasets import make_blobs
from kenchi.outlier_detection import PCA
matplotlib.use('Agg')
import matplotlib.pyplot as plt
... | Python | 0.000002 | @@ -955,168 +955,8 @@
X)%0A%0A
- def test_featurewise_anomaly_score_notfitted(self):%0A with self.assertRaises(NotFittedError):%0A self.sut.featurewise_anomaly_score(self.X)%0A%0A
|
450fcd7093331984e25c8bb7475f394d3663e835 | fix error domain name | tests/twisted/constants.py | tests/twisted/constants.py | """
Some handy constants for other tests to share and enjoy.
"""
from dbus import PROPERTIES_IFACE
HT_CONTACT = 1
HT_ROOM = 2
CHANNEL = "org.freedesktop.Telepathy.Channel"
CHANNEL_IFACE_GROUP = CHANNEL + ".Interface.Group"
CHANNEL_IFACE_HOLD = CHANNEL + ".Interface.Hold"
CHANNEL_IFACE_MEDIA_SIGNALLING = CHANNEL + ".... | Python | 0.000024 | @@ -1374,17 +1374,16 @@
'%0A%0AERROR
-S
= 'org.
@@ -1409,17 +1409,16 @@
hy.Error
-s
'%0AINVALI
@@ -1431,25 +1431,24 @@
MENT = ERROR
-S
+ '.Invalid
@@ -1472,33 +1472,32 @@
LEMENTED = ERROR
-S
+ '.NotImplemen
@@ -1522,17 +1522,16 @@
= ERROR
-S
+ '.Not
|
b226aa22090862b3e7d61f2688bdb53d30240220 | Add project info to ut | Wrappers/CCP4/Combat.py | Wrappers/CCP4/Combat.py | #!/usr/bin/env python
# Combat.py
# Copyright (C) 2006 CCLRC, Graeme Winter
#
# This code is distributed under the BSD license, a copy of which is
# included in the root directory of this package.
#
# 5th June 2006
#
# An example of an combat CCP4 program wrapper, which can be used as the
# base for other wrap... | Python | 0 | @@ -4421,16 +4421,71 @@
(hklin)%0A
+ c.set_project_information('TS00', '13185', 'INFL')%0A
c.se
|
31af4169b978cb96c20265f1fe6b009da7b589d5 | Put log file in user data folder | src/mcedit2/main.py | src/mcedit2/main.py | """
main.py
"""
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
import traceback
import OpenGL
from mcedit2.util import custom_traceback
custom_traceback.install()
# IMPORTANT: Must set OpenGL.BLAH_BLAH **BEFORE** importing OpenGL.GL
if "-log"... | Python | 0.000002 | @@ -1199,241 +1199,112 @@
-logfilename = 'mcedit.log'%0A abslogfile = os.path.abspath(logfilename)%0A if hasattr(sys, 'frozen'):%0A log_debug(%22sys.frozen is set%22)%0A%0A if sys.platform == %22win32%22:%0A if hasattr(sys, '_MEIPASS'):%0A
+from mcedit2.util.directories ... |
b02335f4fef11a51ec4dd667fcaa112c8fb800bd | fix ignore error bug. | jslint.py | jslint.py | import os
import re
import sublime
import sublime_plugin
from statusprocess import *
from asyncprocess import *
RESULT_VIEW_NAME = 'jslint_result_view'
SETTINGS_FILE = "sublime-jslint.sublime-settings"
class ShowJslintResultCommand(sublime_plugin.WindowCommand):
"""show jslint result"""
def run(self):
self.wi... | Python | 0 | @@ -2713,16 +2713,40 @@
ontinue%0A
+ ignored = False%0A
@@ -2811,24 +2811,16 @@
e, line)
- == None
:%0A
@@ -2829,43 +2829,22 @@
-text += line + '%5Cn'%0A else:
+ignored = True
%0A
@@ -3054,16 +3054,93 @@
------%22%0A
+ break%0A if ignored == False:%0A ... |
09ed01974e5fd921d367a6e48e6cc7e382badfe7 | bump version to 0.5.0 | graphql/__init__.py | graphql/__init__.py | __version__ = '0.4.0'
| Python | 0.000001 | @@ -14,9 +14,9 @@
'0.
-4
+5
.0'%0A
|
d0cfa172c551f201da91f6f2ca88ff15fd308675 | Add ansible sudo options to the deployment | manage.py | manage.py | #! /usr/bin/python
from __future__ import print_function
import os
import time
import random
import string
import subprocess
from _lib.bootstrapping import bootstrap_env, from_project_root, requires_env, from_env_bin
from _lib.ansible import ensure_ansible
bootstrap_env(["base"])
from _lib.params import APP_NAME
fr... | Python | 0 | @@ -1915,23 +1915,160 @@
ue)%0A
-def deploy(dest
+@click.option(%22--sudo/--no-sudo%22, default=False)%0A@click.option(%22--ask-sudo-pass/--no-ask-sudo-pass%22, default=False)%0Adef deploy(dest, sudo, ask_sudo_pass
):%0A
@@ -2086,16 +2086,37 @@
loy(dest
+, sudo, ask_sudo_pass
)%0A%0A%0Adef
@@ -2131,16 +2131,49 @@... |
588e1474c0ee4e3f7fc02c5dc4785f70fefa371f | Update AvailableMachinesModel to account for Resources.getLocation returning a list | UM/Qt/Bindings/AvailableMachinesModel.py | UM/Qt/Bindings/AvailableMachinesModel.py | from PyQt5.QtCore import Qt, pyqtSlot, pyqtProperty, pyqtSignal
from UM.Qt.ListModel import ListModel
from UM.Resources import Resources
from UM.Application import Application
from UM.Logger import Logger
from UM.Settings.MachineSettings import MachineSettings
import os
import os.path
import json
class AvailableMach... | Python | 0 | @@ -1039,16 +1039,17 @@
dir
+s
= Resou
@@ -1094,16 +1094,110 @@
ation)%0A%0A
+ for dir in dirs:%0A if not os.path.isdir(dir):%0A continue%0A%0A
@@ -1217,32 +1217,36 @@
s.listdir(dir):%0A
+
data
@@ -1265,16 +1265,20 @@
+
path = o
@@... |
5c361349b0b13d8ccffad962f63c3711d024a20e | Add PyBuffer.h to the header test black list. | Utilities/Maintenance/BuildHeaderTest.py | Utilities/Maintenance/BuildHeaderTest.py | #!/usr/bin/env python
#==========================================================================
#
# Copyright Insight Software Consortium
#
# 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 Licen... | Python | 0.000003 | @@ -1819,24 +1819,67 @@
WCommon.h',%0A
+ 'itkPyBuffer.h', # needs Python.h, etc%0A
'itkVanH
@@ -2909,34 +2909,39 @@
te,
-re-run CMake configuration
+build the ITKHeaderTests target
.%0A//
|
89701f002f8831ca2133aab0cc56319e33d18eed | Fix import | thinc/layers/with_debug.py | thinc/layers/with_debug.py | from typing import Optional, Callable, Any, Tuple
from thinc.api import Model
do_nothing = lambda *args, **kwargs: None
def with_debug(
layer: Model,
name: Optional[str] = None,
*,
on_init: Callable[[Model, Any, Any], None] = do_nothing,
on_forward: Callable[[Model, Any, bool], None] = do_nothin... | Python | 0.000002 | @@ -47,22 +47,21 @@
ple%0A
+%0A
from
-thinc.api
+..model
imp
|
55a29fbc72e7f54d7b622119f5300a1dc13f931e | fix func name | src/operation/vm.py | src/operation/vm.py | # coding: UTF-8
import time
import libvirt
import enum
from kvmconnect.base import BaseOpen
from operation.xmllib.vm import VmGen
from operation.xmllib.pool import PoolGen
class Status(BaseOpen):
"""
manage vm status
"""
status = enum.Enum('status', 'poweroff running')
def __init__(self):
... | Python | 0.99999 | @@ -803,11 +803,8 @@
stop
-_vm
(sel
@@ -1595,25 +1595,24 @@
VM%0A %22%22%22%0A
-%0A
def __in
|
77132e94789cc1b2f7765c34545d39f4770e3aa2 | Use the local logger.info instead of logging.info. This can cause issues with the line with other loggers. | synapse/lib/modules.py | synapse/lib/modules.py | '''
Module which implements the synapse module API/convention.
'''
import logging
import synapse.dyndeps as s_dyndeps
logger = logging.getLogger(__name__)
synmods = {}
modlist = []
def call(name, *args, **kwargs):
'''
Call the given function on all loaded synapse modules.
Returns a list of name,ret,exc... | Python | 0 | @@ -1249,19 +1249,18 @@
logg
-ing
+er
.info('l
|
650b71c637b6bd09a757791b9f9d8483eb153d58 | Prepare release 0.6b1 | fluxghost/__init__.py | fluxghost/__init__.py |
__version__ = "0.6a1"
DEBUG = False
| Python | 0.000001 | @@ -12,17 +12,17 @@
_ = %220.6
-a
+b
1%22%0ADEBUG
|
d7a0555db67d00eb6ac18f549e8d51a1281a175a | Make tests run with Python 2.7 (SF #3308772). | formencode/htmlgen.py | formencode/htmlgen.py | """
Kind of like htmlgen, only much simpler. The only important symbol
that is exported is ``html``.
This builds ElementTree nodes, but with some extra useful methods.
(Open issue: should it use ``ElementTree`` more, and the raw
``Element`` stuff less?)
You create tags with attribute access. I.e., the ``A`` anchor ... | Python | 0 | @@ -2800,24 +2800,16 @@
tr, %7B%7D)%0A
-
%0A def
@@ -5544,20 +5544,16 @@
(list):%0A
-
%0A def
|
3563be1d748033ebae41ba1870929e1161fdb7f6 | Add unittest for PageForm widgets | formly/tests/tests.py | formly/tests/tests.py | from django.core.exceptions import ValidationError
from django.contrib.auth import get_user_model
from django.test import TestCase
from ..models import (
Field,
Survey,
FieldChoice,
)
User = get_user_model()
class Tests(TestCase):
def setUp(self):
self.user = User.objects.create_user("foo",... | Python | 0 | @@ -123,16 +123,54 @@
TestCase
+%0Afrom formly.forms.run import PageForm
%0A%0Afrom .
@@ -226,16 +226,26 @@
Choice,%0A
+ Page,%0A
)%0A%0AUser
@@ -2168,8 +2168,1379 @@
ce_pks)%0A
+%0A def test_multiplechoice_field_choice_form_widgets(self):%0A%0A survey = Survey.objects.create(%0A name=%22c... |
98e2d36d4759e24eb5c03d369d1cd0ac8c3dfdcf | Add Project.queue_name to list_filter and list_display | frigg/builds/admin.py | frigg/builds/admin.py | # -*- coding: utf8 -*-
from django.contrib import admin
from django.template.defaultfilters import pluralize
from .models import Build, BuildResult, Project
class BuildResultInline(admin.StackedInline):
model = BuildResult
readonly_fields = ('result_log', 'succeeded')
extra = 0
max_num = 0
class Bu... | Python | 0 | @@ -590,16 +590,30 @@
sitory',
+ 'queue_name',
'averag
@@ -668,16 +668,30 @@
%5B'owner'
+, 'queue_name'
%5D%0A ac
|
4bd328d14f5997bb8cd605ace428f8f95d7f7ea5 | update public data in a loop | example/website/scripts/generate_static_data.py | example/website/scripts/generate_static_data.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os
from bgpranking import tools
csv_dir = os.path.join('..', 'data', 'csv')
tools.prepare_all_csv(csv_dir)
agg_csv_dir = os.path.join('..', 'data', 'csv_agg')
# cat LU-overall-allocv4-v6-asn.txt | grep asn | cut -d "|" -f 4
lu_raw_asns = open('lu_asns_dump', 'r').rea... | Python | 0 | @@ -45,16 +45,28 @@
mport os
+%0Aimport time
%0A%0Afrom b
@@ -137,40 +137,8 @@
v')%0A
-tools.prepare_all_csv(csv_dir)%0A%0A
agg_
@@ -185,16 +185,112 @@
v_agg')%0A
+js_dir = os.path.join('..', 'data', 'js')%0A%0A%0Awhile True:%0A tools.prepare_all_csv(csv_dir)%0A%0A
# cat LU
@@ -346,16 +346,20 @@
%7C%22 -f... |
6539eb0449f1da6f367d1313c3b34946fd5e4167 | Remove doc from the module. | generate_ldap_diff.py | generate_ldap_diff.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import base64
import fileinput
import pprint
import re
"""
# Based on:
# - http://wiki.zimbra.com/wiki/ShanxT-LDAP-CheatSheet
# - http://wiki.zimbra.com/wiki/Setting_zimbra_admin_password_in_LDAP
# - http://www.openldap.org/faq/data/cache/347.html
... | Python | 0 | @@ -101,1461 +101,113 @@
ort
-pprint%0Aimport re%0A%0A%0A%22%22%22%0A%0A# Based on:%0A# - http://wiki.zimbra.com/wiki/ShanxT-LDAP-CheatSheet%0A# - http://wiki.zimbra.com/wiki/Setting_zimbra_admin_password_in_LDAP%0A# - http://www.openldap.org/faq/data/cache/347.html%0A# - http://wiki.zimbra.com/wiki/Integrating_P... |
2eff140499c66562f8a87d32531d3ecbb78b57f2 | Fix import for py3k | geoalchemy2/compat.py | geoalchemy2/compat.py | """
Python 2 and 3 compatibility:
- Py3k `memoryview()` made an alias for Py2k `buffer()`
- Py3k `bytes()` made an alias for Py2k `str()`
"""
import __builtin__
import sys
if sys.version_info[0] == 2:
buffer = getattr(__builtin__, 'buffer')
bytes = str
else:
# Python 2.6 flake8 workaround
buf... | Python | 0 | @@ -144,16 +144,25 @@
()%60%0A%22%22%22%0A
+try:%0A
import _
@@ -171,16 +171,69 @@
uiltin__
+ as builtins%0Aexcept ImportError:%0A import builtins%0A
%0Aimport
@@ -287,27 +287,24 @@
getattr(
-__
builtin
-__
+s
, 'buffe
@@ -386,27 +386,24 @@
getattr(
-__
builtin
-__
+s
, 'memor
|
ec8240cb979607d8964877d920b4a857aa374d01 | line length. config notes | get_interface_util.py | get_interface_util.py | #!/usr/bin/env python
"""
Specifically written for Python 2.6 because that's what I have.
Get the % of utilized interfaces on the stack. Do not include feeds or other
non-access ports.
"""
# RPC calls can be returned in XML format in Junos by passing "| display xml"
# to the command. Can I use the json module to par... | Python | 0.999251 | @@ -1142,16 +1142,148 @@
riables.
+%0A%0A # Need to create better way to get config for portability. Multiple%0A # devices with multiple default creds.
%0A
@@ -1459,17 +1459,42 @@
p_rpc =
-%22
+str(%0A '
show eth
@@ -1532,33 +1532,34 @@
il %7C display xml
-%22
+')
... |
8ee69e939c6a6227a80437f0027909f213b13e7d | Fix pep 8 failure for CICD | plyer/platforms/linux/filechooser.py | plyer/platforms/linux/filechooser.py | '''
Linux file chooser
------------------
'''
from plyer.facades import FileChooser
from distutils.spawn import find_executable as which
import os
import subprocess as sp
import time
class SubprocessFileChooser:
'''A file chooser implementation that allows using
subprocess back-ends.
Normally you only ne... | Python | 0 | @@ -1724,24 +1724,49 @@
n_selection(
+%0A
self._split_
|
3c9e87e48ab65db36e503090af7cc244354e679f | Remove multiline handing attemp, Fix #5 | powershell_kernel/powershell_repl.py | powershell_kernel/powershell_repl.py | # -*- coding: utf-8 -*-
# Copyright (c) 2011, Wojciech Bederski (wuub.net)
# All rights reserved.
# See LICENSE.txt for details.
import os
import re
from . import subprocess_repl
# PowerShell in interactive mode shows no prompt, so we must hold it by hand.
# Every command prepended with other command, which will outpu... | Python | 0 | @@ -177,467 +177,8 @@
pl%0A%0A
-# PowerShell in interactive mode shows no prompt, so we must hold it by hand.%0A# Every command prepended with other command, which will output only one character ('.')%0A# When user command leads to no output (for example, 'cd ..'), we get only this character,%0A# and then we send comm... |
e4af11394bfc81d4476af2a8fe60f82f11e674d6 | Add staticfiles URLs to urls.development by default | project_template/urls/development.py | project_template/urls/development.py | """
Add any additional URLs that should only be available when using the the
settings.development configuration.
See ``urls.defaults`` for a list of all URLs available across both
configurations.
"""
from .defaults import *
urlpatterns += patterns('',
# Examples:
# url(r'^$', '{{ project_name }}.views.debug'... | Python | 0.000001 | @@ -410,8 +410,158 @@
s')),%0A)%0A
+%0A# Load staticfiles for testing purposes%0Afrom django.contrib.staticfiles.urls import staticfiles_urlpatterns%0Aurlpatterns += staticfiles_urlpatterns()%0A
|
86d319f0dc517c7542c5f5186fae6eafbe128199 | current time now equals the most recent time in the database, not NOW | pyfiles/prediction/run_prediction.py | pyfiles/prediction/run_prediction.py | #!/usr/bin/python
'''
Run Prediction
----------------------------------
Obtain a prediction for the specified device ID.
Note: when running ./run_prediction.py <ID>, it looks for the model file in
```
./pyfiles/prediction/dat/model-<ID>.dat
```
'''
# Scientific Libraries
from numpy impo... | Python | 0.999995 | @@ -3324,16 +3324,160 @@
######%0A%0A
+ c.execute('SELECT max(time_stamp) as current FROM averaged_location WHERE device_id = %25s', (str(DEV_ID),))%0A current = c.fetchall()%5B0%5D%5B0%5D%0A
%0A pri
@@ -4161,30 +4161,31 @@
now (%22+str(
-row%5B1%5D
+current
)+%22), at %22+s
@@ -4243,22 +4243,23 @@
e%22:... |
63e646af52a4b44aa89c9363e3b19c62ab76a67e | Change get_tfidf and get_doclength to public method | pygraphc/preprocess/PreprocessLog.py | pygraphc/preprocess/PreprocessLog.py | from nltk import corpus
from collections import Counter
from math import log, pow, sqrt
from re import sub
class PreprocessLog:
def __init__(self, logfile):
self.logfile = logfile
self.logs = []
self.loglength = 0
self.events_list = []
self.events_unique = []
def do_pr... | Python | 0 | @@ -121,16 +121,24 @@
ocessLog
+(object)
:%0A de
@@ -161,16 +161,21 @@
logfile
+=None
):%0A
@@ -977,26 +977,24 @@
fidf = self.
-__
get_tfidf(ev
@@ -1289,26 +1289,24 @@
ngth = self.
-__
get_doclengt
@@ -3214,26 +3214,24 @@
t)%0A%0A def
-__
get_tfidf(se
@@ -4033,34 +4033,32 @@
cs)
- ... |
af9cec1e43e8cff9542ba26ad7029d3eb4a0e7fd | set default value for 'dir' to avoid breaking backward compatibility | pytest-profiling/pytest_profiling.py | pytest-profiling/pytest_profiling.py | from __future__ import absolute_import
import sys
import os
import cProfile
import pstats
import pipes
import errno
from hashlib import md5
import six
import pytest
LARGE_FILENAME_HASH_LEN = 8
def clean_filename(s):
forbidden_chars = set('/?<>\:*|"')
return six.text_type("".join(c if c not in forbidden_cha... | Python | 0.000001 | @@ -557,16 +557,21 @@
svg, dir
+=None
):%0A
|
d11d4cf968cb77643278035cc98ded907c159453 | fix url formatting | python/citation_vim/bibtex/parser.py | python/citation_vim/bibtex/parser.py | # -*- coding: utf-8 -*-
import os.path
import sys
from pybtex.database.input import bibtex
from citation_vim.item import Item
from citation_vim.utils import check_path, raiseError
class bibtexParser(object):
def __init__(self, context):
self.context = context
self.bibtex_file = check_path(self.con... | Python | 0.003891 | @@ -4433,337 +4433,8 @@
%22%22%22%0A
- attachment = %22%22%0A if u%22file%22 in entry.fields:%0A for file in entry.fields%5Bu%22file%22%5D.split(%22;%22):%0A details = file.split(%22:%22)%0A if 2 %3C len(details) and details%5B2%5D == %22application/pdf%22:%0A ... |
eee1320b873f4dcfd78857d80aa06a99cca90916 | Change code style | python/paddle/v2/reader/decorator.py | python/paddle/v2/reader/decorator.py | # Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | Python | 0.000001 | @@ -5270,24 +5270,30 @@
def
-__impl__
+batched_reader
():%0A
@@ -5544,13 +5544,19 @@
urn
-__impl__
+batched_reader
%0A
|
5c45fbd31c61dc72ce1e620c2840f06334f1cc3c | improve 'Create' entry: use q; only if needed | autocomplete_light/example_apps/create_choice_on_the_fly/autocomplete_light_registry.py | autocomplete_light/example_apps/create_choice_on_the_fly/autocomplete_light_registry.py | import autocomplete_light.shortcuts as autocomplete_light
from django import http
from .models import OnTheFly
class OnTheFlyAutocomplete(autocomplete_light.AutocompleteModelBase):
choices = OnTheFly.objects.all()
def autocomplete_html(self):
html = super(OnTheFlyAutocomplete, self).autocomplete_htm... | Python | 0.000002 | @@ -317,16 +317,120 @@
_html()%0A
+ q = self.request.REQUEST.get('q')%0A if q and not q in %5Bc.name for c in self.choices%5D:%0A
@@ -475,19 +475,20 @@
ate
-Fly
+%22%7B%7D%22
%3C/span%3E'
%0A
@@ -483,16 +483,26 @@
%3C/span%3E'
+.format(q)
%0A
|
5fa5d1745dafdd8cb8ba8ad9122469ee93e0e4f9 | Update "check-license.py" so that it can generate license text applicable to this year. | tools/dev/check-license.py | tools/dev/check-license.py | #!/usr/bin/env python
#
# check if a file has the proper license in it
#
# USAGE: check-license.py [-C] file1 file2 ... fileN
#
# A 'file' may in fact be a directory, in which case it is recursively
# searched.
#
# If the license cannot be found, then the filename is printed to stdout.
# Typical usage:
# $ check-lic... | Python | 0.000212 | @@ -1564,9 +1564,9 @@
-200
-5
+8
Col
|
f72d44d38a21763bbb12816861b0cfc1abe6f8fb | Add Course ID in logging | openedx/core/djangoapps/content/course_overviews/signals.py | openedx/core/djangoapps/content/course_overviews/signals.py | """
Signal handler for invalidating cached course overviews
"""
import logging
from django.dispatch.dispatcher import receiver
from .models import CourseOverview
from openedx.core.djangoapps.signals.signals import COURSE_PACING_CHANGED, COURSE_START_DATE_CHANGED
from xmodule.modulestore.django import SignalHandler
L... | Python | 0 | @@ -2674,16 +2674,27 @@
changed:
+ course=%7B0%7D
previou
@@ -2700,17 +2700,17 @@
us=%7B
-0
+1
%7D new=%7B
-1
+2
%7D'.f
@@ -2716,16 +2716,52 @@
format(%0A
+ updated_course_overview.id,%0A
|
cf0366a2556c2ccd52b599e2b243d4cc75de2682 | print names of intent and mapped action | rasa/core/policies/mapping_policy.py | rasa/core/policies/mapping_policy.py | import logging
from typing import Any, List, Text
from rasa.core.actions.action import (
ACTION_BACK_NAME, ACTION_LISTEN_NAME, ACTION_RESTART_NAME)
from rasa.core.constants import USER_INTENT_BACK, USER_INTENT_RESTART
from rasa.core.domain import Domain
from rasa.core.events import ActionExecuted
from rasa.core.po... | Python | 0 | @@ -2443,48 +2443,113 @@
%22The
-re is a mapped action for the predicted
+ predicted intent is '%7B%7D', which is mapped to %22%0A %22 action '%7B%7D' in the domain.
%22%0A
@@ -2576,24 +2576,40 @@
%22
-intent.%22
+%22.format(intent, action)
)%0A
@@ -2821,16 +2821,113 @@
... |
8d8f076aca177304178919d8c93e031c2646c059 | Add additional pid/vid | gxs700/dump_eeprom.py | gxs700/dump_eeprom.py | # https://github.com/vpelletier/python-libusb1
# Python-ish (classes, exceptions, ...) wrapper around libusb1.py . See docstrings (pydoc recommended) for usage.
import usb1
# Bare ctype wrapper, inspired from library C header file.
import libusb1
import binascii
def nulls(s, offset):
return s[offset:s.find('\x00',... | Python | 0.000003 | @@ -1628,24 +1628,51 @@
...%0A '''%0A
+ print 'Reading EEPROM'%0A
res = de
@@ -1718,16 +1718,16 @@
0, 256)%0A
-
if l
@@ -1837,16 +1837,17 @@
t 'Read
+E
EPROM ok
@@ -2208,16 +2208,227 @@
0xEC)%0A%0A
+pidvid2name = %7B%0A #(0x5328, 0x2009): 'Dexis Platinum (pre-enumeration)'%0A (0x532... |
1960ed67b7f5098cd518e5faa578b47ca69b889d | Add locks to allow use with threaded applications | src/circuit_breaker.py | src/circuit_breaker.py | import time
import functools
CLOSED = 0
OPEN = 1
HALF_OPEN = 2
class CircuitBreaker(object):
def __init__(self, allowed_fails=3, retry_time=30, validation_func=None):
'''
Initializes Breaker object
Args:
allowed_fails(int): Maximum number of consecutive failures allowed befo... | Python | 0.000001 | @@ -22,16 +22,33 @@
nctools%0A
+import threading%0A
%0A%0ACLOSED
@@ -858,16 +858,55 @@
on_func%0A
+ self._lock = threading.RLock()%0A
@@ -1116,24 +1116,53 @@
alf open'''%0A
+ with self._lock:%0A
self
@@ -1175,16 +1175,20 @@
= OPEN%0A
+
@@ -1203,32 +1203,36 @@
e ... |
bfff1c6cb09713910fcd3e7fb01003a9e6c7bf6d | Use IdealGasConstPressureReactor in sensitivity example | interfaces/cython/cantera/examples/reactors/sensitivity1.py | interfaces/cython/cantera/examples/reactors/sensitivity1.py | """
Constant-pressure, adiabatic kinetics simulation with sensitivity analysis
"""
import sys
import numpy as np
import cantera as ct
gri3 = ct.Solution('gri30.xml')
temp = 1500.0
pres = ct.one_atm
gri3.TPX = temp, pres, 'CH4:0.1, O2:2, N2:7.52'
r = ct.IdealGasReactor(gri3)
air = ct.Solution('air.xml')
air.TP = te... | Python | 0 | @@ -262,365 +262,45 @@
lGas
-Reactor(gri3)%0A%0Aair = ct.Solution('air.xml')%0Aair.TP = temp, pres%0Aenv = ct.Reservoir(air)%0A%0A# Define a wall between the reactor and the environment, and make it flexible,%0A# so that the pressure in the reactor is held at the environment pressure.%0Aw = ct.Wall(r, env)%0Aw.expansi... |
85cfdc004c680213883f559f4fa9aafc58690698 | revert owlbot main branch templates (#35) | owlbot.py | owlbot.py | # Copyright 2021 Google LLC
#
# 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, s... | Python | 0 | @@ -1692,488 +1692,4 @@
e)%0A%0A
-# ----------------------------------------------------------------------------%0A# Main Branch migration%0A# ----------------------------------------------------------------------------%0A%0As.replace(%0A %22*.rst%22,%0A %22master%22,%0A %22main%22%0A)%0A%0As.replace(%0A %22*.rst%... |
5260a38a9045c23d11badae902170fa4292818a5 | improve email regex | corehq/util/bounced_email_manager.py | corehq/util/bounced_email_manager.py | import imaplib
import email
import re
from django.conf import settings
from corehq.util.models import BouncedEmail
# NOTE: BouncedEmailManager is not guaranteed to work with non-AmazonSES
# bounces and complaints or a non-gmail email that receives these notifications.
# Please check your configuration before moving ... | Python | 0.999739 | @@ -481,16 +481,259 @@
s.com'%0A%0A
+# From http://regexlib.com/REDetails.aspx?regexp_id=295%0AEMAIL_REGEX = r'((%5BA-Za-z0-9%5D+_+)%7C(%5BA-Za-z0-9%5D+%5C-+)%7C(%5BA-Za-z0-9%5D+%5C.+)%7C' %5C%0A r'(%5BA-Za-z0-9%5D+%5C++))*%5BA-Za-z0-9%5D+@((%5Cw+%5C-+)%7C(%5Cw+%5C.))' %5C%0A r'*%5Cw%7B1,63%7... |
ac2d292f80ff3ea087cfe198790de7a354c99cd9 | Update doctest so it passes under Python 3.2 and 2.7. Fixes #11 | hgtools/versioning.py | hgtools/versioning.py | from __future__ import division
import operator
from .py25compat import next
from distutils.version import StrictVersion
def find(pred, items):
"""
Find the index of the first element in items for which pred returns
True
>>> find(lambda x: x > 3, range(100))
4
>>> find(lambda x: x < -3, range(10... | Python | 0.000001 | @@ -1688,19 +1688,21 @@
%0D%0A%09%09%3E%3E%3E
-str
+round
(Summabl
@@ -1734,19 +1734,21 @@
er()
+, 12
)%0D%0A%09%09
-'
1.93
-'
%0D%0A%09%09
|
99caa411b71e07dd631508bd4225303ca7db7b8c | version bump | hiispider/__init__.py | hiispider/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""HiiSpider is a sophisticated asynchronous spider designed to work in a
distributed manner and handle thousands of requests per second. It's capable
of writing results to both MySQL and Cassandra and features a """
__all__ = ['SchedulerServer', 'InterfaceServer', 'Work... | Python | 0.000001 | @@ -391,9 +391,9 @@
2,
-4
+5
)%0A%0Af
|
12a71f104e3693e73edf7f0bdfc56da19bae1bf1 | Change parser | parser.py | parser.py | import glob, os
def OntoNotes(directory):
"""
Parameters
----------
directory: str
directory in which the OntoNotes project is located
files : str
path to a file containing all of the paths to files containing NER-annotated
data
Yields
------
... | Python | 0.000003 | @@ -1401,20 +1401,20 @@
_ == '__
-name
+main
__':%0A
|
d754690afc2233dfe8fb84ea9cbb0bb820600529 | update tests | tests/score_test.py | tests/score_test.py | import json
import unittest
import sports_py
class TestScores(unittest.TestCase):
match_data = {
'league': 'NHL',
'home_team': 'Pittsburgh Penguins',
'away_team': 'Nashville Predators',
'match_score': '2-0',
'match_date': 'Sat, 19 Aug 2017 02:12:05 GMT',
'match_tim... | Python | 0.000001 | @@ -39,12 +39,9 @@
orts
-_py
%0A
+
%0A%0Acl
@@ -386,19 +386,16 @@
= sports
-_py
.models.
@@ -400,24 +400,29 @@
s.Match(
-'hockey'
+sports.HOCKEY
, match_
@@ -451,11 +451,8 @@
orts
-_py
.get
@@ -461,26 +461,24 @@
port
-_scores('baseball'
+(sports.BASEBALL
)%0A%0A
@@ -995,311 +995,21 @@
rt,
-'hockey')%0A%0A... |
17015ecf48ec37909de6de2c299454fc89b592e9 | Add failing test for URL without zoom | tests/test_gmaps.py | tests/test_gmaps.py | # -*- coding: UTF-8 -*-
from base import TestCase
from jinja2_maps.gmaps import gmaps_url
class TestGmaps(TestCase):
def test_url_dict(self):
url = "https://www.google.com/maps/place/12.34,56.78/@12.34,56.78,42z"
self.assertEquals(url,
gmaps_url(dict(latitude=12.34, longitude=56.... | Python | 0 | @@ -329,8 +329,222 @@
m=42))%0A%0A
+ def test_url_dict_no_zoom(self):%0A url = %22https://www.google.com/maps/place/12.34,56.78/@12.34,56.78,16z%22%0A self.assertEquals(url,%0A gmaps_url(dict(latitude=12.34, longitude=56.78)))%0A%0A
|
99a86a1b68824b8b53254e56a0187ffb1df9dc5b | Add unit-tests for the mirrormanager2.lib.get_siteadmin | tests/test_mmlib.py | tests/test_mmlib.py | # -*- coding: utf-8 -*-
'''
mirrormanager2 tests.
'''
__requires__ = ['SQLAlchemy >= 0.7']
import pkg_resources
import unittest
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(
os.path.abspath(__file__)), '..'))
import mirrormanager2.lib
import tests
class MMLibtests(tests.Modeltests):
... | Python | 0.000001 | @@ -3187,16 +3187,789 @@
vate')%0A%0A
+ def test_get_siteadmin(self):%0A %22%22%22 Test the get_siteadmin function of mirrormanager2.lib. %22%22%22%0A results = mirrormanager2.lib.get_siteadmin(self.session, 1)%0A self.assertEqual(results, None)%0A%0A tests.create_site(self.session)%0A%0... |
aa3d6dc7e4d754e2109e8d7f716d4996f637b4d3 | Append data to Cell and set time_array to None | tunacell/io/supersegger.py | tunacell/io/supersegger.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
tunacell.io.supersegger
^^^^^^^^^^^^^^^^^^^^^^^^
module to parse supersegger data as input for tunacell processing
"""
import pathlib
from scipy.io import loadmat
import numpy as np
from tunacell.base.cell import Cell
def find_containers(path):
"""... | Python | 0.003262 | @@ -4795,30 +4795,62 @@
-container.time_array,
+time_array=None,%0A period=
cont
@@ -4983,16 +4983,39 @@
tainer)%0A
+ new.data = arr%0A
|
f9da5894a120eb55353a6af2c6d52f1d9a862777 | Move json loading in try/except block and add de.py output to possible error. (#811) | turbinia/workers/docker.py | turbinia/workers/docker.py | # Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | Python | 0 | @@ -2516,16 +2516,64 @@
utf-8')%0A
+ containers_info = json.loads(json_string)%0A
exce
@@ -2684,24 +2684,30 @@
de.py: %7B0!s%7D
+ %7B1!s%7D
'.format(e))
@@ -2703,17 +2703,45 @@
.format(
-e
+%0A e, json_string
))%0A e
@@ -2861,55 +2861,8 @@
))%0A%0A
- containers_info = json.loads(json_... |
2a95db43b1294e8c7620687cd824364cc8618d22 | Fix typo | txircd/modules/cmd_kill.py | txircd/modules/cmd_kill.py | from twisted.words.protocols import irc
from txircd.modbase import command
class KillCommand(Command):
def onUse(self, user, data):
target = data["targetuser"]
reason = "Killed by {}: {}".format(user.nickname, data["reason"])
target.sendMessage("KILL", ":{} {}".format(user.nickname, data["reason"]))
quit_to =... | Python | 0.999999 | @@ -60,17 +60,17 @@
import
-c
+C
ommand%0A%0A
|
8f8f8aca7d86b7ed20ae4efdb56dbaca2e77b0c2 | Make the user_agent check mroe elegant. | hoptoad/middleware.py | hoptoad/middleware.py | import sys, traceback
import urllib2
import yaml
import re
from django.core.exceptions import MiddlewareNotUsed
from django.views.debug import get_safe_settings
from django.conf import settings
def _parse_environment(request):
env = dict( (str(k), str(v)) for (k, v) in get_safe_settings().items() )
env.update(... | Python | 0.000001 | @@ -4407,19 +4407,34 @@
-if
+ua = request.META%5B
'HTTP_US
@@ -4446,154 +4446,55 @@
ENT'
+%5D
i
-n request.META:%0A user_agent = request.META%5B'HTTP_USER_AGENT'%5D%0A else:%0A user_agent = None%0A if user_agent:%0A
+f 'HTTP_USER_AGENT' in request.META else ''%0A
... |
24dc11df58e8d55d27fbd9e1464db95518831fb4 | make version objects act like instances of their master class | sqlobject/versioning/__init__.py | sqlobject/versioning/__init__.py | from sqlobject import *
from datetime import datetime
class Version(SQLObject):
def restore(self):
values = self.sqlmeta.asDict()
del values['id']
del values['masterID']
del values['dateArchived']
self.masterClass.get(self.masterID).set(**values)
def nextVersion(self):
... | Python | 0.000008 | @@ -1161,16 +1161,189 @@
elect)%0A%0A
+ def __getattr__(self, attr):%0A if self.__dict__.has_key(attr):%0A return self.__dict__%5Battr%5D%0A else:%0A return getattr(self.master, attr)%0A%0A
def getC
@@ -2407,24 +2407,158 @@
attrs)%0A%0A
+ if '_connection' in self.so... |
47bdbeb445c52e846f20da214fa4086cac13de0d | Update logpm.py | HexChat/logpm.py | HexChat/logpm.py | import hexchat
__module_name__ = "LogPMs"
__module_author__ = "TingPing"
__module_version__ = "1"
__module_description__ = "Auto log pm's"
def open_cb(word, word_eol, userdata):
chan = hexchat.get_info('channel')
# Assume nick if not prefixed with #
# Use existing pref for nicks I usually ignore (i.e. chanserv)
i... | Python | 0.000001 | @@ -338,16 +338,41 @@
%5D != '#'
+ and chan != '%3E%3Epython%3C%3C'
and cha
|
8583e1fec3fb1da321687acd37f92bd9d988bb10 | Enable adding/removing boops with command during runtime | desertbot/modules/automatic/Boops.py | desertbot/modules/automatic/Boops.py | from twisted.plugin import IPlugin
from desertbot.moduleinterface import IModule, BotModule, ignore
from zope.interface import implementer
import random
import re
from desertbot.message import IRCMessage
from desertbot.response import IRCResponse, ResponseType
@implementer(IPlugin, IModule)
class Boops(BotModule):
... | Python | 0 | @@ -93,16 +93,69 @@
ignore%0A
+from desertbot.modules.commandinterface import admin%0A
from zop
@@ -745,17 +745,30 @@
elf, arg
-)
+: list) -%3E str
:%0A
@@ -776,17 +776,18 @@
return
-'
+f%22
Responds
@@ -800,82 +800,696 @@
ops.
-'%0A%0A @ignore%0A def respond(self, message: IRCMessage) -%3E IRCRes... |
6adae0b495f93f00da7ae42e54c14eaaceed435e | Cut down on number of imports | topo/tk/__init__.py | topo/tk/__init__.py | # Tk based GUI support files
#
# $Id$
import propertiesframe
import taggedslider
import topoconsole
import plotpanel
# Code block-copied over from topo/gui.py These imports should
# be cleaned up.
from Tkinter import *
import Pmw, sys
import topo.simulator as simulator
from topo.tk.topoconsole import *
def show_cm... | Python | 0.000417 | @@ -32,23 +32,64 @@
# $Id$%0A%0A
-import
+# For importing the tk GUI files%0Aimport topo.tk.
properti
@@ -103,16 +103,24 @@
%0Aimport
+topo.tk.
taggedsl
@@ -127,24 +127,32 @@
ider%0Aimport
+topo.tk.
topoconsole%0A
@@ -158,16 +158,24 @@
%0Aimport
+topo.tk.
plotpane
@@ -183,108 +183,41 @@
%0A%0A#
-Code bloc... |
399c022233a0edbdf255920da5d6954738d9a221 | Remove unused argument from boto_cloudwatch_alarm.absent | salt/states/boto_cloudwatch_alarm.py | salt/states/boto_cloudwatch_alarm.py | # -*- coding: utf-8 -*-
'''
Manage Cloudwatch alarms
=================
.. versionadded:: 2014.7.0
Create and destroy cloudwatch alarms. Be aware that this interacts with
Amazon's services, and so may incur charges.
This module uses boto, which can be installed via package, or pip.
This module accepts explicit crede... | Python | 0.000001 | @@ -5202,33 +5202,8 @@
me,%0A
- attributes=None,%0A
|
8c9996ad4450de2f444bf9eb4db64136329055cc | fix auto DB finder | htsohm/db/__init__.py | htsohm/db/__init__.py | from datetime import datetime
from glob import glob
import os
from shutil import copy2
import sys
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
import yaml
__engine__ = None
__session__ = None
def get_session():
return __sessi... | Python | 0 | @@ -477,16 +477,150 @@
len(dbs)
+ == 0:%0A raise FileNotFoundError(%22Cannot find sqlite DBCS in the current directory: %25s%22 %25 os.getcwd())%0A elif len(dbs)
%3E 1:%0A
@@ -733,16 +733,25 @@
+database_
path = d
|
4bccd992c9f0725b4ee43c20fc1691631f2d3514 | missing semicolon | utils/user_funcs.py | utils/user_funcs.py | #!bin/env python
import asyncpg
class PGDB:
def __init__(self, db_conn):
self.db_conn = db_conn
async def fetch_user_info(self, member_id: int, column: str):
query = f'''SELECT {column} FROM user_info WHERE member_id = {member_id};'''
return await self.db_conn.fetchval(query)
asy... | Python | 0.999988 | @@ -677,16 +677,17 @@
mber_id%7D
+;
''')%0A
|
165cfea9c3fbe505d3d336f08292ebebf20310e0 | move `__version__` definition after imports | hera_mc/__init__.py | hera_mc/__init__.py | # -*- mode: python; coding: utf-8 -*-
# Copyright 2016 the HERA Collaboration
# Licensed under the 2-clause BSD license.
from __future__ import absolute_import, division, print_function
from types import MethodType
import numpy as np
import six
# Before we can do anything else, we need to initialize some core, share... | Python | 0.000031 | @@ -3092,39 +3092,8 @@
oqa%0A
-__version__ = version.version%0A%0A
from
@@ -3556,8 +3556,39 @@
s last.%0A
+%0A__version__ = version.version%0A
|
f3730ca9b46316db2ebd9b92e3a0af8d79bf7c82 | version bump | hiicart/__init__.py | hiicart/__init__.py | __version__ = '0.3.1'
def validate_gateway(gateway):
"""Test that a gateway is correctly set up.
Returns True if successful, or an error message."""
from hiicart.gateway.base import GatewayError
from hiicart.gateway.amazon.gateway import AmazonGateway
from hiicart.gateway.google.gateway import Goo... | Python | 0.000001 | @@ -16,9 +16,9 @@
0.3.
-1
+2
'%0A%0A%0A
|
94b17240f629ae1b35d3121a289530809f1f4b3e | Send FB hook events to Heroku #18794 | hooks/api_server.py | hooks/api_server.py | # -*- coding: utf-8 -*-
import re
from urllib.parse import quote
import falcon
import pika.exceptions
import requests
from . import services
from . import settings
_API_PREFIX = "/api/v1"
class Health:
def on_get(self, req, resp):
resp.status = falcon.HTTP_200
resp.body = '{"status": "UP"}'
... | Python | 0 | @@ -1026,23 +1026,24 @@
-payload
+raw_data
= req.s
@@ -1054,16 +1054,43 @@
m.read()
+%0A payload = raw_data
.decode(
@@ -1308,16 +1308,60 @@
payload)
+%0A%0A self._send_to_heroku(raw_data)
%0A
@@ -1395,17 +1395,16 @@
TTP_200%0A
-%0A
@@ -1558,16 +1558,521 @@
TP_500%0A... |
de91f76c1bdb263f1a46882683316afd0fcc5068 | Remove invalid method signature | hops/tensorboard.py | hops/tensorboard.py | """
Utility functions to retrieve information about available services and setting up security for the Hops platform.
These utils facilitates development by hiding complexity for programs interacting with Hops services.
"""
import socket
import subprocess
import os
from hops import hdfs as hopshdfs
from hops import u... | Python | 0.000004 | @@ -2179,64 +2179,11 @@
ean(
-keep_previous_runs):%0A if not keep_previous_runs:%0A
+):%0A
|
f05dc9faf43598bed5ce37d721f67b31f3e8eccb | Index parse to int | horizon/settings.py | horizon/settings.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.conf import settings
from django.utils.lru_cache import lru_cache
CONFIG_DEFAULTS = {
'GROUPS': {},
'METADATA_MODEL': None,
}
@lru_cache()
def get_config():
USER_CONFIG = getattr(settings, 'HORIZONTAL_CONFIG',... | Python | 0.000637 | @@ -885,16 +885,33 @@
BLES'%5D =
+ %5Bint(i) for i in
list(ho
@@ -945,16 +945,17 @@
.keys())
+%5D
%0A%0A re
|
d1fffe8017e1c53cb04fcaa2cf7f9b0e480c5081 | refactor monitorchannel colors into class, cleanup | dog/ext/monitoring/monitorchannel.py | dog/ext/monitoring/monitorchannel.py | """
Simple, embed+channel-based monitoring of Dogbot.
"""
import logging
import discord
from dog import Cog
from dog.core import botcollection, utils
logger = logging.getLogger(__name__)
class MonitorChannel(Cog):
def __init__(self, bot):
super().__init__(bot)
self.refuse_notify_left = []
a... | Python | 0 | @@ -80,16 +80,42 @@
discord
+%0Afrom discord import Guild
%0A%0Afrom d
@@ -210,16 +210,105 @@
me__)%0A%0A%0A
+class Colors:%0A NEON_GREEN = 0x71ff5e%0A ORANGE = 0xff945b%0A LIGHT_RED = 0xff655b%0A%0A%0A
class Mo
@@ -806,18 +806,50 @@
sending
-.'
+ args=%25s, kwargs=%25s', args, kwargs
)%0A
@@ -10... |
d89cb9f97942a892350ad5846e703ba3156eb261 | Update run_build.py | metaci/build/management/commands/run_build.py | metaci/build/management/commands/run_build.py | import os
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand
from django.db.models import signals
from metaci.build import handlers
from metaci.build.models import Build
from metaci.build.tasks import lock_org, run_build, scratch_org_lim... | Python | 0.000001 | @@ -597,16 +597,49 @@
ild
-directly
+from the command line (on local computer)
.%22%0A%0A
|
bc8d4a07aabc711142a2085f5a57c11cd2d91b85 | improve logs of mailer | keystone_spassword/contrib/spassword/mailer.py | keystone_spassword/contrib/spassword/mailer.py | #
# Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U
#
# 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 unde... | Python | 0.000003 | @@ -1904,25 +1904,105 @@
socket error
-'
+ %25s %25s' %25 (%0A CONF.spassword.smtp_server, CONF.spassword.smtp_port)
)%0A
@@ -2293,33 +2293,63 @@
entication error
-'
+ %25s' %25 CONF.spassword.smtp_user
)%0A re
@@ -2551,28 +2551,31 @@
MTP
-autentication error'
+sendmail error %... |
f5da38b312a730bf268ad0d8b49c5306f13081f2 | Fix leftover session query in services view | scoring_engine/web/views/services.py | scoring_engine/web/views/services.py | from flask import Blueprint, render_template, url_for, redirect
from flask_login import login_required, current_user
from scoring_engine.models.service import Service
mod = Blueprint('services', __name__)
@mod.route('/services')
@login_required
def home():
current_team = current_user.team
if not current_user... | Python | 0.000016 | @@ -160,16 +160,55 @@
Service%0A
+from scoring_engine.db import session%0A%0A
%0Amod = B
@@ -565,21 +565,30 @@
e =
-Service.query
+session.query(Service)
.get
|
6e65f16fff7b112ca584950cf533194b1d8fcb26 | add HTTP_COOKIE | phpdev.py | phpdev.py | """
Copyright (c) 2013 Mohd. Kamal Bin Mustafa
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, di... | Python | 0.00001 | @@ -3457,16 +3457,80 @@
pdev.py'
+%0A php_env%5B'HTTP_COOKIE'%5D = environ.get('HTTP_COOKIE', '')
%0A%0A
|
9a33772c6be5d280b3fcff42e20a8872da5f4e90 | Fix file download function. | s3stash/nxstashref.py | s3stash/nxstashref.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os
import argparse
from pynux import utils
import requests
import subprocess
import tempfile
import boto
from boto.s3.connection import S3Connection, OrdinaryCallingFormat
import urlparse
import logging
import shutil
from deepharvest.deepharvest_nuxeo import Dee... | Python | 0 | @@ -2080,16 +2080,59 @@
oad_url,
+ headers=self.nx.document_property_headers,
auth=se
@@ -4296,16 +4296,53 @@
n True %0A
+ else:%0A return False%0A
%0A%0A de
|
e664a5594d3b563dae0c7770ff73cd6266af62d7 | Use self methods to compute chart width and height. | pixiedust/display/chart/renderers/bokeh/histogramDisplay.py | pixiedust/display/chart/renderers/bokeh/histogramDisplay.py | # -------------------------------------------------------------------------------
# Copyright IBM Corp. 2017
#
# 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/licens... | Python | 0.000004 | @@ -2024,21 +2024,139 @@
t(self):
+%0A
+ plotwidth = int(self.getPreferredOutputWidth()/2)%0A plotheight = int(self.getPreferredOutputHeight() * 0.75)
%0A
@@ -2452,19 +2452,25 @@
t_width=
-400
+plotwidth
, plot_h
@@ -2467,35 +2467,42 @@
th, plot_height=
-400
+plotheight
,bins=binsize, c
@@ ... |
5a1a65dfba3adbbf0942b71bc71b5141adb2c4bf | use ranking helper | player.py | player.py | import json
import logging
from random import randint
import sys
logging.basicConfig(format='%(levelname)s %(lineno)d:%(funcName)s %(message)s')
log = logging.getLogger('player.Player')
log.addHandler(logging.StreamHandler(sys.stderr))
log.setLevel(logging.DEBUG)
class Player:
VERSION = "Cautios parrot"
de... | Python | 0 | @@ -60,16 +60,58 @@
rt sys%0A%0A
+from ranking_helper import RankingHelper%0A%0A
logging.
@@ -533,16 +533,54 @@
_cards'%5D
+%0A helper = RankingHelper(cards)
%0A%0A
@@ -693,44 +693,24 @@
if
-cards%5B0%5D%5B'rank'%5D == cards%5B1%5D%5B'rank'%5D
+helper.is_pair()
:%0A
|
e5ac916aab98bea8904cba2f6605c59ad15e5fcf | fix paths encoding | player.py | player.py | # -*- encoding: UTF-8 -*-
import os
import sys
import time
import logging
import urllib2
from cStringIO import StringIO
import pygame
from bottle import route, run, static_file
SUCCESS = {'success': True}
ERROR = {'success': False}
LOOP_VOLUME_HIGH = 0.4
LOOP_VOLUME_LOW = 0.15 # while another sound is pla... | Python | 0.000508 | @@ -68,16 +68,30 @@
logging%0A
+import urllib%0A
import u
@@ -1769,16 +1769,144 @@
RVER%0A#%0A%0A
+def fix_path(sound_path):%0A parts = sound_path.split('/')%0A return '/'.join(parts%5B:-1%5D) + '/' + urllib.pathname2url(parts%5B-1%5D)%0A%0A
@route('
@@ -2001,22 +2001,32 @@
lay_url(
+fix_path(
sound)
+)
%0A ... |
bfb88dd35ee5074b7f81ddbe363ce1bcb4fddf23 | add gio to daily emails | scripts/cscap/email_daily_changes.py | scripts/cscap/email_daily_changes.py | """
My purpose in life is to send an email each day with changes found
on the Google Drive
"""
import ConfigParser
import sys
import util
import os
import datetime
import pytz
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
CFG = {'cscap': dict(emails=['labend@ias... | Python | 0 | @@ -398,16 +398,35 @@
ate.edu'
+, 'gio@iastate.edu'
%5D,%0A
@@ -609,16 +609,35 @@
ail.com'
+, 'gio@iastate.edu'
%5D,%0A
|
5977adef1c792c1f7afe137eff3809ef4d57dfb5 | Add live to excluded environments in migration | migrations/versions/0300_migrate_org_types.py | migrations/versions/0300_migrate_org_types.py | import os
"""
Revision ID: 0300_migrate_org_types
Revises: 0299_org_types_table
Create Date: 2019-07-24 16:18:27.467361
"""
from alembic import op
import sqlalchemy as sa
revision = '0300_migrate_org_types'
down_revision = '0299_org_types_table'
environment = os.environ['NOTIFY_ENVIRONMENT']
def upgrade():
... | Python | 0.000001 | @@ -320,34 +320,47 @@
if environment
-!=
+not in %5B%22live%22,
%22production%22:%0A
@@ -348,32 +348,33 @@
e%22, %22production%22
+%5D
:%0A op.exe
@@ -1536,10 +1536,23 @@
ent
-!=
+not in %5B%22live%22,
%22pr
@@ -1560,16 +1560,17 @@
duction%22
+%5D
:%0A
|
35fba5fdd53bc6e604d4f46a0ef0a5de3feb7bca | Fix bug in recently ported dwi2response script | scripts/src/dwi2response/tournier.py | scripts/src/dwi2response/tournier.py | def initParser(subparsers, base_parser):
import argparse
import lib.app
lib.app.addCitation('If using \'tournier\' algorithm', 'Tournier, J.-D.; Calamante, F. & Connelly, A. Determination of the appropriate b value and number of gradient directions for high-angular-resolution diffusion-weighted imaging. NMR Biome... | Python | 0 | @@ -3516,17 +3516,17 @@
%0A del
-f
+F
older(pr
|
6c555c932695728276f389d8260d3c18217e66cc | fix run for 'sudo -u scylla' case | sdcm/remote/kubernetes_cmd_runner.py | sdcm/remote/kubernetes_cmd_runner.py | # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be usefu... | Python | 0.000005 | @@ -5187,34 +5187,63 @@
-if
+tmp =
cmd.s
-tartswith(%22
+plit(maxsplit=3)%0A if tmp%5B0%5D == '
sudo
- %22)
+'
:%0A
@@ -5570,18 +5570,119 @@
-cmd = cmd%5B
+if tmp%5B1%5D == '-u':%0A cmd = tmp%5B3%5D%0A else:%0A cmd = cmd%5Bcmd.find('sudo') +
5:%5D%0A
|
2ca0aa4f29c20f21cce7337b851481bdfaea9a67 | Remove hubsbpot tracking URL params | searx/plugins/tracker_url_remover.py | searx/plugins/tracker_url_remover.py | '''
searx is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
searx is distributed in the hope that it will be useful,
but WITHOUT ANY WA... | Python | 0.000002 | @@ -842,24 +842,106 @@
il)%5B%5E&%5D*'),%0A
+ re.compile(r'(_hsenc%7C_hsmi%7ChsCtaTracking%7C__hssc%7C__hstc%7C__hsfp)%5B%5E&%5D*'),%0A
r
|
3f36c901b928a4a2b9fd6756fb6824fd8a45890e | Add resolver method for generating token | salt/auth/__init__.py | salt/auth/__init__.py | '''
Salt's pluggable authentication system
This sysetm allows for authentication to be managed in a module pluggable way
so that any external authentication system can be used inside of Salt
'''
# 1. Create auth loader instance
# 2. Accept arguments as a dict
# 3. Verify with function introspection
# 4. Execute auth ... | Python | 0.000002 | @@ -4624,32 +4624,80 @@
oader.auth(opts)
+%0A self.serial = salt.payload.Serial(opts)
%0A%0A def cli(se
@@ -6056,9 +6056,199 @@
+try:%0A with open(self.opts%5B'token_file'%5D, 'w+') as fp_:%0A fp_.write(self.serial.dumps(tdata))%0A except (IOError, OSError):%0A ... |
b8dc9a3d981c65d83c87b459bd53a6cfb5d29a04 | Add a convenience wrapper for __progress__ | salt/client/mixins.py | salt/client/mixins.py | # coding: utf-8
'''
A collection of mixins useful for the various *Client interfaces
'''
from __future__ import print_function
from __future__ import absolute_import
import logging
import multiprocessing
import salt.utils
import salt.utils.event
import salt.utils.jid
from salt.utils.event import tagify
from salt.utils... | Python | 0.000057 | @@ -1914,32 +1914,409 @@
%7D%0A
+%0A # TODO: some other way? This seems like a slippery slope of convenience functions%0A def fire_progress(data, outputter='pprint'):%0A progress_event = %7B'data': data,%0A 'outputter': outputter%7D%0A func... |
5b1af94ddde182fea419a13160704cc4091145e9 | remove the unnecessary double trigger | salt/engines/slack.py | salt/engines/slack.py | # -*- coding: utf-8 -*-
'''
An engine that reads messages from Slack and sends them to the Salt
event bus. Alternatively Salt commands can be sent to the Salt master
via Slack by setting the control parameter to ``True`` and using command
prefaced with a ``!``.
.. versionadded: 2016.3.0
:configuration: Example confi... | Python | 0.000012 | @@ -4372,185 +4372,8 @@
%5D)%0A%0A
- # Remove inital salt item from list%0A if cmdline%5B0%5D == 'salt':%0A del cmdline%5B0%5D%0A%0A
|
b2a15ca8d4e973aff265b3eb87224d2fb23cd750 | Add default for __opts__['local'] | salt/modules/event.py | salt/modules/event.py | # -*- coding: utf-8 -*-
'''
Use the :doc:`Salt Event System </topics/event/index>` to fire events from the
master to the minion and vice-versa.
'''
from __future__ import absolute_import
# Import Python libs
import collections
import logging
import os
import sys
import traceback
# Import salt libs
import salt.crypt
im... | Python | 0.000003 | @@ -911,17 +911,27 @@
ts__
-%5B
+.get(
'local'
-%5D
+, None)
:%0A
|
73673598e1998252b16b48d31b800ab0fb441392 | Add documentation for the control system | pml/cs.py | pml/cs.py | """
Template module to define control systems.
"""
class ControlSystem(object):
""" Define a control system to be used with a device
It uses channel access to comunicate over the network with
the hardware.
"""
def __init__(self):
raise NotImplementedError()
def get(self, pv):
... | Python | 0 | @@ -131,16 +131,17 @@
a device
+.
%0A%0A It
@@ -319,66 +319,428 @@
-raise NotImplementedError()%0A%0A def put(self, pv, value):
+%22%22%22 Get the value of the given pv.%0A%0A Args:%0A pv(string): The Pv to get the value of.%0A%0A Returns:%0A Number: The numeric value o... |
f176e86aec79422e4701c63ed3d47caa1dfce3c7 | Add a function to display the highstate data from sls | salt/modules/state.py | salt/modules/state.py | '''
Control the state system on the minion
'''
# Import Python libs
import copy
import os
# Import Salt libs
import salt.state
import salt.payload
from salt._compat import string_types
__outputter__ = {
'highstate': 'highstate',
'sls': 'highstate',
'top': 'highstate... | Python | 0.000001 | @@ -3632,24 +3632,588 @@
w_chunks()%0A%0A
+%0Adef show_sls(mods, env='base', test=None, **kwargs):%0A '''%0A Display the state data from a specific sls or list of sls files on the%0A master%0A%0A CLI Example::%0A%0A salt '*' state.sls core,edit.vim dev%0A '''%0A opts = copy.copy(__opts__)%0A ... |
6157be23dce8857963150d8f162978d967f22bd2 | Move imports in cloudflare integration(#27882) | homeassistant/components/cloudflare/__init__.py | homeassistant/components/cloudflare/__init__.py | """Update the IP addresses of your Cloudflare DNS records."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.const import CONF_API_KEY, CONF_EMAIL, CONF_ZONE
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.event import track_time_interval
_LO... | Python | 0 | @@ -102,16 +102,54 @@
ogging%0A%0A
+from pycfdns import CloudflareUpdater%0A
import v
@@ -921,50 +921,8 @@
.%22%22%22
-%0A from pycfdns import CloudflareUpdater
%0A%0A
|
b02ba945ebdc38abf8ca009933544a95d50a4417 | Drop Py2 and six on salt/states/splunk.py | salt/states/splunk.py | salt/states/splunk.py | # -*- coding: utf-8 -*-
"""
Splunk User State Module
.. versionadded:: 2016.3.0.
This state is used to ensure presence of users in splunk.
.. code-block:: yaml
ensure example test user 1:
splunk.present:
- name: 'Example TestUser1'
- email: example@domain.com
"""
from __future__ ... | Python | 0 | @@ -1,28 +1,4 @@
-# -*- coding: utf-8 -*-%0A
%22%22%22%0A
@@ -277,81 +277,8 @@
%22%22%22%0A
-from __future__ import absolute_import, print_function, unicode_literals%0A
%0A%0Ade
@@ -1223,17 +1223,16 @@
%22User %7B
-0
%7D will b
@@ -1501,33 +1501,32 @@
t(%22new%22, %22User %7B
-0
%7D exists%22.format
@@ -1658,25... |
faa683d04e307b0a2bf4cbedb463686a65c61645 | disable buggy test stup | test/test_bin_model.py | test/test_bin_model.py | import re
# from filecmp import cmp
from scripttest import TestFileEnvironment
testdir = "test/"
bindir = "bin/"
datadir = "test/data/"
testenv = testdir + 'testenv_bin_model/'
env = TestFileEnvironment(testenv)
# relative to test file environment: testenv
bindir_rel = "../../" + bindir
datadir_rel = "../../" + datad... | Python | 0 | @@ -644,16 +644,18 @@
derr'%0A%0A%0A
+#
def test
@@ -658,24 +658,26 @@
test_fit():%0A
+#
%22Call bi
@@ -698,20 +698,22 @@
mode.%22%0A
+#
+
call_scr
@@ -751,16 +751,18 @@
-n xx'%0A
+#
run
@@ -793,16 +793,18 @@
plit())%0A
+#
asse
|
6681386af9258e60bcc3d37d85046dddc652269c | Remove config check notification | util/config.py | util/config.py | from configparser import ConfigParser
import os
import re
from util.matheval import eval_expr
class AbstractConfig:
__config_dir = os.path.expanduser('~/.qldsmanager/') #has to end with /
filename = None
filepath = None
required = None
def __init__(self):
if self.filename == '':
... | Python | 0.000001 | @@ -3825,41 +3825,8 @@
1)%0A%0A
- print('Configs are OK')%0A%0A
|
a78565b7aae8d941ff804ff9ba6eb7d5183b5447 | add relative_attention_max_distance in config (#16170) | src/transformers/models/mt5/configuration_mt5.py | src/transformers/models/mt5/configuration_mt5.py | # coding=utf-8
# Copyright 2020, The T5 Authors and HuggingFace 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 ... | Python | 0 | @@ -2645,32 +2645,194 @@
ttention layer.%0A
+ relative_attention_max_distance (%60int%60, *optional*, defaults to 128):%0A The maximum distance of the longer sequences for the bucket separation.%0A
dropout_
@@ -2872,24 +2872,24 @@
ts to 0.1):%0A
-
@@ -3915,16 +3915,61 @@
ets=... |
981300a70bce72bfa76958eefc1dd494a94e7b77 | Fix coding separation issue | hug/input_format.py | hug/input_format.py | """hug/input_formats.py
Defines the built-in Hug input_formatting handlers
Copyright (C) 2016 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, includi... | Python | 0.000094 | @@ -1660,21 +1660,33 @@
est)
-.groupdict()%0A
+%0A if charset:%0A
@@ -1708,16 +1708,28 @@
charset.
+groupdict().
get('cha
|
a11ddc595cbd28e8a5524b33bc8ddecab8d6602b | This is OLD | test_project/manage.py | test_project/manage.py | #!/usr/bin/env python
try:
from django.core.management import execute_manager
def boot(settings):
execute_manager(settings)
except ImportError:
from django.core.management import execute_from_command_line
def boot(settings):
execute_from_command_line(sys.argv)
import imp
try:
imp.f... | Python | 0.999999 | @@ -15,16 +15,28 @@
python%0A
+import sys%0A%0A
try:%0A
@@ -411,23 +411,8 @@
or:%0A
- import sys%0A
|
0eebc40a74b35fccbe79abdca4afb4aa1cc25d25 | Simplify test skipping using `importorskip()` | testci/test_chipper.py | testci/test_chipper.py | import pytest
import datetime as dt
# OpenCV is *VERY* hard to install in CircleCI, so if we don't have it, skip these tests
try:
cv2 = pytest.importorskip("cv2")
from pelops.datasets.chipper import FrameProducer
except ImportError:
pass
@pytest.fixture
def frame_time_fp(tmpdir):
# Define a FramePro... | Python | 0.000003 | @@ -124,17 +124,8 @@
sts%0A
-try:%0A
cv2
@@ -152,21 +152,48 @@
p(%22cv2%22)
-%0A
-
+# Skip all tests if not found%0A
from pel
@@ -238,37 +238,8 @@
cer%0A
-except ImportError:%0A pass%0A
%0A%0A@p
|
7f5ec7ed56c85fce9e0e221971e2678c0ce23fff | Add test for choose-semse-what-member | tests/biosense_test.py | tests/biosense_test.py | from kqml import KQMLList
from bioagents.biosense.biosense_module import BioSense_Module
def test_choose_sense():
bs = BioSense_Module(testing=True)
msg_content = KQMLList('CHOOSE-SENSE')
msg_content.sets('ekb-term', mek1_ekb)
res = bs.respond_choose_sense(msg_content)
agents = res.get('agents')
... | Python | 0.000002 | @@ -276,24 +276,39 @@
sg_content)%0A
+ print(res)%0A
agents =
@@ -515,25 +515,8 @@
ENE'
-%0A print(agent)
%0A%0Ade
@@ -1345,24 +1345,411 @@
== 'TRUE')%0A%0A
+def test_choose_sense_what_member():%0A bs = BioSense_Module(name='biosense', testing=True)%0A msg_content = KQMLList('CHOOSE-SENSE-WHAT-MEMB... |
3c735d18bdcff28bbdd765b131649ba57fb612b0 | Revert "Revert "Remove useless code"" | hy/models/string.py | hy/models/string.py | # Copyright (c) 2013 Paul Tagliamonte <paultag@debian.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modif... | Python | 0.000004 | @@ -1451,96 +1451,13 @@
%22%22%22%0A
-%0A
-def __new__(cls, value):%0A obj = str_type.__new__(cls, value)%0A return obj
+pass
%0A
|
8f9605c277d851f61c4762a8227866ad9fb0b276 | move network assignment to top of add_agent | wallace/networks.py | wallace/networks.py | from .models import Network
import random
class Chain(Network):
"""A -> B -> C -> ..."""
__mapper_args__ = {"polymorphic_identity": "chain"}
def add_agent(self, newcomer):
newcomer.network = self
vectors = []
if len(self.nodes) > 1:
vector = self.nodes[-2].connect_t... | Python | 0 | @@ -676,16 +676,50 @@
comer):%0A
+%0A newcomer.network = self%0A%0A
@@ -928,41 +928,8 @@
))%0A%0A
- newcomer.network = self%0A%0A
@@ -1534,32 +1534,65 @@
lf, newcomer):%0A%0A
+ newcomer.network = self%0A%0A
vectors
@@ -3047,41 +3047,8 @@
))%0A%0A
- newcomer.netw... |
f594d211b0e95c17edc9eca693f05d307515e1a7 | remove unused "event" parameter in I18nFieldMixin (#34) | i18nfield/fields.py | i18nfield/fields.py | import json
import django
from django.conf import settings
from django.db import models
from .forms import I18nFormField, I18nTextarea, I18nTextInput
from .strings import LazyI18nString
class I18nFieldMixin:
form_class = I18nFormField
widget = I18nTextInput
def __init__(self, *args, **kwargs):
... | Python | 0 | @@ -268,139 +268,8 @@
ut%0A%0A
- def __init__(self, *args, **kwargs):%0A self.event = kwargs.pop('event', None)%0A super().__init__(*args, **kwargs)%0A%0A
|
26c589ba0758c34516455803647d98e91c1bd47d | Print detected image class on top of the video stream. | src/examples/vision/image_classification_camera.py | src/examples/vision/image_classification_camera.py | #!/usr/bin/env python3
#
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | Python | 0.000037 | @@ -662,96 +662,73 @@
age
-detection on the VisionBonnet and prints the object and%0Aprobability for top three object
+classification on camera frames and prints detected object%0Aclasse
s.%0A%0A
@@ -802,16 +802,34 @@
argparse
+%0Aimport contextlib
%0A%0Afrom a
@@ -981,15 +981,8 @@
sses
-, count
):%0A
@@ -1043,... |
ba7397cf5954ad5ab2d243b540c4d0629c9d42ca | Add test for MTanhProfile | tests/test_profiles.py | tests/test_profiles.py | import numpy as np
import unittest
from desc.io import InputReader
from desc.equilibrium import Equilibrium
from desc.profiles import PowerSeriesProfile
class TestProfiles(unittest.TestCase):
def test_same_result(self):
input_path = "examples/DESC/SOLOVEV"
ir = InputReader(input_path)
eq1... | Python | 0 | @@ -28,16 +28,30 @@
nittest%0A
+import pytest%0A
from des
@@ -807,96 +807,253 @@
-x = np.linspace(0, 1, 100)%0A%0A np.testing.assert_allclose(pp.compute(x), sp.compute
+with pytest.warns(UserWarning):%0A mp = pp.to_mtanh(order=4, ftol=1e-12, xtol=1e-12)%0A x = np.linspace(0, 1, 100)%0A%... |
cefb497fe2ca0e72cb300abb0ec0fb45b55e8e8d | Refactor computation of subtotal into method `to_representation` | shop/serializers/defaults/catalog.py | shop/serializers/defaults/catalog.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.timezone import datetime
from rest_framework import serializers
from rest_framework.fields import empty
from shop.models.cart import CartModel
from shop.rest.money import MoneyField
class AddToCartSerializer(serializers.Serializer):
... | Python | 0.000002 | @@ -1830,16 +1830,43 @@
ata
-== empty
+is not empty and 'quantity' in data
:%0A
@@ -1914,23 +1914,51 @@
ntity'%5D.
-default
+to_internal_value(data%5B'quantity'%5D)
%0A
@@ -2023,43 +2023,15 @@
y'%5D.
-to_internal_value(data%5B'quantity'%5D)
+default
%0A
@@ -2097,90 +2097,97 @@
-instance.setdefa... |
22967375441f2a40c255cd2933f9cefb69129f8b | Remove JBluesBlackBody from the nlte_properties collection. | tardis/plasma/properties/property_collections.py | tardis/plasma/properties/property_collections.py | from tardis.plasma.properties import *
class PlasmaPropertyCollection(list):
pass
basic_inputs = PlasmaPropertyCollection([TRadiative, Abundance, Density,
TimeExplosion, AtomicData, DilutionFactor, LinkTRadTElectron,
HeliumTreatment])
basic_properties = PlasmaPropertyCollection([BetaRadiation,
Levels,... | Python | 0 | @@ -1157,25 +1157,8 @@
ata,
- JBluesBlackBody,
Pre
|
8642314ce091dc1e98811ba7aa12f1e66a4b1fb2 | add create_test_person factory | testutils/factories.py | testutils/factories.py | import random
from openstates.data.models import Organization, Bill, LegislativeSession
def create_test_bill(
session,
chamber,
*,
sponsors=0,
actions=0,
votes=0,
versions=0,
documents=0,
sources=0,
subjects=None,
identifier=None,
):
chamber = Organization.objects.get(c... | Python | 0.000006 | @@ -80,16 +80,30 @@
eSession
+, Person, Post
%0A%0A%0Adef c
@@ -1826,28 +1826,679 @@
tion=%22no%22, voter_name=name)%0A
+%0A%0Adef create_test_person(name, *, org, district, party):%0A p = Person.objects.create(%0A name=name,%0A primary_party=party,%0A current_jurisdiction=org.jurisdiction,%0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.