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 |
|---|---|---|---|---|---|---|---|
96ed06f1f3dab3aa9d0f8150c41a5c1b943a86b0 | Add test for config module | frappe/tests/test_config.py | frappe/tests/test_config.py | Python | 0.000002 | @@ -0,0 +1,678 @@
+# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors%0A# License: MIT. See LICENSE%0Aimport unittest%0A%0Aimport frappe%0Afrom frappe.config import get_modules_from_all_apps_for_user%0A%0A%0Aclass TestConfig(unittest.TestCase):%0A%09def test_get_modules(self):%0A%09%09frappe_modules =... | |
d7bfed84d773e7ccbd23e910a533f70b4dd02184 | Add module entrypoint | g2sd/__main__.py | g2sd/__main__.py | Python | 0.000001 | @@ -0,0 +1,58 @@
+from .g2sd import cmd%0A%0Aif __name__ == %22__main__%22:%0A cmd()%0A
| |
7421cecfd6b304692eb19d76d3f90a61a950bc83 | add get_reviewers | get_reviewers.py | get_reviewers.py | Python | 0 | @@ -0,0 +1,1473 @@
+%09%0A%0A import sys%0A import urllib2%0A import time%0A from lxml import html%0A %0A def get_reviewers(bookid, star=1):%0A allstar10_list = %5B%5D%0A for tag in %5B'collections', 'doings', 'wishes'%5D:%0A reached_end = False%0A i = 0%0A while not re... | |
258a8d38d590f856e144b1e725fe38619c6758ea | Create notes_extractor.py | notes_extractor/notes_extractor.py | notes_extractor/notes_extractor.py | Python | 0 | @@ -0,0 +1,1977 @@
+#!/usr/bin/env python3%0A###############################################################################%0A# Name : extract_notes.py #%0A# Version : v. 1.0.0.0 #%0A# Author : Abel Gancsos ... | |
c0d135fc40142561e4a2409e47b34c367a6a7ef4 | add script to read device logs from rms dump | util/scripts/devicelogs.py | util/scripts/devicelogs.py | Python | 0 | @@ -0,0 +1,734 @@
+from rmsdump import *%0D%0A%0D%0Adef read_log_entry (log_entry):%0D%0A return tuple(log_entry.val%5Bi%5D.val for i in range(0, 3))%0D%0A%0D%0Adef print_log (log_atom):%0D%0A print '%25s%3E %25s: %25s' %25 (log_atom%5B0%5D.strftime('%25Y-%25m-%25d %25H:%25M:%25S'), log_atom%5B1%5D, log_atom%5B2%5D)%... | |
f1ccab2168dea1b0827f4ca929f0036e84170a76 | Add tests for cross domain xhr view | go/base/tests/test_views.py | go/base/tests/test_views.py | Python | 0 | @@ -0,0 +1,2059 @@
+%22%22%22Test for go.base.utils.%22%22%22%0A%0Afrom mock import patch, Mock%0Afrom django.core.urlresolvers import reverse%0A%0Afrom go.base.tests.utils import VumiGoDjangoTestCase%0A%0A%0Aclass BaseViewsTestCase(VumiGoDjangoTestCase):%0A def cross_domain_xhr(self, url):%0A return self.cli... | |
b67cc70a6cf04e605ad93933dd9d8a88db94f093 | add a simple flask app | backend/app.py | backend/app.py | Python | 0.000002 | @@ -0,0 +1,194 @@
+from flask import Flask%0Aimport db%0A%0A@app.route(%22/%22)%0Adef hello():%0A return %22Hello World!%22%0A%0Aif __name__ == %22__main__%22:%0A #db.process_db()%0A app = Flask(__name__)%0A app.run(debug=True)%0A %0A
| |
2b25b9ba1c9417e3e25a91055a65551210eb5313 | Add meal migrations | app/timetables/migrations/0002_meal.py | app/timetables/migrations/0002_meal.py | Python | 0.000003 | @@ -0,0 +1,682 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.7 on 2016-08-16 17:46%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('timetables', '0001_initial'),%0A %5D%0A%0A ope... | |
835d9628513a80215641bc4c63eae1fae7b8442b | rewrite portforwarding api | xos/api/utility/portforwarding.py | xos/api/utility/portforwarding.py | Python | 0.000002 | @@ -0,0 +1,1921 @@
+from rest_framework.decorators import api_view%0Afrom rest_framework.response import Response%0Afrom rest_framework.reverse import reverse%0Afrom rest_framework import serializers%0Afrom rest_framework import generics%0Afrom rest_framework.views import APIView%0Afrom core.models import *%0Afrom djan... | |
33f43dd2e167afd40c4a5c516ae7cae35519b4c5 | Add partial output for testcases to comet | judge/bridge/judgecallback.py | judge/bridge/judgecallback.py | import logging
from .judgehandler import JudgeHandler
from judge.models import Submission, SubmissionTestCase
from judge.simple_comet_client import send_message
logger = logging.getLogger('judge.bridge')
class DjangoJudgeHandler(JudgeHandler):
def finish(self):
JudgeHandler.finish(self)
for id i... | Python | 0.000011 | @@ -3629,16 +3629,21 @@
.1f %25.1f
+ (%25s)
' %25 (pac
@@ -3890,11 +3890,29 @@
e.total)
+, packet%5B'output'%5D
))%0A
|
f1826b2cf4c4103efe52713a57dc2fcabda1a45d | fix migration for real | kitsune/questions/migrations/0006_ios_questionlocale.py | kitsune/questions/migrations/0006_ios_questionlocale.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def create_questionlocale(apps, schema_editor):
Product = apps.get_model('products', 'Product')
QuestionLocale = apps.get_model('questions', 'QuestionLocale')
p = Product.objects.get_or_create(slug='... | Python | 0.000001 | @@ -274,16 +274,25 @@
)%0A%0A p
+, created
= Produ
@@ -504,24 +504,38 @@
False%7D)%0A%0A
+ ql, created =
QuestionLoc
@@ -578,18 +578,30 @@
-US'
-,
+)%0A ql.
product
-=
+s.add(
p)%0A%0A
|
c2e3e122560b8981079e1a89ff90fdf31c9eb8d1 | Reset timer on push. | astm/protocol.py | astm/protocol.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Alexander Shorin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
import logging
from .asynclib import AsyncChat, call_later
from .records import HeaderRecord, Terminato... | Python | 0 | @@ -2013,32 +2013,127 @@
ent_data = data%0A
+ if self.timer is not None and not self.timer.cancelled:%0A self.timer.reset()%0A
return s
|
4178691ed3826239721f2d9a6435ef90cfb5cf82 | Add color to input | flask_init/run.py | flask_init/run.py | #!/usr/bin/python
# -*- coding:utf-8 -*-
import os
import six
import templates
from .creator import Creator
from .exceptions import InvalidFolderName
def main():
name = six.moves.input('Input project name (default is "flask_proj"): ')
name = name or 'flask_proj'
module = six.moves.input('Input module na... | Python | 0.000002 | @@ -155,26 +155,44 @@
def
-main(
+color_input(color, text
):%0A
-name =
+return
six
@@ -208,41 +208,165 @@
put(
-'Input project name (default is %22
+color+text+'%5C033%5B0m')%0A%0A%0Adef color_print(color, text):%0A six.print_(color+text+'%5C033%5B0m')%0A%0A%0Adef main():%0A name = color_input(%22%5C03... |
48933f27c098b05276271a62ed3c970e4d5721b0 | add missing file | src/radical/repex/utils.py | src/radical/repex/utils.py | Python | 0.000003 | @@ -0,0 +1,1093 @@
+%0Aimport radical.utils as ru%0A%0A%0A# ------------------------------------------------------------------------------%0A#%0Adef expand_ln(to_link, src_sbox, tgt_sbox, rid, cycle):%0A%0A expand = %7B'rid' : rid,%0A 'cycle': cycle%7D%0A%0A if not src_sbox: src_sbox = '.'%0A if ... | |
88788c215c619ab894e21243d584541f311dbfb9 | Add eventlet test check to new tests __init__.py | oslo_concurrency/tests/__init__.py | oslo_concurrency/tests/__init__.py | Python | 0.000009 | @@ -0,0 +1,704 @@
+# Copyright 2014 Red Hat, Inc.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# ... | |
112c3a5a7728aea9be59b4bab1c26932e5faceaf | replace simple_api.py, set filename via commandline param, git add files that dont exist | import_fusion.py | import_fusion.py | Python | 0 | @@ -0,0 +1,2758 @@
+#!/usr/bin/python%0Aimport json%0Aimport requests%0Aimport sys%0Aimport codecs%0Aimport subprocess%0Afrom datetime import datetime%0Afrom optparse import OptionParser%0A%0A%0Aif __name__ == %22__main__%22:%0A%0A parser = OptionParser()%0A parser.add_option(%22-f%22, dest=%22output_file%22, hel... | |
43d23f19933e898254d58c4874e6f0c0ac3b1cc6 | Add example config file | config-example.py | config-example.py | Python | 0.000001 | @@ -0,0 +1,2400 @@
+# Example configuration file for for Pyaiot%0A%0A# Configuration options are shared between all pyaiot components.%0A%0A%0A# Debug%0A# Enable debug logging for all components.%0A#debug = False%0A%0A# Broker host:%0A# Other component connect to this host for their broker connection. The%0A# dashboard... | |
b1caa89d75aecc564d504e5baffd0dc7619cd587 | Create foursq_friends.py | foursq_friends.py | foursq_friends.py | Python | 0.000028 | @@ -0,0 +1,796 @@
+import json%0Afrom foursq_utils import *%0A%0Adef fetch_usr_friends(user_id):%0A super_token = 'QEJ4AQPTMMNB413HGNZ5YDMJSHTOHZHMLZCAQCCLXIX41OMP'%0A url = 'https://api.foursquare.com/v2/users/' + str(user_id) + '/friends?oauth_token=' + super_token + '&v=20210115'%0A try:%0A raw = get... | |
139524072cc56d19ce887aaa95705dff8a952cc2 | Add lc035_search_insert_position.py | lc035_search_insert_position.py | lc035_search_insert_position.py | Python | 0.000002 | @@ -0,0 +1,719 @@
+%22%22%22Leetcode 35. Search Insert Position%0AEasy%0A%0AURL: https://leetcode.com/problems/search-insert-position/%0A%0AGiven a sorted array and a target value, return the index if the target is found.%0AIf not, return the index where it would be if it were inserted in order.%0A%0AYou may assume no ... | |
1669cd22d6c8ee5bcb37c6770c98ddcf8848d901 | Make lots of xyz with differing natoms visualizable | pad-trajectory.py | pad-trajectory.py | Python | 0.000002 | @@ -0,0 +1,1583 @@
+#!/usr/bin/env python3%0A#%0A# Script to generate an ext-xyz trajectory from individual ext-xyz files with varying atom numbers using ASE.%0A# Appens 'X' atoms at origin to obtain frames with equal lengths%0A# by Patrick Melix%0A# 2020/06/08%0A#%0A%0Afrom ase import io, Atom%0Aimport os%0A%0Adef mai... | |
ac4d1cfc9cb6af0dea2196cdd4f0ca356e392062 | Fix cross-device renames in PythonInterpreterCache. | src/python/twitter/pants/python/interpreter_cache.py | src/python/twitter/pants/python/interpreter_cache.py | # ==================================================================================================
# Copyright 2013 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | Python | 0 | @@ -942,16 +942,30 @@
mport os
+%0Aimport shutil
%0A%0Afrom t
@@ -3496,16 +3496,18 @@
-os.renam
+shutil.mov
e(di
@@ -5932,16 +5932,37 @@
erpreter
+, logger=self._logger
)%0A%0A def
|
900b09803f5c49b8645ba7f3d47eb17515061377 | Create heads_and_legs.py | heads_and_legs.py | heads_and_legs.py | Python | 0.000431 | @@ -0,0 +1,284 @@
+#Kunal Gautam%0A#Codewars : @Kunalpod%0A#Problem name: Heads and Legs%0A#Problem level: 8 kyu%0A%0Adef animals(heads, legs):%0A if heads==0 and legs==0:%0A return (0,0)%0A y = legs//2 - heads%0A x = heads-y%0A if x%3C0 or y%3C0 or legs%252!=0:%0A return %22No solutions%22%0A... | |
fed98c8a9723c6fe18c123015b51714dc4ccdf68 | add migrations | actual_play/migrations/0006_game_thumbnail.py | actual_play/migrations/0006_game_thumbnail.py | Python | 0.000001 | @@ -0,0 +1,502 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.1 on 2016-10-20 22:45%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('actual_play', '0005_auto_20161010_1313'),%0A %5D%... | |
5c9ffc4a0ab9f8aed3071a0bf4ad0fc69070b628 | Create inside_market.py | inside_market.py | inside_market.py | Python | 0.000059 | @@ -0,0 +1,2662 @@
+import pandas as pd%0Aimport numpy as np%0A%0A# update current state of our bid and ask%0A# iterate thru each trade and determine if a fill was generated%0A%0A# id%0A# price%0A# qty%0A# side - bid/ask%0A# status - live, canceled, rejected%0A%0ALIVE = 0%0ACANCELED = 1%0AREJECTED = 2%0AFILLED = ... | |
0dd3894fb8816f6f904e5c7d204ab2672b304588 | Add earth mesh module | gravity_waves/earth_mesh.py | gravity_waves/earth_mesh.py | Python | 0 | @@ -0,0 +1,1202 @@
+from __future__ import absolute_import, print_function, division%0A%0Afrom firedrake import *%0A%0A%0A__all__ = %5B%22generate_earth_mesh%22%5D%0A%0A%0Adef generate_earth_mesh(r_level, num_layers, thickness, hexes=False):%0A %22%22%22Generates an Earth-like spherical mesh for the gravity wave%0A ... | |
5578d11f45e9c41ab9c4311f2bed48b9c24d9bf5 | Create file for Nonterminal have method | tests/grammar_term-nonterm_test/NonterminalHaveTest.py | tests/grammar_term-nonterm_test/NonterminalHaveTest.py | Python | 0.000001 | @@ -0,0 +1,111 @@
+#!/usr/bin/env python%0A%22%22%22%0A:Author Patrik Valkovic%0A:Created 23.06.2017 16:39%0A:Licence GNUv3%0APart of grammpy%0A%0A%22%22%22
| |
b40c6ce73c439e7d74b867702fdd2c4cd7ad8b15 | add testrunner to automactically create/delete a test db during python and django tests. | couchdbkit/ext/django/testrunner.py | couchdbkit/ext/django/testrunner.py | Python | 0 | @@ -0,0 +1,2802 @@
+from django.test.simple import DjangoTestSuiteRunner%0Afrom django.conf import settings%0Afrom couchdbkit.ext.django import loading as loading%0Afrom couchdbkit.resource import ResourceNotFound%0A%0Aclass CouchDbKitTestSuiteRunner(DjangoTestSuiteRunner):%0A %22%22%22%0A A test suite runner for... | |
913c9a10b2eb3b3d9de108a82a3251b2c0de0e10 | Add test for Hostname object | cybox/test/objects/hostname_test.py | cybox/test/objects/hostname_test.py | Python | 0 | @@ -0,0 +1,565 @@
+# Copyright (c) 2014, The MITRE Corporation. All rights reserved.%0A# See LICENSE.txt for complete terms.%0A%0Aimport unittest%0A%0Afrom cybox.objects.hostname_object import Hostname%0Afrom cybox.test.objects import ObjectTestCase%0A%0A%0Aclass TestHostname(ObjectTestCase, unittest.TestCase):%0A o... | |
514aca20c6f076a86819d7180f36c3b2e8bcc33b | Add integration test checking compatibility of Keras models with TF optimizers. | tests/integration_tests/test_tensorflow_integration.py | tests/integration_tests/test_tensorflow_integration.py | Python | 0 | @@ -0,0 +1,1521 @@
+from __future__ import print_function%0A%0Aimport os%0Aimport tempfile%0Aimport pytest%0Aimport keras%0Afrom keras import layers%0Afrom keras.utils.test_utils import get_test_data%0Afrom keras.utils.test_utils import keras_test%0A%0A%0A@pytest.mark.skipif(keras.backend.backend() != 'tensorflow', rea... | |
3840fbe6ca33e48b9bdbd78e85830a13606f612c | Create efi-smc.py | efi-smc.py | efi-smc.py | Python | 0.000001 | @@ -0,0 +1,1698 @@
+#!/usr/bin/python%0Afrom lxml import html%0Aimport requests%0A%0A# Get the EFI/SMC table from Apple's Website%0Apage = requests.get('http://support.apple.com/en-us/HT1237')%0Atree = html.fromstring(page.text)%0A%0A# Count the number of rows which will be used in looping%0Arows = tree.xpath('//*%5B@i... | |
4c23b6b75f64698fa40a263760fea8d7648ff6d6 | Add self as argument | calibrate_sense_hat/calibrate_sense_hat.py | calibrate_sense_hat/calibrate_sense_hat.py | #!/usr/bin/python
import os
from PIL import Image # pillow
from sense_hat import SenseHat
class BlxSenseHat(object):
def __init__(
self,
text_assets='calibrate_sense_hat_text'
):
self._text_dict = {}
# Load text assets
dir_path = os.path.dirname(__file__)... | Python | 0.999699 | @@ -2902,24 +2902,30 @@
how_message(
+self,
text_string,
|
cdc6b62400f66d1b2747b5668a6618c961deb962 | create game class | powerball/game.py | powerball/game.py | Python | 0 | @@ -0,0 +1,534 @@
+#!/usr/bin/env python%0A%0Afrom collections import Counter%0Afrom .player import Player%0A%0Aclass Game:%0A%0A def __init__(self, players=None):%0A %22%22%22%0A Initialize the game instance.%0A players may be initialized by argument or by calling the begin method.%0A wi... | |
b5d1be9069507feaeb41cfcf9cd774a244ffe49c | Add Activity model | sqlalchemy_continuum/ext/activity_stream.py | sqlalchemy_continuum/ext/activity_stream.py | Python | 0.000001 | @@ -0,0 +1,973 @@
+import sqlalchemy as sa%0Afrom sqlalchemy_utils import generic_relationship, JSONType%0A%0A%0Aclass Activity(object):%0A @declared_attr%0A def actor_id(self):%0A return sa.Column(%0A sa.Integer,%0A sa.ForeignKey('user.id'),%0A index=True%0A )%0A%0A... | |
98b738e21918d1b6c4f2193cf229c518c9913974 | add standalone affordance server script | src/python/scripts/affordanceServer.py | src/python/scripts/affordanceServer.py | Python | 0 | @@ -0,0 +1,1045 @@
+from ddapp import consoleapp%0Afrom ddapp import lcmobjectcollection%0Afrom ddapp.timercallback import TimerCallback%0Aimport datetime%0A%0Adef main():%0A%0A app = consoleapp.ConsoleApp()%0A%0A meshCollection = lcmobjectcollection.LCMObjectCollection('MESH_COLLECTION_COMMAND')%0A affordance... | |
8e4d60645fb45e37c7a947b3a86219e5fd15c194 | Add py-geeup package (#12367) | var/spack/repos/builtin/packages/py-geeup/package.py | var/spack/repos/builtin/packages/py-geeup/package.py | Python | 0 | @@ -0,0 +1,1691 @@
+# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass PyGeeup(PythonPackage):%0A %22%22%22Simple Client for E... | |
eb4bcaf1a94963bc1af697180a31a48a84333eb6 | Add exclusive state for /* */ comments to the curly lexer. Seems to fix leaf node comments too. | libraries/vyconf/configfile/curly/lexer.py | libraries/vyconf/configfile/curly/lexer.py | # vyconf.configfile.curly.lexer: lexer for the curly config
#
# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Found... | Python | 0 | @@ -941,16 +941,168 @@
ject):%0A%0A
+ # Multiline comment can't be extracted with regex,%0A # so we have exclusive state for it%0A states = (%0A ('COMMENT', 'exclusive'),%0A )%0A%0A
toke
@@ -1331,43 +1331,184 @@
#
-TODO: add multiline comment support
+/* */ comment. This is a bit complicat... |
c50628d1cf984be774cdf1bc6728b9c1cb3f94fa | Create Assignment2Solution.py | Assignments/Assignment2Solution.py | Assignments/Assignment2Solution.py | Python | 0 | @@ -0,0 +1,1065 @@
+# Your name here%0A# Assignment 2: Process a folder of shapefiles%0A# Using the os library, find all shapefiles,and only shapefiles in a given folder and buffer them as before.%0A# Catch exceptions to handle invalid shapefiles.%0Aimport arcpy%0Aimport os%0A%0Adef main(inputfolder,prefix,outputfolder... | |
4f32369efb0b2cd8540cc78132cadfbed6e68ae8 | Read and write xls files | src/petlx/xls.py | src/petlx/xls.py | Python | 0 | @@ -0,0 +1,1090 @@
+%22%22%22%0ARead and write xls files, using xlrd.%0A%0A%22%22%22%0A%0Aimport os%0A%0Aimport petl%0A%0Afrom petlx.util import UnsatisfiedDependency%0A%0A%0Adep_message = %22%22%22%0AThe package xlrd is required. pip install xlrd.%0A%22%22%22%0A%0A%0Adef fromxls(filename, sheetname):%0A %22%22%22%0... | |
24d742e444c84df99629d8a6aff7ca7e6c90f995 | Add adhoc script to detect jobs with stuck ActiveInvocations list. | scheduler/misc/detect_stuck_active_invs.py | scheduler/misc/detect_stuck_active_invs.py | Python | 0 | @@ -0,0 +1,2353 @@
+#!/usr/bin/env python%0A# Copyright 2018 The LUCI Authors.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-... | |
cf78037980a9345c12b1e2562bc4eda63cea95b3 | Add a simple regression test to go with r143260. CommandInterpreter::PreprocessCommand() should not infinite loop when a target has not been specified yet. | test/functionalities/backticks/TestBackticksWithoutATarget.py | test/functionalities/backticks/TestBackticksWithoutATarget.py | Python | 0.000178 | @@ -0,0 +1,565 @@
+%22%22%22%0ATest that backticks without a target should work (not infinite looping).%0A%22%22%22%0A%0Aimport os, time%0Aimport unittest2%0Aimport lldb%0Afrom lldbtest import *%0A%0Aclass BackticksWithNoTargetTestCase(TestBase):%0A%0A mydir = %22functionalities/backticks%22%0A%0A def test_backti... | |
28e226a47d16fb6a52c937031be19d8832e7e5c4 | Bump development version | ckeditor_filebrowser_filer/__init__.py | ckeditor_filebrowser_filer/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.1.1'
| Python | 0 | @@ -38,9 +38,12 @@
'0.
-1.
+2.0.b
1'%0A
|
5e37cabc1253f573cf270883378157784ca1bf7c | Update train.py (#1733) | PaddleNLP/sequence_tagging_for_ner/train.py | PaddleNLP/sequence_tagging_for_ner/train.py | from __future__ import print_function
import os
import math
import time
import numpy as np
import six
import paddle
import paddle.fluid as fluid
import reader
from network_conf import ner_net
from utils import logger, load_dict
from utils_extend import to_lodtensor, get_embedding
def test(exe, chunk_evaluator, inf... | Python | 0 | @@ -5159,16 +5159,62 @@
ass_id)%0A
+ if %22CE_MODE_X%22 not in os.environ:%0A
@@ -5275,16 +5275,20 @@
mark'%5D,%0A
+
|
dc200e50020637650c8a5dfe76895b0a033a8cea | Add tests for verifying that deactivating password works | akvo/rsr/tests/models/test_login_logging.py | akvo/rsr/tests/models/test_login_logging.py | Python | 0 | @@ -0,0 +1,3299 @@
+# -*- coding: utf-8 -*-%0A%0A# Akvo Reporting is covered by the GNU Affero General Public License.%0A# See more details in the license.txt file located at the root folder of the Akvo RSR module.%0A# For additional details on the GNU license please see %3C http://www.gnu.org/licenses/agpl.html %3E.%0... | |
e28a6423f63a169b46ebe46e9690d3858f953909 | Add tests | apps/commons/tests/test_accepted_locales.py | apps/commons/tests/test_accepted_locales.py | Python | 0.000001 | @@ -0,0 +1,3332 @@
+import os%0Aimport shutil%0A%0Afrom django.conf import settings%0Aimport test_utils%0A%0Aimport manage%0A%0A%0Aclass AcceptedLocalesTest(test_utils.TestCase):%0A %22%22%22Test lazy evaluation of locale related settings.%0A%0A Verify that some localization-related settings are lazily evaluated ... | |
bb9fd71dc06ac39b461b4109e341fe7cd4172c76 | use self.create_socket() | tests/twisted/file-transfer/test-receive-file-and-disconnect.py | tests/twisted/file-transfer/test-receive-file-and-disconnect.py | import socket
from file_transfer_helper import exec_file_transfer_test, ReceiveFileTest
class ReceiveFileAndDisconnectTest(ReceiveFileTest):
def receive_file(self):
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.connect(self.address)
# disconnect
self.conn.Disconnect()
... | Python | 0.000001 | @@ -181,55 +181,26 @@
= s
-ocket.socket(socket.AF_UNIX, socket.SOCK_STREAM
+elf.create_socket(
)%0A
|
5dfd7b1534e19242ab778d535e2de13b424578f7 | Add examples | example.py | example.py | Python | 0 | @@ -0,0 +1,604 @@
+#!/usr/bin/python3%0A#%0A# Copyright (c) 2016, Fabian Affolter %3Cfabian@affolter-engineering.ch%3E%0A# Released under the MIT license. See LICENSE file for details.%0A#%0Aimport fixerio%0A%0A# Our base currency is the Czech Koruna instead of the default (EUR).%0ABASE = 'CZK'%0A%0Aexchange = fixerio.... | |
5afdd7775dd1aa232d3ca8fa2852f4a36918f224 | add management command to fix forms whose non-ascii chars are corrupted | corehq/apps/cleanup/management/commands/fix_corrupted_forms.py | corehq/apps/cleanup/management/commands/fix_corrupted_forms.py | Python | 0 | @@ -0,0 +1,1584 @@
+# encoding: utf-8%0Afrom __future__ import absolute_import%0Afrom __future__ import unicode_literals%0A%0Afrom django.core.management import BaseCommand%0A%0Afrom six.moves import input%0A%0Afrom corehq.apps.app_manager.dbaccessors import get_apps_by_id%0A%0ASUSPICIOUS_STRINGS = %5B%0A internatio... | |
3cf56093b9d132a5089a70a12feb73c4be987da8 | Add mtnpatch.py, a script to parse and import a full monotone diff | contrib/mtnpatch.py | contrib/mtnpatch.py | Python | 0 | @@ -0,0 +1,2202 @@
+#!/usr/bin/env python%0Aimport sys, os, string, getopt%0A%0Amtncmd = %22monotone%22%0A%0Adef main(argv = None):%0A if argv is None:%0A argv = sys.argv%0A opts, list = getopt.getopt(sys.argv%5B1:%5D, ':R')%0A if len(list) %3C 1:%0A print %22You must specify a file%22%0A ... | |
4430b1957b642e87cd263455e371bf1d634101b0 | Add buildone command | cerbero/commands/buildone.py | cerbero/commands/buildone.py | Python | 0.000005 | @@ -0,0 +1,1799 @@
+# cerbero - a multi-platform build system for Open Source software%0A# Copyright (C) 2012 Andoni Morales Alastruey %3Cylatuya@gmail.com%3E%0A#%0A# This library is free software; you can redistribute it and/or%0A# modify it under the terms of the GNU Library General Public%0A# License as published by... | |
6244e0b40d847687b7ff875a48fb08060efc97bf | Solve Within PyCharm | Newsolver.py | Newsolver.py | Python | 0.000039 | @@ -0,0 +1,1342 @@
+from __future__ import division%0D%0Afrom pyomo.environ import *%0D%0Afrom pyomo.opt import SolverFactory%0D%0A%0D%0A%0D%0Amodel = AbstractModel()%0D%0A%0D%0Amodel.M = Set()%0D%0Amodel.N = Set()%0D%0A%0D%0Amodel.n = Param()%0D%0Amodel.c = Param(model.M, model.N)%0D%0A%0D%0Amodel.x = Var(model.M, mod... | |
00f766b24865e8010411105794f20bc0ef39a6dc | Add py-sphinxcontrib-devhelp package (#13278) | var/spack/repos/builtin/packages/py-sphinxcontrib-devhelp/package.py | var/spack/repos/builtin/packages/py-sphinxcontrib-devhelp/package.py | Python | 0 | @@ -0,0 +1,793 @@
+# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass PySphinxcontribDevhelp(PythonPackage):%0A %22%22%22sphin... | |
295afe540c24ded86353402d87c42e072f7a64fa | Initialize makePublicPrivateKeys | books/CrackingCodesWithPython/Chapter23/makePublicPrivateKeys.py | books/CrackingCodesWithPython/Chapter23/makePublicPrivateKeys.py | Python | 0.000004 | @@ -0,0 +1,2682 @@
+# Public Key Generator%0A# https://www.nostarch.com/crackingcodes/ (BSD Licensed)%0A%0Aimport random, sys, os, primeNum, cryptomath%0A%0A%0Adef main():%0A # Create a public/private keypair with 1024-bit keys:%0A print('Making key files...')%0A makeKeyFiles('al_sweigart', 1024)%0A print('... | |
3e97731449027e5ac0d3a047e1b872956feac528 | Create cracking-the-safe.py | Python/cracking-the-safe.py | Python/cracking-the-safe.py | Python | 0.000004 | @@ -0,0 +1,1937 @@
+# Time: O(k%5En)%0A# Space: O(k%5En)%0A%0A# There is a box protected by a password.%0A# The password is n digits, where each letter can be one of the first k digits 0, 1, ..., k-1.%0A#%0A# You can keep inputting the password,%0A# the password will automatically be matched against the last n digits ... | |
9c2487ab2c3b8d12e5a5f0f179b2a1fd79496b17 | add tests | doajtest/unit/event_consumers/test_application_publisher_in_progress_notify.py | doajtest/unit/event_consumers/test_application_publisher_in_progress_notify.py | Python | 0 | @@ -0,0 +1,3096 @@
+from portality import models%0Afrom portality import constants%0Afrom portality.bll import exceptions%0Afrom doajtest.helpers import DoajTestCase%0Afrom doajtest.fixtures import ApplicationFixtureFactory%0Aimport time%0A%0Afrom portality.events.consumers.application_publisher_inprogress_notify impor... | |
73ae4839941b802870eaba29b67c8b8a89e43c71 | add backend_service_migration script to call the migration handler | backend_service_migration.py | backend_service_migration.py | Python | 0.000001 | @@ -0,0 +1,3722 @@
+# Copyright 2020 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# https://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by ... | |
a1b88f50edf9f30f3840c50067545f2d315596aa | create compare.py | part-1/compare.py | part-1/compare.py | Python | 0.000001 | @@ -0,0 +1,438 @@
+# coding: utf8%0A%0Aprint '''%0ACPython implementation detail: Objects of different types except numbers are ordered by their type names; objects of the same types that don%E2%80%99t support proper comparison are ordered by their address.%0A%0A%3E%3E%3E 5 %3C 'foo' # %3Ctype 'int'%3E %3C %3Ctype 's... | |
696960eba9da48a8eb4830f464ccacb792e0c435 | Get the list of entities found by the name given in input | sara_flexbe_states/src/sara_flexbe_states/List_Entities_By_Name.py | sara_flexbe_states/src/sara_flexbe_states/List_Entities_By_Name.py | Python | 0.999836 | @@ -0,0 +1,2984 @@
+#!/usr/bin/env python%0A%0Afrom flexbe_core.proxy import ProxySubscriberCached%0Afrom flexbe_core import EventState, Logger%0Afrom sara_msgs.msg import Entities%0Afrom geometry_msgs.msg import Pose%0Afrom tf.transformations import euler_from_quaternion%0A%0Aimport math%0A%0A%0Aclass list_found_entit... | |
3f24e7b51281031fa9713b737a9647b305105a89 | Write unittest for parse_file() in ConfigReader.py | src/unittests.py | src/unittests.py | Python | 0.000001 | @@ -0,0 +1,3199 @@
+from ConfigReader import ConfigReader as cr%0Aimport unittest%0Aimport os%0A%0Aclass testConfigReader(unittest.TestCase):%0A %22%22%22Test cases for configReader%22%22%22%0A%0A def setUp(self):%0A %22%22%22Set up some important variables%22%22%22%0A self.example_config_filename =... | |
bbd6e538ec45c3650b7b3b7d520613fb4967236a | Print 4x4 grid | python/reddit/think_python_grid.py | python/reddit/think_python_grid.py | Python | 0.000017 | @@ -0,0 +1,342 @@
+def grid():%0A delimiter_row = ('%7B%7D%7B%7D'.format('+ ', '- ' * 4) * 4) + '+'%0A openspace_row = ('%7B%7D%7B%7D'.format('%7C', ' ' * 9) * 4) + '%7C'%0A for box_row in range(4 * 4):%0A if box_row %25 4 == 0:%0A print(delimiter_row)%0A print(openspace_row)%0A ... | |
6e535a2d597f172d9342fb8a547335890c474b49 | Add a sample config file | src/config-sample.py | src/config-sample.py | Python | 0.000001 | @@ -0,0 +1,225 @@
+FLASK_SECRET_KEY = 'Enter a Flask Secret Key'%0A%0A# OAuth Credentials. You can find them on%0A# https://www.yelp.com/developers/v3/manage_app%0AYELP_CLIENT_ID = 'Enter Yelp Client ID'%0AYELP_CLIENT_SECRET = 'Enter Yelp Client Secret'%0A
| |
7b545e210aa534b5d76e30769a125285cb40bfa8 | Create PrintFunctionBancorFormula.py | solidity/python/constants/PrintFunctionBancorFormula.py | solidity/python/constants/PrintFunctionBancorFormula.py | Python | 0.000001 | @@ -0,0 +1,1428 @@
+from math import factorial%0A%0A%0AMIN_PRECISION = 32%0AMAX_PRECISION = 127%0ANUM_OF_PRECISIONS = 128%0A%0A%0ANUM_OF_COEFS = 34%0AmaxFactorial = factorial(NUM_OF_COEFS)%0Acoefficients = %5BmaxFactorial/factorial(i) for i in range(NUM_OF_COEFS)%5D%0A%0A%0Adef fixedExpUnsafe(x,precision):%0A xi = x... | |
8b0130ccb318f7f04daf8e8fa7532c88afb9f7c2 | convert eexec doctests into eexec_test.py | Tests/misc/eexec_test.py | Tests/misc/eexec_test.py | Python | 0.000319 | @@ -0,0 +1,557 @@
+from __future__ import print_function, division, absolute_import%0Afrom fontTools.misc.py23 import *%0Afrom fontTools.misc.eexec import decrypt, encrypt%0A%0A%0Adef test_decrypt():%0A testStr = b%22%5C0%5C0asdadads asds%5C265%22%0A decryptedStr, R = decrypt(testStr, 12321)%0A assert decrypte... | |
6515e45e6d717ed2c84789a5d0941533465496b7 | update test | h2o-py/tests/testdir_munging/pyunit_insert_missing.py | h2o-py/tests/testdir_munging/pyunit_insert_missing.py | from builtins import zip
from builtins import range
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
def insert_missing():
# Connect to a pre-existing cluster
data = [[1, 2, 3, 1, 'a', 1, 9],
[1, 6, 4, 2, 'a', 1, 9],
[2, 3, 8, 6, 'b', 1, 9],
... | Python | 0.000001 | @@ -502,24 +502,44 @@
tion = 0.0)%0A
+ print(h2o_data)%0A
num_nas
@@ -541,35 +541,25 @@
_nas = sum(%5B
-h2o_data%5Bc%5D
+v
.isna().sum(
@@ -564,35 +564,29 @@
m() for
-c
+v
in
-range(
h2o_data
.ncol)%5D)
@@ -569,38 +569,32 @@
or v in h2o_data
-.ncol)
%5D)%0A assert nu
@@ -720,24 +720,44 @@
tion ... |
1de77375a12e26693c89f5fe824df82719bc8632 | Add dummy directory | jacquard/directory/dummy.py | jacquard/directory/dummy.py | Python | 0.000001 | @@ -0,0 +1,270 @@
+from .base import Directory%0A%0Aclass DummyDirectory(Directory):%0A def __init__(self, users=()):%0A self.users = %7Bx.id: x for x in users%7D%0A%0A def lookup(self, user_id):%0A return self.users%5Buser_id%5D%0A%0A def all_users(self):%0A return self.users.values()%0A
| |
90eda86a7bbd1dc28023a6c5df1f964add3ddf55 | add client test for oaipmh endpoint. | test/oaipmh_client_test.py | test/oaipmh_client_test.py | Python | 0 | @@ -0,0 +1,1075 @@
+import requests%0Afrom lxml import etree%0A%0ANS = %22%7Bhttp://www.openarchives.org/OAI/2.0/%7D%22%0A%0AJOURNAL_BASE_URL = %22http://localhost:5004/oai%22%0AARTICLE_BASE_URL = %22http://localhost:5004/oai.article%22%0A%0Adef harvest(base_url, resToken=None):%0A url = base_url + %22?verb=ListReco... | |
cb18bcb02b86c185d946f9bf74d3e846fff7205c | fix error message | src/python/importer.py | src/python/importer.py | # Copyright (c) 2008 The Hewlett-Packard Development Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of... | Python | 0.000002 | @@ -1979,16 +1979,26 @@
mporter%22
+ %25 modpath
%0A%0A
|
0ba3dff1e150d534e4eda086ebbd53ec3789d82c | Add alg_balance_symbols.py | alg_max_connected_colors.py | alg_max_connected_colors.py | Python | 0.00058 | @@ -0,0 +1,215 @@
+def max_connected_colors():%0A pass%0A%0A%0Adef main():%0A # A grid of connected colors: 5 (of 2's).%0A grid = %5B%5B1, 1, 2, 3%5D,%0A %5B1, 2, 3, 2%5D,%0A %5B3, 2, 2, 2%5D%5D%0A%0A%0Aif __init__ == '__main__':%0A main()%0A
| |
ce6052ee9df9ca83ac2da691eb51a8eaea0ab603 | Comment model migration | comments/migrations/0001_initial.py | comments/migrations/0001_initial.py | Python | 0.000001 | @@ -0,0 +1,1204 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.6 on 2016-05-10 22:41%0Afrom __future__ import unicode_literals%0A%0Afrom django.conf import settings%0Afrom django.db import migrations, models%0Aimport django.db.models.deletion%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A initial = Tr... | |
74260fbf266628d4f8afbbab61bbd6de0ddfe7fe | Remove unused constant | dragonflow/neutron/common/constants.py | dragonflow/neutron/common/constants.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | Python | 0.000247 | @@ -570,62 +570,8 @@
e.%0A%0A
-from neutron_lib.api.definitions import portbindings%0A%0A
DF_R
@@ -686,51 +686,4 @@
ip'%0A
-DF_PORT_BINDING_PROFILE = portbindings.PROFILE%0A
|
22298d91fff788c37395cdad9245b3e7ed20cfdf | Add a snippet (Python OpenCV). | python/opencv/opencv_2/images/display_image_with_matplotlib.py | python/opencv/opencv_2/images/display_image_with_matplotlib.py | Python | 0.000018 | @@ -0,0 +1,1525 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A# Copyright (c) 2015 J%C3%A9r%C3%A9mie DECOCK (http://www.jdhp.org)%0A%0A%22%22%22%0AOpenCV - Display image: display an image given in arguments%0A%0ARequired: opencv library (Debian: aptitude install python-opencv)%0A%0ASee: https://opencv-python... | |
ba9e4c6b003cc002e5bc7216da960e47f9fe5424 | Print information about all nitrogens. | copper_imidazole_csv_allnitrogen.py | copper_imidazole_csv_allnitrogen.py | Python | 0 | @@ -0,0 +1,2687 @@
+#!/usr/bin/env python2%0A%0Aimport orca_parser%0Afrom copper_imidazole_analysis import CopperImidazoleAnalysis%0Aimport argparse%0Aimport csv%0A%0Acia = CopperImidazoleAnalysis()%0A%0Aparser = argparse.ArgumentParser(description=%22Given pathnames of ORCA output files, make a dump of all nitrogen pa... | |
0a93e1d5355802746a513e7e64625f18fe9b3ec7 | remove custom CodeInput._get_bbcode | designer/uix/designer_code_input.py | designer/uix/designer_code_input.py | import re
from kivy import Config
from kivy.utils import get_color_from_hex
from pygments import styles, highlight
from designer.helper_functions import show_alert
from kivy.uix.codeinput import CodeInput
from kivy.properties import BooleanProperty, Clock, partial
class DesignerCodeInput(CodeInput):
'''A subclas... | Python | 0.00002 | @@ -1732,956 +1732,8 @@
()%0A%0A
- def _get_bbcode(self, ntext):%0A # override the default method to fix bug with custom themes%0A # get bbcoded text for python%0A try:%0A ntext%5B0%5D%0A # replace brackets with special chars that aren't highlighted%0A # by pygm... |
eb0772fc6c30d98b83bf1c8e7d83af21066ae45b | Add peek method and implementation | data_structures/Stack/Python/Stack.py | data_structures/Stack/Python/Stack.py | # Author: AlexBanks97
# Purpose: LIFO Stack implementation using python array.
# Date: October 15th 2017
class Stack(object):
def __init__(self):
# Initialize stack as empty array
self.stack = []
# Return and remove the last element of the stack array.
def pop(self):
# If the stack... | Python | 0 | @@ -512,16 +512,139 @@
.append(element)
+%0A%0A # Return the last element of the stack array (without removing it).%0A def peek(self):%0A return self.stack%5B-1%5D
|
825c4d613915d43aea2e6ee0bc5d5b49ed0a4500 | Create a simple method to segment a trip into sections | emission/analysis/classification/segmentation/section_segmentation.py | emission/analysis/classification/segmentation/section_segmentation.py | Python | 0 | @@ -0,0 +1,2964 @@
+# Standard imports%0Aimport attrdict as ad%0Aimport numpy as np%0Aimport datetime as pydt%0A%0A# Our imports%0Aimport emission.analysis.classification.cleaning.location_smoothing as ls%0Aimport emission.analysis.point_features as pf%0Aimport emission.storage.decorations.location_queries as lq%0A%0Ad... | |
5f2cd26054adff5a1fbf9ba5d56766b972f46670 | Add a multithreaded stress tester for key generation. Hopefully provides additional confidence that that code is correct with respect to threading. | leakcheck/thread-key-gen.py | leakcheck/thread-key-gen.py | Python | 0 | @@ -0,0 +1,868 @@
+# Copyright (C) Jean-Paul Calderone%0A# See LICENSE for details.%0A#%0A# Stress tester for thread-related bugs in RSA and DSA key generation. 0.12 and%0A# older held the GIL during these operations. Subsequent versions release it%0A# during them.%0A%0Afrom threading import Thread%0A%0Afrom OpenSSL.... | |
cdab60ed217669fc3e84854b649ccd978a0c6118 | fix typos | lg_earth/scripts/add_kml.py | lg_earth/scripts/add_kml.py | #!/usr/bin/env python
from std_msgs.msg import String, Empty
from lg_common.srv import USCSMessage
from lg_common.msg import StringArray
from interactivespaces_msgs.msg import GenericMessage
import SimpleHTTPServer
import SocketServer
import threading
import tempfile
import rospy
import json
import copy
import os
imp... | Python | 0.999974 | @@ -2153,19 +2153,22 @@
if
-not
kml_id
+not in
self
@@ -5266,16 +5266,30 @@
tch=True
+, queue_size=1
)%0A %0A
|
c87be0f98295d64addc01529999996b566c80f2c | add sent notification status | migrations/versions/00xx_add_sent_notification_status.py | migrations/versions/00xx_add_sent_notification_status.py | Python | 0 | @@ -0,0 +1,1734 @@
+%22%22%22empty message%0A%0ARevision ID: 00xx_add_sent_notification_status%0ARevises: 0075_create_rates_table%0ACreate Date: 2017-04-24 16:55:20.731069%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '00xx_sent_notification_status'%0Adown_revision = '0075_create_rates_table... | |
44526603b2ab388fceb99de625f3282c4a2a8d99 | write the test with the proper constants | tests/modules/test_math.py | tests/modules/test_math.py | import math
from ..base import BaseTopazTest
class TestMath(BaseTopazTest):
def assert_float_equal(self, result, expected, eps=1e-15):
assert abs(result - expected) < eps
def test_domain_error(self, space):
space.execute("Math::DomainError")
def test_pi(self, space):
w_res = spa... | Python | 0 | @@ -1979,22 +1979,8 @@
')%0A%0A
- # inf%0A
@@ -2024,22 +2024,31 @@
h.gamma(
-1e1000
+Float::INFINITY
)%22)%0A
@@ -2342,27 +2342,8 @@
'):%0A
- # -inf%0A
@@ -2383,35 +2383,30 @@
ma(-
-1e1000
+Float::INFINITY
)%22%22%22)%0A%0A
- # nan%0A
@@ -2454,23 +2454,18 @@
mma(
-1... |
7597e834288c21065703bcdc86530a0ad5414a95 | backup strategy tasks | nodeconductor/backup/tasks.py | nodeconductor/backup/tasks.py | Python | 0.000002 | @@ -0,0 +1,351 @@
+from celery import shared_task%0A%0A%0A@shared_task%0Adef backup_task(backupable_instance):%0A backupable_instance.get_backup_strategy.backup()%0A%0A%0A@shared_task%0Adef restore_task(backupable_instance):%0A backupable_instance.get_backup_strategy.restore()%0A%0A%0A@shared_task%0Adef delete_ta... | |
4820013e207947fe7ff94777cd8dcf1ed474eab1 | Add migration for account lockout fields on User | migrations/versions/fb6a6554b21_add_account_lockout_fields_to_user.py | migrations/versions/fb6a6554b21_add_account_lockout_fields_to_user.py | Python | 0 | @@ -0,0 +1,929 @@
+%22%22%22Add account lockout fields to User%0A%0ARevision ID: fb6a6554b21%0ARevises: 1f9b411bf6df%0ACreate Date: 2015-10-29 01:07:27.930095%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = 'fb6a6554b21'%0Adown_revision = '1f9b411bf6df'%0A%0Afrom alembic import op%0Aimport sql... | |
cee7f23df93f4a09550348e30709aa1e6e6969fc | use net ip availability api def from neutron-lib | neutron/extensions/network_ip_availability.py | neutron/extensions/network_ip_availability.py | # Copyright 2016 GoDaddy.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | Python | 0.000003 | @@ -577,16 +577,90 @@
cense.%0A%0A
+from neutron_lib.api.definitions import network_ip_availability as apidef%0A
from neu
@@ -858,999 +858,8 @@
in%0A%0A
-RESOURCE_NAME = %22network_ip_availability%22%0ARESOURCE_PLURAL = %22network_ip_availabilities%22%0ACOLLECTION_NAME = RESOURCE_PLURAL.replace('_', '-')%0AEXT_ALIAS... |
6fabbe85bb74788641897daf8b162eac3d47b0aa | Add script for downloading Indonesia price data | data_crunching/indonesia_timeseries/download_indonesia_prices.py | data_crunching/indonesia_timeseries/download_indonesia_prices.py | Python | 0 | @@ -0,0 +1,2158 @@
+#!/usr/bin/env python2%0A%0Aimport urllib2%0Aimport shutil%0Aimport re%0Aimport sys%0Aimport datetime%0Afrom lxml import etree%0A%0Ausage_str = %22%22%22%0AThis scripts downloads daily food prices from http://m.pip.kementan.org/index.php (Indonesia).%0A%0AProvide date in DD/MM/YYYY format.%0A%0AExam... | |
46a842136e93ce21936cbf28950b6f0d358c3359 | Fix super cleanUp for fullstack ProcessFixture | neutron/tests/fullstack/fullstack_fixtures.py | neutron/tests/fullstack/fullstack_fixtures.py | # Copyright 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | Python | 0.000001 | @@ -2072,26 +2072,34 @@
ixture, self
-,
+).cleanUp(
*args, **kwa
|
6c524df7f0e1240237a1cd53858e6eafed8a70a5 | Define liblouis_nacl nexe for MIPS | third_party/liblouis/liblouis_nacl.gyp | third_party/liblouis/liblouis_nacl.gyp | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'braille_test_data_dir': '<(PRODUCT_DIR)/chromevox_test_data/braille',
'braille_chromevox_dir': '<(PRODUCT_DIR)/resources/chromeos... | Python | 0.997255 | @@ -2541,32 +2541,118 @@
get)_arm.nexe',%0A
+ 'out_newlib_mips': '%3C(braille_test_data_dir)/%3E(nexe_target)_mips32.nexe',%0A
'bui
@@ -3150,32 +3150,139 @@
%7D%5D,%0A
+ %5B'enable_mips==1', %7B%0A 'nexe_files': %5B'%3E(out_newlib_mips)'%5D,%0A ... |
4fdf2c32bcd937ba2fc21dbaad8a81620c02fb17 | Fix part of #5134: Add test for core.storage.config.gae_models (#5565) | core/storage/config/gae_models_test.py | core/storage/config/gae_models_test.py | Python | 0.000001 | @@ -0,0 +1,1662 @@
+# coding: utf-8%0A#%0A# Copyright 2018 The Oppia Authors. 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.o... | |
65969d0251dc5031328132cf2043f1f76ee90d72 | Include the demo as a separate file | demo.py | demo.py | Python | 0 | @@ -0,0 +1,2398 @@
+%0Aimport sys, curses%0A%0Afrom cwidgets import *%0Afrom cwidgets import _LOG%0A%0Adef demo(window):%0A # Create the root of the widget hierarchy.%0A root = WidgetRoot(window)%0A # Wrap the UI in a Viewport to avoid crashes at small resolutions.%0A vp = root.add(Viewport())%0A # Push ... | |
3968c53c4577b2efe9ef3cd2de76b688a26517d9 | Add gpio example | chapter2/gpio.py | chapter2/gpio.py | Python | 0.000001 | @@ -0,0 +1,124 @@
+import RPi.GPIO as GPIO%0AGPIO.setmode(GPIO.BOARD)%0AGPIO.setup(5, GPIO.OUT)%0AGPIO.output(5, GPIO.HIGH)%0AGPIO.output(5, GPIO.LOW)%0A
| |
dc0bb07da52fd11a7980b9f36c38fcdb7f9c6ba5 | Add `edit.py` to be able to edit a view asynchronously | edit.py | edit.py | Python | 0.000001 | @@ -0,0 +1,1839 @@
+# edit.py%0A# buffer editing for both ST2 and ST3 that %22just works%22%0A%0Aimport sublime%0Aimport sublime_plugin%0Afrom collections import defaultdict%0A%0Atry:%0A sublime.edit_storage%0Aexcept AttributeError:%0A sublime.edit_storage = %7B%7D%0A%0Aclass EditStep:%0A def __init__(self, cm... | |
a795d94a9c885b97ab5bffc313524ae46626d556 | Add simple function-size analysis tool. | tools/analyze_code_size.py | tools/analyze_code_size.py | Python | 0 | @@ -0,0 +1,2189 @@
+%0Aimport os%0Aimport re%0Aimport sys%0Aimport optparse%0A%0AMARKER_START_FUNCS = %22// EMSCRIPTEN_START_FUNCS%22%0AMARKER_END_FUNCS = %22// EMSCRIPTEN_END_FUNCS%22%0A%0AFUNCTION_CODE_RE = re.compile(%0A r%22function (?P%3Cname%3E%5Ba-zA-Z0-9_%5D+)(?P%3Cdefn%3E.*?)((?=function)%7C(?=$))%22%0A)%0A%0... | |
2ce7bcdd6606cb1590febf6430a7635462b09d74 | fix #61: prefer configuration files under script dir | lixian_config.py | lixian_config.py |
import os
import os.path
def get_config_path(filename):
if os.path.exists(filename):
return filename
user_home = os.getenv('USERPROFILE') or os.getenv('HOME')
lixian_home = os.getenv('LIXIAN_HOME') or user_home
return os.path.join(lixian_home, filename)
LIXIAN_DEFAULT_CONFIG = get_config_path('.xunlei.lixian.c... | Python | 0 | @@ -99,16 +99,130 @@
ilename%0A
+%09import sys%0A%09local_path = os.path.join(sys.path%5B0%5D, filename)%0A%09if os.path.exists(local_path):%0A%09%09return local_path%0A
%09user_ho
|
dfe2bd52fd2e561a79c91d4ff34fbead8a26c1c3 | Create init.py | init.py | init.py | Python | 0.000001 | @@ -0,0 +1,2315 @@
+#!/usr/bin/env python%0Aimport sys%0Aimport os%0Aimport psycopg2%0A%0Adef dump_table(table_name, conn):%0A query = %22SELECT * FROM %22+table_name+%22 LIMIT 1%22%0A cur = conn.cursor()%0A cur.execute(query)%0A rows = cur.fetchall()%0A description = cur.description%0A columns = %22'... | |
bfaeeec3f5f5582822e2918491090815a606ba44 | Add test to make sure imports and __all__ matches | test/test_api.py | test/test_api.py | Python | 0.000037 | @@ -0,0 +1,271 @@
+# -*- coding: utf-8 -*-%0A%0Aimport warthog.api%0A%0A%0Adef test_public_exports():%0A exports = set(%5Bitem for item in dir(warthog.api) if not item.startswith('_')%5D)%0A declared = set(warthog.api.__all__)%0A assert exports == declared, 'Exports and __all__ members should match'%0A
| |
48857638694ceca08c64d7b9c6825e2178c53279 | Add function decorator to improve functools.wraps | pylearn2/utils/doc.py | pylearn2/utils/doc.py | Python | 0.000001 | @@ -0,0 +1,2763 @@
+%22%22%22%0ADocumentation-related helper classes/functions%0A%22%22%22%0A%0A%0Aclass soft_wraps:%0A %22%22%22%0A A Python decorator which concatenates two functions' docstrings: one%0A function is defined at initialization and the other one is defined when%0A soft_wraps is called.%0A%0A ... | |
dfca9c3d7dbbe97516a24bea89b917f7282c7dc7 | Add problem rotate image | python/rotateImage.py | python/rotateImage.py | Python | 0.000003 | @@ -0,0 +1,902 @@
+# https://leetcode.com/problems/rotate-image/%0A%0Aclass Solution(object):%0A def rotate(self, matrix):%0A %22%22%22%0A :type matrix: List%5BList%5Bint%5D%5D%0A :rtype: void Do not return anything, modify matrix in-place instead.%0A %22%22%22%0A size = len(matrix... | |
cce6a4c2efe62c267b04f6ce75019d577428e2c9 | add sensu_check_dict module | library/sensu_check_dict.py | library/sensu_check_dict.py | Python | 0.000001 | @@ -0,0 +1,2951 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0A%0A# Copyright 2014, Blue Box Group, Inc.%0A# Copyright 2014, Craig Tracey %3Ccraigtracey@gmail.com%3E%0A# Copyright 2016, Paul Czarkowski %3Cpczarkow@us.ibm.com%3E%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may n... | |
97e87a73d4161f7bde4fc9843bc1010ee6e064d7 | Add doc-string to default init | learning/model.py | learning/model.py | #!/usr/bin/env python
from __future__ import division
import logging
from six import iteritems
from inspect import isfunction
from collections import OrderedDict
from recordtype import recordtype
import numpy as np
import theano
import theano.tensor as T
_logger = logging.getLogger(__name__)
floatX = theano.con... | Python | 0.000001 | @@ -436,24 +436,159 @@
in, n_out):%0A
+ %22%22%22 Return a n_in * n_out shaped matrix with uniformly sampled elements %0A between - and + sqrt(6)/sqrt(n_in+n_out).%0A %22%22%22%0A
scale =
|
577b84cf124a35b49311e39ab4d40ef0f8af59ed | introduce proso.analysis module | proso/analysis.py | proso/analysis.py | Python | 0 | @@ -0,0 +1,1132 @@
+import json%0Aimport hashlib%0Aimport os%0A%0A%0Adef get_experiment_data(name, compute_fun, cache_dir, cached=True, **kwargs):%0A kwargs_hash = hashlib.sha1(json.dumps(kwargs, sort_keys=True)).hexdigest()%0A filename = '%7B%7D/%7B%7D.json'.format(cache_dir, name);%0A if cached and os.path.e... | |
45cb940db74d99b0dac31a2aace3d8505e4a9046 | Add empty file to contain main part of module | datac/main.py | datac/main.py | Python | 0.000001 | @@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-%0Aimport copy%0A
| |
323fb80744e63a322fe5ed70d86130aa61aa3c19 | Remove unused imports | examples/manifold/plot_swissroll.py | examples/manifold/plot_swissroll.py | """
===================================
Swiss Roll reduction with LLE
===================================
An illustration of Swiss Roll reduction
with locally linear embedding
"""
# Author: Fabian Pedregosa -- <fabian.pedregosa@inria.fr>
# License: BSD, (C) INRIA 2011
print __doc__
import numpy as np
import pylab a... | Python | 0 | @@ -291,78 +291,19 @@
ort
-numpy as np%0Aimport pylab as pl%0Afrom mpl_toolkits.mplot3d import Axes3D
+pylab as pl
%0A%0A%0A#
|
e8c75e84a158876e71a926bec244af43ad93cbc4 | add imu class | imu.py | imu.py | Python | 0.000001 | @@ -0,0 +1,1809 @@
+import serial%0Aimport math%0Aimport struct%0A%0Aclass IMU:%0A %22%22%22Class for working with a Microstrain IMU%22%22%22%0A def __init__(self):%0A self.IMU_PORT = '/dev/ttyS0'%0A self.IMU_BAUD = 115200%0A self.CMD_ACCEL_ANG_ORIENT = '%5CxC8'%0A self.CMD_ACCEL_ANG_ORIENT_SIZE = 67%0A%0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.