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 |
|---|---|---|---|---|---|---|---|
d871328e94f804a2a296f4fba44751fa98e498d1 | Update custom dashboard response | rhizome/api/resources/custom_dashboard.py | rhizome/api/resources/custom_dashboard.py | from tastypie.resources import ALL
from rhizome.api.resources.base_model import BaseModelResource
from rhizome.api.exceptions import DatapointsException
from rhizome.models import CustomDashboard, CustomChart, ChartToDashboard
import json
class CustomDashboardResource(BaseModelResource):
class Meta(BaseModelReso... | Python | 0 | @@ -2292,24 +2292,105 @@
rt_uuids):%0A%0A
+ if type(chart_uuids) == unicode:%0A chart_uuids = %5Bchart_uuids%5D%0A
char
|
7e13edfea2ee0c055f890fba08fa645141cd2f7d | add colourbar | helix.py | helix.py | # Create the data.
from numpy import pi, sin, cos, mgrid
[u,v] = mgrid[-5:5:0.01,0:2*pi+0.1:0.1]
a=2
x = u*cos(v)
y = u*sin(v)
z = a*v
K=-a**2/(u**2 +a**2)**2
from mayavi import mlab
s = mlab.mesh(x, y, z,scalars=K)
mlab.show()
| Python | 0.000001 | @@ -211,16 +211,83 @@
lars=K)%0A
+mlab.colorbar(orientation='horizontal',title='Gaussian Curvature')%0A
mlab.sho
|
b5146035b7f4ae641a53bb956e9afee62c50c347 | Change cache directory for vendor LST | kotori/vendor/lst/h2m/util.py | kotori/vendor/lst/h2m/util.py | # -*- coding: utf-8 -*-
# (c) 2015 Andreas Motl, Elmyra UG <andreas.motl@elmyra.de>
import os
from appdirs import user_cache_dir
from kotori.daq.intercom.c import LibraryAdapter, StructRegistryByID
#from kotori.daq.intercom.cffi_adapter import LibraryAdapterCFFI
def setup_h2m_structs_pyclibrary():
cache_dir = user... | Python | 0 | @@ -301,32 +301,45 @@
cache_dir =
+os.path.join(
user_cache_dir('
@@ -334,37 +334,38 @@
_cache_dir('
-lst', 'elmyra
+kotori'), 'lst
')%0A if no
@@ -732,16 +732,29 @@
e_dir =
+os.path.join(
user_cac
@@ -765,21 +765,22 @@
ir('
-lst', 'elmyra
+kotori'), 'lst
')%0A
|
e6b11c0c110d0457cc31d7d798a2b35e19a0f56e | fix wrong parser | slackn/cli.py | slackn/cli.py | import sys
import logging
from argparse import ArgumentParser
from slackn.core import Queue, Notifier
from slackn.version import version
log = logging.getLogger('slackn')
def get_queue(s):
if ':' in s:
host,port = s.split(':')
else:
host,port = (s, 6379)
return Queue(host,port)
def proce... | Python | 0.998471 | @@ -1979,36 +1979,39 @@
ut')%0A parser_
-host
+service
.add_argument('n
|
463d044cfa70de6bde04c380c459274acb71a1b6 | add database | hello.py | hello.py | from flask import Flask, render_template, session, redirect, url_for, flash
from flask.ext.script import Manager
from flask.ext.bootstrap import Bootstrap
from flask.ext.moment import Moment
from flask.ext.wtf import Form
from wtforms import StringField, SubmitField
from wtforms.validators import Required
app = Flask(... | Python | 0.000001 | @@ -304,152 +304,874 @@
red%0A
-%0Aapp = Flask(__name__)%0Aapp.config%5B'SECRET_KEY'%5D = 'hard to guess string'%0A%0Amanager = Manager(app)%0Abootstrap = Bootstrap(app)%0Amoment = Moment(app)
+from flask.ext.sqlalchemy import SQLAlchemy%0A%0Abasedir = os.path.abspath(os.path.dirname(__file__))%0A%0Aapp = Flask(__name... |
b07ada0833c1d8319e946e7444b2f2c1337c15d1 | Add some debug | hello.py | hello.py | from flask import Flask, render_template, jsonify, request
import pandas as pd
import networkx as nx
import pygraphviz as pgv
import json
import tempfile
import numpy as np
import brewer2mpl
from StringIO import StringIO
app = Flask(__name__)
app.config['DEBUG'] = True
@app.route('/')
def hello():
return render_... | Python | 0.000009 | @@ -403,24 +403,60 @@
et_image():%0A
+ import os%0A print os.getcwd()%0A
history
|
b7f787e0999055f3bf25ba0621df93973d259ac9 | use CYAN_URL instead of DATABASE_URL | hello.py | hello.py | from flask import Flask, render_template, jsonify, request, g
import pandas as pd
import networkx as nx
import pygraphviz as pgv
import json
import tempfile
import numpy as np
import brewer2mpl
from StringIO import StringIO
import psycopg2
import urlparse
import os
app = Flask(__name__)
app.config['DEBUG'] = True
@... | Python | 0.000001 | @@ -4078,16 +4078,30 @@
on%5B%22
-DATABASE
+HEROKU_POSTGRESQL_CYAN
_URL
|
c3febe727bab959fcbc0bc0159389995adca129c | Improve debug output. Print register contents in hex. | epiphany/test/machine.py | epiphany/test/machine.py | from pydgin.debug import Debug
from epiphany.machine import State
from epiphany.sim import new_memory
from epiphany.isa import reg_map
from epiphany.utils import bits2float
possible_attributes = "AN AZ AC AV AVS BN BV BIS BVS BUS BZ pc".split()
def new_state(mem=None, debug=Debug(), **args):
if mem is None:
... | Python | 0 | @@ -3258,24 +3258,28 @@
cation,
+hex(
expected
, got))%0A
@@ -3262,39 +3262,45 @@
on, hex(expected
+)
,
+hex(
got))
+)
%0A%0A def check(
@@ -3817,24 +3817,28 @@
g_name,
+hex(
expected
, got))%0A
@@ -3829,23 +3829,29 @@
expected
+)
,
+hex(
got))
+)
%0A
|
9de3dacc7c687bc5e4d11a5a334f5ef5cc4d2f37 | Fix call to genome mapping code | rnacentral_pipeline/cli/genome_mapping.py | rnacentral_pipeline/cli/genome_mapping.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2018] EMBL-European Bioinformatics Institute
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.000002 | @@ -660,16 +660,72 @@
tral
- import
+.genome_mapping import urls%0Afrom rnacentral_pipeline.rnacentral.
geno
@@ -734,16 +734,28 @@
_mapping
+ import blat
%0A%0A%0A@clic
@@ -1174,31 +1174,16 @@
t):%0A
-genome_mapping.
blat.wri
@@ -1481,31 +1481,16 @@
url =
-genome_mapping.
urls.url
@@ -1744,27 +1744,12 @... |
6424edf4186236443ba4ec5a1b2ffcc26de7c695 | add classifications | fl/__init__.py | fl/__init__.py | # encoding=utf-8
from pupa.scrape import Jurisdiction, Organization
from .votes import FlVoteScraper
from .bills import FlBillScraper
from .people import FlPersonScraper
class Florida(Jurisdiction):
division_id = "ocd-division/country:us/state:fl"
classification = "government"
name = "Florida"
url = "... | Python | 0.000317 | @@ -539,48 +539,8 @@
ic'%7D
-,%0A %7B'name': 'Independent'%7D
%5D%0A
@@ -629,16 +629,43 @@
'2011',
+'classification': 'primary'
%7D,%0A
@@ -722,16 +722,43 @@
'2012',
+'classification': 'primary'
%7D,%0A
@@ -832,24 +832,51 @@
': '2012B',
+'classification': 'special'
%7D,%0A %7... |
d915b43cea8e4ebb5792daaa4d537d4986fc3d0f | document for command decorator | flask_slack.py | flask_slack.py | """
flask_slack
~~~~~~~~~~~~~~~
Slack extension for Flask.
:copyright: (c) 2014 by VeryCB.
:license: BSD, see LICENSE for more details.
"""
from six import string_types
__all__ = ('Slack',)
__version__ = '0.1.2'
__author__ = 'VeryCB <imcaibin@gmail.com>'
class Slack(object):
def __init__... | Python | 0.000001 | @@ -689,24 +689,628 @@
**kwargs):%0A
+ %22%22%22A decorator used to register a command.%0A%0A :param command: the command to register%0A :param token: your command token provided by slack%0A :param team_id: optional. your team_id provided by slack.%0A You can also sp... |
6e9a0df29ba488a96293e938ed96561ee709fc4b | Improve heatmap plotting | smps/plots.py | smps/plots.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
import matplotlib.ticker as mtick
from matplotlib.ticker import ScalarFormatter
import seaborn as sns
default_cmap = sns.cubehelix_palette(8, as_cmap=True)
rc_log = {
'xt... | Python | 0 | @@ -238,16 +238,45 @@
n as sns
+%0Afrom numpy import nan_to_num
%0A%0Adefaul
@@ -587,16 +587,43 @@
ar=True,
+ hide_low=True,%0A
cmap=de
@@ -633,28 +633,16 @@
lt_cmap,
-%0A
fig_kws
@@ -806,24 +806,300 @@
, Z.max())%0A%0A
+ # Copy to avoid modifying original data%0A Z_plot = Z.copy()%... |
40d9ceb14c57c109e8f6371b1a4c677fa33e1669 | Bump base package requirements (#10078) | snmp/setup.py | snmp/setup.py | # (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from codecs import open # To use a consistent encoding
from os import path
from setuptools import setup
HERE = path.dirname(path.abspath(__file__))
# Get version info
ABOUT = {}
with open(path.join(HER... | Python | 0 | @@ -788,12 +788,12 @@
se%3E=
-15.7
+21.1
.0'%0A
|
17bb20d7f7b236feb1c2eff9d71420e672c87431 | Fix typo | djchoices/choices.py | djchoices/choices.py | import re
from django.core.exceptions import ValidationError]
try:
from collections import OrderedDict
except ImportError: # Py2.6, fall back to Django's implementation
from django.utils.datastructures import SortedDict as OrderedDict
try:
from django.utils import six
except ImportError:
import six
... | Python | 0.999999 | @@ -53,17 +53,16 @@
ionError
-%5D
%0A%0Atry:%0A
|
0a0ebb7dd3267d727e6af598f6d964cd4d73fd69 | Add TODO for multiple e-mail verification clicks. | eduid_signup/utils.py | eduid_signup/utils.py | from uuid import uuid4
from hashlib import sha256
import datetime
from pyramid.httpexceptions import HTTPInternalServerError
from eduid_signup.i18n import TranslationString as _
from eduid_signup.compat import text_type
def generate_verification_link(request):
code = text_type(uuid4())
link = request.route... | Python | 0 | @@ -717,16 +717,257 @@
%0A )%0A%0A
+ # XXX need to handle user clicking on confirmation link more than%0A # once gracefully. Should show page saying that e-mail address was%0A # already confirmed, but NOT allow user to auth_token login to%0A # dashboard from that page.%0A%0A
if r
|
0019d3a4d512c4b7da2670872cd880bbe76edd80 | Bump version to 0.4.0 | arghelper.py | arghelper.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014-2016 The arghelper developers. All rights reserved.
# Project site: https://github.com/questrail/arghelper
# Use of this source code is governed by a MIT-style license that
# can be found in the LICENSE.txt file for the project.
"""Provide helper functi... | Python | 0.000001 | @@ -666,11 +666,11 @@
'0.
-3.2
+4.0
'%0A%0A%0A
|
4d0caec3d3c42c7d1e342c934e987d9f602cc26b | return value | scripts/geodata/openaddresses/formatter.py | scripts/geodata/openaddresses/formatter.py | import csv
import os
import six
import yaml
from geodata.address_expansions.abbreviations import abbreviate
from geodata.address_expansions.gazetteers import street_types_gazetteer, unit_types_gazetteer
from geodata.address_formatting.formatter import AddressFormatter
from geodata.addresses.components import AddressCo... | Python | 0.000007 | @@ -4382,16 +4382,36 @@
yield
+ (language, country,
formatt
@@ -4412,16 +4412,17 @@
ormatted
+)
%0A%0A de
@@ -5133,13 +5133,8 @@
ntry
-_code
, fi
@@ -5212,32 +5212,51 @@
for
+ language, country,
formatted_addre
@@ -6381,16 +6381,35 @@
for
+ language, country,
formatt
|
46483b7e551e5180ff36d6892221e4b583f107ac | Use HTTPS for oauth/authenticate step. | le_social/twitter/views.py | le_social/twitter/views.py | from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.shortcuts import redirect
from django.views import generic
from twitter import Twitter, OAuth, TwitterError
from twitter.oauth_dance import parse_oauth_tokens
class OAuthMixin(object):
consumer_key = None
con... | Python | 0 | @@ -1912,16 +1912,17 @@
= 'http
+s
://api.t
|
f9141964ffa4ed36420b8ba564407c2ca661ac46 | edit on glitter | glitter.py | glitter.py | from willie.module import commands
import random
@commands('glitter')
def ans(bot, trigger):
bot.reply("*'-.*\(^O^)/*.-'*") | Python | 0 | @@ -96,12 +96,10 @@
bot.
-repl
+sa
y(%22*
|
39c9e7dd34830eb70ce412c4feb1e5eda66aa08a | Add history to console | inbox.py | inbox.py | #!/usr/bin/env python
import argparse
import signal
import sys
import os
import subprocess
from time import sleep
import logging as log
# Make logging prettified
import tornado.options
tornado.options.parse_command_line()
DEFAULT_PORT = 8888
PATH_TO_MONGO_DATABSE = os.path.join(
os.path.dirname(os.pat... | Python | 0 | @@ -2426,67 +2426,467 @@
ort
-code%0A import pymongo%0A db = pymongo.MongoClient().test
+pymongo%0A env = %7B'db': pymongo.MongoClient().test%7D%0A%0A # Based on http://docs.python.org/2/tutorial/interactive.html%0A # except it's 2013 and we have closures.%0A import atexit%0A import readline%0A ... |
4c64f695bfd9b5ce3d3d1352672aab5b0798f353 | Add instance of nstat_test_run | stress_test/test_type.py | stress_test/test_type.py | # Copyright (c) 2016 Intracom S.A. Telecom Solutions. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v1.0 which accompanies this distribution,
# and is available at http://www.eclipse.org/legal/epl-v10.html
""" Controller Class- A... | Python | 0.000836 | @@ -4062,16 +4062,76 @@
.lower()
+%0A nstat_test_run = stress_test.test_run.TestRun(args)
%0A%0A
@@ -4398,28 +4398,22 @@
+n
st
-ress_test.
+at_
test_run
|
3a83ff315db6f34fb8e656309580060cf708b8a1 | Refactor request body | request.py | request.py | '''
Code adapted from https://westus.dev.cognitive.microsoft.com/docs/services/TextAnalytics.V2.0/operations/56f30ceeeda5650db055a3c9
'''
import http.client, urllib.request, urllib.parse, urllib.error
import script
def main():
'''
Sends a single POST request with a test bit of text.
'''
headers = heade... | Python | 0 | @@ -207,16 +207,35 @@
t script
+%0Aimport numpy as np
%0A%0Adef ma
@@ -385,205 +385,261 @@
-body = %7B%0A %09%22documents%22: %5B%0A %09%09%7B%0A %09%09%22language%22: %22en%22,%0A %09%09%22id%22: %221%22,%0A %09%09%22text%22: %22I had a wonderful experience! The rooms were wonderful and the staf... |
1e16bf4202cc50bc21552e5d5504c58ab792084e | REFACTOR : repr 'Optional' validator now done on Optional object. | strictyaml/validators.py | strictyaml/validators.py | from ruamel.yaml.comments import CommentedSeq, CommentedMap
from strictyaml.exceptions import YAMLValidationError
from strictyaml.exceptions import raise_exception
from strictyaml.representation import YAML
import sys
if sys.version_info[0] == 3:
unicode = str
class Optional(object):
def __init__(self, key):... | Python | 0 | @@ -338,16 +338,91 @@
= key%0A%0A
+ def __repr__(self):%0A return u'Optional(%22%7B0%7D%22)'.format(self.key)%0A
%0Aclass V
@@ -2571,86 +2571,12 @@
-'Optional(%22%7B0%7D%22)'.format(key.key) if type(key) is Optional else '%22%7B0%7D%22'.format
+repr
(key
@@ -2605,16 +2605,17 @@
r(value)
+,
%0A ... |
c5d68743bf6392ae5e4c6bd80ed6727bfebf77fd | Solve basic/string2.py Please enter the commit message for your changes. Lines starting | basic/string2.py | basic/string2.py | #!/usr/bin/python2.4 -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Additional basic string exercises
# D. verbing
# Given a string, if its length is a... | Python | 0.998948 | @@ -525,38 +525,132 @@
g(s):%0A
-# +++your code here+++
+result=s%0A if len(s)%3E=3:%0A if s%5B-3:%5D=='ing':%0A result=result+'ly'%0A else :%0A result=result+'ing'
%0A retur
@@ -646,25 +646,31 @@
ng'%0A return
-%0A
+ result
%0A%0A# E. not_b
@@ -959,38 +959,184 @@
d(s):%0A
-# +++your... |
6f7a75dd98c1f2cc82fe357a3c7cd2147f70db9d | add download_date to API download of single and multiple URLs | newsplease/__init__.py | newsplease/__init__.py | import os
import sys
import urllib
from six.moves import urllib
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
from newsplease.pipeline.extractor import article_extractor
from newsplease.crawler.items import NewscrawlerItem
from dotmap import DotMap
from newsplease.pipeline.pipelines import ExtractedIn... | Python | 0 | @@ -1,12 +1,28 @@
+import datetime%0A
import os%0Aim
@@ -3273,16 +3273,94 @@
lts = %7B%7D
+%0A download_date = datetime.datetime.now().strftime('%25Y-%25m-%25d %25H:%25M:%25S')
%0A%0A
@@ -3557,16 +3557,31 @@
tml, url
+, download_date
)%0A
@@ -3673,16 +3673,16 @@
esults:%0A
-
@@ -3742,... |
8fa83b41e1c391e33324d496b8a03ebb5e23d6b8 | call commands with proper arguments | bastion/shell.py | bastion/shell.py | """
Bastion shell.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
from bastion.filesystem import FileSystem
from bastion.commands import *
from bastion.validators import validate_command
from bastion.validators import validate_mkfs
def accept_input(validator=No... | Python | 0.000015 | @@ -2232,16 +2232,76 @@
rguments
+%0A # TODO: parse arguments and determine type validity
%0A%0A
@@ -2690,28 +2690,38 @@
Open(self,
-args
+filename, flag
).run()%0A
@@ -2897,28 +2897,32 @@
Read(self,
-args
+fd, size
).run()%0A
@@ -3096,36 +3096,42 @@
urn Write(self,
-args
+fd, string
)... |
634aa9818875c15c3db0ac0763fc15889936b79e | Add a structure test macro to make test writing easier. | tests.bzl | tests.bzl | # Copyright 2017 Google 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 law or agre... | Python | 0 | @@ -628,16 +628,94 @@
ts.%22%22%22%0A%0A
+load(%0A %22@io_bazel_rules_docker//docker:docker.bzl%22,%0A %22docker_build%22,%0A)%0A%0A
def _imp
@@ -2256,12 +2256,383 @@
= _impl,%0A)%0A
+%0Adef structure_test_with_files(name, image, config, files):%0A %22%22%22A macro for including extra files inside an image b... |
f5df42e6049b31b1c147da7160e0595e595c6dbc | Add logging to grade | grade.py | grade.py | #Grader called by pyxserver_wsgi.py
#Loads a grader file, which is a dict containing the prompt of the question,
#a feature extractor object, and a trained model.
#Extracts features and runs trained model on the submission to produce a final score.
#Correctness determined by ratio of score to max possible score.
#Requi... | Python | 0 | @@ -411,16 +411,31 @@
rt numpy
+%0Aimport logging
%0A%0Abase_p
@@ -616,16 +616,51 @@
semble%0A%0A
+log = logging.getLogger(__name__)%0A%0A
def grad
@@ -699,16 +699,99 @@
=None):%0A
+ log.debug(%22Grader path: %7B0%7D%5Cn Submission: %7B1%7D%22.format(grader_path,submission))%0A
resu
@@ -1676,32 +1676,33 @@... |
f96989d067f6fd073d04f96bdf2ae314c9b02d49 | Use request helper function in LayersScraper | uoftscrapers/scrapers/utils/layers.py | uoftscrapers/scrapers/utils/layers.py | import requests
import json
from . import Scraper
class LayersScraper:
"""A superclass for scraping Layers of the UofT Map.
Map is located at http://map.utoronto.ca
"""
host = 'http://map.utoronto.ca/'
s = requests.Session()
@staticmethod
def get_layers_json(campus):
"""Retrieve... | Python | 0 | @@ -218,35 +218,8 @@
ca/'
-%0A s = requests.Session()
%0A%0A
@@ -419,29 +419,16 @@
ders = %7B
-%0A
'Referer
@@ -448,25 +448,16 @@
per.host
-%0A
%7D%0A
@@ -462,29 +462,23 @@
-html = Layers
+data =
Scraper.
s.ge
@@ -473,18 +473,16 @@
Scraper.
-s.
get('%25s%25
@@ -596,47 +59... |
b747da4fe99372e53850a964f450c7b00a4d81c9 | Add node add/delete, edge del | graph.py | graph.py |
class SimpleGraph(object):
"""This is a simple graph program that will allow us
to impliment a graph data structure"""
def __init__(self, dict_graph={}):
self.dict_graph = dict_graph
def node(self):
'''return a list of all nodes in the graph'''
return list(__dict_graph.keys())
... | Python | 0.000001 | @@ -492,36 +492,96 @@
raph'''%0A
-pass
+if n not in self.dict_graph:%0A self.dict_graph%5Bn%5D = %5B%5D
%0A%0A def add_ed
@@ -766,64 +766,8 @@
'''%0A
- edge = set(edge)%0A (n1, n2) = tuple(edge)%0A
@@ -1019,36 +1019,153 @@
ists'''%0A
-pass
+try:%0A del se... |
4dbde6b8c33a85508ae9c375fef4d4caabfb4d15 | add function build_valid_filename | nlp/extractors/base.py | nlp/extractors/base.py | import re
class BaseExtractor(object):
def _extract(self, html):
result =[]
return result
def find_between(self, text, s1, s2=None):
if not s1:
raise Exception('s1 is None!')
pos1 = text.find(s1)
if s2 and pos1 != -1:
pos2 = text.... | Python | 0.00008 | @@ -46,35 +46,47 @@
def
-_extract
+build_valid_filename
(self,
-html
+text
):%0D%0A
@@ -85,34 +85,222 @@
):%0D%0A
-result =%5B%5D
+dst=text%0D%0A for x in '%5Ct%5Cn%5C':;%22,.%5B%5D()%7B%7D~!@#$%25%5E&*_+-=/%3C%3E?':%0D%0A dst=dst.replace(x,' ')%0D%0A dst=dst.replace(' ','... |
a2837ab778d39e66c6178dae34a3bebdc638061f | fix test | py/test/testing/test_outcome.py | py/test/testing/test_outcome.py |
import py
import marshal
class TestRaises:
def test_raises(self):
py.test.raises(ValueError, "int('qwe')")
def test_raises_exec(self):
py.test.raises(ValueError, "a,x = []")
def test_raises_syntax_error(self):
py.test.raises(SyntaxError, "qwe qwe qwe")
def test_raises_funct... | Python | 0.000001 | @@ -894,16 +894,93 @@
ion__))%0A
+ mod = py.std.new.module(%22hello123%22)%0A mod.__version__ = %221.3%22 %0A
@@ -1033,34 +1033,40 @@
t.importorskip(%22
-py
+hello123
%22, minversion=%225
|
9b7b65374df1ab8cf9b0d925535d9dd542b3c433 | Use rounding decimal field in BomItem form | InvenTree/part/forms.py | InvenTree/part/forms.py | """
Django Forms for interacting with Part objects
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from InvenTree.forms import HelperForm
from InvenTree.helpers import GetExportFormats
from mptt.fields import TreeNodeChoiceField
from django import forms
from django.utils.translation import ugette... | Python | 0.000001 | @@ -199,16 +199,70 @@
tFormats
+%0Afrom InvenTree.fields import RoundingDecimalFormField
%0A%0Afrom m
@@ -5056,32 +5056,106 @@
tem object %22%22%22%0A%0A
+ quantity = RoundingDecimalFormField(max_digits=10, decimal_places=5)%0A%0A
class Meta:%0A
|
5801c152ea9f83e03a0f6ca8083410104d01df69 | Check for invalid config object | nmi_mysql/nmi_mysql.py | nmi_mysql/nmi_mysql.py | """
Custom mysql wrapper for pymysql
Usefull for raw queries and scripting
"""
import re
import logging
import pymysql.cursors
from queue import Queue
class DB(object):
def __init__(self, conf, max_pool_size=20):
self.conf = conf
self.max_pool_size = max_pool_size
self._initializ... | Python | 0.000001 | @@ -155,16 +155,75 @@
Queue%0A%0A%0A
+CONFIG_KEYS = %5B'host', 'user', 'password', 'db', 'port'%5D%0A%0A%0A
class DB
@@ -281,16 +281,196 @@
ze=20):%0A
+ self.logger = logging.getLogger('database')%0A%0A for c in CONFIG_KEYS:%0A if c not in conf:%0A return self.logger.error('In... |
5fd1e9266a9d4c7d0e06baa61087446eee11dc9c | Correct the static URL | defivelo/settings/base.py | defivelo/settings/base.py | """
Django settings for defivelo project.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
import os
import dj_database_url
import pytz
from django.contrib import ... | Python | 0.999823 | @@ -983,20 +983,16 @@
count',%0A
-
%0A 'dj
@@ -1170,20 +1170,16 @@
files',%0A
-
%0A 'pa
@@ -4665,22 +4665,82 @@
OT',
- '/tmp/static'
+%0A os.path.join(PROJECT_ROOT, 'static_files')
)%0A%0AS
|
f0f1fb06896294f2657083aa7a077d852ea8bb4b | add sort order | ats/admin.py | ats/admin.py | from django.contrib import admin
from .models import ProjectWorker
class ProjectWorkerAdmin(admin.ModelAdmin):
list_filter = ['user', 'project', 'job']
admin.site.register(ProjectWorker, ProjectWorkerAdmin)
| Python | 0.000088 | @@ -152,16 +152,58 @@
'job'%5D%0A
+ ordering = %5B'user', 'project', 'job'%5D%0A
%0A%0Aadmin.
|
86c82a4215aeffb3ddf0a195c8a556fc5a32667a | fix save method if object is updated | nosql_schema/schema.py | nosql_schema/schema.py | import nosqlite
from fields import Field
from exceptions import ValidationError
import config as base_config
class Schema:
@staticmethod
def get_config():
config = vars(base_config)
if 'DATABASE_PATH' not in config:
config['DATABASE_PATH'] = 'database.db'
return config
... | Python | 0.000001 | @@ -1592,34 +1592,8 @@
ate(
-%7B'_id': document%5B'_id'%5D%7D,
docu
|
6447899ec344d14fbb78b9a2bbbe8b75451f10f2 | Set isolation level to reapeatable read | pyophase/settings_production.py | pyophase/settings_production.py | """
This is the settings file used in production.
First, it imports all default settings, then overrides respective ones.
Secrets are stored in and imported from an additional file, not set under version control.
"""
from pyophase import settings_secrets as secrets
from .settings import *
SECRET_KEY = secrets.SECRE... | Python | 0 | @@ -695,16 +695,66 @@
TABLES'%22
+,%0A 'isolation_level': %22repeatable read%22
%0A
|
4839121f90934f7e52e51c05d052d27124680be7 | Remove confusing and useless "\n" | pyqode/python/backend/server.py | pyqode/python/backend/server.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Main server script for a pyqode.python backend. You can directly use this
script in your application if it fits your needs or use it as a starting point
for writing your own server.
::
usage: server.py [-h] [-s [SYSPATH [SYSPATH ...]]] port
positional argumen... | Python | 0.000072 | @@ -1080,10 +1080,8 @@
path
-%5Cn
' %25
|
31852bbf09e4f416f93c7720ecd9eca8cfe32d38 | Update version | pyramid_request_log/__init__.py | pyramid_request_log/__init__.py | from __future__ import absolute_import
from .config import includeme
__version__ = '0.6'
| Python | 0 | @@ -85,7 +85,7 @@
'0.
-6
+7
'%0A
|
7b18161879473793c0be5b369ca332cbcc458d7d | Change wrong import in f2py tool. | numscons/tools/f2py.py | numscons/tools/f2py.py | """f2py Tool
Tool-specific initialization for f2py.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
import os
from os.path import join as pjoin, dirname as pdirname
import re
import sys
import subprocess
im... | Python | 0 | @@ -428,17 +428,24 @@
.Node.FS
-.
+ import
default_
@@ -451,20 +451,8 @@
_fs
-import Entry
%0A%0A#
@@ -647,32 +647,43 @@
target.append(
+default_fs.
Entry(pjoin(buil
@@ -1035,16 +1035,27 @@
.append(
+default_fs.
Entry(pj
|
3c3c452426b7568675028ec9def514eb6d501e35 | Fix flake8 errors | qmxgraph/decoration_contents.py | qmxgraph/decoration_contents.py | import attr
from qmxgraph.extra_attr_validators import tuple_of
asdict = attr.asdict
_is_int = attr.validators.instance_of(int)
_is_str = attr.validators.instance_of(str)
@attr.s(frozen=True, slots=True)
class Image:
"""
Represet an image tag that could be embedded into a table contents.
The image's... | Python | 0.000004 | @@ -2899,16 +2899,24 @@
row with
+%0A
the giv
@@ -3519,21 +3519,13 @@
-assert False,
+msg =
'%5Cn
@@ -3568,16 +3568,46 @@
in%5Cn%7B%7D'
+%0A assert False, msg
.format(
@@ -3678,9 +3678,8 @@
+ 1:%5D)%0A
-%0A
|
314d848288474cd39445cc940711435c04b0be1a | version bumped | oandapyV20/__init__.py | oandapyV20/__init__.py | __title__ = "OANDA REST V20 API Wrapper"
__version__ = "0.2.2"
__author__ = "Feite Brekeveld"
__license__ = "MIT"
__copyright__ = "Copyright 2016 Feite Brekeveld"
# Version synonym
VERSION = __version__
# Set default logging handler to avoid "No handler found" warnings.
import logging
try:
from logging import Nul... | Python | 0 | @@ -53,17 +53,17 @@
= %220.2.
-2
+3
%22%0A__auth
|
3d6adf735cc54b0297ff0cd475aabe39de18840c | return an ElementTree object from make_api_call in xml kind | oauth_access/access.py | oauth_access/access.py | import httplib2
import logging
import socket
import urllib
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse
from django.utils import simplejson as json
from django.contrib.sites.models import Site
import oauth2 as oauth
from oauth_... | Python | 0.000005 | @@ -5405,16 +5405,34 @@
return
+etree.ElementTree(
etree.fr
@@ -5440,32 +5440,33 @@
mstring(content)
+)
%0A else:%0A
|
6b966f68aab979bb6dab55f08ec7c5b3807295da | Update hello.py | hello.py | hello.py | import sqlite3
from flask import Flask
from flask import g
import cf_deployment_tracker
import os
# Emit Bluemix deployment event
cf_deployment_tracker.track()
app = Flask(__name__)
# On Bluemix, get the port number from the environment variable VCAP_APP_PORT
# When running this app on the local machine, default the... | Python | 0.000001 | @@ -1254,16 +1254,1852 @@
html')%0A%0A
+@app.route('/processOrder', methods = %5B'POST'%5D)%0Adef processOrder():%0A if request.method == 'POST':%0A nonce = request.form%5B'nonce'%5D%0A name = request.form%5B'username'%5D%0A order = request.form%5B'order'%5D%0A cost = int(request.form... |
3c46550771f5dc588ae9a0cf61a6980fd0315e6f | Fix e.details handling | odlclient/v2/client.py | odlclient/v2/client.py | # Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Author: Endre Karlson <endre.karlson@hp.com>
#
# 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/lice... | Python | 0.000003 | @@ -2547,16 +2547,58 @@
n as e:%0A
+ if hasattr(e, 'details'):%0A
|
791b6720e489353bb5a2b35906dd88f558f26c33 | Handle NotImplementedError | ogn/gateway/process.py | ogn/gateway/process.py | import logging
from ogn.commands.dbutils import session
from ogn.model import AircraftBeacon, ReceiverBeacon, Location
from ogn.parser import parse, ParseError
logger = logging.getLogger(__name__)
def replace_lonlat_with_wkt(message):
location = Location(message['longitude'], message['latitude'])
message['... | Python | 0.000001 | @@ -1008,32 +1008,170 @@
ormat(message))%0A
+ except NotImplementedError as e:%0A logger.error('Received message: %7B%7D'.format(raw_message))%0A logger.error(e)%0A
except P
|
79f545795c864793bbeee3d2f08ff241bdc5c73d | fix spacing | ogusa/tests/test_SS.py | ogusa/tests/test_SS.py | import pytest
import json
import pickle
import numpy as np
import os
from ogusa import SS
CUR_PATH = os.path.abspath(os.path.dirname(__file__))
def test_SS_fsolve():
# Test SS.SS_fsolve function. Provide inputs to function and
# ensure that output returned matches what it has been before.
with open(os.p... | Python | 0.000054 | @@ -5171,18 +5171,20 @@
e%5Bi%5D%5Bi2%5D
+
==
+
v2))%0A
@@ -5252,18 +5252,20 @@
e%5Bi%5D%5Bi2%5D
+
==
+
v2).all(
@@ -5337,18 +5337,20 @@
e%5Bi%5D%5Bi2%5D
+
==
+
v2)%0A%0A%0A@p
|
77733f09717a2b61d5773c14b0b5a357f155dd1e | make handler authenticated and change to request body | oidenbterm/handlers.py | oidenbterm/handlers.py | import oide.lib.decorators
import oide.settings as global_settings
import oide.apps.filebrowser.settings as app_settings
from oide.lib.handlers.base import BaseHandler
from oidenbterm.mixins.kernel_mixin import KernelMixin
from terminado import TermSocket
from traitlets import Integer
import json
import tornado.web
imp... | Python | 0 | @@ -575,64 +575,149 @@
-def post(self):%0A code = self.get_argument(
+@oide.lib.decorators.authenticated%0A def post(self):%0A # print self.request.body%0A code = json.loads(self.request.body)%5B
%22code%22
-)
+%5D
%0A
|
5c5f7981905c757cd5a750c2b2d09ea6bc6f1f28 | Add BoolTypeFactory class | dataproperty/_factory.py | dataproperty/_factory.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
import abc
import six
from .converter import NopConverterCreator
from .converter import IntegerConverterCreator
from .converter import FloatConverterCreator
from .converter import DateTimeConvert... | Python | 0 | @@ -267,32 +267,76 @@
onverterCreator%0A
+from .converter import BoolConverterCreator%0A
from .converter
@@ -537,32 +537,90 @@
eCheckerCreator%0A
+from ._type_checker_creator import BoolTypeCheckerCreator%0A
from ._type_chec
@@ -2087,32 +2087,271 @@
rterCreator()%0A%0A%0A
+class BoolTypeFactory(TypeConverterFacto... |
f8fd1a1b7e0eb2bcbcd64fa6a352862fceea80de | Use two level danger level. | autopilot.py | autopilot.py | # -*- coding: utf-8 -*-
"""
Autopilots for the DriveIt Gym environment.
@author: Jean-Claude Manoli
"""
import numpy as np
from belief import BeliefTracking
epsilon = 0.05
class Autopilot(object):
def __init__(self, car, other_cars=None):
self.car = car
self.tracker = BeliefTracking(car, other_car... | Python | 0.000004 | @@ -1252,16 +1252,21 @@
d, dd
+, ddd
= False
@@ -1267,17 +1267,26 @@
False,
-1
+False, 1.0
%0A
@@ -1301,17 +1301,17 @@
%5B0%5D %3C 0.
-5
+8
and x %3C
@@ -1324,19 +1324,19 @@
nd x %3E -
-1.0
+0.8
:%0A
@@ -1334,32 +1334,33 @@
8:%0A d
+d
= True%0A
@@ -1411,16 +1411,17 @@
... |
fa9fec30dbc91a1f968661acebc3a0b653781e70 | Update the actual filename if we are doing Windows safe character replacement. | videodownloader/providers/__init__.py | videodownloader/providers/__init__.py | __license__ = '''
Copyright 2010 Jake Wharton
py-video-downloader 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 3 of
the License, or (at your option) any later version.
py-video-downloade... | Python | 0 | @@ -3013,60 +3013,8 @@
l)%0A%0A
- filename = self.filename + self.fileext%0A
@@ -3096,16 +3096,21 @@
+self.
filename
@@ -3129,24 +3129,17 @@
'%5B?%5C
-%5B%5C%5D%5C
/%5C%5C
-=+
%3C%3E:
-;%22,*
+%22*%7C
%5D+',
@@ -3144,16 +3144,21 @@
', '_',
+self.
filename
@@ -3171,16 +3171,68 @@
NIC... |
27df09cd98d9128d89d9d9d26ee0e89223fbd990 | document idlerpg's external dependencies | libqtile/widget/idlerpg.py | libqtile/widget/idlerpg.py | # -*- coding: utf-8 -*-
# Copyright (c) 2016 Tycho Andersen
#
# 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, modi... | Python | 0 | @@ -1451,16 +1451,110 @@
=pants%22)
+%0A%0A Widget requirements: xmltodict_.%0A%0A .. _xmltodict: https://pypi.org/project/xmltodict/
%0A %22%22%22
|
b736e69a88d3caf288f55216830a37df3b2da57c | Generate docs correctly if pexpect is not available. | docs/autogen_api.py | docs/autogen_api.py | #!/usr/bin/env python
"""Script to auto-generate our API docs.
"""
# stdlib imports
import os
import sys
# local imports
sys.path.append(os.path.abspath('sphinxext'))
from apigen import ApiDocWriter
#*****************************************************************************
if __name__ == '__main__':
pjoin = o... | Python | 0.999999 | @@ -2897,16 +2897,337 @@
%5D%0A
+ %0A # If we don't have pexpect, we can't load irunner, so skip any code that%0A # depends on it%0A try:%0A import pexpect%0A except ImportError:%0A docwriter.module_skip_patterns += %5Br'%5C.lib%5C.irunner',%0A ... |
79006fa1fe0bf78d10a1951b2cc20ba5ff245e4b | Provide 'self' argument to instance method | sklearn/utils/tests/test_metaestimators.py | sklearn/utils/tests/test_metaestimators.py | from sklearn.utils.metaestimators import if_delegate_has_method
from nose.tools import assert_true
class Prefix(object):
def func():
pass
class MockMetaEstimator(object):
"""This is a mock meta estimator"""
a_prefix = Prefix()
@if_delegate_has_method(delegate="a_prefix")
def func(self):... | Python | 0.999981 | @@ -129,16 +129,20 @@
ef func(
+self
):%0A
|
4edd9e21f910e156c5b5a73a66b4d63923b8e86d | Make the script Python 3 compatible | rsatool.py | rsatool.py | #!/usr/bin/env python2
import base64, fractions, optparse, random
import gmpy
from pyasn1.codec.der import encoder
from pyasn1.type.univ import *
PEM_TEMPLATE = '-----BEGIN RSA PRIVATE KEY-----\n%s-----END RSA PRIVATE KEY-----\n'
DEFAULT_EXP = 65537
def factor_modulus(n, d, e):
"""
Efficiently recover non-tr... | Python | 0.999675 | @@ -2046,16 +2046,17 @@
return
+(
PEM_TEMP
@@ -2096,16 +2096,35 @@
o_der())
+.decode()).encode()
%0A%0A de
@@ -2749,17 +2749,16 @@
or i in
-x
range(0,
@@ -2817,25 +2817,25 @@
print
-
+(
'%25s = %25d (%25#
@@ -2857,16 +2857,17 @@
al, val)
+)
%0A
@@ -2890,17 +2890,17 @@
print
-
+(
'%2... |
f9f3ca75e8151b1467fddffe390aee6a8fe00259 | Change configuration for wsgi settings | dev_cloud/web_service/wsgi.py | dev_cloud/web_service/wsgi.py | # -*- coding: utf-8 -*-
# @COPYRIGHT_begin
#
# Copyright [2015] Michał Szczygieł, M4GiK Software
#
# 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... | Python | 0 | @@ -881,57 +881,89 @@
%22%22%22%0A
-activate_this = '../.pyenv/bin/activate_this.py '
+from core.settings.config import ENVIROMENT_PATH%0A%0Aactivate_this = ENVIROMENT_PATH
%0Aexe
|
f3724421fa859a5970e66353b6a311aa14b866ec | Add additional spacing to improve readability | labs/lab-5/ex5-1.log.py | labs/lab-5/ex5-1.log.py | #!/usr/bin/python
#
# Copyright 2016 BMC Software, 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 la... | Python | 0.000003 | @@ -914,16 +914,17 @@
%5D, %22r%22)%0A
+%0A
@@ -991,16 +991,17 @@
g_file)%0A
+%0A
|
1adb2c16780a2bbdf5a40368a856dc4b6e9df9f6 | build out initial email example, small change to README | example-emailed_daily_operational_report.py | example-emailed_daily_operational_report.py | import liveengage_data_app as le_api
app = le_api.LiveEngageDataApp(account_number='xx',
keys_and_secrets={
'consumer_key':'xx',
'consumer_secret':'xx',
'token_key':'xx',
... | Python | 0.000361 | @@ -31,16 +31,1506 @@
le_api%0A%0A
+def get_skills(application):%0A skills_data = application.get_skills_data()%0A print(str(skills_data%5B'errors'%5D)) if skills_data%5B'errors'%5D else print('ok')%0A account_skills = %5B%7B%7D%5D%0A for skill in skills_data:%0A account_skills.append(%7B%0A ... |
3d4c4784d0ca5c56c9159b62016717596f5f92e9 | add dbase | ostap/io/dbase.py | ostap/io/dbase.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
# @file compress_dbase.py
#
# Helper module to use databases
#
# @author Vanya BELYAEV Ivan.Belyaev@itep.ru
# @date 2020-05-16
# =====================================================... | Python | 0.000001 | @@ -1549,18 +1549,18 @@
import b
-d
s
+d
db3%0D%0A
@@ -1615,18 +1615,18 @@
if b
-d
s
+d
db3 :%0D%0A
@@ -6678,34 +6678,34 @@
return b
-d
s
+d
db3.hasopen ( fl
@@ -6985,18 +6985,18 @@
return b
-d
s
+d
db3.haso
|
892ce48164c054079820ff712405375fe9eaaafb | remove simple analyzer | readthedocs/search/documents.py | readthedocs/search/documents.py | import logging
from django.conf import settings
from django_elasticsearch_dsl import DocType, Index, fields
from elasticsearch import Elasticsearch
from readthedocs.projects.models import HTMLFile, Project
project_conf = settings.ES_INDEXES['project']
project_index = Index(project_conf['name'])
project_index.setti... | Python | 0.000001 | @@ -2690,33 +2690,16 @@
xtField(
-analyzer='simple'
),%0A%0A
|
216fabd077d5868eebca5b08c27f9907d023a4d9 | Add back erroneously removed validation statement | exdb/forms.py | exdb/forms.py | from datetime import datetime
from django import forms
from django.core.exceptions import ValidationError
from django.utils.timezone import now
from django.utils.encoding import force_text
from django.utils.safestring import mark_safe
from django.utils.html import format_html
from django.utils.translation import ugette... | Python | 0.000001 | @@ -4110,26 +4110,26 @@
datetime', m
-ax
+in
_dt) %3C self.
@@ -4124,32 +4124,59 @@
_dt) %3C self.when
+ and not self.approval_form
),%0A
|
7760765e32b81bad6957d333850293db86a2bbcf | Fixes 'Document instance has no attribute 'file_basename'' | doc2text/__init__.py | doc2text/__init__.py | import PyPDF2 as pyPdf
import PythonMagick
import os
import mimetypes
import cv2
from .page import Page
acceptable_mime = ["image/bmp", "image/png", "image/tiff", "image/jpg", "video/JPEG", "video/jpeg2000"]
def main():
"""Entry point for the application script"""
print("Call your main application code here")... | Python | 0.997427 | @@ -666,24 +666,29 @@
+self.
filename
, self.f
@@ -683,126 +683,140 @@
name
-, self.file_extension = os.path.splitext(path)%0A self.path = path%0A self.filename = os.path.basename(path)
+ = os.path.basename(path)%0A self.file_basename, self.file_extension = os.path.splitext(self.filena... |
d40f1fe493ec2c71d84ac84f5dc989c68de321ca | add version option | batch_isp.py | batch_isp.py | import argparse
from parts import Parts
from pgm_error import PgmError
from operations import Operations
from serial_io import SerialIO
class BatchISP:
def __init__(self):
parser = argparse.ArgumentParser(
description='Linux remake of Atmel\'s BatchISP utility.')
parser.add_argumen... | Python | 0.000001 | @@ -590,16 +590,100 @@
ODO %7D%22)%0A
+ parser.add_argument('-version', action='version', version='%25(prog)s 0.0.0')%0A
|
84fc6f4e05c30e368b869b0e5af80b90db5b0ace | Write generic push instructions for the time being | Lib/extractor/stream.py | Lib/extractor/stream.py | # -*- coding: utf-8 -*-
from fontTools.misc.textTools import num2binary
from fontTools.ttLib.tables.ttProgram import streamOpcodeDict, opcodeDict
from io import BytesIO
class InstructionStream(object):
"""
:param program_bytes: The program bytecode.
:type program_bytes: bytes
The instruction stream.... | Python | 0.000002 | @@ -2731,32 +2731,34 @@
+ #
args.append(str
@@ -2769,16 +2769,90 @@
_args))%0A
+ # TODO: Reactivate when NPUSH can be roundtripped%0A
@@ -3291,16 +3291,96 @@
ructions
+%0A cmd_name = %22push%22 # Write generic push instruction for now
%0A%0A ... |
4943fc51157cf9f03102cb58fbd9f73da5e199e9 | Add additional logic checks in CheckoutLineDelete mutation | saleor/graphql/checkout/mutations.py | saleor/graphql/checkout/mutations.py | import graphene
from django.db import transaction
from ...account.models import Address
from ...checkout import models
from ...checkout.utils import add_variant_to_cart
from ..account.types import AddressInput, User
from ..core.mutations import BaseMutation, ModelMutation
from ..order.mutations.draft_orders import che... | Python | 0 | @@ -5267,24 +5267,78 @@
eckoutLine)%0A
+ if line and line in checkout.lines.all():%0A
line
|
bd905379bc2e2f6830ee61a094ca8e4cff22ac1c | Remove hardcoded pducb factor. | behaviors.py | behaviors.py | from datastructure import EnlargeableArray
from prediction import predict_on_volume
from qrsim.tcpclient import UAVControls
import numpy as np
from numpy.linalg import norm
import numpy.random as rnd
class VelocityTowardsWaypointController(object):
def __init__(self, maxv, max_climb):
self.maxv = maxv
... | Python | 0.000021 | @@ -6580,19 +6580,8 @@
cb =
- 0.15e-12 *
np.
|
1ea72ca96f0f43bd80baa9fb41ec930ea02de271 | fix name error | sfa/rspecs/sfa_rspec_converter.py | sfa/rspecs/sfa_rspec_converter.py | #!/usr/bin/python
from lxml import etree
from StringIO import StringIO
from sfa.util.xrn import *
from sfa.rspecs.sfa_rspec import SfaRSpec
from sfa.rspecs.pg_rspec import PGRSpec
class SfaRSpecConverter:
@staticmethod
def to_pg_rspec(rspec):
if isinstance(rspec, SfaRSpec):
sfa_rspec = rs... | Python | 0.000024 | @@ -2005,16 +2005,16 @@
'%5D =
+
locati
-t
on.g
|
c0a075810e3d92295ade789c24d141c1dbba60c4 | Add support for secret driver in create_secret | docker/api/secret.py | docker/api/secret.py | import base64
import six
from .. import utils
class SecretApiMixin(object):
@utils.minimum_version('1.25')
def create_secret(self, name, data, labels=None):
"""
Create a secret
Args:
name (string): Name of the secret
data (bytes): Secret data ... | Python | 0 | @@ -20,16 +20,38 @@
rt six%0A%0A
+from .. import errors%0A
from ..
@@ -63,16 +63,16 @@
t utils%0A
-
%0A%0Aclass
@@ -177,24 +177,37 @@
labels=None
+, driver=None
):%0A %22
@@ -431,24 +431,175 @@
o the secret
+%0A driver (DriverConfig): A custom driver configuration. If%0A ... |
3ee08a354df1f6e008d1d2de6552a0befa948365 | Call _handle_query_error correctly | designate/mdns/handler.py | designate/mdns/handler.py | # Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Author: Kiall Mac Innes <kiall@hp.com>
#
# 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/L... | Python | 0.000126 | @@ -2053,34 +2053,8 @@
ror(
-%0A context,
requ
@@ -2132,33 +2132,24 @@
_error(self,
- context,
request, rc
@@ -2339,16 +2339,17 @@
end back
+.
%0A
|
346589edf9e331a87ff371e3bf52d7759ec5100a | Add the fix for DNS resolver bug in pycurl to allow hostname use | benchmark.py | benchmark.py | #/usr/bin/env/python
import timeit
import time
import string
import argparse
# Import clients, so script fails fast if not available
from pycurl import Curl
try:
from cStringIO import StringIO
except:
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import requ... | Python | 0 | @@ -3043,32 +3043,155 @@
ody.close()%22))%0A%0A
+ # The use of global DNS cache avoids a bug on some linux systems with libcurl %0A # playing badly with DNS resolvers%0A
tests.append
@@ -3463,32 +3463,96 @@
URL, '$url'); %5C%0A
+ mycurl.setopt(mycurl.DNS_USE_GLOBAL_CACHE, True); %5C%0A
... |
dbf3af1de0bbbda178e5bbd1ca0473a83d8cb9b3 | test triggering travis | fabre_test.py | fabre_test.py | #!/usr/bin/env python
# coding=UTF-8
import sys
sys.exit(0)
| Python | 0.000001 | @@ -40,16 +40,30 @@
port sys
+%0Aimport pytest
%0A%0Asys.ex
|
4cff5b7a14dfda786fef4a869e72095b7d9d83e4 | correct relative import, d'oh | pyjac/performance_tester/__main__.py | pyjac/performance_tester/__main__.py | import sys
import os
import .performance_tester as pt
from argparse import ArgumentParser
def main(args=None):
if args is None:
# command line arguments
parser = ArgumentParser(description='performance_tester.py: '
'tests pyJac performance'
... | Python | 0.000035 | @@ -19,16 +19,22 @@
os%0A%0A
+from .
import
-.
perf
|
237e11dcf7d92a54c8deea6703f32817c49f4fa5 | Add timeout to show name query | silence_notifier/communication.py | silence_notifier/communication.py | import logging
import random
import requests
from slackclient import SlackClient
class Communicator:
"""Class handling communication to Slack, and with Radio REST API."""
channel_mention = "<!channel>"
current_shows_uri = "/v2/sendinger/currentshows"
def __init__(self, slack_client: SlackClient, set... | Python | 0.000003 | @@ -4832,24 +4832,41 @@
n radio.%22%22%22%0A
+ try:%0A
r =
@@ -4923,30 +4923,31 @@
hows_uri
-)%0A try:
+, timeout=10.0)
%0A
|
61fed70623ec31695c616588477605aa40c9683c | Remove extra newline | examples/scripts/get-profile-connections.py | examples/scripts/get-profile-connections.py | #!/usr/bin/env python
###
# (C) Copyright (2012-2016) Hewlett Packard Enterprise Development LP
#
# 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 limita... | Python | 0.000002 | @@ -2408,34 +2408,32 @@
%0A print('
-%5Cn
%7B0:25%7D %7B1:3%7D
|
959f99f6cce0b627fd803bc280fa20eb0fbeb373 | Remove test code (#189) | terminalone/reports.py | terminalone/reports.py | # -*- coding: utf-8 -*-
"""Provides reporting data."""
from __future__ import absolute_import, division
import csv
from .config import SERVICE_BASE_PATHS
from .connection import Connection
from .errors import ClientError, T1Error
from .utils import compose
from .vendor import six
from .vendor.six.moves.urllib.parse im... | Python | 0 | @@ -2601,34 +2601,8 @@
a':%0A
- print(%22test%22)%0A
|
126305c8bf5b659568a1cb40d731b7df0a75c553 | Remove --mp-mode option from runtest.py | runtest.py | runtest.py | #!/usr/bin/env python3
import unittest
import sys
from argparse import ArgumentParser
import logging
import threading
from tests.util import GLOBAL
# **********
# Grab Tests
# **********
# FIXME:
# * Test redirect and response.url after redirect
GRAB_TEST_LIST = (
# *** Internal API
"tests.grab_api",
"te... | Python | 0.000001 | @@ -3615,169 +3615,8 @@
nt(%0A
- %22--mp-mode%22,%0A action=%22store_true%22,%0A default=False,%0A help=%22Enable multiprocess mode in spider tests%22,%0A )%0A parser.add_argument(%0A
@@ -4445,46 +4445,8 @@
G)%0A%0A
- GLOBAL%5B%22mp_mode%22%5D = opts.mp_mode%0A%0A
|
7596de67f67f5bdc9350067a896dcd4b7b4c7650 | Stop requiring the path of the users file; only require the name. | gobbldygook.py | gobbldygook.py | #!/usr/bin/env python3
import argparse, csv, os
from course import Course, all_courses, all_labs, getCourse
from student import Student
def argument_parse():
parser = argparse.ArgumentParser(description="This program works best if you give it some data. However, we have some example stuff to show you anyway.)")
pa... | Python | 0 | @@ -360,26 +360,15 @@
lt='
-users/
example
-.yaml
')%0A%09
@@ -1811,16 +1811,25 @@
ilename=
+'users/'+
args.loa
@@ -1829,16 +1829,24 @@
rgs.load
++'.yaml'
)%0A%09print
|
d73c6addf064ba7b78c4874a6affc6bac6dfee1f | Add image feature detection | image.py | image.py | from __future__ import division
import numpy as np
import cv2
import time
from matplotlib import pyplot as plt
MIN_MATCH_COUNT = 200
# only using match count right now
MIN_MATCH_RATIO = .2
def compare(img1_name, img2_name):
"""
Return whether img1 and img2 differ signficiantly
Determined through feature ... | Python | 0 | @@ -66,16 +66,20 @@
ort time
+, io
%0Afrom ma
@@ -107,16 +107,48 @@
t as plt
+%0Afrom google.cloud import vision
%0A%0AMIN_MA
@@ -1257,8 +1257,774 @@
H_COUNT%0A
+%0Adef features(img_path,labels=True,logos=True,landmarks=True):%0A %22%22%22%0A Returns a list of features from an image%0A%0A Optionally pass ... |
377aef17394b2dabd6db7439d3cfcd4e0d54a3c2 | Allow codata tests to be run as script. | scipy/constants/tests/test_codata.py | scipy/constants/tests/test_codata.py |
import warnings
from scipy.constants import find
from numpy.testing import assert_equal
def test_find():
warnings.simplefilter('ignore', DeprecationWarning)
keys = find('weak mixing', disp=False)
assert_equal(keys, ['weak mixing angle'])
keys = find('qwertyuiop', disp=False)
assert_equal(keys,... | Python | 0.000004 | @@ -82,16 +82,34 @@
rt_equal
+, run_module_suite
%0A%0Adef te
@@ -988,8 +988,59 @@
ime'%5D))%0A
+%0Aif __name__ == %22__main__%22:%0A run_module_suite()%0A
|
67c2e8ba33b5bcc83f0242bece81f604d21939db | Fix editing error | pytest-profiling/pytest_profiling.py | pytest-profiling/pytest_profiling.py | from __future__ import absolute_import
import pytest
import os
import cProfile
import pstats
import pipes
import six
import errno
from hashlib import md5
LARGE_FILENAME_HASH_LEN = 8
def clean_filename(s):
forbidden_chars = set('/?<>\:*|"')
return six.text_type("".join(c if c not in forbidden_chars and ord(... | Python | 0.000002 | @@ -1122,16 +1122,139 @@
lf.svg:%0A
+ self.svg_name = os.path.abspath(os.path.join(%22prof%22, %22combined.svg%22))%0A t = pipes.Template()%0A
|
20d39fe954e9dc62bbe283ad89b7c140529a23df | Remove WindowDict.__contains__ | gorm/window.py | gorm/window.py | from collections import deque, MutableMapping
class WindowDict(MutableMapping):
"""A dict that keeps every value that a variable has had over time.
Look up a revision number in this dict and it will give you the effective value as
of that revision. Keys should always be revision numbers. Once a key i... | Python | 0.000055 | @@ -1678,182 +1678,8 @@
ev%0A%0A
- def __contains__(self, k):%0A if not self._past or self._past%5B0%5D%5B0%5D %3E k:%0A return False%0A self.seek(k)%0A return self._past%5B-1%5D%5B1%5D is not None%0A%0A
|
0220872a2bb0ce8b6d4bb54c4f843a05e15ecd4d | Update docs version | docs/source/conf.py | docs/source/conf.py | import os
import sys
import sphinx_rtd_theme
# Source file types:
source_suffix = ['.rst', '.md']
# -*- coding: utf-8 -*-
#
# HiDi documentation build configuration file, created by
# sphinx-quickstart on Mon Apr 10 19:42:17 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
... | Python | 0 | @@ -1882,17 +1882,17 @@
= u'0.0.
-2
+3
'%0A# The
@@ -1951,17 +1951,17 @@
= u'0.0.
-2
+3
'%0A%0A# The
|
d2f8e58ef18527f280b1fc4675afda9f679e4c37 | Make WindowDict.seek() a little bit lazier | gorm/window.py | gorm/window.py | from collections import deque, MutableMapping, ItemsView, ValuesView
class WindowDictItemsView(ItemsView):
def __contains__(self, item):
(rev, v) = item
if self._mapping._past:
if rev < self._mapping._past[0][0]:
return False
elif self._mapping._future:
... | Python | 0.000001 | @@ -2027,33 +2027,16 @@
ast and
-self._future and
self._pa
@@ -2048,25 +2048,48 @@
%5D%5B0%5D %3C= rev
-%3C
+and (not self._future or
self._futur
@@ -2087,32 +2087,39 @@
lf._future%5B0%5D%5B0%5D
+ %3E rev)
:%0A re
|
2ad3d8df999dcea21f3f12fdf417574effd6ceb6 | Fix profiling | devito/core/autotuning.py | devito/core/autotuning.py | from __future__ import absolute_import
from collections import OrderedDict
from itertools import combinations
from functools import reduce
from operator import mul
import resource
from devito.logger import info, info_at
from devito.nodes import Iteration
from devito.parameters import configuration
from devito.visitor... | Python | 0.000015 | @@ -3491,38 +3491,35 @@
erator.profiler.
-struct
+var
name%5D = operator
@@ -4189,16 +4189,62 @@
struct%0A
+ assert operator.profiler.varname in tuned%0A
tune
@@ -4263,22 +4263,19 @@
rofiler.
-struct
+var
name%5D =
|
ef1813af0e70661c9770de69178ce7b8fc8c544f | Add proper description of project to texinfo docs. | docs/source/conf.py | docs/source/conf.py | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
import os
import re
import sys
# -- Path setup ----------------------------... | Python | 0 | @@ -5352,42 +5352,89 @@
h',
-'One line desc
+%22A dashboard for the status of the top certificate autho
ri
-p
ti
-on of project.'
+es' OCSP responders.%22
,%0A
|
0e5118f0ec68ead39392e168efcc1a957162bb3f | Fix NIN example | examples/imagenet/nin.py | examples/imagenet/nin.py | import math
from chainer import FunctionSet, Variable
import chainer.functions as F
class NIN(FunctionSet):
"""Network-in-Network example model."""
insize = 227
def __init__(self):
w = math.sqrt(2) # MSRA scaling
super(NIN, self).__init__(
conv1 = F.Convolution2D( 3, 96,... | Python | 0.023101 | @@ -1826,16 +1826,26 @@
h =
+F.reshape(
F.averag
@@ -1862,16 +1862,42 @@
2d(h, 6)
+, (x_data.shape%5B0%5D, 1000))
%0A
|
e4fbd6f8e13861053a4a29c776ae24b934639fa5 | fix ports on yaml script | tools/scripts/mosaic/gen_yaml.py | tools/scripts/mosaic/gen_yaml.py | #!/usr/bin/env python3
#
# Create a yaml file for running a mosaic file
# Note: *requires pyyaml*
import argparse
import yaml
def address(port):
return ['127.0.0.1', port]
def create_peers(peers):
res = []
for p in peers:
res += [{'addr':address(p[1])}]
return res
def entity(role, port, peers... | Python | 0 | @@ -537,17 +537,17 @@
s = 5000
-0
+1
%0A for
@@ -642,17 +642,17 @@
s = 6000
-0
+1
%0A for
|
45f60aaedb5a17fb1ce6fd14e6c4136f3411f14d | Fix for audio formats without bitrate | scanner.py | scanner.py | # coding: utf-8
import os, os.path
import time, mimetypes
import mutagen
import config, db
def get_mime(ext):
return mimetypes.guess_type('dummy.' + ext, False)[0] or config.get('mimetypes', ext) or 'application/octet-stream'
class Scanner:
def __init__(self, session):
self.__session = session
self.__tracks =... | Python | 0.000003 | @@ -2522,16 +2522,17 @@
rate =
+(
tag.info
@@ -2539,16 +2539,103 @@
.bitrate
+ if hasattr(tag.info, 'bitrate') else int(os.path.getsize(path) * 8 / tag.info.length))
/ 1000%0A
|
8e664b417d978d040d780dc252418fce087c47f4 | Fix version option | src/htrun/htrun.py | src/htrun/htrun.py | #
# Copyright (c) 2021 Arm Limited and Contributors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
"""Greentea Host Tests Runner."""
from multiprocessing import freeze_support
from htrun import init_host_test_cli_params
from htrun.host_tests_runner.host_test_default import DefaultTestSelector
from htrun... | Python | 0.999999 | @@ -15,16 +15,21 @@
(c) 2021
+-2022
Arm Lim
@@ -852,21 +852,29 @@
equire(%22
-htrun
+greentea-host
%22)%5B0%5D.ve
|
625c70580770b5bb00a64d15e14d15c623db21ee | Update urls.py | taiga/base/utils/urls.py | taiga/base/utils/urls.py | import django_sites as sites
URL_TEMPLATE = "{scheme}://{domain}/{path}"
def build_url(path, scheme="http", domain="localhost"):
return URL_TEMPLATE.format(scheme=scheme, domain=domain, path=path.lstrip("/"))
def is_absolute_url(path):
"""Test wether or not `path` is absolute url."""
return path.starts... | Python | 0.000002 | @@ -325,16 +325,44 @@
(%22http%22)
+ or path.startswith(%22https%22)
%0A%0A%0Adef g
|
1656cbd6b62690017af810e795b8a23b3907a1fa | bump 1.0.2 | epubuilder/version.py | epubuilder/version.py | # coding=utf-8
__version__ = '1.0.1'
| Python | 0.000003 | @@ -28,11 +28,11 @@
= '1.0.
-1
+2
'%0A
|
f69e4c5b18be30b8903a7826cc59b071fce1ba5a | Fix octaned8 results capture | wlauto/workloads/octaned8/__init__.py | wlauto/workloads/octaned8/__init__.py | # Copyright 2014-2016 ARM Limited
#
# 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 w... | Python | 0 | @@ -2146,16 +2146,20 @@
ameter('
+run_
timeout'
@@ -2179,17 +2179,17 @@
efault=1
-2
+8
0,%0A
@@ -2247,23 +2247,22 @@
the
-script run time
+test execution
.'),
@@ -2935,38 +2935,19 @@
elf.
+run_
timeout
-, check_exit_code=False
)%0A%0A
@@ -3657,38 +3657,19 @@
elf.
+run_
timeout
-, check_exit_code=False... |
8100a67f4f47ad30d454fe1aa9b90e29300c1516 | Update score_real script to have some better info/warnings | scripts/score_real_classification.py | scripts/score_real_classification.py | from __future__ import print_function
import sys
from collections import defaultdict
import pprint
def dict_to_string(d):
t = []
for i in d:
x = ":".join([str(i), str(d[i])])
t.append(x)
t = sorted(t, reverse = True, key = lambda x : float(x.split(":")[1]))
return ";".join(t)
if __name... | Python | 0 | @@ -3315,20 +3315,16 @@
= %22INFO:
-low_
lineage_
@@ -3511,20 +3511,16 @@
= %22INFO:
-low_
sublinea
|
2847dfd37a2ea728a722db3cd718f85c71c3b136 | update doc version | docs/source/conf.py | docs/source/conf.py | # -*- coding: utf-8 -*-
#
# python-nvd3 documentation build configuration file, created by
# sphinx-quickstart on Thu Dec 8 12:55:34 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... | Python | 0 | @@ -1646,25 +1646,25 @@
ersion = '0.
-1
+2
.0'%0A# The fu
@@ -1718,17 +1718,17 @@
se = '0.
-1
+2
.0'%0A%0A# T
|
84d6be3ef6c832a0dbb3e98a47491bc8ff372603 | Make log message more verbose. | ticket.py | ticket.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Implements a subset of session tickets as proposed for TLS in RFC 5077:
https://tools.ietf.org/html/rfc5077
"""
import os
import random
import time
import const
import sys
import pickle
from Crypto.Cipher import AES
from Crypto.Hash import HMAC
from Crypto.Hash import SH... | Python | 0.001404 | @@ -1493,16 +1493,20 @@
et keys
+k_S
from fil
|
5adbbc5954c58d01d70726230857379adffed511 | bump the timeout for instance creation (#3468) | spanner/cloud-client/backup_sample_test.py | spanner/cloud-client/backup_sample_test.py | # Copyright 2020 Google 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 law or a... | Python | 0 | @@ -1758,9 +1758,10 @@
ult(
-3
+12
0)
|
c8fdcf888f6c34e8396f11b3e7ab3088af59abb6 | Add tests for slice intersection and sanitization. | distarray/tests/test_utils.py | distarray/tests/test_utils.py | import unittest
from distarray import utils
class TestMultPartitions(unittest.TestCase):
"""
Test the multiplicative parition code.
"""
def test_both_methods(self):
"""
Do the two methods of computing the multiplicative partitions agree?
"""
for s in [2, 3]:
... | Python | 0 | @@ -38,16 +38,87 @@
utils%0A%0A
+from numpy import arange%0Afrom numpy.testing import assert_array_equal%0A%0A
%0Aclass T
@@ -535,16 +535,1202 @@
, s))%0A%0A%0A
+class TestSanitizeIndices(unittest.TestCase):%0A%0A def test_point(self):%0A itype, inds = utils.sanitize_indices(1)%0A self.assertEqual(... |
e0c1d52cd66914db237bac5ebcc7b86fa0d4a54d | Fix consultant serializer | radar/api/serializers/consultants.py | radar/api/serializers/consultants.py | from cornflake.sqlalchemy_orm import ModelSerializer, ReferenceField
from cornflake import fields
from cornflake import serializers
from cornflake.validators import not_empty, upper, max_length, none_if_blank, optional, lower, email_address
from cornflake.exceptions import ValidationError
from radar.api.serializers.co... | Python | 0.000001 | @@ -1772,32 +1772,43 @@
ltantSerializer(
+MetaMixin,
ModelSerializer)
@@ -2457,16 +2457,51 @@
nsultant
+%0A exclude = %5B'specialty_id'%5D
%0A%0A de
|
f9395cb44587248178afd493e78ccf63b6ed7159 | Add unittest test_obj_make_compatible() for dp objects | cyborg/tests/unit/objects/test_device_profile.py | cyborg/tests/unit/objects/test_device_profile.py | # Copyright 2019 Intel, 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... | Python | 0.000009 | @@ -5606,12 +5606,509 @@
lled_once()%0A
+%0A def test_obj_make_compatible(self):%0A dp_obj = objects.DeviceProfile(description=%22fake description%22)%0A primitive = dp_obj.obj_to_primitive()%0A dp_obj.obj_make_compatible(primitive%5B'cyborg_object.data'%5D, '1.0')%0A self.assertNotIn('d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.