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 |
|---|---|---|---|---|---|---|---|
b6f4611c0701b184240f0648969ded9a7ff8719e | cache the query | channelguide/guide/views/categories.py | channelguide/guide/views/categories.py | from django.conf import settings
from channelguide import util, cache
from channelguide.guide import templateutil
from channelguide.guide.auth import admin_required
from channelguide.guide.models import Category, Channel
@cache.aggresively_cache(Category.table, Channel.table)
def index(request):
query = Category.... | Python | 0.999999 | @@ -1752,16 +1752,17 @@
required
+%0A
def dele
|
76a0bae50e51c39d5ccdaa63309cacabda219ddc | Add test for more special tabs | chrome/test/functional/special_tabs.py | chrome/test/functional/special_tabs.py | #!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import pyauto_functional # Must be imported before pyauto
import pyauto
class SpecialTabsTest(pyauto.PyUITest):
"""TestCase for Sp... | Python | 0.000001 | @@ -589,24 +589,110 @@
t Version',%0A
+ 'about:appcache-internals': 'AppCache Internals',%0A 'about:credits': 'Credits',%0A
'about:d
@@ -749,24 +749,72 @@
istograms',%0A
+ 'about:net-internals': 'Network internals',%0A
'about:p
@@ -1066,24 +1066,58 @@
internals',%0A
+ 'chrome://newtab': 'New Ta... |
8767f4fdd38d6365b52f7be9ad7ecadb09d2a1c6 | Stop failing the build if a dependency has been removed. Review URL: http://codereview.chromium.org/7350 | chrome/tools/build/win/dependencies.py | chrome/tools/build/win/dependencies.py | #!/usr/bin/python
# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Script to verify a Portable Executable's dependencies.
Analyzes the input portable executable (a DLL or an EXE for example), e... | Python | 0.000013 | @@ -3891,24 +3891,34 @@
ected):%0A
+# Setting
found_extra
@@ -3921,11 +3921,175 @@
tra
-= 1
+to 1 causes the build to fail. In some case, some%0A # dependencies are stripped out on optimized build; don't break anything%0A # just for that.%0A found_extra = 0
%0A
|
84e5114138e2a49713fc2b3f0bfc866cace7ba5b | make get_pdf callable from 8.0 api | base_report_to_printer/report.py | base_report_to_printer/report.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | Python | 0.000001 | @@ -972,17 +972,22 @@
tions, _
+, api
%0A
-
%0A%0Aclass
@@ -1033,16 +1033,28 @@
eport'%0A%0A
+ @api.v7%0A
def
@@ -1927,16 +1927,307 @@
_type)%0A%0A
+ @api.v8%0A def print_document(self, records, report_name, html=None, data=None):%0A return self._model.print_document(self._cr, self._uid,%0A ... |
ffe795d36c5094254af9bd8596c264dc7db95d1e | rename query -> query_total | benchbuild/experiments/pjtest.py | benchbuild/experiments/pjtest.py | """
A test experiment for PolyJIT.
This experiment should only be used to test various features of PolyJIT. It
provides only 1 configuration (maximum number of cores) and tests 2 run-time
execution profiles of PolyJIT:
1) PolyJIT enabled, with specialization
2) PolyJIT enabled, without specialization
"""
import cs... | Python | 0.000316 | @@ -4446,16 +4446,22 @@
QUERY
+_TOTAL
= %5C%0A
@@ -6017,16 +6017,22 @@
rt.QUERY
+_TOTAL
.unique_
|
cbbe17c702238af8259cff9d52d7bb3e1d8e47b7 | Update _unittests/ut_hackathon/test_crypt.py | _unittests/ut_hackathon/test_crypt.py | _unittests/ut_hackathon/test_crypt.py | """
@brief test log(time=8s)
"""
import sys
import os
import unittest
from pyquickhelper.loghelper import fLOG
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
... | Python | 0.000001 | @@ -53,16 +53,32 @@
port os%0A
+import warnings%0A
import u
@@ -108,29 +108,35 @@
per.
-loghelper import fLOG
+pycode import skipif_travis
%0A%0A%0At
@@ -582,13 +582,12 @@
-fLOG(
+try:
%0A
@@ -599,140 +599,250 @@
-__file__,%0A self._testMethodName,%0A OutputPrint=__name__ == %2... |
d24498206564e7a5b6990cfce57b2c57cc7f3d3f | version 0.1.4alpha | datary/version.py | datary/version.py | #!/usr/bin/env python
"""
Datary python sdk version file
"""
__version__ = "0.1.3"
| Python | 0.000003 | @@ -77,7 +77,12 @@
0.1.
-3
+4alpha
%22%0A
|
bbe127cb4f49e12c7fd452dadf6184d913384e5c | if a user is not found, return empty list of teams | dbaas/api/team.py | dbaas/api/team.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from rest_framework import viewsets, serializers
from account import models
import logging
LOG = logging.getLogger(__name__)
class TeamSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = models.Team
... | Python | 0.997754 | @@ -815,16 +815,33 @@
, None)%0A
+ try:%0A
@@ -865,16 +865,20 @@
t None:%0A
+
@@ -951,60 +951,303 @@
-queryset = queryset.filter(users__username=username)
+ user = models.AccountUser.objects.get(username=username)%0A queryset = queryset.filter(users__username... |
595ae47653a747c304522beb76c045b14ba38e87 | Fix test_fields | example/tests/test_fields.py | example/tests/test_fields.py | # -*- coding: utf-8
from __future__ import unicode_literals
from django.test import TestCase
from shop.models.defaults.customer import Customer
class JSONFieldTest(TestCase):
"""JSONField Wrapper Tests"""
def test_json_field_create(self):
"""Test saving a JSON object in our JSONField"""
jso... | Python | 0.000014 | @@ -54,16 +54,45 @@
terals%0A%0A
+from django.db import models%0A
from dja
@@ -148,31 +148,231 @@
ts.c
-ustomer import Customer
+art_item import CartItem%0Afrom shop.models.fields import JSONField%0A%0A%0Aclass JsonModel(models.Model):%0A%0A class Meta:%0A app_label = 'JsonModel'%0A%0A json = JSONField(... |
2b84f28e9b1a8dcbf8f274d79b100898438a5558 | Set nH to 2 | examples/attention_tagger.py | examples/attention_tagger.py | # coding: utf8
from __future__ import unicode_literals, print_function, division
import plac
from timeit import default_timer as timer
from srsly import cloudpickle as pickle
import spacy
from spacy.attrs import LOWER, PREFIX, SUFFIX, SHAPE
from spacy.tokens.doc import Doc
from thinc.i2v import HashEmbed
from thinc.... | Python | 0.999798 | @@ -4652,22 +4652,27 @@
-Sparse
+MultiHeaded
Attentio
@@ -4686,17 +4686,17 @@
dth, nH=
-6
+2
)%0A
|
cccac62b346ac3835908c5b6dd0cd4a003494979 | Set istat: fixed bug for Fermo | bilanci_project/territori/management/commands/set_istat.py | bilanci_project/territori/management/commands/set_istat.py | # coding=utf-8
import StringIO
from pprint import pprint
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from django.core.management.base import BaseCommand
from unidecode import unidecode
from optparse import make_option
import requests
import zipfile
import csv
import logging
from terri... | Python | 0.000001 | @@ -5858,16 +5858,111 @@
cts.get(
+%0A territorio = Territorio.TERRITORIO.C,%0A
denomina
@@ -5988,32 +5988,57 @@
at_denominazione
+%0A
)%0A
|
843d8e8811ab197fdbb416a7cc7d045af6f1e4bf | Fix project list resources | zou/app/blueprints/crud/project.py | zou/app/blueprints/crud/project.py | from zou.app.models.project import Project
from zou.app.services import user_service, projects_service
from .base import BaseModelResource, BaseModelsResource
class ProjectsResource(BaseModelsResource):
def __init__(self):
BaseModelsResource.__init__(self, Project)
def add_project_permission_filter... | Python | 0.000006 | @@ -95,16 +95,54 @@
_service
+%0Afrom zou.app.utils import permissions
%0A%0Afrom .
@@ -366,16 +366,109 @@
query):%0A
+ if permissions.has_manager_permissions():%0A return query%0A else:%0A
@@ -533,16 +533,16 @@
lter())%0A
-
%0A def
@@ -572,24 +572,24 @@
(self):%0A
-
... |
3f7e9f1392b3cc2f915d332ee224578e71dcebc3 | Add __version__ | workshops/__init__.py | workshops/__init__.py | Python | 0.000001 | @@ -0,0 +1,22 @@
+__version__ = '0.2.0'%0A
| |
f7a1e75bd11388ee5053e0f4e66dd95a760adc3c | Update openFile.py | Procesamiento/ProcesarTweets/openFile.py | Procesamiento/ProcesarTweets/openFile.py | import json
import sys
from pprint import pprint
import urllib2
# encoding:utf-8
valor = '"value":"'
with open('/root/PycharmProjects/ImprimirTweets/tweetsUIO.txt') as f:
for line in f:
line.split(valor)
#print(line.split("value"))
#result = line.split('value:')[-1]
result = line.s... | Python | 0.000001 | @@ -1,12 +1,197 @@
+%0A#C%C3%B3digo escrito en lenguaje python que permite leer el archivo .txt creado por printInFile %0A#con el objetivo de extraer el campo value que contiene el texto de cada tweet recolectado%0A%0A
import json%0A
@@ -281,16 +281,58 @@
ue%22:%22'%0A%0A
+#Ejemplo de directorio Proyecto Pycharm:%0A#... |
a8b7c6012452d415da6bebdaaf36d3f4d5795b46 | bring back original if instead of elif | aiohttp_admin/backends/mongo_utils.py | aiohttp_admin/backends/mongo_utils.py | import re
import trafaret as t
from trafaret.contrib.object_id import MongoId
from ..exceptions import JsonValidaitonError
__all__ = ['create_validator', 'create_filter']
def op(filter, field, operation, value):
if operation == 'in':
filter[field] = {'$in': value}
elif operation == 'like':
... | Python | 0.000001 | @@ -1718,22 +1718,21 @@
nverter%0A
+%0A
-el
if isins
|
98da78251af4e54f2fc254753385edc133f1e49f | Remove Project.storage after unpickling | angr/exploration_techniques/cacher.py | angr/exploration_techniques/cacher.py | import os
import hashlib
import logging
from . import ExplorationTechnique
l = logging.getLogger("angr.exploration_techniques.cacher")
class Cacher(ExplorationTechnique):
"""
An exploration technique that caches states during symbolic execution.
"""
def __init__(self, when=None, dump_cache=True, l... | Python | 0 | @@ -3801,46 +3801,8 @@
tion
-%0A cached_project.storage = None
%0A%0A
@@ -3959,16 +3959,55 @@
= stash%0A
+ cached_project.storage = None%0A%0A
|
abd709f9defd7375abdc3300b2ad6cb5e5d2a30a | Fix a bug in readv(). Close #2447. (#2453) | angr/procedures/linux_kernel/iovec.py | angr/procedures/linux_kernel/iovec.py | import angr
from ..posix.read import read
from ..posix.write import write
from ...sim_type import register_types, parse_types
register_types(parse_types("""
struct iovec {
void *iov_base; /* Starting address */
size_t iov_len; /* Number of bytes to transfer */
};
"""))
class readv(angr.SimProcedure):
... | Python | 0.000001 | @@ -713,16 +713,25 @@
iov_len)
+.ret_expr
%0A
|
bc1a8de33a8f5ef9459bf6258917a3f0d78c90ef | Fix PUT endpoint | website/addons/dropbox/views/config.py | website/addons/dropbox/views/config.py | """Views fo the node settings page."""
# -*- coding: utf-8 -*-
import logging
import httplib as http
from framework import request
from framework.auth import get_current_user
from website.project.decorators import (must_have_addon,
must_have_permission, must_not_be_registration,
must_be_valid_project
)
from fr... | Python | 0.000041 | @@ -3764,16 +3764,52 @@
tration%0A
+@must_have_addon('dropbox', 'user')%0A
@must_ha
@@ -3870,16 +3870,28 @@
e_addon,
+ user_addon,
auth, *
@@ -3963,28 +3963,28 @@
.%22%22%22%0A if
-node
+user
_addon.owner
|
72fe77f34fa724dba03f8a1c773cb64602d63acc | Fix Insufficient Permissions error on MIG (#865) | sacred/host_info.py | sacred/host_info.py | """Helps to collect information about the host of an experiment."""
import os
import platform
import re
import subprocess
from xml.etree import ElementTree
import warnings
from typing import List
import cpuinfo
from sacred.utils import optional_kwargs_decorator
from sacred.settings import SETTINGS
__all__ = ("host_... | Python | 0 | @@ -4723,69 +4723,74 @@
-gpu = %7B%0A %22model%22: child.find(%22product_name
+fb_memory_usage = child.find(%22fb_memory_usage%22).find(%22total
%22).text
-,
%0A
@@ -4798,32 +4798,110 @@
- %22total_memory%22: int(
+if fb_memory_usage == %22Insufficient Permissions%22:%0A # for ... |
7e8066f7a6ad8a2a2e38f0a4f275f073712524ae | update RS functions | rs.py | rs.py | from math import *
def rh(PW,Pa,Ta,dem):
"""
https://www.researchgate.net/publication/227247013_High-resolution_Surface_Relative_Humidity_Computation_Using_MODIS_Image_in_Peninsular_Malaysia/
PW <- MOD05_L2 product
Pa <- MOD07 product
Pa <- 1013.3-0.1038*dem
Ta <- MOD07 product
Ta <- -0.0065*dem+TaMOD07 (if dem... | Python | 0 | @@ -2869,9 +2869,11 @@
.1)
-&
+and
(al
|
dc2254457602ca40f79d20d9eb97e64941ab7709 | use SI units in units example | examples/reasonable_units.py | examples/reasonable_units.py | #!/usr/bin/env python
from time import sleep
import urwid as uw
from urwid_timed_progress import TimedProgressBar
# Demo of bar adjusting to reasonable units
# The demo simulates progress at different rates to show
# the progress bar changing units as needed.
if __name__ == '__main__':
palette = [
('norm... | Python | 0 | @@ -405,16 +405,77 @@
%0A %5D%0A%0A
+ # Using SI units: https://en.wikipedia.org/wiki/Kilobyte%0A
unit
@@ -490,17 +490,21 @@
('
-B
+bytes
', 1),%0A
@@ -512,17 +512,17 @@
('
-K
+k
B', 1000
@@ -554,16 +554,17 @@
)%0A %5D%0A
+%0A
bar
|
1ea6279bd7de7630561c4582ff8f34bc5f43025e | Fix sphinx build error | salt/modules/npm.py | salt/modules/npm.py | # -*- coding: utf-8 -*-
'''
Manage and query NPM packages.
'''
# Import python libs
import json
import logging
import distutils.version # pylint: disable=import-error,no-name-in-module
# Import salt libs
import salt.utils
from salt.exceptions import CommandExecutionError
log = logging.getLogger(__name__)
# Functi... | Python | 0.000001 | @@ -1711,17 +1711,16 @@
ionadded
-d
:: 2014.
|
0ea72bc6c1470960294bbc92ee1e1e9b606699c9 | Update fb_login.py | Automation/fb_login.py | Automation/fb_login.py | '''
This script is created to perform facebook login from terminal
'''
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.ui... | Python | 0.000003 | @@ -1,552 +1,134 @@
-'''%0AThis script is created to perform facebook login from terminal%0A'''%0A%0Afrom selenium import webdriver%0Afrom selenium.webdriver.common.keys import Keys%0Afrom time import sleep%0Afrom selenium.common.exceptions import TimeoutException%0Afrom selenium.webdriver.support.ui import WebDriverWa... |
169a14df3a5e145310f9d73b2531f62e4a02bd5a | Fix zip on clang-release-builder. | scripts/slave/android/archive_build.py | scripts/slave/android/archive_build.py | #!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A tool to archive an Android build.
This script is used for Debug and Release builds.
When this is run, the current directory ... | Python | 0.000079 | @@ -751,16 +751,25 @@
name)%0A
+expanded_
files =
@@ -805,24 +805,33 @@
iles:%0A
+expanded_
files.append
@@ -868,24 +868,33 @@
else:%0A
+expanded_
files = %5Btar
@@ -1117,16 +1117,25 @@
.extend(
+expanded_
files)%0A
|
782574b58e96eadcb3f07dbdf91fdf3ecc88b98e | Fix naming issue in host state | salt/states/host.py | salt/states/host.py | '''
Manage the state of the hosts file
'''
def present(name, ip):
'''
Ensures that the named host is present with the given ip
'''
ret = {'name': name,
'changes': {},
'result': False,
'comment': ''}
if __salt__['hosts.has_pair'](ip, name):
ret['changes'] = '... | Python | 0.000002 | @@ -1146,20 +1146,20 @@
ost ' +
-host
+name
%0A
|
5a33d1e6976b669fc71562fb25287064c7fe72b7 | Fix http.query when result has no text (#38382) | salt/states/http.py | salt/states/http.py | # -*- coding: utf-8 -*-
'''
HTTP monitoring states
Perform an HTTP query and statefully return the result
.. versionadded:: 2015.5.0
'''
# Import python libs
from __future__ import absolute_import
import re
__monitor__ = [
'query',
]
def query(name, match=None, match_type='string', status=None, **... | Python | 0.000005 | @@ -2898,24 +2898,32 @@
ch, data
-%5B
+.get(
'text'
-%5D
+, '')
):%0A
|
ab7603719d82185a1ac66f6b0699b38b3c3f5221 | fix indent | src/database_metrics/monitor.py | src/database_metrics/monitor.py | import multiprocessing as mp
import time
from functools import partial
from typing import Callable
from docker.models.containers import Container
from docker import DockerClient
from delphi.operations.database_metrics.db_actions import _get_epidata_db_size, \
_get_covidcast_rows, \
_clear_db,
_clear_cache
... | Python | 0.00006 | @@ -295,16 +295,18 @@
lear_db,
+ %5C
%0A _cl
@@ -2467,16 +2467,36 @@
atasets,
+ %22queries%22: queries,
%0A
@@ -2536,36 +2536,16 @@
datasets
-, %22queries%22: queries
%7D%0A qu
@@ -3326,28 +3326,24 @@
ar_cache)))%0A
-
return o
|
8e6eeed681ab35bb771e17fce2c5901681a2ca2d | simplify guage delta code | bucky/statsd.py | bucky/statsd.py | # -*- coding: utf-8 -
#
# 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
... | Python | 0.707447 | @@ -4986,89 +4986,36 @@
if
-key not in self.gauges:%0A self.gauges%5Bkey%5D = 0%0A if delta
+delta and key in self.gauges
:%0A
|
c300192f08edfecf843e00a8076cff97010e5fd5 | Add some docstring. | Shift_pygame/Shift_pygame/utils/basic.py | Shift_pygame/Shift_pygame/utils/basic.py | #! /usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
__author__ = 'fyabc'
def error(msg, *args, **kwargs):
print(msg, *args, **kwargs, file=sys.stderr)
def sign(x):
return 1 if x > 0 else (-1 if x < 0 else 1)
_comment_pattern = re.compile(r'#.*?\n')
def strip_line(line):
return _comment... | Python | 0.000001 | @@ -290,24 +290,83 @@
line(line):%0A
+ %22%22%22Remove comments (Start with '#') from the line.%22%22%22%0A%0A
return _
@@ -431,24 +431,111 @@
ault=None):%0A
+ %22%22%22Get the i-th element of the list l. If not exist, return the default value.%22%22%22%0A%0A
try:%0A
|
876cbb786929f3eb18500faa960a3970bc252e2b | allow authproxy requests with double slash in URL (/tiles//layername) | app/gbi_server/authproxy/blueprint.py | app/gbi_server/authproxy/blueprint.py | # This file is part of the GBI project.
# Copyright (C) 2013 Omniscale GmbH & Co. KG <http://omniscale.com>
#
# 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/licens... | Python | 0 | @@ -1861,24 +1861,133 @@
', 'POST'%5D)%0A
+@authproxy.route('/authproxy/%3Cstring:user_token%3E/tiles//%3Cstring:layer%3E/%3Cpath:url%3E', methods=%5B'GET', 'POST'%5D)%0A
def tile_pro
|
df95f72566d0b01be27342f0da42980d3d8a1b60 | Remove unused DefaultRouter in retina_api.urls | app/grandchallenge/retina_api/urls.py | app/grandchallenge/retina_api/urls.py | from django.urls import path, include
from rest_framework.routers import DefaultRouter, SimpleRouter
from grandchallenge.retina_api import views
from django.views.decorators.cache import cache_page
from django.conf import settings
app_name = "retina_api"
router = DefaultRouter()
annotation_router = SimpleRouter()
an... | Python | 0 | @@ -254,34 +254,8 @@
i%22%0A%0A
-router = DefaultRouter()%0A%0A
anno
@@ -572,44 +572,8 @@
= %5B%0A
- path(%22%22, include(router.urls)),%0A
|
c1e7ff32956d003800c113907309f56096d0be41 | set interval int on scheduler minute | bin/scheduler.py | bin/scheduler.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from gevent import monkey
monkey.patch_all()
import time
import schedule
from bottle.ext.mongo import MongoPlugin
from settings import ADMIN_BUCKET_NAME, MONGO_URI
from bin.mining import run
def job(slug):
run(slug)
def rules(cube):
scheduler_type = cube.get(... | Python | 0.000001 | @@ -466,16 +466,20 @@
e.every(
+int(
schedule
@@ -489,16 +489,17 @@
nterval)
+)
.minutes
@@ -635,16 +635,46 @@
y().day%0A
+ else:%0A return None%0A
t.do
|
ea5fd30a583016b4dc858848e28168ada74deca3 | Check in fix for py3k and urlparse. | blaze/py3help.py | blaze/py3help.py | import sys
import itertools
PY3 = sys.version_info[:2] >= (3,0)
if PY3:
def dict_iteritems(d):
return d.items().__iter__()
xrange = range
_inttypes = (int,)
_strtypes = (str,)
unicode = str
imap = map
basestring = str
import urllib
urlparse = urllib.parse
else:
import _... | Python | 0 | @@ -270,31 +270,21 @@
llib
-%0A url
+.
parse
-=
+as
url
-lib.
pars
|
fefe0b3394de8b817236419b271e7c3d5df053e5 | Implement logic functions to fetch projects for given mentor, co-mentors and for orgs listed. | app/soc/modules/gsoc/logic/project.py | app/soc/modules/gsoc/logic/project.py | #!/usr/bin/env python2.5
#
# Copyright 2011 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | Python | 0.0003 | @@ -3808,28 +3808,1002 @@
nt)%0A return q.fetch(limit)%0A
+%0A%0Adef getProjectsForOrgs(orgs, limit=1000):%0A %22%22%22Returns all the projects for the given organization(s).%0A%0A Unlike getAcceptedProjectsForOrg function, this returns all the projects%0A for all the orgs listed%0A%0A Args:%0A org: The organi... |
5d40bdeb1b95c051d0655595846acd91cff6160f | Bump version | botan_version.py | botan_version.py |
release_major = 1
release_minor = 11
release_patch = 6
release_so_abi_rev = release_patch
# These are set by the distribution script
release_vc_rev = None
release_datestamp = 0
release_type = 'unreleased'
| Python | 0 | @@ -51,9 +51,9 @@
h =
-6
+7
%0Arel
|
7205fa3fca6b31467e35a4472aa900ec75db6caf | Solve No.158 by python | 158.py | 158.py | Python | 0.999999 | @@ -0,0 +1,524 @@
+class Solution:%0A %22%22%22%0A @param s: The first string%0A @param b: The second string%0A @return true or false%0A %22%22%22%0A def anagram(self, s, t):%0A%0A def hashLize(s):%0A dicts1= dict()%0A for j in s:%0A if j in dicts1.keys():%0... | |
720db850c0bd57b58598e4a7a54d463267b28ce3 | Use default value for comments metadata | src/zeit/cms/content/metadata.py | src/zeit/cms/content/metadata.py | import zeit.cms.content.dav
import zeit.cms.content.interfaces
import zeit.cms.content.property
import zeit.cms.content.reference
import zeit.cms.content.xmlsupport
import zeit.cms.tagging.tag
import zope.interface
class CommonMetadata(zeit.cms.content.xmlsupport.XMLContentBase):
zope.interface.implements(
... | Python | 0 | @@ -2955,16 +2955,42 @@
omments'
+,%0A use_default=True
)%0A%0A c
@@ -3190,16 +3190,42 @@
tthread'
+,%0A use_default=True
)%0A%0A d
|
31db37732b8fdf783ec4d2b6ef54d9a309aa69a4 | Add file to default upgrade list. | src/encoded/commands/upgrade.py | src/encoded/commands/upgrade.py | """\
Run this to upgrade the site.
Examples
To update on the production server:
%(prog)s production.ini
For the development.ini you must supply the paster app name:
%(prog)s development.ini --app-name app
"""
from contextlib import contextmanager
import logging
EPILOG = __doc__
logger = logging.getLogge... | Python | 0 | @@ -351,16 +351,28 @@
ONS = %5B%0A
+ 'file',%0A
%5D%0A%0A%0Adef
|
cbcf0d1c57751844ca3c6b908fdb7cd6a33484b8 | Change length() to len() | src/app.py | src/app.py | from flask import Flask, render_template, request, redirect, url_for, session, flash
import psycopg2, sys, os, datetime
from config import *
# Instantiate App
app = Flask(__name__)
app.secret_key = APP_SECRET_KEY
# Database Query Function
def db_query(sql_string, data_array):
conn = psycopg2.connect(DB_LOCATION)
... | Python | 0.999903 | @@ -495,11 +495,8 @@
.len
-gth
() !
|
239dba89e8cb933fe8950412eeaea3ca4caa92bd | remove all instances | src/app.py | src/app.py | __author__ = 'Fredrik A. Madsen-Malmo'
from flask import Flask, flash, render_template, g
import models
import forms
import os
DEBUG = True
PORT = port = int(os.environ.get('PORT', 33507))
HOST = '0.0.0.0'
app = Flask(__name__)
app.secret_key = os.environ.get('secret_key', 'error')
# Before and after request
@ap... | Python | 1 | @@ -1585,88 +1585,24 @@
try.
-create(%0A name='fotoply',%0A ip='93.184.204.215',%0A port='7077'
+select().delete(
)%0A%0A
|
fb92397662d0b25cbaef6afe23f6745e734b137e | add a log msg | src/bot.py | src/bot.py | #!/usr/bin/env python
# =============================================================================
# file = bot.py
# description = IRC bot
# author = GR <https://github.com/shortdudey123>
# create_date = 2014-07-09
# mod_date = 2014-07-09
# version = 0.1
# usage = called as a class
# notes =
# python_ver = 2.7.6
# =... | Python | 0.000017 | @@ -4602,32 +4602,116 @@
one%0A %22%22%22%0A
+ self.log(%22Parsing bot message: %7B0%7D %7B1%7D %7B2%7D%22.format(channel, message, nick))%0A
self.bot
|
7a0c87ae0cca03bb13f105ecbc385ab85ef80dd2 | Fix Alu again | alu.py | alu.py | import translator
#nand gate
def nand(a, b):
a = translator.com2s2bin(a)
b = translator.com2s2bin(b)
result = ""
for i in range(0,32):
if (not (a[i] and b[i])):
result+='1'
else:
result+='0'
return int(result, 2)
#adder
def add(a, b):
return a+b
#get zero bit
def equal(a, b):
re... | Python | 0 | @@ -147,17 +147,16 @@
%0A if
-(
not (a%5Bi
@@ -156,16 +156,21 @@
ot (a%5Bi%5D
+=='1'
and b%5Bi
@@ -170,17 +170,21 @@
and b%5Bi%5D
-)
+=='1'
):%0A
@@ -238,21 +238,35 @@
urn
-int
+translator.bin2com2s
(result
-, 2
)%0A%0A#
|
6304dee5624c3bfb6b481a2d4e7b486c742d71bd | remove the useless code to reduce the complexity | binding/python/multiverso/api.py | binding/python/multiverso/api.py | #!/usr/bin/env python
# coding:utf8
import ctypes
from utils import Loader
import numpy as np
mv_lib = Loader.get_lib()
WORKER_ID = None
def init(args=[]):
'''Initialize mutliverso.
This should be called only once before training at the beginning of the
whole project.
'''
n = len(args)
arg... | Python | 0.000141 | @@ -121,25 +121,8 @@
()%0A%0A
-WORKER_ID = None%0A
%0Adef
@@ -960,123 +960,35 @@
-global WORKER_ID%0A if WORKER_ID is None:%0A # %0A WORKER_ID = mv_lib.MV_WorkerId()%0A return WORKER_ID
+return mv_lib.MV_WorkerId()
%0A%0A%0Ad
@@ -1036,16 +1036,17 @@
erId()%0A%0A
+%0A
def is_m
|
4795c58f3cfacb20e3b991fec7b78d59a8dcabff | Use SO_REUSEADDR to avoid errors on quick restart. | examples/unix/sock-server.py | examples/unix/sock-server.py | try:
import rawsocket as socket
except:
import socket
CONTENT = """\
HTTP/1.0 200 OK
Hello #{} from MicroPython!
"""
s = socket.socket()
ai = socket.getaddrinfo("127.0.0.1", 8080)
print("Bind address info:", ai)
addr = ai[0][4]
s.bind(addr)
s.listen(5)
print("Listening, connect your browser to http://127.... | Python | 0 | @@ -235,16 +235,72 @@
%5B0%5D%5B4%5D%0A%0A
+s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)%0A
s.bind(a
|
1ac679e73c60be1d4ad625a9e3081c3c77e13e80 | fix virtual_machine_power_cycle sample description | samples/virtual_machine_power_cycle.py | samples/virtual_machine_power_cycle.py | #!/usr/bin/env python
# Copyright (c) 2008-2013 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | Python | 0 | @@ -37,15 +37,10 @@
) 20
-08-2013
+14
VMw
@@ -645,38 +645,39 @@
for
-changing the name of an object
+power cycling a virtual machine
. De
@@ -727,16 +727,95 @@
ous way.
+ And how to answer virtual machine%0Aquestions in the middle of power operations.
%0A%22%22%22%0A%0Aim
|
1ee752afd07ac1005412d450915d5ef69218b1f7 | Allow for specifying the transform function as a file. | exoline/plugins/transform.py | exoline/plugins/transform.py | # -*- coding: utf-8 -*-
'''Transform data on in a dataport by mapping all values (alpha)
Usage:
exo [options] transform <cik> <rid> <func>
Command Options:
--cma Save data to cvs files just in case.
--dry Does not flush or record back data.
--start=<time>
--end=<time> start ... | Python | 0 | @@ -1119,16 +1119,459 @@
)*5/9'%0A%0A
+ To do more complex things, you can specify a file to use for the%0A transform function. '@%3Cfilename%3E' will import a python module of%0A filename. This module needs to have a method at the top level named%0A 'tr'%0A%0A For example, if the following python is i... |
20a65d3557dfd6c8606c9960c1c7895535c20b98 | Fix error with app_enabled. Closes #836 | satchmo/apps/satchmo_utils/__init__.py | satchmo/apps/satchmo_utils/__init__.py | try:
from decimal import Decimal, ROUND_HALF_UP, InvalidOperation
except:
from django.utils._decimal import Decimal, ROUND_HALF_UP, InvalidOperation
from django.conf import settings
from django.db import models
import datetime
import logging
import os
import random
import sys
import types
log = logging.getLog... | Python | 0.000004 | @@ -188,37 +188,8 @@
ngs%0A
-from django.db import models%0A
impo
@@ -761,24 +761,62 @@
stalled.%22%22%22%0A
+ from django.db import models%0A %0A
all_apps
|
b38aae9df0b77d6178fa5a7795e6a38c4e179ea8 | Change flask portexit | app.py | app.py | #!/usr/bin/env python
from pymongo import MongoClient
import os
from flask import Flask, render_template, request
from bson.objectid import ObjectId
import json
app = Flask(__name__)
client = MongoClient()
db = client.fullcalendar_test
@app.route('/calendarRead', methods=['POST'])
def calendarRead():
custom_att... | Python | 0.000001 | @@ -153,16 +153,42 @@
ort json
+%0Afrom datetime%0A%0Aimport pdb
%0A%0Aapp =
@@ -385,24 +385,170 @@
e'%5D%0A
-%0A start = int
+ # pdb.set_trace()%0A # format start/end as ms since epoch%0A date_to_ms = lambda d: datetime.date.strptime(d, '%25Y-%25m-%25d').timestamp()%0A start = date_to_ms
(req
@@ -5... |
0a8c80dc522f6855aad3b0b691c12e172f49725a | Tweak string cleaning in tests | services/tests/test_services_import.py | services/tests/test_services_import.py | from hypothesis import given, settings
from hypothesis.strategies import lists
import pytest
from rest_framework.test import APIClient
from rest_framework.reverse import reverse
# from services.management.commands.services_import.services import import_services
from services.management.commands.services_import.organiz... | Python | 0 | @@ -2176,16 +2176,37 @@
0', ' ')
+.replace('%5C%5Cr', '%5Cn')
%0A%0A
|
1dc28f250a0323acf456bf4f85731625b80670ac | Switch to webracer | app.py | app.py | import flask
import urllib
import re
import cgi
import xml.sax.saxutils
import curlfe
app = flask.Flask(__name__)
#app.debug = True
def replace(match):
url = match.group(1)
url = xml.sax.saxutils.unescape(url)
url = url[:url.find('&')]
#url = url[:url.find('&')]
url = urllib.unquote(url)
#... | Python | 0.000001 | @@ -72,22 +72,32 @@
%0Aimport
-curlfe
+webracer.session
%0A%0Aapp =
@@ -770,27 +770,58 @@
-fe = curlfe.CurlFe(
+ua = webracer.session.Session(use_cookie_jar=False
)%0A
@@ -932,24 +932,25 @@
ython 2%0A
+#
url = url.en
@@ -970,31 +970,50 @@
-content = fe.fetch(url)
+ua.get(url)%0A content = ua... |
4b9f40dea7c8aaa45e174c7f4371cec543dcf26d | Make captcha required | app.py | app.py | #!/bin/env python
from flask import Flask, request, render_template, flash, redirect, url_for
from flask.ext.sqlalchemy import SQLAlchemy
from wtforms import Form, TextField, validators
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db'
app.config['SECRET_KEY'] = 'foobar'
db = SQLA... | Python | 0.000019 | @@ -1540,16 +1540,33 @@
dators=%5B
+%0A
validato
@@ -1593,16 +1593,68 @@
berlin')
+,%0A validators.Required()%0A
%5D%0A )%0A
|
0cd497d6880466d28e631b7db3fc153c61383e08 | REmove unused code | bluebottle/events/serializers.py | bluebottle/events/serializers.py | from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from rest_framework.validators import UniqueTogetherValidator
from rest_framework_json_api.relations import ResourceRelatedField
from bluebottle.activities.utils import (
BaseActivitySerializer, BaseContributionSerialize... | Python | 0.000001 | @@ -2040,66 +2040,8 @@
,))%0A
- # contributions = serializers.SerializerMethodField()%0A
|
0e7d62a1e5e5883e3a423c4a2c14b87301939022 | Support apps with container = null | app.py | app.py | #!/usr/bin/env python
"""Generate HAProxy configuration (using Marathon as a data source)"""
import logging
import os
import re
import sys
import jinja2
import kazoo.client
import requests
import sseclient
# These are the marathon events that we want to pay attention to.
SIGNIFICANT = [
'failed_health_check_eve... | Python | 0.000004 | @@ -956,16 +956,83 @@
'app'%5D%0A%0A
+ if app%5B'container'%5D is None:%0A continue%0A%0A
|
366371957a01a564c1860313ca04d484caf89fc1 | Create app.py | app.py | app.py | #!/usr/bin/env python
from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTPError
import json
import os
from flask import Flask
from flask impor... | Python | 0.000003 | @@ -1405,19 +1405,16 @@
n None%0A%0A
-
def mak
@@ -1435,24 +1435,29 @@
(data):%0A
+
articles
1 = data
@@ -1448,17 +1448,16 @@
articles
-1
= data.
@@ -1472,16 +1472,21 @@
icles')%0A
+
if artic
@@ -1521,16 +1521,17 @@
%7B%7D%0A%0A
+
author =
@@ -1554,16 +1554,17 @@
uthor')%0A
+
if a
|
df3d7897d71cd7349934c215c39468630c703ebd | Add help. | app.py | app.py | # coding: utf-8
from datetime import datetime
from flask import Flask
from flask import render_template, request
import logging
import telegram
app = Flask(__name__)
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
bot_name = '@DrakeetLoveBo... | Python | 0 | @@ -983,16 +983,62 @@
essage)%0A
+ if '/help' in text:%0A help(message)%0A
%0A%0Adef pa
@@ -1963,28 +1963,232 @@
chat_id=chat_id, text=text)%0A
+%0A%0Adef help(message):%0A text = %22%22%22%0A /echo - repeat the same message back%0A /milestone - Get drakeet's milestone%0A %22%22%22%0A chat_i... |
05a999bd7631da5559b2fece9709132448c030ac | remove traceback decoding | app.py | app.py | #! /usr/bin/env python3
# coding: utf-8
import sys
from os import path
from functools import partial
import os
from pprint import pprint
import traceback
import dropbox
import config
import image_processing
folder_names = {
1: "01 (Januar)",
2: "02 (Februar)",
3: "03 (Mars)",
4: "04 (April)",
... | Python | 0.000059 | @@ -4717,22 +4717,16 @@
-print(
tracebac
@@ -4731,57 +4731,19 @@
ack.
-forma
+prin
t_exc()
-.decode(sys.getfilesystemencoding()))
%0A%0A%0Ai
|
60820804840e7c4bbb9049aedfbb67a5beecfe53 | use patch for updates as in other apps | scheduler/client.py | scheduler/client.py |
"""
Client for Messaging Content Store HTTP services APIs.
"""
import requests
import json
class SchedulerApiClient(object):
"""
Client for Scheduler API.
:param str api_token:
An API Token.
:param str api_url:
The full URL of the API. Defaults to
``http://seed-scheduler/... | Python | 0 | @@ -1148,18 +1148,20 @@
'p
-ut
+atch
': self.
@@ -1161,35 +1161,36 @@
: self.session.p
-ost
+atch
,%0A 'd
@@ -1868,18 +1868,20 @@
ule', 'p
-ut
+atch
', obj=s
|
608876d2cd66ee3ab48057353edf8e5f88b64f16 | fix artemis dockerfile | factories/navitia_artemis.py | factories/navitia_artemis.py | # encoding: utf-8
def absjoin(*p):
return os.path.abspath(os.path.join(*p))
import os.path
ROOT = absjoin(__file__, '..', '..', '..')
import sys
import time
sys.path[0] = ROOT
from clingon import clingon
clingon.DEBUG = True
from navitia_docker_manager import DIM, FFD, utils
Dockerfile = """
FROM navitia/debi... | Python | 0.000293 | @@ -325,16 +325,20 @@
latest%0A%0A
+RUN
pip inst
|
c9606a1d62df63b3b1b83b598efeb628d3428e20 | Bump to v0.10.1 | nutsurv/__init__.py | nutsurv/__init__.py | __version__ = '0.9.0'
__url__ = 'https://github.com/eHealthAfrica/eha-nutsurv-django'
| Python | 0.000001 | @@ -14,11 +14,12 @@
'0.
-9.0
+10.1
'%0A__
|
dd48377a84ba4ab4331bb9fafc9645d4dc11dadd | version updated; | vertest/__init__.py | vertest/__init__.py | __version__ = "$Format:%D$"
| Python | 0 | @@ -1,18 +1,92 @@
-__version__ =
+from param import Version%0A__version__ = Version(release=(1,0,0), fpath=__file__, commit=
%22$Fo
@@ -95,8 +95,31 @@
at:%25
-D$%22%0A
+h$%22, reponame=%22packagegit%22)
|
8b8754296a71e43315b3bb300770f2f621694bbb | add headers & load_profile support for converter | yandextank/version.py | yandextank/version.py | VERSION = '1.16.2'
| Python | 0 | @@ -13,7 +13,7 @@
.16.
-2
+3
'%0A
|
76693b4b2543d1ae5755bf64b9bee1bb008a166d | Fix some multipublisher bugs | zeeko/telemetry/tests/test_recorder.py | zeeko/telemetry/tests/test_recorder.py | import pytest
import numpy as np
import zmq
import itertools
from ..recorder import Recorder
from ...messages import array as array_api
from ...messages.publisher import Publisher
from .support import assert_chunk_array_allclose
from zeeko.conftest import assert_canrecv
@pytest.fixture
def notify(address2, context):
... | Python | 0.000003 | @@ -1999,32 +1999,36 @@
isher.framecount
+ + 1
%0A for key
@@ -3139,36 +3139,8 @@
er)%0A
- self.recv(recorder)%0A
@@ -3587,38 +3587,8 @@
er)%0A
- self.send(publisher2)%0A
@@ -3667,32 +3667,62 @@
ecorder.keys()%7D%0A
+ self.send(publisher2)%0A
self.rec
|
4a43cde46a0f12a9ad7681c63d9dea3918ac2013 | Update scripts version accordingly | scripts/__init__.py | scripts/__init__.py | """**Scripts** folder contains predefined scripts easy to use.
Scripts are only available im Pywikibot ist instaled in directory mode
and not as side package. They can be run in command line using the pwb
wrapper script::
python pwb.py <global options> <name_of_script> <options>
Every script provides a ``-help`... | Python | 0.000001 | @@ -1116,13 +1116,13 @@
__ = '6.
-2
+4
.0'%0A
|
a68e484487289ab9aa208b88884c7b6e5537bab2 | Add basic argparse support | doctr/__main__.py | doctr/__main__.py | import sys
import os
from .local import generate_GitHub_token, encrypt_variable
from .travis import setup_GitHub_push, commit_docs, push_docs
def main():
on_travis = os.environ.get("TRAVIS_JOB_NUMBER", '')
if on_travis:
# TODO: Get this automatically
repo = sys.argv[1]
if setup_GitHub... | Python | 0 | @@ -1,16 +1,100 @@
+%22%22%22%0Adoctr%0A%0AA tool to automatically deploy docs to GitHub pages from Travis CI.%0A%22%22%22%0A%0A
import sys%0Aimpor
@@ -97,16 +97,32 @@
mport os
+%0Aimport argparse
%0A%0Afrom .
@@ -240,21 +240,664 @@
ocs%0A
-%0Adef main():%0A
+from . import __version__%0A%0Adef main():%0A parser ... |
75e03a0ea08fe88d3baf054ade578dde60c181c1 | add shebang to db build script | scripts/build_db.py | scripts/build_db.py | import caffe
from recon import Reconstructor
def main():
'''
Usage:
build_db.py <net_id> <blob_names>... [--gpu <id>]
Options:
--gpu <id> The id of the GPU to use [default: -1]
'''
import docopt, textwrap
main_args = docopt.docopt(textwrap.dedent(main.__doc__))
net_id = m... | Python | 0 | @@ -1,12 +1,34 @@
+#!/usr/bin/env python%0A
import caffe
|
cdf3f9730d2f70c3d516c34da9db7009a3ba110f | Allow evaluation of demos that are not in the format 'env_agent.pkl' | scripts/evaluate.py | scripts/evaluate.py | #!/usr/bin/env python3
import argparse
import gym
import time
import datetime
import babyai.utils as utils
from babyai.evaluate import evaluate
# Parse arguments
parser = argparse.ArgumentParser()
parser.add_argument("--env", required=True,
help="name of the environment to be run (REQUIRED)")
par... | Python | 0 | @@ -435,16 +435,27 @@
-origin
+or --demos
REQUIRED
@@ -601,16 +601,172 @@
--model
+or --demos REQUIRED)%22)%0Aparser.add_argument(%22--demos%22, default=None,%0A help=%22name of the demos file (REQUIRED or --demos-origin or --model
REQUIRED
@@ -1200,16 +1200,17 @@
gent%22)%0A%0A
+%0A
def ma... |
75dd54875802514d7e627d86228761963ed9bb9a | Convert errnos in io.tcp module | evergreen/io/tcp.py | evergreen/io/tcp.py | #
# This file is part of Evergreen. See the NOTICE for more information.
#
import pyuv
import evergreen
from evergreen.io.stream import BaseStream, StreamError, StreamConnection, StreamServer
from evergreen.io.util import Result
__all__ = ['TCPServer', 'TCPClient', 'TCPConnection', 'TCPError']
class TCPError(Strea... | Python | 0.003307 | @@ -223,17 +223,32 @@
t Result
+, convert_errno
%0A
-
%0A__all__
@@ -1093,32 +1093,46 @@
raise TCPError(
+convert_errno(
e.args%5B0%5D, e.arg
@@ -1116,32 +1116,33 @@
_errno(e.args%5B0%5D
+)
, e.args%5B1%5D)%0A
@@ -1636,32 +1636,46 @@
raise TCPError(
+convert_errno(
e.args%5B0%5D, e.arg
@@ -1659,32 +1659,3... |
05b2848849553172873600ffd6344fc2b1f12d8e | Substitute a more realistic jurisdiction_id | example/__init__.py | example/__init__.py | from pupa.scrape import Jurisdiction
from .people import PersonScraper
class Example(Jurisdiction):
jurisdiction_id = 'ex'
def get_metadata(self):
return {
'name': 'Example',
'legislature_name': 'Example Legislature',
'legislature_url': 'http://example.com',
... | Python | 0.999999 | @@ -119,18 +119,66 @@
n_id = '
+ocd-jurisdiction/country:us/state:ex/place:exampl
e
-x
'%0A%0A d
|
015650a95fc61486aee721529ec77da316ac7e95 | Fix typo | finance/settings/__init__.py | finance/settings/__init__.py | """
Django settings for finance project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
from django.co... | Python | 0.999999 | @@ -581,17 +581,17 @@
is) is
-i
+o
ne folde
|
392e43d952deebe5c75244359e16bfcd293e21ef | Optimize apply_templates | example/crfutils.py | example/crfutils.py | """
A miscellaneous utility for sequential labeling.
Copyright 2010,2011 Naoaki Okazaki.
"""
import optparse
import sys
def apply_templates(X, templates):
"""
Generate features for an item sequence by applying feature templates.
A feature template consists of a tuple of (name, offset) pairs,
where nam... | Python | 0.000001 | @@ -667,32 +667,107 @@
mplate.%0A %22%22%22%0A
+ %0A x_range = list(range(len(X)))%0A x_range_set = set(x_range)%0A %0A
for template
@@ -777,24 +777,24 @@
templates:%0A
-
name
@@ -860,37 +860,31 @@
for t in
+x_
range
-(len(X))
:%0A
@@ -995,37 +995,35 @@
if p not in
+x_... |
06c5db13c706901b24a5f829a24f79389ee2bcc5 | Use parameter "preserve_lines" in make_VFS.py | scripts/make_VFS.py | scripts/make_VFS.py | # -*- coding: utf-8 -*-
import json
import os
import javascript_minifier
import python_minifier
try:
import io as StringIO
except ImportError:
import cStringIO as StringIO # lint:ok
###############################################################################
def process_unittest(filename):
"""Pro... | Python | 0.000002 | @@ -4399,16 +4399,37 @@
fy(_data
+, preserve_lines=True
)%0A%0A
|
f136e140a57078c4f0f665051df74dffb1351f33 | fix loading in run_goal_conditioned_policy.py | scripts/run_goal_conditioned_policy.py | scripts/run_goal_conditioned_policy.py | import argparse
import pickle
from rlkit.core import logger
from rlkit.samplers.rollout_functions import multitask_rollout
from rlkit.torch import pytorch_util as ptu
from rlkit.envs.vae_wrapper import VAEWrappedEnv
def simulate_policy(args):
data = pickle.load(open(args.file, "rb"))
policy = data['evaluatio... | Python | 0.000002 | @@ -16,22 +16,21 @@
%0Aimport
-pickle
+torch
%0A%0Afrom r
@@ -253,25 +253,19 @@
a =
-pickle
+torch
.load(
-open(
args
@@ -273,15 +273,8 @@
file
-, %22rb%22)
)%0A
|
1ffca2e52707bbffe0dfac1c2cd6e9da97540802 | Fix for resolve's inability to handle filenames > 74 characters | scripts/phenixer.py | scripts/phenixer.py | '''
Created on 5 Mar 2014
@author: jmht
'''
import os
import sys
sys.path.append("/opt/ample-dev1/python")
import ample_util
def generateMap( mtz, pdb, FP='FP', SIGFP='SIGFP', FREE='FREE', directory=None ):
"""Generate a map from an mtz file and a pdb using reforigin"""
assert os.path.isfile( mtz ) and... | Python | 0 | @@ -49,16 +49,30 @@
port os%0A
+import shutil%0A
import s
@@ -1262,24 +1262,479 @@
map%22%22%22%0A %0A
+ # resolve can only handle file names %3C 75 characters so we need to truncate%0A # We copy the file rather than symlink so that this works on windows and then delete afterwards%0A tempnam=None%0A i... |
3298fff0ded49c21897a7387a7f3093c351ae04f | Use os.exelp to launch psql | scripts/run_psql.py | scripts/run_psql.py | #!/usr/bin/env python
# Copyright (C) 2011 Lukas Lalinsky
# Distributed under the MIT license, see the LICENSE file for details.
from acoustid.script import run_script
import subprocess
def main(script, opts, args):
subprocess.call(['psql'] + script.config.database.create_psql_args())
run_script(main)
| Python | 0 | @@ -170,25 +170,17 @@
%0Aimport
-subproces
+o
s%0A%0A%0Adef
@@ -213,35 +213,35 @@
-subprocess.call(%5B'psql'%5D +
+os.execlp('psql', 'psql', *
scri
|
05e9b7a3cf9dd46a599b9cc0d7b7944c01b5104f | remove FIXME now selenium test is working | selenium_tests/test_user_accounting.py | selenium_tests/test_user_accounting.py | from selenium_tests.AdminDriverTest import AdminDriverTest
from selenium.webdriver.common.by import By
import os
class TestUserAccounting(AdminDriverTest):
def test_create_new_entry_button(self):
self.click_first_element_located(By.LINK_TEXT, "Users")
self.click_first_button("Create New Entry")
... | Python | 0 | @@ -791,472 +791,8 @@
%22)%0A%0A
- # FIXME: This test is currently broken, since it will report that the%0A # %22Remove%22 button is obstructed in the browser (although it is not in%0A # the deployment). It seems to be a selenium issue, which may have been%0A # previously suppressed by d... |
a3a35f3a967a8a875d64bad34193ab4198abd875 | Update python script to use date time objects directly to schedule things. Partially completed. | scripts/schedule.py | scripts/schedule.py | from datetime import date
from dateutil.rrule import rrule, DAILY
class ClassName(object):
"""docstring for """
def __init__(self, arg):
super(, self).__init__()
self.arg = arg
ScheduleMaker(object):
"""docstring for ScheduleMaker"""
def __init__(self, ip_file, start_date, end_... | Python | 0 | @@ -1,16 +1,41 @@
+import random, fileinput%0A
from datetime im
@@ -43,16 +43,32 @@
ort date
+time, date, time
%0Afrom da
@@ -105,151 +105,14 @@
LY%0A%0A
+%0A
class
- ClassName(object):%0A %22%22%22docstring for %22%22%22%0A def __init__(self, arg):%0A super(, self).__init__()%0A self.arg = arg... |
1d5d94a673a57109f6a687ca7dec8f12f2062120 | Change default in learners to auto-apply | Orange/widgets/utils/owlearnerwidget.py | Orange/widgets/utils/owlearnerwidget.py | import numpy as np
from PyQt4.QtCore import QTimer
from Orange.classification.base_classification import LearnerClassification
from Orange.data import Table
from Orange.preprocess.preprocess import Preprocess
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from Orange.widgets.utils.sql impor... | Python | 0 | @@ -3354,20 +3354,19 @@
Setting(
-Fals
+Tru
e)%0A%0A
|
5de304b53e5494fc47b157e52603d8bd36cda93b | Add boolean value alongside the boolean field name in icon label | flask_admin/model/typefmt.py | flask_admin/model/typefmt.py | import json
from markupsafe import Markup
from flask_admin._compat import text_type
try:
from enum import Enum
except ImportError:
Enum = None
def null_formatter(view, value, name):
"""
Return `NULL` as the string for `None` value
:param value:
Value to check
"""
retu... | Python | 0.000003 | @@ -794,16 +794,70 @@
circle'%0A
+ label = f'%7Bname%7D: %7B%22true%22 if value else %22false%22%7D'%0A
retu
@@ -959,20 +959,21 @@
glyph,
-name
+label
))%0A%0A%0Adef
|
63bcd91df2b36bede393bbf9668114354c494f99 | Update urltools.py | flask_appbuilder/urltools.py | flask_appbuilder/urltools.py |
def get_group_by_args():
"""
Get page arguments for group by
"""
group_by = request.args.get('group_by')
if not group_by: group_by = ''
return group_by
def get_page_args():
"""
Get page arguments, returns a dictionary
{ <VIEW_NAME>: PAGE_NUMBER }
Arguments ... | Python | 0.000001 | @@ -1,16 +1,51 @@
+from flask import url_for, request%0A
%0Adef get_group_b
|
8a14abaa1e74a5a0e18c3ab53a0eb5f417efd7f3 | Fix failing test | flask_security/decorators.py | flask_security/decorators.py | # -*- coding: utf-8 -*-
"""
flask_security.decorators
~~~~~~~~~~~~~~~~~~~~~~~~~
Flask-Security decorators module
:copyright: (c) 2012 by Matt Wright.
:license: MIT, see LICENSE for more details.
"""
from collections import namedtuple
from functools import wraps
from flask import current_app, Res... | Python | 0.000209 | @@ -5153,24 +5153,33 @@
ed_response(
+headers=h
)%0A re
|
0355d4233f74ca585c92e34b2547d185a2a3d5fc | Update __init__.py | selfies/__init__.py | selfies/__init__.py | #!/usr/bin/env python
"""
SELFIES: a robust representation of semantically constrained graphs with an
example application in chemistry.
SELFIES (SELF-referencIng Embedded Strings) is a general-purpose,
sequence-based, robust representation of semantically constrained graphs.
It is based on a Chomsky type-2 g... | Python | 0.000072 | @@ -986,17 +986,17 @@
= %221.0.
-1
+3
%22%0A%0A__all
|
b2e5e23324a03988a21045a409560572d5c67019 | check command now displays the path of config file it is checking | flexget/plugins/cli/check.py | flexget/plugins/cli/check.py | from __future__ import unicode_literals, division, absolute_import
import codecs
import logging
from flexget import options
from flexget.event import event
log = logging.getLogger('check')
@event('manager.before_config_load')
def pre_check_config(manager):
"""Checks configuration file for common mistakes that a... | Python | 0 | @@ -384,16 +384,84 @@
check':%0A
+ log.info('Checking config file %60%25s%60' %25 manager.config_path)%0A
|
28c8f6452383e8327918c215dab6bcbcafda5029 | Update ml_restore.py | forest-restore/ml_restore.py | forest-restore/ml_restore.py | from multiprocessing import Pool
from requests.auth import HTTPDigestAuth
import optparse
import requests
import ConfigParser
import logging
# Command line argument parsing
parser = optparse.OptionParser()
parser.add_option("-c","--config-file", dest="configfile", action="store", help="Specify the config file")
parser... | Python | 0.000003 | @@ -134,17 +134,18 @@
logging%0A
+
%0A
-
# Comman
@@ -483,16 +483,37 @@
lp=%22Spec
+ify the user password
%22)%0Aparse
@@ -733,17 +733,18 @@
gging%22)%0A
+
%0A
-
options,
@@ -771,17 +771,18 @@
_args()%0A
+
%0A
-
# loggin
@@ -992,17 +992,18 @@
g.INFO)%0A
+
%0A
-
link = %22
@@ -1051,17 +1051,18 @@
figs... |
18cebc4a42512d371c03e6189400a4e332e5a2e2 | Update test_plots.py | bokeh/models/tests/test_plots.py | bokeh/models/tests/test_plots.py | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2015, Continuum Analytics, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#----------------------------------------... | Python | 0.000004 | @@ -538,24 +538,8 @@
ge1d
-, PolyAnnotation
%0Afro
|
62f750279376d8783d5a93b2d0f6b60223f034fd | add form fill method to auto fill form with datas | oct/core/generic.py | oct/core/generic.py | import csv
import ConfigParser
import os
from mechanize import Browser
from Queue import Queue
import requests
from threading import Thread
import cookielib
from bs4 import BeautifulSoup
from exceptions import OctGenericException
from mechanize import FormNotFoundError
import time
import urllib2
class GenericTransact... | Python | 0 | @@ -6994,16 +6994,301 @@
ame'%5D)%0A%0A
+ def fill_form(self, form_data):%0A %22%22%22%0A Fill the form selected in self.br with form_data dict%0A%0A :param form_data: dict containing the data%0A :type form_data: dict%0A %22%22%22%0A for key, data in form_data.iteritems():%... |
1f6af4efe674a1891f067af94246cc7e3800889b | 版本号:0.0.6 增加 @cache | vxUtils/__init__.py | vxUtils/__init__.py | # endcoding = utf-8
'''
author :
email :
'''
__author__ = 'vex1023'
__email__ = 'vex1023@qq.com'
__version__ = '0.0.5'
__homepages__ = 'https://github.com/vex1023/vxUtils'
__logger__ = 'vxQuant.vxUtils'
from PrettyLogger import *
| Python | 0 | @@ -116,9 +116,9 @@
0.0.
-5
+6
'%0A__
|
1bb5dd78b55ce085956774c828b573d0e5c63df9 | fix comment typo | armstrong/core/arm_sections/models.py | armstrong/core/arm_sections/models.py | from django.core.exceptions import ImproperlyConfigured
from django.db import models
from mptt.models import MPTTModel
from mptt.managers import TreeManager
from mptt.fields import TreeForeignKey
from armstrong.utils.backends import GenericBackend
from .utils import get_section_many_to_many_relations
__BACKEND_MODUL... | Python | 0.000031 | @@ -1937,17 +1937,17 @@
ield
+ or
,%0A
-or
if y
|
d5563c097f0a738ccc7df4e096318ddef9a979f4 | Increase queue job timeout | engine/web_api.py | engine/web_api.py | #! /usr/bin/env python
from flask import Flask, make_response, request
from rq import Queue
from load_redis import configure_redis
from jobs import aggregate
import os
import json
import logging
app = Flask(__name__)
env = os.getenv('FLASK_ENV', 'production')
#30 mins - http://python-rq.org/docs/results/
q = Queue('d... | Python | 0.000001 | @@ -371,18 +371,19 @@
timeout=
-72
+144
00)%0Aapis
|
7c3c333bd7fada179b7fcd9cba08eefd7b3b42cf | check in parser sketch | bulbs/instant_articles/parser.py | bulbs/instant_articles/parser.py | class ContentTransformer(HTMLParser):
pass
class FacebookTransformer(ContentTransformer):
pass
| Python | 0 | @@ -3,98 +3,1398 @@
ass
-ContentTransformer(HTMLParser):%0A pass%0A%0A%0Aclass FacebookTransformer(ContentTransformer):%0A
+InstantArticleParser():%0A%0A def __init__(self, intermediate):%0A pass%0A%0A def generate_body(self, intermediate):%0A body = %22%22%0A for key, body in intermedia... |
8bdc7de7a799b9a11ec3b936584f4d3581fd03a7 | refactor is_active | bulbs/special_coverage/models.py | bulbs/special_coverage/models.py | from django.conf import settings
from django.core.exceptions import ValidationError
from django.db.models.signals import pre_delete
from django.db import models
from django.template.defaultfilters import slugify
from elasticsearch import Elasticsearch
from json_field import JSONField
from bulbs.content.custom_search ... | Python | 0.999997 | @@ -5999,16 +5999,24 @@
date
- and not
+:%0A if
sel
@@ -6031,32 +6031,36 @@
te:%0A
+
+
return self.star
@@ -6076,57 +6076,47 @@
now
-%0A elif self.start_date and self.end_date:%0A
+ %3C self.end_date%0A else:%0A
@@ -6152,32 +6152,16 @@
e %3C= now
- %3C self... |
f4403a1a780ec1fbbb14a32381af0e8b4eb18970 | fix download progress bar's percentage exceed 100% | caffe2/python/models/download.py | caffe2/python/models/download.py | ## @package download
# Module caffe2.python.models.download
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import os
import sys
import signal
import re
# Import urllib
try:
import urllib.error as u... | Python | 0.000007 | @@ -1936,21 +1936,31 @@
size +=
+len(data_
chunk
+)
%0A
|
10ce81ed374097009d710bb3cc8dcd70c1c3e2e4 | Update core.frameworks __init__.py | syft/core/frameworks/__init__.py | syft/core/frameworks/__init__.py | from . import torch
from . import tensorflow
from . import numpy
from . import encode
from . import pandas
__all__ = ["torch", "tensorflow", "numpy", "encode", "pandas"]
| Python | 0.000008 | @@ -1,22 +1,30 @@
from
-.
+syft.core
import torch%0Afr
@@ -24,88 +24,36 @@
orch
-%0Afrom . import tensorflow%0Afrom . import numpy%0Afrom . import encode%0Afrom . import
+, tensorflow, numpy, encode,
pan
|
64185e6890f4310a01755671a4d17238ec7ae6d2 | Add method for attach stars count to projects queryset. | taiga/projects/stars/services.py | taiga/projects/stars/services.py | from django.db.models import F
from django.db.transaction import atomic
from django.db.models.loading import get_model
from django.contrib.auth import get_user_model
from .models import Fan, Stars
def star(project, user):
"""Star a project for an user.
If the user has already starred the project nothing hap... | Python | 0 | @@ -2195,28 +2195,601 @@
=user_or_id)%0A%0A return qs%0A
+%0A%0Adef attach_startscount_to_queryset(queryset):%0A %22%22%22%0A Attach stars count to each object of projects queryset.%0A%0A Because of lazynes of starts objects creation, this makes%0A much simple and more efficient way to access to project... |
24151ca5d19c3743854cacf8bccb1709a7d46a87 | Format using formatting tool | gallery/models.py | gallery/models.py | from django.db import models
from django.urls import reverse
from dotmanca.storage import OverwriteStorage
class Gallery(models.Model):
name = models.CharField(max_length=50)
slug = models.SlugField(unique=True)
added_timestamp = models.DateTimeField(auto_now_add=True)
description = models.TextField(... | Python | 0.000001 | @@ -415,22 +415,22 @@
args = %7B
-'
+%22
slug
-'
+%22
: self.s
@@ -449,33 +449,33 @@
return reverse(
-'
+%22
gallery:gallery'
@@ -473,17 +473,17 @@
:gallery
-'
+%22
, kwargs
@@ -587,17 +587,17 @@
lural =
-'
+%22
gallerie
@@ -597,17 +597,17 @@
alleries
-'
+%22
%0A%0A%0Adef g
@@ -712,10 +712,10 @@
urn
-F'
... |
674f0dd2d4ba09ff3cceddff335427f67960cc0b | Remove obsolete model parameters | src/model_params.py | src/model_params.py | import argparse
from util import info
class ModelParams:
def __init__(self, args):
self.training_dataset = args.training or 'data/training.txt'
self.test_dataset = args.test or 'data/test.txt'
self.n_context = args.context_size
self.n_batch = args.batch_size
self.n_epoch ... | Python | 0.000033 | @@ -216,64 +216,18 @@
elf.
-n_context = args.context_size%0A self.n_batch
+batch_size
@@ -994,104 +994,16 @@
mode
-%0A self.c2w2w_weights = args.c2w2w_weights%0A self.validation_mode = args.validation_mode
+.upper()
%0A%0A
@@ -1042,16 +1042,22 @@
('Model
+hyper-
paramete
@@ -1112,75... |
c6208aa9886a709d76c0cbb810e554f5ca45c8bf | Fix pytest 4.0 problems | ccdproc/tests/pytest_fixtures.py | ccdproc/tests/pytest_fixtures.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import gzip
from tempfile import mkdtemp
import os
from shutil import rmtree
import numpy as np
import pytest
from astropy import units as u
from astropy.utils import NumpyRNGContext
from astropy.io import fits
from astropy.nddata import CCDData
# If a... | Python | 0.000002 | @@ -633,76 +633,104 @@
-try:%0A val = request.keywords%5Bkey%5D.args%5B0%5D%0A except KeyError
+m = request.node.get_closest_marker(key)%0A if m is not None:%0A return m.args%5B0%5D%0A else
:%0A
@@ -739,13 +739,14 @@
-val =
+return
DEF
@@ -760,23 +760,8 @@
ey%5D%0A
- return v... |
08eca76203eee2ddf2887c11d067e05b2c2d70f7 | Add allow-legacy-extension-manifests flag so that chrome can load v1 chromoting webapp | chrome/test/functional/chromoting/chromoting_base.py | chrome/test/functional/chromoting/chromoting_base.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Common imports, setup, etc for chromoting tests."""
import os
def _SetupPaths():
"""Add chrome/test/functional to sys.path for importing pyauto_f... | Python | 0.000007 | @@ -1046,17 +1046,16 @@
b%0A %22%22%22%0A
-%0A
def __
@@ -1356,16 +1356,60 @@
%22%22%22Add
+extra flags for chromoting testing%0A%0A Add
--allow-
@@ -1459,16 +1459,124 @@
ssfully.
+%0A Add --allow-legacy-extension-manifests so that chrome can load%0A chromoting webapp in v1 format.%0A
%22%22%22... |
b067b251c4d37ef9cf876a33b470733fce046807 | add settings dir to system path for wsgi | BAMA_Analytics/wsgi.py | BAMA_Analytics/wsgi.py | """
WSGI config for BAMA_Analytics project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "BAMA_Analytics.settings")
from... | Python | 0 | @@ -309,16 +309,208 @@
ings%22)%0A%0A
+paths = %5B%0A '/srv/django-projects/BAMA_Analytics',%0A '/srv/django-projects/BAMA_Analytics/BAMA_Analytics'%0A%5D%0A%0Afor path in paths:%0A if path not in sys.path:%0A sys.path.append(path)%0A%0A
from dja
|
aacb587ba875ba2a158e349b3191ead8adb9b515 | refactor to make single case type interface public | corehq/apps/userreports/app_manager.py | corehq/apps/userreports/app_manager.py | from corehq.apps.app_manager.util import ParentCasePropertyBuilder
from corehq.apps.userreports.models import DataSourceConfiguration
def get_case_data_sources(app):
"""
Returns a dict mapping case types to DataSourceConfiguration objects that have
the default set of case properties built in.
"""
... | Python | 0.000001 | @@ -313,36 +313,145 @@
%22%22%22%0A
-%0A
-def _get_config_for_typ
+return %7Bcase_type: get_case_data_source(app, case_type) for case_type in app.get_case_types() if case_type%7D%0A%0A%0Adef get_case_data_sourc
e(ap
@@ -469,20 +469,16 @@
e):%0A
-
-
def _mak
@@ -509,28 +509,24 @@
e):%0A
-
... |
4593e113f53e15c42143ce9ddce9294393d08986 | fix doc_type for form data source | corehq/apps/userreports/app_manager.py | corehq/apps/userreports/app_manager.py | from corehq.apps.app_manager.util import ParentCasePropertyBuilder
from corehq.apps.app_manager.xform import XForm
from corehq.apps.userreports.models import DataSourceConfiguration
def get_case_data_sources(app):
"""
Returns a dict mapping case types to DataSourceConfiguration objects that have
the defau... | Python | 0.000001 | @@ -3499,20 +3499,29 @@
c_type='
+X
Form
+Instance
',%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.