max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
map_vectorizer/config/vectorize_config_parser.py | mgiraldo/map-vectorizer | 148 | 11107591 | import csv
def parse(fp):
'''
:param str fp: File pointer
:rtype dict:
:returns:
'''
tempcolors = []
index = 0
configdata = csv.reader(fp, delimiter=',')
for row in configdata:
if index > 0:
tempcolors.append([int(row[0]), int(row[1]), int(row[2])])
else... |
src/web/reactionforms/mysql-execute-query/__init__.py | anderson-attilio/runbook | 155 | 11107598 | <reponame>anderson-attilio/runbook
"""Reactions form class for email notifications."""
from wtforms import SelectField, TextAreaField, TextField
from wtforms.validators import DataRequired, Optional
from ..base import BaseReactForm
class ReactForm(BaseReactForm): #pylint: disable=no-init
''' Class that creates... |
045_ssd_mobilenet_v2_oid_v4/01_float32/03_float16_quantization.py | IgiArdiyanto/PINTO_model_zoo | 1,529 | 11107611 | ### tf-nightly==2.3.0-rc1
import tensorflow.compat.v1 as tf
import numpy as np
# Float16 Quantization - Input/Output=float32
graph_def_file="export/tflite_graph.pb"
input_arrays=["normalized_input_image_tensor"]
output_arrays=['TFLite_Detection_PostProcess','TFLite_Detection_PostProcess:1','TFLite_Detection_PostProce... |
spec/mock_patch_example_spec.py | michaelelin/mamba | 462 | 11107618 | from mamba import description, context, it
from unittest.mock import patch
from expects import expect, be
class ExampleClass(object):
def hello(self):
return 'Hello'
with description('Testing with unittest.mock'):
with context('when class method is mocked'):
with it('returns mocked value'... |
python/akg/ops/nn/ascend/maxpool_grad_with_argmax.py | tianjiashuo/akg | 286 | 11107634 | <reponame>tianjiashuo/akg
#!/usr/bin/env python3
# coding: utf-8
# Copyright 2019-2021 Huawei Technologies Co., Ltd
#
# 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/l... |
python-midonetclient/src/midonetclient/tenant.py | yantarou/midonet | 221 | 11107636 | <reponame>yantarou/midonet
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Midokura PTE LTD.
# 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... |
igibson/utils/data_utils/ext_object/scripts_wip/query_object_placement_probs.py | suresh-guttikonda/iGibson | 360 | 11107649 | import argparse
import json
import os
from igibson.render.mesh_renderer.mesh_renderer_settings import MeshRendererSettings
from igibson.scenes.igibson_indoor_scene import InteractiveIndoorScene
from igibson.simulator import Simulator
def input_number_or_name(selection_name, options):
if len(options) == 1:
... |
cxxtest/python/convert.py | coreyp1/graphlab | 333 | 11107691 | #
# Execute this script to copy the cxxtest/*.py files
# and run 2to3 to convert them to Python 3.
#
import glob
import subprocess
import os
import shutil
os.chdir('cxxtest')
for file in glob.glob('*.py'):
shutil.copyfile(file, '../python3/cxxtest/'+file)
#
os.chdir('../python3/cxxtest')
#
for file in glob.glob('... |
ntm/updates.py | snipsco/ntm-lasagne | 316 | 11107717 | import theano
import theano.tensor as T
import numpy as np
from lasagne.updates import get_or_compute_grads
from collections import OrderedDict
def graves_rmsprop(loss_or_grads, params, learning_rate=1e-4, chi=0.95, alpha=0.9, epsilon=1e-4):
r"""
<NAME>' RMSProp [1]_.
.. math ::
n_{i} &= \chi * n... |
examples/callcontext/client.py | brubbel/Pyro4 | 638 | 11107727 | <gh_stars>100-1000
from __future__ import print_function
import sys
import Pyro4
import uuid
# example: set a single correlation id on the context that should be passed along
Pyro4.current_context.correlation_id = uuid.uuid4()
print("correlation id set to:", Pyro4.current_context.correlation_id)
if sys.version_info <... |
tools/generate_intersection_routes.py | L-Net-1992/transfuser | 447 | 11107828 | <filename>tools/generate_intersection_routes.py
import glob
import os
import sys
import lxml.etree as ET
import argparse
import random
import time
import carla
SAMPLING_DISTANCE = [100]
def add_intersection(transform, root, route_id):
'''
Sample (start wp, end wp) pair along the canonical axes in a 100x100 g... |
backend/lk/models/appstore_app.py | Purus/LaunchKitDocker | 2,341 | 11107832 | <filename>backend/lk/models/appstore_app.py
# encoding: utf-8
#
# Copyright 2016 Cluster Labs, 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/LICE... |
spokestack/nlu/parsers/__init__.py | jonra1993/WakeWord-Detection | 139 | 11107850 | import re
DIGIT_SPLIT_RE = re.compile("[-,()\\s]+")
|
single_view_mpi/libs/mpi.py | deepneuralmachine/google-research | 23,901 | 11107899 | <reponame>deepneuralmachine/google-research<gh_stars>1000+
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apac... |
project/game/bots_battle/replays/test_tenhou_encoder.py | MahjongRepository/tenhou-python-bot | 201 | 11108010 | <filename>project/game/bots_battle/replays/test_tenhou_encoder.py<gh_stars>100-1000
from game.bots_battle.replays.tenhou import TenhouReplay
from mahjong.meld import Meld
from utils.test_helpers import make_meld
def test_encode_called_chi():
meld = make_meld(Meld.CHI, tiles=[26, 29, 35])
meld.who = 3
meld... |
insights/parsr/examples/httpd_conf.py | lhuett/insights-core | 121 | 11108016 | <gh_stars>100-1000
import string
from insights.parsr import (Char, EOF, EOL, EndTagName, Forward, FS, GT, LT,
Letters, Lift, LineEnd, Many, Number, OneLineComment, PosMarker,
QuotedString, skip_none, StartTagName, String, WS, WSChar)
from insights.parsr.query import Directive, Entry, Section
def loads... |
astroNN/data/__init__.py | igomezv/astroNN | 156 | 11108018 | <reponame>igomezv/astroNN
# ---------------------------------------------------------#
# astroNN.data.__init__: tools for loading data
# ---------------------------------------------------------#
import os
import astroNN
def datapath():
"""
Get astroNN embedded data path
:return: full path to embedded... |
scripts/rename_logged_data.py | mageofboy/pylot | 231 | 11108080 | <reponame>mageofboy/pylot
import glob
import os
def two_values_before_number(filebase, file_format='png'):
for index, filename in enumerate(glob.glob(filebase)):
vals = filename.split('-')
new_filename = ('test@' + vals[0] + '-' + vals[1] + '-' +
str(index) + '.' + file_for... |
tods/searcher/__init__.py | ZhuangweiKang/tods | 544 | 11108098 | from .brute_force_search import BruteForceSearch
|
saleor/graphql/app/tests/mutations/test_app_token_delete.py | fairhopeweb/saleor | 15,337 | 11108102 | <filename>saleor/graphql/app/tests/mutations/test_app_token_delete.py<gh_stars>1000+
import graphene
from .....app.error_codes import AppErrorCode
from .....app.models import App, AppToken
from ....tests.utils import assert_no_permission, get_graphql_content
APP_TOKEN_DELETE_MUTATION = """
mutation appTokenDelete... |
drl_grasping/control/moveit2.py | Tiamat-Tech/drl_grasping | 126 | 11108103 | from moveit2 import MoveIt2Interface
from rclpy.executors import MultiThreadedExecutor
from threading import Thread
import rclpy
class MoveIt2(MoveIt2Interface):
def __init__(self, robot_model: str, separate_gripper_controller: bool = True, use_sim_time: bool = True, node_name: str = 'ign_moveit2_py'):
tr... |
analysis/sys_id/make_random_waveform.py | leozz37/makani | 1,178 | 11108123 | <gh_stars>1000+
#!/usr/bin/python
# Copyright 2020 Makani Technologies LLC
#
# 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 requi... |
scripts/generate_spirv.py | samuelig/Vulkan-ValidationLayers | 432 | 11108136 | #!/usr/bin/env python3
#
# Copyright (c) 2016-2021 Valve Corporation
# Copyright (c) 2016-2021 LunarG, Inc.
# Copyright (c) 2016-2021 Google 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 ... |
data_structures/binary_trees/print_odd_level_nodes.py | FatiahBalo/python-ds | 1,723 | 11108139 | # Print all the nodes at odd levels of a binary tree
class Node:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
def print_odd(root, is_odd=True):
if not root:
return
if is_odd:
print(root.val, end=' ')
print_odd(root, not is_odd)
... |
build/chip/java/jar_runner.py | summercms/connectedhomeip | 3,495 | 11108148 | <gh_stars>1000+
#!/usr/bin/env python
# Copyright (c) 2020 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... |
pytouch/handlers/__init__.py | Pandinosaurus/PyTouch | 149 | 11108157 | # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
from .image import ImageHandler
from .sensor import SensorHandler
from .video import VideoHandler
|
keras_extensions/models.py | xgenpanda/keras_extension | 225 | 11108177 | from keras.models import Model, standardize_X
from keras.layers import containers
from keras import optimizers, objectives
from keras import backend as K
class SingleLayerUnsupervised(Model, containers.Sequential):
"""
Single layer unsupervised learning Model.
"""
# add Layer, adapted from keras.layers... |
workspace/lesson1.py | hito0512/tensorRT_Pro | 537 | 11108182 |
import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self):
super().__init__()
self.conv = nn.Conv2d(1, 1, 3, stride=1, padding=1, bias=True)
self.conv.weight.data.fill_(0.3)
self.conv.bias.data.fill_(0.2)
def forward(self, x):
x = self.conv(x)
... |
technology/sky130/modules/sky130_row_cap.py | im-world/OpenRAM | 335 | 11108193 | <gh_stars>100-1000
#!/usr/bin/env python3
# See LICENSE for licensing information.
#
# Copyright (c) 2016-2021 Regents of the University of California
# All rights reserved.
#
import debug
import design
from tech import cell_properties as props
class sky130_row_cap(design.design):
def __init__(self, version, na... |
esphome/components/anova/climate.py | OttoWinter/esphomeyaml | 249 | 11108196 | import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import climate, ble_client
from esphome.const import CONF_ID, CONF_UNIT_OF_MEASUREMENT
UNITS = {
"f": "f",
"c": "c",
}
CODEOWNERS = ["@buxtronix"]
DEPENDENCIES = ["ble_client"]
anova_ns = cg.esphome_ns.namespace("anov... |
spyne/util/resource.py | edustaff/spyne | 786 | 11108203 | <reponame>edustaff/spyne
# encoding: utf8
#
# spyne - Copyright (C) Spyne contributors.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your ... |
tests/test_elements/test_ui_window.py | glipR/pygame_gui | 339 | 11108286 | import os
import pytest
import pygame
import pygame_gui
from tests.shared_fixtures import _init_pygame, default_ui_manager
from tests.shared_fixtures import default_display_surface, _display_surface_return_none
from tests.shared_comparators import compare_surfaces
from pygame_gui.elements.ui_window import UIWindow
fr... |
retrieval_pt/predict.py | baidu/knowledge-driven-dialogue | 299 | 11108308 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
#
# Copyright (c) 2019 Baidu.com, Inc. All Rights Reserved
#
################################################################################
"""
File: predict.py
"""
import torch
import torc... |
py/phl/phlsys_multiprocessing__t.py | aevri/phabricator-tools | 150 | 11108334 | """Test suite for phlsys_multiprocessing."""
# =============================================================================
# TEST PLAN
# -----------------------------------------------------------------------------
# Here we detail the things we are concerned to test and specify whic... |
mantraml/core/management/commands/ui.py | cclauss/mantra | 330 | 11108368 | import os
import shutil
import uuid
import subprocess
import mantraml
from mantraml.core.management.commands.BaseCommand import BaseCommand
class UICmd(BaseCommand):
def add_arguments(self, parser):
parser.add_argument("project_path", default=".", type=str, nargs="?")
return parser
def handle... |
example/blog_gcdatastore.py | ice1x/Flask-Blogging | 767 | 11108384 | from flask import Flask, render_template_string, redirect
from flask_login import UserMixin, LoginManager, login_user, logout_user
from flask_blogging import SQLAStorage, BloggingEngine
from flask_blogging.gcdatastore import GoogleCloudDatastore
from flask_fileupload.storage.gcstorage import GoogleCloudStorage
from fla... |
one-day-build-discord-bot/discord-bot.py | dapopov-st/python-youtube-code | 262 | 11108399 | <reponame>dapopov-st/python-youtube-code
import os
import discord
import asyncio
import random
import datetime
token = os.getenv("DISCORD_API_TOKEN")
bot = discord.Client()
@bot.event
async def on_member_join(member):
if member.id == bot.id:
return
channel = discord.utils.get(bot.guilds[0].channe... |
utils/plot.py | magicly/sample-factory | 320 | 11108413 | <filename>utils/plot.py
MAP_FIGURE_ID = 2
HEATMAP_FIGURE_ID = 3
|
examples/obtain_statistics_lord_of_rings.py | alifaraz14/a-nice-mc | 118 | 11108426 | <gh_stars>100-1000
import os
import sys
import numpy as np
sys.path.append(os.getcwd())
def prior(bs):
return np.random.normal(0.0, 1.0, [bs, 2])
if __name__ == '__main__':
from a_nice_mc.objectives.expression.lord_of_rings import LordOfRings
from a_nice_mc.utils.hmc import HamiltonianMonteCarloSampler... |
Exec/radiation_tests/RadShestakovBolstad/python/paper.py | MargotF/Castro | 178 | 11108534 | #!/usr/bin/env python
from pylab import *
from read_gnu import *
import cPickle as pickle
n = '0200'
ew, x, t = read_gnu_file('../run-paper/eint_'+n+'.gnu')
Ew, x, t = read_gnu_file('../run-paper/Er_'+n+'.gnu')
fid = open('SBunits.p', 'rb')
units = pickle.load(fid)
fid.close()
Tw = (ew/units['cv']) / units['Temp']... |
node/rules.bzl | bowlofstew/rules_protobuf | 252 | 11108548 | load("@org_pubref_rules_node//node:rules.bzl", "node_module")
load("//cpp:rules.bzl", "cpp_proto_repositories")
load("//node:deps.bzl", "DEPS")
load("//protobuf:rules.bzl",
"proto_compile",
"proto_language_deps",
"proto_repositories")
def node_proto_repositories(
omit_cpp_repositories = False,
... |
leet/trees/flatten.py | monishshah18/python-cp-cheatsheet | 140 | 11108555 | <reponame>monishshah18/python-cp-cheatsheet
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
"""
Morris Traversal
5
/ \
2 1
\ / \
6 10 11
/
44
... |
tools/device_file_generator/dfg/avr/avr_mcu.py | roboterclubaachen/xpcc | 161 | 11108598 | # -*- coding: utf-8 -*-
# Copyright (c) 2014, Roboterclub Aachen e.V.
# All rights reserved.
#
# The file is part of the xpcc library and is released under the 3-clause BSD
# license. See the file `LICENSE` for the full license governing this code.
# ---------------------------------------------------------------------... |
ros_ws/src/crazyswarm/scripts/test_ros.py | marios-stam/crazyswarm | 219 | 11108600 | <reponame>marios-stam/crazyswarm
import pytest
@pytest.mark.ros
def test_ros_import():
from pycrazyswarm.crazyflie import TimeHelper, CrazyflieServer
|
fairseq/models/mcbert/model.py | motefly/MC-BERT | 104 | 11108631 | <reponame>motefly/MC-BERT
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
MC-BERT: Efficient Language Pre-Training via a Meta Controller
"""
import torch
import torch.nn as nn
import tor... |
recipes/Python/440627_Encoding_A_String/recipe-440627.py | tdiprima/code | 2,023 | 11108635 | <filename>recipes/Python/440627_Encoding_A_String/recipe-440627.py
'''code_module.py
The purpose of this module
is to provide functions
for the coding of strings.
This is a level 1 module.'''
#==================================
# Level 1 Functions: String To Code
#==================================
def string_to_nu... |
4_dend_airflow_data_pipelines/exercises/dags/3_ex4_full_dag.py | AAbdul12/Data-engineering-nanodegree | 253 | 11108670 | import datetime
from airflow import DAG
from airflow.operators import (
FactsCalculatorOperator,
HasRowsOperator,
S3ToRedshiftOperator
)
# This DAG performs the following functions
# 1. Loads Trip data from S3 to RedShift
# 2. Performs a data quality check on the Trips table in RedShift... |
moya/dbexpression.py | moyaproject/moya | 129 | 11108693 | from __future__ import unicode_literals
from __future__ import print_function
from .context import dataindex
from .context.tools import to_expression
from .compat import implements_to_string, text_type
from .context.missing import is_missing
from .interface import unproxy
from pyparsing import (
Word,
WordEnd... |
examples/models/templates/ModelName.py | jsreid13/seldon-core | 3,049 | 11108694 | from <your_loading_library> import <your_loading_function>
class ModelName(object):
def __init__(self):
self.model = <your_loading_function>(<your_model_file>)
def predict(self,X,features_names):
return self.model.predict(X)
|
samples/add_user_group.py | kevinsigwart/ArcREST | 208 | 11108711 | """
This sample shows how to add a user to a group
Python 2/3
ArcREST 3.5.1
"""
from __future__ import print_function
import arcrest
from arcresthelper import securityhandlerhelper
from arcresthelper import common
def trace():
"""
trace finds the line, the filename
and error message and ret... |
mmtbx/validation/mean_devs_VAL_THR_ILE_phi_psi.py | dperl-sol/cctbx_project | 155 | 11108779 | <gh_stars>100-1000
from __future__ import division
# Phi/Psi corrections in Angstrom and Radials
mean_devs = {
(-170, -180) : (0.039100, -1.177605), # 20
(-170, -170) : (0.035297, -1.183224), # 12
(-170, 140) : (0.010351, -0.992488), # 39
(-170, 150) : (0.019600, 0.905143), # 84
(-170, 160) : (0.039774, 0.47... |
pyvgdlmaster/examples/gridphysics/frogs_video.py | LRHammond/pv4dsrl | 111 | 11108798 | '''
VGDL example: Same as frogs.py, but uploads video on youtube
@author: <NAME>, <NAME>
'''
from frogs import frog_level, frog_game
if __name__ == "__main__":
from vgdl.core import VGDLParser
from vgdl.youtube import upload
game = VGDLParser.playGame(frog_game, frog_level, persist_movie=True)
u... |
tests/unit/ops/test_normalize.py | NVIDIA/NVTabular | 543 | 11108833 | <reponame>NVIDIA/NVTabular
#
# Copyright (c) 2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
spirit/core/storage.py | Ke-xueting/Spirit | 974 | 11108847 | # -*- coding: utf-8 -*-
import django
from django.core.files.storage import (
FileSystemStorage, default_storage, get_storage_class)
from .conf import settings
__all__ = [
'spirit_storage',
'spirit_storage_or_none',
'OverwriteFileSystemStorage']
class OverwriteFileSystemStorage(FileSystemStorage):
... |
addition_module/DMUE/config.py | weihaoxie/FaceX-Zoo | 1,329 | 11108894 | import os
import getpass
def parse_lb_txt(filename):
lines = open(filename, 'r').readlines()
train_dataset, test_dataset = [], []
for line in lines:
key, label = line.split(' ')[0], line[-2]
label = int(label)
mode, img_path = key.split('_') #
if mode == 'train':
... |
update_version.py | xarala221/django-erp | 345 | 11108924 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import os
import sys
from datetime import datetime
def replace(root, replace_dict):
if root[-1] == "/":
root = root[0:-1]
for x in os.listdir(root):
path = root + "/" + x
if os.path.isdir(path):
replace(path, replace_dict)
... |
benedict/__init__.py | fabiocaccamo/python-benedict | 365 | 11108944 | # -*- coding: utf-8 -*-
from benedict.dicts import benedict
from benedict.metadata import (
__author__,
__copyright__,
__description__,
__license__,
__title__,
__version__,
)
|
pages/extensions/amp_dev/markdown_extras/block_tip.py | sss55b/amp.dev | 300 | 11108973 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
TIP_TRIGGER = '[tip'
TIP_START_TAG_PATTERN = re.compile(r'(\[tip( type=\"(.*?)\")?\])',
re.MULTILINE)
TIP_END_TAG_PATTERN = '[/tip]'
ALLOWED_TYPES = ['default', 'important', 'read-on']
def trigger(original_bo... |
extensions/RichardHe.you-complete-me-1.0.36/ycmd/ycmd/tests/cs/subcommands_test.py | Sunshengjin/RoboWare-Studio | 239 | 11108986 | #!/usr/bin/env python
#
# Copyright (C) 2015 ycmd contributors.
#
# This file is part of ycmd.
#
# ycmd is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... |
app.py | e-naharnovic/university-domains-list-api | 102 | 11108990 | <gh_stars>100-1000
import json
from collections import defaultdict
from flask import Flask, request, Response
from pytrie import Trie
import uuid
import requests
import time
import re
app = Flask(__name__)
data = list()
country_index = defaultdict(list)
name_index = dict()
domain_index = defaultdict(list)
# Time to ... |
alipay/aop/api/response/AlipayMerchantPayforprivilegeMerchantremainingQueryResponse.py | antopen/alipay-sdk-python-all | 213 | 11108997 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayMerchantPayforprivilegeMerchantremainingQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayMerchantPayforprivilegeMerchantremainingQueryResponse, self).__in... |
websauna/system/admin/views.py | stevepiercy/websauna | 286 | 11109025 | <filename>websauna/system/admin/views.py
"""Admin interface main views. """
# Pyramid
from pyramid.httpexceptions import HTTPFound
from pyramid.view import view_config
from pyramid_layout.panel import panel_config
# Websauna
from websauna.system.admin.modeladmin import ModelAdmin
from websauna.system.admin.modeladmin ... |
starfish/core/intensity_table/test/factories.py | haoxusci/starfish | 164 | 11109031 | import numpy as np
import xarray as xr
from starfish import DecodedIntensityTable, IntensityTable
from starfish.core.codebook.test.factories import codebook_array_factory, loaded_codebook
from starfish.core.types import Coordinates, Features
from ..overlap import Area
def synthetic_intensity_table() -> IntensityTabl... |
Challenge2/main.py | Gerifield/websocket-smuggle | 284 | 11109043 | <filename>Challenge2/main.py
#!/usr/bin/python
from flask import Flask, render_template, request, Response
from flask_socketio import SocketIO
from flask_restful import Resource, Api
from urlparse import urlparse
import requests
requests.packages.urllib3.disable_warnings()
app = Flask(__name__)
api = Api(app)
socke... |
vroom/environment.py | groschovskiy/vroom | 134 | 11109057 | """A vroom test execution environment.
This is an object with all of the vroom verifiers asked. Good for one file.
"""
import vroom.buffer
import vroom.messages
import vroom.output
import vroom.shell
import vroom.vim
class Environment(object):
"""The environment object.
Sets up all the verifiers and managers an... |
beagle/datasources/elasticsearch_qs.py | limkokhian/beagle | 1,139 | 11109100 | <filename>beagle/datasources/elasticsearch_qs.py
from typing import Generator
from beagle.common.logging import logger
from beagle.config import Config
from beagle.datasources.base_datasource import ExternalDataSource
from beagle.transformers.generic_transformer import GenericTransformer
class ElasticSearchQSSerach(... |
tests/test_sklearn_mlp_converter.py | vumichien/hummingbird | 2,772 | 11109101 | <filename>tests/test_sklearn_mlp_converter.py
"""
Tests sklearn MLP models (MLPClassifier, MLPRegressor) converters.
"""
import unittest
import warnings
import numpy as np
import torch
from sklearn.neural_network import MLPClassifier, MLPRegressor
import hummingbird.ml
from hummingbird.ml import constants
from hummin... |
aztk_cli/entrypoint.py | Geims83/aztk | 161 | 11109113 | <reponame>Geims83/aztk
"""
AZTK module for the CLI entry point
Note: any changes to this file need have the package reinstalled
pip install -e .
"""
import argparse
import warnings
from typing import NamedTuple
from azure.batch.models import BatchErrorException
import aztk
from aztk_cli import constants,... |
mmdeploy/codebase/mmocr/models/text_detection/fpn_cat.py | aegis-rider/mmdeploy | 746 | 11109160 | <gh_stars>100-1000
# Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn.functional as F
from packaging import version
from mmdeploy.core import FUNCTION_REWRITER
@FUNCTION_REWRITER.register_rewriter(
func_name='mmocr.models.textdet.FPNC.forward', backend='tensorrt')
def fpnc__forward__ten... |
TradzQAI/tools/indicators/function_helper.py | kkuette/AI_project | 164 | 11109163 | <reponame>kkuette/AI_project
import numpy as np
def fill_for_noncomputable_vals(input_data, result_data):
non_computable_values = np.repeat(
np.nan, len(input_data) - len(result_data)
)
filled_result_data = np.append(non_computable_values, result_data)
return filled_result_data
|
anuga/shallow_water/tests/test_loadsave.py | samcom12/anuga_core | 136 | 11109168 | #!/usr/bin/env python
from future import standard_library
standard_library.install_aliases()
from builtins import range
import unittest, os, time
import os.path
from math import pi, sqrt
import tempfile
from anuga.file.netcdf import NetCDFFile
from anuga.file.sww import extent_sww
from anuga.config import g, epsilon... |
icg/variationalnetwork.py | mklasby/mri-variationalnetwork | 119 | 11109204 | import tensorflow as tf
class VnBasicCell(object):
"""Variational Network Basic Cell class. The call function defines the calculation for a single stage.
Args:
inputs: list of inputs
constants: dictionary of constants
params: dictionary of (changing) parameters
const_params: di... |
compressai/utils/bench/__main__.py | Conzel/CompressAI | 515 | 11109231 | <filename>compressai/utils/bench/__main__.py
# Copyright (c) 2021-2022, InterDigital Communications, Inc
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted (subject to the limitations in the disclaimer
# below) provided that the following condition... |
desktop/core/ext-py/nose-1.3.7/functional_tests/support/issue143/not-a-package/test.py | kokosing/hue | 5,079 | 11109248 | <gh_stars>1000+
def test():
raise Exception("do not run")
|
extraction/convert_anchor_tags_to_wikidata.py | BenHammersley/deeptype | 614 | 11109254 | import argparse
from os.path import join
from os import makedirs
import marisa_trie
import numpy as np
from wikidata_linker_utils.bash import count_lines
from wikidata_linker_utils.progressbar import get_progress_bar
from wikidata_linker_utils.wikipedia import match_wikipedia_to_wikidata, load_redirections
from wiki... |
test_project/views.py | martey/django-wysiwyg | 128 | 11109290 | from django.shortcuts import render_to_response
def basic_test(request):
return render_to_response("basic_test.html")
|
easyfsl/methods/abstract_meta_learner.py | lnowakow/easy-few-shot-learning | 208 | 11109326 | <gh_stars>100-1000
from abc import abstractmethod
from pathlib import Path
from statistics import mean
from typing import Union
import torch
from torch import nn, optim
from torch.utils.data import DataLoader
from tqdm import tqdm
from easyfsl.utils import sliding_average, compute_backbone_output_shape
class Abstra... |
mmdeploy/codebase/mmdet/models/dense_heads/ssd_head.py | grimoire/mmdeploy | 746 | 11109328 | <gh_stars>100-1000
# Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmdeploy.codebase.mmdet import get_post_processing_params
from mmdeploy.codebase.mmdet.core.ops import (ncnn_detection_output_forward,
ncnn_prior_box_forward)
from mmdeploy.core import FUN... |
test/www/python/postdata.py | henricazottes/zero | 6,247 | 11109339 | from flask import request
def handler():
if request.method == 'POST':
email = request.form.get('email')
password = request.form.get('password')
return 'Got ' + email
return "POST email and password here" |
website/content/02-introduction-to-python/175-running-code/code/formatting_example.py | profread/python | 389 | 11109408 | # Use \n to add a new line, before, in the middle of, or after a string.
print("\nExtra New Line Before")
print("One Print\nTwo New Lines!")
print("Extra New Line After\n")
# Use \t to add a tab.
print("\t Here's some tabbed output.")
# Or, combine both!
print("\nOne Print\n\tOne Tab") |
library/test/test_eof.py | creativemindplus/skybison | 278 | 11109428 | <gh_stars>100-1000
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
# WARNING: This is a temporary copy of code from the cpython library to
# facilitate bringup. Please file a task for anything you change!
# flake8: noqa
# fmt: off
# TODO(T39919550): unfork this file
"... |
train/dag/gen_phrase.py | chuan717/Pinyin2Hanzi | 473 | 11109434 | <gh_stars>100-1000
# coding: utf-8
from __future__ import (print_function, unicode_literals)
import sys
import json
sys.path = ['../..'] + sys.path
from Pinyin2Hanzi import util
from ChineseTone import PinyinHelper, PinyinFormat
import jieba
def cut(s):
return jieba.cut(s, cut_all=False)
def writejson2file(ob... |
scripts/update_changelog_link.py | normalchaos/intellij-rust | 4,168 | 11109478 | <reponame>normalchaos/intellij-rust<filename>scripts/update_changelog_link.py
import re
from datetime import date
from common import get_patch_version
from git import git_command
PLUGIN_XML = "plugin/src/main/resources/META-INF/plugin.xml"
if __name__ == '__main__':
with open(PLUGIN_XML) as f:
text = f.r... |
academicstoday_project/landpage/tests/test_google.py | LeeDoona/EasyGrading | 146 | 11109495 | <reponame>LeeDoona/EasyGrading
from django.core.urlresolvers import resolve
from django.http import HttpRequest
from django.http import QueryDict
from django.test import TestCase
from django.test import Client
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
from l... |
tests/test_downshiftology.py | mathiazom/recipe-scrapers | 811 | 11109502 | from recipe_scrapers.downshiftology import Downshiftology
from tests import ScraperTest
class TestDownshiftologyScraper(ScraperTest):
scraper_class = Downshiftology
def test_host(self):
self.assertEqual("downshiftology.com", self.harvester_class.host())
def test_author(self):
self.asser... |
Modules/object_detection/py_nodes/fisheye_undistort.py | 473867143/Prometheus | 1,217 | 11109505 | <gh_stars>1000+
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
from sensor_msgs.msg import Image
from geometry_msgs.msg import Pose, Point, Quaternion
from cv_bridge import CvBridge
from std_msgs.msg import String
from std_msgs.msg import Bool
import numpy as np
import cv2
import os
import yaml
import math... |
stix_shifter_modules/arcsight/stix_transmission/status_connector.py | pyromaneact/stix-shifter | 129 | 11109528 | <reponame>pyromaneact/stix-shifter
import json
import math
from stix_shifter_utils.modules.base.stix_transmission.base_status_connector import BaseStatusConnector
from stix_shifter_utils.modules.base.stix_transmission.base_status_connector import Status
from enum import Enum
from stix_shifter_utils.utils.error_response... |
fedlab/core/network.py | SMILELab-FL/FedLab | 171 | 11109558 | <filename>fedlab/core/network.py
# Copyright 2021 Peng Cheng Laboratory (http://www.szpclab.com/) and FedLab Authors (smilelab.group)
# 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
# htt... |
tests/clpy_tests/opencl_tests/test_rollaxis.py | fixstars/clpy | 142 | 11109561 | # -*- coding: utf-8 -*-
import unittest
import clpy
import numpy
class TestRollaxis(unittest.TestCase):
"""test class of rollaxis"""
def test_import(self):
self.assertTrue(True) # Always OK if no exeption from import
def test_2_3_matrix(self):
npA = numpy.array([[1, 2, 3], [4, 5, 6]])... |
lib/datasets/tless/handle_rendering_data.py | bertid/clean-pvnet | 284 | 11109601 | <reponame>bertid/clean-pvnet
import os
import glob
from PIL import Image
import numpy as np
import tqdm
from lib.utils.renderer import render_utils
from lib.utils.base_utils import read_pickle
import json
import cv2
blender = '/home/pengsida/Software/blender-2.79a-linux-glibc219-x86_64/blender'
blank_blend = 'lib/dat... |
all/bodies/vision.py | kcorder/autonomous-learning-library | 584 | 11109603 | import torch
from all.core import State, StateArray
from ._body import Body
class FrameStack(Body):
def __init__(self, agent, size=4, lazy=False):
super().__init__(agent)
self._frames = []
self._size = size
self._lazy = lazy
self._to_cache = TensorDeviceCache()
def pro... |
QA/co_optimization_parallel_plate_waveguide_test.py | jbellevi/lumopt | 101 | 11109618 | """ Copyright chriskeraly
Copyright (c) 2019 Lumerical Inc. """
import sys
sys.path.append(".")
import os
import numpy as np
from qatools import *
from lumopt.utilities.wavelengths import Wavelengths
from lumopt.utilities.materials import Material
from lumopt.geometries.polygon import FunctionDefinedPolygon
from... |
SMPyBandits/Policies/klUCBPlusPlus.py | balbok0/SMPyBandits | 309 | 11109658 | # -*- coding: utf-8 -*-
""" The improved kl-UCB++ policy, for one-parameter exponential distributions.
Reference: [Menard & Garivier, ALT 2017](https://hal.inria.fr/hal-01475078)
"""
from __future__ import division, print_function # Python 2 compatibility
__author__ = "<NAME>"
__version__ = "0.5"
from math import lo... |
mordred/tests/__init__.py | UnixJunkie/mordred | 199 | 11109689 | <filename>mordred/tests/__init__.py
"""Mordred test package."""
|
examples/guv_simple_server.py | timgates42/guv | 120 | 11109730 | <reponame>timgates42/guv
"""Simple low-level network server
This module demonstrates how to use guv to create fast network servers. In addition, it can be
used to serve valid HTTP (as far as ``wrk`` is concerned) to benchmark concurrency and requests/sec.
Three basic client handlers are provided:
- :func:`handle_htt... |
test/libs/Hybrid.py | kavyapnaik/PythonRemoteServer | 118 | 11109747 | <filename>test/libs/Hybrid.py
class Hybrid(object):
def get_keyword_names(self):
return ['passing', 'failing', 'logging', 'returning', 'kwargs']
def __getattr__(self, name):
try:
return globals()[name]
except KeyError:
raise AttributeError(name)
def passing(ar... |
next_steps/operations/ml_ops_ds_sdk/lambda/stepfunction_waitforDatasetGroup.py | kamoljan/amazon-personalize-samples | 442 | 11109757 | <gh_stars>100-1000
import json
import base64
import boto3
personalize = boto3.client('personalize')
personalize_runtime = boto3.client('personalize-runtime')
def lambda_handler(event, context):
# TODO implement
datasetGroupArnVal = event['input']
describe_dataset_group_response = personalize.describe_data... |
tests/integration/butterfree/load/conftest.py | fossabot/butterfree | 208 | 11109759 | from pytest import fixture
from butterfree.constants import DataType, columns
from butterfree.transform import FeatureSet
from butterfree.transform.features import Feature, KeyFeature, TimestampFeature
@fixture
def input_dataframe(spark_context, spark_session):
data = [
{
"id": 1,
... |
tests/cell_fabric/test_gen_lef.py | pretl/ALIGN-public | 119 | 11109762 | <filename>tests/cell_fabric/test_gen_lef.py
from align.cell_fabric import gen_lef, pdk
import filecmp
import pathlib
mydir = pathlib.Path(__file__).resolve().parent
pdkdir = pathlib.Path(__file__).parent.parent.parent / "pdks" / "FinFET14nm_Mock_PDK"
p = pdk.Pdk().load(pdkdir / 'layers.json')
def test_lef():
... |
resnet/frelu.py | megvii-model/FunnelAct | 178 | 11109785 | <gh_stars>100-1000
import megengine.functional as F
import megengine.module as M
class FReLU(M.Module):
r""" FReLU formulation. The funnel condition has a window size of kxk. (k=3 by default)
"""
def __init__(self, in_channels):
super().__init__()
self.conv_frelu = M.Conv2d(in_channels, in_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.