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 |
|---|---|---|---|---|
insights/parsers/tests/test_zipl_conf.py | lhuett/insights-core | 121 | 14053 | <filename>insights/parsers/tests/test_zipl_conf.py
from insights.parsers.zipl_conf import ZiplConf
from insights.tests import context_wrap
from insights.parsers import ParseException
import pytest
ZIPL_CONF = """
[defaultboot]
defaultauto
prompt=1
timeout=5
default=linux
target=/boot
[linux]
image=/boot/vmlinuz-3.... |
pony/orm/tests/test_generator_db_session.py | ProgHaj/pony | 2,628 | 14060 | from __future__ import absolute_import, print_function, division
import unittest
from pony.orm.core import *
from pony.orm.core import local
from pony.orm.tests.testutils import *
from pony.orm.tests import setup_database, teardown_database
class TestGeneratorDbSession(unittest.TestCase):
def setUp(self):
... |
h/security/predicates.py | hypothesis/h | 2,103 | 14085 | """
Define authorization predicates.
These are functions which accept an `Identity` object and a context object and
return a truthy value. These represent building blocks of our permission map
which define when people do, or don't have permissions.
For example a predicate might define "group_created_by_user" which is... |
tests/test_reusable_executor.py | hoodmane/loky | 153 | 14088 | <gh_stars>100-1000
import os
import sys
import gc
import ctypes
import psutil
import pytest
import warnings
import threading
from time import sleep
from multiprocessing import util, current_process
from pickle import PicklingError, UnpicklingError
from distutils.version import LooseVersion
import loky
from loky import... |
test/connector/exchange/wazirx/test_wazirx_user_stream_tracker.py | BGTCapital/hummingbot | 3,027 | 14094 | <reponame>BGTCapital/hummingbot
#!/usr/bin/env python
from os.path import join, realpath
import sys; sys.path.insert(0, realpath(join(__file__, "../../../../../")))
import conf
from hummingbot.connector.exchange.wazirx.wazirx_api_order_book_data_source import WazirxAPIOrderBookDataSource
from hummingbot.connector.... |
src/python/setup.py | blaine141/NVISII | 149 | 14117 | # Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
# This work is licensed under the NVIDIA Source Code License - Non-commercial. Full
# text can be found in LICENSE.md
from setuptools import setup, dist
import wheel
import os
# required to geneerate a platlib folder required by audittools
from setuptools.c... |
rojak-analyzer/generate_stopwords.py | pyk/rojak | 107 | 14145 | # Run this script to create stopwords.py based on stopwords.txt
import json
def generate(input_txt, output_py):
# Read line by line
txt_file = open(input_txt)
words = set([])
for raw_line in txt_file:
line = raw_line.strip()
# Skip empty line
if len(line) < 1: continue
#... |
pyexchange/exchange2010/__init__.py | tedeler/pyexchange | 128 | 14147 | """
(c) 2013 LinkedIn Corp. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");?you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing... |
models/recall/word2vec/static_model.py | ziyoujiyi/PaddleRec | 2,739 | 14150 | <filename>models/recall/word2vec/static_model.py<gh_stars>1000+
# Copyright (c) 2020 PaddlePaddle 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://... |
test/test_tools.py | cokelaer/sequana | 138 | 14153 | <gh_stars>100-1000
from sequana.tools import bam_to_mapped_unmapped_fastq, reverse_complement, StatsBAM2Mapped
from sequana import sequana_data
from sequana.tools import bam_get_paired_distance, GZLineCounter, PairedFastQ
from sequana.tools import genbank_features_parser
def test_StatsBAM2Mapped():
data = sequana_... |
configs/mmrotate/rotated-detection_tensorrt_dynamic-320x320-1024x1024.py | grimoire/mmdeploy | 746 | 14156 | <filename>configs/mmrotate/rotated-detection_tensorrt_dynamic-320x320-1024x1024.py
_base_ = ['./rotated-detection_static.py', '../_base_/backends/tensorrt.py']
onnx_config = dict(
output_names=['dets', 'labels'],
input_shape=None,
dynamic_axes={
'input': {
0: 'batch',
2: 'he... |
datasets.py | Tracesource/DCEC | 154 | 14168 | import numpy as np
def load_mnist():
# the data, shuffled and split between train and test sets
from keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x = np.concatenate((x_train, x_test))
y = np.concatenate((y_train, y_test))
x = x.reshape(-1, 28, 28, 1).as... |
tests/integration_tests/framework/flask_utils.py | ilan-WS/cloudify-manager | 124 | 14197 | <reponame>ilan-WS/cloudify-manager<gh_stars>100-1000
#########
# Copyright (c) 2013 GigaSpaces Technologies 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
#
# ... |
test/talker.py | cjds/rosgo | 148 | 14211 | #!/usr/bin/env python
import rospy
from std_msgs.msg import String
def talker():
pub = rospy.Publisher('chatter', String)
rospy.init_node('talker', anonymous=True)
while not rospy.is_shutdown():
str = "%s: hello world %s" % (rospy.get_name(), rospy.get_time())
rospy.loginfo(str)
pu... |
tests/io/test_kepseismic.py | jorgemarpa/lightkurve | 235 | 14217 | import pytest
from astropy.io import fits
import numpy as np
from lightkurve.io.kepseismic import read_kepseismic_lightcurve
from lightkurve.io.detect import detect_filetype
@pytest.mark.remote_data
def test_detect_kepseismic():
"""Can we detect the correct format for KEPSEISMIC files?"""
url = "https://arch... |
recipes/Python/223585_Stable_deep_sorting_dottedindexed_attributes/recipe-223585.py | tdiprima/code | 2,023 | 14219 | <gh_stars>1000+
def sortByAttrs(seq, attrs):
listComp = ['seq[:] = [(']
for attr in attrs:
listComp.append('seq[i].%s, ' % attr)
listComp.append('i, seq[i]) for i in xrange(len(seq))]')
exec('%s' % ''.join(listComp))
seq.sort()
seq[:] = [obj[-1] for obj in seq]
return
#
# begin test code
#
from random... |
spirit/topic/forms.py | ImaginaryLandscape/Spirit | 974 | 14220 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from django import forms
from django.utils.translation import gettext_lazy as _
from django.utils.encoding import smart_bytes
from django.utils import timezone
from ..core import utils
from ..core.utils.forms import NestedModelChoiceField
from ..category.models import Catego... |
package_manager/util_test.py | shahriak/dotnet5 | 10,302 | 14242 | import unittest
import os
from six import StringIO
from package_manager import util
CHECKSUM_TXT = "1915adb697103d42655711e7b00a7dbe398a33d7719d6370c01001273010d069"
DEBIAN_JESSIE_OS_RELEASE = """PRETTY_NAME="Distroless"
NAME="Debian GNU/Linux"
ID="debian"
VERSION_ID="8"
VERSION="Debian GNU/Linux 8 (jessie)"
HOME_UR... |
homeassistant/components/smarthab/light.py | tbarbette/core | 22,481 | 14267 | <gh_stars>1000+
"""Support for SmartHab device integration."""
from datetime import timedelta
import logging
import pysmarthab
from requests.exceptions import Timeout
from homeassistant.components.light import LightEntity
from . import DATA_HUB, DOMAIN
_LOGGER = logging.getLogger(__name__)
SCAN_INTERVAL = timedelt... |
src/python/pants/backend/docker/util_rules/docker_build_context_test.py | pantsbuild/pants | 1,806 | 14300 | <gh_stars>1000+
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from textwrap import dedent
from typing import Any, ContextManager
import pytest
from pants.backend.docker.goals import package_image
... |
deeplab_resnet/__init__.py | tramper2/SIGGRAPH18SSS | 390 | 14302 | from .model import DeepLabResNetModel
from .hc_deeplab import HyperColumn_Deeplabv2
from .image_reader import ImageReader, read_data_list, get_indicator_mat, get_batch_1chunk, read_an_image_from_disk, tf_wrap_get_patch, get_batch
from .utils import decode_labels, inv_preprocess, prepare_label |
joplin_web/api.py | foxmask/joplin-web | 382 | 14389 | # coding: utf-8
"""
joplin-web
"""
from django.conf import settings
from django.http.response import JsonResponse
from django.urls import reverse
from joplin_api import JoplinApiSync
from joplin_web.utils import nb_notes_by_tag, nb_notes_by_folder
import logging
from rich import console
console = console.Console()
... |
xs/layers/ops.py | eLeVeNnN/xshinnosuke | 290 | 14422 | from .base import *
class Input(Layer):
def __init__(self, input_shape: Union[List, Tuple], **kwargs):
super(Input, self).__init__(input_shape=input_shape, **kwargs)
self._shape = input_shape
def call(self, x: F.Tensor, *args, **kwargs) -> F.Tensor:
self._data = x
return self.... |
torchx/examples/apps/lightning_classy_vision/test/component_test.py | LaudateCorpus1/torchx | 101 | 14438 | <reponame>LaudateCorpus1/torchx<gh_stars>100-1000
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import torchx.examples.apps.lightning_classy_vision.component... |
third_party/xiuminglib/xiuminglib/vis/video.py | leehsiu/nerfactor | 183 | 14440 | <filename>third_party/xiuminglib/xiuminglib/vis/video.py
from os.path import join, dirname
import numpy as np
from .text import put_text
from .. import const
from ..os import makedirs
from ..imprt import preset_import
from ..log import get_logger
logger = get_logger()
def make_video(
imgs, fps=24, outpath=N... |
cumulusci/core/config/BaseConfig.py | leboff/CumulusCI | 163 | 14443 | <reponame>leboff/CumulusCI<filename>cumulusci/core/config/BaseConfig.py<gh_stars>100-1000
import logging
class BaseConfig(object):
"""BaseConfig provides a common interface for nested access for all Config objects in CCI."""
defaults = {}
def __init__(self, config=None, keychain=None):
if config... |
Network/class_func.py | Mobad225/S-DCNet | 153 | 14446 | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
# Func1: change density map into count map
# density map: batch size * 1 * w * h
def get_local_count(density_map,psize,pstride):
IF_gpu = torch.cuda.is_available() # if gpu, return gpu
IF_r... |
test/fixtures/python/analysis/main1.py | matsubara0507/semantic | 8,844 | 14464 | import a as b
import b.c as e
b.foo(1)
e.baz(1)
|
tests/test_markdown_in_code_cells.py | st--/jupytext | 5,378 | 14469 | <filename>tests/test_markdown_in_code_cells.py
"""Issue #712"""
from nbformat.v4.nbbase import new_code_cell, new_notebook
from jupytext import reads, writes
from jupytext.cell_to_text import three_backticks_or_more
from jupytext.compare import compare, compare_notebooks
from .utils import requires_myst
def test_th... |
example/cifar10/fast_at.py | KuanKuanQAQ/ares | 206 | 14471 | <reponame>KuanKuanQAQ/ares
''' This file provides a wrapper class for Fast_AT (https://github.com/locuslab/fast_adversarial) model for CIFAR-10 dataset. '''
import sys
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import tensorflow as tf
from ares.model.pytorch_wrapper import pytorch_c... |
mayan/apps/linking/tests/test_smart_link_condition_views.py | atitaya1412/Mayan-EDMS | 343 | 14474 | <gh_stars>100-1000
from mayan.apps.testing.tests.base import GenericViewTestCase
from ..events import event_smart_link_edited
from ..permissions import permission_smart_link_edit
from .mixins import (
SmartLinkConditionViewTestMixin, SmartLinkTestMixin,
SmartLinkViewTestMixin
)
class SmartLinkConditionViewT... |
notebooks/container/__init__.py | DanieleBaranzini/sktime-tutorial-pydata-amsterdam-2020 | 114 | 14476 | <gh_stars>100-1000
from container.base import TimeBase
from container.array import TimeArray, TimeDtype
from container.timeseries import TimeSeries
from container.timeframe import TimeFrame |
bh_tsne/prep_result.py | mr4jay/numerai | 306 | 14502 | import struct
import numpy as np
import pandas as pd
df_train = pd.read_csv('../data/train_data.csv')
df_valid = pd.read_csv('../data/valid_data.csv')
df_test = pd.read_csv('../data/test_data.csv')
with open('result.dat', 'rb') as f:
N, = struct.unpack('i', f.read(4))
no_dims, = struct.unpack('i', f.read(4))
... |
tools_d2/convert-pretrain-model-to-d2.py | nguyentritai2906/panoptic-deeplab | 506 | 14526 | <filename>tools_d2/convert-pretrain-model-to-d2.py
#!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import pickle as pkl
import sys
import torch
"""
Usage:
# download your pretrained model:
wget https://github.com/LikeLy-Journey/SegmenTron/releases/download/v0.1.0/tf-xc... |
pyActionRec/action_flow.py | Xiatian-Zhu/anet2016_cuhk | 253 | 14531 | <reponame>Xiatian-Zhu/anet2016_cuhk
from config import ANET_CFG
import sys
sys.path.append(ANET_CFG.DENSE_FLOW_ROOT+'/build')
from libpydenseflow import TVL1FlowExtractor
import action_caffe
import numpy as np
class FlowExtractor(object):
def __init__(self, dev_id, bound=20):
TVL1FlowExtractor.set_dev... |
apps/auth/views/wxlogin.py | rainydaygit/testtcloudserver | 349 | 14534 | from flask import Blueprint
from apps.auth.business.wxlogin import WxLoginBusiness
from apps.auth.extentions import validation, parse_json_form
from library.api.render import json_detail_render
wxlogin = Blueprint("wxlogin", __name__)
@wxlogin.route('/', methods=['POST'])
@validation('POST:wx_user_code')
def wxuser... |
vimfiles/bundle/vim-python/submodules/pylint/tests/functional/s/star/star_needs_assignment_target_py35.py | ciskoinch8/vimrc | 463 | 14558 | """
Test PEP 0448 -- Additional Unpacking Generalizations
https://www.python.org/dev/peps/pep-0448/
"""
# pylint: disable=superfluous-parens, unnecessary-comprehension
UNPACK_TUPLE = (*range(4), 4)
UNPACK_LIST = [*range(4), 4]
UNPACK_SET = {*range(4), 4}
UNPACK_DICT = {'a': 1, **{'b': '2'}}
UNPACK_DICT2 = {**UNPACK_D... |
search_for_similar_images__perceptual_hash__phash/ui/SelectDirBox.py | DazEB2/SimplePyScripts | 117 | 14561 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# SOURCE: https://github.com/gil9red/VideoStreamingWithEncryption/blob/37cf7f501460a286ec44a20db7b2403e8cb05d97/server_GUI_Qt/inner_libs/gui/SelectDirBox.py
import os
from PyQt5.QtWidgets import QWidget, QLineEdit, QLabel, QPushButton, QHBoxLa... |
code/nn/optimization.py | serced/rcnn | 372 | 14573 | '''
This file implements various optimization methods, including
-- SGD with gradient norm clipping
-- AdaGrad
-- AdaDelta
-- Adam
Transparent to switch between CPU / GPU.
@author: <NAME> (<EMAIL>)
'''
import random
from collections import OrderedDict
import numpy as np
i... |
deep-rl/lib/python2.7/site-packages/OpenGL/GLES2/vboimplementation.py | ShujaKhalid/deep-rl | 210 | 14583 | from OpenGL.arrays import vbo
from OpenGL.GLES2.VERSION import GLES2_2_0
from OpenGL.GLES2.OES import mapbuffer
class Implementation( vbo.Implementation ):
"""OpenGL-based implementation of VBO interfaces"""
def __init__( self ):
for name in self.EXPORTED_NAMES:
for source in [ GLES2_2_0, m... |
eval.py | CLT29/pvse | 119 | 14595 | from __future__ import print_function
import os, sys
import pickle
import time
import glob
import numpy as np
import torch
from model import PVSE
from loss import cosine_sim, order_sim
from vocab import Vocabulary
from data import get_test_loader
from logger import AverageMeter
from option import parser, verify_input... |
paddlex/ppdet/modeling/heads/detr_head.py | xiaolao/PaddleX | 3,655 | 14596 | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
mapreduce/handlers.py | igeeker/v2ex | 161 | 14600 | #!/usr/bin/env python
#
# Copyright 2010 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
src/third_party/swiftshader/third_party/subzero/pydir/wasm-run-torture-tests.py | rhencke/engine | 2,151 | 14605 | <filename>src/third_party/swiftshader/third_party/subzero/pydir/wasm-run-torture-tests.py
#!/usr/bin/env python2
#===- subzero/wasm-run-torture-tests.py - Subzero WASM Torture Test Driver ===//
#
# The Subzero Code Generator
#
# This file is distributed under the University of Illinois Open Sour... |
tests/storage/test_filesystem.py | dilyanpalauzov/vdirsyncer | 888 | 14613 | <filename>tests/storage/test_filesystem.py
import subprocess
import aiostream
import pytest
from vdirsyncer.storage.filesystem import FilesystemStorage
from vdirsyncer.vobject import Item
from . import StorageTests
class TestFilesystemStorage(StorageTests):
storage_class = FilesystemStorage
@pytest.fixtur... |
mhcflurry/select_allele_specific_models_command.py | ignatovmg/mhcflurry | 113 | 14615 | """
Model select class1 single allele models.
"""
import argparse
import os
import signal
import sys
import time
import traceback
import random
from functools import partial
from pprint import pprint
import numpy
import pandas
from scipy.stats import kendalltau, percentileofscore, pearsonr
from sklearn.metrics import ... |
CircuitPython_Made_Easy_On_CPX/cpx_temperature_neopixels.py | joewalk102/Adafruit_Learning_System_Guides | 665 | 14616 | import time
from adafruit_circuitplayground.express import cpx
import simpleio
cpx.pixels.auto_write = False
cpx.pixels.brightness = 0.3
# Set these based on your ambient temperature for best results!
minimum_temp = 24
maximum_temp = 30
while True:
# temperature value remapped to pixel position
peak = simple... |
opendbc/generator/test_generator.py | darknight111/openpilot3 | 116 | 14619 | <gh_stars>100-1000
#!/usr/bin/env python3
import os
import filecmp
import tempfile
from opendbc.generator.generator import create_all, opendbc_root
def test_generator():
with tempfile.TemporaryDirectory() as d:
create_all(d)
ignore = [f for f in os.listdir(opendbc_root) if not f.endswith('_generated.dbc')]... |
mayan/apps/rest_api/classes.py | atitaya1412/Mayan-EDMS | 336 | 14621 | <filename>mayan/apps/rest_api/classes.py
from collections import namedtuple
import io
import json
from furl import furl
from django.core.handlers.wsgi import WSGIRequest
from django.http.request import QueryDict
from django.template import Variable, VariableDoesNotExist
from django.test.client import MULTIPART_CONTEN... |
pxr/base/tf/testenv/testTfStringUtils.py | DougRogers-DigitalFish/USD | 3,680 | 14637 | #!/pxrpythonsubst
#
# Copyright 2016 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
... |
envelopes/envelope.py | siyaoyao/envelopes | 202 | 14647 | # -*- coding: utf-8 -*-
# Copyright (c) 2013 <NAME> <<EMAIL>>
#
# 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, mo... |
test/test_format.py | GuyTuval/msgpack-python | 1,252 | 14661 | <reponame>GuyTuval/msgpack-python
#!/usr/bin/env python
# coding: utf-8
from msgpack import unpackb
def check(src, should, use_list=0, raw=True):
assert unpackb(src, use_list=use_list, raw=raw, strict_map_key=False) == should
def testSimpleValue():
check(b"\x93\xc0\xc2\xc3", (None, False, True))
def test... |
test/scons-time/time/no-result.py | moroten/scons | 1,403 | 14682 | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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,
... |
foo/pictureR/wordsTemplate.py | MangetsuC/arkHelper | 147 | 14724 | <filename>foo/pictureR/wordsTemplate.py<gh_stars>100-1000
from PIL import Image, ImageDraw, ImageFont
from numpy import asarray
from cv2 import cvtColor, COLOR_RGB2BGR, imshow, waitKey
from os import getcwd
def getFontSize_name(resolution):
x = resolution[0]
if x <= 1024:
return (16, (1024,576))
el... |
tools/harness/tests/freemem.py | lambdaxymox/barrelfish | 111 | 14737 | ##########################################################################
# Copyright (c) 2009, ETH Zurich.
# All rights reserved.
#
# This file is distributed under the terms in the attached LICENSE file.
# If you do not find this file, copies can be found by writing to:
# ETH Zurich D-INFK, Universitaetstrasse 6, CH... |
src/reader/_plugins/enclosure_tags.py | mirekdlugosz/reader | 205 | 14750 | """
enclosure_tags
~~~~~~~~~~~~~~
Fix tags for MP3 enclosures (e.g. podcasts).
Adds a "with tags" link to a version of the file with tags set as follows:
* the entry title as title
* the feed title as album
* the entry/feed author as author
This plugin needs additional dependencies, use the ``unstable-plugins`` ext... |
gw_full_latest/CloudTTN.py | rendikanyut/LowCostLoRaGw | 654 | 14763 | <gh_stars>100-1000
#-------------------------------------------------------------------------------
# Part of this Python script is taken from the Pycom NanoGateway
# https://github.com/pycom/pycom-libraries/tree/master/examples/lorawan-nano-gateway
#
# Adapted by <EMAIL>
#
# This file is part of the low-cost LoRa gate... |
release/stubs.min/Autodesk/Revit/DB/__init___parts/Workset.py | htlcnn/ironpython-stubs | 182 | 14772 | class Workset(WorksetPreview,IDisposable):
""" Represents a workset in the document. """
@staticmethod
def Create(document,name):
"""
Create(document: Document,name: str) -> Workset
Creates a new workset.
document: The document in which the new instance is created.
name: The wo... |
tf_quant_finance/datetime/constants.py | slowy07/tf-quant-finance | 3,138 | 14794 | # Lint as: python3
# Copyright 2019 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
generate_trajectories.py | keuntaeklee/pytorch-PPUU | 159 | 14795 | import argparse, pdb
import gym
import numpy as np
import os
import pickle
import random
import torch
import scipy.misc
from gym.envs.registration import register
parser = argparse.ArgumentParser()
parser.add_argument('-display', type=int, default=0)
parser.add_argument('-seed', type=int, default=1)
parser.add_argumen... |
curriculum/experiments/goals/point_nd/goal_point_nd_trpo.py | coco-robotics/rllab-curriculum | 115 | 14807 | <filename>curriculum/experiments/goals/point_nd/goal_point_nd_trpo.py
from curriculum.utils import set_env_no_gpu, format_experiment_prefix
set_env_no_gpu()
import argparse
import math
import os
import os.path as osp
import sys
import random
from multiprocessing import cpu_count
import numpy as np
import tensorflow a... |
pyNastran/bdf/bdf_interface/encoding.py | ACea15/pyNastran | 293 | 14808 | <gh_stars>100-1000
def decode_lines(lines_bytes, encoding: str):
if isinstance(lines_bytes[0], bytes):
lines_str = [line.decode(encoding) for line in lines_bytes]
elif isinstance(lines_bytes[0], str):
lines_str = lines_bytes
else:
raise TypeError(type(lines_bytes[0]))
return line... |
generator/src/googleapis/codegen/utilities/json_expander.py | romulobusatto/google-api-php-client-services | 709 | 14831 | #!/usr/bin/python2.7
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... |
haiku/_src/integration/numpy_inputs_test.py | timwillhack/dm-haikuBah2 | 1,647 | 14875 | <reponame>timwillhack/dm-haikuBah2
# Copyright 2020 DeepMind Technologies Limited. 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/... |
tests/test_translator.py | Attsun1031/schematics | 1,430 | 14894 | # -*- coding: utf-8 -*-
import pytest
def test_translator():
def translator(string):
translations = {'String value is too long.': 'Tamanho de texto muito grande.'}
return translations.get(string, string)
from schematics.translator import register_translator
register_translator(translator... |
osf/management/commands/populate_custom_taxonomies.py | gaybro8777/osf.io | 628 | 14909 | import json
import logging
from django.core.management.base import BaseCommand
from django.db import transaction
from osf.models import AbstractProvider, PreprintProvider, Preprint, Subject
from osf.models.provider import rules_to_subjects
from scripts import utils as script_utils
from osf.models.validators import va... |
modules/mongodb_atlas/mongodb_atlas.py | riddopic/opta | 595 | 14935 | <filename>modules/mongodb_atlas/mongodb_atlas.py
import os
from typing import TYPE_CHECKING
from modules.base import ModuleProcessor
from opta.core.terraform import get_terraform_outputs
from opta.exceptions import UserErrors
if TYPE_CHECKING:
from opta.layer import Layer
from opta.module import Module
clas... |
plugins/hashsum_download/girder_hashsum_download/settings.py | JKitok/girder | 395 | 14972 | from girder.exceptions import ValidationException
from girder.utility import setting_utilities
class PluginSettings:
AUTO_COMPUTE = 'hashsum_download.auto_compute'
@setting_utilities.default(PluginSettings.AUTO_COMPUTE)
def _defaultAutoCompute():
return False
@setting_utilities.validator(PluginSettings.AU... |
ccmlib/cluster_factory.py | justinchuch/ccm | 626 | 14974 |
from __future__ import absolute_import
import os
import yaml
from ccmlib import common, extension, repository
from ccmlib.cluster import Cluster
from ccmlib.dse_cluster import DseCluster
from ccmlib.node import Node
from distutils.version import LooseVersion #pylint: disable=import-error, no-name-in-module
class... |
causalnex/structure/pytorch/dist_type/_base.py | Rishab26/causalnex | 1,523 | 14975 | # Copyright 2019-2020 QuantumBlack Visual Analytics Limited
#
# 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
#
# THE SOFTWARE IS PROVIDED "AS IS"... |
docs/examples/Moving_Platform_Simulation.py | Red-Portal/Stone-Soup-1 | 157 | 15018 | #!/usr/bin/env python
# coding: utf-8
"""
Multi-Sensor Moving Platform Simulation Example
===============================================
This example looks at how multiple sensors can be mounted on a single moving platform and exploiting a defined moving
platform as a sensor target.
"""
# %%
# Building a Simulated M... |
examples/ndfd/ndfd.py | eLBati/pyxb | 123 | 15021 | from raw.ndfd import *
|
backend/kale/tests/assets/kfp_dsl/simple_data_passing.py | brness/kale | 502 | 15035 | import json
import kfp.dsl as _kfp_dsl
import kfp.components as _kfp_components
from collections import OrderedDict
from kubernetes import client as k8s_client
def step1():
from kale.common import mlmdutils as _kale_mlmdutils
_kale_mlmdutils.init_metadata()
from kale.marshal.decorator import marshal as... |
gaphor/RAAML/stpa/connectors.py | Texopolis/gaphor | 867 | 15054 | <filename>gaphor/RAAML/stpa/connectors.py<gh_stars>100-1000
from gaphor.diagram.connectors import Connector
from gaphor.diagram.presentation import Classified
from gaphor.RAAML.raaml import RelevantTo
from gaphor.RAAML.stpa import RelevantToItem
from gaphor.SysML.requirements.connectors import DirectedRelationshipPrope... |
python/test/experimental/test_tb_graph_writer.py | daniel-falk/nnabla | 2,792 | 15067 | # Copyright 2021 Sony 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 by applicable law or agreed to in wri... |
pyperform/tools.py | timgates42/pyperform | 250 | 15080 | <gh_stars>100-1000
__author__ = 'calvin'
import re
import sys
from math import log10
if sys.version[0] == '3':
pass
else:
range = xrange
classdef_regex = re.compile(r"\S*def .*#!|class .*#!")
tagged_line_regex = re.compile(r".*#!")
def convert_time_units(t):
""" Convert time in seconds into reasonable... |
google_or_tools/coloring_ip_sat.py | tias/hakank | 279 | 15101 | # Copyright 2021 <NAME> <EMAIL>
#
# 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 in writin... |
tools/find_run_binary.py | pospx/external_skia | 6,304 | 15106 | #!/usr/bin/python
# Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module that finds and runs a binary by looking in the likely locations."""
import os
import subprocess
import sys
def run_comman... |
pml/engineer_tests.py | gatapia/py_ml_utils | 183 | 15129 | from __future__ import print_function, absolute_import
import unittest, math
import pandas as pd
import numpy as np
from . import *
class T(base_pandas_extensions_tester.BasePandasExtensionsTester):
def test_concat(self):
df = pd.DataFrame({'c_1':['a', 'b', 'c'], 'c_2': ['d', 'e', 'f']})
df.en... |
src/pyrobot/habitat/base.py | cihuang123/pyrobot | 2,150 | 15131 | import numpy as np
import math
import pyrobot.utils.util as prutil
import rospy
import habitat_sim.agent as habAgent
import habitat_sim.utils as habUtils
from habitat_sim.agent.controls import ActuationSpec
import habitat_sim.errors
import quaternion
from tf.transformations import euler_from_quaternion, euler_from_mat... |
nanpy/bmp180.py | AFTC-1/Arduino-rpi | 178 | 15135 | <filename>nanpy/bmp180.py
from __future__ import division
import logging
from nanpy.i2c import I2C_Master
from nanpy.memo import memoized
import time
log = logging.getLogger(__name__)
def to_s16(n):
return (n + 2 ** 15) % 2 ** 16 - 2 ** 15
class Bmp180(object):
"""Control of BMP180 Digital pressure senso... |
qf_lib/backtesting/order/order.py | webclinic017/qf-lib | 198 | 15146 | <gh_stars>100-1000
# Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... |
hallucinate/api.py | SySS-Research/hallucinate | 199 | 15148 | class BaseHandler:
def send(self, data, p):
pass
def recv(self, data, p):
pass
def shutdown(self, p, direction=2):
pass
def close(self):
pass
|
seq2seq-chatbot/chat_web.py | rohitkujur1997/chatbot | 104 | 15151 | <reponame>rohitkujur1997/chatbot<filename>seq2seq-chatbot/chat_web.py
"""
Script for serving a trained chatbot model over http
"""
import datetime
import click
from os import path
from flask import Flask, request, send_from_directory
from flask_cors import CORS
from flask_restful import Resource, Api
import general_ut... |
datar/base/trig_hb.py | stjordanis/datar | 110 | 15179 | <filename>datar/base/trig_hb.py<gh_stars>100-1000
"""Trigonometric and Hyperbolic Functions"""
from typing import Callable
import numpy
from pipda import register_func
from ..core.contexts import Context
from ..core.types import FloatOrIter
from .constants import pi
def _register_trig_hb_func(name: str, np_name: s... |
tests/unit/cli/test_repo.py | tehlingchu/anchore-cli | 110 | 15217 | from anchorecli.cli import repo
|
src/pyrobot/vrep_locobot/camera.py | gujralsanyam22/pyrobot | 2,150 | 15230 | <reponame>gujralsanyam22/pyrobot
# 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.
import numpy as np
import pyrobot.utils.util as prutil
from pyrobot.core import Camera
from pyrobot.utils.uti... |
packs/hue/actions/rgb.py | jonico/st2contrib | 164 | 15278 | from lib import action
class RGBAction(action.BaseAction):
def run(self, light_id, red, green, blue, transition_time):
light = self.hue.lights.get(light_id)
light.rgb(red, green, blue, transition_time)
|
Dragon/python/dragon/vm/tensorflow/contrib/learn/datasets/base.py | neopenx/Dragon | 212 | 15301 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
Algorithm.Python/OptionDataNullReferenceRegressionAlgorithm.py | BlackBoxAM/Lean | 6,580 | 15316 | # QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect 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 Licen... |
examples/sharedlinks/sharedlinks-backend/links/models.py | gcbirzan/django-rest-registration | 329 | 15317 | from django.db import models
from django.contrib.auth.models import User
class Link(models.Model):
url = models.URLField()
title = models.CharField(max_length=255)
reporter = models.ForeignKey(
User,
on_delete=models.SET_NULL,
related_name='reported_links',
null=True,
... |
clint/textui/core.py | mpmman/clint | 1,230 | 15323 | <gh_stars>1000+
# -*- coding: utf-8 -*-
"""
clint.textui.core
~~~~~~~~~~~~~~~~~
Core TextUI functionality for Puts/Indent/Writer.
"""
from __future__ import absolute_import
import sys
from contextlib import contextmanager
from .formatters import max_width, min_width, _get_max_width_context
from .cols import col... |
private_market/test.py | sigmoid3/Dapper | 974 | 15352 | <reponame>sigmoid3/Dapper<gh_stars>100-1000
from ethereum import tester as t
from ethereum import utils
def test():
s = t.state()
test_company = s.abi_contract('company.se', ADMIN_ACCOUNT=utils.decode_int(t.a0))
order_book = s.abi_contract('orders.se')
test_currency = s.abi_contract('currency.se', send... |
doc/python_api/examples/bpy.types.Depsgraph.1.py | rbabari/blender | 365 | 15373 | <gh_stars>100-1000
"""
Dependency graph: Evaluated ID example
++++++++++++++++++++++++++++++++++++++
This example demonstrates access to the evaluated ID (such as object, material, etc.) state from
an original ID.
This is needed every time one needs to access state with animation, constraints, and modifiers
taken into... |
setup.py | zhuzhenping/hf_at_py | 130 | 15385 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/11/20 8:15
# @Author : HaiFeng
# @Email : <EMAIL>
from setuptools import setup
import os
this_directory = os.path.abspath(os.path.dirname(__file__))
# 读取文件内容
def read_file(filename):
with open(os.path.join(this_directory, filename), encoding='u... |
scripts/download_lookml.py | orf/lkml | 110 | 15532 | <filename>scripts/download_lookml.py
import os
import re
from base64 import b64decode
from pathlib import Path
import requests
username = os.environ["GITHUB_USERNAME"]
password = os.environ["GITHUB_PERSONAL_ACCESS_TOKEN"]
auth = requests.auth.HTTPBasicAuth(username, password)
directory = Path(__file__).resolve().par... |
m2-modified/ims/common/agentless-system-crawler/crawler/plugins/emitters/http_emitter.py | CCI-MOC/ABMI | 108 | 15543 | <reponame>CCI-MOC/ABMI<filename>m2-modified/ims/common/agentless-system-crawler/crawler/plugins/emitters/http_emitter.py
import logging
from iemit_plugin import IEmitter
from plugins.emitters.base_http_emitter import BaseHttpEmitter
logger = logging.getLogger('crawlutils')
class HttpEmitter(BaseHttpEmitter, IEmitte... |
chainer_chemistry/links/update/ggnn_update.py | pfnet/chainerchem | 184 | 15549 | <gh_stars>100-1000
import chainer
from chainer import functions
from chainer import links
import chainer_chemistry
from chainer_chemistry.links.connection.graph_linear import GraphLinear
from chainer_chemistry.utils import is_sparse
class GGNNUpdate(chainer.Chain):
"""GGNN submodule for update part.
Args:
... |
samples/ast/test.py | Ryoich/python_zero | 203 | 15550 | def func(a, b):
return a + b
def func2(a):
print(a)
print("Hello")
|
configs/models/aott.py | yoxu515/aot-benchmark | 105 | 15555 | import os
from .default import DefaultModelConfig
class ModelConfig(DefaultModelConfig):
def __init__(self):
super().__init__()
self.MODEL_NAME = 'AOTT'
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.