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 |
|---|---|---|---|---|
simba/ROI_multiply.py | KonradDanielewski/simba | 172 | 11041 | <filename>simba/ROI_multiply.py
import glob
import pandas as pd
from configparser import ConfigParser
import os
from simba.drop_bp_cords import *
def multiplyFreeHand(inifile, currVid):
_, CurrVidName, ext = get_fn_ext(currVid)
config = ConfigParser()
configFile = str(inifile)
config.read(con... |
paas-ce/paas/esb/lib/redis_rate_limit/ratelimit.py | renmcc/bk-PaaS | 767 | 11077 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
plugins/Autocomplete/plugin.py | mogad0n/Limnoria | 476 | 11127 | <reponame>mogad0n/Limnoria
###
# Copyright (c) 2020-2021, The Limnoria Contributors
# 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 cop... |
enaml/qt/qt_timer.py | xtuzy/enaml | 1,080 | 11145 | <reponame>xtuzy/enaml
#------------------------------------------------------------------------------
# Copyright (c) 2013-2017, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#--------------------------... |
pypy/module/cpyext/test/test_pystrtod.py | m4sterchain/mesapy | 381 | 11149 | <filename>pypy/module/cpyext/test/test_pystrtod.py
import math
from pypy.module.cpyext import pystrtod
from pypy.module.cpyext.test.test_api import BaseApiTest, raises_w
from rpython.rtyper.lltypesystem import rffi
from rpython.rtyper.lltypesystem import lltype
from pypy.module.cpyext.pystrtod import PyOS_string_to_do... |
python/cuxfilter/tests/charts/core/test_core_non_aggregate.py | Anhmike/cuxfilter | 201 | 11163 | import pytest
import cudf
import mock
from cuxfilter.charts.core.non_aggregate.core_non_aggregate import (
BaseNonAggregate,
)
from cuxfilter.dashboard import DashBoard
from cuxfilter import DataFrame
from cuxfilter.layouts import chart_view
class TestCoreNonAggregateChart:
def test_variables(self):
... |
recogym/envs/session.py | philomenec/reco-gym | 413 | 11165 | <reponame>philomenec/reco-gym
class Session(list):
"""Abstract Session class"""
def to_strings(self, user_id, session_id):
"""represent session as list of strings (one per event)"""
user_id, session_id = str(user_id), str(session_id)
session_type = self.get_type()
strings = []
... |
examples/plots/warmup_schedule.py | shuoyangd/pytorch_warmup | 170 | 11184 | import argparse
import matplotlib.pyplot as plt
import torch
from pytorch_warmup import *
def get_rates(warmup_cls, beta2, max_step):
rates = []
p = torch.nn.Parameter(torch.arange(10, dtype=torch.float32))
optimizer = torch.optim.Adam([{'params': p}], lr=1.0, betas=(0.9, beta2))
lr_scheduler = torch.... |
utils/data_processing.py | LisaAnne/LocalizingMoments | 157 | 11206 | import numpy as np
import sys
import os
sys.path.append('utils/')
from config import *
from utils import *
sys.path.append(pycaffe_dir)
import time
import pdb
import random
import pickle as pkl
import caffe
from multiprocessing import Pool
from threading import Thread
import random
import h5py
import itertools
import m... |
hwilib/devices/keepkey.py | cjackie/HWI | 285 | 11222 | <filename>hwilib/devices/keepkey.py
"""
Keepkey
*******
"""
from ..errors import (
DEVICE_NOT_INITIALIZED,
DeviceNotReadyError,
common_err_msgs,
handle_errors,
)
from .trezorlib import protobuf as p
from .trezorlib.transport import (
hid,
udp,
webusb,
)
from .trezor import TrezorClient, HID... |
tests/test_lamost_tools.py | igomezv/astroNN | 156 | 11240 | import unittest
import numpy as np
from astroNN.lamost import wavelength_solution, pseudo_continuum
class LamostToolsTestCase(unittest.TestCase):
def test_wavelength_solution(self):
wavelength_solution()
wavelength_solution(dr=5)
self.assertRaises(ValueError, wavelength_solution, dr=1)
... |
src/storage-preview/azext_storage_preview/vendored_sdks/azure_storage/v2018_03_28/file/__init__.py | Mannan2812/azure-cli-extensions | 207 | 11278 | <reponame>Mannan2812/azure-cli-extensions
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -------------------------------------------... |
tt/satisfiability/picosat.py | fkromer/tt | 233 | 11327 | <reponame>fkromer/tt
"""Python wrapper around the _clibs PicoSAT extension."""
import os
from tt.errors.arguments import (
InvalidArgumentTypeError,
InvalidArgumentValueError)
if os.environ.get('READTHEDOCS') != 'True':
from tt._clibs import picosat as _c_picosat
VERSION = _c_picosat.VERSION
def sa... |
src/prefect/schedules/adjustments.py | concreted/prefect | 8,633 | 11330 | """
Schedule adjustments are functions that accept a `datetime` and modify it in some way.
Adjustments have the signature `Callable[[datetime], datetime]`.
"""
from datetime import datetime, timedelta
from typing import Callable
import pendulum
import prefect.schedules.filters
def add(interval: timedelta) -> Calla... |
src/pynwb/retinotopy.py | weiglszonja/pynwb | 132 | 11332 | <reponame>weiglszonja/pynwb
from collections.abc import Iterable
import warnings
from hdmf.utils import docval, popargs, call_docval_func, get_docval
from . import register_class, CORE_NAMESPACE
from .core import NWBDataInterface, NWBData
class RetinotopyImage(NWBData):
"""Gray-scale anatomical image of cortica... |
nncf/experimental/onnx/algorithms/quantization/default_quantization.py | vuiseng9/nncf_pytorch | 136 | 11340 | """
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... |
RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Fall17_noIso_V1_cff.py | ckamtsikis/cmssw | 852 | 11393 | import FWCore.ParameterSet.Config as cms
from RecoEgamma.ElectronIdentification.Identification.mvaElectronID_tools import *
# Documentation of the MVA
# https://twiki.cern.ch/twiki/bin/viewauth/CMS/MultivariateElectronIdentificationRun2
# https://rembserj.web.cern.ch/rembserj/notes/Electron_MVA_ID_2017_documentation
... |
test/python/test_elementwise_ops.py | avijit-chakroborty/ngraph-bridge | 142 | 11405 | <reponame>avijit-chakroborty/ngraph-bridge
# ==============================================================================
# Copyright 2018-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 ... |
lingvo/tasks/image/input_generator.py | allenwang28/lingvo | 2,611 | 11408 | # Lint as: python3
# Copyright 2018 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 ... |
leetcode.com/python/314_Binary_Tree_Vertical_Order_Traversal.py | mamane19/coding-interview-gym | 713 | 11438 | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
from collections import deque
from collections import defaultdict
class Solution(object):
def verticalOrder(self, ... |
tests/api/test_libcoap_api.py | ggravlingen/ikeatradfri | 726 | 11453 | """Test API utilities."""
import json
from pytradfri.api.libcoap_api import APIFactory
from pytradfri.gateway import Gateway
def test_constructor_timeout_passed_to_subprocess(monkeypatch):
"""Test that original timeout is passed to subprocess."""
capture = {}
def capture_args(*args, **kwargs):
c... |
acronym/scoring.py | sigma67/acronym | 340 | 11469 | import re
regex = re.compile('[^a-zA-Z]')
def score_word(word, corpus=None):
word = regex.sub('', word) # leave only alpha
score = 0
consec_bonus = 2
for i, letter in enumerate(word):
if letter.islower():
continue
if i > 0 and word[i-1].upper():
score += conse... |
wagtail/admin/views/pages/unpublish.py | brownaa/wagtail | 8,851 | 11501 | <reponame>brownaa/wagtail<gh_stars>1000+
from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404, redirect
from django.template.response import TemplateResponse
from django.urls import reverse
from django.utils.translation import gettext as _
from wagtail.admin import message... |
cloud/db/db.py | bother3000/Smart-IoT-Planting-System | 171 | 11503 | #!/usr/bin/env python
import pymysql #Python3
db = pymysql.connect("localhost","sips","root","zaijian" )
cursor = db.cursor()
cursor.execute("SELECT VERSION()")
data = cursor.fetchone()
print ("Database version : %s " % data)
db.close()
def create_table():
db = pymysql.connect("localhost","sips","root","zaijian"... |
data.py | zhaoyun630/R-NET-in-Keras | 207 | 11506 | <filename>data.py
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import numpy as np
import cPickle as pickle
from keras import backend as K
from keras.utils import np_utils
from keras.preprocessing import sequence
from random import shuffle
import itertoo... |
doit/exceptions.py | m4ta1l/doit | 1,390 | 11519 | <reponame>m4ta1l/doit
"""Handle exceptions generated from 'user' code"""
import sys
import traceback
class InvalidCommand(Exception):
"""Invalid command line argument."""
def __init__(self, *args, **kwargs):
self.not_found = kwargs.pop('not_found', None)
super(InvalidCommand, self).__init__(*... |
owtf/__main__.py | Udbhavbisarya23/owtf | 1,514 | 11572 | <gh_stars>1000+
"""
owtf.__main__
~~~~~~~~~~~~~
A __main__ method for OWTF so that internal services can be called as Python modules.
"""
import sys
from owtf.core import main
if __name__ == "__main__":
main()
|
recipes/Python/576543_Prime_Number_Generator_Checker/recipe-576543.py | tdiprima/code | 2,023 | 11576 | <reponame>tdiprima/code<gh_stars>1000+
#
# prime number generator
# This program gets two number as input
# and prints
# Prime numbers in the range
# Actual number of primes in the range
# and Estimation based on formula
# n
# pi(n)= -------
# log(n)
# ... |
src/apiron/service/discoverable.py | tushar-deepsource/apiron | 109 | 11587 | from typing import List, Type
from apiron.service.base import ServiceBase
class DiscoverableService(ServiceBase):
"""
A Service whose hosts are determined via a host resolver.
A host resolver is any class with a :func:`resolve` method
that takes a service name as its sole argument
and returns a l... |
vespene/workers/registration.py | Conan-Kudo/vespene | 680 | 11590 | # Copyright 2018, <NAME> LLC
# License: Apache License Version 2.0
# -------------------------------------------------------------------------
# registration.py - updates the database to say who is building something
# and what the current settings are, which is used by the file serving
# code to see if it is ok ... |
timeglass.py | mountwebs/timeglass | 110 | 11606 | <filename>timeglass.py
import rumps
import sys
import icon_manager
from datetime import timedelta
import timekeeper
import os
# pyinstaller --onefile -w --add-data "Icons/:Icons" --icon="Icons/timeglass.png" --clean timeglass.spec
# rumps.debug_mode(True)
class TimerApp(rumps.App):
def __init__(self, initial_sec... |
3rdParty/boost/1.71.0/libs/python/test/iterator.py | rajeev02101987/arangodb | 12,278 | 11617 | # Copyright <NAME> 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)
from __future__ import print_function
'''
>>> from iterator_ext import *
>>> from input_iterator import *
>>> x = list_int()
>>> x.push_back(1)
... |
tools/mo/openvino/tools/mo/front/caffe/proposal_ext.py | ryanloney/openvino-1 | 1,127 | 11623 | # Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.tools.mo.front.common.partial_infer.utils import mo_array
from openvino.tools.mo.ops.proposal import ProposalOp
from openvino.tools.mo.front.caffe.collect_attributes import merge_attrs
from openvino.tools.mo.front.extractor... |
nonebot/command/argfilter/controllers.py | EVAyo/nonebot | 676 | 11629 | """
提供几种常用的控制器。
这些验证器通常需要提供一些参数进行一次调用,返回的结果才是真正的验证器,其中的技巧在于通过闭包使要控制的对象能够被内部函数访问。
版本: 1.3.0+
"""
import re
from nonebot import CommandSession
from nonebot.helpers import render_expression
def handle_cancellation(session: CommandSession):
"""
在用户发送 `算了`、`不用了`、`取消吧`、`停` 之类的话的时候,结束当前传入的命令会话(调用 `session.finish(... |
desktop_local_tests/windows/test_windows_public_ip_disrupt_reorder_adapters.py | UAEKondaya1/expressvpn_leak_testing | 219 | 11638 | <filename>desktop_local_tests/windows/test_windows_public_ip_disrupt_reorder_adapters.py
from desktop_local_tests.public_ip_during_disruption import PublicIPDuringDisruptionTestCase
from desktop_local_tests.windows.windows_reorder_adapters_disrupter import WindowsReorderAdaptersDisrupter
class TestWindowsPublicIPDisru... |
rotkehlchen/api/server.py | rotkehlchenio/rotkehlchen | 137 | 11639 | import json
import logging
from http import HTTPStatus
from typing import Any, Dict, List, Optional, Tuple, Type, Union
import werkzeug
from flask import Blueprint, Flask, Response, abort, jsonify
from flask.views import MethodView
from flask_cors import CORS
from gevent.pywsgi import WSGIServer
from geventwebsocket i... |
src/GridCal/Gui/TowerBuilder/gui.py | SanPen/GridCal | 284 | 11656 | # -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'gui.ui'
##
## Created by: Qt User Interface Compiler version 5.15.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
######################... |
tools/isolate/data/isolate/with_flag.py | Scopetta197/chromium | 212 | 11669 | #!/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.
import os
import sys
def main():
print 'with_flag: Verify the test data files were mapped properly'
assert len(sys.argv) == 2... |
Lib/gds/burp/config.py | mwielgoszewski/jython-burp-api | 134 | 11694 | <reponame>mwielgoszewski/jython-burp-api
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2009 Edgewall Software
# Copyright (C) 2005-2007 <NAME> <<EMAIL>>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are ... |
regtests/webclgl/call_external_method.py | bpmbank/PythonJS | 319 | 11706 | <filename>regtests/webclgl/call_external_method.py
"""external method"""
class myclass:
def __init__(self, i):
self.index = i
def get_index(self):
return self.index
def run(self, n):
self.intarray = new(Int16Array(n))
self.intarray[ self.index ] = 99
@returns( array=n )
@gpu.main
def gpufunc():
... |
tests/test_loop_seer.py | Kyle-Kyle/angr | 6,132 | 11723 | <gh_stars>1000+
import os
import sys
import angr
import nose.tools
test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests')
def test_various_loops():
p = angr.Project(os.path.join(test_location, 'x86_64', 'various_loops'), auto_load_libs=False)
cfg = p.anal... |
968 Binary Tree Cameras.py | krishna13052001/LeetCode | 872 | 11751 | #!/usr/bin/python3
"""
Given a binary tree, we install cameras on the nodes of the tree.
Each camera at a node can monitor its parent, itself, and its immediate children.
Calculate the minimum number of cameras needed to monitor all nodes of the tree.
Example 1:
Input: [0,0,null,0,0]
Output: 1
Explanation: One c... |
examples/get_tiktoks_by_sound.py | twitter-79/TikTok-Api | 2,095 | 11752 | <gh_stars>1000+
from TikTokApi import TikTokApi
api = TikTokApi.get_instance()
count = 30
# You can find this from a tiktok getting method in another way or find songs from the discoverMusic method.
sound_id = "6601861313180207878"
tiktoks = api.by_sound(sound_id, count=count)
for tiktok in tiktoks:
print(tikt... |
robo_gym/envs/ur/ur_avoidance_basic.py | psFournier/robo-gym | 236 | 11777 | """
Environment for basic obstacle avoidance controlling a robotic arm from UR.
In this environment the obstacle is only moving up and down in a vertical line in front of the robot.
The goal is for the robot to stay within a predefined minimum distance to the moving obstacle.
When feasible the robot should continue to... |
test/programytest/storage/entities/test_nodes.py | cdoebler1/AIML2 | 345 | 11785 | import unittest
import unittest.mock
from programy.storage.entities.nodes import NodesStore
class NodesStoreTest(unittest.TestCase):
def test_load(self):
store = NodesStore()
with self.assertRaises(NotImplementedError):
collector = unittest.mock.Mock()
store.load(collecto... |
Python/Tests/TestData/TestDiscoverer/ConfigUnittest/Product/prefix_not_included.py | techkey/PTVS | 404 | 11788 | import unittest
class PrefixNotIncluded(unittest.TestCase):
def test_not_included(self):
pass
if __name__ == '__main__':
unittest.main()
|
demo/examples/stability/advection_d2q4.py | bgraille/pylbm | 106 | 11805 |
"""
Stability analysis of the
D2Q4 solver for the advection equation
d_t(u) + c_x d_x(u) + c_y d_y(u) = 0
"""
import sympy as sp
import pylbm
# pylint: disable=invalid-name
# symbolic variables
U, X, Y = sp.symbols('U, X, Y')
# symbolic parameters
LA, CX, CY = sp.symbols('lambda, cx, cy', constants=True)
S_... |
mmtbx/validation/regression/tst_restraints.py | dperl-sol/cctbx_project | 155 | 11813 | <reponame>dperl-sol/cctbx_project<gh_stars>100-1000
from __future__ import absolute_import, division, print_function
from libtbx.utils import null_out
from libtbx import easy_pickle
from six.moves import cStringIO as StringIO
def run_validation(pdb_file, ignore_hd=True):
from mmtbx.validation import restraints
im... |
get_ip_list_ru_gov.py | gil9red/SimplePyScripts | 117 | 11827 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
"""
Скрипт выводит список ip государственных организаций.
"""
import ipaddress
import sys
import requests
rs = requests.get('https://jarib.github.io/anon-history/RuGovEdits/ru/latest/ranges.json')
# Проверка удачного запроса и полученных д... |
tools/docs/generate_api_rst.py | dcillera/envoy | 17,703 | 11838 | import os
import shutil
import sys
import tarfile
def include_package(envoy_api_protos, rst_file_path, prefix):
# `envoy_api_rst_files` is a list of file paths for .proto.rst files
# generated by protodoc
#
# we are only interested in the proto files generated for envoy protos,
# not for non-envoy... |
tests/library/test_ceph_volume_simple_activate.py | u-kosmonaft-u/ceph-ansible | 1,570 | 11866 | from mock.mock import patch
import os
import pytest
import ca_test_common
import ceph_volume_simple_activate
fake_cluster = 'ceph'
fake_container_binary = 'podman'
fake_container_image = 'quay.ceph.io/ceph/daemon:latest'
fake_id = '42'
fake_uuid = '0c4a7eca-0c2a-4c12-beff-08a80f064c52'
fake_path = '/etc/ceph/osd/{}-{}... |
common/src/stack/command/stack/commands/set/firmware/model/imp/__init__.py | kmcm0/stacki | 123 | 11884 | # @copyright@
# Copyright (c) 2006 - 2019 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
#
# @rocks@
# Copyright (c) 2000 - 2010 The Regents of the University of California
# All rights reserved. Rocks(r) v5.4 www.rocksclusters.org
# ... |
GasBotty/models/utils.py | GreenCUBIC/GasBotty | 353 | 11891 | <reponame>GreenCUBIC/GasBotty
try:
from torch.hub import load_state_dict_from_url
except ImportError:
from torch.utils.model_zoo import load_url as load_state_dict_from_url
|
venv/Lib/site-packages/nipype/conftest.py | richung99/digitizePlots | 585 | 11907 | <gh_stars>100-1000
import os
import shutil
from tempfile import mkdtemp
import pytest
import numpy
import py.path as pp
NIPYPE_DATADIR = os.path.realpath(
os.path.join(os.path.dirname(__file__), "testing/data")
)
temp_folder = mkdtemp()
data_dir = os.path.join(temp_folder, "data")
shutil.copytree(NIPYPE_DATADIR, d... |
tools/SDKTool/src/ui/dialog/progress_bar_dialog.py | Passer-D/GameAISDK | 1,210 | 11963 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making GameAISDK available.
This source code file is licensed under the GNU General Public License Version 3.
For full details, please refer to the file "LICENSE.txt" which is provided as part of this source code package.
Copyright... |
src/oci/dns/models/external_master.py | Manny27nyc/oci-python-sdk | 249 | 11991 | # coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
scripts/build_folding_map.py | tsieprawski/md4c | 475 | 11995 | #!/usr/bin/env python3
import os
import sys
import textwrap
self_path = os.path.dirname(os.path.realpath(__file__));
f = open(self_path + "/unicode/CaseFolding.txt", "r")
status_list = [ "C", "F" ]
folding_list = [ dict(), dict(), dict() ]
# Filter the foldings for "full" folding.
for line in f:
comment_off =... |
tensorflow/contrib/training/python/training/hparam_test.py | DEVESHTARASIA/tensorflow | 384 | 12020 | # Copyright 2016 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... |
onnxsim/__init__.py | Wheest/onnx-simplifier | 1,977 | 12029 | <gh_stars>1000+
from onnxsim.onnx_simplifier import simplify
__version__ = '0.0.0'
|
validation_tests/analytical_exact/river_at_rest_varying_topo_width/numerical_varying_width.py | samcom12/anuga_core | 136 | 12036 | <filename>validation_tests/analytical_exact/river_at_rest_varying_topo_width/numerical_varying_width.py
"""Simple water flow example using ANUGA
Water driven up a linear slope and time varying boundary,
similar to a beach environment
"""
#------------------------------------------------------------------------------
... |
pyxtal/miscellaneous/from_ase_molecule.py | ubikpt/PyXtal | 127 | 12047 | <reponame>ubikpt/PyXtal
from pyxtal.molecule import *
from ase.build import molecule
from pymatgen.core import Molecule
def get_ase_mol(molname):
"""convert ase molecule to pymatgen style"""
ase_mol = molecule(molname)
pos = ase_mol.get_positions()
symbols = ase_mol.get_chemical_symbols()
return M... |
Python3/src/basicExample.py | emanuelen5/XPlaneConnect | 457 | 12050 | <filename>Python3/src/basicExample.py
from time import sleep
import xpc
def ex():
print("X-Plane Connect example script")
print("Setting up simulation")
with xpc.XPlaneConnect() as client:
# Verify connection
try:
# If X-Plane does not respond to the request, a timeout error
... |
eth_tester/normalization/common.py | PabloLefort/eth-tester | 215 | 12080 | from cytoolz.functoolz import (
curry,
)
from eth_utils import (
to_dict,
to_tuple,
)
@curry
@to_dict
def normalize_dict(value, normalizers):
for key, item in value.items():
normalizer = normalizers[key]
yield key, normalizer(item)
@curry
@to_tuple
def normalize_array(value, normali... |
src/cactus/shared/commonTest.py | thiagogenez/cactus | 209 | 12090 | import os
import shutil
import unittest
from base64 import b64encode
from sonLib.bioio import TestStatus
from sonLib.bioio import getTempFile
from sonLib.bioio import getTempDirectory
from sonLib.bioio import system
from toil.job import Job
from toil.common import Toil
from cactus.shared.common import cactus_call, Chi... |
aws_marketplace/creating_marketplace_products/src/training_specification.py | jerrypeng7773/amazon-sagemaker-examples | 2,610 | 12096 | import json
class TrainingSpecification:
template = """
{
"TrainingSpecification": {
"TrainingImage": "IMAGE_REPLACE_ME",
"SupportedHyperParameters": [
{
"Description": "Grow a tree with max_leaf_nodes in best-first fashion. Best nodes are defined as relative reduction in impu... |
nvd3/multiChart.py | areski/python-nvd3 | 442 | 12104 | <filename>nvd3/multiChart.py<gh_stars>100-1000
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Python-nvd3 is a Python wrapper for NVD3 graph library.
NVD3 is an attempt to build re-usable charts and chart components
for d3.js without taking away the power that d3.js gives you.
Project location : https://github.com/are... |
chromium/tools/telemetry/telemetry/internal/image_processing/video.py | wedataintelligence/vivaldi-source | 925 | 12138 | <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 subprocess
from catapult_base import cloud_storage
from telemetry.core import platform
from telemetry.util import image_util
from ... |
adapters/heiman/HS1RC.py | russdan/domoticz-zigbee2mqtt-plugin | 146 | 12177 | <filename>adapters/heiman/HS1RC.py
from adapters.adapter_with_battery import AdapterWithBattery
from devices.switch.selector_switch import SelectorSwitch
class HeimanAlarmRemoteAdapter(AdapterWithBattery):
def __init__(self):
super().__init__()
self.switch = SelectorSwitch('Remote', 'action')
... |
kratos/mpi/tests/test_data_communicator_factory.py | lkusch/Kratos | 778 | 12200 | from KratosMultiphysics import ParallelEnvironment, IsDistributedRun
if IsDistributedRun():
from KratosMultiphysics.mpi import DataCommunicatorFactory
import KratosMultiphysics.KratosUnittest as UnitTest
import math
class TestDataCommunicatorFactory(UnitTest.TestCase):
def setUp(self):
self.registere... |
tools/testrunner/outproc/message.py | LancerWang001/v8 | 20,995 | 12203 | # Copyright 2018 the V8 project 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 itertools
import os
import re
from . import base
class OutProc(base.ExpectedOutProc):
def __init__(self, expected_outcomes, basepath, expected_... |
Packs/Thycotic/Integrations/Thycotic/Thycotic_test.py | diCagri/content | 799 | 12205 | import pytest
from Thycotic import Client, \
secret_password_get_command, secret_username_get_command, \
secret_get_command, secret_password_update_command, secret_checkout_command, secret_checkin_command, \
secret_delete_command, folder_create_command, folder_delete_command, folder_update_command
from tes... |
scripts/tests/snapshots/snap_keywords_test.py | Duroktar/Wolf | 105 | 12212 | # -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals
from snapshottest import Snapshot
snapshots = Snapshot()
snapshots['test_keywords 1'] = '[{"lineno": 7, "source": [" a\\n"], "value": "1"}, {"lineno": 7, "source": [" a\\n"], "value": "2"}, {"lineno": 7,... |
docs/source/conf.py | andriis/bravado | 600 | 12228 | # -*- coding: utf-8 -*-
import sphinx_rtd_theme
# -- General configuration -----------------------------------------------
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_te... |
eeauditor/auditors/aws/Amazon_ECS_Auditor.py | kbhagi/ElectricEye | 442 | 12248 | #This file is part of ElectricEye.
#SPDX-License-Identifier: Apache-2.0
#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 un... |
trimap_module.py | lnugraha/trimap_generator | 168 | 12265 | <reponame>lnugraha/trimap_generator<filename>trimap_module.py<gh_stars>100-1000
#!/usr/bin/env python
import cv2, os, sys
import numpy as np
def extractImage(path):
# error handller if the intended path is not found
image = cv2.imread(path, cv2.IMREAD_GRAYSCALE)
return image
def checkImage(image):
"""... |
test/test_slimta_queue_proxy.py | nanojob/python-slimta | 141 | 12329 | <reponame>nanojob/python-slimta<filename>test/test_slimta_queue_proxy.py<gh_stars>100-1000
import unittest
from mox3.mox import MoxTestBase, IsA
from slimta.queue.proxy import ProxyQueue
from slimta.smtp.reply import Reply
from slimta.relay import Relay, TransientRelayError, PermanentRelayError
from slimta.envelope i... |
grafana_backup/create_snapshot.py | Keimille/grafana-backup-tool | 515 | 12355 | import json
from grafana_backup.dashboardApi import create_snapshot
def main(args, settings, file_path):
grafana_url = settings.get('GRAFANA_URL')
http_post_headers = settings.get('HTTP_POST_HEADERS')
verify_ssl = settings.get('VERIFY_SSL')
client_cert = settings.get('CLIENT_CERT')
debug = setting... |
segmentation/data/transforms/__init__.py | RajasekharChowdary9/panoptic-deeplab | 506 | 12358 | <gh_stars>100-1000
from .build import build_transforms
from .pre_augmentation_transforms import Resize
from .target_transforms import PanopticTargetGenerator, SemanticTargetGenerator
|
htk-lite/commandlist/help.py | otherbeast/hackers-tool-kit | 393 | 12371 | <reponame>otherbeast/hackers-tool-kit
#!/usr/local/bin/python
# coding: latin-1
#if you use this code give me credit @tuf_unkn0wn
#i do not give you permission to show / edit this script without my credit
#to ask questions or report a problem message me on instagram @tuf_unkn0wn
"""
██░ ██ ▄▄▄ ▄████▄ ██ ▄█▀... |
bunkai/algorithm/lbd/custom_tokenizers.py | megagonlabs/bunkai | 149 | 12374 | #!/usr/bin/env python3
import collections
import logging
import os
import typing
import unicodedata
from janome.tokenizer import Tokenizer
from transformers.file_utils import cached_path
from transformers.models.bert.tokenization_bert import BertTokenizer, WordpieceTokenizer, load_vocab
import bunkai.constant
"""
T... |
pythran/tests/rosetta/greatest_subsequential_sum.py | davidbrochart/pythran | 1,647 | 12391 | <gh_stars>1000+
#from http://rosettacode.org/wiki/Greatest_subsequential_sum#Python
#pythran export maxsum(int list)
#pythran export maxsumseq(int list)
#pythran export maxsumit(int list)
#runas maxsum([0, 1, 0])
#runas maxsumseq([-1, 2, -1, 3, -1])
#runas maxsumit([-1, 1, 2, -5, -6])
def maxsum(sequence):
"""Retu... |
test/functional/test_framework/script_util.py | TopoX84/newlux | 1,389 | 12403 | #!/usr/bin/env python3
# Copyright (c) 2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Useful Script constants and utils."""
from test_framework.script import CScript
# To prevent a "tx-size-sma... |
tests/error/test_format_error.py | GDGSNF/graphql-core | 590 | 12422 | <gh_stars>100-1000
from typing import List, Union
from pytest import raises
from graphql.error import GraphQLError, format_error
from graphql.language import Node, Source
from graphql.pyutils import Undefined
def describe_format_error():
def formats_graphql_error():
source = Source(
"""
... |
dvrip.py | jackkum/python-dvr | 149 | 12432 | <filename>dvrip.py
import os
import struct
import json
from time import sleep
import hashlib
import threading
from socket import socket, AF_INET, SOCK_STREAM, SOCK_DGRAM
from datetime import *
from re import compile
import time
import logging
class SomethingIsWrongWithCamera(Exception):
pass
class DVRIPCam(object... |
tests/test_renderer.py | 0xflotus/maildown | 626 | 12433 | <filename>tests/test_renderer.py
import mock
from maildown import renderer
import mistune
import pygments
from pygments import lexers
from pygments.formatters import html
import premailer
import jinja2
def test_highlight_renderer(monkeypatch):
monkeypatch.setattr(mistune, "escape", mock.MagicMock())
monkeypat... |
source1/bsp/entities/portal2_entity_handlers.py | tltneon/SourceIO | 199 | 12443 | import math
from mathutils import Euler
import bpy
from .portal2_entity_classes import *
from .portal_entity_handlers import PortalEntityHandler
local_entity_lookup_table = PortalEntityHandler.entity_lookup_table.copy()
local_entity_lookup_table.update(entity_class_handle)
class Portal2EntityHandler(PortalEntityHan... |
comicstreamerlib/gui_qt.py | rlugojr/ComicStreamer | 169 | 12454 | import sys
import webbrowser
import os
from comicstreamerlib.folders import AppFolders
from PyQt4 import QtGui,QtCore
class SystemTrayIcon(QtGui.QSystemTrayIcon):
def __init__(self, icon, app):
QtGui.QSystemTrayIcon.__init__(self, icon, None)
self.app = app
self.menu = QtGui.QMenu(None)
... |
Python/Interfacing_C_C++_Fortran/F2py/comp_pi_f2py.py | Gjacquenot/training-material | 115 | 12482 | #!/usr/bin/env python
from argparse import ArgumentParser
import sys
from comp_pi import compute_pi
def main():
arg_parser = ArgumentParser(description='compute pi using Fortran '
'function')
arg_parser.add_argument('n', default=1000, nargs='?',
hel... |
dqn/dqn_noisy_networks/model.py | AgentMaker/Paddle-RLBooks | 127 | 12485 | <filename>dqn/dqn_noisy_networks/model.py
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from paddle.nn.initializer import Assign
import math
class NoisyLinear(nn.Linear):
def __init__(self, in_features, out_features, sigma_zero=0.4, bias=True):
super(NoisyLinear, self).__init__(in_f... |
src/ensemble_nn/agent_nn.py | AbhinavGopal/ts_tutorial | 290 | 12538 | <reponame>AbhinavGopal/ts_tutorial
"""Agents for neural net bandit problems.
We implement three main types of agent:
- epsilon-greedy (fixed epsilon, annealing epsilon)
- dropout (arXiv:1506.02142)
- ensemble sampling
All code is specialized to the setting of 2-layer fully connected MLPs.
"""
import numpy as np... |
safe_control_gym/math_and_models/normalization.py | catgloss/safe-control-gym | 120 | 12552 | """Perform normalization on inputs or rewards.
"""
import numpy as np
import torch
from gym.spaces import Box
def normalize_angle(x):
"""Wraps input angle to [-pi, pi].
"""
return ((x + np.pi) % (2 * np.pi)) - np.pi
class RunningMeanStd():
"""Calulates the running mean and std of a data stream.
... |
fastf1/tests/test_livetiming.py | JellybeanAsh/Fast-F1 | 690 | 12555 | <filename>fastf1/tests/test_livetiming.py
import os
from fastf1.core import Session, Weekend
from fastf1.livetiming.data import LiveTimingData
def test_file_loading_w_errors():
# load file with many errors and invalid data without crashing
livedata = LiveTimingData('fastf1/testing/reference_data/livedata/wit... |
perceiver/train/dataset.py | kawa-work/deepmind-research | 10,110 | 12567 | <reponame>kawa-work/deepmind-research
# Copyright 2021 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Un... |
networkx/algorithms/approximation/ramsey.py | rakschahsa/networkx | 445 | 12581 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Ramsey numbers.
"""
# Copyright (C) 2011 by
# <NAME> <<EMAIL>>
# All rights reserved.
# BSD license.
import networkx as nx
from ...utils import arbitrary_element
__all__ = ["ramsey_R2"]
__author__ = """<NAME> (<EMAIL>)"""
def ramsey_R2(G):
r"""Approximately ... |
malaya_speech/train/model/fastspeechsplit/model.py | ishine/malaya-speech | 111 | 12598 | import tensorflow as tf
from ..fastspeech.model import (
TFFastSpeechEncoder,
TFTacotronPostnet,
TFFastSpeechLayer,
)
from ..speechsplit.model import InterpLnr
import numpy as np
import copy
class Encoder_6(tf.keras.layers.Layer):
def __init__(self, config, hparams, **kwargs):
super(Encoder_6,... |
apim-migration-testing-tool/Python/venv/lib/python3.6/site-packages/pymysql/constants/CR.py | tharindu1st/apim-migration-resources | 1,573 | 12615 | <filename>apim-migration-testing-tool/Python/venv/lib/python3.6/site-packages/pymysql/constants/CR.py
# flake8: noqa
# errmsg.h
CR_ERROR_FIRST = 2000
CR_UNKNOWN_ERROR = 2000
CR_SOCKET_CREATE_ERROR = 2001
CR_CONNECTION_ERROR = 2002
CR_CONN_HOST_ERROR = 2003
CR_IPSOCK_ERROR = 2004
CR_UNKNOWN_HOST = 2005
CR_SERVER_GON... |
sayn/logging/file_logger.py | robin-173/sayn | 105 | 12651 | from pathlib import Path
import logging
from .logger import Logger
from .log_formatter import LogFormatter
class FileLogger(Logger):
fmt = LogFormatter(use_colour=False, output_ts=False)
logger = None
def __init__(self, folder, format=None):
if format is None:
format = ("%(asctime)s|... |
segmentation/utils/transforms.py | voldemortX/DST-CBC | 103 | 12655 | <gh_stars>100-1000
# Mostly copied and modified from torch/vision/references/segmentation to support unlabeled data
# Copied functions from fmassa/vision-1 to support multi-dimensional masks loaded from numpy ndarray
import numpy as np
from PIL import Image
import random
import torch
import utils.functional as F
# Fo... |
src/c3nav/site/templatetags/route_render.py | johnjohndoe/c3nav | 132 | 12659 | <reponame>johnjohndoe/c3nav
from django import template
register = template.Library()
@register.filter
def negate(value):
return -value
@register.filter
def subtract(value, arg):
return value - arg
|
mysql_tests/test_schema.py | maestro-1/gino | 1,376 | 12678 | from enum import Enum
import pytest
import gino
from gino.dialects.aiomysql import AsyncEnum
pytestmark = pytest.mark.asyncio
db = gino.Gino()
class MyEnum(Enum):
ONE = "one"
TWO = "two"
class Blog(db.Model):
__tablename__ = "s_blog"
id = db.Column(db.BigInteger(), primary_key=True)
title = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.