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 |
|---|---|---|---|---|---|---|---|
a3b2b50209908fba83997bdc6d75dde222636489 | Add test for double close | tests/test_sa_connection.py | tests/test_sa_connection.py | import asyncio
from aiopg import connect, sa, Cursor
import unittest
import sqlalchemy
from sqlalchemy import MetaData, Table, Column, Integer, String, Sequence
meta = MetaData()
tbl = Table('sa_tbl', meta,
#FetchedValue()
Column('id', Integer, Sequence('sa_tbl_id_seq'), nullable=False,
... | Python | 0 | @@ -4781,28 +4781,462 @@
op.run_until_complete(go())%0A
+%0A def test_double_close(self):%0A @asyncio.coroutine%0A def go():%0A conn = yield from self.connect()%0A res = yield from conn.execute(%22SELECT 1%22)%0A res.close()%0A self.assertTrue(res.closed)%0A... |
70ad81a24e218fd2b5fed03224611eae63e0d58f | add main argument processing file | boxes/argsParse.py | boxes/argsParse.py | Python | 0 | @@ -0,0 +1,18 @@
+import argparse%0A%0A%0A
| |
a633cc0b4ee376ff02af101154e60b8b33dfda08 | add migration for old logs | scripts/migrate_preprint_logs.py | scripts/migrate_preprint_logs.py | Python | 0 | @@ -0,0 +1,1754 @@
+import sys%0Aimport logging%0Afrom datetime import datetime%0A%0Afrom modularodm import Q%0Afrom modularodm.exceptions import NoResultsFound%0A%0Afrom website.app import init_app%0Afrom website.models import NodeLog, PreprintService%0A%0Alogger = logging.getLogger(__name__)%0A%0A%0Adef main(dry):%0A... | |
caf2d7108d7329da562a012775bac0a87d4c62b6 | Create db_create.py | fade/db_create.py | fade/db_create.py | Python | 0.000011 | @@ -0,0 +1,587 @@
+#!flask/bin/python%0A%22%22%22%0A See LICENSE.txt file for copyright and license details.%0A%22%22%22%0Afrom migrate.versioning import api%0Afrom config import SQLALCHEMY_DATABASE_URI%0Afrom config import SQLALCHEMY_MIGRATE_REPO%0Afrom app import db%0Aimport os.path%0A%0A%0Adb.create_all()%0Aif no... | |
f6f75172b1b8a41fc5ae025416ea665258d4ff4c | Add script for updating favicon from gh avatar | favicon-update.py | favicon-update.py | Python | 0 | @@ -0,0 +1,787 @@
+from PIL import Image%0Aimport requests%0Afrom io import BytesIO%0A%0A# This whole script was done using Google and StackOverflow%0A# How to generate ico files%0A# https://stackoverflow.com/a/36168447/1697953%0A# How to get GitHub avatar location from username%0A# https://stackoverflow.com/a/36380674... | |
75031595de8726dcd21535b13385c4e6c89aa190 | Add run meter task | datastore/tasks.py | datastore/tasks.py | Python | 0.999872 | @@ -0,0 +1,225 @@
+from __future__ import absolute_import%0A%0Afrom celery import shared_task%0A%0Afrom datastore.models import Project%0A%0A%0A@shared_task%0Adef run_meter(project_pk):%0A project = Project.objects.get(pk=project_pk):%0A project.run_meter()%0A
| |
27c5a09ddbe2ddf14b2f4c84ebb668adbdfd7070 | ADD example.basicserver for test | example/basicserver.py | example/basicserver.py | Python | 0 | @@ -0,0 +1,265 @@
+%0A%0Afrom wood import Wood%0A%0Aw = Wood(__name__,debug=True)%0A%0AIndexHandler = w.empty(uri='/',name='IndexHandler')%0A%0A@IndexHandler.get%0Adef index_page(self):%0A self.write('%E6%BB%91%E7%A8%BD%EF%BC%8C%E8%BF%99%E9%87%8C%E4%BB%80%E4%B9%88%E9%83%BD%E6%B2%A1%E6%9C%89%5Cn(HuajiEnv)')%0A%0Aif _... | |
8049e2f0bb0a12bb301ab4390c3e4da3d90f0369 | Move stagingsettings to new 'cosmos' project tree | cosmos/platform/frontend/src/bdp_fe/conf/stagingsettings.py | cosmos/platform/frontend/src/bdp_fe/conf/stagingsettings.py | Python | 0 | @@ -0,0 +1,1663 @@
+%22%22%22%0AModule testsettings%0A%0AThese settings allow Django unittests to setup a temporary databse and run the%0Atests of the installed applications.%0A%0A%22%22%22%0A%0ADEBUG = True%0ATEMPLATE_DEBUG = DEBUG%0A%0Afrom bdp_fe.conf.base_settings import *%0A%0ADATABASES = %7B%0A 'default': %7B%... | |
70d912bfb1ccec03edfe92b9b2c87610346c8f42 | Add blocking migration for new domain db | corehq/doctypemigrations/migrations/0006_domain_migration_20151118.py | corehq/doctypemigrations/migrations/0006_domain_migration_20151118.py | Python | 0 | @@ -0,0 +1,476 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0Afrom corehq.doctypemigrations.djangomigrations import assert_initial_complete%0Afrom corehq.doctypemigrations.migrator_instances import domains_migration%0A%0A%0Aclass Migration(migrations.Migrat... | |
0378f8cde69a18d954341b861a724592ef7a5949 | Extend RANSAC example with comparison to BaggingRegressor | examples/linear_model/plot_ransac.py | examples/linear_model/plot_ransac.py | """
===========================================
Robust linear model estimation using RANSAC
===========================================
In this example we see how to robustly fit a linear model to faulty data using
the RANSAC algorithm.
"""
import numpy as np
from matplotlib import pyplot as plt
from sklearn import ... | Python | 0 | @@ -325,16 +325,26 @@
ar_model
+, ensemble
%0A%0A%0A# Set
@@ -1043,21 +1043,21 @@
%0Amodel_r
-obust
+ansac
= linea
@@ -1111,21 +1111,21 @@
%0Amodel_r
-obust
+ansac
.fit(X,
@@ -1148,21 +1148,21 @@
model_r
-obust
+ansac
.inlier_
@@ -1211,16 +1211,171 @@
_mask)%0A%0A
+# Robustly fit linear model with bagged li... |
d0e5ea752912b10e473b2a05da9196800eb6ca86 | Add an example for the RedisLock | examples/redis_lock.py | examples/redis_lock.py | Python | 0.000003 | @@ -0,0 +1,1219 @@
+import random%0A%0Afrom diesel import fork, quickstop, quickstart, sleep%0Afrom diesel.protocols.redis import RedisClient, RedisTransactionError, RedisLock, LockNotAcquired%0A%0A%0A%22%22%22Implement the Redis INCR command using a lock. Obviously this is inefficient, but it's a good%0Aexample of how... | |
1d77849b048c424ebc042a61c047c2c74e27277f | minus 1 | leetcode_python/zigzag_conversion.py | leetcode_python/zigzag_conversion.py | Python | 0.999994 | @@ -0,0 +1,486 @@
+class Solution:%0D%0A # @return a string%0D%0A def convert(self, s, nRows):%0D%0A if nRows == 1:%0D%0A return s%0D%0A result = %5B%5B%5D for i in range(nRows)%5D%0D%0A for i, c in enumerate(s):%0D%0A if (i / (nRows - 1)) %25 2 == 0:%0D%0A ... | |
d0b8c68ae3c8acbc3d5dfe13842e3c41a198b978 | Add script to fix all notions | fix_notions_db.py | fix_notions_db.py | Python | 0.000001 | @@ -0,0 +1,176 @@
+from alignements_backend.db import DB%0Afrom alignements_backend.notion import Notion%0A%0Afor notion in DB.scan_iter(match='notion:*'):%0A n = Notion(list(DB.sscan_iter(notion)))%0A%0A
| |
ad6e0bad22b0c5b0e6f97ceb13694ab804041443 | Add model resources. | tracker/api.py | tracker/api.py | Python | 0 | @@ -0,0 +1,713 @@
+from tastypie.resources import ModelResource%0Afrom tracker.models import Task, WorkSession%0Afrom django.contrib.auth.models import User%0Afrom tastypie import fields%0A%0A%0Aclass UserResource(ModelResource):%0A class Meta:%0A queryset = User.objects.all()%0A resource_name = 'user'... | |
c97680113fb25ed43e96c26d02bfd57e15e427b8 | Add missing migrations | nodeconductor/billing/migrations/0004_invoice_usage_pdf.py | nodeconductor/billing/migrations/0004_invoice_usage_pdf.py | Python | 0 | @@ -0,0 +1,472 @@
+# -*- 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 ('billing', '0003_invoice_status'),%0A %5D%0A%0A operations = %5B%0A migrations.AddField(%0... | |
3d19606b83f6a4a7906f88b15c6e215620394560 | Implemented the Ford-Fulkerson algorithm | ford_fulkerson.py | ford_fulkerson.py | Python | 0.998064 | @@ -0,0 +1,1548 @@
+#!/usr/bin/env python%0A#coding: UTF-8%0A#%0A# Implementation of the Ford-Fulkerson algorithm to solve the maximum flow problem.%0A#%0A# Copyright (c) 2013 Samuel Gro%C3%9F%0A#%0A%0Afrom graph import *%0Afrom basics import depth_first_search%0A%0A%0Adef solve_max_flow_ff(graph, s, t):%0A %22%22%2... | |
321463a5d7f102431ed286d57d1a8fa8c576cca7 | add plotting fns | terrapin/plot.py | terrapin/plot.py | Python | 0.000001 | @@ -0,0 +1,67 @@
+import matplotlib.pyplot as plt%0A%0A%0Adef flow_grid(dem, angles):%0A%09pass
| |
8827eb9dbab6ca325843da4ec8da2aaa5af87bce | Revert D6097465: Move .buckd/tmp/ to buck-out/tmp/buckd/. | programs/buck_project.py | programs/buck_project.py | from __future__ import print_function
import errno
import os
import tempfile
import textwrap
import shutil
import sys
import file_locks
from tracing import Tracing
import hashlib
def get_file_contents_if_exists(path, default=None):
with Tracing('BuckProject.get_file_contents_if_it_exists', args={'path': path}):
... | Python | 0.000026 | @@ -1300,38 +1300,32 @@
k-out%22)%0A
-self._
buck_out_tmp = o
@@ -1368,38 +1368,32 @@
makedirs(
-self._
buck_out_tmp)%0A
@@ -1556,22 +1556,16 @@
.%22, dir=
-self._
buck_out
@@ -3111,41 +3111,8 @@
dir%0A
- makedirs(self.buckd_dir)%0A
@@ -3154,29 +3154,23 @@
elf.
-_
buck
-_out_tmp, ... |
ed23fb301503d331af243a37d1b0a934d5d2f21c | add laser plugin object | mythril/laser/ethereum/plugins/plugin.py | mythril/laser/ethereum/plugins/plugin.py | Python | 0 | @@ -0,0 +1,910 @@
+from mythril.laser.ethereum.svm import LaserEVM%0A%0A%0Aclass LaserPlugin:%0A %22%22%22 Base class for laser plugins%0A%0A Functionality in laser that the symbolic execution process does not need to depend on%0A can be implemented in the form of a laser plugin.%0A%0A Laser plugins impleme... | |
550469032843eb2af3b4a9faaed34d9754f00700 | Add command to test managers emails | geotrek/common/management/commands/test_managers_emails.py | geotrek/common/management/commands/test_managers_emails.py | Python | 0.000002 | @@ -0,0 +1,426 @@
+from django.core.mail import mail_managers%0Afrom django.core.management.base import BaseCommand%0A%0A%0Aclass Command(BaseCommand):%0A help = %22Test if email settings are OK by sending mail to site managers%22%0A%0A def execute(self, *args, **options):%0A%0A subject = u'Test email for ... | |
edb9500824faffd9f1d0d1b59ca29966e3b18282 | Customize behave formatter to output json | modules/formatter_record.py | modules/formatter_record.py | Python | 0.000001 | @@ -0,0 +1,3401 @@
+from behave.formatter.json import PrettyJSONFormatter%0Afrom pprint import pprint%0A%0Aclass RecordFormatter(PrettyJSONFormatter):%0A name = %22super%22%0A description = %22Formatter for adding REST calls to JSON output.%22%0A jsteps = %7B%7D # Contains an array of features, that contains a... | |
def7e3aeaf3b0cd1a6486c72c68a3baad77ef3e5 | Create leetcode-50.py | python_practice/leetCode/leetcode-50.py | python_practice/leetCode/leetcode-50.py | Python | 0.000004 | @@ -0,0 +1,295 @@
+class Solution:%0A def myPow(self, x: 'float', n: 'int') -%3E 'float':%0A return x**n%0A%0A def myPow2(self, x: 'float', n: 'int') -%3E 'float':%0A if n == 0:%0A return 1%0A if n %3C 0:%0A n = 0-n%0A x = 1/x%0A %0A return x**(n... | |
71e431a5eccc6483847888fb0f8f5f30f182913a | add a script to convert xml documentation into json | doc/xmldoc2json.py | doc/xmldoc2json.py | Python | 0.000003 | @@ -0,0 +1,2475 @@
+#!/usr/bin/python%0Aimport sys%0Aimport xml.etree.ElementTree as ET%0Aimport json%0A%0Adef parseClass(data):%0A dictCls = dict(data.attrib)%0A dictCls%5B'brief_description'%5D = data.find(%22brief_description%22).text.strip()%0A dictCls%5B'description'%5D = data.find(%22description%22).text... | |
4ca8d43d8e6ec243d9812bb313a8e7a21ad781ea | Add DB exercise. | Exercise/DB.py | Exercise/DB.py | Python | 0 | @@ -0,0 +1,488 @@
+import mysql.connector%0A%0Aconn = mysql.connector.connect(user='root', password='blue', database='test')%0Acursor = conn.cursor()%0A%0Acursor.execute('create table user (id varchar(20) primary key, name varchar(20))')%0Acursor.execute('insert into user (id, name) values (%25s, %25s)', %5B'1', 'Dai'%... | |
c4e1e034a3f0be3590dc78c5683d9deaf44d696f | add example of escape character | scripts/escape/backslash.py | scripts/escape/backslash.py | Python | 0.000001 | @@ -0,0 +1,517 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0Aimport json%0A%0A'''%0AThis tests the acceptance of backslashes%0A%5C%5Cf should be okay%0A%5Cf is not necessarily okay, because json.dumps will not dump this%0A'''%0A%0Aprint json.dumps(%7B%0A %22foogroup%22: %7B%0A %22hosts%22: %5B%0A ... | |
bfbd2c792aacd307f8d7ed68ea0f2a7db681431d | add functions that generate mask image of the target bin | jsk_apc2016_common/python/jsk_apc2016_common/mask_bin.py | jsk_apc2016_common/python/jsk_apc2016_common/mask_bin.py | Python | 0.000003 | @@ -0,0 +1,2023 @@
+#!/usr/bin/env python%0A%0Aimport numpy as np%0Afrom matplotlib.path import Path%0Aimport jsk_apc2016_common.segmentation_helper as helper%0Afrom tf2_geometry_msgs import do_transform_point%0A%0A%0Adef get_mask_img(transform, target_bin, camera_model):%0A %22%22%22%0A :param point: point that ... | |
852c6639bb0a71b9ef2dd81b2830193d0c9fe23d | Create FractalPoke.py | FractalPoke.py | FractalPoke.py | Python | 0.000001 | @@ -0,0 +1,2356 @@
+bl_info = %7B%0A %22name%22: %22FractalPoke%22,%0A %22author%22: %22Christopher Kopic%22,%0A %22version%22: (1, 0),%0A %22blender%22: (2, 7, 8),%0A %22location%22: %22%22,%0A %22description%22: %22Iterative Poking inspired by Simon Holmedal's Always Forever%22,%0A %22warning%22: %22%22,%0A %22wiki_u... | |
2dff378e7f446e83aa7c105bded3f3330fe9fa20 | Add a script to generate a Javascript file encoding_<enc>.js containing encoding and decoding tables for the specified <enc> encoding. Uses Unicode table at location http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/<enc>.TXT. Related to issue #1541. | scripts/make_encoding_js.py | scripts/make_encoding_js.py | Python | 0 | @@ -0,0 +1,1275 @@
+%22%22%22Create a Javascript script to encode / decode for a specific encoding%0Adescribed in a file available at%0Ahttp://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/%3CENCODING%3E.TXT%0A%22%22%22%0A%0Aimport os%0Aimport re%0Aimport json%0Aimport urllib.request%0A%0Aline_re = re.compile(%22%... | |
a7a0d17fdf67f2176d19e857bade1e406c39bebb | Update `Inventory` creation such that if a host is defined multiple times, it will receive combined data. | pyinfra/api/inventory.py | pyinfra/api/inventory.py | # pyinfra
# File: pyinfra/api/inventory.py
# Desc: represents a pyinfra inventory
from .host import Host
from .attrs import AttrData
class Inventory(object):
'''
Represents a collection of target hosts. Stores and provides access to group data,
host data and default data for these hosts.
Args:
... | Python | 0 | @@ -1762,79 +1762,75 @@
ild
-the actual Host instances%0A hosts = %7B%7D%0A for name in names:
+host data%0A for name in names:%0A # Extract any data
%0A
@@ -1949,50 +1949,494 @@
-self.host_data%5Bname%5D = AttrData(host_data)
+# Ensure host has data dict%0A self.h... |
f1c65cf208b4a6275214d82a765ad75c47c75715 | add example of how to use KT without defines | examples/cuda-c++/vector_add_defines.py | examples/cuda-c++/vector_add_defines.py | Python | 0 | @@ -0,0 +1,932 @@
+#!/usr/bin/env python%0A%22%22%22 This is the example demonstrates how to use Kernel Tuner%0A to insert tunable parameters into template arguments%0A without using any C preprocessor defines%0A%22%22%22%0A%0Aimport numpy as np%0Aimport kernel_tuner as kt%0A%0Adef tune():%0A%0A kernel_string ... | |
00cc1f17796897ca2f4351bbea74ee22aad98f14 | Create quadrants_HH_HL_LH_LL.py | quadrants_HH_HL_LH_LL.py | quadrants_HH_HL_LH_LL.py | Python | 0.999018 | @@ -0,0 +1,2231 @@
+# python3 for categorizing data into 4 quadrants from 2 numerical fields%0A%0A# this case is for vis minoirty + avg income in Toronto census tracts%0A%0Aimport csv%0Aimport statistics as st%0A%0A%0A# just the toronto cts%0Ator_cts = %5B%5D%0Awith open('ct_tor.csv', 'r') as csvfile:%0A reader = cs... | |
9dae55d2ef2e786799554ec2121cf9ecfe59eb62 | Rename file | dnsdiff/dnsdiff.py | dnsdiff/dnsdiff.py | Python | 0.000002 | @@ -0,0 +1,870 @@
+'''Module to quickly look up and compare NS records for differences'''%0A%0Aimport dns.resolver%0Aimport pprint%0Aimport sys%0A%0App = pprint.PrettyPrinter(indent=4)%0A%0Adef compare_dns(nameservers, domain):%0A%09'''Compares records between nameservers using dnspython'''%0A%0A%09responses = %7B%7D%0... | |
bef5333edf60779f645603b3d4c7611867ad7382 | Day25 and final day! yaaaay | day25/code_generator.py | day25/code_generator.py | Python | 0.999998 | @@ -0,0 +1,292 @@
+row = 2978%0Acolumn = 3083%0A%0Ax = 1%0Ay = 1%0A%0Avalue = 20151125%0Astep = 1%0A%0Awhile x %3C= column or y %3C= row:%0A%09if x == step and y == 1:%0A%09%09step += 1%0A%09%09y = step%0A%09%09x = 1%0A%09else:%0A%09%09x += 1%0A%09%09y -= 1%0A%09value = (value * 252533) %25 33554393%0A%0A%09if x == col... | |
be189d9d01f916af87b45f36ac36f7c5d302dbbf | add an experimental command for setting the login background image | kolibri/content/management/commands/background.py | kolibri/content/management/commands/background.py | Python | 0 | @@ -0,0 +1,2125 @@
+from __future__ import absolute_import%0Afrom __future__ import print_function%0Afrom __future__ import unicode_literals%0A%0Aimport logging%0Aimport os%0Aimport shutil%0A%0Afrom django.conf import settings%0Afrom django.core.management.base import BaseCommand%0A%0Alogger = logging.getLogger(__name_... | |
1f48fee7ffcef3eefa6aaedb5ca963c10bb7c58c | Add test case for user creation form | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/test_forms.py | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/test_forms.py | Python | 0.000001 | @@ -0,0 +1,881 @@
+from django.test import TestCase%0A%0Afrom users.forms import ZionsUserCreationForm%0Afrom users.models import User%0A%0A%0Aclass %7B%7Bcookiecutter.project_camel_name%7D%7DUserCreationTestCase(TestCase):%0A def setUp(self):%0A self.test_user = User.objects.create(%0A username='t... | |
616bb27db3daef8939fe706d1c41cf79f35b40fa | set of default rules in common module | common.py | common.py | Python | 0 | @@ -0,0 +1,553 @@
+#/usr/bin/python%0A# -*- coding: utf-8 -*-%0A%0A# Copyright (c) 2012 Denis Zalevskiy%0A# Licensed under MIT License%0A%0Aimport string%0A%0Afrom parser import *%0A%0Adef vspace(): return '%5Cn%5Cr', ignore%0Adef hspace(): return ' %5Ct', ignore%0Adef eol(): return choice(eof, vspace), ignore%0Adef sp... | |
b8c4fdc1ebba18ab832160bece4ce8b391a15b7a | add sampled stochastic games serialization tests | open_spiel/python/tests/sampled_stochastic_games_test.py | open_spiel/python/tests/sampled_stochastic_games_test.py | Python | 0 | @@ -0,0 +1,2450 @@
+# Copyright 2019 DeepMind Technologies Ltd. All rights reserved.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LIC... | |
ed9d640a11c02ca4b42e62d975e4ae9a2bd33093 | add tests for simtk! | openpathsampling/experimental/storage/test_simtk_unit.py | openpathsampling/experimental/storage/test_simtk_unit.py | Python | 0 | @@ -0,0 +1,2650 @@
+import pytest%0Aimport numpy as np%0A%0Afrom ..simstore.custom_json import JSONSerializerDeserializer, DEFAULT_CODECS%0A%0Afrom .simtk_unit import *%0A%0Atry:%0A from simtk import unit%0Aexcept ImportError:%0A HAS_SIMTK = False%0Aelse:%0A HAS_SIMTK = True%0A%0Aclass TestSimtkUnitCodec(objec... | |
4d85702561c000824083544de98693e244c8aab7 | Add test for decoder stack | tests/test_decoding_stack.py | tests/test_decoding_stack.py | Python | 0.000001 | @@ -0,0 +1,2736 @@
+#! /usr/bin/env python%0A%0Afrom __future__ import division%0A%0Afrom timeside.decoder import FileDecoder%0Afrom timeside.analyzer import AubioPitch%0Afrom timeside.core import ProcessPipe%0Aimport numpy as np%0Afrom unit_timeside import *%0A%0Aimport os.path%0A%0A#from glib import GError as GST_IOE... | |
40bf8d4773eb659ac2ac22aef50c2f63084924be | add profiler test case | rfcs/20200624-pluggable-device-for-tensorflow/sample/test_profiler.py | rfcs/20200624-pluggable-device-for-tensorflow/sample/test_profiler.py | Python | 0.000002 | @@ -0,0 +1,1206 @@
+#!/usr/bin/env python%0A# coding=utf-8%0Aimport tensorflow as tf%0Aimport numpy as np%0Aimport os%0Atf.compat.v1.disable_eager_execution()%0A%0Aprofile_options = tf.profiler.experimental.ProfilerOptions(%0A host_tracer_level = 3,%0A ... | |
3d0827fa805a08eaaaa07e037f6ce3da6d8e1c4e | add guess module | yoink/guess.py | yoink/guess.py | Python | 0.000001 | @@ -0,0 +1,1688 @@
+import numpy as np%0Afrom scipy import ndimage%0A%0Atry:%0A from skimage.feature import corner_harris%0A from skimage.measure import approximate_polygon%0Aexcept ImportError:%0A from yoink.mini_skimage import corner_harris, approximate_polygon%0A%0A%0Adef guess_corners(bw):%0A %22%22%22%... | |
4224761522c1e058979f3901f9af1d037398576c | Add cache_key method to be used by Django 1.7 | django_mobile/loader.py | django_mobile/loader.py | import hashlib
from django.template import TemplateDoesNotExist
from django.template.loader import find_template_loader, BaseLoader
from django.template.loader import get_template_from_string
from django.template.loaders.cached import Loader as DjangoCachedLoader
from django_mobile import get_flavour
from django_mobile... | Python | 0 | @@ -335,16 +335,62 @@
ettings%0A
+from django.utils.encoding import force_bytes%0A
%0A%0Aclass
@@ -2927,32 +2927,367 @@
_usable = True%0A%0A
+ def cache_key(self, template_name, template_dirs):%0A if template_dirs:%0A key = '-'.join(%5B%0A template_name,%0A hashlib... |
4ef2344b3abf3d8c0542ffd97425557ae092f21d | handle ZeroDivisionError | tensorflow/python/data/experimental/benchmarks/map_defun_benchmark.py | tensorflow/python/data/experimental/benchmarks/map_defun_benchmark.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.000006 | @@ -1472,24 +1472,105 @@
=True%0A )%0A
+ zero_division_delta = 1e-100%0A wall_time = wall_time + zero_division_delta%0A
self.rep
@@ -1696,19 +1696,19 @@
ec%22:
+ 1 /
float(
-1 /
wall
|
ef96c4e1a27289f5cdad5de78ee2a2dfc1b91bd0 | Create network-delay-time.py | Python/network-delay-time.py | Python/network-delay-time.py | Python | 0.000037 | @@ -0,0 +1,777 @@
+# Time: O((%7CE%7C + %7CV%7C) * log%7CV%7C)%0A# Space: O(%7CE%7C + %7CV%7C)%0A%0A# Dijkstra's algorithm%0Aclass Solution(object):%0A def networkDelayTime(self, times, N, K):%0A %22%22%22%0A :type times: List%5BList%5Bint%5D%5D%0A :type N: int%0A :type K: int%0A ... | |
842d7337f236d94d1b7ed70aaa98eff73b4000cd | Create pyside_houdini.py | pyside_houdini.py | pyside_houdini.py | Python | 0 | @@ -0,0 +1,2485 @@
+%22%22%22%0AThis module helps you use PyQt in Houdini's GUI by integrating PyQt's event%0Aloop into Houdini's. Replace calls to QApplication.exec_() in your%0Acode with calls to pyqt_houdini.exec_(app).%0A%22%22%22%0Afrom email.mime import image%0A%0Aimport hou%0Afrom PySide import QtCore%0Afrom PyS... | |
90ef0ed82a4d22f277ccc0c3275f0a07189fadc0 | Make title pictures. | title_pics.py | title_pics.py | Python | 0.000006 | @@ -0,0 +1,2303 @@
+# -*- coding: utf-8 -*-%0A#%0A# title_pics.py%0A#%0A# purpose: Create map and time-series for title%0A# author: Filipe P. A. Fernandes%0A# e-mail: ocefpaf@gmail%0A# web: http://ocefpaf.github.io/%0A# created: 20-Jan-2015%0A# modified: Tue 20 Jan 2015 11:18:15 AM BRT%0A#%0A# obs:%0A#%0A%0A... | |
84153b0be78998ab8ec6914df8623c99255457b5 | Improve code for creating temporary locustfiles that can be used in tests | locust/test/mock_locustfile.py | locust/test/mock_locustfile.py | Python | 0 | @@ -0,0 +1,1224 @@
+import os%0Aimport random%0Aimport time%0A%0Afrom contextlib import contextmanager%0A%0A%0AMOCK_LOUCSTFILE_CONTENT = '''%0A%22%22%22This is a mock locust file for unit testing%22%22%22%0A%0Afrom locust import HttpLocust, TaskSet, task, between%0A%0A%0Adef index(l):%0A l.client.get(%22/%22)%0A%0Ad... | |
fea7f350ce711d183fd9011c43ca68fff88400eb | Add cython compile util | utils/cython_compile_libs.py | utils/cython_compile_libs.py | Python | 0.000001 | @@ -0,0 +1,1250 @@
+#!/bin/env python%0Afrom __future__ import division, absolute_import, with_statement, print_function, unicode_literals%0Aimport os%0Aimport sys%0Aimport shutil%0Afrom pyximport.pyxbuild import pyx_to_dll%0AWD = os.path.dirname(os.path.dirname((os.path.abspath(__file__))))%0ALIBS = os.path.join(WD, '... | |
bdb841c99b443ab65ad30acc3ab5a88f5e3d7411 | Correct version of build.gradle for building binaries | python/helpers/pydev/build_tools/build_binaries_windows.py | python/helpers/pydev/build_tools/build_binaries_windows.py | '''
Creating the needed environments for creating the pre-compiled distribution on Windods:
1. Download:
* conda32 at C:\tools\Miniconda32
* conda64 at C:\tools\Miniconda
Create the environments:
C:\tools\Miniconda32\Scripts\conda create -y -f -n py27_32 python=2.7 cython numpy nose ipython pip
C:\tools\Miniconda3... | Python | 0 | @@ -1876,36 +1876,26 @@
_envs =
-getattr(os.environ,
+os.getenv(
'MINICON
@@ -1959,28 +1959,18 @@
s =
-getattr(os.environ,
+os.getenv(
'MIN
|
d31f63a914877fe12d66497bdbc7dd6d871672fc | add solution for Best Time to Buy and Sell Stock | src/bestTimeToBuyAndSellStock.py | src/bestTimeToBuyAndSellStock.py | Python | 0 | @@ -0,0 +1,371 @@
+class Solution:%0A # @param prices, a list of integer%0A # @return an integer%0A%0A def maxProfit(self, prices):%0A n = len(prices)%0A if n %3C 2:%0A return 0%0A min_price = prices%5B0%5D%0A res = 0%0A for i in xrange(1, n):%0A res = m... | |
595c8fad76696240f96e61d9a2299de3d6cda16a | Add utility for walking etree and yielding nodes if options class type match. | skcode/utility/walketree.py | skcode/utility/walketree.py | Python | 0 | @@ -0,0 +1,563 @@
+%22%22%22%0ASkCode utility for walking across a document tree.%0A%22%22%22%0A%0A%0Adef walk_tree_for_cls(tree_node, opts_cls):%0A %22%22%22%0A Walk the tree and yield any tree node matching the given options class.%0A :param tree_node: The current tree node instance.%0A :param opts_cls: T... | |
4e50597100b5e84b1ed3c304a3a7323e7bab7918 | Create removeSequence.py | removeSequence.py | removeSequence.py | Python | 0.000001 | @@ -0,0 +1,2258 @@
+#!/usr/bin/python%0A%0A###############################################################################%0A#%0A# removeSequence.py version 1.0%0A# %0A# Removes a specified nucleotide sequence from the beginning of a larger sequence%0A#%0A# Useful for preparing FASTA files for certain proce... | |
b7d15547bd88c6304c5d8ceb1f74481cb4d162e7 | Add parser hacking example | repeat_n_times.py | repeat_n_times.py | Python | 0.000002 | @@ -0,0 +1,1026 @@
+# -*- encoding: utf-8 -*-%0A%0Afrom jinja2 import Environment%0Afrom jinja2.ext import Extension%0Afrom jinja2 import nodes%0A%0A%0Aclass RepeatNTimesExtension(Extension):%0A%0A tags = %7B%22repeat%22%7D%0A%0A def parse(self, parser):%0A lineno = next(parser.stream).lineno%0A ind... | |
e3365aa8d9f5e49d3aff732d169c22a46ef22904 | Create viriback_tracker.py (#452) | plugins/feeds/public/viriback_tracker.py | plugins/feeds/public/viriback_tracker.py | Python | 0 | @@ -0,0 +1,1791 @@
+import logging%0Afrom dateutil import parser%0Afrom datetime import timedelta, datetime%0A%0Afrom core import Feed%0Afrom core.errors import ObservableValidationError%0Afrom core.observables import Url, Ip%0A%0A%0Aclass ViriBackTracker(Feed):%0A default_values = %7B%0A %22frequency%22: tim... | |
5a5c30e701220cc874d08a442af0e81d2020aacf | bump dev version | symposion/__init__.py | symposion/__init__.py | __version__ = "1.0b1.dev42"
| Python | 0 | @@ -22,7 +22,7 @@
dev4
-2
+3
%22%0A
|
85336dfed46145c36307f218612db7c4d8dbf637 | bump version | symposion/__init__.py | symposion/__init__.py | __version__ = "1.0b1.dev17"
| Python | 0 | @@ -22,7 +22,7 @@
dev1
-7
+8
%22%0A
|
c642a32b1aff0c9adc8e62aad8ceb7e0396512ed | bump version | symposion/__init__.py | symposion/__init__.py | __version__ = "1.0b1.dev13"
| Python | 0 | @@ -22,7 +22,7 @@
dev1
-3
+4
%22%0A
|
c36a954dbdfcca6e520dca6b96c1c97f496880ca | Add test for forcefield_labeler | smarty/tests/test_forcefield_labeler.py | smarty/tests/test_forcefield_labeler.py | Python | 0 | @@ -0,0 +1,1249 @@
+from functools import partial%0Aimport smarty%0Aimport openeye%0Afrom openeye.oechem import *%0Aimport os%0Afrom smarty.utils import get_data_filename%0Aimport numpy as np%0Afrom smarty.forcefield_labeler import *%0A%0A%0Adef test_read_ffxml():%0A %22%22%22Test reading of ffxml files.%0A %22%2... | |
7d1fde66e0fd6b3b8cc9876e0d3271d6776b347f | convert tiffs to video added | image_to_video.py | image_to_video.py | Python | 0.001017 | @@ -0,0 +1,1447 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on Tue May 15 16:11:55 2018%0A%0A@author: LaVision%0A%22%22%22%0A%0A#!/usr/local/bin/python3%0A%0Aimport cv2%0Aimport argparse%0Aimport os%0A%0A# Construct the argument parser and parse the arguments%0Aap = argparse.ArgumentParser()%0Aap.add_argument(%22... | |
f67514bf9ed193c0a8ac68c2258913bb54df8a88 | Create save_py_source.py | save_py_source.py | save_py_source.py | Python | 0 | @@ -0,0 +1,1083 @@
+import datetime, os, zipfile%0A%0Aexts = '.py pyui'.split()%0Azip_file_name = 'aa_source_code_%25Y_%25m_%25d_%25H_%25M_%25S.zip'%0Azip_file_name = datetime.datetime.strftime(datetime.datetime.now(), zip_file_name)%0A%0Adef get_filenames(in_dir=None):%0A def visit(_, dirname, names):%0A for... | |
2519e7c8289a6045208013b0958fc4c9f49ff39a | lexographic permutations: python | lexographic_permutations/python/lexographic_permutations.py | lexographic_permutations/python/lexographic_permutations.py | Python | 0.999828 | @@ -0,0 +1,332 @@
+import itertools%0A%0Adef permute(input):%0A%09if len(input) == 2:%0A%09%09return %5Binput, input%5B::-1%5D%5D%0A%0A%09permutations = %5B%5D%0A%09for i in range(0,len(input)):%0A%09%09permutations.append(map(lambda x: input%5Bi%5D+x, permute(input%5B:i%5D+input%5Bi+1:%5D)))%0A%09return sum(permutatio... | |
c7c02febb43eb2466484f5c99d6dcc2d60e67e09 | add docker.py | zblogsite/settings/docker.py | zblogsite/settings/docker.py | Python | 0.000004 | @@ -0,0 +1,776 @@
+from .base import *%0D%0A%0D%0ADEBUG = True%0D%0A%0D%0ADATABASES = %7B%0D%0A 'default': %7B%0D%0A 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.%0D%0A 'NAME': 'zblog', # Or path to database file if using sqlite3... | |
f60f31c73deef7768af5eb45046a8848f2dc40c4 | Create draw_neural_net.py | draw/draw_neural_net.py | draw/draw_neural_net.py | Python | 0.000023 | @@ -0,0 +1,1962 @@
+import matplotlib.pyplot as plt%0A%0Adef draw_neural_net(ax, left, right, bottom, top, layer_sizes):%0A '''%0A Draw a neural network cartoon using matplotilb.%0A %0A :usage:%0A %3E%3E%3E fig = plt.figure(figsize=(12, 12))%0A %3E%3E%3E draw_neural_net(fig.gca(), .1, .9, .1, ... | |
041b55f3a9ded360146f6e2dda74a6b20b3e6f7e | Add scrape_results | scrape_results.py | scrape_results.py | Python | 0 | @@ -0,0 +1,766 @@
+from selenium import webdriver%0Afrom time import sleep%0Afrom bs4 import BeautifulSoup%0A%0Adriver = webdriver.Firefox()%0Adriver.get(%22http://www.nitt.edu/prm/ShowResult.htm%22)%0A%0Adriver.get(%22javascript:(function()%7Bdocument.getElementsByName('main')%5B0%5D.contentWindow.document.getElementB... | |
dc52b5914c4d0024458eefeb3b3576aa58692345 | Remove print | organizations/decorators.py | organizations/decorators.py | # encoding: utf-8
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from seaserv import get_user_current_org
def org_staff_required(func):
"""
Decorator for views that checks the user is org staff.
"""
def _decorated(request, *args, **kwargs):
... | Python | 0.000016 | @@ -453,57 +453,8 @@
ix)%0A
- print url_prefix%0A print org._dict%0A
|
55bf42057bcd9e14d964b2064f9322c164ba91ff | Test request construction (#91) | test/test_requests.py | test/test_requests.py | Python | 0 | @@ -0,0 +1,2340 @@
+import unittest%0A%0Aimport requests%0Aimport requests_mock%0A%0Aimport tableauserverclient as TSC%0A%0A%0Aclass RequestTests(unittest.TestCase):%0A def setUp(self):%0A self.server = TSC.Server('http://test')%0A%0A # Fake sign in%0A self.server._site_id = 'dad65087-b08b-4603-... | |
d149f9d64c55ea38c7be20a1c759dc802a16a793 | Update doc string (Fix #491) | homeassistant/components/notify/smtp.py | homeassistant/components/notify/smtp.py | """
homeassistant.components.notify.mail
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mail (SMTP) notification service.
Configuration:
To use the Mail notifier you will need to add something like the following
to your configuration.yaml file.
notify:
platform: mail
server: MAIL_SERVER
port: YOUR_SMTP_PORT
sender: SE... | Python | 0 | @@ -29,20 +29,20 @@
.notify.
-mail
+smtp
%0A~~~~~~~
@@ -133,20 +133,20 @@
use the
-Mail
+smtp
notifie
@@ -251,20 +251,20 @@
atform:
-mail
+smtp
%0A serve
|
35f98c14a74e207c616fcb57538bb176842c0d1e | Add procfile and wsgi entrypoint | nhs/wsgi.py | nhs/wsgi.py | Python | 0 | @@ -0,0 +1,1142 @@
+%22%22%22%0AWSGI config for Nhs Prescriptions project.%0A%0AThis module contains the WSGI application used by Django's development server%0Aand any production WSGI deployments. It should expose a module-level variable%0Anamed %60%60application%60%60. Django's %60%60runserver%60%60 and %60%60runfcgi%... | |
ebd41d7f264de92be19347042749ef48d5820b7d | add inner product demo | study/language_core_and_lib/function/functional_example.py | study/language_core_and_lib/function/functional_example.py | Python | 0 | @@ -0,0 +1,303 @@
+def demo_inner_product():%0A vec0 = range(10)%0A vec1 = %5Bi ** 2 for i in range(10)%5D%0A print 'inner product:', reduce(lambda l, r: l + r, map(lambda ele: ele%5B0%5D * ele%5B1%5D, zip(vec0, vec1)), 0)%0A print 'verify:', sum(%5Bi ** 3 for i in range(10)%5D)%0A%0A%0Aif __name__ == '__ma... | |
6d51e3eae867e65c35772a647a40535fc088bb5c | version 0.41 | client/version.py | client/version.py | ELECTRUM_VERSION = "0.40b"
SEED_VERSION = 4 # bump this everytime the seed generation is modified
| Python | 0.000001 | @@ -20,10 +20,9 @@
%220.4
-0b
+1
%22%0ASE
|
7bd3d26427c08cf38f2f7dedbf075e1335447f70 | add config for database | config/database.py | config/database.py | Python | 0.000001 | @@ -0,0 +1,75 @@
+mongorc = %7B%0A 'host': '127.0.0.1',%0A 'port': 27017,%0A 'db': 'demo'%0A%7D%0A
| |
f3325695a78f528af6f3c2adb6024dc71405af8f | Create kaynaksız_sil.py | kaynaksız_sil.py | kaynaksız_sil.py | Python | 0.000032 | @@ -0,0 +1,1606 @@
+# -*- coding: utf-8 -*-%0A# !/usr/bin/python%0A%0Afrom bs4 import BeautifulSoup%0Aimport requests%0Aimport mavri%0Aimport re%0Aimport random%0A%0A%0Axx= mavri.login('tr.wikipedia','Mavrikant Bot')%0A%0Awiki='tr.wikipedia'%0Atemplate='%C5%9Eablon:Kaynaks%C4%B1z'%0A%0Aticontinue = ''%0Awhile ticontinu... | |
118e47c2bc307d8de447e9d37973feca44763ab5 | Create __init__.py | packs/astral/actions/lib/__init__.py | packs/astral/actions/lib/__init__.py | Python | 0.000429 | @@ -0,0 +1,35 @@
+from .BaseAction import BaseAction%0A
| |
f5c56152771fbafc5ac9161ccd453a240bfca5cc | Add get_history example. | examples/get_history.py | examples/get_history.py | Python | 0 | @@ -0,0 +1,780 @@
+import sys%0Asys.path.append('../')%0A%0Aimport zabbix%0Afrom datetime import datetime%0Afrom datetime import timedelta%0Afrom calendar import timegm%0A%0A# read config file%0Aconfig = %7B%7D%0Aexecfile(%22config.py%22, config)%0A%0A# new api instance%0Aserver = config%5B%22server%22%5D%0Aapi = zabbi... | |
26afdc032087693d274966a803a6bb3c77d17549 | add request example | examples/request/req.py | examples/request/req.py | Python | 0 | @@ -0,0 +1,605 @@
+from app import Application%0A%0Adef dump(request):%0A text = %22%22%22%0AMethod: %7B0.method%7D%0APath: %7B0.path%7D%0AVersion: %7B0.version%7D%0AHeaders: %7B0.headers%7D%0AMatch: %7B0.match_dict%7D%0ABody: %7B0.body%7D%0AQS: %7B0.query_string%7D%0Aquery: %7B0.query%7D%0Amime_type: %7B0.mime_type... | |
b84a2667b5071ede3eb983364195c3a2d3c97543 | Create MQTTstage.py | MQTTstage.py | MQTTstage.py | Python | 0.000006 | @@ -0,0 +1,62 @@
+#!/usr/bin/python%0A%0A%0A#Check if the %0Adef CheckDirectories():%0A %0A
| |
0db094aba5095b63a8f9bfb066afb0048617f87e | add update_GeneAtlas_images.py | scheduled_bots/scripts/update_GeneAtlas_images.py | scheduled_bots/scripts/update_GeneAtlas_images.py | Python | 0.000001 | @@ -0,0 +1,1932 @@
+%22%22%22%0AOne off script to change GeneAtlas images to point to full-sized versions%0Ahttps://github.com/SuLab/GeneWikiCentral/issues/1%0A%0AAs described at https://www.wikidata.org/wiki/Property_talk:P692#How_about_using_full_size_image_instead_of_small_thumbnail.3F%0Aupdate all uses of the Gene ... | |
427a95f0c56facc138448cde7e7b9da1bcdc8ea4 | Add super basic Hypothesis example | add_example.py | add_example.py | Python | 0.001464 | @@ -0,0 +1,399 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A# Unit Tests%0A%0Adef test_add_zero():%0A assert 0 + 1 == 1 + 0%0A%0Adef test_add_single_digits():%0A assert 1 + 2 == 2 + 1%0A%0Adef test_add_double_digits():%0A assert 10 + 12 == 12 + 10%0A%0A%0A# Property-based Test%0A%0Afrom hypothesis ... | |
3a4cb29e91008225c057feb3811e93b59f99d941 | use flask-mail | application.py | application.py | Python | 0.000001 | @@ -0,0 +1,580 @@
+from flask import Flask%0Afrom flask.ext.mail import Mail, Message%0A%0Amail = Mail()%0Aapp = Flask(__name__)%0Aapp.config.update(%0A MAIL_SERVER='smtp.gmail.com',%0A MAIL_PORT='465',%0A MAIL_USE_SSL=True,%0A MAIL_USERNAME='nokbar@voltaire.sh',%0A MAIL_PASSWORD='H3r... | |
21a504dce25a1b22bda27cd74a443af98b24ad14 | Add pseudo filter combining pypandoc and panflute | filters/extract_urls.py | filters/extract_urls.py | Python | 0 | @@ -0,0 +1,610 @@
+import io%0D%0A%0D%0Aimport pypandoc%0D%0Aimport panflute%0D%0A%0D%0A%0D%0Adef prepare(doc):%0D%0A%09doc.images = %5B%5D%0D%0A%09doc.links = %5B%5D%0D%0A%0D%0A%0D%0Adef action(elem, doc):%0D%0A if isinstance(elem, panflute.Image):%0D%0A %09doc.images.append(elem)%0D%0A elif isinstance(elem, ... | |
b811bb9e9469a23921f841d4bfe3b52928a83e14 | Create b.py | at/abc126/b.py | at/abc126/b.py | Python | 0.000018 | @@ -0,0 +1,310 @@
+read = input%0As = read()%0Aa, b = map(int , %5Bs%5B:2%5D, s%5B2:%5D%5D)%0AYYMM = False%0AMMYY = False%0Aif 1 %3C= b and b %3C= 12:%0A YYMM = True%0Aif 1 %3C= a and a %3C= 12:%0A MMYY = True%0Aif YYMM and MMYY :%0A print('AMBIGUOUS')%0Aelif YYMM and not MMYY:%0A print('YYMM')%0Aelif not Y... | |
32c025a217f7771be94976fda6ede2d80855b4b6 | Move things to new units module | pyatmlab/units.py | pyatmlab/units.py | Python | 0.000001 | @@ -0,0 +1,622 @@
+%22%22%22Various units-related things%0A%22%22%22%0A%0Afrom pint import (UnitRegistry, Context)%0Aureg = UnitRegistry()%0Aureg.define(%22micro- = 1e-6 = %C2%B5-%22)%0A%0A# aid conversion between different radiance units%0Asp2 = Context(%22radiance%22)%0Asp2.add_transformation(%0A %22%5Blength%5D *... | |
c473d392e15912b68f09e20a329758be7ffe7930 | Fix 'yotta version' in Windows | yotta/lib/vcs.py | yotta/lib/vcs.py | # Copyright 2014 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
import os
import subprocess
import tempfile
import logging
import hgapi
import errno
# fsutils, , misc filesystem utils, internal
import fsutils
git_logger = logging.getLogg... | Python | 0.000048 | @@ -3291,16 +3291,35 @@
f.gitdir
+.replace('%5C%5C', '/')
%5D + list
|
b0652c0dff90d68a6a7cf84b536e7e539e344f74 | Fix for bug 902175 | quantum/db/api.py | quantum/db/api.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Nicira Networks, Inc.
# 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.apach... | Python | 0.000001 | @@ -4182,32 +4182,46 @@
(port_id, net_id
+, session=None
):%0A # confirm
@@ -4252,32 +4252,56 @@
ork_get(net_id)%0A
+ if not session:%0A
session = ge
@@ -4328,33 +4328,32 @@
%0A return
-
session.query(mo
@@ -6134,24 +6134,33 @@
t_id, net_id
+, session
)%0A port.i
@@ -6182,37 +6182,35 @... |
50494947bdf7fc8fce50cb5f589c84fd48db4b05 | test perm using py.test #1150 | login/tests/fixture.py | login/tests/fixture.py | Python | 0 | @@ -0,0 +1,1751 @@
+# -*- encoding: utf-8 -*-%0Aimport pytest%0A%0Afrom login.tests.factories import (%0A TEST_PASSWORD,%0A UserFactory,%0A)%0A%0A%0Aclass PermTest:%0A%0A def __init__(self, client):%0A setup_users()%0A self.client = client%0A%0A def anon(self, url):%0A self.client.logou... | |
1a98ccfbff406509d9290e76bbdf8edbb862fc1d | Solve orderred dict | python/py-collections-ordereddict.py | python/py-collections-ordereddict.py | Python | 0.999999 | @@ -0,0 +1,477 @@
+from collections import OrderedDict%0A%0Ad = OrderedDict()%0Anumber_of_items = int(input().strip())%0Afor i in range(number_of_items):%0A item, delimeter, price = input().strip().rpartition(%22 %22)%0A price = int(price)%0A if (item in d):%0A previous_total_purchased = d.get(item)%0A ... | |
fa4155114304d1ebc9e3bb04f546ce7d4708c381 | Add simple pipeline | pykit/pipeline.py | pykit/pipeline.py | Python | 0.000001 | @@ -0,0 +1,676 @@
+# -*- coding: utf-8 -*-%0A%0A%22%22%22%0APipeline that determines phase ordering and execution.%0A%22%22%22%0A%0Afrom __future__ import print_function, division, absolute_import%0Aimport types%0A%0Acpy = %7B%0A 'lower_convert': lower_convert,%0A%7D%0A%0Alower = %7B%0A%0A%7D%0A%0A# ________________... | |
8f81b90e81afca03dd591426b1197dbab74e1adf | Add an import/export handler for Audit->Auditors | src/ggrc_basic_permissions/converters/handlers.py | src/ggrc_basic_permissions/converters/handlers.py | # Copyright (C) 2015 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
from sqlalchemy import and_
from ggrc import db
from ggrc.converters import er... | Python | 0 | @@ -2945,24 +2945,269 @@
*options)%0A%0A%0A
+class AuditAuditorColumnHandler(ObjectRoleColumnHandler):%0A%0A def __init__(self, row_converter, key, **options):%0A self.role = Role.query.filter_by(name=%22Auditor%22).one()%0A super(self.__class__, self).__init__(row_converter, key, **options)%0A%0A%0A
class Use... |
141005c72b1686d73cdc581e9ee8313529e11e4c | Add health check script. | tools/health-check.py | tools/health-check.py | Python | 0 | @@ -0,0 +1,2470 @@
+#!/usr/bin/python%0A%0A# Health check script that examines the /status/ URI and sends mail on any%0A# condition other than 200/OK.%0A# Configuration is via environment variables:%0A# * POWERMON_STATUS - absolute URL to /status/ URI%0A# * POWERMON_SMTPHOST - SMTP host name used to send mail%0A# ... | |
210eba35fc4473e626fc58a8e4ea3cdbb6abdc28 | 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 | @@ -1196,16 +1196,68 @@
ccounts%0A
+ %60i%60 : Display new messages prompt%0A
%60?%60
|
04287120372a6fdb906ed9f27ead4c5f91d5690e | Add a modified version of simple bot | tota/heroes/lenovo.py | tota/heroes/lenovo.py | Python | 0 | @@ -0,0 +1,2680 @@
+from tota.utils import closest, distance, sort_by_distance, possible_moves%0Afrom tota import settings%0A%0A__author__ = %22angvp%22%0A%0A%0Adef create():%0A%0A def lenovo_hero_logic(self, things, t):%0A # some useful data about the enemies I can see in the map%0A enemy_team = setti... | |
2f7d5f30fd6b6cb430c55b21d7cab75800bcfe97 | Add a little hacky highlighter | screencasts/hello-weave/highlight.py | screencasts/hello-weave/highlight.py | Python | 0.000005 | @@ -0,0 +1,1757 @@
+import json%0A%0Aprompt = 'ilya@weave-01:~$ '%0A%0Ahighlight = %5B%0A ('weave-01', 'red'),%0A ('weave-02', 'red'),%0A ('docker', 'red'),%0A ('run', 'red'),%0A ('--name', 'red'),%0A ('hello', 'red'),%0A ('netcat', 'red'),%0A ('-lk', 'red'),%0A ('1234', 'red'),%0A ('sudo curl -s -L git.io/we... | |
6b4733c213046c7a16bf255cfbc92408e2f01423 | Add test for registry model hash | tests/models/test_authenticated_registry_model.py | tests/models/test_authenticated_registry_model.py | Python | 0 | @@ -0,0 +1,1214 @@
+import pytest%0A%0Afrom dockci.models.auth import AuthenticatedRegistry%0A%0A%0ABASE_AUTHENTICATED_REGISTRY = dict(%0A id=1,%0A display_name='Display name',%0A base_name='Base name',%0A username='Username',%0A password='Password',%0A email='Email',%0A insecure=False,%0A)%0A%0A%0... | |
57dc7e58dcfd101c29026c8c07763cba2eb7dd14 | add helper script to inspect comments on released content | scripts/show_comments.py | scripts/show_comments.py | Python | 0 | @@ -0,0 +1,665 @@
+#!/usr/bin/env python%0A%0Afrom __future__ import print_function%0Aimport sys%0A%0Adef main():%0A%09fs = open(sys.argv%5B1%5D).read().splitlines()%0A%09fs = map(lambda f: %7B'name':f, 'contents':open(f).readlines()%7D,fs)%0A%09for f in fs:%0A%09%09buffer = ''%0A%09%09multiline = 0%0A%09%09is_first = ... | |
4b83b7a3d286f60454c96ae609ce18c731339877 | add a stub fuse-based fs component | src/fs/nomadfs.py | src/fs/nomadfs.py | Python | 0 | @@ -0,0 +1,1510 @@
+#!/usr/bin/env python%0A#%0A# Copyright (c) 2015 Josef 'Jeff' Sipek %3Cjeffpc@josefsipek.net%3E%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 restr... | |
4efc50f91d2b141270739ea9f8bef9685cc86e7f | add houdini/shelf/fitcam | houdini/shelf/fitcam.py | houdini/shelf/fitcam.py | Python | 0 | @@ -0,0 +1,2486 @@
+# -*- coding: utf-8 -*-%0Aimport hou%0Aimport toolutils%0A%0Adef setfit(oldCam, resx, resy):%0A oldCam.setDisplayFlag(False)%0A%0A oldCam.parm(oldCam.path() + %22/resx%22).set(resx)%0A oldCam.parm(oldCam.path() + %22/resy%22).set(resy)%0A%0A camups = oldCam.inputAncestors... | |
1886af3e8c96108a8f7bdb320969373e66299bf4 | Create __init__.py | python/django_standalone_orm/__init__.py | python/django_standalone_orm/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
a60ee657a6f1a0479e88b0c9c0f10b204e02ab7c | fix import | tensorflow/contrib/tensorrt/test/test_tftrt.py | tensorflow/contrib/tensorrt/test/test_tftrt.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.000001 | @@ -1078,17 +1078,24 @@
.contrib
-.
+ import
tensorrt
|
88548319d8a7c44d039ce269621f0a9ff4ee8af6 | refactor leslie matrix; add leslie_exe.py | poptox/leslie/leslie_exe.py | poptox/leslie/leslie_exe.py | Python | 0.000011 | @@ -0,0 +1,2478 @@
+import numpy as np%0Aimport os.path%0Aimport pandas as pd%0Aimport sys%0A#find parent directory and import base (travis)%0Aparentddir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))%0Asys.path.append(parentddir)%0Afrom base.uber_model import UberModel, ModelSharedInputs%0A... | |
d3d6a6018d55581bf081c93386f6676c8bb105ce | Add module for running the main simulation | simulate.py | simulate.py | Python | 0 | @@ -0,0 +1,330 @@
+import genetic%0Aimport sys%0A%0Aoutput = sys.stdout%0A%0Adef setOutput(out):%0A output = out%0A genetic.setOutput(output)%0A%0A# Test data for a XOR gate%0AtestData = (%0A (0.1, 0.1, 0.9),%0A (0.1, 0.9, 0.9),%0A (0.9, 0.1, 0.9),%0A (0.9, 0.9, 0.1)%0A)%0A%0Adef simulate():%0A sim... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.