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 |
|---|---|---|---|---|---|---|---|
727205fc2983d18035e05661584f9fdb1c39b800 | Fixed namespace name. | db_tests/bulk_insert_unittest.py | db_tests/bulk_insert_unittest.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010-2011, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenQuak... | Python | 0.998217 | @@ -4712,13 +4712,13 @@
NTO
-uiapi
+hzrdr
.gmf
|
0031c83a571341f3031a4acb1b723658f64d4e9e | Update to v1.3.19 | client/__init__.py | client/__init__.py | __version__ = 'v1.3.18'
import os
import sys
sys.path.insert(0, '')
# Add directory in which the ok.zip is stored to sys.path.
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
| Python | 0 | @@ -18,9 +18,9 @@
.3.1
-8
+9
'%0A%0Ai
|
f39b797a9c648c9673df30ae237d4dd61b1f28ea | Use frozenset | apt_select/apt_system.py | apt_select/apt_system.py | #!/usr/bin/env python
from subprocess import check_output
from os import path
from apt_select.utils import utf8_decode
LAUNCHPAD_ARCH_32 = 'i386'
LAUNCHPAD_ARCH_64 = 'amd64'
LAUNCHPAD_ARCHES = set([
LAUNCHPAD_ARCH_32,
LAUNCHPAD_ARCH_64
])
class AptSystem(object):
"""System information for use in apt rela... | Python | 0.000001 | @@ -184,24 +184,30 @@
AD_ARCHES =
+frozen
set(%5B%0A LA
@@ -1447,24 +1447,30 @@
B_SCHEMES =
+frozen
set(%5B'deb',
@@ -1497,16 +1497,22 @@
OCOLS =
+frozen
set(%5B'ht
|
7830c0c59c01bd11bb5d480afde3c3dc0a85bb71 | Update prediction.py | smact/structure_prediction/prediction.py | smact/structure_prediction/prediction.py | """Structure prediction implementation.
Todo:
* Test with a fully populated database.
* Implement n-ary substitution probabilities;
at the moment, only zero- and single-species
substitutions are considered.
"""
import itertools
from typing import Generator, List, Tuple, Optional
from .database i... | Python | 0 | @@ -3755,24 +3755,211 @@
substituted%0A
+ # Ensure only 1 species is obtained%0A if len(set(parent.get_spec_strs()) - set(map(unparse_spec, species)) - %7Bdiff_spec_str%7D)%3E1:%0A continue%0A
|
b5a5986bae2459a127afe664d811d1429acebc1f | Add CASBackend.get_user() | arcutils/cas/backends.py | arcutils/cas/backends.py | import logging
import textwrap
from xml.etree import ElementTree
from urllib.request import urlopen
from django.contrib.auth import get_user_model
from django.utils.module_loading import import_string
from django.contrib.auth.backends import ModelBackend
from arcutils.decorators import cached_property
from arcutils.... | Python | 0 | @@ -1070,16 +1070,228 @@
n user%0A%0A
+ def get_user(self, user_id):%0A user_model = get_user_model()%0A try:%0A return user_model._default_manager.get(pk=user_id)%0A except user_model.DoesNotExist:%0A return None%0A%0A
def
|
8ecdedf6a1f132794bac8b169b6af9386e98ac24 | Remove unnecessary semicolons | client/ergotime.py | client/ergotime.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Application startup
'''
'''
Copyright (c) 2013, Anders Lowinger, Abundo AB
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of sou... | Python | 0.999991 | @@ -3082,17 +3082,16 @@
d(False)
-;
%0A app
@@ -3123,17 +3123,16 @@
ndo AB%22)
-;
%0A app
@@ -3166,17 +3166,16 @@
ndo.se%22)
-;
%0A app
@@ -3205,17 +3205,16 @@
goTime%22)
-;
%0A%0A sy
|
f481a03a8985f6731bcf9314d72467abab4b1ed2 | change default freeglut library name to glut | autoconf/freeglut.py | autoconf/freeglut.py | from _external import *
from gl import *
from glu import *
freeglut = LibWithHeaderChecker(
'freeglut',
['GL/freeglut.h'],
'c',
dependencies=[gl,glu]
)
| Python | 0.000002 | @@ -89,20 +89,16 @@
ker(%0A%09%09'
-free
glut',%0A%09
|
0784f10ca49d3310e39bc39594f845465166651c | tweak to autograd.builtins.dict.__new__ | autograd/builtins.py | autograd/builtins.py | import itertools
from future.utils import with_metaclass
from .util import subvals
from .extend import (Box, primitive, notrace_primitive, VSpace, vspace,
SparseObject, defvjp, defvjp_argnum, defjvp, defjvp_argnum)
isinstance_ = isinstance
isinstance = notrace_primitive(isinstance)
type_ = type
t... | Python | 0 | @@ -3899,38 +3899,22 @@
= zip(*
-dict_(*args, **kwargs)
+result
.items()
|
78d2e811051e1b52c6e5915e7c4d80134d4a7cbb | Optimize prime-number check for Python (#33) | problems/prime-number/prime-number.py | problems/prime-number/prime-number.py | from math import sqrt
def is_prime(n):
if n <= 1:
return False
elif n == 2:
return True
elif n % 2 == 0:
return False
for i in xrange(3, int(sqrt(n))+1, 2):
if n % i == 0:
return False
return True
| Python | 0.000211 | @@ -84,12 +84,17 @@
f n
-== 2
+in %5B2, 3%5D
:%0A
@@ -114,28 +114,147 @@
True
-%0A elif n %25 2 == 0
+ %0A # To understand the statement below, please visit https://github.com/mre/the-coding-interview/pull/33 %0A elif n %25 6 not in %5B1, 5%5D
:%0A
@@ -289,9 +289,8 @@
in
-x
rang
@@ -313,16 +313,... |
d577c02a706bac1ed94aa91fbe2494f8d0c0f581 | add in import | processing/example_filetype_format.py | processing/example_filetype_format.py | import logging
import multiprocessing
import pandas as pd
#import packages
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class FileTypeFormat(object):
_process_kwargs = ["newPath", "databaseSynId"]
_fileType = "fileType"
_validation_kwargs = []
def __init__(self, syn, center, poo... | Python | 0 | @@ -51,16 +51,26 @@
s as pd%0A
+import os%0A
#import
|
b85e16177b08fcf57ede8f670472e9540c661d13 | FIX prod ref required | product_reference_required/product.py | product_reference_required/product.py | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, fields
class product... | Python | 0 | @@ -297,16 +297,21 @@
, fields
+, api
%0A%0A%0Aclass
@@ -444,16 +444,416 @@
)%0A%0A
+ @api.model%0A def create(self, vals):%0A %22%22%22%0A If we create from template we send default code by context%0A %22%22%22%0A default_code = vals.get('default_code', False)%0A if def... |
858d9c053e991526f303ae9f5e8c1600e653b924 | Add a test to catch when the path is empty | IPython/nbconvert/preprocessors/tests/test_execute.py | IPython/nbconvert/preprocessors/tests/test_execute.py | """
Module with tests for the execute preprocessor.
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import copy
import glob
import io
import os
import re
from IPython import nbformat
from .base import PreprocessorTestsBase
from ..execute import ExecutePreproc... | Python | 0.000006 | @@ -4201,16 +4201,767 @@
t_nb, input_nb)%0A
+%0A def test_empty_path(self):%0A %22%22%22Can the kernel be started when the path is empty?%22%22%22%0A current_dir = os.path.dirname(__file__)%0A filename = os.path.join(current_dir, 'files', 'HelloWorld.ipynb')%0A with io.open(filename) as ... |
8ef6f8847efb5e5cefe8cfc83ca1ee64892199e9 | Fix 2 space indentation. | djangae/contrib/mappers/pipes.py | djangae/contrib/mappers/pipes.py | from django.conf import settings
from mapreduce.mapper_pipeline import MapperPipeline
from mapreduce import parameters
from mapreduce import control
from mapreduce import model
from pipeline.util import for_name
BASE_PATH = '/_ah/mapreduce'
PIPELINE_BASE_PATH = BASE_PATH + '/pipeline'
class DjangaeMapperPipeline(Ma... | Python | 0 | @@ -702,24 +702,26 @@
:%0A
+
shards = par
|
6017a7e5de6fc0d0ef9797d980e634e8fe88cd89 | Create stock data dictionary | Stock_market_data.py | Stock_market_data.py | # for email functionality, credit @s2t2
import os
import sendgrid
from sendgrid.helpers.mail import * # source of Email, Content, Mail, etc.
# for day of week
import datetime
# to query Google stock data
from pandas_datareader import data
from datetime import date, timedelta
#Stock data for Apple, Amazon, Activision... | Python | 0.000025 | @@ -272,16 +272,33 @@
edelta%0A%0A
+stock_data = %5B%5D%0A%0A
#Stock d
@@ -1074,31 +1074,81 @@
def
-differnceclosingprice (
+stock_data_builder (ticker_symbol):%0A stock = %7B%7D%0A stock%5B%22ticker%22%5D =
tick
@@ -1160,32 +1160,33 @@
mbol
-s):%0A
%0A
-yesterday_price
+stock%5B%22today_close%22%5D
... |
988ce79b3de76d46c482995bb4b8dc724e89c718 | Add configuration parameter whether or not to use astropy's coordinate transformations where relevant | galpy/util/config.py | galpy/util/config.py | import os, os.path
try:
import configparser
except:
from six.moves import configparser
_APY_LOADED= True
try:
from astropy import units
except ImportError:
_APY_LOADED= False
# The default configuration
default_configuration= {'astropy-units':'False',
'ro':'8.',
... | Python | 0 | @@ -261,16 +261,65 @@
False',%0A
+ 'astropy-coords':'True',%0A
@@ -923,24 +923,133 @@
py-units'%5D)%0A
+ writeconfig.set('astropy','astropy-coords',%0A default_configuration%5B'astropy-coords'%5D)%0A
with ope
|
dae9d7d67aaf2ab8d39b232d243d860d9597bbd2 | Add error when serializer setup has error | django_excel_tools/exceptions.py | django_excel_tools/exceptions.py | class BaseExcelError(Exception):
def __init__(self, message):
super(BaseExcelError, self).__init__()
self.message = message
class ValidationError(BaseExcelError):
pass
class ColumnNotEqualError(BaseExcelError):
pass
class FieldNotExist(BaseExcelError):
pass
| Python | 0.000001 | @@ -270,28 +270,84 @@
t(BaseExcelError):%0A pass%0A
+%0A%0Aclass SerializerConfigError(BaseExcelError):%0A pass%0A
|
2a478ce22749bb96e3d7cc62f216f42c5375b5e3 | Fix regression in path handling of TenantStaticFileStorage. | django_tenants/files/storages.py | django_tenants/files/storages.py | import os
from django.utils._os import safe_join
from django.db import connection
from django.core.files.storage import FileSystemStorage
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.encoding import filepath_to_uri
from django.utils.six.moves.urllib.parse i... | Python | 0 | @@ -995,32 +995,34 @@
n, name)%0A
+ #
return path%0A%0A%0Ac
@@ -1018,16 +1018,40 @@
rn path%0A
+ return location%0A
%0A%0Aclass
|
71edbea4ff51405b2af1188cbe3f9ff33063aff6 | Flatten the context to avoid issues in django 1.10 | djangocms_text_ckeditor/utils.py | djangocms_text_ckeditor/utils.py | # -*- coding: utf-8 -*-
import os
import re
from cms.models import CMSPlugin
from django.core.files.storage import get_storage_class
from django.template.defaultfilters import force_escape
from django.template.loader import render_to_string
from django.utils.functional import LazyObject
OBJ_ADMIN_RE_PATTERN = r'<cms... | Python | 0.999987 | @@ -38,16 +38,61 @@
ort re%0A%0A
+from classytags.utils import flatten_context%0A
from cms
@@ -116,16 +116,16 @@
SPlugin%0A
-
from dja
@@ -519,24 +519,63 @@
, context):%0A
+ context = flatten_context(context)%0A
context%5B
@@ -1199,20 +1199,24 @@
.%0A re
-turn
+sponse =
render_
@@ -1225,16 +1225,25 @... |
f613c8699aa15a0e6ab1ce8cd9604381f6bbba11 | fix circular import | gary/potential/io.py | gary/potential/io.py | # coding: utf-8
""" Read and write potentials to text (YAML) files. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os
# Third-party
import astropy.units as u
from astropy.utils import isiterable
import numpy as np
from astropy.extern impo... | Python | 0.000002 | @@ -380,51 +380,8 @@
stem
-%0Afrom .. import potential as gary_potential
%0A%0A__
@@ -900,24 +900,113 @@
t, module):%0A
+ # need this here for circular import%0A from .. import potential as gary_potential%0A%0A
try:%0A
@@ -2320,16 +2320,104 @@
%0A %22%22%22
+%0A # need this here for circular imp... |
faa68f4e55159f896551d2604a40bd5c3f55bb73 | should fix capitalization issue | modules/bomb.py | modules/bomb.py | #!/usr/bin/env python
"""
bomb.py - Simple bomb prank game
Copyright 2012, Edward Powell http://embolalia.net
Licensed under the Eiffel Forum License 2.
More info:
* Jenni: https://github.com/myano/jenni/
* Phenny: http://inamidst.com/phenny/
"""
from random import choice, randint
from re import search
import sched,... | Python | 0.999999 | @@ -1654,32 +1654,40 @@
bombs%5Btarget
+.lower()
%5D = (color, code
@@ -1822,16 +1822,24 @@
f target
+.lower()
!= jenn
@@ -1844,16 +1844,24 @@
nni.nick
+.lower()
and tar
@@ -1863,16 +1863,24 @@
d target
+.lower()
not in
@@ -1927,16 +1927,24 @@
p(target
+.lower()
) #remov
@@ -2440,16 +2440,24 @@
s%5Bt... |
e59ffe23c8b60ceb277e0720d81f4157c8f1b2d6 | Put TFModels TODOs | TFBoost/TFBooster.py | TFBoost/TFBooster.py | """
Author: @gabvaztor
StartDate: 04/03/2017
This file contains the next information:
- Libraries to import with installation comment and reason.
- Data Mining Algorithm.
- Sets (train,validation and test) information.
- ANN Arquitectures.
- A lot of utils methods which you'll get useful advantage
... | Python | 0 | @@ -5727,8 +5727,97 @@
un(init)
+%0A%0A# TODO Make TFModels heritable and with capability to return section of tensorflow code
|
b0ce49d2ceb93b9a31472582e513b4a7a3c33a3e | Fix warn | base/auth/manager.py | base/auth/manager.py | from flask import Blueprint
from flask_login import LoginManager, login_required, logout_user, login_user, current_user
from flask_principal import Principal, identity_changed, Identity, AnonymousIdentity, identity_loaded, UserNeed, RoleNeed
from ..ext import db
from .models import User
class UserManager(Blueprint):... | Python | 0.000001 | @@ -807,13 +807,12 @@
ger.
-setup
+init
_app
|
d8c86cde7029d31ec299f85b6de51c5390b5e219 | Update misc.py | modules/misc.py | modules/misc.py | '''Misc. commands!'''
import modules.commands as commands
import random
import json
import time
from datetime import datetime
import asyncio
with open("database/quoteweenie.json","r") as infile:
Quotes_All = json.loads(infile.read())
with open("database/AFINN-111.json", "r") as infile:
words = json.loads(infil... | Python | 0 | @@ -842,23 +842,8 @@
%22 +
- elapsed_time =
tim
|
c8483afbb46b7a8c85fa4a50ffaf86be56e5c1c9 | Update settings for standard DO env vars | config/settings.py | config/settings.py | from datetime import time
from os import getenv
from pathlib import Path
import dj_database_url
from dotenv import load_dotenv
import tomlkit
load_dotenv()
BASE_DIR = Path(__file__).resolve().parent.parent
PYPROJECT_PATH = BASE_DIR / "pyproject.toml"
PYPROJECT = tomlkit.parse(PYPROJECT_PATH.open().read())
SECRET... | Python | 0 | @@ -516,89 +516,8 @@
z%22%5D%0A
-%0ADO_APP_HOSTNAME = getenv(%22DO_APP_HOSTNAME%22)%0Aif DO_APP_HOSTNAME is not None:%0A
ALLO
@@ -530,52 +530,15 @@
STS.
-app
+ext
end(
-DO_APP_HOSTNAME)%0A%0ADO_ALLOWED_HOSTS =
gete
@@ -601,57 +601,8 @@
%22,%22)
-%0A%0A%0Aif DEBUG:%0A ALLOWED_HOSTS.append(%22localhost%22
... |
ff26aeb409e033a6135fd3a58cd0ce5ef4172ca6 | Update update_x.py | config/update_x.py | config/update_x.py | #!/usr/local/bin/python
#coding :utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2019 yutiansut/QUANTAXIS
#
# 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, includ... | Python | 0.00001 | @@ -2245,17 +2245,45 @@
ymbol)%0A%0A
-%0A
+if __name__ == '__main__':%0A
QA_SU_sa
@@ -2294,32 +2294,34 @@
tock_day('tdx')%0A
+
QA_SU_save_stock
@@ -2325,32 +2325,34 @@
ock_xdxr('tdx')%0A
+
QA_SU_save_stock
@@ -2355,32 +2355,34 @@
tock_min('tdx')%0A
+
QA_SU_save_index
@@ -2385,32 +2385,34 @@
ndex_day('t... |
6614149fb326131a26205972eb1f1e1bb87d57ec | Fix counting error (Thanks Hannes Gross) | generate_matrices.py | generate_matrices.py | blocksize = 256
keysize = 80
rounds = 12
def main():
''' Use the global parameters `blocksize`, `keysize` and `rounds`
to create the set of matrices and constants for the corresponding
LowMC instance. Save those in a file named
`matrices_and_constants.dat`.
'''
gen = grain_ssg()
... | Python | 0 | @@ -1357,33 +1357,8 @@
s)%0A%0A
- matfile.write(s)%0A
@@ -1740,32 +1740,36 @@
in range(rounds
+ + 1
):%0A s
@@ -1792,36 +1792,32 @@
matrix ' + str(r
- + 1
) + ':%5Cn'%0A
|
55705fe2ba6a5ee8150c4368ff8c722ba1f93c0d | Update basecamp.py | basehead/basecamp.py | basehead/basecamp.py | from core import send_request, get_auth
from people import get_me
from projects import get_all_active_projects, get_project
from todo_lists import get_todo_list, get_todo, get_all_active_todo_lists
from stars import get_starred_projects
from MY_BC import BC
class Camper(object):
def __init__(self,**kwargs):
... | Python | 0.000001 | @@ -230,16 +230,25 @@
rojects%0A
+try:%0A
from MY_
@@ -259,16 +259,76 @@
mport BC
+%0Aexcept ImportError:%0A from core import MY_BC_NUMBER as BC
%0A%0Aclass
|
10b806e026183c32f2c1b777604c7ff65d54c5e8 | Version Change 1.3.1 | geocoder/__init__.py | geocoder/__init__.py | #!/usr/bin/python
# coding: utf8
"""
Geocoder
~~~~~~~~
Geocoder is a geocoding library, written in python, simple and consistent.
Many online providers such as Google & Bing have geocoding services,
these providers do not include Python libraries and have different
JSON responses between each other.
Consistant JSON... | Python | 0 | @@ -619,17 +619,17 @@
= '1.3.
-0
+1
'%0A__lice
|
571880d6314b3150728e30f6c703a3f3f7020a23 | Add **kwargs | bash_runner/tasks.py | bash_runner/tasks.py | """
Cloudify plugin for running a simple bash script.
Operations:
run: Run a list of scripts provided by the param scripts
"""
import urllib
import subprocess
import fcntl
import select
import os
import errno
from cloudify.utils import get_manager_ip
from cloudify.decorators import operation
@operation
def run(c... | Python | 0.000001 | @@ -327,16 +327,26 @@
ripts=%5B%5D
+, **kwargs
):%0A for
|
3290b04c21f445e8fbcc80a9e6d145276cb62c3d | Add debug logs | bash_runner/tasks.py | bash_runner/tasks.py | """
Cloudify plugin for running a simple bash script.
Operations:
run: Run a list of scripts provided by the param scripts
"""
import urllib
import subprocess
import fcntl
import select
import os
import errno
from cloudify.utils import get_manager_ip
from cloudify.decorators import operation
@operation
def run(c... | Python | 0.000002 | @@ -340,16 +340,103 @@
wargs):%0A
+ ctx.logger.info('scripts = %25s ' %25 scripts)%0A ctx.logger.info('kwargs: %25s ' %25 kwargs)%0A
for s
@@ -502,24 +502,44 @@
sh(sh, ctx)%0A
+ ctx.set_started()%0A
%0A%0Adef bash(p
|
edde0e7ba52d3f2e7b1c5d15f0c92a0545df33fd | fix rosbag_helper script executer | docs/demo_guide/rosbag_helper.py | docs/demo_guide/rosbag_helper.py | #!/usr/bin/env bash
###############################################################################
# Copyright 2018 The Apollo 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... | Python | 0.000005 | @@ -12,12 +12,14 @@
env
-bash
+python
%0A%0A##
@@ -777,17 +777,16 @@
######%0A%0A
-%0A
import u
|
410611c2e7a2cb3a1548b66fb3c20252296d4232 | Fix pool destroy and rename | src/stratis_cli/_actions/_top.py | src/stratis_cli/_actions/_top.py | # Copyright 2016 Red Hat, 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 | @@ -2426,28 +2426,16 @@
xy, pool
-_object_path
=pool_ob
@@ -2883,12 +2883,8 @@
ct,
-new_
name
|
5361f506f79b0732bf6a790b7760ce0d4e6e1df8 | Add progress indicator when building index for model in case there are too many. | autocomplete/__init__.py | autocomplete/__init__.py | #-*- coding:utf-8 -*-
VERSION = '0.1'
import redis
try:
import simplejson
except:
from django.utils import simplejson
try:
from django.core import serializers
from django.db.models.loading import get_model
except:
pass
import mmseg
from autocomplete.utils import queryset_iterator
class Autocomplete (obje... | Python | 0 | @@ -3180,32 +3180,42 @@
items.%0A %22%22%22%0A
+ cnt=0%0A
for item in
@@ -3234,24 +3234,90 @@
nerator ():%0A
+ if cnt%251000 == 0: print 'building index for %25d items' %25 cnt%0A
self.a
@@ -3326,24 +3326,40 @@
_item (item)
+%0A cnt=cnt+1
%0A%0A def add_
|
6a6a886392a860de1c5caec7a330a13408733129 | Remove hardcoded motor name | auv_control_pi/motors.py | auv_control_pi/motors.py | import curio
import logging
import time
from .asgi import channel_layer, MOTOR_CONTROL_CHANNEL
from navio.pwm import PWM
try:
import spidev
pi = True
except ImportError:
pi = False
logger = logging.getLogger(__name__)
T100 = 't100'
SERVO = 'servo'
# map of duty cycle settings in milliseconds which is ... | Python | 0.999161 | @@ -1122,20 +1122,8 @@
T100
-, test=False
):%0A
@@ -1612,22 +1612,25 @@
'name':
-'left'
+self.name
, 'chann
@@ -2816,14 +2816,17 @@
e':
-'left'
+self.name
, 'd
|
84b2883ad46f68bfb5e1387eb812b2081d256a68 | Fix whitesource parser | dojo/tools/whitesource/parser.py | dojo/tools/whitesource/parser.py | import hashlib
import json
from dojo.models import Finding
__author__ = 'dr3dd589'
class WhitesourceJSONParser(object):
def __init__(self, file, test):
self.dupes = dict()
self.items = ()
if file is None:
return
data = file.read()
try:
content = js... | Python | 0.000007 | @@ -709,17 +709,21 @@
%22 + node
-%5B
+.get(
'descrip
@@ -719,33 +719,37 @@
et('description'
-%5D
+, %22%22)
+ %22%5Cn%5Cn%22 + %5C%0A
@@ -813,24 +813,32 @@
ibrary'%5D
-%5B
+.get(
'name'
-%5D
+, %22%22)
+ %22%5Cn%5Cn
@@ -914,17 +914,21 @@
ibrary'%5D
-%5B
+.get(
'filenam
@@ -925,25 +925,29 @@
t('filename'
... |
3c33e0379b278f21e7d8d149312bd4f2eef48f1f | add fix in function node.clone() | e2c/python/e2c/node.py | e2c/python/e2c/node.py | from inspect import getfullargspec
from typing import Callable, Any, Dict, List
class Node(object):
def __init__(self, comp, name: str, callable: Callable) -> None:
self.name = name
self.comp = comp
self.callable = callable
self.nodes: Dict[str, List['Node']] = {}
self._spe... | Python | 0 | @@ -1106,16 +1106,8 @@
e, n
-.clone()
)%0A
|
fa94af887bc7642f1d56aa28722dab1ff23af26a | Kill tabs | glossary/glossary.py | glossary/glossary.py | import time
import datetime
from collections import namedtuple
import pmxbot
from pmxbot import storage
from pmxbot.core import command
ALIASES = ('gl', )
HELP_DEFINE_STR = '!{} define <entry>: <definition>'.format(ALIASES[0])
HELP_QUERY_STR = '!{} <entry> [<num>]'.format(ALIASES[0])
DOCS = (
'To define an entry... | Python | 0.000001 | @@ -1085,18 +1085,24 @@
T NULL,%0A
-%09%09
+
defin
@@ -1122,18 +1122,24 @@
T NULL,%0A
-%09%09
+
autho
@@ -1158,18 +1158,24 @@
T NULL,%0A
-%09%09
+
times
@@ -1197,17 +1197,20 @@
T NULL,%0A
-%09
+
P
@@ -1336,18 +1336,18 @@
y_entry
-on
+ON
glossar
|
3201a2ded684f8c49eaac648e6b085a78690b039 | fix dataclass bug | bigbench/api/task.py | bigbench/api/task.py | # Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | Python | 0 | @@ -2217,334 +2217,8 @@
int%0A
- # human-readable description of this task. when a task returns multiple%0A # ScoreDatas in a list, any important information that disambiguates the%0A # different subtasks should go here. (e.g. a task that evaluates%0A # n-digit arithmetic for different n values can specify n in ... |
a5204725945de2c983e0923085d1a335edc8b4bb | improve docstring | bigbench/api/util.py | bigbench/api/util.py | # Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | Python | 0.000092 | @@ -928,20 +928,345 @@
:%0A
+include_headers: If True, return section header names as well as keywords from%0A the keywords.md file. Both section_headers and keywords are returned, in their%0A original order, in the keywords return argument. For section headers, the%0A corresponding entry in... |
b8f500996b8929da5d3d1ebf438b9632e408ee69 | resolve DeprecationWarning in unit test | bigbench/api/util.py | bigbench/api/util.py | # Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | Python | 0 | @@ -1690,16 +1690,17 @@
egex=r%22%5C
+%5C
d+%22, and
|
617a8d208c0f6e9af36f9e90ea15ca36a46384d2 | Fix line too long | bin/alignak_webui.py | bin/alignak_webui.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is used to run the application in production environment with WSGI server.
With uWSGI:
uwsgi --wsgi-file alignak_webui.py --callable app --socket 0.0.0.0:8868 --protocol=http --enable-threads
"""
import alignak_webui.app
from alignak_webui im... | Python | 0.000424 | @@ -164,16 +164,32 @@
uwsgi
+--plugin python
--wsgi-f
@@ -192,16 +192,20 @@
gi-file
+bin/
alignak_
@@ -228,16 +228,32 @@
ble app
+%5C%0A
--socket
@@ -265,12 +265,12 @@
0.0:
-8868
+5001
--p
@@ -298,16 +298,21 @@
-threads
+ -p 1
%0A%22%22%22%0Aimp
|
369b7412f237d7d8e7280b7c4ba03b86655d45aa | fix some issues with nonstandard module imports | connect/lib/connect/extensions/debug.py | connect/lib/connect/extensions/debug.py | import htcondor
import classad
def run(opts, args, **kwargs):
from IPython.Shell import IPShellEmbed as embed
schedd = htcondor.Schedd()
r = schedd.query()
params = {}
for result in r:
for k in result.keys():
if k in params:
params[k] += 1
else:
params[k] = 1
common = []
for k, v in params.i... | Python | 0.000001 | @@ -1,36 +1,4 @@
-import htcondor%0Aimport classad%0A%0A
%0Adef
@@ -73,16 +73,47 @@
as embed
+%0A%09if htcondor:%0A%09%09import classad
%0A%0A%09sched
|
ba9a4b1bb5f84a3f0185fbcf555eac9e388ed675 | fix - debugger removed | ella/photos/imageop.py | ella/photos/imageop.py | import Image
from ella.utils.filemanipulation import file_rename
def detect_img_type(imagePath):
try:
im = Image.open(imagePath)
return im.format
except IOError:
return None
def get_img_size(imagePath):
""" returns tuple (width, height) of image """
try:
import pdb; ... | Python | 0.000001 | @@ -297,44 +297,8 @@
ry:%0A
- import pdb; pdb.set_trace()%0A
|
80d6c3de821a77985d434fcbe50b379f255b1b2e | set version to 1.1.0 | n26/__init__.py | n26/__init__.py | __version__ = '1.0.0'
| Python | 0.000498 | @@ -10,13 +10,13 @@
__ = '1.
-0
+1
.0'%0A
|
e117f4304ff3182455ad80d419a08681f62da6f3 | Add a middleware parameter | graphql_wsgi/main.py | graphql_wsgi/main.py | import json
import six
from webob.dec import wsgify
from webob.response import Response
from graphql import graphql
from graphql.error import GraphQLError, format_error as format_graphql_error
def graphql_wsgi_dynamic(get_options):
@wsgify
def handle(request):
schema, root_value, pretty = get_optio... | Python | 0.000004 | @@ -301,16 +301,28 @@
, pretty
+, middleware
= get_o
@@ -1137,16 +1137,55 @@
ion_name
+,%0A middleware=middleware
)%0A%0A
@@ -1846,24 +1846,41 @@
pretty=None
+, middleware=None
):%0A def g
@@ -1941,16 +1941,28 @@
, pretty
+, middleware
%0A%0A re
|
3feeddcf34928e9c1bca4c9de0f5028686085c25 | Update messages API | grum/api/messages.py | grum/api/messages.py | from flask.ext.restful import Resource
class Messages(Resource):
def get(self):
return "hello friend" | Python | 0.000001 | @@ -1,8 +1,34 @@
+from flask import jsonify%0A
from fla
@@ -58,16 +58,44 @@
esource%0A
+from .models import Message%0A
%0A%0Aclass
@@ -134,36 +134,557 @@
self
-):%0A return %22hello friend%22
+, message_id):%0A msg = Message.query.filter_by(id=message_id).first_or_404()%0A return jsonify(messa... |
bf180864a62a8212fc7ff9e47beccdbfd9033960 | Add cache data to info output | engine/event.engine.py | engine/event.engine.py | #!/usr/local/bin/python3 -u
__author__ = 'Oliver Ratzesberger <https://github.com/fxstein>'
__copyright__ = 'Copyright (C) 2015 Oliver Ratzesberger'
__license__ = 'Apache License, Version 2.0'
# Make sure we have access to SentientHome commons
import os, sys
sys.path.append(os.path.dirname(os.path.abspath(__file_... | Python | 0.000001 | @@ -853,79 +853,123 @@
ve!'
-%7D%0A%0A for c in cache:%0A log.debug('%25s Max Cache Entries: %25s', c,
+,%0A 'cacheinfo': %5B%5D%7D%0A%0A for c in cache:%0A cacheinfo = dict()%0A cacheinfo%5Bc + '.maxlen'%5D =
cac
@@ -980,17 +980,16 @@
%5D.maxlen
-)
%0A
@@ -993,58 +99... |
6763594b133e0869f3ddbfbb39544b5de86d4d45 | Make Serializable Hash()-able | bitcoin/serialize.py | bitcoin/serialize.py |
#
# serialize.py
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from __future__ import absolute_import, division, print_function, unicode_literals
import struct
import hashlib
# Py3 compatibility
import sys
bchr = chr
... | Python | 0.000294 | @@ -1822,16 +1822,79 @@
other)%0A%0A
+ def __hash__(self):%0A return hash(self.serialize())%0A%0A
class Se
|
1cbf900e18633f21fb7bcb00e6dccf0c1d9787e4 | Fix todo items in style parser | bjcp/style_parser.py | bjcp/style_parser.py | #! /usr/bin/env python
import csv
import pprint
import string
"""
Parse the BJCP 2015 Styles CSV file
"""
# TODO:
# - numbers as floats not strings
# - abv as decimal percent
# - category without subcategory
def main():
categories = {}
styles = {}
filename = '2015_Styles.csv'
with open(filename, '... | Python | 0.000004 | @@ -106,111 +106,8 @@
%22%22%0A%0A
-# TODO:%0A# - numbers as floats not strings%0A# - abv as decimal percent%0A# - category without subcategory%0A%0A
%0Adef
@@ -2574,16 +2574,22 @@
': %5B
+round(
float(a)
for
@@ -2584,16 +2584,28 @@
float(a)
+ / 100.0, 3)
for a i
|
48b605154a56e1cba6d3e18a95b4c02262130f30 | Fix passing additional arguments to pybtex.Engine.format_from_files() | pybtex/__init__.py | pybtex/__init__.py | # Copyright (c) 2006-2018 Andrey Golovigin
#
# 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, publi... | Python | 0 | @@ -2319,16 +2319,38 @@
x=True,%0A
+ **kwargs,%0A
|
33f050149cbb4d89f45505322511b65797456e74 | Remove filter_list from ndb | ndb/__init__.py | ndb/__init__.py | #coding=utf-8
import statement
import common
import operate
__version__ = "1.0"
def read(filename):
return common.read(filename)
def read_string(data):
return common.read_string(data)
def write_node(filename, name, node, indent_flag = '\t'):
common.write_node(filename, name, node, indent_flag)
def pri... | Python | 0.000001 | @@ -617,124 +617,4 @@
on)%0A
-%0Adef filter_list(table, query=None, union=False, sort_key=None):%0A return operate.filte(table, query, union, sort_key)
|
8219a3ccdf83fc6783c7dadfb83067cecc4ba248 | Add @xframe_options_exempt decorators | nearby/views.py | nearby/views.py | import logging
import re
from datetime import datetime
from django.conf import settings
from django.core.urlresolvers import reverse
from django.core.mail import mail_admins
from django.template.loader import render_to_string
from django.shortcuts import render, redirect
from django.http import Http404
from django imp... | Python | 0.000002 | @@ -323,16 +323,88 @@
t forms%0A
+from django.views.decorators.clickjacking import xframe_options_exempt%0A%0A
%0Afrom .m
@@ -806,24 +806,47 @@
.lower())%0A%0A%0A
+@xframe_options_exempt%0A
def councill
@@ -1453,24 +1453,47 @@
address))%0A%0A%0A
+@xframe_options_exempt%0A
def ward_cou
@@ -4308,16 +4308,38 @@
Sen... |
97c55d52733460a5ca978735ff8af93b83b7612a | Tidy up/fix the API example. | examples/api_deploy.py | examples/api_deploy.py | from gevent import monkey # noqa
monkey.patch_all() # noqa async things (speed++, optional)
import logging # noqa: E402, I100
from collections import defaultdict # noqa: E402
from pyinfra.api import BaseStateCallback, Config, Inventory, State # noqa: E402
from pyinfra.api.connect import connect_all # noqa: E40... | Python | 0.000001 | @@ -672,33 +672,8 @@
2%0A%0A%0A
-# Enable pyinfra logging%0A
clas
@@ -1055,16 +1055,51 @@
s case)%0A
+print('Loading Vagrant config...')%0A
hosts =
@@ -1894,32 +1894,36 @@
d_op(%0A state,
+%0A
server.user,%0A
@@ -1920,24 +1920,29 @@
r.user,%0A
+user=
'pyinfra',%0A
@@ -2025,16 +2025,20 @@
state... |
15a8b18586d7124e5523a182d2c7b025dbc9f16a | fix typo | fedoracommunity/search/iconcache.py | fedoracommunity/search/iconcache.py | import os
from rpmcache import RPMCache
import Image
class IconCache(object):
def __init__(self, yum_base, icon_rpm_names, icon_dir, cache_dir):
self.found_icons = {} # {'icon-name': True}
self._rpm_caches = []
self._rpm_caches.extend(icon_rpm_names)
self.yum_base = yum_base
... | Python | 0.999991 | @@ -1724,22 +1724,20 @@
t_match.
-pixbuf
+size
%5B0%5D %3E 12
|
553003ddae3086e4c660859d4060992ea475924d | Put interp check first; remove duplicate check | core/handlers/layer.py | core/handlers/layer.py | from core import db
from core.responses import success, user_error
from flask import abort, Blueprint, request
blueprint = Blueprint('layer', __name__)
def child_label_of(lhs, rhs):
"""Is the lhs label a child of the rhs label"""
if lhs.startswith(rhs):
return True
# Interpretations have a sligh... | Python | 0 | @@ -233,56 +233,8 @@
%22%22%22%0A
- if lhs.startswith(rhs):%0A return True%0A
@@ -477,13 +477,9 @@
reg)
- or (
+:
%0A
@@ -491,73 +491,114 @@
-lhs_reg == rhs_reg and lhs_comment.startswith(rhs_comment)):%0A
+return True%0A%0A # Handle Interps with shared prefix as well as non-interps... |
2216123d1d3e2f59d238a531f9c7f6d9386a52c4 | Add close method to raise stop iteration. | pyperator/utils.py | pyperator/utils.py | import asyncio
# class Edge:
# def __init__(self, source, dest, outport, inport):
# self.source = source
# self.dest = dest
# self.outport = outport
# self.inport = inport
# # self._qu = asyncio.Queue()
# # self._qu.put_nowait(None)
#
# # async def send(self, da... | Python | 0 | @@ -1389,16 +1389,75 @@
(data)%0A%0A
+ async def close(self):%0A await self.send('Done')%0A%0A
asyn
@@ -1549,16 +1549,164 @@
e.get()%0A
+ self.queue.task_done()%0A print(data)%0A if data == 'Done':%0A raise StopIteration%0A else:%0A
... |
f909f092fc848d2dbd66edb890442c53792dc56b | Fix importfeeds plugin on Python 3. | beetsplug/importfeeds.py | beetsplug/importfeeds.py | # -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Fabrice Laporte.
#
# 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 ... | Python | 0 | @@ -1160,429 +1160,8 @@
'%0A%0A%0A
-def _get_feeds_dir(lib):%0A %22%22%22Given a Library object, return the path to the feeds directory to be%0A used (either in the library directory or an explicitly configured%0A path). Ensures that the directory exists.%0A %22%22%22%0A # Inside library directory.%0A ... |
385f6593fa71f2de120e431fbed12f88565b2f46 | remove basename from AtomicBlobs.put as well | corehq/blobs/atomic.py | corehq/blobs/atomic.py | from corehq.blobs import DEFAULT_BUCKET
from corehq.blobs.exceptions import InvalidContext
class AtomicBlobs(object):
"""A blob db wrapper that can put and delete blobs atomically
Usage:
with AtomicBlobs(get_blob_db()) as db:
# do stuff here that puts or deletes blobs
db.dele... | Python | 0.000002 | @@ -686,21 +686,8 @@
ent,
- basename=%22%22,
buc
|
769c7dffb5938b02b681cc4718589ef79ff68b7b | Update Mopsa.py to handle additional options passed through benchexec's xml files | benchexec/tools/mopsa.py | benchexec/tools/mopsa.py | # This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2022 Raphaël Monat
#
# SPDX-License-Identifier: Apache-2.0
import benchexec.tools.template
import benchexec.result as result
class Tool(benchexec.tools.template.BaseTool2):
... | Python | 0 | @@ -1009,17 +1009,33 @@
turn cmd
+ + list(options)
%0A
-
%0A def
@@ -1189,16 +1189,38 @@
ty line%0A
+ r = r.lower()%0A
@@ -1393,21 +1393,21 @@
tswith(%22
-ERROR
+error
%22):%0A
|
959f766b1fced4f27c30251f1b78b694a2415326 | Bump version back to 2.0.0b5.dev0 | pyquil/__init__.py | pyquil/__init__.py | __version__ = "2.0.0b4"
from pyquil.quil import Program
from pyquil.api import list_quantum_computers, get_qc
| Python | 0.000001 | @@ -18,9 +18,14 @@
0.0b
-4
+5.dev0
%22%0A%0Af
|
2e6f0934c67baf27cdf3930d48d6b733995e413f | Make the query docstring a bit clearer | benchmark/_interfaces.py | benchmark/_interfaces.py | # Copyright ClusterHQ Inc. See LICENSE file for details.
"""
Interfaces for the benchmarking results server.
"""
from zope.interface import Interface
class IBackend(Interface):
"""
A backend for storing and querying the results.
"""
def store(result):
"""
Store a single benchmarking... | Python | 0.026926 | @@ -1105,17 +1105,8 @@
the
-*latest*
resu
@@ -1118,16 +1118,91 @@
o return
+. The%0A results are sorted by their timestamp in descending order
.%0A
|
33c33b792dc1ed9acdd3f5331afd5a42385d20ce | Use Write Event in echoserver.py | examples/echoserver.py | examples/echoserver.py | #!/usr/bin/env python
from circuits.net.sockets import TCPServer
class EchoServer(TCPServer):
def read(self, sock, data):
self.write(sock, data)
EchoServer(8000).run()
| Python | 0.000001 | @@ -58,16 +58,23 @@
CPServer
+, Write
%0A%0Aclass
@@ -146,9 +146,14 @@
elf.
-w
+push(W
rite
@@ -164,16 +164,17 @@
k, data)
+)
%0A %0AEc
|
3122965316a6d8f99d737fa46450ed9aeb5c4811 | make item_number unique | eca_catalogue/abstract_models.py | eca_catalogue/abstract_models.py | from django.db import models
from django.utils.translation import ugettext_lazy as _
from treebeard.mp_tree import MP_Node
class NSDMixin(models.Model):
name = models.CharField(_("Name"), max_length=128)
slug = models.SlugField(_("Slug"), max_length=128, unique=True)
description = models.TextField(_("Des... | Python | 0.999226 | @@ -1133,32 +1133,45 @@
, max_length=255
+, unique=True
)%0A%0A class Met
|
12ad6a6e7154c1fd6c35584c227d0155de76791e | Fix failing test (unrelated to app attachments) | corehq/apps/reports/tests/test_cache.py | corehq/apps/reports/tests/test_cache.py | import uuid
from django.http import HttpRequest
from django.test import TestCase
from corehq.apps.domain.shortcuts import create_domain
from corehq.apps.reports.cache import request_cache
from corehq.apps.users.models import WebUser
class MockReport(object):
is_cacheable = False
def __init__(self, request, i... | Python | 0 | @@ -74,16 +74,64 @@
estCase%0A
+from django.test.utils import override_settings%0A
from cor
@@ -975,16 +975,55 @@
quest%0A%0A%0A
+@override_settings(CACHE_REPORTS=True)%0A
class Re
|
e797b81a5550c1c493a78280f1037654b4518b04 | Update for minor API change in django-2fa | account/views/otp.py | account/views/otp.py | ##
# Copyright (C) 2014 Jessica Tallon & Matt Molyneaux
#
# This file is part of Inboxen.
#
# Inboxen 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
#... | Python | 0 | @@ -2972,16 +2972,15 @@
l%22,
-redirect
+success
_url
|
4707dc39f0e0e1fde2a1909d3da08246c8871bb4 | version 0.8.1 | h1ds_core/version.py | h1ds_core/version.py | """
Current h1ds_core version constant plus version pretty-print method.
Code copied from Fabric:
https://github.com/bitprophet/fabric/raw/master/fabric/version.py
This functionality is contained in its own module to prevent circular import
problems with ``__init__.py`` (which is loaded by setup.py during installa... | Python | 0.000001 | @@ -712,20 +712,21 @@
8, 1, '
-beta
+final
', 0)%0A%0Ad
|
857897a88811153f7460472219fd78d4e68bdc12 | bump pkg version | habanero/__init__.py | habanero/__init__.py | # -*- coding: utf-8 -*-
# habanero
"""
habanero library
~~~~~~~~~~~~~~~~~~~~~
habanero is a low level client for the Crossref search API.
Usage::
from habanero import Crossref
cr = Crossref()
# setup a different base URL
Crossref(base_url = "http://some.other.url")
# setup an api key
Crossref(a... | Python | 0 | @@ -900,19 +900,19 @@
__ = %221.
-0.1
+1.0
%22%0A__auth
|
85fa2d64a697cb4049f20414426183738ee7ebc5 | Add key-word arguments to layout.Layout | countershape/layout.py | countershape/layout.py | import html, template
_dtd = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n'
class Layout:
"""
A basic framework for layout objects.
"""
bodyClass = ""
components = ("pageTitle", "body", "header")
def __init__(self, path = No... | Python | 0.997618 | @@ -315,16 +315,26 @@
h = None
+, **kwargs
):%0A
@@ -637,16 +637,26 @@
ODY(body
+, **kwargs
)%0A
|
da548f7d2e69b76901f4f68ae2112946bb9632f6 | Bump version to 3.0.1 | pystorm/version.py | pystorm/version.py | # -*- coding: utf-8 -*-
# Copyright 2014-2015 Parsely, 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 ... | Python | 0 | @@ -978,17 +978,17 @@
= '3.0.
-0
+1
'%0AVERSIO
|
0222d60f050b1517ea57ddf42ab4ff0795c4961c | undo change | corehq/pillows/mappings/case_mapping.py | corehq/pillows/mappings/case_mapping.py | from corehq.pillows.base import DEFAULT_META
from corehq.pillows.core import DATE_FORMATS_ARR, DATE_FORMATS_STRING
from corehq.pillows.mappings import NULL_VALUE
from corehq.util.elastic import es_index
from pillowtop.es_utils import ElasticsearchIndexInfo
CASE_INDEX = es_index("hqcases_2016-03-04")
CASE_ES_TYPE = 'ca... | Python | 0.000002 | @@ -1931,38 +1931,38 @@
'type': '
-object
+nested
'%7D,%0A 'clo
|
2f4bfa8b7d6feb70bd2b76c9c2f3f9113f6f4312 | Load collaborative destroy experiment | enactiveagents/EnactiveAgents.py | enactiveagents/EnactiveAgents.py | """
Entry module of the application.
"""
import pygame
from appstate import AppState
import settings
import events
from view import view
from view import agentevents
from controller import controller
import experiment.basic
import webserver
class HeartBeat(events.EventListener):
"""
Class implementing the hea... | Python | 0 | @@ -2178,12 +2178,15 @@
ence
-Push
+Destroy
Expe
|
b2befc496741a904f8988b2ec8fa5b57aba96a91 | Fix the path to read the sample file from | bin/deploy/giles_conf.py | bin/deploy/giles_conf.py | import json
sample_path = "conf/net/int_service/giles_conf.json.sample"
f = open(path, "r")
data = json.loads(f.read())
f.close()
real_path = "conf/net/int_service/giles_conf.json"
data['giles_base_url'] = 'http://50.17.111.19:8079'
f = open(real_path, "w")
f.write(json.dumps(data))
f.close()
| Python | 0 | @@ -75,16 +75,23 @@
= open(
+sample_
path, %22r
|
ea25a1e01c2f16412da8f628ece3a547427ff896 | update on init() | haproxystats/core.py | haproxystats/core.py | import logging
from datetime import datetime
from requests import Request, Session
log = logging.getLogger(__name__)
class HAProxyService(object):
"""
Generic service object representing a proxy component
params:
- fields(list): Fieldnames as read from haproxy stats export header
- values(list):... | Python | 0 | @@ -1873,23 +1873,41 @@
-def fetch_stats
+ self.update()%0A%0A def update
(sel
|
766a6e7f60ebf039f30b8698b0b326044134c57d | Update event_handler.py | bot/event_handler.py | bot/event_handler.py | import json
import logging
import random
import Algorithmia
from textblob import TextBlob
from text_corpus import TextCorpus
from aylienapiclient import textapi
logger = logging.getLogger(__name__)
class RtmEventHandler(object):
def __init__(self, slack_clients, msg_writer, trump_corpus):
self.clients =... | Python | 0.000004 | @@ -2443,16 +2443,42 @@
sponse =
+ ', '.join(str(d) for d in
classif
@@ -2485,19 +2485,17 @@
ications
-%5B0%5D
+)
%0A%0A
|
86636212c38592769abb421c9338174673fdbcaa | remove make_purchase_invoice from demo script | erpnext/demo/user/fixed_asset.py | erpnext/demo/user/fixed_asset.py |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils.make_random import get_random
from erpnext.assets.doctype.asset.asset import make_purchase_invoice, make_sales_invoice... | Python | 0.003315 | @@ -275,31 +275,8 @@
port
- make_purchase_invoice,
mak
@@ -385,16 +385,17 @@
_asset%0A%0A
+%0A
def work
@@ -464,118 +464,8 @@
))%0A%0A
-%09asset_list = make_asset_purchase_entry()%0A%0A%09if not asset_list:%0A%09%09# fixed_asset.work() already run%0A%09%09return%0A%09%09%0A
%09# E
@@ -615,18 +615,16 @@
ly%22, 1... |
efe45a503e35508b14d96368a0575666ab500d1d | Implement "quote search" in SQL | crabbot/cogs/quotes.py | crabbot/cogs/quotes.py | #!/usr/bin/env python3
# CrabBot quotes
#
# Partially inspired by LRRBot
'''
SQL format
Table "quotes"
author: text
quote: text
'''
from pathlib import PurePath
import random
import sqlite3
from discord.ext import commands
class Quotes:
def __init__(self, bot, quotes_db_path):
self.bot = bot
... | Python | 0 | @@ -2699,13 +2699,21 @@
rns
-exact
+word-for-word
mat
@@ -2819,20 +2819,811 @@
-pass
+''' Get a random quote containing the word-for-word query in it'''%0A # LIKE is case-insensitive for ASCII-range letters only.%0A # Also, it is claimed LIKE is slow for searches starting with %25,%0A ... |
97160a5c94c6c3b410b25b8ad811759c2d696ec3 | fix auth header | nginx_reload.py | nginx_reload.py | import tutum
import websocket
import base64
import os
import json
import re
import sys
from mako.template import Template
from subprocess import call
service_uuid = os.environ.get('LB_SERVICE')
username = os.environ.get('TUTUM_USER')
apikey = os.environ.get('TUTUM_APIKEY')
tutum_auth = os.environ.get('TUTUM_AUTH')
if... | Python | 0.000002 | @@ -2443,16 +2443,18 @@
rization
+:
%22 + tutu
|
cd60cefdd5e483db88436be8eea2577f23c7c56c | Update an incorrect comment | crabbot/cogs/quotes.py | crabbot/cogs/quotes.py | #!/usr/bin/env python3
# CrabBot quotes
#
# Partially inspired by LRRBot
'''
JSON format
{
Name1: [
"Quote1"
"Quote2"
...
],
Name2: [
...
'''
import json
from pathlib import Path
import random
# import sqlite3 # Leaving as a note of possible db alternatives
from discord.ext i... | Python | 0 | @@ -1548,16 +1548,88 @@
ignored%0A
+ # Can't have quote take args, then subcommands don't work%0A
@@ -1700,16 +1700,84 @@
essage%0A%0A
+ # TODO? maybe detect blank strings to help with user error?%0A
@@ -1857,65 +1857,8 @@
))%0A%0A
- # TODO if name is %22%22, pick any o... |
472d626fcc87b7495967ca41bbed500d6d63f593 | Add NoLogger, a Logger that does not logs | bot/logger/logger.py | bot/logger/logger.py | import time
from bot.action.util.textformat import FormattedText
from bot.logger.message_sender import MessageSender
LOG_ENTRY_FORMAT = "{time} [{tag}] {text}"
TEXT_SEPARATOR = " | "
class Logger:
def __init__(self, sender: MessageSender):
self.sender = sender
def log(self, tag, *texts):
t... | Python | 0.000001 | @@ -1027,24 +1027,211 @@
_format()%0A%0A%0A
+class NoLogger(Logger):%0A def __init__(self):%0A super().__init__(None)%0A%0A def log(self, tag, *texts):%0A pass%0A%0A def _get_text_to_send(self, tag, *texts):%0A pass%0A%0A%0A
class Logger
@@ -1239,16 +1239,16 @@
actory:%0A
-
@cla
@@... |
783b3814024d7081813bb0326ddec7cde28d5be2 | Add notes about case-insensitive authors | crabbot/cogs/quotes.py | crabbot/cogs/quotes.py | #!/usr/bin/env python3
# CrabBot quotes
#
# Partially inspired by LRRBot
'''
SQL format
Table "quotes"
author: text
quote: text
'''
from pathlib import PurePath
import random
import sqlite3
from discord.ext import commands
class Quotes:
def __init__(self, bot, quotes_db_path):
self.bot = bot
... | Python | 0.000001 | @@ -4278,17 +4278,16 @@
# TODO
-?
Would k
@@ -4592,136 +4592,237 @@
#
-TODO consider using name.lower() to standardize input.%0A # Would like to preserve capitalization for display though.
+NOTE: For capitalization sanitation, there's 'author COLLATE NOCASE'%0A # either in CREATE TABL... |
510e44d1f89bd445daa47911e7ff20947469eb04 | Add excel_utils | boyle/excel_utils.py | boyle/excel_utils.py | import os
import os.path as op
from typing import List, Sequence
import numpy as np
import pandas as pd
import xlrd
from openpyxl import load_workbook
def _openpyxl_read_xl(xl_path: str):
""" Use openpyxl to read an Excel file. """
try:
wb = load_workbook(filename=xl_path, read_only=True)
excep... | Python | 0.000004 | @@ -1,17 +1,8 @@
-import os
%0Aimport
@@ -15,16 +15,26 @@
h as op%0A
+%0Atry:%0A
from typ
@@ -63,27 +63,87 @@
nce%0A
-%0Aimport numpy as np
+except:%0A raise ImportError('%60typing%60 module not found, please install it.')%0A
%0Aimp
@@ -946,9 +946,8 @@
-#
fail
@@ -955,22 +955,17 @@
.append(
-choice... |
229d2a71cb06d793e67842bcf426dab2f4f60da2 | Remove *args form gateway functions. | qualpay/gateway.py | qualpay/gateway.py | import functools
from .requestor import APIRequestor
__all__ = ('PaymentGateway', 'authorize', 'verify', 'capture', 'sale', 'void',
'refund', 'credit', 'force', 'tokenize')
class PaymentGateway(object):
def __init__(self, merchant_id=None, security_key=None, base_endpoint=None):
import qualpay
... | Python | 0 | @@ -5758,23 +5758,16 @@
wrapper(
-*args,
**kwargs
|
64d187c871c268b4631590a7396f459264fb1c03 | Exit from loop by 'q' | bpc8583/isoClient.py | bpc8583/isoClient.py | #!/usr/bin/env python
import sys
import struct
import os
import getopt
import time
from ISO8583 import ISO8583, MemDump
from py8583spec import IsoSpec, IsoSpec1987BPC
from terminal import Terminal
from card import Card
from transactions import echo_test, balance_inquiry, manual_purchase
def show_available_transacti... | Python | 0.000001 | @@ -968,24 +968,87 @@
ency_code())
+%0A%0A elif trxn_type == 'q':%0A break%0A
%0A els
|
346bb232062ff3068882cb29fa123779a19e4ea6 | fix stderr comment, clarify stdout vs stderr | raco/test_style.py | raco/test_style.py | from nose.plugins.skip import SkipTest
import subprocess
import sys
import unittest
def check_output_and_print_stderr(args):
"""Run the specified command. If it does not exit cleanly, print the stderr
of the command to stderr"""
try:
subprocess.check_output(args, stderr=subprocess.STDOUT)
exce... | Python | 0.000134 | @@ -225,19 +225,155 @@
d to std
-err
+out. Note that stderr prints are displayed as tests%0A run, whereas stdout prints show up next to the failed test. We want the%0A latter.
%22%22%22%0A
|
ab715fa95c85550d014da748a12d131b34522d6a | Fix logic bug | numba/consts.py | numba/consts.py | from __future__ import print_function, absolute_import
from types import ModuleType
import weakref
from . import ir
from .errors import ConstantInferenceError
class ConstantInference(object):
"""
A constant inference engine for a given interpreter.
Inference inspects the IR to try and compute a compile... | Python | 0 | @@ -2854,18 +2854,24 @@
-if
+_slice =
func in
@@ -2879,17 +2879,16 @@
(slice,)
-:
%0A
@@ -2892,46 +2892,14 @@
- return func(*args)%0A%0A if
+_exc =
isi
@@ -2953,16 +2953,42 @@
ception)
+%0A if _slice or _exc
:%0A
@@ -3049,16 +3049,101 @@
r.args%5D%0A
+ ... |
0039eefbfa546f24b3f10031e664341d60e4055c | Use previews in ranger fzf | ranger/commands.py | ranger/commands.py | from ranger.api.commands import Command
class fzf_select(Command):
"""
:fzf_select
Find a file using fzf.
With a prefix argument select only directories.
See: https://github.com/junegunn/fzf
"""
def execute(self):
import subprocess
import os.path
if self.quantifie... | Python | 0 | @@ -391,32 +391,51 @@
-hidden %7C fzf +m
+ --preview 'cat %7B%7D'
%22%0A #
@@ -681,32 +681,51 @@
-hidden %7C fzf +m
+ --preview 'cat %7B%7D'
%22%0A #
|
82073a946ff76a07d907cfb0a0cd8885055f36b3 | Bump version | rdiffb/__init__.py | rdiffb/__init__.py | """Module config for rdiffb."""
from .rdiffb import *
# This is the one place the version number for rdiffb is stored,
# there is a regex for it in setup.py.
__version__ = '0.2.0'
| Python | 0 | @@ -174,9 +174,9 @@
'0.
-2
+3
.0'%0A
|
8a7a1480c3c8892bef0884703c0894d46c3b25ff | Fix about permission | rdmo/core/views.py | rdmo/core/views.py | from __future__ import absolute_import
from django.conf import settings
from django.contrib.auth.mixins import \
PermissionRequiredMixin as DjangoPermissionRequiredMixin
from django.contrib.auth.views import redirect_to_login
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import ... | Python | 0.000001 | @@ -224,16 +224,74 @@
o_login%0A
+from django.contrib.auth.decorators import login_required%0A
from dja
@@ -540,16 +540,17 @@
rt View%0A
+%0A
from res
@@ -1355,24 +1355,40 @@
nForm()%7D)%0A%0A%0A
+@login_required%0A
def about(re
|
40095ec78e7388729abb1d3d0127cabdecce3e12 | Load custom_fields from nova tags | surveil/cmd/rabbitMQ_consumer.py | surveil/cmd/rabbitMQ_consumer.py | # Copyright 2014 - Savoir-Faire Linux 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... | Python | 0.000001 | @@ -5391,24 +5391,537 @@
%7D%0A%0A
+ surveil_metadata_custom_fields = event%5B'payload'%5D%5B'metadata'%5D.get(%0A 'surveil_custom_fields',%0A None%0A )%0A if surveil_metadata_custom_fields is not None:%0A try:%0A ... |
370a7b2a31d8e63b14d302f5205298f3cad0eb39 | Allow conversion of named tab for xlsx files | csvkit/convert/xlsx.py | csvkit/convert/xlsx.py | #!/usr/bin/env python
from cStringIO import StringIO
import datetime
from openpyxl.reader.excel import load_workbook
from csvkit import CSVKitWriter
from csvkit.typeinference import NULL_TIME
def normalize_datetime(dt):
if dt.microsecond == 0:
return dt
ms = dt.microsecond
if ms < 1000:
... | Python | 0 | @@ -853,24 +853,144 @@
ators=True)%0A
+ if 'sheet' in kwargs:%0A sheetn = kwargs%5B'sheet'%5D%0A sheet = book.get_sheet_by_name(sheetn)%0A else:%0A
sheet =
|
b284c56c3a8018b66f4feb50c980efc20bf44e4f | remove message after processing | pdf2xlsx/gui.py | pdf2xlsx/gui.py | # -*- coding: utf-8 -*-
"""
Not so simple tkinter based gui around the pdf2xlsx.do_it function.
"""
from tkinter import Tk, ttk, filedialog, messagebox, StringVar, Toplevel, END
from .managment import do_it
from .config import config
__version__ = '0.2.0'
class ConfOption():
"""
This widget is used to place t... | Python | 0 | @@ -7442,32 +7442,33 @@
s%7D'%0A
+#
messagebox.showi
@@ -7505,32 +7505,33 @@
d',%0A
+#
|
83dca1f0787cf7c403d6f7be9d3decbc01cade3c | Support custom 'out' directory | telemetry/telemetry/core/util.py | telemetry/telemetry/core/util.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import inspect
import os
import socket
import sys
import time
class TimeoutException(Exception):
pass
def GetBaseDir():
main_module = sys.modules[... | Python | 0.000012 | @@ -3150,14 +3150,68 @@
+ os.path.basename(os.environ.get('CHROMIUM_OUT_DIR',
'out'
+))
,%0A
|
8f3ce45d2164f1865e6c1b23f9fc37e332b00413 | Fix piqi -> json generation for flags = True and omit_missing | piqi_to_json.py | piqi_to_json.py | import collections
import base64
import wrappers
import piqi
import piqi_of_json
# config
#
# TODO: make configurable
omit_missing_fields = True
def omit_missing_field(f):
return f.get('json_omit_missing', omit_missing_fields)
def resolve_type(x):
return piqi.resolve_type(x.__piqi_type__, x.__piqi_module... | Python | 0.000008 | @@ -1417,16 +1417,22 @@
%0A
+ skip,
value =
@@ -1473,150 +1473,22 @@
if
-value is None or (value == %5B%5D and field_spec%5B'mode'%5D == 'repeated'):%0A if omit_missing_field(field_spec):%0A continue%0A%0A
+not skip:%0A
@@ -1543,24 +1543,28 @@
field_spec)%0A
+
... |
f94dc5eb7135bdf51f8ca0c71b6f6f49c2ec3fec | Update version in pip package to 0.1.2 (#23) | tensorboard/pip_package/setup.py | tensorboard/pip_package/setup.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Python | 0 | @@ -899,128 +899,8 @@
le.%0A
-# Backwards-incompatible changes to Python API or plugin compatibility will %0A# result in a change to the MAJOR version.%0A
_VER
@@ -911,17 +911,17 @@
= '0.1.
-1
+2
'%0A%0A%0AREQU
@@ -2606,8 +2606,9 @@
izer',%0A)
+%0A
|
64078daac7791af4061bc1de7913d8a76254a4c1 | Rewrite search to use api | aero/adapters/pip.py | aero/adapters/pip.py | # -*- coding: utf-8 -*-
__author__ = 'nickl-'
from string import strip
from aero.__version__ import __version__
from importlib import import_module
from .base import BaseAdapter
class Pip(BaseAdapter):
"""
Pip adapter.
"""
def search(self, query):
response = self.command(['search', query])[0]... | Python | 0 | @@ -272,31 +272,38 @@
-response = self
+m = import_module('pip
.command
(%5B's
@@ -302,30 +302,18 @@
mand
-(%5B'
+s.
search'
-, query%5D)%5B0%5D
+)
%0A
@@ -339,113 +339,184 @@
f
+o
r
-om
r
-e
i
-mport match%0A for key, line in %5Bmap(%0A strip, self.package_name(l).split(' -
+n ... |
d69d5e8d3f847763b249d2c75c5799a16a6b9d58 | add strip authority | aiourllib/rfc3986.py | aiourllib/rfc3986.py | import string
class Protocol(object):
ALPHA = string.ascii_letters
DIGIT = string.digits
UNRESERVED = ALPHA + DIGIT + '-' '.' '_' '~'
GEN_DELIMS = ':' '/' '?' '#' '[' ']' '@'
SUB_DELIMS = '!' '$' '&' '\'' '(' ')' '*' '+' ',' ';' '='
RESERVED = GEN_DELIMS + SUB_DELIMS
PCT_ENCODED = '%' + ... | Python | 0.000002 | @@ -1547,32 +1547,415 @@
ery, hier_part%0A%0A
+ @classmethod%0A def strip_authority(cls, hier_part):%0A if hier_part.startswith('//'):%0A hier_part = hier_part%5B2:%5D%0A if '/' in hier_part:%0A authority, hier_part = hier_part.split('/', 1)%0A hier_part = '/%7B%7D'... |
9ff47d0702e63b93938f882f75887ddf70e06a4c | Fix User.is_active(); recentchanges_userindex uses spaces in usernames. | reportsbot/user.py | reportsbot/user.py | # -*- coding: utf-8 -*-
from .util import to_sql_format, to_wiki_format
__all__ = ["User"]
class User:
"""Represents a user on a particular site.
Users can be part of multiple WikiProjects.
"""
def __init__(self, bot, name):
self._bot = bot
self._name = to_wiki_format(name)
@pr... | Python | 0.000001 | @@ -39,23 +39,8 @@
port
- to_sql_format,
to_
@@ -837,22 +837,8 @@
ry,
-(to_sql_format
(sel
@@ -847,17 +847,16 @@
_name),)
-)
%0A
|
bf4e7caedc49a89d0103077c31b74cf904eef52d | Improve performance of the TopReferrers plugin by ignoring blank referrers. | request/plugins.py | request/plugins.py | import re
from django.utils.translation import string_concat, ugettext, ugettext_lazy as _
from django.template.loader import render_to_string
from request import settings
from request.models import Request
from request.traffic import modules
# Calculate the verbose_name by converting from InitialCaps to "lowercase ... | Python | 0 | @@ -4040,16 +4040,36 @@
isits().
+exclude(referer='').
values_l
|
db1ccc863162112c30b6f89fef475338dafe2aae | Revise main() & add time/space complexity from Yuanlin | alg_binary_search.py | alg_binary_search.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def binary_search(a_list, item):
"""Binary search for ordered list."""
first = 0
last = len(a_list) - 1
found_bool = False
while first <= last and not found_bool:
mid = (first + la... | Python | 0 | @@ -175,16 +175,80 @@
ed list.
+%0A%0A Time complexity: O(logn).%0A Space complexity: O(1).%0A
%22%22%22%0A
@@ -693,16 +693,80 @@
cursion.
+%0A%0A Time complexity: O(logn).%0A Space complexity: O(1).%0A
%22%22%22%0A
@@ -1280,24 +1280,82 @@
ch_recur().%0A
+ Time complexity: O(logn).%0... |
9a9eb4333285d2582655ead70801c5ab7ed7d43f | add dummy local settings when not found | bogo/bogoapp/settings.py | bogo/bogoapp/settings.py | try:
from bogoapp import local_settings
except ImportError:
pass # probably running ci tests
LOGO = getattr(local_settings, "LOGO", None)
SQL_DRIVER_LIB = getattr(local_settings, "SQL_DRIVER_LIB", None)
DATABASE_PATH = getattr(local_settings, "DATABASE_PATH", None)
SQL_SCHEMA_PATH = getattr(local_settings, "S... | Python | 0 | @@ -65,40 +65,33 @@
-pass # probably running ci tests
+local_settings = object()
%0A%0ALO
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.