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 |
|---|---|---|---|---|---|---|---|
8f15a2964c1cbbd85ed8301997c05a38268c79a7 | add script used during position comparison | scripts/pos_compare.py | scripts/pos_compare.py | Python | 0.000001 | @@ -0,0 +1,395 @@
+#!/usr/bin/python%0A%0Aimport sys%0A%0Athreshold = 100%0A%0Afor line in sys.stdin:%0A fields = line.split(' ')%0A aln_name = fields%5B0%5D%0A true_chr = fields%5B1%5D%0A true_pos = int(fields%5B2%5D)%0A aln_chr = fields%5B3%5D%0A aln_pos = int(fields%5B4%5D)%0A aln_mapq = int(fie... | |
bb2fa19aa09e5687e13dedf40da1c7a2507c4c62 | add script to replace `@` and `.` in slugsin for input to gr1x | examples/slugsin_chars_for_gr1x.py | examples/slugsin_chars_for_gr1x.py | Python | 0 | @@ -0,0 +1,472 @@
+import argparse%0A%0A%0Adef main():%0A p = argparse.ArgumentParser()%0A p.add_argument('source', type=str,%0A help='input file')%0A p.add_argument('target', type=str,%0A help='output file')%0A args = p.parse_args()%0A with open(args.source, 'r') as f... | |
1c615be1d3da720d2d0a1974808e3856cbd9d498 | Create Virgil highlevel api implementation | virgil_sdk/api/virgil_api.py | virgil_sdk/api/virgil_api.py | Python | 0 | @@ -0,0 +1,2835 @@
+# Copyright (C) 2016 Virgil Security Inc.%0A#%0A# Lead Maintainer: Virgil Security Inc. %3Csupport@virgilsecurity.com%3E%0A#%0A# All rights reserved.%0A#%0A# Redistribution and use in source and binary forms, with or without%0A# modification, are permitted provided that the following conditions are%... | |
cfc37e2556dc018f1150e647253f377c3e8b75ae | Add subtree_sim.py | scripts/subtree_sim.py | scripts/subtree_sim.py | Python | 0.000008 | @@ -0,0 +1,704 @@
+import numpy as np%0Afrom cogent import LoadTree%0A%0A%0ACLI = %22%22%22%0AUSAGE:%0A random_subtree %3Ctree%3E %3Cn%3E%0A%0ASubsamples %3Cn%3E taxa from the Newick tree in %3Ctree%3E, preserving the branch%0Alengths of subsampled taxa.%0A%22%22%22%0A%0Adef main(treefile, n):%0A n = int(n)%0A ... | |
e81bfc0ddcfdc321af0608d553b123fa2188de38 | Consolidate implementations | datashape/user.py | datashape/user.py | from __future__ import print_function, division, absolute_import
from datashape.dispatch import dispatch
from .coretypes import *
from .predicates import isdimension
from .util import dshape
import sys
from datetime import date, time, datetime
__all__ = ['validate', 'issubschema']
basetypes = np.generic, int, float... | Python | 0.000008 | @@ -1130,78 +1130,8 @@
)%0A%0A%0A
-@dispatch(String, str)%0Adef validate(schema, value):%0A return True%0A%0A%0A
@dis
@@ -1700,85 +1700,88 @@
%0A%0A%0A@
-dispatch(Time, time)%0Adef validate(schema, value):%0A return True%0A%0A%0A@dispatch
+validate.register(String, str)%0A@validate.register(Time, time)%0A@vali... |
5d0c16c877fb445114d2b77ee7a4d14686320688 | Add Python solution for day 19 | day19/solution.py | day19/solution.py | Python | 0 | @@ -0,0 +1,2066 @@
+import re%0A%0Adata = open(%22data%22, %22r%22).read()%0A%0ApossibleReplacements = %7B%7D%0ApossibleReverseReplacements = %7B%7D%0Afor replacement in data.split(%22%5Cn%22):%0A%09lhs, rhs = replacement.split(%22 =%3E %22)%0A%0A%09if lhs in possibleReplacements:%0A%09%09if rhs not in possibleReplacem... | |
cdfdf0646151c54001ccbc80eca5c0e8f83ff38a | add tests for Compose class | rhcephcompose/tests/test_compose.py | rhcephcompose/tests/test_compose.py | Python | 0.000001 | @@ -0,0 +1,770 @@
+import os%0Aimport time%0Afrom rhcephcompose.compose import Compose%0Afrom kobo.conf import PyConfigParser%0A%0ATESTS_DIR = os.path.dirname(os.path.abspath(__file__))%0AFIXTURES_DIR = os.path.join(TESTS_DIR, 'fixtures')%0A%0A%0Aclass TestCompose(object):%0A%0A conf_file = os.path.join(FIXTURES_DIR... | |
885bf944b7839e54a83ce0737b05ff11fa7d3d86 | Create selfTest.py | searchSort/selfTest.py | searchSort/selfTest.py | Python | 0.000002 | @@ -0,0 +1,1257 @@
+from random import randrange, shuffle%0A%0A%0Adef quick_sort(collection, low, high):%0A if low %3C high:%0A p = partition(collection, low, high)%0A quick_sort(collection, low, p)%0A quick_sort(collection, p + 1, high)%0A%0A%0Adef partition(collection, low, high):%0A pivot ... | |
20d1a1784f0831c14e6e03bbb86f5b8dd5ae49ea | Create learn.py | smalltwo/learn.py | smalltwo/learn.py | Python | 0 | @@ -0,0 +1 @@
+%0A
| |
d0f268836f4096800f1deccf727724de2186ba0c | Make logging at debug levels more convenient | wal_e/log_help.py | wal_e/log_help.py | """
A module to assist with using the Python logging module
"""
import datetime
import errno
import logging
import logging.handlers
import os
from os import path
# Minimum logging level to emit logs for, inclusive.
MINIMUM_LOG_LEVEL = logging.INFO
class IndentFormatter(logging.Formatter):
def format(self, rec... | Python | 0.000001 | @@ -1013,28 +1013,33 @@
level',
-logging.INFO
+MINIMUM_LOG_LEVEL
)%0A ha
|
ae93e08c8ebb5bd502d1a5ad3d96bd773c5efce2 | fix for #1409 | drivers/python/rethinkdb/errors.py | drivers/python/rethinkdb/errors.py | # Copyright 2010-2015 RethinkDB, all rights reserved.
__all__ = [
"ReqlCursorEmpty", "RqlCursorEmpty",
"ReqlError", "RqlError",
"ReqlCompileError", "RqlCompileError",
"ReqlDriverCompileError",
"ReqlServerCompileError",
"ReqlRuntimeError", "RqlRuntimeError",
"... | Python | 0 | @@ -2194,16 +2194,120 @@
rots()))
+%0A %0A def __repr__(self):%0A return %22%3C%25s instance: %25s %3E%22 %25 (self.__class__.__name__, str(self))
%0A%0ARqlErr
|
6090dc1539bd0701381c73128a5ca0606adc09e4 | Add SSDP unit test case (init) | tests/utils/test_ssdp.py | tests/utils/test_ssdp.py | Python | 0 | @@ -0,0 +1,706 @@
+# -*- coding: utf-8 -*-%0A'''%0A :codeauthor: :email:%60Bo Maryniuk %3Cbo@suse.de%3E%60%0A'''%0A%0Afrom __future__ import absolute_import, print_function, unicode_literals%0Afrom tests.support.unit import TestCase, skipIf%0Afrom tests.support.mock import (%0A NO_MOCK,%0A NO_MOCK_REASON,%0A ... | |
b6d3ab372f57ad9e3c8427ba8bc211136bc1037b | Set version to 0.1.9a1 | src/powerdns_manager/__init__.py | src/powerdns_manager/__init__.py | # -*- coding: utf-8 -*-
#
# This file is part of django-powerdns-manager.
#
# django-powerdns-manager is a web based PowerDNS administration panel.
#
# Development Web Site:
# - http://www.codetrax.org/projects/django-powerdns-manager
# Public Source Code Repository:
# - https://source.codetrax.org/hgroot/dja... | Python | 0.001588 | @@ -1060,17 +1060,17 @@
(0, 1,
-8
+9
, 'alpha
|
70b4afc095873ad226947edc757cbc4d29daf44a | Add test_incomplete_write.py test to reproduce #173 | functests/test_incomplete_write.py | functests/test_incomplete_write.py | Python | 0 | @@ -0,0 +1,1623 @@
+from __future__ import print_function%0Aimport os%0Aimport sys%0Aimport socket%0Aimport datetime%0Aimport time%0Aimport akumulid_test_tools as att%0Aimport json%0Atry:%0A from urllib2 import urlopen%0Aexcept ImportError:%0A from urllib import urlopen%0Aimport traceback%0Aimport itertools%0Aimp... | |
27147c9691b49a420ddb51a37f19203416429224 | test with isinstance(<X>, (list, tuple)) rather than type(<X>)==list | jsonrpc_http/Engine.py | jsonrpc_http/Engine.py | import inspect
#
import tabular_predDB.cython_code.State as State
import tabular_predDB.python_utils.sample_utils as su
def int_generator(start=0):
next_i = start
while True:
yield next_i
next_i += 1
class Engine(object):
def __init__(self, seed=0):
self.seed_generator = int_gene... | Python | 0.001867 | @@ -1318,63 +1318,89 @@
if
-type(X_L) == list:%0A assert type(X_D) == list
+isinstance(X_L, (list, tuple)):%0A assert isinstance(X_D, (list, tuple))
%0A
@@ -2054,63 +2054,89 @@
if
-type(X_L) == list:%0A assert type(X_D) == list
+isinstance(X_L, (list, tuple)):%0A as... |
67328984667246325244c0eaba75de7413c3079f | add fibonacci example in redid-example | example/redis-example/Fibonacci.py | example/redis-example/Fibonacci.py | Python | 0.000133 | @@ -0,0 +1,1431 @@
+# import redis driver%0Aimport redis%0Aimport pymongo%0A%0A# import python-cache pycache package%0Afrom pycache.Adapter import RedisItemPool%0Afrom pycache.Adapter import MongoItemPool%0Afrom pycache import cached%0A%0Aclient = redis.Redis(host='192.168.99.100', port=32771)%0Apool = RedisItemPool(cl... | |
e39415fbe6a325894abb8d098504150b1c515b57 | Create split-linked-list-in-parts.py | Python/split-linked-list-in-parts.py | Python/split-linked-list-in-parts.py | Python | 0.000003 | @@ -0,0 +1,2412 @@
+# Time: O(n)%0A# Space: O(n)%0A%0A# Given a chemical formula (given as a string), return the count of each atom.%0A#%0A# An atomic element always starts with an uppercase character,%0A# then zero or more lowercase letters, representing the name.%0A#%0A# 1 or more digits representing the count of th... | |
4709a38f67c80c1516b4eae6eb7d8f54cdd985e2 | Create songsched.py | Songsched/songsched.py | Songsched/songsched.py | Python | 0.000001 | @@ -0,0 +1 @@
+%0A
| |
9beaa2052b4e47a2fd075f4d9b7988b03a38a8ad | Create main.py | main.py | main.py | Python | 0.000001 | @@ -0,0 +1,793 @@
+import optparse, settings%0A%0Adef main():%0A parser = optparse.OptionParser()%0A %0A parser.add_option('-c',%0A '--charity',%0A dest='charity',%0A default=None,%0A action=%22store_true%22,%0A ... | |
c36f36555b8fba183220456e51e04ccbaa08bb60 | add a data file to play with. | cno/data/ToyMMB/__init__.py | cno/data/ToyMMB/__init__.py | Python | 0 | @@ -0,0 +1,153 @@
+from cellnopt.core import XMIDAS, CNOGraph%0A%0Apknmodel = CNOGraph(%22PKN-ToyMMB.sif%22)%0Adata = XMIDAS(%22MD-ToyMMB.csv%22)%0Adescription = open(%22README.rst%22).read()%0A
| |
c1ef15e895d4f79a9ef5c83aa13964d30bc8dbff | Add main loop | main.py | main.py | Python | 0 | @@ -0,0 +1,523 @@
+from Board import *%0Afrom Player import *%0A%0Adef main():%0A board = Board()%0A players = (HumanPlayer('x', board), HumanPlayer('o', board))%0A turnNum = 0%0A currentPlayer = None%0A while not board.endGame():%0A currentPlayer = players%5BturnNum %25 2%5D%0A print %22%2... | |
f31b42ae43e7cd2af53a504c1cc2ab398bf7810d | Add api call for Premier League standings | main.py | main.py | Python | 0 | @@ -0,0 +1,660 @@
+import json%0Aimport requests%0Afrom tabulate import tabulate%0A%0ABASE_URL = %22http://api.football-data.org/alpha/%22%0Asoccer_seasons = %22soccerseasons/%22%0A%0Aepl_current_season = %22soccerseasons/398/%22%0Aleague_table = %22leagueTable/%22%0A%0A%0Adef print_standings(table):%0A%09standings = %... | |
c1d5dca7c487075229b384585e0eb11cd91bbef8 | add import script for Chesterfield | polling_stations/apps/data_collection/management/commands/import_chesterfield.py | polling_stations/apps/data_collection/management/commands/import_chesterfield.py | Python | 0 | @@ -0,0 +1,386 @@
+from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter%0A%0Aclass Command(BaseXpressDemocracyClubCsvImporter):%0A council_id = 'E07000034'%0A addresses_name = 'May 2017/ChesterfieldDemocracy_Club__04May2017a.txt'%0A stations_name = 'May 2017/ChesterfieldDemocracy_... | |
04155a80531e58422253e22635f1e496a27a5647 | add import script for South Ribble | polling_stations/apps/data_collection/management/commands/import_south_ribble.py | polling_stations/apps/data_collection/management/commands/import_south_ribble.py | Python | 0 | @@ -0,0 +1,1648 @@
+from django.contrib.gis.geos import Point%0Afrom data_collection.management.commands import BaseHalaroseCsvImporter%0A%0Aclass Command(BaseHalaroseCsvImporter):%0A council_id = 'E07000126'%0A addresses_name = 'Properties.csv'%0A stations_name = 'Polling Stations.csv'%0A elections... | |
e0d728519292377915983385285a3560d3207b19 | Create main.py | main.py | main.py | Python | 0.000001 | @@ -0,0 +1,193 @@
+import webapp2%0A%0Aclass MainHandler(webapp2.RequestHandler):%0A def get(self):%0A self.response.write('Hello world!')%0A%0Aapp = webapp2.WSGIApplication(%5B%0A ('/', MainHandler)%0A%5D, debug=True)%0A
| |
99b4a6fa8eb96f9228635142d2686b9601f293b5 | Put main.py back | main.py | main.py | Python | 0.000001 | @@ -0,0 +1,776 @@
+import wysiweb%0Aimport shutil%0A%0Atry:%0A shutil.rmtree('./frozen')%0Aexcept:%0A pass%0A%0A# site_path: Where are the files that will build the website%0A# static_path: where are the static files? has to be within site_path%0A# static_route: what is the route to access static files: %3Ca href... | |
62df41780706161c4e25f854de0b6cc5d2664a39 | Add test for templates in include_router path (#349) | tests/test_router_prefix_with_template.py | tests/test_router_prefix_with_template.py | Python | 0 | @@ -0,0 +1,471 @@
+from fastapi import APIRouter, FastAPI%0Afrom starlette.testclient import TestClient%0A%0Aapp = FastAPI()%0A%0Arouter = APIRouter()%0A%0A%0A@router.get(%22/users/%7Bid%7D%22)%0Adef read_user(segment: str, id: str):%0A return %7B%22segment%22: segment, %22id%22: id%7D%0A%0A%0Aapp.include_router(rou... | |
9123b90f21fc341cbb2e333eb53c5149dfda8e3b | Add Taiwan time transformed. | cttwt.py | cttwt.py | Python | 0 | @@ -0,0 +1,1661 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A# Copyright (c) 2011 Toomore Chiang, http://toomore.net/%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 wi... | |
4b7fb1ad3cd03e0593ecd3d0626bca385fb2800d | Add scroller example. | examples/scroller/scroller.py | examples/scroller/scroller.py | Python | 0 | @@ -0,0 +1,1815 @@
+# coding=utf8%0A%0A#%0A# python-aosd -- python bindings for libaosd%0A#%0A# Copyright (C) 2010 Armin H%C3%A4berling %3Carmin.aha@gmail.com%3E%0A#%0A# Based on the scroller example from libaosd.%0A#%0A%0Aimport sys%0A%0Aimport aosd%0A%0Adef scroll(osd, width, height):%0A pos = 8%0A step = 3%0A ... | |
7dfc471a8fc9a2e68f3ef49708c4c309cd2ebea1 | check license family is valid | conda_smithy/lint_recipe.py | conda_smithy/lint_recipe.py | import io
import itertools
import os
import re
import jinja2
import ruamel.yaml
# patch over differences between PY2 and PY3
try:
text_type = unicode
except NameError:
text_type = str
EXPECTED_SECTION_ORDER = ['package', 'source', 'build', 'requirements',
'test', 'app', 'about', 'ex... | Python | 0.000035 | @@ -75,16 +75,75 @@
l.yaml%0A%0A
+from conda_build.metadata import allowed_license_families%0A%0A
# patch
@@ -5637,16 +5637,392 @@
file.')%0A
+%0A # 12: License family must be valid (conda-build checks for that)%0A license_family = about_section.get('license_family', '')%0A if license_family and not licens... |
a9fee0cab6899effa865c73c38baf73e5272d87e | Create main.py | main.py | main.py | Python | 0.000001 | @@ -0,0 +1,263 @@
+### Command line interface for functions%0A%0Aimport freqs%0Aimport harmonize%0Aimport error%0Aimport enharmonic%0Aimport voice%0A%0A# 1. Take input from file or user%0A%0A# 2. Call desired function on input, specifying type of output (show, save to file, etc.)%0A%0A# 3. Display result%0A
| |
370d6eb7fc4adb2f2769bdf94f56df239760ef0c | Create quiz2.py | laboratorio-f/quiz2.py | laboratorio-f/quiz2.py | Python | 0.000001 | @@ -0,0 +1,609 @@
+print(%22OFERTAS El Emperador%22)%0A%0Aofer1 = 0.30 %0Aofer2 = 0.20%0Aofer3 = 0.10%0A%0A%0Awhile clientes %3C5:%0A%09monto = int(input(%22Ingrese monto: %22))%0A%09clientes += 1%09%0A%09if monto %3E= 500:%0A%09%09subtotal = monto * ofer1%0A%09%09total = monto - subtotal%0A%09%09print(%22El total es ... | |
c8e6fce132d1eaa9d789dd0c7bd2e5c53e4e5424 | Add python user exception function example (#2333) | pulsar-functions/python-examples/user_exception.py | pulsar-functions/python-examples/user_exception.py | Python | 0 | @@ -0,0 +1,1036 @@
+#!/usr/bin/env python%0A#%0A# Licensed to the Apache Software Foundation (ASF) under one%0A# or more contributor license agreements. See the NOTICE file%0A# distributed with this work for additional information%0A# regarding copyright ownership. The ASF licenses this file%0A# to you under the Apac... | |
3aaee714d59650f36e3918e184905048a83d1cfc | Add new filesystem_stat module. | lib/filesystem_stat.py | lib/filesystem_stat.py | Python | 0 | @@ -0,0 +1,1940 @@
+import os%0Aimport stat%0Aimport snmpy%0Aimport time%0A%0Aclass filesystem_stat(snmpy.plugin):%0A def s_type(self, obj):%0A if stat.S_ISDIR(obj):%0A return 'directory'%0A if stat.S_ISCHR(obj):%0A return 'character special device'%0A if stat.S_ISBLK(obj):... | |
7ac6007e28740e0aff89925b10ae09fa6c0b63d3 | add tests for g.current_user | backend/geonature/tests/test_users_login.py | backend/geonature/tests/test_users_login.py | Python | 0.000001 | @@ -0,0 +1,1414 @@
+import pytest%0A%0Afrom flask import g, url_for, current_app%0A%0Afrom geonature.utils.env import db%0A%0Afrom pypnusershub.db.models import User, Application, AppUser, UserApplicationRight, ProfilsForApp%0A%0Afrom . import login, temporary_transaction%0Afrom .utils import logged_user_headers%0A%0A%... | |
563128f767167ed81469f13192950633874761f3 | Simplify docstring in light of filter changes | flowlogs_reader/flowlogs_reader.py | flowlogs_reader/flowlogs_reader.py | # Copyright 2015 Observable Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | Python | 0.000001 | @@ -3600,222 +3600,159 @@
nly
-log streams that%0A were ingested at or after this time will be examined, and only events at%0A or after this time will be yielded.%0A * %60end_time%60 is similar to start time. Only log streams and events after%0A
+the log events%0A from at or after this time will be con... |
205bbba27a89e6f89e26164dbf25ce9763865d36 | add ping.py | ping.py | ping.py | Python | 0.000003 | @@ -0,0 +1,1210 @@
+#!/usr/bin/env python%0A# -*- coding:utf8 -*-%0Aimport Queue%0Aimport threading%0Aimport subprocess%0Aimport re%0Aimport sys%0A%0Alock = threading.Lock()%0Adef getip(ip):%0A a = re.match(r'(.*%5Cd+)%5C.(%5Cd+)-(%5Cd+)',ip)%0A print a.groups()%0A start = int(a.group(2))%0A end = int(a.gr... | |
1266fd79369634e2a0399e857107487ae589ea20 | add vpc vpc check script | plugins/aws/check_vpc_vpn.py | plugins/aws/check_vpc_vpn.py | Python | 0 | @@ -0,0 +1,1472 @@
+#!/usr/bin/python%0A%0Aimport argparse%0Aimport boto.ec2%0Afrom boto.vpc import VPCConnection%0Aimport sys%0A%0A%0Adef main():%0A try:%0A conn = boto.vpc.VPCConnection(aws_access_key_id=args.aws_access_key_id, aws_secret_access_key=args.aws_secret_access_key, region=boto.ec2.get_region(arg... | |
2d6d5c0a07a751a66c3f0495e3a3a67e4296dd77 | Create subreddits_with_zero_gildings.py | subreddits_with_zero_gildings.py | subreddits_with_zero_gildings.py | Python | 0.00012 | @@ -0,0 +1,965 @@
+# Written by Jonathan Saewitz, released March 26th, 2016 for Statisti.ca%0A# Released under the MIT License (https://opensource.org/licenses/MIT)%0A%0Aimport json, plotly.plotly as plotly, plotly.graph_objs as go%0A%0A########################%0A# Config #%0A########################%0A%0... | |
29e18ed63177dbe8306a22e3c0583342f4591464 | Exit routine for a controlled exit from ample | python/ample_exit.py | python/ample_exit.py | Python | 0 | @@ -0,0 +1,1449 @@
+'''%0ACreated on Mar 18, 2015%0A%0A@author: jmht%0A'''%0A%0Aimport logging%0Aimport sys%0Aimport traceback%0A%0A# external imports%0Atry: import pyrvapi%0Aexcept: pyrvapi=None%0A%0Adef exit(msg):%0A logger = logging.getLogger()%0A %0A #header=%22**** AMPLE ERROR ****%5Cn%5Cn%22%0A header... | |
fa3450a44621fab4a9a2f2ed1599d08f66860f70 | Integrate densities to check normalization | integrate_density.py | integrate_density.py | Python | 0 | @@ -0,0 +1,1483 @@
+import argparse%0Aimport numpy as np%0Aimport h5py%0A%0Aif __name__ == '__main__':%0A%0A parser = argparse.ArgumentParser(description='Integrate probability ' +%0A 'densities to verify that they are ' +%0A 'normalized')%0A ... | |
72a573c24d5234003b9eeb9e0cc487d174908a2e | Add a Trie for storage of data string tokens. | typeahead_search/trie.py | typeahead_search/trie.py | Python | 0 | @@ -0,0 +1,1615 @@
+%22%22%22A Trie (prefix tree) class for use in typeahead search.%0A%0AEvery node in the TypeaheadSearchTrie is another TypeaheadSearchTrie instance.%0A%22%22%22%0A%0Afrom weakref import WeakSet%0A%0A%0Aclass TypeaheadSearchTrie(object):%0A def __init__(self):%0A # The children of this node... | |
060028a383279de41cfc7bcd2bb8322746b3ade6 | set default config | pyethereum/slogging.py | pyethereum/slogging.py | import structlog
import logging
import sys
"""
See test_logging.py for examples
Basic usage:
log = get_logger('eth.vm.op')
log.trace('event name', some=data)
Use Namespaces for components and subprotocols
net
net.handshake
net.frames
p2p.peer
p2p.peermanager
eth.vm
eth.vm.op
eth.vm.mem
eth.chain
eth.chain.new_block
"... | Python | 0.000003 | @@ -4721,24 +4721,117 @@
ig_string)%0A%0A
+configure_logging = configure # for unambigious imports%0A### setup default config%0Aconfigure()%0A
%0Adef get_con
|
e5dd1722911e580caca136fda9b81bb53221c65c | add table widget | ubuntui/widgets/table.py | ubuntui/widgets/table.py | Python | 0 | @@ -0,0 +1,1638 @@
+# Copyright 2014, 2015 Canonical, Ltd.%0A#%0A# This program is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as%0A# published by the Free Software Foundation, either version 3 of the%0A# License, or (at your option) any later ver... | |
51fc613214f20738270f37280fb465aea84ed065 | test the wsgi logging | test/test_slimta_logging_wsgi.py | test/test_slimta_logging_wsgi.py | Python | 0 | @@ -0,0 +1,736 @@
+%0Aimport unittest%0A%0Afrom testfixtures import log_capture%0A%0Afrom slimta.logging import getWsgiLogger%0A%0A%0Aclass TestWsgiLogger(unittest.TestCase):%0A%0A def setUp(self):%0A self.log = getWsgiLogger('test')%0A self.environ = %7B'var': 'val'%7D%0A%0A @log_capture()%0A de... | |
8af510b18a3f0f8298f9a992bffdccc9aee2c8c2 | add sandbox file | src/gmv/sandbox.py | src/gmv/sandbox.py | Python | 0.000001 | @@ -0,0 +1,235 @@
+'''%0ACreated on Jan 30, 2012%0A%0A@author: guillaume.aubert@gmail.com%0A'''%0A%0Afrom cmdline_utils import CmdLineParser%0A%0Aif __name__ == '__main__':%0A %0A global_parser = CmdLineParser()%0A global_parser.disable_interspersed_args()%0A %0A
| |
65f149c33c1ec6e7d7262092def4b175aa52fe54 | Create BinTreeRightSideView_001.py | leetcode/199-Binary-Tree-Right-Side-View/BinTreeRightSideView_001.py | leetcode/199-Binary-Tree-Right-Side-View/BinTreeRightSideView_001.py | Python | 0 | @@ -0,0 +1,550 @@
+# Definition for a binary tree node%0A# class TreeNode:%0A# def __init__(self, x):%0A# self.val = x%0A# self.left = None%0A# self.right = None%0A%0Aclass Solution:%0A # @param root, a tree node%0A # @return a list of integers%0A def rightSideView(self, root):%0A ... | |
01c74cfea946eac098a0e144380314cd4676cf2f | Split lowpass filtering into another script. | analysis/04-lowpass.py | analysis/04-lowpass.py | Python | 0 | @@ -0,0 +1,1470 @@
+#!/usr/bin/env python%0A%0Afrom __future__ import division%0A%0Aimport climate%0Aimport lmj.cubes%0Aimport pandas as pd%0Aimport scipy.signal%0A%0Alogging = climate.get_logger('lowpass')%0A%0Adef lowpass(df, freq=10., order=4):%0A '''Filter marker data using a butterworth low-pass filter.%0A%0A ... | |
6a6b9eff5e5d0d7c4a1a969b15a2a4583cf79855 | add game-of-throne-ii | algorithms/strings/game-of-throne-ii/game-of-throne-ii.py | algorithms/strings/game-of-throne-ii/game-of-throne-ii.py | Python | 0.999371 | @@ -0,0 +1,717 @@
+from collections import Counter%0A%0AMOD = 10**9 + 7%0A%0Adef factMod(x):%0A ret = 1%0A for i in range(1, x):%0A ret = (ret * (i + 1)) %25 MOD;%0A return ret%0A%0Adef powMod(x, y):%0A if y == 0:%0A return 1%0A if y == 1:%0A return x %25 MOD%0A temp = powMod(x, y... | |
6a9b6f0227b37d9c4da424c25d20a2b7e9397a9f | Make `publication_date` column not nullable. | alembic/versions/3800f47ba771_publication_date_not_nullable.py | alembic/versions/3800f47ba771_publication_date_not_nullable.py | Python | 0.000001 | @@ -0,0 +1,450 @@
+%22%22%22Make the %60publication_date%60 column required.%0A%0ARevision ID: 3800f47ba771%0ARevises: 17c1af634026%0ACreate Date: 2012-12-13 21:14:19.363112%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '3800f47ba771'%0Adown_revision = '17c1af634026'%0A%0Afrom alembic import... | |
57e2776a59214318d335f2fa0e2cc1854c33d488 | Add lc0532_k_diff_pairs_in_an_array.py | lc0532_k_diff_pairs_in_an_array.py | lc0532_k_diff_pairs_in_an_array.py | Python | 0.000015 | @@ -0,0 +1,1239 @@
+%22%22%22Leetcode 532. K-diff Pairs in an Array%0AEasy%0A%0AURL: https://leetcode.com/problems/k-diff-pairs-in-an-array/%0A%0AGiven an array of integers and an integer k, you need to find the number %0Aof unique k-diff pairs in the array. Here a k-diff pair is defined as an%0Ainteger pair (i, j), wh... | |
a66ce55c2abcb434168aadb195fd00b8df6f4fd1 | add scoreboard game test | tests/test_scoreboardGame.py | tests/test_scoreboardGame.py | Python | 0.000002 | @@ -0,0 +1,1143 @@
+from unittest import TestCase%0Afrom datetime import datetime%0A%0Afrom nba_data.data.scoreboard_game import ScoreboardGame%0Afrom nba_data.data.season import Season%0Afrom nba_data.data.team import Team%0Afrom nba_data.data.matchup import Matchup%0A%0A%0Aclass TestScoreboardGame(TestCase):%0A de... | |
6b1be6883ead01cc226226499644adb7e99542f8 | Add functionality to load and test a saved model | Experiments/evaluate_model.py | Experiments/evaluate_model.py | Python | 0 | @@ -0,0 +1,2550 @@
+# import os%0Aimport sys%0Aimport tensorflow as tf%0A# sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/' + '../..'))%0A%0Afrom Models.low_level_sharing_four_hidden import LowLevelSharingModel%0Afrom utils.data_utils.labels import Labels%0Afrom utils.data_utils.data_handler import fetch... | |
d883cfac71c9ec39abcd75e79b9bec0f53e7890d | Initialize transpositionHacker | books/CrackingCodesWithPython/Chapter12/transpositionHacker.py | books/CrackingCodesWithPython/Chapter12/transpositionHacker.py | Python | 0.000672 | @@ -0,0 +1,1967 @@
+# Transposition Cipher Hacker%0A# https://www.nostarch.com/crackingcodes/ (BSD Licensed)%0A%0Aimport pyperclip, detectEnglish, transpositionDecrypt%0A%0Adef main():%0A # You might want to copy & paste this text from the source code at%0A # https://www.nostarch.com/crackingcodes/:%0A myMessa... | |
75805397dd62cfa00eb9a9d253259ea9c79f426b | Test Issue #605 | spacy/tests/regression/test_issue605.py | spacy/tests/regression/test_issue605.py | Python | 0 | @@ -0,0 +1,577 @@
+from ...attrs import LOWER, ORTH%0Afrom ...tokens import Doc%0Afrom ...vocab import Vocab%0Afrom ...matcher import Matcher%0A%0A%0Adef return_false(doc, ent_id, label, start, end):%0A return False%0A%0A%0Adef test_matcher_accept():%0A doc = Doc(Vocab(), words=%5Bu'The', u'golf', u'club', u'is',... | |
38dd3604918b2e0d7770e855f775db9ff6720de8 | Add initial DrugBank client | indra/databases/drugbank_client.py | indra/databases/drugbank_client.py | Python | 0 | @@ -0,0 +1,1481 @@
+import os%0Afrom indra.util import read_unicode_csv%0A%0A%0Amappings_file = os.path.join(os.path.dirname(os.path.abspath(__file__)),%0A os.pardir, 'resources', 'drugbank_mappings.tsv')%0A%0A%0Adef get_chebi_id(drugbank_id):%0A return drugbank_chebi.get(drugbank_id)%0A%... | |
84fcbb34005c5bfa19d33e583ca48583b04baeb4 | Create mp3tag.py | plugins/mp3tag.py | plugins/mp3tag.py | Python | 0.000001 | @@ -0,0 +1,2 @@
+.%0A
| |
407e0b6596539a5f8fcac099c11f1fabc956ea26 | add plugin to show available package updates | plugins/pacman.py | plugins/pacman.py | Python | 0 | @@ -0,0 +1,685 @@
+%22%22%22%0A@author Brian Bove https://github.com/bmbove%0A%22%22%22%0Aimport re%0Aimport subprocess%0Afrom .base import PluginBase%0A %0Aclass PacmanPlugin(PluginBase):%0A %0A def configure(self):%0A defaults = %7B%0A 'format': 'pacman %7Bupdates%7D'%0A %7D%0A retu... | |
3501462ebafa15b19ef436231a5a0d9e3b5d430a | Add first implementation of virtual ontology | indra/ontology/virtual_ontology.py | indra/ontology/virtual_ontology.py | Python | 0.000001 | @@ -0,0 +1,1205 @@
+import requests%0Afrom .ontology_graph import IndraOntology%0A%0A%0Aclass VirtualOntology(IndraOntology):%0A def __init__(self, url, ontology='bio'):%0A super().__init__()%0A self.url = url%0A self.ontology = ontology%0A%0A def initialize(self):%0A self._initialized... | |
1139ca1d7c9a4badeb0c3addb23bf0f80866beb5 | Task5 | project1/task5.py | project1/task5.py | Python | 0.999999 | @@ -0,0 +1,827 @@
+from sklearn.linear_model import RidgeCV, LassoCV%0Aimport utils%0Aimport pandas as pd%0A%0Adata = pd.read_csv(%22datasets/housing_data.csv%22)%0A%0AX = data.ix%5B:, %5B0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12%5D%5D.values%0A%0AY = data.ix%5B:, 13%5D.values%0A%0A# Ridge regression%0A%0AtuningAlpha = %5B... | |
2154c816cdb3ff0f4a98980a2d590888f6819c81 | add signals | rest_arch/signals.py | rest_arch/signals.py | Python | 0.000564 | @@ -0,0 +1,172 @@
+# -*- coding: utf-8 -*-%0A%0Afrom blinker import signal%0A%0Abefore_api_called = signal('before_api_called')%0Aafter_api_called = signal('after_api_called')%0A%0A# TODO add more signals%0A
| |
00c5dbbdeee045d9e474ce7b6094cd49df528b05 | add container tests | tests/container_tests.py | tests/container_tests.py | Python | 0 | @@ -0,0 +1,798 @@
+import pytest%0A%0Afrom watir_snake.container import Container%0A%0A%0Aclass TestContainerExtractSelector(object):%0A def test_converts_2_arg_selector_into_a_dict(self):%0A assert Container()._extract_selector('how', 'what') == %7B'how': 'what'%7D%0A%0A def test_returns_the_kwargs_given(... | |
1aebdce5d2fb233927930175fe60e205bca50962 | Fix test :) | tests/test_comicnames.py | tests/test_comicnames.py | # -*- coding: utf-8 -*-
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2016 Tobias Gruetzmacher
from dosagelib import scraper, util
class TestComicNames(object):
def test_names(self):
for scraperclass in scraper.get_scraperclasses():
name = scraperclass.getName()
as... | Python | 0 | @@ -17,16 +17,80 @@
f-8 -*-%0A
+# Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs%0A
# Copyri
@@ -142,16 +142,21 @@
ght (C)
+2015-
2016 Tob
@@ -173,16 +173,93 @@
macher%0A%0A
+from __future__ import absolute_import, division, print_function%0A%0Aimport re%0A%0A
from dos
@@ -283,14 +283,8 @@
aper
-... |
8b55c8a524dd853be2c72951f3656db1a991d0bc | test for Experiment class | tests/test_experiment.py | tests/test_experiment.py | Python | 0.000002 | @@ -0,0 +1,804 @@
+#!/usr/bin/env python%0A# %E2%88%92*%E2%88%92 coding: UTF%E2%88%928 %E2%88%92*%E2%88%92%0Afrom __future__ import division%0A%0Afrom odelab.solver import SingleStepSolver%0Afrom odelab.system import System%0Afrom odelab.scheme import ExplicitEuler%0Afrom odelab.experiment import Experiment%0A%0Aimport... | |
cb788a5c82a4be58bb6b2d6d6608a17f914a42b4 | Add basic tests for layer initialization. | test/graph_test.py | test/graph_test.py | import theanets
import numpy as np
import util
class TestNetwork(util.MNIST):
def _build(self, *hiddens):
return theanets.Regressor((self.DIGIT_SIZE, ) + hiddens)
def test_predict(self):
net = self._build(15, 13)
y = net.predict(self.images)
assert y.shape == (self.NUM_DIGITS... | Python | 0 | @@ -1271,16 +1271,802 @@
ates()%0A%0A
+ def test_layer_ints(self):%0A m = theanets.Regressor((1, 2, 3))%0A assert len(m.layers) == 3%0A%0A def test_layer_tuples(self):%0A m = theanets.Regressor((1, (2, 'relu'), 3))%0A assert len(m.layers) == 3%0A assert m.layers%5B1%5D.activati... |
5e52a7551b20f74d0b08393e8da89463bb6b5366 | add new tests for busco | test/test_busco.py | test/test_busco.py | Python | 0 | @@ -0,0 +1,500 @@
+from sequana.busco import BuscoConfig, BuscoDownload%0Afrom sequana import sequana_data%0Afrom easydev import TempFile%0A%0Adef test_busco_config():%0A bc = BuscoConfig(%22species%22, outpath=%22test%22, sample_name=%22test%22,%0A conda_bin_path=%22test%22, tmp_path=%22test%22, hmmsearc... | |
a4ad209ba361ed07574de37598bcedd3ea499a0a | add test file for testing patches | test/test_patch.py | test/test_patch.py | Python | 0 | @@ -0,0 +1,1766 @@
+# The positive cases of patch are extensively tested in test_diff.py because a%0A# sensible way to validate a diff of two objects is to check that when you apply%0A# the patch to the first object you get the second.%0A# Here the testing mainly focuses on patch operations which would fail and some%0A... | |
3e8dad480392cc654bca0b0fdf3ac27f4f4be3c6 | Add speed test script | test/test_speed.py | test/test_speed.py | Python | 0.000001 | @@ -0,0 +1,1406 @@
+import numpy%0Anumpy.random.seed(0)%0Aimport time%0Aimport cProfile%0Aimport pstats%0A%0Aimport pandas%0A%0Afrom mhcflurry import Class1AffinityPredictor%0Afrom mhcflurry.common import random_peptides%0A%0ANUM = 100000%0A%0ADOWNLOADED_PREDICTOR = Class1AffinityPredictor.load()%0A%0A%0Adef test_speed... | |
3283c9ac640112ab7a26ec3f82e051394ca72ecf | Add catapult presubmit with list of trybots. | PRESUBMIT.py | PRESUBMIT.py | Python | 0 | @@ -0,0 +1,631 @@
+# Copyright (c) 2015 The Chromium Authors. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A%0A%22%22%22Top-level presubmit script for catapult.%0A%0ASee https://www.chromium.org/developers/how-tos/depottools/presubmit-sc... | |
05a5599fd0cf08cf33c8a90673e8c71b4c1d6c36 | Test implementation of convex hull | slides/ComputationalGeometry/convex-hull.py | slides/ComputationalGeometry/convex-hull.py | Python | 0 | @@ -0,0 +1,1802 @@
+import math%0A%0Aclass Vector:%0A def __init__(self, x, y):%0A self.x = x%0A self.y = y%0A %0A # add theta, so we can sort by it later%0A self.theta = math.atan2(y, x)%0A%0A def add(self, other):%0A return Vector(self.x + other.x, self.y + other.y)%0A ... | |
d30db10d1038301fe7b659e23d96a256f77bec6b | remove debug clause | beetsplug/mpdupdate.py | beetsplug/mpdupdate.py | # This file is part of beets.
# Copyright 2013, Adrian Sampson.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, ... | Python | 0 | @@ -3692,16 +3692,8 @@
nged
- or True
:%0A
|
df264f2ec00dc84a0a7ca637c568a3273f55fd03 | remove unnecessary else | homeassistant/components/camera/__init__.py | homeassistant/components/camera/__init__.py | # pylint: disable=too-many-lines
"""
homeassistant.components.camera
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Component to interface with various cameras.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/camera/
"""
import requests
import logging
import time
impor... | Python | 0.000008 | @@ -4255,34 +4255,8 @@
nue%0A
- else:%0A
@@ -4295,20 +4295,16 @@
.join((%0A
-
@@ -4372,36 +4372,32 @@
-
-
'Content-type: i
@@ -4424,20 +4424,16 @@
-
)) + '%5Cr
@@ -4449,36 +4449,32 @@
-
-
handler.request.
@@ -4474,36 +... |
e0597427d93f2260dfce35cfdd3e2714037fb0fb | Implement cheb_dif for getting 1D chebyshev grids and differentiation matrices. | src/spatial_discretizations/FourierChebyshevSpatialDiscretization.py | src/spatial_discretizations/FourierChebyshevSpatialDiscretization.py | Python | 0 | @@ -0,0 +1,1592 @@
+import numpy as np%0Afrom numpy.fft import fft, ifft, fftshift, fft2, ifft2%0Afrom scipy.linalg import toeplitz%0A%0Aclass FourierChebyshevSpatialDiscretization:%0A def __init__(self, config):%0A self.length_x = config%5B'length_x'%5D%0A self.length_y = config%5B'length_y'%5D%0A ... | |
23bd2cedbeeef22715fbd65229f881e7230507d8 | Create decorator.py | notebook2/decorator.py | notebook2/decorator.py | Python | 0.000001 | @@ -0,0 +1,159 @@
+def decor(func):%0A%09def wrap():%0A%09%09print('===')%0A%09%09func()%0A%09%09print('===')%0A%09return wrap%0A%0Adef print_text():%0A%09print('Text')%0A%0Adecorated = decor(print_text)%0Adecorated()%0A
| |
42c9ce432f1e5a328fe35eef64d0667a01eeeb19 | allow it to have a name and a type | python/qidoc/template_project.py | python/qidoc/template_project.py | class TemplateProject(object):
def __init__(self, doc_worktree, worktree_project):
self.src = worktree_project.src
self.path = worktree_project.path
self.doc_worktree = doc_worktree
##
# Add self.doxfile_in, self.sphinx_conf_in, etc.
def __repr__(self):
return "<Templat... | Python | 0.000002 | @@ -76,24 +76,90 @@
e_project):%0A
+ self.doc_type = %22template%22%0A self.name = %22template%22%0A
self
|
3f38f149cf357549006ed97364eb886287d0d2be | Add support for discovering k8s api info from service account | kubespawner/utils.py | kubespawner/utils.py | """
Misc. general utility functions, not tied to Kubespawner directly
"""
import os
import yaml
from tornado.httpclient import HTTPRequest
def request_maker(path='~/.kube/config'):
"""
Return a function that creates Kubernetes API aware HTTPRequest objects
Reads a .kube/config file from the given path, ... | Python | 0 | @@ -157,115 +157,2080 @@
ker(
-path='~/.
+):%0A %22%22%22%0A Return a k8s api aware HTTPRequest factory that autodiscovers connection info%0A %22%22%22%0A if os.path.exists('/var/run/secrets/kubernetes.io/serviceaccount/token'):%0A # We are running in a pod, and have access to a service account!%0A ... |
283c049d3a3bdba4a35d71f44fb7a2c453713c9f | Calculate "minute" correctly. | opbeat/utils/traces.py | opbeat/utils/traces.py | from collections import defaultdict
import threading
import time
from datetime import datetime
class _RequestList(object):
def __init__(self, transaction, response_code, minute):
self.transaction = transaction
self.response_code = response_code
self.minute = minute
self.durations =... | Python | 0.998189 | @@ -1194,16 +1194,19 @@
me()/60)
+*60
)%0A%0A
|
2a1e09f99c5c1c80286048a27d6ba0c2ef7fc5b3 | Add none property store | txdav/base/propertystore/none.py | txdav/base/propertystore/none.py | Python | 0.000001 | @@ -0,0 +1,1789 @@
+# -*- test-case-name: txdav.base.propertystore.test.test_none,txdav.caldav.datastore,txdav.carddav.datastore -*-%0A##%0A# Copyright (c) 2010-2011 Apple Inc. 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 compli... | |
d77dd62203e0898ab326092c410638a0274e53d9 | Initialize P02_errorExample | books/AutomateTheBoringStuffWithPython/Chapter10/P02_errorExample.py | books/AutomateTheBoringStuffWithPython/Chapter10/P02_errorExample.py | Python | 0.000006 | @@ -0,0 +1,176 @@
+# This program raises an exception and automatically displays the traceback%0A%0A%0Adef spam():%0A bacon()%0A%0A%0Adef bacon():%0A raise Exception(%22This is the error message.%22)%0A%0A%0Aspam()%0A
| |
61d0649925fae2d1eca1f512ec519f440f4a5528 | Create OutputNeuronGroup_multiple_outputs_2.py | examples/OutputNeuronGroup_multiple_outputs_2.py | examples/OutputNeuronGroup_multiple_outputs_2.py | Python | 0 | @@ -0,0 +1,2836 @@
+'''%0AExample of a spike receptor (only receives spikes)%0A%0AIn this example spikes are received and processed creating a raster plot at the end of the simulation.%0A%0A'''%0A%0Afrom brian import *%0Aimport numpy%0A%0Afrom brian_multiprocess_udp import BrianConnectUDP%0A%0A# The main function with ... | |
180a1cd82b02d23b824d706c44d4c6838eca0dd2 | Add from_nailgun.py manager | f2s/resources/role_data/managers/from_nailgun.py | f2s/resources/role_data/managers/from_nailgun.py | Python | 0.000001 | @@ -0,0 +1,267 @@
+#!/usr/bin/env python%0A%0Aimport sys%0Aimport json%0A%0Afrom fuelclient.objects.environment import Environment%0A%0AARGS = json.loads(sys.stdin.read())%0A%0Aenv = Environment(ARGS%5B'env'%5D)%0Afacts = env.get_default_facts('deployment', %5BARGS%5B'uid'%5D%5D)%0A%0Asys.stdout.write(json.dumps(facts)... | |
9a25f2c9506ce2c35b9199a96d3106fcc8479d87 | remove unused import | src/robotide/editor/sourceeditor.py | src/robotide/editor/sourceeditor.py | import wx
from wx import stc
from StringIO import StringIO
from robot.parsing.model import TestCaseFile
from robot.parsing.populators import FromFilePopulator
from robot.parsing.txtreader import TxtReader
from robotide.publish.messages import RideItemNameChanged
from robotide.widgets import VerticalSizer
from robotide... | Python | 0.000001 | @@ -56,53 +56,8 @@
gIO%0A
-from robot.parsing.model import TestCaseFile%0A
from
|
cd444633870a83adc4220b0bc7025a4ee014ba69 | Add e2e testing python file | tests/e2e/test_e2e_identidock.py | tests/e2e/test_e2e_identidock.py | Python | 0.000001 | @@ -0,0 +1,28 @@
+import sys%0A%0Aprint(sys.path)%0A
| |
4c6de322d04504e4c0c2c46f686820d3d62b7dac | Add mdata grains as separate module | salt/grains/mdata.py | salt/grains/mdata.py | Python | 0.000001 | @@ -0,0 +1,2231 @@
+# -*- coding: utf-8 -*-%0A'''%0A test grains%0A'''%0Afrom __future__ import absolute_import%0A%0A# Import python libs%0Aimport os%0Aimport logging%0A%0A# Import salt libs%0Aimport salt.utils%0A%0A# Solve the Chicken and egg problem where grains need to run before any%0A# of the modules are loaded... | |
ccdc943f4c0292d6046b32cacab410ba6cf1477a | Add the StatePass module | lib/game_states/state_pass.py | lib/game_states/state_pass.py | Python | 0 | @@ -0,0 +1,3073 @@
+%22%22%22This module contains the StatePass class which defines the data%0Aobject that will be passed between Game States.%0A%22%22%22%0Afrom pygame.mixer import Channel%0Afrom lib.custom_data.settings_data import SettingsData%0A%0A%0Aclass StatePass(object):%0A %22%22%22Stores common data that w... | |
7d09120e1122c5b9888368e7d98b41fe8fdedf87 | add script to send test messages to MNOs | scripts/test-MNOs.py | scripts/test-MNOs.py | Python | 0 | @@ -0,0 +1,1174 @@
+#!/usr/bin/env python%0A%0Aimport urllib2%0Aimport urllib%0Aimport sys%0Aimport datetime%0Aimport pytz%0A%0Atest_phones = %5B%0A ('MTN', '2348142235832'),%0A ('Etisalat', '2348183273915'),%0A ('Glo', '2348117159357'),%0A ('Airtel', '2347010915898'),%0A%5D%0A%0Awat = pytz.timezone('Africa... | |
308fb5c3cb69966d7f7bf20ea1e4753d68d3fe4b | Add init | scrapi/consumers/cmu/__init__.py | scrapi/consumers/cmu/__init__.py | Python | 0.085164 | @@ -0,0 +1,39 @@
+from consumer import consume, normalize
| |
79343dda0711e34ef577ff37bddfe3f83d0035f5 | add script to fetch NOMADS data | scripts/model/fetch_nomads_nc.py | scripts/model/fetch_nomads_nc.py | Python | 0 | @@ -0,0 +1,882 @@
+%22%22%22%0ADownload netcdf data from NOMADS Thredds service, run as%0A%0A/usr/local/python/bin/python fetch_nomads_nc.py%0A%22%22%22%0Aimport mx.DateTime%0Aimport subprocess%0A%0A# start time, GMT%0Asts = mx.DateTime.DateTime(2010,11,1)%0A# end time, GMT%0Aets = mx.DateTime.DateTime(2012,9,17)%0A# I... | |
44f81107d829f76d9f6338a0ba2545a68539515e | Introduce Partial differences class. | Core/Difference.py | Core/Difference.py | Python | 0 | @@ -0,0 +1,526 @@
+# -*- coding:utf-8 -*- %0A%0A%0A#--%0A#%0A# Copyright (C) 2013-2014 Micha%C3%ABl Roy%0A#%0A#--%0A%0A%0A#--%0A#%0A# External dependencies%0A#%0A#--%0A#%0Afrom numpy import array%0A%0A%0A#--%0A#%0A# Difference%0A#%0A#--%0A#%0A# Defines a class representing partial differences on triangular mesh%0A#%0Ac... | |
059a9b14e6db26f6131d41e758d1f14b33bc25b8 | add python script to jump to a random line | vim/goto-random.py | vim/goto-random.py | Python | 0.000001 | @@ -0,0 +1,652 @@
+import random%0Aimport vim%0A%0A%0A# Jumps to a random line inside the current buffer. Helpful if you have lots of%0A# testcases inside a single file and you want to minimize conflicts, i.e. just%0A# appending tests to the end of the file is a bad strategy.%0Adef main():%0A # Add an entry to the j... | |
ae6eb7d4716cab50e8850a94a93c96167337c150 | add fourth tool of Ultimate family, Ultimate GemCutter | benchexec/tools/ultimategemcutter.py | benchexec/tools/ultimategemcutter.py | Python | 0 | @@ -0,0 +1,932 @@
+# This file is part of BenchExec, a framework for reliable benchmarking:%0A# https://github.com/sosy-lab/benchexec%0A#%0A# SPDX-FileCopyrightText: 2016-2021 Daniel Dietsch %3Cdietsch@informatik.uni-freiburg.de%3E%0A# SPDX-FileCopyrightText: 2016-2020 Dirk Beyer %3Chttps://www.sosy-lab.org%3E%0A#%0A# ... | |
772ebd24f21f69eacfaae2b1a6658b82031dbd75 | add import script for North Norfolk | polling_stations/apps/data_collection/management/commands/import_north_norfolk.py | polling_stations/apps/data_collection/management/commands/import_north_norfolk.py | Python | 0 | @@ -0,0 +1,2127 @@
+from django.contrib.gis.geos import Point%0Afrom data_collection.management.commands import BaseCsvStationsCsvAddressesImporter%0Afrom data_finder.helpers import geocode_point_only, PostcodeError%0A%0Aclass Command(BaseCsvStationsCsvAddressesImporter):%0A council_id = 'E07000147'%0A addre... | |
912ec1162e18b6ffc05ecebaf74f0b946748fa00 | fix device/proxy functions arguments names to | zmq/cffi_core/devices.py | zmq/cffi_core/devices.py | # coding: utf-8
from ._cffi import C, ffi, zmq_version_info
from .socket import Socket
from zmq.error import ZMQError
def device(device_type, isocket, osocket):
rc = C.zmq_device(device_type, isocket.zmq_socket, osocket.zmq_socket)
if rc != 0:
raise ZMQError(C.zmq_errno())
return rc
def proxy(i... | Python | 0 | @@ -137,32 +137,33 @@
e_type,
-isocket, osocket
+frontend, backend
):%0A r
@@ -192,24 +192,26 @@
e_type,
-isocket.
+frontend._
zmq_sock
@@ -210,32 +210,33 @@
zmq_socket,
-osocket.
+backend._
zmq_socket)%0A
@@ -320,33 +320,34 @@
oxy(
-isocket, osocket, msocket
+frontend, backend, capture
=Non
@@ -368,23 +3... |
a9348b49b6e91046941fb3af3a6b85edd072d7d9 | add a module for descriptors | cheeseprism/desc.py | cheeseprism/desc.py | Python | 0.000001 | @@ -0,0 +1,489 @@
+class updict(dict):%0A %22%22%22%0A A descriptor that updates it's internal represention on set, and%0A returns the dictionary to original state on deletion.%0A %22%22%22%0A %0A def __init__(self, *args, **kw):%0A super(updict, self).__init__(*args, **kw)%0A self.defau... | |
23d61ae75c505d0e57eea0a3e04301e5b8d52498 | Change the backend to threading | skopt/learning/gbrt.py | skopt/learning/gbrt.py | import numpy as np
from sklearn.base import clone
from sklearn.base import BaseEstimator, RegressorMixin
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.utils import check_random_state
from sklearn.externals.joblib import Parallel, delayed
def _parallel_fit(regressor, X, y):
return regressor.... | Python | 0.000487 | @@ -2926,16 +2926,37 @@
f.n_jobs
+, backend='threading'
)(%0A
|
d38b352f9e8da872ab1ff007df6ada76dfa8991b | add generic parameter passing from UIDebug | ai/executors/debug_executor.py | ai/executors/debug_executor.py | # Under MIT License, see LICENSE.txt
import math
from RULEngine.Debug.ui_debug_command import UIDebugCommand
from RULEngine.Util.Pose import Pose, Position
from ai.STA.Strategy.HumanControl import HumanControl
from ai.executors.executor import Executor
from ai.states.world_state import WorldState
class DebugExecutor... | Python | 0 | @@ -2994,16 +2994,24 @@
data
-%5B
+.get(
'args'
-%5D
+, %22%22)
%0A
|
dc477c7b1f0e0ffca01b934919cd32cbd635baab | Implement web scraper for GitHub repos | cibopath/scraper.py | cibopath/scraper.py | Python | 0.000019 | @@ -0,0 +1,1872 @@
+# -*- coding: utf-8 -*-%0A%0Aimport asyncio%0Aimport logging%0A%0Aimport aiohttp%0A%0Afrom cibopath import readme_parser, github_api%0Afrom cibopath.templates import Template%0A%0Alogger = logging.getLogger('cibopath')%0A%0AJSON_STORE = 'templates.json'%0A%0A%0Aclass CibopathError(Exception):%0A ... | |
71f321452f735d84ce0cdd9088c9ac0a163f2016 | set formatter for loggers | zstacklib/zstacklib/utils/log.py | zstacklib/zstacklib/utils/log.py | '''
@author: frank
'''
import logging
import logging.handlers
import sys
import os.path
class LogConfig(object):
instance = None
LOG_FOLER = '/var/log/zstack'
def __init__(self):
if not os.path.exists(self.LOG_FOLER):
os.makedirs(self.LOG_FOLER, 0755)
... | Python | 0 | @@ -1251,16 +1251,211 @@
unt=3)%0D%0A
+ formatter = logging.Formatter('%25(asctime)s %25(levelname)s %5B%25(name)s%5D %25(message)s')%0D%0A max_rotate_handler.setFormatter(formatter)%0D%0A max_rotate_handler.setLevel(logging.DEBUG)%0D%0A
|
549562247018e9c51e8cb8023972c1cf73fc84f4 | add gc01.py | trypython/stdlib/gc01.py | trypython/stdlib/gc01.py | Python | 0.000001 | @@ -0,0 +1,1339 @@
+# coding: utf-8%0A%22%22%22gc%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%E3%81%AE%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%81%A7%E3%81%99%E3%80%82%22%22%22%0Aimport gc%0Aimport secrets%0Aimport string%0A%0Afrom trypython.common.commoncls import SampleBase, timetra... | |
4593aa5edf05b014aa6c7fe9de8b239ab2fa91b8 | Add snapshot_framework_stats.py script | scripts/snapshot_framework_stats.py | scripts/snapshot_framework_stats.py | Python | 0 | @@ -0,0 +1,1508 @@
+#!/usr/bin/env python%0A%22%22%22Change user password%0A%0AUsage:%0A snapshot_framework_stats.py %3Cframework_slug%3E %3Cstage%3E %3Capi_token%3E%0A%0AExample:%0A ./snapshot_framework_stats.py g-cloud-7 dev myToken%0A%22%22%22%0A%0Aimport sys%0Aimport logging%0A%0Alogger = logging.getLogger('s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.