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 |
|---|---|---|---|---|
tests/structure/test_mmtf.py | alex123012/biotite | 208 | 11090939 | <gh_stars>100-1000
# This source code is part of the Biotite package and is distributed
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
# information.
from tempfile import TemporaryFile
import glob
import itertools
from os.path import join, splitext
import numpy as np
import pytest
from pytest i... |
tests/test_pickle.py | dimidd/skift | 244 | 11090956 | """Test skift."""
import os
import pickle
import pytest
import pandas as pd
import tempfile
from sklearn.exceptions import NotFittedError
from skift import FirstColFtClassifier
@pytest.mark.parametrize("quantize", [True, False])
def test_pickle(quantize):
ftdf = pd.DataFrame(
data=[['woof woof', 0], [... |
tests/test_api_v1_firewall_rule.py | jaredhendrickson13/pfsense-api | 311 | 11090959 | <filename>tests/test_api_v1_firewall_rule.py
# Copyright 2022 <NAME>
#
# 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 ... |
sionna/fec/conv/__init__.py | NVlabs/sionna | 163 | 11091002 | <gh_stars>100-1000
#
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
"""Docstring for the Convolutional codes subpackage.
"""
from .encoding import ConvEncoder
from .decoding import ViterbiDecoder
from .utils import polynomi... |
dec_mining/data_utils.py | ishine/qa_match | 320 | 11091023 | <filename>dec_mining/data_utils.py
# -*- coding: utf-8 -*-
"""
data utils
"""
import os
import sys
import codecs
import collections
import tensorflow as tf
import numpy as np
import six
def convert_to_unicode(text):
"""Converts `text` to Unicode (if it's not already), assuming utf-8 input."""
if six.PY3:
... |
extra_features/influxdb_adapter/datadb.py | grofers/PGObserver | 274 | 11091025 | import psycopg2
import psycopg2.extras
import psycopg2.pool
import contextlib
connection_pool = None
@contextlib.contextmanager
def get_conn(pool):
conn = None
try:
conn = pool.getconn()
conn.autocommit = True
yield conn
finally:
if conn:
pool.putconn(conn)
... |
models/dropped_model.py | MarcAntoineAlex/DenseNAS-1 | 305 | 11091056 | import torch
import torch.nn as nn
import torch.nn.functional as F
class MixedOp(nn.Module):
def __init__(self, dropped_mixed_ops, softmax_temp=1.):
super(MixedOp, self).__init__()
self.softmax_temp = softmax_temp
self._ops = nn.ModuleList()
for op in dropped_mixed_ops:
... |
pyatac/fragmentsizes.py | RavelBio/NucleoATAC | 101 | 11091087 | <gh_stars>100-1000
"""
Classes for working with fragment distribution
@author: <NAME>, Greenleaf Lab, Stanford University
"""
import numpy as np
import pyximport
pyximport.install(setup_args={"include_dirs":np.get_include()})
from pyatac.fragments import getAllFragmentSizes, getFragmentSizesFromChunkList
class Fr... |
xgcm/comodo.py | IvanaEscobar/xgcm | 174 | 11091089 | <filename>xgcm/comodo.py
from collections import OrderedDict
def assert_valid_comodo(ds):
"""Verify that the dataset meets comodo conventions
Parameters
----------
ds : xarray.dataset
"""
# TODO: implement
assert True
def get_all_axes(ds):
axes = set()
for d in ds.dims:
... |
setup.py | RafaelVidoto/robotframework-SikuliLibrary | 143 | 11091109 | <reponame>RafaelVidoto/robotframework-SikuliLibrary<filename>setup.py<gh_stars>100-1000
'''
Created on 2015/12/10
Author: by <EMAIL>
'''
from setuptools import setup
from os.path import abspath, dirname, join
with open(join(dirname(abspath(__file__)), 'target', 'src', 'SikuliLibrary', 'version.py')) as f:
exec(f.... |
test_async/test_connection_async.py | cuongnguyen2190/pure-python-adb | 382 | 11091113 | <gh_stars>100-1000
"""Unit tests for `ConnectionAsync` class.
"""
import asyncio
import sys
import unittest
from unittest.mock import patch
sys.path.insert(0, '..')
from ppadb.connection_async import ConnectionAsync
from .async_wrapper import awaiter
from .patchers import FakeStreamReader, FakeStreamWriter, async... |
test/modules/encoders/test_lstm_encoder.py | facebookresearch/multimodal | 128 | 11091134 | # 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 unittest
import torch
from torchmultimodal.modules.encoders.lstm_encoder import LSTMEncoder
class Tes... |
sklearn_predict.py | shomikverma/chemprop | 689 | 11091137 | <reponame>shomikverma/chemprop
"""Loads a trained sklearn model checkpoint and makes predictions on a dataset."""
from chemprop.sklearn_predict import sklearn_predict
if __name__ == '__main__':
sklearn_predict()
|
selfdrive/debug/count_events.py | shoes22/openpilot | 37,508 | 11091163 | #!/usr/bin/env python3
import sys
from collections import Counter
from pprint import pprint
from tqdm import tqdm
from tools.lib.route import Route
from tools.lib.logreader import LogReader
if __name__ == "__main__":
r = Route(sys.argv[1])
cnt_valid: Counter = Counter()
cnt_events: Counter = Counter()
for q... |
examples/pytorch/diffpool/model/tensorized_layers/diffpool.py | ketyi/dgl | 9,516 | 11091204 | <gh_stars>1000+
import torch
from torch import nn as nn
from model.tensorized_layers.assignment import DiffPoolAssignment
from model.tensorized_layers.graphsage import BatchedGraphSAGE
from model.loss import EntropyLoss, LinkPredLoss
class BatchedDiffPool(nn.Module):
def __init__(self, nfeat, nnext, nhid, link_p... |
installer/resources/pacbot_app/cloudwatch_log_groups.py | Diffblue-benchmarks/pacbot | 1,165 | 11091244 | <gh_stars>1000+
from core.terraform.resources.aws.cloudwatch import CloudWatchLogGroupResource
class ApiCloudWatchLogGroup(CloudWatchLogGroupResource):
name = "apis"
retention_in_days = 7
class UiCloudWatchLogGroup(CloudWatchLogGroupResource):
name = "ui"
retention_in_days = 7
|
examples/bsuite/trpo_v_random.py | acse-yl27218/cherry | 160 | 11091265 | #!/usr/bin/env python3
import torch as th
from torch import autograd, nn
from torch.nn.utils import parameters_to_vector, vector_to_parameters
from torch.distributions import kl_divergence
import cherry as ch
from cherry.algorithms import trpo
from cherry.models.robotics import LinearValue
import bsuite
from bsuite ... |
docs/examples/sqs_send.py | vlcinsky/nameko | 3,425 | 11091287 | <filename>docs/examples/sqs_send.py<gh_stars>1000+
from nameko.extensions import DependencyProvider
import boto3
class SqsSend(DependencyProvider):
def __init__(self, url, region="eu-west-1", **kwargs):
self.url = url
self.region = region
super(SqsSend, self).__init__(**kwargs)
def s... |
tests/test_goal_directed_benchmark.py | jcheminform/guacamol | 242 | 11091314 | from typing import Optional, List
import pytest
from rdkit import Chem
from guacamol.goal_directed_benchmark import GoalDirectedBenchmark
from guacamol.goal_directed_generator import GoalDirectedGenerator
from guacamol.goal_directed_score_contributions import uniform_specification
from guacamol.scoring_function impor... |
applications/popart/bert/bert_optimizer/continuous_pipelining.py | payoto/graphcore_examples | 260 | 11091316 | # Copyright (c) 2021 Graphcore 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
tests/test_cli_convert.py | meatcar/sqlite-utils | 729 | 11091321 | <gh_stars>100-1000
from click.testing import CliRunner
from sqlite_utils import cli
import sqlite_utils
import json
import textwrap
import pathlib
import pytest
@pytest.fixture
def test_db_and_path(fresh_db_and_path):
db, db_path = fresh_db_and_path
db["example"].insert_all(
[
{"id": 1, "d... |
example/imu.py | animuku/pyk4a | 186 | 11091339 | import matplotlib.pyplot as plt
import numpy as np
import pyk4a
from pyk4a import Config, PyK4A
MAX_SAMPLES = 1000
def set_default_data(data):
data["acc_x"] = MAX_SAMPLES * [data["acc_x"][-1]]
data["acc_y"] = MAX_SAMPLES * [data["acc_y"][-1]]
data["acc_z"] = MAX_SAMPLES * [data["acc_z"][-1]]
data["... |
pj4_ner_word/evaluator.py | AidenLong/PJ_NLP | 157 | 11091343 | <gh_stars>100-1000
from __future__ import division
import numpy as np
import itertools
from torch.autograd import Variable
import torch
class Evaluator:
""" evaluation class for ner task """
def __init__(self, l_map):
self.l_map = l_map
self.r_l_map = {v: k for k, v in l_map.items()}
def... |
python/pyspark/test_serializers.py | boyizhang/spark-2.3.2 | 289 | 11091352 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
homeassistant/components/default_config/__init__.py | domwillcode/home-assistant | 22,481 | 11091355 | """Component providing default configuration for new users."""
try:
import av
except ImportError:
av = None
from homeassistant.setup import async_setup_component
DOMAIN = "default_config"
async def async_setup(hass, config):
"""Initialize default configuration."""
if av is None:
return True
... |
code/client/munkilib/fetch.py | KWik/munki | 2,536 | 11091361 | # encoding: utf-8
#
# Copyright 2011-2021 <NAME>.
#
# 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... |
cosypose/recording/bop_recording_scene.py | ompugao/cosypose | 202 | 11091369 | from pathlib import Path
import pinocchio as pin
import numpy as np
from cosypose.config import ASSET_DIR
from cosypose.datasets.datasets_cfg import make_urdf_dataset, make_texture_dataset
from cosypose.simulator import BaseScene, Body, Camera
from cosypose.simulator import BodyCache, TextureCache, apply_random_text... |
libs/blocks-extras/blocks_extras/initialization.py | dendisuhubdy/attention-lvcsr | 295 | 11091404 | import numpy
import theano
from blocks_extras.utils import check_valid_permutation
from blocks.initialization import NdarrayInitialization
class PermutationMatrix(NdarrayInitialization):
"""Generates a 2-dimensional permutation matrix.
Parameters
----------
permutation : ndarray, 1-dimensional, opti... |
python/ql/test/library-tests/encoding/utf8_bom.py | vadi2/codeql | 4,036 | 11091417 | #Starts with a BOM
|
utilities/misc.py | lixiny/ContactPose | 199 | 11091476 | # Copyright (c) Facebook, Inc. and its affiliates.
# Code by <NAME>
import numpy as np
import logging
import math
import transforms3d.euler as txe
import transforms3d.quaternions as txq
import argparse
import cv2
import matplotlib.pyplot as plt
try:
from thirdparty.mano.webuser.smpl_handpca_wrapper_HAND_only \
i... |
more_examples/m8e_images.py | colledkm/24-Tkinter | 201 | 11091484 | <filename>more_examples/m8e_images.py
"""
Example showing for tkinter and ttk how to:
-- Put an IMAGE on a Button (or anything else).
-- Also have text if you want.
Note: The image file for tkinter/ttk must be a GIF (or one of several
other unhelpful formats). PIL -- Python Imaging Library --
is the s... |
platoon/tests/unit/test_controller.py | mila-udem/platoon | 212 | 11091497 | <gh_stars>100-1000
from __future__ import absolute_import
import six
import unittest
from ...channel import controller
if six.PY3:
buffer_ = memoryview
else:
buffer_ = buffer # noqa
class TestController(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.local_size = 3
cls.dev... |
quantifiedcode/plugins/git/backend/tasks/__init__.py | marcinguy/quantifiedcode | 138 | 11091502 | <filename>quantifiedcode/plugins/git/backend/tasks/__init__.py
# -*- coding: utf-8 -*-
"""
Git Tasks and related files
"""
from .fetch import fetch_remote
from .analyze import analyze, update_project_statistics
from .auto_tag import auto_tag
hooks = [
("project.analyze.fetch", fetch_remote),
("project.ana... |
docs/tutorial/rnn_tutorial/gru_step.py | yuhonghong66/minpy | 1,271 | 11091507 | <reponame>yuhonghong66/minpy
def gru_step(x, prev_h, Wx, Wh, b, Wxh, Whh, bh):
"""
Forward pass for a single timestep of an GRU.
The input data has dimentsion D, the hidden state has dimension H, and we
use a minibatch size of N.
Parameters
----------
x : Input data, of shape (N, D)
pr... |
projects/EQL/eql/fast_rcnn.py | Swall0w/detectron2 | 196 | 11091508 | <gh_stars>100-1000
import logging
import math
import numpy as np
import torch
from torch import nn
from torch.nn import functional as F
from detectron2.modeling.roi_heads.fast_rcnn import FastRCNNOutputLayers, FastRCNNOutputs
logger = logging.getLogger(__name__)
class EQLFastRCNNOutputLayers(FastRCNNOutputLayers):
... |
tooz/_retry.py | Kami/tooz | 104 | 11091524 | <filename>tooz/_retry.py
# -*- coding: utf-8 -*-
#
# Copyright © 2016 Red Hat, 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
#
# Unl... |
scripts/save_tag.py | goncaloperes/intellij-rust | 4,168 | 11091545 | <filename>scripts/save_tag.py
import argparse
from git import git_command
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--tag", type=str, help="tag name", required=True)
parser.add_argument("--commit", type=str, help="commit hash", required=True)
args = parser.par... |
tools/perf/page_sets/system_health/chrome_stories.py | zipated/src | 2,151 | 11091576 | <filename>tools/perf/page_sets/system_health/chrome_stories.py
# Copyright 2016 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.
from page_sets.system_health import platforms
from page_sets.system_health import story_tags
f... |
telemetry/telemetry/story/expectations.py | BearerPipelineTest/catapult | 1,894 | 11091591 | <reponame>BearerPipelineTest/catapult<gh_stars>1000+
# Copyright 2017 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.
from __future__ import absolute_import
from telemetry.core import os_version as os_version_module
# TO... |
examples/gto/24-ao_value_on_grid.py | robert-anderson/pyscf | 501 | 11091599 | #!/usr/bin/env python
#
# Author: <NAME> <<EMAIL>>
#
'''
Given coordinates of grids in real space, evaluate the GTO values and MO
orbital values on these grids.
See also
pyscf/examples/dft/30-ao_value_on_grid.py
pyscf/examples/pbc/30-ao_value_on_grid.py
'''
import numpy
from pyscf import lib, gto, scf
mol = gto.M(a... |
python_src/rrts/3D/rrt3D.py | tkortz/motion_planning_rt | 111 | 11091618 | import numpy as np
from numpy.linalg import norm
from math import *
from matplotlib import pyplot as plt
from matplotlib.patches import Polygon
from random import random
from scipy.spatial import ConvexHull
from matplotlib import path
import time
from mpl_toolkits import mplot3d
from mpl_toolkits.mplot3d.art3d import P... |
build/common/commands/worker.py | iamkhalidbashir/frappe_docker | 535 | 11091642 | <gh_stars>100-1000
import os
from frappe.utils.background_jobs import start_worker
def main():
queue = os.environ.get("WORKER_TYPE", "default")
start_worker(queue, False)
exit(0)
if __name__ == "__main__":
main()
|
PhysicsTools/JetMCAlgos/python/GK5CaloJetsMCFlavour_cff.py | ckamtsikis/cmssw | 852 | 11091653 | import FWCore.ParameterSet.Config as cms
# Flavour byReference
GK5byRef = cms.EDProducer("JetPartonMatcher",
jets = cms.InputTag("gk5CaloJets"),
coneSizeToAssociate = cms.double(0.3),
partons = cms.InputTag("myPartons")
)
# Flavour byValue PhysDef
GK5byValPhys = cms.EDProducer("JetFlavourIdentifier",
... |
designate/tests/test_coordination.py | cleosson-daitan/designate | 145 | 11091657 | # Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# Author: <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
#
#... |
dpark/dstream.py | timgates42/dpark | 1,928 | 11091667 | from __future__ import absolute_import
from __future__ import print_function
import os
import time
import socket
import shutil
import itertools
import threading
import random
from functools import reduce
from collections import deque
from contextlib import closing
import six
from six.moves import range
try:
import... |
WebMirror/OutputFilters/FoxTeller/FoxTellerReleasesFilter.py | fake-name/ReadableWebProxy | 193 | 11091677 | <gh_stars>100-1000
import WebMirror.OutputFilters.FilterBase
import WebMirror.OutputFilters.util.MessageConstructors as msgpackers
from WebMirror.OutputFilters.util.TitleParsers import extractTitle
import bs4
import re
import calendar
import datetime
import WebRequest
import time
import urllib.parse
import json
i... |
tests/test_quantile.py | anntzer/corner.py | 324 | 11091703 | # -*- coding: utf-8 -*-
import numpy as np
import pytest
import corner
def test_invalid_quantiles_1(seed=42):
np.random.seed(seed)
with pytest.raises(ValueError):
corner.quantile(np.random.rand(100), [-0.1, 5])
def test_invalid_quantiles_2(seed=42):
np.random.seed(seed)
with pytest.raises(... |
tests/api/test_citizens.py | Gorlym/WEB | 187 | 11091714 | <reponame>Gorlym/WEB
from datetime import datetime
from http import HTTPStatus
import pytest
from analyzer.api.schema import BIRTH_DATE_FORMAT
from analyzer.db.schema import citizens_table, imports_table, relations_table
from analyzer.utils.testing import (
compare_citizen_groups, generate_citizen, get_citizens,
... |
pyscf/gto/basis/dyall_tz.py | QuESt-Calculator/pyscf | 501 | 11091731 | #
# When publishing work that uses these basis sets, please use the following citation:
#
# <NAME>, Theor. Chem. Acc. (1998) 99:366; addendum Theor. Chem. Acc. (2002) 108:365;
# revision Theor. Chem. Acc. (2006) 115:441. Basis sets available from the Dirac web site,
# http://dirac.chem.sdu.dk.
Pt = [[0, -1, [6234208... |
api/brands/views.py | gaybro8777/osf.io | 628 | 11091735 | <gh_stars>100-1000
from django.core.exceptions import ObjectDoesNotExist
from rest_framework import generics
from rest_framework import permissions as drf_permissions
from rest_framework.exceptions import NotFound
from framework.auth.oauth_scopes import CoreScopes
from osf.models import Brand
from api.base import perm... |
odps/ml/pipeline/steps.py | Emersonxuelinux/aliyun-odps-python-sdk | 412 | 11091748 | # encoding: utf-8
# Copyright 1999-2017 Alibaba Group Holding 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/licenses/LICENSE-2.0
#
# Unless required b... |
tests/vulnDB/test_bid_downloader.py | hoominkani/dagda | 947 | 11091764 | #
# Licensed to Dagda under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Dagda licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance... |
tests/urls_empty.py | code-review-doctor/django-axes | 831 | 11091785 | urlpatterns: list = []
|
utils/detectron_parser.py | mikito0011/Chainer_Mask_R-CNN | 153 | 11091797 | <reponame>mikito0011/Chainer_Mask_R-CNN
import numpy as np
import os
path = os.path.join(os.path.dirname(__file__), '../')
import sys
sys.path.append(path)
from mask_rcnn_resnet import MaskRCNNResNet
from chainer import serializers
import pickle
model = MaskRCNNResNet(n_fg_class=80, roi_size=14, pretrained_model='auto... |
cache_replacement/policy_learning/cache_model/loss.py | deepneuralmachine/google-research | 23,901 | 11091814 | # 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
examples/pytorch/eager/speech_recognition/rnnt/pytorch/decoders.py | intelkevinputnam/lpot-docs | 172 | 11091840 | <filename>examples/pytorch/eager/speech_recognition/rnnt/pytorch/decoders.py<gh_stars>100-1000
# Copyright (c) 2019, Myrtle Software Limited. All rights reserved.
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this fil... |
desktop/core/ext-py/Django-1.11/tests/forms_tests/tests/test_renderers.py | kokosing/hue | 5,079 | 11091848 | <gh_stars>1000+
import os
import unittest
from django.forms.renderers import (
BaseRenderer, DjangoTemplates, Jinja2, TemplatesSetting,
)
from django.test import SimpleTestCase
from django.utils._os import upath
try:
import jinja2
except ImportError:
jinja2 = None
class SharedTests(object):
expected... |
people-and-planet-ai/timeseries-classification/data_utils.py | InstantDomain/python-docs-samples | 5,938 | 11091859 | <reponame>InstantDomain/python-docs-samples
# Copyright 2021 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... |
utils/builder/register_builder/riscv/register_changes/vector_registers.py | noahsherrill/force-riscv | 111 | 11091872 | <gh_stars>100-1000
#
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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
#
# ... |
pyglet/media/codecs/pyogg.py | HenrYxZ/pyglet | 1,160 | 11091889 | import pyogg
import os.path
import warnings
from abc import abstractmethod
from ctypes import c_void_p, POINTER, c_int, pointer, cast, c_char, c_char_p, CFUNCTYPE, c_ubyte
from ctypes import memmove, create_string_buffer, byref
from pyglet.media import StreamingSource
from pyglet.media.codecs import AudioFormat, Aud... |
source/utils/profiler.py | jaesikchoi/gpss-research | 151 | 11091891 | import collections
import functools
import sys
import time
ENABLE_PROFILER = True
TOP_ONLY = True
depth = collections.defaultdict(int)
counts = collections.defaultdict(lambda: collections.defaultdict(int))
total_time = collections.defaultdict(lambda: collections.defaultdict(float))
def reset(category=None):
glob... |
src/pydybm/reinforce/discrete_agent.py | ibm-research-tokyo/dybm | 126 | 11091914 | # (C) Copyright IBM Corp. 2016
#
# 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... |
polytester/parsers/base.py | skoczen/polytester | 115 | 11091916 | class BaseParser(object):
def tests_passed(self, result):
raise NotImplementedError
# def num_passed(self):
# # Optional, returns the number of passing tests.
# # Can depend on num_failed or num_total.
# pass
# def num_failed(self):
# # Optional, returns the number ... |
src/graspnet_baseline/utils/collision_detector.py | 1heart/graspnet-baseline | 156 | 11091973 | <reponame>1heart/graspnet-baseline<gh_stars>100-1000
""" Collision detection to remove collided grasp pose predictions.
Author: chenxi-wang
"""
import os
import sys
import numpy as np
import open3d as o3d
class ModelFreeCollisionDetector():
""" Collision detection in scenes without object labels. Curren... |
src/securityinsight/azext_sentinel/manual/_params.py | Mannan2812/azure-cli-extensions | 207 | 11092023 | # --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incor... |
client/labml/utils/keras.py | elgalu/labml | 463 | 11092043 | from typing import Dict, Optional
import tensorflow as tf
from labml import tracker, logger
_MAP = {
'size': None,
'batch': None,
'loss': 'loss.train',
'accuracy': 'accuracy.train',
'val_loss': 'loss.valid',
'val_accuracy': 'accuracy.valid'
}
class LabMLKerasCallback(tf.keras.callbacks.Call... |
tests/bytecode/mp-tests/tuple1.py | LabAixBidouille/micropython | 303 | 11092045 | <gh_stars>100-1000
x = ()
x = a
x = a,
x = a, 2
x = a, 2,
x = a, 2, 3
x = a, 2, 3, 4
x = a, 2, 3, 4, 5
x = ()
x = (a)
x = (a,)
x = (a, 2)
x = (a, 2,)
x = (a, 2, 3)
x = (a, 2, 3, 4)
x = (a, 2, 3, 4, 5)
|
exercises/dominoes/dominoes.py | kishankj/python | 1,177 | 11092060 | <gh_stars>1000+
def can_chain(dominoes):
pass
|
livecode/melt_to_time_series.py | pragnesh-ai/driverlessai-recipes | 194 | 11092076 | <gh_stars>100-1000
"""Melt (unpivot) time series in wide format to H2O standard long time series format"""
# Melt time series in wide format (single row) into long format supported
# by DAI: a row represents a point in time (lag) so a column represents
# a time series values.
#
# Specification:
# Inputs:
# X: datata... |
html/semantics/scripting-1/the-script-element/css-module/resources/cross-origin.py | meyerweb/wpt | 14,668 | 11092098 | <filename>html/semantics/scripting-1/the-script-element/css-module/resources/cross-origin.py<gh_stars>1000+
def main(request, response):
headers = [
(b"Content-Type", b"text/css"),
(b"Access-Control-Allow-Origin", request.GET.first(b"origin")),
(b"Access-Control-Allow-Credentials", b"true")... |
blesuite/smart_scan.py | jreynders/BLESuite-1 | 198 | 11092101 | <reponame>jreynders/BLESuite-1<filename>blesuite/smart_scan.py
import logging
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
def blesuite_smart_scan(connection_manager, connection, device, look_for_device_info=True, attempt_desc_read=False,
timeout=None):
""... |
ipython/data/ethane_model/input.py | tza0035/RMG-Py | 250 | 11092113 | # Data sources
database(
thermoLibraries = ['DFT_QCI_thermo', 'primaryThermoLibrary'],
reactionLibraries = [],
seedMechanisms = [],
kineticsDepositories = ['training'],
kineticsFamilies = 'default',
kineticsEstimator = 'rate rules',
)
generatedSpeciesConstraints(
allowed=['input species','s... |
boto3_type_annotations_with_docs/boto3_type_annotations/mediapackage/paginator.py | cowboygneox/boto3_type_annotations | 119 | 11092132 | <reponame>cowboygneox/boto3_type_annotations
from typing import Dict
from botocore.paginate import Paginator
class ListChannels(Paginator):
def paginate(self, PaginationConfig: Dict = None) -> Dict:
"""
Creates an iterator that will paginate through responses from :py:meth:`MediaPackage.Client.lis... |
wtforms_alchemy/utils.py | jpic/wtforms-alchemy | 161 | 11092136 | <reponame>jpic/wtforms-alchemy
from collections import OrderedDict
from enum import Enum
from inspect import isclass
import six
import sqlalchemy as sa
from sqlalchemy import types
from sqlalchemy_utils import IntRangeType, NumericRangeType
from sqlalchemy_utils.types.choice import Choice
def choice_type_coerce_fact... |
virtual/lib/python3.8/site-packages/alembic/script/__init__.py | Esther-Anyona/mylearner | 1,324 | 11092171 | from .base import Script
from .base import ScriptDirectory
__all__ = ["ScriptDirectory", "Script"]
|
converter/tool/onnx2tensorflow.py | MaxChangInnodisk/innotis-server | 4,208 | 11092184 | <gh_stars>1000+
import sys
import onnx
from onnx_tf.backend import prepare
# tensorflow >=2.0
# 1: Thanks:github:https://github.com/onnx/onnx-tensorflow
# 2: Run git clone https://github.com/onnx/onnx-tensorflow.git && cd onnx-tensorflow
# Run pip install -e .
# Note:
# Errors will occur when using "pip install... |
samples/client/petstore/python-asyncio/tests/test_pet_api.py | derBiggi/swagger-codegen | 14,570 | 11092198 | # coding: utf-8
# flake8: noqa
"""
Run the tests.
$ docker pull swaggerapi/petstore
$ docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
$ pytest -vv
"""
import os
import unittest
import asyncio
import pytest
import petstore_api
from petstore_api import ... |
cube/networks/compound.py | AliOsamaHassan/NLP-Cube | 488 | 11092199 | <filename>cube/networks/compound.py
import sys
from typing import *
import torch
import torch.nn as nn
import torch.nn.functional as F
import pytorch_lightning as pl
import numpy as np
from torch.utils.data import DataLoader
from cube.io_utils.objects import Document
from cube.networks.utils import Word2TargetCollate... |
chocolate/space.py | Intelecy/chocolate | 105 | 11092214 | <reponame>Intelecy/chocolate<filename>chocolate/space.py
"""This module provides common building blocks to define a search space.
Search spaces are defined using dictionaries, where the keys are the parameter
names and the values their distribution. For example, defining a two
parameter search space is done as follow ... |
tools/nntool/stats/temps_stats_collector.py | 00-01/gap_sdk | 118 | 11092246 | # Copyright (C) 2020 GreenWaves Technologies, SAS
# This program 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 option) any later version.
# This progr... |
RecoTauTag/ImpactParameter/python/PFTau3ProngReco_cfi.py | ckamtsikis/cmssw | 852 | 11092260 | import FWCore.ParameterSet.Config as cms
PFTau3ProngReco = cms.EDProducer("PFTau3ProngReco",
PFTauTag = cms.InputTag("hpsPFTauProducer"),
PFTauTIPTag = cms.InputTag("hpsPFTauTransverseImpactParameters"),
Algorithm = cms... |
tests/integration/test_queue.py | msabramo/diesel | 224 | 11092305 | import random
from collections import defaultdict
import diesel
from diesel.util.queue import Queue, QueueTimeout
from diesel.util.event import Countdown, Event
N = 500
W = 50
TIMEOUT = 1.0
class QueueHarness(object):
def setup(self):
self.queue = Queue()
self.done = Countdown(N)
self.... |
extraPackages/matplotlib-3.0.3/examples/lines_bars_and_markers/interp_demo.py | dolboBobo/python3_ios | 130 | 11092318 | <gh_stars>100-1000
"""
===========
Interp Demo
===========
"""
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 2 * np.pi, 20)
y = np.sin(x)
yp = None
xi = np.linspace(x[0], x[-1], 100)
yi = np.interp(xi, x, y, yp)
fig, ax = plt.subplots()
ax.plot(x, y, 'o', xi, yi, '.')
plt.show()
|
tempest/tests/lib/test_api_microversion_fixture.py | rishabh20111990/tempest | 254 | 11092345 | # Copyright 2019 NEC 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 a... |
runner/test/test_runner.py | wannaphongcom/mycroft-precise | 626 | 11092367 | from precise_runner import ReadWriteStream
class TestReadWriteStream:
def test_read_write(self):
s = ReadWriteStream(b'1234567890')
assert s.read(2) == b'12'
assert s.read(2) == b'34'
s.write(b'hi')
assert s.read() == b'567890hi'
s.write(b'hello')
assert s.r... |
scripts/stitch.py | JoeyGrajciar/Clara | 528 | 11092387 | <reponame>JoeyGrajciar/Clara
#!/usr/bin/env python
# This is an initial cut of a general header stitching script.
# It is currently hard-coded to work with Clara, but that is purely
# a path thing. The next step is the genericise this further and
# apply it to Catch. There will undoubtedly be issues to fix there.
# Af... |
RecoEgamma/EgammaIsolationAlgos/test/egammaIsoTest_cfg.py | ckamtsikis/cmssw | 852 | 11092398 | <filename>RecoEgamma/EgammaIsolationAlgos/test/egammaIsoTest_cfg.py
import FWCore.ParameterSet.Config as cms
process = cms.Process("eleIso")
process.load("Configuration.StandardSequences.Geometry_cff")
process.load("Configuration.EventContent.EventContent_cff")
process.source = cms.Source("PoolSource",
fileNames ... |
manage.py | bryancolligan/django-salesforce | 251 | 11092399 | <gh_stars>100-1000
#!/usr/bin/env python
# django-salesforce
#
# by <NAME>
# (c) 2012-2013 Freelancers Union (http://www.freelancersunion.org)
# See LICENSE.md for details
#
import os
import sys
# note that we're actually running the testrunner project, not the salesforce app.
os.environ['DJANGO_SETTINGS_MODULE'] = ... |
routes.py | yunzhongfei/bitfinex_echarts | 116 | 11092418 | from flask import url_for, request
from util import json_response
import requests
import urllib
import sys
from datetime import datetime, timedelta
import pandas as pd
from time import sleep
import ccxt
from Trade import get_bitfinex_candle_data,transfer_to_period_data,calcBolling,calcSince,calcEMA
from utility import ... |
Binary Search/222. Count Complete Tree Nodes.py | beckswu/Leetcode | 138 | 11092461 | """
222. Count Complete Tree Nodes
Example:
Input:
1
/ \
2 3
/ \ /
4 5 6
Output: 6
"""
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def coun... |
tests/models/test_farseg.py | remtav/torchgeo | 678 | 11092474 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import pytest
import torch
from torchgeo.models import FarSeg
BACKBONE = ["resnet18", "resnet34", "resnet50", "resnet101", "anynet"]
class TestFarSeg:
@torch.no_grad() # type: ignore[misc]
def test_classes(self)... |
lib/bindings/samples/server/test/test_drive_monitor.py | tlalexander/stitchEm | 182 | 11092489 | <gh_stars>100-1000
import os
import tempfile
import unittest
import time
import shutil
from blinker import signal
import utils.filesystem
from system.diskchecker import DiskChecker
from system.drive_monitor import DriveMonitor
from utils.settings_manager import SETTINGS
from defaults import DEFAULT_OPTIONS
class T... |
test/unit/util.py | Zhiyuan-w/DeepReg | 379 | 11092491 | <filename>test/unit/util.py<gh_stars>100-1000
from typing import List, Union
import numpy as np
import tensorflow as tf
from deepreg.constant import EPS
def is_equal_np(
x: Union[np.ndarray, List], y: Union[np.ndarray, List], atol: float = EPS
) -> bool:
"""
Check if two numpy arrays are identical withi... |
MeteorClient.py | hharnisc/python-meteor | 165 | 11092494 | <filename>MeteorClient.py
import time
import datetime
from DDPClient import DDPClient
from pyee import EventEmitter
import hashlib
class MeteorClientException(Exception):
"""Custom Exception"""
pass
class CollectionData(object):
def __init__(self):
self.data = {}
def add_data(self, collecti... |
pybasicbayes/util/cyutil.py | dhb2128/pybasicbayes | 122 | 11092500 | <filename>pybasicbayes/util/cyutil.py
from builtins import map
from builtins import str
import Cython.Build
from Cython.Build.Dependencies import *
# NOTE: mostly a copy of cython's create_extension_list except for the lines
# surrounded by "begin matt added" / "end matt added"
def create_extension_list(patterns, excl... |
lib/pymedphys/_experimental/autosegmentation/mask.py | ethanio12345/pymedphys | 207 | 11092507 | # Copyright (C) 2020 <NAME>, <NAME>
# 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 writi... |
src/python/tests/test_pyproj.py | michaelgsharp/NimbusML | 134 | 11092540 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
import unittest
import os
import re
... |
src/probflow/distributions/__init__.py | chiragnagpal/probflow | 134 | 11092565 | <reponame>chiragnagpal/probflow<gh_stars>100-1000
"""
The :mod:`.distributions` module contains classes to instantiate probability
distributions, which describe the likelihood of either a parameter or a
datapoint taking any given value. Distribution objects are used to represent
both the predicted probability distribu... |
sikuli-ide/sample-scripts/note2.sikuli/note2.py | mgrundy/sikuli | 1,292 | 11092579 | # create some notes
v = VDict()
v["1254684338981.png"] = 'use 172.16.31.10'
v["1254685582365.png"] = 'use my default login'
# add a new note
popup('Take a screenshot to add a note')
new_image = capture()
new_note = input()
v[new_image] = new_note
# lookup some notes
for i in (1,2):
popup('Take a screenshot to retri... |
icevision/models/mmdet/models/fcos/backbones/resnet_fpn.py | ai-fast-track/mantisshrimp | 580 | 11092589 | <gh_stars>100-1000
__all__ = [
"resnet50_caffe_fpn_gn_head",
"resnet50_caffe_fpn_gn_head_center_normbbox_centeronreg_giou",
"resnet50_caffe_fpn_gn_head_dcn_1x_center_normbbox_centeronreg_giou",
"resnet101_caffe_fpn_gn_head_1x_coco",
"resnet50_caffe_fpn_gn_head_mstrain_640_800_2x",
"resnet101_caf... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.