max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
dbrepl.py | righteousgambitresearch/SSRFTest | 213 | 12678034 | #!/usr/local/bin/python -i
from metamodel import createLocalSession
from main import app
app.test_request_context('/').__enter__()
createLocalSession()
from model import *
|
app/dashboard/controllers.py | bbhunter/shadow-workers | 114 | 12678050 | import time
import os
from datetime import datetime
from app import db, ConnectedAgents, ConnectedDomAgents, auth, extraModules, AutomaticModuleExecution
from flask import jsonify, send_from_directory, Blueprint, Response, render_template, request, escape
from pywebpush import webpush, WebPushException
from database.mo... |
wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/overlapping_fields_can_be_merged.py | borisgrafx/client | 3,968 | 12678076 | import itertools
from collections import OrderedDict
from ...error import GraphQLError
from ...language import ast
from ...language.printer import print_ast
from ...pyutils.pair_set import PairSet
from ...type.definition import (GraphQLInterfaceType, GraphQLList,
GraphQLNonNull, GraphQL... |
code/ReID_net/datasets/Util/Batch.py | MTonyM/PReMVOS | 140 | 12678095 | import tensorflow as tf
def create_batch_dict(batch_size, tensors_dict):
if batch_size == 1:
batch = {k: tf.expand_dims(t, axis=0) for k, t in list(tensors_dict.items())}
summary = None
else:
keys = list(tensors_dict.keys())
values = list(tensors_dict.values())
values = tf.train.batch(values, ... |
common/src/utils/oopatterns.py | krisshol/bach-kmno | 248 | 12678107 | #
# Copyright (c) 2013-2018 Quarkslab.
# This file is part of IRMA project.
#
# 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 in the top-level directory
# of this distribution and at:
#
# http:... |
tests/query_test/test_queries.py | survivorli/Impala | 1,523 | 12678127 | <gh_stars>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
# "License"... |
third_party/blink/renderer/bindings/scripts/v8_types.py | iridium-browser/iridium-browser | 575 | 12678132 | # Copyright (C) 2013 Google Inc. 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 source code must retain the above copyright
# notice, this list of conditions and the ... |
third_party/blink/renderer/build/scripts/aria_properties.py | zipated/src | 2,151 | 12678136 | # Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import os.path
import sys
PYJSON5_DIR = os.path.join(os.path.dirname(__file__),
'..', '..', '..', '..', 'pyjson5', 'src... |
transformations/replace_spelling/transformation.py | ZhexiongLiu/NL-Augmenter | 583 | 12678149 | <gh_stars>100-1000
import itertools
import random
import json
import os
from interfaces.SentenceOperation import SentenceOperation
from tasks.TaskTypes import TaskType
"""
Base Class for implementing the different input transformations a generation should be robust against.
"""
def generate_sentence(sentence, spell... |
tensorflow_quantum/core/ops/tfq_ps_util_ops_test.py | sarvex/tensorflow-quantum | 1,501 | 12678182 | <reponame>sarvex/tensorflow-quantum
# Copyright 2020 The TensorFlow Quantum 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/license... |
holoviews/tests/plotting/plotly/test_tiles.py | geronimos/holoviews | 864 | 12678197 | from holoviews.element import RGB, Tiles, Points, Bounds
from holoviews.element.tiles import StamenTerrain, _ATTRIBUTIONS
from .test_plot import TestPlotlyPlot, plotly_renderer
import numpy as np
class TestMapboxTilesPlot(TestPlotlyPlot):
def setUp(self):
super().setUp()
# Precompute coordinates
... |
rllib/policy/dynamic_tf_policy.py | linyiyue/ray | 21,382 | 12678218 | from collections import namedtuple, OrderedDict
import gym
import logging
import re
from typing import Callable, Dict, List, Optional, Tuple, Type
from ray.util.debug import log_once
from ray.rllib.models.tf.tf_action_dist import TFActionDistribution
from ray.rllib.models.modelv2 import ModelV2
from ray.rllib.policy.p... |
app/src/thirdparty/telemetry/internal/backends/remote/trybot_browser_finder_unittest.py | ta2edchimp/big-rig | 925 | 12678226 | <gh_stars>100-1000
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import logging
import StringIO
import unittest
from telemetry.internal.backends.remote import trybot_browser_finder
from tele... |
safe_learning/tests/test_utilities.py | xin-alice/cs159_safe_learning | 169 | 12678240 | <reponame>xin-alice/cs159_safe_learning<filename>safe_learning/tests/test_utilities.py<gh_stars>100-1000
"""Test the utilities."""
from __future__ import absolute_import, print_function, division
import pytest
import numpy as np
import tensorflow as tf
from numpy.testing import assert_allclose
from safe_learning.uti... |
pytorch_lightning/loggers/wandb.py | Code-Cornelius/pytorch-lightning | 15,666 | 12678269 | <reponame>Code-Cornelius/pytorch-lightning
# Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... |
timm/optim/optim_factory.py | vb7401/pytorch-image-models | 431 | 12678271 | """ Optimizer Factory w/ Custom Weight Decay
Hacked together by / Copyright 2020 <NAME>
"""
import torch
from torch import optim as optim
from .adafactor import Adafactor
from .adahessian import Adahessian
from .adamp import AdamP
from .lookahead import Lookahead
from .nadam import Nadam
from .novograd import NovoGrad... |
examples/pyplot/scatter2.py | hadivafaii/vedo | 836 | 12678272 | # Scatter plot of a gaussian distribution
# with varying color and point sizes
from vedo import *
from vedo.pyplot import plot
import numpy as np
n = 1000
x = np.random.randn(n)
y = np.random.randn(n)
# define what size must have each marker:
marker_sizes = np.sin(2*x)/8
# define a (r,g,b) list of colors for each ma... |
homeassistant/components/telegram_bot/polling.py | mtarjoianu/core | 30,023 | 12678281 | <gh_stars>1000+
"""Support for Telegram bot using polling."""
import logging
from telegram import Update
from telegram.error import NetworkError, RetryAfter, TelegramError, TimedOut
from telegram.ext import CallbackContext, TypeHandler, Updater
from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSI... |
onnxruntime/python/tools/quantization/calibrate.py | fushwLZU/onnxruntime_test | 6,036 | 12678292 | <gh_stars>1000+
#!/usr/bin/env python
# coding: utf-8
# -------------------------------------------------------------------------
# Copyright (c) Microsoft, Intel Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ------------------------... |
arelle/ModelRssItem.py | hamscher/Arelle | 292 | 12678296 | <gh_stars>100-1000
'''
Created on Nov 11, 2010
@author: Mark V Systems Limited
(c) Copyright 2010 Mark V Systems Limited, All rights reserved.
'''
import os
from arelle import XmlUtil
from arelle.ModelObject import ModelObject
newRssWatchOptions = {
"feedSource": "",
"feedSourceUri": None,
"matchTextExpr"... |
neptune/internal/hardware/resources/gpu_card_indices_provider.py | Raalsky/neptune-client | 254 | 12678310 | #
# Copyright (c) 2019, Neptune Labs Sp. z o.o.
#
# 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 agr... |
tests/pre_commit_hook_test.py | paulo-sampaio/detect-secrets | 2,212 | 12678351 | <reponame>paulo-sampaio/detect-secrets
import json
import tempfile
from contextlib import contextmanager
from functools import partial
from typing import List
from unittest import mock
import pytest
from detect_secrets.core import baseline
from detect_secrets.core.secrets_collection import SecretsCollection
from dete... |
pyNastran/dev/bdf_vectorized/cards/elements/solid/chexa20.py | ACea15/pyNastran | 293 | 12678371 | <reponame>ACea15/pyNastran<filename>pyNastran/dev/bdf_vectorized/cards/elements/solid/chexa20.py
from numpy import arange, searchsorted, array, eye, ones
from numpy.linalg import norm # type: ignore
from pyNastran.bdf.field_writer_8 import print_card_8
from pyNastran.bdf.bdf_interface.assign_type import integer, inte... |
src/sensing/drivers/radar/umrr_driver/src/smartmicro/Services/basicCanServices/uatResponseService.py | P4nos/Aslan | 227 | 12678378 | import queue
import struct
from smartmicro.Protocols.udt.udtUatResponseV1 import UATv1Response
# from smartmicro.Protocols.udt.udtUatResponseV2 import UATv2Response
# from smartmicro.Protocols.udt.udtUatResponseV3 import UATv3Response
from smartmicro.Protocols.udt.udtUatResponseV4 import UATv4Response
from smar... |
codes/models/networks/base_nets.py | sanchitvohra/EGVSR | 709 | 12678403 | import torch.nn as nn
class BaseSequenceGenerator(nn.Module):
def __init__(self):
super(BaseSequenceGenerator, self).__init__()
def generate_dummy_input(self, lr_size):
""" use for compute per-step FLOPs and speed
return random tensors that can be taken as input of <forward>
... |
examples/daily/point.py | mitchkaden/meteostat-python | 133 | 12678419 | """
Example: Daily point data access
Meteorological data provided by Meteostat (https://dev.meteostat.net)
under the terms of the Creative Commons Attribution-NonCommercial
4.0 International Public License.
The code is licensed under the MIT license.
"""
from datetime import datetime
import matplotlib.pyplot as plt
... |
gw_full_latest/CloudMQTT.py | rendikanyut/LowCostLoRaGw | 654 | 12678424 | #-------------------------------------------------------------------------------
# Copyright 2017 <NAME>, University of Pau, France.
#
# <EMAIL>
#
# This file is part of the low-cost LoRa gateway developped at University of Pau
#
# This program is free software: you can redistribute it and/or modify
# it under the ter... |
python/test/feature_assembler_test.py | xinglinsky/vmaf | 2,874 | 12678429 | <filename>python/test/feature_assembler_test.py
from __future__ import absolute_import
__copyright__ = "Copyright 2016-2020, Netflix, Inc."
__license__ = "BSD+Patent"
import unittest
from vmaf.core.feature_assembler import FeatureAssembler
from vmaf.core.feature_extractor import VmafFeatureExtractor, FeatureExtracto... |
mim/commands/install.py | zhouzaida/mim | 188 | 12678433 | <filename>mim/commands/install.py
import os
import os.path as osp
import shutil
import tempfile
from distutils.version import LooseVersion
from pkg_resources import parse_requirements, resource_filename
from typing import List
import click
import pip
from mim.click import get_official_package, param2lowercase
from mi... |
logisland-components/logisland-processors/logisland-processor-scripting/src/main/python/processors/basic/BasicProcessor.py | FeizNouri/logisland | 101 | 12678501 | # coding: utf-8
from AbstractProcessor import AbstractProcessor
from com.hurence.logisland.record import StandardRecord
#
# Simple python processor to test ability to run python code and process some
# records.
#
# The python_processor.python_processor_script_path config property of the
# java python processor must p... |
grid/coder_test.py | susannahsoon/oldperth | 302 | 12678505 | from nose.tools import *
from grid import coder
def assert_close(ll1, ll2):
'''Assert that two latitude & longitude tuples are "close".'''
try:
assert_almost_equal(ll1[0], ll2[0], places=6)
assert_almost_equal(ll1[1], ll2[1], places=6)
except AssertionError as e:
print '%s != %s' ... |
tests/hwsim/nl80211.py | yoavst/hostapd-atrik | 1,991 | 12678530 | <filename>tests/hwsim/nl80211.py
# nl80211 definitions
# Copyright (c) 2014, <NAME> <<EMAIL>>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import binascii
import struct
nl80211_cmd = {
'GET_WIPHY': 1,
'SET_WIPHY': 2,
'NEW_WIPHY': 3,
'DEL_WIPHY... |
api/osapi/app.py | alephdata/opensanctions | 102 | 12678536 | import json
import logging
from urllib.parse import urljoin
from typing import Optional
from fastapi import FastAPI, Path, Query, Form, HTTPException
from fastapi.middleware.cors import CORSMiddleware
from followthemoney.types import registry
from starlette.responses import RedirectResponse
from followthemoney import m... |
vumi/transports/mtech_ussd/tests/test_mtech_ussd.py | seidu626/vumi | 199 | 12678541 | from twisted.internet.defer import inlineCallbacks, returnValue
from vumi.utils import http_request_full
from vumi.message import TransportUserMessage
from vumi.transports.mtech_ussd import MtechUssdTransport
from vumi.transports.mtech_ussd.mtech_ussd import MtechUssdResponse
from vumi.transports.tests.helpers import ... |
tools/telemetry/telemetry/page/actions/click_element.py | iplo/Chain | 231 | 12678596 | <gh_stars>100-1000
# 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.
import re
from telemetry.core import util
from telemetry.core import exceptions
from telemetry.page.actions import page_action
def _... |
pygubu/builder/widgets/tkinterscrolledtext.py | larryw3i/pygubu | 1,716 | 12678598 | <filename>pygubu/builder/widgets/tkinterscrolledtext.py
# encoding: utf8
from __future__ import unicode_literals
try:
import tkinter as tk
from tkinter.scrolledtext import ScrolledText
except ImportError:
import Tkinter as tk
from ScrolledText import ScrolledText
from pygubu.builder.builderobject imp... |
data_structures/array/number_of_elements_that_can_searched_using_binary_search.py | ruler30cm/python-ds | 1,723 | 12678603 | <gh_stars>1000+
"""
In an input of unsorted integer array, find the number of elements
that can be searched using binary search
The idea is the an element is binary searchable if the elements to the
left of it are smaller than it and the elements to the right of it
are bigger than it
So maintain two arrays - left_max... |
Robinhood.py | Travisivart/robinhood-to-csv | 256 | 12678604 | import json
import requests
import urllib
try:
from urllib.request import urlretrieve #py3
except ImportError:
from urllib import urlretrieve # py2
class Robinhood:
endpoints = {
"accounts": "https://api.robinhood.com/accounts/",
"ach_iav_auth": "https://api.robinhood.com/ach/iav/auth/"... |
pypyr/steps/contextmerge.py | mofm/pypyr | 261 | 12678613 | """pypyr step that merges the input mappings into context.
Whereas contextcopy and contextsetf overwrites values that are in context
already, contextmerge merges its input into context, preserving the existing
hierarchy while just updating the values where specified in the contextmerge
input.
Applies string interpola... |
kedro/framework/cli/micropkg.py | daniel-falk/kedro | 2,047 | 12678614 | <gh_stars>1000+
"""A collection of CLI commands for working with Kedro micro-packages."""
import re
import shutil
import sys
import tarfile
import tempfile
from importlib import import_module
from pathlib import Path
from typing import Iterable, List, Optional, Set, Tuple, Union
import click
import pkg_resources
from... |
docs/lessons/lesson01_simple.py | jayvdb/live-py-plugin | 224 | 12678664 | """ Simple plot
In this section, we want to draw the cosine and sine functions
on the same plot. Starting from the default settings, we'll
enrich the figure step by step to make it nicer.
First step is to get the data for the sine and cosine functions:
:lesson goal file: goal01.py
"""
import numpy as np
import matplo... |
natlas-server/app/models/__init__.py | purplesecops/natlas | 500 | 12678695 | <filename>natlas-server/app/models/__init__.py
from app.models.agent import Agent
from app.models.agent_config import AgentConfig
from app.models.agent_script import AgentScript
from app.models.config_item import ConfigItem
from app.models.natlas_services import NatlasServices
from app.models.rescan_task import RescanT... |
RecoTauTag/HLTProducers/python/PixelTracksL2Tau_cfi.py | ckamtsikis/cmssw | 852 | 12678699 | import FWCore.ParameterSet.Config as cms
from RecoPixelVertexing.PixelTrackFitting.pixelTracks_cfi import pixelTracks as _pixelTracks
from RecoTauTag.HLTProducers.trackingRegionsFromBeamSpotAndL2Tau_cfi import trackingRegionsFromBeamSpotAndL2Tau
# Note from new seeding framework migration
# Previously the TrackingReg... |
NVIDIA/benchmarks/transformer/implementations/pytorch/fairseq/criterions/__init__.py | mengkai94/training_results_v0.6 | 140 | 12678714 | <gh_stars>100-1000
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import importli... |
mnist_cifar/main.py | elony314/sparse_learning | 365 | 12678735 | <filename>mnist_cifar/main.py<gh_stars>100-1000
from __future__ import print_function
import sys
import os
import shutil
import time
import argparse
import logging
import hashlib
import copy
import torch
import torch.nn.functional as F
import torch.optim as optim
import torch.backends.cudnn as cudnn
import numpy as np... |
static_precompiler/tests/test_management.py | codexterous/django-static-precompiler | 160 | 12678751 | import os
import pytest
from django.core import management
import static_precompiler.settings
from static_precompiler.management.commands import compilestatic
def test_get_scanned_dirs():
assert compilestatic.get_scanned_dirs() == sorted(
[
os.path.join(os.path.dirname(__file__), "compilest... |
examples/rmg/pruning_test/input.py | tza0035/RMG-Py | 250 | 12678756 | # Data sources
database(
thermoLibraries = ['primaryThermoLibrary'],
reactionLibraries = [],
seedMechanisms = [],
kineticsDepositories = ['training'],
kineticsFamilies = 'default',
kineticsEstimator = 'rate rules',
)
# List of species
species(
label='ethane',
reactive=True,
structur... |
lib/forms.py | srvz/F2E.im | 340 | 12678759 | <reponame>srvz/F2E.im<gh_stars>100-1000
#
# Copyright (c) 2008 <NAME> <EMAIL>
#
# forms.py 31-Jul-2011
#
# 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/LICEN... |
alipay/aop/api/response/AlipayOpenMiniInnerversionLastQueryResponse.py | antopen/alipay-sdk-python-all | 213 | 12678781 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayOpenMiniInnerversionLastQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayOpenMiniInnerversionLastQueryResponse, self).__init__()
self._app_desc = ... |
z3/exodus.py | Wikunia/hakank | 279 | 12678806 | #!/usr/bin/python -u
# -*- coding: latin-1 -*-
#
# Exodus puzzle (Dell Logic Puzzles) in Z3
#
# From
# http://brownbuffalo.sourceforge.net/ExodusClues.html
# """
# Title: Exodus
# Author: <NAME>
# Publication: Dell Logic Puzzles
# Issue: April, 1998
# Page: 14
# Stars: 2
# In preparation for Passover, five children ... |
scripts/init-account-url.py | horacexd/clist | 166 | 12678809 | #!/usr/bin/env python3
from django.db.models.signals import m2m_changed
from django.db.models import Q
from django.db import transaction
from tqdm import tqdm
from ranking.models import Account, update_account_url
def run(*args):
qs = Account.objects.filter(Q(url__isnull=True) | Q(coders__isnull=False))
tot... |
setup.py | ewels/rich-click | 185 | 12678815 | <reponame>ewels/rich-click
from setuptools import setup
setup(
name="rich-click",
install_requires=[
"click>=7",
"rich>=10.7.0",
"importlib-metadata; python_version < '3.8'",
],
extras_require={
"typer": "typer>=0.4",
"dev": "pre-commit",
},
package_data=... |
sdk/python/tests/test_benchmark_collections.py | rpatil524/arvados | 222 | 12678843 | # Copyright (C) The Arvados Authors. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import absolute_import
import arvados
import sys
from . import run_test_server
from . import arvados_testutil as tutil
from . import manifest_examples
from .performance.performance_profiler import profile... |
deps/cld/binding.gyp | LaudateCorpus1/node-cld | 206 | 12678848 | <reponame>LaudateCorpus1/node-cld
{
"targets": [
{
"target_name": "cld-c",
"type": "static_library",
"include_dirs": [
"internal",
],
"sources": [
"internal/cldutil.cc",
"internal/cldutil_shared.cc",
"internal/compact_lang_det.cc",
"internal/co... |
examples/eratosthenes/sieve_cpython.py | bennn/PyonR | 132 | 12678859 | <filename>examples/eratosthenes/sieve_cpython.py
def sieve(n):
primes = [True] * (n+1)
counter = 0
for i in range(2,n):
if primes[i]:
counter = counter + 1
for j in range(i*i, n, i):
primes[j] = False
return counter
import time
a = time.time()
print sieve(10000000)
b=time.time()
print b... |
pythonforandroid/recipes/babel/__init__.py | lstwzd/python-for-android | 6,278 | 12678861 | from pythonforandroid.recipe import PythonRecipe
class BabelRecipe(PythonRecipe):
name = 'babel'
version = '2.2.0'
url = 'https://pypi.python.org/packages/source/B/Babel/Babel-{version}.tar.gz'
depends = ['setuptools', 'pytz']
call_hostpython_via_targetpython = False
install_in_hostpython = ... |
recognition/valid.py | w-garcia/insightface | 108 | 12678884 | <reponame>w-garcia/insightface
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import sys
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
import yaml
from recognition.backbones.resnet_v1 import ResNet_v1_50
from recognition.data.generate_d... |
fuzzers/ECP5/103-gsr/fuzzer.py | Keno/prjtrellis | 256 | 12678896 | from fuzzconfig import FuzzConfig
import nonrouting
import pytrellis
import fuzzloops
import interconnect
cfg = FuzzConfig(job="GSR", family="ECP5", device="LFE5U-45F", ncl="empty.ncl",
tiles=["MIB_R71C4:EFB0_PICB0", "MIB_R34C41:VIQ_BUF"])
def get_substs(gsrmode="ACTIVE_LOW", syncmode="NONE"):
i... |
tests/st/ops/ascend/vector/test_quantized_avg_pool_001.py | tianjiashuo/akg | 286 | 12678897 | <gh_stars>100-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 applicab... |
fengshen/data/cbart_dataloader/cbart_dataset.py | TianHongZXY/Fengshenbang-LM | 265 | 12678901 | import os
import time
import torch
import glob
import numpy as np
from torch.utils.data import Dataset
from torch.nn.utils.rnn import pad_sequence
from dataclasses import dataclass
from transformers.data.data_collator import DataCollatorMixin
from fengshen.data.MMapIndexDataset import MMapIndexDataset
def safe_check... |
torchgan/logging/visualize.py | torchgan/torchgan | 1,300 | 12678930 | <reponame>torchgan/torchgan<filename>torchgan/logging/visualize.py
import torch
import torchvision
from ..models.model import Discriminator, Generator
from .backends import *
if TENSORBOARD_LOGGING == 1:
from tensorboardX import SummaryWriter
if VISDOM_LOGGING == 1:
import visdom
__all__ = [
"Visualize",... |
python/regex.py | honux77/practice | 152 | 12678939 | <filename>python/regex.py
import re
# simple code to extract serial from xml
# use regex and findall method
with open('keys.txt') as fp:
data = fp.read()
p = re.compile(r'\w{5}-\w{5}-\w{5}-\w{5}-\w{5}')
keys = p.findall(data)
with open('newkey.csv', 'w') as fp:
fp.writelines('win7pro-key\n')
... |
demos/place_recognition_demo/python/place_recognition_demo/place_recognition.py | APrigarina/open_model_zoo | 1,031 | 12678940 | <reponame>APrigarina/open_model_zoo
"""
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 b... |
terrascript/resource/cappyzawa/concourse.py | mjuenema/python-terrascript | 507 | 12679007 | # terrascript/resource/cappyzawa/concourse.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:14:28 UTC)
import terrascript
class concourse_team(terrascript.Resource):
pass
__all__ = [
"concourse_team",
]
|
crabageprediction/venv/Lib/site-packages/fontTools/ttLib/tables/_v_m_t_x.py | 13rianlucero/CrabAgePrediction | 38,667 | 12679011 | from fontTools import ttLib
superclass = ttLib.getTableClass("hmtx")
class table__v_m_t_x(superclass):
headerTag = 'vhea'
advanceName = 'height'
sideBearingName = 'tsb'
numberOfMetricsName = 'numberOfVMetrics'
|
StockAnalysisSystem/plugin/Collector/market_data_tushare_pro.py | SleepySoft/StockAnalysisSystem | 138 | 12679023 | <gh_stars>100-1000
import pandas as pd
import tushare as ts
from StockAnalysisSystem.core.config import TS_TOKEN
from StockAnalysisSystem.core.Utility.common import *
from StockAnalysisSystem.core.Utility.time_utility import *
from StockAnalysisSystem.core.Utility.CollectorUtility import *
# ------------------------... |
airflow/providers/tableau/operators/tableau.py | ChaseKnowlden/airflow | 15,947 | 12679030 | # 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... |
programs/test_java_lookup.py | Unknoob/buck | 8,027 | 12679039 | # 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-2.0
#
# Unless required by applicable law or ... |
text/src/autogluon/text/text_prediction/metrics.py | zhiqiangdon/autogluon | 4,462 | 12679055 | __all__ = ['calculate_metric_by_expr', 'infer_eval_log_metrics']
import ast
import operator as op
from autogluon.core.constants import MULTICLASS, BINARY, REGRESSION
# supported operators
operators = {ast.Add: op.add, ast.Sub: op.sub, ast.Mult: op.mul,
ast.Div: op.truediv, ast.Pow: op.pow, ast.BitXor: op... |
guild/tests/samples/projects/get-started/train.py | msarahan/guildai | 694 | 12679093 | import numpy as np
# Hyperparameters
x = 0.1
noise = 0.1
print("x: %f" % x)
print("noise: %f" % noise)
# Simulated training loss
loss = np.sin(5 * x) * (1 - np.tanh(x ** 2)) + np.random.randn() * noise
print("loss: %f" % loss)
|
aztk/models/plugins/__init__.py | lachiemurray/aztk | 161 | 12679095 | <gh_stars>100-1000
from .plugin_file import *
from .plugin_configuration import *
|
test/nn/conv/test_cheb_conv.py | NucciTheBoss/pytorch_geometric | 2,350 | 12679099 | <filename>test/nn/conv/test_cheb_conv.py
import torch
from torch_geometric.nn import ChebConv
from torch_geometric.testing import is_full_test
def test_cheb_conv():
in_channels, out_channels = (16, 32)
edge_index = torch.tensor([[0, 0, 0, 1, 2, 3], [1, 2, 3, 0, 0, 0]])
num_nodes = edge_index.max().item()... |
dephell/controllers/_resolver.py | jayvdb/dephell | 1,880 | 12679100 | <filename>dephell/controllers/_resolver.py
# built-in
import re
from logging import getLogger
from typing import TYPE_CHECKING, Optional
# external
from packaging.markers import Marker
from yaspin import yaspin
# app
from ..context_tools import nullcontext
from ..models import RootDependency
from ._conflict import an... |
testing/kfctl/kfctl_second_apply.py | zhyon404/kubeflow | 9,272 | 12679118 | import logging
import os
import pytest
from kubeflow.kubeflow.ci import kfctl_go_test_utils as kfctl_util
from kubeflow.testing import util
@pytest.mark.skipif(os.getenv("JOB_TYPE") == "presubmit",
reason="test second apply doesn't run in presubmits")
def test_second_apply(record_xml_attribute, ... |
patroni/postgresql/validator.py | kostiantyn-nemchenko/patroni | 4,759 | 12679125 | <filename>patroni/postgresql/validator.py<gh_stars>1000+
import abc
import logging
import six
from collections import namedtuple
from urllib3.response import HTTPHeaderDict
from ..utils import parse_bool, parse_int, parse_real
logger = logging.getLogger(__name__)
class CaseInsensitiveDict(HTTPHeaderDict):
def... |
elephant/test/test_utils.py | Moritz-Alexander-Kern/elephant-1 | 121 | 12679153 | <reponame>Moritz-Alexander-Kern/elephant-1<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Unit tests for the synchrofact detection app
"""
import unittest
import neo
import numpy as np
import quantities as pq
from elephant import utils
from numpy.testing import assert_array_equal
class TestUtils(unittest.TestCase):... |
tests/medium/plugins/test_tcp_output.py | mickotronic/eventgen | 305 | 12679155 | <gh_stars>100-1000
#!/usr/bin/env python3
# encoding: utf-8
import os
import sys
from mock import MagicMock, patch
from splunk_eventgen.__main__ import parse_args
from splunk_eventgen.eventgen_core import EventGenerator
from splunk_eventgen.lib.plugins.output.tcpout import TcpOutputPlugin
FILE_DIR = os.path.dirname... |
ikalog/inputs/input.py | fetus-hina/IkaLog | 285 | 12679161 | <filename>ikalog/inputs/input.py<gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# IkaLog
# ======
# Copyright (C) 2015 <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 Li... |
tests/test_rangeset.py | runfalk/spans | 123 | 12679164 | import pickle
import pytest
from spans import \
daterangeset, datetimerangeset, floatrange, floatrangeset, intrange, \
intrangeset, strrangeset, timedeltarangeset
def test_empty():
assert not intrangeset([])
def test_non_empty():
assert intrangeset([intrange(1, 5)])
@pytest.mark.parametrize("rang... |
ch07/07_07.py | leeseedong/book-cryptocurrency | 121 | 12679166 | <reponame>leeseedong/book-cryptocurrency<gh_stars>100-1000
import pybithumb
import numpy as np
df = pybithumb.get_ohlcv("BTC")
df['range'] = (df['high'] - df['low']) * 0.5
df['target'] = df['open'] + df['range'].shift(1)
df['ror'] = np.where(df['high'] > df['target'],
df['close'] / df['target'],
... |
python/math_test.py | honux77/practice | 152 | 12679178 | import math
def fact(x):
if x == 1:
return 1
else:
return x * fact(x-1);
def mysin(x):
return x - math.pow(x,3)/fact(3) + pow(x,5)/fact(5) - pow(x,7)/fact(7) \
+ math.pow(x,9)/fact(9)
print mysin(3.14/2), math.sin(3.14/2)
print mysin(3.14/4), math.sin(3.14/4), 1/math.sqrt(2)
|
test/spreadsheet_test.py | hermansyah/hyou | 121 | 12679188 | # Copyright 2015 Google Inc. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
scvi/dataloaders/_data_splitting.py | YosefLab/scVI | 398 | 12679213 | <filename>scvi/dataloaders/_data_splitting.py
from math import ceil, floor
from typing import Dict, List, Optional
import numpy as np
import pytorch_lightning as pl
import torch
from torch.utils.data import DataLoader, Dataset
from scvi import REGISTRY_KEYS, settings
from scvi.data import AnnDataManager
from scvi.dat... |
html_parsing/tolko-tebe.ru_uspeykupit.py | DazEB2/SimplePyScripts | 117 | 12679218 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from urllib.parse import urljoin
import requests
def wait(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0):
from datetime import timedelta, datetime
from itertools import cycle
impo... |
tests/test_scripts.py | center-for-threat-informed-defense/attack-control-framework-mappings | 269 | 12679222 | import os
import pathlib
import subprocess
import sys
import pytest
@pytest.fixture()
def attack_domain():
return "enterprise-attack"
@pytest.fixture()
def dir_location():
cwd = os.getcwd()
if "tests" in cwd:
return os.path.dirname(cwd)
else:
return cwd
@pytest.mark.parametrize("a... |
misc/l2net/convert_l2net_weights_matconv_pytorch.py | mihaidusmanu/image-matching-benchmark-baselines | 103 | 12679228 | <reponame>mihaidusmanu/image-matching-benchmark-baselines
import numpy as np
import scipy.io as sio
import torch
import torch.nn.init
from misc.l2net.l2net_model import L2Net
eps = 1e-10
def check_ported(l2net_model, test_patch, img_mean):
test_patch = test_patch.transpose(3, 2, 0, 1)-img_mean
desc = l2net_m... |
openpyscad/modifiers.py | GothAck/openpyscad | 105 | 12679234 | <reponame>GothAck/openpyscad<gh_stars>100-1000
# -*- coding: utf-8 -*-
class Modifier(object):
def __init__(self):
self.is_disable = False
self.is_show_only = False
self.is_debug = False
self.is_transparent = False
def turn_on_disable(self):
self.is_disable = True
... |
chirp/plugins/events/__init__.py | dhanizael/CHIRP | 1,080 | 12679253 | """Event plugin initializer."""
from . import scan
REQUIRED_OS = "Windows"
REQUIRED_ADMIN = True
entrypoint = scan.run
|
train/tasks/segmentation/dataset/coco/parser.py | hamzaMahdi/bonnetal | 231 | 12679265 | # This file is covered by the LICENSE file in the root of this project.
import torch
from torch.utils.data import Dataset
import torchvision.transforms as transforms
import os
import numpy as np
from PIL import Image
import random
import torchvision.transforms.functional as TF
import cv2
'''
means(rgb): [0.47037394 ... |
test/sagemaker_tests/pytorch/inference/integration/sagemaker/test_neuron_hosting.py | johnbensnyder/deep-learning-containers | 383 | 12679279 | <filename>test/sagemaker_tests/pytorch/inference/integration/sagemaker/test_neuron_hosting.py
# Copyright 2019-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# ... |
isegm/model/losses.py | supervisely-ecosystem/ritm-training | 278 | 12679284 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from isegm.utils import misc
class NormalizedFocalLossSigmoid(nn.Module):
def __init__(self, axis=-1, alpha=0.25, gamma=2, max_mult=-1, eps=1e-12,
from_sigmoid=False, detach_delimeter=True,
bat... |
certbot-dns-gehirn/certbot_dns_gehirn/_internal/__init__.py | vivithemage/certbot | 16,789 | 12679290 | """Internal implementation of `~certbot_dns_gehirn.dns_gehirn` plugin."""
|
tf_quant_finance/experimental/pricing_platform/framework/market_data/volatility_surface_test.py | slowy07/tf-quant-finance | 3,138 | 12679293 | <filename>tf_quant_finance/experimental/pricing_platform/framework/market_data/volatility_surface_test.py
# Lint as: python3
# 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 L... |
Python/random-password-generator.py | OluSure/Hacktoberfest2021-1 | 215 | 12679308 | print("Hi, are you having trouble making a password?")
print("let me help you!")
number = input("give me a number from 1-3")
password = <PASSWORD>
animal = input("do you prefer dogs or cats?")
password = number + animal
color=input("what is your favorite color?")
password = color+number+animal
book=input("ok, last ques... |
test/hlt/pytest/python/test_linux_mqtt_al.py | yuanyi-thu/AIOT- | 128 | 12679313 | <gh_stars>100-1000
import pytest
import sys
import time
import json
import requests
from requests.adapters import HTTPAdapter
from requests import RequestException, ReadTimeout
from test_adapter import ts_call_single
from test_adapter import resource_release
from const import mqtt_device_info
from const import mqtt_tes... |
lib/pymedphys/_experimental/pedromartinez/utils/running_mean.py | ethanio12345/pymedphys | 207 | 12679314 | from pymedphys._imports import numpy as np
def running_mean(x, N):
out = np.zeros_like(x, dtype=np.float64)
dim_len = x.shape[0]
for i in range(dim_len):
if N % 2 == 0:
a, b = i - (N - 1) // 2, i + (N - 1) // 2 + 2
else:
a, b = i - (N - 1) // 2, i + (N - 1... |
Python/Tests/TestData/SendToInteractive/SelectOutput.py | techkey/PTVS | 404 | 12679333 | print('first')
print('second')
if True:
x = 1
y = 2
print('hi')
|
tests/test_download_and_extract_extracaptiveflask.py | oza6ut0ne/wifipumpkin3 | 911 | 12679353 | import unittest
from wifipumpkin3.core.common.platforms import Linux
import wifipumpkin3.core.utility.constants as C
from wifipumpkin3.core.utility.collection import SettingsINI
import tempfile
import requests
import os
from os import path
from zipfile import ZipFile
class TestDownloadCaptiveFlaskTemplates(unittest.T... |
utils/compute_mean_std.py | tink2123/DBNet.pytorch | 709 | 12679359 | # -*- coding: utf-8 -*-
# @Time : 2019/12/7 14:46
# @Author : zhoujun
import numpy as np
import cv2
import os
import random
from tqdm import tqdm
# calculate means and std
train_txt_path = './train_val_list.txt'
CNum = 10000 # 挑选多少图片进行计算
img_h, img_w = 640, 640
imgs = np.zeros([img_w, img_h, 3, 1])
means, stdev... |
corehq/messaging/scheduling/migrations/0009_randomtimedevent.py | dimagilg/commcare-hq | 471 | 12679361 | # Generated by Django 1.11.7 on 2017-12-12 19:08
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('scheduling', '0008_timedschedule_event_type'),
]
operations = [
migrations.CreateModel(
name='... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.