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 |
|---|---|---|---|---|---|---|---|
bb69db1a6ff061480cb0861027898cace9a2bf19 | Add www domain to allowed hosts. | chipy_org/settings.py | chipy_org/settings.py | # -*- coding: utf-8 -*-
# Django settings for account project
import os
import sys
import dj_database_url
from django.conf.global_settings import MIDDLEWARE_CLASSES
def env_var(key, default=None):
"""Retrieves env vars and makes Python boolean replacements"""
val = os.environ.get(key, default)
if val ==... | Python | 0 | @@ -599,16 +599,33 @@
py.org',
+ 'www.chipy.org',
'chipy.
|
0fca2d9d6a3a08f85e0ef187627e8bef50590312 | Add auth error url | chipy_org/settings.py | chipy_org/settings.py | # -*- coding: utf-8 -*-
# Django settings for account project
import os.path
import sys
import random
from os import environ as env
import posixpath
import dj_database_url
from django.conf.global_settings import MIDDLEWARE_CLASSES
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
sys.path.append(os.path.join... | Python | 0.000002 | @@ -3580,16 +3580,39 @@
ct%22,%0A%5D%0A%0A
+# Social Auth settings%0A
MIDDLEWA
@@ -3682,16 +3682,38 @@
eware',)
+%0ALOGIN_ERROR_URL = '/'
%0A%0AAUTHEN
|
30d0ca9fa2c76463569362eb0f640dbbe0079068 | Add builder to compile coffeescript to javascript files | buildGame.py | buildGame.py | Python | 0 | @@ -0,0 +1,333 @@
+#!/usr/bin/env python%0A%0Aimport fnmatch%0Aimport os%0Afrom subprocess import call%0A %0ArootPath = 'ludumdare26'%0Apattern = '*.coffee'%0A %0Afor root, dirs, files in os.walk(rootPath):%0A for filename in fnmatch.filter(files, pattern):%0A print( os.path.join(root, filename))%0A ca... | |
054cfe232cd7672788e8b2b4e4af44b7cfbe99be | solve 1 problem | solutions/single-number-ii.py | solutions/single-number-ii.py | Python | 0.000027 | @@ -0,0 +1,1626 @@
+#!/usr/bin/env python%0A# encoding: utf-8%0A%0A%22%22%22%0Asingle-number-ii.py%0A %0ACreated by Shuailong on 2016-03-23.%0A%0Ahttps://leetcode.com/problems/single-number-ii/.%0A%0A%22%22%22%0A%0Aclass Solution(object):%0A def singleNumber(self, nums):%0A %22%22%22%0A O(n) time and O... | |
5e377f926e964f5d6d74ba713947f11b72534b70 | Add namelizer.py to normalize feature names for Events | namelizer.py | namelizer.py | Python | 0 | @@ -0,0 +1,1147 @@
+import itertools%0Aimport os%0Afrom lxml import etree as ET%0Aimport gate%0A%0A%0Aconversations_path = %22/home/nick/hilt/pes/conversations%22%0A%0Afiles = list(%0A itertools.chain.from_iterable(%0A (%0A %5B%0A os.path.join(%0A results%5B0%5D,%0... | |
9a878c96ccf2fb7316dc6e9d330840a78ffd303b | Create second_degree_equation_solver.py | second_degree_equation_solver.py | second_degree_equation_solver.py | Python | 0.009999 | @@ -0,0 +1,1578 @@
+# -*- coding: utf-8 -*-%0Aimport sys%0Aimport math%0A%0Aprint %22 _____ _ _ _____ _ ___ %22%0Aprint %22%7C __%7C___ _ _ ___%7C %7C_%7C_%7C___ ___ %7C __%7C___%7C %7C_ _ ___ ___ _ _ %7C_ %7C %22%0Aprint %22%7C __%7C . %7C %7C %7C .'%7C... | |
2c223297fa64acc853994d6970d422253ce033bd | fix http3 channel | skitai/http3_server.py | skitai/http3_server.py | Python | 0.000001 | @@ -0,0 +1,1410 @@
+#!/usr/bin/env python%0A%0Afrom . import http_server%0Afrom .counter import counter%0Aimport socket, time%0Afrom rs4 import asyncore%0Aimport ssl%0Afrom skitai import lifetime%0Aimport os, sys, errno%0Aimport skitai%0Afrom errno import EWOULDBLOCK%0A%0Aclass http3_channel (https_server.https_channel... | |
4f865a4249ea3e5b349f2ab57d8b50c5582bf848 | add git script | scripts/git_colab.py | scripts/git_colab.py | Python | 0.000001 | @@ -0,0 +1,71 @@
+# test script%0A%0Adef git_command(cmd):%0A print('git command', cmd)%0A
| |
54c22e1f6cb129d24f4b611cfef00ef66ecff356 | Create API for batch | flaskapp/appname/controllers/batchAPI.py | flaskapp/appname/controllers/batchAPI.py | Python | 0.000001 | @@ -0,0 +1,756 @@
+from flask import Flask, jsonify, abort, request, session, Blueprint%0Afrom flask_restful import Resource, Api%0Afrom appname.models import (db, Batch)%0Afrom flask.ext.restless import APIManager%0Afrom flask.ext.sqlalchemy import SQLAlchemy%0A%0AbatchAPI = Blueprint('batchAPI', __name__)%0A%0A@batch... | |
7bcbd81ece25f5967248c650ee61e85e52c67203 | Add ComparisonOperator to enums | shuup/utils/enums.py | shuup/utils/enums.py | Python | 0 | @@ -0,0 +1,545 @@
+# -*- coding: utf-8 -*-%0A# This file is part of Shuup.%0A#%0A# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.%0A#%0A# This source code is licensed under the AGPLv3 license found in the%0A# LICENSE file in the root directory of this source tree.%0Afrom django.utils.translation impo... | |
c58de5a29fb324b9fcd661319e4b6df9b5f189c0 | fix an error in appeaser.py | axelrod/strategies/appeaser.py | axelrod/strategies/appeaser.py | from axelrod import Player
class Appeaser(Player):
"""
A player who tries to guess what the opponent wants, switching his
behaviour every time the opponent plays 'D'.
"""
def strategy(self, opponent):
"""
Start with 'C', switch between 'C' and 'D' when opponent plays 'D'.
"... | Python | 0.000129 | @@ -382,16 +382,51 @@
if
+len(opponent.history) %3E 0:%0A%09 if
opponent
@@ -447,20 +447,17 @@
= 'D':%0A%09
-
+%09
if self.
@@ -466,24 +466,28 @@
r == 'C':%0A%09%09
+
self.str = '
@@ -499,16 +499,17 @@
+%09
else:%0A%09%09
self
@@ -504,16 +504,20 @@
else:%0A%09%09
+
self.str
|
1ddadaab8086569fe4f13612710d8a47442a4bfd | Read data in pickles | data_handling.py | data_handling.py | Python | 0.000007 | @@ -0,0 +1,2276 @@
+import json%0Aimport pickle%0Aimport random%0A%0ADEFAULT_REVIEWS_FILE = %22data/yelp_academic_dataset_review.json%22%0ADEFAULT_REVIEWS_PICKLE = %22data/reviews.pickle%22%0A%0Adef pickles_from_json(json_file=DEFAULT_REVIEWS_FILE, pickle_name=DEFAULT_REVIEWS_PICKLE, num_partitions=100):%0A %22%22%2... | |
d26cc02d4ea3f625eee8deed67a42555245b977f | Implement KeOps MaternKernel | gpytorch/kernels/keops/matern_kernel.py | gpytorch/kernels/keops/matern_kernel.py | Python | 0.000001 | @@ -0,0 +1,2384 @@
+#!/usr/bin/env python3%0Aimport torch%0Aimport math%0Afrom pykeops.torch import LazyTensor as KEOLazyTensor%0Afrom ..kernel import Kernel%0Afrom gpytorch.lazy import KeOpsLazyTensor%0A%0A%0Aclass MaternKernel(Kernel):%0A def __init__(self, nu=2.5, **kwargs):%0A if nu not in %7B0.5, 1.5, 2.... | |
d459436992a1d21ab57e43d4c0baa9a1f6e46881 | fix uploader | source_data/etl_tasks/transform_upload.py | source_data/etl_tasks/transform_upload.py | import xlrd
import pandas as pd
from pprint import pprint
from django.conf import settings
from django.db import transaction
from pandas.io.excel import read_excel
from source_data.models import *
from source_data.etl_tasks.shared_utils import pivot_and_insert_src_datapoints
from datapoints.models import Source, Data... | Python | 0.000001 | @@ -1519,150 +1519,424 @@
s
-ource_datapoints = pivot_and_insert_src_datapoints(self.df,%5C%0A self.document.id,self.column_mappings)%0A%0A%0A batch
+elf.df.rename(columns=%0A %7B%0A self.column_mappings%5B'indicator_col'%5D: 'indicator_string',%0A ... |
baa4945944c2221212d123536ad6a7831b0b2d41 | reset unsub to None on timeout (#22404) | homeassistant/components/stream/core.py | homeassistant/components/stream/core.py | """Provides core stream functionality."""
import asyncio
from collections import deque
import io
from typing import List, Any
import attr
from aiohttp import web
from homeassistant.core import callback
from homeassistant.components.http import HomeAssistantView
from homeassistant.helpers.event import async_call_later... | Python | 0 | @@ -3554,24 +3554,51 @@
timeout.%22%22%22%0A
+ self._unsub = None%0A
if s
|
0da8cdda9046a15191b75374643c922ac66e98d3 | Set default 'editable' key in website's rendering context | addons/website/models/ir_ui_view.py | addons/website/models/ir_ui_view.py | # -*- coding: utf-8 -*-
import copy
import simplejson
import werkzeug
from lxml import etree, html
from openerp.addons.website.models import website
from openerp.http import request
from openerp.osv import osv, fields
class view(osv.osv):
_inherit = "ir.ui.view"
_columns = {
'inherit_option_id': fiel... | Python | 0 | @@ -5189,21 +5189,27 @@
t =
-context.copy(
+dict(editable=False
)%0A
@@ -5235,16 +5235,48 @@
update(%0A
+ context.copy(),%0A
|
c724e6f825c801c864c4498f6b35f2b0bb041b47 | add item shop | games/Item_Shop.py | games/Item_Shop.py | Python | 0 | @@ -0,0 +1,124 @@
+from items import *%0A%0Aclass Item_Shop():%0A def __init__(self):%0A %09self.items = %5B%5D%0A%0A def prepare_items(self):%0A %09pass
| |
693d4db7b3dad61bbfda34463330951f64fcedc7 | Use fst module in feature distribution fit to json example | examples/distribution_to_json.py | examples/distribution_to_json.py | #!/usr/bin/env python
# Copyright (c) 2015, Ecole Polytechnique Federale de Lausanne, Blue Brain Project
# All rights reserved.
#
# This file is part of NeuroM <https://github.com/BlueBrain/NeuroM>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the fo... | Python | 0 | @@ -1914,19 +1914,19 @@
import
-ezy
+fst
%0Afrom ne
@@ -2431,36 +2431,43 @@
ure
-available for the ezy.neuron
+to be extracted with neurom.fst.get
')%0A%0A
@@ -2786,24 +2786,27 @@
n =
-ezy
+fst
.load_
-neur
+populati
on
-s
(dat
@@ -2837,256 +2837,48 @@
a =
-%5Bgetattr(n, 'get_' + feature)() for n in popul... |
28d07102411cbd019bdac97ce6e1251af3bffd35 | Add migration for Image | icekit/migrations/0006_image_imageitem.py | icekit/migrations/0006_image_imageitem.py | Python | 0 | @@ -0,0 +1,1942 @@
+# -*- 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 ('fluent_contents', '0001_initial'),%0A ('icekit', '0005_remove_layout_key'),%0A %5D%0A%0A ... | |
8f3b0928a7d12da534d18e14d29f504eb432de97 | Create beta_password_generator.py | Solutions/beta/beta_password_generator.py | Solutions/beta/beta_password_generator.py | Python | 0.001452 | @@ -0,0 +1,347 @@
+from random import randint%0Aimport re%0A%0AABC = %22abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345678901234567890123456789%22%0A%0Adef password_gen():%0A password = ''.join(ABC%5Brandint(0,81)%5D for i in range(0, randint(6, 20)))%0A return password if re.fullmatch('(?=.*%5Ba-z%5D)... | |
7ac8748c4c48386208d9220d6f265ea7ac00560a | Fix Xcode 4.x debugger build | gyp/debugger.gyp | gyp/debugger.gyp | {
'targets': [
{
'target_name': 'debugger',
'type': 'executable',
'include_dirs' : [
'../src/core',
'../debugger', # To pull SkDebugger.h
'../debugger/QT', # For all the QT UI Goodies
'../src/gpu', # To pull gl/GrGLUtil.h
],
'sources': [
'../de... | Python | 0.99886 | @@ -2616,16 +2616,98 @@
e' : 1,%0A
+ 'mac_framework_dirs': %5B%0A '/Library/Frameworks',%0A %5D,%0A
|
df03481fd9b52e17bc637dacefd15bead4f07f23 | Add initial version of membership fee updater | project/creditor/management/commands/update_membershipfees.py | project/creditor/management/commands/update_membershipfees.py | Python | 0 | @@ -0,0 +1,1336 @@
+# -*- coding: utf-8 -*-%0Aimport datetime%0Aimport dateutil.parser%0A%0Afrom creditor.models import RecurringTransaction, TransactionTag%0Afrom creditor.tests.fixtures.recurring import MembershipfeeFactory%0Afrom django.core.management.base import BaseCommand, CommandError%0Afrom members.models impo... | |
d38007954c927e38112c5500ba6f8328f8d4a66d | add command `manage.py drop [user_id]` | pergenie/apps/db/management/commands/drop.py | pergenie/apps/db/management/commands/drop.py | Python | 0 | @@ -0,0 +1,2820 @@
+# -*- coding: utf-8 -*-%0A%0Aimport sys, os%0Aimport glob%0Aimport shutil%0Afrom pprint import pprint%0Afrom optparse import make_option%0A%0Afrom pymongo import MongoClient%0A# from termcolor import colored%0Afrom django.core.management.base import BaseCommand%0Afrom django.conf import settings%0Af... | |
4e8ff1f7e524d8dc843816c714e86d11e21a8562 | Add script to upload files to carto db | uploadtoCDB.py | uploadtoCDB.py | Python | 0 | @@ -0,0 +1,1210 @@
+#uploadtoCDB.py%0A#Written By: Alejandro Morejon Cortina (Apr 2016)%0A#usage:python uploadtoCDB.py %3Cusername%3E %3Cfilecontainingkey.txt%3E %3Cupload.csv%3E%0A%0Aimport sys%0Aimport requests%0Aimport csv%0Aimport json%0Aimport time%0A%0A#sys.argv%5B1%5D is the your cartodb user name%0A#sys.argv%5B... | |
701d8ef1c4d97d7c58adca892992cc38bee321d5 | Update app/helpers/marshmallow/__init__.py | app/helpers/marshmallow/__init__.py | app/helpers/marshmallow/__init__.py | Python | 0 | @@ -0,0 +1,563 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import absolute_import%0A%0Afrom .schema import (%0A TableSchemaOpts,%0A ModelSchemaOpts,%0A TableSchema,%0A ModelSchema,%0A)%0A%0Afrom .convert import (%0A ModelConverter,%0A fields_for_model,%0A property2field,%0A column2field,%0A ... | |
fa88245727ec8dbf5ed341bb9d5d0816a33e9415 | Create Calendar.py | Calendar.py | Calendar.py | Python | 0.000001 | @@ -0,0 +1,2041 @@
+%22%22%22%0ACreated on 3/26/27%0ACreated for Codeacademy Training exersize.%0AWritten by: Jason R. Pittman%0ANote: All comments are my own for information purpose and future building ideas.%0ANote: They reflect my ideas and my ideas alone%0AThis is a calendar program for Command Line. %0A%0AThe prog... | |
7135d1818d638f41df51749037dbde33fc133cab | Add a release string message in case of total failure. | sc2reader/scripts/sc2parse.py | sc2reader/scripts/sc2parse.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script is intended for use debugging parse issues on replays.
sc2parse [FILES..]
Recursively parses all the files. When exceptions are thrown it catches them
and attempts to print out any information that might be needed for debug. If
information you need isn... | Python | 0.000001 | @@ -3189,16 +3189,109 @@
evel=0)%0A
+ print 'Total failure parsing %7Brelease_string%7D'.format(**replay.__dict__)%0A
@@ -3445,36 +3445,16 @@
print%0A
-
%0A%0A%0Aif __
|
1b5f8568ae0a7760f7247149bcff481efc000f32 | Add redis option to footer | readthedocs/restapi/views/footer_views.py | readthedocs/restapi/views/footer_views.py | from django.shortcuts import get_object_or_404
from django.template import RequestContext, loader as template_loader
from django.conf import settings
from rest_framework import decorators, permissions
from rest_framework.renderers import JSONPRenderer, JSONRenderer
from rest_framework.response import Response
from re... | Python | 0 | @@ -1992,16 +1992,29 @@
(request
+, redis=False
):%0A p
@@ -6236,22 +6236,101 @@
-promo_obj.incr
+if redis:%0A promo_obj.incr('offers')%0A else:%0A promo_obj.incr_redis
('of
|
bd312a1fd7a9633316b03d1473de84979120ae5f | Add sentiment generator | rojak-database/generate_sentiment_data.py | rojak-database/generate_sentiment_data.py | Python | 0.000011 | @@ -0,0 +1,711 @@
+import MySQLdb as mysql%0Afrom faker import Factory%0A%0A# Open database connection%0Adb = mysql.connect('localhost', 'root', 'rojak', 'rojak_database')%0A%0A# Create new db cursor%0Acursor = db.cursor()%0A%0Asql = '''%0AINSERT INTO %60sentiment%60(%60name%60)%0AVALUES ('%7B%7D');%0A'''%0A%0AMAX_SENT... | |
46de363a67bc1bf7bd403625618bfd4b319c230b | Add dein/log source | rplugin/python3/denite/source/dein_log.py | rplugin/python3/denite/source/dein_log.py | Python | 0.000001 | @@ -0,0 +1,1967 @@
+# ============================================================================%0A# FILE: dein.py%0A# AUTHOR: delphinus %3Cdelphinus@remora.cx%3E%0A# License: MIT license%0A# ============================================================================%0A%0Aimport re%0Afrom denite.source.base import B... | |
b5d472d52cfa204ab400632ed542305c90faa137 | Trim errant param in docstring; #983 | gittip/elsewhere/bountysource.py | gittip/elsewhere/bountysource.py | import os
import md5
import time
from gittip import db
from gittip.models import Participant
from gittip.elsewhere import AccountElsewhere, _resolve
www_host = os.environ['BOUNTYSOURCE_WWW_HOST'].decode('ASCII')
api_host = os.environ['BOUNTYSOURCE_API_HOST'].decode('ASCII')
class BountysourceAccount(AccountElsewhere)... | Python | 0 | @@ -2541,60 +2541,8 @@
nt%0A%0A
- :param user:%0A currently logged in user.%0A%0A
|
06290c7ddd164ab508207713e5dff304a1907986 | Create Pedidolistar.py | backend/Models/Grau/Pedidolistar.py | backend/Models/Grau/Pedidolistar.py | Python | 0 | @@ -0,0 +1,337 @@
+from Framework.Pedido import Pedido%0Afrom Framework.ErroNoHTTP import ErroNoHTTP%0A%0Aclass PedidoListar(Pedido):%0A%0A%09def __init__(self,variaveis_do_ambiente):%0A%09%09super(PedidoListar, self).__init__(variaveis_do_ambiente)%0A%09%09try:%0A%09%09%09%0A%09%09%09self.nome = self.corpo%5B'nome'%5D... | |
deb1987bcfb04a773cbc2e826a6d61790a95759b | Create KeepHorizontalHand.py | home/juerg/KeepHorizontalHand.py | home/juerg/KeepHorizontalHand.py | Python | 0 | @@ -0,0 +1,438 @@
+i01 = Runtime.start(%22i01%22, %22InMoov%22)%0Ahand = i01.startRightHand(%22COM15%22)%0Aarduino = Runtime.getService(%22i01.right%22)%0A%0AkeepHorizontalOutPin = 13%0Aboolean keepHorizontal = False%0A%0Adef keepHorizontalStart():%0A arduino.digitalWrite(keepHorizontalOutPin, 1)%0A keepHorizontal = ... | |
cd44a9c7157f637ebeb289af11067d6c0d217fe9 | add errors and debugging example | examples/errors-and-debugging.py | examples/errors-and-debugging.py | Python | 0.000001 | @@ -0,0 +1,1100 @@
+#%0A# Copyright (c) 2014 NSONE, Inc.%0A#%0A# License under The MIT License (MIT). See LICENSE in project root.%0A#%0A%0Afrom nsone import NSONE, Config%0A%0A# to enable verbose logging, set 'verbosity' in the config and use%0A# the standard python logging system%0A%0Aconfig = Config()%0Aconfig.creat... | |
70cec0f09d35c2ad202a3adc3d15bc7597de1b7a | Add monkey-patch test | tests/test_monkey_patch.py | tests/test_monkey_patch.py | Python | 0.000001 | @@ -0,0 +1,847 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A# Path hack%0Aimport os, sys%0Asys.path.insert(0, os.path.abspath('..'))%0A%0Aimport unittest%0Aimport time%0Aimport json%0Afrom collections import defaultdict%0A%0Aimport requests%0Afrom requests import Request%0A%0Aimport requests_cache%0Afrom reque... | |
7c41770adac83bcb00424649d7d248e996363e9b | add 1st test | tests/em/nsem/forward/test_Recursive1D_VsAnalyticHalfspace.py | tests/em/nsem/forward/test_Recursive1D_VsAnalyticHalfspace.py | Python | 0.000001 | @@ -0,0 +1,1840 @@
+import unittest%0Afrom SimPEG.electromagnetics import natural_source as nsem%0Afrom SimPEG import maps%0Aimport numpy as np%0Afrom scipy.constants import mu_0%0A%0A%0Adef create_survey(freq):%0A%0A receivers_list = %5B%0A nsem.receivers.AnalyticReceiver1D(component='real'),%0A nsem.... | |
d1ca69d9b84fbcd034ee53e50de30fe48a0869a8 | add migration to grandfather odata feed privileges to advanced and above plans | corehq/apps/accounting/migrations/0044_grandfather_odata_privs.py | corehq/apps/accounting/migrations/0044_grandfather_odata_privs.py | Python | 0 | @@ -0,0 +1,721 @@
+# Generated by Django 1.11.21 on 2019-10-07 13:21%0A%0Afrom django.core.management import call_command%0Afrom django.db import migrations%0A%0Afrom corehq.privileges import ODATA_FEED%0Afrom corehq.util.django_migrations import skip_on_fresh_install%0A%0A%0A@skip_on_fresh_install%0Adef _grandfather_o... | |
c2be8321712c46e1f94dae42f5003e960e8330c3 | Create hp.py | hp.py | hp.py | Python | 0.000003 | @@ -0,0 +1,988 @@
+import os,sys,socket%0A%0Aprinter = socket.socket()%0A%0A%22%22%22%0APerl stuff -%3E%0A%5Ce%25-12345X%5C@PJL JOB%0A%5C@PJL RDYMSG DISPLAY=%22Hello%22%0A%5C@PJL EOJ%0A%5Ce%25-12345X%0A%0AUEL = chr(0x1B)+chr(0x25)+chr(0x2D)+chr(0x31)+chr(0x32)+chr(0x33)+chr(0x34)+chr(0x35)+chr(0x58)%0Abuf = UEL + '...@... | |
bee511bc002395b3c55e7bd7664947857fd402da | Add bst.py | bst.py | bst.py | Python | 0.000003 | @@ -0,0 +1,2480 @@
+import random%0Afrom tabulate import tabulate%0A%0A%0Aclass Node:%0A def __init__(self, value, parent=None):%0A self.value = value%0A self.left = None%0A self.right = None%0A self.parent = parent%0A%0A%0Aclass BST:%0A def __init__(self):%0A self.root = None%0... | |
5244eaa269118036b255edfb51a3bd72dc9b0320 | Add migration for reviews subscriptions (#10) | osf/migrations/0061_auto_20171002_1438.py | osf/migrations/0061_auto_20171002_1438.py | Python | 0 | @@ -0,0 +1,1862 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.4 on 2017-10-02 19:38%0Afrom __future__ import unicode_literals%0A%0Aimport logging%0A%0Afrom django.db import migrations%0A%0Afrom osf.models import OSFUser%0Afrom osf.models import NotificationSubscription%0Afrom website.notifications.utils impo... | |
8955c00cdf3715b0f6403e9d049c0e221f77f7ac | Add helper script for testing | client.py | client.py | Python | 0 | @@ -0,0 +1,475 @@
+#!/usr/bin/env python%0A%0Aimport chess%0Aimport chess.pgn%0Aimport requests%0Aimport random%0A%0Agame = chess.pgn.Game()%0Anode = game%0A%0Aboard = game.board()%0A%0Awhile not board.is_game_over(claim_draw=True):%0A move = random.choice(list(board.legal_moves))%0A node = node.add_variation(mov... | |
92840c5dc58e78bd41d4a3c7eaec58097f166585 | add spider example, crawls entry titles | justitie/just/spiders/test.py | justitie/just/spiders/test.py | Python | 0 | @@ -0,0 +1,641 @@
+# -*- coding: utf-8 -*-%0Aimport scrapy%0Afrom scrapy.loader import ItemLoader%0A%0Afrom items import JustPublication%0A%0Aclass TestSpider(scrapy.Spider):%0A name = %22test%22%0A%0A def start_requests(self):%0A yield scrapy.Request(%0A url=%22http://www.just.ro/transparenta-d... | |
1f476db6a86831b2b1462cdd3b27e8f2ae3d2187 | Drop old_content table | alembic/versions/3d9034ad2d7d_really_drop_old_content.py | alembic/versions/3d9034ad2d7d_really_drop_old_content.py | Python | 0.000001 | @@ -0,0 +1,386 @@
+%22%22%22really drop old content%0A%0ARevision ID: 3d9034ad2d7d%0ARevises: 1dd2771cbf39%0ACreate Date: 2015-03-29 12:01:54.276288%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '3d9034ad2d7d'%0Adown_revision = '1dd2771cbf39'%0Abranch_labels = None%0Adepends_on = None%0A%0Af... | |
5d500abee0ee7653604d2e70874b4ebeffc5cd6d | Add an I/O cache to FS config even if there's just an "L2" cache. | configs/example/fs.py | configs/example/fs.py | # Copyright (c) 2006-2007 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this ... | Python | 0 | @@ -4600,24 +4600,43 @@
tions.caches
+ or options.l2cache
:%0A test_s
|
2184f523c0861e308c225488b1b43f2694431371 | Fix timezone dependency and added dryrun mode | jenkins/janitor.py | jenkins/janitor.py | #!/usr/bin/env python
# Copyright 2016 The Kubernetes Authors.
#
# 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 appli... | Python | 0 | @@ -671,20 +671,8 @@
son%0A
-import pytz%0A
impo
@@ -685,16 +685,16 @@
process%0A
+
import s
@@ -736,50 +736,8 @@
ple%0A
-from dateutil import parser as dateparser%0A
%0A%0A#
@@ -1889,16 +1889,65 @@
mat=json
+(name,creationTimestamp.date(tz=UTC),zone,region)
',%0A
@@ -2536,27 +2536,37 @@
d = date
-parser... |
380acef9c27a2445366eaec88acdf9672bdeb3c1 | test class for FeedbackFeedTimelineBuilder | devilry/devilry_group/tests/test_feedbackfeed_timeline_builder.py | devilry/devilry_group/tests/test_feedbackfeed_timeline_builder.py | Python | 0.000001 | @@ -0,0 +1,1457 @@
+import devilry%0Afrom django.test import RequestFactory, TestCase%0Afrom django.utils import timezone%0Aimport htmls%0Aimport mock%0Afrom model_mommy import mommy%0Afrom devilry.devilry_group.views.feedbackfeed_student import StudentFeedbackFeedView%0Afrom devilry.devilry_group.views.feedbackfeed_ti... | |
80a1cc839abc23a80b511c99e6a6c03b044eaf35 | Add downloader for per-polling-station data | ext_download.py | ext_download.py | Python | 0 | @@ -0,0 +1,1491 @@
+import argparse%0Aimport glob%0Aimport json%0A%0Afrom kvd_utils import download_json, get_session%0A%0Aext_url_template = 'https://vaalit.yle.fi/content/kv2017/%7Bversion%7D/electorates/%7Belectorate%7D/municipalities/%7Bmunicipality%7D/pollingDistricts/%7Bdistrict%7D/partyAndCandidateResults.json'%... | |
c47ace2e77f87a2a249b8e43c4611c80e63bbe03 | add verification for util/hosts.py | ceph_medic/tests/util/test_hosts.py | ceph_medic/tests/util/test_hosts.py | Python | 0 | @@ -0,0 +1,2701 @@
+import pytest%0Afrom ceph_medic.util import hosts, configuration%0Aimport ceph_medic%0Afrom textwrap import dedent%0A%0A%0Aclass TestContainerPlatform(object):%0A%0A def test_unable_to_retrieve_pods(self, stub_check):%0A stub_check((%5B%5D, %5B'error from command'%5D, 1))%0A%0A with... | |
574b069363f74de35b75b6b28ca66976e6af45bb | Fix situation where session id is an int | corehq/apps/smsforms/management/commands/migrate_sms_sessions_to_sql.py | corehq/apps/smsforms/management/commands/migrate_sms_sessions_to_sql.py | import logging
from django.core.management.base import BaseCommand
from corehq.apps.smsforms.models import XFormsSession, sync_sql_session_from_couch_session, SQLXFormsSession
from dimagi.utils.couch.database import iter_docs
class Command(BaseCommand):
args = ""
help = ""
def handle(self, *args, **optio... | Python | 0.000021 | @@ -537,16 +537,305 @@
try:%0A
+ # Handle the old touchforms session id convention where it was%0A # always an int%0A session_id = session_doc.get(%22session_id%22, None)%0A if isinstance(session_id, int):%0A session_doc%5B%22session_id%... |
36c31f33818c04e9122c8a5dcd325420bef94e56 | add simplisitc test for demumble | demumble_test.py | demumble_test.py | Python | 0.000005 | @@ -0,0 +1,545 @@
+from __future__ import print_function%0A%0Atests = %5B%0A ('demumble', ''),%0A ('demumble hello', 'hello%5Cn'),%0A ('demumble _Z4funcPci', 'func(char*, int)%5Cn'),%0A ('demumble ?Fx_i@@YAHP6AHH@Z@Z', 'int __cdecl Fx_i(int (__cdecl*)(int))%5Cn'),%0A%5D%0A%0Aimport os, subprocess%0Afor t in... | |
6942ff1fee4f3c6a6c17b395b89593bc92946e6a | Use previous values | python/thunder/factorization/ica.py | python/thunder/factorization/ica.py | # ica <master> <inputFile> <outputFile> <k> <c>
#
# performs ICA
#
# k - number of principal components to use before ica
# c - number of independent components to find
#
# example:
#
# pyspark ica.py local data/sigs.txt results 4 4
#
import sys
import os
from numpy import random, sqrt, zeros, real, dot, outer, diag, ... | Python | 0.000009 | @@ -365,16 +365,45 @@
v, orth%0A
+from scipy.io import loadmat%0A
from thu
@@ -1098,16 +1098,17 @@
onality%0A
+#
comps, l
@@ -1159,16 +1159,17 @@
en data%0A
+#
whtMat =
@@ -1211,16 +1211,17 @@
comps))%0A
+#
unwhtMat
@@ -1272,17 +1272,16 @@
nt))))%0A%0A
-#
whtMat =
@@ -1326,17 +1326,16 @@
htMat'%5D%0A
-#
unw... |
803d62323c85cd9e29176f32b1094c5daca3c2dd | add wrapper for CHOLMOD cholesky factor object | polara/lib/cholesky.py | polara/lib/cholesky.py | Python | 0 | @@ -0,0 +1,920 @@
+class CholeskyFactor:%0A def __init__(self, factor):%0A self._factor = factor%0A self._L = None%0A self._transposed = False%0A%0A @property%0A def L(self):%0A if self._L is None:%0A self._L = self._factor.L()%0A return self._L%0A%0A @property%... | |
1fff1dba9ac1d2fa1a825e87d36d46ce0ddec894 | Add distributions.py | distributions.py | distributions.py | Python | 0.000001 | @@ -0,0 +1,1433 @@
+%0Aimport theano.tensor as T%0Afrom numpy import inf%0Afrom math import pi%0A%0Adef alltrue(vals):%0A ret = 1%0A for c in vals:%0A ret = ret * (1 * c)%0A return ret%0A%0Adef bound(logp, *conditions):%0A return T.switch(alltrue(conditions), logp, -inf)%0A%0Aclass Distribution:%0A ... | |
1323086d7d948253cd26e186af7fc16752b642a9 | Add main app | json-beautifier.py | json-beautifier.py | Python | 0.000001 | @@ -0,0 +1,1465 @@
+from google.appengine.api import memcache%0Afrom webapp2_extras.security import generate_random_string%0Aimport jinja2%0Aimport json%0Aimport os%0Aimport webapp2%0A%0AMEMCACHE_EXPIRE = 5 * 60 # seconds%0A%0AJINJA_ENVIRONMENT = jinja2.Environment(%0A loader=jinja2.FileSystemLoader(os.path.dirname(... | |
c0aa90403183b47cd3c40afba5267d0e305cf1ca | add new module | dbn/utils.py | dbn/utils.py | Python | 0.000001 | @@ -0,0 +1,1473 @@
+import numpy as np%0A%0A%0Adef batch_generator(batch_size, data, labels=None):%0A %22%22%22%0A Generates batches of samples%0A :param data: array-like, shape = (n_samples, n_features)%0A :param labels: array-like, shape = (n_samples, )%0A :return:%0A %22%22%22%0A n_batches = int... | |
4136eca2c09fcd3d12b147b2d1d7a11a12fbd94d | Add logcatPkg | logcatPkg.py | logcatPkg.py | Python | 0.000004 | @@ -0,0 +1,777 @@
+#!/usr/bin/env python%0A#coding:utf-8%0A#author:andrewallanwallace@gmail.com%0A#This script is aimed to grep logs by application(User should input a packageName and then we look up for the process ids then separate logs by process ids).%0A%0Aimport os%0Aimport sys%0A%0ApackageName=str(sys.argv%5B1%5D... | |
03735a85521f43ce7af9db7bb1762e3e395bc154 | Solve knowit2017/dec15 | knowit2017/15.py | knowit2017/15.py | Python | 0.998983 | @@ -0,0 +1,779 @@
+def cut_trees(trees):%0A cut = %5B%5D%0A %0A while trees:%0A cut.append(len(trees))%0A lowest = min(trees)%0A %0A trees = %5Btree - lowest for tree in trees if (tree - lowest) %3E 0%5D%0A%0A return cut%0A%0Adef test_cut_trees():%0A assert %5B6, 4, 2, 1%5D ==... | |
28a2ee23218ee767e2e0ed0e9cc7228813bbfc33 | Fix docstring lies and minor code cleanup, no functional change | lepton/system.py | lepton/system.py | #############################################################################
#
# Copyright (c) 2008 by Casey Duncan and contributors
# All Rights Reserved.
#
# This software is subject to the provisions of the MIT License
# A copy of the license should accompany this distribution.
# THE SOFTWARE IS PROVIDED "AS IS", W... | Python | 0 | @@ -774,22 +774,8 @@
lers
- and renderers
, if
@@ -832,20 +832,8 @@
ers
-and renders
to p
@@ -938,37 +938,8 @@
ple(
-controller for controller in
glob
@@ -3044,16 +3044,17 @@
from you
+r
Pyglet
|
a330a2a2d2a0706815c274e5a19409e0306ef26d | add script to generate a readkey | get_read_key.py | get_read_key.py | Python | 0.000001 | @@ -0,0 +1,1152 @@
+#!/usr/bin/env python%0A# vim: set expandtab sw=4 ts=4:%0A# Generate a read key for Keen.io trends%0A#%0A# Copyright (C) 2014 Dieter Adriaenssens %3Cruleant@users.sourceforge.net%3E%0A#%0A# This file is part of buildtime-trend%0A# %3Chttps://github.com/ruleant/buildtime-trend/%3E%0A#%0A# This progra... | |
d87d75a412013c54d6bf3855078f0272518f17eb | fix PY-14506 Deadlock during debugging of PyQt5 application | python/helpers/pydev/pydev_monkey_qt.py | python/helpers/pydev/pydev_monkey_qt.py | from __future__ import nested_scopes
def set_trace_in_qt():
import pydevd_tracing
from pydevd_comm import GetGlobalDebugger
debugger = GetGlobalDebugger()
if debugger is not None:
pydevd_tracing.SetTrace(debugger.trace_dispatch)
_patched_qt = False
def patch_qt():
'''
... | Python | 0 | @@ -2698,24 +2698,63 @@
le.__init__%0A
+ _original_QThread = QtCore.QThread%0A
%0A %0A
@@ -3690,25 +3690,17 @@
QThread%0A
-
%0A
+
@@ -3768,37 +3768,360 @@
read_init(self)%0A
+%0A
-%0A
+ # In PyQt5 the program hangs when we try to call original run method of QThread class.... |
884f2d1620ae4eefe555ed9523a4e5504cd804ed | add test for MICE | test/imputations/cs/test_mice.py | test/imputations/cs/test_mice.py | Python | 0 | @@ -0,0 +1,971 @@
+%22%22%22test_mice.py%22%22%22%0Aimport unittest%0Aimport numpy as np%0Afrom impyute.datasets import test_data%0Afrom impyute.imputations.cs import mice%0A%0A%0Aclass TestEM(unittest.TestCase):%0A %22%22%22 Tests for Multivariate Imputation by Chained Equations%22%22%22%0A def setUp(self):%0A ... | |
0e2cd05c8a7b876fedcb80e0ee26e9ae1c21f607 | Create extras.py | extras.py | extras.py | Python | 0.000001 | @@ -0,0 +1,245 @@
+# -*- coding: utf-8 -*-%0Awarnlist =%5B%227500%22,%227600%22,%227700%22,%220020%22,%220037%22%5D%0Asqkinfo = %7B%0A%227500%22:%22ENTF%C3%9CHRUNG%22,%0A%227600%22:%22FUNKAUSFALL%22,%0A%227700%22:%22NOTFALL%22,%0A%227000%22:%22VFR-zivil%22,%0A%220037%22:%22BPO mit Restlicht%22,%0A%221000%22:%22IFR%22,%... | |
df258636e65cce98ac0213cdf6f7f830f9cd7656 | Add sfp_instagram | modules/sfp_instagram.py | modules/sfp_instagram.py | Python | 0.999251 | @@ -0,0 +1,3164 @@
+#-------------------------------------------------------------------------------%0A# Name: sfp_instagram%0A# Purpose: Gather information from Instagram profiles.%0A#%0A# Author: %3Cbcoles@gmail.com%3E%0A#%0A# Created: 2019-07-11%0A# Copyright: (c) bcoles 2019%0A# Licence: G... | |
978f9c92f159b687c7238cfdd3ab30b8a15f5b9e | Add the multiprocessing example | multiprocessing_subprocess.py | multiprocessing_subprocess.py | Python | 0.000001 | @@ -0,0 +1,2279 @@
+#!/usr/bin/env python%0A%0Aimport os%0Aimport sys%0Aimport subprocess%0Afrom multiprocessing import Process, Queue%0A%0Adef run_command_live(args, cwd=None, shell=True, checkrc=False, workerid=None):%0A%0A %22%22%22 Show realtime output for a subprocess %22%22%22%0A%0A p = subprocess.Popen(arg... | |
429bb8998cebe672774dd4b5b8b1188941227568 | add craftr/libs/opencl module | src/libs/opencl/__init__.py | src/libs/opencl/__init__.py | Python | 0 | @@ -0,0 +1,982 @@
+%0Anamespace = 'craftr/libs/opencl'%0A%0Aimport os, sys%0Aimport craftr, %7Bpath%7D from 'craftr'%0Aimport cxx from 'craftr/lang/cxx'%0A%0Avendor = craftr.options.get('opencl.vendor', None)%0Aif not vendor:%0A raise EnvironmentError('option not set: opencl.vendor')%0A%0Aif vendor == 'intel':%0A sdk... | |
d03938dfbab4301c0a302df6ae8418927049b8f5 | add types.py | obp/types.py | obp/types.py | Python | 0.000001 | @@ -0,0 +1,369 @@
+# Copyright (c) ZOZO Technologies, Inc. All rights reserved.%0A# Licensed under the Apache 2.0 License.%0A%0A%22%22%22Types.%22%22%22%0Afrom typing import Union, Dict%0Aimport numpy as np%0A%0Afrom .policy import BaseContextFreePolicy, BaseContextualPolicy%0A%0A# dataset%0ABanditFeedback = Dict%5Bstr... | |
faeb52d76b4dd66a60d34598a79becee26dc121e | Add the page handler for static routing. | handler/page.py | handler/page.py | Python | 0 | @@ -0,0 +1,131 @@
+class AboutHandler(BaseHandler):%0A%0Aclass FaqHandler(BaseHandler):%0A%0Aclass RobotsHandler(BaseHandler):%0A%0Aclass ApiHandler(BaseHandler):
| |
814e041dc91c76da03b30d0c5e48e9a146fe6850 | add a custom decorator to implement two legged API authentication | chunked_uploads/utils/decorators.py | chunked_uploads/utils/decorators.py | Python | 0 | @@ -0,0 +1,1154 @@
+from django.http import HttpResponse%0Afrom django.conf import settings%0Aimport oauth2%0Afrom django.contrib.sites.models import Site%0Atry: from functools import wraps%0Aexcept ImportError: from django.utils.functional import wraps # Python 2.4 fallback.%0A%0Adef oauth_required(view_func):%0A %... | |
e37c2c7e90a3376d2e2b11e88048cd841ca42a62 | Remove unused dependency on kivy.utils | driveshare_ui.py | driveshare_ui.py | #
# The Kivy interface for DriveShare.
#
# me@leefallat.ca - 2014
#
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen, NoTransition
from kivy.properties import Property
from kivy.properties import StringProperty
from kivy.properties import ObjectProperty
fr... | Python | 0.000001 | @@ -738,26 +738,8 @@
nfig
-%0Aimport kivy.utils
%0A%0Aim
|
3f0f00a0767a6f169fed57e1c21cff7b85239464 | Create hooke_jeeves.py | hooke_jeeves.py | hooke_jeeves.py | Python | 0 | @@ -0,0 +1,2058 @@
+def hooke_jeeves(evalf, x0, s, a=1, r=0.5, kmax=1e5, smin=1e-6):%0A import numpy as np%0A import scipy as sp%0A # Hooke and Jeeves %0A k = 0 # function evaulation counter%0A n = x0.size%0A %0A # first step%0A xb = x0%0A fxb = evalf(xb); k += 1%0A %0A x, fx = p... | |
312c55f41e818c8df155c97eabcde1d7ca262961 | add a beamdyn case execution script | reg_tests/lib/executeBeamdynCase.py | reg_tests/lib/executeBeamdynCase.py | Python | 0 | @@ -0,0 +1,2476 @@
+#%0A# Copyright 2017 National Renewable Energy Laboratory%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.... | |
102e8c17ca25a8fbd55212482be572ec32bfefd7 | check in a second test client | slowTiles.py | slowTiles.py | Python | 0 | @@ -0,0 +1,551 @@
+#!/usr/bin/env python%0A%0A%22%22%22Test times and sizes of some particularly large or difficult tiles.%22%22%22%0A%0Aimport requests, time, grequests%0A%0Aurlbase = 'http://127.0.0.1:8000'%0Afor spot in ('7/25/49', '6/13/23', '5/6/11', '5/7/12', '4/3/6'):%0A url = %22%7B%7D/mergedRivers/%7B%7D.js... | |
c5c7f416e5722fade968c9c65032d7f88759a08d | add model of a subject | model/subject.py | model/subject.py | Python | 0.000001 | @@ -0,0 +1,943 @@
+# coding: utf-8%0A%0Afrom datetime import datetime%0A%0A%0Aclass Subject(object):%0A%0A def __init__(self, id, text, create_time=None, update_time=None):%0A self.subject_id = str(id)%0A self.subject_text = text%0A self.create_time = create_time%0A self.update_time = upd... | |
92f49298f22f412a11ad7e51c630107b0e191ff5 | Add CAN_DETECT info | bears/configfiles/DockerfileLintBear.py | bears/configfiles/DockerfileLintBear.py | import json
from coalib.bearlib.abstractions.Linter import linter
from coalib.bears.requirements.NpmRequirement import NpmRequirement
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
from coalib.results.Result import Result
@linter(executable='dockerfile_lint')
class DockerfileLintBear:
"""
Check f... | Python | 0 | @@ -815,16 +815,53 @@
GPL-3.0'
+%0A CAN_DETECT = %7B'Syntax', 'Smell'%7D
%0A%0A se
|
68ee23dd0f145e82ce0f3c0c66109ee435eadc25 | Add programs button element | src/lib/constants/element/page_header/lhn_menu/button_programs.py | src/lib/constants/element/page_header/lhn_menu/button_programs.py | Python | 0.000001 | @@ -0,0 +1,41 @@
+SELECTOR = '%5Bdata-model-name=%22Program%22%5D'%0A
| |
23f626ddaabfa799da48ee35c29db05f95f8a732 | Add import script for Rhondda Cynon Taff | polling_stations/apps/data_collection/management/commands/import_rct.py | polling_stations/apps/data_collection/management/commands/import_rct.py | Python | 0 | @@ -0,0 +1,2791 @@
+%22%22%22%0AImport Rhondda Cynon Taf%0A%0Anote: this script takes quite a long time to run%0A%22%22%22%0Afrom time import sleep%0Afrom django.contrib.gis.geos import Point%0Afrom data_collection.management.commands import BaseAddressCsvImporter%0Afrom data_finder.helpers import geocode%0Afrom data_c... | |
93fb79bfc3242f991c03f59f0f6991a09e9421d9 | Create insert.py | insert.py | insert.py | Python | 0.000001 | @@ -0,0 +1,80 @@
+x = %5B1,2,3%5D%0Ax.insert(1, 1) // Insert 1 into the list 1 //%0A%0Ax = %5B1,1,2,3%5D%0A
| |
f6c11bf0d3b8960561ce0f2433193543c1f63609 | Add Assignment_1 | programming_with_python/assignment_1/refactored_random_walk.py | programming_with_python/assignment_1/refactored_random_walk.py | Python | 0.000005 | @@ -0,0 +1,1674 @@
+#!/usr/bin/env python3%0A%0Aimport random%0Aimport sys%0Aimport math%0A%0Adef get_random_direction():%0A%09direction = %22%22%0A%09probability = random.random()%0A%0A%09if probability %3C 0.25:%0A%09%09direction = %22west%22%0A%09%09displacements = (-1, 0)%0A%09elif probability %3E= 0.25 and probabi... | |
db7534a83986e404d7f8ed02d42dfa76918d5126 | Create regExpTest.py | regExpTest.py | regExpTest.py | Python | 0.000001 | @@ -0,0 +1,1595 @@
+#!/usr/bin/python%0A%0A#import the necessary modules%0Aimport re # the regexp module%0A%0A%0A%0A# define the necessary fcns%0Adef lookForCmd( theCommand ):%0A%09for commandIndex, commandAgainst in enumerate( commandsToMatchList ): # works %3E but the above is used to fetch the index AND the item (..... | |
6a47701ea874e657475542809ac0f9320063cb9b | Add script to help create release zip | releasezip.py | releasezip.py | Python | 0 | @@ -0,0 +1,742 @@
+import os%0Aimport sys%0Aimport zipfile%0A%0Adef zipdir(path, ziph):%0A # ziph is zipfile handle%0A for root, dirs, files in os.walk(path):%0A for file in files:%0A ziph.write(os.path.join(root, file))%0A %0Adef main(version) :%0A release = zipfile.ZipFile('relea... | |
8f5a53afe8538b1c51dcb3bbe4cfafcdb4d7a405 | Remove WakeUp* import calls from ast/__init__.py I had recently committed a patch that removed the WakeUp*.py files from the slicc/ast directory. I had forgotten to remove the import calls for these files from slicc/ast/__init__.py. This resulted in error while running regressions on zizzer. This patch does the needful... | src/mem/slicc/ast/__init__.py | src/mem/slicc/ast/__init__.py | # Copyright (c) 2009 The Hewlett-Packard Development Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of... | Python | 0 | @@ -3436,113 +3436,4 @@
t *%0A
-from slicc.ast.WakeUpAllDependentsStatementAST import *%0Afrom slicc.ast.WakeUpDependentsStatementAST import *%0A
|
e23fe4a925b676a1ee2dd9eca95bdad6a70b8df1 | Fix issue when running with acl disabled | src/octoprint/plugins/forcelogin/__init__.py | src/octoprint/plugins/forcelogin/__init__.py | # coding=utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms of the AGPLv3 License"
import octoprint.plugin
imp... | Python | 0 | @@ -2975,24 +2975,99 @@
n%0A%09%09%09%09return
+%0A%09%09%09elif not self._user_manager.enabled:%0A%09%09%09%09# ACL isn't enabled%0A%09%09%09%09return
%0A%0A%09%09%09if flas
@@ -3479,24 +3479,96 @@
on%0A%09%09%09return
+%0A%09%09elif not self._user_manager.enabled:%0A%09%09%09# ACL isn't enabled%0A%09%09%09return
... |
ce5187d060978021f71f4045642665448ace72f7 | Add plotly based grapher tool as Jupyter notebook cell | jupyter/plot.py | jupyter/plot.py | Python | 0.000001 | @@ -0,0 +1,1875 @@
+# to be executed as Jupyter notebook%0Aget_ipython().system('pip install plotly --upgrade')%0A%0Afrom plotly import __version__%0Afrom plotly.offline import download_plotlyjs, init_notebook_mode, iplot%0Aimport json%0Aimport plotly.graph_objs as go%0A%0Aprint(__version__) # requires version %3E= 1.... | |
85eaf2b86aefc7697af78f457888652f8a2bbd3d | Add tx.origin check | mythril/analysis/modules/tx_origin.py | mythril/analysis/modules/tx_origin.py | Python | 0 | @@ -0,0 +1,843 @@
+from z3 import *%0Afrom mythril.analysis.report import Issue%0Aimport re%0A%0A%0A%0A'''%0AMODULE DESCRIPTION:%0A%0ACheck for constraints on tx.origin (i.e., access to some functionality is restricted to a specific origin).%0A'''%0A%0Adef execute(statespace):%0A%0A issues = %5B%5D%0A%0A for k in... | |
0995c204e5e05b0a1ee5f8c00dbae58f1f114386 | Add integrations credentials manager | dbaas/integrations/credentials/manager.py | dbaas/integrations/credentials/manager.py | Python | 0.000001 | @@ -0,0 +1,301 @@
+import models%0Aimport logging%0A%0ALOG = logging.getLogger(__name__)%0A%0Aclass IntegrationCredentialManager(object):%0A %0A @classmethod%0A def get_credentials(cls, environment, integration):%0A %09return models.IntegrationCredential.objects.filter(environments=environment, integration_... | |
2dfc4fcc61c0f9d00860168d44da5e03db8e61eb | Add a class to get a random photo of a folder | photobox/cheesefolder.py | photobox/cheesefolder.py | Python | 0 | @@ -0,0 +1,318 @@
+import random%0A%0A%0Aclass Cheesefolder():%0A%0A def __init__(self, folder):%0A self.directory = folder%0A pass%0A%0A def getrandomphoto(self):%0A files = self.directory.getfiles_fullpath()%0A filecount = len(files)%0A randomindex = random.randint(0, filecoun... | |
5ed3e15f200fbec3a5e2aa284e044206a71d5ed4 | Create frus_pdf_urls.py | frus_pdf_urls.py | frus_pdf_urls.py | Python | 0 | @@ -0,0 +1,710 @@
+from urllib.request import urlopen%0Afrom bs4 import BeautifulSoup%0Aimport requests%0A%0Ahtml = urlopen(%22http://digicoll.library.wisc.edu/cgi-bin/FRUS/FRUS-idx?type=header&id=FRUS.FRUS1932v05%22)%0Asoup = BeautifulSoup(html, 'html.parser')%0A%0Awith open(%22fdr_pdf_urls.txt%22, %22w%22) as file:%0... | |
50b3396ef0df860531fe05778767cfd8a5be32c3 | Solve for ini5 | ini5/ini5.py | ini5/ini5.py | Python | 0.999999 | @@ -0,0 +1,477 @@
+#!/usr/bin/python%0A%0Aimport argparse%0A%0Aparser = argparse.ArgumentParser(description=%22Outputs even numbered lines from input file%22)%0Aparser.add_argument(%22--input%22, %22-i%22, required=True, help=%22Input file name%22)%0Aparser.add_argument(%22-o%22, %22--output%22, required=True, help=%22... | |
2180ff5c7576100300898099a2316c66a8e56eb6 | add parser for inline lang ignore comments | src/rstcheck/inline_config.py | src/rstcheck/inline_config.py | Python | 0 | @@ -0,0 +1,1758 @@
+%22%22%22Inline config comment functionality.%22%22%22%0Aimport re%0Aimport typing%0A%0A%0ARSTCHECK_COMMENT_REGEX = re.compile(r%22%5C.%5C. rstcheck:%22)%0A%0A%0Aclass RstcheckCommentSyntaxError(Exception):%0A %22%22%22Syntax error for rstcheck inline config comments.%22%22%22%0A%0A def __init... | |
53cf27711645c64de4a7dad1606a0a51ee4086ff | Update in-memory instance of GroupRuleStatus | src/sentry/rules/processor.py | src/sentry/rules/processor.py | from __future__ import absolute_import
import logging
from collections import defaultdict, namedtuple
from django.utils import timezone
from sentry.models import GroupRuleStatus, Rule
from sentry.rules import EventState, rules
from sentry.utils.cache import cache
from sentry.utils.safe import safe_execute
RuleFutur... | Python | 0 | @@ -3186,32 +3186,61 @@
return%0A%0A
+ now = timezone.now()%0A
if passe
@@ -3597,37 +3597,124 @@
ive=
-timezone.now(),%0A )
+now,%0A )%0A rule_status.last_active = now%0A rule_status.status = GroupRuleStatus.ACTIVE
%0A
@@ -4031,16 +4031,74 @@
AC... |
fb9bbe0a57e1dc083d25d28c7f7fc0b4633c96e0 | add Wikipedia plugin | plugins/wiki/__init__.py | plugins/wiki/__init__.py | Python | 0.000001 | @@ -0,0 +1,1205 @@
+import plugins%0Aimport urllib%0Aimport urllib2%0Aimport json%0Aimport lxml.html%0A%0Aurl = %22https://en.wikipedia.org/w/api.php?%25s%22%0A%0Adef get_text(tree, xpath):%0A return %22%5Cn%22.join(e.text_content() for e in tree.xpath(xpath))%0A%0Adef wiki(connection, channel, nick, cmd, args):%0A ... | |
6b3ab0cf35f20168d072d1df30dd8c4360385209 | disable paths | plstackapi/planetstack/views/api_root.py | plstackapi/planetstack/views/api_root.py | from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.reverse import reverse
@api_view(['GET'])
def api_root(request, format=None):
return Response({
'nodes': reverse('node-list', request=request, format=format),
'sites': reverse('site-list'... | Python | 0.000001 | @@ -214,16 +214,88 @@
+'roles': reverse('role-list', request=request, format=format),%0A #
'nodes':
@@ -357,16 +357,17 @@
+#
'sites':
@@ -429,16 +429,17 @@
+#
'deploym
@@ -527,16 +527,17 @@
+#
'slices'
|
0bef4682c6a81464fd6e72fddd6f0b5957f4d566 | Add a script to calculate paried roi bbox emean and std. | tools/data/calculate_paired_bbox_mean_std.py | tools/data/calculate_paired_bbox_mean_std.py | Python | 0 | @@ -0,0 +1,987 @@
+#!/usr/bin/env python%0A%0Aimport argparse%0Aimport scipy.io as sio%0Aimport sys%0Aimport os.path as osp%0Aimport numpy as np%0Aimport cPickle%0Athis_dir = osp.dirname(__file__)%0Asys.path.insert(0, osp.join(this_dir, '../../external/py-faster-rcnn/lib'))%0Afrom fast_rcnn.bbox_transform import bbox_t... | |
c6951374eba137614744928c18fa4d34de5c5d89 | Add a script to generate data sets for testing sorting algorithms. | src/algorithms/sorting/dataset_generator.py | src/algorithms/sorting/dataset_generator.py | Python | 0 | @@ -0,0 +1,1966 @@
+# Description: Script to Generate Data Sets For Sorting Algorithms%0A%0Aimport random%0Aimport logging%0A%0A# Global Configuration%0ATOTAL_ROWS = 10%0ASORTED = False # Overrides REVERSE_SORTED and RANDOM_NUMBERS%0AREVERSE_SORTED = False # Overrides RANDOM_NUMBERS%0ARANDOM_NUMBERS = Tru... | |
45917087377adef01a4d4ce829013a7958a3afe5 | Add PC / DWPC test | test/pathtools_test.py | test/pathtools_test.py | Python | 0 | @@ -0,0 +1,865 @@
+import os%0A%0Aimport pytest%0A%0Aimport hetio.readwrite%0Afrom hetio.pathtools import paths_between, DWPC%0A%0Adirectory = os.path.dirname(os.path.abspath(__file__))%0A%0A%0Adef test_disease_gene_example_dwpc():%0A %22%22%22%0A Test the DWPC computation from%0A https://doi.org/10.1371/journ... | |
5e8e48895778d8a55b010320dec6befbdaf85af0 | add tests for types.enums | src/tests/types/test_enums.py | src/tests/types/test_enums.py | Python | 0 | @@ -0,0 +1,2708 @@
+import pytest%0A%0Afrom choo.types import LineType, LineTypes, PlatformType, POIType, WalkSpeed, WayEvent, WayType%0A%0A%0Aclass TestEnums:%0A def test_serialize(self):%0A assert WayType.walk.serialize() == 'walk'%0A%0A def test_unserialize(self):%0A assert WayType.unserialize('w... | |
ab8fefb20256a9d800804a0465a4cac7d47019dd | add test_alignment script | test/test_alignment.py | test/test_alignment.py | Python | 0.000006 | @@ -0,0 +1,2000 @@
+#!/usr/bin/env python3%0Aimport time%0A%0Afrom litex.soc.tools.remote import RemoteClient%0Afrom litescope.software.driver.analyzer import LiteScopeAnalyzerDriver%0A%0Awb = RemoteClient()%0Awb.open()%0A%0A# # #%0A%0ADVISAMPLER_DELAY_RST = 0x1%0ADVISAMPLER_DELAY_INC = 0x2%0ADVISAMPLER_DELAY_DEC = 0x4... | |
a3305a53d1007ee48b4dadd37c11efb2d78da7f9 | Add unittests for utils.ichunked() | tests/ichunked_test.py | tests/ichunked_test.py | Python | 0 | @@ -0,0 +1,3318 @@
+# -*- coding: utf-8 -*-%0A#%0A# This software may be modified and distributed under the terms%0A# of the MIT license. See the LICENSE file for details.%0A%0Afrom random import randint%0Aimport unittest%0A%0Afrom logstash_async.utils import ichunked%0A%0ACHUNK_SIZE_SMALL = 1%0ACHUNK_SIZE_NORMAL = 10... | |
35676a61b6fef366d30733dd32211adde9572209 | Add runmailer management command | src/mailer/management/commands/runmailer.py | src/mailer/management/commands/runmailer.py | Python | 0 | @@ -0,0 +1,540 @@
+import sys%0Afrom datetime import datetime%0A%0Afrom django.core.management import BaseCommand%0A%0Afrom mailer.engine import send_loop%0A%0A%0Aclass Command(BaseCommand):%0A %22%22%22Start the django-mailer send loop%22%22%22%0A%0A def handle(self, *args, **options):%0A self.stdout.writ... | |
824f99b5d0a0c5d4b3076d0a5a8991e9fe93ceb1 | Initialize time table data. | server/app/migrations/0008_timetable.py | server/app/migrations/0008_timetable.py | Python | 0.000003 | @@ -0,0 +1,771 @@
+import os%0Afrom datetime import time%0A%0Afrom django.db import migrations%0A%0Adef add_timetable(apps, schema_editor):%0A TimeTable = apps.get_model('app', 'TimeTable')%0A%0A for weekday in range(1, 8):%0A for start in (8, 10, 13, 15, 17, 19):%0A end = start + 2%0A ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.