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 |
|---|---|---|---|---|---|---|---|
7404ba980569352149ee5cc27cb676474c69cea2 | remove index from sim-test-data | test/test_datasets.py | test/test_datasets.py | import statsmodels
import survivalstan
import random
random.seed(9001)
def load_test_dataset(n=50):
''' Load test dataset from R survival package
'''
dataset = statsmodels.datasets.get_rdataset(package='survival', dataname='flchain' )
d = dataset.data.query('futime > 7').sample(n=n)
d.reset_index(... | Python | 0.000013 | @@ -247,17 +247,16 @@
)%0A d
-
= datase
@@ -529,55 +529,8 @@
10)%0A
- dataset.reset_index(level=0, inplace=True)%0A
|
3489b2076faf101a1d834fa3ffcb2b92a88f2005 | Drop old symlinks | bin/init.py | bin/init.py | #! /usr/bin/env python
import symlinks
import os
from dotfiles import Dotfiles
def main():
homedir = os.environ['HOME']
dotfilesRoot = homedir + '/dotfiles'
d = Dotfiles(dotfilesRoot)
d.setup()
if __name__ == "__main__":
main()
| Python | 0.000001 | @@ -21,24 +21,8 @@
on%0A%0A
-import symlinks%0A
impo
|
91ff700aa179a6b9d36ad00cad6bd3b34ecfed0c | Simplify get_top_level_departments query | tx_salaries/models.py | tx_salaries/models.py | from datetime import datetime
from django.db import models
from django.utils.text import slugify
from jsonfield import JSONField
from tx_people import fields
from tx_people.models import Membership, Organization, Post
from tx_people import mixins
from . import managers
def get_top_level_departments():
"""
U... | Python | 0.999998 | @@ -766,17 +766,16 @@
return
-(
Organiza
@@ -791,139 +791,26 @@
cts.
-select_related('stats')%0A .filter(parent=None)%0A .exclude(children__members__employee=None).exclude(stats=None)
+filter(parent=None
)%0A%0A%0A
|
03dec924c6f38aa15b8280179d9b3a93568f9813 | Update netos FVP path | tools/harness/machines/fvp.py | tools/harness/machines/fvp.py | ##########################################################################
# Copyright (c) 2012-2016 ETH Zurich.
# All rights reserved.
#
# This file is distributed under the terms in the attached LICENSE file.
# If you do not find this file, copies can be found by writing to:
# ETH Zurich D-INFK, Universitaetstr 6, CH... | Python | 0 | @@ -612,56 +612,8 @@
_v5.
-24.0/bin'%0AFVP_PATH = '/home/moritz/apps/DS-5_v5.
25.0
|
c62167939485954ede7f1e5e709741e80c9a1127 | Update create_sample_job.py | etc/create_sample_job.py | etc/create_sample_job.py | import json
import uuid
import etcd
job_id1 = str(uuid.uuid4())
job = {
"integration_id": "49fa2adde8a6e98591f0f5cb4bc5f44d",
"sds_type": "generic",
"flow": "ExecuteCommand",
"object_type": "generic",
"status": 'new',
"message": 'Executing command',
"attributes": {
"_raw_input": "... | Python | 0.000002 | @@ -95,127 +95,103 @@
%22: %22
-49fa2adde8a6e98591f0f5cb4bc5f44d%22,%0A %22sds_type%22: %22generic%22,%0A %22flow%22: %22ExecuteCommand%22,%0A %22object_type%22: %22generic
+rohan_create_job_script_test%22,%0A %22run%22: %22tendrl.node_agent.flows.import_cluster.ImportCluster
%22,%0A
@@ -207,148 +207,369... |
939cb080a193e14af8ceb44df3b631f5c2f6bf6d | fix tools/make_test_event_data.py | tools/make_test_event_data.py | tools/make_test_event_data.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
#
# Unless required by applicable law or agreed to in writing, softwa... | Python | 0.000076 | @@ -2005,16 +2005,57 @@
traits
+,%0A %7B%7D
))%0A
|
267a1afaf27122954ce04220f55667109c6ccbf6 | change logic for source.url in case of tor_node | intelmq/bots/parsers/blueliv/parser_crimeserver.py | intelmq/bots/parsers/blueliv/parser_crimeserver.py | # -*- coding: utf-8 -*-
"""
"""
import json
from intelmq.lib import utils
from intelmq.lib.bot import Bot
from intelmq.lib.harmonization import IPAddress
TYPES = {
'PHISHING': 'phishing',
'MALWARE': 'malware',
'EXPLOIT_KIT': 'exploit',
'BACKDOOR': 'backdoor',
'TOR_IP': 'proxy',
'C_AND_C': 'c&... | Python | 0.000001 | @@ -104,56 +104,8 @@
Bot
-%0Afrom intelmq.lib.harmonization import IPAddress
%0A%0ATY
@@ -915,29 +915,52 @@
-if not tor_node:%0A
+raise_failure = False if tor_node else True%0A
@@ -998,33 +998,33 @@
rl', item%5B'url'%5D
-)
+,
%0A
@@ -1025,17 +1025,8 @@
- else:%0A
@@ -10... |
94ed5af698d41408534c4e365cc3d2f8d3baa4c0 | Make docenizer output linted code. | etc/scripts/docenizer.py | etc/scripts/docenizer.py | #! /usr/bin/env python2
# -*- coding: utf-8 -*-
import os
import argparse
import re
import json
try:
from bs4 import BeautifulSoup
except ImportError:
raise ImportError("Please install BeautifulSoup (apt-get install python-bs4 should do it)")
parser = argparse.ArgumentParser(description='Docenizes HTML versio... | Python | 0.000001 | @@ -5821,24 +5821,28 @@
f.write('
+
case %22%7B%7D
@@ -5886,24 +5886,28 @@
te('
+
return %7B%7D;%5Cn
@@ -5907,13 +5907,8 @@
n %7B%7D
-;%5Cn%5Cn
'.fo
@@ -6101,11 +6101,78 @@
-%7D))
+ %7D, indent=16, separators=(',', ': ')))%5B:-1%5D + ' %7D;%5Cn%5Cn'
)%0A
|
6aadd0ff991df18f59152f65d0332c913ba91b93 | add stats calc | bin/extract_darkmatter.py | bin/extract_darkmatter.py | #!/usr/bin/env python
import argparse
import leveldb
import os
import shutil
import sys
from Bio import SeqIO
def main(args):
parser = argparse.ArgumentParser(description="Script to extract darkmatter - predicted proteins with no similarities")
parser.add_argument("-i", "--input", dest="input", help="Name of ... | Python | 0.000001 | @@ -27,88 +27,733 @@
ort
-argparse%0Aimport leveldb%0Aimport os%0Aimport shutil%0Aimport sys%0Afrom Bio import SeqIO
+os%0Aimport sys%0Aimport json%0Aimport shutil%0Aimport leveldb%0Aimport argparse%0Aimport subprocess%0Afrom Bio import SeqIO%0A%0Adef get_seq_stats(fname):%0A stats = %7B%7D%0A cmd = %5B%22seq... |
5ca890fe8273c101056a8d93f47760514801e642 | Fix little bug on context (#3202) | example/rnn/rnn_model.py | example/rnn/rnn_model.py |
# pylint: disable=C0111,too-many-arguments,too-many-instance-attributes,too-many-locals,redefined-outer-name,fixme
# pylint: disable=superfluous-parens, no-member, invalid-name
import sys
sys.path.insert(0, "../../python")
import numpy as np
import mxnet as mx
from lstm import LSTMState, LSTMParam, lstm, lstm_inferen... | Python | 0 | @@ -1351,24 +1351,19 @@
ind(ctx=
-mx.cpu()
+ctx
, **inpu
|
3702edd34881a95db656eb83a952a245a18edc62 | remove debug print | lib/neuroimaging/__init__.py | lib/neuroimaging/__init__.py | """
Insert long description here.
"""
import re
from path import path
__version__ = "0.01a"
packages = (
'neuroimaging',
'neuroimaging.tests',
'neuroimaging.data',
'neuroimaging.data.tests',
'neuroimaging.fmri',
'neuroimaging.fmri.tests',
'neuroimaging.fmri.fmristat',
'neuroimaging.fmri.fmristat.tests... | Python | 0.000008 | @@ -2371,55 +2371,8 @@
e.%22%0A
- print %22import_from:%22,modulename,objectname%0A
|
bba82cbe37ea475e44ff668e56d9d5f9d8a06b4a | Debug true | diggems/settings.py | diggems/settings.py | # -*- coding: utf-8 -*-
# Django settings for diggems project.
import os.path
INSTALATION_DIR = os.path.split(os.path.split(__file__)[0])[0] + '/'
# Diggems specific settings:
DB_POOL_MAX_CONN = 40
## Facebook app settings
FB_APP_ID = '676057105742978'
FB_APP_KEY = 'b7313db851640b75d58bf07680d63ce9'
## URL that wi... | Python | 0.001037 | @@ -476,20 +476,19 @@
DEBUG =
-Fals
+Tru
e%0ATEMPLA
@@ -1300,19 +1300,8 @@
= %5B
-'localhost'
%5D%0A#
|
8199df621efe3f7663d138b2c531d9c382a3a869 | remove extraneous print statements | bigbench/benchmark_tasks/question_answer_creation/qa_creation_class.py | bigbench/benchmark_tasks/question_answer_creation/qa_creation_class.py | # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES ... | Python | 0.999999 | @@ -4531,54 +4531,8 @@
'%5D)%0A
- print(self._ds%5B0%5D)%0A print(self._ds%5B1%5D)%0A
|
01ddaaf654e188e52764d56d0220206022e259da | Improve message box msg #49 | pcef/core/modes/filewatcher.py | pcef/core/modes/filewatcher.py |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# PCEF - Python/Qt Code Editing Framework
# Copyright 2013, Colin Duquesnoy <colin.duquesnoy@gmail.com>
#
# This software is released under the LGPLv3 license.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, s... | Python | 0.000591 | @@ -1127,50 +1127,8 @@
f):%0A
- # TODO: put i18n for this method.%0A
@@ -1232,20 +1232,8 @@
ion(
-self.editor,
%0A
@@ -1249,16 +1249,34 @@
-%22Messa
+self.editor, %22File chan
ge
+d
%22,%0A
@@ -1299,59 +1299,156 @@
The
-document has been modified, Do you want reload it?%22
+file %3Ci%3E%25... |
3fcc6e4fe09ecaa27e5863b2650df101fc605db8 | Update Chapter05/PracticeQuestions/Question3.py added docstring | books/CrackingCodesWithPython/Chapter05/PracticeQuestions/Question3.py | books/CrackingCodesWithPython/Chapter05/PracticeQuestions/Question3.py | # Which Python instruction would import a module named watermelon.py?
import books.CrackingCodesWithPython.Chapter05.PracticeQuestions.watermelon as watermelon
def main():
watermelon.nutrition()
# If Question3.py is run (instead of imported as a module), call
# the main() function:
if __name__ == '__main__':
... | Python | 0 | @@ -1,10 +1,43 @@
-#
+%22%22%22 Chapter 5 Practice Question 3%0A%0A
Which Py
@@ -97,16 +97,75 @@
on.py?%0A%0A
+Note:%0A Contains spoilers for Chapter 7 (functions)%0A%22%22%22%0A%0A
import b
|
e42b1d4f673a43f0a0bc73723c697524e08ffdc7 | Change back to 1 second | backend/scripts/db_running.py | backend/scripts/db_running.py | #!/usr/bin/env python
#
# db_running.py will attempt to connect to the database. It will retry --retry times (defaults to 100), and will
# sleep for --sleep time (defaults to 1 second). It connects to the database on --port (defaults to 30815).
# db_running.py will exit 0 if is successfully connects. It will exit 1 if ... | Python | 0.99966 | @@ -1025,17 +1025,17 @@
efault=%22
-3
+1
%22)%0A%0A
|
1ef8508790071b8d19b0da5e3dde1f48eb9e9479 | add numpy | runColorMap.py | runColorMap.py | import matplotlib.cm as cmap
import ColorMapWriter
mpl_map = cmap.viridis(np.arange(256))
c = ColorMapWriter.ColorMapWriter(mpl_map, 'viridis.xml', 5)
c.createLookupTable() | Python | 0.004014 | @@ -22,16 +22,35 @@
as cmap%0A
+import numpy as np%0A
import C
@@ -63,16 +63,17 @@
pWriter%0A
+%0A
mpl_map
@@ -185,8 +185,9 @@
pTable()
+%0A
|
1c5acfdcdc46cb82b1ae5dcca2b2cc719cbbfb76 | use a better default name | dependencies/bgmodelbuilder/bgmodelbuilder/bgmodel.py | dependencies/bgmodelbuilder/bgmodelbuilder/bgmodel.py | """
@file bgmodel.py
@author: bloer
Defines the BgModel class, which collects metadata about a model definition.
The main purpose of this class is to aid in importing/exporting a complex
model to a bare dict.
"""
#python 2/3 compatibility
from __future__ import (absolute_import, division,
pr... | Python | 0.000382 | @@ -1716,16 +1716,27 @@
elf.name
+ or %22World%22
)%0A
|
b6d2955d0d52a0f6152ebddbf7c19bf58c16dd14 | Comment about some fields in model | backend/tournaments/models.py | backend/tournaments/models.py | from django.db import models
from django.contrib.auth.models import User
class Member(models.Model):
def __str__(self):
return str(self.user)
def name(self):
return self.user.username
user = models.OneToOneField(User, primary_key=True,
help_text='Basic account information, username, password, emai... | Python | 0 | @@ -1566,24 +1566,208 @@
er open.')%0A%0A
+ # games_start, rounds_count and rounds_start_cron are only used to generate%0A # 'Round' model, and after that should not be used.%0A # TODO(crem): Remove those fields from the model?%0A
games_star
|
f8479aa9b3416921d7d387efacedf8a36e4027fd | add cat /etc/ansible/hosts | bin/virt.py | bin/virt.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import yaml
import subprocess
import os
import sys
def proc(cmd,sh = True ):
p = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE, shell=sh)
p.wait()
outs, errs = p.communicate()
if p.returncode:
print(errs)
sys.exi... | Python | 0.000002 | @@ -933,140 +933,8 @@
O),%0A
- %22sudo apt-get update%22,%0A %22sudo apt-get install -qq sshpass%22,%0A %22ssh-keygen -b 2048 -t rsa -f $HOME/.ssh/id_rsa -q -N %5C%22%5C%22%22,%0A
@@ -1458,16 +1458,148 @@
list =%5B%0A
+ %22sudo apt-get update%22,%0A %22sudo apt-get install -qq sshpass%22,%0A %... |
0cbd437b536f9f24eabc1ce63282512016326a08 | Set extra libraries on windows condition only | binding.gyp | binding.gyp | {
"targets": [
{
"target_name": "randomprime",
"sources": [ "./native/randomprime.c" ],
"libraries": [
"-l<(module_root_dir)/native/lib/randomprime",
"-lcredui.lib",
"-lmsimg32.lib",
"-lopengl32.lib",
"-lsecur32.lib",
"-lsetupapi.... | Python | 0 | @@ -22,18 +22,16 @@
%7B%0A
-
%22target_
@@ -48,26 +48,24 @@
ndomprime%22,%0A
-
%22sourc
@@ -99,16 +99,64 @@
e.c%22 %5D,%0A
+ %22conditions%22: %5B%0A %5B%22OS=='win'%22, %7B%0A
@@ -166,24 +166,26 @@
braries%22: %5B%0A
+
%22-
@@ -239,16 +239,18 @@
+
... |
55776c93e9fc5fb8c1bd79881e2feab0765caeda | test travis | binding.gyp | binding.gyp | {
"targets": [
{
"target_name": "addon",
"sources": [
"src/addon.cc",
"src/object.cc",
"src/async.cc",
"src/engine.cc",
"src/results.cc"
],
#"cflags": [ "-Werror", "-Wall", "-Wextra", "-Wpedantic", "-Wunused-parameter", "-funroll-loops", "-Ofast" ],#targets all... | Python | 0.000002 | @@ -615,16 +615,18 @@
%22, %22-O3%22
+ %5D
,%0A %22
|
4a6d9b52852f1eed9e7c8d0bc825a943c0072b4a | Send Content-Type header when using X-SendFile | edgedb/lang/common/fs/bus.py | edgedb/lang/common/fs/bus.py | ##
# Copyright (c) 2012-2014 Sprymix Inc.
# All rights reserved.
#
# See LICENSE for details.
##
import mimetypes
import types
from metamagic.spin import coroutine
from metamagic.spin.node.dispatch.bus import public
from metamagic.spin.node.dispatch.http import http as http_base
from metamagic.spin.protocols.http im... | Python | 0 | @@ -3364,24 +3364,110 @@
direct(url))
+%0A response.content_type = http_headers.ContentType(*(file.mimetype.split('/')))
%0A%0A re
|
21c80d25673564e4a16459789701da0ab5c04dad | Test negative intensities | skimage/color/tests/test_colorlabel.py | skimage/color/tests/test_colorlabel.py | import itertools
import numpy as np
from numpy import testing
from skimage.color.colorlabel import label2rgb
from numpy.testing import (assert_array_almost_equal as assert_close,
assert_array_equal)
def test_shape_mismatch():
image = np.ones((3, 3))
label = np.ones((2, 2))
test... | Python | 0.000004 | @@ -103,16 +103,63 @@
bel2rgb%0A
+from skimage._shared.utils import all_warnings%0A
from num
@@ -265,16 +265,30 @@
ay_equal
+, assert_warns
)%0A%0A%0Adef
@@ -4385,16 +4385,221 @@
t_bg)%0A%0A%0A
+def test_negative_intensity():%0A with all_warnings():%0A labels = np.arange(100).reshape(10, 10)%0A i... |
602834cdebc3a3730eaec81b0e2ff1fe437eb034 | Fortify source | binding.gyp | binding.gyp | {
"target_defaults": {
"include_dirs": ["argon2/include"],
"target_conditions": [
["OS != 'win'", {
"cflags+": ["-fdata-sections", "-ffunction-sections", "-fvisibility=hidden", "-march=native"],
"ldflags+": ["-Wl,--gc-sections"]
}],
["OS == 'mac'", {
"xcode_settings":... | Python | 0.999997 | @@ -14,24 +14,62 @@
efaults%22: %7B%0A
+ %22defines%22: %5B%22_FORTIFY_SOURCE=2%22%5D,%0A
%22include
|
f9c331424636885eb3f0d0d6526c62b4c3861bb0 | Fix test | tests/grid/test_components.py | tests/grid/test_components.py | import pytest
import os
import math
from edisgo.grid.network import Network
from edisgo.grid.components import Load, Generator, Storage, Switch
from edisgo.data import import_data
class TestComponents:
#ToDo add tests for storages_df
@classmethod
def setup_class(self):
"""Setup default values"""... | Python | 0.000004 | @@ -872,19 +872,8 @@
ert
-math.isnan(
load
@@ -891,17 +891,23 @@
sumption
-)
+ == 238
%0A
|
3cf6d8c7c6e3bc3e7c274449ffe51e3ba0465bb6 | remove unnecessary curl call | benchbuild/utils/container.py | benchbuild/utils/container.py | """
Container utilites.
"""
import os
import logging
from benchbuild import settings as s
from benchbuild.utils.cmd import cp, mkdir, bash, rm, curl, tail, cut
from benchbuild.utils.downloader import Wget
from benchbuild.utils.run import run, uchroot_no_args
from plumbum import local, FG, TF
__CONTAINER_PATH_SUFFIX__ ... | Python | 0.00001 | @@ -1544,60 +1544,8 @@
))%0A%0A
-__CONTAINER_REMOTE_DEFAULT__ = get_container_url()%0A%0A
%0Adef
|
3c9a9c0729b8c6dc0ecc70f307de07543eeba098 | Remove debug output | tests/_support/foo.py | tests/_support/foo.py | from invoke.task import task
@task
def mytask():
pass
print mytask
print mytask.is_invoke_task
| Python | 0.000037 | @@ -56,46 +56,4 @@
ass%0A
-%0Aprint mytask%0Aprint mytask.is_invoke_task%0A
|
65abf86bdbb43fb20437a0e3bd485f5984a9ae4e | Fix Basic.Nack tests | tests/channel_test.py | tests/channel_test.py | """
Test the rabbitpy.exchange classes
"""
try:
import unittest2 as unittest
except ImportError:
import unittest
from rabbitpy import channel
from rabbitpy import exceptions
class ServerCapabilitiesTest(unittest.TestCase):
def setUp(self):
self.chan = channel.Channel(1, {}, None, None, None, No... | Python | 0.000001 | @@ -409,33 +409,33 @@
bilities%5Bb'basic
-_
+.
nack'%5D = False%0A
@@ -568,33 +568,33 @@
bilities%5Bb'basic
-_
+.
nack'%5D = True%0A
@@ -2811,28 +2811,29 @@
n.enable_publisher_confirms)
+%0A
|
07aa53d2e4de3becd81850f3634ec0c0131b82e7 | Update timedistributed.py | textclf/nn/timedistributed.py | textclf/nn/timedistributed.py | import numpy as np
from collections import OrderedDict
import copy
from six.moves import zip
from keras import backend as K
from keras import activations, initializations, regularizers, constraints
from keras.regularizers import ActivityRegularizer
from keras.layers.core import MaskedLayer
class TimeDistributed(Mas... | Python | 0.000001 | @@ -17,83 +17,8 @@
np%0A%0A
-from collections import OrderedDict%0Aimport copy%0Afrom six.moves import zip%0A%0A
from
@@ -3308,8 +3308,9 @@
tems()))
+%0A
|
acc192111fae6590bcf52bfae292606e985c1102 | fix script to run on individual asset as well | kobo/apps/subsequences/scripts/repop_known_cols.py | kobo/apps/subsequences/scripts/repop_known_cols.py | # coding: utf-8
'''
Usage:
python manage.py runscript repop_known_cols --script-args=<assetUid>
'''
import re
import json
from pprint import pprint
from kpi.models.asset import Asset
from kobo.apps.subsequences.models import SubmissionExtras
from kobo.apps.subsequences.utils.parse_knowncols import parse_knowncols
... | Python | 0 | @@ -118,16 +118,18 @@
rt json%0A
+#
from ppr
@@ -762,24 +762,157 @@
ex.save()%0A%0A%0A
+def migrate_subex_content_for_asset(asset):%0A for sub_ex in asset.submission_extras.all():%0A migrate_subex_content(sub_ex)%0A%0A%0A
def repop_as
@@ -1502,97 +1502,8 @@
e):%0A
- for sub_ex in SubmissionExtras.obj... |
2d9b763c951cacf4f52d78fdca938b920fff7bfb | use requirement.key as this is available in all setuptools versions | safety/util.py | safety/util.py | from pkg_resources import parse_requirements as _parse_requirements
from collections import namedtuple
import click
import os
Package = namedtuple("Package", ["key", "version"])
RequirementFile = namedtuple("RequirementFile", ["path"])
def iter_lines(fh, lineno=0):
for line in fh.readlines()[lineno:]:
yi... | Python | 0 | @@ -3112,20 +3112,19 @@
key=req.
-name
+key
, versio
|
2405714200246f2a150e50670cd7bc183891569c | add forgotten res_partner update | l10n_ch_zip/migrations/8.0.2.0.0/post-migration.py | l10n_ch_zip/migrations/8.0.2.0.0/post-migration.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Mathias Neef
# Copyright 2015 copadoMEDIA UG
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publi... | Python | 0 | @@ -1161,16 +1161,15 @@
er('
-__name__
+upgrade
')%0A%0A
|
22cc79df721e37d5abb07be17ece4a447ad8876f | Exclude List from method attributes | generators/cs.py | generators/cs.py | # C# generator
boilerplate = """\
using System;
using System.ComponentModel.DataAnnotations;
using ArkeIndustries.RequestServer;
using ArkeIndustries.RequestServer.DataAnnotations;
#pragma warning disable 0649
namespace ArkeIndustries.Starfall.Api {
public sealed class ServerId {
% for server in ast["se... | Python | 0.000001 | @@ -5472,16 +5472,55 @@
ibutes%22%5D
+ if len(a) != 0 and a%5B%22name%22%5D != %22List%22
%5D%0A%0A
|
74daa8a744cc63b85ff5d22b52e90695e22d0a50 | add db_table meta | geoads/models.py | geoads/models.py | # coding=utf-8
from django.db import models
from django.contrib.gis.db import models
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
from stdimage import StdImageField
from autoslug import AutoSlugField
from jsonfie... | Python | 0.000001 | @@ -834,17 +834,67 @@
= True)%0A
+ class Meta:%0A db_table = 'ads_adpicture'
%0A
-
%0Aclass A
@@ -1276,16 +1276,67 @@
sage')%0A%0A
+ class Meta:%0A db_table = 'ads_adcontact'%0A
%0Aclass A
@@ -1717,16 +1717,65 @@
ntType)%0A
+ class Meta:%0A db_table = 'ads_adsearch'
%0A%0Aclass
|
fc8c0b4c7466c7168b469f46ace83f779c98e13f | remove debug print | bika/lims/jsonapi/__init__.py | bika/lims/jsonapi/__init__.py | from Products.Archetypes.config import TOOL_NAME
from Products.CMFCore.utils import getToolByName
from zExceptions import BadRequest
def resolve_request_lookup(context, request, fieldname):
brains = []
at = getToolByName(context, TOOL_NAME, None)
for entry in request[fieldname].split("|"):
content... | Python | 0.000008 | @@ -1584,45 +1584,8 @@
nue%0A
- print schema%5Bfieldname%5D.type%0A
|
8ba1e63bd726e2cfbda0c7bec42cf5bc7c0cec21 | round off indoor temp to 1 decimal | getIndoorTemp.py | getIndoorTemp.py | #!/usr/bin/python
#Based off the tutorial by adafruit here:
# http://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing/software
import os
import glob
import time
def getIndoorTemp():
os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')
base_dir = '/sys/bus/w1/devices... | Python | 0.999994 | @@ -829,16 +829,49 @@
+ 32.0%0A
+ temp_f = round(temp_f,1)%0A
|
0060f9eaae7f9e6d78aa4036e9ec0ec38c79d669 | Update for sys_nameservers | libnamebench/conn_quality.py | libnamebench/conn_quality.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 | @@ -748,16 +748,39 @@
er_list%0A
+import sys_nameservers%0A
import u
@@ -2054,16 +2054,20 @@
ernal =
+sys_
nameserv
@@ -2072,22 +2072,20 @@
rver
-_list.Internal
+s.GetCurrent
Name
|
bd4a6e79725acb7b89f4c1382f885c401aa30690 | Use database context manager for sybase fetch | mica/web/star_hist.py | mica/web/star_hist.py | from astropy.table import Table
from mica.stats import acq_stats
from Ska.DBI import DBI
def get_acq_data(agasc_id):
"""
Fetch acquisition history from mica acq stats for an agasc id
:param agasc_id: AGASC id
:returns: list of dicts of acquisitions
"""
acq = Table(acq_stats.get_stats())
... | Python | 0 | @@ -1147,12 +1147,12 @@
-db =
+with
DBI
@@ -1199,21 +1199,32 @@
a_read')
-%0A
+ as db:%0A
+
gui = db
@@ -1299,16 +1299,20 @@
+
agasc_id
@@ -1314,16 +1314,55 @@
sc_id))%0A
+ if not len(gui):%0A return %5B%5D%0A
gui
|
5b6ae3c2770d974255450326fe8e12a0bbb871cf | fix style | tests/monitor_test.py | tests/monitor_test.py | import asyncio
import unittest
import unittest.mock
import aiozmq
import zmq
from aiozmq._test_util import find_unused_port
ZMQ_EVENTS = [
getattr(zmq, attr) for attr in dir(zmq) if attr.startswith('EVENT_')]
class Protocol(aiozmq.ZmqProtocol):
def __init__(self, loop):
self.wait_ready = asyncio.... | Python | 0.000001 | @@ -3963,28 +3963,116 @@
zmq,
- 'zmq_version_info',
+%0A 'zmq_version_info',%0A
ret
@@ -4254,30 +4254,118 @@
zmq,
- 'pyzmq_version_info',
+%0A 'pyzmq_version_info',%0A ... |
43635b184fdab639f9e522ab191514d51a802a02 | Add space after comma to please Travis | salt/runner.py | salt/runner.py | '''
Execute salt convenience routines
'''
# Import python libs
import multiprocessing
import datetime
# Import salt libs
import salt.loader
import salt.exceptions
import salt.utils
import salt.minion
import salt.utils.event
class RunnerClient(object):
'''
A client for accessing runners
'''
def __ini... | Python | 0 | @@ -2721,16 +2721,17 @@
ll(self,
+
**kwargs
|
0e01b0a8845e0309cbb7131a35eacc1b87ded3f1 | Update version to 1.1.0 | chatterbot_corpus/__init__.py | chatterbot_corpus/__init__.py | """
A machine readable multilingual dialog corpus.
"""
from .corpus import Corpus
__version__ = '1.0.1'
__author__ = 'Gunther Cox'
__email__ = 'gunthercx@gmail.com'
__url__ = 'https://github.com/gunthercox/chatterbot-corpus'
__all__ = (
'Corpus',
)
| Python | 0.000001 | @@ -97,11 +97,11 @@
'1.
-0.1
+1.0
'%0A__
|
cf4f9fb89ec092116c2e3cb89d13112d4450ff43 | Fix copyright notice | gfx/svgcolors.py | gfx/svgcolors.py | # -*- coding: utf-8 -*-
"""
(C) Copyright 2015, 2106 Wojciech Mruczkiewicz
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 re... | Python | 0.001727 | @@ -45,18 +45,18 @@
2015, 2
-1
0
+1
6 Wojcie
|
2674338d6896b62485f33b049c85ae3fedfefc9d | bump to version 0.8.1 | rootpy/info.py | rootpy/info.py | # Copyright 2012 the rootpy developers
# distributed under the terms of the GNU General Public License
"""
_
_ __ ___ ___ | |_ _ __ _ _
| '__/ _ \ / _ \| __| '_ \| | | |
| | | (_) | (_) | |_| |_) | |_| |
|_| \___/ \___/ \__| .__/ \__, |
|_| |___/
{0}
"""
__version__ ... | Python | 0 | @@ -320,17 +320,17 @@
= '0.8.
-0
+1
.dev0'%0A_
|
6491d0b04754fc0f84bbad3564ba590dabf6ee31 | Fixing final output line | bin/correlation_clustering.py | bin/correlation_clustering.py | """
Cluster correlations from correlations.py based on hierarchical linkage.
correlations.py outputs a tuple of
[object 1, object 2, pearson correlation, p value]
Here, we use 1-pearson correlation as our distance
"""
import os
import sys
import math
import argparse
import numpy as np
import scipy.cluster.hierar... | Python | 0.999996 | @@ -4590,24 +4590,28 @@
(counts)%7D%22)%0A
+
out.writ
|
8a52e9e8fc7c4bc17b24cb6f870508899ac9adcf | Display all the possible server values. | mistral/cmd/launch.py | mistral/cmd/launch.py | #!/usr/bin/env python
# Copyright 2016 - Brocade Communications Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | Python | 0.999972 | @@ -6303,35 +6303,39 @@
'
-api, engine, and executor.'
+, '.join(LAUNCH_OPTIONS.keys())
)%0A%0A
|
638fad0966121513773d6c9a5d0b29ca655f3467 | add fileNamer arg to save_NLMSA_downloaders() | pygr/apps/catalog_downloads.py | pygr/apps/catalog_downloads.py |
def catalog_downloads(url,fileFilter,fileNamer,fileDocumenter,klass):
'''returns dict of resources for downloading target data:
url: URL to a directory that gives links to the desired data
fileFilter: function that returns True for a desired file name
fileNamer: function that converts a file name into... | Python | 0 | @@ -1666,16 +1666,59 @@
yer=None
+,%0A fileNamer=None
):%0A '
@@ -1886,16 +1886,148 @@
ent '+x%0A
+ if fileNamer is None: # a default resource naming function%0A fileNamer = lambda x:resourceStem+x%5B:-3%5D # remove .gz suffix%0A
impo
@@ -2107,32 +2107,33 @@
g_downloads(u... |
cc1d5ab4a863bfcb69b68c6d56743c7efd079b7a | Fix shap version (#1053) | python/alibiexplainer/setup.py | python/alibiexplainer/setup.py | # Copyright 2019 kubeflow.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 by applicable law or agreed to in writing,... | Python | 0 | @@ -1154,16 +1154,38 @@
uires=%5B%0A
+ %22shap==0.35%22,%0A
|
419cb4667d42dd5f9a6fd77b4bc77fb73eba3ba5 | Fix unit tests (temp.) | modoboa/core/tests.py | modoboa/core/tests.py | import os
import tempfile
from django.core.urlresolvers import reverse
from django.test import TestCase
from modoboa.lib.sysutils import exec_cmd
from modoboa.lib.tests import ModoTestCase
from . import factories
class ProfileTestCase(ModoTestCase):
fixtures = ['initial_users.json']
def setUp(self):
... | Python | 0 | @@ -1450,24 +1450,25 @@
(TestCase):%0A
+%0A
MAP_FILE
@@ -1482,19 +1482,29 @@
%22
-std
+modoboa_admin
%22: %5B%0A
@@ -1701,21 +1701,50 @@
%22
-autoreply%22: %5B
+modoboa_postfix_autoreply%22: %5B%0A
%22sql
@@ -1791,16 +1791,25 @@
lies.cf%22
+%0A
%5D,%0A
@@ -1812,16 +1812... |
35114cf05ebdc12f6ec0a1ea8f647c8a5f4bc03b | Fix verb relation parsing | parse.py | parse.py | #!/usr/bin/env python
import re
import sys
import string
import unicodedata
from textblob import TextBlob
import grammars
import util
def preprocess(doc):
paragraphs = [s.strip() for s in doc.split('\n') if s.strip()][1:] # strip out title
return TextBlob('\n'.join(paragraphs))
def extract_generic_relations... | Python | 0.000072 | @@ -1109,32 +1109,138 @@
.split(' ')%5B0%5D)%0A
+ verb_relation = words%5Bcur_idx+len(np.split(' ')):next_idx%5D%0A if len(verb_relation) %3E 0:%0A
relation
@@ -1266,35 +1266,27 @@
np,
-words%5Bcur_idx+1:next_idx%5D,%0A
+verb_relation,%0A
|
0efbdc2d0d5ad0ec3aa31fd8981b8f594ae234ee | Test for summary level publisher triple | tests/test_dataset.py | tests/test_dataset.py | #!/usr/bin/env python3
import unittest
import logging
from dipper.sources.Source import Source
from dipper.graph.RDFGraph import RDFGraph
from dipper import curie_map as curiemap
from rdflib import URIRef, Literal
from inspect import getdoc
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)... | Python | 0 | @@ -3303,39 +3303,8 @@
%22)%0A%0A
- @unittest.skip(%22skipping%22)%0A
@@ -3573,17 +3573,17 @@
ms%22) + %22
-p
+P
ublisher
|
284b638286b3ac459735aa9e7ecd8f55b6ce04a6 | Support python3 in generate_bindings.py | bindings/generate_bindings.py | bindings/generate_bindings.py | #!/usr/bin/env python
"""
C++ source code generator to create bindings from Neovim API functions
using Qt types/signals/slots
"""
import msgpack
import sys, subprocess, os
import re
import jinja2
import datetime
INPUT = 'bindings'
def get_api_info(nvim):
"""
Call the neovim binary to get the api info
"""... | Python | 0.000002 | @@ -227,16 +227,370 @@
dings'%0A%0A
+def decutf8(inp):%0A %22%22%22%0A Recursively decode bytes as utf8 into unicode%0A %22%22%22%0A if isinstance(inp, bytes):%0A return inp.decode('utf8')%0A elif isinstance(inp, list):%0A return %5Bdecutf8(x) for x in inp%5D%0A elif isinstance(inp, dic... |
0a99166bb035b662ca40224ea48847dc0e86edf9 | Switch to using `unittest` directly. | rank_filter.recipe/run_test.py | rank_filter.recipe/run_test.py | #!/usr/bin/env python
import os
import subprocess
import sys
import nose
def main(*argv):
argv = list(argv)
test = os.path.join(os.environ["SRC_DIR"], "test", "test_rank_filter.py")
return(subprocess.check_call(["python", nose.core.__file__, test] + argv[1:],
stdin... | Python | 0 | @@ -241,32 +241,24 @@
n%22,
-nose.core.__file__,
+%22-m%22, %22unit
test
+%22
%5D +
|
b6bc965fa3a0f78431d81d0699d2716381a48fde | Fix failing test | tests/test_formats.py | tests/test_formats.py | import collections.abc
import pytest
import re
import datascience as ds
def assert_equal(string1, string2):
string1, string2 = str(string1), str(string2)
whitespace = re.compile('\s')
purify = lambda s: whitespace.sub('', s)
assert purify(string1) == purify(string2), "\n%s\n!=\n%s" % (string1, string2... | Python | 0.000209 | @@ -1720,16 +1720,19 @@
t =
+ds.
Table(%5B%5B
@@ -1784,16 +1784,19 @@
oney'%5D,
+ds.
Currency
|
213148d5732eee7bfbc9cda0f6fb36ae36d947ce | fix args | binstar_client/scripts/cli.py | binstar_client/scripts/cli.py | '''
Binstar command line utility
'''
from __future__ import print_function, unicode_literals
from argparse import ArgumentParser, RawDescriptionHelpFormatter
import logging
from os import makedirs
from os.path import join, exists
from binstar_client import __version__ as version
from binstar_client import commands as... | Python | 0.011915 | @@ -1491,16 +1491,20 @@
se_args(
+args
)%0A%0A s
|
e0728e748e97397961ce556960a98af3dcc0b99e | fix default value if not present | biomaj/process/metaprocess.py | biomaj/process/metaprocess.py | import threading
import logging
import os
from biomaj.process.process import Process
class MetaProcess(threading.Thread):
'''
Meta process in biomaj process workflow. Meta processes are executed in parallel.
Each meta process defined a list of Process to execute sequentially
'''
def __init__(sel... | Python | 0.000002 | @@ -1725,24 +1725,35 @@
process.dir'
+,default=''
)%0A if '
|
f9fcec4e1f9617362d05da562ad413c696ae01fc | Disable logging for SafeTestCase (and thus LdapTestCase) tests | rcamp/tests/utilities/utils.py | rcamp/tests/utilities/utils.py | import os
import unittest
import importlib
import datetime
import pytz
from django.test import TestCase
from django.conf import settings
from accounts.models import (
RcLdapUser,
RcLdapGroup
)
from accounts.models import User
def assert_test_env():
"""Helper method to verify that tests are not being exe... | Python | 0 | @@ -63,16 +63,31 @@
ort pytz
+%0Aimport logging
%0A%0Afrom d
@@ -2932,24 +2932,64 @@
ad.%0A %22%22%22%0A
+%0A logging.disable(logging.CRITICAL)%0A%0A
database
|
79df0eccd44c6c01d69725b9cc7a851ab2be957c | add body property to request. | glaso/request.py | glaso/request.py | from werkzeug.wrappers import Request as Base
class Request(Base):
def __init__(self, environ):
super(Request, self).__init__(environ)
# Params captured from request url
self.params = {}
# Used to mount apps
# eg: mount('/api/users', users.app)
self.prefix = []
... | Python | 0 | @@ -38,16 +38,71 @@
as Base
+%0Afrom functools import lru_cache%0Afrom json import loads
%0A%0Aclass
@@ -661,8 +661,361 @@
%7D%0A
+%0A @property%0A @lru_cache(10)%0A def body(self):%0A if self.mimetype == 'application/json':%0A try:%0A return loads(self.get_data(as_t... |
2eaf27d9c3a97c4c7dbe4e653d82c92e22d9afb2 | Print some more info. | tests/test_getinfo.py | tests/test_getinfo.py | #! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
# $Id: test_getinfo.py,v 1.17 2003/04/21 18:46:10 mfx Exp $
import time
import pycurl
## Callback function invoked when progress information is updated
def progress(download_t, download_d, upload_t, upload_d):
print "Total to download %d bytes, hav... | Python | 0 | @@ -90,29 +90,29 @@
1.1
-7
+8
2003/0
-4/21 18:46:10
+5/01 19:35:01
mfx
@@ -742,24 +742,112 @@
rm()%0A%0Aprint%0A
+print %22HTTP-code:%22, c.getinfo(c.HTTP_CODE)%0Aprint %22Total-time:%22, c.getinfo(c.TOTAL_TIME)%0A
print %22Downl
@@ -1067,16 +1067,71 @@
T_TYPE)%0A
+print %22Namelookup-time:%22, c.getinfo(c.NAM... |
129f621168256565ca46fb8837b1f989684988d0 | Add SQL command to execute arbitrary SQL on local db | lifelogger/commands/local.py | lifelogger/commands/local.py | # coding=utf-8
"""
All commands that create & use the local copies of the Google Calendar data.
"""
import requests
from icalendar import Calendar
from ..config import config, ICAL_PATH
from ..utils import nice_format
from .parser import subparsers
def download(reset=None):
if reset:
config.pop('ical_u... | Python | 0.000001 | @@ -2879,16 +2879,934 @@
shell)%0A%0A
+def sql(statement, separator):%0A from ..database import conn%0A statement = ' '.join(statement)%0A%0A cursor = conn.cursor()%0A cursor.execute(statement)%0A%0A separator = %7B%0A 'comma': ',',%0A 'semicolon': ';',%0A 'tab': '%5Ct',%0A %7D%5... |
8fc5895fdb22e98c40ff4463ea53b7c72dc6e94f | Fix typo in AuthProvider._validate error message. login_url instead of logout_url (#11325) | bokeh/server/auth_provider.py | bokeh/server/auth_provider.py | ''' Provide a hook for supplying authorization mechanisms to a Bokeh server.
'''
#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
from __future__ import annotations
import logging # isort:skip
l... | Python | 0.000102 | @@ -4123,35 +4123,34 @@
URL to redirect
-un
a
+u
thenticated user
@@ -5546,34 +5546,35 @@
h a relative log
-in
+out
_url%22)%0A%0Aclass Au
|
b7ebaf022fd2c0992afeb0e87ce510376e799224 | bump version | goose/version.py | goose/version.py | # -*- coding: utf-8 -*-
"""\
This is a python port of "Goose" orignialy licensed to Gravity.com
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.
Python port was written by Xavier Grangier for Recrutae
Gravity.co... | Python | 0 | @@ -881,17 +881,17 @@
(1, 0, 2
-0
+1
)%0A__vers
|
6890d1b6b534c4fe9c3e4ef004c28379427767c6 | Update scheduler callbacks to use LoggerAction logger once it is created | bot/action/standard/logger.py | bot/action/standard/logger.py | from bot.action.core.action import IntermediateAction
from bot.logger.logger import LoggerFactory
from bot.logger.message_sender.factory import MessageSenderFactory
class LoggerAction(IntermediateAction):
def __init__(self, logger_type: str = "formatted", reuse_max_length: int = 4000, reuse_max_time: int = 60,
... | Python | 0 | @@ -158,16 +158,75 @@
Factory%0A
+from bot.logger.worker_logger import WorkerStartStopLogger%0A
%0A%0Aclass
@@ -1155,16 +1155,337 @@
chat_id)
+%0A self.__update_scheduler_callbacks()%0A%0A def __update_scheduler_callbacks(self):%0A # update scheduler callbacks to use this logger instead of the admi... |
4a42285b6b0afbd5dbd23df049ab2a6d493fc256 | Add production domain | gotosite/urls.py | gotosite/urls.py | from django.conf import settings
from django.conf.urls import url, include
from django.conf.urls.static import static
from django.contrib import admin
from main.views import *
urlpatterns = [
# Admin
url(r'^admin/', admin.site.urls),
# Index
url(r'^$', index, name='index'),
# About
# url(r'^... | Python | 0.000001 | @@ -171,16 +171,53 @@
port *%0A%0A
+domain = 'https://goto.msk.ru/new/'%0A%0A
urlpatte
@@ -251,15 +251,26 @@
(r'%5E
+%25s
admin/'
+ %25 domain
, ad
@@ -309,18 +309,29 @@
url(r'%5E
-$'
+%25s$' %25 domain
, index,
@@ -431,32 +431,34 @@
file%0A url(r'%5E
+%25s
profile/$', prof
@@ -451,16 +451,25 @@
ofile/$'
... |
a8855bd2045f965bdeb783cfa1bd51c311bf013c | Replace domain to localhost | gotosite/urls.py | gotosite/urls.py | from django.conf import settings
from django.conf.urls import url, include
from django.conf.urls.static import static
from django.contrib import admin
from main.views import *
domain = 'https://goto.msk.ru/new/'
urlpatterns = [
# Admin
url(r'^%sadmin/' % domain, admin.site.urls),
# Index
url(r'^%s$'... | Python | 0.999999 | @@ -189,23 +189,25 @@
http
-s
://
-goto.msk.ru
+localhost:8000
/new
|
9056febc4c29984bb838dcaae3d209841ed27344 | add tests for apply_referrer method | referral/tests/models_tests.py | referral/tests/models_tests.py | from django.test import TestCase
from referral.tests.factories import CampaignFactory, ReferrerFactory, UserReferrerFactory
class CampaignTestCase(TestCase):
def test_model(self):
obj = CampaignFactory()
self.assertTrue(obj.pk)
def test_count_users(self):
obj = CampaignFactory()
... | Python | 0 | @@ -1,12 +1,48 @@
+from django.http import HttpRequest%0A
from django.
@@ -63,16 +63,87 @@
stCase%0A%0A
+from referral.models import UserReferrer%0Afrom referral import settings%0A
from ref
@@ -224,16 +224,29 @@
rFactory
+, UserFactory
%0A%0A%0Aclass
@@ -1231,28 +1231,724 @@
self.assertTrue(obj.pk)%0A%0A
+ ... |
5ac248bcbe1e2c0a97754fad185f8a9b2eff2280 | disable weird test. | tests/test_parsing.py | tests/test_parsing.py | import os
import tempfile
import shutil
import unittest
import sys
from os.path import \
join, dirname
from nose.tools import \
assert_equal, raises
try:
from cStringIO import StringIO
finally:
from StringIO import StringIO
from bento.core.pkg_objects import \
PathOption, FlagOption, Executable, ... | Python | 0 | @@ -517,16 +517,17 @@
tation%0A%0A
+#
old = sy
@@ -536,21 +536,23 @@
path%5B:%5D%0A
+#
try:%0A
+#
sys.
@@ -603,16 +603,17 @@
escr%22))%0A
+#
from
@@ -646,16 +646,17 @@
, DESCR%0A
+#
finally:
@@ -652,24 +652,25 @@
R%0A#finally:%0A
+#
sys.path
|
3340367519181ef933847e655cc08a63474b7d06 | Remove the tests for metanl_word_frequency too. Doh. | tests/test_queries.py | tests/test_queries.py | from __future__ import unicode_literals
from nose.tools import eq_, assert_almost_equal, assert_greater
from wordfreq.query import (word_frequency, average_frequency, wordlist_size,
wordlist_info, metanl_word_frequency)
def test_freq_examples():
assert_almost_equal(
word_freque... | Python | 0.003509 | @@ -220,31 +220,8 @@
info
-, metanl_word_frequency
)%0A%0A%0A
@@ -837,192 +837,8 @@
)%0A%0A%0A
-def test_compatibility():%0A assert_almost_equal(metanl_word_frequency('the%7Cen'), 1e9, places=3)%0A assert_almost_equal(metanl_word_frequency('the%7Cen', offset=1e9), 2e9, places=3)%0A%0A%0A
def
|
8fedd77849b320140dbf8588a4c91afeba2b674d | Add test for full Bucket | tests/test_routing.py | tests/test_routing.py | import unittest
from dht.node import Node, SelfNode
from dht.routing import BucketTree
from dht.utils import hash_string
from dht.bucket import NodeAlreadyAddedException
from dht import settings
class BucketTreeTest(unittest.TestCase):
"""
BucketTree.find_node(key)
BucketTree.add_node(node)
"""
... | Python | 0 | @@ -164,16 +164,39 @@
xception
+, BucketIsFullException
%0Afrom dh
@@ -1689,12 +1689,635 @@
de1, node2)%0A
+ %0A def test_full_bucket(self):%0A%0A tree = self.get_new_tree()%0A%0A # This begins with a 1 in binary.%0A key = hash_string('test')%0A dec_key = int(key, 16)%0A%0A #... |
e1a1af7e0aeb351b1f421a7669e19988b719e060 | fix python2 tests again | tests/test_strings.py | tests/test_strings.py | # -*- coding: utf8- -*-
import unittest
import sys
from androguard.core.bytecodes import dvm, mutf8
from androguard.core.analysis import analysis
class StringTest(unittest.TestCase):
def testDex(self):
with open("examples/tests/StringTests.dex", "rb") as fd:
d = dvm.DalvikVMFormat(fd.read())... | Python | 0.000001 | @@ -1747,16 +1747,17 @@
rtEqual(
+u
%22hello w
@@ -1863,32 +1863,33 @@
elf.assertEqual(
+u
%22%5CU00024f5c%22, mu
@@ -1970,24 +1970,25 @@
assertEqual(
+u
%22%5CU0001f64f%22
@@ -2077,16 +2077,17 @@
rtEqual(
+u
%22%5C%5Cud853
@@ -2382,16 +2382,16 @@
0%5Cx80%22%0A%0A
-
@@ -2407,16 +2407,17 @@
rtEqual(
... |
74b4e5edf4e91be3c943d607e8ec3ec658d045ff | stop using reactor.listenWith | tests/twisted/ipv6.py | tests/twisted/ipv6.py | import socket
from twisted.internet import tcp
class Ipv6Server(tcp.Server):
def getHost(self):
return IPv6Address('TCP', *(self.socket.getsockname()))
def getPeer(self):
return IPv6Address('TCP', *(self.client))
class Ipv6Port(tcp.Port):
addressFamily = socket.AF_INET6
transport = I... | Python | 0 | @@ -653,32 +653,33 @@
enTCP6(port,
+
factory,
backlog=5,in
@@ -662,24 +662,25 @@
rt, factory,
+
backlog=5,in
@@ -677,16 +677,17 @@
cklog=5,
+
interfac
@@ -697,18 +697,17 @@
::',
+
reactor
- =
+=
None
@@ -711,16 +711,18 @@
one):%0A
+
+
if react
@@ -733,16 +733,20 @@
s None:%0A
+
from
@@ -7... |
7d165a1855339ee06c2982176ab33c2f02f75b35 | return the most 8 colors | haishoku/main.py | haishoku/main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2017-05-15 15:10
# @Author : Gin (gin.lance.inside@hotmail.com)
# @Link :
# @Disc : haishoku main function
import sys
import haishoku
import alg
def main():
# get image_path from system args
image_path = sys.argv[1]
# get colors tuple with... | Python | 0.999998 | @@ -982,45 +982,325 @@
-for
+# return the most 8 colors%0A temp_sorted_colors_mean = sorted(
color
+s
_mean
- in sorted(colors_mean)
+)%0A if 8 %3C len(temp_sorted_colors_mean):%0A colors_mean = temp_sorted_colors_mean%5Blen(temp_sorted_colors_mean)-8 : len(temp_sorted_colors_mean)%5D%0A else:%... |
f836064417d2ea7ef389e54ccdb9e7b9c191343f | Use while-else loop while waiting for auth | handlers/auth.py | handlers/auth.py | import logging
import time
from util import wrap
from . import BaseHandler
l = logging.getLogger(__name__)
class AuthHandler(BaseHandler):
def __init__(self, conf, irc_bot, tg_bot, user_db, message, *args, **kwargs):
super().__init__(*args, **kwargs)
self.conf = conf
self.irc_bot = irc_... | Python | 0 | @@ -2055,61 +2055,8 @@
ile
-(%0A not self.authenticated%0A and
time
@@ -2116,19 +2116,22 @@
300
-0)%0A
+):%0A
):%0A
@@ -2126,18 +2126,61 @@
-):
+ if self.authenticated:%0A break
%0A
@@ -2200,25 +2200,24 @@
ep(0.5)%0A
-%0A
# Finish
@... |
90a19e1987903456eb890164d558e57c6ebf2ae0 | Set up media for deploy. | config/settings/production.py | config/settings/production.py | import dj_database_url
from .base import *
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = get_env_variable('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABA... | Python | 0 | @@ -1204,16 +1204,17 @@
3.S3Boto
+3
Storage'
|
5181bdbba1edb41b0318d45de98342b44f4fd3a2 | Update models.py | herald/models.py | herald/models.py | """
Models for notifications app.
"""
import json
import six
from django.conf import settings
from django.db import models
from django.utils.module_loading import import_string
@six.python_2_unicode_compatible
class SentNotification(models.Model):
"""
Stores info on the notification that was sent.
"""
... | Python | 0 | @@ -2030,16 +2030,49 @@
data)%0A%0A%0A
+@six.python_2_unicode_compatible%0A
class No
@@ -2348,16 +2348,48 @@
_class%0A%0A
+@six.python_2_unicode_compatible
%0Aclass U
@@ -2777,8 +2777,13 @@
cation)%0A
+ %0A
|
9b8283bfe7998c3f6d05ac666e2880d0f1951480 | fix typo | ichnaea/views.py | ichnaea/views.py | from cornice import Service
from pyramid.httpexceptions import HTTPError, HTTPNoContent
from pyramid.response import Response
from ichnaea.decimaljson import dumps
from ichnaea.schema import SearchSchema, SubmitSchema
from ichnaea.search import search_request
from ichnaea.submit import submit_request
class _JSONErro... | Python | 0.999991 | @@ -2768,17 +2768,17 @@
suffix m
-o
+u
st not b
|
b7c7391fb6f7ec8863d60cb448e24fc0cd18f3cb | Optimize timer.sleep and timer.timeout creation and execution. | idiokit/timer.py | idiokit/timer.py | from . import idiokit, _selectloop
@idiokit.stream
def sleep(delay):
event = idiokit.Event()
node = _selectloop.sleep(delay, event.succeed)
try:
yield event
except:
_selectloop.cancel(node)
raise
class Timeout(Exception):
pass
@idiokit.stream
def timeout(timeout, stream... | Python | 0 | @@ -1,8 +1,79 @@
+from __future__ import absolute_import%0A%0Afrom functools import partial%0A%0A
from . i
@@ -85,18 +85,23 @@
idiokit
-,
+%0Afrom .
_selectl
@@ -103,34 +103,132 @@
lectloop
-%0A%0A%0A@idiokit.stream
+ import cancel as selectloop_cancel, sleep as selectloop_sleep%0A%0A%0Adef _cancel(node, _):%0A ... |
4d41669f6a8d4178fb50ae6de6c776a06a32024e | Add a specific log file | inbox/api/srv.py | inbox/api/srv.py | import sys
from flask import Flask, request, jsonify, make_response, g
from flask.ext.restful import reqparse
from werkzeug.exceptions import default_exceptions, HTTPException
from sqlalchemy.orm.exc import NoResultFound
from inbox.api.kellogs import APIEncoder
from inbox.api.err import log_exception
from inbox.models... | Python | 0.00001 | @@ -4,16 +4,31 @@
ort sys%0A
+import logging%0A
from fla
@@ -782,16 +782,106 @@
name__)%0A
+logging.basicConfig(filename='/var/log/inboxapp/nylas-flask-api.log', level=logging.INFO)%0A
# Handle
|
d63840e47ceaf293e72e359b29c930d8f9d5b9b0 | Add test for existing injector functionality | injector_test.py | injector_test.py | #!/usr/bin/env python3
import unittest
import injector
class DependenciesTest(unittest.TestCase):
def setUp(self):
self.dependencies = injector.Dependencies()
def test_can_add_things(self):
self.dependencies.register_value('my value', 123)
self.dependencies.register_factory('my facto... | Python | 0 | @@ -2067,9 +2067,713 @@
or(%7B
-%7D
+%0A 'value1': (lambda: 1, None),%0A 'value2': (lambda: 'some string', None),%0A 'factory1': (lambda: 'factory 1 result', None),%0A 'factory2': (lambda val1: 'value1 is %7B%7D'.format(val1), %5B'value1'%5D),%0A %7D)%0A%0A def tes... |
d34b79301c30720923a80e4ecfe9078e38d3ff9f | version bump | insteon/const.py | insteon/const.py | __version__ = '0.6.1'
| Python | 0.000001 | @@ -14,9 +14,9 @@
'0.
-6.1
+7.0
'%0A
|
35a62db7ac313e87ae6a7ff6471e302678232466 | Bump version for pypi to 0.2018.01.05.0208 | ipwb/__init__.py | ipwb/__init__.py | __version__ = '0.2018.01.05.0029'
| Python | 0 | @@ -26,9 +26,9 @@
05.0
-029
+208
'%0A
|
454b3e5e9f094461bc3e31500569d52c0e19b7b5 | Remove Goma-specific GYP handling. | scripts/master/factory/webrtc_factory.py | scripts/master/factory/webrtc_factory.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from master.factory import chromium_factory
from master.factory import gclient_factory
from master.factory import chromium_commands
import config
def ... | Python | 0.000015 | @@ -313,885 +313,8 @@
g%0A%0A%0A
-def FixForGomaWin(options, target, gclient_env):%0A %22%22%22Fix gyp variables required for goma on Windows,%0A unless it is already set.%0A%0A Args:%0A options: a list of string for factory options.%0A target: a string of build target (e.g. Debug, Release).%0A gclient_env... |
27bc3fc887092bd01b7ecbf69ce6b86e92287e20 | fix adding BGGClientLegacy to exports (prefer using extend with a list in case there could be more classes to add) | boardgamegeek/__init__.py | boardgamegeek/__init__.py | # coding: utf-8
"""
.. module:: boardgamegeek
:platform: Unix, Windows
:synopsis: interface to boardgamegeek.com
.. moduleauthor:: Cosmin Luță <q4break@gmail.com>
"""
from .api import BGGClient, BGGChoose, BGGRestrictDomainTo, BGGRestrictPlaysTo, BGGRestrictSearchResultsTo, BGGRestrictCollectionTo
from .legacy_... | Python | 0 | @@ -918,11 +918,11 @@
l__.
-app
+ext
end(
|
9d75e2eceee424e716f6ffb62ef0c6ff27eddce5 | Make properties | bolt/spark/statcounter.py | bolt/spark/statcounter.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 us... | Python | 0.00002 | @@ -3884,16 +3884,30 @@
rname)%0A%0A
+ @property%0A
def
@@ -3910,32 +3910,32 @@
def mean(self):%0A
-
self.__i
@@ -3965,32 +3965,46 @@
return self.mu%0A%0A
+ @property%0A
def sum(self
@@ -4065,24 +4065,38 @@
* self.mu%0A%0A
+ @property%0A
def vari
@@ -4241,32 +4241,46 @@
lf.m2 / s... |
6f5a85bd2cd813a10a9215f8ce7f7f9917b0a271 | Update script.py | Stegano-Extract-and-Read-File-From-Image/Make-a-Backdoor/script.py | Stegano-Extract-and-Read-File-From-Image/Make-a-Backdoor/script.py |
import os
import time, zipfile
class scureImage(object):
def _secure(self, image, zipfile, new_image):
return os.system("cat "+image+" "+zipfile+" > "+new_image)
def _openScure(self, new_image):
return os.system("unzip "+new_image)
def _stegano(self, zipFile):
... | Python | 0.000001 | @@ -1,16 +1,337 @@
+%22%22%22%0AName : Stegano, Make a Backdoor in file Image%0ACreated By : Agus Makmun (Summon Agus)%0ABlog : bloggersmart.net - python.web.id%0ALicense : GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007%0ADocumentation : https://github.com/agusmakmun/Some-E... |
bf684505fb6260e7c504b23e0572b0f17fcfcfad | update documentation | OpenHealthAlgorithms/Diabetes.py | OpenHealthAlgorithms/Diabetes.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# ToDo: insert file headers
__author__ = ""
__copyright__ = ""
__license__ = ""
__version__ = ""
__maintainer__ = ""
__email__ = ""
class Diabetes(object):
"""
Calculates Diabetes risk score
Example
-------
>>> from OpenHealthAlgorithms.Diabete... | Python | 0 | @@ -594,18 +594,8 @@
sult
-%0A 7
%0A%0A
|
acf3819d433f3ebc3d3eed17c61f2542f7429f8e | Use __file__ instead of inspect, for compatibility with frozen environments | trimesh/resources/__init__.py | trimesh/resources/__init__.py | import os
import inspect
# find the current absolute path using inspect
_pwd = os.path.dirname(
os.path.abspath(
inspect.getfile(
inspect.currentframe())))
def get_resource(name, decode=True):
"""
Get a resource from the trimesh/resources folder.
Parameters
-------------
... | Python | 0.000001 | @@ -7,22 +7,8 @@
os%0A
-import inspect
%0A%0A#
@@ -42,21 +42,25 @@
ath
-using inspect
+to this directory
%0A_pw
@@ -83,91 +83,16 @@
ame(
-%0A os.path.abspath(%0A inspect.getfile(%0A inspect.currentframe()))
+__file__
)%0A%0A%0A
|
c20d34b0f26c8b97e8ac44bcab241f74ee8bbccf | fix import | fabfile/setup/calibre.py | fabfile/setup/calibre.py | import os.path
from fabsetup.fabutils import custom_task as task # here, every task is custom
from fabsetup.fabutils import subtask, run
from fabsetup.utils import flo
@task
def calibre():
'''Install or update calibre (ebook management tool).
More info:
https://calibre-ebook.com/
https://calibr... | Python | 0.000001 | @@ -43,57 +43,12 @@
ort
-custom_task as task # here, every task is custom
+task
%0Afro
|
83dabc9fc1142e1575843d3a68c6241185543936 | Make the warning for SQLite not being supported a print instead of an exception. | fabtastic/db/__init__.py | fabtastic/db/__init__.py | from django.conf import settings
from fabtastic.db import util
db_engine = util.get_db_setting('ENGINE')
if 'postgresql_psycopg2' in db_engine:
from fabtastic.db.postgres import *
else:
raise NotImplementedError("Fabtastic: DB engine '%s' is not supported" % db_engine) | Python | 0 | @@ -193,33 +193,13 @@
-raise NotImplementedError
+print
(%22Fa
@@ -205,16 +205,24 @@
abtastic
+ WARNING
: DB eng
@@ -260,8 +260,9 @@
_engine)
+%0A
|
5ea4f15c7228ab41fefea437a9aeca6f1791e55b | make sure the verb storage is initialised | feedly/verbs/__init__.py | feedly/verbs/__init__.py | from feedly.utils import get_class_from_string
VERB_DICT = dict()
def get_verb_storage():
from feedly import settings
if settings.FEEDLY_VERB_STORAGE == 'in-memory':
return VERB_DICT
else:
return get_class_from_string(settings.FEEDLY_VERB_STORAGE)
def register(verb):
'''
Regist... | Python | 0.9992 | @@ -272,16 +272,18 @@
STORAGE)
+()
%0A%0A%0Adef r
|
407506bda09d4b8ac55ba14416d2e351f678fda0 | remove password from required tokens | nigeria/formslogic.py | nigeria/formslogic.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from models import *
from apps.reporters.models import *
from apps.form.formslogic import FormsLogic
class NigeriaFormsLogic(FormsLogic):
''' This class will hold the nigeria-specific forms logic.
I'm not sure whether this will be the right structure
... | Python | 0.000003 | @@ -1814,24 +1814,52 @@
nder string%0A
+ # TODO move to db! %0A
requ
@@ -1889,20 +1889,8 @@
le%22,
- %22password%22,
%22na
@@ -2287,33 +2287,16 @@
%0A
- %0A
@@ -2568,25 +2568,16 @@
%0A
- %0A
@@ -2974,16 +2974,16 @@
: %25s%22 %25%0A
+
... |
e793b52be4c583572999efb8e860fb20f7552e1d | Add vars for linux bash output files. Always init platform-specific file name vars. | dotfilesinstaller.py | dotfilesinstaller.py | #!/usr/bin/python
# This script will build platform-specific dotfiles and create the appropriate symlinks in ~
import platform
import os
import io
import sys
def init():
global homeDir
global destDir
homeDir = os.path.expanduser('~') + '/'
destDir = os.path.dirname(os.path.abspath(__file__)) + '/'
os.chdi... | Python | 0 | @@ -365,33 +365,63 @@
ysName%0A global
-b
+macBashOutputFile%0A global macB
ashOutputFile%0A
@@ -405,32 +405,35 @@
al macBashOutput
+Dot
File%0A global ba
@@ -430,17 +430,51 @@
global
-b
+linuxBashOutputFile%0A global linuxB
ashOutpu
@@ -666,74 +666,104 @@
e%0A
-if sysName == 'Linux':%0A bashOutput... |
7a8a158493d03ceeb31bc8a43b7f213e74420bf0 | Set backend-kind to vbd for all VDIs in LUNperVDI SRs | drivers/LUNperVDI.py | drivers/LUNperVDI.py | #!/usr/bin/python
#
# Copyright (C) Citrix Systems Inc.
#
# This program 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; version 2.1 only.
#
# This program is distributed in the hope that it will be u... | Python | 0.000001 | @@ -2093,16 +2093,58 @@
.SCSIid%0A
+ sm_config%5B'backend-kind'%5D = 'vbd'%0A
|
7a1ae8e1a0c614ddb2e3f9e441ab2fb97ed5fc25 | Bump to 6.0.0 | build/titanium_version.py | build/titanium_version.py | version = '5.2.0'
module_apiversion = '2'
| Python | 0.000006 | @@ -8,11 +8,11 @@
= '
-5.2
+6.0
.0'%0A
|
2d3949bd1180eded7c1257c62ea45dda66e17fb4 | Update models.py | geostatsmodels/models.py | geostatsmodels/models.py | import numpy as np
import geostatsmodels.variograms as variograms
def opt( fct, x, y, c, parameterRange=None, meshSize=1000 ):
'''
Optimize parameters for a model of the semivariogram
'''
if parameterRange == None:
parameterRange = [ x[1], x[-1] ]
mse = np.zeros( meshSize )
a = np.linsp... | Python | 0 | @@ -23,37 +23,8 @@
ort
-geostatsmodels.variograms as
vari
|
faf044a6677d4ba5c540abff2e4f312abef0968f | py3 uses linux, not linux2 | extras/iotsaControl/machdep.py | extras/iotsaControl/machdep.py | from __future__ import print_function
from __future__ import unicode_literals
from builtins import object
import sys
import time
import os
VERBOSE=False
if sys.platform == 'darwin':
import subprocess
import plistlib
class PlatformWifi(object):
def __init__(self):
self.wifiInterface = o... | Python | 0.998159 | @@ -1932,16 +1932,25 @@
'linux2'
+, 'linux'
):%0A i
|
4a46549b331ec97b2f591e19215928ac99711e1e | Add failing test for worker management command | django_dbq/tests.py | django_dbq/tests.py | from datetime import datetime, timedelta
from django.core.management import call_command, CommandError
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.utils import override_settings
from django_dbq.management.commands.worker import process_job
from django_dbq.models import... | Python | 0.000073 | @@ -1853,24 +1853,216 @@
ringIO())%0A%0A%0A
+@override_settings(JOBS=%7B'testjob': %7B'tasks': %5B'a'%5D%7D%7D)%0Aclass WorkerManagementCommandTestCase(TestCase):%0A%0A def test_worker_no_args(self):%0A call_command('worker', stdout=StringIO())%0A%0A%0A
@override_se
|
a07f78971fcc2b778a91d9c4dbfdc8c65d1e04b9 | Fix Python 2.5 compatibility | fabtools/tests/fabfiles/ssh.py | fabtools/tests/fabfiles/ssh.py | from textwrap import dedent
from fabric.api import (
quiet,
run,
task,
)
from fabric.contrib.files import contains
@task
def ssh():
"""
Test SSH hardening operations
"""
import fabtools
SSHD_CONFIG = '/tmp/sshd_config'
SSHD_CONFIG_CONTENT = [
'''
''',
'... | Python | 0.862932 | @@ -1,12 +1,51 @@
+from __future__ import with_statement%0A%0A
from textwra
|
5bea134d3a9efef0a51c0ee36961c155d01a213e | Version bump | djasana/__init__.py | djasana/__init__.py | """Django Asana integration project"""
# :copyright: (c) 2017 by Stephen Bywater.
# :license: MIT, see LICENSE for more details.
VERSION = (0, 5, 17)
__version__ = '.'.join(map(str, VERSION[0:3])) + ''.join(VERSION[3:])
__author__ = 'Steve Bywater'
__contact__ = 'steve@regionalhelpwanted.com'
__homepage__ = 'https:/... | Python | 0.000001 | @@ -143,17 +143,17 @@
(0, 5, 1
-7
+8
)%0A__vers
|
ec61435a685e1e55305af06fadd1a03f6a1f54a5 | fix coding style : add newlines [skip ci] | buildtimetrend/service.py | buildtimetrend/service.py | # vim: set expandtab sw=4 ts=4:
"""
Service related methods.
Copyright (C) 2014-2015 Dieter Adriaenssens <ruleant@users.sourceforge.net>
This file is part of buildtimetrend/python-lib
<https://github.com/buildtimetrend/python-lib/>
This program is free software: you can redistribute it and/or modify
it under the ter... | Python | 0 | @@ -1036,16 +1036,17 @@
itable%0A%0A
+%0A
def is_r
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.