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 |
|---|---|---|---|---|---|---|---|
6af41b8b1ff4a6eb28167a063668a1f173999e5c | Create cornersMapping.py | cornersMapping.py | cornersMapping.py | Python | 0.000001 | @@ -0,0 +1,2262 @@
+%0Aimport csv%0Aimport requests%0Aimport time%0Aimport json%0A%0Ausername = %22%22%0A%0Adef requestGeoName(row):%0A #parts = row.split(',')%0A lng = row%5B0%5D%0A lat = row%5B1%5D%0A r = requests.get(%22http://api.geonames.org/findNearestIntersectionOSMJSON?lat=%22+lat+%22&lng=%22+lng+%2... | |
b2d0eaca41f6c697006eeaef38b72af649415d2b | Create models.py | {{cookiecutter.repo_name}}/{{cookiecutter.src_dir}}/{{cookiecutter.main_app}}/models.py | {{cookiecutter.repo_name}}/{{cookiecutter.src_dir}}/{{cookiecutter.main_app}}/models.py | Python | 0.000001 | @@ -0,0 +1,38 @@
+# -*- encoding: utf-8 -*-%0A# ! python2%0A
| |
89c17110f9d17e99ea7686e884cfba91b4762d57 | Add starter code for Lahman db | pybaseball/lahman.py | pybaseball/lahman.py | Python | 0 | @@ -0,0 +1,738 @@
+################################################%0A# WORK IN PROGRESS: ADD LAHMAN DB TO PYBASEBALL%0A# TODO: Make a callable function that retrieves the Lahman db%0A# Considerations: users should have a way to pull just the parts they want %0A# within their code without having to write / save permane... | |
8eafb1b613363f85c9b105812cd5d0047e5ca6ff | Add warp example script | image_processing/warp_image.py | image_processing/warp_image.py | Python | 0 | @@ -0,0 +1,1794 @@
+import argparse%0A%0Aimport cv2%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0A%0Afrom constants import MAX_WIDTH, MAX_HEIGHT%0A%0A# Transform Parameters%0Ay = 90%0Aa = 0.75%0Adelta = (MAX_HEIGHT - y) * a%0A%0Aheight, width = 500, 320%0A# Orignal and transformed keypoints%0Apts1 = np.float... | |
77dfcc41b718ed26e9291b9efc47b0589b951fb8 | Create 0001.py | pylyria/0001/0001.py | pylyria/0001/0001.py | Python | 0.000252 | @@ -0,0 +1,2 @@
+1%0A
| |
d412ec65777431cdd696593ddecd0ee37a500b25 | Create 0011.py | pylyria/0011/0011.py | pylyria/0011/0011.py | Python | 0.000054 | @@ -0,0 +1,385 @@
+# -*- coding: utf-8 -*-%0A#!/usr/bin/env python%0A%0Adef is_sensitive(word):%0A%09sensitive_words = %5Bline.strip() for line in open('sensitive.txt', encoding='utf-8')%5D%0A%09word = word.strip()%0A%09if word.lower() in sensitive_words:%0A%09%09return True%0A%09else:%0A%09%09return False%0A%0Aif __na... | |
5052318d2802284a0331fc77fd7d02bdaca39f42 | test if a layer is working fine | scripts/feature_extract_test.py | scripts/feature_extract_test.py | Python | 0.000004 | @@ -0,0 +1,1417 @@
+%22%22%22Feature extraction test%22%22%22%0A%0Aimport numpy as np;%0Aimport sys%0Aimport theano;%0Aimport theano.tensor as T;%0Asys.path.append(%22..%22)%0A%0Aimport scae_destin.datasets as ds;%0Afrom scae_destin.convnet import ReLUConvLayer;%0Afrom scae_destin.convnet import LCNLayer%0A%0A%0An_epoc... | |
47ebaa10068313c9b8fbbf2e3ffcf06597f88ff6 | add npy2png file converter | convert_npy2image.py | convert_npy2image.py | Python | 0 | @@ -0,0 +1,1471 @@
+import sys%0Aimport math%0Aimport copy%0A%0Aimport pylab%0Aimport numpy%0A%0Afrom Image import fromarray%0Afrom scipy.misc import imread, toimage%0A%0Acmin = 0%0Acmax = 2**8 - 1 %0A%0Adef convert(file_in, file_out, index=None) :%0A%0A%09i = 0%0A%09max_count = 0%0A%0A%09while (True) :%0A%09 try :%... | |
211e9e9352234f5638036b5b1ec85f998609d587 | Add a primitive MITM proxy | diana/utils/proxy.py | diana/utils/proxy.py | Python | 0.000066 | @@ -0,0 +1,2058 @@
+from diana import packet%0Aimport argparse%0Aimport asyncio%0Aimport sys%0Aimport socket%0Afrom functools import partial%0A%0Aclass Buffer:%0A def __init__(self, provenance):%0A self.buffer = b''%0A self.provenance = provenance%0A%0A def eat(self, data):%0A self.buffer += ... | |
d890ef34b11200738687ec49a4a005bb9ebe7c2a | make the module executable | distance/__main__.py | distance/__main__.py | Python | 0 | @@ -0,0 +1,130 @@
+#!/usr/bin/env python%0A%0A%0Afrom . import __version__%0A%0A%0Aprint(f%22distanceutils version %7B__version__%7D%22)%0A%0A%0A# vim:set sw=4 ts=8 sts=4 et:%0A
| |
768b61316a10726a3281a514823f280abc142356 | move wild into its own folder | tests/integration/test_wild.py | tests/integration/test_wild.py | Python | 0 | @@ -0,0 +1,637 @@
+import pytest%0Arequests = pytest.importorskip(%22requests%22)%0A%0Aimport vcr%0A%0Adef test_domain_redirect():%0A '''Ensure that redirects across domains are considered unique'''%0A # In this example, seomoz.org redirects to moz.com, and if those%0A # requests are considered identical, then... | |
c193aebdc76eae285df402463c149bef328c05ef | Add backwards-compatible registration.urls, but have it warn pending deprecation. | registration/urls.py | registration/urls.py | Python | 0 | @@ -0,0 +1,233 @@
+import warnings%0A%0Awarnings.warn(%22Using include('registration.urls') is deprecated; use include('registration.backends.default.urls') instead%22,%0A PendingDeprecationWarning)%0A%0Afrom registration.backends.default.urls import *%0A
| |
fe88e0d8dc3d513cd11ef9ab4cb3ea332af99202 | Add migration | organization/network/migrations/0112_auto_20180502_1742.py | organization/network/migrations/0112_auto_20180502_1742.py | Python | 0.000002 | @@ -0,0 +1,900 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.11 on 2018-05-02 15:42%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('organization-network', '0111_auto_20180307_1152'),%... | |
2f582fa86aa5a8d47a066b4b47fd3425377dc05c | question 1.8 | crack_1_8.py | crack_1_8.py | Python | 0.999705 | @@ -0,0 +1,406 @@
+'''%0Aaccording http://hawstein.com/posts/1.8.html%0Aalgorithm is that str1= %2212345%22,str2= %2251234%22%0Astr1 = str1 + str1 = %221234512345%22%0Aas a result, str2 is subString of str1%0A'''%0Astr1 = 'abcdefghi'%0Astr2 = 'ihgfedcba'%0A%0Adef isSubString(str1, str2):%0A%09if str2 in str1:%0A%09%09r... | |
48e4b9692b29d3fb9f43f37fef70ccc41f47fc0e | Add tests for the errors utility functions | yithlibraryserver/tests/errors.py | yithlibraryserver/tests/errors.py | Python | 0.000001 | @@ -0,0 +1,1035 @@
+import unittest%0A%0Afrom pyramid.httpexceptions import HTTPBadRequest, HTTPNotFound%0A%0A%0Afrom yithlibraryserver.errors import password_not_found, invalid_password_id%0A%0A%0Aclass ErrorsTests(unittest.TestCase):%0A%0A def test_password_not_found(self):%0A result = password_not_found()%... | |
4c225ec7cdafc45840b2459e8804df5818fecd71 | add util module | dace/util.py | dace/util.py | Python | 0.000001 | @@ -0,0 +1,247 @@
+from pyramid.threadlocal import get_current_request%0Afrom substanced.util import find_objectmap%0A%0A%0Adef get_obj(oid):%0A request = get_current_request()%0A objectmap = find_objectmap(request.root)%0A obj = objectmap.object_for(oid)%0A return obj%0A
| |
ddfc28360941a435ae22705dbc46b44cced588e7 | Add demo file. | demo/demo.py | demo/demo.py | Python | 0 | @@ -0,0 +1,333 @@
+#!/usr/bin/env python3%0A%0Aimport fileinput%0Aimport os%0Aparentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))%0Aos.sys.path.insert(0,parentdir) %0Aimport ppp_spell_checker%0A%0A%0Aif __name__ == %22__main__%22:%0A corrector = ppp_spell_checker.StringCorrector('en')%0A while... | |
0f9488588ea66b881cdebf11a42377cb44845a5c | added day6-1a.py. combines transposing input list and function call into single list comprehension | day6/day6-1a.py | day6/day6-1a.py | Python | 0.999998 | @@ -0,0 +1,1507 @@
+%22%22%22--- Day 6: Signals and Noise ---%0A%0ASomething is jamming your communications with Santa. Fortunately, your signal is only partially jammed, and protocol in situations like this is to switch to a simple repetition code to get the message through.%0A%0AIn this model, the same message is sen... | |
8003f9f643b90cf42bdd8ba0ec8d5dc2f96ba191 | Create list-aws-queue.py | list-aws-queue.py | list-aws-queue.py | Python | 0.00003 | @@ -0,0 +1,703 @@
+# This script created a queue%0A#%0A# Author - Paul Doyle Nov 2015%0A#%0A#%0Aimport boto.sqs%0Aimport boto.sqs.queue%0Afrom boto.sqs.message import Message%0Afrom boto.sqs.connection import SQSConnection%0Afrom boto.exception import SQSError%0Aimport sys%0A%0A# Get the keys from a specific url and th... | |
298f297410b9db8b2d211b1d0edddb595f1fa469 | Add timestamp2str() | datetime/datetime.py | datetime/datetime.py | Python | 0.000258 | @@ -0,0 +1,501 @@
+import datetime%0A%0A# ==============================================================================%0A# TIMESTAMP 2 STR%0A# ==============================================================================%0Adef timestamp2str(t, pattern=%2... | |
130b0b5d70c6f94caa1e6dbd98aa4361a9ce4d1d | add tips for relax time... | dictate_num/train.py | dictate_num/train.py | import os
import sys
import pyttsx
import random
from data import *
EXIT_TAG = 'n'
class CTrain(object):
def __init__(self):
self._eng = pyttsx.init()
def pre(self):
print "*"*10,"DICTATE NUMBER TRAING", "*"*10
name = raw_input("Please enter your name: ")
data = CData(nam... | Python | 0 | @@ -1027,303 +1027,406 @@
-print %22%5Cn%5B%253d%5D%22%25( idx,), %22 now level%22, lvl,%22, Please listening...%22%0A nums = self.genNum(lvl)%0A self.readNum(nums)%0A d = raw_input(%22enter what you heard(n for exit): %22)%0A if d.lower().find(EXIT_TAG) %3E= 0:%0A ... |
0e9e63a48c5f3e02fb49d0068363ac5442b39e37 | Add a body to posts | discussion/models.py | discussion/models.py | from django.contrib.auth.models import User
from django.db import models
class Discussion(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=255)
slug = models.SlugField()
def __unicode__(self):
return self.name
class Post(models.Model):
discussion = models... | Python | 0.000001 | @@ -442,24 +442,54 @@
SlugField()%0A
+ body = models.TextField()%0A
posts_fi
|
62beb09ca1ecde8be4945016ae09beaad2dad597 | Create disemvowel_trolls.py | disemvowel_trolls.py | disemvowel_trolls.py | Python | 0.000001 | @@ -0,0 +1,217 @@
+#Kunal Gautam%0A#Codewars : @Kunalpod%0A#Problem name: Disemvowel Trolls%0A#Problem level: 7 kyu%0A%0Adef disemvowel(string):%0A return ''.join(%5Bletter for letter in string if letter.lower() not in %5B'a', 'e', 'i', 'o', 'u'%5D%5D)%0A
| |
078bc9ea1375ac8ff7b2bbb92553ae63e5190cd3 | add var.py in package structData to save vars | trunk/editor/structData/var.py | trunk/editor/structData/var.py | Python | 0 | @@ -0,0 +1,201 @@
+#!/usr/bin/env python%0A%0Aclass Var(object):%0A%0A def __init__(self, name, start_value, set_value=None):%0A self.name = name%0A self.start_value = start_value%0A self.set_value = set_value%0A
| |
a26f0cc1af189686a24518510095f93b064a36a4 | Add two utility functions for group membership | django_split/base.py | django_split/base.py | import six
import inflection
from .validation import validate_experiment
EXPERIMENTS = {}
class ExperimentMeta(type):
def __init__(self, name, bases, dict):
super(ExperimentMeta, self).__init__(name, bases, dict)
# Special case: don't do experiment processing on the base class
if (
... | Python | 0.000001 | @@ -15,19 +15,116 @@
ort
-inflection%0A
+datetime%0Aimport inflection%0A%0Afrom django.contrib.auth.models import User%0A%0Afrom .models import ExperimentGroup
%0Afro
@@ -1408,16 +1408,942 @@
d_date = None%0A
+%0A @classmethod%0A def group(cls, group_name):%0A # This will raise a ValueError if the gr... |
316d0518f2cf81ce3045335b79bc993020befce1 | create main class `FlaskQuik` for bridging quik and flask | flask_quik.py | flask_quik.py | Python | 0 | @@ -0,0 +1,1438 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%22%22%22%0A flask.ext.quik%0A ~~~~~~~~~~~~~~%0A%0A Extension implementing Quik Templates support in Flask with support for%0A flask-babel%0A%0A :copyright: (c) 2012 by Thiago Avelino %3Cthiago@avelino.xxx%3E%0A :license: MIT, see L... | |
4844ac93326186ded80147a3f8e1e1429212428b | add user's launcher | tfx/experimental/templates/taxi/stub_component_launcher.py | tfx/experimental/templates/taxi/stub_component_launcher.py | Python | 0.000001 | @@ -0,0 +1,2813 @@
+# Lint as: python3%0A# Copyright 2020 Google LLC. All Rights Reserved.%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/licens... | |
20d77f66e0287b3aab08b4cf14f23e7e5672aefd | Create database import script for the Picks table (each NFLPool Player's picks for a given season) | db_setup/nflpool_picks.py | db_setup/nflpool_picks.py | Python | 0 | @@ -0,0 +1,2493 @@
+import sqlite3%0A%0Aconn = sqlite3.connect('nflpool.sqlite')%0Acur = conn.cursor()%0A%0A# Do some setup%0Acur.executescript('''%0ADROP TABLE IF EXISTS Player;%0A%0ACREATE TABLE Picks (%0A firstname TEXT NOT NULL,%0A lastname TEXT NOT NULL,%0A id INTEGER NOT NULL PRIMARY KEY UNIQUE,%0... | |
ed1cd0f7de1a7bebaaf0f336ba52e04286dd87de | Create my_mapper.py | Hadoop--Project-to-map-new-Your-taxi-data-info/my_mapper.py | Hadoop--Project-to-map-new-Your-taxi-data-info/my_mapper.py | Python | 0.000014 | @@ -0,0 +1,534 @@
+#!/usr/bin/env python %0A%0A%0Aimport sys%0A%0A%0Afor line in sys.stdin:%0A line = line.strip()%0A unpacked = line.split(%22,%22)%0A stadium, capacity, expanded, location, surface, turf, team, opened, weather, roof, elevation = line.split(%22,%22)%0A #medallion, hack_license, vendor_id, ra... | |
8ad4627973db344e228a9170aef030ab58efdeb9 | Add column order and importable objects lists | src/ggrc/converters/__init__.py | src/ggrc/converters/__init__.py | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
from ggrc.converters.sections import SectionsConverter
all_converters = [('sectio... | Python | 0 | @@ -286,16 +286,308 @@
nverter%0A
+from ggrc.models import (%0A Audit, Control, ControlAssessment, DataAsset, Directive, Contract,%0A Policy, Regulation, Standard, Facility, Market, Objective, Option,%0A OrgGroup, Vendor, Person, Product, Program, Project, Request, Response,%0A Section, Clause, System, Pro... |
8141d6cafb4a1c8986ec7065f27d536d98cc9916 | Add little script calculate sample spectra. | Modules/Biophotonics/python/iMC/script_plot_one_spectrum.py | Modules/Biophotonics/python/iMC/script_plot_one_spectrum.py | Python | 0 | @@ -0,0 +1,1939 @@
+'''%0ACreated on Oct 12, 2015%0A%0A@author: wirkert%0A'''%0A%0Aimport pickle%0Aimport logging%0A%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0Aimport luigi%0A%0Aimport tasks_regression as rt%0Afrom msi.plot import plot%0Afrom msi.msi import Msi%0Aimport msi.normalize as norm%0Aimport scri... | |
55aae76ae3813045542b8f94736fdfb1e08592f2 | Add chrome driver path. | src/lib/environment/__init__.py | src/lib/environment/__init__.py | import os
import logging
from lib import constants, file_ops
yaml = file_ops.load_yaml_contents(constants.path.YAML)
PROJECT_ROOT_PATH = os.path.dirname(os.path.abspath(__file__)) + "/../"
VIRTENV_PATH = PROJECT_ROOT_PATH + constants.path.VIRTUALENV_DIR
LOGGING_FORMAT = yaml[constants.yaml.LOGGING][constants.yaml.FOR... | Python | 0 | @@ -317,16 +317,113 @@
.FORMAT%5D
+%0ACHROME_DRIVER_PATH = PROJECT_ROOT_PATH + constants.path.RESOURCES + constants.path.CHROME_DRIVER
%0A%0A# regi
|
56422abd9e5dbc1b17b009d84fd5e4b028719b94 | add basic IPC traffic analyzer | ipc-viewer.py | ipc-viewer.py | Python | 0 | @@ -0,0 +1,1300 @@
+#!/usr/bin/python%0A%0A# This Source Code Form is subject to the terms of the Mozilla Public%0A# License, v. 2.0. If a copy of the MPL was not distributed with this%0A# file, You can obtain one at http://mozilla.org/MPL/2.0/.%0A%0A# This file analyzes the output of running with MOZ_IPC_MESSAGE_LOG=1... | |
561957a2492714e1b6d76b13daeced66a90aba1d | Create __init__.py | docs/_themes/sphinx_rtd_theme/__init__.py | docs/_themes/sphinx_rtd_theme/__init__.py | Python | 0.000429 | @@ -0,0 +1,371 @@
+%22%22%22Sphinx ReadTheDocs theme.%0A%0AFrom https://github.com/ryan-roemer/sphinx-bootstrap-theme.%0A%0A%22%22%22%0Aimport os%0A%0AVERSION = (0, 1, 5)%0A%0A__version__ = %22.%22.join(str(v) for v in VERSION)%0A__version_full__ = __version__%0A%0A%0Adef get_html_theme_path():%0A %22%22%22Return li... | |
c979fe37cc5f3dd83933893a1e7774c4aa7d061c | Add test script. | examples/get_data.py | examples/get_data.py | Python | 0 | @@ -0,0 +1,1625 @@
+'''%0A Copyright 2019 Trustees of the University of Pennsylvania%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%0... | |
11bd97a647507645f90e259dd8000eb6a8001890 | Add index to log_once table, make cleanup run with db cleanup event. refs #1167 | flexget/utils/log.py | flexget/utils/log.py | """Logging utilities"""
import logging
from flexget.manager import Session, Base
from datetime import datetime, timedelta
from sqlalchemy import Column, Integer, String, DateTime
log = logging.getLogger('util.log')
class LogMessage(Base):
"""Declarative"""
__tablename__ = 'log_once'
id = Column(Intege... | Python | 0.000008 | @@ -37,49 +37,22 @@
ing%0A
-from flexget.manager import Session, Base
+import hashlib
%0Afro
@@ -149,45 +149,545 @@
Time
-%0A%0Alog = logging.getLogger('util.log')
+, Index%0Afrom flexget import schema%0Afrom flexget.utils.sqlalchemy_utils import table_schema%0Afrom flexget.manager import Session%0Afrom flexget.even... |
b3977289de72421530614ff4f28cdf7333d743e4 | Add region migration validation | dbaas/logical/validators.py | dbaas/logical/validators.py | Python | 0 | @@ -0,0 +1,931 @@
+# -*- coding: utf-8 -*-%0Afrom django.utils.translation import ugettext_lazy as _%0Afrom logical.models import Database%0Afrom django.core.exceptions import ValidationError%0Afrom django.core.exceptions import ObjectDoesNotExist%0Afrom system.models import Configuration%0A%0A%0Adef validate_evironmen... | |
f0e092b060d9afb700f027197fdf44eeb2fdd91b | Create __init__.py | __ini__.py | __ini__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
3ce3e6adb3d47989338866da1b840b77e6ceab5a | remove some debug code | src/you_get/extractors/iqiyi.py | src/you_get/extractors/iqiyi.py | #!/usr/bin/env python
__all__ = ['iqiyi_download']
from ..common import *
from uuid import uuid4
from random import random,randint
import json
from math import floor
import hashlib
'''
com.qiyi.player.core.model.def.DefinitonEnum
bid meaning for quality
0 none
1 standard
2 high
3 super
4 suprt-high
5 fullhd
10 4k
96... | Python | 0.025468 | @@ -1424,14 +1424,26 @@
-tmp =
+return json.loads(
get_
@@ -1461,34 +1461,8 @@
req)
-%0A return json.loads(tmp
)%0A%0Ad
|
660fc806d11c6a8af321bb14caec21ca7cba4141 | add kafka streaming consumer | deploy/test/kf_consumer1.py | deploy/test/kf_consumer1.py | Python | 0 | @@ -0,0 +1,339 @@
+import json%0Afrom kafka import KafkaConsumer%0A%0Aconsumer = KafkaConsumer('testres', bootstrap_servers='192.168.33.50:9092')%0A%0Afor msg in consumer:%0A val = msg.value.decode()%0A%0A print(msg.key.decode())%0A print(json.loads(val).get('word'))%0A print(json.loads(val).get('count'))%0... | |
4c96e1eb17a5cbb4c1a33cef5c37aac00b4ec8e0 | Update test_api.py | dpaste/tests/test_api.py | dpaste/tests/test_api.py | # -*- encoding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.test.client import Client
from django.test import TestCase
from ..models import Snippet
from ..forms import EXPIRE_DEFAULT
from ..highlight import LEXER_DEFAULT
class SnippetAPITestCase(TestCase):
def setUp(self):
self.ap... | Python | 0.000004 | @@ -491,199 +491,8 @@
ata.
-%0A%0A !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!%0A%0A ALL tests fail due to a Piston bug:%0A https://bitbucket.org/jespern/django-piston/issue/221/attributeerror-httpresponseservererror
%0A
|
c831e7cec02e06d9346bf6fdf0dcdf553f4f479e | Add test for interpolating NaNs | metpy/calc/tests/test_tools.py | metpy/calc/tests/test_tools.py | # Copyright (c) 2008-2015 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Tests for `calc.tools` module."""
import numpy as np
import pytest
from metpy.calc import find_intersections, nearest_intersection_idx, resample_nn_1d
from metpy.testing im... | Python | 0.000033 | @@ -231,16 +231,17 @@
import
+(
find_int
@@ -251,16 +251,34 @@
ections,
+ interpolate_nans,
nearest
@@ -295,16 +295,40 @@
ion_idx,
+%0A
resampl
@@ -334,16 +334,17 @@
le_nn_1d
+)
%0Afrom me
@@ -2157,8 +2157,908 @@
eaing')%0A
+%0A%0Adef test_interpolate_nan_linear():%0A %22%22%22Tes... |
49d28814c498d1698c61b8eeae3c3e3e019a09c3 | add recipe3 scrap | scrap/recipe3.py | scrap/recipe3.py | Python | 0.000373 | @@ -0,0 +1,1508 @@
+import scrapy%0A%0A%0Aclass Recipe3Spider(scrapy.Spider):%0A name = %22recipe3%22%0A download_delay = 0.5%0A start_urls = %5B%0A %22http://www.cuisineaz.com/recettes/recherche_v2.aspx?recherche=%7B%7D%22.format(r)%0A for r in %5B%0A 'bases',%0A 'aperitifs... | |
f486343277a94e511ea1e152ca6b69f12fd657a0 | Create droidgpspush.py | droidgpspush.py | droidgpspush.py | Python | 0 | @@ -0,0 +1,501 @@
+import androidhelper%0Aimport socket%0Aimport time%0A%0Adroid = androidhelper.Android()%0A%0Aport=12345%0As=socket.socket(socket.AF_INET,socket.SOCK_STREAM)%0As.connect((%2210.201.19.201%22,port)) #connecting to pi as client%0Adroid.makeToast(%22Starting location fetch%22) #notify me%0Awhile True:%0A... | |
6d25c1958a84eb1a6004ebadec6769511974cca4 | add basic rsa by request | basic-rsa/rsa.py | basic-rsa/rsa.py | Python | 0 | @@ -0,0 +1,324 @@
+def main():%0A e = int('3', 16)%0A n = int('64ac4671cb4401e906cd273a2ecbc679f55b879f0ecb25eefcb377ac724ee3b1', 16)%0A d = int('431d844bdcd801460488c4d17487d9a5ccc95698301d6ab2e218e4b575d52ea3', 16)%0A c = int('599f55a1b0520a19233c169b8c339f10695f9e61c92bd8fd3c17c8bba0d5677e', 16)%0A m ... | |
6be3e0c5264ca2750a77ac1dbd4175502e51fd3c | Add argparse tests for ceph-deploy admin | ceph_deploy/tests/parser/test_admin.py | ceph_deploy/tests/parser/test_admin.py | Python | 0 | @@ -0,0 +1,1018 @@
+import pytest%0A%0Afrom ceph_deploy.cli import get_parser%0A%0A%0Aclass TestParserAdmin(object):%0A%0A def setup(self):%0A self.parser = get_parser()%0A%0A def test_admin_help(self, capsys):%0A with pytest.raises(SystemExit):%0A self.parser.parse_args('admin --help'.sp... | |
2ee5f1e3563e5a7104515adf74e41a8781fbcd9e | Create exercise5.py | exercise5.py | exercise5.py | Python | 0.000001 | @@ -0,0 +1,626 @@
+ # -- coding: utf-8 -- %0Amy_name = 'Zed A. Shaw'%0Amy_age = 35 # not a lie%0Amy_height = 74 # inches%0Amy_weight = 180 # lbs%0Amy_eyes = 'Blue'%0Amy_teeth = 'White'%0Amy_hair = 'Brown'%0A%0Aprint %22Let's talk about %25s.%22 %25 my_name%0Aprint %22He's %25d inches tall.%22 %25 my_height%0Aprint %22H... | |
2523d34d4f3e26a408c7ec0e43708efea77f03a9 | Add to support the chinese library | workflow/cndic_naver_search.py | workflow/cndic_naver_search.py | Python | 0 | @@ -0,0 +1,1820 @@
+# Naver Search Workflow for Alfred 2%0A# Copyright (C) 2013 Jinuk Baek%0A# This program is free software; you can redistribute it and/or%0A# modify it under the terms of the GNU General Public License%0A# as published by the Free Software Foundation; either version 2%0A# of the License, or (a... | |
ac0e7cb6ff2885457ccbe9f7311489edf7c9406b | create train object utils | mozi/utils/train_object_utils.py | mozi/utils/train_object_utils.py | Python | 0.000018 | @@ -0,0 +1,2587 @@
+from __future__ import absolute_import%0Afrom __future__ import print_function%0A%0Aimport matplotlib%0A# matplotlib.use('Agg')%0Aimport theano%0Aimport theano.tensor as T%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0Afrom theano.compile.ops import as_op%0Afrom mozi.utils.progbar import P... | |
1768a69163c50e5e964eaf110323e590f13b4ff0 | add 0000 file | Drake-Z/0000/0000.py | Drake-Z/0000/0000.py | Python | 0.000001 | @@ -0,0 +1,680 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A'%E7%AC%AC 0000 %E9%A2%98%EF%BC%9A%E5%B0%86%E4%BD%A0%E7%9A%84 QQ %E5%A4%B4%E5%83%8F%EF%BC%88%E6%88%96%E8%80%85%E5%BE%AE%E5%8D%9A%E5%A4%B4%E5%83%8F%EF%BC%89%E5%8F%B3%E4%B8%8A%E8%A7%92%E5%8A%A0%E4%B8%8A%E7%BA%A2%E8%89%B2%E7%9A%84%E6%95%B0%E5%AD%97%E... | |
ebc2b419a3cc7cace9c79d1c5032a2ae33b8bff1 | Remove unused imports | custom/up_nrhm/reports/asha_reports.py | custom/up_nrhm/reports/asha_reports.py | import datetime
from dateutil.relativedelta import relativedelta
from corehq.apps.reports.filters.select import MonthFilter, YearFilter
from corehq.apps.reports.generic import GenericTabularReport
from corehq.apps.reports.standard import CustomProjectReport, DatespanMixin
from corehq.apps.reports.filters.dates import D... | Python | 0.000001 | @@ -1,69 +1,4 @@
-import datetime%0Afrom dateutil.relativedelta import relativedelta%0A
from
@@ -426,77 +426,8 @@
ort%0A
-from custom.up_nrhm.reports.block_level_af import BlockLevelAFReport%0A
from
|
3d8f02eb7c1b9b363143f25af9eadeb94c43b4ae | increase uwnetid maxlength | myuw/migrations/0017_netidlen.py | myuw/migrations/0017_netidlen.py | Python | 0.000015 | @@ -0,0 +1,395 @@
+# Generated by Django 2.0.13 on 2020-03-12 17:48%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('myuw', '0016_myuw_notice_group'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterField(%0A mo... | |
00a9d09e83ca3ee77d56a795f88d8d464c9c1063 | Version change - Added Tamu provider | geocoder/__init__.py | geocoder/__init__.py | #!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
"""
Geocoder
~~~~~~~~
Simple and consistent geocoding library written in Python.
Many online providers such as Google & Bing have geocoding services,
these providers do not include Python libraries and have different
JSON responses between each... | Python | 0 | @@ -641,17 +641,18 @@
__ = '1.
-9
+10
.0'%0A__li
|
53a0e58bb68c3fb247a65fabf6c80b5bb41f440e | Fix custom attribute test factories | test/integration/ggrc/models/factories.py | test/integration/ggrc/models/factories.py | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Factories for models"""
# pylint: disable=too-few-public-methods,missing-docstring,old-style-class
# pylint: disable=no-init
import random
import factory
from ggrc import db
from ggrc import models
... | Python | 0.000001 | @@ -823,35 +823,50 @@
ory(ModelFactory
+, TitledFactory
):%0A
-
%0A class Meta:%0A
@@ -914,23 +914,8 @@
on%0A%0A
- title = None%0A
de
@@ -977,20 +977,22 @@
_type =
-None
+%22Text%22
%0A multi
@@ -1139,19 +1139,16 @@
ttribute
-_id
= None%0A
|
1e7b84155623691fb9fc1cec4efa6386938f3e72 | Add missing migration (updating validators=) | core/migrations/0055_update_username_validators.py | core/migrations/0055_update_username_validators.py | Python | 0 | @@ -0,0 +1,867 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.7 on 2016-07-22 22:03%0Afrom __future__ import unicode_literals%0A%0Aimport django.core.validators%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('core', '0054_add_pro... | |
48217e5317412a9b5fb8181b6915963783efeaf2 | Add test for kline result of exact amount | tests/test_historical_klines.py | tests/test_historical_klines.py | Python | 0 | @@ -0,0 +1,940 @@
+#!/usr/bin/env python%0A# coding=utf-8%0A%0Afrom binance.client import Client%0Aimport pytest%0Aimport requests_mock%0A%0A%0Aclient = Client('api_key', 'api_secret')%0A%0A%0Adef test_exact_amount():%0A %22%22%22Test Exact amount returned%22%22%22%0A%0A first_res = %5B%5D%0A row = %5B15198923... | |
1f3a15b8ae6ffcb96faaf0acab940d9590fe6cb1 | Add migration | fat/migrations/0064_auto_20160809_1559.py | fat/migrations/0064_auto_20160809_1559.py | Python | 0.000002 | @@ -0,0 +1,663 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.5 on 2016-08-09 15:59%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('fat', '0063_auto_20160809_1545'),%0A %5D%0A%0A ... | |
5ec3f8dbe9f044d08a80563c05b648590fabdda7 | add fibonnaci example | examples/fib.py | examples/fib.py | Python | 0.999895 | @@ -0,0 +1,562 @@
+# / 0 if i is 0%0A# fib(i) = %7C 1 if i is 1%0A# %5C fib(i - 1) + fib(i - 2) otherwise%0A%0Adef fib(n):%0A %22%22%22 Imperative definition of Fibonacci numbers %22%22%22%0A a, b = 0, 1%0A for i in range(n):%0A a, b... | |
c663f6b6e31832fae682c2c527955b13682b701e | Remove learner_testimonials column from course_metadata course run table | course_discovery/apps/course_metadata/migrations/0127_remove_courserun_learner_testimonials.py | course_discovery/apps/course_metadata/migrations/0127_remove_courserun_learner_testimonials.py | Python | 0.000002 | @@ -0,0 +1,429 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.15 on 2018-11-07 17:16%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('course_metadata', '0126_course_has_ofac_restrictions'),%0A... | |
8b1bd5995ff4c95335e25e19962724e6d8c399d7 | Create 0003_auto_20150930_1132.py | cities/migrations/0003_auto_20150930_1132.py | cities/migrations/0003_auto_20150930_1132.py | Python | 0.000016 | @@ -0,0 +1,1070 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('cities', '0002_auto_20150811_1912'),%0A %5D%0A%0A operations = %5B%0A migrations.AddFiel... | |
b75e10f3235e9215458071279b67910627a95180 | Add celery based job runner | ceam/framework/celery_tasks.py | ceam/framework/celery_tasks.py | Python | 0.000011 | @@ -0,0 +1,1683 @@
+import os%0Afrom time import time%0Aimport logging%0A%0Aimport pandas as pd%0A%0Afrom celery import Celery%0Afrom billiard import current_process%0A%0A%0Aapp = Celery()%0A%0A@app.task(autoretry_for=(Exception,), max_retries=2)%0Adef worker(draw_number, component_config, branch_config, logging_direct... | |
164f43f902b89b84b4f0d474f4d3e0a18924110d | Add test of randomized select algorithm | selection_test.py | selection_test.py | Python | 0.000005 | @@ -0,0 +1,640 @@
+import quicksort.quicksort%0Aimport random_selection.random_selection%0Aimport sys%0Aimport time%0Afrom random import randint%0A%0Adef main(max_len, check):%0A%09for n in %5B2**(n+1) for n in range(max_len)%5D:%0A%09%09arr = %5Brandint(0, 2**max_len) for n in range(n)%5D%0A%0A%09%09median = int((len(... | |
9168807db69372ffb93430991fc4e666fa53a8f5 | Add missing example file | examples/movemean.py | examples/movemean.py | Python | 0.000005 | @@ -0,0 +1,583 @@
+%22%22%22%0AA moving average function using @guvectorize.%0A%22%22%22%0A%0Aimport numpy as np%0A%0Afrom numba import guvectorize%0A%0A@guvectorize(%5B'void(float64%5B:%5D, intp%5B:%5D, float64%5B:%5D)'%5D, '(n),()-%3E(n)')%0Adef move_mean(a, window_arr, out):%0A window_width = window_arr%5B0%5D%0A... | |
1376fa5a9369bcff3fbfdf09a103a2b5c8b802f2 | add missing os import and fix undefined gen_log | zmq/eventloop/ioloop.py | zmq/eventloop/ioloop.py | # coding: utf-8
"""tornado IOLoop API with zmq compatibility
If you have tornado ≥ 3.0, this is a subclass of tornado's IOLoop,
otherwise we ship a minimal subset of tornado in zmq.eventloop.minitornado.
The minimal shipped version of tornado's IOLoop does not include
support for concurrent futures - this will only b... | Python | 0 | @@ -837,16 +837,26 @@
tement%0A%0A
+import os%0A
import l
@@ -5515,14 +5515,14 @@
-gen_lo
+loggin
g.de
|
82d34111295fdfa35d0e9815053498e935d415af | Add example script to store & read datetime | examples/store_datetimes.py | examples/store_datetimes.py | Python | 0 | @@ -0,0 +1,244 @@
+import h5py%0Aimport numpy as np%0A%0Aarr = np.array(%5Bnp.datetime64('2019-09-22T17:38:30')%5D)%0A%0Awith h5py.File('datetimes.h5', 'w') as f:%0A # Create dataset%0A f%5B'data'%5D = arr.astype(h5py.opaque_dtype(arr.dtype))%0A%0A # Read%0A print(f%5B'data'%5D%5B:%5D)%0A
| |
e581eb8af860456b0ff46e99398002b3df0f0677 | add Julia magic for IPython | julia/magic.py | julia/magic.py | Python | 0.000406 | @@ -0,0 +1,1954 @@
+%22%22%22%0A==========================%0A Julia magics for IPython%0A==========================%0A%0A%7BJULIAMAGICS_DOC%7D%0A%0AUsage%0A=====%0A%0A%60%60%25%25julia%60%60%0A%0A%7BJULIA_DOC%7D%0A%22%22%22%0A%0A#-----------------------------------------------------------------------------%0A# Imports%... | |
12691d47c4dbbaac42d2c9a8fe04e70cb5a94e98 | add Yaspin.write usage example | examples/write_method.py | examples/write_method.py | Python | 0 | @@ -0,0 +1,466 @@
+# -*- coding: utf-8 -*-%0A%0A%22%22%22%0Aexamples.write_method%0A~~~~~~~~~~~~~~~~~~~~~%0A%0ABasic usage of %60%60write%60%60 method.%0A%22%22%22%0A%0Aimport time%0A%0Afrom yaspin import yaspin%0A%0A%0Adef main():%0A with yaspin(text='Downloading images') as sp:%0A # task 1%0A time.sl... | |
324bc6f72deef0349f0da48366ab11b749a231b5 | Make AzureKeyVaultBackend backwards-compatible (#12626) | airflow/contrib/secrets/azure_key_vault.py | airflow/contrib/secrets/azure_key_vault.py | Python | 0 | @@ -0,0 +1,1208 @@
+#%0A# Licensed to the Apache Software Foundation (ASF) under one%0A# or more contributor license agreements. See the NOTICE file%0A# distributed with this work for additional information%0A# regarding copyright ownership. The ASF licenses this file%0A# to you under the Apache License, Version 2.0 ... | |
165d6795c2e3b173282736127c092ede57ae8f55 | Create create_recurring_for_failed.py | erpnext/patches/v6_27/create_recurring_for_failed.py | erpnext/patches/v6_27/create_recurring_for_failed.py | Python | 0.000004 | @@ -0,0 +1,324 @@
+import frappe%0Afrom erpnext.controllers.recurring_document import manage_recurring_documents%0A%0Adef execute():%0A%0A%09frappe.db.sql(%22%22%22update %60tabSales Invoice%60 %0A%09%09%09%09set is_recurring=1 where (docstatus=1 or docstatus=0) and next_date='2016-06-26' and is_recurring=0%22%22%22)%0... | |
93d1d4cc446cd13affaf1b467e39845c5dc437a5 | Add missing migration | events/migrations/0002_auto_20150119_2138.py | events/migrations/0002_auto_20150119_2138.py | Python | 0.0002 | @@ -0,0 +1,1027 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('events', '0001_initial'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterField(%0A ... | |
a8b46224dfda38173ea130d820411aad6a47acfc | Add Commander.py | src/Commander.py | src/Commander.py | Python | 0.000004 | @@ -0,0 +1,1596 @@
+# Copyright (c) 2013 Molly White%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 use, cop... | |
52c9a8ab10934c7acf8bcc404dccd2524199acb7 | support for qualifying keys with dot('.') in JSON reference | src/DictUtils.py | src/DictUtils.py | import collections
class DictUtils:
@staticmethod
def __retrieveFromDict(t, key):
if None != t:
found = True
if str == type(key):
keys = [key]
else:
keys = key
for k in keys:
if k in t:
... | Python | 0.000072 | @@ -195,13 +195,22 @@
s =
-%5B
key
-%5D
+.split('.')
%0A
|
60b13eb1a322336433824680a7ffe344afb6cdc7 | Fix tests | udata/tests/api/test_url_api.py | udata/tests/api/test_url_api.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import httpretty
import requests
from flask import url_for
from udata.tests.api import APITestCase
from udata.utils import faker
from udata.settings import Testing
CROQUEMORT_URL = 'http://check.test'
CHECK_ONE_URL = '{0}/check/one'.form... | Python | 0.000003 | @@ -2890,33 +2890,33 @@
tus(response, 50
-0
+3
)%0A self.a
@@ -5014,17 +5014,17 @@
onse, 50
-0
+3
)%0A
|
fe36fd79c1981c489fd1db548c7468acbf98fff5 | add test for s3 filename unquote | app/backend/gwells/tests/test_documents.py | app/backend/gwells/tests/test_documents.py | Python | 0.000001 | @@ -0,0 +1,1118 @@
+from django.test import TestCase%0Afrom gwells.documents import MinioClient%0A%0A%0Aclass DocumentsTestCase(TestCase):%0A%0A def test_document_url_with_space(self):%0A minio_client = MinioClient(disable_private=True)%0A%0A test_document = %7B%0A %22bucket_name%22: %22test... | |
4b06b5ec929af3466bfe9f03892b6c68259a2e3e | add gunicorn app | gunicorn_app.py | gunicorn_app.py | Python | 0 | @@ -0,0 +1,446 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0Aimport os%0A%0ADATA_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), 'data'))%0A%0Afrom logbook.compat import redirect_logging%0Aredirect_logging()%0A%0Afrom aip import make%0Afrom aip.log import RedisPub%0A%0Awith RedisPub():%0A ... | |
52236b1ad285683d828b248e462a7b984d31e636 | Add example of connecting OGR to matplotlib through shapely and numpy | examples/world.py | examples/world.py | Python | 0.000002 | @@ -0,0 +1,449 @@
+import ogr%0Aimport pylab%0Afrom numpy import asarray%0A%0Afrom shapely.wkb import loads%0A%0Asource = ogr.Open(%22/var/gis/data/world/world_borders.shp%22)%0Aborders = source.GetLayerByName(%22world_borders%22)%0A%0Afig = pylab.figure(1, figsize=(4,2), dpi=300)%0A%0Awhile 1:%0A feature = borders.... | |
bc871956d492a3bc34e28847de136e1b4ad82035 | Create codechallenge.py | codechallenge.py | codechallenge.py | Python | 0.000004 | @@ -0,0 +1 @@
+%0A
| |
08a813019c43288051e2ef5cbdfc6daaa0b6a32c | fix running rubyspec? | fabfile/travis.py | fabfile/travis.py | import glob
import os
from fabric.api import task, local
from fabric.context_managers import lcd
class Test(object):
def __init__(self, func, deps=[], needs_pypy=True, needs_rubyspec=False):
self.func = func
self.deps = deps
self.needs_pypy = needs_pypy
self.needs_rubyspec = needs... | Python | 0 | @@ -2168,16 +2168,22 @@
spec -t
+%60pwd%60/
topaz-c
|
2044e3b018595e45cc2969d0675d5006ea02ccf5 | update to use new struct data of g_project | trunk/editor/savefilerooms.py | trunk/editor/savefilerooms.py | #!/usr/bin/env python
from xml.dom import minidom
from xml.etree import ElementTree
#to use OrderedDict in python < 2.7
try:
from collections import OrderedDict
except ImportError:
from misc.dict import OrderedDict
from structdata.world import g_world
def prettify(content):
"""
Return a pretty-print... | Python | 0 | @@ -235,21 +235,23 @@
uctdata.
-world
+project
import
@@ -252,21 +252,23 @@
mport g_
-world
+project
%0A%0Adef pr
@@ -1372,26 +1372,29 @@
g_
-world.informations
+project.data%5B'world'%5D
.dic
@@ -1416,92 +1416,85 @@
for
-key_information in g_world.dictionary():%0A if key_information != %22informatio... |
93d91ba059a7037281f6a5e4d6afd5e071668d81 | Create freebook.py | freebook/reddit/freebook.py | freebook/reddit/freebook.py | Python | 0 | @@ -0,0 +1,1839 @@
+# Get free ebooks from Reddit%0A%0Afrom bs4 import BeautifulSoup%0Aimport feedparser%0Aimport requests%0A%0Aurl = %22https://www.reddit.com/r/freebooks.rss%22%0Aheaders = %7B%22User-Agent%22: %22Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:59.0) Gecko/20100101 Firefox/59.0%22%7D%0A%0Aurls = %5B%... | |
6edadeb278be9b776845a12954871386ead270d4 | add tests for log rotation | plenum/test/test_log_rotation.py | plenum/test/test_log_rotation.py | Python | 0 | @@ -0,0 +1,1796 @@
+import pytest%0Aimport os%0Aimport logging%0Aimport shutil%0Aimport time%0Afrom plenum.common.logging.TimeAndSizeRotatingFileHandler %5C%0A import TimeAndSizeRotatingFileHandler%0A%0A%0Adef cleanFolder(path):%0A if os.path.exists(path):%0A shutil.rmtree(path)%0A os.makedirs(path, exi... | |
fd75ee4a96eddc1e71eb85dd36a2c8f5b13807ca | Create RemoveLinkedListElement.py | RemoveLinkedListElement.py | RemoveLinkedListElement.py | Python | 0.000001 | @@ -0,0 +1,785 @@
+%22%22%22Remove Linked List Elements%0ARemove all elements from a linked list of integers that have value val.%0A%0AExample%0AGiven: 1 --%3E 2 --%3E 6 --%3E 3 --%3E 4 --%3E 5 --%3E 6, val = 6%0AReturn: 1 --%3E 2 --%3E 3 --%3E 4 --%3E 5 %0A%22%22%22%0Aclass ListNode(object):%0A def __init__(self, ... | |
fd33fadc260cda2bd2395f027457f990ab05480b | Add migration for Registration changed | registration/migrations/0008_auto_20160418_2250.py | registration/migrations/0008_auto_20160418_2250.py | Python | 0 | @@ -0,0 +1,739 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.4 on 2016-04-18 13:50%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('registration', '0007_auto_20160416_1217'),%0A %5D... | |
3c1be9f8fb362699737b6dd867398e734057c300 | Add main entry point. | rave/__main__.py | rave/__main__.py | Python | 0 | @@ -0,0 +1,1016 @@
+import argparse%0Aimport sys%0Afrom os import path%0A%0A%0Adef parse_arguments():%0A parser = argparse.ArgumentParser(description='A modular and extensible visual novel engine.', prog='rave')%0A parser.add_argument('-b', '--bootstrapper', help='Select bootstrapper to bootstrap the engine with.... | |
592b3dda603dec0765825fc8dc03fb623906cb63 | Add migration | infrastructure/migrations/0018_auto_20210928_1642.py | infrastructure/migrations/0018_auto_20210928_1642.py | Python | 0.000002 | @@ -0,0 +1,579 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.29 on 2021-09-28 14:42%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 ('infrastructure'... | |
ede4704704f5f6b246d70c84a16be9465cfa55e2 | Triplet with given sum | Arrays/triplet_with_given_sum.py | Arrays/triplet_with_given_sum.py | Python | 0.999999 | @@ -0,0 +1,1413 @@
+import unittest%0A%22%22%22%0AGiven an unsorted array of numbers, and a value, find a triplet whose sum is equal to value.%0AInput: 12 3 4 1 6 9, value = 24%0AOutput: 12 3 9%0A%22%22%22%0A%0A%22%22%22%0AApproach:%0A1. Sort the array.%0A2. Scan from left to right.%0A3. Fix current element as potentia... | |
05659cd132a5dfb54b50ec38ff1d405697de251a | Add crawler for superpoop | comics/crawler/crawlers/superpoop.py | comics/crawler/crawlers/superpoop.py | Python | 0.000053 | @@ -0,0 +1,849 @@
+from comics.crawler.base import BaseComicCrawler%0Afrom comics.crawler.meta import BaseComicMeta%0A%0Aclass ComicMeta(BaseComicMeta):%0A name = 'Superpoop'%0A language = 'en'%0A url = 'http://www.superpoop.com/'%0A start_date = '2008-01-01'%0A history_capable_days = 30%0A schedule =... | |
6da1f28296a8db0c18c0726dcfdc0067bebd9114 | add a script to test learned DQN | learning_tools/keras-rl/dqn/dqn_tester.py | learning_tools/keras-rl/dqn/dqn_tester.py | Python | 0 | @@ -0,0 +1,1686 @@
+import numpy as np%0Aimport gym%0Aimport os%0Aimport pickle%0Aimport argparse%0Aimport pandas as pd%0A%0Afrom keras.models import Sequential%0Afrom keras.layers import Dense, Activation, Flatten%0Afrom keras.optimizers import Adam%0A%0Afrom rl.agents.dqn import DQNAgent%0Afrom rl.policy import Boltz... | |
9f6f6b727458eb331d370443074a58d1efa6d755 | Add migration for blank true. | kolibri/logger/migrations/0003_auto_20170531_1140.py | kolibri/logger/migrations/0003_auto_20170531_1140.py | Python | 0.000141 | @@ -0,0 +1,523 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.7 on 2017-05-31 18:40%0Afrom __future__ import unicode_literals%0A%0Aimport kolibri.core.fields%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('logger', '0002_auto_20170518_10... | |
b04e3787de29d4bee68854e15a7e783cbe3c3bd0 | Add test for microstructure generator | pymks/tests/test_microstructure_generator.py | pymks/tests/test_microstructure_generator.py | Python | 0 | @@ -0,0 +1,1519 @@
+import pytest%0Aimport numpy as np%0Afrom pymks.datasets import make_microstructure%0A%0A%0A@pytest.mark.xfail%0Adef test_size_and_grain_size_failure():%0A make_microstructure(n_samples=1, size=(7, 7), grain_size=(8, 1))%0A%0A%0A@pytest.mark.xfail%0Adef test_volume_fraction_failure():%0A make_... | |
04dcdadf4f8b18405754683af0138ddc8363580e | Create followExpression.py | maya/python/animation/followExpression.py | maya/python/animation/followExpression.py | Python | 0.000001 | @@ -0,0 +1,1118 @@
+ctrlShape = cmds.createNode('locator')%0ActrlTransform = cmds.listRelatives(ctrlShape,p=True,f=True)%0Aif isinstance(ctrlTransform,list):%0A ctrlTransform = ctrlTransform%5B0%5D%0Ajt = cmds.createNode('joint',n='followJoint')%0A%0AattrName = 'follow'%0Aif not cmds.attributeQuery(attrName,n=ctrlTr... | |
58c62061c0c02682f96d6793b0570b455887d392 | Add pytest tools | delocate/tests/pytest_tools.py | delocate/tests/pytest_tools.py | Python | 0.000001 | @@ -0,0 +1,514 @@
+import pytest%0A%0A%0Adef assert_true(condition):%0A __tracebackhide__ = True%0A assert condition%0A%0A%0Adef assert_false(condition):%0A __tracebackhide__ = True%0A assert not condition%0A%0A%0Adef assert_raises(expected_exception, *args, **kwargs):%0A __tracebackhide__ = True%0A r... | |
dd93995a119323d9b67dce1f8797eb72788a044a | solve 12704 | UVA/vol-127/12704.py | UVA/vol-127/12704.py | Python | 0.999999 | @@ -0,0 +1,211 @@
+from sys import stdin, stdout%0AI = list(map(int, stdin.read().split()))%0A%0Afor i in range(0, I%5B0%5D):%0A %5Bx, y, r%5D = I%5B3*i + 1: 3*i + 4%5D%0A cd = (x*x + y*y) ** 0.5%0A stdout.write('%7B:.2f%7D %7B:.2f%7D%5Cn'.format(r-cd, r+cd))%0A%0A
| |
3ad0f9ee142e3a08e82749f47003870f14029bff | Fix urls.py to point to web version of view | mysite/urls.py | mysite/urls.py | from django.conf.urls.defaults import *
import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^$', 'mysite.search.views.fetch_bugs'),
(r'^search/$', 'mysite.search.views.fetch_bugs'),
(r'^admin/(.*)', admin.site.root),
(r'^static/(?P<path>... | Python | 0.000004 | @@ -1620,16 +1620,20 @@
r_scrape
+_web
'),%0A%0A
|
8706ec4678bc4740b64265ced63fb12d837e0297 | Add Basic Histogram Example | altair/vegalite/v2/examples/histogram.py | altair/vegalite/v2/examples/histogram.py | Python | 0 | @@ -0,0 +1,435 @@
+%22%22%22%0AHistogram%0A-----------------%0AThis example shows how to make a basic histogram, based on the vega-lite docs%0Ahttps://vega.github.io/vega-lite/examples/histogram.html%0A%22%22%22%0Aimport altair as alt%0A%0Amovies = alt.load_dataset('movies')%0A%0Achart = alt.Chart(movies).mark_bar().en... | |
4f1ddebb0fc185dfe4cd5167c67be8f6cea78273 | Create listenCmd.py | listenCmd.py | listenCmd.py | Python | 0.000002 | @@ -0,0 +1,1525 @@
+#!/usr/bin/python%0A%0A#impoer the necessary modules%0Aimport re # the regexp module%0A%0A# listen command test python file%0A%0A%0A# // THE FCNS //%0A%0A# the fcn that iterate through the recognized command list to find a match with the received pseech command%0Adef listenForCommand( theCommand ):%... | |
fd1b2885057512d6b91a2b2ed4df183e66093e61 | Create extended_iter_with_peek.py | lld_practice/extended_iter_with_peek.py | lld_practice/extended_iter_with_peek.py | Python | 0.000001 | @@ -0,0 +1,1407 @@
+%0Aclass ExtendedIter:%0A %22%22%22An extended iterator that wraps around an existing iterators.%0A It provides extra methods:%0A - %60has_next()%60: checks if we can still yield items.%0A - %60peek()%60: returns the next element of our iterator, but doesn't pass by it.%0A If there's ... | |
7ce7ce4bd899e6c386de669d11a2fc5593157c91 | move processing in a mixin | pipeline/storage.py | pipeline/storage.py | import os
try:
from staticfiles import finders
from staticfiles.storage import CachedStaticFilesStorage, StaticFilesStorage
except ImportError:
from django.contrib.staticfiles import finders
from django.contrib.staticfiles.storage import CachedStaticFilesStorage, StaticFilesStorage
from django.core.ex... | Python | 0 | @@ -87,34 +87,26 @@
t Cached
-StaticFilesStorage
+FilesMixin
, Static
@@ -246,34 +246,26 @@
t Cached
-StaticFilesStorage
+FilesMixin
, Static
@@ -493,308 +493,173 @@
line
-Storage(StaticFilesStorage):%0A def get_available_name(self, name):%0A if self.exists(name):%0A self.delete(name)%0A ... |
77e980157f51af421eceb7c7b7a84945d8d33a91 | Convert caffemodel of FCN8s to chainer model | scripts/caffe_to_chainermodel.py | scripts/caffe_to_chainermodel.py | Python | 0.999999 | @@ -0,0 +1,1226 @@
+#!/usr/bin/env python%0A%0Afrom __future__ import print_function%0Aimport argparse%0Aimport os.path as osp%0A%0Aimport caffe%0Aimport chainer.functions as F%0Aimport chainer.serializers as S%0A%0Aimport fcn%0Afrom fcn.models import FCN8s%0A%0A%0Adata_dir = fcn.get_data_dir()%0Acaffemodel = osp.join(... | |
a8423d5759a951b7f8d765203e3a02a6d3211f35 | add body task generator | neurolabi/python/flyem/BodyTaskManager.py | neurolabi/python/flyem/BodyTaskManager.py | Python | 0.000008 | @@ -0,0 +1,2513 @@
+'''%0ACreated on Sep 18, 2013%0A%0A@author: zhaot%0A'''%0Aimport os;%0A%0Aclass ExtractBodyTaskManager:%0A '''%0A classdocs%0A '''%0A%0A def __init__(self):%0A '''%0A Constructor%0A '''%0A self.commandPath = '';%0A self.minSize = 0;%0A self.maxSi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.