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 |
|---|---|---|---|---|---|---|---|
8f4d99f67b42fd6518d0b968c5ac2c39f3159211 | Change Windows virtualenv command | installer/steps/a_setup_virtualenv.py | installer/steps/a_setup_virtualenv.py | import os
import re
from helper import *
import unix_windows
section("Preparing virtualenv")
# check that virtualenv installed
if not executable_exists('virtualenv'):
fail("""\
Please install virtualenv!
https://github.com/pypa/virtualenv
{}""".format(unix_windows.VIRTUALENV_INSTALL_MSG))
# Make sure that no... | Python | 0.000001 | @@ -124,22 +124,182 @@
stalled%0A
-if not
+virtualenv_installed = False%0A%0Aif unix_windows.IS_WIN:%0A virtualenv_installed = shell(unix_windows.VIRTUALENV_CMD + ' -h').success()%0Aelse:%0A virtualenv_installed =
executa
@@ -322,16 +322,46 @@
ualenv')
+%0A%0A%0Aif not virtualenv_installed
:%0A fa
@@ -881... |
ac19c1bb16dd01c97bffb4073bc464225321a52f | Update forms.py | investment_support_directory/forms.py | investment_support_directory/forms.py | from directory_constants import choices
from directory_components import forms, fields, widgets
from django.forms import ValidationError
from django.forms.widgets import HiddenInput, TextInput
from investment_support_directory.fields import IntegerField
CHOICES_FINANCIAL = (
'Opening bank accounts',
'Accoun... | Python | 0.000001 | @@ -1868,54 +1868,66 @@
': '
-Type the product,service,expertises or keyw
+Enter the name of the skills or service you%E2%80%99re looking f
or
-d
'%0A
|
115774c49493f59161bde814eecd77b5beb617a9 | Allow BROKER_URL environment setting. | lily/settings/celeryconfig.py | lily/settings/celeryconfig.py | import os
from datetime import timedelta
from kombu import Queue
from .settings import DEBUG, TIME_ZONE
BROKER = os.environ.get('BROKER', 'DEV')
if BROKER == 'IRONMQ':
BROKER_URL = 'ironmq://%s:%s@mq-aws-eu-west-1.iron.io' % (os.environ.get('IRON_MQ_PROJECT_ID'), os.environ.get('IRON_MQ_TOKEN'))
elif BROKER ==... | Python | 0 | @@ -101,16 +101,82 @@
_ZONE%0A%0A%0A
+BROKER_URL = os.environ.get('BROKER_URL')%0A%0Aif not BROKER_URL:%0A
BROKER =
@@ -208,17 +208,20 @@
'DEV')%0A
-%0A
+
if BROKE
@@ -235,16 +235,20 @@
RONMQ':%0A
+
BROK
@@ -372,16 +372,20 @@
OKEN'))%0A
+
elif BRO
@@ -404,16 +404,20 @@
DAMQP':%0A
+
... |
0ff62b1fc3deeba58904b73918828ef6d526ed74 | Use named format params | ffmpeg_recorder.py | ffmpeg_recorder.py | # coding: utf-8
# pylint: disable=too-many-instance-attributes
# pylint: disable=no-self-use
# pylint: disable=arguments-differ
import logging
import subprocess
import os
from ffmpeg_process import *
from scr_config import *
class FfmpegRecorder(object):
def __init__(self):
self._scr_config = ScrConfig(... | Python | 0.000004 | @@ -2399,17 +2399,28 @@
audio=%22%7B
-0
+audio_device
%7D%22'%0A
@@ -2556,17 +2556,28 @@
video=%22%7B
-1
+video_device
%7D%22'%0A%0A
@@ -2736,25 +2736,29 @@
f scale=iw*%7B
-2
+scale
%7D:-1 ' + %5C%0A
@@ -2893,17 +2893,22 @@
'-y %7B
-3
+output
%7D'%0A%0A
@@ -3090,17 +3090,21 @@
ale=iw*%7B
-2
+sca... |
a472d5750953e13bd6d46f9ccb801a5136bfa00b | Add GeoDjango | iotendpoints/iotendpoints/settings.py | iotendpoints/iotendpoints/settings.py | """
Django settings for iotendpoints project.
Generated by 'django-admin startproject' using Django 1.11.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import... | Python | 0.000001 | @@ -1145,24 +1145,50 @@
aticfiles',%0A
+ 'django.contrib.gis',%0A
'endpoin
|
761c603243d3136d0e6fec65003dd009b9df0c54 | change main script file mode | file-mixer/main.py | file-mixer/main.py | #! /usr/bin/python3
import os
import sys
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from main_view import MainView
BASE_DIR = os.path.dirname(__file__)
builder = Gtk.Builder()
builder.add_from_file(os.path.join(BASE_DIR, 'file-mixer.gui.glade'))
win = MainView(builder, "window1")
wi... | Python | 0.000005 | |
206991a376c0d7ee9d431c82323b1da72593708d | Revert "Improve urls formatting." | fileupload/urls.py | fileupload/urls.py | # encoding: utf-8
from django.conf.urls import patterns, url
from .views import (BasicVersionCreateView, BasicPlusVersionCreateView,
PictureCreateView, AngularVersionCreateView, jQueryVersionCreateView,
PictureDeleteView, PictureListView)
urlpatterns = patterns('',
url(
r'^basic/$',
BasicVe... | Python | 0 | @@ -59,16 +59,26 @@
rl%0Afrom
+fileupload
.views i
@@ -83,17 +83,16 @@
import
-(
BasicVer
@@ -126,36 +126,32 @@
rsionCreateView,
-%0A
PictureCreateVi
@@ -204,20 +204,16 @@
ateView,
-%0A
Picture
@@ -226,26 +226,8 @@
View
-, PictureListView)
%0A%0Aur
@@ -251,37 +251,25 @@
rns('',%0A
-url(%0A ... |
cf972237100aa556a748cc84732b2e268a341dc9 | Remove demo string | find_duplicates.py | find_duplicates.py | def find_problems(given_list = ["12345678a", "12345678b", "12345678c", "abcdefghi1","123"],print_me=True):
"""
Scans a list of strings to find any cases where the first 8 characters are matching
:param given_list: A string or list of strings to scan (optional, will demo otherwise)
:param print_me: Boole... | Python | 0.000171 | @@ -1936,26 +1936,8 @@
ems(
-%22This,is, a, demo%22
)%0A%0A%0A
|
6f24dbf7b9da9cfe3565c697e8615949bd39cfcc | Fix celery tasks logging and add shortcut for app context | flask_app/tasks.py | flask_app/tasks.py | from __future__ import absolute_import
from logging import Formatter
from logbook.compat import LoggingHandler
from logging.handlers import SysLogHandler
from celery import Celery
from celery.signals import after_setup_task_logger, after_setup_logger
import os
queue = Celery('tasks', broker='redis://localhost')
queu... | Python | 0.000001 | @@ -37,122 +37,62 @@
rt%0A%0A
-from logging import Formatter%0Afrom logbook.compat import LoggingHandler%0Afrom logging.handlers import SysLogHandler
+import functools%0Aimport os%0Aimport sys%0A%0Aimport logbook%0A
%0Afro
@@ -149,29 +149,24 @@
after_setup_
-task_
logger, afte
@@ -177,24 +177,84 @@
tup_
+task_
lo... |
68116c0a92789800023dea7f89dcfa31bbc461db | Remove hit.strings from yara output | modules/Signature/YaraScan.py | modules/Signature/YaraScan.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
import os
import sys
i... | Python | 0.000119 | @@ -2482,57 +2482,8 @@
le,%0A
- 'strings' : h.strings,%0A
|
571fc0ace1712e772baf08d60a25a33b6c231f76 | test sublime | parser.py | parser.py | #!#/usr/bin/env python
# -*- coding: utf-8 -*-
hi | Python | 0.000002 | @@ -43,7 +43,4 @@
-*-
-%0Ahi
|
da3d891a68a133583e51b02bcdf3335f84c88096 | add note to input url account without https | freshbook/utils.py | freshbook/utils.py | from __future__ import print_function
import json
from six.moves import input
from collections import namedtuple
from . import Freshbook
Option = namedtuple('Option', 'id name')
class SetupConfig(object):
PATH = '.freshbook'
def __init__(self):
self.account = input('> Account URL: ')
sel... | Python | 0 | @@ -297,16 +297,35 @@
ount URL
+ (without https://)
: ')%0A
|
38357d8d6043561084c8f7469ee11d373878cf3b | Fix spacing in jnp tile | e3nn_jax/_dropout.py | e3nn_jax/_dropout.py | import jax
import jax.numpy as jnp
import haiku as hk
from e3nn_jax import Irreps
class Dropout(hk.Module):
"""Equivariant Dropout
:math:`A_{zai}` is the input and :math:`B_{zai}` is the output where
- ``z`` is the batch index
- ``a`` any non-batch and non-irrep index
- ``i`` is the irrep index, ... | Python | 0.000134 | @@ -1739,13 +1739,16 @@
ise,
+
(1,
+
1,
+
dim)
|
22f74a56a7216c718e22cc51e7ee60c77feb6771 | Handle ValueError from hot_package | murano/packages/load_utils.py | murano/packages/load_utils.py | # Copyright (c) 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | Python | 0.000003 | @@ -1798,24 +1798,175 @@
der=loader)%0A
+ except ValueError as err:%0A raise e.PackageLoadError(%22Couldn't load package from file: %22%0A %22%7B0%7D%22.format(err))%0A
finally:
|
e48e0654e1bbed6c3e49835c5a40356fa6127fe5 | Make the REPL loop. | pg-cli.py | pg-cli.py | #!/usr/bin/env python
from __future__ import unicode_literals
from prompt_toolkit import CommandLineInterface
from prompt_toolkit.completion import Completer, Completion
from prompt_toolkit.line import Line
from prompt_toolkit.layout import Layout
from prompt_toolkit.layout.prompt import DefaultPrompt
from prompt_tool... | Python | 0.000036 | @@ -103,16 +103,35 @@
nterface
+, AbortAction, Exit
%0Afrom pr
@@ -1626,75 +1626,17 @@
-cli = CommandLineInterface(style=DocumentStyle,%0A layout=
+layout =
Layo
@@ -1684,20 +1684,16 @@
-
-
menus=%5BC
@@ -1722,20 +1722,16 @@
-
lexer=Sq
@@ -1741,26 +1741,17 @@
xer)
-,%... |
2bba5467cc3664c5a6dd1532ea1ded0a240e2d63 | Remove `whitenoise.runserver_nostatic` | nightreads/settings/common.py | nightreads/settings/common.py | """
Django settings for nightreads project.
Generated by 'django-admin startproject' using Django 1.9.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os... | Python | 0.000004 | @@ -839,45 +839,8 @@
s',%0A
- 'whitenoise.runserver_nostatic',%0A
|
3c646af2ef7f1c1a85656e8609ef5998bca8c178 | make text able to have colors and outlines | glc/shapes/text.py | glc/shapes/text.py | """
glc.shapes.text
===============
(c) 2016 LeoV
https://github.com/leovoel/
"""
from .shape import Shape
from ..utils import rad
import cairo
class Text(Shape):
def get_extents(self, context):
text = self.get_string("text", 0, "Hello world")
size = self.get_number("size", 0... | Python | 0.000003 | @@ -2310,16 +2310,17 @@
nx, ny)%0A
+%0A
@@ -2393,16 +2393,17 @@
o(0, 0)%0A
+%0A
@@ -2414,20 +2414,80 @@
ext.
-show_text(text
+text_path(text)%0A%0A self.draw_fill_and_stroke(context, t, True, False
)%0A
|
8e0fe9012da4a0e840ce5daa468f1e7ccb3d970f | fix shebang | libexec/notify_by_xmpp.py | libexec/notify_by_xmpp.py | #!/usr/bin/python -tt
# skvidal@fedoraproject.org, modified by David Laval
# gplv2+
## XMPP notification
#define command{
# command_name notify-host-by-xmpp
# command_line $PLUGINSDIR$/notify_by_xmpp.py -a $PLUGINSDIR$/notify_by_xmpp.ini "Host '$HOSTALIAS$' is $HOSTSTATE$ - Info : $HOSTOUTPUT$" $CONTACTEMA... | Python | 0.000008 | @@ -8,18 +8,18 @@
bin/
+env
python
- -tt
%0A# s
|
bfe29b6a82f17db1aef761f46d1b4c55fa6d15ff | Update gocomics scraper to handle <picture> elements. | gocomics-scrape.py | gocomics-scrape.py | #!/usr/local/bin/python
import formatter
import htmllib
import sys
import time
import urllib
import xml.dom.minidom
from xml.sax.saxutils import escape as xml_escape
FEEDBURNER_NS = 'http://rssnamespace.org/feedburner/ext/1.0'
XHTML_NS = 'http://www.w3.org/1999/xhtml'
def open_url(url):
class Opener(urllib.FancyUR... | Python | 0 | @@ -327,18 +327,16 @@
r):%0A
-
version
@@ -1486,39 +1486,494 @@
one%0A
-%0A def do_img(self, attrs):
+ self.in_comic_picture = False%0A%0A def start_picture(self, attrs):%0A if ('class', 'img-fluid item-comic-image') in attrs:%0A self.in_comic_picture = True%0A%0A def e... |
67c110e7e7d64727de66cc992fb9b21bf75d4dfc | fix url to image because in expression like this: for x in Model.objects[:10]: print(x.image) then x.image get incorrect url without THUMBOR_HOST | libthumbor/flask/field.py | libthumbor/flask/field.py | from werkzeug.datastructures import FileStorage
from urllib.parse import urlparse, urljoin
from flask import current_app
from mongoengine.base import BaseField
from libthumbor.crypto import CryptoURL
from mongoengine import *
import requests
crypto_url = None
cla... | Python | 0.999993 | @@ -1529,32 +1529,87 @@
return ''%0A%0A
+ def __str__(self):%0A return self.endpoint()%0A%0A
def __repr__
|
0f8ec812f1400f34edc1c397f9e037f3faa02b9d | Improved regular expression. | pyvisa.py | pyvisa.py | import vpp43
from vpp43_constants import *
import re, time
class ResourceManager(object):
def __init__(self):
self.session = vpp43.open_default_resource_manager()
self.__close = vpp43.close # needed for __del__
def __del__(self):
self.__close(self.session)
def __repr__(self):
... | Python | 0.999993 | @@ -1176,16 +1176,22 @@
.__delay
+ %3E 0.0
:%0A
@@ -2382,17 +2382,24 @@
HAR_EN,
-0
+VI_FALSE
)%0A
@@ -2496,75 +2496,178 @@
.*?)
-(?:%5Cs+(?P%3CNOEND%3ENOEND))?%22%5C%0A %22(?:%5Cs+DELAY%5Cs+
+%22%5C%0A %22(((?%3C=.) +%7C%5CA)%22%5C%0A ... |
ca609ad85680ecaf0cd568356d5926c62cb4e130 | Use the correct variable | linehaul/events/parser.py | linehaul/events/parser.py | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | Python | 0.999978 | @@ -5122,18 +5122,33 @@
t: %25r%22,
-ua
+parsed.user_agent
)%0A el
|
d092c8de1bc018968eb87137c9003aa4b5a43e39 | delete useless if..elif.. | lixian_commands/delete.py | lixian_commands/delete.py |
from lixian import XunleiClient
from lixian_commands.util import *
from lixian_cli_parser import *
from lixian_encoding import default_encoding
from lixian_colors import colors
import lixian_help
import lixian_query
@command_line_parser(help=lixian_help.delete)
@with_parser(parse_login)
@with_parser(parse_colors)
@co... | Python | 0 | @@ -458,24 +458,8 @@
es)%0A
-%09if len(args):%0A%09
%09to_
@@ -511,62 +511,8 @@
gs)%0A
-%09elif args.all:%0A%09%09to_delete = client.read_all_tasks()%0A
%09if
|
4dc2d7babd1514f8c04994e5309e453515a92c6a | Changed settings time = 0 to time = None | readHR.py | readHR.py | import csv
import numpy as np
class EcgReader:
def __init__(self, file):
self.file = file
self.csv_check = True
self.data_type = True
self.time = []
self.voltage = []
self.peak_vector = []
self.filecheck()
if self.csv_check:
self.readfil... | Python | 0.998807 | @@ -944,25 +944,28 @@
self.time =
-0
+None
%0A
@@ -980,17 +980,20 @@
ltage =
-0
+None
%0A
|
20058bcc49a843a1b379bb59137a521f7732f40a | Describe c4 as High-CPU | render.py | render.py | import mako.template
import mako.exceptions
import json
import datetime
def pretty_name(inst):
pieces = inst['instance_type'].split('.')
family = pieces[0]
short = pieces[1]
family_names = {
'r3': 'R3 High-Memory',
'c3': 'C3 High-CPU',
'm3': 'M3 General Purpose',
'i3':... | Python | 0.999977 | @@ -256,32 +256,61 @@
'C3 High-CPU',%0A
+ 'c4': 'C4 High-CPU',%0A
'm3': 'M
|
e9ae6d5120aa20b627f477c2e032826d0adf37a1 | set Referer, use request instead of post | rester.py | rester.py | # coding: utf-8
# https://github.com/materialsproject/pymatgen/blob/1eb2f2f/pymatgen/matproj/rest.py
from __future__ import division, unicode_literals
import os, requests, warnings, urlparse
from bson.json_util import loads
import webtzite.configure_settings
import django
django.setup()
class MPResterBase(object):
... | Python | 0 | @@ -2342,16 +2342,40 @@
ders = %7B
+'Referer': self.preamble
%7D%0A
@@ -3041,20 +3041,17 @@
headers
- = %7B
+%5B
%22X-CSRFT
@@ -3055,17 +3055,19 @@
RFToken%22
-:
+%5D =
self.se
@@ -3096,17 +3096,16 @@
ftoken')
-%7D
%0A
@@ -3137,120 +3137,54 @@
ion.
-post(url, data=payload, headers=headers) %5C%0... |
8bd66db2a4c2371f6dfc2b42303f38b575a9ade2 | The fizzbuzz strings need to be lowercase | round2.py | round2.py | """FizzBuzz.
Write a program that prints the integers from 1 to 100. But for multiples of
three print "Fizz" instead of the number and for the multiples of five print
"Buzz". For numbers which are multiples of both three and five print "FizzBuzz"
"""
input = xrange(99, 336)
output = []
expected = ['fizz', 'buzz', '1... | Python | 1 | @@ -96,17 +96,17 @@
print %22
-F
+f
izz%22 ins
@@ -161,17 +161,17 @@
print%0A%22
-B
+b
uzz%22. Fo
@@ -230,21 +230,21 @@
print %22
-FizzB
+fizzb
uzz%22%0A%22%22%22
|
de8c8c4b8b8ccc211824d25b18fe4d0284527b02 | fix video aufmacher breaking everything | scrape.py | scrape.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import datetime
import os
import os.path
import requests
import json
from bs4 import BeautifulSoup
import arrow
from peewee import *
from models import Aufmacher, Author, Image, TweetJob
from config import db
import untangle
DOWNLOAD_URL = "http://www.zeit.de"
def get_arti... | Python | 0 | @@ -528,29 +528,121 @@
-article = obj.gallery
+try:%0A article = obj.gallery%0A except AttributeError:%0A article = obj.video
%0A%0A
|
a5eb5450a91eb43a2227bdc5f3d25555faaf8544 | Add hypen as delimiter | scrape.py | scrape.py | import discord
import asyncio
from tqdm import tqdm
import argparse
parser = argparse.ArgumentParser(description='Discord channel scraper')
requiredNamed = parser.add_argument_group('Required arguments:')
requiredNamed.add_argument('-c', '--channel', type=str, help='Channel to scrape. Requires the channel ID.',... | Python | 0.999998 | @@ -1066,18 +1066,22 @@
e = %22%7B%7D
-%7B%7D
+- %7B%7D -
%7B%7D%22.for
|
77a422ab38399b0ef2cd4dceb94c91e447510d82 | include component parameters in db output | sdf/db.py | sdf/db.py | import numpy as np
import mysql.connector
from . import filter
from . import config as cfg
def write_all(r,update=False):
"""Write sdf results to db."""
# set up connection
try:
cnx = mysql.connector.connect(user=cfg.mysql['user'],
password=cfg.mysql['passwd... | Python | 0.000001 | @@ -2158,16 +2158,25 @@
odel_jy,
+comps_jy,
chi,R) %22
@@ -2223,24 +2223,27 @@
,%25s,%25s,%25s,%25s
+,%25s
)%22)%0A
@@ -2456,32 +2456,162 @@
ujy%5Bi%5D%0A %0A
+ comp_str = '%5B'+','.join(%22%7B:e%7D%22.format(p) %5C%0A for p in r.model_comp_fnujy%5B:,i%5D)+'%5D'... |
14e2985e3f825a7e02120dc1d4d9bf96b04379fd | Rename `get_nexthop_host` to `get_host` | sdn_ip.py | sdn_ip.py | from netaddr import IPNetwork
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_0, ofproto_v1_3
from ryu.lib import hub
from ryu.lib.packet import packet
from ryu.lib.p... | Python | 0.008236 | @@ -2648,32 +2648,24 @@
def get_
-nexthop_
host(self, i
@@ -3302,24 +3302,16 @@
elf.get_
-nexthop_
host(nex
|
d81cb7310a54a109d57eb4cd438694aeef3099a5 | Fix tests. | semver.py | semver.py | # -*- coding: utf-8 -*-
import re
_REGEX = re.compile('^(?P<major>[0-9]+)'
'\.(?P<minor>[0-9]+)'
'\.(?P<patch>[0-9]+)'
'(\-(?P<prerelease>[0-9A-Za-z]+(\.[0-9A-Za-z]+)*))?'
'(\+(?P<build>[0-9A-Za-z]+(\.[0-9A-Za-z]+)*))?$')
def parse(versi... | Python | 0 | @@ -786,38 +786,16 @@
= a
-and str(a) or '', b and str(b)
+or '', b
or
@@ -1045,14 +1045,8 @@
, d2
-, keys
):%0A
@@ -1063,20 +1063,43 @@
key in
-keys
+%5B'major', 'minor', 'patch'%5D
:%0A
@@ -1108,20 +1108,16 @@
v =
-nat_
cmp(d1.g
@@ -1158,19 +1158,311 @@
if v
- != 0
:%0A
+ ret... |
0af3258cd3a6ad4a75aad8c967d72f7c1b755624 | Refactor to use with-block | series.py | series.py | """Read and print an integer series."""
import sys
def read_series(filename):
try:
f = open(filename, mode='rt', encoding='utf-8')
return [int(line.strip()) for line in f]
finally:
f.close()
def main(filename):
print(read_series(filename))
if __name__ == '__main__':
main(s... | Python | 0 | @@ -82,24 +82,12 @@
-try:%0A f =
+with
ope
@@ -126,16 +126,22 @@
'utf-8')
+ as f:
%0A
@@ -186,39 +186,8 @@
f%5D%0A
- finally:%0A f.close()%0A
%0A%0Ade
|
fb02617b29cab97a70a1a11b0d3b7b62b834aa3b | Structure for sending dummy files | server.py | server.py | from flask import Flask
from flask import request
import flask
import hashlib
import json
import gzip
app = Flask(__name__)
stored_files = {}
@app.route('/profile/<type>', methods=['GET'])
def get_dummy_files(type):
if type == 'lawyer':
pass
elif type == 'doctor:':
pass
elif type == 'fema... | Python | 0 | @@ -249,201 +249,385 @@
-pass%0A elif type == 'doctor:':%0A pass%0A elif type == 'female':%0A pass%0A elif type == 'male':%0A pass%0A else:%0A return %22No files here%5Cn%22%0A%0A return %22Sent files%5Cn%22
+gzip_address = './zipfiles/doc.tar.gz'%0A elif type == 'doc... |
05fb5a3b539504f0871b98646413ecda0e6d4878 | Update server.py | server.py | server.py | #!/usr/bin/python
import sys
import urllib2
from configuration import *
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
import webbrowser
clients = {}
#tarocco to speedup server reply
def _bare_address_string(self):
host, port = self.client_address[:2]
return str(host)
BaseHTTPRequestHandler.addr... | Python | 0 | @@ -1,8 +1,568 @@
+%22%22%22%0A Licensed under the Apache License, Version 2.0 (the %22License%22);%0A you may not use this file except in compliance with the License.%0A You may obtain a copy of the License at%0A%0A http://www.apache.org/licenses/LICENSE-2.0%0A%0A Unless required by applicable law or agr... |
82424fa6ce90f384e418c54bd9bdc61216e550d8 | Remove shadowing of file builtin in server.py. PEP8 formatting | server.py | server.py | # This file provided by Facebook is for non-commercial testing and evaluation
# purposes only. Facebook reserves all rights not expressly granted.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PAR... | Python | 0.000003 | @@ -811,16 +811,17 @@
tml'))%0A%0A
+%0A
@app.rou
@@ -889,17 +889,16 @@
dler():%0A
-%0A
with
@@ -925,27 +925,24 @@
', 'r') as f
-ile
:%0A co
@@ -962,19 +962,16 @@
.loads(f
-ile
.read())
@@ -1012,25 +1012,26 @@
%0A new
-C
+_c
omment = req
@@ -1061,17 +1061,18 @@
new
-C
+_c
omment%5B'
@@... |
0fbea689d8debebea36a96d960946bc4d49fe004 | Fix a bug that would only show the first letter of the announcing message of a new client on the server to other clients. | server.py | server.py | import socket
import os
import select
import sys
import commands
import parsers
import clients
import string
import protocols
class Server(object):
"""The chat server. It relays communication between client."""
_port = 0
_bind = ""
_server_socket = None
_clients = []
@property
def port(self):
return self._p... | Python | 0 | @@ -1717,16 +1717,17 @@
client,
+%5B
%22HERE CO
@@ -1737,16 +1737,17 @@
DADDY!%22
+%5D
)%0A%09%09cmd.
|
2bcffc5c35e17136fc53e84d3bf747b6b1ec97b3 | Insert goals in app | sieben.py | sieben.py | #!/usr/bin/env python3.5
# coding: utf-8
import sys
from mikado import Goals
from os import path
from subprocess import run
from system import save, load, dot_export
from PyQt5.QtCore import pyqtSignal, Qt
from PyQt5.QtGui import QImage, QPixmap
from PyQt5.QtWidgets import (
QApplication,
QDockWidget,
QLabe... | Python | 0 | @@ -2584,32 +2584,91 @@
.delete_goal(),%0A
+ Qt.Key_I: lambda: self.start_inserting_goal(),%0A
Qt.K
@@ -3861,32 +3861,461 @@
refresh.emit()%0A%0A
+ def start_inserting_goal(self):%0A self.input.setEnabled(True)%0A self.input.setFocus(True)%0A self.input.editingFinished.... |
ae1317ec704d4c0a5a12b13446d92ebfa281b38f | patch from jbender to fix use wx's default colors | motmot/wxvalidatedtext/wxvalidatedtext.py | motmot/wxvalidatedtext/wxvalidatedtext.py | import wx
__version__ = '0.5.1' # keep in sync with setup.py
def integer_validator(input_string):
try:
int(input_string)
except ValueError:
return False
return True
def float_validator(input_string):
try:
float(input_string)
except ValueError:
return False
retur... | Python | 0.000001 | @@ -518,17 +518,12 @@
lor=
-'#FFFFFF'
+None
,%0A
@@ -552,17 +552,12 @@
lor=
-'#000000'
+None
):%0A%0A
@@ -747,39 +747,263 @@
-self.valid_color = valid_color%0A
+if valid_color is None:%0A self.valid_color = self.ctrl.GetBackgroundColour()%0A else:%0A self.valid_color = valid_col... |
cc697b677bc5b97b033cd24444d43d8b94bc85a1 | Fix mock connection | emv/test/test_transmission.py | emv/test/test_transmission.py | from unittest2 import TestCase
from emv.util import unformat_bytes
from emv.protocol.command import SelectCommand
from emv.protocol.response import SuccessResponse
from emv.transmission import TransmissionProtocol
class MockConnection(object):
T0_protocol = 1
def __init__(self, responses):
self.respo... | Python | 0.000002 | @@ -374,24 +374,39 @@
connect(self
+, protocol=None
):%0A p
|
292c973454aaae354dd5452260ee2dfbae4a4fc0 | fix ST3 bug | SublimeTmpl.py | SublimeTmpl.py | # + Python 3 support
# + sublime text 3 support
import os, sublime, sublime_plugin
PACKAGE_NAME = 'SublimeTmpl'
TMLP_DIR = 'templates'
KEY_SYNTAX = 'syntax'
KEY_FILE_EXT = 'extension'
PACKAGES_PATH = sublime.packages_path()
class SublimeTmplCommand(sublime_plugin.TextCommand):
def run(self, edit, type = 'html')... | Python | 0 | @@ -181,48 +181,8 @@
ion'
-%0APACKAGES_PATH = sublime.packages_path()
%0A%0Acl
@@ -300,32 +300,67 @@
lf.view%0A
+packages = sublime.packages_path()%0A
%0A self.tm
@@ -454,21 +454,16 @@
oin(
-PACKAGES_PATH
+packages
, se
@@ -1022,16 +1022,22 @@
# print(
+file,
os.path.
|
8fb82e6b42505ea7a6effd2eb3eee4f14ec91edf | fix test status change | nailgun/nailgun/test/test_provisioning.py | nailgun/nailgun/test/test_provisioning.py | # -*- coding: utf-8 -*-
import json
import logging
import unittest
from mock import patch
from nailgun.settings import settings
from nailgun.test.base import BaseHandlers
from nailgun.test.base import reverse
from nailgun.network import manager as netmanager
from nailgun.api.models import Cluster
class TestProvisio... | Python | 0.000001 | @@ -3518,25 +3518,27 @@
tatus, '
-deploying
+provisioned
')%0A
|
fdc8cd8269f7f78e5dde464017114d93a8f3a0e1 | set option before it's used.. | wagtailstartproject/project_template/tests/test_selenium/base.py | wagtailstartproject/project_template/tests/test_selenium/base.py | import unittest
from itertools import chain
from os import environ, path, rmdir
from tempfile import mkdtemp
from time import sleep
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.support.expected_conditions import staleness_of
from selenium.webdriver.s... | Python | 0 | @@ -5982,48 +5982,8 @@
s()%0A
- cls.set_driver_options(options)%0A
@@ -6045,32 +6045,72 @@
ADLESS', True))%0A
+ cls.set_driver_options(options)%0A
try:%0A
|
903d5d6f5acdc71c459a055b8e79860b3817b92b | Add blacklist | flair_bot.py | flair_bot.py | #!/usr/bin/env python3
import praw
import sys
import os
from time import gmtime, strftime
try:
from flair_list import flairs
except ImportError as e:
print("Flairs file can't be accessed\n")
print(e)
sys.exit()
except SyntaxError as e:
print("There is a syntax error in the flair list\n")
print(... | Python | 0 | @@ -596,16 +596,114 @@
sword'%0A%0A
+ # Blacklist for users abusing the flair system%0A BLACKLIST = %5B'sampleuser', 'sampleUSER2'%5D%0A%0A
%22%22%22
@@ -2115,32 +2115,141 @@
uthor of the PM%0A
+ if author.lower() in (user.lower() for user in self.BLACKLIST):%0A continue%... |
24fc06d17303868ef4ea057cd001ec6cb49ab18f | Fix utf-8 problem with åäö and friends. | flask_app.py | flask_app.py | import os
from flask import Flask, render_template
from jinja2 import Template
app = Flask(__name__, template_folder='.', static_url_path='', static_folder='..')
app.config.from_pyfile('settings.py')
BASE = '/%s' % app.config['REPO_NAME']
@app.route('/')
def home():
with open('talk.md', 'r') as f:
templa... | Python | 0 | @@ -335,16 +335,32 @@
f.read()
+.decode('utf-8')
)%0A
|
0cbc06890eb131fb5014a88c8f5a111d3a6abb0d | Update mockito-core to 2.24.5 | external_plugin_deps.bzl | external_plugin_deps.bzl | load("//tools/bzl:maven_jar.bzl", "maven_jar")
def external_plugin_deps():
maven_jar(
name = "mockito",
artifact = "org.mockito:mockito-core:2.24.0",
sha1 = "969a7bcb6f16e076904336ebc7ca171d412cc1f9",
deps = [
"@byte-buddy//jar",
"@byte-buddy-agent//jar",
... | Python | 0.000001 | @@ -160,17 +160,17 @@
re:2.24.
-0
+5
%22,%0A
@@ -184,48 +184,48 @@
= %22
-969a7bcb6f16e076904336ebc7ca171d412cc1f9
+599509fe319bd9e39559b8f987bee5d4b77167e4
%22,%0A
|
56dabb4f34385c007ee9bdcebcd35953fe5b9085 | Upgrade mockito-core to 2.9.0 | external_plugin_deps.bzl | external_plugin_deps.bzl | load("//tools/bzl:maven_jar.bzl", "maven_jar")
def external_plugin_deps():
maven_jar(
name = "mockito",
artifact = "org.mockito:mockito-core:2.7.21",
sha1 = "23e9f7bfb9717e849a05b84c29ee3ac723f1a653",
deps = [
'@byte-buddy//jar',
'@objenesis//jar',
],
)
maven_jar(
name = "byt... | Python | 0.000001 | @@ -151,12 +151,11 @@
e:2.
-7.21
+9.0
%22,%0A
@@ -169,48 +169,48 @@
= %22
-23e9f7bfb9717e849a05b84c29ee3ac723f1a653
+f28b9606eca8da77e10df30a7e301f589733143e
%22,%0A
@@ -369,12 +369,11 @@
y:1.
-6.11
+7.0
%22,%0A
@@ -387,48 +387,48 @@
= %22
-8a8f9409e27f1d62c909c7eef2aa7b3a580b4901
+48481d20ed4334ee0abfe8212... |
9955d127a55655f366a14161afdbe9c5547721bf | Correct import error. | VOIAnalyzer.py | VOIAnalyzer.py | #!/usr/bin/env python
# coding : utf-8
"""
Main module for VOI analyzer.
"""
import pandas as pd
import numpy as np
import argparse
import os
def _analysis(img_mat, voi_mat, voi_no, eps=1e-12):
""" Extract VOI statistices for each VOI.
"""
vec = img_mat[voi_mat == voi_no]
vec2 = vec[~np.isnan(vec)]
... | Python | 0 | @@ -138,16 +138,51 @@
ort os%0A%0A
+import VOIAnalyzer.utils as utils%0A%0A
def _ana
|
33d6c3326c2427890d7f95f417e901913727af48 | Fix error message | drupdates/updates.py | drupdates/updates.py | """ Primary Drupdates Module. """
import os
from os.path import expanduser
from string import Template
from drupdates.settings import Settings
from drupdates.settings import DrupdatesError
from drupdates.constructors.repos import Repos
from drupdates.constructors.reports import Reports
class Updates(object):
""" R... | Python | 0.000012 | @@ -4046,77 +4046,8 @@
ry)%0A
- msg += 'Moving to next working directory, if applicable'%0A
|
9ca6d43aebda95680464a9a256af3e9a39ef27c0 | Add decrease_key() | ds_priority_queue.py | ds_priority_queue.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
class PriorityQueue(object):
"""Binary Min Heap class."""
def __init__(self, ):
self.heap_ls = [(0, 0)]
self.current_size = 0
def _percolate_up(self, i):
while i // 2 > 0:
... | Python | 0.000007 | @@ -2008,16 +2008,68 @@
i -= 1%0A%0A
+ def decrease_key(self, val, key):%0A pass%0A%0A
%0Adef mai
|
a1fd463fa8fe6b923b99da595246ead3dd8bf103 | Implement Corr class; to be used in conjuction with the TVFCGs. | dyfunconn/fc/corr.py | dyfunconn/fc/corr.py | # -*- coding: utf-8 -*-
""" Correlation
@see https://docs.scipy.org/doc/numpy/reference/generated/numpy.corrcoef.html
"""
# Author: Avraam Marimpis <avraam.marimpis@gmail.com>
from .estimator import Estimator
from ..analytic_signal import analytic_signal
import numpy as np
def corr(data, fb, fs, pairs=None):
... | Python | 0 | @@ -312,25 +312,766 @@
ne):%0A %22%22%22
-%0A
+ Correlation%0A%0A Compute the correlation for the given :attr:%60data%60, between the :attr:%60pairs%60 (if given)%0A of channels.%0A%0A%0A Parameters%0A ----------%0A data : array-like, shape(n_channels, n_samples)%0A Multichannel recording data... |
febaf427d5347079404e851351dab63fb5d5e4f9 | Add the option to NOT verify the ssl certificate | easywebdav/client.py | easywebdav/client.py | import requests
import shutil
from numbers import Number
from httplib import responses as HTTP_CODES
from urlparse import urlparse
import xml.etree.cElementTree as xml
from collections import namedtuple
from cStringIO import StringIO
class WebdavException(Exception):
pass
class ConnectionFailed(WebdavException):
... | Python | 0.000001 | @@ -1960,16 +1960,33 @@
l='http'
+, verify_ssl=True
):%0A
@@ -2188,16 +2188,57 @@
ssion()%0A
+ self.session.verify = verify_ssl%0A
|
a827ee08e73ac7474908a06f871fba4dfcceee0b | drop todo comment | ecs_scheduler/env.py | ecs_scheduler/env.py | """ECS scheduler initialization helper methods."""
import os
import logging
import logging.handlers
import setuptools_scm
from . import triggers, __version__
_logger = logging.getLogger(__name__)
def init():
"""Initialize global application state."""
_init_logging()
triggers.init()
def get_var(name,... | Python | 0 | @@ -799,82 +799,8 @@
%22%22%22%0A
- # TODO: remove hardcoded version once package can be built for docker%0A
|
535777aff8107db49211bea974cb1131c3df17fe | add id property to grid class | edisgo/grid/grids.py | edisgo/grid/grids.py | import networkx as nx
class Grid:
"""Defines a basic grid in eDisGo
Attributes
----------
_id : :obj:`str`
Identifier
_network : :class:`~.grid.network.Network`
Network which this grid is associated with
_voltage_nom : int
Nominal voltage
_peak_load : :obj:`float`
... | Python | 0 | @@ -1402,16 +1402,106 @@
dError%0A%0A
+ @property%0A def id(self):%0A %22%22%22Returns id of grid%22%22%22%0A return self._id%0A%0A
@pro
|
ae26ebda6cad3db11ddf279835a0655475c00a36 | fix generic views | cmsplugin_blog/models.py | cmsplugin_blog/models.py | import datetime
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from cms.utils.placeholder import PlaceholderNoAction
from cms.models import CMSPlugin
import tagging
from tagging.fields import TagField
from simple_translation.action... | Python | 0.000015 | @@ -42,16 +42,18 @@
models%0D%0A
+%0D%0A
from dja
@@ -753,18 +753,16 @@
time.now
-()
)%0D%0A
|
6c35c54cd9561c9f829e8ba9500acdcd09642a32 | rename global to make usage clear | cnxarchive/utils/safe.py | cnxarchive/utils/safe.py | import subprocess
import threading
from subprocess import PIPE
from logging import getLogger
logger = getLogger('safestat')
process = None
def safe_stat(path, timeout=1, cmd=None):
"Use threads and a subproc to bodge a timeout on top of filesystem access"
global process
if cmd is None:
cmd = [... | Python | 0.000001 | @@ -120,16 +120,26 @@
stat')%0A%0A
+safe_stat_
process
@@ -271,32 +271,42 @@
ess%22%0A global
+safe_stat_
process%0A%0A if
@@ -377,42 +377,8 @@
h)%0A%0A
- # import pdb; pdb.set_trace()%0A
@@ -406,16 +406,26 @@
global
+safe_stat_
process%0A
@@ -472,24 +472,34 @@
d')%0A
+safe_stat_
pr... |
269f220bdbe2fc30bcd2620c260751a613e0a3a9 | Use in_sent_idx instead of insent_id | code/dstruct/Sentence.py | code/dstruct/Sentence.py | #! /usr/bin/env python3
""" A Sentence class
Originally obtained from the 'pharm' repository, but modified.
"""
from dstruct.Word import Word
class Sentence(object):
_MAXLEN = 1000 # to avoid bad parse tree that have self-recursion
doc_id = None
sent_id = None
words = []
def __init__(self, _doc_... | Python | 0.000004 | @@ -3823,39 +3823,41 @@
prov_words%5B0%5D.in
+_
sent_id
+x
%0A if begi
@@ -4016,39 +4016,41 @@
prov_words%5B0%5D.in
+_
sent_id
+x
%0A end = m
@@ -4073,23 +4073,25 @@
s%5B-1%5D.in
+_
sent_id
+x
%0A%0A
@@ -4486,39 +4486,41 @@
prov_words%5B0%5D.in
+_
sent_id
+x
%0A end1 =
@@ -4540,3... |
a1e92f9fcb8364eee991f0a7f976b4e1b83dcddd | Use consistent data in "colour.models.cie_uvw" module doc tests. | colour/models/cie_uvw.py | colour/models/cie_uvw.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
CIE UVW Colourspace
===================
Defines the *CIE UVW* colourspace transformations:
- :func:`XYZ_to_UVW`
See Also
--------
`CIE UVW Colourspace IPython Notebook
<http://nbviewer.ipython.org/github/colour-science/colour-ipython/blob/master/notebooks/models/c... | Python | 0 | @@ -1762,40 +1762,46 @@
ay(%5B
-11.80583421, 10.34, 5.15089229%5D)
+0.07049534, 0.1008, 0.09558313%5D) * 100
%0A
@@ -1858,35 +1858,35 @@
ay(%5B
- 24.2543371
+-28.0483277
...,
-
-7.2205484
+-0.8805242
...,
@@ -1894,15 +1894,15 @@
37.
-4645000
+0041149
...%5D
|
2ea688e90d6924bbad8fb59aa0706e9328fbba6d | Add initial FlatContainer class. | nodev/specs/generic.py | nodev/specs/generic.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015-2016 Alessandro Amici.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, ... | Python | 0 | @@ -1216,16 +1216,43 @@
literals
+%0Afrom builtins import super
%0A%0Aimport
@@ -1843,80 +1843,8 @@
er)%0A
-def container_contains(container, item):%0A return item in container%0A%0A%0A
@con
@@ -1880,15 +1880,16 @@
def
-iterato
+containe
r_co
@@ -2496,24 +2496,719 @@
s(self.container, item)%0A
+%0A%0Adef gen... |
37d8fadd25ebf06207e046007097b06ecb9f33ac | Use Numpy dtype when creating Numpy array | numba/cuda/tests/cudapy/test_alignment.py | numba/cuda/tests/cudapy/test_alignment.py | import numpy as np
from numba import from_dtype, cuda
from numba import unittest_support as unittest
class TestAlignment(unittest.TestCase):
def test_record_alignment(self):
rec_dtype = np.dtype([('a', 'int32'), ('b', 'float64')], align=True)
rec = from_dtype(rec_dtype)
@cuda.jit((rec[:],... | Python | 0 | @@ -439,16 +439,22 @@
type=rec
+_dtype
)%0A
|
4ad7c389cc74463e0f161ffdc3a2f766c614c6ad | Remove test_raise_causing_warp_diverge_debug | numba/cuda/tests/cudapy/test_exception.py | numba/cuda/tests/cudapy/test_exception.py | from __future__ import print_function, absolute_import, division
import numpy as np
from numba import config, cuda, jit
from numba.cuda.testing import unittest, SerialMixin, skip_on_cudasim
class TestException(SerialMixin, unittest.TestCase):
def test_exception(self):
def foo(ary):
x = cuda.t... | Python | 0 | @@ -2868,631 +2868,8 @@
e)%0A%0A
- @skip_on_cudasim(%22failing case doesn't happen in CUDASIM%22)%0A def test_raise_causing_warp_diverge_debug(self):%0A %22%22%22Test case for issue #2655 with debug mode.%0A %22%22%22%0A # This test case is a little sensitive to CFG layout, and currently%0A ... |
ad7b71212a9c2356227048a28ee94c52193f6156 | clean up | onadata/apps/fsforms/line_data_project.py | onadata/apps/fsforms/line_data_project.py | import datetime
from collections import OrderedDict
from django.db.models import Count
from .models import FInstance
def date_range(start, end, intv):
start = datetime.datetime.strptime(start,"%Y%m%d")
end = datetime.datetime.strptime(end,"%Y%m%d")
diff = (end - start ) / intv
for i in range(intv):
... | Python | 0.000001 | @@ -617,32 +617,81 @@
nt(self, date):%0A
+ date = date + datetime.timedelta(days=1)%0A
return s
@@ -1877,32 +1877,81 @@
nt(self, date):%0A
+ date = date + datetime.timedelta(days=1)%0A
return s
|
0dddfa454716326ced71cff5fcb2a7dcaa6609f6 | Refactor global variable name | git_ready.py | git_ready.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Python | 0.000006 | @@ -620,16 +620,23 @@
%0A%0AMASTER
+_BRANCH
= 'mast
@@ -783,16 +783,23 @@
= MASTER
+_BRANCH
:%0A
@@ -3227,16 +3227,23 @@
t=MASTER
+_BRANCH
,%0A
|
dbd3320bba832d031781f02d8199628d9acd3fac | Fix except syntax | edx_shopify/tasks.py | edx_shopify/tasks.py | from celery import Task
from celery.utils.log import get_task_logger
from .models import Order, OrderItem
from .utils import auto_enroll_email
logger = get_task_logger(__name__)
class ProcessOrder(Task):
"""
Process order creation event.
"""
def run(self, data):
order = Order.objects.get(id... | Python | 0.000032 | @@ -891,16 +891,17 @@
except
+(
KeyError
@@ -915,16 +915,17 @@
teration
+)
:%0A
|
009f9ca2405d48199477d9699a9606e0cceeb196 | add base extension class | glim/core.py | glim/core.py | from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
# registry class is for generic framework components register function with configuration
class Registry:
def __init__(self, registrar):
self.registrar = registrar
def ... | Python | 0 | @@ -1125,16 +1125,71 @@
pass%0A%0A
+# Extension class%0Aclass Extension(Registry):%0A pass%0A%0A
# Databa
|
4b2f91c2fe3629e0dac6d95cb2736a01984ca63b | Update koth example to match new Entity behavior | examples/koth_vmflib_example.py | examples/koth_vmflib_example.py | #!/usr/bin/python3
"""Example map generator: King of the Hill Example
This script demonstrates vmflib by generating a basic "king of the hill" style
map. "King of the hill" is a game mode in Team Fortress 2 where each team tries
to maintain control of a central "control point" for some total defined amount
of time (b... | Python | 0 | @@ -1492,33 +1492,8 @@
250%22
-%0Am.children.append(light)
%0A%0A#
@@ -2518,37 +2518,8 @@
5 0%22
-%0Am.children.append(spawn_red)
%0A%0A#
@@ -2706,37 +2706,8 @@
5 0%22
-%0Am.children.append(spawn_blu)
%0A%0A#
|
3d40ffe587a33376b5f68caff3ec7bcc41dc7be0 | use opaque sock | fdbus/server/server.py | fdbus/server/server.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from time import ctime
from threading import Thread
from signal import signal, SIGINT
from select import poll, POLLIN, POLLHUP
from ..fdbus_h import *
from ..exceptions.exceptions import *
from ..fdobjects.fdobjects import FileDescriptorPool, FileDescriptor, FDBus
class... | Python | 0.000001 | @@ -574,21 +574,19 @@
self.s
-erver
+ock
= self.
@@ -710,21 +710,19 @@
n(self.s
-erver
+ock
, DEFAUL
@@ -970,29 +970,27 @@
.bind(self.s
-erver
+ock
, self.serv_
@@ -1201,21 +1201,19 @@
t(self.s
-erver
+ock
, self.s
@@ -1912,21 +1912,19 @@
e(self.s
-erver
+ock
)%0A
@@ -2621,21 +2621,19 @@
r(self.s
-e... |
ae17374c8b4c99f253877215e6f8514245b9785b | add stats output | PyMaSC/plot.py | PyMaSC/plot.py | import logging
import sys
import os.path
from collections import namedtuple
from PyMaSC import VERSION
from PyMaSC.utils.parsearg import get_plot_parser
from PyMaSC.utils.logfmt import set_rootlogger
from PyMaSC.pymasc import prepare_output, PLOTFILE_SUFFIX
from PyMaSC.output.stats import load_stats, load_cc, load_mas... | Python | 0.000018 | @@ -284,16 +284,17 @@
import
+(
load_sta
@@ -316,16 +316,63 @@
ad_masc,
+ output_stats,%0A
CCOUTPU
@@ -408,32 +408,33 @@
STATSFILE_SUFFIX
+)
%0Afrom PyMaSC.han
@@ -3705,16 +3705,34 @@
E_SUFFIX
+, STATSFILE_SUFFIX
%5D)%0A%0A
@@ -4190,24 +4190,79 @@
)%0A%0A #%0A
+ ... |
dd612e7380b6d84f1b5cca6787ac1881e13eb2e0 | Update diskspace.py | miniprobe/sensors/diskspace.py | miniprobe/sensors/diskspace.py | #!/usr/bin/env python
# Copyright (c) 2014, Paessler AG <support@paessler.com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
# 1. Redistributions of source code must retain the above copyright not... | Python | 0 | @@ -3830,16 +3830,17 @@
ed Bytes
+
%22 + str(
@@ -4566,16 +4566,17 @@
ed Space
+
%22 + str(
|
2c2350064a31402b8a3eeb3f827424d6b49416d6 | address #6 and #8 | benchmark/lsh_benchmark.py | benchmark/lsh_benchmark.py | import time, argparse, sys, json
from hashlib import sha1
from sklearn.datasets import fetch_20newsgroups
import numpy as np
from datasketch import MinHashLSH, MinHash
def get_ngrams(text, n=3):
onegrams = text.split()
if n == 1:
return onegrams
if len(onegrams) < n:
return text
return... | Python | 0.000393 | @@ -591,16 +591,17 @@
(%22header
+s
%22, %22foot
@@ -613,24 +613,24 @@
%22quotes%22))%0A
-
print(%22F
@@ -2160,32 +2160,33 @@
f benchmark_grou
+n
d_truth(threshol
@@ -2721,32 +2721,63 @@
.append(result)%0A
+ times.append(duration)%0A
return times
@@ -4066,16 +4066,16 @@
ts%22%5D =%5C%0A
-
... |
4a7f79c6ae97fb9f41defffa28e36dd9c9868230 | add timer | simple_access.py | simple_access.py | from glob import iglob
import ROOT
import rootpy
from rootpy.tree import Cut
from root_numpy import tree2rec
import pandas as pd
def expander(
dtype='cf',
tree='rrqDir/calibzip1',
base='/tera2/data3/cdmsbatsProd/R133/dataReleases/Prodv5-3_June2013/merged/',
data='all',
producti... | Python | 0.000008 | @@ -122,16 +122,38 @@
s as pd%0A
+from time import time%0A
%0A%0Adef ex
@@ -1295,24 +1295,57 @@
current'):%0A%0A
+ # time call%0A t1 = time()%0A%0A
# deal w
@@ -2708,24 +2708,25 @@
+#
print %22cpath
@@ -2797,24 +2797,25 @@
%5D = tmp%0A
+#
print %22addin
@@ -2835,16 +2835,17 @@
ist%0A... |
2bc0cf211a15a6bd20f9a851ba92a12d8bb8479c | fix float instead of int | examples/ultimate_schedule/ultimate.py | examples/ultimate_schedule/ultimate.py | import schedule
import time
import sys
import os
import random
from tqdm import tqdm
sys.path.append(os.path.join(sys.path[0],'../../'))
from instabot import Bot
bot = Bot()
bot.login()
bot.logger.info("ULTIMATE script. 24hours save")
comments_file_name = "comments.txt"
random_user_file = bot.read_list_from_file("us... | Python | 0.000004 | @@ -552,16 +552,19 @@
amount=
+int
(700/24)
@@ -606,15 +606,20 @@
unt=
+int(
300/24)
+)
%0Adef
|
41db03999af7221773ff7fa2aa3c679108a5c9f5 | Use polling in taylor_server.py example to get Slider's value updates | examples/glyphs/taylor_server.py | examples/glyphs/taylor_server.py | from __future__ import print_function
import sys
import time
import requests
import numpy as np
import sympy as sy
from bokeh.objects import Plot, DataRange1d, LinearAxis, ColumnDataSource, Glyph, Grid, Legend
from bokeh.widgetobjects import Slider, HBox, VBox
from bokeh.glyphs import Patch, Line, Text
from bokeh.se... | Python | 0 | @@ -394,16 +394,35 @@
in(xs)%0A%0A
+initial_order = 1%0A%0A
def tayl
@@ -2065,16 +2065,116 @@
egend)%0A%0A
+def on_slider_value_change(obj, attr, old, new):%0A update_data(int(new))%0A session.store_all()%0A%0A
slider =
@@ -2204,17 +2204,29 @@
, value=
-1
+initial_order
, step=1
@@ -2247,9 +2247,8 @@
:%22)... |
25fa0687d0d7008c80f2d15ed11dfc19f6e661c7 | Improve :func:`firmant.utils.paths.cat` docstring. | firmant/utils/paths.py | firmant/utils/paths.py | # Copyright (c) 2010, Robert Escriva
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of condition... | Python | 0 | @@ -1724,36 +1724,77 @@
- %3E%3E%3E m = Mock('output')%0A
+.. doctest::%0A :hide:%0A%0A %3E%3E%3E import sys%0A%0A .. doctest::%0A%0A
@@ -1834,17 +1834,26 @@
ty.py',
-m
+sys.stdout
) #docte
@@ -1873,38 +1873,16 @@
%0A
- Called output.write('
# Copyri
@@ -1909,22 +1909,17 @@
... |
bbda2229df033cad6a05988c09c187a464da6da4 | Change backup related event types to the right form | nodeconductor/backup/tasks.py | nodeconductor/backup/tasks.py | import logging
from celery import shared_task
from django.utils import timezone
from nodeconductor.backup import models, exceptions
from nodeconductor.core.log import EventLoggerAdapter
logger = logging.getLogger(__name__)
event_logger = EventLoggerAdapter(logger)
@shared_task
def process_backup_task(backup_uuid)... | Python | 0 | @@ -808,17 +808,19 @@
up_creat
-e
+ion
_started
@@ -1965,17 +1965,19 @@
up_creat
-e
+ion
_failed'
@@ -2325,17 +2325,19 @@
up_creat
-e
+ion
_succeed
@@ -3218,17 +3218,21 @@
p_restor
-e
+ation
_started
@@ -3830,17 +3830,21 @@
p_restor
-e
+ation
_failed'
@@ -4371,17 +4371,21 @@
p_restor
-e
+ation
_succeed
@@ -... |
ffad95f21c1f04343cb5ae7a59bab0c76b1c44f5 | Update TimeDepExtinction.py | experimental_code/TimeDepExtinction.py | experimental_code/TimeDepExtinction.py | #!/usr/bin/env python
import argparse, os,sys
from numpy import *
import numpy as np
from scipy.special import gamma
from scipy.special import beta as f_beta
import platform, time
import csv
from scipy.special import gdtr, gdtrix
from scipy.special import betainc
import scipy.stats
np.set_printoptions(suppress=True)
n... | Python | 0 | @@ -643,17 +643,23 @@
ale) + (
-k
+W_shape
-1)*log(
|
911c8ebd648fb0e14d5b7d713ebdb2b0fc42b63e | add documenation for restore_signals | proclib/helpers.py | proclib/helpers.py | """
proclib.helpers
~~~~~~~~~~~~~~~
Helper utility functions.
"""
import shlex
import signal
TO_RESTORE = tuple(
getattr(signal, sig) for sig in ('SIGPIPE', 'SIGXFZ', 'SIGXFSZ')
if hasattr(signal, sig)
)
def restore_signals(signals=TO_RESTORE):
"""
Function for restoring the signa... | Python | 0 | @@ -285,42 +285,194 @@
-Function for restoring the signals
+Restores signals before the process is%0A executed so that they can be terminated%0A with SIGPIPE.%0A%0A :param signals: Defaults to SIGPIPE,%0A SIGXFZ, and SIGXFSZ (if available).
%0A
|
0cf65b5afb7d5a32137a4fa872be8451feca14d2 | fix prints | tox/interpreters.py | tox/interpreters.py | import sys
import os
import py
import re
import subprocess
import inspect
class Interpreters:
def __init__(self):
self.name2executable = {}
self.executable2info = {}
def get_executable(self, name):
""" return path object to the executable for the given
name (e.g. python2.5, pyt... | Python | 0.000001 | @@ -615,65 +615,8 @@
me)%0A
- print (%22executable for %25s is %25s%22 %25(name, e))%0A
@@ -1059,55 +1059,8 @@
me)%0A
- print (%22get info for %25s%22 %25 executable)%0A
|
6978e47ea902bba65a8f865d58b879edea9d1bd3 | Fix asyncs.processes exit bug | py/garage/garage/asyncs/processes.py | py/garage/garage/asyncs/processes.py | __all__ = [
'ProcessOwner',
'process',
]
import asyncio
from garage import asserts
from .futures import TaskOwner
# Inherit from BaseException so that `except Exception` won't catch it.
class ProcessExit(BaseException):
pass
class process:
"""Decorate processes.
A process is an asyncio.Ta... | Python | 0.000005 | @@ -980,17 +980,12 @@
xit.
-cancelled
+done
():%0A
|
f5dbe1df012241d680cd05c2a96cf4c5d3ccb463 | add logger | acddl/util.py | acddl/util.py | import argparse
import signal
import sys
from tornado import ioloop, web, httpserver
from wcpan.logger import setup as setup_logger, INFO
from . import api
from .controller import RootController
def parse_args(args):
parser = argparse.ArgumentParser('acddl')
parser.add_argument('-l', '--listen', required=T... | Python | 0.000026 | @@ -726,24 +726,48 @@
ctionpool',%0A
+ 'wcpan.worker',%0A
'acd
|
995f2f032fd37273d976bc94a2b5b28b2e2abbbd | Fix public room pagination for client_reader app | synapse/replication/slave/storage/room.py | synapse/replication/slave/storage/room.py | # -*- coding: utf-8 -*-
# Copyright 2015, 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Python | 0.000025 | @@ -1466,24 +1466,97 @@
func__%0A )
+%0A get_public_room_changes = DataStore.get_public_room_changes.__func__
%0A%0A def st
|
1e8d06550d45ec25ac694b6e4ef7f88e587093d7 | Remove a check related to PY2 and VENVs | openquake/baselib/__init__.py | openquake/baselib/__init__.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2017-2018 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... | Python | 0.000006 | @@ -1372,206 +1372,38 @@
g')%0A
-# FIXME %60hasattr(sys, 'real_prefix')%60 check can be removed%0A# after the removal of Python 2 support%0Aif (hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix')%0A
+if hasattr(sys, 'base_prefix')
and
@@ -1432,18 +1432,16 @@
s.prefix
-))
... |
b93e6afb59e2766e961245a0ce7e6b53861511cb | Differentiate between 'no new eps' and 'series not found' | modules/module_sqliteseries.py | modules/module_sqliteseries.py | import time
import datetime
import sqlite
# create table series (id INTEGER PRIMARY KEY, uid TEXT UNIQUE, serie TEXT, season INTEGER, episode INTEGER, title TEXT, airdate DATE);
# insert into series values(null, 'Alias', 1, 1, 'Pilot', date('2006-01-01'));
# select * from series where airdate = date('2006-01-02', '-1 ... | Python | 0.999999 | @@ -2083,101 +2083,365 @@
-bot.say(channel, %22Series '%25s' not found%22 %25 args) # TODO: add to 'wishlist' file or something?
+cur.execute(%22SELECT * FROM series WHERE serie LIKE %25s%22, (%22%25%22+args+%22%25%22,))%0A if cur.rowcount == 0:%0A bot.say(channel, %22Series '%25s' not f... |
58fb7a5b8d095ca3ba6a2ded671e4d6fc310eddc | change per-hp filename from gaia_skymap* to skymap* | py/desitarget/skyhealpixs.py | py/desitarget/skyhealpixs.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
"""
desitarget.skyhealpixs
====================
Dynamic lookup of whether a given RA,Dec location is a good place to
put a sky fiber.
Scripts based on desitarget.skybricks, adapted for healpix split.
"""
import os
import numpy as n... | Python | 0 | @@ -2569,13 +2569,8 @@
r, '
-gaia_
skym
|
ed91a2a5caa296c35bf806cac4b92ba3ceaa5441 | Remove unused imports (#10) | examples/simple_distribution.py | examples/simple_distribution.py | import sys
import time
from random import shuffle
from vania.fair_distributor import FairDistributor
def main():
# User input for the number of targets and objects.
users = ['user1', 'user2']
tasks = ['task1', 'task2']
preferences = [
[1, 2],
[2, 1],
]
# Run solver
distrib... | Python | 0 | @@ -1,81 +1,14 @@
-import sys%0Aimport time%0Afrom random import shuffle%0Afrom vania.fair_distributor
+from vania
imp
|
d7cc85449b41dfeb70443efee2d221b415c614b8 | Add note about faulty OS X pipe tracing | px/px_processinfo.py | px/px_processinfo.py | import sys
import errno
import operator
import px_file
import px_process
def find_process_by_pid(pid, processes):
for process in processes:
if process.pid == pid:
return process
return None
def print_command_line(process):
"""
Print command line separated by linefeeds rather th... | Python | 0 | @@ -3542,16 +3542,176 @@
%22%22%22%0A%0A
+ # FIXME: On OS X, if we one of our files has a DEVICE field that is referred%0A # to by an FD in some other process, that should be included in this map.%0A%0A
file
|
487dd802d63e2860efa519e13bbb35062b6135b9 | fix quotation regex | hazm/Normalizer.py | hazm/Normalizer.py | #coding=utf8
from __future__ import unicode_literals
import re
maketrans = lambda A, B: dict((ord(a), b) for a, b in zip(A, B))
compile_patterns = lambda patterns: [(re.compile(pattern), repl) for pattern, repl in patterns]
class Normalizer():
def __init__(self, character_refinement=True, punctuation_spacing=True, ... | Python | 0.000278 | @@ -701,39 +701,21 @@
%09('%22
-(.+)%22', r'%C2%AB%5C1%C2%BB'),%0A%09%09%09%09(%22'(.+)'%22
+ *(%5B%5E%22%5D+) *%22'
, r'
|
0dfa43733b9cf5be5722520f2949da77bf8d9dc6 | add safe_format for None | py3status/modules/getjson.py | py3status/modules/getjson.py | # -*- coding: utf-8 -*-
"""
Display JSON response from a URL.
This module gets the given `url` configuration parameter and assumes the
response is a JSON object. The keys of the JSON object are used as the format
placeholders. The format placeholders are replaced by the value. Objects that
are nested can be accessed b... | Python | 0.003172 | @@ -34,24 +34,28 @@
ay JSON
-response
+data fetched
from a
@@ -1955,20 +1955,12 @@
-response = %7B
+try:
%0A
@@ -1972,102 +1972,17 @@
-'cached_until': self.py3.time_in(self.cache_timeout),%0A %7D%0A%0A try:%0A resp
+json_data
= s
@@ -2028,16 +2028,23 @@
timeout)
+.json()... |
933308ea388f46273648af588dfb54cd78e71d12 | return on same line | py_solutions_1-10/Euler_2.py | py_solutions_1-10/Euler_2.py | # sum of even fibonacci numbers below 4 million?
import timeit
start = timeit.default_timer()
#def euler_2():
# a1 = 1
# b1 = 1
# b2 = 0
# limit = 4000000
# while b2 <= limit:
# b2 = a1 + b1
# a1 = b1
# b1 = b2
# if b2 % 2 == 0:
# yield b2
def euler_2(t=0, n=2... | Python | 0.001289 | @@ -342,24 +342,16 @@
4000000:
-%0A
return
@@ -355,14 +355,15 @@
rn t
-
%0A
+el
if n
@@ -376,16 +376,8 @@
= 0:
-%0A
ret
|
fdb018bfe3cc47f11465e102a825e54f7f715c13 | Validate theme names | feature_selection/feature_selection.py | feature_selection/feature_selection.py | import os
import re
import yaml
from yaml.constructor import ConstructorError
from yaml.scanner import ScannerError
from yaml.parser import ParserError
from sql import SQLValidator
CREATE_TEMPLATE = 'CREATE TABLE {0} AS SELECT geom,{1} FROM {2} WHERE ({3})'
INDEX_TEMPLATE = """
INSERT INTO gpkg_contents (table_name, d... | Python | 0.000008 | @@ -1743,16 +1743,216 @@
tems():%0A
+ if not re.match('%5E%5Ba-z0-9_%5D+$', theme):%0A self._errors.append(%22Each theme must be named using lowercase characters and underscores%22)%0A return False%0A
|
70043341fef4942b0486074a5f2ae50ea537de72 | Update version.py | minette/version.py | minette/version.py | __version__ = "0.4.dev3"
| Python | 0.000001 | @@ -19,7 +19,7 @@
.dev
-3
+4
%22%0A
|
a3413ab2932dfcf5fce1110b87ea2333ff908fac | fix typo | formation/zookeeper.py | formation/zookeeper.py | #!/usr/bin/python
from confu import atlas
from troposphere import ( Template, FindInMap, GetAtt, Ref, Parameter, Join, Base64, Select, Output, ec2 as ec2 )
template = Template()
template.add_description('ZooKeeper')
atlas.infra_params(template) ## ssh_key, Env, Silo
atlas.conf_params(template) ## Conf Name, Co... | Python | 0.999991 | @@ -1714,16 +1714,18 @@
ame=Ref(
+i_
launchco
|
48dbb1e44880fe3f0fffe4591d79db782141988e | Add generic function for deleting files | pybossa/uploader/__init__.py | pybossa/uploader/__init__.py | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2014 SF Isle of Man Limited
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | Python | 0.000001 | @@ -3804,8 +3804,114 @@
urn url%0A
+%0A def delete_file(self, name, container):%0A %22%22%22Override by the uploader handler.%22%22%22%0A pass%0A
|
40c4dd2aa1428fca8bf78a73f223e96b06c7caac | Update an example test | examples/test_download_files.py | examples/test_download_files.py | import math
from seleniumbase import BaseCase
class DownloadTests(BaseCase):
def test_download_files(self):
self.open("https://pypi.org/project/seleniumbase/#files")
pkg_header = self.get_text("h1.package-header__name").strip()
pkg_name = pkg_header.replace(" ", "-")
whl_f... | Python | 0 | @@ -2896,24 +2896,27 @@
whl_line
+_fi
= self.get_
@@ -2924,36 +2924,100 @@
ext(
-%22tbody tr:nth-of-type(1) th%22
+'a%5Bhref$=%22.whl%22%5D')%0D%0A whl_line = self.get_text('tbody th:contains(%22%25s%22)' %25 whl_line_fi
)%0D%0A
@@ -3153,24 +3153,27 @@
tar_gz_line
+_fi
= self.get_
@@ -3181,36 +3181... |
9d7db8f4ba86e8e5e526efacd878b31403b75e90 | fix test_examples | examples/tests/test_examples.py | examples/tests/test_examples.py | # -*- coding: utf-8 -*-
import glob
import os
import subprocess
import sys
import pytest
tests = glob.glob(os.path.join(os.path.dirname(__file__), '../*_main.py'))
@pytest.mark.parametrize('pypath', tests)
def test_examples(pypath):
p = subprocess.Popen(
['python3' if sys.version_info.major == 3 else ... | Python | 0.000007 | @@ -271,72 +271,23 @@
%5B
-'python3' if sys.version_info.major == 3 else 'python',%0A
+sys.executable,
pyp
@@ -358,16 +358,21 @@
), '..')
+%0A
)%0A as
|
ce15f3a9143e6d9b640cd49f695c3179957c211e | comment quanmin | web/management/commands/fetch.py | web/management/commands/fetch.py | # -*- coding: utf-8 -*-
import sys
from web.fetch import Fetcher
from django.core.management.base import BaseCommand
import leancloud
from settings import LEAN_CLOUD_ID, LEAN_CLOUD_SECRET
reload(sys)
sys.setdefaultencoding("utf-8")
class Command(BaseCommand):
def handle(self, *args, **options):
... | Python | 0 | @@ -16,17 +16,16 @@
tf-8 -*-
-%0D
%0Aimport
@@ -27,17 +27,16 @@
port sys
-%0D
%0Afrom we
@@ -57,17 +57,16 @@
Fetcher
-%0D
%0Afrom dj
@@ -109,17 +109,16 @@
eCommand
-%0D
%0Aimport
@@ -126,17 +126,16 @@
eancloud
-%0D
%0Afrom se
@@ -180,19 +180,17 @@
D_SECRET
-%0D%0A%0D
+%0A
%0Areload(
@@ -193,17 +193,16 @@... |
915098188119a930600a2e202137ad043f18a666 | Bump version 2.0.3 | hijack/__init__.py | hijack/__init__.py | # -*- coding: utf-8 -*-
__version__ = '2.0.2' # pragma: no cover
default_app_config = 'hijack.apps.HijackConfig'
| Python | 0 | @@ -36,17 +36,17 @@
= '2.0.
-2
+3
' # pra
|
aadd20186edb5871dbe84e27ee8ed087b5e250e9 | Fix typo | pybossa_gravatar/gravatar.py | pybossa_gravatar/gravatar.py | # -*- coding: utf8 -*-
"""Gravatar module for pybossa-gravatar."""
import urllib
import hashlib
import os
import time
from werkzeug import secure_filename
from pybossa.cache import users as cached_users
from pybossa.core import user_repo, uploader
class Gravatar(object):
"""Gravatar class for downloading and set... | Python | 0.999999 | @@ -775,17 +775,17 @@
True i
-s
+f
SSL sho
|
19a11204b532e079fe6b83744d95dddd14979e4a | Create TicTacToeNetwork class | examples/tictactoe/tictactoe.py | examples/tictactoe/tictactoe.py | class TicTacToe(object):
def __init__(self, anns=[None, None], increments=[0, 0]):
self.pieces = [None for _ in xrange(9)]
self.anns = anns
self.increments = increments
self.turn = 0
def check(self, position):
if len(set(self.pieces[3*(position/3):3*(position/3 + 1)])) =... | Python | 0 | @@ -2203,8 +2203,51 @@
output%0A
+%0A%0Aclass TicTacToeNetwork(object):%0A pass%0A
|
5b98d7cebb96a98c506b709d97e75b31dff60bb6 | use scikit KDtree instead of scipy one (faster according to line_profiler) | Surrounding.py | Surrounding.py | #! /usr/bin/python2
# vim: set fileencoding=utf-8
"""Implementation of Surrounding class."""
import scipy.spatial as spatial
import numpy as np
import utils as u
class Surrounding(object):
"""Build a KD tree of objects to allow faster ball query."""
@profile
def __init__(self, db, query, fields, projecti... | Python | 0 | @@ -98,31 +98,31 @@
rt s
-cipy.spatial as spatial
+klearn.neighbors as skn
%0Aimp
@@ -1081,21 +1081,141 @@
= s
-patial.KDTree
+kn.NearestNeighbors(radius=350.0, algorithm='kd_tree',%0A leaf_size=25)%0A self.space.fit
(np.
@@ -1233,21 +1233,8 @@
loc)
-, leafsize=25
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.