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 |
|---|---|---|---|---|
cadl/dataset_utils.py | muxgt/pycadl | 398 | 11135305 | """Utils for creating datasets.
"""
"""
Copyright 2017 <NAME>. See also NOTICE.md.
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... |
python/tests/pushSAXhtml.py | balabit-deps/libxml2 | 372 | 11135312 | <filename>python/tests/pushSAXhtml.py
#!/usr/bin/python -u
import sys
import libxml2
# Memory debug specific
libxml2.debugMemory(1)
log = ""
class callback:
def startDocument(self):
global log
log = log + "startDocument:"
def endDocument(self):
global log
log = log + "endDocu... |
src/transformers/models/ibert/quant_modules.py | dctelus/transformers | 8,028 | 11135316 | # coding=utf-8
# Copyright 2021 The I-BERT Authors (<NAME>, <NAME>, <NAME>,
# <NAME>, <NAME> - UC Berkeley) and The HuggingFace Inc. team.
# Copyright (c) 20121, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance... |
docs/examples/auto-instrumentation/server_uninstrumented.py | oxeye-nikolay/opentelemetry-python | 868 | 11135339 | # Copyright The OpenTelemetry 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 applicable law or agreed to in ... |
api/users/models.py | zefixlluja/flagsmith | 111 | 11135366 | <gh_stars>100-1000
import logging
import typing
from django.conf import settings
from django.contrib.auth.base_user import BaseUserManager
from django.contrib.auth.models import AbstractUser
from django.core.mail import send_mail
from django.db import models
from django.db.models import Q
from django.utils.encoding im... |
Cryptography/xor_cipher.py | TeacherManoj0131/HacktoberFest2020-Contributions | 256 | 11135383 | <reponame>TeacherManoj0131/HacktoberFest2020-Contributions
"""
author: <NAME>
date: 21.12.2017
class: XORCipher
This class implements the XOR-cipher algorithm and provides
some useful methods for encrypting and decrypting strings and
files.
Overview abo... |
tests/console/commands/source/conftest.py | uda/poetry | 12,347 | 11135421 | <gh_stars>1000+
import pytest
from poetry.config.source import Source
@pytest.fixture
def source_one():
return Source(name="one", url="https://one.com")
@pytest.fixture
def source_two():
return Source(name="two", url="https://two.com")
@pytest.fixture
def source_default():
return Source(name="default... |
video/dataset/HMDB51/raw/video_processing_nvvl.py | Arun-George-Zachariah/Hadamard-Matrix-for-hashing | 202 | 11135439 | <gh_stars>100-1000
import os
import csv
import logging
import subprocess
from os import listdir
from joblib import delayed
from joblib import Parallel
def exe_cmd(cmd):
try:
dst_file = cmd.split()[-1]
if os.path.exists(dst_file):
return "exist"
cmd = cmd.replace('(', '\(').repl... |
openbook_hashtags/tests/tests_hashtag.py | TamaraAbells/okuna-api | 164 | 11135462 | <filename>openbook_hashtags/tests/tests_hashtag.py
import json
from django.urls import reverse
from faker import Faker
from rest_framework import status
from openbook_common.tests.helpers import make_user, make_authentication_headers_for_user, make_hashtag, \
make_fake_post_text, make_community, make_circle, make... |
tests/conftest.py | pagladashu38/pytest-splinter4 | 226 | 11135496 | """Configuration for pytest runner."""
pytest_plugins = "pytester"
|
caffe2/quantization/server/concat_dnnlowp_op_test.py | Hacky-DH/pytorch | 60,067 | 11135516 | <filename>caffe2/quantization/server/concat_dnnlowp_op_test.py
import collections
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
from caffe2.python import core, dyndep, workspace
from caffe2.quantization.server.dnnlowp_test_utils import check_quantized_results_c... |
scripts/sg-toolbox/SG-Font-Check-Metrics.py | tphinney/science-gothic | 104 | 11135561 | <filename>scripts/sg-toolbox/SG-Font-Check-Metrics.py
#FLM: Check: Metric links
# ----------------------------------------
# (C) <NAME>, 2019 (http://www.kateliev.com)
# (C) Karandash Type Foundry (http://www.karandash.eu)
#-----------------------------------------
# www.typerig.com
# No warranties. By using this you ... |
igibson/examples/demo/vr_demos/test/vr_scroll_wrap_text_test.py | NishanthJKumar/iGibson | 360 | 11135585 | """ This VR hand dexterity benchmark allows the user to interact with many types of objects
and interactive objects, and provides a good way to qualitatively measure the dexterity of a VR hand.
You can use the left and right controllers to start/stop/reset the timer,
as well as show/hide its display. The "overlay togg... |
setup.py | mohamad-amin/falkon | 130 | 11135604 | import os
import os.path as osp
from typing import Any, Tuple, List
import numpy
from setuptools import setup, find_packages, Extension
try:
import torch
except ImportError:
raise ImportError("PyTorch must be pre-installed before installing Falkon.")
from torch.utils.cpp_extension import BuildExtension, CUDAE... |
common/src/stack/command/stack/commands/remove/vm/storage/__init__.py | sammeidinger/stack | 123 | 11135624 | # @copyright@
# Copyright (c) 2006 - 2019 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
#
import stack.commands
from stack.exception import ParamError
class Command(stack.commands.remove.vm.Command):
"""
Mark a virtual machine's d... |
ck/repo/module/math.frontier/module.py | krai/ck | 480 | 11135657 | <filename>ck/repo/module/math.frontier/module.py
#
# Collective Knowledge (detect frontier for multi-objective optimizations (such as execution time vs energy vs code size vs faults vs price ...))
#
# See CK LICENSE.txt for licensing details
# See CK COPYRIGHT.txt for copyright details
#
# Developer: <NAME>, <EMAIL>, h... |
DaPy/matlib.py | huihui7987/DaPy | 552 | 11135666 | <reponame>huihui7987/DaPy<gh_stars>100-1000
from array import array
from .core import Matrix, SeriesSet, Series
from .core import nan, inf
from .core import range, filter, zip, range
from .core import is_math, is_seq, is_iter, is_value
from .core.base import STR_TYPE
from .core.base.IndexArray import SortedIndex
from c... |
gwd/jigsaw/crop.py | kazakh-shai/kaggle-global-wheat-detection | 136 | 11135698 | import argparse
import os
import os.path as osp
from functools import partial
from multiprocessing import Pool
import cv2
import pandas as pd
from tqdm import tqdm
from gwd.converters import images2coco
CROP_SIZE = 1024
OFFSET_SIZE = 512
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argum... |
codes/scripts/rename.py | arthur-qiu/BasicSR | 106 | 11135717 | <gh_stars>100-1000
import os
import os.path
import glob
input_folder = '/home/xtwang/Projects/PIRM18/results/pirm_selfval_img06/*' # glob matching pattern
save_folder = '/home/xtwang/Projects/PIRM18/results/pirm_selfval_img'
mode = 'cp' # 'cp' | 'mv'
file_list = sorted(glob.glob(input_folder))
if not os.path.exis... |
e2cnn/nn/modules/batchnormalization/gnorm.py | marcelroed/e2cnn | 356 | 11135740 |
from collections import defaultdict
from e2cnn.gspaces import *
from e2cnn.nn import FieldType
from e2cnn.nn import GeometricTensor
from ..equivariant_module import EquivariantModule
import torch
from torch.nn import Parameter
from typing import List, Tuple, Any, Union
import numpy as np
__all__ = ["GNormBatchNor... |
display_utils.py | imRushabhShah/nlp_adversarial_examples | 168 | 11135745 | <reponame>imRushabhShah/nlp_adversarial_examples
from IPython.core.display import display, HTML
import numpy as np
def html_render(x_orig, x_adv):
x_orig_words = x_orig.split(' ')
x_adv_words = x_adv.split(' ')
orig_html = []
adv_html = []
# For now, we assume both original and adversarial text hav... |
typed_python/compiler/native_function_pointer.py | APrioriInvestments/typed_python | 105 | 11135755 | import ctypes
import typed_python.compiler.native_ast as native_ast
from typed_python import PointerTo
class NativeFunctionPointer:
def __init__(self, fname, fp, input_types, output_type):
self.fp = fp
self.fname = fname
self.input_types = input_types
self.output_type = output_type... |
speedml/feature.py | Dennis055/speedml | 212 | 11135762 | """
Speedml Feature component with methods that work on dataset features or the feature engineering workflow. Contact author https://twitter.com/manavsehgal. Code, docs and demos https://speedml.com.
"""
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from b... |
tests/ahocorapy_test.py | Gavingx/ahocorapy | 175 | 11135769 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from builtins import str
from io import open
from pickle import dumps, loads
import unittest
from ahocorapy.keywordtree import KeywordTree
class TestAhocorapy(unittest.TestCase):
def test_empty_tree(self):
kwtree = KeywordTree()
kwtree.finalize()
... |
tests/test_sklearn_multi_output.py | onnx/sklearn-onnx | 323 | 11135787 | <filename>tests/test_sklearn_multi_output.py
# SPDX-License-Identifier: Apache-2.0
import unittest
from logging import getLogger
import numpy
from numpy.testing import assert_almost_equal
from onnxruntime import InferenceSession
from sklearn.datasets import load_linnerud, make_multilabel_classification
from sklearn.mu... |
tests/settings.py | amcgavin/react-render | 138 | 11135791 | DEBUG = True
SECRET_KEY = '_'
STATIC_URL = '/static/'
INSTALLED_APPS = (
'django.contrib.staticfiles',
'tests.test_app',
)
|
tests/unit/test_okd.py | gordonmessmer/ansible-bender | 513 | 11135804 | """ Making sure that ab can be used as a custom builder in okd """
import json
import os
from flexmock import flexmock
from ansible_bender.api import Application
from ansible_bender.okd import build_inside_openshift
# OKD sets an env var BUILD to this VALUE
# oc get --template '{{ (index (index .spec.containers 0)... |
scripts/torch/train.py | mohitktanwr/Improved-Inverse-ResNest-Isprs | 3,168 | 11135819 | <reponame>mohitktanwr/Improved-Inverse-ResNest-Isprs
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
## Created by: <NAME>
## Email: <EMAIL>
## Copyright (c) 2020
##
## LICENSE file in the root directory of this source tree
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++... |
test/core_typecheck.py | loongson-zn/build | 215 | 11135830 | <gh_stars>100-1000
#!/usr/bin/python
# Copyright 2003 <NAME>
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
# This tests the typechecking facilities.
import BoostBuild
t = BoostBuild.Tester(["-ffile.jam"], pass_toolset=0)
... |
models/modules.py | ztmo520/NeuralRecon | 1,001 | 11135880 | <reponame>ztmo520/NeuralRecon<filename>models/modules.py
import torch
import torch.nn as nn
import torchsparse
import torchsparse.nn as spnn
from torchsparse.tensor import PointTensor
from torchsparse.utils import *
from ops.torchsparse_utils import *
__all__ = ['SPVCNN', 'SConv3d', 'ConvGRU']
class BasicConvolutio... |
tests/test_backprop.py | Gausx/flashtorch | 685 | 11135925 | <reponame>Gausx/flashtorch
import inspect
import pytest
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models as models
from flashtorch.saliency import Backprop
#####################
# Utility functions #
#####################
def find_first_conv_layer(model, layer_type, in... |
test/programytest/storage/stores/sql/dao/test_conversation.py | cdoebler1/AIML2 | 345 | 11135931 | import unittest
from programy.storage.stores.sql.dao.conversation import Conversation
from programy.storage.stores.sql.dao.conversation import ConversationProperty
from programy.storage.stores.sql.dao.conversation import Match
from programy.storage.stores.sql.dao.conversation import MatchNode
from programy.storage.sto... |
vipermonkey/api.py | lap1nou/ViperMonkey | 874 | 11135932 | """
ViperMonkey - API
ViperMonkey is a specialized engine to parse, analyze and interpret Microsoft
VBA macros (Visual Basic for Applications), mainly for malware analysis.
Author: <NAME> - http://www.decalage.info
License: BSD, see source code or documentation
Project Repository:
https://github.com/decalage2/ViperM... |
pygears/lib/filt.py | bogdanvuk/pygears | 120 | 11135997 | from pygears import alternative, gear
from pygears.typing import Queue, Union, Uint, Tuple, Bool, Unit, Any, Maybe
from pygears.lib.fmaps.queue import queuemap
from .ccat import ccat
def filt_type(din, lvl, sel):
return Queue[(din[0].types)[sel], lvl]
@gear(hdl={'compile': True})
async def filt(din: Tuple[{'dat... |
utils/cmpcodesize/cmpcodesize/compare.py | AbdouSarr/swift | 825 | 11136006 | <filename>utils/cmpcodesize/cmpcodesize/compare.py
# ====--- compare.py - Compare built products' sizes -*- coding: utf-8 -*-===//
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Li... |
evaluation_scripts/python_code.py | yolochai/scisumm-corpus | 198 | 11136075 | # -*- coding: utf-8 -*-
"""
Created on Fri May 06 14:43:15 2016
@author: rustagi
"""
import ast
import os
import csv
csvfile=open('results_task1_last.csv', 'wb')
fieldnames = ['System_Name','Filename','Precision_Task_1a','Recall_Task_1a','F1_Score_Task_1a','Precision_Task_1b','Recall_Task_1b','F1_Score_Ta... |
examples/01-maps/plot_layer.py | Prithwijit-Chak/simpeg | 358 | 11136078 | <reponame>Prithwijit-Chak/simpeg<filename>examples/01-maps/plot_layer.py
"""
Maps: Parametrized Layer
========================
Build a model of a parametrized layer in a wholespace. If you want to
build a model of a parametrized layer in a halfspace, also use
maps.InjectActiveCell.
The model is
.. code::
m = [
... |
tests/test_activation_count.py | lauragustafson/fvcore | 1,137 | 11136079 | <reponame>lauragustafson/fvcore<gh_stars>1000+
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# pyre-ignore-all-errors[2]
import typing
import unittest
from collections import Counter, defaultdict
from typing import Any, Dict, List, Tuple
import torch
import torch.nn as nn
from fvcore.nn.acti... |
recommends/apps.py | asymness/django-recommends | 142 | 11136096 | import importlib
from django.apps import AppConfig, apps
from .settings import RECOMMENDS_AUTODISCOVER_MODULE
class RecommendsConfig(AppConfig):
name = 'recommends'
def ready(self):
if not RECOMMENDS_AUTODISCOVER_MODULE:
return
for appconfig in apps.get_app_configs():
... |
pybotters/models/ftx.py | maruuuui/pybotters | 176 | 11136103 | from __future__ import annotations
import asyncio
import logging
from typing import Any, Awaitable, Optional
import aiohttp
from ..auth import Auth
from ..store import DataStore, DataStoreManager
from ..typedefs import Item
from ..ws import ClientWebSocketResponse
logger = logging.getLogger(__name__)
class FTXDat... |
tests/test_scheduler/test_virtualtimescheduler.py | mmpio/RxPY | 4,342 | 11136106 | import pytest
import unittest
from rx.scheduler import VirtualTimeScheduler
from rx.internal import ArgumentOutOfRangeException
from rx.internal.constants import DELTA_ZERO, UTC_ZERO
class VirtualSchedulerTestScheduler(VirtualTimeScheduler):
def add(self, absolute, relative):
return absolute + relative
... |
usaspending_api/etl/management/commands/load_multiple_submissions.py | g4brielvs/usaspending-api | 217 | 11136109 | <filename>usaspending_api/etl/management/commands/load_multiple_submissions.py<gh_stars>100-1000
import logging
from datetime import timedelta
from django.core.management import call_command
from django.core.management.base import BaseCommand
from django.db import transaction
from django.db.models import Max
from djan... |
code/trainer.py | kkanshul/finegan | 288 | 11136124 | from __future__ import print_function
from six.moves import range
import sys
import numpy as np
import os
import random
import time
from PIL import Image
from copy import deepcopy
import torch.backends.cudnn as cudnn
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.optim as optim
imp... |
tests/decorators/test_parameter.py | slobinger/connexion | 4,084 | 11136131 | <reponame>slobinger/connexion<filename>tests/decorators/test_parameter.py
from unittest.mock import MagicMock
from connexion.decorators.parameter import parameter_to_arg
def test_injection():
request = MagicMock(name='request', path_params={'p1': '123'})
request.args = {}
request.headers = {}
request... |
QUICK_START/NODE_VOXELNET/src/script/voxelnet_ros.py | Hqss/DINK | 189 | 11136147 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# BSD 3-Clause License
#
# Copyright (c) 2019, FPAI
# Copyright (c) 2019, SeriouslyHAO
# Copyright (c) 2019, xcj2019
# Copyright (c) 2019, Leonfirst
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permit... |
gans/gan_training_tf_fns.py | garyxcheng/federated | 330 | 11136152 | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
nengo/spa/bind.py | Michaeljurado24/nengo | 762 | 11136154 | import nengo
from nengo.exceptions import ValidationError
from nengo.spa.module import Module
class Bind(Module):
"""A module for binding together two inputs.
Binding is done with circular convolution. For more details on how
this is computed, see the underlying `~.networks.CircularConvolution`
netwo... |
networks/mlp_mse.py | google-research/ibc | 180 | 11136157 | <reponame>google-research/ibc
# coding=utf-8
# Copyright 2022 The Reach ML 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
#
# Unle... |
tests/test_main_inline.py | shmuelamar/cbox | 164 | 11136181 | <filename>tests/test_main_inline.py
from io import StringIO
from os import linesep
import pytest
from cbox.__main__ import main
DATA1 = linesep.join(['hello world', '123 456', 'zzz xxx'])
DATA2 = linesep.join(['abc.py', 'def.pyc'])
def run_inline(in_data, argv):
"""runs inline func and returns its stdout, stde... |
ferminet/utils/tests/base_scf_test.py | llxlr/ferminet | 469 | 11136198 | # Lint as: python3
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
#... |
src/textacy/datasets/oxford_text_archive.py | austinjp/textacy | 1,929 | 11136200 | <filename>src/textacy/datasets/oxford_text_archive.py<gh_stars>1000+
"""
Oxford Text Archive literary works
----------------------------------
A collection of ~2.7k Creative Commons literary works from the Oxford Text Archive,
containing primarily English-language 16th-20th century literature and history.
Records inc... |
tests/components/rfxtrx/test_device_action.py | andersop91/core | 22,481 | 11136209 | <gh_stars>1000+
"""The tests for RFXCOM RFXtrx device actions."""
from __future__ import annotations
from typing import Any, NamedTuple
import RFXtrx
import pytest
import homeassistant.components.automation as automation
from homeassistant.components.device_automation import DeviceAutomationType
from homeassistant.c... |
tests/backends/oracle/test_operations.py | ni-ning/django | 61,676 | 11136217 | <reponame>ni-ning/django
import unittest
from django.core.management.color import no_style
from django.db import connection
from django.test import TransactionTestCase
from ..models import Person, Tag
@unittest.skipUnless(connection.vendor == 'oracle', 'Oracle tests')
class OperationsTests(TransactionTestCase):
... |
misc/markov.py | erayon/cycli | 290 | 11136224 | <filename>misc/markov.py
from cycli.cypher import Cypher
from misc.graphgist import get_all_queries
import re
cypher = Cypher()
queries = get_all_queries()
# Each Cypher word is a state in the Markov model. We're also adding a "" state; this means there are no previous words
# (we're at the beginning of the query).
... |
sarpy/io/general/nitf_elements/tres/unclass/OBJCTA.py | bombaci-vsc/sarpy | 119 | 11136225 | <filename>sarpy/io/general/nitf_elements/tres/unclass/OBJCTA.py
from ..tre_elements import TREExtension, TREElement
__classification__ = "UNCLASSIFIED"
__author__ = "<NAME>"
class OBJ(TREElement):
def __init__(self, value):
super(OBJ, self).__init__()
self.add_field('OBJ_TY', 's', 20, value)
... |
rules/private/proto_repository_tools_srcs.bzl | heartless-clown/rules_proto | 249 | 11136237 | <gh_stars>100-1000
""" Code generated by list_repository_tools_srcs.go; DO NOT EDIT."""
PROTO_REPOSITORY_TOOLS_SRCS = [
"@build_stack_rules_proto//:BUILD.bazel",
"@build_stack_rules_proto//cmd/depsgen:BUILD.bazel",
"@build_stack_rules_proto//cmd/depsgen:config.go",
"@build_stack_rules_proto//cmd/depsgen... |
examples/quickflat/plot_make_svg.py | mvdoc/pycortex | 423 | 11136246 | """
===============================
Save a 2D static flatmap as SVG
===============================
Plot a 2D static flatmap and save it as SVG file.
**Some words on the `rechache` parameter before we begin:**
Setting the `recache=True` parameter recaches the flatmap cache located in
<filestore>/<subject>/cache. By ... |
example/viewer.py | animuku/pyk4a | 186 | 11136252 | import cv2
import numpy as np
import pyk4a
from pyk4a import Config, PyK4A
def main():
k4a = PyK4A(
Config(
color_resolution=pyk4a.ColorResolution.RES_720P,
depth_mode=pyk4a.DepthMode.NFOV_UNBINNED,
synchronized_images_only=True,
)
)
k4a.start()
# ... |
data/covering_grammar/lib/covering_grammar.py | wannaphong/wikipron | 111 | 11136271 | #!/usr/bin/env python
"""Creates covering grammar FST from TSV of correspondences."""
import argparse
import pynini
TOKEN_TYPES = ["byte", "utf8"]
def main(args: argparse.Namespace) -> None:
input_token_type = (
args.input_token_type
if args.input_token_type in TOKEN_TYPES
else pynini.... |
videoanalyst/data/utils/misc.py | TragedyN/SiamFCpp | 737 | 11136283 | # -*- coding: utf-8 -*-
from typing import Dict
def index_data(data: Dict, idx: int):
r"""
Arguments
data: Dict
data to be indexed
idx: int
index used for indexing in data's first dimension
"""
ret = dict()
for k in data:
ret[k] = data[k][idx]
r... |
skyline/panorama/agent.py | datastreaming/skyline-1 | 396 | 11136288 | import logging
import sys
import traceback
from os import getpid
# from os.path import dirname, abspath, isdir
from os.path import isdir
from daemon import runner
from time import sleep
from sys import version_info
import mysql.connector
from mysql.connector import errorcode
from logging.handlers import TimedRotating... |
crypto/storagespace/test.py | cclauss/fbctf-2019-challenges | 213 | 11136292 | <reponame>cclauss/fbctf-2019-challenges<gh_stars>100-1000
#!/usr/bin/env sage
from typing import Any, Callable, Dict, Optional, Tuple
import base64
import socket
import json
from solve import Connection
"""
Tests functionality of the server and a few sanity checks
"""
JSON = Dict[str, Any]
TestFunction = Callable[[C... |
Hackerrank_problems/kangaroo/solution3.py | gbrls/CompetitiveCode | 205 | 11136295 | '''
LOGIC:
First, we compare the first kangaroo's location with the second one.
if same then they will meet at the starting point.
Second, if first kangaroo's location and rate bothe are heigher or visa-verse
then there is no chance of them meeting at same place.
Else if their location are ... |
addons/pythonscript_repl/input_box.py | blueflamegames/godot-python | 1,323 | 11136302 | <reponame>blueflamegames/godot-python
from godot import exposed, InputEventKey, KEY_UP, KEY_DOWN, LineEdit
@exposed(tool=True)
class InputBox(LineEdit):
def _enter_tree(self):
self.repl_node = self.get_parent().get_parent()
def _gui_input(self, event):
if isinstance(event, InputEventKey) and ... |
scipy/linalg/_decomp_svd.py | jake-is-ESD-protected/scipy | 9,095 | 11136313 | <filename>scipy/linalg/_decomp_svd.py
"""SVD decomposition functions."""
import numpy
from numpy import zeros, r_, diag, dot, arccos, arcsin, where, clip
# Local imports.
from ._misc import LinAlgError, _datacopied
from .lapack import get_lapack_funcs, _compute_lwork
from ._decomp import _asarray_validated
__all__ = ... |
Algo and DSA/LeetCode-Solutions-master/Python/graph-connectivity-with-threshold.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 11136364 | <reponame>Sourav692/FAANG-Interview-Preparation<filename>Algo and DSA/LeetCode-Solutions-master/Python/graph-connectivity-with-threshold.py<gh_stars>1000+
# Time: O((nlogn + q) * α(n)) ~= O(nlogn + q)
# Space: O(n)
class UnionFind(object): # Time: O(n * α(n)), Space: O(n)
def __init__(self, n):
self.set ... |
uproot3/interp/objects.py | NiclasEich/uproot3 | 320 | 11136380 | <reponame>NiclasEich/uproot3
#!/usr/bin/env python
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot3/blob/master/LICENSE
from __future__ import absolute_import
import copy
import struct
import numbers
import numpy
import uproot3.rootio
import uproot3.interp.interp
import uproot3.interp.numerical
im... |
pydgin/sim.py | kevinyuan/pydgin | 159 | 11136383 | #=======================================================================
# sim.py
#=======================================================================
# This is the common top-level simulator. ISA implementations can use
# various hooks to configure the behavior.
import os
import sys
# ensure we know where the py... |
lib/utils/meshrenderer/gl_utils/tiles.py | bertid/clean-pvnet | 284 | 11136391 | <reponame>bertid/clean-pvnet
import numpy as np
import cv2
def tiles(batch, rows, cols, spacing_x=0, spacing_y=0, scale=1.0):
if batch.ndim == 4:
N, H, W, C = batch.shape
elif batch.ndim == 3:
N, H, W = batch.shape
C = 1
else:
raise ValueError('Invalid batch shape: {}'.format(batch.shape))
H = int(H*scale... |
src/invoice2data/extract/plugins/tables.py | bosd/invoice2data | 944 | 11136397 | <reponame>bosd/invoice2data<filename>src/invoice2data/extract/plugins/tables.py
"""
Plugin to extract tables from an invoice.
"""
import re
import logging
logger = logging.getLogger(__name__)
DEFAULT_OPTIONS = {"field_separator": r"\s+", "line_separator": r"\n"}
def extract(self, content, output):
"""Try to ex... |
venv/Lib/site-packages/nipype/interfaces/mrtrix3/tests/test_auto_ComputeTDI.py | richung99/digitizePlots | 585 | 11136446 | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ..utils import ComputeTDI
def test_ComputeTDI_inputs():
input_map = dict(
args=dict(
argstr="%s",
),
contrast=dict(
argstr="-constrast %s",
),
data_type=dict(
argstr="-datatype %s... |
data/dataloader.py | alexa/bort | 469 | 11136483 | # Copyright Amazon.com, Inc. or its affiliates. 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 b... |
gdspy/polygon.py | gdmcbain/gdspy | 239 | 11136485 | ######################################################################
# #
# Copyright 2009 <NAME>. #
# This file is part of gdspy, distributed under the terms of the #
# Boost Software License - Version 1.0. See the accom... |
bcs-ui/backend/tests/dashboard/workloads/test_container.py | masanqi/bk-bcs | 599 | 11136513 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
mmseg/models/decode_heads/dnl_head.py | weiyx16/mmsegmentation | 103 | 11136522 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.cnn import NonLocal2d
from torch import nn
from ..builder import HEADS
from .fcn_head import FCNHead
class DisentangledNonLocal2d(NonLocal2d):
"""Disentangled Non-Local Blocks.
Args:
temperature (float): Temperature to adjust att... |
Configuration/Geometry/python/GeometryExtendedGFlashReco_cff.py | ckamtsikis/cmssw | 852 | 11136530 | import FWCore.ParameterSet.Config as cms
# Ideal geometry, needed for transient ECAL alignement
from Configuration.Geometry.GeometryExtendedGFlash_cff import *
from Configuration.Geometry.GeometryReco_cff import *
|
cogs/admin.py | igotadell/pollmaster | 101 | 11136538 | <reponame>igotadell/pollmaster
import logging
from discord.ext import commands
class Admin(commands.Cog):
def __init__(self, bot):
self.bot = bot
# every commands needs owner permissions
async def cog_check(self, ctx):
return self.bot.owner == ctx.author
async def cog_command_error(... |
pgoapi/protos/pogoprotos/data/logs/raid_rewards_log_entry_pb2.py | aroo135/pgoapi | 842 | 11136548 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/data/logs/raid_rewards_log_entry.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.... |
plugin.video.fanfilm/resources/lib/libraries/unwise.py | mrknow/filmkodi | 105 | 11136564 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
'''
FanFilm Add-on
Copyright (C) 2015 lambda
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 3 of the License, or
(a... |
OpenMatch/modules/matchers/__init__.py | vishalbelsare/OpenMatch | 403 | 11136568 | <reponame>vishalbelsare/OpenMatch<gh_stars>100-1000
from OpenMatch.modules.matchers.kernel_matcher import KernelMatcher
|
utils/metrics.py | niqbal996/ViewAL | 126 | 11136572 | import numpy as np
# https://stats.stackexchange.com/questions/179835/how-to-build-a-confusion-matrix-for-a-multiclass-classifier
def calculate_miou(confusion_matrix):
MIoU = np.divide(np.diag(confusion_matrix), (
np.sum(confusion_matrix, axis=1) + np.sum(confusion_matrix, axis=0) -
np.diag(confus... |
PythonAPI/carissma_project/lib/python3.5/site-packages/mpl_toolkits/axes_grid/axes_grid.py | AbdulHoffmann/carla_carissma | 445 | 11136619 | <reponame>AbdulHoffmann/carla_carissma<gh_stars>100-1000
from mpl_toolkits.axisartist.axes_divider import LocatableAxes
from mpl_toolkits.axisartist.axes_grid import (
AxesGrid, CbarAxes, Grid, ImageGrid)
|
apps/modules/theme_setting/process/page.py | Bension/osroom | 579 | 11136625 | #!/usr/bin/env python
# -*-coding:utf-8-*-
# @Time : 2017/11/1 ~ 2019/9/1
# @Author : <NAME>
import os
import shutil
from flask import request
import regex as re
from flask_babel import gettext
from apps.app import mdbs
from apps.configs.sys_config import THEME_TEMPLATE_FOLDER
from apps.core.flask.reqparse import arg... |
pyriemann/__init__.py | qbarthelemy/pyRiemann | 301 | 11136632 | from ._version import __version__
from . import classification
from . import tangentspace
from . import channelselection
from . import estimation
from . import spatialfilters
from . import clustering
from . import stats
from . import embedding
from . import preprocessing
__all__ = [
'__version__',
'classifica... |
classifier.py | lloyd31/GANDCTAnalysis | 108 | 11136639 | import argparse
import datetime as dt
import os
import numpy as np
import tensorflow as tf
from src.dataset import deserialize_data
from src.models import (build_multinomial_regression,
build_multinomial_regression_l1,
build_multinomial_regression_l1_l2,
... |
pypower/t/t_modcost.py | Bengt/PYPOWER | 221 | 11136662 | # Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""Tests for code in C{modcost}.
"""
from numpy import array
from pypower.totcost import totcost
from pypower.modcost import modcost
from pypower.t.t_begin impo... |
neo/Prompt/Commands/Bootstrap.py | volekerb/neo-python | 387 | 11136673 | import sys
from neo.Settings import settings
from prompt_toolkit import prompt
import requests
from tqdm import tqdm
import tarfile
import shutil
import os
def BootstrapBlockchainFile(target_dir, download_location, bootstrap_name, require_confirm=True, delete_bootstrap_file=True):
if download_location is None:
... |
knox/crypto.py | nnamdei/django-rest-knox | 788 | 11136675 | import binascii
from os import urandom as generate_bytes
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from knox.settings import knox_settings
sha = knox_settings.SECURE_HASH_ALGORITHM
def create_token_string():
return binascii.hexlify(
gener... |
dump_match/geom.py | hoverinc/OANet | 209 | 11136712 | <reponame>hoverinc/OANet<filename>dump_match/geom.py
# geom.py ---
#
# Filename: geom.py
# Description:
# Author: <NAME>
# Maintainer:
# Created: Thu Oct 5 14:53:24 2017 (+0200)
# Version:
# Package-Requires: ()
# URL:
# Doc URL:
# Keywords:
# Compatibility:
#
#
# Commentary:
#
#
#
#
# Change Log:
#
#
#
# Copyright ... |
pytorch3d/common/workaround/utils.py | jkxing/pytorch3d | 6,041 | 11136717 | # Copyright (c) Facebook, Inc. and its 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 torch
def _safe_det_3x3(t: torch.Tensor):
"""
Fast determinant calculation for a batch of 3x3 m... |
data/model/oci/label.py | giuseppe/quay | 2,027 | 11136750 | <filename>data/model/oci/label.py
import logging
from data.model import InvalidLabelKeyException, InvalidMediaTypeException, DataModelException
from data.database import (
Label,
Manifest,
TagManifestLabel,
MediaType,
LabelSourceType,
db_transaction,
ManifestLabel,
TagManifestLabelMap,... |
ipagnn/lib/figure_utils.py | deepneuralmachine/google-research | 23,901 | 11136755 | <gh_stars>1000+
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
torchmetrics/functional/text/cer.py | lucadiliello/metrics | 769 | 11136756 | <filename>torchmetrics/functional/text/cer.py
# Copyright The PyTorch Lightning 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 obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... |
tests/storage/test_redis_sentinel.py | mymedia2/limits | 140 | 11136768 | <reponame>mymedia2/limits<gh_stars>100-1000
import unittest
import mock
import redis.sentinel
from limits.storage import RedisSentinelStorage, storage_from_string
from tests.storage.test_redis import SharedRedisTests
class RedisSentinelStorageTests(SharedRedisTests, unittest.TestCase):
def setUp(self):
... |
tools/linux_symbolize.py | fengjixuchui/bochspwn | 138 | 11136769 | #!/usr/bin/python
#
# Authors: <NAME> (<EMAIL>)
# <NAME> (<EMAIL>)
#
# Copyright 2013 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:... |
windows_packages_gpu/torch/distributions/categorical.py | codeproject/DeepStack | 353 | 11136781 | import torch
from torch._six import nan
from torch.distributions import constraints
from torch.distributions.distribution import Distribution
from torch.distributions.utils import probs_to_logits, logits_to_probs, lazy_property
class Categorical(Distribution):
r"""
Creates a categorical distribution ... |
tests/verena/test_verena.py | kiranmusze/deutschland | 445 | 11136855 | <gh_stars>100-1000
from deutschland.verena.verena import Verena
def test_verena():
v = Verena()
res = v.get()
assert (
len(res) > 0
), "Scraping and extracting all pages of the VERENA portal eturned 0 results. It very likely shouldn't."
|
pandapower/plotting/patch_makers.py | junmuz/pandapower | 104 | 11136881 | from matplotlib.patches import RegularPolygon, Arc, Circle, Rectangle, Ellipse
import numpy as np
from pandapower.plotting.plotting_toolbox import _rotate_dim2, get_color_list, get_angle_list, \
get_linewidth_list
try:
import pplog as logging
except ImportError:
import logging
logger = logging.getLogger(_... |
examples/speaker_tasks/recognition/speaker_reco_infer.py | ahmetgunduz/NeMo | 4,145 | 11136899 | <reponame>ahmetgunduz/NeMo
# Copyright (c) 2020, NVIDIA CORPORATION. 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
#... |
sympy/plotting/pygletplot/plot_mode.py | shipci/sympy | 319 | 11136909 | from __future__ import print_function, division
from sympy import Symbol, sympify
from plot_interval import PlotInterval
from plot_object import PlotObject
from util import parse_option_string
from sympy.geometry.entity import GeometryEntity
from sympy.core.compatibility import is_sequence
class PlotMode(PlotObject)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.