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 |
|---|---|---|---|---|
fortnitepy/ext/commands/bot.py | gfdb/fortnitepy | 127 | 5159 | <filename>fortnitepy/ext/commands/bot.py<gh_stars>100-1000
"""
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, includi... |
src/data_loading.py | katerakelly/pytorch-maml | 565 | 5185 | <gh_stars>100-1000
import numpy as np
import random
import torch
from torch.utils.data import DataLoader
from torch.utils.data.sampler import Sampler
import torchvision.transforms as transforms
from dataset import Omniglot, MNIST
'''
Helpers for loading class-balanced few-shot tasks
from datasets
'''
class ClassBal... |
observations/r/bomsoi.py | hajime9652/observations | 199 | 5203 | <gh_stars>100-1000
# -*- 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 bomsoi(path):
"""Southern Oscillation Index Data
... |
mol_dqn/experimental/multi_obj.py | deepneuralmachine/google-research | 23,901 | 5208 | <reponame>deepneuralmachine/google-research<gh_stars>1000+
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apac... |
src/generate_class_specific_samples.py | HesterLim/pytorch-cnn-visualizations | 6,725 | 5212 | """
Created on Thu Oct 26 14:19:44 2017
@author: <NAME> - github.com/utkuozbulak
"""
import os
import numpy as np
import torch
from torch.optim import SGD
from torchvision import models
from misc_functions import preprocess_image, recreate_image, save_image
class ClassSpecificImageGeneration():
"""
Pro... |
features/steps/section.py | revvsales/python-docx-1 | 3,031 | 5217 | <reponame>revvsales/python-docx-1<filename>features/steps/section.py
# encoding: utf-8
"""
Step implementations for section-related features
"""
from __future__ import absolute_import, print_function, unicode_literals
from behave import given, then, when
from docx import Document
from docx.enum.section import WD_OR... |
coltran/run.py | DionysisChristopoulos/google-research | 23,901 | 5220 | <filename>coltran/run.py
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... |
pyctcdecode/__init__.py | kensho-technologies/pyctcdecode | 203 | 5237 | # Copyright 2021-present Kensho Technologies, LLC.
from .alphabet import Alphabet # noqa
from .decoder import BeamSearchDecoderCTC, build_ctcdecoder # noqa
from .language_model import LanguageModel # noqa
__package_name__ = "pyctcdecode"
__version__ = "0.3.0"
|
platypush/backend/joystick/linux/__init__.py | BlackLight/platypush | 228 | 5239 | import array
import struct
import time
from fcntl import ioctl
from typing import IO
from platypush.backend import Backend
from platypush.message.event.joystick import JoystickConnectedEvent, JoystickDisconnectedEvent, \
JoystickButtonPressedEvent, JoystickButtonReleasedEvent, JoystickAxisEvent
class JoystickLin... |
src/modules/sensors/vehicle_magnetometer/mag_compensation/python/mag_compensation.py | SaxionMechatronics/Firmware | 4,224 | 5240 | <reponame>SaxionMechatronics/Firmware
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
File: mag_compensation.py
Author: <NAME>
Email: <EMAIL>
Github: https://github.com/baumanta
Description:
Computes linear coefficients for mag compensation from thrust and current
Usage:
python mag_compensation.py /path/to/... |
examples/qmmm/02-mcscf.py | QuESt-Calculator/pyscf | 501 | 5246 | #!/usr/bin/env python
#
# Author: <NAME> <<EMAIL>>
#
'''
A simple example to run MCSCF with background charges.
'''
import numpy
from pyscf import gto, scf, mcscf, qmmm
mol = gto.M(atom='''
C 1.1879 -0.3829 0.0000
C 0.0000 0.5526 0.0000
O -1.1867 -0.2472 0.0000
H -1.9237 0.3850 0.0000
H ... |
ens/exceptions.py | pjryan93/web3.py | 326 | 5258 | import idna
class AddressMismatch(ValueError):
'''
In order to set up reverse resolution correctly, the ENS name should first
point to the address. This exception is raised if the name does
not currently point to the address.
'''
pass
class InvalidName(idna.IDNAError):
'''
This excep... |
src/backend/schemas/vps.py | ddddhm1/LuWu | 658 | 5261 | from typing import List
from typing import Optional
from typing import Union
from models.vps import VpsStatus
from schemas.base import APIModel
from schemas.base import BasePagination
from schemas.base import BaseSchema
from schemas.base import BaseSuccessfulResponseModel
class VpsSshKeySchema(APIModel):
name: s... |
editortools/player.py | bennettdc/MCEdit-Unified | 237 | 5281 | """Copyright (c) 2010-2012 <NAME>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
W... |
labgraph/graphs/node_test_harness.py | Yunusbcr/labgraph | 124 | 5289 | <gh_stars>100-1000
#!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
import asyncio
import functools
import inspect
from contextlib import contextmanager
from typing import (
Any,
AsyncIterable,
Awaitable,
Callable,
Generic,
Iterator,
List,
Mapping,
Opti... |
extras/usd/examples/usdMakeFileVariantModelAsset/usdMakeFileVariantModelAsset.py | DougRogers-DigitalFish/USD | 3,680 | 5383 | #!/pxrpythonsubst
#
# Copyright 2016 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
... |
src/zvt/recorders/em/meta/em_stockhk_meta_recorder.py | vishalbelsare/zvt | 2,032 | 5389 | # -*- coding: utf-8 -*-
from zvt.contract.api import df_to_db
from zvt.contract.recorder import Recorder
from zvt.domain.meta.stockhk_meta import Stockhk
from zvt.recorders.em import em_api
class EMStockhkRecorder(Recorder):
provider = "em"
data_schema = Stockhk
def run(self):
df_south = em_api.... |
moderngl_window/resources/data.py | DavideRuzza/moderngl-window | 142 | 5424 | <reponame>DavideRuzza/moderngl-window
"""
Registry general data files
"""
from typing import Any
from moderngl_window.resources.base import BaseRegistry
from moderngl_window.meta import DataDescription
class DataFiles(BaseRegistry):
"""Registry for requested data files"""
settings_attr = "DATA_LOADERS"
... |
NLP/UNIMO/src/finetune/visual_entailment.py | zhangyimi/Research | 1,319 | 5443 | <gh_stars>1000+
# Copyright (c) 2021 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... |
pytorch_translate/models/__init__.py | Ayansam1152/translate | 748 | 5451 | <reponame>Ayansam1152/translate
#!/usr/bin/env python3
import importlib
import os
# automatically import any Python files in the models/ directory
for file in sorted(os.listdir(os.path.dirname(__file__))):
if file.endswith(".py") and not file.startswith("_"):
model_name = file[: file.find(".py")]
... |
keras/models.py | kalyc/keras-apache-mxnet | 300 | 5455 | <filename>keras/models.py
"""Model-related utilities.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from . import backend as K
from .utils.generic_utils import has_arg
from .utils.generic_utils import to_list
from .engine.input_layer import Input
from ... |
experimental/tracing/bin/diff_heap_profiler.py | BearerPipelineTest/catapult | 1,894 | 5476 | #!/usr/bin/env python
# Copyright 2017 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.
from __future__ import absolute_import
from __future__ import print_function
import argparse
import gzip
import json
import os
import s... |
differential_privacy/run_federated.py | HanGuo97/federated | 330 | 5518 | # Copyright 2020, Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
designate-8.0.0/designate/tests/test_api/test_v2/test_limits.py | scottwedge/OpenStack-Stein | 145 | 5520 | <reponame>scottwedge/OpenStack-Stein
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Author: <NAME> <<EMAIL>>
#
# 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://ww... |
tests/test_sync_module.py | naveengh6/blinkpy | 272 | 5531 | <reponame>naveengh6/blinkpy
"""Tests camera and system functions."""
import unittest
from unittest import mock
from blinkpy.blinkpy import Blink
from blinkpy.helpers.util import BlinkURLHandler
from blinkpy.sync_module import BlinkSyncModule, BlinkOwl
from blinkpy.camera import BlinkCamera, BlinkCameraMini
@mock.pat... |
python/flexflow_cffi_build.py | zmxdream/FlexFlow | 455 | 5561 | <filename>python/flexflow_cffi_build.py
#!/usr/bin/env python
# Copyright 2020 Stanford University, Los Alamos National Laboratory
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# htt... |
Python/Tests/TestData/ProjectHomeProjects/Subfolder/ProgramB.py | techkey/PTVS | 404 | 5591 | # ProgramB.py
print('Hello World')
|
ssod/utils/structure_utils.py | huimlight/SoftTeacher | 604 | 5596 | <reponame>huimlight/SoftTeacher<gh_stars>100-1000
import warnings
from collections import Counter, Mapping, Sequence
from numbers import Number
from typing import Dict, List
import numpy as np
import torch
from mmdet.core.mask.structures import BitmapMasks
from torch.nn import functional as F
_step_counter = Counter(... |
dev/Tools/build/waf-1.7.13/waflib/extras/fc_xlf.py | jeikabu/lumberyard | 1,738 | 5598 | <gh_stars>1000+
#! /usr/bin/env python
# encoding: utf-8
# harald at klimachs.de
import re
from waflib import Utils,Errors
from waflib.Tools import fc,fc_config,fc_scan
from waflib.Configure import conf
from waflib.Tools.compiler_fc import fc_compiler
fc_compiler['aix'].insert(0, 'fc_xlf')
@conf
def find_xlf(conf):
... |
Codes/gracekoo/test.py | ghoslation/algorithm | 256 | 5606 | # -*- coding: utf-8 -*-
# @Time: 2020/11/8 23:47
# @Author: GraceKoo
# @File: test.py
# @Desc:
from threading import Thread
import time
def print_numbers():
time.sleep(0.2)
print("子线程结束")
if __name__ == "__main__":
t1 = Thread(target=print_numbers)
t1.setDaemon(True)
t1.start()
# print("主线程结... |
layers/gin_layer.py | JakeStevens/benchmarking-gnns | 275 | 5624 | <reponame>JakeStevens/benchmarking-gnns<gh_stars>100-1000
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl.function as fn
"""
GIN: Graph Isomorphism Networks
HOW POWERFUL ARE GRAPH NEURAL NETWORKS? (<NAME>, <NAME>, <NAME> and <NAME>, ICLR 2019)
https://arxiv.org/pdf/1810.00826.... |
lstm-synthetic-wave-anomaly-detect.py | cse-icon-dataAnalytics/lstm-anomaly-detect | 178 | 5631 | <reponame>cse-icon-dataAnalytics/lstm-anomaly-detect
""" Inspired by example from
https://github.com/Vict0rSch/deep_learning/tree/master/keras/recurrent
Uses the TensorFlow backend
The basic idea is to detect anomalies in a time-series.
"""
import matplotlib.pyplot as plt
import numpy as np
import time
from keras.layer... |
wouso/core/security/admin.py | AlexandruGhergut/wouso | 117 | 5671 | from django.contrib import admin
from wouso.core.security.models import Report
admin.site.register(Report)
|
latest/probe.py | Soldie/Nscan-scanner-ip | 574 | 5676 | import time
import Queue
import random
import socket
import struct
import logging
import threading
from convert import *
from protocol import ethernet, ip, tcp, udp
ETH_P_IP = 0x0800 # IP protocol
ETH_P_ALL = 0x0003 # Every packet
NSCRIPT_PATH = 'nscript' # NSCRIPT PATH
PAYLOAD = {
53:('\x5d\x0d\x01\x00\x00\x01\x00... |
codalab/lib/path_util.py | kl-chou/codalab-worksheets | 236 | 5682 | <filename>codalab/lib/path_util.py
"""
path_util contains helpers for working with local filesystem paths.
There are a few classes of methods provided here:
Functions to normalize paths and check that they are in normal form:
normalize, check_isvalid, check_isdir, check_isfile, path_is_url
Functions to list d... |
shared/templates/coreos_kernel_option/template.py | deperrone/content | 1,138 | 5686 | <reponame>deperrone/content<filename>shared/templates/coreos_kernel_option/template.py
from ssg.utils import parse_template_boolean_value
def preprocess(data, lang):
data["arg_negate"] = parse_template_boolean_value(data, parameter="arg_negate", default_value=False)
data["arg_is_regex"] = parse_template_boole... |
capirca/lib/ipset.py | google-admin/capirca | 604 | 5691 | # 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... |
stp_core/common/logging/handlers.py | andkononykhin/plenum | 148 | 5700 | <reponame>andkononykhin/plenum<filename>stp_core/common/logging/handlers.py
import logging
class CallbackHandler(logging.Handler):
def __init__(self, typestr, default_tags, callback, override_tags):
"""
Initialize the handler.
"""
super().__init__()
self.callback = callback... |
test/tst_vlen.py | timgates42/netcdf4-python | 574 | 5712 | import sys
import unittest
import os
import tempfile
from netCDF4 import Dataset
import numpy as np
from numpy.testing import assert_array_equal
FILE_NAME = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
VL_NAME = 'vlen_type'
VL_BASETYPE = np.int16
DIM1_NAME = 'lon'
DIM2_NAME = 'lat'
nlons = 5; nlats = 5... |
sonnet/src/once.py | ScriptBox99/deepmind-sonnet | 10,287 | 5713 | # Copyright 2019 The Sonnet 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 applicable l... |
tests/_test_progress_board.py | stjordanis/Hyperactive | 382 | 5716 | <gh_stars>100-1000
import os, glob
import subprocess
from subprocess import DEVNULL, STDOUT
abspath = os.path.abspath(__file__)
dir_ = os.path.dirname(abspath)
files = glob.glob(dir_ + "/_progress_board_tests/_test_progress_board_*.py")
for file_path in files:
file_name = str(file_path.rsplit("/", maxsplit=1)[1... |
allure/pytest_plugin.py | allure-framework/allure-pytest | 112 | 5726 | import uuid
import pickle
import pytest
import argparse
from collections import namedtuple
from six import text_type
from allure.common import AllureImpl, StepContext
from allure.constants import Status, AttachmentType, Severity, \
FAILED_STATUSES, Label, SKIPPED_STATUSES
from allure.utils import parent_module, p... |
talleres_inov_docente/figures/plot_helpers.py | jfcaballero/Tutorial-sobre-scikit-learn-abreviado | 576 | 5734 | from matplotlib.colors import ListedColormap
cm3 = ListedColormap(['#0000aa', '#ff2020', '#50ff50'])
cm2 = ListedColormap(['#0000aa', '#ff2020'])
|
sympy/tensor/tests/test_functions.py | iamabhishek0/sympy | 8,323 | 5743 | <reponame>iamabhishek0/sympy<filename>sympy/tensor/tests/test_functions.py
from sympy.tensor.functions import TensorProduct
from sympy import MatrixSymbol, Matrix, Array
from sympy.abc import x, y, z
from sympy.abc import i, j, k, l
A = MatrixSymbol("A", 3, 3)
B = MatrixSymbol("B", 3, 3)
C = MatrixSymbol("C", 3, 3)
... |
mturk/comparison_among_different_models/sample_from_models_for_comparison.py | qiaone/GIF | 322 | 5754 | import sys
sys.path.append('../../')
import constants as cnst
import os
os.environ['PYTHONHASHSEED'] = '2'
import tqdm
from model.stg2_generator import StyledGenerator
import numpy as np
from my_utils.visualize_flame_overlay import OverLayViz
from my_utils.flm_dynamic_fit_overlay import camera_ringnetpp
from my_utils.g... |
dymos/utils/test/test_hermite.py | kaushikponnapalli/dymos | 104 | 5761 | import unittest
import numpy as np
from numpy.testing import assert_almost_equal
from dymos.utils.hermite import hermite_matrices
class TestHermiteMatrices(unittest.TestCase):
def test_quadratic(self):
# Interpolate with values and rates provided at [-1, 1] in tau space
tau_given = [-1.0, 1.0]... |
observations/r/zea_mays.py | hajime9652/observations | 199 | 5780 | <gh_stars>100-1000
# -*- 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 zea_mays(path):
"""Darwin's Heights of Cross- and ... |
recipes/libstudxml/all/conanfile.py | rockandsalt/conan-center-index | 562 | 5787 | from conans import ConanFile, AutoToolsBuildEnvironment, MSBuild, tools
from conans.errors import ConanInvalidConfiguration
import os
import shutil
required_conan_version = ">=1.33.0"
class LibStudXmlConan(ConanFile):
name = "libstudxml"
description = "A streaming XML pull parser and streaming XML serializer... |
plaso/formatters/interface.py | jonathan-greig/plaso | 1,253 | 5813 | <gh_stars>1000+
# -*- coding: utf-8 -*-
"""This file contains the event formatters interface classes.
The l2t_csv and other formats are dependent on a message field,
referred to as description_long and description_short in l2t_csv.
Plaso no longer stores these field explicitly.
A formatter, with a format string defi... |
audiomate/annotations/label_list.py | CostanzoPablo/audiomate | 133 | 5820 | import collections
import copy
import intervaltree
from .label import Label
class LabelList:
"""
Represents a list of labels which describe an utterance.
An utterance can have multiple label-lists.
Args:
idx (str): An unique identifier for the label-list
within a corpus f... |
astropy/io/fits/hdu/streaming.py | jayvdb/astropy | 445 | 5824 | <gh_stars>100-1000
# Licensed under a 3-clause BSD style license - see PYFITS.rst
import gzip
import os
from .base import _BaseHDU, BITPIX2DTYPE
from .hdulist import HDUList
from .image import PrimaryHDU
from astropy.io.fits.file import _File
from astropy.io.fits.header import _pad_length
from astropy.io.fits.util i... |
paasta_tools/async_utils.py | sobolevn/paasta | 1,711 | 5831 | import asyncio
import functools
import time
import weakref
from collections import defaultdict
from typing import AsyncIterable
from typing import Awaitable
from typing import Callable
from typing import Dict
from typing import List
from typing import Optional
from typing import TypeVar
T = TypeVar("T")
# NOTE: thi... |
datagen.py | kuangliu/pytorch-ssd | 124 | 5872 | '''Load image/class/box from a annotation file.
The annotation file is organized as:
image_name #obj xmin ymin xmax ymax class_index ..
'''
from __future__ import print_function
import os
import sys
import os.path
import random
import numpy as np
import torch
import torch.utils.data as data
import torchvision.t... |
lingvo/core/builder.py | allenwang28/lingvo | 2,611 | 5873 | # Lint as: python3
# Copyright 2020 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 ... |
raiden/tests/integration/long_running/test_stress.py | tirkarthi/raiden | 2,101 | 5875 | <gh_stars>1000+
import time
from http import HTTPStatus
from itertools import count
from typing import Sequence
import gevent
import grequests
import pytest
import structlog
from eth_utils import to_canonical_address
from flask import url_for
from raiden.api.python import RaidenAPI
from raiden.api.rest import APIServ... |
igibson/utils/data_utils/ext_object/scripts/step_1_visual_mesh.py | mamadbiabon/iGibson | 360 | 5883 | <reponame>mamadbiabon/iGibson<filename>igibson/utils/data_utils/ext_object/scripts/step_1_visual_mesh.py
import os
import sys
import bpy
script_dir = os.path.dirname(os.path.abspath(__file__))
utils_dir = os.path.join(script_dir, "../../blender_utils")
sys.path.append(utils_dir)
from utils import bake_model, clean_u... |
mushroom_rl/utils/plots/common_plots.py | PuzeLiu/mushroom-rl | 344 | 5888 | from mushroom_rl.utils.plots import PlotItemBuffer, DataBuffer
from mushroom_rl.utils.plots.plot_item_buffer import PlotItemBufferLimited
class RewardPerStep(PlotItemBuffer):
"""
Class that represents a plot for the reward at every step.
"""
def __init__(self, plot_buffer):
"""
Constr... |
src/models/nn/adaptive_softmax.py | dumpmemory/state-spaces | 513 | 5897 | # Copyright (c) 2019-2020, NVIDIA CORPORATION. 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... |
test/jit/test_backend_nnapi.py | Hacky-DH/pytorch | 60,067 | 5949 | import os
import sys
import unittest
import torch
import torch._C
from pathlib import Path
from test_nnapi import TestNNAPI
from torch.testing._internal.common_utils import TEST_WITH_ASAN
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.pa... |
tests/test_markup.py | samdoran/sphinx | 4,973 | 5984 | <gh_stars>1000+
"""
test_markup
~~~~~~~~~~~
Test various Sphinx-specific markup extensions.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
import pytest
from docutils import frontend, nodes, utils
from docutils.parsers.rst i... |
virtual/lib/python3.6/site-packages/sqlalchemy/sql/default_comparator.py | mzazakeith/flask-blog | 207 | 5986 | <reponame>mzazakeith/flask-blog
# sql/default_comparator.py
# Copyright (C) 2005-2018 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Default implementation of SQL compariso... |
vel/notebook/__init__.py | tigerwlin/vel | 273 | 6015 | from .loader import load |
CircuitPython_JEplayer_mp3/repeat.py | gamblor21/Adafruit_Learning_System_Guides | 665 | 6022 | <gh_stars>100-1000
# The MIT License (MIT)
#
# Copyright (c) 2020 <NAME> for Adafruit Industries LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without l... |
tests/test_env.py | Majanao/pytorch-blender | 381 | 6047 | import pytest
from pathlib import Path
from blendtorch import btt
BLENDDIR = Path(__file__).parent/'blender'
class MyEnv(btt.env.OpenAIRemoteEnv):
def __init__(self, background=True, **kwargs):
super().__init__(version='1.0.0')
self.launch(scene=BLENDDIR/'env.blend', script=BLENDDIR /
... |
pytorch_ares/pytorch_ares/attack_torch/mim.py | thu-ml/realsafe | 107 | 6060 | <gh_stars>100-1000
import imp
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
from pytorch_ares.attack_torch.utils import loss_adv
class MIM(object):
'''Projected Gradient Descent'''
def __init__(self, net, epsilon, p, stepsize, steps, decay_factor, data_name,target, loss... |
ares/defense/randomization.py | KuanKuanQAQ/ares | 206 | 6064 | <reponame>KuanKuanQAQ/ares<gh_stars>100-1000
''' The randomization defense method, which applies random . '''
import tensorflow as tf
from ares.defense.input_transformation import input_transformation
def randomize(xs, scale_min=0.875, pad_value=0.0):
''' Apply random rescaling and padding to xs.
:param xs... |
jumpy/jumpy/ndarray.py | rghwer/testdocs | 13,006 | 6072 | ################################################################################
# Copyright (c) 2015-2018 Skymind, Inc.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless... |
localgraphclustering/algorithms/eig2_nL.py | vishalbelsare/LocalGraphClustering | 106 | 6078 | import numpy as np
import scipy as sp
import scipy.sparse.linalg as splinalg
def eig2_nL(g, tol_eigs = 1.0e-6, normalize:bool = True, dim:int=1):
"""
DESCRIPTION
-----------
Computes the eigenvector that corresponds to the second smallest eigenvalue
of the normalized Laplacian matrix ... |
src/toil/batchSystems/abstractBatchSystem.py | Hexotical/toil | 348 | 6096 | <reponame>Hexotical/toil<gh_stars>100-1000
# Copyright (C) 2015-2021 Regents of the University of California
#
# 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/lice... |
robosuite/models/grippers/__init__.py | kyungjaelee/robosuite | 397 | 6120 | <reponame>kyungjaelee/robosuite<gh_stars>100-1000
from .gripper_model import GripperModel
from .gripper_factory import gripper_factory
from .gripper_tester import GripperTester
from .panda_gripper import PandaGripper
from .rethink_gripper import RethinkGripper
from .robotiq_85_gripper import Robotiq85Gripper
from .rob... |
tests/arch/x86/test_x86parser.py | IMULMUL/barf-project | 1,395 | 6128 | # Copyright (c) 2014, Fundacion Dr. <NAME>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and... |
unittest/scripts/py_devapi/scripts/mysqlx_collection_remove.py | mueller/mysql-shell | 119 | 6140 | # Assumptions: validate_crud_functions available
# Assumes __uripwd is defined as <user>:<pwd>@<host>:<plugin_port>
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_s... |
leaf/rbac/model/__init__.py | guiqiqi/leaf | 119 | 6142 | """用户, 组, 及相关认证数据库模型"""
from .group import Group
from .user import User
from .user import UserIndex
from .auth import Authentication
from .accesspoint import AccessPoint
|
alipay/aop/api/domain/KbAdvertSettleBillResponse.py | snowxmas/alipay-sdk-python-all | 213 | 6146 | <filename>alipay/aop/api/domain/KbAdvertSettleBillResponse.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class KbAdvertSettleBillResponse(object):
def __init__(self):
self._download_url = None
self._paid_date = None
@proper... |
django_loci/tests/base/test_admin.py | yashikajotwani12/django-loci | 205 | 6161 | <filename>django_loci/tests/base/test_admin.py
import json
import os
import responses
from django.urls import reverse
from .. import TestAdminMixin, TestLociMixin
class BaseTestAdmin(TestAdminMixin, TestLociMixin):
geocode_url = 'https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/'
def tes... |
test/run/t344.py | timmartin/skulpt | 2,671 | 6171 | for ch in "Hello world!":
d = ord(ch)
h = hex(d)
o = oct(d)
b = bin(d)
print ch, d, h, o, b
|
build/lib/jet_django/views/model.py | lukejamison/jet-dasboard | 193 | 6226 | from django.core.exceptions import NON_FIELD_ERRORS
from rest_framework import status, viewsets, serializers
from rest_framework.decorators import list_route
from rest_framework.response import Response
from rest_framework.serializers import ModelSerializer
from jet_django.filters.model_aggregate import AggregateFilte... |
pylayers/em/openems/test/Rect_Waveguide.py | usmanwardag/pylayers | 143 | 6254 | <filename>pylayers/em/openems/test/Rect_Waveguide.py<gh_stars>100-1000
from openems.openems import *
# A simple simulation
#
# FDTD Simulation Setting
#
F = FDTD()
F.add(Exc(typ='Sinus',f0=100000))
F.add(BoundaryCond(['PMC','PMC','PEC','PEC','MUR','MUR']))
#
# CSX (Geometry setting)
#
C = CSX()
# The Box is added ... |
nodes/2.x/python/View.ViewTemplate.py | andydandy74/ClockworkForDynamo | 147 | 6264 | import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
def GetViewTemplate(view):
if not view: return None
elif hasattr(view, "ViewTemplateId"):
if view.ViewTemplateId.IntegerValue == -1: return None
else: return view.Document.GetElement(view.ViewTemplateId)
else: return None
views = UnwrapEle... |
igibson/object_states/aabb.py | mamadbiabon/iGibson | 360 | 6273 | <reponame>mamadbiabon/iGibson
import numpy as np
from igibson.external.pybullet_tools.utils import aabb_union, get_aabb, get_all_links
from igibson.object_states.object_state_base import CachingEnabledObjectState
class AABB(CachingEnabledObjectState):
def _compute_value(self):
body_id = self.obj.get_body... |
Kmeans Cluster/Kmeans_Compare.py | Jojoxiao/Machine-Learning-for-Beginner-by-Python3 | 397 | 6285 | #-*- coding:utf-8 -*-
# &Author AnFany
# 引入方法
import Kmeans_AnFany as K_Af # AnFany
import Kmeans_Sklearn as K_Sk # Sklearn
import matplotlib.pyplot as plt
from pylab import mpl # 作图显示中文
mpl.rcParams['font.sans-serif'] = ['FangSong'] # 设置中文字体新宋体
mpl.rcParams['axes.unicode_minus'] = False
import numpy as... |
sdc/utilities/sdc_typing_utils.py | dlee992/sdc | 540 | 6295 | # *****************************************************************************
# 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... |
DQM/L1TMonitorClient/python/L1EmulatorErrorFlagClient_cfi.py | ckamtsikis/cmssw | 852 | 6297 | <filename>DQM/L1TMonitorClient/python/L1EmulatorErrorFlagClient_cfi.py<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDHarvester import DQMEDHarvester
l1EmulatorErrorFlagClient = DQMEDHarvester("L1EmulatorErrorFlagClient",
#
# for each L1 system, give:
# - SystemLa... |
examples/ingenerator.py | quynhanh-ngx/pytago | 206 | 6315 | def main():
n = 111
gen = (n * 7 for x in range(10))
if 777 in gen:
print("Yes!")
if __name__ == '__main__':
main()
|
azbankgateways/views/__init__.py | lordmahyar/az-iranian-bank-gateways | 196 | 6330 | <reponame>lordmahyar/az-iranian-bank-gateways<gh_stars>100-1000
from .banks import callback_view, go_to_bank_gateway
from .samples import sample_payment_view, sample_result_view
|
src/resources/clients/python_client/visitstate.py | visit-dav/vis | 226 | 6344 | <reponame>visit-dav/vis
import sys
class RPCType(object):
CloseRPC = 0
DetachRPC = 1
AddWindowRPC = 2
DeleteWindowRPC = 3
SetWindowLayoutRPC = 4
SetActiveWindowRPC = 5
ClearWindowRPC = 6
ClearAllWindowsRPC = 7
OpenDatabaseRPC = 8
CloseData... |
core/src/main/python/akdl/entry/base_entry.py | zhangjun0x01/Alink | 3,301 | 6356 | import abc
from typing import Dict, Callable
import tensorflow as tf
from flink_ml_framework.context import Context
from flink_ml_framework.java_file import *
from ..runner import tf_helper, io_helper
from ..runner.output_writer import DirectOutputWriter
try:
from flink_ml_tensorflow.tensorflow_context import TF... |
simba/run_dash_tkinter.py | justinshenk/simba | 172 | 6364 | # All credit to https://stackoverflow.com/questions/46571448/tkinter-and-a-html-file - thanks DELICA - https://stackoverflow.com/users/7027346/delica
from cefpython3 import cefpython as cef
import ctypes
try:
import tkinter as tk
from tkinter import messagebox
except ImportError:
import Tkinter as tk
impo... |
security_monkey/watchers/vpc/vpn.py | boladmin/security_monkey | 4,258 | 6374 | <reponame>boladmin/security_monkey
# 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 o... |
_ar/masking_provement.py | TomKingsfordUoA/ResidualMaskingNetwork | 242 | 6388 | import os
import glob
import cv2
import numpy as np
import torch
from torchvision.transforms import transforms
from natsort import natsorted
from models import resmasking_dropout1
from utils.datasets.fer2013dataset import EMOTION_DICT
from barez import show
transform = transforms.Compose(
[
transforms.ToPI... |
mod/tools/ccmake.py | mattiasljungstrom/fips | 429 | 6394 | <gh_stars>100-1000
"""
wrapper for ccmake command line tool
"""
import subprocess
name = 'ccmake'
platforms = ['linux', 'osx']
optional = True
not_found = "required for 'fips config' functionality"
#-------------------------------------------------------------------------------
def check_exists(fips_dir) :
"""tes... |
heat/api/openstack/v1/views/stacks_view.py | noironetworks/heat | 265 | 6404 | <reponame>noironetworks/heat
#
# 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... |
desktop/core/ext-py/pyasn1-0.1.8/pyasn1/compat/iterfunc.py | kokosing/hue | 422 | 6410 | <filename>desktop/core/ext-py/pyasn1-0.1.8/pyasn1/compat/iterfunc.py
from sys import version_info
if version_info[0] <= 2 and version_info[1] <= 4:
def all(iterable):
for element in iterable:
if not element:
return False
return True
else:
all = all
|
tzwhere/tzwhere.py | tuxiqae/pytzwhere | 115 | 6420 | <reponame>tuxiqae/pytzwhere
#!/usr/bin/env python
'''tzwhere.py - time zone computation from latitude/longitude.
Ordinarily this is loaded as a module and instances of the tzwhere
class are instantiated and queried directly
'''
import collections
try:
import ujson as json # loads 2 seconds faster than normal jso... |
examples/scripts/segmentation/nnet3-segmenter.py | mxmpl/pykaldi | 916 | 6481 | #!/usr/bin/env python
from __future__ import print_function
from kaldi.segmentation import NnetSAD, SegmentationProcessor
from kaldi.nnet3 import NnetSimpleComputationOptions
from kaldi.util.table import SequentialMatrixReader
# Construct SAD
model = NnetSAD.read_model("final.raw")
post = NnetSAD.read_average_poster... |
ppcls/data/preprocess/__init__.py | zhusonghe/PaddleClas-1 | 3,763 | 6502 | <filename>ppcls/data/preprocess/__init__.py
# Copyright (c) 2021 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/licen... |
SearchService/test/unit/test_solr_interface.py | loftwah/appscale | 790 | 6522 | <gh_stars>100-1000
#!/usr/bin/env python
import os
import json
import sys
import unittest
import urllib2
from flexmock import flexmock
sys.path.append(os.path.join(os.path.dirname(__file__), "../../"))
import solr_interface
import search_exceptions
class FakeSolrDoc():
def __init__(self):
self.fields = []
cl... |
script.video.F4mProxy/lib/flvlib/constants.py | akuala/REPO.KUALA | 105 | 6534 | <filename>script.video.F4mProxy/lib/flvlib/constants.py
"""
The constants used in FLV files and their meanings.
"""
# Tag type
(TAG_TYPE_AUDIO, TAG_TYPE_VIDEO, TAG_TYPE_SCRIPT) = (8, 9, 18)
# Sound format
(SOUND_FORMAT_PCM_PLATFORM_ENDIAN,
SOUND_FORMAT_ADPCM,
SOUND_FORMAT_MP3,
SOUND_FORMAT_PCM_LITTLE_ENDIAN,
SOU... |
jug/subcommands/demo.py | rdenham/jug | 309 | 6556 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2017, <NAME> <<EMAIL>>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# 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 ... |
src/python/nimbusml/internal/entrypoints/trainers_lightgbmbinaryclassifier.py | montehoover/NimbusML | 134 | 6559 | # - Generated by tools/entrypoint_compiler.py: do not edit by hand
"""
Trainers.LightGbmBinaryClassifier
"""
import numbers
from ..utils.entrypoints import EntryPoint
from ..utils.utils import try_set, unlist
def trainers_lightgbmbinaryclassifier(
training_data,
predictor_model=None,
number_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.