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 |
|---|---|---|---|---|
chainercv/transforms/image/random_sized_crop.py | souravsingh/chainercv | 1,600 | 11139789 | from __future__ import division
import math
import numpy as np
import random
def random_sized_crop(img,
scale_ratio_range=(0.08, 1),
aspect_ratio_range=(3 / 4, 4 / 3),
return_param=False, copy=False):
"""Crop an image to random size and aspect rat... |
worldengine/drawing_functions.py | ctittel/worldengine | 946 | 11139808 | """
This file should contain only functions that operates on pixels, not on images,
so no references to PIL are necessary and the module can be used also through
Jython
"""
import numpy
import sys
import time
from worldengine.common import get_verbose, count_neighbours
from worldengine.common import anti_alias as anti... |
opsdroid/testing/mockmodules/skills/skill/skilltest/mock.py | JiahnChoi/opsdroid.kr | 712 | 11139828 | """Mock skill."""
|
coverage/disposition.py | timofurrer/coveragepy | 2,254 | 11139834 | <reponame>timofurrer/coveragepy
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Simple value objects for tracking what to do with files."""
class FileDisposition:
"""A simple value type for recording wha... |
cctbx/sgtbx/direct_space_asu/proto/__init__.py | dperl-sol/cctbx_project | 155 | 11139838 | from __future__ import absolute_import, division, print_function
import sys
import boost_adaptbx.boost.python as bp
ext = bp.import_ext("cctbx_sgtbx_asu_ext")
from cctbx_sgtbx_asu_ext import *
def asu_show_(asu, f=None):
if f is None:
f = sys.stdout
print(asu.as_string(), file=f)
direct_space_asu.show_compre... |
tests/init_test.py | RaSan147/python | 283 | 11139871 | import ipinfo
from ipinfo.handler import Handler
from ipinfo.handler_async import AsyncHandler
def test_get_handler():
handler = ipinfo.getHandler()
assert isinstance(handler, Handler)
def test_get_handler_async():
handler = ipinfo.getHandlerAsync()
assert isinstance(handler, AsyncHandler)
|
src/sparsezoo/requests/download.py | signalism/sparsezoo | 116 | 11139894 | # Copyright (c) 2021 - present / Neuralmagic, 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 b... |
examples/volumetric/tet_threshold.py | evanphilip/vedo | 836 | 11139907 | <reponame>evanphilip/vedo
"""Threshold the original TetMesh
with a scalar array"""
from vedo import *
settings.useDepthPeeling = True
tetm = TetMesh(dataurl+'limb_ugrid.vtk')
tetm.color('prism').alpha([0,1])
# Threshold the tetrahedral mesh for values in the range:
tetm.threshold(above=0.9, below=1)
tetm.addScalarBa... |
assets/src/ba_data/python/bastd/ui/report.py | Benefit-Zebra/ballistica | 317 | 11139918 | # Released under the MIT License. See LICENSE for details.
#
"""UI related to reporting bad behavior/etc."""
from __future__ import annotations
import _ba
import ba
class ReportPlayerWindow(ba.Window):
"""Player for reporting naughty players."""
def __init__(self, account_id: str, origin_widget: ba.Widget)... |
code/ReplaceDenormals.py | starimeL/PytorchConverter | 411 | 11139926 | <reponame>starimeL/PytorchConverter
import numpy as np
import torch
def ReplaceDenormals(net):
for name, param in net.named_parameters():
np_arr = param.data.numpy()
for x in np.nditer(np_arr, op_flags=['readwrite']):
if abs(x) < 1e-30:
x[...] = 1e-30
param.data... |
keras_extensions/rbm.py | xgenpanda/keras_extension | 225 | 11139929 | <gh_stars>100-1000
from __future__ import division
import numpy as np
from keras import initializations, regularizers, constraints
from keras import backend as K
from keras.layers.core import Layer, Dense
from .backend import random_binomial
import theano
class RBM(Layer):
"""
Bernoulli-Bernoulli Restric... |
nazurin/sites/Pixiv/models.py | amber6hua/nazurin | 170 | 11139958 | <filename>nazurin/sites/Pixiv/models.py
from dataclasses import dataclass
from random import random
from nazurin.models import Illust, Image
from .config import HEADERS, IMG_PROXY
@dataclass
class PixivImage(Image):
async def display_url(self):
# use reverse proxy to avoid strange problems
url = ... |
tests/integration/test_reexec.py | Satertek/pex | 2,160 | 11139967 | # Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import json
import os
import subprocess
import sys
from textwrap import dedent
import pytest
from pex.common import temporary_dir
from pex.interpreter import PythonInterpreter
from pex.t... |
kats/models/globalmodel/ensemble.py | iamxiaodong/Kats | 3,580 | 11140005 | # 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.
# pyre-unsafe
import logging
import time
from multiprocessing import cpu_count
from multiprocessing.dummy import Pool
from typing import List, ... |
mlens/parallel/base.py | mehrdad-shokri/mlens | 760 | 11140018 | """ML-Ensemble
:author: <NAME>
:copyright: 2017-2018
:license: MIT
Base classes for parallel estimation
Schedulers for global setups:
0:
Base setups - independent of other features:
IndexMixin._setup_0_index
1:
Global setups - reserved for aggregating classes:
Layer._setup_1_glo... |
tests/test_private_func.py | raphaelahrens/pytm | 524 | 11140042 | import random
import unittest
from pytm.pytm import (
TM,
Actor,
Boundary,
Data,
Dataflow,
Datastore,
Process,
Server,
Threat,
)
class TestUniqueNames(unittest.TestCase):
def test_duplicate_boundary_names_have_different_unique_names(self):
random.seed(0)
object... |
misc/utils.py | hzhucn/Visual_Dialogue.pytorch | 123 | 11140043 | <filename>misc/utils.py
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import random
import pdb
"""
Some utility Functions.
"""
def repackage_hidden_volatile(h):
if type(h) == Variable:
return Variable(h.data, volatile=True)
else:
return t... |
sdk/consumption/azure-mgmt-consumption/azure/mgmt/consumption/aio/_consumption_management_client.py | rsdoherty/azure-sdk-for-python | 2,728 | 11140065 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
tools/pythonpkg/tests/fast/api/test_insert_into.py | AldoMyrtaj/duckdb | 2,816 | 11140066 | import duckdb
from pandas import DataFrame
import pytest
class TestInsertInto(object):
def test_insert_into_schema(self, duckdb_cursor):
# open connection
con = duckdb.connect()
con.execute('CREATE SCHEMA s')
con.execute('CREATE TABLE s.t (id INTEGER PRIMARY KEY)')
# make r... |
atcoder/abc053/a.py | Ashindustry007/competitive-programming | 506 | 11140095 | #!/usr/bin/env python3
# https://abc053.contest.atcoder.jp/tasks/abc053_a
x = int(input())
if x < 1200: print('ABC')
else: print('ARC')
|
tests/unit/utils/test_static.py | fairhopeweb/warehouse | 3,103 | 11140114 | # 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 the Li... |
opendatatools/datayes/robo_agent.py | solider245/OpenData | 1,179 | 11140137 | <filename>opendatatools/datayes/robo_agent.py
from opendatatools.common import RestAgent
import pandas as pd
import json
top_items_map = {
'中国宏观' : "402273",
'行业经济' : "771263",
'国际宏观' : "1138921",
'特色数据' : "632815",
'市场行情' : 'RRP1349982',
'公司数据' : 'RRP1',
}
class RoboAgent(RestAgent):
def... |
9_Alexnet_fastai/alexnet.py | Sara-Rajaee/Deep_learning_explorations | 154 | 11140141 | # Import necessary packages
import torch.nn as nn
import numpy as np
class AlexNet(nn.Module):
def __init__(self, features, n_class=1000):
super(AlexNet, self).__init__()
self.features = features
# (FC=>ACT=>BN=>DO)x2=>FC=>SOFTMAX
self.classifier = nn.Sequential(
nn.Lin... |
tests/models/test_standard_absolute_deviation.py | selimfirat/pysad | 155 | 11140166 |
def test_standard_absolute_deviation():
from pysad.models import StandardAbsoluteDeviation
import numpy as np
from numpy.testing import assert_raises
from pysad.utils import fix_seed
fix_seed(61)
X = np.random.rand(150, 1)
model = StandardAbsoluteDeviation(substracted_statistic="mean")
... |
parallel_wavegan/losses/adversarial_loss.py | A-Quarter-Mile/ParallelWaveGAN | 1,023 | 11140167 | # -*- coding: utf-8 -*-
# Copyright 2021 <NAME>
# MIT License (https://opensource.org/licenses/MIT)
"""Adversarial loss modules."""
import torch
import torch.nn.functional as F
class GeneratorAdversarialLoss(torch.nn.Module):
"""Generator adversarial loss module."""
def __init__(
self,
av... |
tensorboard/main_lib.py | Digitaltransform/tensorboard | 6,139 | 11140169 | # Copyright 2021 The TensorFlow 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 applica... |
junit2htmlreport/matrix.py | camresp/junit2html | 112 | 11140176 | <filename>junit2htmlreport/matrix.py
"""
Handle multiple parsed junit reports
"""
from __future__ import unicode_literals
import os
from . import parser
from .common import ReportContainer
from .parser import SKIPPED, FAILED, PASSED, ABSENT
from .render import HTMLMatrix, HTMLReport
UNTESTED = "untested"
PARTIAL_PASS ... |
scitbx/cross_entropy.py | dperl-sol/cctbx_project | 155 | 11140185 | from __future__ import absolute_import, division, print_function
from scitbx.array_family import flex
from scitbx.python_utils import random_transform
import sys
from six.moves import range
from six.moves import zip
class cross_entropy_optimizer(object):
def __init__(self, function, mean, sigma, alpha, beta, q=7, e... |
tests/functional/fixtures/authentication.py | pombredanne/h | 2,103 | 11140194 | import pytest
__all__ = (
"user",
"login_user",
"with_logged_in_user",
"with_logged_in_staff_member",
"with_logged_in_admin",
)
@pytest.fixture
def user(factories):
return factories.User()
@pytest.fixture
def login_user(db_session, app, user):
def login_user(staff=False, admin=False):
... |
.venv/lib/python3.8/site-packages/numpy/core/__init__.py | acrucetta/Chicago_COVI_WebApp | 6,989 | 11140195 | """
Contains the core of NumPy: ndarray, ufuncs, dtypes, etc.
Please note that this module is private. All functions and objects
are available in the main ``numpy`` namespace - use that instead.
"""
from numpy.version import version as __version__
import os
# disables OpenBLAS affinity setting of the main thread ... |
mediasoup-client/deps/webrtc/src/build/android/lighttpd_server.py | skgwazap/mediasoup-client-android | 128 | 11140199 | <filename>mediasoup-client/deps/webrtc/src/build/android/lighttpd_server.py
#!/usr/bin/env python
#
# 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.
"""Provides a convenient wrapper for spawning a test ... |
var/spack/repos/builtin/packages/r-kernlab/package.py | kkauder/spack | 2,360 | 11140221 | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RKernlab(RPackage):
"""Kernel-Based Machine Learning Lab
Kernel-based machine learnin... |
Char01 DQN/DQN_CartPole-v0.py | Yexiong-Zeng/Deep-reinforcement-learning-with-pytorch | 2,224 | 11140240 | <gh_stars>1000+
import argparse
import pickle
from collections import namedtuple
from itertools import count
import os, time
import numpy as np
import matplotlib.pyplot as plt
import gym
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.distributions import Norm... |
corehq/apps/domain/views/tombstone.py | akashkj/commcare-hq | 471 | 11140246 | from datetime import datetime
from crispy_forms import layout as crispy
from django.contrib import messages
from django.http import HttpResponseRedirect
from corehq.apps.domain.dbaccessors import iter_all_domains_and_deleted_domains_with_name
from corehq.apps.domain.models import Domain
from corehq.apps.hqwebapp.cris... |
apim-migration-testing-tool/Python/venv/lib/python3.6/site-packages/google/protobuf/internal/text_encoding_test.py | tharindu1st/apim-migration-resources | 14,668 | 11140275 | #! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions ... |
meltingpot/python/utils/scenarios/wrappers/all_observations_wrapper_test.py | vishalbelsare/meltingpot | 132 | 11140293 | <filename>meltingpot/python/utils/scenarios/wrappers/all_observations_wrapper_test.py
# Copyright 2020 DeepMind Technologies Limited.
#
# 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
#
# h... |
model/solver.py | jsedoc/A-Hierarchical-Latent-Structure-for-Variational-Conversation-Modeling | 167 | 11140326 | from itertools import cycle
import numpy as np
import torch
import torch.nn as nn
import models
from layers import masked_cross_entropy
from utils import to_var, time_desc_decorator, TensorboardWriter, pad_and_pack, normal_kl_div, to_bow, bag_of_words_loss, normal_kl_div, embedding_metric
import os
from tqdm import tqd... |
tools/regression/xsl_reports/report.py | zyiacas/boost-doc-zh | 198 | 11140334 |
# Copyright (c) MetaCommunications, Inc. 2003-2004
#
# 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)
import shutil
import os.path
import os
import string
import time
import sys
import utils
impor... |
sim.py | flint-stone/OpenTPU | 248 | 11140337 | # coding=utf-8
import argparse
import sys
import numpy as np
from collections import deque
from math import exp
import isa
from config import MATSIZE as WIDTH
args = None
# width of the tile
#WIDTH = 16
class TPUSim(object):
def __init__(self, program_filename, dram_filename, hostmem_filename):
# TODO: ... |
rplugin/python3/defx/util.py | Matsui54/defx.nvim | 1,229 | 11140339 | # ============================================================================
# FILE: util.py
# AUTHOR: <NAME> <Shougo.Matsu at gmail.<EMAIL>>
# License: MIT license
# ============================================================================
from pathlib import Path
from pynvim import Nvim
from sys import executab... |
examples/pytorch/pinsage/evaluation.py | ketyi/dgl | 9,516 | 11140341 | <reponame>ketyi/dgl
import numpy as np
import torch
import pickle
import dgl
import argparse
def prec(recommendations, ground_truth):
n_users, n_items = ground_truth.shape
K = recommendations.shape[1]
user_idx = np.repeat(np.arange(n_users), K)
item_idx = recommendations.flatten()
relevance = groun... |
tests/test_transactionscout.py | nhatminhbeo/mango-explorer | 131 | 11140349 | from .context import mango
from .fakes import fake_mango_instruction, fake_seeded_public_key, fake_token
from datetime import datetime
from decimal import Decimal
from solana.publickey import PublicKey
import typing
def test_transaction_instruction_constructor() -> None:
instruction_type: mango.InstructionType ... |
module/Handshaker/Handshaker.py | Yiidiir/SniffAir | 1,173 | 11140379 | <gh_stars>1000+
#!/usr/bin/python
import logging
logging.getLogger ( "scapy.runtime" ).setLevel ( logging.CRITICAL )
from scapy.all import *
load_contrib ( 'ppi_cace' )
import sys, os, time, signal, subprocess
import argparse
sys.path.insert ( 0, '../../lib/' )
from Queries import *
parser = argparse.ArgumentParser... |
scripts/ch4_proximity.py | mathkann/understanding-random-forests | 353 | 11140394 | import numpy as np
import matplotlib.pyplot as plt
from itertools import cycle
from scipy.spatial.distance import pdist, squareform
from sklearn.datasets import load_digits
from sklearn.ensemble import RandomForestClassifier
from sklearn.manifold import MDS
def rf_proximities(forest, X):
prox = pdist(forest.app... |
www/tests/inject_name_in_module.py | raspberrypieman/brython | 5,926 | 11140398 | <gh_stars>1000+
def yyy():
return xxx*2 |
retool-gui.py | rufotheone-fr/retool | 117 | 11140414 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" retool-gui.py: GUI version of Retool for Windows.
https://github.com/unexpectedpanda/retool
"""
import os
import platform
import PySimpleGUIQt as sg
import retool
import sys
import updateclonelists
import webbrowser
from modules.classes import Filter... |
hail/python/test/hailtop/hailctl/dataproc/test_start.py | tdeboer-ilmn/hail | 789 | 11140417 | <filename>hail/python/test/hailtop/hailctl/dataproc/test_start.py
import pytest
from hailtop.hailctl.dataproc import cli
def test_cluster_name_required(capsys, gcloud_run):
with pytest.raises(SystemExit):
cli.main(["start"])
assert "arguments are required: name" in capsys.readouterr().err
assert... |
alembic/versions/2014090207_add_subworksheets_to__136275e06649.py | kl-chou/codalab-worksheets | 236 | 11140420 | <filename>alembic/versions/2014090207_add_subworksheets_to__136275e06649.py
"""Add subworksheets to worksheet item
Revision ID: 136275e06649
Revises: <KEY>
Create Date: 2014-09-02 07:44:47.959083
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '136275e06649'
do... |
pytest-server-fixtures/pytest_server_fixtures/rethink.py | RaiVaibhav/pytest-plugins | 167 | 11140433 | import socket
import uuid
import logging
import pytest
from pytest_server_fixtures import CONFIG
from pytest_fixture_config import requires_config
from .base2 import TestServerV2
log = logging.getLogger(__name__)
rethinkdb = None
def _rethink_server(request):
""" This does the actual work - there are several... |
dicompylercore/config.py | gacou54/dicompyler-core | 110 | 11140435 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# config.py
"""Configuration for dicompyler-core."""
# Copyright (c) 2016-2018 <NAME>
# This file is part of dicompyler-core, released under a BSD license.
# See the file license.txt included with this distribution, also
# available at https://github.com/dicompyler/di... |
examples/cookbook/symsph.py | dualword/pymol-open-source | 636 | 11140469 | <gh_stars>100-1000
# symshp: create a symmetry-expanded sphere about a selection
# usage:
#
# symexp name [,selection [,cutoff ]]
from pymol import cmd as global_cmd
def symsph(name, selection="sele", cutoff=20.0, self_cmd=global_cmd):
cutoff = float(cutoff)
prefix = selection+"_symarea_"
tmp_obj = se... |
libs/cherrypy/tutorial/tut08_generators_and_yield.py | scambra/HTPC-Manager | 674 | 11140482 | <reponame>scambra/HTPC-Manager
"""
Bonus Tutorial: Using generators to return result bodies
Instead of returning a complete result string, you can use the yield
statement to return one result part after another. This may be convenient
in situations where using a template package like CherryPy or Cheetah
would be overk... |
tests/unit/peapods/pods/test_networking.py | Karnak123/jina | 15,179 | 11140500 | from jina.helper import get_internal_ip
from jina import __default_host__, __docker_host__
from jina.peapods.networking import get_connect_host, is_remote_local_connection
from jina.parsers import set_pea_parser
import pytest
docker_uses = 'docker://abc'
@pytest.mark.parametrize(
'bind_host, connect_host, conne... |
api/genie/tests/test_views_schedules.py | zhangkuantian/cuelake | 272 | 11140514 | <reponame>zhangkuantian/cuelake<gh_stars>100-1000
import pytest
from django.urls import reverse
from conftest import populate_seed_data
from genie.models import CustomSchedule as Schedule
@pytest.mark.django_db(transaction=True)
def test_schedules(client, populate_seed_data, mocker):
# Create schedule test
pa... |
app/game_master.py | Palmito94/posio | 521 | 11140518 | # -*- coding: utf-8 -*-
from app import socketio, app
from posio.game import Game
class GameMaster:
"""
Starts the game and manages the game lifecycle
"""
def __init__(self,
score_max_distance,
leaderboard_answer_count,
max_response_time,
... |
golem/gui/gui_utils.py | Sunil-Rathore/golem | 171 | 11140525 | <filename>golem/gui/gui_utils.py
"""Helper functions to deal with Golem GUI module application."""
import configparser
import copy
import inspect
import os
import subprocess
import sys
from functools import wraps
from urllib.parse import urlparse, urljoin
from flask import abort, render_template, request
from flask_lo... |
io_import_vmf/cube2equi.py | lasa01/io_import_vmf | 153 | 11140532 | # Originally by adamb70 from https://github.com/adamb70/Python-Spherical-Projection
# Modified to be used with Source Engine cubemaps.
# Converted to numpy to achieve reasonable performance.
import numpy
from numpy import ndarray
from enum import IntEnum
from typing import Tuple
def spherical_coordinates(i: ndarray,... |
nncf/torch/pruning/filter_pruning/functions.py | MaximProshin/nncf | 136 | 11140536 | """
Copyright (c) 2022 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writin... |
cogdl/layers/base_layer.py | cenyk1230/cogdl | 1,072 | 11140538 | import torch
import torch.nn as nn
class BaseLayer(nn.Module):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
def forward(self, graph, x):
m = self.message(x[graph.edge_index[0]])
return self.aggregate(graph, m)
def message(self, x):
return x
def ag... |
examples/pybullet/gym/pybullet_envs/minitaur/robots/crowd_controller.py | felipeek/bullet3 | 9,136 | 11140564 | <filename>examples/pybullet/gym/pybullet_envs/minitaur/robots/crowd_controller.py
# Lint as: python3
"""Crowd objects/human controllers module."""
import abc
import collections
from typing import Any, Callable, Dict, Iterable, List, Optional, Union, Sequence, Text
from absl import logging
import dataclasses
import gi... |
open-codegen/opengen/definitions.py | elsuizo/optimization-engine | 253 | 11140602 | import pkg_resources
def templates_dir():
"""Directory where the templates are found (for internal use, mainly)"""
return pkg_resources.resource_filename('opengen', 'templates/')
def templates_subdir(subdir=None):
"""
Directory where the templates are found and subfolder relative
to that path(fo... |
setup.py | jmaupetit/md2pdf | 114 | 11140639 | <filename>setup.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
md2pdf - setup file
"""
import md2pdf
from setuptools import setup, find_packages
def parse_requirements(requirements, ignore=('setuptools',)):
"""
Read dependencies from requirements file (with version numbers if any)
Notes:
... |
mysqlbinlog_back.py | bbotte/mysqlbinlog_flashback | 195 | 11140647 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
产生mysqlbinlog反向的sql的主程序
v0.1.0 2016/10/20 yilai created
"""
import traceback
import os,sys
import logging
from func import init_logger,print_stack
from flashback import Parameter,deal_all_event,generate_create_table,convert_datetime_to_timestamp
import codecs
from da... |
tensorflow/compiler/tests/add_n_test.py | abhaikollara/tensorflow | 848 | 11140662 | <filename>tensorflow/compiler/tests/add_n_test.py
# Copyright 2019 The TensorFlow 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/l... |
tests/test_utils_get_percent.py | ZSD-tim/dayu_widgets | 157 | 11140720 | """
Test get_percent.
"""
import pytest
from dayu_widgets import utils
@pytest.mark.parametrize('value, mini, maxi, result', (
(0, 0, 100, 0),
(100, 0, 100, 100),
(1, 0, 100, 1),
(99, 0, 100, 99),
(-1, 0, 100, 0),
(101, 0, 100, 100),
(101, 10, 110, 91),
(10, 100, 100, 100),
))
def tes... |
xled/cli.py | magicus/xled | 121 | 11140736 | # -*- coding: utf-8 -*-
"""Console script for xled."""
from __future__ import absolute_import
import logging
import time
import click
import click_log
import xled.auth
import xled.control
import xled.discover
import xled.exceptions
import xled.security
log = logging.getLogger(__name__)
LOGGERS = (log, xled.disc... |
keras_fcn/metrics.py | li657835991/FCN | 235 | 11140742 | import keras.backend as K
import tensorflow as tf
from tensorflow.python.ops import control_flow_ops
def Mean_IoU(classes):
def mean_iou(y_true, y_pred):
mean_iou, op = tf.metrics.mean_iou(y_true, y_pred, classes)
return mean_iou
_initialize_variables()
return mean_iou
def _initialize_var... |
examples/ionq_half_adder.py | ssc1729/ProjectQ | 795 | 11140744 | # -*- coding: utf-8 -*-
# Copyright 2021 ProjectQ-Framework (www.projectq.ch)
#
# 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
#
# ... |
autoimpute/visuals/imputations.py | gjdv/autoimpute | 191 | 11140754 | """Visualizations to explore imputations of an incomplete dataset."""
import matplotlib.pylab as plt
import seaborn as sns
from autoimpute.utils import check_data_structure
from autoimpute.imputations import SingleImputer
from .helpers import _validate_data, _validate_kwgs, _get_observed, _melt_df
from .helpers import... |
tools/demo.py | ChisenZhang/Curve-Text-Detector | 627 | 11140769 | import numpy as np
import cv2
import os, glob
import _init_paths
import caffe
from fast_rcnn.config import cfg, cfg_from_file, cfg_from_list
from fast_rcnn.bbox_transform import clip_boxes, bbox_transform_inv, info_syn_transform_inv_h, info_syn_transform_inv_w
from fast_rcnn.nms_wrapper import nms, pnms
from utils.blo... |
photoshop/api/save_options/tif.py | MrTeferi/photoshop-python-api | 270 | 11140812 | <gh_stars>100-1000
# Import local modules
from photoshop.api._core import Photoshop
class TiffSaveOptions(Photoshop):
object_name = "TiffSaveOptions"
def __int__(self):
super().__init__()
@property
def alphaChannels(self):
"""If true, the alpha channels are saved."""
return s... |
wuapis.py | nsacyber/BAM | 125 | 11140831 | <filename>wuapis.py
import sqlite3
import logging, logging.handlers
import globs
import BamLogger
from db.bam_analysis_db import prodvgtebyname
from support.utils import verifyhex
_wulogger = logging.getLogger("BAM.wuapis")
def db_logconfig(queue):
global _wulogger
qh = logging.handlers.QueueHandler(qu... |
bin/update_readme_changelog.py | bbayles/cibuildwheel | 702 | 11140850 | <gh_stars>100-1000
#!/usr/bin/env python3
import re
import sys
from pathlib import Path
PROJECT_ROOT = Path(__file__).parent / ".."
CHANGELOG_FILE = PROJECT_ROOT / "docs" / "changelog.md"
README_FILE = PROJECT_ROOT / "README.md"
# https://regexr.com/622ds
FIRST_5_CHANGELOG_ENTRIES_REGEX = re.compile(r"""(^###.*?(?=#... |
recipes/Python/578199_Rookies_Backup_Program/recipe-578199.py | tdiprima/code | 2,023 | 11140859 | <reponame>tdiprima/code
import os
import sys
def main():
try:
source, destination = sys.argv[1:]
assert os.path.isdir(source), '<source_directory> is not a directory'
if os.path.exists(destination):
assert os.path.isdir(destination), \
'<destination_directory>... |
src/Functions/Web/Javbus.py | yepcn/javsdt | 1,064 | 11140872 | # -*- coding:utf-8 -*-
import re
import requests
from Class.MyEnum import ScrapeStatusEnum
# from traceback import format_exc
from Class.MyError import SpecifiedUrlError
# 搜索javbus,或请求javbus上jav所在网页,返回html
def get_bus_html(url, proxy):
for retry in range(10):
try:
if proxy: # existmag=a... |
keras/keras/layers/core.py | molingbo/crcn | 167 | 11140880 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division
import theano
import theano.tensor as T
from .. import activations, initializations
from ..utils.theano_utils import shared_zeros, floatX
from ..utils.generic_utils import make_tuple
from theano.sandbox.rng_mrg import MRG_RandomStreams as Rando... |
hata/ext/commands_v2/utils.py | Multiface24111/hata | 173 | 11140901 | <gh_stars>100-1000
__all__ = ()
def raw_name_to_display(raw_name):
"""
Converts the given raw command or it's parameter's name to it's display name.
Parameters
----------
raw_name : `str`
The name to convert.
Returns
-------
display_name : `str`
The converted ... |
models/datasets/hd5.py | povezava/pytorch_GAN_zoo | 1,545 | 11140928 | <reponame>povezava/pytorch_GAN_zoo
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import json
import torch
import h5py
import copy
from .utils.db_stats import buildKeyOrder
class H5Dataset(torch.utils.data.Dataset):
def __init__(self,
file_path,
partiti... |
tools/accuracy_checker/accuracy_checker/adapters/pose_estimation_openpose.py | APrigarina/open_model_zoo | 1,031 | 11140932 | <gh_stars>1000+
"""
Copyright (c) 2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agree... |
tests/test_gail.py | HighExecutor/stable-baselines | 222 | 11140938 | import os
import shutil
import gym
import numpy as np
import pytest
from stable_baselines import (A2C, ACER, ACKTR, GAIL, DDPG, DQN, PPO1, PPO2,
TD3, TRPO, SAC)
from stable_baselines.common.cmd_util import make_atari_env
from stable_baselines.common.vec_env import VecFrameStack, DummyVec... |
containers/compilers/rump/python3/python-wrapper/python-wrapper-udp.py | urjitbhatia/unik | 1,237 | 11140941 | from io import StringIO
import sys
import threading
from http.server import BaseHTTPRequestHandler, HTTPServer
###From https://github.com/bmc/grizzled-python/blob/bf9998bd0f6497d1e368610f439f9085d019bf76/grizzled/io/__init__.py
# ---------------------------------------------------------------------------
# Imports
# -... |
tools/telemetry/telemetry/page/page_test_results.py | iplo/Chain | 231 | 11140948 | # Copyright (c) 2013 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 collections
import copy
import logging
import sys
import traceback
import unittest
class PageTestResults(unittest.TestResult):
def __init__(sel... |
tridet/utils/tensor2d.py | flipson/dd3d | 227 | 11140974 | <reponame>flipson/dd3d
# Copyright 2021 Toyota Research Institute. All rights reserved.
import torch
import torch.nn.functional as F
def compute_features_locations(h, w, stride, dtype=torch.float32, device='cpu', offset="none"):
"""Adapted from AdelaiDet:
https://github.com/aim-uofa/AdelaiDet/blob/master... |
ratelimit/models.py | sobolevn/django-ratelimit | 712 | 11140977 | # This module intentionally left blank.
|
core/simulators/srunner/scenarios/opposite_direction.py | timothijoe/DI-drive | 219 | 11140994 | <reponame>timothijoe/DI-drive
import math
import py_trees
import carla
from six.moves.queue import Queue # pylint: disable=relative-import
from core.simulators.carla_data_provider import CarlaDataProvider
from core.simulators.srunner.scenariomanager.scenarioatomics.atomic_behaviors import (
ActorTransformSetter, ... |
codigo_das_aulas/aula_17/exemplo_04.py | VeirichR/curso-python-selenium | 234 | 11141006 | <reponame>VeirichR/curso-python-selenium<gh_stars>100-1000
from selene.support.shared import browser
base_url = 'http://google.com'
browser.config.base_url = base_url
browser.open('')
# browser.element('input[name="q"]').type('Live de python')
browser.element(
'//*[@name="q"]'
).type('Live de python').press_ente... |
Src/StdLib/Lib/site-packages/win32com/test/policySemantics.py | cwensley/ironpython2 | 1,078 | 11141027 | <reponame>cwensley/ironpython2
import win32com.server.util
import win32com.client
import pythoncom
import winerror
import win32com.test.util
import unittest
class Error(Exception):
pass
# An object representing a list of numbers
class PythonSemanticClass:
_public_methods_ = ["In"] # DISPIDs are allocated.
... |
ML/Pytorch/object_detection/YOLO/dataset.py | xuyannus/Machine-Learning-Collection | 3,094 | 11141034 | <filename>ML/Pytorch/object_detection/YOLO/dataset.py<gh_stars>1000+
"""
Creates a Pytorch dataset to load the Pascal VOC dataset
"""
import torch
import os
import pandas as pd
from PIL import Image
class VOCDataset(torch.utils.data.Dataset):
def __init__(
self, csv_file, img_dir, label_dir, ... |
src/python3/request/item_create_link.py | meson800/onedrive-sdk-python | 912 | 11141038 | <reponame>meson800/onedrive-sdk-python
# -*- coding: utf-8 -*-
'''
# Copyright (c) 2015 Microsoft Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includin... |
Utils/Storage/BaseOSS.py | Caius-Lu/Savior | 108 | 11141047 | <reponame>Caius-Lu/Savior
import io
from abc import ABC, abstractmethod
import cv2
import msgpack
import msgpack_numpy as m
import numpy as np
from PIL import Image
from Utils.Exceptions import ImageFileSizeAbnormalException, ImageClassNotSupportToEncodeException
from Utils.misc import convert_pil_to_numpy
class Cl... |
fbmessenger/sender_actions.py | Stanwarr/fbmessenger | 120 | 11141054 | <filename>fbmessenger/sender_actions.py
class SenderAction(object):
SENDER_ACTIONS = [
'mark_seen',
'typing_on',
'typing_off'
]
def __init__(self, sender_action):
if sender_action not in self.SENDER_ACTIONS:
raise ValueError('Invalid sender_action provided.')
... |
src/genie/libs/parser/iosxe/tests/ShowSpanningTreeDetail/cli/equal/golden_output_1_expected.py | balmasea/genieparser | 204 | 11141064 | <filename>src/genie/libs/parser/iosxe/tests/ShowSpanningTreeDetail/cli/equal/golden_output_1_expected.py
expected_output = {
"rapid_pvst": {
"forwarding_delay": 15,
"hello_time": 2,
"hold_count": 6,
"max_age": 20,
"vlans": {
1: {
"aging_timer": 480... |
trieste/acquisition/multi_objective/pareto.py | satrialoka/trieste | 119 | 11141090 | <reponame>satrialoka/trieste
# Copyright 2020 The Trieste Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
bdd100k/__init__.py | Celeven1996/bdd100k | 193 | 11141151 | """BDD100K python toolkit."""
|
evaluation/ci-for-ml/ci-simulation-repeated/1_normal_approx.py | rasbt/machine-learning-notes | 131 | 11141153 | <gh_stars>100-1000
import argparse
from get_dataset import get_dataset
from sklearn.tree import DecisionTreeClassifier
import scipy.stats
import numpy as np
def run_method(num_repetitions):
is_inside_list = []
for i in range(num_repetitions):
X_train, y_train, X_test, y_test, X_huge_test, y_huge_tes... |
soft_renderer/functional/projection.py | bala1144/SoftRas | 201 | 11141165 | import torch
def projection(vertices, P, dist_coeffs, orig_size):
'''
Calculate projective transformation of vertices given a projection matrix
P: 3x4 projection matrix
dist_coeffs: vector of distortion coefficients
orig_size: original size of image captured by the camera
'''
vertices = to... |
siren_pytorch/__init__.py | lucidrains/SIREN-pytorch | 293 | 11141183 | <filename>siren_pytorch/__init__.py
from siren_pytorch.siren_pytorch import Sine, Siren, SirenNet, SirenWrapper
|
memshell.py | google/Legilimency | 116 | 11141186 | <reponame>google/Legilimency
# Legilimency - Memory Analysis Framework for iOS
# --------------------------------------
#
# Written and maintained by <NAME> <<EMAIL>>
#
# Copyright 2017 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this ... |
plato/agent/conversational_agent/conversational_agent.py | avmi/plato-research-dialogue-system | 899 | 11141193 | <reponame>avmi/plato-research-dialogue-system
"""
Copyright (c) 2019-2020 Uber Technologies, 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
Unl... |
tests/test_general/settings.py | agilentia/django-salesforce | 251 | 11141234 | from django.utils.crypto import get_random_string
SECRET_KEY = get_random_string(length=32)
SF_CAN_RUN_WITHOUT_DJANGO = True
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.