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 |
|---|---|---|---|---|---|---|---|
00efe5a076bf3029b91e8f64e39892922d9632a9 | Fix carbon timer proc being GC'd. | pyglet/app/carbon.py | pyglet/app/carbon.py | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | Python | 0 | @@ -2183,16 +2183,85 @@
= None%0A
+ self._timer_func_proc = EventLoopTimerProc(self._timer_proc)%0A
@@ -2300,16 +2300,16 @@
nit__()%0A
-
%0A def
@@ -2493,71 +2493,8 @@
mer%0A
- idle_event_proc = EventLoopTimerProc(self._timer_proc)%0A
@@ -2724,18 +2724,24 @@
-idle_event
+self... |
b41444b5f7c48c4bc46a49405f7b053dcb8ea66c | rename resource function | into/backends/sas.py | into/backends/sas.py | from __future__ import absolute_import, division, print_function
import sas7bdat
from sas7bdat import SAS7BDAT
import datashape
from datashape import discover, dshape
from collections import Iterator
import pandas as pd
import sqlalchemy as sa
from .sql import dshape_to_alchemy, dshape_to_table
from ..append import ... | Python | 0.000005 | @@ -512,11 +512,11 @@
rce_
-csv
+sas
(uri
|
4e1d611a06874d478e91185a0349cfc3747e36ab | Create __init__.py | bin/map/__init__.py | bin/map/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
7f4079c30bf5a693f1ccad38109bbfc83a076f22 | Add palette utilities | bingraphvis/util.py | bingraphvis/util.py | Python | 0 | @@ -0,0 +1,1138 @@
+#generated using palettable%0APALETTES = %7B%0A 'grays' : %5B'#FFFFFD', '#D6D6D4', '#B1B1B0', '#908F8F', '#727171', '#545453', '#373737', '#1A1919', '#000000'%5D, %0A 'greens' : %5B'#F7FCF5', '#E5F5E0', '#C7E9C0', '#A1D99B', '#74C476', '#41AB5D', '#238B45', '#006D2C', '#00441B'%5D, %0A 'purples': %... | |
4022a35c3799abb2da16a178cfdc16bf93a9c580 | Fix syntax error | blues/postgres.py | blues/postgres.py | """
Postgres Blueprint
==================
**Fabric environment:**
.. code-block:: yaml
blueprints:
- blues.postgres
settings:
postgres:
version: 9.3 # PostgreSQL version (required)
# bind: * # What IP address(es) to listen on, use '*' for all (Default: loca... | Python | 0.000002 | @@ -3918,16 +3918,17 @@
chema)s%22
+,
%0A
|
aed1f0e4e33dd956f4499ecffd6bf50bb58e7df4 | Add fermi.py | scripts/fermi.py | scripts/fermi.py | Python | 0.000022 | @@ -0,0 +1,1597 @@
+# This example file is part of the ENVISIoN Electronic structure visualization studio%0A#%0A# Load this file into the Inviwo Python Editor (which you can access under the menu Python, %0A# which is available if Inviwo has been compiled with the Python module on)%0A#%0A# For Copyright and License inf... | |
9ffa7ab2b4b5fb03d9cd8dd2740234ebaf8c8097 | Add per client ignore exception option. | redis_cache/cache.py | redis_cache/cache.py | # -*- coding: utf-8 -*-
from django.conf import settings
from django.core.cache.backends.base import BaseCache
from django.core.exceptions import ImproperlyConfigured
from django.core.cache import get_cache
from .util import load_class
from .exceptions import ConnectionInterrupted
import functools
DJANGO_REDIS_IGNO... | Python | 0 | @@ -618,74 +618,8 @@
%22%22%0A%0A
- if not DJANGO_REDIS_IGNORE_EXCEPTIONS:%0A return method%0A%0A
@@ -678,32 +678,72 @@
rgs, **kwargs):%0A
+ if self._ignore_exceptions:%0A
try:%0A
@@ -731,32 +731,36 @@
try:%0A
+
retu
@@ -792,16 +792,20 @@
kwargs)%0A... |
b4fd94008fa5b1dcdb6dd61651d8776dfb41f2d6 | Make sure we return a list. | oscar/apps/dashboard/catalogue/widgets.py | oscar/apps/dashboard/catalogue/widgets.py | import six
from django.forms.util import flatatt
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
from django import forms
class ProductSelect(forms.Widget):
is_multiple = False
css = 'select2 input-xlarge'
def format_value(self, value):
return six.text_t... | Python | 0.000272 | @@ -1482,16 +1482,21 @@
return
+list(
filter(b
@@ -1517,9 +1517,10 @@
it(','))
+)
%0A
|
7e449b0267f47ee08327d9d76976c5e1b197501b | Add missing migration (#9504) | osf/migrations/0219_auto_20201020_1836.py | osf/migrations/0219_auto_20201020_1836.py | Python | 0.000002 | @@ -0,0 +1,2634 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.28 on 2020-10-20 18:36%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('osf', '0218_auto_20200929_1850'),%0A %5D%0A%0A... | |
c137028a98cd762a4e93950fbde085969500999e | Build tagger | installer/build_tag.py | installer/build_tag.py | Python | 0.000001 | @@ -0,0 +1,452 @@
+#!/usr/python%0D%0A%0D%0Aimport os%0D%0Afrom subprocess import call, check_output%0D%0Aver = check_output(%5B %22python%22, %22version.py%22, %22../apps/Tasks/src/version.h%22,%0D%0A%09%22PROGRAM_VERSION_MAJOR,PROGRAM_VERSION_MINOR,PROGRAM_VERSION_PATCH,PROGRAM_VERSION_BUILD%22,%0D%0A%09%22PROGRAM_VE... | |
866b1c634c4fc6dc27ad953ccde6b6dcd11dcc91 | Add mood light script | moodlight.py | moodlight.py | Python | 0.000001 | @@ -0,0 +1,1101 @@
+from maya.utils import executeDeferred%0Aimport pymel.core as pm%0Aimport threading%0Aimport time%0A%0A%0A_active_mood_light = None%0A_running = False%0A%0A%0Aclass MoodLightThread(threading.Thread):%0A%0A%09def __init__(self, speed):%0A%09%09self.speed = speed%0A%09%09super(MoodLightThread, self)._... | |
b0d699066799d0309e7af3f8892f56a6feaac778 | Write tests for new functionality; several destinations | new_tests.py | new_tests.py | Python | 0.000001 | @@ -0,0 +1,1292 @@
+from numpy import testing%0Aimport unittest%0Aimport numpy as np%0Afrom numpy import pi%0A%0Afrom robot_arm import RobotArm%0A%0A%0Aclass TestRobotArm(unittest.TestCase):%0A%0A def setUp(self):%0A self.lengths = (3, 2, 2,)%0A self.destinations = (%0A (5, 0,),%0A ... | |
aafe6849ef2264606fcb6d3cceef27450f986a98 | Add .. to list of search paths | 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 | @@ -2921,32 +2921,83 @@
, 'Resources'),%0A
+ os.path.join(os.getcwd(), '..'),%0A
|
50f698c2fdd90bc4b3e60a583c196381fc23e099 | Implement a rudimentary API for LLTK | lltk-restful/base.py | lltk-restful/base.py | Python | 0.000034 | @@ -0,0 +1,1344 @@
+#!/usr/bin/python%0A# -*- coding: UTF-8 -*-%0A%0Aimport lltk%0Aimport lltk.generic%0Aimport lltk.caching%0Aimport lltk.exceptions%0A%0Afrom flask import Flask%0Afrom flask import jsonify, request%0A%0A__author__ = 'Markus Beuckelmann'%0A__author_email__ = 'email@markus-beuckelmann.de'%0A__version__ ... | |
04f19b29c79e1ab624d7ce596730ad9b4fd500fd | add lcdb.helpers.py | lcdb/helpers.py | lcdb/helpers.py | Python | 0.001346 | @@ -0,0 +1,338 @@
+import yaml%0Afrom jsonschema import validate, ValidationError%0A%0A%0Adef validate_config(config, schema):%0A schema = yaml.load(open(schema))%0A cfg = yaml.load(open(config))%0A try:%0A validate(cfg, schema)%0A except ValidationError as e:%0A msg = '%5CnPlease fix %25s: %2... | |
f4944256092b085b1546eaec114e0987da6697bc | add simple cli client | instapaper_cli.py | instapaper_cli.py | Python | 0.000001 | @@ -0,0 +1,1079 @@
+#!/opt/local/bin/python2.6%0A%0Afrom instapaper import Instapaper%0Afrom optparse import OptionParser%0Afrom getpass import getpass%0A%0Adef usage():%0A print %22Usage: instapaper.py %5B-h%5D username password url%22%0A print %22Options:%22%0A print %22-h Print this help%22%0A%0Adef main(... | |
4d740138dc7101e2816837c070d3051835977d75 | Add lc0621_task_scheduler.py | lc0621_task_scheduler.py | lc0621_task_scheduler.py | Python | 0.000004 | @@ -0,0 +1,1116 @@
+%22%22%22Leetcode 621. Task Scheduler%0AMedium%0A%0AURL: https://leetcode.com/problems/task-scheduler/%0A%0AGiven a char array representing tasks CPU need to do. It contains capital letters%0AA to Z where different letters represent differenttasks. Tasks could be done%0Awithout original order. Each ... | |
af8f7a09c6cf8a96b716d016fc3a983340760869 | Create problem10.py | python/problem10.py | python/problem10.py | Python | 0.000029 | @@ -0,0 +1,184 @@
+import primes%0A%0Adef problem10(limit):%0A ps = itertools.takewhile(lambda x: x %3C limit, primes.Eppstein_Sieve())%0A # ps = primes.Eratosthenes(limit) # memory error%0A return sum(ps)%0A
| |
5b276622f570adac64eda9932c7da47bf4bcd25c | Add PPM sample | ppm_practice.py | ppm_practice.py | Python | 0 | @@ -0,0 +1,1409 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A%0Aclass PpmImage(object):%0A %22%22%22PPM %E7%94%BB%E5%83%8F%E3%82%92%E8%A1%A8%E3%81%99%E3%82%AF%E3%83%A9%E3%82%B9%22%22%22%0A%0A def __init__(self, name, width, height, image, depth=8):%0A %22%22%22%0A :param name:%0A ... | |
4f404a71cb7ee912bca8184fe94c97d6cfba1186 | Add script to rotate a solid angle in the xz plane | preprocessing_tools/solid_rotation_y.py | preprocessing_tools/solid_rotation_y.py | Python | 0 | @@ -0,0 +1,2276 @@
+'''%0ARotates the protein by a solid angle on the plane xz%0A'''%0A%0Aimport numpy%0Aimport os%0A%0Afrom argparse import ArgumentParser%0A%0Afrom move_prot_helper import (read_vertex, read_pqr, rotate_y,%0A modify_pqr)%0A%0Adef read_inputs():%0A %22%22%22%0A Parse c... | |
daf23cbb6d6015a2819de5d089a35903cbce9441 | Create katakan.py | list/katakan.py | list/katakan.py | Python | 0.000004 | @@ -0,0 +1,984 @@
+%22%22%22%0A4%0A2 belas%0Aseratus 4 puluh 0%0A9 ribu seratus 2 puluh 1%0A2 puluh 1 ribu 3 puluh 0%0A9 ratus 5 ribu 0%0A8 puluh 2 juta 8 ratus 8 belas ribu seratus 8 puluh 8%0A3 ratus 1 juta 4 puluh 8 ribu 5 ratus 8 puluh 8%0A%22%22%22%0A%0Adef kata(n):%0A angka = range(11)%0A temp = %22%22%0A%0... | |
69be3c0efe6d0a508eac0e9bcc837eac9d68e8f0 | Improve python p.a.c.k.er detection, fix #479 | python/jsbeautifier/unpackers/packer.py | python/jsbeautifier/unpackers/packer.py | #
# Unpacker for Dean Edward's p.a.c.k.e.r, a part of javascript beautifier
# by Einar Lielmanis <einar@jsbeautifier.org>
#
# written by Stefano Sanfilippo <a.little.coder@gmail.com>
#
# usage:
#
# if detect(some_string):
# unpacked = unpack(some_string)
#
"""Unpacker for Dean Edward's p.a.c.k.e.r"""
import r... | Python | 0.000003 | @@ -1231,19 +1231,19 @@
-argsregex =
+juicers = %5B
(r%22
@@ -1278,17 +1278,51 @@
'(.*)'%5C.
-%22
+split%5C('%5C%7C'%5C), *(%5Cd+), *(.*)%5C)%5C)%22),
%0A
@@ -1334,23 +1334,27 @@
- r%22split%5C('%5C%7C'%5C
+(r%22%7D%5C('(.*)', *(%5Cd+
), *
@@ -1365,19 +1365,80 @@
), *
+'
(.*)
-%5C)
+'%5C.split... |
1555164ff275436de580a33735a2d8c6e6893b42 | Create lab4.py | laboratorios/lab4.py | laboratorios/lab4.py | Python | 0.000001 | @@ -0,0 +1,909 @@
+#lab 4%0A#josue dde leon%0A%0A%0Afor i in range (1, 4):%0A%09nombre = input(%22%5Cn%5Cnintroduce nombre: %22)%0A%09n1 = input (%22Introduce nota 1: %22)%0A%09n2 = input (%22Introduce nota 2: %22)%0A%09n3 = input (%22Introduce nota 3: %22)%0A%09n4 = input (%22Introduce nota 4: %22)%0A%09n5 = input (%2... | |
7b06edf37a630d4582fc84832cd1d40b790e4aa3 | Add server | pygls/server.py | pygls/server.py | Python | 0.000001 | @@ -0,0 +1,1513 @@
+import asyncio%0Aimport logging%0A%0Afrom .protocol import LanguageServerProtocol%0A%0Alogger = logging.getLogger(__name__)%0A%0A%0Aclass Server:%0A def __init__(self, protocol_cls):%0A assert issubclass(protocol_cls, asyncio.Protocol)%0A self.loop = asyncio.get_event_loop()%0A%0A ... | |
357ce31d1f28fbc5d12a23dfd3bb2aa40a4e27a3 | Add serialdumpbytexor.py | serialdumpbytexor.py | serialdumpbytexor.py | Python | 0.000128 | @@ -0,0 +1,394 @@
+#!/usr/bin/env python%0A%0Aimport sys, serial%0A%0Aif __name__ == '__main__':%0A ser = serial.Serial('/dev/cu.usbserial-A8004ISG', 115200, timeout=10, xonxoff=0, rtscts=0)%0A # ser.open()%0A bb = bytearray(512)%0A while 1:%0A ba = bytearray(ser.read(1024))%0A for i in range(... | |
6d8d76277d5d55d1be155763f380e0a573e03719 | Fix a test which was broken since the last commit (Warning_:_) | test/test_timeout.py | test/test_timeout.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#Copyright (C) 2009-2010 :
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
#
#This file is part of Shinken.
#
#Shinken is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as... | Python | 0.000019 | @@ -3497,16 +3497,17 @@
%22Warning
+
: Contac
|
ca99e80e04a1d7fb3ff3698f23cdc19c8ec16113 | add refresh test | refresh_test.py | refresh_test.py | Python | 0 | @@ -0,0 +1,2226 @@
+#!/usr/bin/env python%0A%0A# This program is free software; you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as published by%0A# the Free Software Foundation; either version 3 of the License, or%0A# (at your option) any later version.%0A#%0A# This... | |
b440872f71d37cc5bf110eb0c7c13a4a2dcb7f6c | create utils package, field_template_read update var name to template render | opps/fields/utils.py | opps/fields/utils.py | Python | 0 | @@ -0,0 +1,236 @@
+# -*- coding: utf-8 -*-%0Adef field_template_read(obj):%0A %22%22%22Use replace because the django template can't read variable with %22-%22%0A %22%22%22%0A fields = %7B%7D%0A for o in obj:%0A fields%5Bo.replace(%22-%22, %22_%22)%5D = obj%5Bo%5D%0A%0A return fields%0A
| |
2804024fbee6b825dec512ff13d7b28a1fee5b25 | Add root Api object. | routeros_api/api.py | routeros_api/api.py | Python | 0 | @@ -0,0 +1,2769 @@
+import hashlib%0Aimport binascii%0Afrom routeros_api import api_communicator%0Afrom routeros_api import api_socket%0Afrom routeros_api import base_api%0A%0A%0Adef connect(host, username='admin', password='', port=8728):%0A socket = api_socket.get_socket(host, port)%0A base = base_api.Connectio... | |
52f715af4b1cf6dd964e71cafdf807d1133fe717 | add a basic script that tests nvlist_in and nvlist_out functionality | tests/test_nvlist.py | tests/test_nvlist.py | Python | 0.000001 | @@ -0,0 +1,841 @@
+import json%0Aimport math%0Afrom libzfs_core.nvlist import *%0Afrom libzfs_core.nvlist import _lib%0A%0Aprops_in = %7B%0A%09%22key1%22: %22str%22,%0A%09%22key2%22: 10,%0A%09%22key3%22: %7B%0A%09%09%22skey1%22: True,%0A%09%09%22skey2%22: None,%0A%09%09%22skey3%22: %5B%0A%09%09%09True,%0A%09%09%09False... | |
5348379759caa9576c3194ae0795e2fcc6ed3308 | add unit tests | tests/test_region.py | tests/test_region.py | Python | 0.000001 | @@ -0,0 +1,2354 @@
+# -*- coding: utf-8 -*-%0Afrom cooler.region import *%0Aimport nose%0A%0A%0Adef test_bool_ops():%0A a, b = parse_region(('chr1', 5, 10)), parse_region(('chr1', 15, 20))%0A assert comes_before(a, b) == True%0A assert comes_after(a, b) == False%0A assert contains(a, b) == False%0A asser... | |
c9fc6d4f98ba102d94fa54eedae6a50d38459d71 | add test_invalid_files to test_schema | tests/test_schema.py | tests/test_schema.py | Python | 0.000001 | @@ -0,0 +1,2280 @@
+import os%0Aimport jsonschema%0Aimport json%0Aimport pathlib%0Aimport copy%0A%0A%0Adef get_example_json(filebase):%0A rootdir = pathlib.Path(__file__).resolve().parent.parent%0A jsonfilepath = str(rootdir / 'examples' / f'%7Bfilebase%7D.json')%0A with open(jsonfilepath) as f:%0A js =... | |
5e4fd7fb37f9e16d27a7751221f6e3725509f2fc | Prepare to use unittests | tests/testapi.py | tests/testapi.py | Python | 0 | @@ -0,0 +1,1273 @@
+#!/usr/bin/python%0A%0Afrom fortigateconf import FortiOSConf%0Aimport sys%0Aimport json%0Aimport pprint%0Aimport json%0Afrom argparse import Namespace%0Aimport logging%0Aformatter = logging.Formatter(%0A '%25(asctime)s %25(name)-12s %25(levelname)-8s %25(message)s')%0Alogger = logging.getLogg... | |
e57a73ac2c1a22d97ce40a8954ecb44e3b92a53c | increase to 100% | lob/api_requestor.py | lob/api_requestor.py | import requests
import lob
import json
import resource
from lob import error
from version import VERSION
def _is_file_like(obj):
"""
Checks if an object is file-like enough to be sent to requests.
In particular, file, StringIO and cStringIO objects are file-like.
Refs http://stackoverflow.com/question... | Python | 0.000013 | @@ -1040,28 +1040,16 @@
else:
-%0A
#pragma
@@ -1166,27 +1166,8 @@
esp)
- # pragma: no cover
%0A%0A
|
cd653c3657aa14d3845a253d916e9f0d336910ce | add logger convenience class | loggerglue/logger.py | loggerglue/logger.py | Python | 0 | @@ -0,0 +1,2627 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0AAn rfc5424/rfc5425 syslog server implementation%0ACopyright %C2%A9 2011 Evax Software %3Ccontact@evax.fr%3E%0A%22%22%22%0Aimport socket,os,sys%0Afrom datetime import datetime%0A%0Afrom loggerglue.rfc5424 import DEFAULT_PRIVAL,SyslogEntry%0Afrom loggerglue.emitte... | |
1ac75fafc9c67e0fc1f898f4653593730ed66326 | Create uber.py | modules/uber.py | modules/uber.py | Python | 0.000036 | @@ -0,0 +1,50 @@
+def uber(self):%0A self.send_chan(%22Prkl, toimii!%22)%0A
| |
7b8d7bf81b094f554f3d820b1e0df5d54917f4c0 | Create getCITask.py | src/main/resources/xlr_xldeploy/getCITask.py | src/main/resources/xlr_xldeploy/getCITask.py | Python | 0.000001 | @@ -0,0 +1,1389 @@
+#%0A# Copyright 2017 XEBIALABS%0A#%0A# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the %22Software%22), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, mer... | |
71fa375ac07ed23e7105f253fc45fff98890c1c4 | document :- Bug #539644 - backward compatibility for file utility | addons/document/content_index.py | addons/document/content_index.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | Python | 0 | @@ -5234,17 +5234,16 @@
-#
fp = Pop
@@ -5269,94 +5269,8 @@
mime
--type',fname%5D, shell=False, stdout=PIPE).stdout%0A fp = Popen(%5B'file','-b
',fn
@@ -5406,14 +5406,20 @@
lt.s
-trip()
+plit(';')%5B0%5D
%0A
|
64bb565ad1a7785fdd4a65f92ba26f73425c4e63 | Add a hack so we are still able to answer to users requesting "tor-browser-bundle" | lib/gettor/requests.py | lib/gettor/requests.py | # Copyright (c) 2008 - 2011, Jacob Appelbaum <jacob@appelbaum.net>,
# Christian Fromme <kaner@strace.org>
# This is Free Software. See LICENSE for license information.
import sys
import email
import re
import logging
import gettor.utils
import gettor.packages
import gettor.filters
class ... | Python | 0 | @@ -3989,32 +3989,267 @@
ng.%0A %22%22%22%0A
+ # XXX HACK ALERT: This makes it possible for users to still request%0A # the windows bundle by its old name%0A packages_hacked = self.config.PACKAGES%0A packages_hacked%5B'tor-browser-bundle'%5D = ()%0A
for p in
|
116babc38e2e4023eb0b45eabc02050ed433e240 | Include a helpful MOD analyser script | scripts/mod_info.py | scripts/mod_info.py | Python | 0 | @@ -0,0 +1,1262 @@
+# mod_info.py%0A# %0A# Display information about a Protracker module.%0A# %0A# Written & released by Keir Fraser %3Ckeir.xen@gmail.com%3E%0A# %0A# This is free and unencumbered software released into the public domain.%0A# See the file COPYING for more details, or visit %3Chttp://unlicense.org%3E.%0... | |
e9576468046fd53195f139f5751c9d45f26c51c4 | handle NER exceptions. | aleph/analyze/polyglot_entity.py | aleph/analyze/polyglot_entity.py | from __future__ import absolute_import
import logging
from collections import defaultdict
from polyglot.text import Text
from aleph.core import db
from aleph.model import Reference, Entity, Collection
from aleph.model.entity_details import EntityIdentifier
from aleph.analyze.analyzer import Analyzer
log = logging.ge... | Python | 0 | @@ -759,16 +759,33 @@
return%0A
+ try:%0A
@@ -806,24 +806,28 @@
xt)%0A
+
+
if len(self.
@@ -848,16 +848,20 @@
) == 1:%0A
+
@@ -913,32 +913,36 @@
ages%5B0%5D%0A
+
+
for entity in te
@@ -958,32 +958,36 @@
es:%0A
+
if entity.tag ==
@@ -996... |
9e7acd4e7d80cffb0274e3a01aee517fb63d3db9 | Create Josuel_Concordance.py | Josuel_Concordance.py | Josuel_Concordance.py | Python | 0 | @@ -0,0 +1,2281 @@
+# Author: Josuel Musambaghani%0A%0A# library that breaks text into parts%0Aimport nltk%0Aimport string%0A%0Awith open('c:/Python27/fileIn.txt', 'r') as in_file:%0A text = in_file.read()%0A f = nltk.sent_tokenize(text)%0A%0A%0A# This code deals with the proble of parenthesis%0Afor item in range... | |
2032a823b2dad6f7cebb63ee276bcfb6ea02b7a0 | improve notes | notes/code/lolviz.py | notes/code/lolviz.py | Python | 0.000001 | @@ -0,0 +1,1790 @@
+import graphviz%0A%0Adef lolviz(table):%0A %22%22%22%0A Given a list of lists such as:%0A%0A %5B %5B('a','3')%5D, %5B%5D, %5B('b',230), ('c',21)%5D %5D%0A%0A return the dot/graphviz to display as a two-dimensional%0A structure.%0A %22%22%22%0A s = %22%22%22%0A digraph G %7B... | |
70b6fde787018daf5b87f485e60c9a26fa542f2e | add basic affine 3D transforms | lab_3/affine_transform.py | lab_3/affine_transform.py | Python | 0.000008 | @@ -0,0 +1,1469 @@
+from util.matrix import Matrix%0Afrom math import cos, sin%0A%0A%0Adef translation(x, y, z):%0A return Matrix(%5B%0A %5B1, 0, 0, x%5D,%0A %5B0, 1, 0, y%5D,%0A %5B0, 0, 1, z%5D,%0A %5B0, 0, 0, 1%5D%0A %5D)%0A%0A# den = (phi ** 2 + psi ** 2) ** .5%0A# ... | |
786f75be946427024fa96ae8dcd06d8d1ecd49cc | Add the init method to the node model. | model/node.py | model/node.py | Python | 0 | @@ -0,0 +1,147 @@
+class NodeModel(Query):%0A def __init__(self, db):%0A self.db = db%0A self.table_name = %22node%22%0A super(NodeModel, self).__init__()
| |
07467664b699612e10b51bbeafdce79a9d1e0127 | Write unit test for utility functions | test/test_util.py | test/test_util.py | Python | 0.000002 | @@ -0,0 +1,1844 @@
+from __future__ import unicode_literals%0A%0Atry:%0A import io%0A StringIO = io.StringIO%0Aexcept ImportError:%0A import StringIO%0A StringIO = StringIO.StringIO%0Aimport os%0Aimport shutil%0Aimport sys%0Aimport tempfile%0Aimport unittest%0A%0Aimport cudnnenv%0A%0A%0Aclass TestSafeTempDi... | |
448f18769d7c701d9dd03ff65489656380513d07 | Add test init. | tests/__init__.py | tests/__init__.py | Python | 0 | @@ -0,0 +1,949 @@
+from flexmock import flexmock%0Afrom flask.ext.storage import MockStorage%0Afrom flask_uploads import init%0A%0Acreated_objects = %5B%5D%0Aadded_objects = %5B%5D%0Adeleted_objects = %5B%5D%0Acommitted_objects = %5B%5D%0A%0A%0Aclass MockModel(object):%0A def __init__(self, **kw):%0A created_... | |
256648ad4effd9811d7c35ed6ef45de67f108926 | Add pytest option for specifying the typing module to use | tests/conftest.py | tests/conftest.py | Python | 0 | @@ -0,0 +1,325 @@
+import sys%0A%0A%0Adef pytest_addoption(parser):%0A parser.addoption('--typing', action='store', default='typing')%0A%0A%0Adef pytest_configure(config):%0A if config.option.typing == 'no':%0A sys.modules%5B'typing'%5D = None%0A elif config.option.typing != 'typing':%0A sys.modu... | |
08f6d31feb493b24792eaabfa11d08faea68c62b | add textample plug | plugins/textample/textample.py | plugins/textample/textample.py | Python | 0 | @@ -0,0 +1,1195 @@
+# coding=utf-8%0A%0Aimport gzip%0Aimport os%0Aimport random%0Aimport re%0A%0A%0Adef search(regex, base_dir, file_contains=''):%0A reg = re.compile(regex, re.IGNORECASE)%0A for root, _, files in os.walk(base_dir):%0A for file in files:%0A if file.endswith('.gz'):%0A ... | |
6638431cbfef10b70b338b62a116661ea66c42b0 | Remove unused import | nose2/main.py | nose2/main.py | import logging
import os
import sys
from nose2.compat import unittest
from nose2 import events, loader, runner, session, util
log = logging.getLogger(__name__)
__unittest = True
class PluggableTestProgram(unittest.TestProgram):
sessionClass = session.Session
loaderClass = loader.PluggableTestLoader
run... | Python | 0.000001 | @@ -117,14 +117,8 @@
sion
-, util
%0A%0A%0Al
|
da3248f782d83c46b698c31736b29a42d380511c | Add the playground | micro/_playground.py | micro/_playground.py | Python | 0.999869 | @@ -0,0 +1,738 @@
+CODE = '''%0Aout str + 2 3%0A'''%0A%0Aif __name__ == '__main__':%0A import lexer%0A import preparser%0A import parser%0A import builtin_functions%0A import sys%0A import evaluate%0A%0A specific_lexer = lexer.Lexer()%0A specific_preparser = preparser.Preparser(specific_lexer)%0... | |
682b064f29c7a6cfea0c9866da03703822e70cb3 | Add machinery to slurp dhcpd.leases journal into usable format. | propernoun/leases.py | propernoun/leases.py | Python | 0 | @@ -0,0 +1,505 @@
+from . import parser%0Afrom . import watch%0A%0Adef gen_leases(path):%0A %22%22%22%0A Keep track of currently valid leases for ISC dhcpd.%0A%0A Yields dictionaries that map %60%60ip%60%60 to information about the%0A lease. Will block until new information is available.%0A %22%22%22%0A ... | |
ba6c50d0b2fd973c34f2df3779d78df11f671598 | Create mongo_import_keywords.py | mongo_import_keywords.py | mongo_import_keywords.py | Python | 0.00004 | @@ -0,0 +1,2116 @@
+%22%22%22%0ALoad mongo database with keywords for annie annotation.%0AThe keyword_array pickle is packaged with the GRITS classifier.%0A%22%22%22%0Aimport sys%0Aimport re%0Aimport pickle%0Afrom pymongo import MongoClient%0A%0Adef load_keyword_array(file_path):%0A with open(file_path) as f:%0A ... | |
f9917d04f1147fd9bc147bf1a7b5b4797a37207c | fix to a buggy community searching code in processIncomingMsg (thanks to Paul Warner for pointing out) | pysnmp/proto/secmod/rfc2576.py | pysnmp/proto/secmod/rfc2576.py | # SNMP v1 & v2c security models implementation
from pyasn1.codec.ber import encoder
from pysnmp.proto.secmod import base
from pysnmp.smi.error import NoSuchInstanceError
from pysnmp.proto import error
from pysnmp import debug
class SnmpV1SecurityModel(base.AbstractSecurityModel):
securityModelID = 1
# Accordin... | Python | 0 | @@ -5051,134 +5051,8 @@
- break%0A if mibNodeIdx.syntax != communityName:%0A continue%0A break%0A else:%0A
@@ -5159,34 +5159,26 @@
bols('__SNMP
--COMMUNITY
+v2
-MIB', 'snmp
@@ -5199,16 +5199,20 @@
Names')%0A
+
@@ -5285,32 +5285,36 @@
x... |
a21ed2d12b763d93722b6c8e9f6d6ff39d15938c | add utility to fetch satellites and corresponding TLEs | python-files/get-satellites.py | python-files/get-satellites.py | Python | 0 | @@ -0,0 +1,1522 @@
+#!/usr/bin/env python3%0A%0A%22%22%22%0AUtility to get the station information from a SatNOGS Network server.%0A%0ACollects the paginated objects into a single JSON list and stores in a file.%0A%22%22%22%0A%0Aimport json%0Aimport sqlite3%0Aimport requests%0A%0Aimport orbit%0A%0A%0A# default expire t... | |
550873226ec0879a86fea2527b56535a329981b1 | Add upcoming_match.py | upcoming_match.py | upcoming_match.py | Python | 0.000001 | @@ -0,0 +1,455 @@
+#! /usr/bin/env python%0A#%0A# Tests sending an upcoming_match notification via adb to The Blue Alliance%0A# Android app.%0A%0Aimport test_notification%0A%0A%0Ajson_data = %7B%22match_key%22: %222007cmp_sf1m3%22,%0A %22event_name%22: %22Championship - Einstein Field%22,%0A %22team_keys%22: %5B%... | |
1d8cbf94f127571358aee97677a09f7cea3bf3a7 | Add helper functions for to/from bytes/unicode | p23serialize/util.py | p23serialize/util.py | Python | 0.000001 | @@ -0,0 +1,548 @@
+from . import str_mode%0A%0Aif str_mode == 'bytes':%0A unicode_type = unicode%0Aelse: # str_mode == 'unicode'%0A unicode_type = str%0A%0Adef recursive_unicode(obj):%0A if isinstance(obj, bytes):%0A return obj.decode('latin1')%0A elif isinstance(obj, list):%0A return %5Brecu... | |
01f21a16e4bcecccf51a565b51222ab18b79adb4 | Add tests for shell utils. | st2common/tests/unit/test_util_shell.py | st2common/tests/unit/test_util_shell.py | Python | 0 | @@ -0,0 +1,2606 @@
+# Licensed to the StackStorm, Inc ('StackStorm') under one or more%0A# contributor license agreements. See the NOTICE file distributed with%0A# this work for additional information regarding copyright ownership.%0A# The ASF licenses this file to You under the Apache License, Version 2.0%0A# (the %2... | |
f56a902f2e7ca45bb4bf1dfa7dacefd3fefff524 | Create config.sample | zhwikt-broken-file-links/config.sample.py | zhwikt-broken-file-links/config.sample.py | Python | 0 | @@ -0,0 +1,70 @@
+# -*- coding: utf-8 -*-%0Acfg = %7B%0A%09%22category%22: %22Category:%E5%90%AB%E6%9C%89%E5%8F%97%E6%8D%9F%E6%96%87%E4%BB%B6%E9%93%BE%E6%8E%A5%E7%9A%84%E9%A1%B5%E9%9D%A2%22%0A%7D%0A
| |
f55051cdfd6c358d9cb131c5fc7ae1e5e330d93e | return zero as timestamp when it does not present in riak cache(cherry picked from commit d4c290959524cb2bac2109f6867a0500ec8e7d9e) | mapproxy/cache/riak.py | mapproxy/cache/riak.py | # This file is part of the MapProxy project.
# Copyright (C) 2013 Omniscale <http://omniscale.de>
#
# 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... | Python | 0 | @@ -2755,17 +2755,17 @@
mestamp
-=
+!
= None:%0A
@@ -2776,27 +2776,22 @@
-timestamp =
+return
float(t
@@ -2797,15 +2797,13 @@
time
-.time()
+stamp
)%0A
@@ -2800,32 +2800,37 @@
estamp)%0A
+%0A
obj.usermeta
@@ -2849,56 +2849,32 @@
mp':
-str(timestamp)%7D%0A%0A return float(tim... |
18d129613c5a576b770a812f18ff05873925fb2c | refactor to a shorter version. | restclients/digitlib/curric.py | restclients/digitlib/curric.py | """
This is the interface for interacting with the UW Libraries Web Service.
"""
import logging
from restclients.digitlib import get_resource
url_prefix = "/php/currics/service.php?code="
sln_prefix = "&sln="
quarter_prefix = "&quarter="
year_prefix = "&year="
logger = logging.getLogger(__name__)
def get_subject_g... | Python | 0.000174 | @@ -993,33 +993,16 @@
if
-data_in_resp.get(
%22Locatio
@@ -999,37 +999,40 @@
f %22Location%22
-)
i
-s not None
+n data_in_resp
:%0A
@@ -1052,21 +1052,17 @@
_in_resp
-.get(
+%5B
%22Locatio
@@ -1059,25 +1059,25 @@
p%5B%22Location%22
-)
+%5D
%0A if
@@ -1076,33 +1076,16 @@
if
-data_... |
f22f833efb45bdfe0458d045cfd300721185dc84 | Revert "bug fix" | sabToSickBeardwithConverter.py | sabToSickBeardwithConverter.py | import os
import sys
import autoProcessTV
from readSettings import ReadSettings
from mkvtomp4 import MkvtoMp4
from extensions import valid_input_extensions
settings = ReadSettings(os.path.dirname(sys.argv[0]), "autoProcess.ini")
path = str(sys.argv[1])
for r, d, f in os.walk(path):
for files in f:
if os.p... | Python | 0 | @@ -440,20 +440,20 @@
kvtoMp4(
-file
+path
, FFMPEG
|
d3a9824ea2f7675e9e0008b5d914f02e63e19d85 | Add new package. (#22639) | var/spack/repos/builtin/packages/liblbfgs/package.py | var/spack/repos/builtin/packages/liblbfgs/package.py | Python | 0 | @@ -0,0 +1,1217 @@
+# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass Liblbfgs(AutotoolsPackage):%0A %22%22%22libLBFGS is a C... | |
a568663ebcf8b45a801df2cf2185dd3e7c969a79 | Fix fragile command description | vint/linting/policy/prohibit_command_rely_on_user.py | vint/linting/policy/prohibit_command_rely_on_user.py | import re
from vint.ast.node_type import NodeType
from vint.linting.level import Level
from vint.linting.policy.abstract_policy import AbstractPolicy
from vint.linting.policy.reference.googlevimscriptstyleguide import get_reference_source
from vint.linting.policy_loader import register_policy
PROHIBITED_COMMAND_PATTE... | Python | 0.004767 | @@ -589,32 +589,45 @@
= '
-Prefer single quoted str
+Avoid commands that rely on user sett
ings
|
b55277497559fad19f790ba8821f02ff2ce20c91 | add a minimal smoke test of multi-run | bluesky/tests/test_multi_runs.py | bluesky/tests/test_multi_runs.py | Python | 0 | @@ -0,0 +1,1130 @@
+from bluesky import preprocessors as bpp%0Afrom bluesky import plans as bp%0Afrom bluesky import plan_stubs as bps%0Afrom bluesky.preprocessors import define_run_wrapper as drw%0Afrom ophyd.sim import motor, det%0Afrom bluesky.tests.utils import DocCollector%0A%0A%0Adef test_multirun_smoke(RE, hw):%... | |
f31b11b2cf1f6924c4373fbfaf4b911102272876 | add base serializer | cla_backend/apps/complaints/serializers.py | cla_backend/apps/complaints/serializers.py | Python | 0 | @@ -0,0 +1,383 @@
+# -*- coding: utf-8 -*-%0Afrom rest_framework import serializers%0A%0Afrom .models import Category, Complaint%0A%0A%0Aclass CategorySerializerBase(serializers.ModelSerializer):%0A class Meta:%0A model = Category%0A fields = ('id', 'name')%0A%0A%0Aclass ComplaintSerializerBase(seriali... | |
9d348cba1c800a4de9a0078ded1e03540256f8a6 | Add backwards-compatible registration.urls, but have it warn pending deprecation. | registration/urls.py | registration/urls.py | Python | 0 | @@ -0,0 +1,233 @@
+import warnings%0A%0Awarnings.warn(%22Using include('registration.urls') is deprecated; use include('registration.backends.default.urls') instead%22,%0A PendingDeprecationWarning)%0A%0Afrom registration.backends.default.urls import *%0A
| |
d028db776b92c4d968434a64b2c5d7e02867b32e | Create db_init.py | db_init.py | db_init.py | Python | 0.000009 | @@ -0,0 +1,640 @@
+from sqlalchemy import create_engine, Column, Integer, String, Sequence, update%0Afrom sqlalchemy.ext.declarative import declarative_base%0Afrom sqlalchemy.orm import sessionmaker%0A%0Aengine = create_engine('sqlite:///passwords.db')%0ABase = declarative_base()%0ASession = sessionmaker(bind=engine)%0... | |
e7fa141bc8fade9c6a34c0bbe95df9a77eb95e0e | Update __init__.py | tendrl/commons/objects/disk/__init__.py | tendrl/commons/objects/disk/__init__.py | from tendrl.commons.etcdobj import EtcdObj
from tendrl.commons import objects
class Disk(objects.BaseObject):
def __init__(self, disk_id=None, device_name=None, disk_kernel_name=None,
parent_id=None, parent_name=None, disk_type=None, fsuuid=None,
mount_point=None, model=None, ven... | Python | 0.000072 | @@ -1375,32 +1375,36 @@
'nodes/%25s/Disks/
+all/
%25s'%0A self
@@ -3442,16 +3442,20 @@
s/Disks/
+all/
%25s'%0A
|
b40512e834e88f24c20885cddb220188fce11339 | Add verbose names to UserProfile fields. | accounts/migrations/0004_auto_20150227_2347.py | accounts/migrations/0004_auto_20150227_2347.py | Python | 0.000001 | @@ -0,0 +1,798 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('accounts', '0003_auto_20150227_2158'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterF... | |
18baab37c3f1924b104f4ef86224c1b197ef1dad | add problem 054 | problem_054.py | problem_054.py | Python | 0.000847 | @@ -0,0 +1,2200 @@
+#!/usr/bin/env python%0A#-*-coding:utf-8-*-%0A%0A'''%0A'''%0A%0Aimport timeit%0A%0A%0Aclass Poker:%0A def __init__(self, cards):%0A self.numbers = %7B%7D%0A self.suits = %7B%7D%0A for card in cards:%0A n = self._to_number(card%5B0%5D)%0A s = card%5B1%5D%... | |
e21d6d88f49dbdeb2dfb96e68f174ba587eaa27a | Add pre-deploy version match | pre-deploy.py | pre-deploy.py | Python | 0 | @@ -0,0 +1,1140 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%22%22%22%0Apre-deploy.py%0A%0ACreated by Stephan H%C3%BCgel on 2017-06-06%0A%0AA simple check to ensure that the tag version and the library version coincide%0AIntended to be called before a Wheel is written using %22upload%22%0A%22%22%22%0A%0Aimpor... | |
bc1c65315fe22146b2d9a0955acc6e286b069657 | Add problem 48 | problem_48.py | problem_48.py | Python | 0.02481 | @@ -0,0 +1,335 @@
+'''%0AProblem 48%0A%0A@author: Kevin Ji%0A'''%0A%0Adef self_power_with_mod(number, mod):%0A product = 1%0A%0A for _ in range(number):%0A product *= number%0A product %25= mod%0A%0A return product%0A%0A%0AMOD = 10000000000%0Anumber = 0%0A%0Afor power in range(1, 1000 + 1):%0A ... | |
008625fef55f8f58ab80b883d34ae5d40e55c721 | Add initial test for binheap | test_binheap.py | test_binheap.py | Python | 0.000001 | @@ -0,0 +1,164 @@
+import pytest%0Afrom binheap import Binheap%0A%0A%0Adef test_init_bh():%0A b = Binheap()%0A assert b.binlist is %5B%5D%0A c = Binheap(%5B1, 2%5D)%0A assert c.binlist == %5B1, 2%5D%0A
| |
4de60043a290a5590dc686f611228a9ddd94a980 | fix benchmark.py | mpmath/tests/benchmark.py | mpmath/tests/benchmark.py | # Note: the code in this file is a big pile of ugly
from mpmath import *
from mpmath.lib import *
from decimal import getcontext, Decimal
import dmath
from random import seed, random, randint
def getrandom(type):
if type == 'mpf':
return mpf(random() * 2.0**randint(-10, 10)) ** 0.5
if type ... | Python | 0.000015 | @@ -2008,16 +2008,17 @@
', 'fpow
+i
(x, 42,
@@ -2528,16 +2528,25 @@
slow = %5B
+%22power%22,
%22exp%22, %22
|
a400a24a20dad682e90ad6e52fc8f17a6cac541a | Support for methods on User model when checking permissions | oscar/views/decorators.py | oscar/views/decorators.py | from functools import wraps
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.decorators import user_passes_test
from django.shortcuts import render
from django.contrib import messages
from django.contrib.auth.views import redirect_to_login
from django.core.exceptions import PermissionDenied... | Python | 0.000009 | @@ -2366,19 +2366,27 @@
or a
-n attribute
+ property or method
on
@@ -2966,39 +2966,112 @@
-if conditions and %5B'is_active',
+# always check for is_active if not checking for is_anonymous%0A if (conditions and%0A
'is
@@ -3081,17 +3081,16 @@
onymous'
-%5D
not in
@@ -3099,17 +3099,2... |
d43c67a59dcf6c43667d633df8b6f8a3eb84d611 | add HelloKhalaClient2.py | examples/testClient/HelloKhalaClient2.py | examples/testClient/HelloKhalaClient2.py | Python | 0.000001 | @@ -0,0 +1,1167 @@
+#moss's HelloKhala Client%0D%0A#add time type%0D%0Aimport socket%0D%0Aimport struct%0D%0Aimport json%0D%0A%0D%0Adef login():%0D%0A%09send = %7B'type': 'login'%7D%0D%0A%09return send%0D%0Adef logout():%0D%0A%09send = %7B'type': 'logout'%7D%0D%0A%09return send%0D%0Adef devType():%0D%0A%09send = %7B'ty... | |
80e80bff7603e852710df6c9de613b1781877b2d | Test case for two classes with the same name in one module. | tests/python/typeinference/same_name.py | tests/python/typeinference/same_name.py | Python | 0 | @@ -0,0 +1,171 @@
+class A(object):%0A def method(self):%0A return 1%0A%0AA().method() ## type int%0A%0A%0Aclass A(object):%0A def method(self):%0A return %22test%22%0A%0AA().method() ## type str%0A
| |
bd766630ceadcea1928a8b582a178d49788ecc53 | Fix try_cast_int #66 | quora/quora.py | quora/quora.py | from bs4 import BeautifulSoup
import re
import requests
####################################################################
# Helpers
####################################################################
def try_cast_int(s):
try:
temp = re.findall('\d', str(s))
temp = ''.join(temp)
return i... | Python | 0.000002 | @@ -227,106 +227,478 @@
-try:%0A temp = re.findall('%5Cd', str(s))%0A temp = ''.join(temp)%0A return int(temp)
+pattern = re.compile(r'(%5B0-9%5D+(%5C.%5B0-9%5D+)*%5B %5D*%5BKk%5D)%7C(%5B0-9%5D+)')%0A raw_result = re.search(pattern, s).groups()%0A if raw_result%5B2%5D != None:%0A ... |
4887a269a28656c288461165078943f99e2390be | add settings template for ansible later | ansible/crates_settings.py | ansible/crates_settings.py | Python | 0 | @@ -0,0 +1,846 @@
+from base_settings import *%0A%0A%0A# SECURITY WARNING: keep the secret key used in production secret!%0ASECRET_KEY = 'zhj_+x#q-&vqh7&)7a3it@tcsf50@fh9$3&&j0*4pmt1x=ye+1'%0A%0A# SECURITY WARNING: don't run with debug turned on in production!%0ADEBUG = False%0A%0AALLOWED_HOSTS = %5B'.'%5D%0A%0A# where... | |
4143f5381b8ff47a80a550065e831c306551cd77 | solve problem 035 | python/035.py | python/035.py | Python | 0.000285 | @@ -0,0 +1,626 @@
+%0Adef base10_to_base2( n ):%0A base2n = 0%0A if n == 0:%0A return 0%0A return base10_to_base2( n/2 ) * 10 + n %25 2%0A%0Adef palindromes( s ):%0A flag = True%0A str_len = len(s)%0A half_len = str_len / 2%0A for i in range( 0, half_len+1 ):%0A if s%5Bi%5D != s%5Bstr... | |
a5a7d6c3097571a9ef050a75127a2eb24ad2746c | Remove test code. | packs/alertlogic/actions/scan_list_scan_executions.py | packs/alertlogic/actions/scan_list_scan_executions.py | #!/usr/bin/env python
# Licensed to the StackStorm, Inc ('StackStorm') 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 "Licens... | Python | 0.000001 | @@ -1535,341 +1535,4 @@
'%5D)%0A
-%0Aif __name__ == '__main__':%0A%0A config_file = %22/home/jjm/src/our-configs/alertlogic.yaml%22%0A with open(config_file) as f:%0A config = yaml.safe_load(f)%0A%0A action = ListScanExecutions(config)%0A ScanId = action.run(scan_title=%22ACI - RDG3 - Martin%22)%0A ... |
675b76f2bc36d7ce97d2e7227582597067be16bd | fix list problem. | crawler/git_crawler.py | crawler/git_crawler.py | # -*- coding: utf-8 -*-
from datetime import datetime
import envoy
from allmychanges.utils import cd, get_package_metadata
def git_clone(repo_path, path):
"""Clone git repo from repo_path to local path"""
r = envoy.run('git clone {repo} {path}'.format(repo=repo_path, path=path))
if r.status_code != 0 and... | Python | 0.000003 | @@ -881,16 +881,21 @@
return
+list(
reversed
@@ -899,16 +899,17 @@
sed(lst)
+)
%0A%0A%0Adef g
@@ -1810,32 +1810,33 @@
sections=
+%5B
dict(notes='',%0A
@@ -1877,38 +1877,44 @@
+
items=
+list(
reversed(current
@@ -1920,24 +1920,26 @@
t_commits)))
+%5D)
)%0A%0A
@@ -2173,16 +... |
7ecec2d2b516d9ae22a3a0f652424045d547d811 | Put object_tools in the correct order in settings | test_settings.py | test_settings.py | DEBUG = True
DATABASE_ENGINE = 'sqlite3'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
SECRET_KEY = '123'
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
... | Python | 0.000037 | @@ -280,24 +280,44 @@
.sessions',%0A
+ 'object_tools',%0A
'django.
@@ -332,36 +332,16 @@
admin',%0A
- 'object_tools',%0A
'obj
@@ -356,17 +356,16 @@
s.tests'
-,
%0A%5D%0A%0AROOT
|
35296b1c87a86a87fbcf317e26a497fc91c287c7 | Update receiver to catch value error | lexos/receivers/kmeans_receiver.py | lexos/receivers/kmeans_receiver.py | from typing import NamedTuple
from lexos.models.filemanager_model import FileManagerModel
from lexos.receivers.base_receiver import BaseReceiver
class KMeansOption(NamedTuple):
"""The typed tuple to hold kmeans options."""
n_init: int # number of iterations with different centroids.
k_value: int # k val... | Python | 0 | @@ -821,65 +821,8 @@
'%5D)%0A
- k_value = int(self._front_end_data%5B'nclusters'%5D)%0A
@@ -1014,16 +1014,31 @@
no input
+ from front-end
, use th
@@ -1068,24 +1068,99 @@
-if k_value == ''
+try:%0A k_value = int(self._front_end_data%5B'nclusters'%5D)%0A except ValueError
:%0A
|
4b6306a0a2d589fc8db79e3dabf5339a16f80f19 | fix typo in notification | app/models/notification.py | app/models/notification.py | #!/usr/bin/env python3
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy import ForeignKeyConstraint
from datetime import datetime
from app import db, login_manager as lm
from random import randint
from flask.ext.login import UserMixin
from werkzeug.security import generate_password_ha... | Python | 0.000245 | @@ -1747,16 +1747,21 @@
if
+self.
ref_clas
@@ -1767,32 +1767,32 @@
ss == 'Review':%0A
-
retu
@@ -1841,32 +1841,37 @@
d)%0A elif
+self.
ref_class == 'Re
@@ -1964,32 +1964,37 @@
d)%0A elif
+self.
ref_class == 'Co
@@ -2066,32 +2066,37 @@
d)%0A elif
+self.
ref_class == 'U... |
63bd4b5ed96cd7fd3181ce1ebb7bf63cdda6384e | Version 1.6.0 | sigopt/version.py | sigopt/version.py | VERSION = '1.5.2'
| Python | 0 | @@ -10,9 +10,9 @@
'1.
-5.2
+6.0
'%0A
|
b6f6eb362c8637839cbce4bd133895e73a695cc0 | Fix wrong args | cupy/cuda/compiler.py | cupy/cuda/compiler.py | import hashlib
import os
import re
import tempfile
import filelock
from pynvrtc import compiler
import six
from cupy.cuda import device
from cupy.cuda import function
_nvrtc_version = None
def _get_nvrtc_version():
global _nvrtc_version
if _nvrtc_version is None:
interface = compiler.NVRTCInterface... | Python | 0.999193 | @@ -956,16 +956,17 @@
('-arch
+=
%7B%7D'.form
|
dcd0a51e2a47174c5e1067575905056d1578319d | fix docstring | src/acquisition/covid_hosp/common/utils.py | src/acquisition/covid_hosp/common/utils.py | """Code shared among multiple `covid_hosp` scrapers."""
# standard library
import datetime
import re
import pandas as pd
class CovidHospException(Exception):
"""Exception raised exclusively by `covid_hosp` utilities."""
class Utils:
# regex to extract issue date from revision field
# example revision: "Mon,... | Python | 0.000018 | @@ -4131,33 +4131,35 @@
%0A newer_than
-D
+: d
ate%0A Lower
@@ -4210,33 +4210,35 @@
%0A older_than
-D
+: d
ate%0A Upper
|
89d83b9ca8c1c52537aae0c5339b0cb5ae64c6c4 | Add additional test for template filters: for filter queries and filter with variable argument | tests/filters.py | tests/filters.py | """Test cases for variable fields
"""
import unittest
from lighty.templates import Template
from lighty.templates.filter import filter_manager
def simple_filter(value):
return str(value).upper()
filter_manager.register(simple_filter)
def argument_filter(value, arg):
return str(value) + ', ' + str(arg)
filte... | Python | 0 | @@ -670,16 +670,17 @@
'Error
+t
emplate
@@ -1666,16 +1666,721 @@
eter')%0A%0A
+ def testMultiFilter(self):%0A multifilter_template = Template(name='multifilter.html')%0A multifilter_template.parse(%0A '%7B%7B simple_var%7Csimple_filter%7Cargument_filter:%22world%22 %7D%7D')%0A ... |
c5382580601e25a9fb5b41f42548a6e49929fae0 | Put this four languages in options bring problems. | wagtailcodeblock/blocks.py | wagtailcodeblock/blocks.py | from django.forms import Media
from django.utils.translation import ugettext_lazy as _
# Wagtail 2.0 compatibility - new package paths
try:
from wagtail.core.blocks import (
StructBlock,
TextBlock,
ChoiceBlock,
)
except ImportError:
from wagtail.wagtailcore.blocks import ... | Python | 0.000005 | @@ -607,24 +607,80 @@
_choices()%0D%0A
+ off_languages = %5B'html', 'mathml', 'svg', 'xml'%5D%0D%0A%0D%0A
%0D%0A langua
@@ -1265,16 +1265,157 @@
UAGES:%0D%0A
+ # Review: https://github.com/PrismJS/prism/blob/gh-pages/prism.js#L602%0D%0A if lang_code not in self.off_languages:%0D%0A
... |
a4d3cb3f90d0d1fe51cdb18f64502f8061798221 | set global user | wallaby/apps/wallabyApp.py | wallaby/apps/wallabyApp.py | #!/usr/bin/env python
# Copyright (c) by it's authors.
# Some rights reserved. See LICENSE, AUTHORS.
import wallaby.FX as FX
import wallaby.FXUI as FXUI
from wallaby.qt_combat import *
import wallaby.frontends.qt.resource_rc as resource_rc
from wallaby.frontends.qt.loginDialog import *
import twisted.application.s... | Python | 0.000001 | @@ -4567,16 +4567,55 @@
eactor%0A%0A
+ FX.user = dlg.userEdit.text()%0A%0A
|
b32f01154cce6d7b7572b04e7218b04d052661e0 | use apply_detection_link in eval | examples/ssd/eval.py | examples/ssd/eval.py | from __future__ import division
import argparse
import sys
import time
import chainer
from chainer import iterators
from chainercv.datasets import voc_detection_label_names
from chainercv.datasets import VOCDetectionDataset
from chainercv.evaluations import eval_detection_voc
from chainercv.links import SSD300
from ... | Python | 0 | @@ -343,16 +343,65 @@
SSD512%0A
+from chainercv.utils import apply_detection_link%0A
%0A%0Adef ma
@@ -1230,251 +1230,40 @@
e()%0A
-%0A
pr
-ed_bboxes = list()%0A pred_labels = list()%0A pred_scores = list()%0A gt_bboxes = list()%0A gt_labels = list()%0A gt_difficults = list()%0A%0A while True:... |
49707bf137c2ad7c4e0e69e25c47956846b5ee76 | Use never_cache decorator for views that render JS code | tinymce/views.py | tinymce/views.py | # coding: utf-8
# License: MIT, see LICENSE.txt
"""
django-tinymce4-lite views
"""
from __future__ import absolute_import
import json
import logging
from django import VERSION
from django.core.urlresolvers import reverse
from django.http import JsonResponse, HttpResponse
from django.template.loader import render_to_st... | Python | 0 | @@ -392,16 +392,70 @@
ettings%0A
+from django.views.decorators.cache import never_cache%0A
from jsm
@@ -2064,24 +2064,37 @@
s=status)%0A%0A%0A
+@never_cache%0A
def spell_ch
@@ -2399,32 +2399,28 @@
%22%22%22%0A re
-sponse =
+turn
HttpRespons
@@ -2588,72 +2588,22 @@
t')%0A
- response%5B'Cache-Control'%5D ... |
8874af7c0db371f63da687c5398db1c7b80f58cd | Fix import of django during install time (for environments like Heroku) (#120) | todo/__init__.py | todo/__init__.py | """
A multi-user, multi-group task management and assignment system for Django.
"""
__version__ = "2.4.10"
__author__ = "Scot Hacker"
__email__ = "shacker@birdhouse.org"
__url__ = "https://github.com/shacker/django-todo"
__license__ = "BSD License"
from . import check
| Python | 0.000005 | @@ -245,16 +245,22 @@
cense%22%0A%0A
+try:%0A%09
from . i
@@ -271,8 +271,114 @@
t check%0A
+except ModuleNotFoundError:%0A%09# this can happen during install time, if django is not installed yet!%0A%09pass%0A
|
e3c51012a36fd85781824bd6b66c7e5e1d6696a9 | Add documentation | app/resources/companies.py | app/resources/companies.py | from app.models import Company, PostalCode, CompanyPostalCode
from flask_restful import Resource, reqparse
class Companies(Resource):
def get(self):
parser = reqparse.RequestParser()
parser.add_argument('country')
parser.add_argument('postal_code')
args = parser.parse_args()
... | Python | 0 | @@ -148,16 +148,1243 @@
(self):%0A
+ %22%22%22%0A List all restaurants%0A ---%0A tags:%0A - Restaurants%0A definitions:%0A - schema:%0A id: Restaurant%0A properties:%0A id:%0A type: integer%0A ... |
d1f15d677ebb0c380e1d0a9824005a3db410909a | Fix query exceptions that got broken when i split the exceptions | wapiti/exceptions.py | wapiti/exceptions.py | # encoding: utf-8
# Copyright (c) Ecometrica. All rights reserved.
# Distributed under the BSD license. See LICENSE for details.
"""API exception definitions for wapiti"""
import traceback
from django.conf import settings
from django.http import HttpResponse
class APIBaseException(Exception):
name = "API Error"
... | Python | 0.000024 | @@ -254,16 +254,17 @@
sponse%0A%0A
+%0A
class AP
@@ -3464,32 +3464,33 @@
y Formed Query%22%0A
+%0A
def __init__
@@ -3511,32 +3511,89 @@
tr='', msg=''):%0A
+ from wapiti.views.object_views import SearchView%0A
super(AP
@@ -3852,16 +3852,17 @@
Query%22%0A
+%0A
def
@@ -3891,32 +3891,90 @@
... |
1b7d85267e183a3bc4f3b91a54a11550bd8edfb0 | Change shape to size for backward compatibility | ptsemseg/models/frrn.py | ptsemseg/models/frrn.py | import torch.nn as nn
import torch.nn.functional as F
from ptsemseg.models.utils import *
class frrn(nn.Module):
"""
Full Resolution Residual Networks for Semantic Segmentation
URL: https://arxiv.org/abs/1611.08323
References:
1) Original Author's code: https://github.com/TobyPDE/FRRN
2) TF ... | Python | 0.000001 | @@ -3939,20 +3939,21 @@
s in y.s
-hape
+ize()
%5B-2:%5D%5D)
|
4d2f3ee1343b9aef24f599b8acd07ed8340f0bff | convert that to a list so we can measure it's len in a template | tndata_backend/notifications/views.py | tndata_backend/notifications/views.py | from collections import defaultdict
from django.contrib.auth.decorators import user_passes_test
from django.contrib import messages
from django.shortcuts import render, redirect
from . import queue
from .models import GCMMessage
@user_passes_test(lambda u: u.is_staff, login_url='/')
def dashboard(request):
"""A... | Python | 0.000116 | @@ -863,17 +863,17 @@
jobs =
-(
+%5B
%0A
@@ -964,17 +964,17 @@
obs%0A
-)
+%5D
%0A con
|
6618ea7c1b67d87acff86338415e2a322a01cc3c | add loopback support | testsniff.py | testsniff.py | #!/usr/bin/env python
import getopt, sys
import pcap
from dpkt.ethernet import Ethernet
def usage():
print >>sys.stderr, 'usage: %s [-i device] [pattern]' % sys.argv[0]
sys.exit(1)
def main():
opts, args = getopt.getopt(sys.argv[1:], 'i:h')
name = None
for o, a in opts:
if o == '-i': name... | Python | 0.000001 | @@ -46,47 +46,18 @@
ort
-pcap%0Afrom dpkt.ethernet import Ethernet
+dpkt, pcap
%0A%0Ade
@@ -311,16 +311,25 @@
usage()%0A
+ %0A
pc =
@@ -378,16 +378,193 @@
(args))%0A
+ decode = %7B pcap.DLT_LOOP:dpkt.loopback.Loopback,%0A pcap.DLT_NULL:dpkt.loopback.Loopback,%0A pcap.DLT_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.