max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
asterioids-pygame-project/source_code_step_4/space_rocks/utils.py | syberflea/materials | 3,682 | 3251669 | from pygame.image import load
def load_sprite(name, with_alpha: bool=True) -> object:
path = f"assets/sprites/{name}.png"
loaded_sprite = load(path)
if with_alpha:
return loaded_sprite.convert_alpha()
else:
return loaded_sprite.convert()
| 1 | 1 | 0 | 0 | 2 | 0 |
dojo/db_migrations/0150_dedupe_endpoint_status.py | santos0santos0/django-DefectDojo | 249 | 3251678 | <gh_stars>100-1000
from django.db import migrations
from django.db.models import Count, Q
import logging
logger = logging.getLogger(__name__)
class Migration(migrations.Migration):
dependencies = [
('dojo', '0149_harmonize_user_format'),
]
def dedupe_endpoint_status(apps, schema_editor):
... | 0 | 0 | 0 | 0 | 0 | 0 |
fna_det/configs/fna_ssdlite_search.py | BaiYuYuan/FNA | 173 | 3251681 | <reponame>BaiYuYuan/FNA
# model settings
input_size = 300
model = dict(
type='SingleStageDetectorSearch',
pretrained=dict(
use_load=True,
load_path='./seed_mbv2.pt',
seed_num_layers=[1, 1, 2, 3, 4, 3, 3, 1, 1] # mbv2
),
backbone=dict(
type='SSDLiteBackbone',
... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/js/shared/src/gdal/get_band_names.py | BuddyVolly/sepal | 153 | 3251688 | <gh_stars>100-1000
import json
import sys
from osgeo import gdal
from osgeo.gdalconst import GA_ReadOnly
def get_band_names(path):
ds = gdal.Open(path, GA_ReadOnly)
metadata = [
ds.GetRasterBand(i + 1).GetDescription()
for i in range(0, ds.RasterCount)
]
return metadata
if __name__ =... | 0 | 0 | 0 | 0 | 0 | 0 |
dialogue-engine/test/programytest/translate/test_textblob_translate.py | cotobadesign/cotoba-agent-oss | 104 | 3251694 | <filename>dialogue-engine/test/programytest/translate/test_textblob_translate.py
"""
Copyright (c) 2020 COTOBA DESIGN, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, inc... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/collectd/files/usr/lib/collectd/python/tcp.py | camdesgov/govuk-puppet | 130 | 3251696 | #!/usr/bin/env python
# -*- coding: utf-8; -*-
#
# collectd implementation of:
# https://github.com/BrightcoveOS/Diamond/blob/master/src/collectors/tcp/tcp.py
import collectd
import os
class Tcp(object):
PROC: list[str] = ['/proc/net/netstat', '/proc/net/snmp']
GAUGES: list[str] = ['CurrEstab', 'MaxConn']
... | 0 | 0 | 2 | 2 | 4 | 0 |
CTFd/plugins/ctfd_glowworm/__init__.py | Threezh1/H1ve | 501 | 3251715 | from __future__ import division # Use floating point for math calculations
from CTFd.plugins import register_plugin_assets_directory
from CTFd.plugins.flags import get_flag_class
from CTFd.utils.user import get_current_user
from CTFd import utils
from CTFd.models import (
db,
Solves,
Fails,
Flags,
... | 0 | 15 | 0 | 0 | 15 | 0 |
f5/bigip/tm/asm/signatures.py | nghia-tran/f5-common-python | 272 | 3251721 | <reponame>nghia-tran/f5-common-python<filename>f5/bigip/tm/asm/signatures.py
# coding=utf-8
#
# Copyright 2015-2016 F5 Networks 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
#
# htt... | 0 | 0 | 0 | 0 | 0 | 0 |
nanpy/ad9850.py | AFTC-1/Arduino-rpi | 178 | 3251738 | <reponame>AFTC-1/Arduino-rpi<gh_stars>100-1000
from __future__ import division
from nanpy.arduinotree import ArduinoTree
from nanpy.memo import memoized
from nanpy.shiftout import ShiftOut
LOW, HIGH = 0, 1
OUTPUT = 1
class AD9850(object):
"""controllling the AD9850 DDS module.
code is based on this info: ... | 0 | 0 | 0 | 0 | 0 | 0 |
dace/frontend/tensorflow/__init__.py | Walon1998/dace | 227 | 3251756 | <reponame>Walon1998/dace
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
from .tensorflow import *
from .winograd import *
| 0 | 0 | 0 | 0 | 0 | 0 |
src/train.py | zkqiu/MOC-Detector | 223 | 3251762 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import os
import torch
import torch.utils.data
from opts import opts
from MOC_utils.model import create_model, load_model, save_model, load_coco_pretrained_model, load_imagenet_pretrained_model
from... | 0 | 0 | 0 | 0 | 0 | 0 |
logdevice/test/ldbench/end2end_test/Workers.py | YangKian/LogDevice | 1,831 | 3251788 | #!/usr/bin/env python3
# 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 logging
import subprocess
from Execution import ExecutionBase
# Worker module i... | 0 | 1 | 0 | 1 | 2 | 0 |
applications/MultilevelMonteCarloApplication/tests/caarc_wind_mpi/FluidDynamicsAnalysisMC.py | lkusch/Kratos | 778 | 3251791 | # Import Python libraries
import sys
import time
import numpy as np
# IMport Kratos
import KratosMultiphysics
import KratosMultiphysics.FluidDynamicsApplication
from KratosMultiphysics.FluidDynamicsApplication.fluid_dynamics_analysis import FluidDynamicsAnalysis
class FluidDynamicsAnalysisMC(FluidDynamicsAnalysis):
... | 0 | 0 | 0 | 1 | 1 | 0 |
nncf/torch/tensor_statistics/statistics.py | sarthakpati/nncf | 310 | 3251874 | """
Copyright (c) 2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writin... | 13 | 5 | 0 | 0 | 18 | 0 |
etl/parsers/etw/Microsoft_Windows_Mobile_Broadband_Experience_Api_Internal.py | IMULMUL/etl-parser | 104 | 3251877 | <filename>etl/parsers/etw/Microsoft_Windows_Mobile_Broadband_Experience_Api_Internal.py
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-Mobile-Broadband-Experience-Api-Internal
GUID : 2aabd03b-f48b-419a-b4ce-7a14403f4a46
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes... | 0 | 0 | 0 | 0 | 0 | 0 |
example.py | mkmoisen/pyhs2 | 200 | 3251900 | <reponame>mkmoisen/pyhs2
import pyhs2
with pyhs2.connect(host='localhost',
port=10000,
authMechanism="PLAIN",
user='root',
password='<PASSWORD>',
database='default') as conn:
with conn.cursor() as cur:
#Show databas... | 0 | 0 | 0 | 0 | 0 | 0 |
services.py | goztrk/django-htk | 206 | 3251932 | # HTK Imports
from htk.utils import resolve_model_dynamically
class HtkBaseService(object):
def __init__(self, *args, **kwargs):
pass
def init_model(self, module_str):
model = resolve_model_dynamically(module_str)
assert model is not None
self.model = model
| 0 | 0 | 0 | 0 | 0 | 0 |
Testcase4-Application-breakdown/image-process/scripts/checkInvoke.py | daisy-ycguo/ServerlessBench | 129 | 3251936 | <gh_stars>100-1000
# Copyright (c) 2020 Institution of Parallel and Distributed System, Shanghai Jiao Tong University
# ServerlessBench is licensed under the Mulan PSL v1.
# You can use this software according to the terms and conditions of the Mulan PSL v1.
# You may obtain a copy of Mulan PSL v1 at:
# http://lic... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/templates/locations/ZA/config.py | himansu1997/eden | 205 | 3251941 | <reponame>himansu1997/eden<gh_stars>100-1000
# -*- coding: utf-8 -*-
from gluon import current
def config(settings):
"""
Template settings for South Africa
- designed to be used in a Cascade with an application template
"""
#T = current.T
# Pre-Populate
settings.base.prepopulate.... | 0 | 0 | 0 | 0 | 0 | 0 |
claf/data/dto/helper.py | GMDennis/claf | 225 | 3251960 |
class Helper:
"""
Helper Data Transfer Object (DTO) Class
(include model parameter - value defined by data, predict_helper and etc.)
dictionary consisting of
- model: (dict) model parameter (ex. num_classes)
- predict_helper: (dict) predict_helper (ex. class_idx2text)
"""
... | 1 | 1 | 3 | 0 | 5 | 0 |
hwam/models.py | dekoder/LogESP | 130 | 3251967 | <reponame>dekoder/LogESP<filename>hwam/models.py
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
from hwam.choices import *
# Create your models here.
class OrganizationalUnit(models.Model):
name = models.CharField(max_length=30)
desc = models.CharFi... | 0 | 0 | 0 | 0 | 0 | 0 |
mmocr/models/textrecog/backbones/resnet_extra.py | Jessmin/TableMASTER-mmocr | 206 | 3251968 | <filename>mmocr/models/textrecog/backbones/resnet_extra.py
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmdet.models.builder import BACKBONES
from ..layers.context_block import ContextBlock
def conv3x3(in_planes, out_planes, stride=1):
""" 3x3 convolution with padding """
return nn.... | 0 | 0 | 0 | 0 | 0 | 0 |
007-python-101/test.py | gynvael/stream | 152 | 3251974 | <filename>007-python-101/test.py<gh_stars>100-1000
import sys
sys.path.append("mymod.bmp")
import hello
hello.hello("Test test test!")
| 0 | 0 | 0 | 0 | 0 | 0 |
.github/workflows/license_checker_v2.py | guillaume-chevalier/New-Python-Project-Base | 519 | 3252037 | import argparse
import urllib3
# Here is the command I use to verify all libraries installed with pip.
# python license_checker_v2.py --dependencies $(cut -d '=' -f 1 <<< $(pip freeze))
# Alternatively, if you are processing directly a requirements.txt file, you can use the following command to parse
# awk -F'[>=<]' ... | 2 | 3 | 0 | 0 | 5 | 0 |
tests/test_plugin_managers.py | DmitryRibalka/monitorrent | 465 | 3252044 | import os
from mock import Mock, MagicMock, patch
from tests import TestCase
from monitorrent.plugin_managers import load_plugins, register_plugin, get_plugins, get_all_plugins
class LoadPluginsTest(TestCase):
def test_load_plugins(self):
dir_name = os.path.realpath(os.path.join(__file__, '../../monitorre... | 0 | 0 | 0 | 0 | 0 | 0 |
src/gen_labels_mot16_car.py | EvelynYihuiYang/MCMOT | 306 | 3252059 | import os.path as osp
import os
import shutil
import numpy as np
def mkdirs(d):
# if not osp.exists(d):
if not osp.isdir(d):
os.makedirs(d)
data_root = '/mnt/diskb/even/dataset/'
seq_root = data_root + 'MOT16/images/train'
label_root = data_root + 'MOT16/labels_with_ids/train'
cls_map = {
'Pede... | 0 | 0 | 0 | 0 | 0 | 0 |
src/python/grapl-tests-common/grapl_tests_common/upload_logs.py | inickles/grapl | 313 | 3252088 | from __future__ import annotations
import json
import os
import random
import string
import time
import uuid
from dataclasses import dataclass
from datetime import datetime
from os import PathLike
from typing import TYPE_CHECKING, Optional, cast
from grapl_common.env_helpers import S3ClientFactory, SQSClientFactory
f... | 24 | 7 | 3 | 0 | 34 | 0 |
pyunity/window/templateWindow.py | pyunity/pyunity | 158 | 3252089 | <filename>pyunity/window/templateWindow.py<gh_stars>100-1000
"""Template window provider, use this for creating new window providers"""
from . import ABCWindow
from ..errors import *
from ..values import Clock
from ..input import KeyCode
from .. import config
class Window(ABCWindow):
"""
A template window pro... | 0 | 0 | 0 | 0 | 0 | 0 |
models/tf/plainsr.py | thinkreed/ECBSR | 162 | 3252130 | import sys
import tensorflow as tf
import h5py
import math
import numpy as np
import cv2
from tensorflow.keras.layers import Conv2D, Conv2DTranspose, Input, PReLU, ReLU, UpSampling2D, Lambda
from tensorflow.keras.models import Model
import os
os.environ["CUDA_VISIBLE_DEVICES"]="-1"
def tf_conv3x3(inp, out_channels, a... | 0 | 2 | 0 | 0 | 2 | 0 |
geoq/training/urls.py | kaydoh/geoq | 471 | 3252154 | <filename>geoq/training/urls.py
from django.urls import path
from .views import *
app_name = 'training'
urlpatterns = [
path('', login_required(TrainingListView.as_view()), name='course_list'),
path('<int:pk>/', login_required(TrainingView.as_view()), name='course_view_information'),
path('<int:pk>/quiz/'... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_runpip.py | alexef/pipx | 3,573 | 3252184 | from helpers import run_pipx_cli
def test_runpip(pipx_temp_env, monkeypatch, capsys):
assert not run_pipx_cli(["install", "pycowsay"])
assert not run_pipx_cli(["runpip", "pycowsay", "list"])
| 0 | 0 | 0 | 0 | 0 | 0 |
hpe/imc/hp_imc_dbman_conf_cmd_injection_73_e0703.py | iamarkaj/poc | 1,007 | 3252227 | # https://www.tenable.com/security/research/tra-2019-42
import sys, socket, string
from struct import *
from pyasn1.type import univ
from pyasn1.codec.ber import encoder
import hexdump
def usage():
print "usage : "+sys.argv[0] + " <target_ip> <target_port> <hour>:<minute>"
print "example: "+sys.argv[0] + " 1... | 0 | 0 | 0 | 0 | 0 | 0 |
alembic/versions/2016041819_add_path_to_worker__42d0efeae48e.py | kl-chou/codalab-worksheets | 236 | 3252260 | """Add path to worker dependencies.
Revision ID: 42d<PASSWORD>e
Revises: <PASSWORD>
Create Date: 2016-04-18 19:48:19.931013
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4<PASSWORD>'
down_revision = '<PASSWORD>'
def upgrade():
op.add_column('worker_dep... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_utils.py | Varriount/sanic | 4,959 | 3252267 | <filename>tests/test_utils.py
from os import environ
from pathlib import Path
from types import ModuleType
import pytest
from sanic.exceptions import LoadFileException
from sanic.utils import load_module_from_file_location
@pytest.mark.parametrize(
"location",
(
Path(__file__).parent / "static" / "a... | 0 | 0 | 0 | 0 | 0 | 0 |
voctogui/lib/ports.py | 0xflotus/voctomix | 521 | 3252270 | <reponame>0xflotus/voctomix
#!/usr/bin/env python3
import logging
import os
import json
from gi.repository import Gtk, Gst, GLib
from lib.config import Config
from lib.uibuilder import UiBuilder
import lib.connection as Connection
from vocto.port import Port
# time interval to re-fetch queue timings
TIMER_RESOLUTION ... | 0 | 0 | 0 | 0 | 0 | 0 |
L1TriggerConfig/RPCTriggerConfig/test/dumpConeDef.py | ckamtsikis/cmssw | 852 | 3252305 | import FWCore.ParameterSet.Config as cms
process = cms.Process("dump")
#process.load("L1TriggerConfig.RPCTriggerConfig.RPCConeDefinition_cff")
useGlobalTag = 'IDEAL_31X'
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
process.GlobalTag.globaltag = useGlobalTag + '::All'
#process.Me... | 0 | 0 | 0 | 0 | 0 | 0 |
src/embedding/test_freezed_graph.py | mykiscool/DeepCamera | 914 | 3252311 | <gh_stars>100-1000
import argparse
import tensorflow as tf
def load_graph(frozen_graph_filename):
# We load the protobuf file from the disk and parse it to retrieve the
# unserialized graph_def
with tf.gfile.GFile(frozen_graph_filename, "rb") as f:
graph_def = tf.GraphDef()
graph_def.Pars... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/__init__.py | iguazio/graphite-api | 315 | 3252345 | import json
import os
import shutil
from logging.config import dictConfig
os.environ.setdefault(
'GRAPHITE_API_CONFIG',
os.path.join(os.path.dirname(__file__), 'conf.yaml')) # noqa
try:
import unittest2 as unittest
except ImportError:
import unittest
from graphite_api._vendor import whisper
from gra... | 2 | 0 | 0 | 0 | 2 | 0 |
src/accelerate/commands/test.py | Pandinosaurus/accelerate | 2,313 | 3252351 | <reponame>Pandinosaurus/accelerate
#!/usr/bin/env python
# Copyright 2021 The HuggingFace Team. 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... | 0 | 0 | 0 | 0 | 0 | 0 |
malaya_speech/train/model/tacotron2/__init__.py | ishine/malaya-speech | 111 | 3252364 | import tensorflow as tf
def generate_guided_attention(
mel_lengths, input_lengths, reduction_factor: int=1, g: float=0.2
) -> object:
mel_len = mel_lengths // reduction_factor
char_len = input_lengths
xv, yv = tf.meshgrid(tf.range(char_len), tf.range(mel_len), indexing='ij')
f32_matrix = tf.cast(y... | 2 | 1 | 0 | 0 | 3 | 0 |
model/loss/loss.py | ishine/FastVocoder | 116 | 3252377 | <filename>model/loss/loss.py
import torch
import torch.nn as nn
from .stft_loss import MultiResolutionSTFTLoss
class Loss(nn.Module):
def __init__(self):
super(Loss, self).__init__()
self.stft_loss = MultiResolutionSTFTLoss()
self.l1_loss = nn.L1Loss()
def forward(self, est_source, w... | 0 | 0 | 0 | 0 | 0 | 0 |
pypower/t/t_qps_pypower.py | Bengt/PYPOWER | 221 | 3252392 | <gh_stars>100-1000
# 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 of C{qps_pypower} QP solvers.
"""
from numpy import array, zeros, shape, Inf
from scipy.sparse import csr_matrix as sparse
from pypo... | 0 | 0 | 0 | 0 | 0 | 0 |
networks/resnet_encoder.py | Uehwan/SimVODIS | 117 | 3252398 | <reponame>Uehwan/SimVODIS<gh_stars>100-1000
# Copyright Niantic 2019. Patent Pending. All rights reserved.
#
# This software is licensed under the terms of the Monodepth2 licence
# which allows for non-commercial use only, the full terms of which are made
# available in the LICENSE file.
from __future__ import absolut... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/utils/fixtures/setups/setuptools_setup/setup.py | rschwarzkopf/poetry | 12,347 | 3252448 | import setuptools
setuptools.setup(
name="my_package",
version="0.1.2",
author="<NAME>",
author_email="<EMAIL>",
description="Just a description",
url="https://example.org",
packages=setuptools.find_packages(),
)
| 0 | 0 | 0 | 0 | 0 | 0 |
support/coding/remove_byte_order_mark.py | hedbergj/OpenSpace | 489 | 3252478 | """
OpenSpace
Copyright (c) 2014-2020
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute... | 0 | 0 | 0 | 0 | 0 | 0 |
src/salt/base/ext/_utils/common_util.py | autopi-io/autopi-core | 133 | 3252507 | <filename>src/salt/base/ext/_utils/common_util.py<gh_stars>100-1000
import datetime
import errno
import importlib
import json
import logging
import logging.handlers
import os
import re
from timeit import default_timer as timer
log = logging.getLogger(__name__)
def makedirs(path, exist_ok=False):
try:
o... | 0 | 0 | 0 | 0 | 0 | 0 |
HunterAdminApi/test/common/plugin_info/test_plugin_config.py | tt9133github/hunter | 322 | 3252522 | #!/ usr/bin/env
# coding=utf-8
"""
author: b5mali4
Copyright (c) 2018
"""
import unittest
from common.plugin_config.localfile_plugin_config import LocalFilePluginConfig
from common.plugin_config.redis_plugin_config import RedisPluginConfig
class PluginConfigTestCase(unittest.TestCase):
def testGetPluginConfigFro... | 0 | 0 | 0 | 0 | 0 | 0 |
run_kp2uv.py | google/retiming | 152 | 3252529 | <filename>run_kp2uv.py
# Copyright 2020 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... | 0 | 0 | 0 | 0 | 0 | 0 |
odin/utilities/params/event_types.py | gsamarakoon/Odin | 103 | 3252536 | <gh_stars>100-1000
from .odin_enum import OdinEnum
class Events(OdinEnum):
"""Event Type Enumeration
Odin trades by awaiting sequences of predetermined events and interpreting
such events in order to make subsequent decisions. The documentation for
each event type is contained in the events module, t... | 0 | 0 | 0 | 0 | 0 | 0 |
Wrapping/Python/paraview/detail/catalyst_export.py | xj361685640/ParaView | 815 | 3252588 | <reponame>xj361685640/ParaView
r"""Module used to generate Catalyst export scripts"""
from .. import simple, smstate, smtrace, servermanager
def _get_catalyst_state(options):
# build a `source_set` comprising of the extractor proxies.
# if not extracts have been configured, then there's nothing to generate.
... | 0 | 0 | 0 | 0 | 0 | 0 |
ffmpeg_streaming/_reperesentation.py | ace-smart/py-streaming | 455 | 3252593 | """
ffmpeg_streaming.media
~~~~~~~~~~~~
Auto Generate Representation and Representation Object
:copyright: (c) 2020 by <NAME>.
:website: https://www.aminyazdanpanah.com
:email: <EMAIL>
:license: MIT, see LICENSE for more details.
"""
from ._format import Format
from ._media_property import Size, Bitrate
MINIMUM_BIT... | 13 | 5 | 0 | 0 | 18 | 0 |
2020/10/05/Some New Features in Python 3.9/threepointnine/timezones.py | kenjitagawa/youtube_video_code | 492 | 3252617 | from datetime import datetime
#from pytz import timezone
from zoneinfo import ZoneInfo
current_time = datetime.now()
print(current_time)
current_time_amsterdam = datetime.now()
print(current_time.astimezone(ZoneInfo('Europe/Amsterdam')))
| 0 | 0 | 0 | 0 | 0 | 0 |
src/config.py | harunpehlivan/QuickDraw | 592 | 3252647 | RED_HSV_LOWER = [0, 100, 100]
RED_HSV_UPPER = [20, 255, 255]
RED_RGB = (0, 0, 255)
GREEN_HSV_LOWER = [36, 0, 0]
GREEN_HSV_UPPER = [86, 255, 255]
GREEN_RGB = (0, 255, 0)
BLUE_HSV_LOWER = [100, 60, 60]
BLUE_HSV_UPPER = [140, 255, 255]
BLUE_RGB = (255, 0, 0)
YELLOW_RGB = (0, 255, 255)
WHITE_RGB = (255, 255, 255)
CLASS... | 0 | 0 | 0 | 0 | 0 | 0 |
slovnet/infer/bert.py | harri-pltr/slovnet | 147 | 3252679 | <filename>slovnet/infer/bert.py
from itertools import groupby
from slovnet.record import Record
from slovnet.token import tokenize
from slovnet.bert import bert_subs
from slovnet.chop import chop_weighted
from slovnet.mask import pad_masked, split_masked
from slovnet.markup import (
BIOMarkup,
MorphMarkup,
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/functional/apps/forum_conversation/forum_polls/test_views.py | BrendaH/django-machina | 572 | 3252695 | <gh_stars>100-1000
import pytest
from django.urls import reverse
from faker import Faker
from machina.core.db.models import get_model
from machina.core.loading import get_class
from machina.test.factories import (
ForumReadTrackFactory, PostFactory, TopicPollFactory, TopicPollOptionFactory,
TopicPollVoteFactor... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/pubsub/test_gossipsub.py | Jacquelinevv0693/py-libp2p | 315 | 3252724 | import random
import pytest
import trio
from libp2p.pubsub.gossipsub import PROTOCOL_ID
from libp2p.tools.factories import IDFactory, PubsubFactory
from libp2p.tools.pubsub.utils import dense_connect, one_to_all_connect
from libp2p.tools.utils import connect
@pytest.mark.trio
async def test_join():
async with P... | 0 | 2 | 0 | 0 | 2 | 0 |
integration_test/packages/run_pandas.py | robintw/recipy | 451 | 3252731 | <reponame>robintw/recipy<filename>integration_test/packages/run_pandas.py
"""
Sample script that runs pandas functions logged by recipy.
"""
# Copyright (c) 2016 University of Edinburgh.
from __future__ import (nested_scopes, generators, division,
absolute_import, with_statement,
... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/jet_bridge_base/jet_bridge_base/fields/boolean.py | bokal2/jet-bridge | 1,247 | 3252739 | <reponame>bokal2/jet-bridge<gh_stars>1000+
from jet_bridge_base.fields.field import Field
class BooleanField(Field):
TRUE_VALUES = {
't', 'T',
'y', 'Y', 'yes', 'YES',
'true', 'True', 'TRUE',
'on', 'On', 'ON',
'1', 1,
True
}
FALSE_VALUES = {
'f', 'F',... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/examples/plot_convert_h2o.py | xhochy/onnxmltools | 623 | 3252744 | # SPDX-License-Identifier: Apache-2.0
"""
.. _l-example-h2o:
Converts a H2O model
====================
This example trains a `h2o
<http://docs.h2o.ai/h2o/latest-stable/h2o-py/docs/intro.html>`_
model on the Iris datasets and converts it
into ONNX.
.. contents::
:local:
Train a model
+++++++++++++
"""
import o... | 0 | 0 | 0 | 0 | 0 | 0 |
cacreader/swig-4.0.2/Examples/python/import_packages/from_init3/py3/pkg2/__init__.py | kyletanyag/LL-Smartcard | 1,031 | 3252766 | <gh_stars>1000+
from .bar import Pkg2_Bar
| 0 | 0 | 0 | 0 | 0 | 0 |
catalogue/aarch64-pick/shelf.py | hugookeeffe/herdtools7 | 103 | 3252824 | <reponame>hugookeeffe/herdtools7
record = "AArch64-Pick"
cats = [
"cats/aarch64-pick.cat",
]
cfgs = [
"cfgs/new-web.cfg",
]
illustrative_tests = [
"tests/MP+rel+CAS-addr.litmus",
"tests/MP+rel+CSEL-addr.litmus",
"tests/MP+rel+CSEL-addr2.litmus",
"tests/LB+rel+CAS.litmus",
"tests/LB+CSEL-... | 0 | 0 | 0 | 0 | 0 | 0 |
language-python-test/test/features/tail_call/tail_call_class_constructor.py | wbadart/language-python | 137 | 3252832 | <reponame>wbadart/language-python
# a tail call to a class constructor
class C(): pass
def f():
g ()
return 0
def g():
if True:
return C()
# should never get here
print("should not be here")
print(f())
| 0 | 0 | 0 | 0 | 0 | 0 |
Packs/Rundeck/Integrations/Rundeck/Rundeck.py | diCagri/content | 799 | 3252839 | <reponame>diCagri/content
import demistomock as demisto
from CommonServerPython import *
import urllib3
import traceback
from typing import Any, Dict, Optional, Union
import ntpath
from dateparser import parse
# Disable insecure warnings
urllib3.disable_warnings()
""" CONSTANTS """
VERSION = 24
MAX_RESULTS = 100
"... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/integration/test_initialization_integration.py | sYnfo/bellybutton | 236 | 3252875 | <filename>tests/integration/test_initialization_integration.py<gh_stars>100-1000
"""Integration tests for bellybutton/initialization.py"""
try:
from io import BytesIO
except ImportError:
from StringIO import StringIO as BytesIO
import pytest
from bellybutton import initialization, parsing
@pytest.mark.para... | 0 | 0 | 0 | 0 | 0 | 0 |
graphql_compiler/cost_estimation/int_value_conversion.py | manesioz/graphql-compiler | 521 | 3252890 | # Copyright 2019-present Kensho Technologies, LLC.
"""Int value conversion.
This module is a utility for reasoning about intervals when computing filter selectivities,
and generating parameters for pagination. Since integers are the easiest type to deal with
in this context, when we encounter a different type we repre... | 12 | 4 | 0 | 0 | 16 | 0 |
Z - Tool Box/LaZagne/Mac/lazagne/softwares/system/chainbreaker_module/chainbreaker.py | dfirpaul/Active-Directory-Exploitation-Cheat-Sheet-1 | 1,290 | 3252894 | <gh_stars>1000+
#!/usr/bin/python
# Author : n0fate
# E-Mail <EMAIL>, <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 Free Software Foundation; either version 2 of the License, or (at
# your option) any later ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit_tests/v1/test_system_backend_methods.py | reimerp/hvac | 544 | 3252895 | <gh_stars>100-1000
from unittest import TestCase
import requests_mock
from parameterized import parameterized
from hvac import Client
class TestSystemBackendMethods(TestCase):
"""Unit tests providing coverage for Vault system backend-related methods in the hvac Client class."""
@parameterized.expand(
... | 0 | 0 | 0 | 0 | 0 | 0 |
mayan/apps/motd/tests/test_models.py | eshbeata/open-paperless | 2,743 | 3252898 | <filename>mayan/apps/motd/tests/test_models.py
from __future__ import unicode_literals
from datetime import timedelta
from django.test import TestCase
from django.utils import timezone
from ..models import Message
from .literals import TEST_LABEL, TEST_MESSAGE
class MOTDTestCase(TestCase):
def setUp(self):
... | 0 | 0 | 0 | 0 | 0 | 0 |
robo/acquisition_functions/lcb.py | lebrice/RoBO | 455 | 3252900 | from __future__ import annotations
import logging
import numpy as np
from robo.acquisition_functions.base_acquisition import BaseAcquisitionFunction
logger = logging.getLogger(__name__)
class LCB(BaseAcquisitionFunction):
def __init__(self, model, par: float=1.0):
r"""
The lower confidence bou... | 2 | 1 | 0 | 0 | 3 | 0 |
examples/euro/ex2.py | RalphWalters/thredo | 340 | 3252901 | # Example 2: Real threads
import thredo
def func(n, label) -> object:
total = 0
while n > 0:
total += n
n -= 1
if n % 10_000_000 == 0:
print(label, n)
return total
def main():
t1 = thredo.spawn(func, 60_000_000, 'thread-1')
t2 = thredo.spawn(func, 40_000_00... | 0 | 1 | 0 | 0 | 1 | 0 |
morepath/tests/fixtures/scenario/view.py | hugovk/morepath | 314 | 3252964 | <filename>morepath/tests/fixtures/scenario/view.py
from . import model
from . import app
@app.Root.json(model=model.RootRoot)
def root_root_default(self, request):
return [
request.link(model.GenericModel("a", "foo")),
request.link(model.DocumentModel("b")),
]
@app.Generic.view(model=model.G... | 0 | 0 | 0 | 0 | 0 | 0 |
calvin/actorstore/systemactors/media/FaceFinder.py | gabrielcercel/calvin-base | 334 | 3252996 | # -*- coding: utf-8 -*-
# Copyright (c) 2016-17 Ericsson AB
#
# 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... | 0 | 1 | 4 | 0 | 5 | 0 |
src/lib/error_logger.py | shah0lin/data | 316 | 3253043 | <reponame>shah0lin/data<filename>src/lib/error_logger.py
# Copyright 2020 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
#
# Un... | 0 | 0 | 0 | 0 | 0 | 0 |
generalization/ThreeDMatch-to-ETH/preparation.py | zeta1999/SpinNet | 166 | 3253048 | <reponame>zeta1999/SpinNet<gh_stars>100-1000
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import time
import numpy as np
import torch
import shutil
import torch.nn as nn
import glob
import sys
sys.path.append('../../')
import script.common as cm
import open3d
from ThreeDMatch.Test.tools import get_pcd, get_ETH_... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/integration/models/conftest.py | satrialoka/trieste | 119 | 3253049 | # Copyright 2021 The Trieste Contributors
#
# 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... | 1 | 2 | 0 | 0 | 3 | 0 |
setup.py | gmr/queries | 174 | 3253052 | import os
import platform
import setuptools
# PYPY vs cpython
if platform.python_implementation() == 'PyPy':
install_requires = ['psycopg2cffi>=2.7.2,<3']
else:
install_requires = ['psycopg2>=2.5.1,<3']
# Install tornado if generating docs on readthedocs
if os.environ.get('READTHEDOCS', None) == 'True':
... | 0 | 0 | 0 | 0 | 0 | 0 |
skater/core/local_interpretation/dnni/initializer.py | RPUTHUMA/Skater | 718 | 3253063 | <gh_stars>100-1000
# -*- coding: UTF-8 -*-
import warnings
import numpy as np
from tensorflow.python.ops import nn_grad, math_grad
from skater.util.logger import build_logger
from skater.util.logger import _INFO
class Initializer(object):
"""
"""
__name__ = "Initializer"
# Currently supported Activat... | 0 | 0 | 0 | 0 | 0 | 0 |
bricknil/ble_queue.py | ElTentakel/bricknil | 103 | 3253091 | <gh_stars>100-1000
# Copyright 2019 <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 t... | 0 | 0 | 0 | 0 | 0 | 0 |
opendatatools/usstock/__init__.py | solider245/OpenData | 1,179 | 3253111 | # encoding: utf-8
from .usstock_interface import * | 0 | 0 | 0 | 0 | 0 | 0 |
Python3/1309.py | rakhi2001/ecom7 | 854 | 3253155 | __________________________________________________________________________________________________
sample 8 ms submission
class Solution:
def freqAlphabets(self, s: str) -> str:
n = len(s)
i = 0
ans = []
while i < n:
if i + 2 < n and s[i + 2] == '#':
num =... | 0 | 0 | 0 | 0 | 0 | 0 |
components/mpas-seaice/testing_and_setup/testcases/square/square_hex_sb/run_square_hex_sb_testcase.py | Fa-Li/E3SM | 235 | 3253161 | from create_grids import create_grids
from create_boundary_info import create_boundary_info
from create_ic import create_ic
from run_model import run_model
from plot_testcase import plot_testcase
#-------------------------------------------------------------------------------
def run_square_hex_sb_testcase():
cr... | 0 | 0 | 0 | 0 | 0 | 0 |
steps.py | behnam-samadi/HE_time_series | 1,018 | 3253192 | from __future__ import annotations
from typing import Callable
import numpy as np
from neuraxle.base import NonFittableMixin, BaseStep, Identity, ExecutionContext
from neuraxle.data_container import DataContainer
from neuraxle.steps.output_handlers import InputAndOutputTransformerMixin
from neuraxle.union import Featu... | 5 | 4 | 0 | 0 | 9 | 0 |
lstm_classifier/t2e/config.py | undeadyequ/ser_model | 217 | 3253202 | <reponame>undeadyequ/ser_model<filename>lstm_classifier/t2e/config.py
import torch
import pickle
import gensim
from create_vocab import Vocabulary, create_vocab
model_config = {
'gpu': 1,
'<PAD>': 0,
'<SOS>': 1,
'<EOS>': 2,
'<UNK>': 3,
'n_layers': 2,
'dropout': 0.2,
'output_dim': 6, # ... | 0 | 0 | 0 | 0 | 0 | 0 |
demo_tensorflow_story.py | renjunxiang/Text_Generate | 101 | 3253203 | from generate_text import train_tensorflow, generate_tensorflow
import os
import tensorflow as tf
DIR = os.path.dirname(os.path.abspath(__file__))
# train_tensorflow(mode='length', file='story',
# len_min=10, len_max=200,
# maxlen=200, num_words=20000,
# num_units=12... | 0 | 0 | 0 | 0 | 0 | 0 |
dreamer/algos/replay.py | huy-ha/dreamer-pytorch | 148 | 3253231 | from rlpyt.replays.sequence.uniform import UniformSequenceReplayBuffer
from rlpyt.utils.collections import namedarraytuple
SamplesToBuffer = namedarraytuple("SamplesToBuffer",
["observation", "action", "reward", "done"])
def initialize_replay_buffer(self, examples, batch_spec, async... | 1 | 2 | 0 | 0 | 3 | 0 |
stonesoup/models/transition/tests/test_cv.py | Red-Portal/Stone-Soup-1 | 157 | 3253258 | <filename>stonesoup/models/transition/tests/test_cv.py
# coding: utf-8
import datetime
from pytest import approx
import numpy as np
from scipy.stats import multivariate_normal
from ..linear import ConstantVelocity
from ....types.state import State
def test_cvmodel():
""" ConstanVelocity Transition Model test ""... | 0 | 0 | 0 | 0 | 0 | 0 |
configs/seg/baselines/deeplabv3_r50-d8_512x512_80k_8x2_adamw_ade20k.py | yinchimaoliang/K-Net | 361 | 3253261 | _base_ = [
'../_base_/models/deeplabv3_r50-d8.py', '../_base_/datasets/ade20k.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_adamw_80k.py'
]
model = dict(
decode_head=dict(num_classes=150), auxiliary_head=dict(num_classes=150))
data = dict(samples_per_gpu=2, workers_per_gpu=2)
| 0 | 0 | 0 | 0 | 0 | 0 |
src/ebonite/ext/lightgbm/requirement.py | zyfra/ebonite | 270 | 3253263 | <filename>src/ebonite/ext/lightgbm/requirement.py<gh_stars>100-1000
from ebonite.core.analyzer.requirement import RequirementHook
from ebonite.core.objects.requirements import InstallableRequirement, Requirement, Requirements, UnixPackageRequirement
class LightGBMRequirementHook(RequirementHook):
def can_process(... | 0 | 0 | 0 | 0 | 0 | 0 |
modoboa/admin/migrations/0004_auto_20160914_0907.py | HarshCasper/modoboa | 1,602 | 3253284 | <reponame>HarshCasper/modoboa
# Generated by Django 1.9.9 on 2016-09-14 09:07
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('admin', '0003_auto_20151118_1215'),
]
operations = [
migrations.CreateModel(
... | 0 | 0 | 0 | 0 | 0 | 0 |
release/stubs.min/Autodesk/Revit/DB/__init___parts/TessellatedBuildIssueType.py | htlcnn/ironpython-stubs | 182 | 3253309 | <reponame>htlcnn/ironpython-stubs
class TessellatedBuildIssueType(Enum,IComparable,IFormattable,IConvertible):
"""
Issues,which can be encountered while building a polymesh,
or a shell,or a solid from data,describing
tessellated shapes.
enum TessellatedBuildIssueType,values: AllFine (0),Degen... | 0 | 0 | 0 | 0 | 0 | 0 |
macropy/core/test/macros/basic_block_macro.py | CyberFlameGO/macropy | 2,061 | 3253331 | <reponame>CyberFlameGO/macropy<gh_stars>1000+
import macropy.core
import macropy.core.macros
macros = macropy.core.macros.Macros()
@macros.block
def my_macro(tree, target, **kw):
assert macropy.core.unparse(target) == "y"
assert macropy.core.unparse(tree).strip() == "x = (x + 1)", macropy.core.unparse(tree)
... | 0 | 0 | 0 | 0 | 0 | 0 |
llvm/utils/lit/lit/BooleanExpression.py | mkinsner/llvm | 2,338 | 3253348 | from __future__ import annotations
import re
class BooleanExpression:
# A simple evaluator of boolean expressions.
#
# Grammar:
# expr :: or_expr
# or_expr :: and_expr ('||' and_expr)*
# and_expr :: not_expr ('&&' not_expr)*
# not_expr :: '!' not_expr
# ... | 2 | 6 | 0 | 2 | 10 | 0 |
test/testZ3.py | jeanqasaur/jeeves | 253 | 3253356 | import macropy.activate
from smt.Z3 import *
from fast import AST
import unittest
class TestZ3(unittest.TestCase):
def setUp(self):
self.s = Z3()
def test_sat_ints(self):
x = self.s.getIntVar('x')
self.s.solverAssert(x > 0)
self.s.solverAssert(x < 2)
self.assertTrue(self.s.isSatisfiable())
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/genie/libs/parser/iosxe/tests/ShowLogging/cli/equal/golden_output_5_expected.py | balmasea/genieparser | 204 | 3253379 | expected_output = {
"log_buffer_bytes": 512000,
"logging": {
"buffer": {
"filtering": "disabled",
"level": "debugging",
"messages_logged": 9789,
"status": "enabled",
"xml": "disabled"
},
"console": {
"filtering": "disabled",
"level": "debugging",
"messages... | 0 | 0 | 0 | 0 | 0 | 0 |
winapi__windows__ctypes/hibernate_win7.py | DazEB2/SimplePyScripts | 117 | 3253385 | <reponame>DazEB2/SimplePyScripts
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
"""Скрипт отправляет win7 в режим гибернации (спящий режим)"""
try:
import sys
if len(sys.argv) > 1:
seconds_delay = int(sys.argv[1])
import time
while seconds_delay > 0:
... | 0 | 0 | 0 | 0 | 0 | 0 |
metadrive/tests/test_functionality/test_bicycle_model.py | liuzuxin/metadrive | 125 | 3253411 | <filename>metadrive/tests/test_functionality/test_bicycle_model.py
import numpy as np
from metadrive.component.vehicle_model.bicycle_model import BicycleModel
from metadrive.envs.metadrive_env import MetaDriveEnv
from metadrive.utils import setup_logger
from metadrive.utils.math_utils import norm
def predict(current... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/issue0030.py | schra/pcpp | 146 | 3253451 | from __future__ import absolute_import, print_function
import unittest, sys
shouldbe = r'''#line 1 "tests/issue0030/source3.c"
2
'''
class runner(object):
def runTest(self):
from pcpp import CmdPreprocessor
p = CmdPreprocessor(['pcpp', '-o', 'tests/issue0030.c',
'tests... | 0 | 0 | 0 | 0 | 0 | 0 |
confidnet/models/small_convnet_mnist.py | luoyan407/predict_trustworthiness_smallscale | 149 | 3253489 | <reponame>luoyan407/predict_trustworthiness_smallscale<filename>confidnet/models/small_convnet_mnist.py<gh_stars>100-1000
import torch.nn as nn
import torch.nn.functional as F
from confidnet.models.model import AbstractModel
class SmallConvNetMNIST(AbstractModel):
def __init__(self, config_args, device):
... | 0 | 0 | 0 | 0 | 0 | 0 |
kafka_influxdb/reader/reader.py | gldnspud/kafka-influxdb | 224 | 3253496 | <reponame>gldnspud/kafka-influxdb
import logging
from kafka_influxdb.encoder.errors import EncoderError
class ReaderAbstract(object):
"""
A Kafka consumer based on kafka-python
See: https://github.com/dpkp/kafka-python
"""
# We need to treat legacy Kafka Versions (< 0.9.0) a little different.
... | 0 | 0 | 0 | 0 | 0 | 0 |
muddery/server/database/worlddata/event_data.py | dongwudanci/muddery | 127 | 3253505 | <gh_stars>100-1000
"""
Query and deal common tables.
"""
from muddery.server.database.worlddata.base_query import BaseQuery
from muddery.server.database.worlddata.worlddata import WorldData
class EventData(BaseQuery):
"""
Object's event data.
"""
table_name = "event_data"
@classmethod
def ge... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.