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 |
|---|---|---|---|---|---|---|---|
4f3234433b97e7f243d54e9e95399f5cabecd315 | Change broken course_modes migration to not touch the database. | common/djangoapps/course_modes/migrations/0005_auto_20151217_0958.py | common/djangoapps/course_modes/migrations/0005_auto_20151217_0958.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('course_modes', '0004_auto_20151113_1457'),
]
operations = [
migrations.RemoveField(
model_name='coursemode',
... | Python | 0.000001 | @@ -237,24 +237,148 @@
rations = %5B%0A
+ migrations.SeparateDatabaseAndState(%0A database_operations=%5B%5D,%0A state_operations=%5B%0A
migr
@@ -393,24 +393,36 @@
emoveField(%0A
+
@@ -454,24 +454,36 @@
+
+
name='ex... |
9a84d3c47a6874460acfc5001b9185df85ac3ca5 | Update to rook 1.2.1 | update-rook.py | update-rook.py | #!/usr/bin/env python3
import os
import tempfile
import re
import sys
import shutil
import configparser
import sh
import obsscripts
# update rook to a newer version
PACKAGE = "rook"
SRCREPO = "rook/rook"
LATEST_OCTOPUS = "v1.2.0"
LATEST_NAUTILUS = "v1.2.0"
OBS = "https://api.opensuse.org"
IBS = "https://api.suse.de... | Python | 0.000017 | @@ -223,17 +223,17 @@
= %22v1.2.
-0
+1
%22%0ALATEST
@@ -250,17 +250,17 @@
= %22v1.2.
-0
+1
%22%0A%0AOBS =
@@ -1263,24 +1263,316 @@
gtversion):%0A
+ f, filename = tempfile.mkstemp('.txt', text=True)%0A tf = os.fdopen(f, %22w%22)%0A fetch_changelog(osc, tgtversion, tf)%0A tf.close()%0A osc.vc(%22-F%22... |
abd087a3800f976caa63170af2d7d2a1ff3a22e7 | Rename test helper function | tests/integration/blueprints/site/user/test_views_email_address_confirmation.py | tests/integration/blueprints/site/user/test_views_email_address_confirmation.py | """
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
import pytest
from byceps.database import db
from byceps.services.authorization import service as authorization_service
from byceps.services.user import service as user_service
from byceps.services.verification_t... | Python | 0.000002 | @@ -1613,39 +1613,39 @@
token = create_
-confirm
+verific
ation_token(user
@@ -2785,39 +2785,39 @@
token = create_
-confirm
+verific
ation_token(user
@@ -3564,39 +3564,39 @@
token = create_
-confirm
+verific
ation_token(user
@@ -4141,39 +4141,39 @@
token = create_
-confirm
+verific
ation_token(user
@@ -4738... |
b63b75aa21e9fe0cdef217adfe35c03fc1dc2869 | fix scrollback | user_server.py | user_server.py | from twisted.internet.protocol import Factory
from twisted.protocols.basic import LineReceiver
from twisted.application.internet import UNIXServer
import os
import json
import events
class Scrollback:
def __init__(self, length):
self.index = 0
self.length = length
self.data = [None] * ... | Python | 0.000017 | @@ -233,32 +233,8 @@
h):%0A
- self.index = 0%0A
@@ -280,32 +280,13 @@
ata
-
= %5B
-None%5D * length%0A
+%5D%0A
%0A
@@ -328,27 +328,21 @@
data
-%5Bself.index%5D =
+.append(
line
+)
%0A
@@ -350,39 +350,27 @@
-self.index = (self.index + 1) %25
+if len(self.data) %3E
sel
@@ -381,2... |
0c9c9f4f86ccc2c7328309569e0ebba44de3b1de | make stages class more subclassable | util/stages.py | util/stages.py | from astrometry.util.file import *
class CallGlobal(object):
def __init__(self, pattern, globals, *args, **kwargs):
self.pat = pattern
self.args = args
self.kwargs = kwargs
self.globals = globals
def getfunc(self, stage):
func = self.pat % stage
func = eval(func, self.globals)
return func
def __call__... | Python | 0.000052 | @@ -300,16 +300,116 @@
rn func%0A
+%09def getkwargs(self, stage, **kwargs):%0A%09%09kwa = self.kwargs.copy()%0A%09%09kwa.update(kwargs)%0A%09%09return kwa%0A
%09def __c
@@ -484,35 +484,27 @@
elf.
+get
kwargs
-.copy()%0A%09%09kwa.update(
+(stage, **
kwar
|
b1e2face6015afc560de6928141a85bb99eaf0da | bump version | cob/__version__.py | cob/__version__.py | __version__ = "0.0.3"
| Python | 0 | @@ -16,7 +16,7 @@
0.0.
-3
+4
%22%0A
|
5d0085cc0752ab172b0ec610d8be652dd0141d6c | Fix embed title | cogs/dictionary.py | cogs/dictionary.py | import json
import re
from urllib.parse import quote_plus
import discord
from discord.ext import commands
from asyncurban import UrbanDictionary, WordNotFoundError
from utils import aiohttp_wrap as aw
class Dictionary(commands.Cog):
URL = "https://dictionaryapi.com/api/v3/references/collegiate/json/{}"
def... | Python | 0.000004 | @@ -1335,16 +1335,49 @@
= None%0A
+ title = word.title()%0A
@@ -1619,16 +1619,74 @@
ate'%5D)%7D%22
+%0A title = f%22%7Bword.title()%7D - (%7Bresp%5B0%5D%5B'fl'%5D%7D)%22
%0A%0A
@@ -1781,45 +1781,13 @@
ame=
-f%22%7Bword.title()%7D - (%7Bresp%5B0%5D%5B'fl'%5D%7D)%22
+title
,%0A... |
efd617d4a5835fc345e6044c604d1ec492ad7bf7 | Handle empty choices | commands/Choice.py | commands/Choice.py | import random
from CommandTemplate import CommandTemplate
class Command(CommandTemplate):
triggers = ['choice', 'choose']
helptext = "Helps you make a choice between options in a comma-separated list"
possibleReplies = ["{}", "Hmm, I'd go with {}", "Out of those, {} sounds the least bad", "{}, obviously",
... | Python | 0.999973 | @@ -1243,16 +1243,206 @@
arts%0A%09%09%09
+#Remove all the empty choices from the list%0A%09%09%09choices = filter(bool, choices)%0A%09%09%09if len(choices) == 0:%0A%09%09%09%09replytext = %22That's just an empty list of choices... I'll pick nothing then%22%0A%09%09%09el
if len(c
|
9c32dc02f30943b763305c5e87465659b4aa19b6 | Correct typo in TransientAdvectionDiffusion.py | openpnm/algorithms/TransientAdvectionDiffusion.py | openpnm/algorithms/TransientAdvectionDiffusion.py | from openpnm.algorithms import TransientReactiveTransport, AdvectionDiffusion
from openpnm.utils import logging, Docorator, GenericSettings
docstr = Docorator()
logger = logging.getLogger(__name__)
@docstr.dedent
class TransientAdvectionDiffusionSettings(GenericSettings):
r"""
Parameters
----------
%(... | Python | 0.000956 | @@ -2797,33 +2797,33 @@
settings%5B't_
-tolerance
+precision
'%5D = t_preci
|
bcf82e718c58cca11340e8a300346226f685f2da | Fix dashboard when windows is large. | openxc/tools/dashboard.py | openxc/tools/dashboard.py | """ This module contains the methods for the ``openxc-dashboard`` command line
program.
`main` is executed when ``openxc-dashboard`` is run, and all other callables in
this module are internal only.
"""
from __future__ import absolute_import
import argparse
import curses
import curses.wrapper
import numbers
from date... | Python | 0 | @@ -3980,24 +3980,70 @@
pe.states):%0A
+ # TODO missing keys here?%0A
@@ -4080,20 +4080,16 @@
(value,
-str(
self.eve
@@ -4095,14 +4095,22 @@
ents
-%5Bitem%5D
+.get(item, %22?%22
))%0A
|
a6f95c70aaf9049465438c68080a09603c54628f | Add detail view for Build model | InvenTree/build/api.py | InvenTree/build/api.py | """
JSON API for the Build app
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import filters
from rest_framework import generics, permissions
from django.conf.urls import url, include
from .models import Build, Bu... | Python | 0 | @@ -915,16 +915,284 @@
%5D%0A%0A%0A
+class BuildDetail(generics.RetrieveUpdateAPIView):%0A %22%22%22 API endpoint for detail view of a Build object %22%22%22%0A%0A queryset = Build.objects.all()%0A serializer_class = BuildSerializer%0A%0A permission_classes = %5B%0A permissions.IsAuthenticatedOr... |
eec67312b5990dd73c6330e74bff978ad300f780 | add pickle support to attrdict | src/python/m5/util/attrdict.py | src/python/m5/util/attrdict.py | # Copyright (c) 2006 The Regents of The University of Michigan
# 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 ... | Python | 0.000002 | @@ -2244,16 +2244,134 @@
(attr)%0A%0A
+ def __getstate__(self):%0A return dict(self)%0A%0A def __setstate__(self, state):%0A self.update(state)%0A%0A
class mu
|
e7a48fc19e965475c2d3c32e3c084a056c2927aa | Update pyyaml usage | resume_tex.py | resume_tex.py | # Converts my Resume from YAML to TeX.
# Just don't forget to drop pdflatex on the output :)
# ------------------------------------------------------------------------------
# @contributor Aleksandr Mattal <https://github.com/qutebits>
# inspired by work of Brandon Amos <https://github.com/bamos/cv>
import re
import y... | Python | 0.000243 | @@ -426,16 +426,21 @@
= yaml.
+safe_
load(ope
@@ -1457,8 +1457,9 @@
s beauty
+%0A
|
10013e0e85dc993f4386af1b62ec5bd311123cb0 | Update sweep params. | make_sst_sweep.py | make_sst_sweep.py | # Create a script to run a random hyperparameter search.
import copy
import getpass
import os
import random
import numpy as np
LIN = "LIN"
EXP = "EXP"
SS_BASE = "SS_BASE"
# Instructions: Configure the variables in this block, then run
# the following on a machine with qsub access:
# python make_sweep.py > my_sweep.s... | Python | 0 | @@ -1109,17 +1109,16 @@
.000
-1
+3
, 0.00
-06
+1
),%0A
@@ -1250,17 +1250,17 @@
(LIN, 0.
-4
+5
, 0.75),
@@ -1406,15 +1406,15 @@
IN,
-5
+8
.0,
-50
+32
.0),
|
158208fb3a8bc07fd415f818c4047e9429be44e0 | fix type-casting issue | mammon/channel.py | mammon/channel.py | #!/usr/bin/env python
# mammon - a useless ircd
#
# Copyright (c) 2015, William Pitcock <nenolod@dereferenced.org>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in... | Python | 0.000001 | @@ -6568,16 +6568,20 @@
h.name,
+str(
len(ch.m
@@ -6587,16 +6587,17 @@
members)
+)
, ch.top
|
578d059cd8e8cfd32a8626b57aaa4028b8db53ee | Add missing STDOUT logger handler for production | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/settings/staging.py | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/settings/staging.py | from settings.base import *
DEBUG = False
ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=['{{cookiecutter.repo_name|as_hostname}}.{{cookiecutter.test_host}}'])
# Static site url, used when we need absolute url but lack request object, e.g. in email sending.
SITE_URL = env.str('DJANGO_SITE_URL', default='h... | Python | 0 | @@ -1792,16 +1792,141 @@
ntry'%5D%0A%0A
+else:%0A LOGGING%5B%22handlers%22%5D.update(%0A %7B%22console%22: %7B%22class%22: %22logging.StreamHandler%22, %22formatter%22: %22default%22%7D%7D%0A )%0A%0A
# Sentry
|
b6937405a9b85026f3e9cffc94fa65c87ee793c0 | Add possibility to debug csv streamer views. | kirppu/views/csv_utils.py | kirppu/views/csv_utils.py | # -*- coding: utf-8 -*-
import functools
import io
from urllib.parse import quote
from django.http import StreamingHttpResponse
def strip_generator(fn):
@functools.wraps(fn)
def inner(output, event, generator=False):
if generator:
# Return the generator object only when using StringIO.
... | Python | 0 | @@ -34,16 +34,28 @@
nctools%0A
+import html%0A
import i
@@ -88,16 +88,48 @@
quote%0A%0A
+from django.conf import settings
%0Afrom dj
@@ -144,16 +144,30 @@
p import
+ HttpResponse,
Streami
@@ -548,213 +548,599 @@
de
-f streamer():%0A output = io.StringIO()%0A for a_string in generator(output):%0... |
16d96cd77f7355c07c5f282b697861dfb164f3c8 | Fix critical bug in ChainedAnimation | ui2/animate.py | ui2/animate.py | import warnings
from objc_util import *
# Constants representing easings. See http://apple.co/29FOF5i
ANIMATE_EASE_IN = 1 << 16
ANIMATE_EASE_OUT = 2 << 16
ANIMATE_EASE_IN_OUT = 0 << 16
ANIMATE_EASE_NONE = ANIMATE_LINEAR = 3 << 16
class Animation(object):
"""Represents an animation to one or more properties of... | Python | 0 | @@ -1,21 +1,4 @@
-import warnings%0A%0A
from
@@ -2150,29 +2150,24 @@
s):%0A
-self.
anims = %5BCha
@@ -2167,194 +2167,419 @@
= %5B
-ChainedAnimationComponent(%0A a,%0A animations%5Bi + 1%5D if i %3C len(animations) - 1 else None%0A ) for i, a in... |
acb787e677a76311172942ad0e0cf033d6b0b3a9 | Remove version printing | docs/examples/plot_streamThickness.py | docs/examples/plot_streamThickness.py | """
Simple example to vary streamline thickness based on the vector amplitudes
=================================
"""
import numpy as np
import matplotlib.pyplot as plt
from discretize import TensorMesh
###############################################################################
# Create mesh
# -----
#
# Minimum ce... | Python | 0.000001 | @@ -1533,197 +1533,8 @@
3)%0A%0A
-###############################################################################%0A# Print the version of SimPEG and dependencies%0A# --------------------------------------------%0A#%0A%0Aversions()%0A%0A
####
|
1abc730b053ba5de43983f22560267c6e790ec7c | Make main file importable. | the_dungeon.py | the_dungeon.py | import sys
import world
from creatures import Player
from player_ai import PlayerAI
import display
def run(world, steps=None, slp=0.5, show=True, player=None):
if steps is None:
steps = sys.maxsize
display.initialize()
for i in range(steps):
if show:
to_display = [world]
... | Python | 0 | @@ -845,17 +845,47 @@
ep()%0A%0A%0A%0A
-%0A
+if __name__ == %22__main__%22:%0A
dungeon
@@ -900,16 +900,20 @@
World()%0A
+
player =
@@ -963,16 +963,20 @@
=(0,1))%0A
+
world.te
@@ -995,16 +995,20 @@
ungeon)%0A
+
run(dung
|
2642c062a2c9fb9cc62091aebdb0c420dce27ca6 | Fix #7 - Allow to define MCR, MSSR, CER | uptick/feed.py | uptick/feed.py | import math
import click
from prettytable import PrettyTable
from pprint import pprint
from tqdm import tqdm
from bitshares.storage import configStorage as config
from bitshares.price import Price
from bitshares.witness import Witness, Witnesses
from bitshares.asset import Asset
from datetime import datetime, timedelta... | Python | 0 | @@ -753,16 +753,363 @@
pe=str)%0A
+@click.option(%0A '--cer',%0A help=%22Core Exchange Rate%22,%0A default=None,%0A type=float)%0A@click.option(%0A '--mssr',%0A help=%22Percentage for max short squeeze ratio (e.g., 110)%22,%0A default=110,%0A type=float)%0A@click.option(%0A '--mcr',%0A he... |
311a0dfceb449dbce8cd2093ec5329812ab7404f | fix issue with witnesses identification | uptick/feed.py | uptick/feed.py | import math
import click
from prettytable import PrettyTable
from pprint import pprint
from tqdm import tqdm
from bitshares.storage import configStorage as config
from bitshares.price import Price
from bitshares.witness import Witness, Witnesses
from bitshares.asset import Asset
from datetime import datetime, timedelta... | Python | 0 | @@ -2731,16 +2731,107 @@
s.set()%0A
+ witness_accounts = %5B%0A x%5B%22witness_account%22%5D for x in witnesses%0A %5D%0A
@@ -2851,24 +2851,24 @@
qdm(feeds):%0A
-
@@ -3098,35 +3098,33 @@
%5D in witness
-es.schedule
+_accounts
else %22%22,%0A
@@ -3550,27 +3550,25 @... |
faba2bc98f08cddea51d2e0093aa5c2981c8bf15 | Add update interval constant. Add detail to constructor. | gdrived.py | gdrived.py | #!/usr/bin/env python
#
# Copyright 2012 Jim Lawton. 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 requir... | Python | 0 | @@ -658,61 +658,529 @@
on%0A%0A
-class GDriveDaemon(daemon.Daemon):%0A def run(self):
+UPDATE_INTERVAL = 30 # Sync update interval in seconds.%0A%0Aclass GDriveDaemon(daemon.Daemon, object):%0A %0A def __init__(self):%0A %22Class constructor.%22%0A %0A # Use pidfile in Gdrive config di... |
e3e8dea40503944e1983f20ab18edd67163f384f | Bump version 0.19.0rc1 --> 0.19.0rc2 | lbrynet/__init__.py | lbrynet/__init__.py | import logging
__version__ = "0.19.0rc1"
version = tuple(__version__.split('.'))
logging.getLogger(__name__).addHandler(logging.NullHandler())
| Python | 0 | @@ -32,17 +32,17 @@
0.19.0rc
-1
+2
%22%0Aversio
|
82a8b7ac80fd7758a9a5e41c7751d4138577f85e | update logger in client test | pctrl/client_test.py | pctrl/client_test.py | #!/usr/bin/env python
# Author:
# Florian Kaufmann (DE-CIX)
import argparse
import atexit
import json
from multiprocessing.connection import Listener, Client
import os
from signal import signal, SIGTERM
from sys import exit
from threading import RLock, Thread
from lib import PConfig
class XRS_Client(object):
d... | Python | 0 | @@ -280,17 +280,32 @@
PConfig%0A
+import util.log
%0A
-
%0Aclass X
@@ -357,24 +357,32 @@
config_file
+, logger
):%0A #
@@ -601,16 +601,46 @@
lf.id)%0A%0A
+ self.logger = logger%0A%0A
def
@@ -835,16 +835,16 @@
info())%0A
-
@@ -885,16 +885,27 @@
_client(
+self.logger
)%0A
@@ ... |
e7d5d150d989e1c4626c98b782af19e17db64f31 | update doc on get by relation function | cognitive/apps/atlas/query.py | cognitive/apps/atlas/query.py | from cognitive.settings import graph
import pandas
class Node:
def __init__(self,name,fields=["id","name"]):
'''Node is a general class to represent a neo4j node
'''
self.name = name
self.fields = fields
def count(self):
'''count returns the count :) I am ze-count! One... | Python | 0 | @@ -3508,68 +3508,327 @@
ram
-filters: a tuples with elements (field, relationship, value)
+head_params list of parameters to search on, eg %5Btrm_123%5D%0A :param field field in node to search for parameters in%0A :param tail_name node label of the tail end of the relationship%0A :param relation... |
ea2a56d7e4c45a3c760e3b9e5bb1e7e9e760f853 | Bump version to 0.0.6 | pgawedge/_version.py | pgawedge/_version.py | version_info = (0, 0, 5)
__version__ = '.'.join(map(str, version_info))
| Python | 0.000001 | @@ -19,9 +19,9 @@
0,
-5
+6
)%0A%0A_
|
bab46721aa057d0e83cfae11c4c2c36e03d11074 | Remove global inliner_packages variable | pinliner/pinliner.py | pinliner/pinliner.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import argparse
import json
import os
from pinliner import __version__
import sys
TEMPLATE_FILE = 'importer.template'
TEMPLATE_PATTERN = '${CONTENTS}'
inliner_packages = {}
def output(cfg, what, newline=True):
# We need inde... | Python | 0 | @@ -238,32 +238,8 @@
'%0A%0A%0A
-inliner_packages = %7B%7D%0A%0A%0A
def
@@ -2063,152 +2063,8 @@
es%0A%0A
-inliner_packages = %7B%0A %22a%22: %5B%0A 1, 2334, 2811%5D,%0A %22a.c%22: %5B1, 2852, 2877%5D,%0A %22a.b%22: %5B0, 2186, 2326%5D,%0A %22a.c.d%22: %5B0, 2819, 2844%5D%0A%7D%0A%0A
%0Adef
|
850222c22e46806157d3081c70d2852a866b3351 | change links() to global | getLink.py | getLink.py | #encoding: utf8
# Return a set of url links in src page
def getLink(src):
source = src.lower()
links = set()
head = 0
length = len(source)
flag = True
while ((flag) and (head < length)):
flag = False
pos1 = source[head:].find('href="') + head
pos2 = source[pos1 + 7:].fin... | Python | 0 | @@ -10,16 +10,109 @@
: utf8%0A%0A
+# links ia a global set that stroe all of the links in the particular domain.%0Alinks = set()%0A%0A
# Return
@@ -189,16 +189,18 @@
er()%0A
+ #
links =
|
d88b7876570cc2bd66a19a508f22f8e7e0501243 | use the default value of getattr.. | company_registration/tasks.py | company_registration/tasks.py | # -*- coding: utf-8 -*-
"""tasks.py: Django company_registration"""
import logging
from celery.schedules import crontab
from celery.task.base import periodic_task
from company_registration.models import RegistrationProfile
import settings
__author__ = 'Steven Klass'
__date__ = '1/9/13 2:56 PM'
__copyright__ = 'Copyr... | Python | 0 | @@ -773,16 +773,23 @@
'DEBUG'
+, False
) else l
|
9c8af5537e9371bd4843dad066a0186fe4bb7ea3 | Revert "ignoring ball_lost_time" | bitbots_body_behavior/src/bitbots_body_behavior/decisions/goal_seen.py | bitbots_body_behavior/src/bitbots_body_behavior/decisions/goal_seen.py | import rospy
from dynamic_stack_decider.abstract_decision_element import AbstractDecisionElement
class GoalSeen(AbstractDecisionElement):
def __init__(self, blackboard, dsd, parameters=None):
super(GoalSeen, self).__init__(blackboard, dsd, parameters)
self.goal_lost_time = rospy.Duration(self.bla... | Python | 0 | @@ -659,16 +659,35 @@
if
+ rospy.Time.now() -
self.bl
@@ -728,24 +728,29 @@
n()
-!= rospy.Time(0)
+%3C self.goal_lost_time
:%0A
|
8759a164c82026e4dcb386fd9803da28e2c1c242 | Update Chapter07/PracticeQuestions/Question2.py added docstrings | books/CrackingCodesWithPython/Chapter07/PracticeQuestions/Question2.py | books/CrackingCodesWithPython/Chapter07/PracticeQuestions/Question2.py | # Is each spam a global or local variable?
spam = 42 # global/local
def foo():
global spam
spam = 99 # global/local
print(spam)
def main():
foo() # mind == blown
# If Question2.py is run (instead of imported as a module), call
# the main() function:
if __name__ == '__main__':
main()
| Python | 0 | @@ -1,10 +1,42 @@
-#
+%22%22%22Chapter 7 Practice Question 2%0A%0A
Is each
@@ -67,16 +67,20 @@
ariable?
+%0A%22%22%22
%0A%0Aspam =
@@ -110,17 +110,144 @@
ef foo()
-:
+ -%3E None:%0A %22%22%22Prints spam.%0A%0A Prints the contents of the spam variable.%0A%0A Returns:%0A Prints spam variable.%0A ... |
83e1979c2041a4c00b871979b9be7901efcb743a | Set RULES_GO_VERSION to 0.15.0 (#1665) | go/def.bzl | go/def.bzl | # Copyright 2014 The Bazel Authors. 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 la... | Python | 0 | @@ -2087,17 +2087,17 @@
N = %220.1
-4
+5
.0%22%0A%0AGoL
|
2a024236ff6f50689d99e9cf327a7145ae08e0f6 | add portal db config | rrd/config.py | rrd/config.py | #-*-coding:utf8-*-
import os
import json
#-- dashboard db config --
DASHBOARD_DB_HOST = "127.0.0.1"
DASHBOARD_DB_PORT = 3306
DASHBOARD_DB_USER = "root"
DASHBOARD_DB_PASSWD = ""
DASHBOARD_DB_NAME = "dashboard"
#-- graph db config --
GRAPH_DB_HOST = "127.0.0.1"
GRAPH_DB_PORT = 3306
GRAPH_DB_USER = "root"
GRAPH_DB_PASSW... | Python | 0 | @@ -345,16 +345,171 @@
graph%22%0A%0A
+#-- portal db config --%0APORTAL_DB_HOST = %22127.0.0.1%22%0APORTAL_DB_PORT = 3306%0APORTAL_DB_USER = %22root%22%0APORTAL_DB_PASSWD = %22%22%0APORTAL_DB_NAME = %22falcon_portal%22%0A%0A
#-- app
|
9b5975f92db327fe9fb5698ed9f512a03f0932c3 | Add instructions for running image analysis | gridify.py | gridify.py | import rasterfairy
import json
import numpy as np
import math
# Expects output from tSNE-images.py and runs rasterfairy on the input,
# writing the image paths layed out to a grid as the output
with open('/home/te/projects/ml4a-ofx/points.json') as json_file:
data = json.load(json_file)
arr = []
for tup in data:... | Python | 0.000688 | @@ -1,12 +1,483 @@
+# Prerequisites%0A#git clone git@github.com:ml4a/ml4a-ofx.git%0A#cd mla-ofx%0A%0A#pip3 install keras%0A#pip3 install numpy%0A#pip3 install prime%0A# https://github.com/Quasimondo/RasterFairy%0A#pip3 install rasterfairy%0A%0A# Run instructions%0A# put 300+ images in the folder 'images'%0A#python3 .sc... |
67bdac10aa9f38643339d73b437e43d5ae34be75 | Add StepFormSet inlineformset to forms.py | planner/forms.py | planner/forms.py | from django.contrib.auth.forms import AuthenticationForm
from django import forms
from django.core.validators import MinLengthValidator
from .models import PoolingUser, Trip, Step
from users.forms import UserCreationForm
class LoginForm(AuthenticationForm):
username = forms.CharField(widget=forms.EmailInput(attrs... | Python | 0 | @@ -1552,24 +1552,126 @@
x_price'%5D%0A%0A%0A
+StepFormSet = inlineformset_factory(parent_model=Trip, model=Step, form=StepForm, can_delete=False)%0A%0A%0A
class UserFo
|
375e214d6cea559e94a6f0de2ce2fc05c3dea424 | add country to the feed | corehq/apps/change_feed/management/commands/run_form_websocket_feed.py | corehq/apps/change_feed/management/commands/run_form_websocket_feed.py | from optparse import make_option
from django.core.management import BaseCommand
from corehq.apps.change_feed import topics
from corehq.apps.change_feed.consumer.feed import KafkaChangeFeed
from ws4redis.publisher import RedisPublisher
from ws4redis.redis_store import RedisMessage
import json
import time
class Command... | Python | 0.000001 | @@ -73,16 +73,60 @@
Command%0A
+from django_countries.data import COUNTRIES%0A
from cor
@@ -342,16 +342,107 @@
rt time%0A
+from corehq.apps.domain.models import Domain%0Afrom corehq.util.quickcache import quickcache%0A
%0A%0Aclass
@@ -899,67 +899,303 @@
p=%22S
-tart at this point in the changes feed (defaults to ... |
850d44deb34d3354b43049029a4b5c00535edb0d | fix throttle logging | voatist/api.py | voatist/api.py | import time
import os
import json
import sys
import requests
THROTTLE_GROW = 3
THROTTLE_DECAY = 0.8
THROTTLE_MIN = 1.1
THROTTLE_MAX = 275
LOGGING = True
class Api(object):
def __init__(self, apikey, useragent, username, password, access_token_file, base_url):
self.apikey = apikey
self.useragent... | Python | 0.000001 | @@ -4607,32 +4607,82 @@
le_decay(self):%0A
+ should_log = self.throttle %3E THROTTLE_MIN%0A
self.thr
@@ -4705,16 +4705,16 @@
E_DECAY%0A
-
@@ -4795,20 +4795,29 @@
-else
+if should_log
:%0A
@@ -4827,32 +4827,35 @@
log(%22backoff
+up
to one request e
@@ -5064,16 +5064,21... |
12b8a94266411fc85f9566e25a4da2a9ca59a83d | Add setup sh scripts to handler.py | handler.py | handler.py | #!/usr/bin/env python
print("""
This example shows how you can monitor an analog input by attaching a function to its changed event.
You should see the analog value being printed out as it changes.
Try connecting up a rotary potentiometer or analog sensor to input one.
""")
from subprocess import call
import time
... | Python | 0 | @@ -317,48 +317,364 @@
me%0A%0A
-sh ./subscribe.sh ble987BF3738084 PULSE
+# discover bluetooth devices - sh ./discover.sh%0Acall(%5B%22sh%22, %22./discover.sh%22%5D)%0A%0A# register oximeter sh ./registerDevice.sh 98:7B:F3:73:80:84 Oximeter%0Acall(%5B%22sh%22, %22sh ./registerDevice.sh 98:7B:F3:73:80:84 Oximeter%22%5... |
9909064d4dfcf9c1ae72b906318cda7b736ad9d2 | correct log file location | config/settings/production.py | config/settings/production.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import os
import configparser
from django.core.exceptions import ImproperlyConfigured
from .base import * # noqa
DEBUG = False
ALLOWED_HOSTS = ['127.0.0.1']
config = configparser.ConfigParser()
try:
config.read(os.path.join(BASE_... | Python | 0.000003 | @@ -1123,17 +1123,8 @@
': '
-/var/log/
phil
|
ed81444804b5b1a2afaaa003812abfaa83e5bf24 | comment on system module & changed say output | hangman.py | hangman.py | # A simple hangman game programmed in Python 3
#
# You need to have Python 3 installed on your system to be able to run this game.
# Tested on Python 3.3.2.
#
# The game prompts the user to enter a letter to start guessing a word.
# 11 incorrect guesses are allowed, after the 11th, hangman is hanged and the game is ove... | Python | 0 | @@ -764,16 +764,48 @@
t system
+ # enable command line functions
%0A%0Adef st
@@ -1104,16 +1104,23 @@
em('say
+-r 160
%25s' %25 (t
|
ea856d0965d9aa69e17f4c604e1bfaa9486c7f31 | Fix color util | wasabi/util.py | wasabi/util.py | # coding: utf8
from __future__ import unicode_literals, print_function
import sys
import locale
import textwrap
class MESSAGES(object):
GOOD = 'good'
FAIL = 'fail'
WARN = 'warn'
INFO = 'info'
COLORS = {
MESSAGES.GOOD: 2,
MESSAGES.FAIL: 1,
MESSAGES.WARN: 3,
MESSAGES.INFO: 4,
'red... | Python | 0.000002 | @@ -365,16 +365,77 @@
blue': 4
+,%0A 'pink': 5,%0A 'cyan': 6,%0A 'white': 7,%0A 'grey': 8
%0A%7D%0A%0AICON
@@ -1028,21 +1028,27 @@
not
-fg and not bg
+any(%5Bfg, bg, bold%5D)
:%0A
@@ -1082,10 +1082,10 @@
s =
-''
+%5B%5D
%0A
@@ -1112,21 +1112,20 @@
yles
- += '%5C033%5B1m'
+.append('1')
%0A
... |
5722942e8c2898967d1ebc97e31c0cda5d39df3d | Improve security settings | config/settings/production.py | config/settings/production.py | from .common import *
ENVIRONMENT = 'production'
DEBUG = False
# Core settings
ALLOWED_HOSTS = ['.reggae-cdmx.com', ]
INTERNAL_IPS: list = []
# Security
# CSRF_COOKIE_SECURE = True
# CSRF_USE_SESSIONS = True
SECURE_BROWSER_XSS_FILTER = True
SECURE_SSL_REDIRECT = True # Force HTTPS
# Static files
STATIC_URL = '/s... | Python | 0.000009 | @@ -150,18 +150,45 @@
ecurity%0A
-#
+SESSION_COOKIE_SECURE = True%0A
CSRF_COO
|
5d46b0c7516451241037d6b46c66aa153b962b83 | update outip match | ip2geo.py | ip2geo.py | #!/usr/bin/env python
# encoding=utf-8
import sys
import argparse
import requests
import urllib
import re
# parse the console params
parser = argparse.ArgumentParser()
parser.add_argument('domain', help='a domain like baidu.com | a ipv4 addr', type=str)
parser.add_argument('-v', help='show request detail info', actio... | Python | 0 | @@ -1382,22 +1382,16 @@
urllib.
-parse.
urlencod
@@ -1528,18 +1528,16 @@
type%0A
- #
print(r
@@ -1583,16 +1583,18 @@
print(
+''
)%0A%0A# fil
@@ -2070,12 +2070,8 @@
e(r'
-%E6%82%A8%E6%9D%A5%E8%87%AA%EF%BC%9A
%3C/sp
@@ -2078,16 +2078,18 @@
an%3E(.*)?
+%5Ct
%3Cspan cl
@@ -2105,13 +2105,13 @@
0%5C%22%3E
-... |
e818de96908e4ec6801d42e54c29036b3cc373b3 | Update denormalization command | project/apps/api/management/commands/denormalize.py | project/apps/api/management/commands/denormalize.py | from django.core.management.base import (
BaseCommand,
)
from apps.api.models import (
Convention,
Contest,
Contestant,
Performance,
Song,
Group,
Singer,
Director,
Panelist,
)
class Command(BaseCommand):
help = "Command to denormailze data."
def handle(self, *args, **... | Python | 0.000004 | @@ -118,26 +118,63 @@
st,%0A
-Contestant
+Award,%0A Contestant,%0A Entrant,%0A Session
,%0A Pe
@@ -198,19 +198,8 @@
ng,%0A
- Group,%0A
@@ -518,72 +518,379 @@
-cs = Contestant.objects.all()%0A for c in cs:%0A c
+ps = Panelist.objects.all()%0A for p in ps:%0A ... |
1dcee2da40eec36f049d501048b33be1208ef90b | fix a bug with import in DBFileSystemGC | HW3/dbsys-hw3/DBFileSystemGC.py | HW3/dbsys-hw3/DBFileSystemGC.py | from Database import Database
from Catalog.Schema import DBSchema
import os;
class DBFileSystemGC:
defaultDBPath = './data';
# close all the files in that directory.
def list_files(path):
# returns a list of names (with extension, without full path) of all files
# in folder path
files = []
... | Python | 0 | @@ -1,70 +1,4 @@
-from Database import Database%0Afrom Catalog.Schema import DBSchema%0A
impo
@@ -5,17 +5,16 @@
rt os;%0A%0A
-%0A
class DB
|
51ea9b839c1ef4b9150da3fb35d4a0be4799674b | Update denormalization command | project/apps/api/management/commands/denormalize.py | project/apps/api/management/commands/denormalize.py | from django.core.management.base import (
BaseCommand,
)
from apps.api.models import (
Award,
Certification,
Chapter,
Chart,
Contest,
Contestant,
Convention,
Group,
Judge,
Member,
Organization,
Performance,
Performer,
Person,
Role,
Round,
Score,
... | Python | 0.000004 | @@ -1593,9 +1593,17 @@
n %22D
-one
+enormalized
%22%0A
|
86c213ab74853aaad620f31d0fabd45f9e61a7df | Remove messaging - it's too noisy. | runnit-bot.py | runnit-bot.py | """
This script is used to helpout AutoMod on some things it can't do.
"""
import datetime
import os,sys
import praw
import logging
import re
import sched, time
USERNAME=os.environ['USER']
PASSWORD=os.environ['PASSWORD']
AUTHOR=os.environ['AUTHOR']
CommentsRemoved = set();
def login():
r = praw.Reddit('RunnitAuto... | Python | 0 | @@ -1339,44 +1339,8 @@
nts%0A
- recent_comments_removed = set();%0A
f
@@ -1512,377 +1512,8 @@
nt);
-%0A recent_comments_removed.add(comment);%0A%0A # message the author%0A if len(recent_comments_removed) %3E 0:%0A title = 'Removed AutoMod comments due to negative score';%0A body = 'Removed... |
a84dd6f7916f15f1abf3b5ba987e3bb40a50a72e | refactor irregular length numpy op | treeano/theano_extensions/irregular_length.py | treeano/theano_extensions/irregular_length.py | import numpy as np
import theano
import theano.tensor as T
def group_irregular_length_tensors(tensors):
"""
groups a set of irregular length tensors (where the length of the first
axis of each is different) into one large tensor, and also returns
a vector of the lengths of the original tensors (for us... | Python | 0.999971 | @@ -642,16 +642,895 @@
ngths%0A%0A%0A
+def ungroup_irregular_length_numpy(x, lengths, pad=True):%0A %22%22%22%0A ungroups a grouped irregular length numpy tensor into%0A a list of tensors%0A%0A pad: if False, returns a list of tensors with different shape.%0A if True, returns a single tensor with 0 padd... |
ee3941e2c3a0355314b270c04de6a623f5a0730c | Add statistics about general speaking | plugins/stats.py | plugins/stats.py | import operator
class Plugin:
def __call__(self, bot):
bot.on_hear(r"(lol|:D|:P)", self.on_hear)
bot.on_respond(r"stats", self.on_respond)
bot.on_help("stats", self.on_help)
def on_hear(self, bot, msg, reply):
stats = bot.storage.get("stats", {})
for word in msg["match... | Python | 0.000024 | @@ -53,16 +53,66 @@
, bot):%0A
+ bot.on_hear(r%22.*%22, self.on_hear_anything)%0A
@@ -153,16 +153,16 @@
n_hear)%0A
-
@@ -247,16 +247,273 @@
_help)%0A%0A
+ def on_hear_anything(self, bot, msg, reply):%0A stats = bot.storage.get(%22stats%22, %7B%7D)%0A word_stats = stats.get... |
fa78d5b06e6825956069dc758cd934264bd6d465 | Version Bump. | config/settings.py | config/settings.py | # Syncrae Application settings
SYNCRAE_PORT = 8888
SYNCRAE_TORNADO_SETTINGS = {
'port': SYNCRAE_PORT,
}
# format: 'major.minor.bug name'
SYNCRAE_VERSION = '0.2.0 BETA'
# Loging info
SYNCRAE_LOG_LEVEL = 'INFO'
SYNCRAE_LOG_FILE = None
SYNCRAE_ERR_CODES = {
# All err codes start with a '5' to represent Sync... | Python | 0 | @@ -163,9 +163,9 @@
'0.
-2
+3
.0 B
|
02f157652f5b93a5f8c7af8ad6e4caf31f038192 | bump version and fix logging issues | plugz/loading.py | plugz/loading.py | import os
import sys
import inspect
from collections import defaultdict
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
from plugz import PluginTypeBase
import errors
""" Main storage of the plugins."""
_loaded_plugins = defaultdict(list)
def register_plugin(f):
"""... | Python | 0 | @@ -767,9 +767,9 @@
%25 f
-%7D
+)
%0A
@@ -1023,16 +1023,17 @@
methods)
+)
%0A
@@ -2632,17 +2632,16 @@
in_name)
-)
%0A p =
|
c13bc308db35928860a2d03a17f2fd432459d9ec | Update for proj@6 (#16183) | var/spack/repos/builtin/packages/py-basemap/package.py | var/spack/repos/builtin/packages/py-basemap/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import os
class PyBasemap(PythonPackage):
"""The matplotlib basemap toolkit is a library for plo... | Python | 0 | @@ -362,52 +362,223 @@
-homepage = %22http://matplotlib.org/basemap/%22%0A
+url = 'https://github.com/matplotlib/basemap/archive/v1.2.0rel.tar.gz'%0A homepage = %22http://matplotlib.org/basemap/%22%0A%0A version('1.2.1', sha256='3fb30424f18cd4ffd505e30fd9c810ae81b999bb92f950c76553e1abc081faa7')
%0A
@@ -... |
18df0ce4c9b9cd72e8419f487f657af727efc781 | document LDAP_BIND_TYPE in config_template.py | config_template.py | config_template.py | import os
basedir = os.path.abspath(os.path.dirname(__file__))
# BASIC APP CONFIG
WTF_CSRF_ENABLED = True
SECRET_KEY = 'We are the world'
BIND_ADDRESS = '127.0.0.1'
PORT = 9393
LOGIN_TITLE = "PDNS"
# TIMEOUT - for large zones
TIMEOUT = 10
# LOG CONFIG
LOG_LEVEL = 'DEBUG'
LOG_FILE = 'logfile.log'
# For Docker, leave ... | Python | 0.000001 | @@ -944,16 +944,245 @@
er:636'%0A
+# with LDAP_BIND_TYPE you can specify 'direct' or 'search' to use user credentials%0A# for binding or a predefined LDAP_USERNAME and LDAP_PASSWORD, binding with non-DN only works with AD%0ALDAP_BIND_TYPE= 'direct' # direct or search%0A
LDAP_USE
|
eac438105d977bedb3e0a20ae2387a62cfafdfd5 | Tweak assignment order in except clauses. | scheduling.py | scheduling.py | #!/usr/bin/env python3.3
"""Example coroutine scheduler, PEP-380-style ('yield from <generator>').
Requires Python 3.3.
There are likely micro-optimizations possible here, but that's not the point.
TODO:
- Docstrings.
- Unittests.
PATTERNS TO TRY:
- Wait for all, collate results.
- Wait for first N that are ready.
... | Python | 0 | @@ -1624,25 +1624,20 @@
elf.
-result = exc.valu
+alive = Fals
e%0A
@@ -1647,36 +1647,41 @@
self.
-alive = Fals
+result = exc.valu
e%0A ex
@@ -1716,39 +1716,37 @@
self.
-exception = exc
+alive = False
%0A
@@ -1747,37 +1747,39 @@
self.
-alive = False
+exception = exc
%0A ... |
d34f8e7a68b3c3b8023ac298f31a2ff52595ed80 | Fix some encoding problems | documents/management/commands/clean_old_versions.py | documents/management/commands/clean_old_versions.py | import shutil, tempfile, os, csv
from optparse import make_option
from daisyproducer.documents.models import Document
from django.core.management.base import BaseCommand
class Command(BaseCommand):
args = ''
help = 'Clean out old versions from the database and the file system'
option_list = BaseCommand.o... | Python | 0.000001 | @@ -163,16 +163,60 @@
eCommand
+%0Afrom django.utils.encoding import smart_str
%0A%0Aclass
@@ -1040,16 +1040,26 @@
..%5Cn' %25
+smart_str(
document
@@ -1065,16 +1065,17 @@
t.title)
+)
%0A
|
e899efe271c3195d92ae017d1ced09e8545c7325 | use disabled not readonly for widgets | constance/admin.py | constance/admin.py | from datetime import datetime, date, time
from decimal import Decimal
from operator import itemgetter
import six
from django import forms
from django.contrib import admin, messages
from django.contrib.admin import widgets
from django.contrib.admin.options import csrf_protect_m
from django.core.exceptions import Permis... | Python | 0 | @@ -2119,25 +2119,31 @@
rs%5B'
-readonly'%5D = True
+disabled'%5D = 'disabled'
%0A%0A
|
0bf68db66f2c543c65a4796efba1ea592f0d8a9e | Make Groestlcoin the default coin | server/env.py | server/env.py | # Copyright (c) 2016, Neil Booth
#
# All rights reserved.
#
# See the file "LICENCE" for information about the copyright
# and warranty status of this software.
'''Class for handling environment configuration and defaults.'''
import resource
from collections import namedtuple
from ipaddress import ip_address
from os... | Python | 0.026332 | @@ -846,11 +846,15 @@
', '
-Bit
+Groestl
coin
|
517f9062be966c4374f2efbdfb636872f45024bd | remove https from redirect middleware | core/middleware.py | core/middleware.py | """
Middleware for core app.
"""
from django.contrib.sites.models import Site
from django.http import HttpResponsePermanentRedirect
from django.core.urlresolvers import resolve
from django.core import urlresolvers
from django.utils.http import urlquote
# http://eikke.com/django-domain-redirect-middleware/
class Doma... | Python | 0.000001 | @@ -815,43 +815,8 @@
-request.is_secure() and 'https' or
'htt
|
d9b3f20eba5a18cffc9ae2022a22c06be5880bf5 | Update admin.py | courriers/admin.py | courriers/admin.py | from django.contrib import admin
from django.conf.urls.defaults import patterns, url
from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext as _
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from .models import Newsletter, NewsletterItem... | Python | 0 | @@ -1816,16 +1816,21 @@
wsletter
+Admin
)%0Aadmin.
|
d43c30785e5b86d83fe60f38e939aa3a7c6f1e49 | change buffer size in pyaudio | pyaudio_utils.py | pyaudio_utils.py | """
Audio recorder and player classes built on pyaudio.
"""
import time
import wave
import cStringIO
import pyaudio
import scipy.io.wavfile
class AudioPlayer(object):
""" Asynchronous audio player. NOT WORKING WELL."""
def __init__(self, wav_filename):
self.wave_file = wave.open(wav_filename, 'rb'... | Python | 0.000001 | @@ -783,19 +783,19 @@
_buffer=
-256
+512
,%0A
|
355a8a8d34cfd87f3e3e84c8dbce99ad63fe3441 | Add comment about future additions | pyaxiom/utils.py | pyaxiom/utils.py | #!python
# coding=utf-8
import random
import string
import itertools
from pyaxiom.urn import IoosUrn
from pyaxiom import logger
class DotDict(object):
def __init__(self, *args, **kwargs):
for k, v in kwargs.items():
setattr(self, k, v)
def __repr__(self):
import pprint
r... | Python | 0 | @@ -2224,16 +2224,74 @@
'area'%5D:
+ # Ignore 'comments'. May need to add more things here...
%0A
|
74581b6a212b0ab61d286b22b789c5f73905f855 | Remove extraneous prints from custom date types | pycassa/types.py | pycassa/types.py | """
Data type definitions that are used when converting data to and from
the binary format that the data will be stored in.
In addition to the default classes included here, you may also define
custom types by creating a new class that extends :class:`~.CassandraType`.
For example, IntString, which stores an arbitrary... | Python | 0.000001 | @@ -4268,52 +4268,8 @@
ue)%0A
- print %22packing (old): %2510.10f%22 %25 ts%0A
@@ -4289,32 +4289,32 @@
l._have_struct:%0A
+
retu
@@ -4596,54 +4596,8 @@
1e6%0A
- print %22unpacking (old): %2510.10f%22 %25 ts%0A
@@ -5369,61 +5369,8 @@
se)%0A
- print %22packing (intermedia... |
2d4cce26f8b6c45b0c92783475285273e6a0722c | Allow hardcoded error headers per #10 | pycnic/errors.py | pycnic/errors.py | from .data import STATUSES
class PycnicError(Exception):
pass
class HTTPError(PycnicError):
status_code = 0
status = None
message = None
data = None
headers = None
def __init__(self, status_code, message, data=None, headers=[]):
if self.status_code:
status_code = self.... | Python | 0.000001 | @@ -456,32 +456,56 @@
elf.data = data%0A
+ if headers:%0A
self.hea
|
1a6029416d4ab3a157dafbbae2a9d986f0c15374 | fix typo | pycycle/utils.py | pycycle/utils.py | import ast
import codecs
import os
import sys
import traceback
import click
import crayons
import re
if sys.version_info[0] > 2:
open_func = open
else:
open_func = codecs.open
REGEX_RELATIVE_PATTERN = re.compile('from \.')
class Node(object):
def __init__(self, name, imports=None, full_path=None, line... | Python | 0.999991 | @@ -3362,16 +3362,95 @@
if
+0 %3C= ast_node.lineno - 1 %3C len(lines) and%5C%0A
REGEX_RE
|
f6ff634bc532585fefb7c30d33709857f6b6d336 | add kepsff to init | pyke/__init__.py | pyke/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
PACKAGEDIR = os.path.abspath(os.path.dirname(__file__))
from .version import __version__
from .keparray import *
from .kepbls import *
from .kepclip import *
from .kepconvert import *
from .kepcotrend import *
from .kepdetre... | Python | 0 | @@ -867,32 +867,54 @@
rfphot import *%0A
+from .kepsff import *%0A
from .kepsmooth
|
5260a603965dbe5a36d6b1737692c5fd093b7944 | Make kmer positions 1-offset. | pykmer/basics.py | pykmer/basics.py | from pykmer.bits import ffs, rev, popcnt, m1
nuc = { 'A':0, 'a':0, 'C':1, 'c':1, 'G':2, 'g':2, 'T':3, 't':3 }
def kmer(seq):
"Turn a string in to an integer k-mer"
r = 0
for c in seq:
if c not in nuc:
return None
r = (r << 2) | nuc[c]
return r
def render(k, x):
"Turn a... | Python | 0.000002 | @@ -1537,16 +1537,55 @@
ositions
+ (1-based, negative denoting rc-strand)
from a
@@ -1593,32 +1593,32 @@
tring sequence%22%0A
-
for i in ran
@@ -1631,32 +1631,50 @@
(str) - k + 1):%0A
+ j = i + 1%0A
x = kmer
@@ -1722,17 +1722,17 @@
eld (x,
-i
+j
)%0A
@@ -1787,12 +1787,12 @@
k, x), -... |
27e2b386ba57b97bd93898bd36bd8c053929ba1e | Bump revision 0.1.1 | pylr/__init__.py | pylr/__init__.py | # -*- coding: utf-8 -*-
'''
Created on 4 déc. 2013
.. moduleauthor:: Mappy S.A
OpenLR decoder
'''
__version_info__=(0,1,0)
__version__ = "{0}.{1}.{2}".format(*__version_info__)
from .parser import (BinaryParseError,
BinaryVersionError,
InvalidDataSizeError,
... | Python | 0.000001 | @@ -117,17 +117,17 @@
__=(0,1,
-0
+1
)%0A__vers
|
cf0223f6a725641431fa9f704cab47d96d4783a2 | Add method for parsing articles from archive | sites/ksml.py | sites/ksml.py | # -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
import processor
from datetime import datetime
def parse( url ):
r = requests.get( url )
if r.status_code == 404:
return processor.create_dictionary('', url, r.status_code, [u''], [u''], u'', u'', u'', u'', [u''], [u''])
r.encoding = 'UTF-8'... | Python | 0 | @@ -1441,16 +1441,1101 @@
tions)%0A%0A
+%0Adef parse_from_archive(url, content):%0A%09article = BeautifulSoup( content, %22html.parser%22 )%0A%0A%09if article == None:%0A%09%09return processor.create_dictionary('', url, 404, %5Bu''%5D, %5Bu''%5D, u'', u'', u'', u'', %5Bu''%5D, %5Bu''%5D)%0A%0A%09processor.decompose_al... |
23c1fef38bf35d39ff1eddafe028cacd746097ba | Add writing of covariance | python/lowdim.py | python/lowdim.py | # lowdim <master> <inputFile_X> <inputFile_y> <mode> <outputFile> <k>"
#
# perform two stages of dimensionality reduction
# first reduce each time series using the specified method
# then do PCA
# each row is (x,y,z,timeseries)
#
import sys
import os
from numpy import *
from scipy.linalg import *
from scipy.io import... | Python | 0.001428 | @@ -1835,16 +1835,107 @@
evals%22)%0A
+savemat(outputFile+%22/%22+%22cov.mat%22,mdict=%7B'cov':cov%7D,oned_as='column',do_compression='true')%0A
savemat(
|
25904df895e495570d8fab05619809c84b7d45e1 | Comment B Combinator | skiski/bfc.py | skiski/bfc.py | from ski import S, K, I
from helper import Typename
class B(metaclass=Typename("B")):
is_class = True
def __init__(self, x):
self.x = x
self.is_class = False
def dot(self, y):
return B2(self.x, y)
def __str__(self):
return "(B " + str(self.x) + ")"
def __repr__(... | Python | 0 | @@ -73,32 +73,142 @@
Typename(%22B%22)):%0A
+ %22%22%22%0A which composes two function%0A%0A %3E%3E%3E B(lambda x: x).dot(lambda x: x + 5).dot(5).b()%0A 10%0A %22%22%22
%0A is_class =
|
13981e78604234a0f736d52e5d1dacc92e95882b | update system encoding | python/search.py | python/search.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interface to ElasticSearch for serving search requests
#
# Tuan Tran (ttran@l3s.de)
#
import sys
from sys import argv
from conn import connect,close as es_close
QUERY = { "query":{ "multi_match" : {"query": "%s", "fields": [ "text", "title", "contributor" ]}}}
def si... | Python | 0.000001 | @@ -1098,16 +1098,32 @@
rint(hit
+.encode('utf-8')
)%0A
|
6333ccb825b026bdb805672ff14f99123d8a381e | remove gen | python/server.py | python/server.py | import tornado.ioloop
import tornado.web
from tornado import gen
class MainHandler(tornado.web.RequestHandler):
@gen.coroutine
def get(self):
self.write("Hello, world")
application = tornado.web.Application([
(r"/", MainHandler),
])
if __name__ == "__main__":
application.listen(8888)
tor... | Python | 0.000048 | @@ -37,32 +37,8 @@
.web
-%0Afrom tornado import gen
%0A%0Acl
@@ -87,27 +87,8 @@
):%0A%0A
- @gen.coroutine%0A
|
844160735a53f3ce19f7eac006f1d24a822ac1e9 | fix issue with dumping xml containing ints | python/xmlfmt.py | python/xmlfmt.py | #!/usr/bin/env python
# Copyright (C) 2010 Red Hat, Inc.
#
# This is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.
#
# This so... | Python | 0.000002 | @@ -1346,16 +1346,20 @@
'=%5C'' +
+str(
getattr(
@@ -1366,16 +1366,17 @@
self, a)
+)
+ '%5C''%0A
@@ -1936,19 +1936,24 @@
+ '%3E' +
+str(
obj
+)
+ '%3C/'
|
9e2f6e05cf8a95bac96d9a21c7fb58ab32bb7080 | Add docstring | pywrap/cython.py | pywrap/cython.py | import os
import sys
from .defaultconfig import Config
from .exporter import CythonDeclarationExporter, CythonImplementationExporter
from .parser import Parser, Includes, TypeInfo
from .templates import render
from .utils import make_header, file_ending, hidden_stdout, hidden_stderr
def load_config(custom_config):
... | Python | 0.000005 | @@ -5384,24 +5384,269 @@
ors=False):%0A
+ %22%22%22Run setup script to build extension.%0A%0A Parameters%0A ----------%0A setuppy_name : str, optional (default: 'setup.py')%0A Setup script name%0A%0A hide_errors : bool, optional (default: False)%0A Hide output to stderr%0A %22%22%22%0A
... |
aec5f9a80b3259a2e410e24168ad8760c81dc908 | Add do_control() to take IR reading as the input to control the motor.\nThe controller is just a test one. | qb_controller.py | qb_controller.py | import contextlib
import time
import Adafruit_BBIO.GPIO as GPIO
import Adafruit_BBIO.PWM as PWM
import Adafruit_BBIO.ADC as ADC
def setup_motor():
# Initialize GPIO pins
GPIO.setup(left_motor1, GPIO.OUT)
GPIO.setup(left_motor2, GPIO.OUT)
GPIO.setup(right_motor1, GPIO.OUT)
GPIO.setup(right_motor2,... | Python | 0.000001 | @@ -1725,206 +1725,32 @@
()%0A%0A
-%0Aif __name__ == '__main__':%0A import config%0A%0A left_motor1, left_motor2, left_pwm = config.LEFT_MOTOR_PINS%0A right_motor1, right_motor2, right_pwm = config.RIGHT_MOTOR_PINS%0A%0A setup_motor()%0A
+def simple_motor_test():
%0A
@@ -2176,24 +2176,24 @@
motor(0, 0... |
c532d7584bea96f1ceed35b2ecef22812ec87de9 | Fix npm install 'invalid version number' for un-@version-ed quark files | quark/helpers.py | quark/helpers.py | # Copyright 2015 datawire. 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 agr... | Python | 0.000013 | @@ -3045,16 +3045,18 @@
urn %220.0
+.1
%22%0A%0Adef n
@@ -3239,16 +3239,19 @@
Name = %22
+TBD
%22%0A
@@ -3266,16 +3266,18 @@
n = %220.0
+.1
%22%0A re
|
c2fe954c7979fc4192e5433122d66c4f0953964f | Handle PyCurl errors | registry_view.py | registry_view.py | #!/usr/bin/env python
#
# Script to visualize the contents of a Docker Registry v2 using the API via curl
#
# v1.3.1 by Ricardo Branco
#
# MIT License
import base64, getopt, json, os, re, string, sys
import time
from calendar import timegm
from datetime import datetime
from getpass import getpass
try:
import pycur... | Python | 0 | @@ -108,17 +108,17 @@
%0A# v1.3.
-1
+2
by Rica
@@ -2436,16 +2436,23 @@
eaders)%0A
+%09try:%0A%09
%09c.perfo
@@ -2456,16 +2456,82 @@
rform()%0A
+%09except%09pycurl.error, err:%0A%09%09print(c.errstr())%0A%09%09sys.exit(err%5B0%5D)%0A
%09body =
|
2ac0509e6a6e1a92ee04def45cf502664b1bd101 | Fix storemagic test for new alias API | IPython/extensions/tests/test_storemagic.py | IPython/extensions/tests/test_storemagic.py | import tempfile, os
from IPython.config.loader import Config
import nose.tools as nt
ip = get_ipython()
ip.magic('load_ext storemagic')
def test_store_restore():
ip.user_ns['foo'] = 78
ip.magic('alias bar echo "hello"')
tmpd = tempfile.mkdtemp()
ip.magic('cd ' + tmpd)
ip.magic('store foo')
ip... | Python | 0.000001 | @@ -712,35 +712,22 @@
78)%0A
-nt.
assert
-_in('bar',
ip.alia
@@ -740,19 +740,22 @@
ger.
+is_
alias
-_table
+('bar'
)%0A
|
27b3eff0d2f38a99b587916663e4d2c2c6371ec2 | Fix super invocation arguments | npc/formatters/sectioners.py | npc/formatters/sectioners.py | """
Module for generating section headings
"""
import tempfile
from pathlib import Path
from mako.template import Template
from npc import util
def get_sectioner(key, heading_level, prefs):
"""
Helper to get the right built-in sectioner object
Creates a new sectioner object based on `key`. The special k... | Python | 0.00002 | @@ -5237,16 +5237,36 @@
_init__(
+heading_level, prefs
)%0A%0A
|
297279618ed3a909ccd3a37d5c1b3fd63d2fad01 | Use string for tempdir path | npc/formatters/sectioners.py | npc/formatters/sectioners.py | """
Module for generating section headings
"""
import tempfile
from pathlib import Path
from mako.template import Template
from npc import util
def get_sectioner(key, heading_level, prefs):
"""
Helper to get the right built-in sectioner object
Creates a new sectioner object based on `key`. The special k... | Python | 0.000004 | @@ -2735,23 +2735,18 @@
ioner=se
-ctioner
+lf
)%0A%0A d
@@ -3602,16 +3602,20 @@
rectory=
+str(
self.tem
@@ -3618,16 +3618,17 @@
.tempdir
+)
, **enco
|
109df245a57dc1a67aa792e04cdd42164d179d35 | Add amount of products to pagination data | lfs/search/views.py | lfs/search/views.py | import json
from django.core.paginator import EmptyPage
from django.core.paginator import InvalidPage
from django.core.paginator import Paginator
from django.core.urlresolvers import reverse
from django.db.models import Q
from django.http import HttpResponse
from django.shortcuts import render
from django.template.loa... | Python | 0.000005 | @@ -340,16 +340,63 @@
o_string
+%0Afrom django.utils.translation import ungettext
%0A%0Afrom l
@@ -1824,16 +1824,58 @@
r(query)
+%0A amount_of_products = products.count()
%0A%0A #
@@ -2313,16 +2313,249 @@
earch'))
+%0A pagination_data%5B'total_text'%5D = ungettext('%25(count)d product',%0A ... |
18a6b18f6668a059dcc337c7ab175497f1448a29 | Update honeypot.py | honeypot.py | honeypot.py | from flask import Flask, jsonify, request
import os
import requests
from pprint import pprint
import json
import logging
import logstash
#added this K
#from cfenv import AppEnv
#added this K
#env = AppEnv()
#env.LOG_HOST # 'test-app'
#env.LOG_PORT # 5000
if 'LOG_HOST' not in os.environ or 'LOG_PORT' not in os.envi... | Python | 0 | @@ -879,16 +879,18 @@
honeypot
+CF
: ', ext
|
984fed853582dbf73db31a4cf0e91cb9fc556afc | Fix --no_output option help message | healthy.py | healthy.py | #! /usr/bin/env python
# coding=utf-8
"""
healthy.py
Checks the health of a Python package, based on this calculation:
Health is on a scale from 0-100
"""
import argparse
from datetime import datetime, timedelta
import os
try:
# Different location in Python 3
from xmlrpc.client import ServerProxy
except Imp... | Python | 0 | @@ -5305,39 +5305,34 @@
help='Show
-verbose
+no
output - the re
@@ -5329,48 +5329,35 @@
t -
-the reasons for the package health score
+no output will be generated
',%0A
|
088a733b791507d366605fde7ff8ee571e809f6f | Version 0.3.2. | cmsplugin_footnote/__init__.py | cmsplugin_footnote/__init__.py | __version__ = (0, 3, 1)
version_string = '.'.join(str(n) for n in __version__)
| Python | 0 | @@ -18,9 +18,9 @@
3,
-1
+2
)%0Ave
|
8de66e1d776c61bff6266df58327fd6c4282ba0c | fix OSM bbox | ott/utils/object_utils.py | ott/utils/object_utils.py | import sys
import base64
import hashlib
import logging
log = logging.getLogger(__file__)
def to_hash(str):
''' generates nice 0AI3Mk6FErSH4Q== type hashes from strings '''
hasher = hashlib.sha1(str)
ret_val = base64.urlsafe_b64encode(hasher.digest()[0:10])
return ret_val
def get_error_message(err, de... | Python | 0.000797 | @@ -5142,21 +5142,158 @@
f
-or a in argv:
+irst = True%0A for a in argv:%0A # skip app path at argv%5B0%5D%0A if first:%0A first = False%0A continue
%0A
|
6957f03adc876d5d5079da3c33ac98fae33bd47b | Use list() for copying | coalib/results/ResultFilter.py | coalib/results/ResultFilter.py | import copy
from coalib.results.Diff import ConflictError, Diff
from coalib.results.SourceRange import SourceRange
def filter_results(original_file_dict,
modified_file_dict,
original_results,
modified_results):
"""
Filters results for such ones that ar... | Python | 0.000001 | @@ -785,24 +785,25 @@
ges%0A %22%22%22%0A
+%0A
# diffs_
@@ -4218,29 +4218,20 @@
wfile =
-copy.deepcopy
+list
(file_co
|
e40736c1055747cab45adb8ce6a511b9889000fd | test case for quotation | erpnext/selling/doctype/quotation/test_quotation.py | erpnext/selling/doctype/quotation/test_quotation.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, json
from frappe.utils import flt
import unittest
test_dependencies = ["Product Bundle"]
class TestQuotation(unittest.TestCase):
def t... | Python | 0.000001 | @@ -1125,16 +1125,942 @@
sert()%0A%0A
+%09def test_create_quotation_with_margin(self):%0A%09%09from erpnext.selling.doctype.quotation.quotation import make_sales_order%0A%09%09from erpnext.selling.doctype.sales_order.sales_order %5C%0A%09%09%09import make_material_request, make_delivery_note, make_sales_invoice%0A%0A%... |
79bd6db9464c2fa10cb727d311f19ac67cc8db84 | Improve error logging for worker threads | statscache/plugins/__init__.py | statscache/plugins/__init__.py | import abc
import datetime
from multiprocessing import cpu_count
from statscache.plugins.schedule import Schedule
from statscache.plugins.models import BaseModel, ScalarModel,\
CategorizedModel, CategorizedLogModel,\
ConstrainedCategorizedLogM... | Python | 0.000001 | @@ -4893,20 +4893,16 @@
spawn(e
-rror
):%0A
@@ -4912,20 +4912,16 @@
if e
-rror
is not
@@ -4970,18 +4970,18 @@
in
-%7B!r%7D: %7B!r%7D
+'%7B%7D': '%7B%7D'
%22.fo
@@ -4997,16 +4997,18 @@
.ident,
+e.
error))%0A
|
aba9481ec750292354688d026fd4f3561959b125 | Increase wait time for Locust tests | locust/locustfile.py | locust/locustfile.py | # Copyright (C) 2016 University of Zurich. All rights reserved.
#
# This file is part of MSRegistry Backend.
#
# MSRegistry Backend is free software: you can redistribute it and/or
# modify it under the terms of the version 3 of the GNU Affero General
# Public License as published by the Free Software Foundation, or a... | Python | 0 | @@ -5454,16 +5454,18 @@
_wait=40
+00
%0A max
@@ -5472,11 +5472,13 @@
_wait=90
+00
%0A%0A%0A
|
b0f0ee7b04a1dcf011dd32ceafb1c8cc975d9538 | fix storage/api/compose_objects main call | storage/api/compose_objects.py | storage/api/compose_objects.py | #!/usr/bin/env python
# Copyright (C) 2013 Google 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 applic... | Python | 0.000001 | @@ -3154,22 +3154,20 @@
main(
-p
ar
+g
s
-er
.bucket,
@@ -3167,22 +3167,20 @@
bucket,
-p
ar
+g
s
-er
.destina
@@ -3185,22 +3185,20 @@
nation,
-p
ar
+g
s
-er
.sources
|
c89803251462f6c34263bc9e7f5e24293b645a28 | add one condition | HPACK.py | HPACK.py | from tables import HuffmanTree
import int_representation as intRepresent
from binascii import unhexlify
import struct
huffmanRoot = HuffmanTree.create()
def serialize(content, isString = False):
wire = 0
for c in content:
wire <<= 8
wire |= ord(c) if isString else c
return unhexlify(hex(wi... | Python | 0.999902 | @@ -962,16 +962,71 @@
ze != -1
+ and table.settingsDynamicTableSize != dynamicTableSize
:%0A
|
5efca5a3e8fb978cb47e986b1bd7296fe2cae3ce | Add some spaces to get_list_as_english | helpers.py | helpers.py | def get_readable_list(passed_list, sep=', '):
output = ""
for i, item in enumerate(passed_list):
if len(passed_list) is 1:
output += str(item)
else:
if i is not (len(passed_list) - 1):
output += str(item) + sep
else:
output += str(item)
return output
def get_list_as_english(passed_list):
ou... | Python | 0.000204 | @@ -409,24 +409,30 @@
+= str(item)
+ + ' '
%0A%0A%09%09elif len
@@ -559,16 +559,17 @@
put += %22
+
%22%0A%0A%09%09els
|
6c11c90de2d17c3935466176047a818cb1aec621 | Add validation for empty fields for userservice/create_user | src/userservice/userservice.py | src/userservice/userservice.py | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | Python | 0 | @@ -1362,21 +1362,35 @@
fo('
-cre
+valid
ating
-user
+new user request
: %25s
@@ -1737,35 +1737,179 @@
if
-not fields.issubset(set(req
+any(field not in req for field in fields)%0A return jsonify(%7B'msg':'missing required field(s)'%7D), 400%0A if any(not (value or value.strip()) for value in req.value... |
d2c4c35da78834bb220d93131264d19d7638d1a6 | Add test for one language slide generation | csunplugged/tests/at_a_distance/views/test_slides_file_generation_view.py | csunplugged/tests/at_a_distance/views/test_slides_file_generation_view.py | from django.conf import settings
from django.test import override_settings
from django.urls import reverse
from tests.BaseTestWithDB import BaseTestWithDB
from tests.at_a_distance.AtADistanceTestDataGenerator import AtADistanceTestDataGenerator
TEST_TEMPLATES = settings.TEMPLATES
TEST_TEMPLATES[0]["DIRS"].append("test... | Python | 0 | @@ -4199,28 +4199,1150 @@
%7D,%0A %7D%0A )%0A
+%0A @override_settings(DEFAULT_LANGUAGES=MULTIPLE_LANGUAGES)%0A def test_slides_file_generation_view_multiple_lessons_multiple_languages_one_requested(self):%0A lesson1 = self.test_data.create_lesson(1)%0A lesson1.languages = %5BLANG... |
40f704895f7e4652d723b7c58fb2b0cee04bc757 | fix template names. | id/views.py | id/views.py | from registration.views import RegistrationView
from settings.settings import REGISTRATION_OPEN, REGISTRATION_CLOSED_URL, REGISTRATION_SUCCESS_URL
from django.contrib.auth.views import logout as django_logout
from django.contrib.auth.views import login as django_login
from django.contrib.auth.views import REDIRECT_FIEL... | Python | 0 | @@ -473,16 +473,17 @@
ame__)%0A%0A
+%0A
class Pr
@@ -763,15 +763,16 @@
_url
-=
+ =
'/'%0A%0A
-%0A
@@ -1529,20 +1529,17 @@
/log
-ged_out.html
+out.jinja
',%0A
@@ -2872,20 +2872,21 @@
n/login.
-html
+jinja
',%0A
@@ -3000,32 +3000,42 @@
urrent_app=None,
+%0A
extra_context=N
@@ -3389,16 +33... |
05de768e2b62cec0808f9bd6530f82984e9ad438 | Define resource, send the transport to the resource as a parameter | vumi/transports/mtn_rwanda/mtn_rwanda_ussd.py | vumi/transports/mtn_rwanda/mtn_rwanda_ussd.py | from twisted.internet import reactor
from twisted.web import xmlrpc, server
from vumi import log
from vumi.transports.base import Transport
from vumi.config import ConfigText
class MTNRwandaUSSDTransportConfig(Transport.CONFIG_CLASS):
"""
MTN Rwanda USSD transport configuration.
"""
# TODO: Configure... | Python | 0.000001 | @@ -68,16 +68,67 @@
, server
+%0Afrom twisted.internet.defer import inlineCallbacks
%0A%0Afrom v
@@ -965,16 +965,20 @@
esource(
+self
)%0A
@@ -1804,24 +1804,59 @@
transport):%0A
+ self.transport = transport%0A
xmlr
@@ -1876,12 +1876,536 @@
nit__(self)%0A
+%0A def xmlrpc_(self, request, re... |
9ebd20e98bc196885885fd8cdfc121f170fd0fa2 | make command_line.py actually work as a standalone wrapper | colourvalgrind/command_line.py | colourvalgrind/command_line.py | #!/usr/bin/env python
from colourvalgrind import colour_valgrind
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input",
help="valgrind log file to run through colour filters",
required=True)
args = parser.pars... | Python | 0 | @@ -64,39 +64,65 @@
nd%0A%0A
-def main():%0A import argparse
+import argparse%0Aimport subprocess%0Aimport sys%0A%0Adef main():
%0A
@@ -155,16 +155,30 @@
tParser(
+add_help=False
)%0A pa
@@ -201,19 +201,18 @@
t(%22-
-i
+t
%22, %22--
-inpu
+tes
t%22,%0A
@@ -319,27 +319,41 @@
-required=True)%0A
... |
9f073c8d39826c99b4c0ae6c7af2858da6579e0f | add nr_days option to set number of days to fetch | horepgd.py | horepgd.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# horepgd.py
#
# This script provides a daemon which runs daily
import os
import sys
import pwd
import grp
import logging
import logging.handlers
import argparse
from horepg.horizon import *
from horepg.oorboekje import *
from horepg.tvheadend import *
from horepg.xmltvd... | Python | 0.000001 | @@ -1230,16 +1230,29 @@
io=False
+, nr_days = 5
):%0A wit
@@ -1936,33 +1936,39 @@
r i in range(0,
-5
+nr_days
):%0A sta
@@ -2451,17 +2451,23 @@
ange(0,
-5
+nr_days
):%0A
@@ -3491,24 +3491,149 @@
then exit')%0A
+ parser.add_argument('-nr', nargs='?', metavar='DAYS', dest='nr_days', default=5, ty... |
182b5663fbe383c302250d0779dbd5f4b1a4a085 | add single shot option | horepgd.py | horepgd.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# horepgd.py
#
# This script provides a daemon which runs daily
import os
import sys
import pwd
import grp
import logging
import logging.handlers
import argparse
from horepg.horizon import *
from horepg.oorboekje import *
from horepg.tvheadend import *
from horepg.xmltvd... | Python | 0.000039 | @@ -3341,24 +3341,149 @@
daemonize')%0A
+ parser.add_argument('-1', dest='single_shot', action='store_const', const=True, default=False, help='Run once, then exit')%0A
parser.add
@@ -4928,16 +4928,109 @@
els)))%0A%0A
+ if args.single_shot:%0A run_import(channels, args.tvhsocket, args.do_radio_epg)%0A else:%0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.