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 |
|---|---|---|---|---|---|---|---|
f8239afefa436b9da5e01416cdc5dcadd058a51f | Update models | app/models.py | app/models.py | from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from app import db
class User(UserMixin, db.Model):
"""This class represents the user table."""
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.Str... | Python | 0 | @@ -1,12 +1,40 @@
+import datetime%0A%0Aimport jwt%0A
from flask_l
@@ -128,16 +128,46 @@
ord_hash
+%0Afrom flask import current_app
%0A%0Afrom a
@@ -954,32 +954,42 @@
ef password(self
+, password
):%0A self.
@@ -1019,37 +1019,32 @@
e_password_hash(
-self.
password)%0A%0A d
@@ -1119,24 +1119,29 @@
sh(s... |
52f945b55bb804cef808c7d8ac62712cd9cc5afb | print bias avalue as well | code/similarity.py | code/similarity.py | """ This module implements the idea of finding out emotions similarities
by using the experiments similar to what Hinton describes in his NRelu paper."""
import restrictedBoltzmannMachine as rbm
import numpy as np
import theano
from theano import tensor as T
from common import *
from similarity_utils import *
thean... | Python | 0 | @@ -4302,16 +4302,47 @@
_value()
+%0A print triner.b.get_value()
%0A%0A def
|
23865e7155974dbc9a9be3d9e6c51ed7b96200ea | add next to profile form | poweredsites/forms/profile.py | poweredsites/forms/profile.py | # -*- coding: utf-8 -*-
#
# Copyright(c) 2010 poweredsites.org
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | Python | 0 | @@ -1101,24 +1101,80 @@
_http=True)%0D
+%0A next = validators.String(not_empty=False, max=600)%0D
%0A%0D%0A def _
|
2ac4385cffe2d999273f592778f7a4fd51e97672 | Specifiy what capacity to use if it is not a number. SPOT-2226 | spacescout_web/org_filters/uw_search.py | spacescout_web/org_filters/uw_search.py | from spacescout_web.org_filters import SearchFilter
class Filter(SearchFilter):
def url_args(self, args):
search_args = []
if self.request.path != u'/':
request_parts = self.request.path.split('/')
campus = request_parts[1]
if len(request_parts) > 2:
... | Python | 0.999993 | @@ -1429,12 +1429,43 @@
-pass
+search_args.append(%7B'capacity': 1%7D)
%0A
|
fd929cd7792424dea9c309882afc713c0a863d2b | Add todo | src/blame.py | src/blame.py | import os
import subprocess
from urllib.parse import parse_qs, quote_plus, urlparse
import sublime
import sublime_plugin
from .templates import blame_phantom_css, blame_phantom_html_template
from .util import communicate_error, platform_startupinfo, view_is_suitable
class Blame(sublime_plugin.TextCommand):
PHA... | Python | 0.000002 | @@ -5513,32 +5513,145 @@
rase_phantoms()%0A
+ # @todo Fix 2 key presses being needed to show a phantom again after closing it was closed using %5Bx%5D%0A
else:%0A
|
79cb55efa06b87fd999fa23a8d54bed4231b2967 | fix some shallow bugs in submission.py ensemble | code/submission.py | code/submission.py | from __future__ import print_function
import grasp
import ensemble
import importlib
import sys
import os
import subprocess
from multiprocessing import Process
import yaml
import json
with open("SETTINGS.json") as file:
config = json.load(file)
with open("final_nets.yml") as file:
all_net_kwargs = yaml.load(f... | Python | 0.000001 | @@ -5813,38 +5813,8 @@
e%22:%0A
- assert 1 == 0%0A
@@ -5864,22 +5864,23 @@
ig%5B%22
-submission_dir
+SUBMISSION_PATH
%22%5D,
@@ -5930,24 +5930,74 @@
= %5B
-x%5B%22output_path%22%5D
+os.path.join(config%5B%22SUBMISSION_PATH%22%5D, x%5B%22output_name%22%5D) + '.csv'
for
|
c22d4f5aa412b6aa624212bf5728c94fbef5d375 | Modify attributes for Bucketlist Model, Modify relationship between User model and Bucketlist Model | app/models.py | app/models.py | from datetime import datetime
from passlib.apps import custom_app_context as pwd_context
from app import db
class User(db.Model):
"""This class represents the users database table."""
__tablename__ = "users"
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(255), unique=Tru... | Python | 0 | @@ -915,17 +915,17 @@
s Bucket
-l
+L
ist(db.M
@@ -1029,17 +1029,16 @@
cketlist
-s
'%0A%0A i
@@ -1173,16 +1173,17 @@
ey(%22user
+s
.id%22))%0A
|
560e5ac6134f30797d72c8bfe70a442ecacf210a | Return 0 in __dirs_content_valid, to be fixed | pilot/test/test_copytools_mv.py | pilot/test/test_copytools_mv.py | #!/usr/bin/env python
# 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
#
# Authors: Pavlo Svirin <pavlo.svirin@gmail.com>
import unittest
import str... | Python | 0.000015 | @@ -5822,24 +5822,85 @@
tent=None):%0A
+ return 0%0A # currently this fails: need to fix%0A
if d
|
f14941252136fc64bb1e96b104705102f11017cf | add index kw param. | processor/emblem_processor.py | processor/emblem_processor.py | import logging
import multiprocessing
import operator
from itertools import repeat
import pymongo
from mapreduce.driver import MapReduceDriver
from mapreduce.emblem_finals import EmblemFinals
from mapreduce.emblem_freq import EmblemFreq
from nlp.emblem import Emblem
from processor.data_source import MongoDataSource
... | Python | 0 | @@ -4219,24 +4219,46 @@
ld_name)))%0A%0A
+ if index:%0A
self
@@ -4328,32 +4328,36 @@
e=True)%0A
+
self.data_source
@@ -4414,16 +4414,20 @@
+
+
field =
@@ -4459,24 +4459,28 @@
%5B1%5D%0A
+
+
if isinstanc
@@ -4503,24 +4503,28 @@
+
for key... |
4ceb0b3cb2b952a491b4173313559c7b4bc06c2b | Update __init__.py | editorsnotes/__init__.py | editorsnotes/__init__.py | __version__ = '2.0.1'
VERSION = __version__
| Python | 0.000072 | @@ -12,11 +12,11 @@
= '
-2.0
+0.2
.1'%0A
|
10f5bd8a80bb949371611d271380ecd041a950b6 | Configure for github pages | doc/conf.py | doc/conf.py | # -*- coding: utf-8 -*-
# Copyright (c) 2010, 2011, Sebastian Wiesner <lunaryorn@googlemail.com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the... | Python | 0.000001 | @@ -44,16 +44,22 @@
0, 2011,
+ 2012,
Sebasti
@@ -2663,16 +2663,324 @@
ptiks'%0A%0A
+%0Adef configure_github_pages(app, exc):%0A if app.builder.name == 'html':%0A # inhibit github pges site processor%0A open(os.path.join(app.outdir, '.nojekyll'), 'w').close()%0A with open(os.path.join(app.out... |
053785b92dc925b27ba036a2b560ab509180fd1e | Add Lowdown to Sphinx extensions load list. | doc/conf.py | doc/conf.py | # :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
'''Lucidity documentation build configuration file'''
import os
import re
# -- General ------------------------------------------------------------------
# Extensions
extensions = [
'sphinx.ext.autodoc',
... | Python | 0 | @@ -393,16 +393,30 @@
wcode',%0A
+ 'lowdown'%0A
%5D%0A%0A# The
|
d800a1d5636e9ec886ce25910106ef43e1361f7c | Update copyright year. | doc/conf.py | doc/conf.py | # -*- coding: utf-8 -*-
#
# Moulder documentation build configuration file, created by
# sphinx-quickstart on Sun Dec 14 11:15:19 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't picklea... | Python | 0 | @@ -1426,17 +1426,17 @@
2009-201
-0
+2
, Sali L
|
4806cda6f2615b7f8766ac43f52fc88f0dd20ccb | tag doc version as 1.0.6 as well | doc/conf.py | doc/conf.py | # -*- coding: utf-8 -*-
#
# execnet documentation build configuration file, created by
# sphinx-quickstart on Wed Sep 30 21:16:59 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | Python | 0 | @@ -1628,17 +1628,17 @@
= %221.0.
-5
+6
%22%0A# The
|
202533ab5505d833da8db582cf3a971cb853fdbd | Use main program source code to detect Tkinter relevance. | nuitka/plugins/standard/TkinterPlugin.py | nuitka/plugins/standard/TkinterPlugin.py | # Copyright 2019, Jorj McKie, mailto:lorj.x.mckie@outlook.de
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in comp... | Python | 0 | @@ -1196,16 +1196,62 @@
Options%0A
+from nuitka.utils.Utils import isWin32Windows%0A
from nui
@@ -4857,23 +4857,24 @@
and
-os.name == %22nt%22
+isWin32Windows()
%0A%0A
@@ -4883,34 +4883,34 @@
def onModule
-Discovered
+SourceCode
(self, modul
@@ -4902,32 +4902,50 @@
ode(self, module
+_name, source_code
):%0A ... |
2d8644d5cc0085db4615de6bfabdd024a6a19469 | fix demo issue | comb/demo/redis.py | comb/demo/redis.py | # -*- coding: utf-8 -*-
import comb.slot
import comb.mq.redis as RedisHelper
import redis
class Slot(comb.slot.Slot):
def initialize(self):
"""
This block is execute before thread initial
Example::
class UserSlot(Slot):
def initialize(self,*args,**kwargs):
... | Python | 0 | @@ -663,18 +663,19 @@
Helper.p
-op
+ush
(self.db
@@ -834,35 +834,34 @@
= RedisHelper.p
-ush
+op
(self.db,'mq1')%0A
|
379ae8c6dc026ff33d28b4df00e5d435fc4fc85a | FIX depends | account_invoice_control/__openerp__.py | account_invoice_control/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pu... | Python | 0.000001 | @@ -1134,15 +1134,24 @@
: %5B'
-account
+sale', 'purchase
'%5D,%0A
|
889159bf9f8d8a067ad0e7c740b68f73da83ef6c | test some floats too. | activitysim/abm/test/test_skims.py | activitysim/abm/test/test_skims.py | from collections import OrderedDict
from future.utils import iteritems
import numpy as np
import pytest
from activitysim.abm.tables import skims
@pytest.fixture(scope="session")
def matrix_dimension():
return 5922
@pytest.fixture(scope="session")
def num_of_matrices():
return 845
@pytest.fixture(scope="... | Python | 0 | @@ -1779,8 +1779,220 @@
on ** 2%0A
+%0A%0Adef test_multiple_large_floats():%0A calculated_value = skims.multiply_large_numbers(%5B6205.1, 5423.2, 932.4, 15.4%5D)%0A actual_value = 483200518316.9472%0A assert abs(calculated_value - actual_value) %3C 0.0001
|
6deb49a633415c7379459ff04b711a404a41eaab | fix the comment for the API inconsistency | acplugins4python/ac_server_protocol.py | acplugins4python/ac_server_protocol.py | from ac_server_helpers import *
ACSP_NEW_SESSION = 50
ACSP_NEW_CONNECTION = 51
ACSP_CONNECTION_CLOSED = 52
ACSP_CAR_UPDATE = 53
ACSP_CAR_INFO = 54 # Sent as response to ACSP_GET_CAR_INFO command
ACSP_LAP_COMPLETED = 73
ACSP_CLIENT_EVENT = 130
ACSP_CE_COLLISION_WITH_CAR = 10
ACSP_CE_COLLISION_WITH_ENV = 1... | Python | 0.003609 | @@ -2492,38 +2492,36 @@
nt type than Car
-Update
+Info
%0D%0A ('carS
@@ -2560,38 +2560,36 @@
nt type than Car
-Update
+Info
%0D%0A )%0D%0A %0D%0Ac
@@ -2833,30 +2833,28 @@
ype than Car
-Update
+Info
%0D%0A ('
@@ -2905,22 +2905,20 @@
than Car
-Update
+Info
%0D%0A )%0D
|
387e0729ea7c92920f15abcc04eaa52a320447fd | return url for eval. | job.py | job.py | import lib.search.bing_search as bing
import lib.tweet.parseTwitter as twitter
from lib.querygen.tweets2query import QueryGenerator
import lib.summarization.tagdef as tagdef
from lib.summarization import extractor
import string
import logging
logging.basicConfig(level=logging.INFO)
logger = logging
def main():
i... | Python | 0.000001 | @@ -977,22 +977,19 @@
return
-result
+url
s%0A%0A d
|
e4649b40ee5ba1bb9c7d43acb4e599b210f9dd4a | Rename test and function to a more appropriate ones. | php4dvd/test_deletefilm.py | php4dvd/test_deletefilm.py | # -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
import unittest
class AddFilm(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
self.driver.implicitly_wait(10)
self.base_url = "http://hub.wart.ru/"
... | Python | 0 | @@ -138,11 +138,14 @@
ass
-Add
+Delete
Film
@@ -407,11 +407,14 @@
est_
-add
+delete
film
|
4644a70f20901f221fe307adc94d7cfb9059649a | Bump version | pytablereader/__version__.py | pytablereader/__version__.py | # encoding: utf-8
from datetime import datetime
__author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016-{}, {}".format(datetime.now().year, __author__)
__license__ = "MIT License"
__version__ = "0.23.0"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| Python | 0 | @@ -205,17 +205,17 @@
= %220.23.
-0
+1
%22%0A__main
|
c4a77bf510bf23e25f259aaae8c1effa65e45a85 | fix bug when trying to get a slice (of pizza) | python/ccxtpro/base/cache.py | python/ccxtpro/base/cache.py | import collections
class Delegate:
def __init__(self, name):
self.name = name
def __get__(self, instance, owner):
return getattr(instance, self.name)
class ArrayCache(list):
# implicitly called magic methods don't invoke __getattribute__
# https://docs.python.org/3/reference/datamod... | Python | 0.000002 | @@ -506,50 +506,8 @@
_')%0A
- __getitem__ = Delegate('__getitem__')%0A
@@ -1152,12 +1152,309 @@
lf) + other%0A
+%0A def __getitem__(self, item):%0A deque = super(list, self).__getattribute__('_deque')%0A if isinstance(item, slice):%0A start, stop, step = item.indices(len(deque))%0... |
49396a7964de09c60459ec1ed3e91890e212100c | fix travis | python/mxnet/lr_scheduler.py | python/mxnet/lr_scheduler.py | """
learning rate scheduler, which adaptive changes the learning rate based on the
progress
"""
import logging
class LRScheduler(object):
"""Base class of a learning rate scheduler"""
def __init__(self):
"""
base_lr : float
the initial learning rate
"""
self.base_lr ... | Python | 0.000002 | @@ -3606,24 +3606,16 @@
step)-1:
-
%0A
|
8b7cf7cab92d4b4b5cfdc4f905eac07129737fc3 | Add tip on how to disable Ray OOM handler (#14017) | python/ray/memory_monitor.py | python/ray/memory_monitor.py | import logging
import os
import platform
import sys
import time
# Import ray before psutil will make sure we use psutil's bundled version
import ray # noqa F401
import psutil # noqa E402
logger = logging.getLogger(__name__)
def get_rss(memory_info):
"""Get the estimated non-shared memory usage from psutil mem... | Python | 0 | @@ -2031,16 +2031,120 @@
uster.%5Cn
+%22%0A %22--- To disable OOM exceptions, set %22%0A %22RAY_DISABLE_MEMORY_MONITOR=1.%5Cn
---%5Cn%22)%0A
@@ -4935,16 +4935,17 @@
if
+(
%22RAY_DEB
@@ -4984,17 +4984,16 @@
.environ
-:
%0A
@@ -5005,57 +5005,82 @@
-return # escape h... |
6f42122bc4b8ae8a287f0350eba4d8cd2f5f9649 | correct the ConfigSessionError exception name. | python/vyos/configsession.py | python/vyos/configsession.py | # configsession -- the write API for the VyOS running config
# Copyright (C) 2019 VyOS maintainers and contributors
#
# This library is free software; you can redistribute it and/or modify it under the terms of
# the GNU Lesser General Public License as published by the Free Software Foundation;
# either version 2.1 of... | Python | 0 | @@ -2497,15 +2497,21 @@
ise
-VyOSAPI
+ConfigSession
Erro
|
07fa886690539d097b212375598d7ca3239664ba | Make option group items appear the same in the cart as text options for consistency | shop_simplevariations/cart_modifier.py | shop_simplevariations/cart_modifier.py | #-*- coding: utf-8 -*-
from shop.cart.cart_modifiers_base import BaseCartModifier
from shop_simplevariations.models import CartItemOption, CartItemTextOption
class ProductOptionsModifier(BaseCartModifier):
'''
This modifier adds an extra field to the cart to let the lineitem "know"
about product options an... | Python | 0.000015 | @@ -814,24 +814,63 @@
= (
+'%25s: %22%25s%22' %25 (text_opt.text_
option
-_obj
.name,
+text_opt.text),
pri
|
8ebba5de25de289046bdca46f1613a337f1aacbf | Improve CommentForm tests | amy/extcomments/tests.py | amy/extcomments/tests.py | from django.test import TestCase
import django_comments
from workshops.models import Organization, Person
class TestEmailFieldRequiredness(TestCase):
def test_email_field_requiredness(self):
"""Regression test for #1944.
Previously a user without email address would not be able to add a comment.... | Python | 0 | @@ -26,16 +26,48 @@
estCase%0A
+from django.urls import reverse%0A
import d
@@ -349,16 +349,17 @@
ent.%22%22%22%0A
+%0A
@@ -380,21 +380,33 @@
-person = Pers
+organization = Organizati
on.o
@@ -436,51 +436,72 @@
-personal=%22Ron%22,%0A family=%22Weasley
+domain=%22example.org%22,%0A ... |
afbc63d29a23170d17ce18e0c39a403de974aede | Use of websockets for the episodes listing | app/handlers/__init__.py | app/handlers/__init__.py | __author__ = 'roland'
| Python | 0 | @@ -16,8 +16,97 @@
oland'%0A%0A
+from handlers.mainhandler import MainHandler%0Afrom handlers.showhandler import ShowHandler
|
36f2c75f177b076ce54cb1d056b715edb15377f8 | Bump app version number. | app/handlers/__init__.py | app/handlers/__init__.py | __version__ = "2015.7.3"
__versionfull__ = __version__
| Python | 0 | @@ -19,9 +19,9 @@
5.7.
-3
+4
%22%0A__
|
dd791f210379907b909c1a52492a380d17c88058 | add arguments | compressandmove.py | compressandmove.py | #!/usr/bin/env python
# file.py Code
#
# Copyright (c) Jose M. Molero
#
# All rights reserved.
#
# MIT License
#
# 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, includin... | Python | 0.000006 | @@ -1549,16 +1549,619 @@
ameters%0A
+ if len(args.localresource) %3C 1 or len(args.storageaccount) %3C 1 or %5C%0A len(args.container) %3C 1:%0A raise ValueError('invalid positional arguments')%0A if args.upload and args.download:%0A raise ValueError('cannot force transfer direction of d... |
e17efc67e20e1db1f11c00853dd26da250e3655e | add access rule for event_moodle | addons/event_moodle/__openerp__.py | addons/event_moodle/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | Python | 0.000001 | @@ -1532,16 +1532,60 @@
iew.xml'
+,%0A 'security/ir.model.access.csv'
%0A
|
647830063534043afa7d93a0d151e59f9f826557 | Fix reward calculation for randomized positions in skat_dqn.py. | open_spiel/python/examples/skat_dqn.py | open_spiel/python/examples/skat_dqn.py | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... | Python | 0.997305 | @@ -3019,32 +3019,37 @@
me_step.rewards%5B
+eval_
player_pos%5D%0A
|
cf3e84add9cb87f0baf742e4cf1304356c57de9e | add test for RandomSlugField.db_type | randomslug/tests/__init__.py | randomslug/tests/__init__.py | """
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
from django.db import models
import re
from randomslug.models import *
from randomslug.validators impo... | Python | 0 | @@ -3136,8 +3136,256 @@
.slug))%0A
+ %0A def test_slug_db_type(self):%0A slugfield = RandomSlugField()%0A self.assertEqual(slugfield.db_type(None), 'varchar(10)')%0A slugfield = RandomSlugField(5)%0A self.assertEqual(slugfield.db_type(None), 'varchar(5)')%0A
|
c30f2ba581e0fea43124e8804f45ab8fa9dca94a | Use sfh_marginal in androcmd/phatpatchfit/majoraxplot.py | androcmd/phatpatchfit/majoraxplot.py | androcmd/phatpatchfit/majoraxplot.py | # encoding: utf-8
"""
Tools for plotting SFR along the major axis.
2015-07-01 - Created by Jonathan Sick
"""
import matplotlib as mpl
import numpy as np
from .analysistools import marginalize_metallicity
from .sfrplots import scale_sfr, lin_scale_sfr
def select_patches(dataset):
"""Patch keys that lie along th... | Python | 0.000001 | @@ -153,59 +153,8 @@
np%0A%0A
-from .analysistools import marginalize_metallicity%0A
from
@@ -1721,77 +1721,122 @@
-logage, sfr = marginalize_metallicity(dataset%5B'patches'%5D%5Bk%5D, fit_key)
+t = np.array(dataset%5B'patches'%5D%5Bk%5D%5B'sfh_marginal'%5D%5Bfit_key%5D)%0A logage = t%5B'log(age)'%5D%0A ... |
ea8ea2e6203ee6cb7580444207446c0bb82f7239 | Add solution for Lesson_5_Analyzing_Data.10-Using_match_and_project. | Lesson_5_Analyzing_Data/10-Using_match_and_project/followers.py | Lesson_5_Analyzing_Data/10-Using_match_and_project/followers.py | #!/usr/bin/env python
"""
Write an aggregation query to answer this question:
Of the users in the "Brasilia" timezone who have tweeted 100 times or more,
who has the largest number of followers?
The following hints will help you solve this problem:
- Time zone is found in the "time_zone" field of the user object in e... | Python | 0 | @@ -1817,17 +1817,403 @@
line = %5B
-
+%7B%22$match%22: %7B%22user.time_zone%22: %22Brasilia%22%7D%7D,%0A %7B%22$match%22: %7B%22user.statuses_count%22: %7B%22$gte%22: 100%7D%7D%7D,%0A %7B%22$project%22: %7B%22tweets%22: %22$user.statuses_count%22,%0A %22scre... |
93cc7c44efdd01c0e6d5a218301da7686b4f7289 | implement postmaster redirection | app/server.py | app/server.py | import requests
from salmon.routing import nolocking, route, stateless
from salmon.mail include MailResponse
from config import settings
import json
import logging
log = logging.getLogger(__name__)
log.level = logging.DEBUG
@route("postmaster@(domain)", inbox=".+", domain=".+")
@stateless
def forward_postmaster(mess... | Python | 0.000002 | @@ -63,16 +63,28 @@
tateless
+, route_like
%0Afrom sa
@@ -98,14 +98,13 @@
il i
-nclude
+mport
Mai
@@ -235,134 +235,185 @@
UG%0A%0A
-@route(%22postmaster@(domain)%22, inbox=%22.+%22, domain=%22.+%22)%0A@stateless%0Adef forward_postmaster(message, to=None, host=None):
+def forward_postmaster(message, domain):%0A ... |
da51d49904ff75621ff9ebb501e4612cfa0a3d86 | Trim more | juriscraper/pacer/case_query.py | juriscraper/pacer/case_query.py | import pprint
import re
import sys
from .docket_report import BaseDocketReport
from .reports import BaseReport
# from .utils import clean_pacer_object
from ..lib.log_tools import make_default_logger
from ..lib.string_utils import clean_string, harmonize, \
force_unicode
logger = make_default_logger()
class Case... | Python | 0 | @@ -11,18 +11,8 @@
int%0A
-import re%0A
impo
@@ -18,16 +18,16 @@
ort sys%0A
+
%0Afrom .d
@@ -441,149 +441,8 @@
%22%22%0A%0A
- docket_number_dist_regex = re.compile(%0A r%22((%5Cd%7B1,2%7D:)?%5Cd%5Cd-%5Ba-zA-Z%5D%7B1,4%7D-%5Cd%7B1,10%7D)%22)%0A%0A # PATH = 'n/beam/servlet/TransportRoom'%0A
@@ -66... |
11595f576a62a3c65f26113dfa06c72f768ad291 | Take '--help' as well as '-h' as hint to emit the usage output. | test/redo.py | test/redo.py | #!/usr/bin/env python
"""
A simple utility to redo the failed/errored tests.
You need to specify the session directory in order for this script to locate the
tests which need to be re-run.
See also dotest.py, the test driver running the test suite.
Type:
./dotest.py -h
for help.
"""
import os, sys, datetime
impo... | Python | 0.999999 | @@ -4304,16 +4304,56 @@
th('-h')
+ or sys.argv%5Bindex%5D.startswith('--help')
:%0A
|
9bc6675797c1e00438d467db1a64ade7a356cbd3 | Version bump to 0.5.2. | spec_cleaner/__init__.py | spec_cleaner/__init__.py | #!/usr/bin/env python
# vim: set ts=4 sw=4 et: coding=UTF-8
# Copyright (c) 2013, SUSE LINUX Products GmbH, Nuernberg, Germany
# All rights reserved.
# See COPYING for details.
__version__ = '0.5.1'
import os
import sys
import argparse
from rpmexception import RpmWrongArgs, RpmException
from rpmcleaner import RpmSp... | Python | 0 | @@ -191,17 +191,17 @@
= '0.5.
-1
+2
'%0A%0Aimpor
|
c398353e06f5a88130da9f01a1db00e4488a40a9 | support for loading 'faulty character set' session files | lib/core/target.py | lib/core/target.py | #!/usr/bin/env python
"""
$Id$
This file is part of the sqlmap project, http://sqlmap.sourceforge.net.
Copyright (c) 2007-2010 Bernardo Damele A. G. <bernardo.damele@gmail.com>
Copyright (c) 2006 Daniele Bellucci <daniele.bellucci@gmail.com>
sqlmap is free software; you can redistribute it and/or modify it under
th... | Python | 0 | @@ -4322,32 +4322,43 @@
onf.dataEncoding
+, 'replace'
)%0A __
|
a2169c737c21636cadb50bba3d5c6a25121a3efb | Fix test failures | spectral_cube/io/fits.py | spectral_cube/io/fits.py | from astropy.io import fits
from astropy.wcs import WCS
from astropy.extern import six
from astropy.utils import OrderedDict
from astropy.io.fits.hdu.hdulist import fitsopen as fits_open
from astropy.io.fits.util import first as first_hdu
import numpy as np
from .. import SpectralCube, StokesSpectralCube, LazyMask
f... | Python | 0.001261 | @@ -1,20 +1,37 @@
+import warnings%0A%0A
from astropy.io impo
@@ -201,62 +201,8 @@
pen%0A
-from astropy.io.fits.util import first as first_hdu%0A%0A%0A
%0Aimp
@@ -302,16 +302,70 @@
_utils%0A%0A
+def first(iterable):%0A return next(iter(iterable))%0A%0A
%0A# FITS
@@ -1877,12 +1877,8 @@
irst
-_dhu
(arr
@@ -247... |
cc12728d7160a10f0c182c0cccfde0fd15cadb75 | Add a reset function stub | spicedham/basewrapper.py | spicedham/basewrapper.py |
class BaseWrapper(object):
"""
A base class for backend plugins.
"""
def get_key(self, tag, key, default=None):
"""
Gets the value held by the tag, key composite key. If it doesn't exist,
return default.
"""
raise NotImplementedError()
def get_key_list(sel... | Python | 0 | @@ -76,16 +76,181 @@
%22%22%22%0A%0A
+ def reset(self, really):%0A %22%22%22%0A Resets the training data to a blank slate.%0A %22%22%22%0A if really:%0A raise NotImplementedError()%0A%0A%0A
def
@@ -844,18 +844,17 @@
elf, tag
-,
+_
key_valu
|
f6722960a33a51d0682c4c21a6e46d03f53b80f0 | simplify max_score calc more | app/models/golf_round.py | app/models/golf_round.py | from app import db
class GolfRound(db.Model):
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
tee_id = db.Column(db.Integer, db.ForeignKey('tee.id'))
date = db.Column(db.DateTime)
notes = db.Column(db.String(128))
total_score = db.Column... | Python | 0.000018 | @@ -956,835 +956,8 @@
f):%0A
- def calc_diff(self):%0A if self == self.user.get_rounds()%5B0%5D:%0A return self.total_score%0A old_handicap = self.user.get_previous_round(self).handicap_index%0A course_handicap = round(old_handicap * self.tee.slope / 113, 0)%0A ... |
b5f85e30ccabe198c939329e2bb847d34f0e1235 | Fix list.sort() argument passing | sqlalchemy_json/track.py | sqlalchemy_json/track.py | """This module contains the tracked object classes.
TrackedObject forms the basis for both the TrackedDict and the TrackedList.
A function for automatic conversion of dicts and lists to their tracked
counterparts is also included.
"""
import itertools
import logging
from six import iteritems
from sqlalchemy.ext.mut... | Python | 0.000413 | @@ -5974,16 +5974,12 @@
lf,
-cmp=None
+/, *
, ke
@@ -6073,17 +6073,8 @@
ort(
-cmp=cmp,
key=
|
ac1e5b9a2008b8ce125368cc3a3ed3f9efcc4c66 | Fix GitHub build URL | ci/lambdas/codebuild-callback-handler/lambda_function.py | ci/lambdas/codebuild-callback-handler/lambda_function.py | # Invoked by: SNS Subscription
# Returns: Error or status message
#
# Triggered after a CodeBuild run finishes and is responsible for updating
# the GitHub status, and sending some notifications.
import boto3
import traceback
import os
import zlib
import zipfile
import json
import re
import uuid
import urllib.request
... | Python | 0.021504 | @@ -1009,17 +1009,16 @@
https://
-$
%7B0%7D.cons
@@ -1063,9 +1063,8 @@
lds/
-$
%7B1%7D/
|
64df3095505b5651626536e08810edfb282b888b | Fix introduced bug in creating the list of bases | kdotp_symmetry/_symmetric_hamiltonian.py | kdotp_symmetry/_symmetric_hamiltonian.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Dominik Gresch <greschd@gmx.ch>
from collections import namedtuple
import sympy as sp
from sympy.physics.quantum import TensorProduct
import numpy as np
import scipy.linalg as la
from fsc.export import export
from ._expr_utils import expr_to_vector, monomial... | Python | 0 | @@ -3568,16 +3568,25 @@
basis =
+np.array(
mat.null
@@ -3613,16 +3613,26 @@
implify)
+).tolist()
%0A
|
4334610f0e25647e81d7769b664ac58e3c754093 | Remove some unneccessary packages from windows installer | buildmsi.py | buildmsi.py | #!/usr/bin/env python2.7
""" Build Windows MSI distributions.
Requirements:
- A 'windeps' folder with all of the *exe installers listed in
BINARY_PACKAGES, available at http://www.lfd.uci.edu/~gohlke/pythonlibs/
in both 32 and 64 bit.
- 'pywin32' installers for 32 and 64 bit in 'windeps' folder, , ... | Python | 0.000001 | @@ -2001,39 +2001,8 @@
%22),%0A
- SourceDep(%22pyusb%22, %22usb%22),%0A
@@ -2384,23 +2384,8 @@
e%22,%0A
- %22chdkptp%22,%0A
|
22f79d326a8c0cd6763a0a7262df51d9ef213f18 | Fix bug where required parameters were not correctly identified in Python2.7. | src/azure/cli/commands/_auto_command.py | src/azure/cli/commands/_auto_command.py | from __future__ import print_function
import inspect
import sys
from msrest.paging import Paged
from msrest.exceptions import ClientException
from azure.cli.parser import IncorrectUsageError
from ..commands import COMMON_PARAMETERS
EXCLUDED_PARAMS = frozenset(['self', 'raw', 'custom_headers', 'operation_config'])
cla... | Python | 0 | @@ -4241,34 +4241,31 @@
d =
-False if default else True
+arg not in arg_defaults
%0A%0A
|
8659ffef5dab72bb81764ecc286f4324e3c5b03b | Use Issue class for dh_groups analysis | analysis.py | analysis.py | import datetime
import enum
import math
import os
import subprocess
import tempfile
from algorithms import *
from sshmessage import *
def score(issues):
max_score = {}
for issue in issues:
if issue.what in max_score:
max_score[issue.what] = max(max_score[issue.what], issue.severity.value)... | Python | 0 | @@ -4319,32 +4319,38 @@
issues.append(
+Issue(
Severity.error,
@@ -4394,16 +4394,17 @@
, group)
+)
%0A
@@ -4457,16 +4457,22 @@
.append(
+Issue(
Severity
@@ -4522,24 +4522,25 @@
its%22, group)
+)
%0A%0A ( inpu
|
425b1ac925ecc2aeae8dff358b1054c9824fa4f0 | Reorganize code in analyzer.py | analyzer.py | analyzer.py | # push-analyzer, A script for analyzing git pushes
# Copyright (c) 2014 firecoders
#
# 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 righ... | Python | 0.000001 | @@ -1261,52 +1261,8 @@
):%0A
- changes = %5B%5D%0A changes_overview = %5B%5D%0A%0A
@@ -1675,32 +1675,50 @@
.decode () %7D )%0A%0A
+ changes = %5B%5D%0A%0A
for sha in r
@@ -2220,120 +2220,29 @@
-if utils.get_diff ( sha_pre, sha_post ).decode () == '':%0A changes_overview.append ( 'sam... |
0205db84f05c0914abe4b6e14d824de2777f60cd | Monitor unreleased version count. | allmychanges/management/commands/send_stats.py | allmychanges/management/commands/send_stats.py | import os
import datetime
from pprint import pprint
from django.core.management.base import BaseCommand
from twiggy_goodies.django import LogMixin
from django.conf import settings
from allmychanges.utils import graphite_send
from allmychanges.models import Package, Changelog, Version, User
from django.utils import tim... | Python | 0 | @@ -2367,24 +2367,279 @@
v2').count()
+%0A %0A stats%5B'db.versions.v1-unreleased'%5D = Version.objects.filter(code_version='v1', unreleased=True).exclude(changelog__filename=None).count()%0A stats%5B'db.versions.v2-unreleased'%5D = Version.objects.filter(code_version='v2', unreleased=True).count()
%0A%0A ... |
8ab04ee3710a248cdc84c85a76797a298212f4f3 | Use click.echo instead of print (#117) | alertaclient/commands/cmd_query.py | alertaclient/commands/cmd_query.py |
import json
import click
from tabulate import tabulate
from alertaclient.models.alert import Alert
from alertaclient.utils import build_query, DateTime
COLOR_MAP = {
'critical': {'fg': 'red'},
'major': {'fg': 'magenta'},
'minor': {'fg': 'yellow'},
'warning': {'fg': 'blue'},
'normal': {'fg': 'gree... | Python | 0 | @@ -1372,13 +1372,18 @@
-print
+click.echo
(jso
@@ -1401,16 +1401,62 @@
alerts'%5D
+, sort_keys=True, indent=4, ensure_ascii=False
))%0A e
|
c2f2a294b3b513e83a2ea5bca09a13c255c51c88 | fix case when job has not lastBuild property | analyzer.py | analyzer.py | #!/usr/bin/python
import pprint
import re
import argparse
from datetime import datetime
from statsd import StatsClient
from utils import failureReasons, JenkinsClient
def is_build_failed(job):
if job['lastBuild']:
if job['lastBuild']['result'] == 'FAILURE':
return True
return Fals... | Python | 0.000008 | @@ -188,32 +188,100 @@
ed(job):%0A if
+'lastBuild' in job and job%5B'lastBuild'%5D is not None and 'result' in
job%5B'lastBuild'%5D
@@ -420,28 +420,24 @@
ob):%0A if
-job%5B
'lastBuild'%5D
@@ -427,33 +427,39 @@
if 'lastBuild'
-%5D
+ in job
:%0A build_
|
88cc2242ccd91d7574dab0f687c3a0c755a9a4aa | convert stock prices from strings to floats before saving/returning | analyzer.py | analyzer.py | import json, urllib2
from neuralNetwork import NN
def getHistoricalData(stockSymbol):
historicalPrices = []
# login to API
urllib2.urlopen("http://api.kibot.com/?action=login&user=guest&password=guest")
# get 10 days of data from API (business days only, could be < 10)
url = "http://api.kibo... | Python | 0.002193 | @@ -647,16 +647,22 @@
.append(
+float(
tempLine
@@ -665,16 +665,17 @@
Line%5B1%5D)
+)
%0A%0A re
@@ -917,16 +917,22 @@
n True%0A%0A
+print
getHisto
|
d629cf3dd99f02fe6f8627386b623ee2ef6da092 | update exception message when the index ayas count is not exact | src/alfanous/Indexing.py | src/alfanous/Indexing.py | # coding: utf-8
## Copyright (C) 2009-2012 Assem Chelli <assem.ch [at] gmail.com>
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU Affero General Public License as published
## by the Free Software Foundation, either version 3 of the License, or
... | Python | 0.000006 | @@ -3784,28 +3784,31 @@
f( %22
-number of ayas wrong
+Ayas count is not exact
%22, v
@@ -3868,16 +3868,18 @@
ur index
+es
%22 )%0A
|
ccdc17645440cf191f9cca27f32b2211fad4ccd0 | Load coordinates info into the main table | luigi/tasks/release/load_coordinates.py | luigi/tasks/release/load_coordinates.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by... | Python | 0 | @@ -1641,16 +1641,363 @@
e%0A);%0A$$%0A
+,%0A$$%0AINSERT INTO rnacen.rnc_coordinates AS t1 (%0A accession, primary_accession, local_start, local_end, strand, id%0A)%0ASELECT%0A accession, primary_accession, local_start, local_end, strand, NEXTVAL('rnc_coordinates_pk_seq')%0AFROM rnacen.load_rnc_coordinates as t2%0A ... |
d927932c47deb7ebae519183a4a7e3e440a3b69e | Fix KeyError in IQVIA (#49968) | homeassistant/components/iqvia/__init__.py | homeassistant/components/iqvia/__init__.py | """Support for IQVIA."""
import asyncio
from datetime import timedelta
from functools import partial
from pyiqvia import Client
from pyiqvia.errors import IQVIAError
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import ATTR_ATTRIBUTION
from homeassistant.core import callback
from h... | Python | 0 | @@ -946,24 +946,61 @@
g entry.%22%22%22%0A
+ hass.data.setdefault(DOMAIN, %7B%7D)%0A
coordina
|
e9bbb93177045b9f3f8a78d575fde07ecdf2c307 | Fix raw data url | api/urls.py | api/urls.py | from django.conf.urls import url
from django.views.decorators.csrf import csrf_exempt
from rest_framework.routers import DefaultRouter
from api import views
router = DefaultRouter()
# share routes
router.register(r'extras', views.ExtraDataViewSet, base_name=views.ExtraDataViewSet.serializer_class.Meta.model._meta.mo... | Python | 0.999523 | @@ -3137,17 +3137,16 @@
er(r'raw
-_
data', v
|
5722cac8dcacafa0a4b8d9f23f7f0a38a0632283 | Add support to specify an identity file for ssh connections | proxmoxer/backends/openssh.py | proxmoxer/backends/openssh.py | __author__ = 'Oleg Butovich'
__copyright__ = '(c) Oleg Butovich 2013-2015'
__licence__ = 'MIT'
from proxmoxer.backends.base_ssh import ProxmoxBaseSSHSession, BaseBackend
try:
import openssh_wrapper
except ImportError:
import sys
sys.stderr.write("Chosen backend requires 'openssh_wrapper' module\n")
s... | Python | 0 | @@ -583,35 +583,72 @@
sudo=False
+,%0A identity_file=None
):%0A
-
self.hos
@@ -858,16 +858,59 @@
= sudo%0A
+ self.identify_file = identity_file%0A
@@ -1193,16 +1193,106 @@
.timeout
+,%0A identify_file=self.identi... |
7bc245ba0079980bf55bfd6dcd630c9ae38310fc | Stop services instead of restarting them from stripdown | VMEncryption/main/oscrypto/encryptstates/UnmountOldrootState.py | VMEncryption/main/oscrypto/encryptstates/UnmountOldrootState.py | #!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2015 Microsoft Corporation
#
# 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
#
# U... | Python | 0 | @@ -2035,16 +2035,42 @@
service%22
+ in line or %22sshd.service%22
in line
@@ -2225,82 +2225,8 @@
%5B0%5D%0A
- self.context.logger.log(%22Restarting %7B0%7D%22.format(service))%0A
@@ -2278,23 +2278,20 @@
stemctl
-restart
+stop
%7B0%7D'.fo
|
ae2f12bf1dcd7ec1b1d7b5843b56fdc8df32a50e | gunicorn debug=False | config-gunicorn.py | config-gunicorn.py | #!/usr/bin/env python
import os
def numCPUs():
if not hasattr(os, 'sysconf'):
raise RuntimeError('No sysconf detected.')
return os.sysconf('SC_NPROCESSORS_ONLN')
bind = '127.0.0.1:8000'
workers = 4
worker_class = 'gevent'
debug = True
daemon = True
pidfile = '/tmp/gunicorn.pid'
logfile = '/tmp/gunic... | Python | 0.999639 | @@ -243,19 +243,20 @@
debug =
-Tru
+Fals
e%0Adaemon
|
d717cc604d26f3470af3c2f686d04ce7eb1ef1f3 | Generate proper contents for displaying a user profile page. | web_apps/game_support/src/local/view.py | web_apps/game_support/src/local/view.py | #!/usr/bin/env python
# ---------------------------------------------------------------------------------------------
"""
local/view.py
Copyright (c) 2015 Kevin Cureton
"""
# ---------------------------------------------------------------------------------------------
# -----------------------------------------------... | Python | 0.999062 | @@ -1817,38 +1817,39 @@
oute_name='view.
-create
+display
_user', request_
@@ -1948,32 +1948,231 @@
%22%22%22%0A
-results = dict()
+user_uid = request.matchdict%5B'user_uid'%5D%0A%0A results = dict()%0A results%5B'error'%5D = %22%22%0A%0A users_stash = local.stash.UsersStash()%0A user_info = users_st... |
ff6b9eddc27ee2b897ab20198d562ef1dfe257d5 | support get docker info | app/dash.py | app/dash.py | #!/usr/bin/env python3
# coding=utf-8
"""
@version:0.1
@author: ysicing
@file: blog/dash.py
@time: 2017/9/20 22:46
"""
from flask import Blueprint, render_template
dash = Blueprint('dash', __name__)
@dash.route('/dash/')
def dash_index():
return render_template('dash.html') | Python | 0 | @@ -163,122 +163,318 @@
late
-%0A%0Adash = Blueprint('dash', __name__)%0A%0A%0A@dash.route('/dash/')%0Adef dash_index():%0A return render_template('dash.html'
+,jsonify%0Afrom app.plugins.docker import DockerApi%0A%0Adash = Blueprint('dash', __name__)%0A%0Adocker = DockerApi(host=None, timeout=None)%0A%0A%0A@dash.r... |
95945f98b3c4689dc1fb5066f5102154cc4a6a28 | bump version | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name='vdist',
version='0.3.4',
description='Create OS packages from Python projects using Docker containers',
long_description='Create OS packages from Python projects using Docker containers',
author='L. Brouwer',
author_email='objectified@gma... | Python | 0 | @@ -84,9 +84,9 @@
0.3.
-4
+5
',%0A
|
2b28da0ee9c3a26e5d0bd7cebe56fece3585689a | Update file_opt_args | website/addons/osfstorage/decorators.py | website/addons/osfstorage/decorators.py | import httplib
import functools
from webargs import Arg
from webargs import core
from modularodm.exceptions import NoResultsFound
from modularodm.exceptions import ValidationValueError
from modularodm.storage.base import KeyExistsException
from framework.auth.decorators import must_be_signed
from website.models impo... | Python | 0.000022 | @@ -321,16 +321,48 @@
rt User%0A
+from website.models import Node%0A
from web
@@ -1327,32 +1327,12 @@
'
-auth': Arg(%7B%0A 'id
+user
': A
@@ -1350,37 +1350,24 @@
quired=True,
- dest='user',
use=User.lo
@@ -1407,157 +1407,346 @@
one)
+,
%0A
-%7D),%0A 'source': Arg(unicode, required=True, valida... |
7dcbb064e9bd87e30d322e695452ab140c30b5ed | Support for --version | src/contexts/__main__.py | src/contexts/__main__.py | import sys
from .plugin_discovery import load_plugins
from . import run_with_plugins, main
def cmd():
try:
import colorama
except ImportError:
pass
else:
colorama.init()
plugin_list = load_plugins()
exit_code = run_with_plugins(plugin_list)
sys.exit(exit_code)
if __n... | Python | 0 | @@ -97,16 +97,93 @@
cmd():%0A
+ if '--version' in sys.argv:%0A print_version()%0A sys.exit(0)%0A%0A
try:
@@ -384,16 +384,284 @@
code)%0A%0A%0A
+def print_version():%0A import pkg_resources%0A version = pkg_resources.require('contexts')%5B0%5D.version%0A py_version = '.'.join(str(i) for... |
cdaa708e185b252ddebb542e89a9c4d5e6740f2c | Include old (>24h) messages in news feed | feedline.py | feedline.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Rapidly display fresh headlines from a TinyTinyRSS instance on the command line.
(c) 2017 Andreas Fischer <_@ndreas.de>
"""
import subprocess
import argparse
import getpass
import json
import os.path
import readchar
from ttrss import TinyTinyRSS
def get_conn():
""... | Python | 0 | @@ -1420,9 +1420,29 @@
id=-
-3
+4, view_mode=%22unread%22
):%0A
|
72438aceb58c7fe566a9a09ffccc0f8622a8df31 | Update file list to new Hector file layout | setup.py | setup.py | """
pyhector
--------
Python wrapper for the `Hector simple climate model
<https://github.com/JGCRI/hector>`_.
**Install** using ::
pip install pyhector
Find **usage** instructions in the `repository
<https://github.com/openclimatedata/pyhector>`_.
"""
from setuptools import setup, Extension
from setuptools.co... | Python | 0 | @@ -1526,68 +1526,1066 @@
ces=
-list(glob.glob(%22src/*.cpp%22) + glob.glob(%22hector/src/*.cpp%22))
+%5B%0A %22hector/src/bc_component.cpp%22,%0A %22hector/src/carbon-cycle-model.cpp%22,%0A %22hector/src/carbon-cycle-solver.cpp%22,%0A %22hector/src/ch4_component.cpp%22,%0A %22hector... |
d0b6e2b9b3a936ea16a7c48fd951bb4f297c1190 | Update setup.py to point to correct site | setup.py | setup.py | try:
from setuptools import setup, find_packages
except:
from distutils.core import setup, find_packages
install_requires = ['py3compat >= 0.2']
setup(
name='daisychain',
version='0.1',
description='Configuration-based OO-dependency resolution workflow engine',
author='Jeff Edwards',
autho... | Python | 0 | @@ -382,16 +382,21 @@
on-daisy
+chain
/daisych
|
30bf6ddb0dde4e6bc953924fd6b22a09d97805cf | Add Test runs for Python 3.7 and remove 3.4 (#5295) | nox.py | nox.py | # Copyright 2016 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | Python | 0 | @@ -1546,15 +1546,8 @@
.7',
- '3.4',
'3.
@@ -1555,16 +1555,23 @@
', '3.6'
+, '3.7'
%5D)%0Adef u
|
a88a9ad6ed64c3bf4b5a9e40a41a68e9581654e7 | Fix nox config. (#4599) | nox.py | nox.py | # Copyright 2017, Google LLC All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | Python | 0 | @@ -2024,21 +2024,8 @@
est'
-, *LOCAL_DEPS
)%0A
@@ -2181,14 +2181,12 @@
s/system
-.py
+/
')%0A
|
82cc05e882698bdf2248ae0ae1589bb6455d0ca5 | update fetch | fetch/rb.py | fetch/rb.py | import robotparser
from utils import config
from splinter import Browser
def index(session):
url = config.rb_url()
_robot_can_fetch(session, url)
def fetch():
with Browser(**config.browser_kwargs()) as browser:
browser.visit(url)
styles = []
group_names = brows... | Python | 0.000001 | @@ -673,17 +673,17 @@
n.visit(
-5
+3
, url, f
|
5839d76a0e29a3fa6b07a460ff3f0d8cf9b889b7 | Remove alpha release | setup.py | setup.py | import os
from setuptools import setup, find_packages
src_dir = os.path.dirname(__file__)
install_requires = [
"troposphere~=1.8.0",
"awacs~=0.6.0",
"stacker~=0.8.1",
]
tests_require = [
"nose~=1.0",
"mock~=2.0.0",
]
def read(filename):
full_path = os.path.join(src_dir, filename)
with o... | Python | 0 | @@ -460,11 +460,9 @@
0.7.
-1a1
+0
%22,%0A
|
38791c7bb480ea5c9efdb4bab3a9c785e5078153 | bump to version 0.1alpha9 | setup.py | setup.py | from setuptools import setup, find_packages
import os, sys
static_types = [
'*.js',
'*.html',
'*.css',
'*.ico',
'*.gif',
'*.jpg',
'*.png',
'*.txt*',
'*.py',
'*.template'
]
#if sys.platform != "win32":
# _install_requires.append("Twisted")
_install_requires = [
'cs... | Python | 0 | @@ -328,9 +328,9 @@
lpha
-8
+9
', %0A
@@ -541,9 +541,9 @@
0.1a
-4
+5
',%0A
|
7156cc172b3ba87e3247367c6bf51cc24ce9a902 | Update PyPI usage | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
setup.py
Created by Stephan Hügel on 2015-06-21
"""
from __future__ import unicode_literals
import os
import re
import io
from setuptools import setup, find_packages, Distribution
def read(*names, **kwargs):
with io.open(
os.path.join(os.path.dirname(__fil... | Python | 0 | @@ -1785,85 +1785,103 @@
%22%22%5C%0A
-Fast lon, lat to BNG conversion%0A---------------------------------------------
+===============================%0AFast lon, lat to BNG conversion%0A===============================
%0AUse
@@ -1891,17 +1891,17 @@
Rust 1.
-0
+x
binary
@@ -2179,29 +2179,49 @@
n%5Cn%0A
-Call t... |
ab077d26c51c3e6db6e82bd256b14563373587fe | Resolve requests version conflict | setup.py | setup.py | # Copyright (C) 2015-2016 Regents of the University of California
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | Python | 0 | @@ -1446,16 +1446,24 @@
requests
+==2.18.4
',%0A
|
b61a6e79703b6f807f1b179f23fa9dd7836ab957 | Version bump to 2.4.0 | setup.py | setup.py | from setuptools import setup, find_packages
long_description = open('README.rst').read()
setup(
name='PyChromecast',
version='2.3.0',
license='MIT',
url='https://github.com/balloob/pychromecast',
author='Paulus Schoutsen',
author_email='paulus@paulusschoutsen.nl',
description='Python modu... | Python | 0 | @@ -132,17 +132,17 @@
sion='2.
-3
+4
.0',%0A
|
2f766e439b9d91ab4d4682245a2360bc1e5c2bb5 | Update version | setup.py | setup.py | import matplotlib
import os
MPLBE = os.environ.get('MPLBE')
if MPLBE:
matplotlib.use(MPLBE)
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
DESCRIPTION = "General Matplotlib Exporter"
LONG_DESCRIPTION = open('README.md').read()
NAME = "mplexporter"
AUTHOR = "Jake V... | Python | 0 | @@ -560,11 +560,11 @@
'0.
-0.1
+1.0
'%0A%0As
|
6797300eeeb014debc5472927c5b5711597881ea | bump to 0.2.1 | setup.py | setup.py | """
Copyright 2012 DISQUS
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, software
distrib... | Python | 0.000055 | @@ -594,16 +594,18 @@
N = '0.2
+.1
'%0ANAME =
|
d611830525e93e1c1a364ed88695d62003490e07 | Bump version number | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name="trajprocess",
version='2.0.4',
packages=find_packages(),
requires=['numpy', 'mdtraj', 'nose'],
zip_safe=False,
include_package_data=True,
)
| Python | 0.000002 | @@ -90,9 +90,9 @@
2.0.
-4
+5
',%0A
|
abfdbaee5f80c7c02436268016718a5362f9083d | make setup.py pypi conform | setup.py | setup.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
version = '0.1.5'
setup(
name='SerpScrap',
version=version,
description='A python module to scrape and extract data like links, titles, descriptions, ratings, from search engine result pages.',
long_description=... | Python | 0.000001 | @@ -171,16 +171,18 @@
iption='
+''
A python
@@ -258,16 +258,20 @@
ratings,
+%0A
from se
@@ -294,17 +294,40 @@
lt pages
-.
+ %0A and listed urls.''
',%0A l
@@ -485,24 +485,43 @@
SerpScrap',%0A
+ license='MIT',%0A
packages
@@ -776,17 +776,390 @@
6.4.2',%0A
-
%5D,%0A
+ classifiers=%5B%0A ... |
5d36740917dbc08aca8202d4fb5915b4f17a9552 | Add log level specification to cax | cax/main.py | cax/main.py | import argparse
import logging
import os.path
import time
from cax.config import mongo_password, set_json, get_task_list, get_config
from cax.tasks import checksum, clear, data_mover, process
from cax import __version__
def main():
parser = argparse.ArgumentParser(
description="Copying All kinds of XENON1... | Python | 0 | @@ -496,16 +496,50 @@
'store',
+ type=str,%0A
dest='c
@@ -628,38 +628,319 @@
x%22)%0A
-%0A args = parser.parse_args(
+ parser.add_argument('--log', dest='log', type=str, default='info',%0A help=%22Logging level e.g. debug%22)%0A%0A args = parser.parse_args()%0... |
8548f3dc25af0a9cee7d34bcfcec2dc4ca5d1a88 | Edit spam regex | findspam.py | findspam.py | # -*- coding: utf-8 -*-
import re
import phonenumbers
class FindSpam:
rules = [
{'regex': u"(?i)\\b(baba(ji)?|nike|vashi?k[ae]r[ae]n|sumer|kolcak|porn|molvi|judi bola|ituBola.com|lost lover|11s|acai|skin care|swtor2credits|me2.do|black magic|bam2u|Neuro(3X|flexyn)|Nutra|Bowtrol|Forskolin|Blackline Elite|TestC... | Python | 0.000003 | @@ -282,16 +282,27 @@
Bowtrol%7C
+Slim Genix%7C
Forskoli
|
8649b296e05c432dd3841d8c5dc8d9aebd6d09db | update global test script | cea/test.py | cea/test.py | """
Test all the main scripts in one go - drink coffee while you wait :)
"""
import properties
import demand
import emissions
import embodied
import graphs
properties.test_properties()
demand.test_demand()
emissions.test_lca_operation()
embodied.test_lca_embodied()
graphs.test_graph_demand()
| Python | 0 | @@ -279,16 +279,44 @@
_graph_demand()%0A
+%0Aprint 'full test completed'
|
3112a99c4099842fc599212a606a9e946b84cdd2 | Add error handling for not having enough files to choose from | odc.py | odc.py | import os
import glob
import random
import smart_open
import pandas as pd
import click
N_POSITIVE = 99684
N_NEGATIVE = 996941
N_TOTAL = N_POSITIVE + N_NEGATIVE
POSITIVE_RATIO = N_POSITIVE / N_TOTAL
def read_submission(file, n_advertise):
df = pd.read_csv(file)
columns = df.columns.values
assert len(colu... | Python | 0 | @@ -3774,24 +3774,147 @@
n_samples:%0A
+ if len(files) == 0:%0A raise Exception('There are not enough files to get %7B%7D examples'.format(n_samples))%0A
rand
@@ -3916,20 +3916,21 @@
random_
-file
+index
= rando
@@ -3935,21 +3935,71 @@
dom.
-choice(files)
+randrange(len(files))%0A ... |
747ed560ac6a3854feb0a2c23885b1aa0be61b5f | fix some style issues | app/main.py | app/main.py | from google.appengine.api import files
from google.appengine.api import urlfetch
from google.appengine.ext import ndb
from google.appengine.ext import blobstore
import csv
import re
import sys
import os
import webapp2
import jinja2
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.jo... | Python | 0.000018 | @@ -1,43 +1,4 @@
-from google.appengine.api import files%0A
from
@@ -75,51 +75,8 @@
ndb
-%0Afrom google.appengine.ext import blobstore
%0A%0Aim
@@ -98,19 +98,8 @@
re%0A
-import sys%0A
impo
@@ -329,16 +329,17 @@
=True)%0A%0A
+%0A
class Lo
@@ -834,16 +834,17 @@
lues))%0A%0A
+%0A
class Re
@@ -2397,16 +2397,17 @... |
90c07db3c507e1394cf0a72e73f9c7cc425b20a4 | return False | one.py | one.py | def one(iterable):
"""
Return X if X is the only one value where bool(i) is True for
each every i in the iterable. In any other case return None.
>>> one((True, False, False))
True
>>> one((True, False, True))
False
>>> one((0, 0, 'a'))
'a'
>>> one((0, False, None))
False
... | Python | 0.999999 | @@ -23,134 +23,214 @@
%22%22%22
-%0A
Return
-X if X is
+the object in
the
-only one value where bool(i) is
+given iterable that evaluates to
True
- for
+.%0A
%0A
-each every i in the iterable. In any other case
+If the given iterable has more than one object that evaluates to True,%0A or if there i... |
6726af1a15c3b64ea9cbb68e18a7983477713842 | Update 0.91 | src/cerberus_ac/admin.py | src/cerberus_ac/admin.py | # -*- coding: utf-8 -*-
"""Admin module."""
# from django.contrib import admin
# from django.contrib.admin.sites import AdminSite
#
# from cerberus_ac.views import EditUserPermissions
# from .models import *
#
#
# class SecurityAdmin(AdminSite):
# pass
#
# class DataAdmin(AdminSite):
# pass
#
# class AuditAdm... | Python | 0 | @@ -43,96 +43,8 @@
%22%22%0A%0A
-# from django.contrib import admin%0A# from django.contrib.admin.sites import AdminSite%0A#%0A
# fr
@@ -91,16 +91,16 @@
issions%0A
+
# from .
@@ -157,32 +157,33 @@
e):%0A# pass%0A#
+
%0A# class DataAdm
@@ -362,16 +362,16 @@
Admin')%0A
+
# audit_
@@ -416,748 +416,8 @@
in')
... |
b16c86b418e1c706bf25347d276d25876637d89b | add failing test for customized type deep in type hierarchy | spyne/test/interface/test_interface.py | spyne/test/interface/test_interface.py | #!/usr/bin/env python
#
# spyne - Copyright (C) Spyne contributors.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later ve... | Python | 0 | @@ -3158,16 +3158,651 @@
r_call%0A%0A
+ def test_empty(self):%0A RequestStatus = Unicode(values=%5B'new', 'processed'%5D)%0A%0A class RequestUnsigned(ComplexModel):%0A pass%0A%0A class DataRequest(RequestUnsigned):%0A operator = Uuid%0A status = Array(RequestSta... |
baab52477f637364f0a1a974b4ee13114c667bca | allow multiple encodings in headers (i.e. "From: =?iso-8859-2?Q?...?= <email@address.com>") | cia-mail.py | cia-mail.py | #!/usr/local/bin/python
#
# Copyright (C) Merlijn van Deen <valhallasw@gmail.com>, 2009
#
# Distributed under the terms of the MIT license.
#
import sys, time
from email.Parser import Parser
from email.Header import Header, decode_header
from xml.sax.saxutils import escape
from xmlrpclib import ServerProxy
e = Parser... | Python | 0.000001 | @@ -440,16 +440,89 @@
er,
-Header(*
+' '.join(%5Btext.decode(encoding if encoding else 'ascii') for (text, encoding) in
deco
@@ -545,25 +545,9 @@
er%5D)
-%5B0%5D).__unicode__(
+%5D
)) f
|
8453607c1fb1cb1835bc1323f4c59366015e93fe | Create a command-line vulgarizer | estimate.py | estimate.py | import sys
from fractions import Fraction
from math import log10
digits = sys.argv[1]
print("Estimating %s as a fraction..." % digits)
def vulgarize(rpt):
"""Calculate a vulgar fraction for a given continued fraction"""
f = Fraction(0)
if tuple(rpt) == (0,): return f # Avoid dividing by zero
for term in reversed(... | Python | 0.000309 | @@ -63,79 +63,8 @@
10%0A%0A
-digits = sys.argv%5B1%5D%0Aprint(%22Estimating %25s as a fraction...%22 %25 digits)%0A%0A
def
@@ -566,16 +566,232 @@
g10(x)%0A%0A
+digits = sys.argv%5B1%5D%0Aif %22,%22 in digits:%0A%09digits = %5Bint(d.strip()) for d in digits.split(%22,%22)%5D%0A%09frac = vulgarize(digits)%0A%09print(... |
0e2ef0a70fa6627c0eb4a292e69d3ed1f8500f36 | Add the ability to graph the results | estimate.py | estimate.py | import sys
from fractions import Fraction
from math import log10
def vulgarize(rpt):
"""Calculate a vulgar fraction for a given continued fraction"""
f = Fraction(0)
if tuple(rpt) == (0,): return f # Avoid dividing by zero
for term in reversed(rpt):
f = 1 / (term + f)
return 1/f
def magnitude(x):
"""Give an i... | Python | 0.000004 | @@ -833,16 +833,30 @@
1/orig%0A
+accuracy = %5B%5D%0A
while re
@@ -1033,12 +1033,1099 @@
ror, frac))%0A
+%09if vulg != orig:%0A%09%09# Estimate the accuracy by showing, in effect, how many%0A%09%09# correct digits there are before there's an error.%0A%09%09# (Accuracy becomes immeasurable for the last term.)%0A%09%... |
a54cb5529e5611b2d21c837d5422e31abd8d2819 | Add :q alias for quit | placidity/commands/quit/quit.py | placidity/commands/quit/quit.py | class Quit:
aliases = ('quit', 'quit()', )
description = 'Quits the application'
def execute(self):
raise SystemExit
| Python | 0 | @@ -37,16 +37,22 @@
quit()',
+ ':q',
)%0A d
|
e2d009c2e64340d101319824af1130bb92b4b021 | Add debug logger method to utils | app/util.py | app/util.py | import os
def chown(username, path, destination):
"""Set owner and group of file to that of the parent directory."""
s = os.stat(path)
os.chown(os.path.join(path, destination), s.st_uid, s.st_gid)
def construct_path(path, format, *args):
"""Constructs a path using locally available variables."""
r... | Python | 0.000001 | @@ -362,8 +362,244 @@
*args)%0A
+%0Adef logger(config):%0A %22%22%22 Returns a logger if development mode, else a no-op. %22%22%22%0A def log(message):%0A print('%5BDebug%5D: %7B%7D'.format(message))%0A%0A if config%5B'DEBUG'%5D:%0A return log%0A else:%0A return lambda x: None%0A
|
cf6ddfdac8a56194ad1297921a390be541d773cc | Remove last digit of version number if it's 0. | app_info.py | app_info.py | # coding=UTF8
import datetime
name = "Devo"
release_date = datetime.date(2012, 12, 13)
version = (1, 0, 0)
version_string = ".".join(str(x) for x in version)
identifier = "com.iogopro.devo"
copyright = u"Copyright © 2010-2012 Luke McCarthy"
developer = "Developer: Luke McCarthy <luke@iogopro.co.uk>"
company_na... | Python | 0.000158 | @@ -147,23 +147,61 @@
or x in
+(
version
+ if version%5B2%5D != 0 else version%5B:2%5D)
)%0A%0Aident
|
206715b0d205adca9598b07b9fb57063e5b4a220 | Bump VERSION_INT up | src/constants.py | src/constants.py | #
# Copyright 2013 TeamSWAP
#
# 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 wr... | Python | 0.000001 | @@ -641,17 +641,17 @@
_INT = 1
-2
+5
%0D%0AURL_CH
|
1e7c95ee7d920a5d0f312608b323c7449ca4fe1c | Bump version. | floobits.py | floobits.py | #!/usr/bin/env python
# coding: utf-8
import os
from floo import emacs_handler
from floo.common import migrations
from floo.common import reactor
from floo.common import utils
from floo.common import shared as G
def cb(port):
print('Now listening on %s' % port)
def main():
G.__VERSION__ = '0.11'
G.__PL... | Python | 0 | @@ -335,17 +335,17 @@
= '1.5.
-5
+6
'%0A ut
|
5950997c8925804338f224f1278c3018479dab09 | scale pixels to 16 shades | ppp.py | ppp.py | #! /usr/bin/python
"""
ppp.py
peggy.pi.pic
Take picture with Raspberry Pi camera and then display
as 25 x 25 pixel image (16 shades) on Peggy2
"""
# http://picamera.readthedocs.org/en/release-1.9/recipes1.html#capturing-to-a-pil-image
import io
import time
import picamera
from PIL import Image
# Create the in-mem... | Python | 0.000001 | @@ -723,283 +723,350 @@
L')%0A
-%0A# # test - show image%0A# image.show()%0A%0Aimage.thumbnail((25,25))%0A%0A# # save image to file as test%0A# imgout = open('/home/pi/temp.bmp', 'w')%0A# image.save(imgout)%0A# imgout.close()%0A#%0A
+image.thumbnail((25,25))%0Apxls = list(image.getdata())%0A%0A# convert pixels to 16 l... |
a9de7732dc442df94770d91f8bef9eac45aea7de | Disable bytecode writing for testing | test/test.py | test/test.py | #!/usr/bin/env python
'''CSS Property Sorter Script Unittest
Copyright (c) 2012 Yu-Jie Lin
Author: Yu-Jie Lin <livibetter@gmail.com>, http://yjl.im
License: MIT license (http://opensource.org/licenses/mit-license.php)
'''
from __future__ import print_function
import glob
import os.path
import unittest
import sys
... | Python | 0.000001 | @@ -335,16 +335,47 @@
d('..')%0A
+sys.dont_write_bytecode = True%0A
from sor
@@ -421,16 +421,48 @@
s as SP%0A
+sys.dont_write_bytecode = False%0A
%0A%0Adef F(
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.