commit stringlengths 40 40 | subject stringlengths 1 1.49k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | new_contents stringlengths 1 29.8k | old_contents stringlengths 0 9.9k | lang stringclasses 3
values | proba float64 0 1 |
|---|---|---|---|---|---|---|---|
8982f8d7e00ddf55782c2cd5a9c895d44afd1fca | Add wolfram plugin | plugins/wolfram.py | plugins/wolfram.py | import lxml.etree
import io
import re
import requests
import urllib.parse
import sys
class Plugin:
def __init__(self, appid):
self.appid = appid
def format_pod(self, pod):
subpod = pod.find("subpod")
return self.format_subpod(subpod)
def convert_unicode_chars(self, text):
... | Python | 0 | |
9a237141c9635d2a1dad6349ad73d24e969d8460 | Add runner | hud-runner.py | hud-runner.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Convenience wrapper for running hud directly from source tree."""
from hud.hud import main
if __name__ == '__main__':
main()
| Python | 0.000022 | |
bfb7d8d9356fe66f433556977a333e4256c6fb61 | Create series.py | trendpy/series.py | trendpy/series.py | # series.py
# MIT License
# Copyright (c) 2017 Rene Jean Corneille
# 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, co... | Python | 0 | |
250d1c20c16b6c0846a9fb94ef4ebc6e780221df | Create solution.py | hackerrank/algorithms/implementation/easy/equalize_the_array/py/solution.py | hackerrank/algorithms/implementation/easy/equalize_the_array/py/solution.py | def solution(nums):
import collections
if len(nums) == 0:
return 0
item, count = collections.Counter(nums).most_common()[0]
return len(nums) - count
n = int(input())
nums = tuple(map(int, input().split()))
cnt = solution(nums)
print(cnt)
| Python | 0.000018 | |
fca6421c53e286549d861c65c114991602f310ea | Add some adaptors. | pykmer/adaptors.py | pykmer/adaptors.py | """
This module provides some adaptors for converting between
different data formats:
`k2kf`
Convert a sequence of k-mers to k-mer frequency pairs
`kf2k`
Convert a sequence of k-mer frequency pairs to k-mers
`keyedKs`
Provide keyed access to a sequence of k-mers
`keyedKFs`
Provide keyed access to a... | Python | 0 | |
b7f3e32827bb9a0f122928d218f4d535febb0829 | add command | Command.py | Command.py | # -*- coding: utf-8 -*-
"""
Command pattern
"""
from os import listdir, curdir
class ListCommand(object):
def __init__(self, path=None):
self.path = path or curdir
def execute(self):
self._list(self.path)
@staticmethod
def _list(path=None):
print 'list path {} :'.format(p... | Python | 0.000292 | |
bd865a9fdc941b99be40a5ba3dcc02b819b2e9da | add cpm.utils.refstring | cpm/utils/refstring.py | cpm/utils/refstring.py | # Copyright (c) 2017 Niklas Rosenstein
#
# 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, modify, merge, publish, d... | Python | 0.000001 | |
edb904ca105abfb767f94f366e19ed05374a8014 | Create URL Shortner | URLShortner.py | URLShortner.py | import uuid
import json
import os
from glob import iglob
from pprint import pprint
mapping={}
mapping['URL']=[]
#Getting JSON file of initial Tika parsing containing list of file paths categorized by MIME types
file="C:/Users/rahul/Documents/GitHub/Scientific-Content-Enrichment-in-the-Text-Retrieval-Conference-TREC-Po... | Python | 0 | |
62a13341610d476ba8ff9e3fd5a3476cbdb18225 | Create convert.py | convert.py | convert.py | import gensim
#word2vec embeddings start with a line with the number of lines (tokens?) and the number of dimensions of the file. This allows
#gensim to allocate memory accordingly for querying the model. Larger dimensions mean larger memory is held captive. Accordingly, this line
#has to be inserted into the GloVe em... | Python | 0.000002 | |
5d5ccc84eaaec6b6d749a9054f744a5a44f9dac9 | add script for reading from PCF8574 | i2c/PCF8574.py | i2c/PCF8574.py | #!/usr/bin/python
import sys
import smbus
import time
# Reads data from PCF8574 and prints the state of each port
def readPCF8574(busnumber,address):
address = int(address,16)
busnumber = int(1)
bus = smbus.SMBus(busnumber)
state = bus.read_byte(address);
for i in range(0,8):
port = "port... | Python | 0 | |
37b92cdd13bd9c86b91bac404a8c73c62ebafa53 | Add VPC_With_VPN_Connection example | examples/VPC_With_VPN_Connection.py | examples/VPC_With_VPN_Connection.py | # Converted from VPC_With_VPN_Connection.template located at:
# http://aws.amazon.com/cloudformation/aws-cloudformation-templates/
from troposphere import Base64, FindInMap, GetAtt, Join, Output
from troposphere import Parameter, Ref, Tags, Template
from troposphere.cloudfront import Distribution, DistributionConfig
f... | Python | 0.000001 | |
b792a8cb3d61dbac1c48a16585c7bb6725bc06a0 | add barebones | barebones_ssg/ssg.py | barebones_ssg/ssg.py |
# hack to get unicode working with jinja2
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import glob
import metadata as meta
from tag_ontology import *
import commands as c
import json
from jinja2 import Template, Environment, FileSystemLoader
import os
pages_pat = "pages/*.md"
pages_lst = glob.glob(pages_p... | Python | 0.999962 | |
ddbe9de5cfc5b412812096291db6a37d120e03ce | add plotting the distribution of fields and apgoee | py/plot_dustwapogee.py | py/plot_dustwapogee.py | ###############################################################################
# plot_dustwapogee: plot the dust-map at 5 kpc with the APOGEE fields in the
# sample overlayed
###############################################################################
import sys
import numpy
import healpy
from ga... | Python | 0 | |
139a634515061674d3832320791d35ff512d8a5a | Add a snippet. | python/print_stderr.py | python/print_stderr.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
print("Error message", file=sys.stderr)
| Python | 0.000002 | |
2909b4a7e46fe4a466e0c99abf90222c43f34d93 | add tests for Every Election wrapper | polling_stations/apps/data_finder/tests/test_ee_wrapper.py | polling_stations/apps/data_finder/tests/test_ee_wrapper.py | import mock
from django.test import TestCase
from data_finder.helpers import EveryElectionWrapper
# mock get_data() functions
def get_data_exception(self, postcode):
raise Exception()
def get_data_no_elections(self, postcode):
return []
def get_data_with_elections(self, postcode):
return [
{}, ... | Python | 0 | |
8d31c4091edbd955dc292d8b9ebc75fb69477df9 | Add image processor for ros | Turtlebot/image.py | Turtlebot/image.py | #!/usr/bin/env python
import cv2
import rospy
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import datetime
import numpy as np
import socket
import sys
import threading
import select
import signal
class ImageConvertor:
c = 0
def __init__(self):
self.server = None
... | Python | 0.000001 | |
67d760f0a3ed081d43237e1b2106b86a4e6a56c6 | add log handler | Util/LogHandler.py | Util/LogHandler.py | # -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name๏ผ LogHandler.py
Description :
Author : JHao
date๏ผ 2017/3/6
-------------------------------------------------
Change Activity:
2017/3/6: log handler
--------------------------------... | Python | 0.000002 | |
7331e1d1061a7a1ac9abc583d45746facfde9180 | Create search-in-a-binary-search-tree.py | Python/search-in-a-binary-search-tree.py | Python/search-in-a-binary-search-tree.py | # Time: O(h)
# Space: O(1)
# Given the root node of a binary search tree (BST) and a value.
# You need to find the node in the BST that the node's value equals the given value.
# Return the subtree rooted with that node.
# If such node doesn't exist, you should return NULL.
#
# For example,
#
# Given the tree:
# ... | Python | 0.000023 | |
7ccd01315c3be8f8742d6bde0351f10aa431057a | Add grid_2D.py | worlds/grid_2D.py | worlds/grid_2D.py | '''
Created on Jan 11, 2012
@author: brandon_rohrer
'''
import stub_world
import agent_stub as ag
import pickle
import numpy as np
#import matplotlib.pyplot as plt
class World(stub_world.StubWorld):
''' grid_2D.World
Two-dimensional grid task
In this task, the agent steps North, South, Eas... | Python | 0.000005 | |
130d94001810a72e3647ec169b5a26d556bf0101 | Create pregunta2.py | pregunta2.py | pregunta2.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import random
from adivinaconf import *
class SetEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, set):
return list(obj)
return json.JSONEncoder.default(self, obj)
def trad_sino(s):
... | Python | 0.999989 | |
58311387849f8785fa964eb01e728c92bc0d8b61 | Create levenshtein.py | levenshtein.py | levenshtein.py |
# source: http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance
def levenshtein(source, target):
if len(source) < len(target):
return levenshtein(target, source)
# So now we have len(source) >= len(target).
if len(target) == 0:
return len(source)
# We c... | Python | 0.000001 | |
d205c9a5a2d92190676a30156e039f8cdd400629 | Correct base API | pysis/sis.py | pysis/sis.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from datetime import datetime
import calendar
class SIS(object):
__BASE_URL__ = 'http://api.ndustrial.io/v1/'
__API_DOMAIN__ = 'api.ndustrial.io'
#__BASE_URL__ = 'http://localhost:3000/v1/'
#__API_DOMAIN__ = 'localhost:3000'
"""Main SIS object
... | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from datetime import datetime
import calendar
class SIS(object):
__BASE_URL__ = 'http://api.sustainableis.com/v1/'
__API_DOMAIN__ = 'api.sustainableis.com'
#__BASE_URL__ = 'http://localhost:3000/v1/'
#__API_DOMAIN__ = 'localhost:3000'
"""Main SIS ob... | Python | 0.000003 |
ef7834df028b0d04d12298183dbc5602bd7ba92a | Add some rough unit tests for the API | spiff/api/tests.py | spiff/api/tests.py | from django.test import TestCase
from django.test.client import Client
from spiff import membership, inventory
from django.contrib.auth.models import User
import json
class APITestMixin(TestCase):
def setupAPI(self):
self.user = User.objects.create_user('test', 'test@example.com', 'test')
self.user.first_nam... | Python | 0 | |
a5b012db4cb4cc8a988c0ed37411194639dd1bbd | add tester.py module to pytools | lib/tester.py | lib/tester.py | #!/usr/bin/env python
"""
Package: pytools
Author: Christopher Hanley
Purpose:
========
Provide driver function for package tests.
Dependencies:
=============
- nose 0.10.4 or greater.
Usage Example:
==============
All packages will need to import jwtools.tester and add the following
function to the __init__.py of... | Python | 0.000006 | |
6efc045d34f432723b52aa094c1caec3bf102e96 | add sparse repeated updates benchmark | benchmarks/sparse_repeated_updates.py | benchmarks/sparse_repeated_updates.py | import numpy as np
import theano
import theano.tensor as T
fX = theano.config.floatX
s = theano.shared(np.ones((10, 1), dtype=fX))
idxs = [0, 1, 1]
fn = theano.function([], updates=[(s, T.inc_subtensor(s[idxs], s[idxs] ** 2))])
fn()
print s.get_value()
| Python | 0 | |
4b43906004f9bfb6164bb2c0b95efaf1dbb881c8 | add py | correction_image.py | correction_image.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Project Apricot
# Copyright (c) 2015 Daiki, Takanori.
| Python | 0.00008 | |
fc44d4463045e458796d13b3c97b34cf6ba47f61 | Add script to create the player pitch weights. | bluechip/player/createpitchweights.py | bluechip/player/createpitchweights.py | import random
from player.models import Player, Pitch, PlayerPitchWeight
#TODO: Need to centralize this function call.
random.seed(123456789)
pitch_records = Pitch.objects.all().order_by('id')
pitches_count = pitch_records.count()
for p in Player.objects.all():
weights = []
sum_weights = 0
for _ in xrange(pitches_... | Python | 0 | |
d3f68c385da4d2fa864ba748f41785be01c26c34 | Add py solution for 551. Student Attendance Record I | py/student-attendance-record-i.py | py/student-attendance-record-i.py | class Solution(object):
def checkRecord(self, s):
"""
:type s: str
:rtype: bool
"""
A = False
L = 0
for c in s:
if c == 'L':
L += 1
if L > 2:
return False
else:
L = 0
... | Python | 0.998417 | |
a1ee4d90e0cf159f27274423b989c98844fbeba1 | Create mytask1b.py | ml/mytask1b.py | ml/mytask1b.py | """ Features
The objective of this task is to explore the corpus, deals.txt.
The deals.txt file is a collection of deal descriptions, separated by a new line, from which
we want to glean the following insights:
1. What is the most popular term across all the deals?
2. What is the least popular term across all t... | Python | 0.999813 | |
714e2e2ae5e8412ef522dc64666e6548307eec07 | Add the init method to the topic model. | model/topic.py | model/topic.py | class TopicModel(Query):
def __init__(self, db):
self.db = db
self.table_name = "topic"
super(TopicModel, self).__init__()
| Python | 0 | |
168c45fa913670c7f6d89ffc799fa9d13454d734 | add multi-layer convolutional net for mnist | multi-layer.py | multi-layer.py | """
solving mnist classification problem using tensorflow
multi-layer architecture
"""
# Config
BATCH_SIZE = 50
ITERATIONS = 20000
# Setup Logging
import logging
logging_format = '%(asctime)s - %(levelname)s - %(message)s'
log_level = logging.DEBUG
logging.basicConfig(filename='logfile.log',format=logging_format,leve... | Python | 0.000003 | |
c795f8e21d2b400134cb52ef7eae2cc7e26cfd99 | Create ada.py | ada.py | ada.py | Python | 0.00017 | ||
028831c53d27452168b7a430eb713e01c966acb0 | add privacy policy as first legal check | accelerator/migrations/0006_add_privacy_policy_legal_check.py | accelerator/migrations/0006_add_privacy_policy_legal_check.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-05-14 09:09
from __future__ import unicode_literals
from django.db import migrations
def add_privacy_policy_legal_check(apps, schema_editor):
LegalCheck = apps.get_model('accelerator', 'LegalCheck')
LegalCheck.objects.create(
name='accepted... | Python | 0 | |
a2975adeedcc4aa33ee8b63bd404675bb3453089 | Add broker app. | apps/broker.py | apps/broker.py | """
Alter item database.
"""
import logging
import sys
import os
# import hack to avoid PYTHONPATH
try:
import pydarkstar
except ImportError:
root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
root, dirs, files = next(os.walk(root))
if 'pydarkstar' in dirs:
sys.path.insert(1, r... | Python | 0 | |
997339beae952b0a3d63644546d02b257164a1a2 | add tests for marching cubes and mesh surface area | skimage/measure/tests/test_marching_cubes.py | skimage/measure/tests/test_marching_cubes.py | import numpy as np
from numpy.testing import assert_raises
from scipy.special import (ellipkinc as ellip_F, ellipeinc as ellip_E)
from skimage.measure import marching_cubes, mesh_surface_area
def _ellipsoid(a, b, c, sampling=(1., 1., 1.), info=False, tight=False,
levelset=False):
"""
Generates... | Python | 0 | |
edb498113441acb68511a478f2ec18c1be4f1384 | Add tests for provision state commands | ironicclient/tests/functional/osc/v1/test_baremetal_node_provision_states.py | ironicclient/tests/functional/osc/v1/test_baremetal_node_provision_states.py | # Copyright (c) 2016 Mirantis, Inc.
#
# 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... | Python | 0.999685 | |
a8c08baeb2ee6268ac61613a23cc86cf885a9d09 | Handle NULL deleted_at in migration 112. | nova/db/sqlalchemy/migrate_repo/versions/112_update_deleted_instance_data.py | nova/db/sqlalchemy/migrate_repo/versions/112_update_deleted_instance_data.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/... | Python | 0.000002 |
7dbab1a6615a49513fe16c74550ddf2f52b0f698 | Create 4-keys-keyboard.py | Python/4-keys-keyboard.py | Python/4-keys-keyboard.py | # Time: O(n)
# Space: O(1)
class Solution(object):
def maxA(self, N):
"""
:type N: int
:rtype: int
"""
if N <= 6:
return N
dp = [i for i in range(N+1)]
for i in xrange(7, N+1):
dp[i % 6] = max(dp[(i-4) % 6]*3,dp[(i-5) % 6]*4)
... | Python | 0.999774 | |
be9c88b630ea243afdef3d87ac0b316bd3300281 | Add 283-move-zeroes.py | 283-move-zeroes.py | 283-move-zeroes.py | """
Question:
Move Zeroes
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.
For example, given nums = [0, 1, 0, 3, 12], after calling your function, nums should be [1, 3, 12, 0, 0].
Note:
You must do this in-place... | Python | 0.011626 | |
5d7f2fdfb1b850aacaf29ba76c7e5ed441e6db63 | Create 32losmasgrandes.py | 32losmasgrandes.py | 32losmasgrandes.py | #Integrantes del equipo
#Chavez Pavon Jose Manuel
#Ramirez Ramirez Servando
#Saules Rojas David
#Lopez Adriana
import random
#Funcino para crear una lista
#La cual usaremos para simular las alturas de las 32 personas
#La llenaremos de forma aleatoria
def lista ():
l = [] #Creamos la lista de las "alturas"
for x i... | Python | 0.000132 | |
a7ccd7bc02476cfad85280ff1e742671453360de | Add Digital Outcomes and Specialists to frameworks | migrations/versions/420_dos_is_coming.py | migrations/versions/420_dos_is_coming.py | """DOS is coming
Revision ID: 420
Revises: 410_remove_empty_drafts
Create Date: 2015-11-16 14:10:35.814066
"""
# revision identifiers, used by Alembic.
revision = '420'
down_revision = '410_remove_empty_drafts'
from alembic import op
import sqlalchemy as sa
from app.models import Framework
def upgrade():
op.e... | Python | 0 | |
273f0bd289d62c6980f095b0a8bb41a973b0678f | add import script for Bradford | polling_stations/apps/data_collection/management/commands/import_bradford.py | polling_stations/apps/data_collection/management/commands/import_bradford.py | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E08000032'
addresses_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June2017.tsvJune2017.tsv'
stations_name = 'parl.2017-06-08/Version 1/Democracy_Club__0... | Python | 0 | |
12ba7e0c6db91f5ee46a1be9acaece110f98b911 | add bigwig file reader | PyMaSC/bwreader.py | PyMaSC/bwreader.py | import os
import wWigIO
class BigWigFile(object):
@staticmethod
def wigToBigWig(wigfile, sizefile, bwfile):
wWigIO.wigToBigWig(wigfile, sizefile, bwfile)
@staticmethod
def bigWigToWig(bwfile, wigfile):
wWigIO.bigWigToWig(bwfile, wigfile)
def __init__(self, path, chrom_size=None)... | Python | 0 | |
c03cd3f85e9df113ef10833eaedfc846adde45f6 | Add an example for the job board feature | taskflow/examples/job_board_no_test.py | taskflow/examples/job_board_no_test.py | # -*- encoding: utf-8 -*-
#
# Copyright ยฉ 2013 eNovance <licensing@enovance.com>
#
# Authors: Dan Krause <dan@dankrause.net>
# Cyril Roelandt <cyril.roelandt@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You ... | Python | 0.000033 | |
c0f690fe1d43edc4fc5cc4b3aeb40594c1abd674 | Create pollard_rho_algorithm.py | daedalus/attacks/pollard_rho_algorithm.py | daedalus/attacks/pollard_rho_algorithm.py | #pollard rho algorithm of integer factorization
def gcd(a,b):
if a is 0:
return b
return gcd(b%a,a)
def pollard_rho(number,x,y):
d = 1
while d is 1:
x = (x**2+1)%number
for i in range(0,2,1):
y = (y**2+1)%number
if x>y:
z = x-y
else:
... | Python | 0.000772 | |
c5dfcffdf743e2c26b8dba6e3be8aee7d7aaa608 | Test `write_*` and `join_*` on bytes | test/test_join_bytes.py | test/test_join_bytes.py | import re
import linesep
try:
from StringIO import StringIO as BytesIO
except ImportError:
from io import BytesIO
# Based on <https://pytest.org/latest/example/parametrize.html#a-quick-port-of-testscenarios>
def pytest_generate_tests(metafunc):
idlist = []
argvalues = []
for scenario in meta... | Python | 0.000004 | |
a30cd68e77242df4efadc75c4390dd8a3ce68612 | Add data migration for Audit's empty status | src/ggrc/migrations/versions/20170103101308_42b22b9ca859__fix_audit_empty_status.py | src/ggrc/migrations/versions/20170103101308_42b22b9ca859__fix_audit_empty_status.py | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""
Fix audit empty status
Create Date: 2016-12-22 13:53:24.497701
"""
# disable Invalid constant name pylint warning for mandatory Alembic variables.
# pylint: disable=invalid-name
import sqlalchemy as sa... | Python | 0 | |
56b44a5a510390913e2b9c9909218428842dcde8 | Match old_user_id to user_id and old_team_id to team_id | migrations/versions/542fd8471e84_match_old_to_new_user_and_team_columns.py | migrations/versions/542fd8471e84_match_old_to_new_user_and_team_columns.py | # -*- coding: utf-8 -*-
"""Match old to new user and team columns
Revision ID: 542fd8471e84
Revises: 382cde270594
Create Date: 2020-04-07 03:52:04.415019
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '542fd8471e84'
down_revision = '382cde270594'
branch_labels... | Python | 0.999503 | |
52eb461f1679f134aed25c221cfcc63abd8d3768 | add test | test/test_importers/test_youtube_importer.py | test/test_importers/test_youtube_importer.py | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2016 SciFabric LTD.
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | Python | 0.000002 | |
1e9a64fe6324d8b4ac96daafa7427e9f55e6dd38 | add Geom.decompose tests | tests/gobj/test_geom.py | tests/gobj/test_geom.py | from panda3d import core
empty_format = core.GeomVertexFormat.get_empty()
def test_geom_decompose_in_place():
vertex_data = core.GeomVertexData("", empty_format, core.GeomEnums.UH_static)
prim = core.GeomTristrips(core.GeomEnums.UH_static)
prim.add_vertex(0)
prim.add_vertex(1)
prim.add_vertex(2)
... | Python | 0.000001 | |
66b5a1089ed0ce2e615f889f35b5e39db91950ae | Fix serving uploaded files during development. | mezzanine/core/management/commands/runserver.py | mezzanine/core/management/commands/runserver.py |
import os
from django.conf import settings
from django.contrib.staticfiles.management.commands import runserver
from django.contrib.staticfiles.handlers import StaticFilesHandler
from django.views.static import serve
class MezzStaticFilesHandler(StaticFilesHandler):
def get_response(self, request):
res... |
import os
from django.conf import settings
from django.contrib.staticfiles.management.commands import runserver
from django.contrib.staticfiles.handlers import StaticFilesHandler
from django.http import Http404
from django.views.static import serve
class MezzStaticFilesHandler(StaticFilesHandler):
def get_resp... | Python | 0 |
93a7f4cb914de537e477a6c6bd45e0aa28ce2e4f | update model fields | modelview/migrations/0053_auto_20200408_1442.py | modelview/migrations/0053_auto_20200408_1442.py | # Generated by Django 3.0 on 2020-04-08 12:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('modelview', '0052_auto_20200408_1308'),
]
operations = [
migrations.AddField(
model_name='energyframework',
name='data... | Python | 0.000001 | |
bc52778a5ed9ee44f40400cc2693f86318434527 | Add missing file | metashare/repository/editor/lang.py | metashare/repository/editor/lang.py |
from xml.etree.ElementTree import XML
import os
import logging
from metashare.settings import LOG_LEVEL, LOG_HANDLER
import pycountry
# Setup logging support.
logging.basicConfig(level=LOG_LEVEL)
LOGGER = logging.getLogger('metashare.xml_utils')
LOGGER.addHandler(LOG_HANDLER)
def read_langs(filename):
if not os.... | Python | 0.000006 | |
e580995de78c3658951b119577a0f7c335352e13 | Create feature_class_info_to_csv.py | feature_class_info_to_csv.py | feature_class_info_to_csv.py | import arcpy
import os
import time
import csv
begin_time = time.clock()
arcpy.env.workspace = ws = r"\\192-86\DFSRoot\Data\allenj\Desktop\gdb\test.gdb"
mrcsv = r"\\192-86\DFSRoot\Data\allenj\Desktop\gdb\write.csv"
ls = [1,2,3]
writer = csv.writer(open(mrcsv, 'a'))
writer.writerow(["Feature","Feature_Count","Extent... | Python | 0.000003 | |
ae477223f296de9ee6b81a15d56d7140a5bf26ac | Create __init__.py | requests/packages/urllib3/contrib/packages/ssl_match_hostname/__init__.py | requests/packages/urllib3/contrib/packages/ssl_match_hostname/__init__.py | Python | 0.000429 | ||
2ef9fce02be94f8c4e9b5c52ca04a05cce1b5ede | Allow to start server as a module | LiSE/LiSE/server/__main__.py | LiSE/LiSE/server/__main__.py | import cherrypy
from argparse import ArgumentParser
from . import LiSEHandleWebService
parser = ArgumentParser()
parser.add_argument('world', action='store', required=True)
parser.add_argument('-c', '--code', action='store')
args = parser.parse_args()
conf = {
'/': {
'request.dispatch': cherrypy.dispatch.M... | Python | 0.000001 | |
9e2d025384dd58c87bf8d292008711c317cb45df | extract human face | otherFaces.py | otherFaces.py | import cv2
print(cv2.__file__)
import os
import sys
IMAGE_DIR = 'D:\DATA\girl2\girl2'
OUTPUT_DIR = './other_people'
if not os.path.exists(OUTPUT_DIR):
os.makedirs(OUTPUT_DIR)
# http://blog.topspeedsnail.com/archives/10511
# wget https://raw.githubusercontent.com/opencv/opencv/master/data/haarcascades... | Python | 0.999999 | |
a0124a990b4afe0cd5fd3971bae1e43f417bc1b2 | Add management command to find domains impacted by 502 bug | corehq/apps/domain/management/commands/find_secure_submission_image_domains.py | corehq/apps/domain/management/commands/find_secure_submission_image_domains.py | from django.core.management.base import BaseCommand
from corehq.apps.domain.models import Domain
import csv
class Command(BaseCommand):
help = 'Find domains with secure submissions and image questions'
def handle(self, *args, **options):
with open('domain_results.csv', 'wb+') as csvfile:
... | Python | 0 | |
71f1bc5d981952f275500a2b62a67488b33e205b | Longest increasing subsequence algo | LongestIncreasingSubsequence.py | LongestIncreasingSubsequence.py | #Finds a largest increasing subsequence in O(n^2) time
#algorithm at http://www.algorithmist.com/index.php/Longest_Increasing_Subsequence
def LongestSubsequence(array):
n=len(array)
q=[0]*n
p=[-1]*n # Contains all the previos elements to the increasing sequence
for i in range(n):
maxLen=0
for j in ran... | Python | 0.999398 | |
361a075efed0ca4a9877f7268b2e91725ef8be65 | Add encoder.py | encoder.py | encoder.py | """
Source: https://trac.ffmpeg.org/wiki/Encode/H.264
"""
import os
import sys
import subprocess
FFMPEG_PATH = '/usr/local/bin/ffmpeg'
VIDEO_CODEC = 'h264'
VIDEO_ENCODER = 'h264_omx'
AUDIO_CODEC = 'aac'
AUDIO_ENCODER = 'aac'
BITRATE = '2500k'
SRC_DIR = os.path.expanduser('~/Desktop')
DEST_DIR = os.path.expanduser(... | Python | 0.000011 | |
00c7e9a020b60b9bfbc2c8c8e1b3e40869f9a73e | Add unit tests for agent membership | midonet/neutron/tests/unit/test_extension_agent_membership.py | midonet/neutron/tests/unit/test_extension_agent_membership.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2015 Midokura SARL.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.... | Python | 0 | |
3344c49bf36a4bd74fb9db079297b98a2e0ee46f | Implement cht.sh release script | bin/release.py | bin/release.py | #!/usr/bin/env python
from __future__ import print_function
from datetime import datetime
import os
from os import path
import re
import shutil
import subprocess
from subprocess import Popen
import sys
SHARE_DIR = path.join(path.dirname(__file__), "../share/")
def run(args):
return Popen(args, stdout=sys.stdou... | Python | 0 | |
278cd37ada508701896c2669a215365785f5a261 | Add eval dispatch (copied from compyle) | evalExp.py | evalExp.py | from keywords import *
from reg import *
from parse import parse
def evalExp():
expr = parse(fetch(EXPR)) # make dedicated fetch_expr()?
# expr = transformMacros(expr)
evalFunc = getEvalFunc(expr)
# evalFunc()
# reassign next step
def getEvalFunc(expr):
if isVar(expr):
return compVar
if isNum(expr):
retur... | Python | 0 | |
0ffd8c1b52b95ef61bcb2ecf7183d1abab55a3ce | Rename Documents to Attachments | smile_attachment/models/models.py | smile_attachment/models/models.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 Smile (<http://www.smile.fr>). All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under th... | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 Smile (<http://www.smile.fr>). All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under th... | Python | 0 |
5de57ff00037d6f9a04307e60685f47f368cb29f | add example script to test calling the ffi | example.py | example.py | import scipcffi.ffi as s
scip_ptr = s.ffi.new('SCIP**')
rc = s.lib.SCIPcreate(scip_ptr)
assert rc == s.lib.SCIP_OKAY
scip = scip_ptr[0]
| Python | 0 | |
4ce96ed8ab49555d3cd29ac6ab420cc438b60af8 | set is_example flag | msgvis/apps/importer/management/commands/import_coded_data.py | msgvis/apps/importer/management/commands/import_coded_data.py | import traceback
import sys
import path
import csv
from time import time
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from django.conf import settings
from django.contrib.auth.models import User
from msgvis.apps.importer.models im... | Python | 0.998652 | |
e0871cd8c106a5f66bffd7a93759747b2f282c46 | make CommCareBuild.create_from_zip tolorate having directory entries like 'dist/' (by ignoring them) | corehq/apps/builds/models.py | corehq/apps/builds/models.py | from datetime import datetime
from zipfile import ZipFile
from couchdbkit.exceptions import ResourceNotFound
from couchdbkit.ext.django.schema import *
from corehq.apps.builds.jadjar import JadJar
class CommCareBuild(Document):
"""
#python manage.py shell
#>>> from corehq.apps.builds.models import CommCare... | from datetime import datetime
from zipfile import ZipFile
from couchdbkit.exceptions import ResourceNotFound
from couchdbkit.ext.django.schema import *
from corehq.apps.builds.jadjar import JadJar
class CommCareBuild(Document):
"""
#python manage.py shell
#>>> from corehq.apps.builds.models import CommCare... | Python | 0 |
3a2a311c3c3f8a6bc2f027bfa247d912122e512e | Add test for gaussian | tests/functions_tests/test_gaussian.py | tests/functions_tests/test_gaussian.py | import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import condition
if cuda.available:
cuda.init()
class TestGaussian(unittest.TestCase):
def setUp(self):
self.m = n... | Python | 0.000004 | |
945c2c620634c2c816aa446d91773adb75cb87e3 | Add airmass tool | airmass.py | airmass.py | #!/usr/env/python
import argparse
import numpy as np
from astropy import units as u
##-------------------------------------------------------------------------
## Parse Command Line Arguments
##-------------------------------------------------------------------------
## create a parser object for understanding comman... | Python | 0 | |
12f2198a53d474bb69a6b9118fca0638dcce8aac | add data migration | accelerator/migrations/0088_remove_community_participation_read_more_prompts.py | accelerator/migrations/0088_remove_community_participation_read_more_prompts.py | # Generated by Django 2.2.24 on 2022-03-07 12:10
import re
from django.db import migrations
def remove_community_participation_read_more_prompts(apps, schema_editor):
"""
Target read more prompts:
For more information, read about Judging at Mass Challenge.
Read more about Mentoring at Mass Challenge.... | Python | 0 | |
b166cd8cc95ceb56f8d03cacb8903b0936e69210 | Create solution.py | data_structures/linked_list/problems/find_pattern_in_linked_list/py/solution.py | data_structures/linked_list/problems/find_pattern_in_linked_list/py/solution.py | import LinkedList
# Linked List Node inside the LinkedList module is declared as:
#
# class Node:
# def __init__(self, val, nxt=None):
# self.val = val
# self.nxt = nxt
#
def FindPatternInLinkedList(head: LinkedList.Node, pattern: LinkedList.Node) -> int:
if head == None or pattern == ... | Python | 0.000018 | |
869480c1b813d167f30de71040d891af484e1cce | add eight-puzzle example | eight_puzzle_example.py | eight_puzzle_example.py | #!/usr/bin/env python
"""
Example of using PyDDL to solve an eight-puzzle. Each number is a tile that
can slide vertically or horizontally to fill in the blank space. This "hard"
instance (requiring the maximum of 31 steps) is taken from the following paper:
Reinefeld, Alexander. "Complete Solution of the Eight-Puzzle... | Python | 0.998914 | |
9bffe981c018213b87d015a20603c092567bbdf4 | Initialize multiple class setup; add remaining APIs | cobaltuoft/cobalt.py | cobaltuoft/cobalt.py | from .endpoints import Endpoints
from .helpers import get, scrape_filters
class Cobalt:
def __init__(self, api_key=None):
self.host = 'http://cobalt.qas.im/api/1.0'
self.headers = {
'Referer': 'Cobalt-UofT-Python'
}
if not api_key or not self._is_valid_key(api_key):
... | Python | 0 | |
54864841267c4d2cb53ce581c05d8ba9c15eef0c | Add lexer | balloon.py | balloon.py | from pygments.lexer import *
from pygments.token import *
class CustomLexer(RegexLexer):
name = 'Balloon'
aliases = ['balloon']
filenames = '*.bl'
tokens = {
'root': [
include('keywords'),
(r'[]{}(),:;[]', Punctuation),
(r'#.*?$', Comment),
(r... | Python | 0.000001 | |
d0306518dcc395a051460115d7ef9488f26426cc | Add paper shortening tool: input text, output shorter text | shorten-pdf/shorten.py | shorten-pdf/shorten.py | #!/usr/bin/python
import sys
LONG_PARAGRAPH_THRESH = 400
LONG_START_LEN = 197
LONG_END_LEN = 197
if len(sys.argv) < 2:
print 'Give me a text file as an argument.'
sys.exit(0)
f = open(sys.argv[1]) # open file
t = f.read() # read text
ps = t.split('\n\n') # get paragraphs
ps_ = [] ... | Python | 0.999999 | |
0267ada9eed8c9759c4fe5ec5b4cd184bc2d5de1 | Create ode.py | ode.py | ode.py | import sys
def rk4(func, x, y, step, xmax):
"""
Integrates y'=f(x,y) using 4th step-order Runge-Kutta.
@param func: a differential equation
@type func: list
@param x: initial value of x-axis, which is usually starting time
@type x: float
@param y: initial value for y-axis
@type y... | Python | 0.000002 | |
316a82c5465a13770404b6a302348f192618cd27 | Add an interface for eagerly evaluating command graph elements | libqtile/command_interface.py | libqtile/command_interface.py | # Copyright (c) 2019, Sean Vig. All rights reserved.
#
# 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, modify, mer... | Python | 0 | |
dff1f9176d7ce77a242263bfc9a0760cd31f0585 | Add a prototype for cached regex.compile() | regex_proxy.py | regex_proxy.py | from regex import *
from regex import compile as raw_compile
_cache = {}
# Wrap regex.compile up so we have a global cache
def compile(s, *args, **args):
global _cache
try:
return _cache[s]
except KeyError:
r = raw_compile(s, *args, **kwargs)
_cache[s] = r
return r
| Python | 0.000001 | |
231e19ed29314bc0d9aad3cd1d69b757364fce7d | Create pms.py | pms.py | pms.py | import serial
# we stop terminal with raspi-config,
# we stop bluethooth from /boot/config.txt first,
# and currently UART device is /dev/ttyAMAO,
# but we still cannot read data from device
# failure devices
#dev = "ttyS0"
# work devices
#dev = "ttyAMA0"
#dev = "serial0"
dev = "ttyUSB0"
ser = serial.Serial(port="/... | Python | 0 | |
dd1e3a665298a616d9b78f0c019288a9d6d883b8 | Add unit tests for the OfficeAdminExtraGeoLocation model | labonneboite/tests/app/test_models.py | labonneboite/tests/app/test_models.py | # coding: utf8
import unittest
from labonneboite.common.models import OfficeAdminExtraGeoLocation
class OfficeAdminExtraGeoLocationTest(unittest.TestCase):
"""
Tests for the OfficeAdminExtraGeoLocation model.
"""
def test_codes_as_list(self):
codes = u" 57070\n\n\n\n\n\n 75010 \n 54 ... | Python | 0 | |
7b1b343c552ee6f124ccceee05f1a6732657c9e1 | Add initial startup program (pox.py) | pox.py | pox.py | #!/usr/bin/python
from pox.core import core
import pox.openflow.openflow
import pox.topology.topology
import pox.openflow.of_01
import pox.dumb_l3_switch.dumb_l3_switch
# Set default log level
import logging
logging.basicConfig(level=logging.DEBUG)
# Turn on extra info for event exceptions
import pox.lib.revent.reve... | Python | 0.000002 | |
35887b39b0151432423cca7832f1c9bc4ab7d836 | Create OutputNeuronGroup.py | examples/OutputNeuronGroup.py | examples/OutputNeuronGroup.py | '''
Example of a spike receptor (only receives spikes)
In this example spikes are received and processed creating a raster plot at the end of the simulation.
'''
from brian import *
import numpy
from brian_multiprocess_udp import BrianConnectUDP
# The main function with the NeuronGroup(s) and Synapse(s) must be na... | Python | 0 | |
3834af9b3a6381ac7a2334c7bd2ae6d562e0f20b | Create HR_pythonIsLeap.py | HR_pythonIsLeap.py | HR_pythonIsLeap.py | def is_leap(year):
leap = False
# Write your logic here
# thought process
#if year%4==0:
# return True
#elif year%100==0:
# return False
#elif year%400==0:
# return True
# Optimized, Python 3
return ((year%4==0)and(year%100!=0)or(year%400==0))
| Python | 0.000764 | |
b5cc6ead2e17ef54612b3072c7991166955bee77 | Add user commands | dropbox-cli.py | dropbox-cli.py | #!/usr/bin/env python
import os
import logging
import dropbox
import argparse
APP_NAME = "dropbox-static-cli"
DEFAULT_KEY_PATH = "{}/.dropbox-static-cli-key".format(os.environ["HOME"])
L = None
def parse_arguments():
parser = argparse.ArgumentParser(
prog="dropbox-static-cli",
... | Python | 0.000008 | |
d160d73740c73e2cab8325179e7f0a9ee4ae8c50 | add disk_usage.py example script | examples/disk_usage.py | examples/disk_usage.py | #!/usr/bin/env python
"""
List all mounted disk partitions a-la "df" command.
"""
import sys
import psutil
def convert_bytes(n):
if n == 0:
return "0B"
symbols = ('k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
prefix = {}
for i, s in enumerate(symbols):
prefix[s] = 1 << (i+1)*10
for s in... | Python | 0.000001 | |
7475b73072f0037fc53bcae59e331c4d5a997e86 | Add auto-fill test cases | depot/tests/test_checkout.py | depot/tests/test_checkout.py | from django.contrib.auth.models import User
from depot.models import Depot, Organization
from verleihtool.test import ClientTestCase
class AutoFillTestCase(ClientTestCase):
"""
Test cases asserting the auto-fill functionality for checkout-form
:author: Stefan Su
"""
def setUp(self):
super... | Python | 0.000001 | |
0caa9035e06e6596a295ed2ed0a6238a2b09f353 | add PCA and TSNE representation | utils/postprocessing/representation.py | utils/postprocessing/representation.py | import numpy as np
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
def PCA_representation(data, n_components):
pca = PCA(n_components=n_components)
return pca.fit_transform(data)
def TSNE_representation(data, n_components):
model = TSNE(n_components=n_compone... | Python | 0 | |
3ee47b0adbc379d77f01df51927399ecf3fb24e6 | Add docstring and comment. | examples/mnist-autoencoder.py | examples/mnist-autoencoder.py | #!/usr/bin/env python
'''Single-layer autoencoder example using MNIST digit data.
This example shows one way to train a single-layer autoencoder model using the
handwritten MNIST digits.
This example also shows the use of climate command-line arguments.
'''
import climate
import matplotlib.pyplot as plt
import thea... | #!/usr/bin/env python
import climate
import matplotlib.pyplot as plt
import theanets
from utils import load_mnist, plot_layers, plot_images
g = climate.add_group('MNIST Example')
g.add_argument('--features', type=int, default=8, metavar='N',
help='train a model using N^2 hidden-layer features')
def ... | Python | 0 |
239e8062329c0303776326ccc2c272cccb25a9d0 | add table iterator for cursor like functionality over C* | cassandra/cqlengine/table_iterator.py.py | cassandra/cqlengine/table_iterator.py.py | class TableIterator(object):
"""
Iterates over a Cassandra table defined by a cqlengine model class using query paging in order to pull back chunks
of data that have `blocksize` number of records.
Can optionally provide kwargs which are used as where clause filters. These kwargs must be columns on the m... | Python | 0 | |
09112412a4814e3727def2547765546bf44c1e7d | Test joint refinement of 300 cspad images using Brewster 2018 methods. | test/algorithms/refinement/test_cspad_refinement.py | test/algorithms/refinement/test_cspad_refinement.py | # Test multiple stills refinement.
from __future__ import absolute_import, division, print_function
import os
from dxtbx.model.experiment_list import ExperimentListFactory
import procrunner
def test1(dials_regression, run_in_tmpdir):
"""
Refinement test of 300 CSPAD images, testing auto_reduction, parameter
f... | Python | 0 | |
6bac7268df94d73555c0b594c89b4d5ed0bf53ed | Create NN.py | DeepLearning/DeepLearning/04_Deep_LeeWJ/NN.py | DeepLearning/DeepLearning/04_Deep_LeeWJ/NN.py | """
mnist๋ฐ์ดํฐ ์
์ ํ์ผ์ด ํฌ๊ธฐ์, ์ฒซ ์คํ์์ ๋ค์ด ๋ฐ์ ํ,
pickle๋ก ๋ก๋ํ์ฌ ๊ฐ์ฒด๋ฅผ ๋ณด์ํ๋ ์์ผ๋ก ์๋๋ฅผ ์ค์ผ ์ ์๋ค.
"""
import sys, os
import numpy as np
from mnist import load_mnist
import pickle
sys.path.append(os.pardir) #๋ถ๋ชจ ๋๋ ํฐ๋ฆฌ์ ํ์ผ์ ๊ฐ์ ธ์ฌ ์ ์๋๋ก ์ค์ ํ๋ค.
#load_mnist ๋ฉ์๋์ 3๊ฐ์ง ๋งค๊ฐ๋ณ์
#1. flatten --> ์
๋ ค๊ธฐ๋ฏธ์ง์ ์์ฑ ๋ฐฐ์ด ์ค์ false = 13์ฐจ์๋ฐฐ์ด, true = 1์ฐจ์ ๋ฐฐ์ด
#1์ฐจ์ ๋ฐฐ์ด์ ์ฅํ ๋ฐ... | Python | 0.000002 | |
99b0aeb3257b8125a30340c06cc1bf834e914461 | add bar_contact.py that was missing | examples/Mechanics/ContactDetection/BulletIO/bar_contact.py | examples/Mechanics/ContactDetection/BulletIO/bar_contact.py | import os,sys
import numpy
import math
import pickle
import random
from siconos.mechanics.contact_detection.tools import Contactor
from siconos.io.mechanics_io import Hdf5
#sys.path.append('../..')
#from mechanics_io import Hdf5
import siconos.numerics as Numerics
import siconos.kernel as Kernel
# WARNING : in 3D by... | Python | 0 | |
fa521b4358a06d1667864a09cd7195d3a6db764d | Add lc206_reverse_linked_list.py | lc206_reverse_linked_list.py | lc206_reverse_linked_list.py | """206. Reverse Linked List
Easy
Reverse a singly linked list.
Example:
Input: 1->2->3->4->5->NULL
Output: 5->4->3->2->1->NULL
Follow up:
A linked list can be reversed either iteratively or recursively. Could you implement both?
"""
# Definition for singly-linked list.
class ListNode(object):
def __init__(self,... | Python | 0.000001 | |
2dd6049c1fa9340d14f4b73f843f7ed4408e84f5 | Prepare release script init | utils/create_release.py | utils/create_release.py | #!/usr/bin/env python3
import os
import datetime
import subprocess
from distutils.version import StrictVersion
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
def main():
# git_clean = subprocess.check_output(
# "git status --porcelain", shell=True, universal_newlines=True,
... | Python | 0 | |
2850713d0add5cb1ae084898bdd6929c0f5bfb3e | add simulated annealing stat script | master/scripts/planner/solvers/hyperparameter_optimization/test_stat_sa.py | master/scripts/planner/solvers/hyperparameter_optimization/test_stat_sa.py | import GPy
import GPyOpt
import numpy as np
from sys import path
import pickle
import time
from tqdm import tqdm
path.append("..")
path.append("../..")
path.append("../../..")
from solver import SimulatedAnnealingSolver, RandomSolver
import map_converter as m
fs = open("../../../webserver/data/serialization/mapper.pi... | Python | 0 | |
edf2fd4c3c73a82f590ec3065cfdf6de4eb58e01 | Fix include_clients in PostfixCollector | src/collectors/postfix/postfix.py | src/collectors/postfix/postfix.py | # coding=utf-8
"""
Collect stats from postfix-stats. postfix-stats is a simple threaded stats
aggregator for Postfix. When running as a syslog destination, it can be used to
get realtime cumulative stats.
#### Dependencies
* socket
* json (or simeplejson)
* [postfix-stats](https://github.com/disqus/postfix-stats)... | # coding=utf-8
"""
Collect stats from postfix-stats. postfix-stats is a simple threaded stats
aggregator for Postfix. When running as a syslog destination, it can be used to
get realtime cumulative stats.
#### Dependencies
* socket
* json (or simeplejson)
* [postfix-stats](https://github.com/disqus/postfix-stats)... | Python | 0 |
1d4693b6f5b6f8b3912aae1216665272a36b1411 | Add missing group.py | group.py | group.py | from pygame.sprite import Group as pygame_Group
class Group(pygame_Group):
def draw(self, onto, *args, **kw):
for sprite in self:
sprite.draw(*args, **kw)
super(Group, self).draw(onto)
| Python | 0.000387 | |
5350fa9bb5d67b79d652a57b766ed1b1167a92eb | Introduce TC-DA-1.7 Python test (#21775) | TC_DA_1_7.py | TC_DA_1_7.py | #
# Copyright (c) 2022 Project CHIP Authors
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | Python | 0.002474 | |
b680141b9ec5468a5a0890edf25045a6af8b46c2 | Add run.py | run.py | run.py | #!/usr/bin/python
# -*- coding:utf8 -*-
# Powered By KK Studio
from app.DNStack import DNStack
if __name__ == "__main__":
app = DNStack()
app.run()
| Python | 0.000009 | |
d3e786b554bfafeb4f0c16635b80f9911acc4bba | add stacked auto encoder file. | sae.py | sae.py | #coding: utf-8
import requests
import random, numpy
from aa import AutoEncoder
class StackedAutoEncoder:
def __init__(self, visible, hiddens):
# TODO: fine-tuning layer
num_of_nodes= [visible] + hiddens
self.auto_encoders = []
for i in xrange(len(num_of_nodes)-1):
self.... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.