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 |
|---|---|---|---|---|---|---|---|---|---|---|
mmdet/models/dense_heads/corner_head.py | jiangrongatrobo/mmdetection | 278 | 3217875 | <gh_stars>100-1000
from math import ceil, log
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, bias_init_with_prob
from mmcv.ops import CornerPool, batched_nms
from mmdet.core import multi_apply
from ..builder import HEADS, build_loss
from ..utils import gaussian_rad... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/migrations/migrations_test_apps/lookuperror_b/models.py | ni-ning/django | 61,676 | 3217898 | <reponame>ni-ning/django
from django.db import models
class B1(models.Model):
pass
class B2(models.Model):
a1 = models.ForeignKey('lookuperror_a.A1', models.CASCADE)
class B3(models.Model):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
book/src/ch04/src/isp.py | zangyuchen2008/Clean-Code-in-Python-Second-Edition | 133 | 3217904 | <gh_stars>100-1000
"""Clean Code in Python - Second edition
Chapter 04 - The SOLID Principles
ISP: Interface Segregation Principle
"""
from abc import ABCMeta, abstractmethod
class XMLEventParser(metaclass=ABCMeta):
@abstractmethod
def from_xml(xml_data: str):
"""Parse an event from a source in XML ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/gpuarray/test_scan.py | fshart/aesara | 111 | 3217910 | <reponame>fshart/aesara
import numpy as np
import pytest
import aesara
import aesara.sandbox.rng_mrg
from aesara import gpuarray
from aesara import tensor as aet
from aesara.gpuarray.basic_ops import GpuFromHost, HostFromGpu
from aesara.gpuarray.elemwise import GpuElemwise
from aesara.scan.basic import scan
from aesar... | 0 | 0 | 0 | 0 | 0 | 0 |
elegantrl/envs/utils/marl_utils.py | XFFXFF/ElegantRL | 129 | 3217914 | import logging
import operator
from collections import defaultdict
import torch as th
import torch.nn as nn
from torch.distributions import Categorical
class DecayThenFlatSchedule:
def __init__(self, start, finish, time_length, decay="exp"):
self.start = start
self.finish = finish
self.t... | 0 | 0 | 0 | 0 | 0 | 1 |
powerline/bindings/bar/powerline-bar.py | MrFishFinger/powerline | 11,435 | 3217923 | <reponame>MrFishFinger/powerline<filename>powerline/bindings/bar/powerline-bar.py
#!/usr/bin/env python
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import os
import sys
import time
from threading import Lock, Timer
from argparse import ArgumentPar... | 0 | 0 | 0 | 0 | 0 | 0 |
Game21/modules/interfaces/endinterface.py | tkq111/1 | 4,013 | 3217934 | '''
Function:
定义游戏结束界面
Author:
Charles
微信公众号:
Charles的皮卡丘
'''
import sys
import pygame
'''结束界面'''
def endInterface(screen, end_image_path, again_image_paths, score_info, font_path, font_colors, screensize) -> bool:
end_image = pygame.image.load(end_image_path)
again_images = [pygame.image.load(aga... | 0 | 1 | 0 | 0 | 1 | 0 |
barbican/plugin/simple_certificate_manager.py | mail2nsrajesh/barbican | 177 | 3217952 | <gh_stars>100-1000
# 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, software
# di... | 0 | 0 | 0 | 0 | 0 | 0 |
cli/polygonetl/enumeration/entity_type.py | cffls/polygon-etl | 1,482 | 3217961 | <reponame>cffls/polygon-etl
class EntityType:
BLOCK = 'block'
TRANSACTION = 'transaction'
RECEIPT = 'receipt'
LOG = 'log'
TOKEN_TRANSFER = 'token_transfer'
TRACE = 'trace'
CONTRACT = 'contract'
TOKEN = 'token'
ALL_FOR_STREAMING = [BLOCK, TRANSACTION, LOG, TOKEN_TRANSFER, TRACE, CONT... | 0 | 0 | 0 | 0 | 0 | 0 |
VSR/Backend/TF/Models/SrGan.py | Kadantte/VideoSuperResolution | 1,447 | 3217965 | <filename>VSR/Backend/TF/Models/SrGan.py
"""
Copyright: <NAME> 2017-2018
Author: <NAME>
Email: <EMAIL>
Created Date: May 17th 2018
Updated Date: May 25th 2018
SRGAN implementation (CVPR 2017)
See https://arxiv.org/abs/1609.04802
"""
from .. import tf
from ..Arch import Discriminator
from ..Framework.GAN import loss_b... | 0 | 0 | 0 | 0 | 0 | 0 |
hs_app_netCDF/admin.py | tommac7/hydroshare | 178 | 3217986 | from django.contrib.gis import admin
from .models import NetcdfResource
admin.site.unregister(NetcdfResource)
| 0 | 0 | 0 | 0 | 0 | 0 |
dlg/dialogconvert.py | marcelkauf/Meridian59-101 | 214 | 3217998 | <gh_stars>100-1000
# Convert from .tab file format to a sequence of admin commands.
# After recreating the world, e.g. "send o 0 recreate all" (or at initial startup),
# add NPC dialog to the speech library with these commands:
#
# python dialogconvert.py npc1.tab dialog.txt
#
# Blakserv admin command:
# read dialog.tx... | 0 | 0 | 0 | 0 | 0 | 0 |
python/ray/tests/test_failure_3.py | linyiyue/ray | 21,382 | 3218043 | <gh_stars>1000+
import os
import sys
import ray
import numpy as np
import pytest
import time
from ray._private.test_utils import SignalActor
@pytest.mark.parametrize(
"ray_start_cluster_head", [{
"num_cpus": 5,
"object_store_memory": 10**8,
}],
indirect=True)
def test_parallel_actor_fil... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_templating.py | miguelgrinberg/aioflask | 189 | 3218051 | <reponame>miguelgrinberg/aioflask
import asyncio
import os
import unittest
from unittest import mock
import aioflask
from .utils import async_test
class TestTemplating(unittest.TestCase):
@async_test
async def test_template_strng(self):
app = aioflask.Flask(__name__)
app.secret_key = 'secret'
... | 0 | 0 | 0 | 0 | 0 | 0 |
web200-1/exp.py | mehrdad-shokri/CTF_web | 664 | 3218052 | #coding:utf-8
import requests
import re
def RAND_RANGE(__n, __min, __max,__tmax):
return __min+(__max-__min+1.0)*(__n/(__tmax+1.0))
def shuffle(dstr,relist):
strlen = len(dstr)
dstr = bytearray(dstr)
if strlen<=1:
return
n_left = strlen
i=0
while n_left:
n_left -=1
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/sage/manifolds/point.py | UCD4IDS/sage | 1,742 | 3218055 | from __future__ import annotations
r"""
Points of Topological Manifolds
The class :class:`ManifoldPoint` implements points of a
topological manifold.
A :class:`ManifoldPoint` object can have coordinates in
various charts defined on the manifold. Two points are declared
equal if they have the same coordinates in the s... | 14 | 7 | 0 | 1 | 22 | 0 |
tests/build_static_beam.py | RGPATCHI/pymapdl | 194 | 3218068 | <filename>tests/build_static_beam.py<gh_stars>100-1000
"""
Build static beam to grab boundary conditions
"""
import os
from pyansys import examples
import pyansys
os.environ["I_MPI_SHM_LMT"] = "shm" # necessary on ubuntu
mapdl = pyansys.launch_mapdl(override=True, additional_switches="-smp")
mapdl.cdread("db", exam... | 0 | 0 | 0 | 0 | 0 | 0 |
test_project/select2_djhacker_formfield/admin.py | robertispas/django-autocomplete-light | 1,368 | 3218084 | from django.contrib import admin
from .models import TModel
class TestInline(admin.TabularInline):
model = TModel
fk_name: str = 'for_inline'
class TestAdmin(admin.ModelAdmin):
inlines: list[object] = [TestInline]
admin.site.register(TModel, TestAdmin)
| 0 | 0 | 2 | 0 | 2 | 0 |
tests/data/expected/main/main_root_model_with_additional_properties_use_standard_collections/output.py | adaamz/datamodel-code-generator | 891 | 3218114 | # generated by datamodel-codegen:
# filename: root_model_with_additional_properties.json
# timestamp: 2019-07-26T00:00:00+00:00
from __future__ import annotations
from enum import Enum
from typing import Optional, Union
from pydantic import BaseModel, Field
class NestedObjectResult(BaseModel):
status: int... | 0 | 0 | 18 | 0 | 18 | 0 |
koku/api/tags/test/gcp/tests_queries.py | cgoodfred/koku | 157 | 3218119 | <reponame>cgoodfred/koku<filename>koku/api/tags/test/gcp/tests_queries.py
#
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""Test the Report Queries."""
from tenant_schemas.utils import tenant_context
from api.functions import JSONBObjectKeys
from api.iam.test.iam_test_case import IamTestCase
f... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/tutorials/manual_segmentation.py | haoxusci/starfish | 164 | 3218141 | """
.. _tutorial_manual_segmentation:
Loading ImageJ ROI Sets
=======================
.. note::
Starfish only supports importing 2D ROIs.
In order to create a cell by gene expression matrix from image-based transcriptomics data, RNA
spots must be assigned to cells by segmenting an image. The best quality cell se... | 0 | 1 | 0 | 0 | 1 | 0 |
Modules/ftp.py | dev-abir/Dorkify | 124 | 3218151 | <reponame>dev-abir/Dorkify
import sys
import time
import core.search_url as search_url
import core.logo as logo
import core.colors as colors
import core.mods as mods
def ftp():
def ftp_menu():
global ch
mods.clear_screen()
logo.dorkify_logo()
print(f'''
CHOOSE OPTION :
... | 0 | 0 | 0 | 0 | 0 | 0 |
paas-ce/paas/esb/components/generic/templates/qcloud_voice/send_voice_msg.py | canway-bk/bk-PaaS | 767 | 3218168 | <reponame>canway-bk/bk-PaaS
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may no... | 0 | 0 | 0 | 0 | 0 | 0 |
redash/permissions.py | zero1number/redash | 20,680 | 3218180 | <reponame>zero1number/redash<gh_stars>1000+
import functools
from flask_login import current_user
from flask_restful import abort
from funcy import flatten
view_only = True
not_view_only = False
ACCESS_TYPE_VIEW = "view"
ACCESS_TYPE_MODIFY = "modify"
ACCESS_TYPE_DELETE = "delete"
ACCESS_TYPES = (ACCESS_TYPE_VIEW, A... | 0 | 0 | 0 | 0 | 0 | 0 |
qcengine/procedures/model.py | jhrmnn/QCEngine | 105 | 3218202 | import abc
from typing import Any, Dict, Union
from pydantic import BaseModel
from ..util import model_wrapper
class ProcedureHarness(BaseModel, abc.ABC):
name: str
procedure: str
class Config:
allow_mutation: False
extra: "forbid"
def __init__(self, **kwargs):
super().__i... | 7 | 5 | 4 | 0 | 16 | 0 |
im2mesh/oflow/config.py | autonomousvision/occupancy_flow | 146 | 3218223 | <filename>im2mesh/oflow/config.py
import torch
import torch.distributions as dist
from torch import nn
import os
from im2mesh.encoder import encoder_dict, encoder_temporal_dict
from im2mesh.oflow import models, training, generation
from im2mesh import data
def get_decoder(cfg, device, dim=3, c_dim=0, z_dim=0):
''... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_shortcuts.py | KDWSS/convtools-ita | 174 | 3218231 | <filename>tests/test_shortcuts.py
import pytest
from convtools import conversion as c
from convtools.base import Breakpoint
def test_base_zip():
meta = {1: "a", 2: "b", 3: "c"}
input_data = {"items": [1, 2, 3], "meta": meta}
converter = (
c.zip(
c.item("items"),
c.repeat(c... | 0 | 0 | 0 | 0 | 0 | 0 |
observations/r/paulsen.py | hajime9652/observations | 199 | 3218257 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def paulsen(path) -> tuple[object, object]:
"""Neurotransmission in Guine... | 0 | 1 | 0 | 0 | 1 | 0 |
toolchain_build/toolchain_tests.py | cohortfsllc/cohort-cocl2-sandbox | 2,151 | 3218261 | #!/usr/bin/python
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Run all python tests in this directory."""
import sys
import unittest
MODULES = [
'once_test',
'toolchain_main_test',... | 0 | 0 | 0 | 0 | 0 | 0 |
script/bilstm.gate.py | pl8787/textnet-release | 114 | 3218274 | <reponame>pl8787/textnet-release
#-*-coding:utf8-*-
import copy, os
from gen_conf_file import *
from dataset_cfg import *
def gen_gate_bilstm(d_mem, init, lr, dataset):
# print "ORC: left & right lstm share parameters"
is_share = False
net = {}
# dataset = 'tb_fine'
# dataset = 'mr'
if dataset... | 0 | 0 | 0 | 0 | 0 | 0 |
blitzdb/backends/mongo/backend.py | timgates42/blitzdb | 252 | 3218288 | from __future__ import annotations
import logging
import traceback
import uuid
from collections import defaultdict
import pymongo
import six
from blitzdb.backends.base import Backend as BaseBackend
from blitzdb.backends.base import NotInTransaction
from blitzdb.backends.mongo.queryset import QuerySet
from blitzdb.doc... | 18 | 13 | 1 | 1 | 33 | 0 |
tests/python/unittest/test_viz.py | mchoi8739/incubator-mxnet | 228 | 3218292 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 0 | 1 | 0 | 0 | 1 | 0 |
resources/usr/local/lib/python2.7/dist-packages/Cython/Coverage.py | edawson/parliament2 | 110 | 3218314 | <filename>resources/usr/local/lib/python2.7/dist-packages/Cython/Coverage.py
"""
A Cython plugin for coverage.py
Requires the coverage package at least in version 4.0 (which added the plugin API).
"""
from __future__ import absolute_import
import re
import os.path
import sys
from collections import defaultdict
from... | 0 | 0 | 0 | 0 | 0 | 0 |
src/DyldExtractor/macho/macho_constants.py | jelbrek/DyldExtractor | 177 | 3218338 |
"""
The n_type field really contains four fields:
unsigned char N_STAB:3,
N_PEXT:1,
N_TYPE:3,
N_EXT:1;
which are used via the following masks.
"""
N_STAB = 0xe0 # if any of these bits set, a symbolic debugging entry
N_PEXT = 0x10 # private external symbol bit
N_TYPE = 0x0e # mask for the type bits
N_EXT = 0... | 0 | 0 | 0 | 0 | 0 | 0 |
dojo/tool_type/views.py | art-tykh/django-DefectDojo | 1,772 | 3218345 | # # product
import logging
from django.contrib import messages
from django.contrib.auth.decorators import user_passes_test
from django.urls import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render
from dojo.utils import add_breadcrumb
from dojo.forms import ToolTypeForm
from doj... | 0 | 3 | 0 | 0 | 3 | 0 |
striplog/markov.py | bsburnham/striplog | 156 | 3218351 | from __future__ import annotations
"""
Markov chains for the striplog package.
"""
from collections import namedtuple
import numpy as np
import scipy.stats
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.colors as cols
from .utils import hollow_matrix
from .utils import observations
from... | 32 | 26 | 0 | 0 | 58 | 0 |
skfem/element/element_hex/element_hex0.py | reverendbedford/scikit-fem | 238 | 3218355 | <reponame>reverendbedford/scikit-fem
import numpy as np
from ..element_h1 import ElementH1
from ...refdom import RefHex
class ElementHex0(ElementH1):
"""Piecewise constant element."""
interior_dofs = 1
maxdeg = 0
dofnames = ['u']
doflocs = np.array([[.5, .5, .5]])
refdom = RefHex
def lb... | 0 | 0 | 0 | 0 | 0 | 0 |
public/sdks/languages-and-frameworks/python/pkg/envkey/__init__.py | allanice001/envkey | 140 | 3218375 | <gh_stars>100-1000
from .loader import load
from .fetch import fetch_env
from os import environ
get = environ.get
load(is_init=True, cache_enabled=("ENVKEY_SHOULD_CACHE" in environ))
__all__ = ['load', 'fetch_env', 'get']
| 0 | 0 | 0 | 0 | 0 | 0 |
train_mtcnn_LPR/12train_wm_lpr/gen_12net_list.py | ilaotan/License-Plate-Detect-Recognition-via-Deep-Neural-Networks-accuracy-up-to-99.9 | 1,437 | 3218390 | import sys
import os
save_dir = "./12"
if not os.path.exists(save_dir):
os.mkdir(save_dir)
f1 = open(os.path.join(save_dir, 'pos_12.txt'), 'r')
f2 = open(os.path.join(save_dir, 'neg_12.txt'), 'r')
f3 = open(os.path.join(save_dir, 'part_12.txt'), 'r')
pos = f1.readlines()
neg = f2.readlines()
part = f3.readlines()... | 0 | 0 | 0 | 0 | 0 | 0 |
resnet34_doublefilters.py | lijian10086/quantized_distillation | 321 | 3218398 | import os
import torch
import torchvision
import cnn_models.conv_forward_model as convForwModel
import cnn_models.help_fun as cnn_hf
import datasets
import model_manager
from cnn_models.wide_resnet_imagenet import Wide_ResNet_imagenet
import cnn_models.resnet_kfilters as resnet_kfilters
import functools
import quantiza... | 0 | 0 | 0 | 0 | 0 | 0 |
graph_embedding/dmon/train_gcn.py | DionysisChristopoulos/google-research | 23,901 | 3218420 | <filename>graph_embedding/dmon/train_gcn.py
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/testing_config/custom_components/test/binary_sensor.py | domwillcode/home-assistant | 30,023 | 3218482 | from __future__ import annotations
"""
Provide a mock binary sensor platform.
Call init before using it in your tests to ensure clean test data.
"""
from homeassistant.components.binary_sensor import DEVICE_CLASSES, BinarySensorEntity
from tests.common import MockEntity
ENTITIES = {}
def init(empty: bool=False):
... | 2 | 2 | 0 | 0 | 4 | 0 |
tuenti/tuenti-challenge-10/19.py | Ashindustry007/competitive-programming | 506 | 3218505 | #!/usr/bin/env python3
import os
import hashlib
d = dict()
e = 5 # 2
for i in range(10**e):
fn = f'/mnt/cow{str(i).zfill(e)}'
l = os.path.getsize(fn)
with open(fn, 'rb') as f:
offset = f.seek(0, 3)
for i in range(offset, l):
if f.read(1) != b'\x00':
d[i] = d.get(i... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/result_tests.py | app63/python-cloudant | 187 | 3218509 | <filename>tests/unit/result_tests.py
#!/usr/bin/env python
# Copyright (C) 2016, 2018 IBM Corp. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.... | 0 | 0 | 0 | 0 | 0 | 0 |
classification/training/update/WindowClassificationTrainUpdateTransformParam.py | Tessellate-Imaging/Monk_Gui | 129 | 3218510 | import os
import sys
import json
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
class WindowClassificationTrainUpdateTransformParam(QtWidgets.QWidget):
forward_model_param = QtCore.pyqtSignal();
backward_data_param = QtCore.pyqtSignal();
def __init__(self):... | 0 | 0 | 0 | 8 | 8 | 0 |
alipay/aop/api/domain/SignFieldBean.py | antopen/alipay-sdk-python-all | 213 | 3218527 | <reponame>antopen/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.SignerBean import SignerBean
class SignFieldBean(object):
def __init__(self):
self._sign_field_type = None
self._signe... | 0 | 0 | 0 | 0 | 0 | 0 |
old_py2/tests/test_event_get_short_name.py | guineawheek/ftc-data-take-2 | 266 | 3218543 | <reponame>guineawheek/ftc-data-take-2<filename>old_py2/tests/test_event_get_short_name.py
import unittest2
from google.appengine.ext import ndb
from google.appengine.ext import testbed
from helpers.district_manipulator import DistrictManipulator
from helpers.event_helper import EventHelper
from models.district import... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/puppet3/modules/php/files/agent/plugins/PhpServerStarterPlugin.py | TanJay/stratos | 127 | 3218544 | <gh_stars>100-1000
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "Licen... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/dbnd/src/dbnd/_core/settings/engine.py | busunkim96/dbnd | 224 | 3218550 | from __future__ import annotations
import logging
import sys
import typing
from typing import Union
from dbnd._core.errors.friendly_error.executor_k8s import (
local_engine_not_accept_remote_jobs,
)
from dbnd._core.parameter.parameter_builder import parameter
from dbnd._core.task import config
from dbnd._core.tas... | 2 | 5 | 1 | 0 | 8 | 0 |
tests/components/laundrify/conftest.py | liangleslie/core | 30,023 | 3218572 | <filename>tests/components/laundrify/conftest.py
"""Configure py.test."""
import json
from unittest.mock import patch
import pytest
from .const import VALID_ACCESS_TOKEN, VALID_ACCOUNT_ID
from tests.common import load_fixture
@pytest.fixture(name="laundrify_setup_entry")
def laundrify_setup_entry_fixture():
""... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/e2e-tests.py | klueska/gpu-feature-discovery | 120 | 3218573 | #!/usr/bin/env python3
import re
import sys
import time
import yaml
from kubernetes import client, config, watch
def get_expected_labels_regexs() -> object:
with open("./expected-output.txt") as f:
expected_labels = f.readlines()
return [re.compile(label.strip()) for label in expected_labels]
... | 0 | 2 | 0 | 0 | 2 | 0 |
tests/resources/example_docker_project/scripts/docker_tracking_test.py | PeterSulcs/mlflow | 10,351 | 3218581 | <gh_stars>1000+
""" Example script that calls tracking APIs within / outside of a start_run() block. """
import mlflow
import sys
import tempfile
def call_tracking_apis():
mlflow.log_metric("some_key", 3)
with tempfile.NamedTemporaryFile("w") as temp_file:
temp_file.write("Temporary content.")
... | 0 | 0 | 0 | 0 | 0 | 0 |
spf/core/gather.py | mehrdad-shokri/SPF | 450 | 3218630 | <reponame>mehrdad-shokri/SPF
#!/usr/bin/env python3
import re
import urllib.request, urllib.parse, urllib.error
import urllib.request, urllib.error, urllib.parse
from core.parser import Parser
from core.display import Display, ProgressBar
class Gather():
def __init__(self, domain, display=None):
self.doma... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/train/dataset/imagenetvid.py | tzhhhh123/Stark | 376 | 3218655 | <reponame>tzhhhh123/Stark
import os
from .base_video_dataset import BaseVideoDataset
from lib.train.data import jpeg4py_loader
import xml.etree.ElementTree as ET
import json
import torch
from collections import OrderedDict
from lib.train.admin import env_settings
def get_target_to_image_ratio(seq):
anno = torch.T... | 0 | 0 | 0 | 0 | 0 | 0 |
bindings/bindingtester/tests/test_util.py | nik-io/foundationdb | 11,024 | 3218656 | #
# test_util.py
#
# This source file is part of the FoundationDB open source project
#
# Copyright 2013-2018 Apple Inc. and the FoundationDB project 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 ... | 2 | 11 | 0 | 1 | 14 | 0 |
train_nth_farthest.py | alexmlamb/relational-rnn-pytorch | 257 | 3218657 | """
Implementation of 'Nth Farthest' task
as defined in Santoro, Faulkner and Raposo et. al., 2018
(Relational recurrent neural networks, https://arxiv.org/abs/1806.01822)
Note: The training data is re-generated each epoch as in the
Sonnet implementation. This avoids overfitting but means that the
experiments may take... | 3 | 6 | 0 | 7 | 16 | 0 |
models/medium/video/tv.py | billvsme/videoSpider | 216 | 3218670 | # -*- coding: utf-8 -*-
from sqlalchemy import Table
from sqlalchemy import Column, Integer, ForeignKey
from sqlalchemy.orm import relationship
from models import Base
from .video import Video
tv_genre_table = Table(
'tvs_genres_association',
Base.metadata,
Column('tv_id', Integer, ForeignKey('tvs.id')),
... | 0 | 0 | 2 | 0 | 2 | 0 |
components/isceobj/Planet/AstronomicalHandbook.py | vincentschut/isce2 | 1,133 | 3218690 | #!/usr/bin/env python3
from __future__ import annotations
import math
import collections
## Const Constants are now module constants
pi = math.pi
m = 1.0
kg = 1.0
s = 1.0
K = 1.0
rad = 1.0
km = 1000.0 * m
hour = 3600.0 * s
day = 24.0 * hour
deg = (math.pi/180.0) * rad
Watt = 1.0 * kg * m**2 / s**3
G = 6.6742E-11 * m**... | 1 | 8 | 0 | 0 | 9 | 0 |
detection_infer_speed.py | shouwangzhe134/simpledet | 3,195 | 3218731 | <reponame>shouwangzhe134/simpledet
import argparse
import importlib
import time
from utils.patch_config import patch_config_as_nothrow
from core.detection_module import DetModule
import mxnet as mx
def parse_args():
parser = argparse.ArgumentParser(description='Test detector inference speed')
# general
p... | 0 | 0 | 0 | 0 | 0 | 0 |
FGO-py/fgoServerChann.py | ACPudding/FGO-py | 420 | 3218734 | from __future__ import annotations
from requests import post
class ServerChann:
def __init__(self,scKey):
self.scKey=scKey
def __call__(self,msg) -> bool | object:
try:return post(f'https://sctapi.ftqq.com/{self.scKey}.send',data={
'title':'FGO-py',
'desp':msg
}).... | 0 | 1 | 0 | 0 | 1 | 0 |
takeover.py | bbhunter/takeover-1 | 688 | 3218745 | <reponame>bbhunter/takeover-1
#!/usr/bin/env python3
# takeover - subdomain takeover finder
# coded by M'hamed (@m4ll0k) Outaadi
import os
import json
import requests
import urllib.parse
import concurrent.futures as thread
import urllib3
import getopt
import sys
import re
r = '\033[1;31m'
g = '\033[1;32m'
y = '\033[... | 0 | 0 | 0 | 0 | 0 | 0 |
src/python/grapl_analyzerlib/tests/test_engagement.py | msilvey/grapl | 313 | 3218749 | import unittest
import pytest
from grapl_analyzerlib.prelude import GraphClient
from grapl_analyzerlib.nodes.engagement import EngagementView
@pytest.mark.integration_test
class TestEngagement(unittest.TestCase):
def test_get_or_create(self) -> None:
client = GraphClient()
engagement = Engagement... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/test_sklearn_wrapper.py | ragrawal/baikal | 622 | 3218762 | import pytest
import sklearn.decomposition
import sklearn.linear_model
from numpy.testing import assert_array_equal
from sklearn import datasets
from sklearn.model_selection import GridSearchCV, StratifiedKFold
from sklearn.pipeline import Pipeline
from baikal import Model, Input
from baikal.sklearn import SKLearnWrap... | 0 | 4 | 0 | 0 | 4 | 0 |
test/rxd/test_rangevarplot.py | shhong/nrn | 203 | 3218789 | from __future__ import annotations
import pytest
import gc
@pytest.fixture
def model_rangevarplot(neuron_instance) -> int | tuple[object, object, object, object]:
h, rxd, data, save_path = neuron_instance
def make_rvp(with_sec: bool=True, with_species: bool=True) -> int | tuple[object, object, object, object... | 2 | 3 | 0 | 0 | 5 | 0 |
f5/bigiq/resource.py | nghia-tran/f5-common-python | 272 | 3218799 | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 0 | 3 | 0 | 0 | 3 | 0 |
src/mtrl/experiment/dmcontrol.py | NagisaZj/ac-teach | 129 | 3218804 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""Class to interface with an Experiment"""
from typing import List
import numpy as np
from mtenv.utils.types import ObsType
from mtrl.agent import utils as agent_utils
from mtrl.env.vec_env import VecEnv # type: ignore[attr-defined]
from mtrl.e... | 7 | 1 | 0 | 0 | 8 | 0 |
chainer-1.5/util/generators.py | ysadamori/chainer_LSTM_seq2seq_example | 137 | 3218844 | def batch(generator, batch_size):
batch = []
is_tuple = False
for l in generator:
is_tuple = isinstance(l, tuple)
batch.append(l)
if len(batch) == batch_size:
yield tuple(list(x) for x in zip(*batch)) if is_tuple else batch
batch = []
if batch:
yie... | 1 | 0 | 0 | 0 | 1 | 0 |
.github/workflows/data-check/conftest.py | lucascr91/mais | 290 | 3218853 | # -------------------------------------
# Execute at Collection Time
# -------------------------------------
# Gets jinja templates and fills them
# with data from table_config.yaml, then
# generate tests with different configs
# -------------------------------------
import csv
import json
import os
from pathlib impo... | 2 | 3 | 0 | 0 | 5 | 0 |
Lib/lib2to3/tests/data/fixers/myfixes/fix_preorder.py | shawwn/cpython | 52,316 | 3218862 | <filename>Lib/lib2to3/tests/data/fixers/myfixes/fix_preorder.py<gh_stars>1000+
from lib2to3.fixer_base import BaseFix
class FixPreorder(BaseFix):
order = "pre"
def match(self, node): return False
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/suite/test_watch_namespace.py | snebel29/kubernetes-ingress | 3,803 | 3218887 | <gh_stars>1000+
import requests
import pytest
from suite.resources_utils import ensure_connection_to_public_endpoint, create_items_from_yaml, create_example_app, \
wait_until_all_pods_are_ready, ensure_response_from_backend, create_namespace_with_name_from_yaml, delete_namespace
from suite.yaml_utils import get_fi... | 0 | 0 | 0 | 0 | 0 | 0 |
src/pytorch_metric_learning/losses/arcface_loss.py | cwkeam/pytorch-metric-learning | 4,357 | 3218891 | import numpy as np
import torch
from ..utils import common_functions as c_f
from .large_margin_softmax_loss import LargeMarginSoftmaxLoss
class ArcFaceLoss(LargeMarginSoftmaxLoss):
"""
Implementation of https://arxiv.org/pdf/1801.07698.pdf
"""
def __init__(self, *args, margin: float=28.6, scale: int... | 2 | 2 | 0 | 0 | 4 | 0 |
third_party/tensorflow-text/src/tools/wordpiece_vocab/generate_vocab.py | zealoussnow/chromium | 575 | 3218918 | # coding=utf-8
# Copyright 2021 TF.Text 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 ag... | 1 | 3 | 0 | 0 | 4 | 0 |
actions/tests/test_models.py | Akash1S/meethub | 428 | 3218923 | from django.test import TestCase
from django.contrib.auth.models import User
from actions.models import Action
class ActionModelTest(TestCase):
@classmethod
def setUpTestData(cls):
user = User.objects.create_user(username='iyanu', password=<PASSWORD>)
action = Action.objects.create(user = u... | 0 | 0 | 0 | 0 | 0 | 0 |
pygmt/tests/test_grdclip.py | weiji14/gmt-python | 168 | 3218931 | <gh_stars>100-1000
"""
Tests for grdclip.
"""
import os
import pytest
import xarray as xr
from pygmt import grdclip, load_dataarray
from pygmt.helpers import GMTTempFile
from pygmt.helpers.testing import load_static_earth_relief
@pytest.fixture(scope="module", name="grid")
def fixture_grid():
"""
Load the gr... | 0 | 0 | 0 | 0 | 0 | 0 |
config/oauth.py | Grace-codes/TechStruck-Bot | 249 | 3218947 | from pydantic import BaseSettings
class StackOAuthConfig(BaseSettings):
client_id: str
client_secret: str
redirect_uri: str
key: str
class Config:
env_file: str = ".env"
env_prefix: str = "stackexchange_"
class GithubOAuthConfig(BaseSettings):
client_id: str
client_secre... | 0 | 0 | 11 | 0 | 11 | 0 |
rednose/helpers/feature_handler.py | shoes22/openpilot | 251 | 3218988 | <reponame>shoes22/openpilot<gh_stars>100-1000
#!/usr/bin/env python3
import os
import sys
import numpy as np
from rednose.helpers import TEMPLATE_DIR, load_code, write_code
from rednose.helpers.sympy_helpers import quat_matrix_l, rot_matrix
def sane(track):
img_pos = track[1:, 2:4]
diffs_x = abs(img_pos[1:, 0]... | 0 | 0 | 0 | 0 | 0 | 0 |
util/stat/is_exec/is_exec.py | byamao1/HaboMalHunter | 727 | 3219000 | #!/usr/bin/env python
"""
Tencent is pleased to support the open source community by making HaboMalHunter available.
Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in
compliance with the License. You may obtai... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_float.py | rianmcguire/WeasyPrint | 4,512 | 3219003 | <filename>tests/test_float.py
"""
weasyprint.tests.layout
-----------------------
Tests for floating boxes layout.
"""
import pytest
from weasyprint.formatting_structure import boxes
from .testing_utils import assert_no_logs, render_pages
def outer_area(box):
"""Return the (x, y, w, h) rectangle f... | 0 | 0 | 0 | 0 | 0 | 0 |
solutions/python3/445.py | sm2774us/amazon_interview_prep_2021 | 279 | 3219011 | <filename>solutions/python3/445.py
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
s1, s2, s3 = [], [], []
p1, p2 = l1, l2
while p1:
s1.append(p1.val)
p1 = p1.next
while p2:
s2.append(p2.val)
p2 = p2.nex... | 0 | 0 | 0 | 0 | 0 | 0 |
website/notifications/listeners.py | gaybro8777/osf.io | 628 | 3219088 | <filename>website/notifications/listeners.py
import logging
from website.notifications.exceptions import InvalidSubscriptionError
from website.notifications.utils import subscribe_user_to_notifications, subscribe_user_to_global_notifications
from website.project.signals import contributor_added, project_created
from fr... | 0 | 0 | 0 | 0 | 0 | 0 |
im2mesh/encoder/__init__.py | kitakou0313/differentiable_volumetric_rendering | 595 | 3219112 | <filename>im2mesh/encoder/__init__.py
from im2mesh.encoder import conv
encoder_dict = {
'simple_conv': conv.ConvEncoder,
'resnet18': conv.Resnet18,
'resnet34': conv.Resnet34,
'resnet50': conv.Resnet50,
'resnet101': conv.Resnet101,
}
| 0 | 0 | 0 | 0 | 0 | 0 |
unittest/test_Planish.py | baidu/broc | 127 | 3219124 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
#
# Copyright (c) 2015 Baidu.com, Inc. All Rights Reserved
#
################################################################################
"""
test case for Planish
Authors: liruih... | 0 | 0 | 0 | 0 | 0 | 0 |
data_processing/html_scraper.py | abhishekkrthakur/clickbaits_revisited | 191 | 3219135 | <filename>data_processing/html_scraper.py<gh_stars>100-1000
# coding: utf-8
"""
Scrape and save html for all links in clickbait and non_clickbait CSVs
@author: <NAME>
"""
import sys
reload(sys)
sys.setdefaultencoding('UTF8')
import pandas as pd
import requests
from joblib import Parallel, delayed
import cPickle
from t... | 0 | 0 | 0 | 0 | 0 | 0 |
exercises/es/exc_03_09_01.py | Jette16/spacy-course | 2,085 | 3219164 | from spacy.lang.es import Spanish
from spacy.tokens import Token
nlp = Spanish()
# Registra la extensión de atributo del Token, "is_country",
# con el valor por defecto False
____.____(____, ____=____)
# Procesa el texto y pon True para el atributo "is_country"
# para el token "España"
doc = nlp("Vivo en España.")
... | 0 | 0 | 0 | 0 | 0 | 0 |
dbaas/maintenance/service/host_maintenance.py | didindinn/database-as-a-service | 303 | 3219179 | from django_services import service
from ..models import HostMaintenance
class HostMaintenanceService(service.CRUDService):
model_class = HostMaintenance
| 0 | 0 | 0 | 0 | 0 | 0 |
base/base.gyp | Scopetta197/chromium | 212 | 3219196 | <filename>base/base.gyp
# Copyright (c) 2012 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.
{
'variables': {
'chromium_code': 1,
},
'includes': [
'../build/win_precompile.gypi',
'base.gypi',
],
'targ... | 0 | 0 | 0 | 0 | 0 | 0 |
deepconcolic/dbnc_pulp.py | nberth/DeepConcolic | 102 | 3219238 | <reponame>nberth/DeepConcolic
from typing import *
from utils import *
from pulp import *
from pulp_encoding import *
from amplif import AnalyzerWithLinearExtrapolation
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA, FastICA
# ---
from engine import LayerLocalAnalyzer, Coverab... | 0 | 0 | 0 | 0 | 0 | 0 |
src/3dgan.py | zhanglang1860/tf-3dgan | 283 | 3219267 | #!/usr/bin/env python
import os
import numpy as np
import tensorflow as tf
import dataIO as d
from tqdm import *
'''
Global Parameters
'''
n_epochs = 10
batch_size = 64
g_lr = 0.0025
d_lr = 0.00001
beta = 0.5
alpha_d = 0.0015
alpha_g = 0.000025
d_thresh = 0.8
z_size = 100
obj ... | 0 | 0 | 0 | 0 | 0 | 0 |
2013/Practice Round/Bad Horse/Bad Horse solution.py | prashantsingh2408/Google-Kick-Start | 237 | 3219302 | <reponame>prashantsingh2408/Google-Kick-Start
T = int(input())
for x in range(1, T + 1):
M = int(input())
pairs = [list(input().split()) for index in range(M)]
y = True
pair = pairs.pop()
members = {pair[0]: True, pair[1]: False}
while pairs:
previous_length = len(pairs)
for inde... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/Lib/site-packages/statsmodels/stats/base.py | EkremBayar/bayar | 6,931 | 3219316 | <reponame>EkremBayar/bayar
# -*- coding: utf-8 -*-
"""Base classes for statistical test results
Created on Mon Apr 22 14:03:21 2013
Author: <NAME>
"""
from statsmodels.compat.python import lzip
import numpy as np
from statsmodels.tools.testing import Holder
class HolderTuple(Holder):
"""Holder class with indexi... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter08/GAN.py | Tanishadel/Mastering-Machine-Learning-for-Penetration-Testing | 241 | 3219328 | <reponame>Tanishadel/Mastering-Machine-Learning-for-Penetration-Testing
import pickle as pkl
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data')
def model_inputs(real_dim, z_dim):
input... | 0 | 0 | 0 | 0 | 0 | 0 |
ceryx/tests/utils.py | insilica/ceryx | 791 | 3219330 | import os
import stat
import subprocess
CERTIFICATE_ROOT = "/usr/local/share/certificates"
EVERYBODY_CAN_READ = stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH
def create_certificates_for_host(host) -> tuple[object, object]:
base_path = f"{CERTIFICATE_ROOT}/{host}"
certificate_path = f"{base_path}.crt"
key_p... | 0 | 1 | 0 | 0 | 1 | 0 |
common/utils.py | cganta/dbtest | 130 | 3219351 | <gh_stars>100-1000
"""
Copyright (c) Microsoft Corporation.
Licensed under the MIT license.
"""
def recursive_find(dict_instance, keys):
if not isinstance(keys, list):
raise ValueError("Expected list of keys")
if not isinstance(dict_instance, dict):
return None
if len(keys) == 0:
re... | 0 | 0 | 0 | 0 | 0 | 0 |
zipline/utils/paths.py | magne-max/zipline | 412 | 3219373 | from __future__ import annotations
"""
Canonical path locations for zipline data.
Paths are rooted at $ZIPLINE_ROOT if that environment variable is set.
Otherwise default to expanduser(~/.zipline)
"""
from errno import EEXIST
import os
from os.path import exists, expanduser, join
import pandas as pd
def hidden(path... | 9 | 11 | 0 | 0 | 20 | 0 |
flask_server/ocr.py | developerVictorNkuna/frontend-tools | 203 | 3219394 | import pytesseract
import requests
from PIL import Image
from PIL import ImageFilter
from StringIO import StringIO
def process_image(url) -> object:
image = _get_image(url)
image.filter(ImageFilter.SHARPEN)
return pytesseract.image_to_string(image)
def _get_image(url) -> object:
return Image.open(St... | 0 | 2 | 0 | 0 | 2 | 0 |
saleor/attribute/migrations/0010_auto_20210412_0736.py | fairhopeweb/saleor | 15,337 | 3219396 | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("attribute", "0009_auto_20210421_0552"),
]
operations: list[object] = [
migrations.AddField(
model_name="attribute",
name="unit",
f... | 0 | 0 | 2 | 0 | 2 | 0 |
conans/model/dependencies.py | Wonders11/conan | 6,205 | 3219405 | from __future__ import annotations
from collections import OrderedDict
from conans.model.conanfile_interface import ConanFileInterface
from conans.model.ref import ConanFileReference
class Requirement(object):
def __init__(self, ref, build: bool=False, direct: bool=True, test: bool=False, visible: bool=True):
... | 5 | 21 | 0 | 0 | 26 | 0 |
src/ralph/networks/migrations/0003_custom_link_ips_to_eth.py | DoNnMyTh/ralph | 1,668 | 3219452 | <filename>src/ralph/networks/migrations/0003_custom_link_ips_to_eth.py<gh_stars>1000+
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def move_from_base_object_to_ethernet(apps, schema_editor):
IPAddress = apps.get_model('networks', 'IPAddress')
Ethern... | 0 | 0 | 0 | 0 | 0 | 0 |
2019/10/17/Some New Features in Python 3.8/fstring.py | kenjitagawa/youtube_video_code | 492 | 3219454 | name = 'Anthony'
favorite_language = 'Python'
#print(f'Name: { name }')
#print(f'Favorite Language: { favorite_language }')
print(f'{name=}')
print(f'{favorite_language=}') | 0 | 0 | 0 | 0 | 0 | 0 |
fairseq/fairseq/data/audio/speech_to_text_dataset.py | zhaoguangxiang/OFA | 16,259 | 3219463 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import annotations
import csv
import io
import logging
import re
from collections import defaultdict
from pathlib import Path
... | 50 | 24 | 6 | 0 | 80 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.