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
phy/plot/gloo/shader.py
fjflores/phy
118
12622995
<reponame>fjflores/phy # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright (c) 2009-2016 <NAME>. All rights reserved. # Distributed under the (new) BSD License. # ----------------------------------------------------------------------------- """ A Shader is...
tensorboard/plugins/graph/keras_util_test.py
Digitaltransform/tensorboard
6,139
12622996
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
macdivert/macdivert.py
FinalTheory/WirelessNetworkReproduction
263
12623012
# encoding: utf8 import os import Queue import threading import libdivert as nids from copy import deepcopy from ctypes import cdll from enum import Defaults, Flags from ctypes import POINTER, pointer, cast from ctypes import (c_void_p, c_uint32, c_char_p, c_int, CFUNCTYPE, create_string_buffer, c_...
scripts/python/common_setup.py
wyzero/BladeDISC
328
12623028
# Copyright 2022 The BladeDISC 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 law or ...
dro_sfm/loggers/__init__.py
aliyun/dro-sfm
147
12623039
<reponame>aliyun/dro-sfm from dro_sfm.loggers.wandb_logger import WandbLogger __all__ = ["WandbLogger"]
examples/multisource_adapt/config.py
19valentin99/pykale
324
12623041
""" Default configurations for multi-source domain adapation """ import os from yacs.config import CfgNode as CN # ----------------------------------------------------------------------------- # Config definition # ----------------------------------------------------------------------------- _C = CN() # -----------...
src/gamemodes/mudkip.py
iamgreaser/lykos
122
12623049
<reponame>iamgreaser/lykos<filename>src/gamemodes/mudkip.py<gh_stars>100-1000 from src.gamemodes import game_mode, GameMode, InvalidModeException from src.messages import messages from src.events import EventListener from src import channels, users # someone let woffle commit while drunk again... tsk tsk @game_mode("m...
veros/runtime.py
AkasDutta/veros
115
12623058
<reponame>AkasDutta/veros<filename>veros/runtime.py import os from threading import local from collections import namedtuple from veros.backend import BACKENDS from veros.logs import LOGLEVELS # globals log_args = local() log_args.log_all_processes = False log_args.loglevel = "info" # MPI helpers def _default_mp...
src/ralph/signals.py
DoNnMyTh/ralph
1,668
12623059
from django.db import connection from django.db.models.signals import post_save from django.dispatch import receiver # TODO(mkurek): make this working as a decorator, example: # @post_commit(MyModel) # def my_handler(instance): # ... def post_commit(func, model, signal=post_save, single_call=True): """ Pos...
word2gauss/words.py
seomoz/word2gauss
203
12623093
<reponame>seomoz/word2gauss from itertools import islice import numpy as np from .embeddings import text_to_pairs LARGEST_UINT32 = 4294967295 def tokenizer(s): ''' Whitespace tokenizer ''' return s.strip().split() class Vocabulary(object): ''' Implemetation of the Vocabulary interface ...
src/hobbits-plugins/analyzers/KaitaiStruct/ksy_py/image/tga.py
SabheeR/hobbits
304
12623094
<filename>src/hobbits-plugins/analyzers/KaitaiStruct/ksy_py/image/tga.py # This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO from enum import Enum impo...
test/distributed/pipeline/sync/skip/test_verify_skippables.py
Hacky-DH/pytorch
60,067
12623100
<reponame>Hacky-DH/pytorch # Copyright 2019 <NAME> # # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. import pytest from torch import nn from torch.distributed.pipeline.s...
tests/test_console.py
ericchiang/kpm
121
12623117
from kpm.console import KubernetesExec def test_console_default(): k = KubernetesExec("myrc", "echo titi") assert k is not None
roleutils/utils.py
Onii-Chan-Discord/phen-cogs
105
12623131
<filename>roleutils/utils.py """ MIT License Copyright (c) 2020-2021 phenom4n4n 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 use...
mmdet/models/dense_heads/anchor_aug.py
Qianna00/InstanceLoc
120
12623161
import time import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule, bias_init_with_prob, normal_init from mmdet.core import build_anchor_generator, build_bbox_coder from mmdet.ops import batched_nms from ..builder import HEADS @HEADS.register_module() c...
tools/benchmark/matrix_vector_dotproduct.py
sumau/tick
411
12623178
<filename>tools/benchmark/matrix_vector_dotproduct.py # License: BSD 3 clause import os import matplotlib.pyplot as plt import numpy as np import pandas as pd from tools.benchmark.benchmark_util import ( iter_executables, run_benchmark, default_result_dir, get_last_result_dir, extract_build_from_name) BASE_F...
tests/implementations/ormar_.py
quaternionmedia/fastapi-crudrouter
686
12623185
import os import databases import ormar import pytest import sqlalchemy from fastapi import FastAPI from fastapi_crudrouter import OrmarCRUDRouter from tests import CarrotCreate, CarrotUpdate, PAGINATION_SIZE, CUSTOM_TAGS DATABASE_URL = "sqlite:///./test.db" database = databases.Database(DATABASE_URL) metadata = sql...
2020/05/16/Adding Extra Fields On Many-To-Many Relationships in Django/many_to_many_extra/many_to_many_extra/example/models.py
kenjitagawa/youtube_video_code
492
12623189
from django.db import models class Student(models.Model): name = models.CharField(max_length=30) def __str__(self): return self.name class Course(models.Model): name = models.CharField(max_length=30) students = models.ManyToManyField(Student, through='Enrollment') def __str__(self): ...
sonnet/src/moving_averages_test.py
ScriptBox99/deepmind-sonnet
10,287
12623202
<reponame>ScriptBox99/deepmind-sonnet # 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...
corehq/apps/cloudcare/dbaccessors.py
dimagilg/commcare-hq
471
12623206
<filename>corehq/apps/cloudcare/dbaccessors.py<gh_stars>100-1000 from corehq.apps.app_manager.dbaccessors import get_brief_apps_in_domain from corehq.apps.cloudcare.models import ApplicationAccess from corehq.util.quickcache import quickcache @quickcache(['domain']) def get_application_access_for_domain(domain): ...
cmt/mapclient_qt.py
nasa/CrisisMappingToolk
178
12623235
<filename>cmt/mapclient_qt.py<gh_stars>100-1000 # ----------------------------------------------------------------------------- # Copyright * 2014, United States Government, as represented by the # Administrator of the National Aeronautics and Space Administration. All # rights reserved. # # The Crisis Mapping Toolkit ...
24-class-metaprog/evaltime/metalib.py
SeirousLee/example-code-2e
990
12623244
# tag::METALIB_TOP[] print('% metalib module start') import collections class NosyDict(collections.UserDict): def __setitem__(self, key, value): args = (self, key, value) print(f'% NosyDict.__setitem__{args!r}') super().__setitem__(key, value) def __repr__(self): return '<Nosy...
addition_module/DMUE/preprocess/mtcnn/__init__.py
weihaoxie/FaceX-Zoo
1,329
12623245
from .mtcnn import MTCNN
photutils/detection/core.py
rosteen/photutils
167
12623256
<reponame>rosteen/photutils # Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module implements the base class and star finder kernel for detecting stars in an astronomical image. Each star-finding class should define a method called ``find_stars`` that finds stars in an image. """ import abc im...
src/IDA/grap/idagrap/ui/widgets/PatternGenerationWidget.py
AirbusCyber/grap
171
12623283
#!/usr/bin/env python # Inspired by IDAscope. from pygrap import graph_free import idagrap.ui.helpers.QtShim as QtShim import idc import idaapi from idagrap.config.General import config from idagrap.patterns.Modules import MODULES from idagrap.ui.widgets.EditorWidget import EditorWidget import idagrap.ui.helpers.QtG...
gui.py
mraza007/videodownloader
232
12623296
#!/usr/bin/env python3.6 import tkinter as tk import os.path from pytube import YouTube from threading import Thread from tkinter import filedialog, messagebox, ttk from download_youtube_video import download_youtube_video from pytube.exceptions import PytubeError, RegexMatchError class YouTubeDownloadGUI(tk.Frame)...
akshare/bond/bond_convert.py
akfamily/akshare
721
12623300
#!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2022/4/13 10:50 Desc: 债券-集思录-可转债 集思录:https://app.jisilu.cn/data/cbnew/#cb """ import pandas as pd import requests def bond_cov_jsl(cookie: str = None) -> pd.DataFrame: """ 集思录可转债 https://app.jisilu.cn/data/cbnew/#cb :param cookie: 输入获取到的游览器 cookie...
tensorflow_decision_forests/tensorflow/ops/inference/api.py
Hawk94/decision-forests
412
12623324
# Copyright 2021 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
examples/service/kubernetes/fabfile.py
theoden-dd/fabricio
291
12623331
<reponame>theoden-dd/fabricio """ https://github.com/renskiy/fabricio/blob/master/examples/service/kubernetes """ import fabricio from fabric import api as fab from fabricio import tasks, kubernetes from fabricio.misc import AvailableVagrantHosts from six.moves import filter hosts = AvailableVagrantHosts(guest_netwo...
test-framework/test-suites/unit/tests/command/stack/commands/sync/vm/test_sync_vm_plugin_hypervisor.py
sammeidinger/stack
123
12623353
import pytest from unittest.mock import create_autospec, patch, call, ANY from stack.commands import DatabaseConnection from stack.commands.sync.vm.plugin_hypervisor import Plugin, VmException from stack.commands.sync.vm import Command from stack.bool import str2bool from collections import namedtuple class TestSyncVm...
release/stubs.min/Autodesk/Revit/DB/__init___parts/ViewFamily.py
htlcnn/ironpython-stubs
182
12623361
class ViewFamily(Enum,IComparable,IFormattable,IConvertible): """ An enumerated type that corresponds to the type of a Revit view. enum ViewFamily,values: AreaPlan (110),CeilingPlan (111),CostReport (106),Detail (113),Drafting (108),Elevation (114),FloorPlan (109),GraphicalColumnSchedule (119),ImageView (1...
examples/chat_bot.py
sap2me/steampy
322
12623368
<reponame>sap2me/steampy import time from steampy.client import SteamClient # Set API key api_key = '' # Set path to SteamGuard file steamguard_path = '' # Steam username username = '' # Steam password password = '' def main(): print('This is the chat bot.') if not are_credentials_filled(): print('Yo...
src/england_data/run_dataset_merge.py
charlottestanton/covid-19-open-data
430
12623387
<reponame>charlottestanton/covid-19-open-data # pylint: disable=g-bad-file-header # Copyright 2020 DeepMind Technologies Limited. 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 Lic...
tests/test_grads.py
ZvonimirBandic/QuCumber
163
12623401
# Copyright 2019 PIQuIL - 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 agreed ...
dataset/utils.py
NotMorven/cavaface.pytorch
329
12623403
<gh_stars>100-1000 from __future__ import print_function import os import numpy as np import torch import random import math class RandomErasing(object): """ Class that performs Random Erasing in Random Erasing Data Augmentation by Zhong et al. ----------------------------------------------------------...
matchzoo/datasets/snli/load_data.py
baajur/MatchZoo
2,209
12623411
"""SNLI data loader.""" import typing from pathlib import Path import pandas as pd import keras import matchzoo _url = "https://nlp.stanford.edu/projects/snli/snli_1.0.zip" def load_data( stage: str = 'train', task: str = 'classification', target_label: str = 'entailment', return_classes: bool = F...
src/main/python/rlbot/utils/structures/rigid_body_struct.py
VirxEC/RLBot
408
12623417
import ctypes from rlbot.utils.structures.bot_input_struct import PlayerInput from rlbot.utils.structures.game_data_struct import Vector3 from rlbot.utils.structures.start_match_structures import MAX_PLAYERS class Quaternion(ctypes.Structure): _fields_ = [("x", ctypes.c_float), ("y", ctypes.c_flo...
tests/core/test_hash_files.py
siliconcompiler/siliconcompiler
424
12623428
# Copyright 2020 Silicon Compiler Authors. All Rights Reserved. import os import siliconcompiler def test_hash_files(): chip = siliconcompiler.Chip('top') chip.load_target("freepdk45_demo") chip.write_manifest("raw.json") allkeys = chip.getkeys() for keypath in allkeys: if 'file' in chip.g...
flextensor/test/test_tvm_expr/grad/te-padding-case1.py
imxian/FlexTensor
135
12623434
import tvm import numpy as np import torch N = 2 nC = 16 H = 14 W = 14 K = 16 R = 3 S = 3 padding = 1 P = H + 2 * padding Q = W + 2 * padding dtype = "float32" A = tvm.te.placeholder([N, nC, H, W], dtype=dtype, name="A") C = tvm.te.compute([N, K, P, Q], lambda n, k, h, w : tvm.tir.if_then_else( tvm.t...
src/datadog/azext_datadog/generated/_params.py
haroonf/azure-cli-extensions
207
12623453
<reponame>haroonf/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. # # Code generated by Microsoft (R) AutoRest Co...
srcs/python/kungfu/tensorflow/optimizers/async_sgd.py
Pandinosaurus/KungFu
291
12623454
<filename>srcs/python/kungfu/tensorflow/optimizers/async_sgd.py import tensorflow as tf from kungfu.tensorflow.compat import _tf_assign, _tf_mod from kungfu.tensorflow.ops import (barrier, counter, current_cluster_size, current_rank, defuse, fuse, re...
src/transformers/convert_slow_tokenizers_checkpoints_to_fast.py
dctelus/transformers
8,028
12623465
# coding=utf-8 # Copyright 2018 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
pwndbg/commands/vmmap.py
R2S4X/pwndbg
287
12623467
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Command to print the vitual memory map a la /proc/self/maps. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import gdb import six import pwndbg.color.memory as M ...
landlab/graph/radial/dual_radial.py
amanaster2/landlab
257
12623496
<gh_stars>100-1000 import numpy as np from ..dual import DualGraph from ..voronoi.dual_voronoi import DualVoronoiGraph from .radial import RadialGraph, RadialGraphLayout class DualRadialGraph(DualGraph, RadialGraph): """Graph of a series of points on concentric circles. Examples -------- >>> from l...
Geometry/VeryForwardGeometryBuilder/test/print_geometry_info_geomFromDB_cfg.py
Purva-Chaudhari/cmssw
852
12623525
<filename>Geometry/VeryForwardGeometryBuilder/test/print_geometry_info_geomFromDB_cfg.py import FWCore.ParameterSet.Config as cms process = cms.Process("GeometryInfo") # minimum of logs process.MessageLogger = cms.Service("MessageLogger", cerr = cms.untracked.PSet( enable = cms.untracked.bool(False) ),...
system/shui/dummyui.py
mrshu/stash
1,822
12623622
<reponame>mrshu/stash # -*- coding: utf-8 -*- """ Stub ui to allow debug on PC """ AUTOCAPITALIZE_NONE = 0 def measure_string(*args, **kwargs): return 12.0 def in_background(func): return func def get_screen_size(): return 100, 100 class View(object): def __init__(self, *args, **kwargs): ...
resource/param/vmaf_v3.py
elam03/vmaf
2,874
12623627
feature_dict = { 'VMAF_feature': ['vif_scale0', 'vif_scale1', 'vif_scale2', 'vif_scale3', 'adm2', 'motion', ], } model_type = "LIBSVMNUSVR" model_param_dict = { # ==== preprocess: normalize each feature ==== # # 'norm_type': 'none', # default: do nothing 'norm_type': 'clip_0to1', # rescale to within...
automig/lib/diffing.py
abe-winter/automigrate
336
12623640
<gh_stars>100-1000 "diffing.py -- sql-diffing" import collections from . import wrappers class DiffError(Exception): pass def group_by_table(stmts): "take list of WrappedStatement" groups = collections.defaultdict(list) for stmt in stmts: if isinstance(stmt, (wrappers.CreateTable, wrappers.CreateIndex)): ...
orbitdeterminator/tests/test_ellipse_fit.py
DewanshiDewan/orbitdeterminator
158
12623644
"""Tests ellipse_fit with satellites. Compatible with pytest.""" import pytest import numpy as np import sys import os.path sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))) from util.new_tle_kep_state import tle_to_state from util.rkf5 import rkf5 from kep_determination.ellips...
checkov/common/checks_infra/solvers/connections_solvers/and_connection_solver.py
niradler/checkov
4,013
12623646
<filename>checkov/common/checks_infra/solvers/connections_solvers/and_connection_solver.py from typing import Optional, List, Tuple, Dict, Any from networkx.classes.digraph import DiGraph from checkov.common.graph.checks_infra.enums import Operators from checkov.common.graph.checks_infra.solvers.base_solver import Ba...
sqlalchemy_continuum/relationship_builder.py
vhermecz/sqlalchemy-continuum
193
12623660
import sqlalchemy as sa from .exc import ClassNotVersioned from .expression_reflector import VersionExpressionReflector from .operation import Operation from .table_builder import TableBuilder from .utils import adapt_columns, version_class, option class RelationshipBuilder(object): def __init__(self, versioning...
dme.py
CKylinMC/PagerMaid_Plugins
153
12623701
""" Module to automate message deletion. """ from asyncio import sleep from os import path, remove from os.path import exists from PIL import Image, UnidentifiedImageError from pagermaid import redis, log, redis_status from pagermaid.listener import listener from pagermaid.utils import alias_command @listener(is_plug...
tests/stress/dict_copy.py
sebastien-riou/micropython
13,648
12623711
<filename>tests/stress/dict_copy.py # copying a large dictionary a = {i: 2 * i for i in range(1000)} b = a.copy() for i in range(1000): print(i, b[i]) print(len(b))
scattertext/test/test_gensimPhraseAdder.py
shettyprithvi/scattertext
1,823
12623727
from unittest import TestCase import pandas as pd from scattertext.CorpusFromParsedDocuments import CorpusFromParsedDocuments from scattertext.WhitespaceNLP import whitespace_nlp from scattertext.representations.Word2VecFromParsedCorpus import GensimPhraseAdder from scattertext.test.test_corpusFromPandas import get_d...
fun/feudal_batch_processor.py
gooooloo/DLIB
141
12623731
import numpy as np from collections import namedtuple def cosine_similarity(u, v): return np.dot(np.squeeze(u),np.squeeze(v)) / (np.linalg.norm(u) * np.linalg.norm(v)) Batch = namedtuple("Batch", ["obs", "a", "returns", "s_diff", "ri", "gsum", "features"]) class FeudalBatch(object): def __init__(self): ...
begin/cmdline.py
jamezpolley/begins
120
12623737
"Generate command line parsers and apply options using function signatures" import argparse import os import sys try: import configparser except ImportError: import ConfigParser as configparser try: from inspect import signature except ImportError: from funcsigs import signature from begin import con...
atc/atcd/atcd/AtcdDBQueueTask.py
KeleiAzz/augmented-traffic-control
4,319
12623747
# # Copyright (c) 2014, Facebook, Inc. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. # # from sqlite3 import Op...
openvim/test/test_openvim.py
acasana/openmano_movilnet
204
12623774
#!/usr/bin/env python # -*- coding: utf-8 -*- ## # Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U. # This file is part of openmano # 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 #...
causalimpact/tests/test_inferences.py
cdutr/causalimpact-1
152
12623791
"""Unit Tests for inferences module""" import pytest import numpy as np import pandas as pd from pandas.testing import assert_series_equal from statsmodels.tsa.statespace.structural import UnobservedComponents from statsmodels.tsa.arima_process import ArmaProcess import causalimpact compile_posterior = causalimpact...
example/tests/checkout/test_checkout_utils.py
icvntechstudio/django-salesman
222
12623802
import pytest from django.core.exceptions import ValidationError from salesman.checkout import utils def test_validate_address(): with pytest.raises(ValidationError): assert utils.validate_address('', context={}) assert utils.validate_address('Test', context={}) == 'Test'
opem/Test/test_Padulles_Hauer.py
Martenet/opem
173
12623829
<reponame>Martenet/opem<filename>opem/Test/test_Padulles_Hauer.py # -*- coding: utf-8 -*- ''' >>> from opem.Dynamic.Padulles_Hauer import * >>> import shutil >>> Test_Vector={"T":343,"E0":0.6,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"B":0.04777,"C":0.01...
slybot/slybot/pageactions.py
rmdes/portia-dashboard
223
12623867
import json import re LUA_SOURCE = """ function main(splash) assert(splash:go(splash.args.url)) splash:runjs(splash.args.js_source) splash:wait_for_resume(splash.args.slybot_actions_source) splash:set_result_content_type("text/html") return splash.html() end """ JS_SOURCE = """ function main(spla...
robomimic/algo/td3_bc.py
akolobov/robomimic
107
12623871
""" Implementation of TD3-BC. Based on https://github.com/sfujim/TD3_BC (Paper - https://arxiv.org/abs/1812.02900). Note that several parts are exactly the same as the BCQ implementation, such as @_create_critics, @process_batch_for_training, and @_train_critic_on_batch. They are replicated here (instead of subclass...
clearly/utils/colors.py
lowercase00/clearly
344
12623890
from typing import List, TypeVar C = TypeVar('C') # how to constrain to only the closure below? def color_factory(color_code: str) -> C: def apply(text: str, format_spec: str = '') -> str: return color_code + format(text, format_spec) + '\033[0m' def mix(*colors: C) -> List[C]: return [colo...
concepts/listSlicingListOfLists.py
sixtysecondrevit/dynamoPython
114
12623895
""" PYTHON LIST SLICING: FLAT LIST """ __author__ = '<NAME> - <EMAIL>' __twitter__ = '@solamour' __version__ = '1.0.0' # SYNTAX: [ startCut : endCut ] # startCut = This is the first item included in the Slice # endCut = This is the last item included in the Slice # NOTES: # All parameters have to be inte...
Tests/SSL/test_ssl_containers.py
microsoft/InnerEye-DeepLearning
402
12623947
<reponame>microsoft/InnerEye-DeepLearning # ------------------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. # -------------------------...
torch/csrc/jit/tensorexpr/codegen_external.py
xiaohanhuang/pytorch
183
12623966
#!/usr/bin/env python3 import argparse from tools.codegen.gen import parse_native_yaml, FileManager import tools.codegen.model as model def num_leading_spaces(line: str) -> int: return len(line) - len(line.lstrip()) def deindent(code: str) -> str: lines = code.split('\n') min_leading_spaces = min(map(num_l...
Contents/Libraries/Shared/guessit/test/test_options.py
jippo015/Sub-Zero.bundle
1,553
12623983
#!/usr/bin/env python # -*- coding: utf-8 -*- # pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name, pointless-string-statement import os import pytest from ..options import get_config_file_locations, merge_configurations, load_config_file, ConfigurationException, \ load_config __lo...
vel/rl/models/backbone/nature_cnn_rnn.py
galatolofederico/vel
273
12623990
from vel.api import RnnLinearBackboneModel, ModelFactory from vel.rl.models.backbone.nature_cnn import NatureCnn from vel.modules.rnn_cell import RnnCell class NatureCnnRnnBackbone(RnnLinearBackboneModel): """ Long-Short-Term Memory rnn cell together with DeepMind-style 'Nature' cnn preprocessing """ ...
tests/test_project_conf.py
mubashshirjamal/code
1,582
12624005
from tests.base import TestCase from vilya.models.project import CodeDoubanProject from vilya.models.project_conf import PROJECT_CONF_FILE from nose.tools import raises class TestProjectConf(TestCase): def test_create_project_without_conf(self): self.clean_up() project = CodeDoubanProject.add( ...
tests/test_subscriptions.py
sguzman/castero
483
12624012
<gh_stars>100-1000 import os from unittest import mock from lxml import etree import pytest from castero.feed import Feed, FeedDownloadError, FeedStructureError, FeedParseError from castero.subscriptions import ( Subscriptions, SubscriptionsLoadError, SubscriptionsParseError, SubscriptionsStructureErr...
cinder/api/contrib/snapshot_manage.py
cloudification-io/cinder
571
12624042
<reponame>cloudification-io/cinder<gh_stars>100-1000 # Copyright 2015 Huawei Technologies Co., Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/lic...
src/badgr/envs/env.py
KaiW-53/badgr
110
12624051
import numpy as np from badgr.utils.np_utils import imresize from badgr.utils.python_utils import AttrDict class EnvSpec(object): def __init__(self, names_shapes_limits_dtypes): names_shapes_limits_dtypes = list(names_shapes_limits_dtypes) names_shapes_limits_dtypes += [('done', (1,), (0, 1), np...
gammapy/scripts/analysis.py
Rishank2610/gammapy
155
12624076
# Licensed under a 3-clause BSD style license - see LICENSE.rst import logging import click from gammapy.analysis import Analysis, AnalysisConfig log = logging.getLogger(__name__) @click.command(name="config") @click.option( "--filename", default="config.yaml", help="Filename to store the default configu...
api/src/opentrons/config/types.py
knownmed/opentrons
235
12624109
<reponame>knownmed/opentrons from dataclasses import dataclass from typing import Dict, Tuple from typing_extensions import TypedDict class AxisDict(TypedDict): X: float Y: float Z: float A: float B: float C: float class CurrentDictDefault(TypedDict): default: AxisDict CurrentDictModel...
scripts/multiprocessing_performance_plot.py
ptallada/pysparkling
260
12624115
<gh_stars>100-1000 import matplotlib.pyplot as plt import numpy as np import pysparkling.tests.test_multiprocessing as test_mp def plot(has_hyperthreading=True): n_cpu, r = test_mp.test_performance() r = {n: 1.0 / (v[0] / r[1][0]) for n, v in r.items()} if has_hyperthreading: n_cpu /= 2 x, ...
demo/cict_demo/camera/coordinate_transformation.py
timothijoe/DI-drive
219
12624118
import numpy as np def rotationMatrix3D(roll, pitch, yaw): # RPY <--> XYZ, roll first, picth then, yaw final si, sj, sk = np.sin(roll), np.sin(pitch), np.sin(yaw) ci, cj, ck = np.cos(roll), np.cos(pitch), np.cos(yaw) cc, cs = ci * ck, ci * sk sc, ss = si * ck, si * sk R = np.identity(3) R...
prerender/cache/__init__.py
bosondata/chrome-prerender
169
12624185
import os from .base import CacheBackend CACHE_BACKEND = os.environ.get('CACHE_BACKEND', 'dummy') cache: CacheBackend = None if CACHE_BACKEND == 'disk': from .disk import DiskCache cache = DiskCache() elif CACHE_BACKEND == 's3': from .s3 import S3Cache cache = S3Cache() else: from .dummy impor...
fexm/docker_scripts/afl_base_image/afl_utils/tests/test_afl_sync.py
fgsect/fexm
105
12624196
from afl_utils import afl_sync from afl_utils.afl_sync import AflRsync import os import shutil import unittest class AflSyncTestCase(unittest.TestCase): def setUp(self): # Use to set up test environment prior to test case # invocation os.makedirs('testdata/rsync_tmp_store', exist_ok=True)...
examples/parallel/interengine/bintree_script.py
chebee7i/ipython
748
12624204
#!/usr/bin/env python """ Script for setting up and using [all]reduce with a binary-tree engine interconnect. usage: `python bintree_script.py` This spanning tree strategy ensures that a single node node mailbox will never receive more that 2 messages at once. This is very important to scale to large clusters (e.g....
src/ch6/3-caricature/silhouette-better.py
ssloy/least-squares-course
129
12624231
import numpy as np import matplotlib.pyplot as plt def amplify(x): n = len(x) A = np.matrix(np.zeros((2*n,n))) b = np.matrix(np.zeros((2*n,1))) for i in range(n): A[i, i] = 1. # amplify the curvature A[i, (i+1)%n] = -1. b[i, 0] = (x[i] - x[(i+1)%n])*1.9 A[n+i, i] = 1...
panoramix/contract.py
git-github-com-warren1990-Github-git/panoramix
259
12624232
<reponame>git-github-com-warren1990-Github-git/panoramix import collections import logging import panoramix.folder as folder import panoramix.sparser as sparser from panoramix.matcher import Any, match from panoramix.prettify import pprint_ast, pprint_trace, prettify, pretty_stor from panoramix.utils.helpers import ( ...
fhir/resources/familymemberhistory.py
cstoltze/fhir.resources
144
12624235
<filename>fhir/resources/familymemberhistory.py<gh_stars>100-1000 # -*- coding: utf-8 -*- """ Profile: http://hl7.org/fhir/StructureDefinition/FamilyMemberHistory Release: R4 Version: 4.0.1 Build ID: 9346c8cc45 Last updated: 2019-11-01T09:29:23.356+11:00 """ import typing from pydantic import Field, root_validator fro...
documentation/test_python/inspect_underscored/inspect_underscored/__init__.py
Ryan-rsm-McKenzie/m.css
367
12624237
""".. :data _DATA_IN_MODULE: In-module documented underscored data. This won't be picked up by the initial crawl, unfortunately, as the docstrings are processed much later. """ import enum from . import _submodule, _submodule_external, _submodule_undocumented class _Class: """Documented underscored clas...
icevision/models/ross/efficientdet/fastai/__init__.py
ai-fast-track/mantisshrimp
580
12624242
from icevision.models.ross.efficientdet.fastai.callbacks import * from icevision.models.ross.efficientdet.fastai.learner import *
tests/t-mime-type.py
kurtace72/lighttpd2
395
12624263
<gh_stars>100-1000 # -*- coding: utf-8 -*- from base import * from requests import * class TestMimeType1(CurlRequest): URL = "/test.txt" EXPECT_RESPONSE_BODY = "" EXPECT_RESPONSE_CODE = 200 EXPECT_RESPONSE_HEADERS = [ ("Content-Type", "text/plain; charset=utf-8") ] class TestMimeType2(CurlRequest): URL = "/tes...
caffe2/python/layers/merge_id_lists.py
KevinKecc/caffe2
585
12624276
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
Geometry/CMSCommonData/python/cmsRecoIdealGeometryXML_cff.py
ckamtsikis/cmssw
852
12624277
import FWCore.ParameterSet.Config as cms from Geometry.CMSCommonData.cmsRecoIdealGeometryXML_cfi import * from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi import * from Geometry.EcalCommonData.ecalSimulationParameters_cff import * from Geometry.HcalCommonData.hcalDDDSimConstants_cff import * from Geo...
dirigible/fts/tests/test_2799_FillDownDuringPaste.py
EnoX1/dirigible-spreadsheet
168
12624293
# Copyright (c) 2010 Resolver Systems Ltd. # All Rights Reserved # from functionaltest import FunctionalTest import key_codes class Test_2799_fill_down_during_paste(FunctionalTest): def wait_for_cell_to_contain_formula(self, column, row, formula): self.open_cell_for_editing(column, row) self.wai...
dynaconf/vendor/click/_unicodefun.py
sephiartlist/dynaconf
2,293
12624294
import codecs,os def _verify_python_env(): M='.utf8';L='.utf-8';J=None;I='ascii' try:import locale as A;G=codecs.lookup(A.getpreferredencoding()).name except Exception:G=I if G!=I:return B='' if os.name=='posix': import subprocess as D try:C=D.Popen(['locale','-a'],stdout=D.PIPE,stderr=D.PIPE).communicate()[0...
thrift/lib/py3/test/interactions/interaction_test.py
sakibguy/fbthrift
2,112
12624330
<filename>thrift/lib/py3/test/interactions/interaction_test.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 # # http://www.apache.org...
ml-agents-envs/mlagents_envs/registry/base_registry_entry.py
bobcy2015/ml-agents
13,653
12624360
from abc import abstractmethod from typing import Any, Optional from mlagents_envs.base_env import BaseEnv class BaseRegistryEntry: def __init__( self, identifier: str, expected_reward: Optional[float], description: Optional[str], ): """ BaseRegistryEntry allows...
flask_aiohttp/__init__.py
Hardtack/Flask-aiohttp
142
12624366
""":mod:`flask_aiohttp` --- Asynchronous Flask with aiohttp ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Provides Flask extension for asynchronous I/O. With this extension, we can use `asyncio.coroutine` as Flask's view function. So, we can add asyncio-redis <https://github.com/jonathanslenders/asynci...
tino/server.py
NotSoSmartDev/Tino
143
12624383
import uvicorn class Server(uvicorn.Server): async def startup(self, sockets=None): await super().startup(sockets=sockets) for f in self.config.loaded_app.startup_funcs: await f() async def shutdown(self, sockets=None): await super().shutdown(sockets=sockets) for f...
IO/Exodus/Testing/Python/TestExodusWithNaN.py
satya-arjunan/vtk8
1,755
12624418
#!/usr/bin/env python # This test loads an Exodus file with NaNs and we test that the vtkDataArray # returns a correct range for the array with NaNs i.e. not including the NaN. from vtk import * from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() rdr = vtkExodusIIReader() rdr.SetFileName(str(VTK_...
backend/services/task_annotations_service.py
majdal/tasking-manager
421
12624423
from backend.models.postgis.task_annotation import TaskAnnotation from backend.models.postgis.utils import timestamp class TaskAnnotationsService: @staticmethod def add_or_update_annotation(annotation, project_id, annotation_type): """ Takes a json of tasks and create annotations in the db """ ...
plasmapy/formulary/tests/test_magnetostatics.py
seanjunheng2/PlasmaPy
429
12624510
<filename>plasmapy/formulary/tests/test_magnetostatics.py<gh_stars>100-1000 import numpy as np import pytest from astropy import constants from astropy import units as u from plasmapy.formulary.magnetostatics import ( CircularWire, FiniteStraightWire, GeneralWire, InfiniteStraightWire, MagneticDip...
test/paysage/batch/test_shuffle.py
fyumoto/RBMs
124
12624531
<filename>test/paysage/batch/test_shuffle.py import tempfile import numpy as np import pandas as pd from paysage import batch import pytest def test_shuffle(): # create temporary files file_original = tempfile.NamedTemporaryFile() file_shuffle = tempfile.NamedTemporaryFile() # create data num_ro...
corehq/apps/enterprise/migrations/0002_enterprisepermissions_account_unique.py
akashkj/commcare-hq
471
12624575
# Generated by Django 2.2.24 on 2021-07-23 20:50 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('enterprise', '0001_initial'), ] operations = [ migrations.AlterField( model_name='enterprisepe...
insights/combiners/krb5.py
lhuett/insights-core
121
12624627
<gh_stars>100-1000 """ krb5 configuration ================== The krb5 files are normally available to rules as a list of Krb5Configuration objects. """ from .. import LegacyItemAccess from insights.core.plugins import combiner from insights.parsers.krb5 import Krb5Configuration from insights.parsers.httpd_conf import ...