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 |
|---|---|---|---|---|---|---|---|
c1894e280f7d4b8d2afac6b4febaae451894306c | Add command to view exons in the database | scout/commands/view/exons.py | scout/commands/view/exons.py | Python | 0 | @@ -0,0 +1,1283 @@
+import logging%0Aimport click%0Afrom pprint import pprint as pp%0A%0Afrom flask.cli import with_appcontext%0A%0Afrom scout.server.extensions import store%0A%0ALOG = logging.getLogger(__name__)%0A%0A%0A@click.command('exons', short_help='Display exons')%0A@click.option('-b', '--build', default='37', ... | |
685e9cc5f285bb6fadddea8d94d5a9820ace39e6 | Initialize manager module for server | src/server/manager.py | src/server/manager.py | Python | 0 | @@ -0,0 +1,1808 @@
+class Event:%0A def __init__(self, t, hz):%0A self.t = t%0A self.hz = hz%0A%0Aclass Layer:%0A def __init__(self):%0A self.events = %5B%5D%0A%0A def addEvent(self, e):%0A self.events.append(e)%0A%0Aclass Client:%0A def __init__(self, connection):%0A self... | |
6be3900d26a25495101de2a14a9f62b59d9b776a | use posixpath to generate thumbnail-src | seahub/thumbnail/utils.py | seahub/thumbnail/utils.py | import os
from seahub.utils import get_service_url
def get_thumbnail_src(repo_id, obj_id, size):
return os.path.join(get_service_url(), "thumbnail", repo_id,
obj_id, size, '')
| Python | 0.000002 | @@ -1,17 +1,24 @@
import
+p
os
+ixpath
%0Afrom se
@@ -112,11 +112,13 @@
urn
+p
os
-.
+ix
path
@@ -188,16 +188,18 @@
+
obj_id,
@@ -206,10 +206,6 @@
size
-, ''
)%0A
|
ccadcfe891871032ea5e4c1974db67ed1b69a0e8 | add undocumented function to display new messages. | rtv/docs.py | rtv/docs.py | from .__version__ import __version__
__all__ = ['AGENT', 'SUMMARY', 'AUTH', 'CONTROLS', 'HELP', 'COMMENT_FILE',
'SUBMISSION_FILE', 'COMMENT_EDIT_FILE']
AGENT = """\
desktop:https://github.com/michael-lazar/rtv:{} (by /u/civilization_phaze_3)\
""".format(__version__)
SUMMARY = """
Reddit Terminal Viewer is... | Python | 0 | @@ -1200,60 +1200,8 @@
nts%0A
- %60i%60 : Display new messages prompt%0A
%60?
@@ -1504,16 +1504,68 @@
comment%0A
+ %60i%60 : Display new messages prompt%0A
%60s%60
|
9ffcadf3a79459b6685cf64a6a77d5186f8fc691 | add main file, data base connection and one simple insertion test | main.py | main.py | Python | 0 | @@ -0,0 +1,684 @@
+from users_handler import UsersHandler%0Aimport pymongo%0Aimport logging%0Aimport sys%0A%0Alogging.basicConfig(format='%25(levelname)s: %25(message)s', level=logging.DEBUG)%0A%0Atry:%0A client = pymongo.MongoClient(%22mongodb://root:chat1234@ds135797.mlab.com:35797/chat%22)%0A logging.info(%22C... | |
7ca529e9afe68033c5f6f552aae6f5316a406555 | check for peru file before running | main.py | main.py | #! /usr/bin/env python3
import os
import sys
import runtime
import module
def main():
r = runtime.Runtime()
peru_file_name = os.getenv("PERU_FILE_NAME") or "peru"
m = module.parse(r, peru_file_name)
if len(sys.argv) > 1:
target = sys.argv[1].split('.')
else:
target = []
m.buil... | Python | 0 | @@ -86,34 +86,8 @@
():%0A
- r = runtime.Runtime()%0A
@@ -141,16 +141,141 @@
%22peru%22%0A
+ if not os.path.isfile(peru_file_name):%0A print(%22no peru file found%22)%0A sys.exit(1)%0A r = runtime.Runtime()%0A
m =
|
a7ba6c3872103bf46d838202da37e1426e285525 | Add example skeleton | main.py | main.py | Python | 0.000002 | @@ -0,0 +1,986 @@
+from random import random%0Afrom kivy.app import App%0Afrom kivy.uix.widget import Widget%0Afrom kivy.uix.button import Button%0Afrom kivy.graphics import Color, Ellipse, Line%0A%0A%0Aclass MyPaintWidget(Widget):%0A%0A def on_touch_down(self, touch):%0A color = (random(), 1, 1)%0A wi... | |
b627cccbd77dbb4f8d87189d7d85cb66d2324b2e | add helpers.py file to notebooks folder for common helper functions for notebooks to use | notebooks/helpers.py | notebooks/helpers.py | Python | 0 | @@ -0,0 +1,1039 @@
+import itertools%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0A%0Adef plot_confusion_matrix(cm, classes,%0A normalize=False,%0A title='Confusion matrix',%0A cmap=plt.cm.Blues):%0A %22%22%22%0A This function p... | |
59ba6d2db5fa27878653f000cb1e6f8cfd6ccc89 | Check ptavi.p3 | check-p3.py | check-p3.py | Python | 0 | @@ -0,0 +1,1798 @@
+#!/usr/bin/python3%0A# -*- coding: utf-8 -*-%0A%0A%22%22%22%0AScript de comprobaci%C3%B3n de entrega de pr%C3%A1ctica%0A%0APara ejecutarlo, desde la shell:%0A $ python check-p3.py login_github%0A%0A%22%22%22%0A%0Aimport os%0Aimport random%0Aimport sys%0A%0A%0Aif len(sys.argv) != 2:%0A print()%0A ... | |
db689744216f19ed425e3155dd8d57d792497f4a | create VersionList module and class to manage the list of blender version installed on user system | settingMod/VersionList.py | settingMod/VersionList.py | Python | 0 | @@ -0,0 +1,868 @@
+#!/usr/bin/python3.4%0A# -*-coding:Utf-8 -*%0A'''module to manage list of all know version of Blender in the system'''%0Aimport xml.etree.ElementTree as xmlMod%0A%0A%0Aclass VersionList:%0A%09'''class dedicated to Blender version managing'''%0A%09%0A%09%0A%09def __init__(self, xml= None):%0A%09%09'''... | |
238f62cadfe4514b116ffaa0b0c2206e31132d8e | Add poll.py, which polls an F5 load balancer for virtual service stats and sends them to Graphite | poll.py | poll.py | Python | 0 | @@ -0,0 +1,2314 @@
+#!/usr/bin/env python%0Afrom pysnmp.entity.rfc3413.oneliner import cmdgen%0Afrom pysnmp.smi import builder%0Aimport time%0Aimport socket%0Aimport struct%0Aimport pickle%0A%0Ahostname = socket.gethostname().split('.')%0Acolo = hostname%5B1%5D%0A%0ACARBON_SERVER = %22%22%0ACARBON_PORT = 2004%0A%0ACOMM... | |
013016bf533a91e7dceffd806a8a1db0e8b6a74c | add admin.py to device logs for text-based searching | corehq/ex-submodules/phonelog/admin.py | corehq/ex-submodules/phonelog/admin.py | Python | 0 | @@ -0,0 +1,467 @@
+from django.contrib import admin%0Afrom .models import *%0A%0A%0Aclass DeviceReportEntryAdmin(admin.ModelAdmin):%0A%0A model = DeviceReportEntry%0A list_display = %5B%0A 'xform_id',%0A 'msg',%0A 'type',%0A 'domain',%0A 'date',%0A 'username',%0A %5D%0... | |
717f3c5d4babe9feeb4e0d82fb2ea839d735c4b4 | Test database.common for full coverage of database | test/backend/test_database/test_common.py | test/backend/test_database/test_common.py | Python | 0 | @@ -0,0 +1,332 @@
+import mock%0Afrom linkr import db%0Aimport database.common%0Afrom test.backend.test_case import LinkrTestCase%0A%0A%0Aclass TestCommon(LinkrTestCase):%0A def test_create_tables(self):%0A with mock.patch.object(db, 'create_all') as mock_create:%0A database.common.create_tables()%... | |
62962e852b24e9659b82615190cf184896fe08d7 | Add account tasks | froide/account/tasks.py | froide/account/tasks.py | Python | 0.000003 | @@ -0,0 +1,773 @@
+from django.conf import settings%0Afrom django.utils import translation%0A%0Afrom froide.celery import app as celery_app%0A%0Afrom .models import User%0A%0A%0A@celery_app.task%0Adef cancel_account_task(user_pk):%0A from .utils import cancel_user%0A%0A translation.activate(settings.LANGUAGE_CODE... | |
97c93e1c678c93dccb9a361bdffe5b1edd51f144 | make ansi | make_ansi.py | make_ansi.py | Python | 0.000775 | @@ -0,0 +1,2078 @@
+#!/usr/bin/env python%0Aimport re%0Aimport math%0Afrom pprint import pprint, pformat%0Afrom colortrans import rgb2short%0Afrom from pygments.styles import get_style_by_name, get_all_styles%0A%0ABASE_COLORS = %7B%0A 'BLACK': (0, 0, 0),%0A 'RED': (170, 0, 0),%0A 'GREEN': (0, 170, 0),%0A 'Y... | |
4316122225d2e523ff310f65479ea676e0aa02e3 | Add methods for loading data sets | load_data_sets.py | load_data_sets.py | Python | 0.000001 | @@ -0,0 +1,990 @@
+import os%0Aimport numpy as np%0A%0Aimport sgf_wrapper%0A%0Adef load_sgf_positions(*dataset_names):%0A for dataset in dataset_names:%0A dataset_dir = os.path.join(os.getcwd(), 'data', dataset)%0A dataset_files = %5Bos.path.join(dataset_dir, name) for name in os.listdir(dataset_dir)%5... | |
263fb51df80a9da6efc567f7e6e3b26012e12a4c | Fix bug for url_to_s3 | modules/data_source/url_to_s3/main.py | modules/data_source/url_to_s3/main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from specparser import get_settings_from_file
import os
import sys
import boto
import requests
from StringIO import StringIO
def percent_cb(complete, total):
sys.stdout.write('.')
sys.stdout.flush()
def s3_multipart_upload(bucket, url, remote_filename):
from ... | Python | 0.000001 | @@ -971,16 +971,43 @@
r as e:%0A
+ mp.cancel_upload()%0A
|
02401c9cdccaa52cf933ffc16225dc6bcbc2a1c3 | Create matrix.py | dasem/matrix.py | dasem/matrix.py | Python | 0.000006 | @@ -0,0 +1,2334 @@
+%22%22%22Matrix.%0A%0AUsage:%0A dasem.docterm save-wikipedia-doc-term-matrix %5Boptions%5D %3Cfilename%3E%0A%0AOptions:%0A --output-filename Filename to write to%0A -h --help Help message%0A --max-n-pages=%3Cint%3E Maximum number of pages%0A -v --verbose Verbose debug me... | |
715e02da3f2bdf8bff6d18258295e0152c27acef | Add the procedure generator | src-backend/api/generator.py | src-backend/api/generator.py | Python | 0 | @@ -0,0 +1,2451 @@
+from xml.etree import ElementTree%0Afrom xml.dom import minidom%0Afrom models import *%0A%0A%0Aclass ProcedureGenerator:%0A def __init__(self, procedure):%0A self.name = 'Procedure'%0A self.procedure = procedure%0A%0A def _get_properties(self):%0A props = %7B%0A ... | |
9707ccdab7f51e61dda2ac290ffda882d3610ee8 | Create retrieve_newest_file_from_nas.py | retrieve_newest_file_from_nas.py | retrieve_newest_file_from_nas.py | Python | 0 | @@ -0,0 +1,957 @@
+#!/bin/env python3%0A%22%22%22%0ACopies the most recent datafile from a secure NAS to a local file.%0A%22%22%22%0A%0Akey_file = 'key_rsa' # NOT .pub%0Aimport paramiko%0Aimport sqlite3%0Afrom datetime import datetime%0A%0Ahost = 'hostname'%0Aport = 22%0Ausername = ''%0Afilecount = 15%0Alocaldir = r%2... | |
38587aa6c906b87e5a908a6b963d89cbc2fc5505 | move manage.py into src folder | src/manage.py | src/manage.py | Python | 0.000001 | @@ -0,0 +1,242 @@
+#!/usr/bin/env python%0Aimport os%0Aimport sys%0A%0Aif __name__ == %22__main__%22:%0A os.environ.setdefault(%22DJANGO_SETTINGS_MODULE%22, %22settings%22)%0A%0A from django.core.management import execute_from_command_line%0A%0A execute_from_command_line(sys.argv)%0A
| |
e8880307030922f1ab7b2445ee67179fe276f1b1 | add trayicon test | netk/tests/testtrayicon.py | netk/tests/testtrayicon.py | Python | 0 | @@ -0,0 +1,201 @@
+#!/usr/bin/env python%0A%0Aimport pygtk%0Apygtk.require(%222.0%22)%0Aimport xfce4%0A%0Alabel = gtk.Label(%22Boo!%22)%0Alabel.show()%0Ati = xfce4.netk.TrayIcon(gtk.gdk.screen_get_default())%0Ati.add(label)%0Ati.show()%0A%0Agtk.main()%0A
| |
d9def2c4a7dd315df15725151945f30d7e48bace | Simplify odoo start. Make it work everywhere | openerp/cli/start.py | openerp/cli/start.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import glob
import os
import sys
from . import Command
from .server import main
from openerp.modules.module import get_module_root, MANIFEST
from openerp.service.db import _create_empty_database, DatabaseExists
class Start(Command):
"""Quick start the... | Python | 0.000002 | @@ -1687,183 +1687,94 @@
if
-not mods:%0A die(%22Directory %60%25s%60 does not contain any Odoo module.%5CnPlease start this command %22%0A %22in your project's directory or use %60--path%60 argument%22
+mods and '--addons-path' not in cmdargs:%0A cmdargs.append('--addons-path=%2... |
e4cd6dbd730f6a8a018cc5d987b3fb36d036cdd5 | add random todo about misleading function override | corehq/apps/custom_data_fields/models.py | corehq/apps/custom_data_fields/models.py | from couchdbkit.ext.django.schema import (Document, StringProperty,
BooleanProperty, SchemaListProperty, StringListProperty)
from jsonobject import JsonObject
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext as _
CUSTOM_DATA_FIELD_PREFIX = "data-field"
# This list i... | Python | 0 | @@ -1742,24 +1742,180 @@
ield_type):%0A
+ # todo: this overrides get_or_create from DocumentBase but with a completely different signature.%0A # This method should probably be renamed.%0A
exis
|
b3265f241ad4c405bc56cc1b4a5154dc3a4098bd | Create settings.py | settings.py | settings.py | Python | 0.000001 | @@ -0,0 +1,116 @@
+API_KEY = %22API_KEY%22%0AAPI_SECRET = %22API_SECRET%22%0AACCESS_TOKEN=%22ACCESS_TOKEN%22%0AACCESS_TOKEN_SECRET=%22ACCESS_TOKEN_SECRET%22%0A
| |
97c149057bf68ef8063316acad2b4c86f6579452 | Create maximum-vacation-days.py | Python/maximum-vacation-days.py | Python/maximum-vacation-days.py | Python | 0.999174 | @@ -0,0 +1,840 @@
+# Time: O(n%5E2 * k)%0A# Space: O(k)%0A%0Aclass Solution(object):%0A def maxVacationDays(self, flights, days):%0A %22%22%22%0A :type flights: List%5BList%5Bint%5D%5D%0A :type days: List%5BList%5Bint%5D%5D%0A :rtype: int%0A %22%22%22%0A if not days or not ... | |
612fb44b33c4f52488f3565c009188d61a8343c2 | Add an auto join script | python/autojoin_on_invite.py | python/autojoin_on_invite.py | Python | 0.000001 | @@ -0,0 +1,194 @@
+__module_name__ = %22autojoin on invite%22%0A__module_version__ = %221.0%22%0A%0Aimport hexchat%0A%0A%0Adef join(word, word_eol, userdata):%0A%09hexchat.command('join ' + word%5B0%5D)%0A%0A%0Ahexchat.hook_print('Invited', join)%0A
| |
3fd3b376b1334dba0ffea3641dcbb32d788f4083 | Add migration script to fix templated orphans. | scripts/fix_templated_orphans.py | scripts/fix_templated_orphans.py | Python | 0 | @@ -0,0 +1,2637 @@
+# -*- coding: utf-8 -*-%0A%0A%22%22%22Find orphaned templated nodes without parents, then attempt to identify and%0Arestore their parent nodes. Due to a bug in templating that has since been%0Afixed, several templated nodes were not attached to the %60nodes%60 lists of their%0Aparents.%0A%0A%22%22%2... | |
f18e500ff7eb1b73097786892673934346c9a94f | Create sign_rpm.py | sign_rpm.py | sign_rpm.py | Python | 0 | @@ -0,0 +1,2302 @@
++#!/bin/python%0A +%0A +import argparse, subprocess, shlex, os%0A +defaults = %7B%7D%0A +defaults%5B'rpm_dir'%5D = ''%0A +%0A +def get_args():%0A + parser = argparse.ArgumentParser(description=%22Setup a GPG macro to be used in signing an rpm. Optionally you can provide the location of rpm's ... | |
8995e45946812f5cd982d52bd12a99915a8b03cc | Add script to migrate artifact references | scripts/migrate-artifact-refs.py | scripts/migrate-artifact-refs.py | Python | 0 | @@ -0,0 +1,1249 @@
+import sys%0Aimport logging%0Afrom cPickle import loads%0A%0Afrom pylons import c%0A%0Afrom allura import model as M%0A%0Alog = logging.getLogger('allura.migrate-artifact-refs')%0A%0A# Threads have artifact references that must be migrated to the new system%0Adef main():%0A test = sys.argv%5B-1%5... | |
e7394973e5383fc72c4f8004390a05bc91b9053e | Add a skeleton Python file that can be reused. | skeleton.py | skeleton.py | Python | 0 | @@ -0,0 +1,1146 @@
+# Copyright 2017 Varun Khaneja%0A%0A# Permission is hereby granted, free of charge, to any person obtaining a copy of%0A# this software and associated documentation files (the %22Software%22), to deal in%0A# the Software without restriction, including without limitation the rights to%0A# use, copy, ... | |
df17f792faab74955f5e9573bf7dd9812b489bd3 | Add a hybridization example using Slate manually | hybridization_solver.py | hybridization_solver.py | Python | 0.000001 | @@ -0,0 +1,1270 @@
+from __future__ import absolute_import, print_function, division%0A%0Afrom firedrake import *%0A%0Aqflag = False%0Adegree = 1%0A%0Amesh = UnitSquareMesh(8, 8, quadrilateral=qflag)%0An = FacetNormal(mesh)%0A%0Aif qflag:%0A RT = FiniteElement(%22RTCF%22, quadrilateral, degree)%0A DG = FiniteElem... | |
efa84ed71e6804d71dd639715299a6438824fd64 | add unit tests for nacelle's session handling | nacelle/tests/tests_session_handling.py | nacelle/tests/tests_session_handling.py | Python | 0 | @@ -0,0 +1,1645 @@
+%22%22%22%0ATest nacelle's session handling%0A%22%22%22%0A# third-party imports%0Aimport webapp2%0A%0A# local imports%0Afrom nacelle.conf import settings%0Afrom nacelle.test.testcases import NacelleTestCase%0A%0A%0A# test fixtures: we need to set up a local wsgi app so we can test the login%0A# deco... | |
ba2d1a707a0869ad0266380b818f88fe626e0267 | Add alphabet_lstm.py | alphabet_lstm.py | alphabet_lstm.py | Python | 0.999999 | @@ -0,0 +1,2717 @@
+import numpy as np%0Afrom keras.models import Sequential%0Afrom keras.layers import Dense%0Afrom keras.layers import LSTM%0Afrom keras.utils import np_utils%0A%0A# http://machinelearningmastery.com/understanding-stateful-lstm-recurrent-neural-networks-python-keras/%0A%0Aif __name__ == %22__main__%22... | |
46e66f00ab8c340ca1f104c40c6b9a76762d7ec3 | Add example script | examples/cluster/experimental_cloud.py | examples/cluster/experimental_cloud.py | Python | 0 | @@ -0,0 +1,1512 @@
+# Licensed to Modin Development Team under one or more contributor license agreements.%0A# See the NOTICE file distributed with this work for additional information regarding%0A# copyright ownership. The Modin Development Team licenses this file to you under the%0A# Apache License, Version 2.0 (the... | |
3ddb3c93693822f0fdb3256a360754a4994a954e | add qutebrowser config | overlay/.config/qutebrowser/config.py | overlay/.config/qutebrowser/config.py | Python | 0 | @@ -0,0 +1,916 @@
+c.url.start_pages = %5B%22https://start.duckduckgo.com%22%5D%0Ac.content.javascript.enabled = False%0A%0Ac.content.headers.accept_language = %22en-US,en;q=0.5%22%0Ac.content.headers.custom = %7B%22accept%22: %22text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8%22%7D%0Ac.content.headers.... | |
73a00c9ac8e237dbd317e3e81ab19521cd7942de | Add donorresponse types | iatidq/donorresponse.py | iatidq/donorresponse.py | Python | 0 | @@ -0,0 +1,1298 @@
+%0A# IATI Data Quality, tools for Data QA on IATI-formatted publications%0A# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith%0A#%0A# Copyright (C) 2013 Publish What You Fund%0A#%0A# This programme is free software; you may redistribute and/or modify%0A# it under the terms of the GN... | |
4ca364980441dc3f41339db62f774f077588be40 | Add first version of the manager | dcclient/xml_manager/manager.py | dcclient/xml_manager/manager.py | Python | 0.000001 | @@ -0,0 +1,629 @@
+%22%22%22 Methos to create and manipulate the XML%0A%22%22%22%0Aimport data_structures%0A%0A%0Aclass ManagedXml:%0A def __init__(self):%0A self.xml = data_structures.Cfg_data()%0A%0A def addVlan(self, vid, name='', ports=%5B%5D):%0A %22%22%22 This method adds a vlan to the XML an ... | |
8e982c72829574a00a97f389ac169e5760d53f3c | Create restartable_thread.py | restartable_thread.py | restartable_thread.py | Python | 0 | @@ -0,0 +1,518 @@
+import threading%0Aimport time%0A%0Aclass ThreadRestartable(threading.Thread):%0A def __init__(self, theName):%0A threading.Thread.__init__(self, name=theName)%0A%0A def run(self):%0A print %22In ThreadRestartable%5Cn%22%0A time.sleep(10)%0A%0Athd = ThreadRestartable(%22WOR... | |
8a844b78c5ded93ce7a75585a6ad2b86d8b4cb13 | Add recognize decoding typedef or local type | pida_type_decoder.py | pida_type_decoder.py | Python | 0.000001 | @@ -0,0 +1,647 @@
+from pida_types import IDA_TYPES%0Afrom pida_tlocal_type import IdaTLocalType%0A%0A%0Adef decode_step(ida_type):%0A # TODO :%0A pass%0A%0A%0Adef decode_hybrid_type(ida_type):%0A value = %7B'idt': None, 'value': None%7D%0A rbyte = ord(ida_type%5B0%5D)%0A if not (ida_type%5B1%5D == '#' a... | |
4e617fef31af8360985abed00da43223ef5cc015 | Allow force installation of requirements | blues/application/tasks.py | blues/application/tasks.py | import os
from fabric.decorators import task
from fabric.state import env
from fabric.utils import indent
from refabric.utils import info
from .deploy import *
from .project import *
from .providers import get_providers
from .. import git
from ..app import blueprint
__all__ = []
@task
def setup():
"""
In... | Python | 0 | @@ -815,19 +815,32 @@
oad=True
+, force=False
):%0A
-
%22%22%22%0A
@@ -1103,53 +1103,18 @@
nged
-:%0A # Check if requirements has changed
+ or force:
%0A
@@ -1179,24 +1179,136 @@
ments.txt')%0A
+ requirements_changed = False%0A%0A if not force:%0A # Check if requirements has... |
f0c1263f1ca6d9a4f45eea3b19b9f818ed303d26 | Add examples/tic_ql_tab_simple_selfplay.py | examples/tic_ql_tab_simple_selfplay.py | examples/tic_ql_tab_simple_selfplay.py | Python | 0.000001 | @@ -0,0 +1,1589 @@
+'''%0AThe Q-learning algorithm is used to estimate the state-action values for a%0Asimple Tic-Tac-Toe position by playing games against itself (self-play).%0A'''%0Afrom capstone.game.games import TicTacToe%0Afrom capstone.game.players import RandPlayer%0Afrom capstone.game.utils import tic2pdf%0Afro... | |
6b00d2a2ca774bff57b523339c10759be4619da6 | add cluster name to detected cluster | tendrl/node_agent/node_sync/sds_detect.py | tendrl/node_agent/node_sync/sds_detect.py | import etcd
from tendrl.commons.event import Event
from tendrl.commons.message import Message, ExceptionMessage
from tendrl.node_agent.discovery.sds import manager as sds_manager
def load_and_execute_sds_discovery_plugins():
Event(
Message(
priority="info",
publisher=NS.publisher... | Python | 0 | @@ -1189,24 +1189,133 @@
uster_id'),%0A
+ detected_cluster_name=sds_details.get(%0A 'detected_cluster_name'),%0A
|
0663a2f90870e0f8b902aa97a479ee9d8ab3b23c | Add usage example to tf.keras.utils.to_categorical | tensorflow/python/keras/utils/np_utils.py | tensorflow/python/keras/utils/np_utils.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.000019 | @@ -1112,24 +1112,155 @@
ssentropy.%0A%0A
+ Usage Example:%0A %3E%3E%3E y = %5B0, 1, 2, 3%5D%0A %3E%3E%3E tf.keras.utils.to_categorical(y, num_classes=4)%0A array(%5B...%5D, dtype=float32)%0A%0A
Arguments:
|
8dc22c4c575b7c6931ab3ed14ef40b43dc03a685 | TEST initiated | dipy/core/tests/test_stensor.py | dipy/core/tests/test_stensor.py | Python | 0 | @@ -0,0 +1,726 @@
+%22%22%22 Testing qball %0A%0A%22%22%22%0A%0Aimport os%0Afrom os.path import join as pjoin%0Aimport numpy as np%0A%0Aimport dipy.core.stensor as ten%0A%0Afrom nose.tools import assert_true, assert_false, %5C%0A assert_equal, assert_raises%0A%0Afrom numpy.testing import assert_array_equal, assert_... | |
4c785069bc16257c568e65e601d3808fe8248546 | Bring back exception conversion to Forbidden | openerp/addons/base/ir/ir_http.py | openerp/addons/base/ir/ir_http.py | #----------------------------------------------------------
# ir_http modular http routing
#----------------------------------------------------------
import logging
import re
import sys
import werkzeug.exceptions
import werkzeug.routing
import openerp
from openerp import http
from openerp.http import request
from op... | Python | 0 | @@ -3777,39 +3777,197 @@
-return self._handle_exception(e
+# force a Forbidden exception with the original traceback%0A return self._handle_exception(%0A convert_exception_to(%0A werkzeug.exceptions.Forbidden)
)%0A%0A
|
775bca5465022e905a58859d72a970749973dba4 | Create main.py | msort/src/main.py | msort/src/main.py | Python | 0 | @@ -0,0 +1,497 @@
+def split(L:list) -%3E list:%0A%09ret = %5B%5D%0A%09for i in L:%0A%09%09ret.append(%5Bi%5D)%0A%09while len(ret) %3E 1:%0A%09%09ret%5B0%5D = merge(ret%5B0%5D, ret%5B1%5D)%0A%09%09del ret%5B1%5D%0A%09return ret%5B0%5D%0A%09%0Adef merge(L1:list, L2:list) -%3E list:%0A%09for i in L2:%0A%09%09for n, j in ... | |
ac8759778ba3bb9af64259685f4f9526b7a452e3 | add shortcuts for number localization | gittip/utils/i18n.py | gittip/utils/i18n.py | from __future__ import print_function, unicode_literals
import os
from aspen.utils import utcnow
from babel.dates import format_timedelta
import babel.messages.pofile
def to_age(dt, loc):
return format_timedelta(utcnow() - dt, add_direction=True, locale=loc)
def load_langs(localeDir):
langs = {}
for f... | Python | 0.000002 | @@ -162,16 +162,113 @@
.pofile%0A
+from babel.numbers import (%0A format_currency, format_decimal, format_number, format_percent%0A)%0A
%0A%0Adef to
@@ -1395,16 +1395,332 @@
else s%0A
+ request.context.format_number = lambda *a: format_number(*a, locale=loc)%0A request.context.format_decimal = lambda *a: f... |
915dd2ca82bd42ed58768cb1139ceaceada42c84 | add simple bmp station application | ryu/app/bmpstation.py | ryu/app/bmpstation.py | Python | 0 | @@ -0,0 +1,1246 @@
+import socket%0Aimport logging%0Alogging.basicConfig(level=logging.DEBUG)%0A%0Afrom ryu.base import app_manager%0A%0Afrom ryu.lib import hub%0Afrom ryu.lib.hub import StreamServer%0Afrom ryu.lib.packet.bmp import *%0A%0ASERVER_HOST = '0.0.0.0'%0ASERVER_PORT = 11019%0A%0A%0Aclass BMPStation(app_manag... | |
b077fb6e577e013cf95b57b1ea7d42febc3b03e7 | Add encoding module. | encoding.py | encoding.py | Python | 0 | @@ -0,0 +1,676 @@
+%22%22%22Script for encoding a payload into an image.%22%22%22%0A%0Afrom PIL import Image, ImageMath%0A%0Adef encode(host, payload):%0A # type: (PIL.Image, PIL.Image) -%3E PIL.Image%0A %22%22%22Encode a payload into an image.%22%22%22%0A output_rgb_channels = %5B%5D%0A for host_channel, p... | |
241a2820c90817be6dbabb6642b499cf1a224925 | Add limb drawing example | examples/gallery/plot_AIA_limb_STEREO.py | examples/gallery/plot_AIA_limb_STEREO.py | Python | 0 | @@ -0,0 +1,2698 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0A=================================%0ADrawing AIA Limb on STEREO Images%0A=================================%0A%0A%0AIn this example we use a STEREO-B and an SDO image to demonstrate how to%0Aoverplot the limb as seen by AIA on an EUVI-B image. This makes use of%0A... | |
38b416453c0e0b64d86270232879fb73b2f67d36 | Add async Api class | grapheneasync/api.py | grapheneasync/api.py | Python | 0.000001 | @@ -0,0 +1,2570 @@
+# -*- coding: utf-8 -*-%0Aimport asyncio%0Aimport logging%0Afrom grapheneapi.exceptions import NumRetriesReached%0A%0Afrom grapheneapi.api import Api as OriginalApi%0Afrom .websocket import Websocket%0Afrom .http import Http%0A%0Alog = logging.getLogger(__name__)%0A%0A%0Aclass Api(OriginalApi):%0A ... | |
0ad8d8665f064542346c3788cecaffdcb68f168a | Create tests for custom exceptions and warnings | plasmapy/utils/tests/test_exceptions.py | plasmapy/utils/tests/test_exceptions.py | Python | 0 | @@ -0,0 +1,1655 @@
+import pytest%0Aimport warnings%0A%0Afrom .. import (PlasmaPyError,%0A PhysicsError,%0A RelativityError,%0A AtomicError)%0A%0Afrom .. import (PlasmaPyWarning,%0A PhysicsWarning,%0A RelativityWarning,%0A AtomicW... | |
47bc22166213e50b4f5a2bc583752ff10babd188 | add scripts/check_dict.py | scripts/check_dict.py | scripts/check_dict.py | Python | 0.000001 | @@ -0,0 +1,787 @@
+#!/usr/bin/python%0A%0Aimport sys%0A%0Aif len(sys.argv) == 1:%0A print %22usage : %25s dict_file1 dict_file2 ...%22%0A exit(1)%0A%0Ad = %7B%7D%0A%0Afor fname in sys.argv%5B1:%5D:%0A with open(fname, %22r%22) as fin:%0A for i, line in enumerate(fin):%0A try:%0A ... | |
7a039a9c99e0a3fbd786de7794a798063b271b2f | Create parse_selected_language.py | parse_selected_language.py | parse_selected_language.py | Python | 0.000006 | @@ -0,0 +1,1819 @@
+#%0A# Main idea: to extract only a particular %22language%22 from text content containing words / characters from different language.%0A# Using regex, we search for characters within particular unicode ranges and exclude the rest.%0A#%0A%0Aimport re%0A%0Adef parse_only_text(string, setting):%0A '... | |
ad934a9abd973141434a12eb346a339d876b5baf | Add regression test for #693 | spacy/tests/regression/test_issue693.py | spacy/tests/regression/test_issue693.py | Python | 0.000002 | @@ -0,0 +1,609 @@
+# coding: utf8%0Afrom __future__ import unicode_literals%0A%0Aimport pytest%0A%0A%0A@pytest.mark.xfail%0A@pytest.mark.models%0Adef test_issue693(EN):%0A %22%22%22Test that doc.noun_chunks parses the complete sentence.%22%22%22%0A%0A text1 = %22the TopTown International Airport Board and the Goo... | |
6cd12f2aaa6170daef88a913ee78b725b6450d61 | Add check for 'not guilty beyond a reasonable doubt' | proselint/checks/garner/not_guilty.py | proselint/checks/garner/not_guilty.py | Python | 0.000001 | @@ -0,0 +1,1086 @@
+# -*- coding: utf-8 -*-%0A%22%22%22Not guilty beyond a reasonable doubt.%0A%0A---%0Alayout: post%0Asource: Garner's Modern American Usage%0Asource_url: http://bit.ly/1T4alrY%0Atitle: Not guilty beyond a reasonable doubt.%0Adate: 2016-03-09 15:50:31%0Acategories: writing%0A---%0A%0... | |
5127914f6842e77e9a1613b58ff28fae420b0da8 | Create chi_make_a_smoothie_bot.py | chi_make_a_smoothie_bot.py | chi_make_a_smoothie_bot.py | Python | 0.000025 | @@ -0,0 +1,1326 @@
+from asyncio import sleep%0D%0Aimport discord%0D%0Aimport subprocess%0D%0Aimport time%0D%0Afrom datetime import datetime%0D%0Aimport sys%0D%0Afrom pathlib import Path%0D%0A%0D%0Aclient = discord.Client()%0D%0Aclient.started = False%0D%0A%0D%0A@client.event%0D%0Aasync def on_ready():%0D%0A if client... | |
024280702c11d896195706b299767fdbd73d59f6 | add script | scripts/map_filter.py | scripts/map_filter.py | Python | 0.000001 | @@ -0,0 +1,1877 @@
+#!/usr/bin/env python%0A%0Aimport pysam%0Aimport argparse%0A%0A%0Adef avgmap(maptabix, chrom, start, end):%0A ''' return average mappability across chrom:start-end region; maptabix = pysam.Tabixfile'''%0A scores = %5B%5D%0A%0A if None in (start, end): return None%0A%0A if chrom in maptab... | |
3eb70001e175077b9f8e6a696f009ca2a2b76002 | Add python solution to 001 | 001/001.py | 001/001.py | Python | 0.999972 | @@ -0,0 +1,121 @@
+print sum(%5Ba * b for a, b in zip(map(lambda n: sum(filter(lambda x: not x %25 n, range(1000))), (3, 5, 15)), (1, 1, -1))%5D)%0A
| |
2c9760da48caaf9656c8b1e3f81e70671b7e7c5e | Add missing migration for audit app. | postgres/audit/migrations/0003_auditlog_app_session.py | postgres/audit/migrations/0003_auditlog_app_session.py | Python | 0 | @@ -0,0 +1,426 @@
+# -*- 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 ('audit', '0002_auditlog'),%0A %5D%0A%0A operations = %5B%0A migrations.AddField(%0A ... | |
9198b5f153fa21a6a1134cbb3499b767f7780fb1 | add the first version of enemy class | enemy.py | enemy.py | Python | 0 | @@ -0,0 +1,195 @@
+import entity%0A%0A%0Aclass Enemy(entity.Entity):%0A def __init__(self, health, damage):%0A super().__init__(health, damage)%0A%0A def __str__(self):%0A return %22enemy:%5Cn%22 + super().__str__()%0A
| |
d138b826d1c26853ad9ec2cb49c39c2a11617b84 | Add __init__.py to appease older python versions | wrangler/__init__.py | wrangler/__init__.py | Python | 0.000013 | @@ -0,0 +1 @@
+%0A
| |
b261a85300dfd6413bb436114b549b087aab211b | allow module execution (#184) | coveralls/__main__.py | coveralls/__main__.py | Python | 0 | @@ -0,0 +1,62 @@
+from .cli import main%0A%0A%0Aif __name__ == '__main__':%0A main()%0A
| |
a4be10de8f6b7ef59e73f6e5c81bb73a3d769145 | Create fetchseq.py | fetchseq.py | fetchseq.py | Python | 0 | @@ -0,0 +1,1250 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on Fri Jun 3 14:15:58 2016%0A%0A@author: Ahmed%0A%22%22%22%0A%0A%22%22%22Fetch sequences in fasta format for given antiCRISPR protein accession numbers. %0AAdapted from https://www.biostars.org/p/66921/ + acc2gb.py%0AUSAGE:%0Acat %3Cfile%3E %7C python f... | |
b90b57adae8a5a32c3c914c880d8900bd008e9f3 | Add fedjax/experimental/__init__.py | fedjax/experimental/__init__.py | fedjax/experimental/__init__.py | Python | 0.000008 | @@ -0,0 +1,1208 @@
+# Copyright 2021 Google LLC%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by ... | |
7ada16150f5a77bf9578de40a2bd8390c0ddea7e | Add minimal Info cog | dog/ext/info.py | dog/ext/info.py | Python | 0.000001 | @@ -0,0 +1,1489 @@
+%22%22%22%0AInformation extension.%0A%22%22%22%0A%0Aimport discord%0Afrom discord.ext import commands%0A%0Afrom dog import Cog%0Afrom dog.core import utils%0A%0Acm = lambda v: utils.commas(v)%0A%0ASERVER_INFO_MEMBERS = '''%7B%7D total member(s)%0A%7B%7D online, %7B%7D offline%0A%7B%7D%25 online'''%0... | |
9b0c3888912b6da4c4632da2623075c4eef9444d | Create fizzbuzz.py | fizzbuzz.py | fizzbuzz.py | Python | 0.000685 | @@ -0,0 +1,183 @@
+# Python: fizzbuzz.py%0A%0A%09import sys%0A%09for i in range(-50, 100):%0A%09if i%253==0:%0A%09%09sys.stdout.write('Fizz')%0A%09if i%255==0:%0A%09%09sys.stdout.write('Buzz')%0A%09if (i%255%3C%3E0 and i%253%3C%3E0):%0A%09%09print i,%0A%09print%0A
| |
a466a89cd18252c6d90fd3b590148ca3268ff637 | Add a couple of simple tests for LPD geometry | karabo_data/tests/test_lpd_geometry.py | karabo_data/tests/test_lpd_geometry.py | Python | 0 | @@ -0,0 +1,752 @@
+from matplotlib.figure import Figure%0Aimport numpy as np%0A%0Afrom karabo_data.geometry2 import LPD_1MGeometry%0A%0Adef test_inspect():%0A geom = LPD_1MGeometry.from_quad_positions(%5B%0A (11.4, 299),%0A (-11.5, 8),%0A (254.5, -16),%0A (278.5, 275)%0A %5D)%0A # S... | |
de7fdc1d14db4cef3a01dd954d4e7107a168639a | Fix in_contest | judge/views/contests.py | judge/views/contests.py | from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, Http404
from django.shortcuts import render_to_response
from django.template import RequestContext
from judge.comment... | Python | 0.000124 | @@ -1197,16 +1197,258 @@
t.path)%0A
+ if request.user.is_authenticated():%0A participation = request.user.profile.contest.current%0A in_contest = participation is not None and participation.contest == contest%0A else:%0A in_contest = False%0A
@@ -1483,32 +1483,3... |
efac5a6167e2ac437072084f0e48147ccccab793 | test read() on all examples | test/test_examples.py | test/test_examples.py | Python | 0 | @@ -0,0 +1,1237 @@
+import icy%0Aimport contextlib%0Aimport os%0Afrom datetime import datetime%0A%0Aclass DummyFile(object):%0A def write(self): pass%0A%0Aif __name__ == '__main__':%0A print('running examples tests ...')%0A t0 = datetime.now()%0A results = %5B0, 0, 0, 0%5D%0A for ex in sorted(icy.example... | |
defe99d80e102527140fb5742f4deedb6748f05e | add execute. | sc_spider/execute.py | sc_spider/execute.py | Python | 0.000001 | @@ -0,0 +1,46 @@
+from scrapy.cmdline import execute%0A%0Aexecute()%0A
| |
52fc9722c30b195c417e2fbf1ebbaad8180093c7 | fix merge | schedule/settings.py | schedule/settings.py | # Django settings for paquetin project.
import os
PROJECT_PATH = os.path.realpath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgr... | Python | 0.000001 | @@ -4566,29 +4566,16 @@
_nose',%0A
-%3C%3C%3C%3C%3C%3C%3C HEAD%0A
'dja
@@ -4593,68 +4593,8 @@
e',%0A
-=======%0A%3E%3E%3E%3E%3E%3E%3E adding back the file settings.py for travis%0A
@@ -6392,21 +6392,8 @@
r'%0A%0A
-%3C%3C%3C%3C%3C%3C%3C HEAD%0A
# Te
@@ -6523,64 +6523,4 @@
,%0A%5D%0A
-=======%0A%3E%3E%3E%... |
80f35ad0d3a6a1f04eb0339bb1088ebe6eb27af5 | Add result classes for update/insert/delete ops | mongomock/results.py | mongomock/results.py | Python | 0 | @@ -0,0 +1,2316 @@
+try:%0A from pymongo.results import InsertOneResult%0A from pymongo.results import InsertManyResult%0A from pymongo.results import UpdateResult%0A from pymongo.results import DeleteResult%0Aexcept ImportError:%0A class _WriteResult(object):%0A%0A def __init__(self, acknowledged... | |
35b5ef2d39363e893796a8384209034093d8a11e | add import script for Burnley | polling_stations/apps/data_collection/management/commands/import_burnley.py | polling_stations/apps/data_collection/management/commands/import_burnley.py | Python | 0 | @@ -0,0 +1,454 @@
+from data_collection.management.commands import BaseXpressWebLookupCsvImporter%0A%0Aclass Command(BaseXpressWebLookupCsvImporter):%0A council_id = 'E07000117'%0A # note: extension is TSV, but file is actually comma seperated%0A addresses_name = 'BurnleyPropertyPostCodePollingStationWeb... | |
6fce34ca55d4dfaee921480077b48e0984d8fe1c | Create max_of_three.py | 09-revisao/practice_python/max_of_three.py | 09-revisao/practice_python/max_of_three.py | Python | 0.000333 | @@ -0,0 +1,1125 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%22%22%22Exercise 28: Max Of Three%0A%0AImplement a function that takes as input three variables, and returns%0Athe largest of the three. Do this without using the Python max()%0Afunction!%0A%0AThe goal of this exercise is to think about some intern... | |
54940c2532d90e23b919031e948e4c7b608b1866 | add import script for Wycombe | polling_stations/apps/data_collection/management/commands/import_wycombe.py | polling_stations/apps/data_collection/management/commands/import_wycombe.py | Python | 0 | @@ -0,0 +1,1573 @@
+from django.contrib.gis.geos import Point%0Afrom data_collection.management.commands import BaseCsvStationsShpDistrictsImporter%0Afrom data_finder.helpers import geocode_point_only, PostcodeError%0A%0Aclass Command(BaseCsvStationsShpDistrictsImporter):%0A srid = 27700%0A council_id = 'E0700000... | |
0c5c2dd033a4d586e24fc76a7f5398db52470ac6 | Add python wrapper | python/camera.py | python/camera.py | Python | 0.000065 | @@ -0,0 +1,2543 @@
+%22%22%22%0AA simple python wrapper around escapi%0A%0AUsage:%0A%0Afrom camera import Device%0A%0Adevice = Deveice.connect(0, 500, 500)%0Aimage = device.get_image()%0A%22%22%22%0A%0Aimport os%0Afrom ctypes import *%0Afrom PIL import Image%0A%0Adef resolve(name):%0A f = os.path.join(os.path.dirnam... | |
a877ba0845ea868a79d89965c419ec637bc85ff1 | add python | python/python.py | python/python.py | Python | 0.998891 | @@ -0,0 +1,192 @@
+from collections import namedtuple%0D%0APoint = namedtuple('Point',%5B'x','y'%5D)%0D%0A%0D%0Aif __name__ == %22__main__%22:%0D%0A%09main()%0D%0A%0D%0A%0D%0Aimport heapq%0D%0Aheap = %5B%5D%0D%0Aheapq.heapify(heap)%0D%0Aheapq.heappush(heap,(1,2))%0D%0A
| |
5ba42c79d777b8afad82a6dc120afc366643e9b8 | Create test.py | test.py | test.py | Python | 0.000005 | @@ -0,0 +1,220 @@
+import spacy%0Anlp = spacy.load('en')%0Adoc5 = nlp(u%22Timothy Spann is studying at Princeton University in New Jersey.%22)%0A# Named Entity Recognizer (NER)%0Afor ent in doc5.ents:%0A print ent, ent.label, ent.label_%0A %0A
| |
e5f22aaf4de371df0b52a275dbebbd4cd6c1d980 | add test file | test.py | test.py | Python | 0.000001 | @@ -0,0 +1,127 @@
+import os%0Aimport logging%0Aimport redis%0Aimport gevent%0Afrom flask import Flask, render_template%0Afrom flask_sockets import Sockets%0A
| |
50c3e9ffeacf7db5c002186e178ca24a6c14bf22 | Add py-watchdog (#19167) | var/spack/repos/builtin/packages/py-watchdog/package.py | var/spack/repos/builtin/packages/py-watchdog/package.py | Python | 0.000004 | @@ -0,0 +1,1600 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass PyWatchdog(PythonPackage):%0A %22%22%22Python library a... | |
c151f843964408481a5f6569718537a786ff5722 | range excluding script, still lacks some error checking | range-exclude.py | range-exclude.py | Python | 0 | @@ -0,0 +1,691 @@
+#! /usr/bin/env python3.4%0A%0Aimport ipaddress%0Aimport math%0Asupernet = False%0Asubnet = False%0A%0Awhile not supernet:%0A%0A%09inputRange = input('Input the IP range you would like remove a subrange from: ')%0A%09try:%0A%09%09supernet =ipaddress.ip_network(inputRange)%0A%09except ValueError:%0A%0... | |
ca314c93df2b643e3cb66dbcb9343b05ea4bf8d2 | fix indentation | Algorithm.Python/MultipleSymbolConsolidationAlgorithm.py | Algorithm.Python/MultipleSymbolConsolidationAlgorithm.py | # QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Licen... | Python | 0.000358 | @@ -4685,20 +4685,16 @@
i = 0%0A
-
for
@@ -4729,36 +4729,32 @@
eys()):%0A
-
symbolData = sel
@@ -4760,36 +4760,32 @@
lf.Data%5Bsymbol%5D%0A
-
# we hav
@@ -4853,23 +4853,15 @@
-
i += 1%0A
-
@@ -4902,20 +4902,16 @@
2 == 0:%0A
-
|
e639cea1f5264870e3f5f19fbd88345a23ef61a9 | add timestamps to debug logging | lib/misc.py | lib/misc.py | import time
import re
import sys, os
sentinel_options = []
def is_numeric(strin):
import decimal
# Decimal allows spaces in input, but we don't
if strin.strip() != strin:
return False
try:
value = decimal.Decimal(strin)
except decimal.InvalidOperation as e:
return False
... | Python | 0.000002 | @@ -348,16 +348,117 @@
g(str):%0A
+ ts = time.strftime('%25Y-%25m-%25d %25H:%25M:%25S', time.gmtime(now()))%0A logstr = %22%7B%7D %7B%7D%22.format(ts, str)%0A
if o
@@ -510,16 +510,19 @@
print(
+log
str)%0A%0Ade
|
9d44e4eb4c8d2c2f10152894f7c53d9feaae528c | Add ip-restriction plugin to declare ip whitelists/blacklists and restrict api access | api_bouncer/middlewares/ip_restriction.py | api_bouncer/middlewares/ip_restriction.py | Python | 0 | @@ -0,0 +1,1757 @@
+import ipaddress%0A%0Afrom django.http import JsonResponse%0A%0Afrom ..models import Plugin%0A%0A%0Adef get_client_ip(request):%0A x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')%0A if x_forwarded_for:%0A ip = x_forwarded_for.split(',')%5B0%5D%0A else:%0A ip = reque... | |
db692a253a606923096a2a12359bad5302e53e55 | Create test.py | test.py | test.py | Python | 0.000005 | @@ -0,0 +1,16 @@
+print %22test.py%22%0A
| |
7e61bf47982784af8e162a804620779f9d6c9fbd | 1832. Check if the Sentence Is Pangram | LeetCode/CheckIfTheSentenceIsPangram.py | LeetCode/CheckIfTheSentenceIsPangram.py | Python | 1 | @@ -0,0 +1,188 @@
+# simple solution under assumption sentence only has lowercase English letters%0Aclass Solution:%0A def checkIfPangram(self, sentence: str) -%3E bool:%0A return len(set(sentence)) == 26%0A
| |
9f8e7ff3220c81e22fde17a85989653b45602f28 | Create 6kyu_n-centered_array.py | Solutions/6kyu/6kyu_n-centered_array.py | Solutions/6kyu/6kyu_n-centered_array.py | Python | 0.000746 | @@ -0,0 +1,129 @@
+from math import ceil%0A%0Adef is_centered(arr,n):%0A return any(sum(arr%5Bi:-i%5D)==n for i in range(ceil(len(arr)/2))) or sum(arr)==n%0A
| |
bf0be80bdc2ec691fb0f0ac1bcfe3337f070c199 | Add some tests | spreadflow_core/test/test_jobqueue.py | spreadflow_core/test/test_jobqueue.py | Python | 0 | @@ -0,0 +1,3267 @@
+# -*- coding: utf-8 -*-%0A%22%22%22Tests for cooperative job queue.%0A%22%22%22%0Afrom __future__ import absolute_import%0Afrom __future__ import division%0Afrom __future__ import unicode_literals%0A%0Afrom twisted.internet import defer%0Afrom twisted.trial import unittest%0A%0Afrom spreadflow_core.... | |
7d9aed1bed273b1b83f22436e5c24cde3cc93586 | add an rnn model | CharRNN.py | CharRNN.py | Python | 0 | @@ -0,0 +1,1602 @@
+import numpy as np%0Afrom chainer import Variable, FunctionSet%0Aimport chainer.functions as F%0A%0Aclass CharRNN(FunctionSet):%0A%0A def __init__(self, n_vocab, n_units):%0A super(CharRNN, self).__init__(%0A embed = F.EmbedID(n_vocab, n_units),%0A l1_x = F.Linear(n_u... | |
31cc4f9c90ce231c3cb75318db31a711b325947a | add pixiv downloader. | bin/pixiv_dl.py | bin/pixiv_dl.py | Python | 0 | @@ -0,0 +1,2863 @@
+# coding: utf-8%0Aimport os%0Aimport logging%0Afrom netrc import netrc%0Afrom random import random%0Afrom time import sleep%0Aimport pixivpy3%0Alogging.basicConfig(level=logging.DEBUG)%0ALOG = logging.getLogger(__name__)%0ASIZES = %7B'large', 'original'%7D%0ADIRNAME = os.path.expanduser(os.path.join... | |
bd68dd06ba24806d1c216d3fc818d5597dc469d2 | add leetcode Merge Two Sorted Lists | leetcode/MergeTwoSortedLists/solution.py | leetcode/MergeTwoSortedLists/solution.py | Python | 0 | @@ -0,0 +1,861 @@
+# -*- coding:utf-8 -*-%0A# Definition for singly-linked list.%0A# class ListNode:%0A# def __init__(self, x):%0A# self.val = x%0A# self.next = None%0A%0A%0Aclass Solution:%0A # @param two ListNodes%0A # @return a ListNode%0A%0A def mergeTwoLists(self, l1, l2):%0A if... | |
8f82c38886ee085564c59b8e8fdc81f5f4899c0b | new function that prints hello | new_feature1_file.py | new_feature1_file.py | Python | 0.999912 | @@ -0,0 +1,37 @@
+def print_hello():%0A print(%22hello%22)
| |
94d8adf9d48c6118a3467947ad8b1ae0b6dd3d63 | Fix - add missed migrations | blog/migrations/0006_auto_20160513_1634.py | blog/migrations/0006_auto_20160513_1634.py | Python | 0 | @@ -0,0 +1,1714 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.5 on 2016-05-13 13:34%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('blog', '0005_auto_20160422_1256'),%0A %5D%0A%0A ... | |
17c9cd8fcd597f5ecef00ee6cf494d3b3dc77e6b | add nonlinear fv advection operator | src/pymor/operators/fv.py | src/pymor/operators/fv.py | Python | 0.000019 | @@ -0,0 +1,2600 @@
+# -*- coding: utf-8 -*-%0A# This file is part of the pyMor project (http://www.pymor.org).%0A# Copyright Holders: Felix Albrecht, Rene Milk, Stephan Rave%0A# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)%0A%0Afrom __future__ import absolute_import, division, print_funct... | |
a9c0b9f026ac10ca058afc2f7ad311e7431407f8 | add modules to follow | src/pymyinstall/packaged/packaged_config_C_tofollow.py | src/pymyinstall/packaged/packaged_config_C_tofollow.py | Python | 0 | @@ -0,0 +1,1555 @@
+#-*- coding: utf-8 -*-%0A%22%22%22%0A@file%0A@brief Defines a set of modules to try%0A%22%22%22%0Aimport sys%0Afrom ..installhelper.module_install import ModuleInstall%0A%0A%0Adef follow_set():%0A %22%22%22%0A modules to follow%0A %22%22%22%0A mod = %5B%0A ModuleInstall(%0A ... | |
5f731df6478843e9d74f6b26feed67f93b63a429 | hello world | publication-erdf/flask_service.py | publication-erdf/flask_service.py | Python | 0.999981 | @@ -0,0 +1,234 @@
+#!/usr/bin/env python3%0A%0Afrom flask import Flask%0Aapp = Flask(__name__)%0A%0A%0AURI_ROOT = '/publication-erdf'%0A%0A%0A@app.route(URI_ROOT + '/process-email')%0Adef process_email():%0A return %22Hello World!%22%0A%0Aif __name__ == %22__main__%22:%0A app.run()%0A
| |
1bb393531771f877e9d4e9c2a0b99446f8873fc9 | Create gatherThreatIntel_ISC_IPs.py | gatherThreatIntel_ISC_IPs.py | gatherThreatIntel_ISC_IPs.py | Python | 0.000002 | @@ -0,0 +1,1610 @@
+#!/bin/python%0A# Inspired by: https://bitbucket.org/whyJoseph/spse-whyjoseph/src/a9cb102ae93826cd7155ff77c2c4a24f584ff0a3/SANSTopXIP.py%0Afrom optparse import OptionParser%0Aimport logging%0Aimport urllib%0Aimport re%0Aimport sys%0A# Uses BeautifulSoup4%0Afrom bs4 import BeautifulSoup%0A%0A%0Adef t... | |
75ce58aa8073e29fcc54d45b8f3dec24cacd05a4 | Add missed needs_update attribute, which is referenced from the RTPproxy client code. | sippy/SdpMediaDescription.py | sippy/SdpMediaDescription.py |
from SdpConnecton import SdpConnecton
from SdpMedia import SdpMedia
from SdpGeneric import SdpGeneric
f_types = {'m':SdpMedia, 'i':SdpGeneric, 'c':SdpConnecton, 'b':SdpGeneric, \
'k':SdpGeneric}
class SdpMediaDescription(object):
m_header = None
i_header = None
c_header = None
b_header = None
k... | Python | 0 | @@ -392,16 +392,40 @@
b', 'k')
+%0A needs_update = True
%0A%0A de
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.