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 |
|---|---|---|---|---|---|---|---|
8356da27e34b269052e57734b424f65a3c636b07 | remove testing kludge | build-db.py | build-db.py | # usage: python build-db.py <wod ascii file name> <table name to append to>
from wodpy import wod
import sys, sqlite3
import util.main as main
import util.dbutils as dbutils
import numpy as np
import qctests.CSIRO_wire_break
if len(sys.argv) == 3:
conn = sqlite3.connect('iquod.db', isolation_level=None)
cur ... | Python | 0.000001 | @@ -3041,17 +3041,16 @@
= 0%0A
-#
while Tr
@@ -3057,34 +3057,8 @@
ue:%0A
- for qq in range(100):%0A
|
100fa2f08656009e3fa2ee4fd66a85c5aca35f9d | Comment typo fix | sacad/rate_watcher.py | sacad/rate_watcher.py | """ This module provides a class with a context manager to help avoid overloading web servers. """
import collections
import logging
import os
import sqlite3
import threading
import time
import urllib.parse
import lockfile
MIN_WAIT_TIME_S = 0.01
SUSPICIOUS_LOCK_AGE_S = 120
class WaitNeeded(Exception):
""" Exce... | Python | 0 | @@ -2744,16 +2744,55 @@
break%0A
+ # loop again to find wait time%0A
el
@@ -3721,16 +3721,17 @@
t availa
+b
le: wait
|
e63c463a3200d9843bc5be6c1c3ee36fb267cbde | Update hyper space setting. | matchzoo/engine/param_table.py | matchzoo/engine/param_table.py | """Parameters table class."""
import typing
from matchzoo.engine import Param
class ParamTable(object):
"""
Parameter table class.
Example:
>>> params = ParamTable()
>>> params.add(Param('ham', 'Parma Ham'))
>>> params.add(Param('egg', 'Over Easy'))
>>> params['ham']
... | Python | 0 | @@ -72,16 +72,30 @@
rt Param
+, hyper_spaces
%0A%0A%0Aclass
@@ -1821,16 +1821,50 @@
-return %7B
+full_space = %7B%7D%0A for param in self:
%0A
@@ -1876,19 +1876,71 @@
+if
param.
-name:
+hyper_space is not None:%0A param_space =
par
@@ -1970,97 +1970,204 @@
+
-for par... |
4a6846b969746b79f1acd0e0615232d97ed54b1f | replace import-time cluster dependencies (#1544) | frameworks/template/tests/test_sanity.py | frameworks/template/tests/test_sanity.py | import pytest
import sdk_install
import sdk_utils
from tests import config
FOLDERED_SERVICE_NAME = sdk_utils.get_foldered_name(config.SERVICE_NAME)
@pytest.fixture(scope='module', autouse=True)
def configure_package(configure_security):
try:
sdk_install.uninstall(config.PACKAGE_NAME, FOLDERED_SERVICE_NAME... | Python | 0 | @@ -73,81 +73,8 @@
ig%0A%0A
-FOLDERED_SERVICE_NAME = sdk_utils.get_foldered_name(config.SERVICE_NAME)%0A
%0A@py
@@ -215,33 +215,59 @@
CKAGE_NAME,
-FOLDERED_
+sdk_utils.get_foldered_name(config.
SERVICE_NAME
@@ -267,16 +267,17 @@
CE_NAME)
+)
%0A%0A
@@ -443,25 +443,51 @@
-FOLDERED_
+sdk_utils.get_f... |
0eef0efbe716feb3dc02fb45a756496d5517966c | Update docs. | matchzoo/models/naive_model.py | matchzoo/models/naive_model.py | """Naive model with a simplest structure for testing purposes."""
import keras
from matchzoo import engine
class NaiveModel(engine.BaseModel):
"""Naive model with a simplest structure for testing purposes."""
def build(self):
"""Build."""
x_in = self._make_inputs()
x = keras.layers.... | Python | 0 | @@ -147,16 +147,21 @@
%0A %22%22%22
+%0A
Naive mo
@@ -207,24 +207,159 @@
ng purposes.
+%0A%0A Bare minimum functioning model. The best choice to get things rolling.%0A The worst choice to fit and evaluate performance.%0A
%22%22%22%0A%0A def
|
0859bb58a4fa24f5e278e95da491a2b4409f0b2b | Tag 0.5.3 | koordinates/__init__.py | koordinates/__init__.py | # -*- coding: utf-8 -*-
"""
Koordinates Python API Client Library
:copyright: (c) Koordinates Limited.
:license: BSD, see LICENSE for more details.
"""
__version__ = "0.5.0"
from .exceptions import (
KoordinatesException,
ClientError,
ClientValidationError,
InvalidAPIVersion,
ServerError,
Bad... | Python | 0.000001 | @@ -166,17 +166,17 @@
= %220.5.
-0
+3
%22%0A%0Afrom
|
b6554b00fdb0387a27671eeb39589dc7e7109f6e | Add collecter function | app/main.py | app/main.py | from flask import Flask
app = Flask(__name__)
app.config.update(
DEBUG=True
)
@app.route("/")
def index():
return "Hello python"
if __name__ == "__main__":
app.run()
| Python | 0.000001 | @@ -16,16 +16,100 @@
rt Flask
+, request, jsonify%0Afrom urllib.request import urlopen%0Afrom bs4 import BeautifulSoup%0A
%0Aapp = F
@@ -197,68 +197,585 @@
-return %22Hello python%22%0A%0Aif __name__ == %22__main__%22:%0A app.run()
+url = request.args.get('url', '')%0A res = collecter(url)%0A return js... |
7b58f59ec288dd055cf931dd47c4e8e59bb9ad1d | update atx-agent version | uiautomator2/version.py | uiautomator2/version.py | # coding: utf-8
#
__apk_version__ = '1.1.5'
# 1.1.5 waitForExists use UiObject2 method first then fallback to UiObject.waitForExists
# 1.1.4 add ADB_EDITOR_CODE broadcast support, fix bug (toast捕获导致app闪退)
# 1.1.3 use thread to make watchers.watched faster, try to fix input method type multi
# 1.1.2 fix count error whe... | Python | 0 | @@ -918,18 +918,69 @@
= '0.4.
-5'
+6'%0A# 0.4.6 fix download dns resolve error (sometimes)
%0A# 0.4.5
|
0c9accce7b3df8889ecf57b6df89a36628cb908c | add timeout for running scheduler | sbin/run_scheduler.py | sbin/run_scheduler.py | import subprocess
import tempfile
import time, os
import re
import sys
# cd ~/.config/sublime-text-3/Packages/UnitTesting
# python sbin/run_scheduler.py PACKAGE
# script directory
__dir__ = os.path.dirname(os.path.abspath(__file__))
version = int(subprocess.check_output(["subl","--version"]).decode('utf8').strip()[-... | Python | 0.000001 | @@ -1483,16 +1483,37 @@
mething%0A
+startt = time.time()%0A
while (n
@@ -1623,16 +1623,125 @@
flush()%0A
+ if time.time()-startt %3E 60:%0A print(%22Timeout: Sublime Text is not responding%22)%0A sys.exit(1)%0A
time
|
c9e676b22b6d57e14106df22eeeaa586a7c6d356 | Revert r4157. | scipy/linalg/setup.py | scipy/linalg/setup.py | ## Automatically adapted for scipy Oct 18, 2005 by
#!/usr/bin/env python
import os
import sys
import re
from distutils.dep_util import newer_group, newer
from glob import glob
from os.path import join
#-------------------
# To skip wrapping single precision atlas/lapack/blas routines, set
# the following flag to Tru... | Python | 0.000061 | @@ -1864,16 +1864,22 @@
'sgesv
+cgesv
sgetrf c
|
42f4ed206a9c79799b9bb0b13b829c8cf9c979e4 | write to file | scraper/parse_dump.py | scraper/parse_dump.py | #!/usr/bin/python
# Simple script to parse the devpost dump and place results in a json
import os
import json
from multiprocessing import Pool
from bs4 import BeautifulSoup
OUTPUT_FNAME="devpostdump.json"
DUMP_DIR = "output/"
projects = [os.path.join(DUMP_DIR, f) for f in os.listdir(DUMP_DIR)]
# projects = projects[... | Python | 0.000001 | @@ -1820,19 +1820,16 @@
s)%0A j
-son
= p.map
@@ -1873,10 +1873,111 @@
:1000%5D))
+%0A print %22Creating json file%22%0A with open(OUTPUT_FNAME, %22w+%22) as f:%0A f.write(json.dump(j))
%0A%0A
|
8dc3cf60a57d6cce644c619385985c781c60c638 | use the begin of the line | commands.py | commands.py | import sublime
import sublime_plugin
import os
from .textgetter import TextGetter, \
RTextGetter, \
PythonTextGetter, \
JuliaTextGetter, \
MarkDownTextGetter
from .textsender import TextSender, PythonTextSender
class SendTextPlusCommand(sublime_plugin.WindowCommand):
def run(self, cmd=None, prog=... | Python | 0.006477 | @@ -1814,16 +1814,26 @@
pt =
+view.line(
view.sel
@@ -1837,16 +1837,17 @@
sel()%5B0%5D
+)
.begin()
|
c924f2d4a0072299d477a05da675646ce306941a | fix host name | wallace/heroku/clock.py | wallace/heroku/clock.py | """A clock process."""
from apscheduler.schedulers.blocking import BlockingScheduler
from wallace import db
import os
import imp
import inspect
from psiturk.models import Participant
from datetime import datetime
from psiturk.psiturk_config import PsiturkConfig
from boto.mturk.connection import MTurkConnection
import ... | Python | 0.000357 | @@ -1888,16 +1888,61 @@
'HOST'%5D%0A
+ host = host%5B:-len(%22.herokuapp.com%22)%5D%0A
@@ -2050,30 +2050,16 @@
ig-vars
-%5C%0A
-H %22Acce
@@ -2101,30 +2101,16 @@
rsion=3%22
- %5C%0A
-H %22Con
@@ -2137,30 +2137,16 @@
on/json%22
- %5C%0A
-d %7B%7D'.
|
94182e97ed1635e3aa4993f3db69c248e16b7600 | Undo previous commit | unnaturalcode/ucUser.py | unnaturalcode/ucUser.py | # Copyright 2013, 2014 Joshua Charles Campbell
#
# This file is part of UnnaturalCode.
#
# UnnaturalCode 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 Licens... | Python | 0 | @@ -1266,28 +1266,31 @@
os.m
-knod
+akedirs
(self.ucDir)
@@ -2673,12 +2673,15 @@
os.m
-knod
+akedirs
(sel
|
c8a010e6e9a917c50843dd10303f8f9497b4687c | Bump version | waterbutler/__init__.py | waterbutler/__init__.py | __version__ = '0.2.2'
__import__("pkg_resources").declare_namespace(__name__)
| Python | 0 | @@ -12,17 +12,17 @@
= '0.2.
-2
+3
'%0D__impo
|
d377c835f20e839dfd5e95c5ab14db98a441c6a8 | Add product variation redirect test | shuup_tests/admin/test_product_variation.py | shuup_tests/admin/test_product_variation.py | # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2019, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
import pytest
import six
from django.forms import formset_factory
... | Python | 0 | @@ -312,16 +312,61 @@
_factory
+%0Afrom django.core.urlresolvers import reverse
%0A%0Afrom s
@@ -612,16 +612,34 @@
_product
+, get_default_shop
%0Afrom sh
@@ -1695,32 +1695,32 @@
formset.save()%0A
-
assert not p
@@ -1771,16 +1771,1018 @@
inked%0A%0A%0A
+@pytest.mark.django_db%0Adef test_simple_children_redi... |
61d69f2cc850df49186f88c540d22cf4c0462b41 | Add test for full-path import of Django View class | python/ql/test/experimental/library-tests/frameworks/django-v2-v3/routing_test.py | python/ql/test/experimental/library-tests/frameworks/django-v2-v3/routing_test.py | """testing views for Django 2.x and 3.x"""
from django.urls import path, re_path
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse, HttpResponseNotFound
from django.views import View
def url_match_xss(request, foo, bar, no_taint=None): # $requestHandler routedParameter=foo routedParameter=bar
... | Python | 0 | @@ -199,16 +199,49 @@
rt View%0A
+import django.views.generic.base%0A
%0A%0Adef ur
@@ -1337,24 +1337,208 @@
pResponse%0A%0A%0A
+# direct import with full path to %60View%60 class (not supported)%0Aclass ClassView2(django.views.generic.base.View):%0A def get(self, request): # $ MISSING: requestHandler%0A pa... |
b0e3886ee24689f1eb249e0ed3c66d887b317f60 | Delete table test | tst/test.py | tst/test.py | #!/usr/bin/python
import grpc
import keyvalue_pb2
import os
import sys
if __name__ == '__main__':
conn_str = os.environ['GRPCROCKSDB_PORT'].split("/")[2]
print "Connecting on: " + conn_str
channel = grpc.insecure_channel(conn_str)
stub = keyvalue_pb2.KeyValueStub(channel)
create_table_res = stub.... | Python | 0.000002 | @@ -1261,8 +1261,103 @@
%2299999%22%0A
+ delete_table_res = stub.DeleteTable(keyvalue_pb2.DeleteTableReq(tablename='test-table-1'))%0A
|
c45017a80c17fcb6f0bb2595392a24b287aba3ca | Update collect_sql to support objects of different types but same name | smartmin/management/commands/collect_sql.py | smartmin/management/commands/collect_sql.py | from __future__ import print_function, unicode_literals
import six
import sqlparse
from collections import OrderedDict
from datetime import datetime
from django.core.management.base import BaseCommand
from django.db.migrations import RunSQL
from django.db.migrations.executor import MigrationExecutor
from enum import ... | Python | 0 | @@ -2362,10 +2362,11 @@
nt%5B:
-79
+100
%5D.re
@@ -5108,16 +5108,21 @@
te(%22 %3E %25
+ -100
s (%25s)%22
@@ -5359,24 +5359,93 @@
eredDict()%0A%0A
+ def op_key(op):%0A return op.sql_type, op.obj_name%0A%0A
for
@@ -5682,32 +5682,31 @@
lized%5Bop
-eration.obj_name
+_key(operation)
%5D)%... |
4437565016d0b1edc3b5a5f96d405cd0c41ca5b9 | Use DataHandle timestep helpers in sample_project | smif/sample_project/models/energy_demand.py | smif/sample_project/models/energy_demand.py | """Energy demand dummy model
"""
import numpy as np
from smif.data_layer.data_handle import RelativeTimestep
from smif.model.sector_model import SectorModel
class EDMWrapper(SectorModel):
"""Energy model
"""
def initialise(self, initial_conditions):
pass
def simulate(self, data):
# G... | Python | 0 | @@ -1206,130 +1206,26 @@
r =
-RelativeTimestep.BASE.resolve_relative_to(now,%0A
data.
+base_
timestep
s)%0A
@@ -1212,34 +1212,32 @@
ta.base_timestep
-s)
%0A self.lo
@@ -1638,89 +1638,30 @@
r =
-RelativeTimestep.PREVIOUS.resolve_relative_to(%... |
d5fe2e21c8ed4e1dc66098e16011cb2f9094e573 | Fix ConditionalJump to manually increment the PC | bytecode.py | bytecode.py | class BytecodeBase:
autoincrement = True # For jump
def __init__(self):
# Eventually might want to add subclassed bytecodes here
# Though __subclasses__ works quite well
pass
def execute(self, machine):
pass
class Push(BytecodeBase):
def __init__(self, data):
... | Python | 0.000001 | @@ -1775,32 +1775,67 @@
alue, jump_to):%0A
+ self.autoincrement = False%0A
self.val
@@ -2009,34 +2009,47 @@
-self.autoincrement = Fa
+machine.pc = self.jump_to%0A e
lse
+:
%0A
@@ -2064,38 +2064,29 @@
machine.pc
++
=
-self.jump_to
+1%0A
%0A%0Aclass Prin
|
eeea990b6409085e38df4be4c137b9e42e354ec6 | remove more target="_blank" for @tofumatt (bug 807049) | mkt/site/context_processors.py | mkt/site/context_processors.py | from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from tower import ugettext as _
from access import acl
import amo
from amo.context_processors import get_collect_timings
from amo.urlresolvers import reverse
import mkt
from zadmin.models import get_config
def global_settings(requ... | Python | 0.00002 | @@ -1421,60 +1421,8 @@
ng')
-,%0A 'target': '_blank'
%7D)%0A
@@ -1605,64 +1605,8 @@
ps')
-,%0A 'target': '_blank'
%7D)%0A
|
462813f8f10db550a4897bfcf20aa1d675543edb | Exclude system sources from test coverage | mesonbuild/scripts/coverage.py | mesonbuild/scripts/coverage.py | # Copyright 2017 The Meson development team
# 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 ... | Python | 0 | @@ -2687,32 +2687,95 @@
cal/include/*')%0A
+ remove_dir_from_trace(lcov_exe, covinfo, '/usr/src/*')%0A
subproce
|
95114756c60f40c3da76e3d83af3e10d64453e0f | Simplify classfier logic | classify.py | classify.py | from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.ensemble import RandomForestRegressor
from sklearn.pipeline import Pipeline
from sklearn import cross_validation
import numpy as np
import sys
import itertools
import linecache
import json
import os
import pickle
from utils import Utilities
class... | Python | 0 | @@ -53,16 +53,57 @@
torizer%0A
+from sklearn.dummy import DummyRegressor%0A
from skl
@@ -400,38 +400,24 @@
self, group,
- n_estimators,
model_file=
@@ -595,49 +595,8 @@
ile%0A
- self.n_estimators = n_estimators%0A
@@ -660,16 +660,58 @@
ain=True
+, class_name=DummyRegressor, parameters=%7B%7D
):%0A ... |
5e2b2342f94933a9c3e853802471776731b232c8 | Add boot trigger API route. | app/urls.py | app/urls.py | # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be usefu... | Python | 0 | @@ -783,16 +783,45 @@
rs.boot%0A
+import handlers.boot_trigger%0A
import h
@@ -2760,16 +2760,154 @@
case%22%0A)%0A
+_BOOT_TRIGGER_URL = tornado.web.url(%0A r%22/trigger/boot%5Bs%5D?/?%22,%0A handlers.boot_trigger.BootTriggerHandler,%0A name=%22boot-trigger%22%0A)%0A%0A
%0AAPP_URL
@@ -3163,11 +3163,34 @@
C... |
96340529a8d5702ce8c880aa66966b2971b96449 | change method | calc_cov.py | calc_cov.py | import mne
import sys
from mne import compute_covariance
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from my_settings import *
reject = dict(grad=4000e-13, # T / m (gradiometers)
mag=4e-12, # T (magnetometers)
eeg=180e-6 #
)
subject = sys.ar... | Python | 0.000005 | @@ -623,23 +623,57 @@
0.2,
- method=%22shrunk
+%0A method=%22factor_analysis
%22)%0Am
|
4be984747a41e5ab966b12afe9074a0e611faee2 | Add license text to resampling.py | resampling.py | resampling.py | """
@author Talha Can Havadar (talhaHavadar)
"""
import random
from collections import Counter
class ResamplingWheel(object):
"""
A Class implementation for resampling wheel
Creates an imaginary wheel that consist of weighted portions.
According to these weights, you can pick an index value.
Index ... | Python | 0 | @@ -1,12 +1,1087 @@
%22%22%22%0A
+MIT License%0A%0ACopyright (c) 2017 Talha Can Havadar%0A%0APermission is hereby granted, free of charge, to any person obtaining a copy%0Aof this software and associated documentation files (the %22Software%22), to deal%0Ain the Software without restriction, including without limitati... |
5fa9e88e9402a4ca12f2f54298d397bc7b54728b | Revert "deactivated test for non-existent 'references'" | web/tests/test_views.py | web/tests/test_views.py | from django.test import TestCase, Client
from django.urls import reverse
from web.views import index, about, compare, reference
class TestViews(TestCase):
def test_index_view_GET(self):
url = reverse('index')
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertTemplate... | Python | 0 | @@ -970,75 +970,8 @@
:%0A%09%09
-pass # Uncomment these tests when 'reference' section is made%0A%0A%09%09#
url
@@ -1031,18 +1031,16 @@
thon'%0A%09%09
-#
response
@@ -1066,18 +1066,16 @@
url)%0A%0A%09%09
-#
self.ass
@@ -1109,26 +1109,24 @@
ode, 200)%0A%09%09
-#
self.assertT
@@ -1171,10 +1171,8 @@
)%0A%09%... |
a5fddaefdedef18b0b6b7d3b2ec65f64eaaaad65 | fix date time bug | clean_db.py | clean_db.py | import MySQLdb, config, urllib, cgi, datetime
from datetime import datetime
sql = MySQLdb.connect(host="localhost",
user=config.username,
passwd=config.passwd,
db=config.test_db)
sql.query("SELECT `id` FROM `feedurls`")
db_feed_query=... | Python | 0.000016 | @@ -641,18 +641,17 @@
i =
-start_date
+date_from
%0A
@@ -663,24 +663,23 @@
le i %3C=
-end_
date
+_to
:%0A
@@ -690,16 +690,29 @@
int
-end_dates
+i.strftime(%22%25d/%25m/%25Y%22)
%0A %0A
|
37fb65dd7763f7cbd1a53f613bbda16d739f11a3 | Make `cctrluser create` work | cctrl/auth.py | cctrl/auth.py | # -*- coding: utf-8 -*-
"""
Copyright 2010 cloudControl UG (haftungsbeschraenkt)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
... | Python | 0.000003 | @@ -3710,18 +3710,25 @@
t_email(
+settings
)
-;
%0A%0A pa
|
d64460c8bbbe045dcdf9f737562a31d84044acce | Change package name to 'cirm' to avoid confusion. | rest/setup.py | rest/setup.py | #
# Copyright 2012 University of Southern 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 applicable law or... | Python | 0 | @@ -767,20 +767,16 @@
s=%5B%22cirm
-rest
%22%5D,%0A
|
917d8e26a64a40de0a0b77085f1fa6d054af0ee8 | Remove cleanup_testfn, no longer used. | conftest.py | conftest.py | import os
import sys
import platform
import shutil
import pytest
collect_ignore = []
if platform.system() != 'Windows':
collect_ignore.extend(
[
'distutils/msvc9compiler.py',
]
)
@pytest.fixture
def save_env():
orig = os.environ.copy()
try:
yield
finally:
... | Python | 0 | @@ -33,22 +33,8 @@
form
-%0Aimport shutil
%0A%0Aim
@@ -2561,254 +2561,8 @@
d%0A%0A%0A
-@pytest.fixture%0Adef cleanup_testfn():%0A from distutils.tests import py38compat as os_helper%0A%0A yield%0A path = os_helper.TESTFN%0A if os.path.isfile(path):%0A os.remove(path)%0A elif os.path.isdir(path)... |
1c8446fc05b3246de0f7da58ccb2362fe41ae05e | Throw on errors in promises | model/Parse.py | model/Parse.py | import urllib.request
import urllib.parse
import json
import threading
app_id = None
rest_key = None
def init(parse_app_id, parse_rest_key):
global app_id, rest_key
app_id = parse_app_id
rest_key = parse_rest_key
class ParsePromise(threading.Thread):
def __init__(self, fun, *args, **kwargs):
... | Python | 0.000003 | @@ -446,32 +446,64 @@
lf.__ret = None%0A
+ self.__exception = None%0A
self.sta
@@ -519,32 +519,49 @@
def run(self):%0A
+ try:%0A
self.__r
@@ -611,49 +611,207 @@
gs)%0A
-%0A def prep(self):%0A self.join()%0A
+ except Exception as e:%0A self.__exception ... |
d1137c56b59ef4fec06726fa0dda4854d0631e6d | delete tempfile after uploading screenshot | restclient.py | restclient.py | import json
import requests
from bs4 import BeautifulSoup
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from ui.Ui_LoginDialog import Ui_LoginDialog
def getLoginToken(address, email, password, timeout=15):
""" attempt to get a login token. KeyError means invalid username or ... | Python | 0.000001 | @@ -21,16 +21,26 @@
equests%0A
+import os%0A
from bs4
@@ -747,23 +747,16 @@
timeout)
-.json()
%0A%0A ##
@@ -938,16 +938,23 @@
return r
+.json()
%5B'respon
@@ -1026,16 +1026,29 @@
en, path
+, delete=True
):%0A %22
@@ -1198,16 +1198,55 @@
rb%22) %7D)%0A
+ if delete:%0A os.unlink(path)%0A
ret... |
7484c8d4ab699ee16bc867cdff1e7ec699dbb142 | Add profiling support to Melange. By assigning profile_main_as_logs or profile_main_as_html to main variable you can turn on profiling. profile_main_as_logs will log profile data to App Engine console logs, profile_main_as_html will show profile data as html at the bottom of the page. If you want to profile app on depl... | app/main.py | app/main.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 | @@ -1813,15 +1813,1320 @@
def
-main():
+profile_main_as_html():%0A %22%22%22Main program for profiling. Profiling data added as HTML to the page.%0A %22%22%22%0A import cProfile%0A import pstats%0A import StringIO%0A%0A prof = cProfile.Profile()%0A prof = prof.runctx('real_main()', globals(), locals())%0A str... |
04572dc4b4ad8a98ce293a3357e0a35088325e57 | Fix spelling error in documentation. | db/apply.py | db/apply.py | #!/usr/bin/python
import pprint
#from planetlab.types import *
from planetlab import session
from slices import *
from sites import *
import sys
def usage():
return """
apply.py takes static configurations stored in sites.py and slices.py
and applies them to the PLC database adding or updating object... | Python | 0.000002 | @@ -431,18 +431,18 @@
./apply.
-y
p
+y
--syncs
|
3da4ad7b8c58f2b94e038576bcd79794529b9f4f | fix unit test, order dataframes | _unittests/ut_pandas_helper/test_table_formula.py | _unittests/ut_pandas_helper/test_table_formula.py | """
@brief test log(time=2s)
"""
import sys
import os
import unittest
import pandas
from pandas.testing import assert_frame_equal
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
... | Python | 0.000001 | @@ -1483,32 +1483,108 @@
_b=%5B3.2, 3.1%5D))%0A
+ exp.sort_index(inplace=True)%0A group.sort_index(inplace=True)%0A
assert_f
@@ -1602,24 +1602,24 @@
group, exp)%0A
-
%0A gro
@@ -1907,32 +1907,111 @@
_b=%5B2.1, 3.1%5D))%0A
+ exp.sort_index(inplace=True)%0A groupmax.sort_in... |
da3d6e89f660e7fd6d9b8d32a9aab50b7234e737 | Fix comment | elizabeth/utils.py | elizabeth/utils.py | import functools
import json
from os.path import (
abspath,
dirname,
join
)
from elizabeth.exceptions import UnsupportedLocale
__all__ = ['pull']
PATH = abspath(join(dirname(__file__), 'data'))
SUPPORTED_LOCALES = {
"da": {
"name": "Danish",
"name_local": "Dansk"
},
"de": {
... | Python | 0 | @@ -1771,16 +1771,17 @@
orithm.%0A
+%0A
See:
|
fc05512b3ad40f6571ee3d942e4829a19e2a465e | Add core.models.Sensor | sensor/core/models.py | sensor/core/models.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from django.db import models
class GenericSensor(models.Model):
"""Represents a sensor abstracting away the spe... | Python | 0.000002 | @@ -602,8 +602,185 @@
model')%5D
+%0A%0A%0Aclass Sensor(models.Model):%0A %22%22%22Base class for specific sensor types.%22%22%22%0A%0A generic_sensor = models.OneToOneField(GenericSensor)%0A%0A class Meta:%0A abstract = True
|
13054b372375cd1a0abf5cf2be1eff722fdb7213 | Remove useless commented code | sentry/conf/server.py | sentry/conf/server.py | """
sentry.conf.server
~~~~~~~~~~~~~~~~~~
These settings act as the default (base) settings for the Sentry-provided web-server
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django.conf.global_settings import *
import hashlib
import ... | Python | 0 | @@ -2747,53 +2747,8 @@
r',%0A
-# 'django.template.loaders.eggs.Loader',%0A
)%0A%0AM
|
d9d9b993edc8baebf69b446d40f0a05260a041d5 | Remove prints | emailauth/tests.py | emailauth/tests.py | from django.test import Client, TestCase
from emailauth import forms
c = Client()
class FormTests(TestCase):
def test_creation_form(self):
form_data = {'email': 'test@test.com', 'password1': 'test1234', 'password2': 'test1234'}
form = forms.UserCreationForm(form_data)
# Testing if form ... | Python | 0.000002 | @@ -1261,48 +1261,8 @@
/')%0A
- print(get_response.status_code)%0A
@@ -1343,21 +1343,12 @@
test
-u
+U
ser
-@test.com
',%0A
@@ -1435,55 +1435,8 @@
%7D)%0A
- print(post_response_wrong.status_code)%0A
@@ -1590,32 +1590,32 @@
'testPass1234',%0A
+
%7D)%0A
@@ -1613,49 +1613,8 @... |
88ee9a485534f442978f9b29a1dbcf15cd245b25 | simplify fragment copy loop | distance/filter/base.py | distance/filter/base.py | """Base classes for filters."""
from distance.base import Transform, TransformError
from distance.level import Level
from distance.levelobjects import Group
from distance import levelfragments as levelfrags
ANIM_FRAG_TYPES = (
levelfrags.AnimatorFragment,
levelfrags.EventListenerFragment,
levelfrags.Tra... | Python | 0.000063 | @@ -546,213 +546,109 @@
+f
or
-g_secs = %5Bs.to_key(any_version=True) for s in orig.sections%5D%0A for sec in ANIM_FRAG_SECTIONS:%0A try:%0A idx = org_secs.index(sec)%0A except ValueError:%0A pass%0A else
+ i, sec in enumerate(orig.sections):%0A if sec.to_key(... |
c060f88310e979cdcb400cead73730cc7e1b6226 | Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model. | app/soc/models/group.py | app/soc/models/group.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 applicab... | Python | 0 | @@ -2163,25 +2163,98 @@
ups%22
-) %0A #: Optional
+,%0A verbose_name=ugettext_lazy('Created by'))%0A #: Required
fie
@@ -2398,24 +2398,24 @@
%0A #:
-Optional
+Required
email a
@@ -2671,32 +2671,32 @@
) %0A %0A #:
-Optional
+Required
field stori
@@ -2828,32 +2828,32 @@... |
4c0325f92f542b9af7e504be55b7c7d79d1af3c8 | Update some features | compiler.py | compiler.py | # -*- coding: utf-8 -*-
# This file is part of the pymfony package.
#
# (c) Alexandre Quercia <alquerci@email.com>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
"""
"""
from __future__ import absolute_import;
from pymfony.component.syste... | Python | 0 | @@ -912,16 +912,58 @@
zation';
+%0A TYPE_AFTER_REMOVING = 'AfterRemoving'
%0A%0A de
@@ -1063,16 +1063,61 @@
list();
+%0A self.__afterRemovingPasses = list();
%0A%0A de
@@ -1414,16 +1414,67 @@
Passes);
+%0A passes.extend(self.__afterRemovingPasses);
%0A%0A
@@ -1832,17 +1832,20 @@
... |
a5b9b12f3e16e3cf2bb1de6f61571f612981c468 | Use comma separated list of tags for tags --merge | v6/plugins/tags/tags.py | v6/plugins/tags/tags.py | # -*- coding: utf-8 -*-
# Copyright © 2012-2013 Roberto Alsina and others.
# 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 t... | Python | 0.000001 | @@ -2181,16 +2181,32 @@
list of
+comma-separated
tags, re
@@ -2217,18 +2217,12 @@
ing
-everything
+them
wit
@@ -2338,17 +2338,17 @@
%22foo
- bar baz
+,bar,baz,
usel
@@ -2461,24 +2461,72 @@
.%0A%0A %22%22%22%0A%0A
+ tags = _process_comma_separated_tags(tags)%0A%0A
if len(t
@@ -3586,24 +3586,125 @@... |
265e9added53d1eee1291b9e0b5a10bc7dfe19c8 | Make sure we don't have section A before doing the extra round of manipulation | myuw_mobile/test/dao/canvas.py | myuw_mobile/test/dao/canvas.py | from django.test import TestCase
from django.test.client import RequestFactory
from myuw_mobile.dao.canvas import get_indexed_data_for_regid
from myuw_mobile.dao.canvas import get_indexed_by_decrosslisted
from myuw_mobile.dao.schedule import _get_schedule
from myuw_mobile.dao.term import get_current_quarter
class Test... | Python | 0.000001 | @@ -691,32 +691,139 @@
urses/149650')%0A%0A
+ has_section_a = '2013,spring,TRAIN,100/A' in data%0A self.assertFalse(has_section_a)%0A%0A
trai
|
ae948a2dfdd62af2ba98a0ee506ddd48504ee64b | bump version to 0.6-dev | validictory/__init__.py | validictory/__init__.py | #!/usr/bin/env python
from validictory.validator import SchemaValidator
__all__ = [ 'validate', 'SchemaValidator' ]
__version__ = '0.5.0'
def validate(data, schema, validator_cls=SchemaValidator):
'''
Validates a parsed json document against the provided schema. If an
error is found a ValueError is raise... | Python | 0 | @@ -132,11 +132,15 @@
'0.
-5
+6
.0
+-dev
'%0A%0Ad
|
295a6dd0c2af01161ee5da274719596f043fe21c | Use encode('utf8') instead of str(...). | applyCrf.py | applyCrf.py | #!/usr/bin/env python
"""This program will read a JSON file (such as adjudicated_modeled_live_eyehair_100_03.json) and process it with CRF++. The labels assigned by CRF++ are printed."""
import argparse
import sys
import scrapings
import crf_features as crff
import CRFPP
def main(argv=None):
'''this is called if... | Python | 0.000001 | @@ -1805,14 +1805,24 @@
add(
-str(tf
+tf.encode('utf8'
))%0A
|
e7c142f6b4cbb4add64586c30297f0c3f983de88 | update field tooltip | addons/website_sale/models/res_config_settings.py | addons/website_sale/models/res_config_settings.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from ast import literal_eval
from odoo import api, models, fields
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
def _default_order_mail_template(self):
if self.env['i... | Python | 0 | @@ -2213,30 +2213,54 @@
lls
-*e-Commerce Inventory*
+the %22Website Delivery Information%22 application
')%0A%0A
|
1c2c9664d82d02ec2eb9929fe5370aa5e4b077b1 | simplify logic - is_act_as_username returns False, not just logs | djactasauth/backends.py | djactasauth/backends.py | # -*- coding: utf-8 -*-
import logging
import django
from django.contrib.auth.backends import ModelBackend
from django.contrib import auth
_authenticate_needs_request_arg = django.VERSION[:2] >= (1, 11)
log = logging.getLogger(__name__)
class FilteredModelBackend(ModelBackend):
def get_user(self, user_id):
... | Python | 0.998867 | @@ -1741,16 +1741,41 @@
ar_msg)%0A
+ return False%0A
@@ -2510,33 +2510,16 @@
rn None%0A
- try:%0A
@@ -2584,59 +2584,8 @@
ar)%0A
- except ValueError:%0A return None%0A
|
0cd3651810daceefa492bc303c74568d1a042ca6 | Fix get_proxy_ticket method usage | django_cas_ng/models.py | django_cas_ng/models.py | # ⁻*- coding: utf-8 -*-
from django.db import models
from django.conf import settings
from .utils import (get_cas_client, get_service_url, get_user_from_session)
from importlib import import_module
from cas import CASError
SessionStore = import_module(settings.SESSION_ENGINE).SessionStore
class ProxyError(ValueErr... | Python | 0.000004 | @@ -118,25 +118,8 @@
ent,
- get_service_url,
get
@@ -1702,59 +1702,8 @@
se:%0A
- service_url = get_service_url(request)%0A
@@ -1753,20 +1753,16 @@
=service
-_url
)%0A
@@ -1822,25 +1822,16 @@
cket(pgt
-, service
)%0A
|
db033a9560ee97b5281adbf05f3f452943d592d7 | Add test_get_on_call and test_weekly | django_on_call/tests.py | django_on_call/tests.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
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 a... | Python | 0 | @@ -1,186 +1,19 @@
-%22%22%22%0AThis file demonstrates writing tests using the unittest module. These will pass%0Awhen you run %22manage.py test%22.%0A%0AReplace this with more appropriate tests for your application.%0A%22%22%22
+import datetime
%0A%0Afr
@@ -44,16 +44,44 @@
stCase%0A%0A
+from .models import OnCall%0A... |
781e20bc3f465bdaac50f0f2a637b037d892c054 | Remove premature optimisation | src/registry.py | src/registry.py | from .formatters import *
class FormatRegistry():
def __init__(self):
self.__registered_formatters = [
ClangFormat(), ElmFormat(), GoFormat(), JavaScriptFormat(),
PythonFormat(), RustFormat(), TerraformFormat()
]
self.__source_formatter_lookup_table = {}
for... | Python | 0.00005 | @@ -80,35 +80,24 @@
self.__
-registered_
formatters =
@@ -244,192 +244,8 @@
%5D
-%0A self.__source_formatter_lookup_table = %7B%7D%0A for formatter in self.__registered_formatters:%0A self.__source_formatter_lookup_table%5Bformatter.source%5D = formatter
%0A%0A
@@ -301,19 +301,8 @... |
945e7d1ef165054891a0ac574d52f6a1c3b7a162 | Add long help | code_gen.py | code_gen.py | import sys
import getopt
from config import CONFIG
from ida_code_gen import IdaCodeGen
from ida_parser import IdaInfoParser
def print_help():
print 'Options:'
print ' -d, --database Path to database from arguments. Default = ' + CONFIG['database']
print ' -o, --out_dir Path to output directory for c... | Python | 0.000121 | @@ -647,16 +647,25 @@
vdo', %5B'
+help', ''
verbose'
@@ -813,12 +813,24 @@
==
+(
'-h'
+, '--help')
:%0A
|
2ad94140360f893ad46b1b972e753f2a78b5f779 | print function | example/example.py | example/example.py | # coding: utf-8
import json
import os
import lastpass
with open(os.path.join(os.path.dirname(__file__), 'credentials.json')) as f:
credentials = json.load(f)
username = str(credentials['username'])
password = str(credentials['password'])
try:
# First try without a multifactor password
vault = last... | Python | 0.00093 | @@ -941,15 +941,47 @@
rint
-
+(%22%7B%7D %7B%7D %7B%7D %7B%7D %7B%7D %7B%7D %7B%7D%22.format(
index
-+
+ +
1, i
@@ -1031,9 +1031,11 @@
i.group
+))
%0A
|
cefa0a94582e40f92c48d6c91cf393c9b0310713 | fix geojson in sources dir | validate.py | validate.py |
import json
import re
import click
import jsonschema
import utils
@click.command()
@click.argument('schema', type=click.File('r'), required=True)
@click.argument('jsonfiles', type=click.Path(exists=True), required=True)
def validate(schema, jsonfiles):
"""Validate a JSON files against a JSON schema.
\b
... | Python | 0.000003 | @@ -502,24 +502,67 @@
jsonfiles):%0A
+ if path.startswith('sources'):%0A
rege
@@ -571,27 +571,122 @@
= r'
-(
sources
-%7Cgenerated)
+/%5BA-Z%5D%7B2%7D/%5BA-Z%5D%7B2%7D/%5Ba-z-%5D+.json'%0A elif path.startswith('generated'):%0A regex = r'generated
/%5BA-
@@ -712,19 +712,54 @@
-... |
6d35c533940db6a6d664546c2b97e5c12c92dcfe | remove yaml parser for bandap GMM | example/src/yml.py | example/src/yml.py | # -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import os
import yaml
class SpeakerYML(object):
def __init__(self, ymlf):
# open yml file
with open(ymlf) as yf:
conf = yaml.safe_load(yf)
# read parameter from yml file
self.wa... | Python | 0.000005 | @@ -1389,269 +1389,8 @@
'%5D%0A%0A
- self.GMM_bandap_n_mix = conf%5B'GMM'%5D%5B'bandap'%5D%5B'n_mix'%5D%0A self.GMM_bandap_n_iter = conf%5B'GMM'%5D%5B'bandap'%5D%5B'n_iter'%5D%0A self.GMM_bandap_covtype = conf%5B'GMM'%5D%5B'bandap'%5D%5B'covtype'%5D%0A self.GMM_bandap_cvtype = conf%5B'GMM'%... |
7e16a9feb88023a03363aee5be552a2f15b825fc | 修复 waiting 状态下颜色错误的问题 | utils/templatetags/submission.py | utils/templatetags/submission.py | # coding=utf-8
def translate_result(value):
results = {
0: "Accepted",
1: "Runtime Error",
2: "Time Limit Exceeded",
3: "Memory Limit Exceeded",
4: "Compile Error",
5: "Format Error",
6: "Wrong Answer",
7: "System Error",
8: "Waiting"
}
... | Python | 0.000007 | @@ -593,11 +593,9 @@
==
-%228%22
+8
:%0A
|
d17a88ac9ef8e3806c7ac60d31df62a1041939cb | Add sum_of_spreads | muv/spatial.py | muv/spatial.py | """
Spatial statistics.
"""
__author__ = "Steven Kearnes"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"
import numpy as np
def spread(d, t):
"""
Calculate the spread between two sets of compounds.
Given a matrix containing distances between two sets of compounds, A
... | Python | 0.998996 | @@ -588,17 +588,17 @@
%22%22%22%0A
-p
+s
= np.me
@@ -634,10 +634,906 @@
return
-p
+s%0A%0A%0Adef sum_of_spreads(d, coeff, min_t=0, max_t=3, step=None):%0A %22%22%22%0A Calculate the sum of spreads across a range of distance thresholds.%0A%0A Parameters%0A ----------%0A d : ndarray%0A Dis... |
e05736cd36bc595070dda78e91bcb1b4bcfd983c | Remove deprecated usage of `reflect` constructor param | microcosm_postgres/operations.py | microcosm_postgres/operations.py | """
Common database operations.
"""
from sqlalchemy import MetaData
from sqlalchemy.exc import ProgrammingError
from microcosm_postgres.migrate import main
from microcosm_postgres.models import Model
def stamp_head(graph):
"""
Stamp the database with the current head revision.
"""
main(graph, "stam... | Python | 0 | @@ -1794,22 +1794,36 @@
gres
-,
+)%0A _metadata.
reflect
-=True
+(
)%0A
|
92d1b23208912ca4c8a440468caf7bc595704d8c | Add test for the PeriodOverlapFilterBackend | django/website/logframe/tests/test_api.py | django/website/logframe/tests/test_api.py | from datetime import date, timedelta
from inspect import isfunction
from django.contrib.auth.models import Permission
from django.db.models.query_utils import Q
from django.test.client import RequestFactory
from django_dynamic_fixture import G
import mock
import pytest
from rest_framework.request import Request
from... | Python | 0 | @@ -416,16 +416,22 @@
import
+(%0A
CanEditO
@@ -440,16 +440,20 @@
eadOnly,
+%0A
IDFilte
@@ -461,16 +461,52 @@
Backend,
+%0A PeriodOverlapFilterBackend,%0A
get_per
@@ -516,16 +516,18 @@
_filter%0A
+)%0A
%0A%0A@pytes
@@ -1955,25 +1955,26 @@
():%0A
-yesterday
+start_date
= date.
@@ -2005,21... |
78c5ef063a82d707b30eed4a6e02fcbc8976f4df | move sort code to the end, so initial result will be sorted too. | django_project/feti/views/landing_page.py | django_project/feti/views/landing_page.py | # coding=utf-8
"""FETI landing page view."""
__author__ = 'Christian Christelis <christian@kartoza.com>'
__date__ = '04/2015'
__license__ = "GPL"
__copyright__ = 'kartoza.com'
from collections import OrderedDict
from haystack.query import SearchQuerySet
from django.shortcuts import render
from django.http import Htt... | Python | 0 | @@ -758,16 +758,32 @@
cription
+.strip().lower()
%0A%0A se
@@ -1697,108 +1697,8 @@
se%5D%0A
- course_dict = OrderedDict(%0A sorted(course_dict.items(), key=campus_key))%0A
@@ -2104,24 +2104,109 @@
rses.all()%0A%0A
+ course_dict = OrderedDict(%0A sorted(course_dict.items(... |
c7f8fd75dd5b41a059b65e9cea54d875d1f57655 | Change self to PortStatCollector. | src/collectors/portstat/portstat.py | src/collectors/portstat/portstat.py | """
The PortStatCollector collects metrics about ports listed in config file.
##### Dependencies
* psutil
"""
from collections import Counter
import psutil
import diamond.collector
class PortStatCollector(diamond.collector.Collector):
def __init__(self, *args, **kwargs):
super(PortStatCollector, sel... | Python | 0 | @@ -1682,20 +1682,33 @@
stats =
-self
+PortStatCollector
.get_por
|
0744dba6a52c42dbe6f9ba360e5311a1f90c3550 | Fix python 3 compatibility issue in DNSimple driver. | libcloud/common/dnsimple.py | libcloud/common/dnsimple.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 not use ... | Python | 0 | @@ -774,16 +774,41 @@
icense.%0A
+%0Afrom libcloud.utils.py3
import h
|
725b246a0bbb437a5a0efeb16b58d3942f3b14cc | Update the example client. | examples/client.py | examples/client.py | from twisted.internet import reactor, defer
from txjason.netstring import JSONRPCClientFactory
from txjason.client import JSONRPCClientError
client = JSONRPCClientFactory('127.0.0.1', 7080)
@defer.inlineCallbacks
def stuff():
try:
r = yield client.callRemote('bar.foo')
except JSONRPCClientError as e... | Python | 0 | @@ -26,22 +26,30 @@
ort
-reactor, defer
+defer, endpoints, task
%0Afro
@@ -226,16 +226,144 @@
def
-stuff():
+main(reactor, description):%0A endpoint = endpoints.clientFromString(reactor, description)%0A client = JSONRPCClientFactory(endpoint)%0A
%0A
@@ -645,49 +645,45 @@
)%0A%0A%0A
-reactor.callWhenRunn... |
5dddadb98340fec6afda80fd1a8ee1eda907b60a | print exports to terminal | examples/export.py | examples/export.py | """
Demonstrates export console output
"""
from rich.console import Console
from rich.table import Table
console = Console(record=True)
def print_table():
table = Table(title="Star Wars Movies")
table.add_column("Released", style="cyan", no_wrap=True)
table.add_column("Title", style="magenta")
tabl... | Python | 0 | @@ -737,26 +737,8 @@
able
-, justify=%22center%22
)%0A%0A%0A
@@ -796,16 +796,53 @@
as text%0A
+file1 = %22table_export_plaintext.txt%22%0A
text = c
@@ -876,30 +876,13 @@
pen(
-%22plaintext_export.txt%22
+file1
, %22w
@@ -913,16 +913,75 @@
te(text)
+%0Aprint(f%22Exported console output as plain text to %7Bfile1%7... |
1741c7258ebdcef412442cebab33409290496df0 | Add network example | IoT/iot_utils.py | IoT/iot_utils.py | from __future__ import print_function
import sys, signal, atexit
import json
__author__ = 'KT Kirk'
__all__ = ['keys', 'atexit', 'signal']
## Exit handlers ##
# This function stops python from printing a stacktrace when you hit control-C
def SIGINTHandler(signum, frame):
raise SystemExit
# This function lets you... | Python | 0.000002 | @@ -696,8 +696,11 @@
on_file)
+%0A%0A%0A
|
525f4e7139fa36446ea344417107b86664d33269 | Fix #664 | yowsup/layers/protocol_media/protocolentities/message_media_downloadable_video.py | yowsup/layers/protocol_media/protocolentities/message_media_downloadable_video.py | from yowsup.structs import ProtocolEntity, ProtocolTreeNode
from .message_media_downloadable import DownloadableMediaMessageProtocolEntity
class VideoDownloadableMediaMessageProtocolEntity(DownloadableMediaMessageProtocolEntity):
'''
<message t="{{TIME_STAMP}}" from="{{CONTACT_JID}}"
offline="{{OFFLINE... | Python | 0 | @@ -2286,32 +2286,44 @@
if self.caption
+ is not None
:%0A ou
@@ -2962,24 +2962,87 @@
on%0A %0A
+ def getCaption(self):%0A return self.caption%0A %0A
def toPr
@@ -3917,16 +3917,28 @@
.caption
+ is not None
:%0A
|
b07243a6fb11dbbd487ba37620f7c8f4fc89449a | bump version to v1.10.5 | ndd/package.py | ndd/package.py | # -*- coding: utf-8 -*-
"""Template package file"""
__title__ = 'ndd'
__version__ = '1.10.4'
__author__ = 'Simone Marsili'
__summary__ = ''
__url__ = 'https://github.com/simomarsili/ndd'
__email__ = 'simo.marsili@gmail.com'
__license__ = 'BSD 3-Clause'
__copyright__ = 'Copyright (c) 2020, Simone Marsili'
__classifiers_... | Python | 0 | @@ -87,9 +87,9 @@
.10.
-4
+5
'%0A__
|
7abd9b977368a189ca3f298e566dd1dd5b7a66d1 | Update constant.py | vnpy/trader/constant.py | vnpy/trader/constant.py | """
General constant string used in VN Trader.
"""
from enum import Enum
class Direction(Enum):
"""
Direction of order/trade/position.
"""
LONG = "多"
SHORT = "空"
NET = "净"
class Offset(Enum):
"""
Offset of order/trade.
"""
NONE = ""
OPEN = "开"
CLOSE = "平"
CLOSETO... | Python | 0.000001 | @@ -2776,16 +2776,40 @@
TFINEX%22%0A
+ BINANCE = %22BINANCE%22%0A
%0A%0Aclass
|
5848a9c64744eacf8d90a86335e948ed17ef8346 | Correct path to workflows | src/prepare_asaim/import_workflows.py | src/prepare_asaim/import_workflows.py | #!/usr/bin/env python
import os
from bioblend import galaxy
admin_email = os.environ.get('GALAXY_DEFAULT_ADMIN_USER', 'admin@galaxy.org')
admin_pass = os.environ.get('GALAXY_DEFAULT_ADMIN_PASSWORD', 'admin')
url = "http://localhost:8080"
gi = galaxy.GalaxyInstance(url=url, email=admin_email, password=admin_pass)
wf... | Python | 0.000018 | @@ -385,37 +385,24 @@
local_path('
-/home/galaxy/
asaim_main_w
@@ -446,37 +446,24 @@
local_path('
-/home/galaxy/
asaim_taxono
@@ -531,37 +531,24 @@
local_path('
-/home/galaxy/
asaim_functi
@@ -617,37 +617,24 @@
local_path('
-/home/galaxy/
asaim_go_sli
@@ -707,21 +707,8 @@
th('
-/home/galaxy/
asai
|
0d31cbfd3042a1e7255ed833715112504fe608ae | Revert types | dshin/nn/types.py | dshin/nn/types.py | """
TensorFlow type annotation aliases.
"""
import typing
import tensorflow as tf
Value = (tf.Variable, tf.Tensor)
Values = typing.Sequence[Value]
Named = (tf.Variable, tf.Tensor, tf.Operation)
NamedSeq = typing.Sequence[Named]
Tensors = typing.Sequence[tf.Tensor]
Variables = typing.Sequence[tf.Variable]
Operations =... | Python | 0.000001 | @@ -85,17 +85,29 @@
Value =
-(
+typing.Union%5B
tf.Varia
@@ -120,17 +120,17 @@
f.Tensor
-)
+%5D
%0AValues
@@ -166,9 +166,21 @@
d =
-(
+typing.Union%5B
tf.V
@@ -215,9 +215,9 @@
tion
-)
+%5D
%0ANam
|
8a3ae1b809d886f647f13574cc9b416b17c27b7c | Remove VERSION variable from api.py | duckduckpy/api.py | duckduckpy/api.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from collections import namedtuple
from utils import camel_to_snake_case
SERVER_HOST = 'api.duckduckgo.com'
VERSION = '0.1-alpha'
USER_AGENT = 'duckduckpy {0}'.format(VERSION)
ICON_KEYS = set(['URL', 'Width', 'Height'])
RESULT_KEYS = set(['FirstURL', 'I... | Python | 0.000002 | @@ -58,16 +58,49 @@
iterals%0A
+from __init__ import __version__%0A
from col
@@ -131,16 +131,27 @@
le%0Afrom
+duckduckpy.
utils im
@@ -215,30 +215,8 @@
om'%0A
-VERSION = '0.1-alpha'%0A
USER
@@ -252,15 +252,19 @@
mat(
-VERSION
+__version__
)%0A%0AI
|
ee5e9d09a02e52714291a44148be4722f8e495ac | Revert "Take Abode camera snapshot before fetching latest image" (#68626) | homeassistant/components/abode/camera.py | homeassistant/components/abode/camera.py | """Support for Abode Security System cameras."""
from __future__ import annotations
from datetime import timedelta
from typing import Any, cast
from abodepy.devices import CONST, AbodeDevice as AbodeDev
from abodepy.devices.camera import AbodeCamera as AbodeCam
import abodepy.helpers.timeline as TIMELINE
import reque... | Python | 0 | @@ -3020,63 +3020,8 @@
%22%22%22%0A
- if not self.capture():%0A return None%0A
|
82d562472fd738890fe72755a25392a12f7e7bc3 | Implement getArtist(name) function. | dbengine.py | dbengine.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sqlite3
dbname = "bandevents.db"
class DBEngine(object):
def __init__(self):
self.conn = None
self.cur = None
self.__firstRun()
def __firstRun(self):
if self.conn == None:
self.conn = sqlite3.connect(dbname)
... | Python | 0 | @@ -2855,27 +2855,288 @@
-pass # TODO
+q = u%22SELECT name, playcount FROM artist %22 %5C%0A + %22WHERE name = ? LIMIT 5;%22%0A results = self.cur.execute(q, %5Baname%5D)%0A for artist, playcount in results.fetchall():%0A yield %7B u%22artist%22 : artist, %5C%0A ... |
86c7f0bbacc59d00219b7f046150bd1bbf8da760 | Improve type hints in hive (#77586) | homeassistant/components/hive/climate.py | homeassistant/components/hive/climate.py | """Support for the Hive climate devices."""
from datetime import timedelta
import logging
from typing import Any
import voluptuous as vol
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
PRESET_BOOST,
PRESET_NONE,
ClimateEntityFeature,
HVA... | Python | 0 | @@ -4004,17 +4004,30 @@
set_mode
-)
+: str) -%3E None
:%0A
@@ -4262,16 +4262,17 @@
= round(
+(
self.cur
@@ -4287,16 +4287,22 @@
perature
+ or 0)
* 2) /
|
70f588282e1777945e113e73dbca83f77355f0f9 | Test git permission | driver/omni_driver.py | driver/omni_driver.py | import driver
import lib.lib as lib
from hardware.dmcc_motor import DMCCMotorSet
class OmniDriver(driver.Driver):
#Vijay was here
| Python | 0 | @@ -125,8 +125,23 @@
as here%0A
+%0A#Chad was here
|
2b0a0f2a575075fd44a8283d7f14efc9e0199f83 | Reformatted to better read. | dbfUtils.py | dbfUtils.py | import struct, datetime, decimal, itertools
def dbfreader(f):
"""Returns an iterator over records in a Xbase DBF file.
The first row returned contains the field names.
The second row contains field specs: (type, size, decimal places).
Subsequent rows contain the data records.
If a record is marked... | Python | 0.999999 | @@ -63,16 +63,21 @@
%0A %22%22%22
+%0A
Returns
@@ -118,24 +118,24 @@
e DBF file.%0A
-
%0A The fir
@@ -391,17 +391,16 @@
reads.%0A
-%0A
%22%22%22%0A
@@ -620,24 +620,25 @@
fields = %5B%5D%0A
+%0A
for fiel
@@ -860,16 +860,17 @@
deci))%0A
+%0A
yiel
@@ -1160,16 +1160,17 @@
ze(fmt)%0A
+%0A... |
a3f12245163a9165f45f4ee97b6e4e67cdd29783 | Update decipher.py | decipher.py | decipher.py | #
# decipher.py (c) Luis Hoderlein
#
# BUILT: Apr 21, 2016
#
# This program can brute force Cesarian ciphers
# It gives you all possible outputs, meaning you still have to chose the output you want
#
import string
def pad(num):
if num < 10:
return "0"+str(num)
else:
return str(num)
raw_txt = raw_input("Enter ... | Python | 0 | @@ -195,16 +195,26 @@
want%0A#%0A%0A
+# imports%0A
import s
@@ -220,16 +220,53 @@
string%0A%0A
+# adds padding to make output inline%0A
def pad(
@@ -333,16 +333,47 @@
r(num)%0A%0A
+# declare vars + ask for input%0A
raw_txt
@@ -445,34 +445,95 @@
%5B%5D%0A%0A
-raw_txt = raw_txt.lower()%0A
+# make all lower case (... |
71e96782caff8543c2e859226bd0b77a79a55040 | fix gate | e3nn_jax/_gate.py | e3nn_jax/_gate.py | from functools import partial
import jax
import jax.numpy as jnp
from e3nn_jax import IrrepsData, elementwise_tensor_product, scalar_activation
from e3nn_jax.util.decorators import overload_for_irreps_without_data
@partial(jax.jit, static_argnums=(1, 2, 3, 4))
def _gate(input: IrrepsData, even_act, odd_act, even_ga... | Python | 0.000001 | @@ -358,36 +358,36 @@
-# split l=0 vs l%3E0%0A j = 0
+scalars, gated = input, None
%0A
@@ -459,26 +459,16 @@
- break%0A
scal
@@ -497,16 +497,34 @@
it(%5Bj%5D)%0A
+ break%0A
asse
@@ -562,51 +562,17 @@
#
-apply scalar activation if there is n
+N
o gate
+s:
%0A
@@ -... |
f421b2997494ca546c6479e4246456e56b816e60 | Add Robert EVT ID too | libpebble2/util/hardware.py | libpebble2/util/hardware.py | __author__ = 'katharine'
class PebbleHardware(object):
UNKNOWN = 0
TINTIN_EV1 = 1
TINTIN_EV2 = 2
TINTIN_EV2_3 = 3
TINTIN_EV2_4 = 4
TINTIN_V1_5 = 5
BIANCA = 6
SNOWY_EVT2 = 7
SNOWY_DVT = 8
SPALDING_EVT = 9
BOBBY_SMILES = 10
SPALDING = 11
SILK_EVT = 12
SILK = 14
... | Python | 0 | @@ -297,16 +297,36 @@
VT = 12%0A
+ ROBERT_EVT = 13%0A
SILK
|
6bce6f9e0a44780503df59054c962ddd82d9b53f | Remove unused variables | decouple.py | decouple.py | # coding: utf-8
import os
import sys
# Useful for very coarse version differentiation.
PY3 = sys.version_info[0] == 3
if PY3:
from configparser import ConfigParser
string_type = str
string_empty = ''
else:
from ConfigParser import SafeConfigParser as ConfigParser
string_type = unicode
string_... | Python | 0.000007 | @@ -168,52 +168,8 @@
ser%0A
- string_type = str%0A string_empty = ''%0A
else
@@ -236,57 +236,8 @@
ser%0A
- string_type = unicode%0A string_empty = u''%0A
%0A%0Acl
|
d9af336506fcca40cbc5ebf337268cfd16459c4f | Use iter_log in example. | examples/ra_log.py | examples/ra_log.py | #!/usr/bin/python
# Demonstrates how to iterate over the log of a Subversion repository.
from subvertpy.ra import RemoteAccess
conn = RemoteAccess("svn://svn.gnome.org/svn/gnome-specimen/trunk")
def cb(changed_paths, rev, revprops, has_children=None):
print "=" * 79
print "%d:" % rev
print "Revision prop... | Python | 0 | @@ -157,36 +157,27 @@
svn.
-gnome
+samba
.org/s
-vn/gnome-specimen
+ubvertpy
/tru
@@ -186,14 +186,12 @@
%22)%0A%0A
-def cb
+for
(cha
@@ -229,20 +229,120 @@
children
-=Non
+) in conn.iter_log(paths=None,%0A start=0, end=conn.get_latest_revnum(), discover_changed_paths=Tru
e):%0A
@@ -493,20 +493,16 @@
... |
1fdcf3b9a590bf52f42ce3ce5cdfbae07dc7100d | remove remaining settings | src/settings.py | src/settings.py | import os
gettext = lambda s: s
"""
Django settings for demo project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: o... | Python | 0.000001 | @@ -1485,361 +1485,8 @@
'),%0A
- # NOTE: we need to expose private in order for django-libsass to work%0A # TODO: we need to find a way arount this as we do not want to expose the source files%0A os.path.join(BASE_DIR, 'private'),%0A)%0A%0ASTATICFILES_FINDERS = (%0A 'django.contrib.staticfiles.finders.File... |
7e7ec43b7d98e5afc42bfd25e3d43ae468771340 | fix #369; add script to strip extra space around/within existing sentences | docs/database/scripts/clean_whitespace.py | docs/database/scripts/clean_whitespace.py | #Script for removing unwanted ASCII whitespace from sentences:
# - leading/trailing whitespace
# - internal sequences of more than one whitespace character
# - internal tabs and newlines
# By default, uses the MySQL credentials (username, password, db name) and hostname of the VM.
# To run on the server, you must s... | Python | 0.000001 | @@ -2355,16 +2355,68 @@
strip()%0A
+ new_text = new_text.replace(%22'%22, r%22%5C'%22)%0A
|
1d0d28ebdda25a7dc579857063d47c5042e6c02b | Enable south for the docs site. | django_docs/settings.py | django_docs/settings.py | # Settings for docs.djangoproject.com
from django_www.common_settings import *
### Django settings
CACHE_MIDDLEWARE_KEY_PREFIX = 'djangodocs'
INSTALLED_APPS = [
'django.contrib.sitemaps',
'django.contrib.sites',
'django.contrib.staticfiles',
'djangosecure',
'haystack',
'docs',
]
MIDDLEWA... | Python | 0 | @@ -288,16 +288,29 @@
ystack',
+%0A 'south',
%0A%0A 'd
@@ -1379,24 +1379,74 @@
cs.index'%0A%0A%0A
+### South settings%0A%0ASOUTH_TESTS_MIGRATE = False%0A%0A%0A
### Enable o
|
3434c404d8ab3d42bed4756338f1b8dba3a10255 | split debug_plot into debug and plot | src/settings.py | src/settings.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
debug = False
debug_plot = False
plot = False
# CE hack is ON
CE = True
def plt_show():
from matplotlib import pyplot as plt
if debug_plot:
plt.show()... | Python | 0.998673 | @@ -293,16 +293,36 @@
bug_plot
+ or (debug and plot)
:%0A
|
2dc0ac43b50c61aa10576779a8228ff578c37068 | Use get_user_model | src/auditlog/middleware.py | src/auditlog/middleware.py | from __future__ import unicode_literals
import threading
import time
from django.conf import settings
from django.db.models.signals import pre_save
from django.utils.functional import curry
from django.apps import apps
from auditlog.models import LogEntry
from auditlog.compat import is_authenticated
# Use Middleware... | Python | 0.000004 | @@ -83,17 +83,25 @@
.con
-f
+trib.auth
import
sett
@@ -96,24 +96,30 @@
import
-settings
+get_user_model
%0Afrom dj
@@ -203,37 +203,8 @@
rry%0A
-from django.apps import apps%0A
from
@@ -2764,269 +2764,8 @@
urn%0A
- try:%0A app_label, model_name = settings.AUTH_USER_MODEL.split('.')%... |
00c14e981807668b09a5d6a2e71fe8872291acad | Add admin support for attachments | django_mailbox/admin.py | django_mailbox/admin.py | from django.conf import settings
from django.contrib import admin
from django_mailbox.models import Message, Mailbox
def get_new_mail(mailbox_admin, request, queryset):
for mailbox in queryset.all():
mailbox.get_new_mail()
get_new_mail.short_description = 'Get new mail'
class MailboxAdmin(admin.ModelAdmi... | Python | 0 | @@ -93,16 +93,35 @@
s import
+ MessageAttachment,
Message
@@ -130,16 +130,16 @@
Mailbox%0A
-
%0Adef get
@@ -504,16 +504,74 @@
_mail%5D%0A%0A
+class MessageAttachmentAdmin(admin.ModelAdmin):%0A pass%0A%0A
class Me
@@ -981,16 +981,16 @@
True):%0A
-
admi
@@ -1028,16 +1028,83 @@
eAdmin)%0A
+ admin.site... |
472e24a080132a78af0128a4f89e73c86527f761 | set 755 permissions on s2protocol.py so that it can be executed | s2protocol.py | s2protocol.py | #!/usr/bin/env python
#
# Copyright (c) 2013 Blizzard Entertainment
#
# 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, co... | Python | 0 | |
2d42d48863bb2fb063ab09c659ceaf4f3f32e2cf | Fix first fetching of the weboob's module; | server/weboob/main.py | server/weboob/main.py | #!/usr/bin/env python
from weboob.core import Weboob
from weboob.core.modules import ModuleLoadError
from weboob.exceptions import BrowserIncorrectPassword, BrowserPasswordExpired
from weboob.tools.backend import Module
import json
import os
import sys
DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
# cwd is /build/server
e... | Python | 0 | @@ -1501,16 +1501,487 @@
weboob()
+%0A%0A # Careful: this is extracted from weboob's code.%0A # Install the module if necessary and hide the progress.%0A class DummyProgress:%0A def progress(self, a, b):%0A pass%0A repositories = self.weboob.repositories%0A ... |
48c880a35c899929da33f20e9cd4ee7e4fd8bc7e | Set a custom name template including the replica set | servers/mongo/data.py | servers/mongo/data.py | from .. import Server
import logging
class MongoDataNode(Server):
log = logging.getLogger('Servers.MongoDataNode')
log.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter(
'%(asctime)s [%(name)s] %(levelname)s: %(message)s',
... | Python | 0 | @@ -1683,12 +1683,512 @@
et_index))%0A%0A
+ @property%0A def name(self):%0A%0A try:%0A return self.unique_name%0A except Exception:%0A pass%0A%0A template = '%7Benvcl%7D-rs%7Bset%7D-%7Bzone%7D-%7Bindex%7D'%0A name = template.format(envcl=self.envcl, set=self.repl... |
48303bced57e8e7c51a309c623b4da60b3920fba | Add /usr/local/namebench as a valid path, since that's where Python on Ubuntu puts us | libnamebench/util.py | libnamebench/util.py | # Copyright 2009 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python | 0.000001 | @@ -2966,32 +2966,74 @@
etc/namebench',%0A
+ '/usr/local/namebench',%0A
|
cac7a02edd2f1effdf3da181542721a06e971790 | Increase cached_input to 5 minutes | flexget/utils/cached_input.py | flexget/utils/cached_input.py | from __future__ import unicode_literals, division, absolute_import
import copy
import logging
import hashlib
from datetime import datetime, timedelta
from sqlalchemy import Column, Integer, String, DateTime, PickleType, Unicode, ForeignKey
from sqlalchemy.orm import relation
from flexget import db_schema
from flexget.u... | Python | 0.000011 | @@ -2402,16 +2402,17 @@
me='
-1
+5
minute
+s
')%0A%0A
|
71289d3a22476001421454ff736ea03742e43158 | Add basic parser | vumi_twilio_api/twilml_parser.py | vumi_twilio_api/twilml_parser.py | class Verb(object):
"""Represents a single verb in TwilML. """
def __init__(self, verb, attributes={}, nouns={}):
self.verb = verb
self.attributes = attributes
self.nouns = nouns
| Python | 0.000334 | @@ -1,8 +1,45 @@
+import xml.etree.ElementTree as ET%0A%0A%0A
class Ve
@@ -242,8 +242,749 @@
= nouns%0A
+%0A%0Aclass TwilMLParseError(Exception):%0A %22%22%22Raised when trying to parse invalid TwilML%22%22%22%0A%0A%0Aclass TwilMLParser(object):%0A %22%22%22Parser for TwilML%22%22%22%0A%0A def parse_xml(self... |
84642bab00aecbb061789fc9e8a5d5103e3e9e42 | add getdict | panoramisk/message.py | panoramisk/message.py | from . import utils
from urllib.parse import unquote
class Message(utils.CaseInsensitiveDict):
"""Handle both Responses and Events with the same api:
..
>>> resp = Message({'Response': 'Follows'}, 'Response body')
>>> event = Message({'Event': 'MeetmeEnd', 'Meetme': '4242'})
Responses:
... | Python | 0.000001 | @@ -2361,16 +2361,906 @@
self)%0A%0A
+ def getdict(self, key):%0A %22%22%22Convert a multi values header to a case-insensitive dict:%0A%0A .. code-block:: python%0A%0A %3E%3E%3E resp = Message(%7B%0A ... 'Response': 'Success',%0A ... 'ChanVariable': %5B%0A ... |
948ce666053eee9fbdfd7f14e9f02e0aa6bdd18d | list[:limit] works fine if limit=None | djangofeeds/feedutil.py | djangofeeds/feedutil.py | from django.utils.text import truncate_html_words
from djangofeeds import conf
from datetime import datetime
from djangofeeds.optimization import BeaconDetector
import time
from datetime import datetime, timedelta
_beacon_detector = BeaconDetector()
def entries_by_date(entries, limit=None):
"""Sort the feed entr... | Python | 0.999999 | @@ -1138,17 +1138,17 @@
try for
-(
+_
date, en
@@ -1150,17 +1150,16 @@
e, entry
-)
in sort
@@ -1173,23 +1173,14 @@
ies%5B
-slice(0,
+:
limit
-)
%5D%5D%0A%0A
|
a49095bf078603e046288629aa8497f031ed6bd3 | Add transpose_join, joins 2 infinite lists by transposing the next elements | node/divide.py | node/divide.py | #!/usr/bin/env python
from nodes import Node
class Divide(Node):
"""
Takes two items from the stack and divides them
"""
char = "/"
args = 2
results = 1
@Node.test_func([4,2], [2])
@Node.test_func([2,4], [0.5])
def func(self, a: Node.number, b: Node.number):
"""a/b... | Python | 0.000001 | @@ -15,16 +15,17 @@
python%0A
+%0A
from nod
@@ -43,96 +43,75 @@
ode%0A
-%0Aclass Divide(Node):%0A %22%22%22%0A Takes two items from the stack and divides them%0A %22%22%22
+from type.type_infinite_list import DummyList%0A%0A%0Aclass Divide(Node):
%0A
@@ -151,25 +151,16 @@
lts = 1%0A
- %0A
%0A ... |
e869d59dddf6e574155a4c5307b184d46e145d7c | Delete Feeds/Posts and retry query if MultipleObjectsReturned | djangofeeds/managers.py | djangofeeds/managers.py | from django.db import models
from django.db.models.query import QuerySet
from djangofeeds.utils import truncate_field_data
DEFAULT_POST_LIMIT = 5
def update_with_dict(obj, fields):
set_value = lambda (name, val): setattr(obj, name, val)
map(set_value, fields.items())
obj.save()
return obj
class Ext... | Python | 0 | @@ -115,16 +115,27 @@
eld_data
+%0Aimport sys
%0A%0ADEFAUL
@@ -384,32 +384,299 @@
elf, **kwargs):%0A
+ try:%0A obj, created = self.get_or_create(**kwargs)%0A except self.model.MultipleObjectsReturned:%0A sys.stderr.write(%22djfeedsMultipleObjectsReturned: %25s%22 %25 (%0A ... |
04933787fc7d8783ce4ac100f946ca32c2599703 | Fix unicode issues generating MathJax JS | indico/modules/events/abstracts/views.py | indico/modules/events/abstracts/views.py | # This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | Python | 0.001111 | @@ -1011,16 +1011,293 @@
fBase%0A%0A%0A
+class _MathjaxMixin:%0A def _getHeadContent(self):%0A return (render('js/mathjax.config.js.tpl') +%0A b'%5Cn'.join(b'%3Cscript src=%22%7B0%7D%22 type=%22text/javascript%22%3E%3C/script%3E'.format(url)%0A for url in self._asset_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.