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 |
|---|---|---|---|---|
crits/ips/urls.py | dutrow/crits | 738 | 30995 | <reponame>dutrow/crits<filename>crits/ips/urls.py
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^search/$', views.ip_search, name='crits-ips-views-ip_search'),
url(r'^search/(?P<ip_str>\S+)/$', views.ip_search, name='crits-ips-views-ip_search'),
url(r'^details/(?P<ip>\S+)/$', ... |
atlas/aws_utils/src/test/test_aws_bucket.py | DeepLearnI/atlas | 296 | 31018 | <filename>atlas/aws_utils/src/test/test_aws_bucket.py
import unittest
from mock import Mock
from foundations_spec import *
from foundations_aws.aws_bucket import AWSBucket
class TestAWSBucket(Spec):
class MockListing(object):
def __init__(self, bucket, files):
self._bucket = bucket
... |
pykafka/test/utils.py | Instamojo/pykafka | 1,174 | 31027 | import time
import os
from pykafka.test.kafka_instance import KafkaInstance, KafkaConnection
def get_cluster():
"""Gets a Kafka cluster for testing, using one already running is possible.
An already-running cluster is determined by environment variables:
BROKERS, ZOOKEEPER, KAFKA_BIN. This is used prim... |
mlcomp/contrib/model/video/resnext3d/r2plus1_util.py | megachester/mlcomp | 166 | 31046 | <gh_stars>100-1000
#!/usr/bin/env python3
# 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.
import logging
import torch.nn as nn
def r2plus1_unit(
dim_in,
dim_out,
t... |
challenges/CNMP/poller/for-testing/machine.py | pingjuiliao/cb-multios | 473 | 31093 | <gh_stars>100-1000
#!/usr/bin/env python
#
# Copyright (C) 2014 Narf Industries <<EMAIL>>
#
# 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 limitation
#... |
venv/Lib/site-packages/zmq/tests/test_win32_shim.py | ajayiagbebaku/NFL-Model | 603 | 31097 | <filename>venv/Lib/site-packages/zmq/tests/test_win32_shim.py<gh_stars>100-1000
from __future__ import print_function
import os
import time
import sys
from functools import wraps
from pytest import mark
from zmq.tests import BaseZMQTestCase
from zmq.utils.win32 import allow_interrupt
def count_calls(f):
@wraps... |
requests__examples/yahoo_api__rate_currency.py | DazEB2/SimplePyScripts | 117 | 31104 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# TODO: использовать http://www.cbr.ru/scripts/Root.asp?PrtId=SXML или разобраться с данными от query.yahooapis.com
# непонятны некоторые параметры
# TODO: сделать консоль
# TODO: сделать гуй
# TODO: сделать сервер
import requests
rs = requests.... |
PyEngine3D/OpenGLContext/Texture.py | ubuntunux/PyEngine3D | 121 | 31111 | import traceback
import copy
import gc
from ctypes import c_void_p
import itertools
import array
import math
import numpy as np
from OpenGL.GL import *
from PyEngine3D.Common import logger
from PyEngine3D.Utilities import Singleton, GetClassName, Attributes, Profiler
from PyEngine3D.OpenGLContext import OpenGLContex... |
models/ClassicNetwork/blocks/resnext_block.py | Dou-Yu-xuan/deep-learning-visal | 150 | 31180 | <filename>models/ClassicNetwork/blocks/resnext_block.py<gh_stars>100-1000
# -*- coding: UTF-8 -*-
"""
@<NAME> 2020_09_08
"""
import torch.nn as nn
import torch.nn.functional as F
from models.blocks.SE_block import SE
from models.blocks.conv_bn import BN_Conv2d
class ResNeXt_Block(nn.Module):
"""
ResNeXt bloc... |
unittest/scripts/py_dev_api_examples/working_with_collections/Working_with_Existing_Collections.py | mueller/mysql-shell | 119 | 31269 | # Get a collection object for 'my_collection'
myColl = db.get_collection('my_collection')
|
falkon/mmv_ops/keops.py | mohamad-amin/falkon | 130 | 31271 | import warnings
from dataclasses import dataclass
from typing import List, Optional
import torch
from falkon.utils.stream_utils import sync_current_stream
from falkon.mmv_ops.utils import _get_gpu_info, create_output_mat, _start_wait_processes
from falkon.options import FalkonOptions, BaseOptions
from falkon.utils i... |
octavia/controller/worker/v2/flows/flow_utils.py | zhangi/octavia | 129 | 31336 | <reponame>zhangi/octavia
# 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 i... |
corehq/apps/fixtures/interface.py | omari-funzone/commcare-hq | 471 | 31356 | from django.contrib import messages
from django.http import HttpResponseRedirect
from django.utils.functional import cached_property
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_noop, ugettext_lazy
from couchdbkit import ResourceNotFound
from memoized import memoized... |
tests/components/tasks/gqa_tests.py | aasseman/pytorchpipe | 232 | 31387 | <filename>tests/components/tasks/gqa_tests.py
# -*- coding: utf-8 -*-
#
# Copyright (C) tkornuta, IBM Corporation 2019
#
# 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... |
contrib/frontends/py/nntpchan/__init__.py | majestrate/nntpchan | 233 | 31389 | <filename>contrib/frontends/py/nntpchan/__init__.py
#
# entry for gunicorn
#
from nntpchan.app import app
from nntpchan import viewsp
|
alipay/aop/api/domain/TopicItemVo.py | snowxmas/alipay-sdk-python-all | 213 | 31405 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class TopicItemVo(object):
def __init__(self):
self._desc = None
self._id = None
self._status = None
self._title = None
@property
def desc(self):
return... |
exercises/spiral-matrix/spiral_matrix.py | kishankj/python | 1,177 | 31421 | <filename>exercises/spiral-matrix/spiral_matrix.py
def spiral_matrix(size):
pass
|
grove/alpha/jordan_gradient/jordan_gradient.py | mkeshita/grove | 229 | 31427 | import numpy as np
from pyquil import Program
from pyquil.api import QuantumComputer, get_qc
from grove.alpha.jordan_gradient.gradient_utils import (binary_float_to_decimal_float,
measurements_to_bf)
from grove.alpha.phaseestimation.phase_estimation import phase_... |
test/benchmark/jvp_conv2d.py | jabader97/backpack | 395 | 31428 | from torch import randn
from torch.nn import Conv2d
from backpack import extend
def data_conv2d(device="cpu"):
N, Cin, Hin, Win = 100, 10, 32, 32
Cout, KernelH, KernelW = 25, 5, 5
X = randn(N, Cin, Hin, Win, requires_grad=True, device=device)
module = extend(Conv2d(Cin, Cout, (KernelH, KernelW))).to... |
test/com/facebook/buck/core/module/impl/test_app.py | Unknoob/buck | 8,027 | 31469 | <reponame>Unknoob/buck<filename>test/com/facebook/buck/core/module/impl/test_app.py
# Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... |
loopchain/blockchain/blocks/v0_5/block_builder.py | windies21/loopchain | 105 | 31481 | <gh_stars>100-1000
# Copyright 2018-current ICON Foundation
#
# 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 applicabl... |
recipes/Python/576708_DVMVersusCAPM/recipe-576708.py | tdiprima/code | 2,023 | 31495 | <gh_stars>1000+
#On the name of ALLAH and may the blessing and peace of Allah
#be upon the Messenger of Allah <NAME>.
#Author : <NAME>
#Date : 07/03/09
#version :2.6.1
"""
collections module's extras in python 2.6.1 were used in my program, DVMextrapolating
DVMgordonsModel and CAPM subclasses of namedtuple Python cla... |
tutorials/W1D3_MultiLayerPerceptrons/solutions/W1D3_Tutorial1_Solution_d58d2933.py | amita-kapoor/course-content-dl | 473 | 31513 |
"""
At infinite membrane resistance, the Neuron does not leak any current out,
and hence it starts firing with the slightest input current,
This shifts the transfer function towards 0, similar to ReLU activation (centered at 0).
Also, when there is minimal refractory time, the neuron can keep firing
at a high input cu... |
arviz/plots/backends/matplotlib/separationplot.py | sudojarvis/arviz | 1,159 | 31540 | <reponame>sudojarvis/arviz
"""Matplotlib separation plot."""
import matplotlib.pyplot as plt
import numpy as np
from ...plot_utils import _scale_fig_size
from . import backend_kwarg_defaults, backend_show, create_axes_grid
def plot_separation(
y,
y_hat,
y_hat_line,
label_y_hat,
expected_events,
... |
Examples/Image/Detection/FastRCNN/BrainScript/B3_VisualizeOutputROIs.py | shyamalschandra/CNTK | 17,702 | 31559 | <filename>Examples/Image/Detection/FastRCNN/BrainScript/B3_VisualizeOutputROIs.py
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
f... |
src/deepke/name_entity_re/__init__.py | johncolezhang/DeepKE | 710 | 31560 | from .standard import *
from .few_shot import *
|
recipes/Python/299133_bubblebabble/recipe-299133.py | tdiprima/code | 2,023 | 31562 | #! /usr/bin/env python
"""Compute a (somewhat more) human readable format for message
digests. This is port of the perl module Digest-BubbleBabble-0.01
(http://search.cpan.org/~btrott/Digest-BubbleBabble-0.01/)
"""
vowels = "aeiouy"
consonants = "bcdfghklmnprstvzx"
def bubblebabble(digest):
"""compute bubblebabb... |
examples/python/sso/esi_oauth_native.py | Dusty-Meg/esi-docs | 130 | 31565 | <reponame>Dusty-Meg/esi-docs<gh_stars>100-1000
""" Python 3 native (desktop/mobile) OAuth 2.0 example.
This example can be run from the command line and will show you how the
OAuth 2.0 flow should be handled if you are a web based application.
Prerequisites:
* Create an SSO application at developers.eveonli... |
examples/resourcetracking/client.py | brubbel/Pyro4 | 638 | 31567 | <filename>examples/resourcetracking/client.py
from __future__ import print_function
import sys
import random
import Pyro4
if sys.version_info < (3, 0):
input = raw_input
uri = input("Enter the URI of the server object: ")
with Pyro4.Proxy(uri) as proxy:
print("currently allocated resources:", proxy.list())... |
tests/unitary/ERC20CRV/test_setters.py | AqualisDAO/curve-dao-contracts | 217 | 31597 | import brownie
def test_set_minter_admin_only(accounts, token):
with brownie.reverts("dev: admin only"):
token.set_minter(accounts[2], {"from": accounts[1]})
def test_set_admin_admin_only(accounts, token):
with brownie.reverts("dev: admin only"):
token.set_admin(accounts[2], {"from": account... |
rurouni/exceptions.py | PinkDiamond1/Kenshin | 219 | 31601 | # coding: utf-8
class RurouniException(Exception):
pass
class ConfigException(RurouniException):
pass
class TokenBucketFull(RurouniException):
pass
class UnexpectedMetric(RurouniException):
pass |
release/stubs.min/System/Windows/Forms/__init___parts/ControlStyles.py | htlcnn/ironpython-stubs | 182 | 31611 | class ControlStyles(Enum,IComparable,IFormattable,IConvertible):
"""
Specifies the style and behavior of a control.
enum (flags) ControlStyles,values: AllPaintingInWmPaint (8192),CacheText (16384),ContainerControl (1),DoubleBuffer (65536),EnableNotifyMessage (32768),FixedHeight (64),FixedWidth (32),Opaque ... |
bin/award_ebadge_declare.py | ervikey/SA-ctf_scoreboard | 106 | 31633 | <filename>bin/award_ebadge_declare.py
# encode = utf-8
import os
import sys
import re
ta_name = 'SA-ctf_scoreboard'
ta_lib_name = 'sa_ctf_scoreboard'
pattern = re.compile(r"[\\/]etc[\\/]apps[\\/][^\\/]+[\\/]bin[\\/]?$")
new_paths = [path for path in sys.path if not pattern.search(path) or ta_name in path]
new_paths.i... |
seleniumwire/thirdparty/mitmproxy/net/http/multipart.py | KozminMoci/selenium-wire | 975 | 31641 | <reponame>KozminMoci/selenium-wire
import mimetypes
import re
from urllib.parse import quote
from seleniumwire.thirdparty.mitmproxy.net.http import headers
def encode(head, l):
k = head.get("content-type")
if k:
k = headers.parse_content_type(k)
if k is not None:
try:
... |
nlpaug/model/audio/normalization.py | techthiyanes/nlpaug | 3,121 | 31707 | import numpy as np
from nlpaug.model.audio import Audio
class Normalization(Audio):
def manipulate(self, data, method, start_pos, end_pos):
aug_data = data.copy()
if method == 'minmax':
new_data = self._min_max(aug_data[start_pos:end_pos])
elif method == 'max':
new_data = self._max(aug_data[start_pos:en... |
robogym/envs/rearrange/tests/test_object_creation.py | 0xflotus/robogym | 288 | 31766 | import numpy as np
from numpy.testing import assert_allclose
from robogym.envs.rearrange.common.utils import (
get_mesh_bounding_box,
make_block,
make_blocks_and_targets,
)
from robogym.envs.rearrange.simulation.composer import RandomMeshComposer
from robogym.mujoco.mujoco_xml import MujocoXML
def _get_d... |
examples/tesselation.py | 2dx/moderngl | 916 | 31803 | <gh_stars>100-1000
#!/usr/bin/env python3
'''Simple example of using tesselation to render a cubic Bézier curve'''
import numpy as np
import moderngl
from ported._example import Example
class Tessellation(Example):
title = "Tessellation"
gl_version = (4, 0)
def __init__(self, **kwargs):
super()... |
tests/techniques/test_train_policy_gradient.py | alphagamatoe/AlphaToe | 172 | 31852 | <filename>tests/techniques/test_train_policy_gradient.py
import functools
from unittest import TestCase
from common.base_game_spec import BaseGameSpec
from common.network_helpers import create_network
from games.tic_tac_toe import TicTacToeGameSpec
from games.tic_tac_toe_x import TicTacToeXGameSpec
from techniques.tra... |
sdk/python/core/tests/test_sanity_augmentation.py | YDK-Solutions/ydk | 125 | 31854 | # ----------------------------------------------------------------
# Copyright 2016 Cisco Systems
#
# 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/LICENS... |
getdata.py | krantirk/dash-120million-taxi-app | 103 | 31898 | <reponame>krantirk/dash-120million-taxi-app
import vaex
import os
# Open the main data
taxi_path = 's3://vaex/taxi/yellow_taxi_2012_zones.hdf5?anon=true'
# override the path, e.g. $ export TAXI_PATH=/data/taxi/yellow_taxi_2012_zones.hdf5
taxi_path = os.environ.get('TAXI_PATH', taxi_path)
df_original = vaex.open(taxi_pa... |
libs/validators/iban.py | Sparklingx/nzbhydra | 674 | 31904 | import re
from .utils import validator
regex = (
r'^[A-Z]{2}[0-9]{2}[A-Z0-9]{13,30}$'
)
pattern = re.compile(regex)
def char_value(char):
"""A=10, B=11, ..., Z=35
"""
if char.isdigit():
return int(char)
else:
return 10 + ord(char) - ord('A')
def modcheck(value):
"""Check if... |
examples/project-sourcecode/c.py | wheatdog/guildai | 694 | 31924 | <gh_stars>100-1000
from subproject import d
print("c")
|
tests/test_packages/test_skills/test_registration_aw1/test_behaviours.py | bryanchriswhite/agents-aea | 126 | 31967 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI 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 ob... |
mitmproxy/contentviews/auto.py | KarlParkinson/mitmproxy | 24,939 | 31981 | <filename>mitmproxy/contentviews/auto.py
from mitmproxy import contentviews
from . import base
class ViewAuto(base.View):
name = "Auto"
def __call__(self, data, **metadata):
# TODO: The auto view has little justification now that views implement render_priority,
# but we keep it around for no... |
official/utils/misc/keras_utils.py | baranshad/models | 180 | 32006 | # 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 required by applica... |
examples/highcharts/pie-donut.py | Jbrunn/python-highcharts | 370 | 32045 | # -*- coding: utf-8 -*-
"""
Highcharts Demos
Donut chart: http://www.highcharts.com/demo/pie-donut
"""
from highcharts import Highchart
H = Highchart(width = 850, height = 400)
data = [{
'y': 55.11,
'color': 'Highcharts.getOptions().colors[0]',
'drilldown': {
'name'... |
Configuration/Eras/python/Modifier_run2_GEM_2017_cff.py | ckamtsikis/cmssw | 852 | 32053 | <reponame>ckamtsikis/cmssw<filename>Configuration/Eras/python/Modifier_run2_GEM_2017_cff.py
import FWCore.ParameterSet.Config as cms
run2_GEM_2017 = cms.Modifier()
|
d4rl/carla/data_collection_agent_lane.py | chappers/d4rl | 552 | 32054 | # !/usr/bin/env python
# Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
#
# Modified by <NAME> on 20 April 2020
import argparse
import datetime
impo... |
applications/tensorflow2/image_classification/data/data_transformer.py | payoto/graphcore_examples | 260 | 32084 | <reponame>payoto/graphcore_examples
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
import tensorflow as tf
from tensorflow.python.ops import math_ops
import logging
from . import imagenet_processing
from custom_exceptions import UnsupportedFormat, DimensionError
class DataTransformer:
logger = loggin... |
dowhy/graph_learner.py | leo-ware/dowhy | 2,904 | 32101 | class GraphLearner:
"""Base class for causal discovery methods.
Subclasses implement different discovery methods. All discovery methods are in the package "dowhy.causal_discoverers"
"""
def __init__(self, data, library_class, *args, **kwargs):
self._data = data
self._labels = list(self._data.columns)
self... |
easytrader/utils/stock.py | chforest/easytrader | 6,829 | 32103 | <filename>easytrader/utils/stock.py
# coding:utf-8
import datetime
import json
import random
import requests
def get_stock_type(stock_code):
"""判断股票ID对应的证券市场
匹配规则
['50', '51', '60', '90', '110'] 为 sh
['00', '13', '18', '15', '16', '18', '20', '30', '39', '115'] 为 sz
['5', '6', '9'] 开头的为 sh, 其余为 s... |
matplotlib_venn/_venn2.py | TRuikes/matplotlib-venn | 306 | 32134 | <gh_stars>100-1000
'''
Venn diagram plotting routines.
Two-circle venn plotter.
Copyright 2012, <NAME>.
http://kt.era.ee/
Licensed under MIT license.
'''
# Make sure we don't try to do GUI stuff when running tests
import sys, os
if 'py.test' in os.path.basename(sys.argv[0]): # (XXX: Ugly hack)
import matplotlib
... |
notebooks/bqml/track_meta.py | roannav/learntools | 359 | 32140 | # See also examples/example_track/track_meta.py for a longer, commented example
track = dict(
author_username='dansbecker',
course_name='Machine Learning',
course_url='https://www.kaggle.com/learn/intro-to-machine-learning'
)
lessons = [
dict(
topic='Your First BiqQuery ML Model',
... |
Python/1013. PartitionArrayIntoThreePartsWithEqualSum.py | nizD/LeetCode-Solutions | 263 | 32142 | class Solution:
def canThreePartsEqualSum(self, A: List[int]) -> bool:
# Since all the three parts are equal, if we sum all element of arrary it should be a multiplication of 3
# so the sum of each part must be equal to sum of all element divided by 3
quotient, remainder = divmod(sum(A), 3)
... |
lib/data_utils/insta_utils_imgs.py | ziniuwan/maed | 145 | 32144 | import os
import sys
sys.path.append('.')
import argparse
import numpy as np
import os.path as osp
from multiprocessing import Process, Pool
from glob import glob
from tqdm import tqdm
import tensorflow as tf
from PIL import Image
from lib.core.config import INSTA_DIR, INSTA_IMG_DIR
def process_single_record(fname,... |
recipes/happly/all/conanfile.py | rockandsalt/conan-center-index | 562 | 32192 | from conans import ConanFile, tools
class HapplyConan(ConanFile):
name = "happly"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/nmwsharp/happly"
topics = ("conan", "happly", "ply", "3D")
license = "MIT"
description = "A C++ header-only parser for the PLY... |
tests/integration/serialization_test.py | markowanga/stweet | 101 | 32206 | import pytest
import stweet as st
from tests.test_util import get_temp_test_file_name, get_tweets_to_tweet_output_test, \
two_lists_assert_equal
def test_csv_serialization():
csv_filename = get_temp_test_file_name('csv')
tweets_collector = st.CollectorTweetOutput()
get_tweets_to_tweet_output_test([
... |
Maths_And_Stats/Number_Theory/Segmented_Sieve/segmented_sieve.py | arslantalib3/algo_ds_101 | 182 | 32208 | <gh_stars>100-1000
def segmented_sieve(n):
# Create an boolean array with all values True
primes = [True]*n
for p in range(2,n):
#If prime[p] is True,it is a prime and its multiples are not prime
if primes[p]:
for i in range(2*p,n,p):
# Mark every multiple of ... |
third_party/blink/renderer/bindings/scripts/blink_idl_parser_test.py | zealoussnow/chromium | 14,668 | 32213 | # 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.
# pylint: disable=no-member,relative-import
"""Unit tests for blink_idl_parser.py."""
import unittest
from blink_idl_parser import BlinkIDLParser
class B... |
sarikasama/0012/0012.py | saurabh896/python-1 | 3,976 | 32229 | #!/usr/bin/env python3
#filter sensitive words in user's input
def replace_sensitive_words(input_word):
s_words = []
with open('filtered_words','r') as f:
line = f.readline()
while line != '':
s_words.append(line.strip())
line = f.readline()
for word in s_words:
... |
tests/r/test_bcdeter.py | hajime9652/observations | 199 | 32245 | <reponame>hajime9652/observations
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.bcdeter import bcdeter
def test_bcdeter():
"""Test module bcdeter.py by downloading
bcdeter.csv and testing... |
Sampling_based_Planning/rrt_3D/env3D.py | CodesHub/PathPlanning | 3,693 | 32258 | <filename>Sampling_based_Planning/rrt_3D/env3D.py
# this is the three dimensional configuration space for rrt
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
import numpy as np
# from utils3D import OBB2AABB
def R_matrix(z_angle,y_angle,x_angle):
# s angle: row; y angle: pitch; z ... |
mqtt_io/modules/sensor/mcp3008.py | DominicWindisch/mqtt-io | 231 | 32261 | <reponame>DominicWindisch/mqtt-io<filename>mqtt_io/modules/sensor/mcp3008.py
"""
MCP3008 analog to digital converter
"""
import logging
from typing import cast
from mqtt_io.types import ConfigType, SensorValueType
from . import GenericSensor
REQUIREMENTS = ("adafruit-mcp3008",)
CONFIG_SCHEMA = {
"spi_port": di... |
tests/test_scriptfields.py | ttimasdf/pyes | 175 | 32283 | <filename>tests/test_scriptfields.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import unittest
from pyes import scriptfields
class ScriptFieldsTest(unittest.TestCase):
def test_scriptfieldserror_imported(self):
self.assertTrue(hasattr(scriptfields, 'ScriptFieldsError'))
def test_i... |
arviz/plots/backends/matplotlib/distcomparisonplot.py | sudojarvis/arviz | 1,159 | 32296 | <filename>arviz/plots/backends/matplotlib/distcomparisonplot.py
"""Matplotlib Density Comparison plot."""
import matplotlib.pyplot as plt
import numpy as np
from ...distplot import plot_dist
from ...plot_utils import _scale_fig_size
from . import backend_kwarg_defaults, backend_show
def plot_dist_comparison(
ax,... |
tests/r/test_us_pop.py | hajime9652/observations | 199 | 32343 | <gh_stars>100-1000
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.us_pop import us_pop
def test_us_pop():
"""Test module us_pop.py by downloading
us_pop.csv and testing shape of
extract... |
run.py | radish2012/flask-restful-example | 650 | 32370 | from app.factory import create_app, celery_app
app = create_app(config_name="DEVELOPMENT")
app.app_context().push()
if __name__ == "__main__":
app.run()
|
tests/unicode/unicode_id.py | learnforpractice/micropython-cpp | 692 | 32394 | <filename>tests/unicode/unicode_id.py
# test unicode in identifiers
# comment
# αβγδϵφζ
# global identifiers
α = 1
αβγ = 2
bβ = 3
βb = 4
print(α, αβγ, bβ, βb)
# function, argument, local identifiers
def α(β, γ):
δ = β + γ
print(β, γ, δ)
α(1, 2)
# class, method identifiers
class φ:
def __init__(self):
... |
samples/histrequester_demo.py | suuuch/tws_async | 102 | 32397 | import datetime
import pytz
from tws_async import *
stocks = [
Stock('TSLA'),
Stock('AAPL'),
Stock('GOOG'),
Stock('INTC', primaryExchange='NASDAQ')
]
forexs = [
Forex('EURUSD'),
Forex('GBPUSD'),
Forex('USDJPY')
]
endDate = datetime.date.today()
startDate = endDate - datetime.timedelta(day... |
Tests/ttLib/tables/C_F_F__2_test.py | odidev/fonttools | 2,705 | 32399 | """cff2Lib_test.py -- unit test for Adobe CFF fonts."""
from fontTools.ttLib import TTFont
from io import StringIO
import re
import os
import unittest
CURR_DIR = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
DATA_DIR = os.path.join(CURR_DIR, 'data')
CFF_TTX = os.path.join(DATA_DIR, "C_F_F__2.ttx")
CF... |
tfumap/parametric_tsne.py | EhsanKA/ParametricUMAP_paper | 124 | 32415 | ### based on https://github.com/kylemcdonald/Parametric-t-SNE/blob/master/Parametric%20t-SNE%20(Keras).ipynb
import numpy as np
from tensorflow.keras import backend as K
from tensorflow.keras.losses import categorical_crossentropy
from tqdm.autonotebook import tqdm
import tensorflow as tf
def Hbeta(D, beta):
""... |
atomic_reactor/plugins/check_and_set_platforms.py | qixiang/atomic-reactor | 113 | 32438 | <filename>atomic_reactor/plugins/check_and_set_platforms.py
"""
Copyright (c) 2018 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
Query the koji build target, if any, to find the enabled architectures. Remove any e... |
solo/losses/simclr.py | xwyzsn/solo-learn | 693 | 32460 | <filename>solo/losses/simclr.py
# Copyright 2021 solo-learn development team.
# 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 limitation the rights to ... |
src/thenewboston/factories/network_validator.py | achalpatel/thenewboston-python | 122 | 32490 | from factory import Faker
from .network_node import NetworkNodeFactory
from ..constants.network import ACCOUNT_FILE_HASH_LENGTH, BLOCK_IDENTIFIER_LENGTH, MAX_POINT_VALUE, MIN_POINT_VALUE
from ..models.network_validator import NetworkValidator
class NetworkValidatorFactory(NetworkNodeFactory):
daily_confirmation_... |
Core/Stealer/FileZilla.py | HugoMskn/Telegram-RAT | 375 | 32516 | # Import modules
import os
from xml.dom import minidom
from base64 import b64decode
# Fetch servers from FileZilla
FileZilla = os.getenv('AppData') + '\\FileZilla\\'
def StealFileZilla():
if not os.path.exists(FileZilla):
return []
RecentServersPath = FileZilla + 'recentservers.xml'
SiteManag... |
src/k3d.py | maiki/k3x | 188 | 32533 | # k3d.py
#
# Copyright 2020 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in ... |
spytest/apis/system/ztp.py | shubav/sonic-mgmt | 132 | 32573 | # This file contains the list of API's for operations on ZTP
# @author : <NAME> (<EMAIL>)
from spytest import st
import apis.system.basic as basic_obj
import utilities.utils as utils_obj
import apis.system.switch_configuration as switch_conf_obj
import apis.system.interface as intf_obj
import apis.routing.ip as ip_obj
... |
hwtypes/compatibility.py | splhack/hwtypes | 167 | 32604 | import sys
__all__ = ['IntegerTypes', 'StringTypes']
if sys.version_info < (3,):
IntegerTypes = (int, long)
StringTypes = (str, unicode)
long = long
import __builtin__ as builtins
else:
IntegerTypes = (int,)
StringTypes = (str,)
long = int
import builtins
|
demos/shortify/shortify/utils.py | Ixyk-Wolf/aiohttp-demos | 649 | 32616 | import aioredis
import trafaret as t
import yaml
from aiohttp import web
CONFIG_TRAFARET = t.Dict(
{
t.Key('redis'): t.Dict(
{
'port': t.Int(),
'host': t.String(),
'db': t.Int(),
'minsize': t.Int(),
'maxsize': t.In... |
067_MiDaS/01_float32/07_float16_quantization.py | IgiArdiyanto/PINTO_model_zoo | 1,529 | 32619 | ### tensorflow==2.3.1
import tensorflow as tf
# Float16 Quantization - Input/Output=float32
height = 384
width = 384
converter = tf.lite.TFLiteConverter.from_saved_model('saved_model')
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.target_spec.supported_types = [tf.float16]
tflite_model = converter.c... |
antlr-python/ChatErrorListener.py | evilkirin/antlr-mega-tutorial | 138 | 32633 | import sys
from antlr4 import *
from ChatParser import ChatParser
from ChatListener import ChatListener
from antlr4.error.ErrorListener import *
import io
class ChatErrorListener(ErrorListener):
def __init__(self, output):
self.output = output
self._symbol = ''
def syntaxError(sel... |
ImageNet/lib/validation.py | mhilmiasyrofi/AT_HE | 107 | 32648 | from utils import *
import torch
import sys
import numpy as np
import time
import torchvision
from torch.autograd import Variable
import torchvision.transforms as transforms
import torchvision.datasets as datasets
def validate_pgd(val_loader, model, criterion, K, step, configs, logger, save_image=False, HE=False):
... |
docs/examples/use_cases/video_superres/common/loss_scaler.py | cyyever/DALI | 3,967 | 32685 | <gh_stars>1000+
import torch
class LossScaler:
def __init__(self, scale=1):
self.cur_scale = scale
# `params` is a list / generator of torch.Variable
def has_overflow(self, params):
return False
# `x` is a torch.Tensor
def _has_inf_or_nan(x):
return False
# `overflow... |
cog/__init__.py | uniphil/cog | 158 | 32703 | <filename>cog/__init__.py
def cog():
return "Cog is alive."
|
etherscan/stats.py | adamzhang1987/py-etherscan-api | 458 | 32711 | from .client import Client
class Stats(Client):
def __init__(self, api_key='YourApiKeyToken'):
Client.__init__(self, address='', api_key=api_key)
self.url_dict[self.MODULE] = 'stats'
def get_total_ether_supply(self):
self.url_dict[self.ACTION] = 'ethsupply'
self.build_url()
... |
SimpleSign.py | wanzhiguo/mininero | 182 | 32719 | import MiniNero
import ed25519
import binascii
import PaperWallet
import cherrypy
import os
import time
import bitmonerod
import SimpleXMR2
import SimpleServer
message = "send0d000114545737471em2WCg9QKxRxbo6S3xKF2K4UDvdu6hMc"
message = "send0d0114545747771em2WCg9QKxRxbo6S3xKF2K4UDvdu6hMc"
sec = raw_input("sec?")
print... |
tests/api/endpoints/admin/test_two_factor_auth.py | weimens/seahub | 420 | 32731 | <reponame>weimens/seahub
import os
import pytest
from django.urls import reverse
from seahub.options.models import (UserOptions, KEY_FORCE_2FA, VAL_FORCE_2FA)
from seahub.test_utils import BaseTestCase
from seahub.two_factor.models import TOTPDevice, devices_for_user
TRAVIS = 'TRAVIS' in os.environ
@pytest.mark.ski... |
Introducing_CircuitPlaygroundExpress/CircuitPlaygroundExpress_LightSensor_cpx.py | joewalk102/Adafruit_Learning_System_Guides | 665 | 32781 | # CircuitPlaygroundExpress_LightSensor
# reads the on-board light sensor and graphs the brighness with NeoPixels
import time
from adafruit_circuitplayground.express import cpx
from simpleio import map_range
cpx.pixels.brightness = 0.05
while True:
# light value remaped to pixel position
peak = map_range(cpx... |
tests/engine/training/test_fingerprinting.py | fintzd/rasa | 9,701 | 32787 | import inspect
from unittest.mock import Mock
from _pytest.monkeypatch import MonkeyPatch
from rasa.core.policies.ted_policy import TEDPolicy
from rasa.engine.training import fingerprinting
from rasa.nlu.classifiers.diet_classifier import DIETClassifier
from rasa.nlu.selectors.response_selector import ResponseSelector... |
indra/assemblers/tsv/__init__.py | zebulon2/indra | 136 | 32798 | from .assembler import TsvAssembler
|
graphgallery/utils/ipynb.py | EdisonLeeeee/GraphGallery | 300 | 32824 | from IPython import get_ipython
from IPython.display import display
def is_ipynb():
return type(get_ipython()).__module__.startswith('ipykernel.')
|
homeassistant/components/ripple/__init__.py | domwillcode/home-assistant | 30,023 | 32833 | <gh_stars>1000+
"""The ripple component."""
|
synapse/cmds/hive.py | ackroute/synapse | 216 | 32834 | <filename>synapse/cmds/hive.py
import os
import json
import shlex
import pprint
import asyncio
import tempfile
import functools
import subprocess
import synapse.exc as s_exc
import synapse.common as s_common
import synapse.lib.cmd as s_cmd
import synapse.lib.cli as s_cli
ListHelp = '''
Lists all the keys underneath ... |
etl/parsers/etw/Microsoft_Windows_USB_USBHUB.py | IMULMUL/etl-parser | 104 | 32870 | <filename>etl/parsers/etw/Microsoft_Windows_USB_USBHUB.py
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-USB-USBHUB
GUID : 7426a56b-e2d5-4b30-bdef-b31815c1a74a
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CS... |
care/facility/models/notification.py | gigincg/care | 189 | 32898 | import enum
from django.db import models
from care.facility.models import FacilityBaseModel
from care.users.models import User
from django.contrib.postgres.fields import JSONField
class Notification(FacilityBaseModel):
class EventType(enum.Enum):
SYSTEM_GENERATED = 50
CUSTOM_MESSAGE = 100
E... |
web/api/tests/test_health_check.py | marcelomansur/maria-quiteria | 151 | 32919 | <reponame>marcelomansur/maria-quiteria
import pytest
from django.urls import reverse
class TestHealthCheck:
def test_return_success_when_accessing_health_check(self, api_client, url):
response = api_client.get(url, format="json")
assert response.status_code == 200
assert list(response.json... |
datmo/core/storage/local/dal.py | awesome-archive/datmo | 331 | 32941 | <filename>datmo/core/storage/local/dal.py
import os
from kids.cache import cache
from datetime import datetime
from datmo.core.util.i18n import get as __
from datmo.core.entity.model import Model
from datmo.core.entity.code import Code
from datmo.core.entity.environment import Environment
from datmo.core.entity.file_c... |
rl_algorithms/utils/config.py | medipixel/rl_algorithms | 466 | 32948 | <gh_stars>100-1000
import collections.abc as collections_abc
import os.path as osp
from addict import Dict
import yaml
class ConfigDict(Dict):
def __missing__(self, name):
raise KeyError(name)
def __getattr__(self, name):
try:
value = super(ConfigDict, self).__getattr__(name)
... |
passage/preprocessing.py | vishalbelsare/Passage | 597 | 32950 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import string
from collections import Counter
import numpy as np
import theano
import theano.tensor as T
punctuation = set(string.punctuation)
punctuation.add('\n')
punctuation.add('\t')
punctuation.add(u'’')
punctuation.add(u'‘')
punctuation.add(u'“')
punctuation.add(u'”... |
tests/test_models.py | lmacaya/oddt | 264 | 32954 | import pickle
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
import pytest
from oddt.scoring.models import classifiers, regressors
@pytest.mark.filterwarnings('ignore:Stochastic Optimizer')
@pytest.mark.parametrize('cls',
[classifiers.svm(probabil... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.