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 |
|---|---|---|---|---|---|---|---|
4d500d9abe2da28cdd9bd95019048de445aac265 | Add a history demo in documentation. | docs/source/tutorial/v5/history_demo.py | docs/source/tutorial/v5/history_demo.py | Python | 0 | @@ -0,0 +1,850 @@
+# coding: utf-8%0Afrom deprecated.history import deprecated%0Afrom deprecated.history import versionadded%0Afrom deprecated.history import versionchanged%0A%0A%0A@deprecated(%0A reason=%22%22%22%0A This is deprecated, really. So you need to use another function.%0A But I don%5C't know which ... | |
361333f8b214097469389d0219f339fc59ea469b | Add permissions.py | teams/permisssions.py | teams/permisssions.py | Python | 0.000001 | @@ -0,0 +1,287 @@
+from rest_framework.permissions import BasePermission%0A%0Aclass IsOwnerPermission(BasePermission):%0A def has_permission(self, request, view):%0A return request.user.is_authenticated()%0A%0A def has_object_permission(self, request, view, obj):%0A return request.user == obj.owner%... | |
7cb839279bc62b95eb7367814ef71c046d4b2184 | Add 'examples' module which contains some examplary function examples. | tssim/examples.py | tssim/examples.py | Python | 0 | @@ -0,0 +1,725 @@
+%22%22%22This module contains example time functions%22%22%22%0A%0Aimport numpy as np%0A%0A%0Adef rand_lin_noise():%0A beta = np.random.normal()%0A return lambda x: beta * x + np.random.random(size=len(x))%0A%0A%0Adef const_lin_noise(x):%0A beta = np.random.normal()%0A return beta * x + n... | |
c156ad1379d842924b928c6c80f668f9875e840a | Remove page-filter flag. (which is now user-filter) | tools/telemetry/telemetry/story/story_filter.py | tools/telemetry/telemetry/story/story_filter.py | # 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.
import optparse
import re
from telemetry.internal.util import command_line
class _StoryMatcher(object):
def __init__(self, pattern):
self._regex = N... | Python | 0 | @@ -1374,123 +1374,8 @@
.')%0A
- group.add_option('--page-filter', dest='story_filter',%0A help='Deprecated. Use --story-filter instead.')%0A
|
c39c086f51963678769c1066637ca573c721e827 | Create a simple static gallery script. | static_gallery.py | static_gallery.py | Python | 0 | @@ -0,0 +1,1929 @@
+from . import flag%0A#from go import html%0Afrom go import os%0Afrom go import path/filepath%0A%0Adef ReadAlbumDirs(input_dir):%0A f = os.Open(input_dir)%0A with defer f.Close():%0A names = f.Readdirnames(-1)%0A for name in names:%0A stat = os.Stat(filepath.Join(input_dir, name))%0A ... | |
f083789e5615d15715f49a7dbdb25505aa5efae2 | Initialize P1_assignChores | books/AutomateTheBoringStuffWithPython/Chapter16/PracticeProjects/P1_assignChores.py | books/AutomateTheBoringStuffWithPython/Chapter16/PracticeProjects/P1_assignChores.py | Python | 0.000124 | @@ -0,0 +1,471 @@
+# Write a program that takes a list of people%E2%80%99s email addresses and a list of chores%0A# that need to be done and randomly assigns chores to people. Email each person their%0A# assigned chores.%0A#%0A# If you%E2%80%99re feeling ambitious, keep a record of each person%E2%80%99s previously assi... | |
54a9b637aad85a20f3e865185ffed0abfd4192cd | Create tutorial4.py | tutorial4.py | tutorial4.py | Python | 0 | @@ -0,0 +1,813 @@
+from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame%0A%0ASCREEN_WIDTH = 640%0ASCREEN_HEIGHT = 480%0A%0Aclass SpaceShip(Sprite):%0A %22%22%22%0A Animated space ship%0A %22%22%22%0A asset = ImageAsset(%22images/four_spaceship_by_albertov_with_thrust.png%22, %0... | |
1a9302d984e8fd0e467a04c87428b64d874e5f04 | refactor customerWallet | usermanage/views/customerWallet.py | usermanage/views/customerWallet.py | Python | 0.999998 | @@ -0,0 +1,829 @@
+from django.shortcuts import render, redirect%0Afrom django.http import HttpResponseRedirect%0Afrom django.contrib.auth import login, authenticate, logout%0Afrom django.contrib.auth.models import User, Group%0Afrom django.contrib.auth.decorators import login_required, user_passes_test, permission_req... | |
b9f28570ba619db5adacb05a7eadab77f140e876 | Create __init__.py | fake_data_crud_service/rest/__init__.py | fake_data_crud_service/rest/__init__.py | Python | 0.000429 | @@ -0,0 +1,114 @@
+__package__ = 'rest'%0A__author__ = 'Barbaglia, Guido'%0A__email__ = 'guido.barbaglia@gmail.com;'%0A__license__ = 'MIT'%0A
| |
192e60955051f8ffb34f6cc1f1e3f226acb1b5fb | add missing primary key constraints (#7129) | warehouse/migrations/versions/b5bb5d08543d_create_missing_primary_key_constraints.py | warehouse/migrations/versions/b5bb5d08543d_create_missing_primary_key_constraints.py | Python | 0 | @@ -0,0 +1,1021 @@
+# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in writing,... | |
a3d3040f16a604b534406d2f59a841d7ef6cebfa | Test HTTPMediaWikiAPI.get_content() | tests/test_api.py | tests/test_api.py | Python | 0.000001 | @@ -0,0 +1,421 @@
+import requests%0A%0Afrom unittest import TestCase%0Afrom mfnf.api import HTTPMediaWikiAPI%0A%0Aclass TestHTTPMediaWikiAPI(TestCase):%0A%0A def setUp(self):%0A self.api = HTTPMediaWikiAPI(requests.Session())%0A%0A def test_get_content(self):%0A content = self.api.get_content(%22Ma... | |
8139dc9e04025da001323122521951f5ed2c391b | Fix mysql encoding for users.profile.reason | users/migrations/0010_users-profile-encoding.py | users/migrations/0010_users-profile-encoding.py | Python | 0.001314 | @@ -0,0 +1,643 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.9 on 2016-09-25 01:43%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('users', '0009_remove_profile_active'),%0A %5D%0A%0A op... | |
328901c74d1ee103a1ee5b2f26aa391ddeda465b | Add unit test for webpage creation and description | tests/test_web.py | tests/test_web.py | Python | 0 | @@ -0,0 +1,1806 @@
+%22%22%22Test the AutoCMS web reporting functionality.%22%22%22%0A%0Aimport os%0Aimport shutil%0Aimport unittest%0Aimport re%0A%0Afrom autocms.core import load_configuration%0Afrom autocms.web import (%0A produce_default_webpage%0A)%0A%0A%0Aclass TestWebPageCreation(unittest.TestCase):%0A %22%... | |
e6b086f3baef34cf1e5278e930a034a92f4eee76 | Add test for DirectionalGridCRF | tests/test_directional_crf.py | tests/test_directional_crf.py | Python | 0 | @@ -0,0 +1,1860 @@
+import numpy as np%0A%0Afrom numpy.testing import assert_array_equal, assert_array_almost_equal%0A#from nose.tools import assert_almost_equal%0A%0Aimport pystruct.toy_datasets as toy%0Afrom pystruct.lp_new import lp_general_graph%0Afrom pystruct.inference_methods import _make_grid_edges%0Afrom pystr... | |
439e4b740f6903341e81e158e6591c9cbd242a4c | Check in a tool that dumps graphviz output. | tools/graphviz.py | tools/graphviz.py | Python | 0 | @@ -0,0 +1,2833 @@
+#!/usr/bin/python%0A%0A# Copyright (c) 2011 Google Inc. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A%0A%22%22%22Using the JSON dumped by the dump-dependency-json generator,%0Agenerate input suitable for graphviz to ... | |
80d9a407d76f11573af5ccb6783f837b939b5466 | Add Python benchmark | lib/node_modules/@stdlib/math/base/special/erfinv/benchmark/python/benchmark.scipy.py | lib/node_modules/@stdlib/math/base/special/erfinv/benchmark/python/benchmark.scipy.py | Python | 0.000138 | @@ -0,0 +1,1543 @@
+#!/usr/bin/env python%0A%22%22%22Benchmark scipy.special.erfinv.%22%22%22%0A%0Aimport timeit%0A%0Aname = %22erfinv%22%0Arepeats = 3%0Aiterations = 1000000%0A%0A%0Adef print_version():%0A %22%22%22Print the TAP version.%22%22%22%0A%0A print(%22TAP version 13%22)%0A%0A%0Adef print_summary(total,... | |
3133bbfcb5ee56c88ea20be21778519bffe77299 | Add another different type of book | literotica.py | literotica.py | Python | 0.999663 | @@ -0,0 +1,924 @@
+from common import *%0Afrom sys import argv%0Afrom urlgrab import Cache%0Afrom re import compile, DOTALL, MULTILINE%0A%0Acache = Cache()%0Aurl = argv%5B1%5D%0A%0AtitlePattern = compile(%22%3Ch1%3E(%5B%5E%3C%5D+)%3C/h1%3E%22)%0AcontentPattern = compile(%22%3Cdiv class=%5C%22b-story-body-x x-r15%5C%22%... | |
f31d6730a0cfbc50c55e9260391f399e77c3d631 | access the repository from console | utils/__init__.py | utils/__init__.py | Python | 0.000001 | @@ -0,0 +1,18 @@
+__version__=%220.1%22%0A
| |
893679baff0367538bdf3b52b04f8bae72732be8 | Add migration to remove system avatar source. | zerver/migrations/0031_remove_system_avatar_source.py | zerver/migrations/0031_remove_system_avatar_source.py | Python | 0 | @@ -0,0 +1,487 @@
+# -*- 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 ('zerver', '0030_realm_org_type'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterField(%... | |
ff89cda5f77bec569c7451c9ee72ef7c028f7552 | Add sample extraction script | extract_samples.py | extract_samples.py | Python | 0 | @@ -0,0 +1,166 @@
+import sys, os%0Aimport numpy as np%0Aimport pandas as pd%0Aimport datetime%0A%0Aif __name__ == '__main__':%0A infile = sys.argv%5B1%5D%0A csv_content = pd.read_csv(infile, %5B0%5D)%0A
| |
73f47cc6a8a98b2026ee27985f8c3042352c941b | Add lc066_plus_one.py | lc066_plus_one.py | lc066_plus_one.py | Python | 0.000849 | @@ -0,0 +1,819 @@
+%22%22%22Leetcode 66. Plus One%0AEasy%0A%0AURL: https://leetcode.com/problems/plus-one/%0A%0AGiven a non-empty array of digits representing a non-negative integer, %0Aplus one to the integer.%0A%0AThe digits are stored such that the most significant digit is at the %0Ahead of the list, and each eleme... | |
efe8b8f34919425d36fc36eee8ca719c49f4f3b5 | fix data types for default values | lib/governance.py | lib/governance.py | #!/usr/bin/env python
import pdb
import time
import argparse
import sys
import json
sys.path.append("../")
sys.path.append("../scripts")
import misc
import binascii
# PeeWee models -- to replace hand-coded versions
from models import PeeWeeEvent, PeeWeeSuperblock, PeeWeeProposal, PeeWeeGovernanceObject
from pprint i... | Python | 0.000001 | @@ -728,11 +728,9 @@
%22 :
-%220%22
+0
,%0A
@@ -1197,26 +1197,25 @@
ect_type%22 :
-%22%22
+0
,%0A
|
b51398d602a157ce55fd7e08eedd953051f716a1 | Add script to update uploaded files. | backend/scripts/updatedf.py | backend/scripts/updatedf.py | Python | 0 | @@ -0,0 +1,214 @@
+#!/usr/bin/env python%0A%0A#import hashlib%0Aimport os%0A%0Adef main():%0A for root, dirs, files in os.walk(%22/mcfs/data/materialscommons%22):%0A for f in files:%0A print f%0A%0Aif __name__ == %22__main__%22:%0A main()%0A
| |
ba3582d1e4521c040ef9f43c3a4760eb4fd694da | add lib/config_loader.py | hokusai/lib/config_loader.py | hokusai/lib/config_loader.py | Python | 0.000002 | @@ -0,0 +1,945 @@
+import os%0Aimport tempfile%0Aimport shutil%0A%0Afrom urlparse import urlparse%0A%0Aimport boto3%0Aimport yaml%0A%0Afrom hokusai.lib.common import get_region_name%0Afrom hokusai.lib.exceptions import HokusaiError%0A%0Aclass ConfigLoader%0A def __init__(self, uri):%0A self.uri = uri%0A%0A def loa... | |
21e766688e3cc4d08339f81c35dba43d26010a6d | edit vehicle form | vehicles/forms.py | vehicles/forms.py | Python | 0 | @@ -0,0 +1,386 @@
+from django import forms%0A%0A%0Aclass EditVehicleForm(forms.Form):%0A fleet_number = forms.CharField(label='Fleet number', required=False)%0A reg = forms.CharField(label='Registration', required=False)%0A vehicle_type = forms.CharField(label='Type', required=False)%0A colours = forms.Cha... | |
fbf36a2fb52b5ed1aceaec4c1d1075448584a97d | Test that modules can be imported in any order | tests/test_imports.py | tests/test_imports.py | Python | 0 | @@ -0,0 +1,622 @@
+%22%22%22Test that all modules/packages in the lektor tree are importable in any order%0A%0AHere we import each module by itself, one at a time, each in a new%0Apython interpreter.%0A%0A%22%22%22%0Aimport pkgutil%0Aimport sys%0Afrom subprocess import run%0A%0Aimport pytest%0A%0Aimport lektor%0A%0A%0A... | |
e3bdccc8c7ef23b449a53043f4a048fe71cd642c | Use an explicit list due to the filter-object type of python3 | accounting/apps/connect/views.py | accounting/apps/connect/views.py | from django.views import generic
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from accounting.apps.books.models import Organization
from .steps import (
CreateOrganizationStep,
ConfigureTaxRatesStep,
ConfigureBusinessSettingsStep,
ConfigureFinancialSettingsS... | Python | 0.000005 | @@ -1559,33 +1559,26 @@
complete
-d_steps =
+_
filter
-(
+ =
lambda s
@@ -1599,32 +1599,90 @@
ted(request)
+%0A uncompleted_steps = list(filter(uncomplete_filter
, steps)
%0A try
@@ -1661,32 +1661,33 @@
e_filter, steps)
+)
%0A try:%0A
@@ -1713,16 +1713,27 @@
= next(
+s for s in
unco... |
b7fff47b228fbe8774c9f465c383ae1015c598fe | use cvmfs.py for openRootCatalog.py | add-ons/tools/openRootCatalog.py | add-ons/tools/openRootCatalog.py | #!/usr/bin/python
import sys
import zlib
import tempfile
import subprocess
def getRootCatalogName(cvmfspublished):
try:
cvmfspubdata = open(cvmfspublished, 'rb').read()
except:
print "cannot open .cvmfspublished"
sys.exit(1)
lines = cvmfspubdata.split('\n')
if len(lines) < 1:
print ".cvmfspublished is m... | Python | 0 | @@ -23,650 +23,82 @@
ort
-sys%0Aimport zlib%0Aimport tempfile%0Aimport subprocess%0A%0Adef getRootCatalogName(cvmfspublished):%0A%09try:%0A%09%09cvmfspubdata = open(cvmfspublished, 'rb').read()%0A%09except
+cvmfs%0A%0Aimport sys%0A%0Adef usage()
:%0A
-%09
%09print
-%22cannot open .cvmfspublished%22%0A%09%09sys.exi... |
a377195fa95b819924ddfbd3fb564cffbe08f9ae | Add an example for solvent model to customize solvent cavity | examples/solvent/30-custom_solvent_cavity.py | examples/solvent/30-custom_solvent_cavity.py | Python | 0 | @@ -0,0 +1,1924 @@
+#!/usr/bin/env python%0A%0A'''%0ACustom solvent cavity%0A'''%0A%0Aimport numpy%0Afrom pyscf import gto, qmmm, solvent%0A%0A#%0A# Case 1. Cavity for dummy atoms with basis on the dummy atoms%0A#%0Amol = gto.M(atom='''%0AC 0.000000 0.000000 -0.542500%0AO 0.000000 0.0000... | |
97ecb8f7dbcb36cfa9e2d180f29d29002eea127e | add elasticsearch import | examples/ElasticsearchIntegrationWithSpark/import_from_elasticsearch.py | examples/ElasticsearchIntegrationWithSpark/import_from_elasticsearch.py | Python | 0 | @@ -0,0 +1,2082 @@
+#%0A# Licensed to the Apache Software Foundation (ASF) under one or more%0A# contributor license agreements. See the NOTICE file distributed with%0A# this work for additional information regarding copyright ownership.%0A# The ASF licenses this file to You under the Apache License, Version 2.0%0A# (... | |
8b419fefc93f9084b8d504b7382fd51087e4645f | add migration script that removes table 'regressions' | benchbuild/db/versions/001_Remove_RegressionTest_table.py | benchbuild/db/versions/001_Remove_RegressionTest_table.py | Python | 0.000138 | @@ -0,0 +1,846 @@
+%22%22%22%0ARemove unneeded Regressions table.%0A%0AThis table can and should be reintroduced by an experiment that requires it.%0A%22%22%22%0Afrom sqlalchemy import Table, Column, ForeignKey, Integer, String%0Afrom benchbuild.utils.schema import metadata%0A%0AMETA = metadata()%0AREGRESSION = Table('... | |
847232f2890a4700e4983cd971ef2cd1a76a4b1d | rebuild cases | corehq/apps/cleanup/management/commands/rebuild_cases.py | corehq/apps/cleanup/management/commands/rebuild_cases.py | Python | 0.000002 | @@ -0,0 +1,1235 @@
+from __future__ import print_function%0Afrom __future__ import absolute_import%0Afrom __future__ import unicode_literals%0Aimport logging%0Afrom django.core.management.base import BaseCommand%0A%0Afrom corehq.form_processor.backends.sql.processor import FormProcessorSQL%0Afrom corehq.form_processor.... | |
0919661333c8099a85e7c12c6ce9393ced8c985b | create the lib directory to hold vendored libraries | ceph_deploy/lib/__init__.py | ceph_deploy/lib/__init__.py | Python | 0 | @@ -0,0 +1,272 @@
+%22%22%22%0AThis module is meant for vendorizing Python libraries. Most libraries will need%0Ato have some %60%60sys.path%60%60 alterations done unless they are doing relative%0Aimports.%0A%0ADo **not** add anything to this module that does not represent a vendorized%0Alibrary.%0A%22%22%22%0A%0Aimpor... | |
6303ffeee0118a2fef1cb0a9abfe931a04ee6974 | Fix web app. #79 | channelworm/web_app/wsgi.py | channelworm/web_app/wsgi.py | Python | 0.000048 | @@ -0,0 +1,389 @@
+%22%22%22%0AWSGI config for myproject project.%0AIt exposes the WSGI callable as a module-level variable named %60%60application%60%60.%0AFor more information on this file, see%0Ahttps://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/%0A%22%22%22%0A%0Aimport os%0Aos.environ.setdefault(%22DJANGO_... | |
e5ed4497fd8aee709dd441cfcddc9a1a91c538d4 | add theilsen | chart-02-theilsen-median-of-root-median-squared-errors.py | chart-02-theilsen-median-of-root-median-squared-errors.py | Python | 0.999936 | @@ -0,0 +1,1238 @@
+# create files for chart-02-theilsen-median-of-root-mdian-squared-errors%0A# with these choices%0A# metric in median-root-median-squared-errors%0A# model in theilsen%0A# ndays in 30 60 ... 360%0A# predictors in act actlog ct ctlog%0A# responses in price logprice%0A# usetax i... | |
2df737f2690925e2752ae7633f1db05f952209bc | Create led_record.py | led_record.py | led_record.py | Python | 0.000001 | @@ -0,0 +1,1588 @@
+#!/usr/bin/env python%0Aimport RPi.GPIO as GPIO%0Afrom time import sleep%0Aimport os%0Aimport subprocess%0A%0A# Setup getting an image%0Adef get_video(state):%0A folderName = %22/home/pi/HumphreyData/%22%0A%09if os.path.isdir(folderName)== False:%0A%09 os.makedirs(folderName)%0A fileNumber = 1%... | |
4567d9d710654ef47f971821a9bec79a41515264 | Make call_local test a bit more complex. | distarray/tests/test_odin.py | distarray/tests/test_odin.py | """
Test Odin extensions to distarray.
To run these tests, you must have an ipcluster running
For example,
$ ipcluster start -n <n> --engines=MPIEngineSetLauncher
"""
import unittest
import numpy as np
from distarray import odin
@odin.local
def assert_allclose(da, db):
assert np.allclose(da, db), "Arrays ... | Python | 0 | @@ -1221,22 +1221,20 @@
a):%0A
-return
+db =
local_a
@@ -1242,16 +1242,61 @@
d50(da)%0A
+ dc = local_add_num(db, 99)%0A return dc%0A
%0A%0Aclass
@@ -3692,16 +3692,21 @@
.pi + 50
+ + 99
)%0A%0A%0Aif _
|
f68689e3b6caaad2d143d92af5395f7c12316525 | add simple test file | test.py | test.py | Python | 0 | @@ -0,0 +1,1552 @@
+from __future__ import division%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0A%0Afrom pybasicbayes.distributions import Gaussian, Regression%0Afrom autoregressive.distributions import AutoRegression%0Afrom pyhsmm.util.text import progprint_xrange%0A%0Afrom models import LDS%0A%0Anp.random... | |
2e4bb9ca00c992dab0967b3238d8aebd8710d79d | Create controller.py | src/controller.py | src/controller.py | Python | 0.000001 | @@ -0,0 +1,72 @@
+#!/usr/bin/env python%0Aimport rospy%0A%0Aif __name__ == '__main__':%0A pass%0A
| |
c3748579854ae06c995cb12ea45a1be4de8f827d | Add gallery migration | features/galleries/migrations/0003_auto_20170421_1109.py | features/galleries/migrations/0003_auto_20170421_1109.py | Python | 0 | @@ -0,0 +1,576 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11 on 2017-04-21 09:09%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0Aimport django.db.models.deletion%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('galleries', '0002_... | |
a6381765ad8e15624a5dabb848283e92b0e90d8c | Create rpkm_bin.py | code_collection/rpkm_bin.py | code_collection/rpkm_bin.py | Python | 0.000003 | @@ -0,0 +1,934 @@
+import sys%0A%0Apeak=%5B%5D%0Awith open(sys.argv%5B1%5D,'r') as f:%0A%09for line in f:%0A%09%09line=line.strip('%5Cn').split('%5Ct')%0A%09%09peak.append(line)%0A%0Abed=%5B%5D%0Awith open(sys.argv%5B2%5D,'r') as f:%0A%09for line in f:%0A%09%09line=line.strip('%5Cn').split('%5Ct')%0A%09%09bed.append(li... | |
85202173cf120caad603315cd57fa66857a88b0b | Add missing migrations for institutions | feder/institutions/migrations/0013_auto_20170810_2118.py | feder/institutions/migrations/0013_auto_20170810_2118.py | Python | 0.000006 | @@ -0,0 +1,535 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.2 on 2017-08-10 21:18%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0Aimport jsonfield.fields%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('institutions', '0012_auto_2017080... | |
4bb5653f5f7f95bf28b2ee596c441cbc4c7fbf3a | Create whitefilterstr.py | whitefilterstr.py | whitefilterstr.py | Python | 0.000016 | @@ -0,0 +1,539 @@
+def whiteListCharFilter(inStr, whiteListStr):%0A %22%22%22 Sanatize a string with a list of allowed (white) characters%0A%0A Input: inStr %7Bstring%7D String to be sanatized.%0A Input: whiteListStr %7Bstring%7D String with allowed characters.%0A Output: outStr %7Bstring%7D Sanatized strin... | |
4bfb560dc9f28d850a89c98590df032849cfc035 | Create zoql.py | zoql.py | zoql.py | Python | 0.000164 | @@ -0,0 +1,1180 @@
+#!/usr/local/bin/python3%0A%0Aimport sys%0Aimport cmd%0Aimport csv%0A%0Aimport pdb%0A%0Aimport config%0Afrom zuora import Zuora%0A%0Azuora = Zuora(config.zuoraConfig)%0A%0A%0Adef zuoraObjectKeys(zouraObject):%0A if zouraObject:%0A return zouraObject.keys()%0A %0Adef dumpRecords(records)... | |
a7a16e4317b9b61d3e01b8ec54ad499d73a3a600 | Fix tracebacks | homeassistant/components/upnp/config_flow.py | homeassistant/components/upnp/config_flow.py | """Config flow for UPNP."""
import voluptuous as vol
from homeassistant import config_entries
from homeassistant import data_entry_flow
from .const import (
CONF_ENABLE_PORT_MAPPING, CONF_ENABLE_SENSORS,
CONF_SSDP_DESCRIPTION, CONF_UDN
)
from .const import DOMAIN
def ensure_domain_data(hass):
"""Ensure ... | Python | 0.000015 | @@ -2963,24 +2963,63 @@
set up.%22%22%22%0A
+ ensure_domain_data(self.hass)%0A%0A
# if
@@ -4465,32 +4465,71 @@
onfig entry.%22%22%22%0A
+ ensure_domain_data(self.hass)%0A%0A
return a
@@ -4657,32 +4657,71 @@
s new entry.%22%22%22%0A
+ ensure_domain_data(self.hass)%0A%0A
... |
eb250318cf6933b4a037bd9ea238ce0fc7be58c2 | add first script | gitthemall.py | gitthemall.py | Python | 0.000018 | @@ -0,0 +1,1214 @@
+#! /usr/bin/env python2%0Aimport argparse%0Aimport os.path%0Aimport logging%0Aimport sys%0A%0Alogging.basicConfig(format='%25(levelname)s: %25(message)s')%0A%0Adef fail(msg):%0A 'Fail program with printed message'%0A logging.error(msg)%0A sys.exit(1)%0A%0Adef update(repo, actions):%0A 'U... | |
f9ea992353f2caa835ca2007eb07b470d1b782a3 | Fix migration colorfield | geotrek/trekking/migrations/0006_practice_mobile_color.py | geotrek/trekking/migrations/0006_practice_mobile_color.py | Python | 0.000002 | @@ -0,0 +1,606 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.14 on 2019-03-04 12:43%0Afrom __future__ import unicode_literals%0A%0Aimport colorfield.fields%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('trekking', '0005_auto_20181219_... | |
96b7a859e04673af63732b061298b3b852b08250 | Fix filetransfer version | setup.py | setup.py | #!/usr/bin/env python
import os
import bluebottle
from setuptools import setup, find_packages
def read_file(name):
return open(os.path.join(os.path.dirname(__file__), name)).read()
readme = read_file('README.rst')
changes = ''
dependency_links = [
'git+https://github.com/onepercentclub/django-taggit-autoco... | Python | 0.000001 | @@ -880,16 +880,155 @@
-0.2.16'
+,%0A 'hg+https://bitbucket.org/jdiascarvalho/django-filetransfers@89c8381764da217d72f1fa396ce3929f0762b8f9#egg=django-filetransfers-0.1.1'
%0A%5D%0A%0Ainst
@@ -2407,17 +2407,17 @@
rs==0.1.
-0
+1
',%0A '
|
3959ad4a4ddc4655c1acd8362de4284ba1e8d3e7 | Apply the hack that renames local_settings.py only when running setup.py | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
from setuptest import test
import os
'''
Rename local_settings.py in order to
be excluded from setup.py install command
'''
ORIG_NAME = 'cronos/local_settings.py'
TEMP_NAME = 'cronos/local_settings.py1'
try:
os.rename(ORIG_NAME, TEMP_NAME)
except:
... | Python | 0.000001 | @@ -96,22 +96,64 @@
mport os
-%0A%0A'''%0A
+, sys%0A%0Aif sys.argv%5B1%5D == 'install':%0A '''%0A
Rename l
@@ -181,16 +181,20 @@
rder to%0A
+
be exclu
@@ -227,20 +227,28 @@
command%0A
-'''%0A
+ '''%0A
ORIG_NAM
@@ -278,16 +278,20 @@
ngs.py'%0A
+
TEMP_NAM
@@ -322,16 +322,20 @@
gs.py1'%0A
+ ... |
1c181eb7f9987d2147df48a762d34895593f031a | Add version for torch dependency | setup.py | setup.py | #!/usr/bin/env python
import io
import os
import shutil
import subprocess
from pathlib import Path
import distutils.command.clean
from setuptools import setup, find_packages
from build_tools import setup_helpers
ROOT_DIR = Path(__file__).parent.resolve()
def read(*names, **kwargs):
with io.open(ROOT_DIR.joinpat... | Python | 0 | @@ -1208,16 +1208,201 @@
RSION)%0A%0A
+pytorch_package_version = os.getenv('PYTORCH_VERSION')%0A%0Apytorch_package_dep = 'torch'%0Aif pytorch_package_version is not None:%0A pytorch_package_dep += %22==%22 + pytorch_package_version%0A%0A
%0Aclass c
@@ -2437,23 +2437,35 @@
uests',
-'
+py
torch
-'
+_package_dep
... |
b187e844d667b14dcc7874b351ee3f82383be348 | Fix dependency reference error | setup.py | setup.py | import ast
import re
from setuptools import setup, find_packages
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('puckdb/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
setup(
name='puckdb',
author='Aaron Toth',
v... | Python | 0.000007 | @@ -772,26 +772,8 @@
s',%0A
- 'dotenv',%0A
|
b782a5af281a9fc841477d2360197c6e35ee794d | Version bump (there will be a day when I remember earlier) | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(name='mongodbforms',
version='0.1d',
description="An implementation of django forms using mongoengine.",
author='Jan Schrewe',
author_email='jan@schafproductions.com',
url='http://www.schafproductions.com',
packages=['mongodbforms',]... | Python | 0 | @@ -93,17 +93,17 @@
ion='0.1
-d
+e
',%0A d
|
40c6a07808be26de0534a5b6f47ef28f591a500c | bump again | setup.py | setup.py | from setuptools import setup, find_packages
requires = []
dep_links = []
for dep in open('requirements.txt').read().split("\n"):
if dep.startswith('git+'):
dep_links.append(dep)
else:
requires.append(dep)
setup(
name='django-suave',
version="0.5.6",
description='Rather nice pages.... | Python | 0 | @@ -278,9 +278,9 @@
0.5.
-6
+7
%22,%0A
|
2672d4af2c480cfbd83418db2b660a335bdf4540 | bump version on invenio packages | setup.py | setup.py | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Invenio Digital Library Framework."""
import os
from setuptools import find_pack... | Python | 0 | @@ -604,25 +604,25 @@
nvenio%3E=1.0.
-0
+2
,%3C1.1.0',%0A%5D%0A
@@ -920,25 +920,25 @@
o-mail%3E=1.0.
-0
+1
,%3C1.1.0',%0A
@@ -1058,25 +1058,25 @@
access%3E=1.0.
-0
+1
,%3C1.1.0',%0A
@@ -1096,33 +1096,33 @@
o-accounts%3E=1.0.
-0
+1
,%3C1.1.0',%0A
@@ -1142,33 +1142,33 @@
uth2server%3E=1.0.
-0
+1
,%3C1... |
9be0f7d7ce0a562fdda5fc065a8971ccdf3b7c2c | Bump version to 1.1.0 | setup.py | setup.py | #!/usr/bin/env python
import os
import subprocess
import tarfile
import shutil
import sysconfig
import requests
from setuptools import setup
from setuptools.command.build_ext import build_ext
from setuptools.extension import Extension
def urlretrieve(source_url, destination_path):
response = requests.get(source... | Python | 0 | @@ -3840,11 +3840,11 @@
='1.
-0.2
+1.0
',%0A
|
71fb2fc819c82e2db4075c6e5e32b2addc99c63a | Add platforms and classifiers | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
setup(name='gsmsapi',
version='0.10',
description='SMS API for (german) SMS providers',
author='Torge Szczepanek',
author_email='debian@cygnusnetworks.de',
maintainer='Torge Szczepanek',
maintainer_email='debian@cygnusnetworks.de',
lice... | Python | 0.000001 | @@ -549,10 +549,366 @@
%22api%22%5D,%0A
+%09platforms='any',%0A%09classifiers=%5B%0A%09%09'Development Status :: 4 - Beta',%0A%09%09'Intended Audience :: Developers',%0A%09%09'License :: OSI Approved :: MIT License',%0A%09%09'Operating System :: OS Independent',%0A%09%09'Programming Language :: Python',%0A%09%09'Topic... |
8b8383680e73496a73a3a520c3ebc85e2e01ce01 | fix version in setup.py | setup.py | setup.py | #!/usr/bin/env python
"""
Flask-REST4
-------------
Elegant RESTful API for your Flask apps.
"""
from setuptools import setup
setup(
name='flask_rest4',
version='0.1.0',
url='https://github.com/squirrelmajik/flask_rest4',
license='See License',
author='majik',
author_email='me@yamajik.com',
... | Python | 0 | @@ -170,17 +170,17 @@
on='0.1.
-0
+3
',%0A u
|
b03b6faea0470d867749c7b3bc3d6edc9c2406b9 | Remove pytest-Django | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
# Utility function to read file in the setup.py directory
def open_here(fname):
return open(os.path.join(os.path.dirname(__file__), fname))
def get_dependenci... | Python | 0.000006 | @@ -1671,34 +1671,8 @@
ose'
-, '--ds=app.test_settings'
%5D%0A
@@ -3468,25 +3468,8 @@
%3E=3'
-, 'pytest-django'
%5D,%0A
|
656d24c38c69891d8731ccf32852b66e32120eb7 | Bump dependency | setup.py | setup.py | #!/usr/bin/env python
from setuptools import find_packages, setup
project = "microcosm_pubsub"
version = "0.26.1"
setup(
name=project,
version=version,
description="PubSub with SNS/SQS",
author="Globality Engineering",
author_email="engineering@globality.com",
url="https://github.com/globality... | Python | 0.000001 | @@ -574,17 +574,17 @@
m%3E=0.17.
-1
+2
%22,%0A
|
5e9fa7a1bb8601fb5629d7e7e92a894ab335ccf1 | update readme extension | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read().replace('.. :changelog:', ... | Python | 0 | @@ -156,19 +156,18 @@
'README.
-rst
+md
') as re
@@ -214,115 +214,8 @@
()%0A%0A
-with open('HISTORY.rst') as history_file:%0A history = history_file.read().replace('.. :changelog:', '')%0A%0A
requ
@@ -571,27 +571,8 @@
adme
- + '%5Cn%5Cn' + history
,%0A
|
187dbc9feab320c720c2632c4140a62e2c384328 | bump version | setup.py | setup.py | #!/usr/bin/env python
# Copyright 2016 IBM All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | Python | 0 | @@ -768,17 +768,17 @@
_ = '0.2
-4
+5
.0'%0A%0Aif
|
c95234c130435ddd116784ad1829f7bdaa9182c5 | ADD 138 solutions with A195615(OEIS) | 100_to_199/euler_138.py | 100_to_199/euler_138.py | Python | 0 | @@ -0,0 +1,1478 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A'''%0AProblem 138%0AConsider the isosceles triangle with base length, b = 16, and legs, L = 17.%0A%0A%0ABy using the Pythagorean theorem it can be seen that the height of the triangle, h = %E2%88%9A(172 %E2%88%92 82) = 15, which is one less than ... | |
e7b54968a67bda76546deff546baa49f836cfbaa | Add train_fcn32s | examples/voc/train_fcn32s.py | examples/voc/train_fcn32s.py | Python | 0.000003 | @@ -0,0 +1,1643 @@
+#!/usr/bin/env python%0A%0Aimport chainer%0Afrom chainer.training import extensions%0A%0Aimport fcn%0A%0A%0Adef main():%0A gpu = 0%0A resume = None # filename%0A%0A # 1. dataset%0A dataset_train = fcn.datasets.PascalVOC2012SegmentationDataset('train')%0A dataset_val = fcn.datasets.Pa... | |
b01bd1b21f1b12c9120845ec8a85355b038d6b20 | Add a basic Storage engine to talk to the DB | inventory_control/storage.py | inventory_control/storage.py | Python | 0 | @@ -0,0 +1,667 @@
+%22%22%22%0AThis is the Storage engine. It's how everything should talk to the database%0Alayer that sits on the inside of the inventory-control system.%0A%22%22%22%0A%0Aimport MySQLdb%0A%0A%0Aclass StorageEngine(object):%0A %22%22%22%0A Instantiate a DB access object, create all the necessary ... | |
5397bbe4a87dba82dc9fa57abf09a4346aa63f46 | Add 168 python solution (#38) | python/168_Excel_Sheet_Column_Title.py | python/168_Excel_Sheet_Column_Title.py | Python | 0 | @@ -0,0 +1,199 @@
+class Solution:%0A def convertToTitle(self, n: int) -%3E str:%0A res = %22%22%0A while n %3E 0:%0A n -= 1%0A res = chr(65 + n %25 26) + res%0A n //= 26%0A return res%0A
| |
399daa8ebec14bc4d7ee6c08135e525190e1eb6f | Add short Python script that prints as many dummy divs as needed. | collections/show-test/print-divs.py | collections/show-test/print-divs.py | Python | 0 | @@ -0,0 +1,130 @@
+# print-divs.py%0A%0Adef printDivs(num):%0A%09for i in range(num):%0A%09%09print('%3Cdiv class=%22item%22%3EItem ' + str(i+1) + '%3C/div%3E')%0A%0AprintDivs(20)
| |
97883fa22dd8b1207cd533b4dd9e438c83a32a90 | Update version. | mixer/__init__.py | mixer/__init__.py | """
Description.
"""
# Module information
# ==================
__version__ = '0.1.0'
__project__ = 'mixer'
__author__ = "horneds <horneds@gmail.com>"
__license__ = "BSD" | Python | 0 | @@ -84,9 +84,9 @@
'0.
-1
+2
.0'%0A
@@ -169,8 +169,9 @@
= %22BSD%22
+%0A
|
2b80b358edd5bcf914d0c709369dbbcfd748772b | Add in a test for the marketing_link function in mitxmako | common/djangoapps/mitxmako/tests.py | common/djangoapps/mitxmako/tests.py | Python | 0.000002 | @@ -0,0 +1,1032 @@
+from django.test import TestCase%0Afrom django.test.utils import override_settings%0Afrom django.core.urlresolvers import reverse%0Afrom django.conf import settings%0Afrom mitxmako.shortcuts import marketing_link%0Afrom mock import patch%0A%0A%0Aclass ShortcutsTests(TestCase):%0A %22%22%22%0A ... | |
7236d0358064968b9cbb0ab7f4ee9876dea02aaa | add python common functions | python/tcp_port_scan/tcp_port_scan.py | python/tcp_port_scan/tcp_port_scan.py | Python | 0.000222 | @@ -0,0 +1,2695 @@
+# -*- coding: utf-8 -*-%0A#!/usr/bin/python%0A##-------------------------------------------------------------------%0A## @copyright 2015 DennyZhang.com%0A## File : tcp_port_scan.py%0A## Author : DennyZhang.com %3Cdenny@dennyzhang.com%3E%0A## Description :%0A## --%0A## Created : %3C2016-01-15%3E%0A##... | |
c61850de298a1f40dd84d95d758d3c3faed38160 | Add safe_decode utility function | nose2/util.py | nose2/util.py | import os
import re
import sys
try:
from compiler.consts import CO_GENERATOR
except ImportError:
# IronPython doesn't have a complier module
CO_GENERATOR=0x20
try:
from inspect import isgeneratorfunction # new in 2.6
except ImportError:
import inspect
# backported from Python 2.6
def isgen... | Python | 0.000233 | @@ -473,16 +473,28 @@
RATOR)%0A%0A
+import six%0A%0A
%0AIDENT_R
@@ -2307,8 +2307,285 @@
n False%0A
+%0A%0Adef safe_decode(string):%0A if string is None:%0A return string%0A try:%0A return string.decode()%0A except UnicodeDecodeError:%0A pass%0A try:%0A return string.decode('ut... |
a119c9f53babd87f5e5adc1886256c59a21c19a5 | Move content_type formatting support to a different module | hug/format.py | hug/format.py | Python | 0.000001 | @@ -0,0 +1,223 @@
+def content_type(content_type):%0A '''Attaches an explicit HTML content type to a Hug formatting function'''%0A def decorator(method):%0A method.content_type = content_type%0A return method%0A return decorator%0A
| |
ef803b8ac95bb2440d1d312584376149573ac798 | Create bbgdailyhistory.py | BBG/bbgdailyhistory.py | BBG/bbgdailyhistory.py | Python | 0.002245 | @@ -0,0 +1,2933 @@
+# *- bbgdailyhistory.py -*%0A%0Aimport os%0Aimport numpy as np%0Aimport pandas as pd%0Aimport blpapi%0A%0A%0Aclass BBGDailyHistory:%0A '''%0A Parameters%0A ----------%0A sec : str%0A Ticker%0A fields : str or list%0A Field of list of fields ('PX_HIGH', 'PX_LOW', etc...)%... | |
353868bc281ade826b48d2c5a79ad14986c0d35c | Create lowercaseLists.py | Bits/lowercaseLists.py | Bits/lowercaseLists.py | Python | 0 | @@ -0,0 +1,478 @@
+#!/usr/bin/env python%0A%0Adocs = %5B%22The Corporation%22, %22Valentino: The Last Emperor%22, %22Kings of Patsry%22%5D%0Amovies = %5B%22The Talented Mr. Ripley%22, %22The Network%22, %22Silence of the Lambs%22, %22Wall Street%22, %22Marie Antoinette%22, %22My Mana Godfrey%22, %22Rope%22, %22Sleuth%2... | |
9afd1a8d3584e45d32858c3b8fa44efd0f1a09f1 | add unit test for ofproto automatic detection | ryu/tests/unit/ofproto/test_ofproto.py | ryu/tests/unit/ofproto/test_ofproto.py | Python | 0 | @@ -0,0 +1,2429 @@
+# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.%0A# Copyright (C) 2013 Isaku Yamahata %3Cyamahata at private email ne jp%3E%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 ob... | |
81afc4ed6d7390567dfe9949c9f332b36a6add9c | Add lang install es_ES | l10n_cr_base/l10n_cr_base.py | l10n_cr_base/l10n_cr_base.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# l10n_cr_base.py
# l10n_cr_base
# First author: Carlos Vásquez <carlos.vasquez@clearcorp.co.cr> (ClearCorp S.A.)
# Copyright (c) 2010-TODAY ClearCorp S.A. (http://clearcorp.co.cr). All rights reserved... | Python | 0 | @@ -3252,8 +3252,294 @@
rtner()%0A
+%0Adef _lang_es_install(self, cr, uid, data, context):%0A lang = 'es_ES'%0A modobj = pooler.get_pool(cr.dbname).get('ir.module.module')%0A mids = modobj.search(cr, uid, %5B('state', '=', 'installed')%5D)%0A modobj.update_translations(cr, uid, mids, lang)%0A return %7B... |
e1810dcfd635198363838ed5c4dcd92c1cef1b07 | use wikistats lib to update languages_by_size | scripts/maintenance/wikimedia_sites.py | scripts/maintenance/wikimedia_sites.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""Script that updates the language lists in Wikimedia family files."""
#
# (C) xqt, 2009-2014
# (C) Pywikibot team, 2008-2014
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__version__ = '$Id$'
#
import codecs
... | Python | 0 | @@ -129,17 +129,17 @@
2009-201
-4
+6
%0A# (C) P
@@ -165,9 +165,9 @@
-201
-4
+6
%0A#%0A#
@@ -335,71 +335,55 @@
ort
-requests%0A%0Afrom xml.etree import cElementTree%0A%0A
+pywikibot%0A%0Afrom pywikibot.data
import
-py
wiki
-bot%0A
+stats
%0Afro
@@ -420,86 +420,43 @@
ly%0A%0A
-URL = 'https://wikistats.wmflabs... |
657591afce265521078a7cb2f84347c2319b6b33 | Add tests to help with autograding | nbgrader/tests.py | nbgrader/tests.py | Python | 0 | @@ -0,0 +1,445 @@
+import nose.tools%0Aimport numpy as np%0A%0A%0Adef assert_unequal(a, b, msg=%22%22):%0A if a == b:%0A raise AssertionError(msg)%0A%0A%0Adef assert_same_shape(a, b):%0A a_ = np.array(a, copy=False)%0A b_ = np.array(b, copy=False)%0A assert a_.shape == b_.shape, %22%7B%7D != %7B%7D%2... | |
5e7746d054f7762d93e1f70296fa3b43f882553c | Add synthtool scripts (#3765) | java-bigquerydatatransfer/google-cloud-bigquerydatatransfer/synth.py | java-bigquerydatatransfer/google-cloud-bigquerydatatransfer/synth.py | Python | 0.000001 | @@ -0,0 +1,1357 @@
+# Copyright 2018 Google LLC%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/LICENSE-2.0%0A#%0A# Unless required by a... | |
c13ec330194612832dfb0953d3e561a0ac151d69 | add irrigation baseline file gen scripts | scripts/RT/create_irrigation_files.py | scripts/RT/create_irrigation_files.py | Python | 0 | @@ -0,0 +1,814 @@
+%22%22%22Create the generalized irrigation files, for now.%0A%0Ahttps://www.ars.usda.gov/ARSUserFiles/50201000/WEPP/usersum.pdf page 60%0A%22%22%22%0Afrom datetime import date%0A%0ALASTYEAR = date.today().year%0A%0A%0Adef main():%0A %22%22%22Create files.%22%22%22%0A for ofecnt in range(1, 7): ... | |
1b9aa5ccd500e17aa32c315e212068c8be96216c | Add profiler, now not import. thanks @tweekmoster! | rplugin/python3/deoplete/sources/deoplete_go/profiler.py | rplugin/python3/deoplete/sources/deoplete_go/profiler.py | Python | 0 | @@ -0,0 +1,1369 @@
+import functools%0Aimport queue%0A%0Atry:%0A import statistics%0A stdev = statistics.stdev%0A mean = statistics.mean%0Aexcept ImportError:%0A stdev = None%0A%0A def mean(l):%0A return sum(l) / len(l)%0A%0Atry:%0A import time%0A clock = time.perf_counter%0Aexcept Exception... | |
e9f2e966361d8a23c83fbbbb4a4b3d4046203a16 | Test script for the heart container | CERR_core/Contouring/models/heart/test/test.py | CERR_core/Contouring/models/heart/test/test.py | Python | 0 | @@ -0,0 +1,612 @@
+#Test script for heart container testing if all the imports are successful%0A%0Aimport sys%0Aimport os%0Aimport numpy as np%0Aimport h5py%0Aimport fnmatch%0Afrom modeling.sync_batchnorm.replicate import patch_replication_callback%0Afrom modeling.deeplab import *%0Afrom torchvision.utils import make_g... | |
b223c8be2bcb11d529a07997c05a9c5ab2b183b2 | Add basic tests for run length encoding printable | csunplugged/tests/resources/generators/test_run_length_encoding.py | csunplugged/tests/resources/generators/test_run_length_encoding.py | Python | 0 | @@ -0,0 +1,3175 @@
+from unittest import mock%0Afrom django.http import QueryDict%0Afrom django.test import tag%0Afrom resources.generators.RunLengthEncodingResourceGenerator import RunLengthEncodingResourceGenerator%0Afrom tests.resources.generators.utils import BaseGeneratorTest%0A%0A%0A@tag(%22resource%22)%0Aclass R... | |
24c3166906c8431523c641721e635fdc28fd91ce | add server that tests if a cookie was set | cookiescheck-test-server.py | cookiescheck-test-server.py | Python | 0.000001 | @@ -0,0 +1,643 @@
+import sys%0A%0Afrom flask import Flask, request, send_from_directory, make_response, abort%0Aapp = Flask(__name__)%0A%0Afilepath = None%0Amainpath = None%0A%0A@app.route('/%3Cpath:path%3E')%0Adef get(path):%0A ret = make_response(send_from_directory(filepath, path))%0A%0A if path == mainpath:%... | |
c011154135a73db2c5bba247fc33f94032553f2e | Correct package files | janitor/__init__.py | janitor/__init__.py | Python | 0.000082 | @@ -0,0 +1,93 @@
+import utils%0A%0Autils = utils%0Alogger, logger_api = utils.logger.setup_loggers(%0A %22janitor%22%0A)%0A
| |
b6aedc1589c754bb867381e309aba5ae19f7bb1a | Create GDAL_SaveRaster.py | GDAL_SaveRaster.py | GDAL_SaveRaster.py | Python | 0 | @@ -0,0 +1,1331 @@
+%0Afrom osgeo import gdal%0A%0A%0A%0Adef save_raster ( output_name, raster_data, dataset, driver=%22GTiff%22 ):%0A %22%22%22%0A A function to save a 1-band raster using GDAL to the file indicated%0A by %60%60output_name%60%60. It requires a GDAL-accesible dataset to collect%0A the projec... | |
542731f7fb3f5d09c4de4340f7ce18b7cbf41172 | Create Client.py | Client.py | Client.py | Python | 0.000001 | @@ -0,0 +1,206 @@
+from Networking import Client%0A%0Aclient = Client()%0Aclient.connect('10.42.42.25', 12345).send(%7B'Ordre':'Timelapse', 'Action':%5B%22/home/pi/photo3%22, 24, 30, 0.25, False%5D%7D)%0Areponse = client.recv()%0Aclient.close()%0A%0A%0A
| |
745adf9898e6dc80d37f1a0c3c4361acf76f2feb | Create main.py | main.py | main.py | Python | 0.000001 | @@ -0,0 +1,1471 @@
+import webapp2%0Aimport logging%0Aimport json%0Aimport utils%0Aimport re%0Aimport advanced%0A%0Aclass show_search_results(utils.BaseHandler):%0A def post(self):%0A #get info about slack post%0A token = self.request.get('token')%0A channel = self.request.get('c... | |
42753fc71b6a7cbe8697ba0eb053fdbc39c852a1 | add test_eval | misc/test_eval.py | misc/test_eval.py | Python | 0 | @@ -0,0 +1,532 @@
+%0A# eval%0Adef main():%0A dictString = %22%7B'Define1':%5B%5B63.3,0.00,0.5,0.3,0.0%5D,%5B269.3,0.034,1.0,1.0,0.5%5D,%22 %5C%0A %22%5B332.2,0.933,0.2,0.99920654296875,1%5D,%5B935.0,0.990,0.2,0.1,1.0%5D%5D,%22 %5C%0A %22'Define2':%5B%5B63.3,0.00,0.5,0.2,1.0%5D,%5B269... | |
a9da84352d6ff8b26a8e25ac9d15d5737c84225f | Add problem 12 | problem_12.py | problem_12.py | Python | 0.000203 | @@ -0,0 +1,2826 @@
+from crypto_library import ecb_aes%0Afrom problem_11 import distinguish_encryption_mode%0Afrom string import printable%0A'''%0Afrom crypto_library import BLOCKSIZE%0Aimport random%0A%0AENCRYPTION_KEY = ''.join(random.choice(printable) for _ in range(BLOCKSIZE))%0A'''%0A%0A%0Adef new_encryption_oracl... | |
0ecc153d3946258f7daddd48bfc2870cb497b5db | Add IPlugSession interface | pyramid_pluggable_session/interfaces.py | pyramid_pluggable_session/interfaces.py | Python | 0 | @@ -0,0 +1,861 @@
+from zope.interface import Interface%0A%0Aclass IPlugSession(Interface):%0A %22%22%22 In interface that describes a pluggable session%0A %22%22%22%0A%0A def loads(session, request):%0A %22%22%22 This function given a %60%60session%60%60 and %60%60request%60%60 should using the%0A ... | |
1447a057095fb5b9f3845451e434d81d79e4e795 | version 0.2.0 | fb/__init__.py | fb/__init__.py | Python | 0.000003 | @@ -0,0 +1,2 @@
+ %0A
| |
a0d8eff20cfd8b60be005e31692af74837ca16f5 | test math.ceil() function | pythonPractiseSamples/mathExcercises.py | pythonPractiseSamples/mathExcercises.py | Python | 0.000099 | @@ -0,0 +1,414 @@
+#! /usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A# vim:fenc=utf-8%0A#%0A# Copyright %C2%A9 2016 Damian Ziobro %3Cdamian@xmementoit.com%3E%0A%0Aimport unittest%0Aimport math%0A%0Aclass TestMathMethods(unittest.TestCase):%0A%0A def setUp(self):%0A self.number = 3.5%0A%0A def test_ceil(s... | |
44130357b98001790547d53b7e1080e79842a058 | add group recorded | test_add_group.py | test_add_group.py | Python | 0 | @@ -0,0 +1,1871 @@
+# -*- coding: utf-8 -*-%0Afrom selenium.webdriver.firefox.webdriver import WebDriver%0Afrom selenium.webdriver.common.action_chains import ActionChains%0Aimport time, unittest%0A%0Adef is_alert_present(wd):%0A try:%0A wd.switch_to_alert().text%0A return True%0A except:%0A ... | |
4569c22d2d0245641e0c2696f798f273405c6bee | Test recorded and exported to the project | test_add_group.py | test_add_group.py | Python | 0 | @@ -0,0 +1,1894 @@
+# -*- coding: utf-8 -*-%0Afrom selenium.webdriver.firefox.webdriver import WebDriver%0Afrom selenium.webdriver.common.action_chains import ActionChains%0Aimport time, unittest%0A%0Adef is_alert_present(wd):%0A try:%0A wd.switch_to_alert().text%0A return True%0A except:%0A ... | |
1ce8285228c29370ad4230f7968abdd7436ff250 | update nth stair | IK/DP/nth_stair.py | IK/DP/nth_stair.py | Python | 0.000001 | @@ -0,0 +1,806 @@
+# http://www.geeksforgeeks.org/count-ways-reach-nth-stair/%0A# This problem is simpl extension of Fibonacci Number%0A%0A# Case 1 when person can take 1 or 2 steps%0A%0Adef fibonacci_number(n):%0A if n %3C= 1:%0A return n%0A return fibonacci_number(n-1) + fibonacci_number(n-2)%0A%0Adef co... | |
f30e4fd9a617ab664d3851b05b27bc5512af3551 | Make remote streamer for ipc allow both str and unicode | flexget/ipc.py | flexget/ipc.py | from __future__ import absolute_import, division, unicode_literals
import logging
import random
import string
import threading
import rpyc
from rpyc.utils.server import ThreadedServer
from flexget.logger import console, capture_output
from flexget.options import get_parser, ParserError
log = logging.getLogger('ipc'... | Python | 0.000001 | @@ -961,18 +961,20 @@
uffer =
-''
+None
%0A
@@ -1082,46 +1082,289 @@
-self.buffer += data%0A while '%5Cn'
+# This relies on all data up to a newline being either unicode or str, not mixed%0A if not self.buffer.strip():%0A self.buffer = data%0A else:%0A self.buf... |
d5a42bd23e7227e041aa3d748765b056e3294a0d | Create infogan.py | InfoGAN/infogan.py | InfoGAN/infogan.py | Python | 0 | @@ -0,0 +1,22 @@
+# initial python file%0A
| |
af5c39347863f2804bb1e36cb0bf6f1a049530c2 | add 15-26 | src/training/Core2/Chapter15RegularExpressions/exercise15_26.py | src/training/Core2/Chapter15RegularExpressions/exercise15_26.py | Python | 0.999988 | @@ -0,0 +1,317 @@
+import re%0D%0A%0D%0A%0D%0Adef replace_email(a_string, new_email):%0D%0A return re.sub('%5Cw+@%5Cw+%5C.%5Cw+', new_email, a_string)%0D%0A%0D%0Aif __name__ == '__main__':%0D%0A assert 'wd@wd.wd xx wd@wd.wd b' == replace_email('abc@126.com xx a@133.com b', 'wd@wd.wd')%0D%0A assert 'abb' == rep... | |
f730a8cfd6700eeedf1cbcc5df8b3b97f918f0fa | Add filterset for tag page, refs #450 | grouprise/features/tags/filters.py | grouprise/features/tags/filters.py | Python | 0 | @@ -0,0 +1,689 @@
+from django.forms.widgets import CheckboxInput%0Afrom django_filters import BooleanFilter%0Afrom django_filters.widgets import BooleanWidget%0A%0Afrom grouprise.features.associations.filters import ContentFilterSet%0A%0A%0Aclass TagContentFilterSet(ContentFilterSet):%0A tagged_only = BooleanFilter... | |
42c7db3f9422d38b0d7273ad8f95db8183b69a9c | Add a python version of the lineset_test ... it demonstrates how one has to run eve from python. | tutorials/eve/lineset_test.py | tutorials/eve/lineset_test.py | Python | 0.000423 | @@ -0,0 +1,752 @@
+## Translated from 'lineset_test.C'.%0A## Run as: python -i lineset_test.py%0A%0Aimport ROOT%0AROOT.PyConfig.GUIThreadScheduleOnce += %5B ROOT.TEveManager.Create %5D%0A%0Adef lineset_test(nlines = 40, nmarkers = 4):%0A r = ROOT.TRandom(0)%0A s = 100%0A%0A ls = ROOT.TEveStraightLineSet()%0A%0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.