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 |
|---|---|---|---|---|---|---|---|
4dac5069084e90a0c4b0fd12e763e92df79f31c5 | rename ds_justification_reason to justification_reason - add migration | backend/unpp_api/apps/project/migrations/0017_auto_20170915_0734.py | backend/unpp_api/apps/project/migrations/0017_auto_20170915_0734.py | Python | 0 | @@ -0,0 +1,471 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.3 on 2017-09-15 07:34%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('project', '0016_remove_application_agency'),%0A %5D%0A%0... | |
d7f024bc47c362afc6930510dea3bc425d5b554a | create example_fabfile | pg_fabrep/example_fabfile.py | pg_fabrep/example_fabfile.py | Python | 0.000002 | @@ -0,0 +1,352 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0Afrom fabric.api import env, task%0Afrom pg_fabrep.tasks import *%0A%0A%0A@task%0Adef example_cluster():%0A # name of your cluster - no spaces, no special chars%0A env.cluster_name = 'example_cluster'%0A # always ask user for confirmation wh... | |
c4243483052ec7eec2f1f88ea72fafc953d35648 | Add ptxgen sample | samples/ptxgen.py | samples/ptxgen.py | Python | 0 | @@ -0,0 +1,1920 @@
+# Copyright (c) 2013 NVIDIA Corporation%0A#%0A# Permission is hereby granted, free of charge, to any person obtaining a copy%0A# of this software and associated documentation files (the %22Software%22), to deal%0A# in the Software without restriction, including without limitation the rights%0A# to u... | |
ebc417be95bcec7b7a25dc1ad587f17b1bfa521d | Add download_student_forms | scripts/download_student_forms.py | scripts/download_student_forms.py | Python | 0 | @@ -0,0 +1,2621 @@
+#!/usr/bin/env python2.5%0A#%0A# Copyright 2011 the Melange authors.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/L... | |
013d793c6ebe7a4d426d6c2d823510f90b84d19e | Add a landmine to get rid of obselete test netscape plugins | build/get_landmines.py | build/get_landmines.py | #!/usr/bin/env python
# Copyright 2013 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.
"""
This file emits the list of reasons why a particular build needs to be clobbered
(or a list of 'landmines').
"""
import optparse
i... | Python | 0.000001 | @@ -1931,16 +1931,113 @@
blink)'%0A
+ if (platform() != 'ios'):%0A print 'Clobber to get rid of obselete test plugin after r248358'%0A
%0A%0Adef ma
|
5401eb7b463dfd9a807b86b7bdfa4079fc0cb2ac | Define basic regular expressions | autoload/vimwiki_pytasks.py | autoload/vimwiki_pytasks.py | import vim
import re
from tasklib import task
"""
How this plugin works:
1.) On startup, it reads all the tasks and syncs info TW -> Vimwiki file. Task is identified by their
uuid.
2.) When saving, the opposite sync is performed (Vimwiki -> TW direction).
a) if task is marked as subtask by ind... | Python | 0.000304 | @@ -14,16 +14,17 @@
port re%0A
+%0A
from tas
@@ -31,16 +31,21 @@
klib
+.task
import
task
@@ -40,20 +40,1038 @@
import
-task
+TaskWarrior, Task%0A%0A# Building blocks%0ABRACKET_OPENING = re.escape('* %5B')%0ABRACKET_CLOSING = re.escape('%5D ')%0AEMPTY_SPACE = r'(?P%3Cspace%3E%5Cs*)'%0ATEXT = r'(?P%3Ctext%3E.+)... |
b9fbc458ed70e6bffdfc5af9d9f0ad554b6c0cec | Decrease memory usage of LSTM text gen example | examples/lstm_text_generation.py | examples/lstm_text_generation.py | from __future__ import print_function
from keras.models import Sequential
from keras.layers.core import Dense, Activation, Dropout
from keras.layers.recurrent import LSTM
from keras.datasets.data_utils import get_file
import numpy as np
import random, sys
'''
Example script to generate text from Nietzsche's writin... | Python | 0 | @@ -1333,16 +1333,31 @@
(chars))
+, dtype=np.bool
)%0Ay = np
@@ -1391,16 +1391,31 @@
(chars))
+, dtype=np.bool
)%0Afor i,
@@ -1528,17 +1528,16 @@
ar%5D%5D = 1
-.
%0A y%5Bi
@@ -1570,17 +1570,16 @@
i%5D%5D%5D = 1
-.
%0A%0A%0A# bui
|
08402e98f9eb56ab3b103e5bf36004638461f903 | Add koi7-to-utf8 script. | languages/python/koi7-to-utf8.py | languages/python/koi7-to-utf8.py | Python | 0 | @@ -0,0 +1,981 @@
+#!/usr/bin/python%0A# -*- encoding: utf-8 -*-%0A#%0A# %D0%9F%D0%B5%D1%80%D0%B5%D0%BA%D0%BE%D0%B4%D0%B8%D1%80%D0%BE%D0%B2%D0%BA%D0%B0 %D0%B8%D0%B7 %D1%81%D0%B5%D0%BC%D0%B8%D0%B1%D0%B8%D1%82%D0%BD%D0%BE%D0%B3%D0%BE %D0%BA%D0%BE%D0%B4%D0%B0 %D0%9A%D0%9E%D0%98-7 %D0%9D2%0A# (%D0%BA%D0%BE%D0%B4%D1%8B %D0%... | |
815845fd98627fe9df0b0444ee31fe337d1c63da | Add celery worker module | utils/celery_worker.py | utils/celery_worker.py | Python | 0.000001 | @@ -0,0 +1,1121 @@
+import os%0Aimport sys%0A# Append .. to sys path%0Asys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))%0Aimport multiscanner%0A%0Afrom celery import Celery%0Afrom celery.contrib.batches import Batches%0A%0Aapp = Celery('celery_worker', broker='pyamqp://guest@localhost//')%0A... | |
60e37ece40e96ecd9bba16b72cdb64e1eb6f8f77 | Fix purge_cluster script | utils/purge_cluster.py | utils/purge_cluster.py | # encoding: utf-8
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.
# Distributed under the terms of the BSD License. See COPYING.rst.
# ---------------------------------------------------------------------------
"""... | Python | 0.000001 | @@ -923,18 +923,15 @@
ext.
-purge_keys
+cleanup
(all
|
43629166927a0e6e7f4648a165ce12e22b32508d | Add missing migration for DiscoveryItem (#15913) | src/olympia/discovery/migrations/0010_auto_20201104_1424.py | src/olympia/discovery/migrations/0010_auto_20201104_1424.py | Python | 0 | @@ -0,0 +1,467 @@
+# Generated by Django 2.2.16 on 2020-11-04 14:24%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('discovery', '0009_auto_20201027_1903'),%0A %5D%0A%0A operations = %5B%0A migrations.RemoveField(%0A mod... | |
c5f91aa604ccca0966be3076c46385d6019b65f2 | Add utils refresh_db | APITaxi/utils/refresh_db.py | APITaxi/utils/refresh_db.py | Python | 0.000001 | @@ -0,0 +1,665 @@
+# -*- coding: utf-8 -*-%0A#Source: http://dogpilecache.readthedocs.org/en/latest/usage.html%0A%0Afrom sqlalchemy import event%0Afrom sqlalchemy.orm import Session%0A%0Adef cache_refresh(session, refresher, *args, **kwargs):%0A %22%22%22%0A Refresh the functions cache data in a new thread. Start... | |
4cba006f440ebf219eb2cb64dd322e0168bdc3bb | Was cat_StartdLogs.py | factory/tools/find_StartdLogs.py | factory/tools/find_StartdLogs.py | Python | 0.998194 | @@ -0,0 +1,1764 @@
+#!/bin/env python%0A#%0A# cat_StartdLogs.py%0A#%0A# Print out the StartdLogs for a certain date%0A#%0A# Usage: cat_StartdLogs.py %3Cfactory%3E YY/MM/DD %5Bhh:mm:ss%5D%0A#%0A%0Aimport sys,os,os.path,time%0Asys.path.append(%22lib%22)%0Asys.path.append(%22..%22)%0Asys.path.append(%22../../lib%22)%0Aimp... | |
fd97b0e0edffa331d11ba7961637eb03ea5b8881 | Save an RPC call on each request, make sure we have a django_user before trying to update it | djangae/contrib/gauth/middleware.py | djangae/contrib/gauth/middleware.py | from django.contrib.auth import authenticate, login, logout, get_user, BACKEND_SESSION_KEY, load_backend
from django.contrib.auth.middleware import AuthenticationMiddleware as DjangoMiddleware
from django.contrib.auth.models import BaseUserManager, AnonymousUser
from djangae.contrib.gauth.backends import AppEngineUser... | Python | 0 | @@ -1513,16 +1513,32 @@
kend_str
+ and django_user
:%0A
@@ -1987,32 +1987,19 @@
ail(
-users.get_current
+google
_user
-()
.ema
|
38bfc1a536f43ece367a49a62501b57c89f689a1 | Add script to delete tables. | django-server/feel/core/db/reset.py | django-server/feel/core/db/reset.py | Python | 0 | @@ -0,0 +1,511 @@
+from django.db.models.base import ModelBase%0A%0Afrom quiz.models import Quiz, ShortAnswer, Choice, QuizAttempt%0Afrom codequiz.models import CodeQuiz, CodeQuizAttempt%0A%0Afrom concept.models import Concept, ConceptSection%0Afrom course.models import Course, CourseSlug, CourseConcept, ConceptDepende... | |
4b3c3fb315c0f7450dd87a98e3d7f928408a8ab4 | add documentation for do_layout() method | kivy/uix/layout.py | kivy/uix/layout.py | '''
Layout
======
Layouts are used to calculate and assign widget positions.
The :class:`Layout` class itself cannot be used directly. You must use one of:
- Anchor layout : :class:`kivy.uix.anchorlayout.AnchorLayout`
- Box layout : :class:`kivy.uix.boxlayout.BoxLayout`
- Float layout : :class:`kivy.uix.floatlayout.... | Python | 0.000001 | @@ -2021,24 +2021,276 @@
f, *largs):%0A
+ '''This function is called when a layout is needed, with by a trigger.%0A If you are doing a new Layout subclass, don't call this function%0A directly, use :prop:%60_trigger_layout%60 instead.%0A%0A .. versionadded:: 1.0.8%0A '''%0A
... |
586c047cebd679f6a736c2dfec9b6df762938b12 | Add command line tool. | simulate_packs.py | simulate_packs.py | Python | 0.000001 | @@ -0,0 +1,739 @@
+#!/usr/local/bin/python3%0Aimport argparse%0Aimport Panini%0Afrom Panini import StickerCollection%0Afrom Accumulator import Accumulator%0A%0Aparser = argparse.ArgumentParser('Simulate creating a Panini sticker collection')%0A%0Aparser.add_argument('runs', metavar='N', type= int)%0A%0Aruns = parser.pa... | |
bad6bc988f09bf1f135d81eb654c5fc6c1de9a28 | add standalone gene report script. It will be used in the NDEx server as the GSEA exporter. | cx2grp.py | cx2grp.py | Python | 0 | @@ -0,0 +1,2621 @@
+#!/usr/bin/python%0A%0A'''%0AThis script takes a CX network from stdin and print out a set of gene symbols found in node names,%0Arepresents, alias and function terms.%0AGene Symbols are normallized to human genes using mygene.info services.%0A%0A'''%0A%0Aimport sys,json%0Aimport requests%0A%0Adef t... | |
9008d6e3d14a5a582f0ddbd6b4a113386b639f26 | Add Pyramid parser module | webargs/pyramidparser.py | webargs/pyramidparser.py | Python | 0.000002 | @@ -0,0 +1,3308 @@
+# -*- coding: utf-8 -*-%0A%22%22%22Pyramid request argument parsing.%0A%0AExample usage: ::%0A%0A from wsgiref.simple_server import make_server%0A from pyramid.config import Configurator%0A from pyramid.response import Response%0A from webargs import Arg%0A from webargs.pyramidparser ... | |
5149d86c7e787eff46f21669d448158ba0905a41 | Add dbck.py: a database check tool | dbck.py | dbck.py | Python | 0.000004 | @@ -0,0 +1,1303 @@
+#!/usr/bin/python%0A#%0A# dbck.py%0A#%0A# Distributed under the MIT/X11 software license, see the accompanying%0A# file COPYING or http://www.opensource.org/licenses/mit-license.php.%0A#%0A%0A%0Aimport sys%0Aimport Log%0Aimport MemPool%0Aimport ChainDb%0Aimport cStringIO%0A%0Afrom bitcoin.coredefs i... | |
48bc3bfa4ab6648d3599af15cfe7a2dd69abdb40 | make gsid ctable schedule run hourly | custom/apps/gsid/ctable_mappings.py | custom/apps/gsid/ctable_mappings.py | from ctable.fixtures import CtableMappingFixture
from ctable.models import ColumnDef, KeyMatcher
class PatientSummaryMapping(CtableMappingFixture):
name = 'patient_summary'
domains = ['gsid']
couch_view = 'gsid/patient_summary'
schedule_active = True
@property
def columns(self):
colum... | Python | 0.000001 | @@ -2007,8 +2007,153 @@
columns%0A
+%0A def customize(self, mapping):%0A mapping.schedule_type = 'hourly'%0A mapping.schedule_hour = -1%0A mapping.schedule_day = -1%0A
|
94ebfd057eb5a7c7190d981b26c027573578606d | validate using validator module | modularodm/fields/StringField.py | modularodm/fields/StringField.py | from ..fields import Field
import weakref
class StringField(Field):
default = ''
def __init__(self, *args, **kwargs):
super(StringField, self).__init__(*args, **kwargs)
def validate(self, value):
if isinstance(value, unicode):
return True
else:
try:
... | Python | 0.000001 | @@ -24,23 +24,48 @@
eld%0A
-%0Aimport weakref
+from ..validators import StringValidator
%0A%0Acl
@@ -107,16 +107,50 @@
t = ''%0A%0A
+ validate = StringValidator()%0A%0A
def
@@ -182,16 +182,16 @@
wargs):%0A
+
@@ -244,246 +244,4 @@
rgs)
-%0A%0A def validate(self, value):%0A if isinstance... |
5748666a1f2c6cd307be79c33117252e10d6df01 | Add matchup script | mzalendo/kenya/management/commands/kenya_matchup_coords_to_place.py | mzalendo/kenya/management/commands/kenya_matchup_coords_to_place.py | Python | 0.000001 | @@ -0,0 +1,1511 @@
+import re %0Aimport csv%0Aimport sys%0A%0Afrom optparse import make_option%0A%0Afrom django.core.management.base import LabelCommand%0Afrom django.contrib.gis.geos import Point%0A%0Afrom mapit.models import Area, Generation, Type, NameType, Country%0A%0Aclass Command(LabelCommand):%0A %22%22%22Re... | |
9386236d41298ed8888a6774f40a15d44b7e53fe | Create command for Data Log Report fixtures | data_log/management/commands/generate_report_fixture.py | data_log/management/commands/generate_report_fixture.py | Python | 0 | @@ -0,0 +1,1070 @@
+from django.core.management.base import BaseCommand%0Afrom django.core import serializers%0A%0Afrom data_log import models%0Aimport json%0A%0A%0Aclass Command(BaseCommand):%0A help = 'Create Data Log Report fixtures'%0A%0A def handle(self, *args, **kwargs):%0A self.stdout.write('Creatin... | |
ebf790c6c94131b79cb5da4de6cb665f97e54799 | Add viewset permission class for checking image permissions | app/grandchallenge/cases/permissions.py | app/grandchallenge/cases/permissions.py | Python | 0 | @@ -0,0 +1,412 @@
+from rest_framework import permissions%0A%0Afrom grandchallenge.serving.permissions import user_can_download_image%0A%0A%0Aclass ImagePermission(permissions.BasePermission):%0A %22%22%22%0A Permission class for APIViews in retina app.%0A Checks if user is in retina graders or admins group%0A... | |
496754c54005cf7e1b49ada8e612207f5e2846ff | Add dead letter SQS queue example | python/example_code/sqs/dead_letter_queue.py | python/example_code/sqs/dead_letter_queue.py | Python | 0.000002 | @@ -0,0 +1,1006 @@
+# Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22). You%0A# may not use this file except in compliance with the License. A copy of%0A# the License is located at%0A#%0A# http://aws.amazon.com/apache... | |
085a9aa05dfda6348d0e7e2aa6ac7f0c6ce6d63b | add some basic client-server tests | client_server_tests.py | client_server_tests.py | Python | 0.000001 | @@ -0,0 +1,446 @@
+import pyopentxs%0A%0A# this is defined by the sample data%0ASERVER_ID = %22r1fUoHwJOWCuK3WBAAySjmKYqsG6G2TYIxdqY6YNuuG%22%0A%0A%0Adef test_check_server_id():%0A nym_id = pyopentxs.create_pseudonym()%0A assert pyopentxs.check_server_id(SERVER_ID, nym_id)%0A%0Adef test_register_nym():%0A nym_... | |
7fc64847ed45229220e9bdfe20c25f3c83f10a80 | Add isup.py | isup.py | isup.py | Python | 0.000001 | @@ -0,0 +1,567 @@
+#!/usr/bin/env python%0Aimport re%0Aimport sys%0Afrom urllib.request import urlopen%0A%0Adef isup(domain):%0A request = urlopen(%22http://www.isup.me/%22 + domain).read()%0A if type(request) != type(''):%0A request = request.decode('utf-8')%0A return domain + %22 %22 + (%22UP%22 if %2... | |
9c7935ebbd4d995c44526c91fdb3b647a15eb877 | Create API tasks.py with update_char_data | evewspace/API/tasks.py | evewspace/API/tasks.py | Python | 0.000003 | @@ -0,0 +1,1239 @@
+# Eve W-Space%0A# Copyright 2014 Andrew Austin and contributors%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/l... | |
bf0445cff09c62e2ad76b8ca922509ed3108e520 | Improve the test that checks if the correct templates are being used | okupy/tests/integration/login.py | okupy/tests/integration/login.py | # vim:fileencoding=utf8:et:ts=4:sts=4:sw=4:ft=python
from django.conf import settings
from django.contrib.auth.models import User
from django.core import mail
from django.db import DatabaseError
from django.test.client import Client
from mockldap import MockLdap
from ...common.test_helpers import OkupyTestCase
impor... | Python | 0.000004 | @@ -818,16 +818,40 @@
ef test_
+login_page_uses_correct_
template
@@ -850,32 +850,32 @@
template(self):%0A
-
response
@@ -927,93 +927,98 @@
sert
-In('login_form', response.context)%0A self.assertIn('messages', response.context
+TemplateUsed(response, 'base.html')%0A self.assertTemplateUsed(re... |
1d1a37ad6f0aedbf18a72b551fdee4d96c92ea11 | Update RICA example. | examples/mnist-rica.py | examples/mnist-rica.py | #!/usr/bin/env python
import climate
import matplotlib.pyplot as plt
import numpy as np
import theanets
from utils import load_mnist, plot_layers, plot_images
logging = climate.get_logger('mnist-rica')
climate.enable_default_logging()
class RICA(theanets.Autoencoder):
def J(self, weight_inverse=0, **kwargs):
... | Python | 0 | @@ -461,14 +461,38 @@
um()
+%0A
for
-w
+l
in
@@ -496,16 +496,34 @@
in self.
+layers for w in l.
weights)
@@ -1463,29 +1463,26 @@
ork.
+get_
weights
-%5B0%5D.get_value(
+('hid1'
).T)
|
57cf0e1d153c2d06e722329ac35f2093a1d1c17c | use .py file to make for setup.py | Docs/city_fynder.py | Docs/city_fynder.py | Python | 0.000001 | @@ -0,0 +1,576 @@
+# Which city would like to live?%0A# Created by City Fynders - University of Washington%0A%0Aimport pandas as pd%0Aimport numpy as np%0Aimport geopy as gy%0Afrom geopy.geocoders import Nominatim%0A%0Aimport data_processing as dp%0A%0A%0A# import data%0A(natural, human, economy, tertiary) = dp.read_da... | |
64b321f1815c17562e4e8c3123b5b7fbbe23ce0b | Add logging test | pubres/tests/logging_test.py | pubres/tests/logging_test.py | Python | 0.000001 | @@ -0,0 +1,1491 @@
+import logging%0Aimport logging.handlers%0Aimport multiprocessing%0A%0Aimport pubres%0Afrom pubres.pubres_logging import setup_logging%0A%0Afrom .base import *%0A%0A%0Aclass MultiprocessingQueueStreamHandler(logging.handlers.BufferingHandler):%0A %22%22%22A logging handler that pushes the getMess... | |
b52bad82bafed23d3db5a0e73c22a056d1753174 | add card parsers | pypeerassets/card_parsers.py | pypeerassets/card_parsers.py | Python | 0 | @@ -0,0 +1,713 @@
+'''parse cards according to deck issue mode'''%0A%0A%0Adef none_parser(cards):%0A '''parser for NONE %5B0%5D issue mode'''%0A%0A return None%0A%0A%0Adef custom_parser(cards, parser=None):%0A '''parser for CUSTOM %5B1%5D issue mode,%0A please provide your custom parser as argument'''%0A%0A... | |
a5b28834bb5e52857720139a1fbe6dfd1d1ea266 | create a new string helper that concatenates arguments | radosgw_agent/util/string.py | radosgw_agent/util/string.py | Python | 0.000023 | @@ -0,0 +1,315 @@
+%0Adef concatenate(*a, **kw):%0A %22%22%22%0A helper function to concatenate all arguments with added (optional)%0A newlines%0A %22%22%22%0A newline = kw.get('newline', False)%0A string = ''%0A for item in a:%0A if newline:%0A string += item + '%5Cn'%0A e... | |
68c66c397f11637f650131ef69f4f16ebe6f43e4 | Create luhn.py | luhn.py | luhn.py | Python | 0.000001 | @@ -0,0 +1,1640 @@
+# Luhn algorithm check%0A# From https://en.wikipedia.org/wiki/Luhn_algorithm%0Adef luhn_checksum(card_number):%0A def digits_of(n):%0A return %5Bint(d) for d in str(n)%5D%0A digits = digits_of(card_number)%0A odd_digits = digits%5B-1::-2%5D%0A even_digits = digits%5B-2::-2%5D%0A ... | |
7655170c50b3e7d3af0a34c82478696b6b8f3d39 | Disable Session Keepalives in the Request Library | rightscale/httpclient.py | rightscale/httpclient.py | from functools import partial
import requests
DEFAULT_ROOT_RES_PATH = '/'
class HTTPResponse(object):
"""
Wrapper around :class:`requests.Response`.
Parses ``Content-Type`` header and makes it available as a list of fields
in the :attr:`content_type` member.
"""
def __init__(self, raw_respo... | Python | 0.000001 | @@ -41,16 +41,17 @@
uests%0A%0A%0A
+%0A
DEFAULT_
@@ -1068,16 +1068,17 @@
ndpoint%0A
+%0A
@@ -1099,16 +1099,175 @@
ession()
+%0A%0A # Disable keepalives. They're unsafe in threaded apps that potentially%0A # re-use very old connection objects from the urllib3 connection pool.
%0A
@@ -... |
9e6c2d1601170657fb0516e5c2addde65761b8fe | support grayscale + 8-bit alpha channel | rinoh/backend/pdf/png.py | rinoh/backend/pdf/png.py | # This file is part of RinohType, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
import png
from .cos import Name, XObjectImage, Array, I... | Python | 0.000005 | @@ -256,16 +256,40 @@
nses/.%0A%0A
+from io import BytesIO%0A%0A
import p
@@ -566,16 +566,52 @@
Indexed'
+,%0A 4: 'DeviceGray'
%7D%0A NU
@@ -2261,23 +2261,916 @@
ode(
-flate_params))%0A
+))%0A if self._png.color_type == 4:%0A idat = BytesIO()%0A for idat_chunk in s... |
1718926c99692fefb90627c55589990cd0e0225b | Make migrations in project_template home app reversible | wagtail/project_template/home/migrations/0002_create_homepage.py | wagtail/project_template/home/migrations/0002_create_homepage.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def create_homepage(apps, schema_editor):
# Get models
ContentType = apps.get_model('contenttypes.ContentType')
Page = apps.get_model('wagtailcore.Page')
Site = apps.get_model('wagtailcore.Site')
Home... | Python | 0.000005 | @@ -383,24 +383,99 @@
lt homepage%0A
+ # If migration is run multiple times, it may have already been deleted%0A
Page.obj
@@ -479,19 +479,22 @@
objects.
-get
+filter
(id=2).d
@@ -578,15 +578,10 @@
pe,
-created
+__
= C
@@ -1071,16 +1071,437 @@
True)%0A%0A%0A
+def remove_homepage(apps, schema_editor):%0A ... |
889b322261384c90ac165ddd1e8bf2944b3e7785 | Add machine types people use as host for TF builds. | third_party/remote_config/remote_platform_configure.bzl | third_party/remote_config/remote_platform_configure.bzl | """Repository rule to create a platform for a docker image to be used with RBE."""
def _remote_platform_configure_impl(repository_ctx):
platform = repository_ctx.attr.platform
if platform == "local":
os = repository_ctx.os.name.lower()
if os.startswith("windows"):
platform = "window... | Python | 0.000004 | @@ -568,16 +568,17 @@
if
+(
machine_
@@ -603,32 +603,156 @@
pc%22)
-:%0A cpu = %22ppc
+ or%0A machine_type.startswith(%22powerpc%22)):%0A cpu = %22ppc%22%0A elif machine_type.startswith(%22s390x%22):%0A cpu = %22s390x
%22%0A%0A
|
2dea3ee1e50d5365ca190ee894536faea3148c7d | Add ChromiumTestShell activity and socket to constants. | build/android/pylib/constants.py | build/android/pylib/constants.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.
"""Defines a set of constants shared by test runners and other scripts."""
import os
CHROME_PACKAGE = 'com.google.android.apps.chrome'
CHROME_ACTIVITY... | Python | 0.000002 | @@ -354,16 +354,67 @@
e.Main'%0A
+CHROME_DEVTOOLS_SOCKET = 'chrome_devtools_remote'%0A%0A
CHROME_T
@@ -467,16 +467,17 @@
.tests'%0A
+%0A
LEGACY_B
@@ -586,16 +586,17 @@
tivity'%0A
+%0A
CONTENT_
@@ -611,17 +611,17 @@
CKAGE =
-%22
+'
org.chro
@@ -642,17 +642,17 @@
hell_apk
-%22
+'
%0ACONTENT
@@ -669,17 +669,17 ... |
4ab784d9526b2a4555e288038df0490269b17683 | 完成1题 | 已完成/ToLeetSpeak.py | 已完成/ToLeetSpeak.py | Python | 0.000004 | @@ -0,0 +1,1693 @@
+#!/usr/bin/python%0A# -*- coding: UTF-8 -*-%0A%0A'''%0A# ToLeetSpeak%E9%A2%98%E7%9B%AE%E5%9C%B0%E5%9D%80%EF%BC%9Ahttps://www.codewars.com/kata/57c1ab3949324c321600013f/train/python%0A'''%0A%0Aimport unittest%0A%0Aclass TestCases(unittest.TestCase):%0A def setUp(self):%0A pass%0A def tes... | |
988b56b4348ec8be3127cfd6576779de4367d488 | Add pywikibot user-config file | .pywikibot/user-config.py | .pywikibot/user-config.py | Python | 0 | @@ -0,0 +1,146 @@
+family = 'wikipedia'%0Amylang = 'en'%0A%0Ausernames%5B'wikipedia'%5D%5B'en'%5D = u'ExampleBot'%0A%0Aconsole_encoding = 'utf-8'%0Atextfile_encoding = 'unicode_escape'%0A
| |
d808d55b5ca9ae2e45418aca718ee21a9beb84f9 | Create a custom reverse() function (not implemented yet) | djangorestframework/urlresolvers.py | djangorestframework/urlresolvers.py | Python | 0 | @@ -0,0 +1,168 @@
+from django.core.urlresolvers import reverse%0A%0Adef reverse(viewname, urlconf=None, args=None, kwargs=None, prefix=None, current_app=None):%0A raise NotImplementedError%0A
| |
631faacaf077c2b4d0d446e42076fd4e4f27ed37 | Add tests for template tags | djlotrek/tests/test_templatetags.py | djlotrek/tests/test_templatetags.py | Python | 0 | @@ -0,0 +1,1328 @@
+import os%0Aimport mock%0A%0Afrom django.test import TestCase%0A%0Afrom djlotrek.templatetags.djlotrek_tags import absolute_url%0A%0Afrom django.test import RequestFactory%0A%0A%0Aclass TemplateTagsTestCase(TestCase):%0A%0A def setUp(self):%0A pass%0A%0A def test_absolute_url(self):%0A ... | |
e812029c03cb6a7a6e474546fb686342e6d2c064 | Add test for `wsgiref.simple_server` | python/ql/test/library-tests/frameworks/stdlib/wsgiref_simple_server_test.py | python/ql/test/library-tests/frameworks/stdlib/wsgiref_simple_server_test.py | Python | 0 | @@ -0,0 +1,1943 @@
+# This test file demonstrates how to use an application with a wsgiref.simple_server%0A# see https://docs.python.org/3/library/wsgiref.html#wsgiref.simple_server.WSGIServer%0Aimport sys%0Aimport wsgiref.simple_server%0A%0Adef ignore(*arg, **kwargs): pass%0Aensure_tainted = ensure_not_tainted = ignor... | |
f2028ab194fe7c1c1497ee9320ddddbbece6406a | Add eventlet backdoor to facilitate troubleshooting. | nova/common/eventlet_backdoor.py | nova/common/eventlet_backdoor.py | Python | 0.000002 | @@ -0,0 +1,1990 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4%0A%0A# Copyright (c) 2012 Openstack, LLC.%0A# Administrator of the National Aeronautics and Space Administration.%0A# All Rights Reserved.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file excep... | |
d81ba7d656f11e817eb610b1c65a4880fddc9004 | Fix getting money from arcade games. | saylua/modules/arcade/api.py | saylua/modules/arcade/api.py | from saylua.wrappers import api_login_required
from flask import g, request
from models.db import Game, GameLog
from saylua.utils import int_or_none
import json
# Send a score to the API.
@api_login_required()
def api_send_score(game_id):
try:
gameName = Game(game_id)
except IndexError:
retu... | Python | 0 | @@ -1,20 +1,43 @@
+from saylua import db%0A%0A
from saylua.wrappers
@@ -757,16 +757,48 @@
= score%0A
+ db.session.commit()%0A
|
43d7160272511107528a33d7dff932ed274d9b58 | add sitemaps | fluent_faq/sitemaps.py | fluent_faq/sitemaps.py | Python | 0.000001 | @@ -0,0 +1,1078 @@
+from django.contrib.sitemaps import Sitemap%0Afrom fluent_faq.models import FaqCategory, FaqQuestion%0Afrom fluent_faq.urlresolvers import faq_reverse%0A%0A%0Aclass FaqQuestionSitemap(Sitemap):%0A %22%22%22%0A Sitemap for FAQ questions%0A %22%22%22%0A def items(self):%0A return Fa... | |
23f4e54ea84a23af55e29ead27a38af12672aa43 | Create multi_currency_prices.py | examples/multi_currency_prices.py | examples/multi_currency_prices.py | Python | 0 | @@ -0,0 +1,1227 @@
+%0A from pyoanda import Client, PRACTICE%0A%0A client = Client(environment=PRACTICE,account_id=%22Your Oanda account ID%22,access_token=%22Your Oanda access token%22)%0A%0A # Get prices for a list of instruments%0A%0A pair_list = %5B'AUD_JPY','EUR_JPY','GBP_JPY','AUD_USD'%5D%0A%0A dat... | |
22b04a8a6a014ee4e077f2dc03338bdc9479cc5c | package module for handling wavelength calib | comoving_rv/longslit/wavelength.py | comoving_rv/longslit/wavelength.py | Python | 0 | @@ -0,0 +1,2251 @@
+# Third-party%0Aimport numpy as np%0Afrom scipy.optimize import minimize, leastsq%0Afrom scipy.stats import scoreatpercentile%0A%0A# Project%0Afrom .models import voigt_polynomial%0A%0A__all__ = %5B'fit_emission_line'%5D%0A%0Adef errfunc(p, pix, flux, flux_ivar):%0A amp, x_0, std_G, fwhm_L, *bg_c... | |
21e411171e811e1b68ad3674567ecb05f6f7a7ad | add migrations | cmsplugin_contact_plus/migrations/0004_auto_20170410_1553.py | cmsplugin_contact_plus/migrations/0004_auto_20170410_1553.py | Python | 0.000001 | @@ -0,0 +1,700 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('cmsplugin_contact_plus', '0003_auto_20161102_1927'),%0A %5D%0A%0A operations = %5B%0A mig... | |
fe18d3387f7f8072b4f23990e5108f646729a860 | Create pKaKs2.7.py | Modules/pKaKs2.7.py | Modules/pKaKs2.7.py | Python | 0.000002 | @@ -0,0 +1,828 @@
+#This short script uses the output values of KaKs.pl & SnpEff to calculate mutational load using Nei-Gojobori: pKa/Ks = %5B-3/4ln(1-4pn/3)%5D / %5B-3/4ln(1-4ps/3)%5D, where ps = syn SNPs / syn sites and pn = nonsyn SNPs / nonsyn sites%0A%0Afrom math import log #If for some reason you need to calculat... | |
61e56ad3feecef6fe422db8fb5d7b9b26dc03d6a | Add day 3 part 2. | day3-2.py | day3-2.py | Python | 0.000227 | @@ -0,0 +1,891 @@
+%22%22%22This module checks how many valid triangles are in the input data.%22%22%22%0A%0A%0Adef main():%0A %22%22%22Run main function.%22%22%22%0A with open('data/day3data.txt', 'r') as f:%0A input = f.readlines()%0A%0A dataList = %5Bmap(int, i.strip('%5Cn').split()) for i in input%5... | |
047541a111e9da5d59b47d40a528bc990bae6927 | add scope expression | compiler/eLisp/eLisp/expr/scope.py | compiler/eLisp/eLisp/expr/scope.py | Python | 0.000002 | @@ -0,0 +1,3023 @@
+#!/usr/bin/env python%0A# -*- encoding: utf-8 -*-%0A#%0A# Copyright (c) 2015 ASMlover. All rights reserved.%0A#%0A# Redistribution and use in source and binary forms, with or without%0A# modification, are permitted provided that the following conditions%0A# are met:%0A#%0A# * Redistributions of sou... | |
2d05a12a9b9534ad1925e7d543e6f66d8a79d3f8 | Initialize P02_deleteBigFiles | books/AutomateTheBoringStuffWithPython/Chapter09/PracticeProjects/P02_deleteBigFiles.py | books/AutomateTheBoringStuffWithPython/Chapter09/PracticeProjects/P02_deleteBigFiles.py | Python | 0.000014 | @@ -0,0 +1,610 @@
+# t%E2%80%99s not uncommon for a few unneeded but humongous files or folders to take up the%0A# bulk of the space on your hard drive. If you%E2%80%99re trying to free up room on your%0A# computer, you%E2%80%99ll get the most bang for your buck by deleting the most massive of%0A# the unwanted files. B... | |
cee924604f070bd1bbca33dda53c5783e2678c5d | Add tests for sagepay | payments/sagepay/test_sagepay.py | payments/sagepay/test_sagepay.py | Python | 0 | @@ -0,0 +1,2074 @@
+from __future__ import unicode_literals%0Afrom unittest import TestCase%0Afrom mock import patch, MagicMock%0A%0Afrom . import SagepayProvider%0A%0A%0AVENDOR = 'abcd1234'%0AENCRYPTION_KEY = '1234abdd1234abcd'%0A%0A%0Aclass Payment(MagicMock):%0A%0A id = 1%0A variant = 'sagepay'%0A currency ... | |
a07e4d08b475e0d921265f9da104f109943901bc | Add lammps wrapper tests with cuds | simlammps/tests/cuds_test.py | simlammps/tests/cuds_test.py | Python | 0 | @@ -0,0 +1,1775 @@
+%22%22%22Tests for running lammps using CUDS and Simulation classes.%22%22%22%0Aimport unittest%0A%0Afrom simphony.core.cuba import CUBA%0Afrom simphony import CUDS, Simulation%0Afrom simphony.engine import EngineInterface%0Afrom simphony.testing.utils import create_particles_with_id%0Afrom simphony... | |
257c5bffe1804d694510f5a4638de8e6ae6a1470 | Create lstm_gan_mnist.py | lstm_gan_mnist.py | lstm_gan_mnist.py | Python | 0.000004 | @@ -0,0 +1,25 @@
+import tensorflow as tf %0A
| |
7a813d21043c394ab10e1ddb687d7827a8b7e761 | add slideshare plugin | plugins/slideshare/slideshare.py | plugins/slideshare/slideshare.py | Python | 0 | @@ -0,0 +1,2356 @@
+#!/usr/bin/env python%0A%0Aimport urllib2%0Aimport re%0Aimport urllib%0Aimport time%0Aimport sha%0Aimport BeautifulSoup%0Afrom BeautifulSoup import BeautifulStoneSoup %0A%0Afrom optparse import OptionParser%0A%0ATOTALIMPACT_SLIDESHARE_KEY = %22nyHCUoNM%22%0ATOTALIMPACT_SLIDESHARE_SECRET = %22z7sRiGC... | |
de2d21316ca47d1839584a7cccbe8026489ace7d | Change Schema.schema to a property | iati/core/schemas.py | iati/core/schemas.py | """A module containing a core representation of IATI Schemas."""
from lxml import etree
import iati.core.exceptions
import iati.core.resources
import iati.core.utilities
class Schema(object):
"""Represenation of a Schema as defined within the IATI SSOT.
Attributes:
name (str): The name of the Schema.... | Python | 0 | @@ -1173,22 +1173,28 @@
self.
+_
schema
+_base
= None%0A
@@ -1823,22 +1823,28 @@
self.
+_
schema
+_base
= gener
@@ -1855,8 +1855,916 @@
_schema%0A
+%0A @property%0A def schema(self):%0A %22%22%22A Schema that can be used for validation.%0A%0A Takes the base Schema that was loaded and ... |
c388e6a4143b3646df5947cb5f596ec137488513 | Add minimal skeleton for plotting script | plot.py | plot.py | Python | 0 | @@ -0,0 +1,398 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0A%0Aimport argparse%0Aimport matplotlib.pyplot as plt%0Aimport pandas as pd%0A%0Aparser = argparse.ArgumentParser(description='Plot data from output of the n-body simulation.')%0Aparser.add_argument('--output', type=str, default='output_int.dat',%0A ... | |
a7ad8f2075e7661ad9ed539083a8785f7a628b95 | test 1 | dashsniffer/sniff.py | dashsniffer/sniff.py | Python | 0.000201 | @@ -0,0 +1,82 @@
+def greet(name):%0A print 'Hello', name%0Agreet('Jack')%0Agreet('Jill')%0Agreet('Bob')%0A
| |
faf13ff99fd47424c4fb93f1c2a6b3b80c81e0d1 | replace bin<->text converters for ipv6 | ryu/lib/ip.py | ryu/lib/ip.py | import struct
def ipv4_arg_to_bin(w, x, y, z):
"""Generate unsigned int from components of IP address
returns: w << 24 | x << 16 | y << 8 | z"""
return (w << 24) | (x << 16) | (y << 8) | z
def ipv4_to_bin(ip):
'''
Parse an IP address and return an unsigned int.
The IP address is i... | Python | 0 | @@ -1,17 +1,32 @@
-import struct
+from ryu.lib import addrconv
%0A%0A%0Ad
@@ -771,509 +771,8 @@
z)%0A%0A
-IPV6_PACK_STR = '!8H'%0A%0A%0Adef ipv6_to_arg_list(ipv6):%0A '''%0A convert ipv6 string to a list of 8 different parts%0A '''%0A args = %5B%5D%0A if '::' in ipv6:%0A h, t = ipv6.split(':... |
21ee2c1762629c826efa4306cffaf7f42b29ed29 | modify comments | crosscat/utils/experiment_utils.py | crosscat/utils/experiment_utils.py | """A framework for running engine-agnostic experiments.
The experiment engine must provide 'runner', 'reader', 'writer' functions and
optionally a function to identify 'config' files, is_config_file. The 'runner'
converts 'config's into 'result's. 'writer' and 'reader' serialize and
deserialize 'result's.
A 'result... | Python | 0 | @@ -3857,24 +3857,186 @@
er, mapper%0A%0A
+ Same as do_experiment but takes list of 'config's and optional mapper%0A argument. Optional mapper argument allows multiprocessing or%0A IPython.parallel%0A%0A
Args:%0A
@@ -4513,73 +4513,8 @@
use
-. Enables use of%0A multiprocessing or ipython.... |
f189137d52b9f44db0e82723b0e7a16a602c6523 | Create duplicate_encoder.py | duplicate_encoder.py | duplicate_encoder.py | Python | 0.001774 | @@ -0,0 +1,258 @@
+#Kunal Gautam%0A#Codewars : @Kunalpod%0A#Problem name: Duplicate Encoder%0A#Problem level: 6 kyu%0A%0Adef duplicate_encode(word. st=%22%22):%0A for char in word.lower():%0A if word.lower().count(char)%3E1: st = st + ')'%0A else: st = st + '('%0A return st%0A
| |
488717ab6c84c771737a3b2ccfe8cbf4d270c9b7 | Implement dragon class | mugloar/dragon.py | mugloar/dragon.py | Python | 0.000027 | @@ -0,0 +1,1455 @@
+import json%0A%0A%0Aclass Dragon:%0A%0A # By default, stay home.%0A scaleThickness = 0%0A clawSharpness = 0%0A wingStrength = 0%0A fireBreath = 0%0A%0A def __init__(self, weather_code):%0A if weather_code == 'T E':%0A # Draught requires a 'balanced' dragon, ha ha%... | |
5f092edf48828f61042c78878474b8c85b62fbdd | Bump version to turn on SET_MAX_FPS. | o3d/installer/win/o3d_version.py | o3d/installer/win/o3d_version.py | #!/usr/bin/python2.4
# Copyright 2008-9 Google Inc. All Rights Reserved.
# version = (major, minor, trunk, patch)
plugin_version = (0, 1, 43, 1)
sdk_version = plugin_version
| Python | 0.000001 | @@ -136,17 +136,17 @@
1, 43,
-1
+2
)%0Asdk_ve
|
beeb3065e2d366dd68021eb5f55c94e2c61684e4 | add experiment script | ftrl/single_feature_experiment.py | ftrl/single_feature_experiment.py | Python | 0.000001 | @@ -0,0 +1,208 @@
+import subprocess%0A%0Afor i in range(3, 23):%0A print %22%5Cn%5Cn%5Cnrun field %22 + str(i) + %22%5Cn%22%0A subprocess.call(%22python ftrl/ftrl.py train.raw.csv test.raw.csv submission.csv %7B0%7D%22.format(i).split(%22 %22), shell=True)
| |
e5f130c1f006d2b96ca81be5a9f66c15b97b8793 | Create sol2.py | project_euler/problem_12/sol2.py | project_euler/problem_12/sol2.py | Python | 0.000044 | @@ -0,0 +1,278 @@
+def triangle_number_generator(): %0A for n in range(1,1000000):%0A yield n*(n+1)//2%0A %0Adef count_divisors(n): %0A return sum(%5B2 for i in range(1,int(n**0.5)+1) if n%25i==0 and i*i != n%5D)%0A%0Aprint(next(i for i in triangle_number_generator() if count_divisors(i) %3E 500))%0... | |
5938a5d751bcac40eac2bf7f7090e1970f097ebc | Add py-rq (#19175) | var/spack/repos/builtin/packages/py-rq/package.py | var/spack/repos/builtin/packages/py-rq/package.py | Python | 0 | @@ -0,0 +1,1677 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass PyRq(PythonPackage):%0A %22%22%22RQ (Redis Queue) is a ... | |
be3428c9fe6de7741cec7f3899bcc71049b113ca | Create HR_IntroToConditionalStatements.py | HR_IntroToConditionalStatements.py | HR_IntroToConditionalStatements.py | Python | 0 | @@ -0,0 +1,232 @@
+#!/bin/python3%0A%0Aimport math%0Aimport os%0Aimport random%0Aimport re%0Aimport sys%0A%0A%0A%0Aif __name__ == '__main__':%0A #N = int(input())%0A # One liner in a lambda function%0A print((lambda N:'Weird' if N %25 2 else 'Not Weird')(int(input())))%0A
| |
9f2fc78155dc725842ebbc82203994e26d1c7333 | Add marv_ros skeleton for ROS specific code | code/marv-robotics/marv_ros/__init__.py | code/marv-robotics/marv_ros/__init__.py | Python | 0 | @@ -0,0 +1,69 @@
+# Copyright 2019 Ternaris.%0A# SPDX-License-Identifier: AGPL-3.0-only%0A
| |
cb29ce461eb143dc44b244576b153a0b7a3b1a7d | Create missing_element.py | missing_element.py | missing_element.py | Python | 0.000189 | @@ -0,0 +1,299 @@
+%22%22%22%0AThere is an array of non-negative integers.%0AA second array is formed by shuffling the elements of the first array and deleting a random element.%0AGiven these two arrays, find which element is missing in the second array.%0Ahttp://www.ardendertat.com/2012/01/09/programming-interview-que... | |
527288828306c3620442e611fc9fb23180ee09fe | Add remove-nth-node-from-end-of-list | remove-nth-node-from-end-of-list.py | remove-nth-node-from-end-of-list.py | Python | 0.000003 | @@ -0,0 +1,697 @@
+# Link: https://leetcode.com/problems/remove-nth-node-from-end-of-list/%0A# Definition for singly-linked list.%0A# class ListNode:%0A# def __init__(self, x):%0A# self.val = x%0A# self.next = None%0A%0Aclass Solution:%0A # @param %7BListNode%7D head%0A # @param %7Binteger%7D ... | |
066a65aa0d60a6f83e13798eb74848bbffd199f6 | Update remove-comments.py | Python/remove-comments.py | Python/remove-comments.py | # Time: O(n), n is the length of the source
# Space: O(k), k is the max length of a line.
# Given a C++ program, remove comments from it.
# The program source is an array where source[i] is the i-th line of the source code.
# This represents the result of splitting the original source code string by the newline chara... | Python | 0 | @@ -82,17 +82,16 @@
f a line
-.
%0A%0A# Give
@@ -3445,18 +3445,31 @@
result
- =
+, newline = %5B%5D,
%5B%5D%0A
@@ -3496,26 +3496,8 @@
ce:%0A
- i = 0%0A
@@ -3513,32 +3513,32 @@
f not in_block:%0A
-
@@ -3546,24 +3546,42 @@
ewline = %5B%5D%0A
+ i = 0%0A
... |
90218ad99cf9d9f4599f065790ac4d388adc3521 | Add markup template filter. | blog/templatetags/markup.py | blog/templatetags/markup.py | Python | 0 | @@ -0,0 +1,302 @@
+from django import template%0Afrom django.template.defaultfilters import stringfilter%0Afrom django.utils.safestring import mark_safe%0A%0Afrom blog.models import markup%0A%0A%0Aregister = template.Library()%0A%0A%0A@register.filter%0A@stringfilter%0Adef markup(value):%0A result = markup(value)%0A... | |
28ed25a30ed495cce2d5ace3ac12c00f35f9dbcd | Add AmazonDriver | calplus/v1/object_storage/drivers/amazon.py | calplus/v1/object_storage/drivers/amazon.py | Python | 0.000001 | @@ -0,0 +1,3012 @@
+import boto3%0A%0Afrom calplus.v1.object_storage.drivers.base import BaseDriver, BaseQuota%0A%0A%0APROVIDER = 'AMAZON'%0A%0A%0Aclass AmazonDriver(BaseDriver):%0A %22%22%22AmazonDriver for Object Storage%22%22%22%0A%0A def __init__(self, cloud_config):%0A super(AmazonDriver, self).__init... | |
75ec71f313e43bbadc0441d7231fbdfb0e4dfe7b | add default OPENSTACK_KEYSTONE_DEFAULT_ROLE='Member'. You must also make sure that this role exists in keystone: ./keystone-manage $* role add Member | openstack-dashboard/dashboard/settings.py | openstack-dashboard/dashboard/settings.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Fourth Paradigm Development, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "Licen... | Python | 0.000009 | @@ -3565,8 +3565,50 @@
.DEBUG)%0A
+%0AOPENSTACK_KEYSTONE_DEFAULT_ROLE='Member'%0A
|
b78518df363fb1cb398c70920f219ca9be78f816 | Test another implementation of scipy's _spectral | pythran/tests/scipy/_spectral.py | pythran/tests/scipy/_spectral.py | Python | 0 | @@ -0,0 +1,2071 @@
+# Author: Pim Schellart%0A# 2010 - 2011%0A%0A%22%22%22Tools for spectral analysis of unequally sampled signals.%22%22%22%0A%0Aimport numpy as np%0A%0A#pythran export _lombscargle(float64%5B%5D, float64%5B%5D, float64%5B%5D)%0A##runas import numpy; x = numpy.arange(2., 12.); y = numpy.arange(1., 11.)... | |
a1e679b4b0802f1c40d08f1f7cba212b13de61a4 | Create testing2.py | myPack/testing2.py | myPack/testing2.py | Python | 0.000001 | @@ -0,0 +1,56 @@
+import aldmbmtl%0A%0Aaldmbmtl.toolbox.myPack.testing.test()%0A
| |
0ae07ef204806ab45b746df16371c3925ea894e9 | Create problem6.py | Project-Euler/Problem6/problem6.py | Project-Euler/Problem6/problem6.py | Python | 0.000035 | @@ -0,0 +1,941 @@
+%22%22%22%0A%5Bref.href%5D https://projecteuler.net/problem=6%0A%0ASum square difference.%0A%0AThe sum of the squares of the first ten natural numbers is:%0A%0A 1%5E2 + 2%5E2 + ... + 10%5E2 = 385%0A%0AThe square of the sum of the first ten natural numbers is:%0A%0A (1 + 2 + ... + 10)%5E2 = 55%5... | |
8b4304d5eb80e8506aa19dc412c0c5bade993eea | change csv exporter to check flag inmediately instead of calling another function | scrapy/contrib/exporter/__init__.py | scrapy/contrib/exporter/__init__.py | """
Item Exporters are used to export/serialize items into different formats.
"""
import csv
import pprint
from cPickle import Pickler
from xml.sax.saxutils import XMLGenerator
__all__ = ['BaseItemExporter', 'PprintItemExporter', 'PickleItemExporter', \
'CsvItemExporter', 'XmlItemExporter']
class BaseItemExport... | Python | 0 | @@ -3741,32 +3741,36 @@
self._headers_
+not_
written = False%0A
@@ -3763,20 +3763,19 @@
itten =
-Fals
+Tru
e%0A%0A d
@@ -3794,32 +3794,120 @@
em(self, item):%0A
+ if self._headers_not_written:%0A self._headers_not_written = False%0A
self._wr
@@ -3949,16 +3949,17 @@
t(item)%0A
... |
a8b07a61b56f87509f33cd3f79e7800837ef4f29 | Add lc0189_rotate_array.py | lc0189_rotate_array.py | lc0189_rotate_array.py | Python | 0.000061 | @@ -0,0 +1,1007 @@
+%22%22%22Leetcode 189. Rotate Array%0AEasy%0A%0AURL: https://leetcode.com/problems/rotate-array/%0A%0AGiven an array, rotate the array to the right by k steps, where k is non-negative.%0A%0AExample 1:%0AInput: %5B1,2,3,4,5,6,7%5D and k = 3%0AOutput: %5B5,6,7,1,2,3,4%5D%0AExplanation:%0Arotate 1 step... | |
7bae6e3f490f4986f07ce45bf333a5982b505bd4 | add 255 | python/255_verify_preorder_sequence_in_binary_search_tree.py | python/255_verify_preorder_sequence_in_binary_search_tree.py | Python | 0.999996 | @@ -0,0 +1,848 @@
+%22%22%22%0AGiven an array of numbers, verify whether it is the correct preorder traversal%0Asequence of a binary search tree.%0A%0AYou may assume each number in the sequence is unique.%0A%0AFollow up:%0ACould you do it using only constant space complexity?%0A%22%22%22%0Aclass Solution(object):%0A ... | |
86686926809bfef55b71618888eec6667faaeec9 | complete 26 reciprocal cycles | 26-reciprocal-cycles.py | 26-reciprocal-cycles.py | Python | 0.000069 | @@ -0,0 +1,1065 @@
+%22%22%22Based on chillee's answer at Fri, 6 Jan 2017, 05:06:%0AThere's so many convoluted substring solutions.%0A%0A1/3 = 3/9 = 0.(3)%0A1/7 = 148257/999999 = 0.(148257)%0A%0ATherefore, the length of the repeating portion is length of the numerator when%0Ayou set the denominator equal to some string... | |
4c6442382adcb716ea817fbc781a402dec36aac9 | set app.debug = True. | app.py | app.py | from flask import Flask
import redis
import os
from rq import Queue
app = Flask(__name__)
my_redis = redis.from_url(
os.getenv("REDIS_URL", "redis://127.0.0.1:6379"),
db=10
)
redis_rq_conn = redis.from_url(
os.getenv("REDIS_URL", "redis://127.0.0.1:6379"),
db=14
)
scopus_queue = Queue("scopus", conn... | Python | 0.000067 | @@ -83,16 +83,33 @@
_name__)
+%0Aapp.debug = True
%0A%0Amy_red
|
3cd4a151f9f03ecf2674348e9377e00346bbd849 | add first revision of the script | rtp.py | rtp.py | Python | 0 | @@ -0,0 +1,2205 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Afrom bs4 import BeautifulSoup%0Aimport urllib2%0Aimport re%0Aimport unicodedata%0Aimport os%0Aimport string%0A%0AvalidFilenameChars = %22-_. %25s%25s%22 %25 (string.ascii_letters, string.digits)%0A%0Adef removeDisallowedFilenameChars(filename):%0A... | |
17d5372feac64099373ed7ac844fe8bdbf8fad71 | Fix list/generator issue with .keys() in Python 3 | loginas/tests/tests.py | loginas/tests/tests.py | try:
from urllib.parse import urlsplit
except ImportError:
from urlparse import urlsplit
from django.test import TestCase
from django.contrib.auth.models import User
from django.test.utils import override_settings
from django.core.urlresolvers import reverse
from django.core.exceptions import ImproperlyConfigu... | Python | 0.000018 | @@ -2110,16 +2110,21 @@
key in
+list(
self.cli
@@ -2141,16 +2141,17 @@
s.keys()
+)
:%0A
|
8947167b0442b8d03cfd328fd77961a864f54638 | Create double.py | CodeWars/8kyu/double.py | CodeWars/8kyu/double.py | Python | 0.000019 | @@ -0,0 +1,39 @@
+def doubleInteger(i):%0A return i + i%0A
| |
3f2a1aa0ce76dc50662e11da50149d0de231c848 | add keys | keys.py | keys.py | Python | 0.000003 | @@ -0,0 +1,17 @@
+G_EMAIL_KEY = %22%22%0A
| |
79b284a723303daa486b97c0da69eb1c4bf56a95 | add latex for gini index | skbio/maths/diversity/alpha/gini.py | skbio/maths/diversity/alpha/gini.py | #!/usr/bin/env python
from __future__ import division
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this s... | Python | 0 | @@ -537,46 +537,97 @@
-Formula is %60%60G = A/(A+B)%60%60
+The Gini index is defined as%0A%0A .. math::%0A%0A G=%5C%5Cfrac%7BA%7D%7BA+B%7D%0A%0A
where
-%60
+:math:
%60A%60
-%60
is
@@ -647,23 +647,27 @@
een
-%60
+:math:
%60y=x%60
-%60
and the
%0A
@@ -662,20 +662,16 @@
and the
-%0A
... |
cec1cc8082854a0fd61ea83bb69ba1e9d013b089 | Create libs.py | libs.py | libs.py | Python | 0.000001 | @@ -0,0 +1,1128 @@
+# coding: utf-8%0A%0A'''%D0%91%D0%B8%D0%B1%D0%BB%D0%B8%D0%BE%D1%82%D0%B5%D0%BA%D0%B8 SEO %D0%BC%D0%BE%D0%B4%D1%83%D0%BB%D1%8F'''%0A%0Aimport sublime, sublime_plugin, re, urllib%0A%0Aclass xenuTools:%0A%0A%09def download_url_to_string(url):%0A%09%09request = urllib.request.Request(url)%0A%09%09respon... | |
636b02bbe33e60348b0171241b7a3c264f1c90a7 | too soon. sorry | src/pyechonest/decorators.py | src/pyechonest/decorators.py | Python | 0.999999 | @@ -0,0 +1,852 @@
+# from http://wiki.python.org/moin/PythonDecoratorLibrary#Memoize%0Aclass memoized(object):%0A %22%22%22Decorator that caches a function's return value each time it is called.%0A If called later with the same arguments, the cached value is returned, and%0A not re-evaluated.%0A %22%22%22%0... | |
c04610422ffd6e0fe87c62d7a8039116f804467c | Add jupyterhub config | jupyterhub_config.py | jupyterhub_config.py | Python | 0.000001 | @@ -0,0 +1,1178 @@
+import os%0Aimport everware%0A%0Aimport jupyterhub.handlers.pages%0Ajupyterhub.handlers.pages.HomeHandler.get = everware.HomeHandler.get%0Ajupyterhub.handlers.pages.HomeHandler.post = everware.HomeHandler.post%0A%0Ac = get_config()%0A%0A# spawn with custom docker containers%0Ac.JupyterHub.spawner_cl... | |
010f19ab2f9c0f3305d7f2eabcbbd33952a58fdd | Add a dir | stingroc/0002/0002.py | stingroc/0002/0002.py | Python | 0.99927 | @@ -0,0 +1,13 @@
+print %220002%22%0A
| |
287a89307af6ad720978682f49c01e39259303ec | Create censys_monitor.py | censys_monitor.py | censys_monitor.py | Python | 0.000001 | @@ -0,0 +1,1910 @@
+import censys.certificates%0Aimport json%0Aimport requests%0Aimport os%0Aimport random%0A%0A#UID = %22%22%0A#SECRET = %22%22%0A%0A%0A#api for remynseit and remynse%0AUIDS = %5B%22UID1%22, %22UID2%22, %22UID3%22%5D%0ASECRETS = %7B%22secret%22: %22value%22, %22secret2%22: %22value2%22%7D%0A%0A'''%0ASe... | |
731118d82aa41689f12adb32ea37be55be89a757 | Add gpu_buffer.py | fafnir/gpu_buffer.py | fafnir/gpu_buffer.py | Python | 0.002058 | @@ -0,0 +1,1163 @@
+import panda3d.core as p3d%0A%0A%0Aclass GpuBuffer:%0A def __init__(self, name, count, data_type, data_format):%0A self.buffer = p3d.Texture(name)%0A self.data_type = data_type%0A self.data_format = data_format%0A self.resize(count)%0A%0A def resize(self, count):%0A... | |
3cb7c1cd73dfb73d96af15a183d4e7ef6a9369e8 | create src | src/GitApi.py | src/GitApi.py | Python | 0 | @@ -0,0 +1,2636 @@
+#!/usr/bin/env python%0A# -*- coding:utf-8 -*-%0A%0Afrom requests import get%0Afrom json import loads%0Afrom argparse import ArgumentParser%0A%0A%0Aclass GitHub():%0A%0A def GetRepos(self, user):%0A self.msg = %22%22%0A req = loads(get('https://api.github.com/users/' +%0A ... | |
4f751298176bf2118d4a638e106d5e9572725178 | Add utility class | konstrukteur/Util.py | konstrukteur/Util.py | Python | 0.000001 | @@ -0,0 +1,659 @@
+#%0A# Konstrukteur - Static website generator%0A# Copyright 2013 Sebastian Fastner%0A#%0A%0Aimport re%0Aimport unidecode%0A%0Adef fixCoreTemplating(content):%0A%09%22%22%22 This fixes differences between core JS templating and standard mustache templating %22%22%22%0A%0A%09# Replace %7B%7B=tagname%7D... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.