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 |
|---|---|---|---|---|---|---|---|---|---|---|
tests/python_client/scale/helm_env.py | CyberFlameGO/milvus | 10,504 | 3308469 | from __future__ import annotations
import os
from scale import constants
from utils.util_log import test_log as log
from common import common_func as cf
from scale import scale_common as sc
class HelmEnv:
milvus_chart_path = sc.get_milvus_chart_env_var()
def __init__(self, release_name: object | None=None, ... | 1 | 3 | 0 | 0 | 4 | 0 |
external/model-preparation-algorithm/mpa_tasks/apis/classification/config.py | opencv/openvino_training_extensions | 775 | 3308486 | <reponame>opencv/openvino_training_extensions<filename>external/model-preparation-algorithm/mpa_tasks/apis/classification/config.py
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
from attr import attrs
from ote_sdk.configuration.elements import (add_parameter_group,
... | 0 | 0 | 0 | 0 | 0 | 0 |
ryu/tests/unit/lib/test_hub.py | umkcdcrg01/ryu_openflow | 269 | 3308517 | <reponame>umkcdcrg01/ryu_openflow
# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2013 <NAME> <yamamoto at valinux co jp>
#
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
ghostwriter/oplog/tests/test_forms.py | bbhunter/Ghostwriter | 601 | 3308554 | <reponame>bbhunter/Ghostwriter
# Standard Libraries
import logging
# Django Imports
from django.test import TestCase
# Ghostwriter Libraries
from ghostwriter.factories import OplogEntryFactory, OplogFactory, ProjectFactory
from ghostwriter.oplog.forms import OplogEntryForm, OplogForm
logging.disable(logging.CRITICAL... | 0 | 0 | 0 | 0 | 0 | 0 |
discum/stickers/stickers.py | deepestML/Discord-S.C.U.M | 383 | 3308564 | from ..RESTapiwrap import *
class Stickers(object):
__slots__: list[str] = ['discord', 's', 'log']
def __init__(self, discord, s, log): #s is the requests session object
self.discord = discord
self.s = s
self.log = log
def getStickers(self, directoryID, store_listings, locale) -> object:
store_listings = s... | 0 | 4 | 1 | 0 | 5 | 0 |
seahub/adfs_auth/backends.py | samuelduann/seahub | 420 | 3308601 | <filename>seahub/adfs_auth/backends.py<gh_stars>100-1000
# Copyright (c) 2012-2016 Seafile Ltd.
# Copyright (C) 2010-2012 Yaco Sistemas (http://www.yaco.es)
# Copyright (C) 2009 <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the... | 0 | 0 | 0 | 0 | 0 | 0 |
components/gcp/container/component_sdk/python/tests/google/ml_engine/test__create_model.py | nostro-im/pipelines | 2,860 | 3308618 | <filename>components/gcp/container/component_sdk/python/tests/google/ml_engine/test__create_model.py
# 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 writ... | 0 | 0 | 0 | 0 | 0 | 0 |
python/metaparticle_pkg/builder/test/test_docker_builder.py | bwoodhouse322/package | 512 | 3308621 | <reponame>bwoodhouse322/package<filename>python/metaparticle_pkg/builder/test/test_docker_builder.py
#!/usr/bin/env python
'''Unit tests for DockerBuilder'''
from __future__ import absolute_import
import unittest
from unittest.mock import patch
from metaparticle_pkg.builder import docker_builder
class TestDockerBui... | 0 | 0 | 0 | 0 | 0 | 0 |
genalog/ocr/metrics.py | jingjie181/genalog | 185 | 3308626 | <reponame>jingjie181/genalog
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# ---------------------------------------------------------
"""
Utility functions to support getting OCR metrics
OCR Metrics
1. word/ch... | 0 | 0 | 0 | 0 | 0 | 0 |
test/pytest/test_embed.py | AdrianAlan/hls4ml | 380 | 3308631 | import pytest
import hls4ml
import numpy as np
from pathlib import Path
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Embedding
test_root_path = Path(__file__).parent
@pytest.fixture(scope='module')
def data() -> object:
X = np.random.randint(10, size=(32, 100))
return X... | 0 | 3 | 0 | 0 | 3 | 0 |
etl/parsers/etw/Microsoft_Windows_Deduplication_Change.py | IMULMUL/etl-parser | 104 | 3308650 | <filename>etl/parsers/etw/Microsoft_Windows_Deduplication_Change.py
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-Deduplication-Change
GUID : 1d5e499d-739c-45a6-a3e1-8cbe0a352beb
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.util... | 0 | 0 | 0 | 0 | 0 | 0 |
libs/network/test/httplib_acceptance.py | yhager/cpp-netlib | 1,502 | 3308669 | <gh_stars>1000+
# Copyright (c) 2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#!/bin/env python
from sys import argv
from time import sleep
import httplib2 as httplib
from subprocess... | 0 | 0 | 0 | 0 | 0 | 0 |
ts3/filetransfer.py | epichb/py-ts3 | 192 | 3308688 | <filename>ts3/filetransfer.py
#!/usr/bin/env python3
# The MIT License (MIT)
#
# Copyright (c) 2013-2018 <see AUTHORS.txt>
#
# 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 restricti... | 0 | 0 | 0 | 0 | 0 | 0 |
tempy/tags.py | maalbano/TemPy | 154 | 3308713 | <filename>tempy/tags.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
@author: <NAME> <<EMAIL>>
All the HTML tags as defined in the W3C reference, in alphabetical order.
"""
from .elements import Tag, VoidTag
DOCTYPES = {
"html": "HTML",
"html_strict": 'HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.or... | 0 | 0 | 0 | 0 | 0 | 0 |
pychartjs/__init__.py | quizitive/pyChart.js | 104 | 3308715 | <filename>pychartjs/__init__.py
from pychartjs.pychartjs import *
from pychartjs.utils import *
from pychartjs import Opt as Options
name = "Django Objective Chart.JS"
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/ut/python/nn/probability/distribution/test_categorical.py | PowerOlive/mindspore | 3,200 | 3308728 | <gh_stars>1000+
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | 0 | 0 | 0 | 0 | 0 | 0 |
torch/nn/common_types.py | wenhaopeter/read_pytorch_code | 206 | 3308756 | <reponame>wenhaopeter/read_pytorch_code
from typing import TypeVar, Union, Tuple
from .. import Tensor
# Create some useful type aliases
# Template for arguments which can be supplied as a tuple, or which can be a scalar which PyTorch will internally
# broadcast to a tuple.
# Comes in several variants: A tuple of unk... | 0 | 0 | 0 | 0 | 0 | 0 |
supersuit/utils/basic_transforms/reshape.py | PettingZoo-Team/SuperSu | 237 | 3308774 | <gh_stars>100-1000
import numpy as np
from . import convert_box
def check_param(obs_space, shape):
assert isinstance(shape, tuple), "shape must be tuple. It is {}".format(shape)
assert all(isinstance(el, int) for el in shape), "shape must be tuple of ints, is: {}".format(shape)
assert np.prod(shape) == np... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/instancemode/server.py | gabehack/Pyro4 | 638 | 3308783 | from __future__ import print_function
import Pyro4
@Pyro4.behavior(instance_mode="single")
class SingleInstance(object):
@Pyro4.expose
def msg(self, message) -> object:
print("[%s] %s.msg: %s" % (id(self), self.__class__.__name__, message))
return id(self)
@Pyro4.behavior(instance_mode="sess... | 0 | 4 | 0 | 0 | 4 | 0 |
grumpy-tools-src/tests/havingmainpkg/__main__.py | Srinivas11789/grumpy | 386 | 3308822 | from __future__ import print_function
def main():
print('__name__ is', __name__)
print('__package__ is', __package__)
from . import SPAM
print(SPAM)
if __name__ == '__main__':
print('__name__ IS __main__')
print('__package__ is', __package__)
main()
| 0 | 0 | 0 | 0 | 0 | 0 |
njunmt/__init__.py | whr94621/NJUNMT-tf | 111 | 3308841 | <filename>njunmt/__init__.py
from . import encoders
from . import decoders
from . import models
from . import nmt_experiment
| 0 | 0 | 0 | 0 | 0 | 0 |
models/__init__.py | xiaobaishu0097/savn | 169 | 3308856 | from .basemodel import BaseModel
from .gcn import GCN
from .savn import SAVN
__all__ = ["BaseModel", "GCN", "SAVN"]
variables = locals()
| 0 | 0 | 0 | 0 | 0 | 0 |
test_python_toolbox/test_sequence_tools/test_divide_to_slices.py | hboshnak/python_toolbox | 119 | 3308857 | <gh_stars>100-1000
# Copyright 2009-2017 <NAME>.
# This program is distributed under the MIT license.
from python_toolbox.sequence_tools import divide_to_slices
def test():
assert divide_to_slices(range(10), 3) == \
[range(0, 4), range(4, 7), range(7, 10)]
| 0 | 0 | 0 | 0 | 0 | 0 |
pinball/tools/workflow_util.py | DotModus/pinball | 1,143 | 3308866 | # Copyright 2015, Pinterest, 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 law or agreed to in writ... | 0 | 0 | 0 | 0 | 0 | 0 |
python/ql/test/library-tests/types/properties/properties.py | vadi2/codeql | 4,036 | 3308869 | class C(object):
@property
def p1(self) -> int:
return 1
@p1.setter
def p1(self, val):
pass
@property
def p2(self) -> int:
return 1
@p2.deleter
def p2(self, val):
pass
def p3(self) -> int:
return 1
p3 = propert... | 0 | 3 | 0 | 0 | 3 | 0 |
src/byro/common/templatetags/url_replace.py | mv-idatalytics/jenkins-byro | 114 | 3308897 | <gh_stars>100-1000
from django import template
register = template.Library()
@register.simple_tag
def url_replace(request, field, value):
queryparams = request.GET.copy()
queryparams[field] = str(value)
return queryparams.urlencode()
| 0 | 0 | 0 | 0 | 0 | 0 |
pygmt/tests/test_dimfilter.py | weiji14/gmt-python | 168 | 3308902 | """
Tests for dimfilter.
"""
import os
import pytest
import xarray as xr
from pygmt import dimfilter, load_dataarray
from pygmt.exceptions import GMTInvalidInput
from pygmt.helpers import GMTTempFile
from pygmt.helpers.testing import load_static_earth_relief
@pytest.fixture(scope="module", name="grid")
def fixture_g... | 0 | 2 | 0 | 0 | 2 | 0 |
Model_fastText/old_code/model.py | DmytroBabenko/Text-Classification-Models-Pytorch | 481 | 3308927 | <reponame>DmytroBabenko/Text-Classification-Models-Pytorch
# model.py
import torch
from torch import nn
from torch import Tensor
from torch.autograd import Variable
import numpy as np
from sklearn.metrics import accuracy_score
class fastText(nn.Module):
def __init__(self, config):
super(fastText, self).__... | 0 | 0 | 0 | 0 | 0 | 0 |
deluca/envs/classic/_reacher.py | google/deluca | 105 | 3308930 | # Copyright 2021 The Deluca 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 w... | 0 | 4 | 13 | 0 | 17 | 0 |
pyscreenshot/plugins/pyside2_grabwindow.py | ponty/pyscreenshot | 416 | 3308981 | from __future__ import annotations
import io
import logging
from PIL import Image
from pyscreenshot.plugins.backend import CBackend
log = logging.getLogger(__name__)
class PySide2BugError(Exception):
pass
app = None
class PySide2GrabWindow(CBackend):
name: str = "pyside2"
def grab_to_buffer(self, ... | 2 | 2 | 1 | 0 | 5 | 0 |
vumi/tests/test_multiworker.py | seidu626/vumi | 199 | 3309018 | <gh_stars>100-1000
from twisted.internet.defer import (Deferred, DeferredList, inlineCallbacks,
returnValue)
from vumi.tests.utils import StubbedWorkerCreator
from vumi.service import Worker
from vumi.message import TransportUserMessage
from vumi.multiworker import MultiWorker
from ... | 0 | 0 | 0 | 0 | 0 | 0 |
doc/examples/projections.py | nno/PyMVPA | 227 | 3309020 | #!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.... | 0 | 0 | 0 | 0 | 0 | 0 |
src/utils/visualization/scatter_plot.py | Mrxuelovecode/Deep-Multi-Sphere-SVDD | 214 | 3309026 | import matplotlib
matplotlib.use('Agg') # or 'PS', 'PDF', 'SVG'
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
def plot_2Dscatter(data, title, export_pdf: bool=False, show: bool=False):
sns_style = "white"
sns_palette = "colorblind"
sns.set(style=sns_style, palette=sns_palette... | 2 | 0 | 0 | 0 | 2 | 0 |
widgets/notebook/codegen.py | ardovm/wxGlade | 225 | 3309050 | from __future__ import annotations
"""\
Code generator functions for wxNotebook objects
@copyright: 2002-2007 <NAME>
@copyright: 2014-2016 <NAME>
@copyright: 2019 <NAME>
@license: MIT (see LICENSE.txt) - THIS PROGRAM COMES WITH NO WARRANTY
"""
import common
import wcodegen
class PythonNotebookGenerator(wcodegen.Pyt... | 1 | 7 | 2 | 0 | 10 | 0 |
src/kubetop/_runmany.py | TheoBrigitte/kubetop | 154 | 3309074 | <gh_stars>100-1000
# Copyright Least Authority Enterprises.
# See LICENSE for details.
"""
Integration between the per-frame kubetop rendering and the Twisted
startup/shutdown interfaces.
Theory of Operation
===================
#. Glue kubetop rendering object together with a time-based trigger (for periodic re-rend... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/get_info.py | ZaibanAli/eospy | 150 | 3309096 | from eospy.cleos import Cleos
ce = Cleos(url='https://api.eosargentina.io')
# Get info
get_info=ce.get_info()
print(get_info)
# Get head block number from info
head = get_info['head_block_num']
print('Head Block number is', head)
| 0 | 0 | 0 | 0 | 0 | 0 |
jupyter_micropython_kernel/deviceconnector.py | Albaobab/jupyter_micropython_kernel | 122 | 3309143 | from __future__ import annotations
import logging, sys, time, os, re, binascii, subprocess, ast
import serial, socket, serial.tools.list_ports, select
import websocket # the old non async one
serialtimeout = 0.5
serialtimeoutcount = 10
wifimessageignore = re.compile("(\x1b\[[\d;]*m)?[WI] \(\d+\) (wifi|system_api|mod... | 6 | 13 | 0 | 5 | 24 | 0 |
test/test_nn/test_math/test_add.py | jinmang2/PRML | 11,017 | 3309148 | import unittest
import numpy as np
import prml.nn as nn
class TestAdd(unittest.TestCase):
def test_add(self):
npa = np.random.randn(4, 5)
npb = np.random.randn(4, 5)
a = nn.asarray(npa)
b = nn.asarray(npb)
c = a + b
self.assertTrue(np.allclose(c.value, npa + npb))
... | 0 | 0 | 0 | 0 | 0 | 0 |
earth_enterprise/src/server/wsgi/common/custom_http_error_handler.py | ezeeyahoo/earthenterprise | 2,661 | 3309157 | <reponame>ezeeyahoo/earthenterprise
#!/usr/bin/env python2.7
#
# Copyright 2020 the Open GEE 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/licens... | 0 | 0 | 0 | 0 | 0 | 0 |
python/paddle/fluid/tests/unittests/dygraph_to_static/test_grid_generator.py | zmxdream/Paddle | 17,085 | 3309201 | <reponame>zmxdream/Paddle
# copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# 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
#
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
subaligner/subtitle.py | baxtree/subaligner | 227 | 3309209 | <filename>subaligner/subtitle.py
import pysrt
import tempfile
import os
import re
import xml.etree.ElementTree as ElementTree
import inspect
from typing import Optional, List
from pysrt import SubRipFile, SubRipItem
from copy import deepcopy
from .utils import Utils
from .exception import UnsupportedFormatException
c... | 0 | 0 | 0 | 0 | 0 | 0 |
example/trade/post_batch_cancel_order.py | bailzx5522/huobi_Python | 611 | 3309210 | <filename>example/trade/post_batch_cancel_order.py
from huobi.client.trade import TradeClient
from huobi.constant import *
from huobi.utils import *
trade_client = TradeClient(api_key=g_api_key, secret_key=g_secret_key)
symbol_test = "eosusdt"
i = 0
n = 3
order_id_list = []
while(i<n):
order_id = trade_client.cr... | 0 | 0 | 0 | 0 | 0 | 0 |
mmhuman3d/core/visualization/renderer/torch3d_renderer/segmentation_renderer.py | ykk648/mmhuman3d | 472 | 3309218 | <reponame>ykk648/mmhuman3d<filename>mmhuman3d/core/visualization/renderer/torch3d_renderer/segmentation_renderer.py
from typing import Iterable, Optional, Tuple, Union
import torch
from pytorch3d.structures import Meshes
from mmhuman3d.core.cameras import MMCamerasBase
from mmhuman3d.utils import get_different_colors... | 0 | 0 | 0 | 0 | 0 | 0 |
widgets/list_box/codegen.py | ardovm/wxGlade | 225 | 3309245 | """\
Code generator functions for wxListBox objects
@copyright: 2002-2007 <NAME>
@copyright: 2014-2016 <NAME>
@copyright: 2017 <NAME>
@license: MIT (see LICENSE.txt) - THIS PROGRAM COMES WITH NO WARRANTY
"""
import common
import wcodegen
from ChoicesCodeHandler import *
class PythonListBoxGenerator(wcodegen.PythonW... | 0 | 1 | 3 | 0 | 4 | 0 |
utils/metric_util.py | SunnyMarkLiu/lic2019-dureader2.0-rank2 | 137 | 3309247 | #!/usr/bin/python
# _*_ coding: utf-8 _*_
from __future__ import annotations
"""
@author: <NAME>, <EMAIL>
@github: https://github.com/sunnymarkLiu
@time : 2019/4/9 11:51
"""
import itertools
import json
import sys
import zipfile
sys.path.append('../')
from check.metric.bleu import BLEUWithBonus
from check.metric.rou... | 3 | 12 | 0 | 0 | 15 | 0 |
envs/dkitty_redesign.py | tomasruizt/dads | 141 | 3309249 | <reponame>tomasruizt/dads
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
libmem-py/clean.py | CKLinuxProject/libmem | 195 | 3309250 | <reponame>CKLinuxProject/libmem
import os
import shutil
import json
print("[+] Cleaning...")
with open("tree.json", "r") as f:
json_str = f.read()
json_data = json.loads(json_str)
f.close()
for (path, dirs, files) in os.walk(os.curdir):
if path not in json_data["dirs"]:
shutil.rmtree(path)
else:
for f in fi... | 0 | 0 | 0 | 0 | 0 | 0 |
observations/r/volat.py | hajime9652/observations | 199 | 3309252 | # -*- 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 volat(path) -> tuple[object, object]:
"""volat
Data loads lazily. ... | 0 | 1 | 0 | 0 | 1 | 0 |
compiler/tests/regress.py | im-world/OpenRAM | 335 | 3309285 | #!/usr/bin/env python3
# See LICENSE for licensing information.
#
# Copyright (c) 2016-2021 Regents of the University of California and The Board
# of Regents for the Oklahoma Agricultural and Mechanical College
# (acting for and on behalf of Oklahoma State University)
# All rights reserved.
#
import re
import unittes... | 0 | 3 | 0 | 0 | 3 | 0 |
data/task_scripts/main/task00106.py | aallaire91/phyre | 432 | 3309295 | <filename>data/task_scripts/main/task00106.py
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
facebook_problems/problem_19.py | loftwah/Daily-Coding-Problem | 129 | 3309301 | """This problem was asked by Facebook.
Write a function that rotates a list by k elements.
For example, [1, 2, 3, 4, 5, 6] rotated by two becomes [3, 4, 5, 6, 1, 2].
Try solving this without creating a copy of the list.
How many swap or move operations do you need?
""" | 0 | 0 | 0 | 0 | 0 | 0 |
Discord Sentiment Analysis Bot/vader_example_2.py | AymaneZizi/Tutorials | 559 | 3309329 | from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
# create sentiment analyzer object
analyzer = SentimentIntensityAnalyzer()
def sentiment_analyzer_scores(text) -> str:
score = analyzer.polarity_scores(text)
lb = score['compound']
if lb >= 0.05:
return 'positive'
elif (lb > ... | 0 | 1 | 0 | 0 | 1 | 0 |
focal_loss/losses.py | WenWeiHsueh/nn_playground | 445 | 3309345 | import keras.backend as K
def focal_loss(target, output, gamma: int=2) -> object:
output /= K.sum(output, axis=-1, keepdims=True)
eps = K.epsilon()
output = K.clip(output, eps, 1. - eps)
return -K.sum(K.pow(1. - output, gamma) * target * K.log(output),
axis=-1)
| 1 | 1 | 0 | 0 | 2 | 0 |
test/modules/md/message.py | tititiou36/httpd | 2,529 | 3309360 | <filename>test/modules/md/message.py
#!/usr/bin/env python3
import os
import sys
def main(argv):
if len(argv) > 2:
cmd = argv[2]
if 'renewing' != cmd:
f1 = open(argv[1], 'a+')
f1.write(f'{argv}\n')
if 'MD_VERSION' in os.environ:
f1.write(f'MD_VE... | 0 | 0 | 0 | 0 | 0 | 0 |
jira/CVE-2019-11581/poc.py | nobgr/vulhub | 9,681 | 3309363 | <reponame>nobgr/vulhub
# -*- coding: utf-8 -*-
import requests
req = requests.Session()
def Base(url,subject):
print("[+] Get Token")
r = req.get("%s/secure/ContactAdministrators!default.jspa" % url)
c = r.headers['Set-Cookie']
t = c[c.find("=")+1:c.find(";")]
data = {
"from": "<EMAIL>",
... | 0 | 0 | 0 | 0 | 0 | 0 |
sdc/datatypes/series/pdimpl.py | densmirn/sdc | 540 | 3309368 | # *****************************************************************************
# Copyright (c) 2020, Intel Corporation All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of sou... | 6 | 2 | 0 | 0 | 8 | 0 |
setup.py | Anselmoo/pydqc | 276 | 3309369 | <reponame>Anselmoo/pydqc<gh_stars>100-1000
from setuptools import setup
setup(name='pydqc',
packages=['pydqc'],
package_data={'pydqc': ['templates/*.txt']},
version='0.1.0',
description='python automatic data quality check',
author='SauceCat',
author_email='<EMAIL>',
url='https://github.com/SauceCat/pydqc',
do... | 0 | 0 | 0 | 0 | 0 | 0 |
skgstat/tests/test_stmodels.py | rhugonnet/scikit-gstat | 141 | 3309371 | import unittest
import numpy as np
from numpy.testing import assert_array_almost_equal
from skgstat import models, stmodels
class TestSumModel(unittest.TestCase):
def setUp(self):
# spatial range = 10; spatial sill = 5
self.Vx = lambda h: models.spherical(h, 10, 5)
# temporal range = 5;... | 0 | 0 | 0 | 0 | 0 | 0 |
spider/chengJiaoSpiderKe.py | BerSerK/LianjiaSpider | 143 | 3309387 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import random
import re
import requests
import sys
import lxml
import datetime
import os
from multiprocessing import Pool
from bs4 import BeautifulSoup
from generate_excle import generate_excle
from AgentAndProxies import hds
from AgentAndProxies import GetIpProxy
from model.E... | 0 | 0 | 0 | 0 | 0 | 0 |
mmpdblib/environment.py | trumanw/mmpdb | 102 | 3309393 | # mmpdb - matched molecular pair database generation and analysis
#
# Copyright (c) 2015-2017, <NAME> Ltd.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above ... | 4 | 13 | 1 | 0 | 18 | 0 |
datapackage_pipelines/lib/dump_to_sql.py | gperonato/datapackage-pipelines | 109 | 3309396 | from dataflows import Flow, dump_to_sql
from datapackage_pipelines.wrapper import ingest
from datapackage_pipelines.utilities.flow_utils import spew_flow
def flow(parameters) -> object:
return Flow(
dump_to_sql(
parameters['tables'],
engine=parameters.get('engine', 'env://DPP_DB_EN... | 0 | 1 | 0 | 0 | 1 | 0 |
Python/Quora_Bookmark_Topics_Downloader/app.py | iamakkkhil/Rotten-Scripts | 1,127 | 3309425 | <reponame>iamakkkhil/Rotten-Scripts
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import selenium
import time
def scrap(email, password_input):
driver = webdriver.C... | 0 | 0 | 0 | 0 | 0 | 0 |
filprofiler/tests/test_not_ipython.py | whalesalad/filprofiler | 521 | 3309434 | <reponame>whalesalad/filprofiler
"""Tests for trying to use IPython when you're not running via Fil."""
from IPython.core.interactiveshell import InteractiveShell
from IPython.utils.capture import capture_output
import sys
def test_helpful_error():
"""If you're not in Fil, you get an error message."""
result... | 0 | 0 | 0 | 0 | 0 | 0 |
web3/_utils/module_testing/net_module.py | geofferyj/web3.py | 3,041 | 3309441 | <gh_stars>1000+
import pytest
from typing import (
TYPE_CHECKING,
)
from eth_utils import (
is_boolean,
is_integer,
is_string,
)
if TYPE_CHECKING:
from web3 import Web3 # noqa: F401
class NetModuleTest:
def test_net_version(self, web3: "Web3") -> None:
version = web3.net.version
... | 0 | 0 | 0 | 0 | 0 | 0 |
GreedyInfoMax/audio/models/independent_module.py | weiaicunzai/pytorch-faster-rcnn | 288 | 3309457 | <reponame>weiaicunzai/pytorch-faster-rcnn
import torch
import torch.nn as nn
from GreedyInfoMax.audio.models import (
autoregressor,
encoder,
loss_InfoNCE,
loss_supervised_phones,
loss_supervised_speaker,
)
class IndependentModule(nn.Module):
def __init__(
self,
opt,
e... | 0 | 0 | 0 | 0 | 0 | 0 |
plugin/view.py | rkoval/naomi | 600 | 3309475 | # 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
# distributed under th... | 0 | 11 | 0 | 0 | 11 | 0 |
unittest/scripts/py_devapi/scripts/mysqlx_table_delete.py | mueller/mysql-shell | 119 | 3309492 | # Assumptions: validate_crud_functions available
from __future__ import print_function
from mysqlsh import mysqlx
mySession = mysqlx.get_session(__uripwd)
ensure_schema_does_not_exist(mySession, 'js_shell_test')
schema = mySession.create_schema('js_shell_test')
mySession.set_current_schema('js_shell_test')
# Create... | 0 | 0 | 0 | 0 | 0 | 0 |
discretize/mixins/mesh_io.py | ngodber/discretize | 123 | 3309501 | from __future__ import annotations
import os
import numpy as np
from discretize.utils import mkvc
from discretize.utils.code_utils import deprecate_method
import warnings
try:
from discretize.mixins.vtk_mod import InterfaceTensorread_vtk
except ImportError:
InterfaceTensorread_vtk = object
class TensorMeshI... | 15 | 16 | 0 | 0 | 31 | 0 |
backend/labels/migrations/0014_remove_uuid_null.py | stungkit/doccano | 2,082 | 3309512 | import uuid
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("labels", "0013_populate_uuid_values"),
]
operations: list[object] = [
migrations.AlterField(
model_name="category",
name="uuid",
... | 0 | 0 | 2 | 0 | 2 | 0 |
L1TriggerConfig/GMTConfigProducers/python/L1MuGMTRSKeysOnline_cfi.py | ckamtsikis/cmssw | 852 | 3309559 | <filename>L1TriggerConfig/GMTConfigProducers/python/L1MuGMTRSKeysOnline_cfi.py
import FWCore.ParameterSet.Config as cms
L1MuGMTRSKeysOnline = cms.ESProducer("L1MuGMTRSKeysOnlineProd",
onlineAuthentication = cms.string('.'),
subsystemLabel = cms.string('L1MuGMT'),
onlineDB = cms.string('oracle://CMS_OMDS_LB/... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/Pastebin.py | methos2016/dumpmon | 491 | 3309561 | <reponame>methos2016/dumpmon
from .Site import Site
from .Paste import Paste
from bs4 import BeautifulSoup
from . import helper
from time import sleep
from settings import SLEEP_PASTEBIN
from twitter import TwitterError
import logging
import requests
class PastebinPaste(Paste):
def __init__(self, id):
sel... | 0 | 0 | 0 | 0 | 0 | 0 |
octavia/api/v2/controllers/quotas.py | zhangi/octavia | 129 | 3309585 | # Copyright 2016 Rackspace
#
# 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 agree... | 1 | 6 | 0 | 0 | 7 | 0 |
code/Model/baselines/sdp-lstm/dependency-kbp/utils.py | INK-USC/DS-RelationExtraction | 156 | 3309594 | <reponame>INK-USC/DS-RelationExtraction
import data_utils
def _get_feed_dict_for_others(model, x_batch, y_batch, x_lens, use_pos=True, use_ner=False, use_deprel=True):
feed = {model.word_inputs:x_batch[data_utils.WORD_FIELD], model.labels:y_batch, model.seq_lens:x_lens}
if use_pos:
feed[model.pos_input... | 0 | 0 | 0 | 0 | 0 | 0 |
src/PeerRead/data_cleaning/clean_PeerRead.py | dveni/causal-text-embeddings | 114 | 3309598 | <gh_stars>100-1000
import argparse
import os
import bert.tokenization as tokenization
from PeerRead.data_cleaning.process_PeerRead_abstracts import clean_PeerRead_dataset
dataset_names = ['acl_2017',
'arxiv.cs.ai_2007-2017',
'arxiv.cs.cl_2007-2017',
'arxiv.cs.lg_2... | 0 | 0 | 0 | 0 | 0 | 0 |
misc/repl.py | aluhrs13/HPI | 1,026 | 3309619 | #!/usr/bin/env python3
# M-x run-python (raise window so it doesn't hide)
# ?? python-shell-send-defun
# C-c C-r python-shell-send-region
# shit, it isn't autoscrolling??
# maybe add hook
# (setq comint-move-point-for-output t) ;; https://github.com/jorgenschaefer/elpy/issues/1641#issuecomment-528355368
#
from i... | 0 | 0 | 0 | 0 | 0 | 0 |
fw/train.py | ajarai/fast-weights | 186 | 3309673 | <reponame>ajarai/fast-weights<filename>fw/train.py
import cPickle
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import tensorflow as tf
import os
import time
import sys
from data_utils import (
generate_epoch,
)
from model import (
fast_weights_model,
)
from custom_GRU import (
... | 0 | 0 | 0 | 0 | 0 | 0 |
rastervision_core/rastervision/core/data/label_source/__init__.py | theoway/raster-vision | 1,577 | 3309681 | <filename>rastervision_core/rastervision/core/data/label_source/__init__.py
# flake8: noqa
from rastervision.core.data.label_source.label_source import *
from rastervision.core.data.label_source.label_source_config import *
from rastervision.core.data.label_source.chip_classification_label_source import *
from rasterv... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_pipelines/test_boolean.py | mikeywaites/kim | 356 | 3309710 | <gh_stars>100-1000
import pytest
from ..conftest import get_mapper_session
from kim.field import FieldInvalid, Boolean
from kim.pipelines.base import Session, is_valid_choice
def test_is_allowed_value():
field = Boolean(name='test')
session = Session(field, 'test', {})
with pytest.raises(FieldInvalid):... | 0 | 0 | 0 | 0 | 0 | 0 |
Python_03_save_csv.py | rogerolowski/SimpleStockAnalysisPython | 195 | 3309726 | <filename>Python_03_save_csv.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 4 18:55:42 2020
@author: Tin
"""
# Save Data to CSV
import warnings
warnings.filterwarnings("ignore")
import yfinance as yf
yf.pdr_override()
# input
symbol = 'AMD'
start = '2014-01-01'
end = '2019-01-01... | 0 | 0 | 0 | 0 | 0 | 0 |
openbook_auth/migrations/0003_auto_20181020_1501.py | TamaraAbells/okuna-api | 164 | 3309748 | # Generated by Django 2.1.2 on 2018-10-20 13:01
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('openbook_auth', '0002_auto_20181010_1423'),
]
operations: l... | 0 | 0 | 2 | 0 | 2 | 0 |
fontText2/script.py | SumithDath/Digital-Handwriting | 181 | 3309754 | from PIL import Image
files = dataAvailable = [32,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,... | 0 | 0 | 0 | 0 | 0 | 0 |
d2go/utils/ema_state.py | wenliangzhao2018/d2go | 687 | 3309759 | <reponame>wenliangzhao2018/d2go<filename>d2go/utils/ema_state.py
#!/usr/bin/env python3
import itertools
from typing import Any, Dict, Optional
import torch
import torch.nn as nn
class EMAState(object):
"""Stores Exponential Moving Average state for a model.
Args:
decay: EMA decay factor, should be... | 0 | 0 | 0 | 0 | 0 | 0 |
lldb/test/API/lang/objc/direct-dispatch-step/TestObjCDirectDispatchStepping.py | Machiry/checkedc-clang | 250 | 3309781 | <reponame>Machiry/checkedc-clang
"""Test stepping through ObjC method dispatch in various forms."""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestObjCDirectDispatchStepping(TestBase):
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/commands_test.py | lexdene/aiomcache | 121 | 3309785 | <gh_stars>100-1000
import asyncio
import pytest
from unittest import mock
from aiomcache.exceptions import ClientException, ValidationException
@pytest.mark.run_loop
def test_version(mcache, loop):
version = yield from mcache.version()
stats = yield from mcache.stats()
assert version == stats[b'version']... | 0 | 0 | 0 | 0 | 0 | 0 |
securetea/lib/auto_server_patcher/ssl_scanner.py | neerajv18/SecureTea-Project | 257 | 3309787 | <filename>securetea/lib/auto_server_patcher/ssl_scanner.py
# -*- coding: utf-8 -*-
u"""SSL Scanner for SecureTea Auto Server Patcher
Project:
╔═╗┌─┐┌─┐┬ ┬┬─┐┌─┐╔╦╗┌─┐┌─┐
╚═╗├┤ │ │ │├┬┘├┤ ║ ├┤ ├─┤
╚═╝└─┘└─┘└─┘┴└─└─┘ ╩ └─┘┴ ┴
Author: <NAME> <<EMAIL>> , Jun 20 2019
Version: 1.4
Module: SecureTea... | 0 | 0 | 0 | 0 | 0 | 0 |
fool/lexical.py | HuaYZhao/FoolNLTK | 1,718 | 3309835 | <reponame>HuaYZhao/FoolNLTK
#!/usr/bin/env python
# -*-coding:utf-8-*-
import sys
import os
import json
from fool.predictor import Predictor
from zipfile import ZipFile
OOV_STR = "<OOV>"
def _load_map_file(path, char_map_name, id_map_name):
with ZipFile(path) as myzip:
with myzip.open('all_map.json') ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/SafeProcess_test.py | timgates42/PyBBIO | 102 | 3309880 | <filename>examples/SafeProcess_test.py<gh_stars>100-1000
#!/usr/bin/env python
"""
SafeProcess_test.py
<NAME>
An example to demonstrate the use of the SafeProcess library
for PyBBIO.
This example program is in the public domain.
"""
from bbio import *
from bbio.libraries.SafeProcess import *
def foo():
whil... | 0 | 0 | 0 | 0 | 0 | 0 |
python/paddle/fluid/tests/unittests/test_accuracy_op.py | zmxdream/Paddle | 17,085 | 3309903 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 0 | 0 | 0 | 0 | 0 | 0 |
evaluate/simple_lm.py | tizz98/JamSpell | 499 | 3309915 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from utils import loadText, normalize, generateSentences
from collections import defaultdict
import cPickle, zlib
import math
import sys
import time
class SimpleLangModel(object):
K: float = 0.05
def __init__(self):
self.wordToId: dict[object,object] = {... | 1 | 6 | 1 | 4 | 12 | 0 |
blogs/lightning/ltgpred/trainer/dnn.py | laurenzberger/training-data-analyst | 6,140 | 3309956 | import tensorflow.keras as keras
def create_dnn_model(img, params) -> object:
nfil = params.get('nfil', 5)
dprob = params.get('dprob', 0.05 if params['batch_norm'] else 0.25)
nlayers = params.get('nlayers', 3)
x = keras.layers.BatchNormalization()(img)
for layer in range(nlayers):
numnodes = (nlayers - l... | 0 | 1 | 0 | 0 | 1 | 0 |
insights/tests/test_soscleaner.py | ryan-blakley/insights-core | 121 | 3309975 | from insights.contrib.soscleaner import SOSCleaner
from mock.mock import Mock
from pytest import mark
def _soscleaner() -> object:
soscleaner = SOSCleaner()
soscleaner.logger = Mock()
return soscleaner
@mark.parametrize(("line", "expected"), [
("radius_ip_1=10.0.0.1", "radius_ip_1=10.230.230.1"),
... | 0 | 1 | 0 | 0 | 1 | 0 |
server/migrations/0076_remove_blank_updates.py | nathandarnell/sal | 215 | 3309986 |
from server.models import *
from django.db import migrations, models
def clean_updates(apps, schema_editor):
"""
Make sure we don't have any pending updates without a version, this makes
the plugin barf
"""
PendingAppleUpdate = apps.get_model("server", "PendingAppleUpdate")
updates_to_clean... | 0 | 0 | 2 | 0 | 2 | 0 |
weixin/msg_template.py | wdw139130/wechat-mall | 108 | 3310002 | <filename>weixin/msg_template.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
TEXT_TEMPLATE = """
<xml>
<ToUserName><![CDATA[{to_user}]]></ToUserName>
<FromUserName><![CDATA[{from_user}]]></FromUserName>
<CreateTime>{create_time}</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<... | 0 | 0 | 0 | 0 | 0 | 0 |
title_maker_pro/twitter_bot.py | eliseumds/this-word-does-not-exist | 761 | 3310025 | from __future__ import annotations
import re
import os
import time
import argparse
import tweepy
import datasets
import logging
import stanza
import random
from word_generator import WordGenerator
logger = logging.getLogger(__name__)
MAX_TWEET_LENGTH = 250
def _inverse_definition_str(word_with_definition) -> str:
... | 1 | 6 | 0 | 0 | 7 | 0 |
beaconrunner/eth2spec/test/helpers/keys.py | casparschwa/beaconrunner | 2,161 | 3310072 | from py_ecc.bls import G2ProofOfPossession as bls
# Enough keys for 256 validators per slot in worst-case epoch length
privkeys = [i + 1 for i in range(32 * 256)]
pubkeys = [bls.SkToPk(privkey) for privkey in privkeys]
pubkey_to_privkey = {pubkey: privkey for privkey, pubkey in zip(privkeys, pubkeys)}
| 0 | 0 | 0 | 0 | 0 | 0 |
{{cookiecutter.project_slug}}/backend/app/app/tests_pre_start.py | Gjacquenot/full-stack-fastapi-couchbase | 353 | 3310096 | import logging
from tenacity import after_log, before_log, retry, stop_after_attempt, wait_fixed
from app.db.database import get_default_bucket
from app.tests.api.api_v1.test_login import test_get_access_token
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
max_tries = 60 * 5 # 5 minut... | 0 | 0 | 0 | 0 | 0 | 0 |
atlas/foundations_internal/src/test/test_job_resources.py | DeepLearnI/atlas | 296 | 3310133 | <reponame>DeepLearnI/atlas
from foundations_spec import *
from foundations_internal.job_resources import JobResources
class TestJobResources(Spec):
@let
def num_gpus(self):
return self.faker.random_int(0, 8)
@let
def ram(self):
return self.faker.random.random() * 256
@set_up
... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/dash-live-model-training/demo_utils.py | JeroenvdSande/dash-sample-apps | 2,332 | 3310155 | from __future__ import annotations
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
from dash.dependencies import Input, Output, State
import pathlib
# get relative data folder
PATH = pathlib.Path(__file__).parent
DATA_PATH = PATH.joinpath("data").resolve()
def demo_explanat... | 0 | 6 | 0 | 0 | 6 | 0 |
Chapter03/Exercise37/today.py | eugeniousone/The-Python-Workshop | 238 | 3310190 | """
This script prints the current system date.
"""
import datetime
print(datetime.date.today()) | 0 | 0 | 0 | 0 | 0 | 0 |
CPAC/anat_preproc/tests/test_anat_preproc.py | Lawreros/C-PAC | 125 | 3310192 | <reponame>Lawreros/C-PAC
import os
import sys
from .. import anat_preproc
from nose.tools import *
import nibabel as nib
import numpy as np
class TestAnatPreproc:
def __init__(self):
"""
Initialize and run the the anat_preproc workflow
Populate the node-name : node_output dicti... | 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.