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 |
|---|---|---|---|---|
Bot/cogs/mod.py | Shuri2060/Nurevam | 145 | 91061 | from discord.ext import commands
from .utils import utils
import datetime
import asyncio
import discord
import logging
log = logging.getLogger(__name__)
def check_roles(ctx):
if ctx.message.author.id == 1<PASSWORD>:
return True
return utils.check_roles(ctx, "Mod", "admin_roles")
def has_mute_role(ctx... |
examples/graph_learning/train_robot_value_prediction.py | ONLYA/RoboGrammar | 156 | 91069 | <filename>examples/graph_learning/train_robot_value_prediction.py<gh_stars>100-1000
'''
train_robot_value_prediction.py
use Graph Neural Network to learn a value function for robot designs.
Learned GNN:
input: a graph of the robot design with all nodes being terminal nodes.
output: the predicted reward for the desig... |
Chapter03/demoTabWidget.py | houdinii/Qt5-Python-GUI-Programming-Cookbook | 131 | 91087 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'demoTabWidget.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
D... |
bcbio/bam/ref.py | a113n/bcbio-nextgen | 418 | 91126 | <reponame>a113n/bcbio-nextgen
"""Manipulation functionality to deal with reference files.
"""
import collections
from bcbio import utils
from bcbio.pipeline import config_utils
from bcbio.provenance import do
def fasta_idx(in_file, config=None):
"""Retrieve samtools style fasta index.
"""
fasta_index = in... |
dataviva/apps/embed/views.py | joelvisroman/dataviva-site | 126 | 91136 | <reponame>joelvisroman/dataviva-site
# -*- coding: utf-8 -*-
import requests
from datetime import datetime
from sqlalchemy import func
from flask import Blueprint, request, render_template, g, Response, make_response, jsonify
from flask.ext.babel import gettext
from dataviva import db, datavivadir, __year_range__, vie... |
nsff_scripts/run_midas.py | frankhome61/nsff | 330 | 91140 | <filename>nsff_scripts/run_midas.py
"""
Compute depth maps for images in the input folder.
"""
import os
import glob
import torch
import cv2
import numpy as np
from torchvision.transforms import Compose
from models.midas_net import MidasNet
from models.transforms import Resize, NormalizeImage, PrepareForNet
impor... |
angr/exploration_techniques/dfs.py | Kyle-Kyle/angr | 6,132 | 91144 | <gh_stars>1000+
from . import ExplorationTechnique
import random
class DFS(ExplorationTechnique):
"""
Depth-first search.
Will only keep one path active at a time, any others will be stashed in the 'deferred' stash.
When we run out of active paths to step, we take the longest one from deferred and con... |
app/tests/uploads_tests/test_models.py | kaczmarj/grand-challenge.org | 101 | 91146 | import pytest
from django.conf import settings
from requests import put
from grandchallenge.uploads.models import UserUpload
from tests.algorithms_tests.factories import AlgorithmImageFactory
from tests.factories import UserFactory
from tests.verification_tests.factories import VerificationFactory
@pytest.mark.djang... |
analysis/flight_data/generate_wind_db_from_flight_log.py | leozz37/makani | 1,178 | 91159 | #!/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 required by applicabl... |
test/util.py | pyrige/greedypacker | 108 | 91202 | import sys
import contextlib
@contextlib.contextmanager
def stdout_redirect(stringIO):
sys.stdout = stringIO
try:
yield stringIO
finally:
sys.stdout = sys.__stdout__
stringIO.seek(0)
|
snape/test/test_make_image_dataset.py | AhmadKSA/snape | 182 | 91259 | <reponame>AhmadKSA/snape
import shutil
from snape.make_image_dataset import *
from snape.make_image_dataset import _ImageNet, _ImageGrabber
from snape.utils import get_random_state
import glob
import pytest
conf = {
"n_classes": 2,
"n_samples": 11,
"out_path": "./test_images/",
"weights": [.8, .2],
... |
scripts/kitti_submission.py | xingruiy/RAFT-3D | 133 | 91268 | <reponame>xingruiy/RAFT-3D<filename>scripts/kitti_submission.py
import sys
sys.path.append('.')
from tqdm import tqdm
import os
import numpy as np
import cv2
import argparse
import torch
from lietorch import SE3
import raft3d.projective_ops as pops
from utils import show_image, normalize_image
from data_readers.kitt... |
tests/callbacks/test_manifold_mixup.py | NunoEdgarGFlowHub/torchbearer | 358 | 91279 | from unittest import TestCase
from mock import patch, Mock
from torch import nn
from torchbearer.callbacks.manifold_mixup import ManifoldMixup
import torchbearer
import torch
class TestModule(nn.Module):
def __init__(self):
super(TestModule, self).__init__()
self.conv = nn.Conv1d(1, 1, 1)
... |
python/graphscope/nx/tests/algorithms/forward/traversal/test_bfs.py | LI-Mingyu/GraphScope-MY | 1,521 | 91280 | <reponame>LI-Mingyu/GraphScope-MY<gh_stars>1000+
import networkx.algorithms.traversal.tests.test_bfs
import pytest
from graphscope.nx.utils.compat import import_as_graphscope_nx
import_as_graphscope_nx(networkx.algorithms.traversal.tests.test_bfs,
decorators=pytest.mark.usefixtures("graphscope... |
corehq/motech/repeaters/migrations/0004_attempt_strings.py | akashkj/commcare-hq | 471 | 91304 | # Generated by Django 2.2.19 on 2021-04-10 14:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('repeaters', '0003_migrate_connectionsettings'),
]
operations = [
migrations.AlterField(
model_name='sqlrepeatrecordattempt',
... |
examples/vocab.py | lyeoni/nlp-preprocessing | 152 | 91306 | import argparse
from collections import Counter, OrderedDict
from prenlp.tokenizer import *
TOKENIZER = {'nltk_moses': NLTKMosesTokenizer(),
'mecab' : Mecab()}
class Vocab:
"""Defines a vocabulary object that will be used to numericalize text.
Args:
vocab_size (int) : the max... |
airmozilla/main/views/pages.py | mozilla/airmozilla | 115 | 91307 | <reponame>mozilla/airmozilla
import datetime
import hashlib
import urllib
import time
import collections
import urlparse
import requests
from django import http
from django.conf import settings
from django.contrib.sites.requests import RequestSite
from django.shortcuts import get_object_or_404, redirect, render
from ... |
vim/autoload/conque_term/conque_sole_shared_memory.py | adifinem/dotvim | 413 | 91312 | # FILE: autoload/conque_term/conque_sole_shared_memory.py
# AUTHOR: <NAME> <<EMAIL>>
# WEBSITE: http://conque.googlecode.com
# MODIFIED: 2011-09-02
# VERSION: 2.3, for Vim 7.0
# LICENSE:
# Conque - Vim terminal/console emulator
# Copyright (C) 2009-2011 <NAME>
#
# MIT License
#
# Permission is hereby granted, f... |
green/test/test_result.py | vck3000/green | 686 | 91329 | <reponame>vck3000/green
# encoding: utf-8
from __future__ import unicode_literals
import copy
# `from doctest import DocTestCase` causes crashes, since the DocTestCase is
# detected as a TestCase subclass and unittest.TestLoader.loadTestsFromModule()
# called from GreenTestLoader.loadTestsFromModule() thinks it is a d... |
doc/integrations/cortx-s3-slack-bot/upload_file_to_s3.py | novium258/cortx-1 | 552 | 91347 | <filename>doc/integrations/cortx-s3-slack-bot/upload_file_to_s3.py
import requests
import os
from botocore.exceptions import ClientError
from elasticsearch_connector import ElasticsearchConnector
async def upload_file_to_s3(s3_client, es_client: ElasticsearchConnector, file_data, token):
""" Gets a file from slac... |
applications/popart/transformer_transducer/training/transducer_builder.py | payoto/graphcore_examples | 260 | 91351 | <reponame>payoto/graphcore_examples<filename>applications/popart/transformer_transducer/training/transducer_builder.py
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
import numpy as np
import logging_util
import transducer_blocks
# set up logging
logger = logging_util.get_basic_logger(__name__)
... |
datasets/setup_cambridge.py | tannerliu347/dsacstar | 104 | 91368 | <gh_stars>100-1000
import os
import math
import numpy as np
import cv2 as cv
import torch
from skimage import io
# setup individual scene IDs and their download location
scenes = [
'https://www.repository.cam.ac.uk/bitstream/handle/1810/251342/KingsCollege.zip',
'https://www.repository.cam.ac.uk/bitstream/handle/18... |
core/python/build.py | lf-shaw/kungfu | 2,209 | 91381 | <gh_stars>1000+
import os
import sys
import subprocess
import platform
import click
from kungfu.version import get_version
@click.group(invoke_without_command=True)
@click.option('-l', '--log_level', type=click.Choice(['trace', 'debug', 'info', 'warning', 'error', 'critical']),
default='warning', help='... |
tests/test_compress.py | elkinsd/couchapp | 224 | 91389 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This software is licensed as described in the file LICENSE, which
# you should have received as part of this distribution.
import unittest2 as unittest
import mock
import os
class CompressTest(unittest.TestCase):
def test_compress_js(self):
from couchapp.... |
custom_layers/pad_layer.py | bobenxia/Centripetal-SGD | 767 | 91404 | import torch.nn as nn
import torch.nn.functional as F
class PadLayer(nn.Module):
# E.g., (-1, 0) means this layer should crop the first and last rows of the feature map. And (0, -1) crops the first and last columns
def __init__(self, pad):
super(PadLayer, self).__init__()
self.pad = pad
... |
mmocr/models/textrecog/layers/satrn_layers.py | hongxuenong/mmocr | 2,261 | 91472 | <filename>mmocr/models/textrecog/layers/satrn_layers.py
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule
from mmocr.models.common import MultiHeadAttention
class SatrnEncoderLayer(BaseModule):
... |
addon/surface_heat_diffuse_skinning/__init__.py | meshonline/Surface-Heat-Diffuse-Skinning | 108 | 91498 | # ***** BEGIN GPL LICENSE BLOCK *****
#
#
# This program 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 2
# of the License, or (at your option) any later version.
#
# This program is distribute... |
tests/test_connector.py | romis2012/aiohttp-socks | 158 | 91516 | <reponame>romis2012/aiohttp-socks
import asyncio
import ssl
import aiohttp
import pytest # noqa
from aiohttp import ClientResponse, TCPConnector
from yarl import URL # noqa
from aiohttp_socks import (
ProxyType,
ProxyConnector,
ChainProxyConnector,
ProxyInfo,
ProxyError,
ProxyConnectionError... |
gslib/tests/test_hash.py | maxshine/gsutil | 1,894 | 91548 | # -*- coding: utf-8 -*-
# Copyright 2014 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 require... |
src/sage_setup/util.py | UCD4IDS/sage | 1,742 | 91556 | r"""
Utility functions for building Sage
"""
# ****************************************************************************
# Copyright (C) 2017 <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the F... |
tests/test_environment_variables.py | ben-31/kas | 187 | 91577 | <reponame>ben-31/kas<gh_stars>100-1000
import os
import shutil
from kas import kas
def test_build_dir_is_placed_inside_work_dir_by_default(changedir, tmpdir):
conf_dir = str(tmpdir.mkdir('test_env_variables'))
shutil.rmtree(conf_dir, ignore_errors=True)
shutil.copytree('tests/test_environment_variables', ... |
tests/apollo/test_skvbc_consensus_batching.py | definitelyNotFBI/utt | 340 | 91578 | <gh_stars>100-1000
# Concord
#
# Copyright (c) 2019 VMware, Inc. All Rights Reserved.
#
# This product is licensed to you under the Apache 2.0 license (the "License").
# You may not use this product except in compliance with the Apache 2.0 License.
#
# This product may include a number of subcomponents with separate co... |
saleor/core/utils/date_time.py | eanknd/saleor | 1,392 | 91581 | from datetime import datetime
import pytz
def convert_to_utc_date_time(date):
"""Convert date into utc date time."""
if date is None:
return
return datetime.combine(date, datetime.min.time(), tzinfo=pytz.UTC)
|
docs/_ext/djangodocs.py | Kunpors/dr.pors- | 341 | 91592 | <filename>docs/_ext/djangodocs.py
# Sphinx helper for Django-specific references
def setup(app):
app.add_crossref_type(
directivename = "label",
rolename = "djterm",
indextemplate = "pair: %s; label",
)
app.add_crossref_type(
directivename = "setting",
rolename = "se... |
configs/mmedit/super-resolution/super-resolution_ncnn_dynamic.py | aegis-rider/mmdeploy | 746 | 91629 | _base_ = ['./super-resolution_dynamic.py', '../../_base_/backends/ncnn.py']
|
sklearn/gaussian_process/tests/_mini_sequence_kernel.py | MaiRajborirug/scikit-learn | 50,961 | 91634 | from sklearn.gaussian_process.kernels import Kernel, Hyperparameter
from sklearn.gaussian_process.kernels import GenericKernelMixin
from sklearn.gaussian_process.kernels import StationaryKernelMixin
import numpy as np
from sklearn.base import clone
class MiniSeqKernel(GenericKernelMixin, StationaryKernelMixin, Kernel... |
NLP/Conversational-Recommendation-BASELINE/conversational_recommendation/goal_planning/model/paddle_astar_goal.py | zhangyimi/Research | 1,319 | 91665 | <gh_stars>1000+
######################################################################
# Copyright (c) 2019 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 L... |
tests/samples/threads.py | spamegg1/snoop | 751 | 91693 | <filename>tests/samples/threads.py
from threading import Thread
from snoop.configuration import Config
snoop = Config(columns='thread').snoop
@snoop
def foo():
return 1
def run(name):
thread = Thread(target=foo, name=name)
thread.start()
thread.join()
def main():
run('short')
run('longer... |
src/main/python/pybuilder/plugins/python/pep8_plugin.py | klr8/pybuilder | 1,419 | 91696 | <filename>src/main/python/pybuilder/plugins/python/pep8_plugin.py
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2020 PyBuilder Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... |
falkon/kernels/distance_kernel.py | vishalbelsare/falkon | 130 | 91717 | from typing import Union, Optional, Dict
import torch
from falkon import sparse
from falkon.kernels.diff_kernel import DiffKernel
from falkon.la_helpers.square_norm_fn import square_norm_diff
from falkon.options import FalkonOptions
from falkon.sparse import SparseTensor
SQRT3 = 1.7320508075688772
SQRT5 = 2.23606797... |
cctbx/examples/exp_i_alpha_derivatives.py | dperl-sol/cctbx_project | 155 | 91759 | from __future__ import absolute_import, division, print_function
import cmath
import math
from six.moves import zip
class least_squares:
def __init__(self, obs, calc):
self.obs = obs
self.calc = calc
a, b = self.calc.real, self.calc.imag
self.abs_calc = math.sqrt(a**2 + b**2)
self.delta = self.o... |
python/tinyflow/_util.py | irvingzhang0512/tinyflow | 2,035 | 91760 | <reponame>irvingzhang0512/tinyflow
from __future__ import absolute_import as _abs
import json
from nnvm import symbol, graph
def infer_variable_shapes(net, feed_dict):
"""Inference shape of all variables in the net.
Parameters
----------
net : tf.Symbol
The symbolic network containing all the v... |
DQM/EcalPreshowerMonitorModule/python/EcalPreshowerMonitorTasks_withFEDIntegrity_cfi.py | ckamtsikis/cmssw | 852 | 91770 | <filename>DQM/EcalPreshowerMonitorModule/python/EcalPreshowerMonitorTasks_withFEDIntegrity_cfi.py<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from DQM.EcalPreshowerMonitorModule.ESRawDataTask_cfi import *
from DQM.EcalPreshowerMonitorModule.ESIntegrityTask_cfi import *
from DQM.EcalPreshowerMonitorModul... |
tests/components/ecobee/test_util.py | tbarbette/core | 30,023 | 91785 | """Tests for the ecobee.util module."""
import pytest
import voluptuous as vol
from homeassistant.components.ecobee.util import ecobee_date, ecobee_time
async def test_ecobee_date_with_valid_input():
"""Test that the date function returns the expected result."""
test_input = "2019-09-27"
assert ecobee_d... |
larq_compute_engine/mlir/python/converter_test.py | simonmaurer/compute-engine | 193 | 91791 | import sys
import unittest
from packaging import version
from unittest import mock
import tensorflow as tf
import larq_zoo as lqz
from tensorflow.python.eager import context
sys.modules["importlib.metadata"] = mock.MagicMock()
sys.modules["importlib_metadata"] = mock.MagicMock()
sys.modules["larq_compute_engine.mlir.... |
pymagnitude/third_party/_apsw/setup.py | tpeng/magnitude | 1,520 | 91813 | <reponame>tpeng/magnitude
#!/usr/bin/env python
# See the accompanying LICENSE file.
import os
import sys
import shlex
import glob
import re
import time
import zipfile
import tarfile
try:
if not os.environ.get("APSW_FORCE_DISTUTILS"):
from setuptools import setup, Extension, Command
else:
rai... |
tests/errors/semantic/non_blocking/var_is_none.py | dina-fouad/pyccel | 206 | 91838 | <filename>tests/errors/semantic/non_blocking/var_is_none.py<gh_stars>100-1000
# pylint: disable=missing-function-docstring, missing-module-docstring/
from pyccel.decorators import types
@types('int')
def f(a):
b = 0
if a is not None:
b = b + a
return b
|
osf/migrations/0122_auto_20180801_2105.py | gaybro8777/osf.io | 628 | 91855 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-08-01 21:05
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
('osf', '0121_merge_201... |
test/fixture/mycompile.py | Valkatraz/scons | 1,403 | 91868 | <filename>test/fixture/mycompile.py
r"""
Phony "compiler" for testing SCons.
Copies its source files to the target file, dropping lines
that match a pattern, so we can recognize the tool
has made a modification.
"""
import sys
if __name__ == '__main__':
line = ('/*' + sys.argv[1] + '*/\n').encode()
with open... |
databricks/koalas/tests/test_window.py | varunsh-coder/koalas | 3,211 | 91871 | <reponame>varunsh-coder/koalas<filename>databricks/koalas/tests/test_window.py<gh_stars>1000+
#
# Copyright (C) 2019 Databricks, 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
#
# h... |
rl_baselines/rl_algorithm/acer.py | anonymous-authors-2018/robotics-repo | 524 | 91879 | <filename>rl_baselines/rl_algorithm/acer.py
from stable_baselines import ACER
from rl_baselines.base_classes import StableBaselinesRLObject
class ACERModel(StableBaselinesRLObject):
"""
object containing the interface between baselines.acer and this code base
ACER: Sample Efficient Actor-Critic with Expe... |
lona/shell/shell.py | korantu/lona | 230 | 91917 | <gh_stars>100-1000
from rlpython import embed
def load_commands(server):
import_strings = server.settings.CORE_COMMANDS + server.settings.COMMANDS
commands = []
for import_string in import_strings:
commands.append(server.acquire(import_string))
return commands
def embed_shell(server, **emb... |
tests/basic/for_range2.py | MoonStarCZW/py2rb | 124 | 91932 | for i in range(5):
for j in range(i+1, 5):
print("i:%s, j:%s" % (i,j))
|
Machine Learning/Online Search Relevance Metrics/metrics/resources.py | endorama/examples | 2,561 | 91983 | <gh_stars>1000+
import json
import os
import time
from timeit import default_timer as timer
IGNORES = [400, 404]
INDEX = 'ecs-search-metrics'
TRANSFORM_NAMES = [f'{INDEX}_transform_queryid', f'{INDEX}_transform_completion']
INDEX_NAMES = [INDEX] + TRANSFORM_NAMES
PIPELINE_NAMES = INDEX_NAMES
class Timer:
def __... |
examples/cs_maml/cs_maml_edge.py | cuiboyuan/plato | 135 | 92003 | """
A federated learning client at the edge server in a cross-silo training workload.
"""
from dataclasses import dataclass
import logging
import os
import pickle
import sys
from plato.clients import edge
@dataclass
class Report(edge.Report):
"""Report from an Axiothea edge server, to be sent to the central se... |
algorithm/sliding_window_examples.py | ganeshskudva/Algorithm_Templates | 190 | 92011 | from collections import Counter
from collections import defaultdict
# [3] https://leetcode.com/problems/longest-substring-without-repeating-characters/
# Given a string, find the length of the longest substring without repeating characters.
#
# variation with no pattern
def lengthOfLongestSubstring(s):
# create a... |
examples/eph/00-simple_eph.py | QuESt-Calculator/pyscf | 501 | 92030 | <reponame>QuESt-Calculator/pyscf
#!/usr/bin/env python
'''
A simple example to run EPH calculation.
'''
from pyscf import gto, dft, eph
mol = gto.M(atom='N 0 0 0; N 0 0 2.100825', basis='def2-svp', verbose=4, unit="bohr")
# this is a pre-computed relaxed molecule
# for geometry relaxation, refer to pyscf/example/geomo... |
lldb/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py | medismailben/llvm-project | 765 | 92036 | <filename>lldb/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
lldbinline.MakeInlineTest(
__file__, globals(), [
decorators.expectedFailureAll(
compiler="gcc")])
|
tests/utils_tests/test_glob.py | MikeAmy/django | 5,079 | 92046 | <reponame>MikeAmy/django
from __future__ import unicode_literals
from django.test import SimpleTestCase
from django.utils.glob import glob_escape
class TestUtilsGlob(SimpleTestCase):
def test_glob_escape(self):
filename = '/my/file?/name[with special chars*'
expected = '/my/file[?]/name[[]with sp... |
match.py | pammirato/image_vatic | 571 | 92050 | <reponame>pammirato/image_vatic<filename>match.py
import munkres
def match(first, second, method):
"""
Attempts to match every path in 'first' with a path in 'second'. Returns
the association along with its score.
Note: if two paths have nothing to do with each other, but there is no
other suita... |
tools/optimize/convert_model_batch.py | zhouzy-creator/Tengine | 4,697 | 92067 | # -*- coding: utf-8 -*-
# OPEN AI LAB is pleased to support the open source community by supporting Tengine available.
#
# Copyright (C) 2021 OPEN AI LAB. All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
# in compliance with the License. You may ... |
vbdiar/utils/utils.py | VarunSrivastava19/VBDiarization | 101 | 92069 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 Brno University of Technology FIT
# Author: <NAME> <<EMAIL>>
# All Rights Reserved
import os
import re
import random
from os import listdir
from os.path import isfile, join
import fnmatch
import math
import numpy as np
import yaml
class Utils(obje... |
funsor/compat/ops.py | fritzo/funsor | 198 | 92076 | <reponame>fritzo/funsor<gh_stars>100-1000
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
from torch import ones, randn, tensor, zeros # noqa F401
from funsor.testing import allclose # noqa F401
from .ops import * # noqa F401
|
quaternion/quat_test.py | IhorNehrutsa/micropython-samples | 268 | 92090 | # quat_test.py Test for quat.py
# Released under the MIT License (MIT). See LICENSE.
# Copyright (c) 2020 <NAME>
from math import sin, cos, isclose, pi, sqrt
from quat import *
print('Properties')
q1 = Quaternion(1, 2, 3, 4)
q1.w = 5
q1.x = 6
q1.y = 7
q1.z = 8
assert q1 == Quaternion(5, 6, 7, 8)
assert (q1.w, q1.x, ... |
tools/converters/torchvision_resnet_to_zcls_resnet.py | YinAoXiong/ZCls | 110 | 92113 | # -*- coding: utf-8 -*-
"""
@date: 2021/5/4 下午7:11
@file: torchvision_resnet_to_zcls_resnet.py
@author: zj
@description: Transform torchvision pretrained model into zcls format
"""
import os
from torchvision.models.resnet import resnet18, resnet34, resnet50, resnet101, resnet152, resnext50_32x4d, \
resnext101_32x... |
src/pretix/base/exporters/json.py | fabm3n/pretix | 1,248 | 92126 | #
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 <NAME> and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# 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... |
cctbx/regression/tst_pair_asu_table.py | dperl-sol/cctbx_project | 155 | 92135 | from __future__ import absolute_import, division, print_function
from iotbx.kriber import strudat
from cctbx import geometry_restraints
from cctbx import crystal
from cctbx.array_family import flex
import scitbx.math
from scitbx import matrix
from libtbx.test_utils import approx_equal, show_diff
from libtbx.utils impor... |
platypush/backend/http/app/routes/plugins/camera/pi.py | BlackLight/platypush | 228 | 92137 | <filename>platypush/backend/http/app/routes/plugins/camera/pi.py
import os
import tempfile
from flask import Response, Blueprint, send_from_directory
from platypush.backend.http.app import template_folder
from platypush.backend.http.app.utils import authenticate, send_request
from platypush.config import Config
from ... |
Python3/721.py | rakhi2001/ecom7 | 854 | 92140 | __________________________________________________________________________________________________
sample 196 ms submission
class Solution:
def accountsMerge(self, accounts: List[List[str]]) -> List[List[str]]:
email_to_name = {}
graph = collections.defaultdict(set)
for acc in accounts:
... |
sdk/python/pulumi_azure/core/subscription.py | henriktao/pulumi-azure | 109 | 92163 | <reponame>henriktao/pulumi-azure
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequenc... |
tricks/copy_variant_set_to_prim/python/copy_variant_set_to_prim.py | jingtaoh/USD-Cookbook | 332 | 92170 | <filename>tricks/copy_variant_set_to_prim/python/copy_variant_set_to_prim.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""An example module that shows how to copy SdfPath objects using the SDF API."""
# IMPORT THIRD-PARTY LIBRARIES
from pxr import Sdf
def main():
"""Run the main execution of the current scr... |
applications/graph/motif/model/autoencoder.py | jonesholger/lbann | 194 | 92179 | <filename>applications/graph/motif/model/autoencoder.py<gh_stars>100-1000
import lbann
import lbann.modules
class FullyConnectedAutoencoder(lbann.modules.Module):
"""Multilayer perceptron autoencoder."""
global_count = 0 # Static counter, used for default names
def __init__(
self,
... |
pyclient/confluo/rpc/schema.py | Mu-L/confluo | 1,398 | 92181 | import struct
import time
import yaml
import yaml.resolver
from collections import OrderedDict
import data_types
from data_types import TypeID
def now_ns():
return int(time.time() * 10 ** 6)
class Schema:
""" The schema for the data in the atomic multilog.
"""
def __init__(self, columns):
... |
examples/image/cath/scripts/cath/networks/ResNet34/ResNet34.py | mariogeiger/se3cnn | 170 | 92190 | <reponame>mariogeiger/se3cnn
import torch.nn as nn
from functools import partial
from experiments.util.arch_blocks import *
class network(ResNet):
def __init__(self,
n_input,
n_output,
args):
features = [[[32]],
[[32] * 2] * 3,
... |
app/api/models/Base.py | nurely/lxdui | 589 | 92202 | <filename>app/api/models/Base.py<gh_stars>100-1000
from abc import ABC, abstractmethod
class Base(ABC):
@abstractmethod
def info(self):
raise NotImplementedError()
@abstractmethod
def create(self):
raise NotImplementedError()
@abstractmethod
def delete(self):
raise Not... |
randomcrop.py | createnewdemo/SPANet | 177 | 92206 | #!/usr/bin/env python
# from __future__ import division
import torch
import math
import random
from PIL import Image, ImageOps, ImageEnhance
import numbers
import torchvision.transforms.functional as F
import numpy as np
class RandomCrop(object):
"""Crop the given PIL Image at a random location.
Args:
... |
inverse_rl/models/tf_util.py | SaminYeasar/inverse_rl | 220 | 92211 | <filename>inverse_rl/models/tf_util.py
import tensorflow as tf
import numpy as np
REG_VARS = 'reg_vars'
def linear(X, dout, name, bias=True):
with tf.variable_scope(name):
dX = int(X.get_shape()[-1])
W = tf.get_variable('W', shape=(dX, dout))
tf.add_to_collection(REG_VARS, W)
if bi... |
demos/usage-remove-selected-elements.py | kinimesi/dash-cytoscape | 432 | 92213 | <gh_stars>100-1000
import json
import os
import random
import dash
from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_html_components as html
import dash_cytoscape as cyto
asset_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
'..', 'assets'
)
a... |
tests/functions/test_count.py | hodgesrm/clickhouse-sqlalchemy | 251 | 92234 | from sqlalchemy import Column, func
from clickhouse_sqlalchemy import types, Table
from tests.testcase import CompilationTestCase
class CountTestCaseBase(CompilationTestCase):
table = Table(
't1', CompilationTestCase.metadata(),
Column('x', types.Int32, primary_key=True)
)
def test_count... |
analysis/MxnetA.py | YifeiCN/nn_tools | 370 | 92261 | <gh_stars>100-1000
from __future__ import absolute_import
import mxnet as mx
import mxnet.symbol as sym
import json
from analysis.layers import *
import re
import ctypes
from mxnet.ndarray import NDArray
import mxnet.ndarray as nd
from mxnet.base import NDArrayHandle, py_str
blob_dict=[]
tracked_layers = []
def tm... |
vis/max_bar_plot.py | SurvivorT/SRTP | 489 | 92264 | #!/usr/bin/env python
#
# File: bar_plot.py
#
import argparse
import os
import pickle
import matplotlib
import numpy as np
params = {
'axes.labelsize': 12,
'font.size': 16,
'font.family': 'serif',
'legend.fontsize': 12,
'xtick.labelsize': 12,
'ytick.labelsize': 12,
#'text.usetex': True,
... |
app/grandchallenge/notifications/filters.py | nlessmann/grand-challenge.org | 101 | 92268 | import re
from functools import reduce
from operator import or_
from actstream.models import Follow
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
from django_filters import CharFilter, ChoiceFilter, FilterSet
from machina.apps.forum.models import Forum
from machina.... |
services/workers/emails/tests/test_welcome_email.py | paulowe/aws-boilerplate | 711 | 92275 | <gh_stars>100-1000
import settings
from .. import handlers
def test_send_welcome_email(mocker, ses_client):
ses_send_email = mocker.patch.object(ses_client, 'send_email', autospec=True)
mocker.patch('emails.sender.get_ses_client', return_value=ses_client)
event = {'to': '<EMAIL>', 'name': '<NAME>', 'type... |
databuilder/databuilder/serializers/neo4_serializer.py | defendercrypt/amundsen | 2,072 | 92282 | # Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from typing import (
Any, Dict, Optional,
)
from databuilder.models.graph_node import GraphNode
from databuilder.models.graph_relationship import GraphRelationship
from databuilder.models.graph_serializable import (
NODE_K... |
Chapter02/animals/sheep.py | RoyMcCrain/Mastering-Vim | 155 | 92288 | """A sheep."""
import animal
class Sheep(animal.Animal):
def __init__(self):
self.kind = 'sheep'
|
powerline/matchers/vim/plugin/commandt.py | MrFishFinger/powerline | 11,435 | 92289 | <filename>powerline/matchers/vim/plugin/commandt.py<gh_stars>1000+
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import os
from powerline.bindings.vim import vim_getbufoption, buffer_name
def commandt(matcher_info):
name = buffer_name(matcher_inf... |
doc/examples/scripts/structure/md_analysis.py | danijoo/biotite | 208 | 92305 | r"""
Basic analysis of a MD simulation
=================================
In this example, we will analyze a trajectory of a *Gromacs* MD
simulation:
The trajectory contains simulation data of lysozyme over the course of
1 ns.
The data is the result of the famous *Gromacs*
'`Lysozyme in Water <http://www.mdtutorials.co... |
api/tacticalrmm/logs/tests.py | juaromu/tacticalrmm | 903 | 92313 | from itertools import cycle
from unittest.mock import patch
from django.utils import timezone as djangotime
from model_bakery import baker, seq
from tacticalrmm.test import TacticalTestCase
from logs.models import PendingAction
class TestAuditViews(TacticalTestCase):
def setUp(self):
self.authenticate()... |
scaffoldgraph/vis/base.py | UCLCheminformatics/ScaffoldGraph | 121 | 92361 | <filename>scaffoldgraph/vis/base.py
"""
scaffoldgraph.vis.base
"""
import networkx as nx
from abc import ABC
from scaffoldgraph.core import ScaffoldGraph
from scaffoldgraph.utils import canonize_smiles
from .utils import remove_node_mol_images
class Visualizer(ABC):
"""Base class for ScaffoldGraph visualizers... |
proximal/utils/timings_log.py | kyleaj/ProxImaL | 101 | 92406 | import timeit
class TimingsEntry(object):
"""A log of the runtime for an operation.
"""
def __init__(self, op):
self.op = op
self.evals = 0
self.total_time = 0
self.lastticstamp = None
@property
def avg_time(self):
if self.evals == 0:
return 0
... |
PaddleKG/CoKE/bin/pathquery_data_preprocess.py | shippingwang/models | 1,319 | 92435 | <reponame>shippingwang/models
# Copyright (c) 2019 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-... |
headless/examples/generate_traffic.py | aclk/abstreet | 5,680 | 92498 | #!/usr/bin/python3
# This example loads an exported JSON map, finds different buildings, and
# generates a simple travel demand model.
#
# 1) cargo run --bin dump_map data/system/us/seattle/maps/montlake.bin > montlake.json
# 2) ./headless/examples/generate_traffic.py --map=montlake.json --out=traffic.json
# 3) cargo r... |
utils/lr_scheduler.py | happywu/simpledet-1 | 3,195 | 92514 | <reponame>happywu/simpledet-1
import logging
from math import cos, pi
from mxnet.lr_scheduler import LRScheduler
class WarmupMultiFactorScheduler(LRScheduler):
def __init__(self, step, factor=1, warmup=False, warmup_type='constant', warmup_lr=0, warmup_step=0):
super().__init__()
assert isinstance(... |
alipay/aop/api/domain/InsurancePeriod.py | antopen/alipay-sdk-python-all | 213 | 92554 | <reponame>antopen/alipay-sdk-python-all<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class InsurancePeriod(object):
def __init__(self):
self._period = None
self._period_unit = None
@property
def period(s... |
utils/swift_build_support/swift_build_support/build_graph.py | gandhi56/swift | 72,551 | 92608 | # swift_build_support/build_graph.py ----------------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.tx... |
wagtail/core/tests/test_comments.py | brownaa/wagtail | 8,851 | 92627 | <reponame>brownaa/wagtail
from django.contrib.auth import get_user_model
from django.test import TestCase
from wagtail.core.models import Comment, Page
class CommentTestingUtils:
def setUp(self):
self.page = Page.objects.get(title="Welcome to the Wagtail test site!")
self.revision_1 = self.page.s... |
examples/integrations/sklearn/svm.py | anukaal/opytimizer | 528 | 92653 | <gh_stars>100-1000
import numpy as np
from sklearn import svm
from sklearn.datasets import load_digits
from sklearn.model_selection import KFold, cross_val_score
from opytimizer import Opytimizer
from opytimizer.core import Function
from opytimizer.optimizers.swarm import PSO
from opytimizer.spaces import SearchSpace
... |
third_party/py/gflags/gflags/flags_unicode_literals_test.py | sevki/bazel | 218 | 92656 | #!/usr/bin/env python
"""Test the use of flags when from __future__ import unicode_literals is on."""
from __future__ import unicode_literals
import unittest
import gflags
gflags.DEFINE_string('seen_in_crittenden', 'alleged mountain lion',
'This tests if unicode input to these functions works.')... |
app/src/thirdparty/telemetry/internal/platform/tracing_agent/chrome_tracing_agent_unittest.py | ta2edchimp/big-rig | 925 | 92660 | # Copyright 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.
import unittest
from telemetry.internal.platform.tracing_agent import chrome_tracing_agent
class FakePlatformBackend(object):
pass
class FakeDevtoolsC... |
codalab/apps/queues/migrations/0001_initial.py | AIMultimediaLab/AI4Media-EaaS-prototype-Py2-public | 333 | 92661 | <reponame>AIMultimediaLab/AI4Media-EaaS-prototype-Py2-public
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
depends_on = (
("authenz", "0002_auto__add_cl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.