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 |
|---|---|---|---|---|---|---|---|
8b84b2ae83977e091ee33ce86e30bcc7cc5c08a2 | Allow apostrophe and forbid colon in thread names | chandl/util.py | chandl/util.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import sys
import hashlib
import unidecode
import six
import requests
import chandl
def bytes_fmt(num, suffix='B'):
"""
Turn a number of bytes into a more friendly representation, e.g. 2.5MiB.
:param num: The number of bytes... | Python | 0.000006 | @@ -2047,17 +2047,18 @@
, '_', '
-:
+%5C'
'%5D%0A j
|
a82d419d17c67cfd7842cf104994b9ecbda96e94 | Delete existing libnccl before installing NCCL | perfkitbenchmarker/linux_packages/nccl.py | perfkitbenchmarker/linux_packages/nccl.py | # Copyright 2018 PerfKitBenchmarker 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 appli... | Python | 0.000001 | @@ -1859,16 +1859,94 @@
ild(vm)%0A
+ vm.RemoteCommand('sudo rm -rf /usr/local/nccl2') # Preexisting NCCL in DLVM
%0A vm.In
|
13ae8cf8eddba1cf40d89307ba1c52480cbac472 | Bump version | async2rewrite/__init__.py | async2rewrite/__init__.py | """
Convert discord.py code using abstract syntax trees.
"""
__title__ = 'async2rewrite'
__author__ = 'Tyler Gibbs'
__version__ = '0.0.2'
__copyright__ = 'Copyright 2017 TheTrain2000'
__license__ = 'MIT'
from .main import *
| Python | 0 | @@ -131,17 +131,17 @@
= '0.0.
-2
+3
'%0A__copy
|
0639158e539f0f1c1a6d4dac1753179429257017 | add django_pluralize template filter | source/base/helpers.py | source/base/helpers.py | import datetime
import logging
import os
from django.conf import settings
from django.template.defaultfilters import linebreaks as django_linebreaks,\
escapejs as django_escapejs
from jingo import register
from sorl.thumbnail import get_thumbnail
logger = logging.getLogger('base.helpers')
@register.filter
def l... | Python | 0.000001 | @@ -176,16 +176,47 @@
escapejs
+, pluralize as django_pluralize
%0A%0Afrom j
@@ -550,16 +550,114 @@
me.now()
+%0A %0A@register.filter%0Adef dj_pluralize(string, arg='s'):%0A return django_pluralize(string, arg)
%0A%0A@regis
@@ -1583,28 +1583,29 @@
il(source, *args, **kwargs)%0A
+%0A
|
982f2c8777c43cff2d69cc6adac02a6d5397c043 | Update warning message for PMID search | indra/literature/pubmed_client.py | indra/literature/pubmed_client.py | import urllib, urllib2
from functools32 import lru_cache
import xml.etree.ElementTree as ET
from indra.databases import hgnc_client
pubmed_search = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi'
pubmed_fetch = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi'
pmid_convert = 'http://www.ncbi.nlm.n... | Python | 0 | @@ -1706,17 +1706,17 @@
print
-
+(
'Not all
@@ -1734,18 +1734,50 @@
etrieved
-,
+for search %25s;%5Cn'%0A '
limited
@@ -1785,16 +1785,30 @@
t %25d.' %25
+ (search_term,
params%5B
@@ -1816,16 +1816,18 @@
retmax'%5D
+))
%0A ret
|
62694c2072e3499b843372166daeead8a6335a5e | Format with Black | comics/accounts/views.py | comics/accounts/views.py | from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
from django.urls import reverse
from invitations.utils import get_invitation_model
from comics.accounts.models ... | Python | 0 | @@ -3917,17 +3917,17 @@
_by(
-'
+%22
-created
')%0A%0A
@@ -3922,17 +3922,17 @@
-created
-'
+%22
)%0A%0A r
|
d305e953d028b935333b86b4cffc58649b8a4652 | Twitter uses OAuth1 not OAuth2, dummy | hiptweet/tasks.py | hiptweet/tasks.py | import logging
import requests
from flask import Blueprint, jsonify
from requests_oauthlib import OAuth2Session
from hiptweet import celery
from hiptweet.models import HipChatGroup, HipChatRoom
from celery.utils.log import get_task_logger
# set up logging
logger = get_task_logger(__name__)
logger.setLevel(logging.INFO... | Python | 0.99914 | @@ -92,25 +92,25 @@
import OAuth
-2
+1
Session%0Afrom
@@ -1344,32 +1344,28 @@
id)%0A
-capabilities_url
+install_info
= group
@@ -1384,25 +1384,8 @@
o%5B0%5D
-.capabilities_url
%0A
@@ -1418,16 +1418,29 @@
sts.get(
+install_info.
capabili
@@ -1638,16 +1638,62 @@
%22room%22%0A
+ twitter_token = group.... |
7b42e7e84adb091f100ed13a52e1c1f9a65dbd5b | set ordering by block number in database | sunfinder/sunfinder.py | sunfinder/sunfinder.py | #!/usr/bin/env python
"""sunfinder.py: Queries the Chainz SolarCoin Explorer API, pulls solar production data and
loads to database"""
__author__ = "Steven Campbell AKA Scalextrix"
__copyright__ = "Copyright 2017, Steven Campbell"
__license__ = "The Unlicense"
__version__ = "1.0"
import json
import os.path
import ... | Python | 0.000001 | @@ -4798,16 +4798,79 @@
ursor()%0A
+%09%09%09c.execute('select * FROM SOLARDETAILS ORDER BY block DESC')%0A
%09%09%09row_c
|
aa4be6a435222003bf5e87df5c1f8d34394592fe | add celery conf | hiren/__init__.py | hiren/__init__.py | Python | 0.999777 | @@ -0,0 +1,43 @@
+from github.celery import app as celery_app
| |
a871f05ba94c34b1444468c46ed7895469059653 | Create member allow_origin | glarkconnector.py | glarkconnector.py | #!/usr/bin/python
"""Connector for the glark.io editor. """
__version__ = "0.1"
import BaseHTTPServer
import json
import os
import re
import sys
class ConnectorRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
"""Request handler exposing a REST api to the underlying filesystem"""
serv... | Python | 0 | @@ -358,16 +358,63 @@
rsion__%0D
+%0A allow_origin = %22http://dev.galipette.org%22%0D
%0A%0D%0A d
@@ -1010,34 +1010,20 @@
n%22,
-%22http://dev.galipette.org%22
+allow_origin
)%0D%0A
@@ -2896,34 +2896,20 @@
n%22,
-%22http://dev.galipette.org%22
+allow_origin
)%0D%0A
|
f343c9782ac0ae02ca056385aa4c6098399d0076 | Fix loop through jaydebeapi cursor because not iterable | atp_classes/TeradataDB.py | atp_classes/TeradataDB.py | import atp_classes, re, platform, os
class TeradataDB:
def __init__(self, host=None, port=None, username=None, password=None, database=None, auth_mech=None):
config = atp_classes.Config()
self.host = host or config.get_config()['database']['dataWarehouse']['host']
self.username = username... | Python | 0.000022 | @@ -3223,32 +3223,43 @@
for row in cur
+.fetchall()
:%0A
|
e8583e6ad8c0a3d89fe4bcb063a776f1ad139447 | Update spoonerism.py | pythainlp/transliterate/spoonerism.py | pythainlp/transliterate/spoonerism.py | # -*- coding: utf-8 -*-
from pythainlp.transliterate import pronunciate
from pythainlp import thai_consonants
_list_consonants = list(thai_consonants.replace("ห", ""))
def puan(word: str, show_pronunciation: bool = True) -> str:
"""
Thai Spoonerism
This function converts Thai word to spoonerized.
It... | Python | 0 | @@ -879,19 +879,16 @@
urn word
-%5B0%5D
%0A if
|
9abe7a776c4b0a4995a1c3a3d16f02bcba93f12e | add sin flute | audio/fourier_an_audio.py | audio/fourier_an_audio.py | #Milton Orlando Sarria
#analisis espectral de sinusoides
import matplotlib.pyplot as plt
import numpy as np
from fourierFunc import fourierAn
import wav_rw as wp
filename1='sound/flute-A4.wav'
filename2='sound/violin-B3.wav'
#leer los archivos de audio
fs,x1=wp.wavread(filename1)
fs,x2=wp.wavread(filename2)
t=(np.... | Python | 0.999997 | @@ -156,16 +156,51 @@
w as wp%0A
+from scipy.signal import get_window
%0A%0Afilena
@@ -374,16 +374,161 @@
oat(fs)%0A
+#crear dos ventanas%0Aw1 = get_window('hamming', x1.size); w1 = w1 / sum(w1) %0Aw2 = get_window('hamming', x2.size); w2 = w2 / sum(w2)
%0A#calcul
@@ -582,16 +582,19 @@
ierAn(x1
+*w1
... |
0b7f25c92a2d0798a535487aa5305a793e998214 | Fix line replacement logic | homely/general.py | homely/general.py | import os
from homely.engine import add
from homely.utils import filereplacer
def lineinfile(filename, contents, prefix=None, regex=None):
filename = os.path.expanduser(filename)
obj = LineInFile(filename=filename, contents=contents)
if prefix is not None:
obj.findprefix(prefix)
elif regex is... | Python | 0.000004 | @@ -2281,24 +2281,28 @@
if
+not
modified
:%0A
@@ -2297,74 +2297,12 @@
fied
-:%0A tmp.write(line)%0A elif
+ and
mat
@@ -2638,16 +2638,82 @@
strip()%0A
+ else:%0A tmp.write(line)%0A
|
53b43e51c4d073dae4f3ccad896ba1744ca1284b | Update version | auth_backends/_version.py | auth_backends/_version.py | __version__ = '0.1.1' # pragma: no cover
| Python | 0 | @@ -12,17 +12,17 @@
= '0.1.
-1
+2
' # pra
|
f57a2c9124da513734a8e4934b8a02903109077e | Remove hardcoded backgrount from molecule svg | girder/molecules/server/openbabel.py | girder/molecules/server/openbabel.py | from girder.api.rest import RestException
from openbabel import OBMol, OBConversion
import pybel
import re
inchi_validator = re.compile('InChI=[0-9]S?\/')
# This function only validates the first part. It does not guarantee
# that the entire InChI is valid.
def validate_start_of_inchi(inchi):
if not inchi_vali... | Python | 0.00027 | @@ -3078,32 +3078,151 @@
ta, in_format):%0A
+ out_options = %7B%0A 'b': 'none', # transparent background color%0A 'B': 'black' # black bonds color%0A %7D%0A
return conve
@@ -3254,13 +3254,38 @@
t, 'svg'
+, out_options=out_options
)%5B0%5D%0A
|
2321ddb5f6d7731597f4f122a87041933348f064 | Enable Unicode tests | gmn/src/d1_gmn/tests/test_unicode.py | gmn/src/d1_gmn/tests/test_unicode.py | # -*- coding: utf-8 -*-
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2016 DataONE
#
# Licensed under the Apache License, Version 2.0 ... | Python | 0.000001 | @@ -933,22 +933,8 @@
ng%0A%0A
-import pytest%0A
impo
@@ -1038,34 +1038,8 @@
a%0A%0A%0A
-@pytest.mark.skip('TODO')%0A
clas
@@ -1135,16 +1135,33 @@
000(self
+, mn_client_v1_v2
):%0A %22
@@ -1221,28 +1221,52 @@
%22%22%22%0A
-%0A
-def test(client
+with d1_gmn.tests.gmn_mock.disable_auth(
):%0A
@@ -1630,22... |
3868a4ef30835ed1904a37318013e20f2295a8a9 | Remove fantastic from COB theme | ckanext/cob/plugin.py | ckanext/cob/plugin.py | import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
def groups():
# Return a list of groups
return toolkit.get_action('group_list')(data_dict={'all_fields': True})
def dataset_count():
# Return a count of all datasets
result = toolkit.get_action('package_search')(data_dict={'rows': 1... | Python | 0 | @@ -657,57 +657,8 @@
ic')
-%0A toolkit.add_resource('fanstatic', 'cob')
%0A%0A
|
46c1c21c0190aa95f4fede8fa1d98bbae7cf38c5 | test mode defaults to true - fix for #21 | ckanext/doi/config.py | ckanext/doi/config.py | #!/usr/bin/env python
# encoding: utf-8
"""
Created by 'bens3' on 2013-06-21.
Copyright (c) 2013 'bens3'. All rights reserved.
"""
from pylons import config
from paste.deploy.converters import asbool
TEST_PREFIX = '10.5072'
ENDPOINT = 'https://mds.datacite.org'
TEST_ENDPOINT = 'https://test.datacite.org/mds'
def g... | Python | 0.000001 | @@ -379,33 +379,32 @@
return:%0A %22%22%22%0A
-%0A
return asboo
@@ -439,16 +439,22 @@
st_mode%22
+, True
))%0A%0A%0Adef
|
3c1b5c425109d24eca552e60e859d7d747607492 | Fix UP in TRRUST | indra/sources/trrust/processor.py | indra/sources/trrust/processor.py | from copy import deepcopy
from indra.databases import hgnc_client
from indra.statements import Agent, IncreaseAmount, DecreaseAmount, Evidence
class TrrustProcessor(object):
"""Processor to extract INDRA Statements from Trrust data frame.
Attributes
----------
df : pandas.DataFrame
The Trrust... | Python | 0.000001 | @@ -1893,16 +1893,37 @@
if
+up_id and ',' not in
up_id:%0A
|
bf8ab86d536570790d135f0f46c97ffb30a83535 | update background_substraction.py | background_subtraction.py | background_subtraction.py | # Reference: http://docs.opencv.org/master/db/d5c/tutorial_py_bg_subtraction.html
import numpy as np
import cv2
# TODO: remove hard coded file name
cap = cv2.VideoCapture('videos/sample_video_2.mp4')
# Here are the 3 ways of background subtraction
# createBackgroundSubtractorMOG2 seems to give the best result. Need ... | Python | 0.000001 | @@ -74,16 +74,41 @@
ion.html
+%0A# requires opencv v3.1.0
%0A%0Aimport
|
4bf71f03166fc0097668c3cf18dcbea52b000a49 | comment updated | gui/form/itemdialog.py | gui/form/itemdialog.py | # -*- coding: utf-8 -*-
from PyQt4 import QtGui, QtCore
from core import map
from core.localisation import _
class itemDialog(QtGui.QDialog):
"""
Window to fill some informations to create an item
label npc gender npc gender field
create button cancel button
"""
_app = None
_parent = None
_coordinates = Non... | Python | 0 | @@ -200,71 +200,81 @@
em%0A%09
-label npc gender%09npc gender field%0A%09create button%09%09cancel button
+All items contains two fields for their coordinates if the item is edited
%0A%09%22%22
|
1f815ad5cb7535132a60297808abfa959709ba65 | Fix redirect_to_login | daiquiri/files/views.py | daiquiri/files/views.py | import logging
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.shortcuts import redirect
from django.views.generic import View
from .utils import file_exists, check_file, send_file
logger = logging.getLogger(__name__)
class FileView(View):
def get(self, request,... | Python | 0.000011 | @@ -9,16 +9,72 @@
ogging%0A%0A
+from django.contrib.auth.views import redirect_to_login%0A
from dja
@@ -153,46 +153,8 @@
404%0A
-from django.shortcuts import redirect%0A
from
@@ -922,24 +922,35 @@
rect
-('account_login'
+_to_login(request.path_info
)%0A%0A
|
3ce5f60102d5de7367a06e7412e9e31597e40a58 | revert to original hello world | click_tutorial/cli.py | click_tutorial/cli.py | import click
@click.argument('name')
@click.command()
def cli(name):
click.echo("Hello, {0}!".format(name))
if __name__ == '__main__':
cli()
| Python | 0.999999 | @@ -11,32 +11,8 @@
ck%0A%0A
-@click.argument('name')%0A
@cli
@@ -32,20 +32,16 @@
def cli(
-name
):%0A c
@@ -62,26 +62,15 @@
lo,
-%7B0%7D!%22.format(name)
+World!%22
)%0A%0Ai
|
d44250f60e9676618170bd61f8f6bc438078ef87 | Add celery settings. | base/config/production.py | base/config/production.py | " Production settings must be here. "
from .core import *
from os import path as op
SECRET_KEY = 'SecretKeyForSessionSigning'
ADMINS = frozenset([MAIL_USERNAME])
# flask.ext.collect
# -----------------
COLLECT_STATIC_ROOT = op.join(op.dirname(ROOTDIR), 'static')
# dealer
DEALER_PARAMS = dict(
backends=('git', ... | Python | 0 | @@ -975,16 +975,74 @@
master'%0A
+# Celery settings%0ABROKER_URL = 'redis://localhost:6379/0'%0A
%0A%0A# pymo
|
4c977a313942074cccdd6756762c5545e650cdc7 | Switch to NumPy's `ndindex` in `_cdist_apply` | dask_distance/_utils.py | dask_distance/_utils.py | import functools
import itertools
import numpy
import dask
import dask.array
from . import _compat
from . import _pycompat
def _broadcast_uv(u, v):
u = _compat._asarray(u)
v = _compat._asarray(v)
U = u
if U.ndim == 1:
U = U[None]
V = v
if V.ndim == 1:
V = V[None]
if U.... | Python | 0 | @@ -1167,57 +1167,22 @@
in
-itertools.product(*%5B_pycompat.irange(e) for e in
+numpy.ndindex(
resu
@@ -1189,17 +1189,16 @@
lt.shape
-%5D
):%0A
|
bd712dad2709ba31be89f48f283084d5894cb378 | Replace dot in archive thumbnail name by underscore | ipol_demo/modules/core/archive.py | ipol_demo/modules/core/archive.py | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
Helper functions for core, related to the archive module.
"""
import gzip
import json
import os
import traceback
from collections import OrderedDict
import requests
from ipolutils.utils import thumbnail
def create_thumbnail(src_file):
"""
Create thumbnail w... | Python | 0 | @@ -521,31 +521,11 @@
name
-, _ = os.path.splitext(
+ =
os.p
@@ -546,16 +546,33 @@
rc_file)
+.replace(%22.%22, %22_%22
)%0A th
@@ -2016,16 +2016,52 @@
umbnail%0A
+ print(src_file)%0A
|
871f49eea1197af8224c601833e6e96f59697eb3 | Update phishing_database.py | plugins/feeds/public/phishing_database.py | plugins/feeds/public/phishing_database.py | from datetime import timedelta
import logging
from core.observables import Url
from core.feed import Feed
from core.errors import ObservableValidationError
class PhishingDatabase(Feed):
""" This class will pull the PhishingDatabase feed from github on a 12 hour interval. """
default_values = {
'frequ... | Python | 0.000002 | @@ -1,12 +1,106 @@
+#!/usr/bin/env python%0A%22%22%22This class will incorporate the PhishingDatabase feed into yeti.%22%22%22%0A%0A
from datetim
@@ -282,17 +282,16 @@
%0A %22%22%22
-
This cla
@@ -363,17 +363,16 @@
nterval.
-
%22%22%22%0A%0A
|
63be69b5a977d4ae5b65bf849e0de6809dc6cc3f | Remove unused function | systemd/server_main.py | systemd/server_main.py | # -*- coding: utf-8 -*-
import fcntl
import json
import os
import socket
import select
import struct
import sys
import termios
import threading
import time
import subprocess
import atexit
import re
import candy_board_amt
import logging
import logging.handlers
# sys.argv[0] ... Serial Port
# sys.argv[1] ... The path t... | Python | 0.000004 | @@ -4624,20 +4624,34 @@
-modem_reset(
+logger.error(%22Do nothing:
sys.
@@ -4647,35 +4647,40 @@
thing: sys.argv%5B
-1%5D,
+3%5D=%25s%22 %25
sys.argv%5B2%5D)%0A
@@ -4669,25 +4669,25 @@
%25 sys.argv%5B
-2
+3
%5D)%0A else:
|
89c32db7496ae261d24ef87cd94c92f936c7894a | Fix typo | flexget/components/trakt/trakt_calendar.py | flexget/components/trakt/trakt_calendar.py | import datetime
import math
from loguru import logger
from requests import RequestException
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.utils.cached_input import cached
from . import db
logger = logger.bind(name='trakt_calendar')
max_number_of_days = 31
... | Python | 0.999999 | @@ -3215,16 +3215,17 @@
single
+c
all. Fin
|
730489e4f6a7f3067ad67c16512c2cbcb97f3272 | stop gap on astronmical solar zenith | bin/astronomical.py | bin/astronomical.py | """
astronomical.py, Sam Murphy (2017-04-27)
Astronomical calculations (e.g. solar angles) for
processing satellite imagery through Google Earth
Engine.
"""
import ee
class Astronomical:
pi = 3.141592653589793
degToRad = pi / 180 # degress to radians
radToDeg = 180 / pi # radians to degress
def sin(x):retu... | Python | 0.000001 | @@ -1934,16 +1934,41 @@
return
+'need to check this out'#
solar_z.
|
9e3becba368e5cc916c9af99a89e62e502d0a506 | Fix syntax error in urls | greenland/urls.py | greenland/urls.py | """greenland URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | Python | 0.000254 | @@ -1133,16 +1133,17 @@
esults')
+,
%0A url
|
4be61b5013f1a9d1400abbf64d37eb2290cb8e7e | Update soc/logic/site/sidebar.py to use parts of the "site map" in soc/logic/site/map.py to generate portions of the sidebar menu. | app/soc/logic/site/sidebar.py | app/soc/logic/site/sidebar.py | #!/usr/bin/python2.5
#
# Copyright 2008 the Melange authors.
#
# 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.000001 | @@ -846,16 +846,47 @@
id_user%0A
+from soc.logic.site import map%0A
%0A%0Adef bu
@@ -1012,94 +1012,47 @@
i
-s_admin: B
+d: a G
oo
+g
le
-an indicating that curre
+ Accou
nt
+(
user
- is a %22Developer%22%0A (site super-user)
+s.User) object
; de
@@ -1078,39 +1078,40 @@
hich
- case
%0A
-id_user.... |
0a08c933375197bd630442e4c1f27c68fb2c8d0b | Reorder some things | groupvpn-webui.py | groupvpn-webui.py | import json
import math
import random
import re
import string
from flask import Flask, redirect, render_template, request, url_for
import ipaddress
import wtforms as w
PASSWORD_CHARS = string.ascii_lowercase + string.digits
PASSWORD_LENGTH = 30
class IPNetworkField(w.Field):
widget = w.widgets.TextInput()
d... | Python | 0.000335 | @@ -1991,805 +1991,8 @@
se%0A%0A
-app = Flask(__name__)%0Aapp.jinja_env.trim_blocks = True%0Aapp.jinja_env.keep_trailing_newline = True%0A%0A@app.route('/', methods=%5B'GET'%5D)%0Adef home():%0A return redirect(url_for('configurate'))%0A%0A@app.route('/configurate', methods=%5B'GET', 'POST'%5D)%0Adef configurate():... |
8c59053b4fc367246c79a967fc8764d92742ed53 | add ability to feed in guess to s21 inverse | kid_readout/analysis/resonator.py | kid_readout/analysis/resonator.py | from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import lmfit
import scipy.stats
import scipy.optimize
minimize = lmfit.minimize
# To use different defaults, change these three import statements.
from kid_readout.analysis.khalil import delayed_generic_s21 as default_model
from kid_re... | Python | 0 | @@ -6578,32 +6578,43 @@
s21, params=None
+,guess=None
):%0A %22%22%22%0A
@@ -6990,24 +6990,58 @@
verse(s21):%0A
+ if guess is None:%0A
@@ -7086,16 +7086,61 @@
data))%5D%0A
+ else:%0A x0 = guess%0A
|
4c6c41872b9a547917d81996f5f93d628c90216d | proper print | temperature-sparkpy.py | temperature-sparkpy.py |
from __future__ import print_function
import sys
import math
from operator import add
from pyspark import SparkContext
def is_number(s):
try:
float(s)
return True
except ValueError:
return False
def mapper(line):
# positive or negative
sign = line[87:88]
# bef... | Python | 0.997763 | @@ -930,22 +930,22 @@
1)%0A
-c
ou
-nts
+tput
= lines
@@ -1002,33 +1002,8 @@
-output = counts.collect()
%0A
|
548edcb10ef949d394388282d052da36135982d7 | Add coveralls support[5]. | build.py | build.py | #!/usr/bin/python
import os
import shutil
from subprocess import call
import sys
import platform
cur_path = os.getcwd()
build_path = os.getcwd() + "/build"
if platform.system() == 'Windows':
build_path = os.getcwd() + "/win_build"
if 'test' in sys.argv:
os.chdir(build_path)
r = call(["make tests"], shell=... | Python | 0 | @@ -1295,32 +1295,73 @@
%22%5D, shell=True)%0A
+ if %22-DTRAVIS=1%22 not in sys.argv:%0A
call(%5B%22make
|
2a3ba559d3aaa191a58de6868ad019ab7f8b8189 | Fix for building with under Windows | build.py | build.py | #!/usr/bin/python
"""
/*
This file is part of Bohrium and copyright (c) 2012 the Bohrium
team <http://www.bh107.org>.
Bohrium 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... | Python | 0 | @@ -3249,32 +3249,73 @@
= False%0A if
+not sys.platform.startswith('win32') and
os.geteuid() ==
|
df41dcb3c8538e482bcc61f9817ce26569652b6b | build script set user data for git | build.py | build.py | # -*- coding: utf-8 -*-
import os
import sh
from logging_service import __version__ as version
def open_file(path):
return open(path, 'r+')
def get_git(repo_path):
return sh.git.bake(_cwd=repo_path)
def main():
file_build = open_file('build_version')
lines = file_build.readlines()
build_vers... | Python | 0.000001 | @@ -91,16 +91,74 @@
ersion%0A%0A
+GIT_USER = 'circle-ci'%0AGIT_EMAIL = 'vitomarti@gmail.com'%0A%0A
%0Adef ope
@@ -262,24 +262,162 @@
epo_path)%0A%0A%0A
+def set_user_data_git(git):%0A git('config', '--global', 'user.email', GIT_EMAIL)%0A git('config', '--global', 'user.name', GIT_USER)%0A%0A%0A
def main():%0A... |
54b8e07ac412e757fb32ebfa19b75ef8a72f6688 | Print build path | build.py | build.py | #!/usr/bin/env python
import sys
import os
from argparse import ArgumentParser
from subprocess import check_call, check_output
def ensure_tool(name):
check_call(['which', name])
def build_and_publish(path, args):
login_command = get_login_command(args)
print >>sys.stderr, "Test anaconda.org login:"
... | Python | 0.000001 | @@ -436,16 +436,72 @@
.strip()
+%0A print %3E%3Esys.stderr, %22build path %7B%7D%22.format(binfile)
%0A%0A pr
|
d0315abc9ace94d767a1533cd7f2b669381c2e50 | tag bug fixed | kwueBackend/kwue/models/models.py | kwueBackend/kwue/models/models.py | from django.db import models
from unixtimestampfield.fields import UnixTimeStampField
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from mptt.models import MPTTModel, TreeForeignKey
from kwue.helper_functions.time_helpers import show_date
imp... | Python | 0.000001 | @@ -4453,17 +4453,16 @@
l==%22food
-_
model%22:%0A
|
00e68cff5e7d370e137383b4e0c3c774ddb4c929 | update metadata | l10n_br_sale_stock/__openerp__.py | l10n_br_sale_stock/__openerp__.py | # -*- coding: utf-8 -*-
###############################################################################
# #
# Copyright (C) 2013 Raphaël Valyi - Akretion #
# Copyright (C) 2013 Renato Lima - Akretion ... | Python | 0.000001 | @@ -1975,91 +1975,8 @@
l',%0A
-%3C%3C%3C%3C%3C%3C%3C HEAD%0A=======%0A #'test/sale_order_demo.yml'%0A%3E%3E%3E%3E%3E%3E%3E comment data file%0A
|
3d52e82a295c7c7d6b77d81a1d2c6ac0929bb120 | make sqlitecache bundable. | sqlite_cache/__init__.py | sqlite_cache/__init__.py | from sqlite_cache.core import SQLiteCache # pragma: no cover
| Python | 0 | @@ -2,20 +2,48 @@
rom
-sqlite_cache
+__future__ import absolute_import%0A%0Afrom
.cor
|
05d7bf2dd9a92ade3ca0cf909cdb49be0c67cb23 | use python3 in safe_exec | codejail/safe_exec.py | codejail/safe_exec.py | """Safe execution of untrusted Python code."""
import six
import logging
import os.path
import shutil
import sys
import textwrap
try:
import simplejson as json
except ImportError:
import json
from codejail import jail_code
from codejail.util import temp_directory, change_directory
log = logging.getLogger(_... | Python | 0.000083 | @@ -3144,23 +3144,22 @@
exec
-
+(
code
- in
+,
g_dict
+)
%0A
@@ -3298,14 +3298,8 @@
int,
- long,
flo
@@ -3310,17 +3310,8 @@
str,
- unicode,
lis
@@ -3669,12 +3669,8 @@
ict.
-iter
item
|
962322fd385bcfcc670ead757190d37955ccda14 | improve logging and add ros params | lg_earth/src/lg_earth/kmlalive.py | lg_earth/src/lg_earth/kmlalive.py | import subprocess
import rospy
import rosservice
import traceback
import sys
class KmlAlive:
def __init__(self, earth_proc):
self.earth_proc = earth_proc
rospy.loginfo("XXX starting KMLALIVE process")
rospy.Timer(rospy.Duration(10), self.keep_alive, oneshot=True)
# only restart whe... | Python | 0 | @@ -216,16 +216,151 @@
ocess%22)%0A
+ self.timeout_period = rospy.get_param(~timeout_period, 5)%0A self.initial_timeout = rospy.get_param(~initial_timeout, 60)%0A
@@ -2089,17 +2089,35 @@
unter %3E
-5
+self.timeout_period
and sel
@@ -2139,18 +2139,36 @@
unter %3E
-60
+self.initial_timeout
... |
f672da20640b761d47d5c15d791e06fc5e25fd35 | Fix Deprecation warning in Django 1.9 | bootstrap3/utils.py | bootstrap3/utils.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from django.forms.widgets import flatatt
from django.template import Variable, VariableDoesNotExist, Template, Context
from django.template.base import FilterExpression, kwarg_re, TemplateSyntaxError
from django.template.loader import get_templ... | Python | 0.000067 | @@ -69,16 +69,43 @@
ort re%0A%0A
+from django import VERSION%0A
from dja
@@ -169,17 +169,82 @@
ort
-Variable,
+(Context, RequestContext, Template, Variable,%0A
Var
@@ -264,27 +264,9 @@
xist
-, Template, Context
+)
%0Afro
@@ -295,16 +295,17 @@
import
+(
FilterEx
@@ -317,18 +317,8 ... |
67d421a5c0e59554f0e4b8a94250668194789205 | Fix source in pool instrumentation. | inbox/ignition.py | inbox/ignition.py | import time
import weakref
import gevent
from socket import gethostname
from urllib import quote_plus as urlquote
from sqlalchemy import create_engine, event
from inbox.sqlalchemy_ext.util import ForceStrictMode
from inbox.config import config
from inbox.util.stats import statsd_client
from nylas.logging import get_lo... | Python | 0 | @@ -3097,16 +3097,90 @@
gnition'
+,%0A 'nylas.logging'
%5D)%0A
|
cd19d61dcc3290f323e449a42ada0e351e1b4819 | Fix bug preventing EAS accounts from being authed. | inbox/util/url.py | inbox/util/url.py | from dns.resolver import Resolver, NoNameservers
from urllib import urlencode
import logging as log
import re
# http://www.regular-expressions.info/email.html
EMAIL_REGEX = re.compile(r'[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}',
re.IGNORECASE)
# Use Google's Public DNS server (8.8.8.8)
dns_resolver = Resolver(... | Python | 0.000001 | @@ -4497,16 +4497,30 @@
yahoo'%0A%0A
+ else:%0A
retu
@@ -4522,20 +4522,21 @@
return
-None
+'eas'
%0A%0A%0A# Fro
|
60690c178f3adb5a2e05e4960e3b142dbf6c1aad | update cache | cache.py | cache.py | import json as json
def cache_json(func, key_prefix='', expire=0, expire_at='', redis_client=None):
"""key_prefix should be unique at module level within the redis db,
func name & all arguments would also be part of the key.
redis_client: it's thread safe.
to avoid giving `redis_client` param every t... | Python | 0.000001 | @@ -1,12 +1,27 @@
+import inspect%0A
import json
@@ -28,16 +28,68 @@
as json%0A
+from functools import wraps%0Afrom hashlib import md5%0A
%0A%0Adef ca
@@ -180,16 +180,47 @@
_prefix
+is optional.%0A if use, it
should b
@@ -272,14 +272,30 @@
%0A
+ __module__ &
func
-
+_
name
@@ -615,16 +615,33 @@... |
c40376c36312e582704b4fafbc36f4b17171394f | switch to using selectors | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by roadhump
# Copyright (c) 2014 roadhump
#
# License: MIT
#
"""This module exports the ESLint plugin class."""
import logging
import re
from SublimeLinter.lint import NodeLinter
logger = logging.getLogger('SublimeLi... | Python | 0.000002 | @@ -425,44 +425,8 @@
%22%22%0A%0A
- syntax = ('javascript', 'html')%0A
@@ -830,16 +830,15 @@
-selector
+default
s =
@@ -848,20 +848,24 @@
'
-html
+selector
': 'sour
@@ -873,22 +873,53 @@
e.js
-.embedded.html
+ - meta.attribute-with-value, text.html.basic
'%0A
|
d927e5dbf7820ad0e48006d9b2042b62c04bd310 | Update regex | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Clifton Kaznocha
# Copyright (c) 2014 Clifton Kaznocha
#
# License: MIT
#
"""This module exports the Flow plugin class."""
import os
from SublimeLinter.lint import Linter
class Flow(Linter):
"""Provides an in... | Python | 0.000002 | @@ -545,36 +545,59 @@
#
-Find the line number and col
+Warning location and optional title for the message
%0A
@@ -601,17 +601,16 @@
-%5E
/.+/(?P%3C
@@ -652,25 +652,25 @@
%3E%5Cd+),%5Cd+:%5Cs
-*
+?
(?P%3Cmessage1
@@ -672,14 +672,18 @@
sage
-1%3E.+)$
+_title%3E.*)
%5Cr?%5C
@@ -699,30 +699,17 @@
... |
6a9d6d30dc7ea207e2f4d8179a5ef99a95fce4e5 | Fix bug in ListingGenerator with limit=None. | praw/models/listinggenerator.py | praw/models/listinggenerator.py | from .prawmodel import PRAWModel
class ListingGenerator(PRAWModel):
"""Instances of this class generate ``RedditModels``"""
def __init__(self, reddit, url, limit=100, params=None):
"""Initialize a ListingGenerator instance.
:param reddit: An instance of :class:`.Reddit`.
:param url: ... | Python | 0 | @@ -1326,24 +1326,51 @@
%0A if
+self.limit is not None and
self.yielded
|
bf7562d9f45a777163f2ac775dc9cf4afe99a930 | Change 'language' to 'syntax', that is more precise terminology. | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Aparajita Fishman
# Copyright (c) 2013 Aparajita Fishman
#
# Project: https://github.com/SublimeLinter/SublimeLinter-contrib-jshint
# License: MIT
#
"""This module exports the JSHint plugin linter class."""
from Sub... | Python | 0.002004 | @@ -435,16 +435,14 @@
-language
+syntax
= (
|
cea40608a1efe16310c7b978fba40abcde26ced4 | make flake8 happy | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Dan Flettre
# Copyright (c) 2015 Dan Flettre
#
# License: MIT
#
"""This module exports the Semistandard plugin class."""
from SublimeLinter.lint import NodeLinter, util
class Semistandard(NodeLinter):
"""Prov... | Python | 0 | @@ -264,14 +264,8 @@
nter
-, util
%0A%0A%0Ac
|
9bfe8cd21931c69d79657aa275be02af21ec78f1 | Simplify `cmd` property | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Bartosz Kruszczynski
# Copyright (c) 2015 Bartosz Kruszczynski
#
# License: MIT
#
"""This module exports the Reek plugin class."""
from SublimeLinter.lint import RubyLinter
import re
class Reek(RubyLinter):
""... | Python | 0 | @@ -543,16 +543,8 @@
= '
-ruby -S
reek
@@ -638,40 +638,8 @@
rb'%0A
- version_args = '-S reek -v'%0A
|
d20d035516f279b00deeae9ad55d3540f02eaf33 | Fix deprecation warnings | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Fred Callaway
# Copyright (c) 2015 Fred Callaway
# Copyright (c) 2017 FichteFoll <fichtefoll2@googlemail.com>
#
# License: MIT
#
"""This module exports the Mypy plugin class."""
import logging
import os
import shuti... | Python | 0.00011 | @@ -2478,59 +2478,20 @@
-settings = self.get_view_settings()%0A
if not
+self.
sett
@@ -2552,24 +2552,16 @@
ing_dir(
-settings
)%0A
|
153a4dfaa5ecdd2a257a7e8d4e079bf7b6264956 | fix serializer | project/apps/api/serializers.py | project/apps/api/serializers.py | from rest_framework import serializers
from .models import (
Convention,
Contest,
Contestant,
Group,
Performance,
Note,
)
from django.contrib.auth import get_user_model
User = get_user_model()
class PerformanceSerializer(serializers.ModelSerializer):
round = serializers.CharField(
... | Python | 0.000003 | @@ -4215,16 +4215,19 @@
district
+_fk
= seria
@@ -4237,62 +4237,27 @@
ers.
-CharField(%0A source='get_district_display',%0A
+StringRelatedField(
)%0A%0A
@@ -4464,16 +4464,19 @@
district
+_fk
',%0A
|
68293b6075ead70651924761e4e3187286ad6765 | Add the proper tests user/pass. | integration_tests/test_basic_page_loads.py | integration_tests/test_basic_page_loads.py | from django.contrib.auth.models import User
from django.test import testcases
from django.test.client import Client
class Fail(testcases.TestCase):
def setUp(self):
super(Fail, self).setUp()
u = User(username='john_doe')
u.set_password('password')
u.is_superuser = True
u.s... | Python | 0 | @@ -683,38 +683,40 @@
%7B'username': '
-ivailo
+john_doe
', 'password': '
@@ -711,32 +711,32 @@
password': '
-Heman3f5
+password
'%7D)%0A
@@ -1085,38 +1085,40 @@
%7B'username': '
-ivailo
+john_doe
', 'password': '
@@ -1113,32 +1113,32 @@
password': '
-Heman3f5
+password
'%7D)%0A
@@ -1363,14 ... |
1b048e5c4504d31fe001651468b95b31a3ce5255 | update cron job | clock.py | clock.py | import os
import sys
from argparse import ArgumentParser
from datetime import date
from apscheduler.schedulers.blocking import BlockingScheduler
from flask import Flask, request, abort
from linebot import (
LineBotApi, WebhookParser
)
from linebot.exceptions import (
... | Python | 0.000001 | @@ -3435,27 +3435,8 @@
00)%0A
- global my_date%0A
@@ -3473,16 +3473,21 @@
days=1)%0A
+ %0A
#@sched.
|
005c684b88e6383aabe5294bfa0104ba4fb3ed40 | Use the fancier tmp_file management in tests | test/ops/test_index.py | test/ops/test_index.py | """
Tests for index operations
"""
from unittest import TestCase
import os
import xarray as xr
import pandas as pd
import numpy as np
from datetime import datetime
from cate.ops import index
from cate.ops import subset
def assert_dataset_equal(expected, actual):
# this method is functionally equivalent to
... | Python | 0 | @@ -70,16 +70,27 @@
port os%0A
+import sys%0A
import x
@@ -101,16 +101,16 @@
y as xr%0A
-
import p
@@ -169,16 +169,101 @@
datetime
+%0Aimport tempfile%0Aimport shutil%0Afrom contextlib import contextmanager%0Aimport itertools
%0A%0Afrom c
@@ -572,16 +572,388 @@
ctual)%0A%0A
+_counter = itertools.count()%0AON_WIN... |
759a6994441c35400965beea19e6425b377cf4e8 | add datetime_format | cloud.py | cloud.py | # coding: utf-8
import leancloud
from leancloud import Engine
from leancloud import LeanEngineError
from app import app
from logentries import LogentriesHandler
import logging
from qiniu import Auth
from qiniu import BucketManager
import requests
import os
import json
import time
engine = Engine(app)
log = logg... | Python | 0.002308 | @@ -700,16 +700,219 @@
_url')%0A%0A
+# local_time = time.localtime()%0A# # day_stamp = time.strftime(%22%25Y-%25m-%25d%22)%0A# day_stamp = '20161013'%0A# collection = db%5B'realtime_quotes_'+day_stamp%5D%0Adatetime_format = %22%25Y-%25m-%25d %25H:%25M:%25S%22%0A%0Agranularity =10%0A%0A
def cach
|
853dc8de1d077494c707a5ec8a6b75ac0e0628cf | Add trailing slash to URL for consistency. | cadorsfeed/views.py | cadorsfeed/views.py | from werkzeug import redirect, Response
from werkzeug.exceptions import NotFound
from cadorsfeed.utils import expose, url_for, db
from parse import parse
from fetch import fetchLatest, fetchReport
@expose('/report/latest')
def latest_report(request):
if 'latest' in db:
latestDate = db['latest']
else:
... | Python | 0 | @@ -214,16 +214,17 @@
t/latest
+/
')%0Adef l
|
cb50a43435de4e3b62324d1b738f3775cabe7367 | Fix reverse url in RecentChangesFeed | candidates/feeds.py | candidates/feeds.py | from __future__ import unicode_literals
import re
from django.contrib.sites.models import Site
from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
from django.utils.feedgenerator import Atom1Feed
from django.utils.text import slugify
from django.utils.translation import uget... | Python | 0.999993 | @@ -859,225 +859,35 @@
-m = lock_re.search(item.source)%0A if m:%0A return %22%7B0%7D - %7B1%7D%22.format(%0A m.group(1),%0A item.action_type%0A )%0A else:%0A return %22%7B0%7D - %7B1%7D%22.format(%0A
+return %22%7B0%7D - %7B1%7D%22.... |
63caf1fceb94d185e73858c2b58c82bf5912b7c4 | Add documentation for coding formatter | beetsplug/hook.py | beetsplug/hook.py | # This file is part of beets.
# Copyright 2015, Adrian Sampson.
#
# 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, ... | Python | 0 | @@ -971,120 +971,526 @@
-def __init__(self, coding):%0A self._coding = coding%0A%0A def format(self, format_string, *args, **kwargs):
+%22%22%22A custom string formatter that decodes the format string and it's%0A fields.%0A %22%22%22%0A%0A def __init__(self, coding):%0A %22%22%22Creates ... |
847d9c4a1e88b9e00a3be082db635743866a8abd | Fix tests | catalog/__init__.py | catalog/__init__.py | from os import environ
from flask import Flask
from flask_wtf.csrf import CSRFProtect
from flask_sqlalchemy import SQLAlchemy
DB_URL = 'postgresql:///catalog' + ('_test' if environ.get('ENV') == 'test' else '')
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = DB_URL
app.config['SQLALCHEMY_TRACK_MODIFICA... | Python | 0.000003 | @@ -44,47 +44,8 @@
ask%0A
-from flask_wtf.csrf import CSRFProtect%0A
from
@@ -312,16 +312,96 @@
y(app)%0A%0A
+if environ.get('ENV') != 'test':%0A from flask_wtf.csrf import CSRFProtect%0A
csrf = C
@@ -413,16 +413,20 @@
otect()%0A
+
csrf.ini
@@ -431,12 +431,75 @@
nit_app(app)
+%0Aelse:%0A app.jinja_... |
31fd889ec6d8851ce61085b0cbd15b86195905a8 | remove unused imports | test/scripts/window.py | test/scripts/window.py | #!/usr/bin/env python
"""
This program is carefully crafted to exercise a number of corner-cases in
Qtile.
"""
from __future__ import print_function
import sys
import time
import struct
import xcffib
import xcffib.xproto
try:
from StringIO import StringIO # Python 2
except ImportError:
from io import St... | Python | 0.000001 | @@ -177,22 +177,8 @@
ime%0A
-import struct%0A
impo
@@ -212,118 +212,8 @@
oto%0A
-try:%0A from StringIO import StringIO # Python 2%0Aexcept ImportError:%0A from io import StringIO # Python 3%0A%0A
%0Adef
|
7d26429acac78b2b1388a5d069d807038038bd1c | Add a folded indicator | examples/gui_integration/python_editor.py | examples/gui_integration/python_editor.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# PCEF - Python/Qt Code Editing Framework
# Copyright 2013, Colin Duquesnoy <colin.duquesnoy@gmail.com>
#
# This software is released under the LGPLv3 license.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, ... | Python | 0.000001 | @@ -1166,16 +1166,83 @@
5, 28))%0A
+ fi = FoldingIndicator(50, 60)%0A fi.state = fi.FOLDED%0A
@@ -1283,32 +1283,10 @@
tor(
-FoldingIndicator(50, 60)
+fi
)%0A
|
147a24ea0ba9da03b3774b7993e20e785776e027 | Use sys.nstates in stead of using A.shape[0] | control/passivity.py | control/passivity.py | '''
Author: Mark Yeatman
Date: May 15, 2022
'''
from . import statesp as ss
import numpy as np
import cvxopt as cvx
def is_passive(sys):
'''
Indicates if a linear time invarient system is passive
Constructs a linear matrix inequality and a feasibility optimization
such that is a solution exists, t... | Python | 0.000008 | @@ -825,18 +825,19 @@
e =
-A.shape%5B0%5D
+sys.nstates
%0A
|
b8e556871ff4aff9b85c67cc010814a0e6f60386 | Add new constants and change existing file names. | const.py | const.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module defines constant values for the ScrambleSuit protocol.
While some values can be changed, in general they should not. If you do not
obey, be at least careful because the protocol could easily break.
"""
# FIXME - Directory where long-lived information is ... | Python | 0 | @@ -261,16 +261,165 @@
k.%0A%22%22%22%0A%0A
+# Length of the HMAC used to authenticate the ticket.%0AHMAC_KEY_LENGTH = 32%0A%0A# Length of the AES key used to encrypt the ticket.%0AAES_KEY_LENGTH = 16%0A%0A
# FIXME
@@ -470,16 +470,16 @@
stored.%0A
-
DATA_DIR
@@ -758,16 +758,47 @@
(1 %3C%3C 2)
+%0AFLAG_PRNG_SEED =... |
84bcae49475d0d0ce0c14d671b363c488d93bb9f | Add skip reason | fmriprep/workflows/bold/tests/test_util.py | fmriprep/workflows/bold/tests/test_util.py | ''' Testing module for fmriprep.workflows.bold.util '''
import pytest
import os
import numpy as np
from nipype.utils.filemanip import fname_presuffix
from nilearn.image import load_img
from ..util import init_bold_reference_wf
def symmetric_overlap(img1, img2):
mask1 = load_img(img1).get_data() > 0
mask2 = l... | Python | 0.000001 | @@ -612,16 +612,100 @@
ARGETS')
+,%0A reason='FMRIPREP_REGRESSION_%7BSOURCE,TARGETS%7D env vars not set'
)%0A@pytes
|
ae0a02ed13c42537dae9ae9909ea310bb9ee1a10 | remove unused config change detection code | ceilometer/agent.py | ceilometer/agent.py | #
# Copyright 2013 Intel Corp.
# Copyright 2014 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 applica... | Python | 0.000005 | @@ -605,23 +605,8 @@
se.%0A
-import hashlib%0A
impo
@@ -693,19 +693,8 @@
tch%0A
-import six%0A
impo
@@ -1366,36 +1366,8 @@
conf
-%0A self.cfg_loc = None
%0A%0A
@@ -1548,37 +1548,32 @@
e):%0A
-self.
cfg_loc = cfg_fi
@@ -1593,37 +1593,32 @@
se:%0A
-self.
cfg_loc = self.c
@@ -164... |
f6efc8ee2e026dcc1bdad9d52afff8a489784eb1 | correct commissions | compfipy/portfolio.py | compfipy/portfolio.py | """
portfolio.py
Define a specifc group of Assets along with functions that pertain to the portfolio.
### Portfolio
- [x] Aggregate specific Assets in Table
- [x] keep track of positions
- [x] keep track of fees
- [x] keep track of cost
- [x] keep track of value
- [x] Enter and Exit position
- [ ] ???Rebalance whole ... | Python | 0.000006 | @@ -1997,24 +1997,25 @@
ons %22%22%22%0A
+%0A
self.tra
@@ -2010,33 +2010,19 @@
-self.trades%5Bsymbol%5D%5Bdate%5D
+trade_price
= a
@@ -2064,18 +2064,18 @@
ate%5D + m
-in
+ax
(commiss
@@ -2083,16 +2083,20 @@
on_min,
+abs(
commissi
@@ -2107,16 +2107,110 @@
amount)
+)%0A%0A self.cash = se... |
2a030ce151cdb6eaaa3933bd7f958edf658ab209 | Make the parent directory part of the Python path for custom management commands to work. | manage.py | manage.py | #!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ... | Python | 0 | @@ -15,16 +15,77 @@
python%0A
+import os%0Aimport sys%0Asys.path.append(os.path.abspath(%22..%22))%0A%0A
from dja
|
0feb5947af0dacc53ba624723593dd88b0b4653a | Fix shop creation | byceps/services/shop/shop/service.py | byceps/services/shop/shop/service.py | """
byceps.services.shop.shop.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from typing import Optional
from ....database import db
from ....typing import PartyID
from .models import Shop as DbShop
from .transfer.models impo... | Python | 0.000001 | @@ -414,24 +414,34 @@
op = DbShop(
+party_id,
party_id)%0A%0A
|
c0e903c3dab9fea0594d023ab9c049ca408bd9a4 | Cover text: outlined | cover.py | cover.py |
from PIL import Image, ImageDraw, ImageFont
from io import BytesIO
import textwrap
def make_cover(title, author, width=600, height=800, fontname="Helvetica", fontsize=40, bgcolor=(120, 20, 20), textcolor=(255, 255, 255), wrapat=30):
img = Image.new("RGBA", (width, height), bgcolor)
draw = ImageDraw.Draw(img)... | Python | 0.999509 | @@ -504,32 +504,128 @@
, font=font)%0A
+ draw_text_outlined(draw, ((width - title_size%5B0%5D) / 2, 100), title, textcolor, font=font)%0A #
draw.text(((wid
@@ -804,30 +804,45 @@
nt)%0A draw
-.
+_
text
-(
+_outlined(draw,
((width - au
@@ -922,40 +922,8 @@
t)%0A%0A
- draw = ImageDraw.Draw(img)%0A%0A
... |
99bfdd1f038865a3558e212777b0a5641d87c170 | Add report types to NEA. | inspectors/nea.py | inspectors/nea.py | #!/usr/bin/env python
import datetime
import logging
import os
import re
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from utils import utils, inspector
# http://arts.gov/oig
# Oldest report: 2005
# options:
# standard since/year options for a year range to fetch from.
# report_id: only bother... | Python | 0 | @@ -704,11 +704,20 @@
S =
-%5B
+%7B
%0A
+ %22audit%22:
AUD
@@ -733,16 +733,30 @@
S_URL,%0A
+ %22evaluation%22:
SPECIAL
@@ -770,16 +770,37 @@
S_URL,%0A
+ %22semiannual_report%22:
SEMIANN
@@ -817,16 +817,31 @@
S_URL,%0A
+ %22peer_review%22:
PEER_RE
@@ -852,16 +852,25 @@
S_URL,%0A
+ %22fisma%22:
FISM... |
91a8c5312c58edff070915fc5d182b35f60ef0fa | allow for error recovery in cases where a file sync fails. | sync-dropbox-to-ftp.py | sync-dropbox-to-ftp.py | #!/usr/bin/env python3
"""The initial options file should look like:
{
"state": { "cursor": null },
"options": {
"ftp": {
"auth": { "host": "FTP_HOST", "user": "FTP_USER", "passwd": "FTP_PASSWORD" },
"path": "FTP_DIRECTORY_NAME"
},
"dropbox": {
"auth": { "access_token": "ACCESS_TOKEN... | Python | 0 | @@ -93,16 +93,28 @@
r%22: null
+, %22left%22: %5B%5D
%7D,%0A %22o
@@ -2554,27 +2554,79 @@
th'%5D)%0A
-added_files
+left, state%5B'left'%5D = state%5B'left'%5D, %5B%5D%0A if not left:%0A left
, state%5B
@@ -2767,21 +2767,27 @@
in
-added_files:%0A
+left:%0A try:%0A
@@ -2812,16 +2812,18 @@
byt... |
5f15ad2da19cc3872b5e6fbbaa5db8b902cef720 | Revert "we don't want this commit" | manage.py | manage.py | #!/usr/bin/env python
"""
Usage: manage.py {lms|cms} [--settings env] ...
Run django management commands. Because edx-platform contains multiple django projects,
the first argument specifies which project to run (cms [Studio] or lms [Learning Management System]).
By default, those systems run in with a settings file ... | Python | 0 | @@ -3238,58 +3238,8 @@
ine%0A
- # this is a commited changed,that we dont want
%0A
|
8c233868e82a6828d21574b0d488699c1c7b1443 | Update test_ValueType.py | cairis/cairis/test/test_ValueType.py | cairis/cairis/test/test_ValueType.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | Python | 0.000001 | @@ -1294,23 +1294,12 @@
0%5D%5B%22
-vulnerability_t
+theT
ype%22
@@ -1418,14 +1418,10 @@
%5B%22th
-reat_t
+eT
ype%22
|
278c7817120370c22cad2e56471e7d1673312e3e | Use functools.wraps rather than manually setting __name__ | curry.py | curry.py | from inspect import signature, isclass
import sys
import unittest
def get_arg_count(fun):
if isclass(fun):
return len(signature(fun.__call__).parameters)
else:
return len(signature(fun).parameters)
def curry(fun):
arg_count = get_arg_count(fun)
def curried(*old_args, **old_kwargs):
... | Python | 0 | @@ -1,8 +1,36 @@
+from functools import wraps%0A
from ins
@@ -298,16 +298,36 @@
nt(fun)%0A
+ %0A @wraps(fun)
%0A def
@@ -427,24 +427,52 @@
old_kwargs%0A
+ %0A @wraps(fun)
%0A def
@@ -686,51 +686,8 @@
gs%0A%0A
- _inner.__name__ = fun.__name__%0A
@@ -864,97 +864,22 @@... |
7cac8f8ba591315d68e223503c4e93f976c8d89d | Set default race and class without extra database queries | characters/views.py | characters/views.py | from django.shortcuts import get_object_or_404, redirect, render
from characters.forms import CharacterForm
from characters.models import Character, Class, Race
def index(request):
all_characters = Character.objects.all()
context = {'all_characters': all_characters}
return render(request, 'characters/ind... | Python | 0 | @@ -687,88 +687,8 @@
):%0A%0A
- race = Race.objects.get(id=1)%0A cclass = Class.objects.get(id=1)%0A%0A
@@ -836,13 +836,13 @@
race
-=race
+_id=1
,%0A
@@ -865,15 +865,13 @@
lass
-=cclass
+_id=1
%0A
|
daabf57935c9bec91ee4ce0bcd4713790fe928ea | use celery | daily.py | daily.py | from totalimpactwebapp.user import User
from totalimpactwebapp import db
import datetime
import tasks
"""
requires these env vars be set in this environment:
DATABASE_URL
"""
def page_query(q):
offset = 0
while True:
r = False
for elem in q.limit(100).offset(offset):
r = True
... | Python | 0.000618 | @@ -536,18 +536,16 @@
%0A
- #
tasks.a
@@ -577,46 +577,8 @@
er)%0A
- tasks.add_profile_deets(user)%0A
%0A%0Ade
|
a2cc8a5e6009bda68edf85a432d9a8ec002e99a1 | Fix #80 | adapter/__init__.py | adapter/__init__.py | import sys
PY2 = sys.version_info[0] == 2
if PY2:
is_string = lambda v: isinstance(v, basestring)
to_lldb_str = lambda s: s.encode('utf8', 'backslashreplace')
from_lldb_str = lambda s: s.decode('utf8', 'replace')
xrange = xrange
else:
is_string = lambda v: isinstance(v, str)
to_lldb_str = str
... | Python | 0.000001 | @@ -96,16 +96,82 @@
string)%0A
+ # python2-based LLDB accepts utf8-encoded ascii strings only.%0A
to_l
@@ -222,24 +222,57 @@
ashreplace')
+ if isinstance(s, unicode) else s
%0A from_ll
|
8c73f52d180e602b79031228367411fe9610b856 | Fix mcp tests. | scikits/image/graph/tests/test_mcp.py | scikits/image/graph/tests/test_mcp.py | import numpy as np
from numpy.testing import *
import scikits.image.graph.mcp as mcp
a = np.ones((8,8), dtype=np.float32)
a[1:-1, 1] = 0
a[1, 1:-1] = 0
## array([[ 1., 1., 1., 1., 1., 1., 1., 1.],
## [ 1., 0., 0., 0., 0., 0., 0., 1.],
## [ 1., 0., 1., 1., 1., 1., 1., 1.],
## ... | Python | 0 | @@ -1711,28 +1711,25 @@
ed_costs = n
-umpy
+p
.where(a==1,
@@ -2042,28 +2042,25 @@
test_neg = n
-umpy
+p
.where(a==1,
@@ -2083,20 +2083,17 @@
_inf = n
-umpy
+p
.where(a
|
537e3855e0d4d323844b711c3f72bef21eaa565c | Update streets_helper.py | cea/datamanagement/streets_helper.py | cea/datamanagement/streets_helper.py | """
This script extracts streets from Open street maps
"""
from __future__ import division
from __future__ import print_function
import os
import osmnx as ox
from geopandas import GeoDataFrame as Gdf
import cea.config
import cea.inputlocator
from cea.utilities.standardize_coordinates import get_projected_coordinate_... | Python | 0.000003 | @@ -3902,365 +3902,35 @@
-This is the main entry point to your script. Any parameters used by your script must be present in the %60%60config%60%60%0A parameter. The CLI will call this %60%60main%60%60 function passing in a %60%60config%60%60 object after adjusting the configuration%0A to reflect parameters... |
2930d355421ed3804d5c675fad20c82f27066d7e | Support numpy 1.9 | chainer/functions/array/broadcast.py | chainer/functions/array/broadcast.py | import six
from chainer import cuda
from chainer import function
from chainer.utils import type_check
def _backward_one(x, g):
if g is None:
xp = cuda.get_array_module(x)
return xp.zeros_like(x)
if g.ndim != x.ndim:
g = g.sum(axis=tuple(range(g.ndim - x.ndim)))
# An input var... | Python | 0.00004 | @@ -2805,46 +2805,279 @@
-return xp.broadcast_to(x, self._shape)
+if hasattr(xp, 'broadcast_to'):%0A return xp.broadcast_to(x, self._shape),%0A else:%0A # numpy 1.9 doesn't support broadcast_to method%0A dummy = xp.empty(self._shape)%0A bx, _ = xp.broadcast_array... |
65202bc31623d4bf16bb60a5d6084c8215f01c7d | fix bug in layor | script/suntomorrow/train_predictor.py | script/suntomorrow/train_predictor.py | #!/usr/bin/env python
"""Chainer example: autoencoder of a solar image.
"""
# c.f.
# http://nonbiri-tereka.hatenablog.com/entry/2015/06/21/220506
# http://qiita.com/kenmatsu4/items/99d4a54d5a57405ecaf8
import argparse
import numpy as np
import operator
import re
import six
import subprocess
import random
import cha... | Python | 0 | @@ -2520,17 +2520,17 @@
el.convA
-2
+3
(hm2)),
@@ -2668,17 +2668,17 @@
el.convV
-2
+3
(hz3)),
|
460aabe9184f220f9444599f6352c0fd12db26cb | convert expiration to string | batch.py | batch.py | from datetime import datetime, timedelta
import json
import celery
from emails import send_email
from pytz import timezone
import requests
import stripe
from helpers import amount_to_charge
from salesforce import SalesforceConnection
from config import STRIPE_KEYS
from config import ACCOUNTING_MAIL_RECIPIENT
from co... | Python | 0.999999 | @@ -2994,24 +2994,28 @@
n_date__c':
+str(
charge.sourc
@@ -3025,16 +3025,17 @@
xp_month
+)
+ ' / '
@@ -3037,16 +3037,20 @@
' / ' +
+str(
charge.s
@@ -3063,16 +3063,17 @@
exp_year
+)
,%0A
|
dc50a4ec058f9893e87a069bc64e4715ecfa0bea | Add initial status code assertion | haas_rest_test/plugins/assertions.py | haas_rest_test/plugins/assertions.py | # -*- coding: utf-8 -*-
# Copyright (c) 2014 Simon Jagoe
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the 3-clause BSD license. See the LICENSE.txt file for details.
from __future__ import absolute_import, unicode_literals
class StatusCodeAssertion(object):
_sche... | Python | 0.000004 | @@ -271,60 +271,510 @@
ls%0A%0A
-%0Aclass StatusCodeAssertion(object):%0A%0A _schema = %7B
+from jsonschema.exceptions import ValidationError%0Aimport jsonschema%0A%0Afrom ..exceptions import YamlParseError%0A%0A%0Aclass StatusCodeAssertion(object):%0A%0A _schema = %7B%0A '$schema': 'http://json-schema.or... |
b9ea36d80ec256988a772e621eb91481cff5e464 | Bump version to 0.3 | cicoclient/shell.py | cicoclient/shell.py | # Copyright Red Hat, 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... | Python | 0 | @@ -934,17 +934,17 @@
sion='0.
-2
+3
',%0A
|
79323b06acebed5243b7d40364497c72751441e3 | Add example of creating a ioctl read helper function. | ioctl/__init__.py | ioctl/__init__.py | import ctypes
import ctypes.util
import fcntl
import os
import sys
# In Python 2, the bytearray()-type does not support the buffer interface,
# and can therefore not be used in ioctl().
# This creates a couple of helper functions for converting to and from
if sys.version_info < (3, 0):
import array
def _to_by... | Python | 0 | @@ -2705,16 +2705,347 @@
ioctl().
+%0A%0A :Example:%0A ::%0A%0A import os%0A import ioctl%0A import ioctl.linux%0A RNDGETENTCNT = ioctl.linux.IOR('R', 0x00, ctypes.c_int)%0A rndgetentcnt = ioctl.ioctl_fn_ptr_r(RNDGETENTCNT, ctypes.c_int)%0A fd = os.open('/d... |
6d41c4f58c94367f922117b52fcd15a131e96344 | implement Patent.classes | lib/new_xml_parsing/xml_driver.py | lib/new_xml_parsing/xml_driver.py | #!/usr/bin/env python
from itertools import chain
from collections import deque
from xml.sax import make_parser, handler
class ChainList(list):
"""
This is the base structure that handles the tree created by XMLElement
and XMLHandler. Overriding __getattr__ allows us to chain queries on
a list in orde... | Python | 0.000017 | @@ -4223,15 +4223,360 @@
ms')%5B0%5D%0A
-%0A
+ self.classes = self._classes()%0A%0A def _classes(self):%0A main = self.xml.classification_national.contents_of('main_classification')%0A further = self.xml.classification_national.contents_of('further_classification')%0A it = %5Bx%5B0%5D for x in (... |
591b974d0630ff26c82ede7652fc667dbf3fef2e | Remove unused import | test/test_gatherbot.py | test/test_gatherbot.py | import re
import unittest
from unittest import mock
import discord
from .helper import async_test, get_mock_coro
from gather.gatherbot import GatherBot
class TestGatherBotCommands(unittest.TestCase):
def test_register(self):
bot = GatherBot()
self.assertEqual({}, bot.actions)
regex = r'^te... | Python | 0.000001 | @@ -49,23 +49,8 @@
ock%0A
-import discord%0A
from
|
561de1d124289058eafde34547e8fc773c3e9793 | Rename strips to d_strips | board.py | board.py |
import direction_strips as ds_m
from pente_exceptions import *
from defines import *
class Board():
def __init__(self, size, clone_it=False):
self.size = size
if not clone_it:
self.set_to_empty()
def set_to_empty(self):
self.strips = [] # TODO Rename to d_strips
se... | Python | 0.999681 | @@ -261,24 +261,26 @@
self.
+d_
strips = %5B%5D
@@ -282,34 +282,8 @@
= %5B%5D
- # TODO Rename to d_strips
%0A
@@ -284,32 +284,34 @@
%5B%5D%0A self.
+d_
strips.append(ds
@@ -347,32 +347,34 @@
))%0A self.
+d_
strips.append(ds
@@ -411,32 +411,34 @@
))%0A self.
+d_
strips.append(ds... |
62e9510fe2fbe3186c7c817a5c287322a65b1dc9 | Fix linearPotential import to new package structure | galpy/potential/IsothermalDiskPotential.py | galpy/potential/IsothermalDiskPotential.py | ###############################################################################
# IsothermalDiskPotential.py: class that implements the one-dimensional
# self-gravitating isothermal disk
###############################################################################
import numpy
from gal... | Python | 0.000022 | @@ -314,66 +314,8 @@
rom
-galpy.util import bovy_conversion%0Afrom galpy.potential_src
.lin
|
1e012f6fc25e2be5bc55b7cae9f04a3a33ac86e5 | use static url for ckeditor media serving | ckeditor/widgets.py | ckeditor/widgets.py | from django import forms
from django.conf import settings
from django.core.urlresolvers import reverse
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
from django.utils.html import conditional_escape
from django.utils.encoding import force_unicode
from django.utils impo... | Python | 0 | @@ -876,33 +876,31 @@
ngs.
-CKEDITOR_MEDIA_PREFIX + '
+STATIC_URL + 'ckeditor/
cked
|
b927fe276af848b6c9a4653e04421a739e63037c | remove unused import | test/test_graphprot.py | test/test_graphprot.py | from scripttest import TestFileEnvironment
import re
import os
# from filecmp import cmp
bindir = "graphprot/"
script = "graphprot_seqmodel"
# test file environment
datadir = "test/"
testdir = "test/testenv_graphprot_seqmodel/"
# directories relative to test file environment
bindir_rel = "../../" + bindir
datadir_rel ... | Python | 0.000001 | @@ -50,18 +50,8 @@
re%0A
-import os%0A
# fr
|
c04bd5e52b4a516e31f98231cc6ccb7853040d2b | fix bad middleware arg | corehq/middleware.py | corehq/middleware.py | import logging
import os
import datetime
from django.conf import settings
try:
import psutil
except ImportError:
psutil = None
# this isn't OR specific, but we like it to be included
OPENROSA_ACCEPT_LANGUAGE = "HTTP_ACCEPT_LANGUAGE"
OPENROSA_VERSION_HEADER = "HTTP_X_OPENROSA_VERSION"
OPENROSA_DATE_HEADER = "... | Python | 0.000169 | @@ -2759,17 +2759,16 @@
), extra
-s
=%7B'durat
|
3eac07253f843384247b5dde6cd2a3ed2c362ffd | Add test case for static user sheet | tests/frontend/user/test_basic_actions.py | tests/frontend/user/test_basic_actions.py | from flask import url_for
from pycroft import config
from pycroft.model import session
from pycroft.model.user import User
from pycroft.model.facilities import Room
from tests.fixtures import permissions
from tests.fixtures.dummy import user as dummy_user_fixtures, facilities
from . import UserFrontendTestBase, Legacy... | Python | 0 | @@ -5211,8 +5211,499 @@
pass%0A
+%0A def test_static_datasheet(self):%0A endpoint = url_for('user.static_datasheet', user_id=self.user.id)%0A response = self.client.get(endpoint)%0A self.assertTrue(response.data.startswith(b%22%25PDF%22))%0A self.assert200(response)%0A self.ass... |
db3e3dd65c50b58e1a371f3d60be209d1322cfb9 | Remove extra "Disconnected" message from console stub | host/python/keyglove_stub_console.py | host/python/keyglove_stub_console.py | #!/usr/bin/env python
"""
================================================================================
Keyglove host control console demo application
2014-12-06 by Jeff Rowberg <jeff@rowberg.net>
Changelog:
2014-12-06 - Initial release
=========================================================================... | Python | 0.000001 | @@ -5510,18 +5510,41 @@
!= None
+ and keyglove.connected
:%0A
-
@@ -5594,32 +5594,36 @@
%0A if
+not
keyglove.disconn
@@ -5633,64 +5633,8 @@
():%0A
- print(%22Disconnected%22)%0A else:%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.