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 |
|---|---|---|---|---|
tests/test_templatetags.py | adeweb-be/django-filebrowser-tinyMCEv5 | 107 | 12626342 | # coding: utf-8
from django.test import TestCase
from django.http import QueryDict
from filebrowser.templatetags.fb_tags import get_file_extensions
class GetFileExtensionsTemplateTagTests(TestCase):
def test_get_all(self):
self.assertEqual(
sorted(eval(get_file_extensions(''))),
s... |
ctools/worker/learner/learner_hook.py | XinyuJing/DI-star | 267 | 12626343 | import numbers
import os
from abc import ABC, abstractmethod
from typing import Any, Dict
import torch
from easydict import EasyDict
from ctools.utils import allreduce
class Hook(ABC):
"""
Overview:
Abstract class for hooks
Interfaces:
__init__
Property:
name, priority
""... |
python/rikai/parquet/shuffler.py | chunyang/rikai | 111 | 12626383 | <filename>python/rikai/parquet/shuffler.py
# Copyright 2021 Rikai Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... |
tests/ssz/test_to_dict.py | muta6150/beacon_chain | 217 | 12626406 | <reponame>muta6150/beacon_chain<filename>tests/ssz/test_to_dict.py
import pytest
from ssz.ssz import (
to_dict
)
@pytest.mark.parametrize(
'value, result',
[
({}, {}),
({'a': 1, 'b': 2}, {'a': 1, 'b': 2}),
([], []),
([{'a': 1}, {'b': 2}], [{'a': 1}, {'b': 2}])
]
)
def ... |
tello_driver/launch/emulators_launch.py | crisdeodates/DJI-Tello_ros2_cpp | 114 | 12626442 | from launch import LaunchDescription
from launch.actions import ExecuteProcess
from launch_ros.actions import Node
# Launch two emulators and two drivers for testing
def generate_launch_description():
emulator_path = 'install/tello_driver/lib/tello_driver/tello_emulator'
localhost = '127.0.0.1'
dr1_cmd... |
content/public/PRESUBMIT.py | sarang-apps/darshan_browser | 575 | 12626449 | # Copyright 2018 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.
"""Content public presubmit script
See https://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API bui... |
src/losses/multi/__init__.py | xiongzhiyao/pytorch-segmentation | 359 | 12626469 | <gh_stars>100-1000
import torch.nn as nn
from .focal_loss import FocalLoss
from .lovasz_loss import LovaszSoftmax
from .ohem_loss import OhemCrossEntropy2d
from .softiou_loss import SoftIoULoss
class MultiClassCriterion(nn.Module):
def __init__(self, loss_type='CrossEntropy', **kwargs):
super()... |
rclpy/test/test_validate_namespace.py | RoboStack/rclpy | 121 | 12626520 | # Copyright 2017 Open Source Robotics Foundation, 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... |
numba/core/unsafe/nrt.py | auderson/numba | 6,620 | 12626524 | <gh_stars>1000+
"""
Contains unsafe intrinsic that calls NRT C API
"""
from numba.core import types
from numba.core.typing import signature
from numba.core.extending import intrinsic
@intrinsic
def NRT_get_api(tyctx):
"""NRT_get_api()
Calls NRT_get_api() from the NRT C API
Returns LLVM Type i8* (void po... |
tests/python_print_width/print_width.py | hixio-mh/plugin-python | 362 | 12626534 | def foo():
return "line_with_79_chars_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
return "line_with_80_chars_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
image_synthesis/data/imagenet_dataset.py | buxiangzhiren/VQ-Diffusion_office | 236 | 12626577 | from torch.utils.data import Dataset
import numpy as np
import io
from PIL import Image
import os
import json
import random
from image_synthesis.utils.misc import instantiate_from_config
def load_img(filepath):
img = Image.open(filepath).convert('RGB')
return img
class ImageNetDataset(Dataset):
def __init... |
examples/basic_workflow_parallel.py | densmirn/sdc | 540 | 12626581 | <filename>examples/basic_workflow_parallel.py
# *****************************************************************************
# Copyright (c) 2019-2020, Intel Corporation All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following... |
PythonMiddleware/extensions.py | chandlerette/Python-Middleware | 101 | 12626595 | <reponame>chandlerette/Python-Middleware
def getExtensionObjectFromString(strExtension):
try:
assetID,tempData=strExtension.split("$")
itemVER, tempData=tempData.split("@")
itemID,tempData=tempData.split(";")
return extensions(assetID,itemVER,itemID,tempData)
... |
setup.py | tombry/virlutils | 133 | 12626619 | <filename>setup.py
# coding: utf-8
from setuptools import setup, find_packages # noqa: H301
from virl import __version__
NAME = "virlutils"
CMLNAME = "cmlutils"
VERSION = __version__
# To install the library, run the following
#
# python setup.py install
#
# prerequisite: setuptools
# http://pypi.python.org/pypi/setu... |
atlas/foundations_rest_api/src/foundations_rest_api/config/configs.py | DeepLearnI/atlas | 296 | 12626629 | <gh_stars>100-1000
import yaml
import os
import pathlib
ATLAS = yaml.load(open(os.getenv('AUTH_CLIENT_CONFIG_PATH', pathlib.Path(os.path.abspath(__file__)).parent / 'auth_client_config.yaml')))
|
tests/nnet/activations/test_sigmoid.py | Zac-HD/MyGrad | 147 | 12626640 | import sys
import numpy as np
from mygrad.nnet.activations import sigmoid
from tests.wrappers.uber import backprop_test_factory, fwdprop_test_factory
@fwdprop_test_factory(
mygrad_func=sigmoid,
true_func=lambda x: 1 / (1 + np.exp(-x)),
num_arrays=1,
index_to_bnds={0: (-np.log(sys.float_info.max), No... |
docker/s3tests/test_bucket_policy.py | yuchen-sun/chubaofs | 2,498 | 12626648 | <gh_stars>1000+
# Copyright 2020 The ChubaoFS Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
vendor/gx/ipfs/QmYkNhwAviNzN974MB3koxuBRhtbvCotnuQcugrPF96BPp/client_model/setup.py | u5surf/go-livepeer | 4,695 | 12626657 | <filename>vendor/gx/ipfs/QmYkNhwAviNzN974MB3koxuBRhtbvCotnuQcugrPF96BPp/client_model/setup.py
#!/usr/bin/python
from setuptools import setup
setup(
name = 'prometheus_client_model',
version = '0.0.1',
author = '<NAME>',
author_email = '<EMAIL>',
description = 'Data model artifacts for the Promethe... |
experiments/faster_rcnn/rcnn_dota_e2e.py | Amberrferr/Faster_RCNN_for_DOTA | 344 | 12626678 | # --------------------------------------------------------
# Deformable Convolutional Networks
# Copyright (c) 2017 Microsoft
# Licensed under The Apache-2.0 License [see LICENSE for details]
# Modified by <NAME>
# --------------------------------------------------------
import os
import sys
os.environ['PYTHO... |
venv/lib/python3.8/site-packages/statsmodels/nonparametric/api.py | johncollinsai/post-high-frequency-data | 6,931 | 12626685 | __all__ = [
"KDEUnivariate",
"KDEMultivariate", "KDEMultivariateConditional", "EstimatorSettings",
"KernelReg", "KernelCensoredReg",
"lowess", "bandwidths",
"pdf_kernel_asym", "cdf_kernel_asym"
]
from .kde import KDEUnivariate
from .smoothers_lowess import lowess
from . import bandwidths
from .kern... |
src/pythae/models/adversarial_ae/__init__.py | clementchadebec/benchmark_VAE | 143 | 12626687 | <gh_stars>100-1000
"""Implementation of an Adversarial Autoencoder model as proposed in
(https://arxiv.org/abs/1511.05644). This model tries to make the posterior distribution match
the prior using adversarial training.
Available samplers
-------------------
.. autosummary::
~pythae.samplers.NormalSampler
~... |
gcp_variant_transforms/transforms/merge_header_definitions.py | tsa87/gcp-variant-transforms | 113 | 12626693 | # Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
pypeit/specobj.py | brackham/PypeIt | 107 | 12626695 | <reponame>brackham/PypeIt
"""
Module for the SpecObj classes
.. include common links, assuming primary doc root is up one directory
.. include:: ../include/links.rst
"""
import copy
import inspect
from IPython import embed
import numpy as np
from scipy import interpolate
from astropy import units
from linetools.s... |
src/build/fuchsia/symbolizer.py | Chilledheart/naiveproxy | 14,668 | 12626721 | # Copyright 2018 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 logging
import os
import subprocess
from common import SDK_ROOT
from common import GetHostArchFromPlatform
from common import GetHostToolPathFromPlat... |
securify/analyses/patterns/ast/shadowed_builtin_pattern.py | AlexandreH/securify2 | 258 | 12626726 | <reponame>AlexandreH/securify2
from typing import List
from securify.analyses.patterns.abstract_pattern import Severity, PatternMatch, MatchComment
from securify.analyses.patterns.ast.abstract_ast_pattern import AbstractAstPattern
from securify.analyses.patterns.ast.declaration_utils import DeclarationUtils
class S... |
src/python/grapl-template-generator/grapl_template_generator/common_types.py | grapl-security/grapl | 291 | 12626738 | <reponame>grapl-security/grapl<gh_stars>100-1000
from typing import NewType
VersionConstraint = NewType("VersionConstraint", str)
|
usaspending_api/disaster/v2/views/object_class/loans.py | ststuck/usaspending-api | 217 | 12626782 | from typing import List
from decimal import Decimal
from django.db.models import F, Value, TextField, Min
from django.db.models.functions import Cast
from usaspending_api.common.cache_decorator import cache_response
from usaspending_api.common.helpers.orm_helpers import ConcatAll
from usaspending_api.disaster.v2.views... |
statuspage/settings.py | bctransitapps/statuspage | 113 | 12626789 | <reponame>bctransitapps/statuspage
import os
import dj_database_url
import logging
logger = logging.getLogger(__name__)
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
PRODUCTION = os.environ.get('PRODUCTION', False)
STATUS_TICKET_URL = os.environ.get('STATUS_TICKET_URL', None)
STATUS_LOGO_URL = os.environ.ge... |
aiida/parsers/plugins/diff_tutorial/parsers.py | azadoks/aiida-core | 180 | 12626795 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Parsers for DiffCalculation of plugin tutorial.
Register parsers via the "aiida.parsers" entry point in the setup.json file.
"""
# START PARSER HEAD
from aiida.engine import ExitCode
from aiida.orm import SinglefileData
from aiida.parsers.parser import Parser
from aiida.p... |
app/grandchallenge/core/templatetags/dict_lookup.py | kaczmarj/grand-challenge.org | 101 | 12626812 | from django import template
register = template.Library()
@register.simple_tag
def get_dict_values(dictionary, key):
try:
return dictionary.get(key)
except AttributeError:
return None
|
networks/raw_rnn.py | Fred1991/VAE-GMVAE | 193 | 12626834 | <reponame>Fred1991/VAE-GMVAE
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 13 11:17:53 2018
@author: psanch
"""
import tensorflow as tf
import utils.constants as const
from utils.utils import get1toT
from networks.base_raw_rnn import BaseRawRNN
from networks.dense_net import DenseNet
import u... |
hv6/hv6/spec/kernel/spec/invariants.py | ProKil/OS2018spring-projects-g10 | 132 | 12626901 | <filename>hv6/hv6/spec/kernel/spec/invariants.py
#
# Copyright 2017 Hyperkernel Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... |
hyperparameter_hunter/space/space_core.py | beyondacm/hyperparameter_hunter | 688 | 12626922 | """Defines utilities intended for internal use only, most notably
:class:`hyperparameter_hunter.space.space_core.Space`. These tools are used behind the scenes by
:class:`hyperparameter_hunter.optimization.protocol_core.BaseOptPro` to combine instances of
dimensions defined in :mod:`hyperparameter_hunter.space.dimensio... |
amazon/paapi5_python_sdk/item_info.py | frenners/python-amazon-paapi | 121 | 12626927 | <reponame>frenners/python-amazon-paapi
# coding: utf-8
"""
Copyright 2019 Amazon.com, Inc. or its affiliates. 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.
A copy of the License is located at
http://www.a... |
pre_process_sysu.py | shuoyang129/Cross-Modal-Re-ID-baseline | 249 | 12626928 | import numpy as np
from PIL import Image
import pdb
import os
data_path = '/home/datasets/prml/computervision/re-id/sysu-mm01/ori_data'
rgb_cameras = ['cam1','cam2','cam4','cam5']
ir_cameras = ['cam3','cam6']
# load id info
file_path_train = os.path.join(data_path,'exp/train_id.txt')
file_path_val = os.path.join(d... |
Scripts/sims4communitylib/debug/interactions/object_break.py | ColonolNutty/Sims4CommunityLibrary | 118 | 12626947 | """
The Sims 4 Community Library is licensed under the Creative Commons Attribution 4.0 International public license (CC BY 4.0).
https://creativecommons.org/licenses/by/4.0/
https://creativecommons.org/licenses/by/4.0/legalcode
Copyright (c) COLONOLNUTTY
"""
from typing import Any
from event_testing.results import Te... |
tests/nlu/tokenizers/test_jieba_tokenizer.py | Next-Trends/rasa | 3,603 | 12626960 | import logging
from typing import Dict, Optional
from _pytest.logging import LogCaptureFixture
from _pytest.tmpdir import TempPathFactory
from rasa.engine.graph import ExecutionContext
from rasa.engine.storage.resource import Resource
from rasa.engine.storage.storage import ModelStorage
from rasa.nlu.tokenizers.jieba... |
Chapter24/solver.py | haohaoxiao/Deep-Reinforcement-Learning-Hands-On-Second-Edition | 621 | 12626976 | <reponame>haohaoxiao/Deep-Reinforcement-Learning-Hands-On-Second-Edition
#!/usr/bin/env python3
"""
Solver using MCTS and trained model
"""
import time
import argparse
import random
import logging
import datetime
import collections
import csv
from tqdm import tqdm
import seaborn as sns
import matplotlib.pylab as plt
i... |
Z - Tool Box/LaZagne/Windows/lazagne/softwares/windows/vaultfiles.py | dfirpaul/Active-Directory-Exploitation-Cheat-Sheet-1 | 1,290 | 12626987 | <filename>Z - Tool Box/LaZagne/Windows/lazagne/softwares/windows/vaultfiles.py
# -*- coding: utf-8 -*-
from lazagne.config.module_info import ModuleInfo
from lazagne.config.constant import constant
import os
class VaultFiles(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'vaultfiles', 'windows... |
wgan_gp_loss.py | deepsound-project/pggan-pytorch | 115 | 12626988 | import torch
from torch.autograd import Variable, grad
mixing_factors = None
grad_outputs = None
def mul_rowwise(a, b):
s = a.size()
return (a.view(s[0], -1) * b).view(s)
def calc_gradient_penalty(D, real_data, fake_data, iwass_lambda, iwass_target):
global mixing_factors, grad_outputs
if mixing_fa... |
demo/memory_tree/aloi_script.py | Ark-kun/vowpal_wabbit | 4,332 | 12627001 | import os
import time
import numpy as np
# for shot in available_shots.iterkeys():
print("## perform experiments on aloi ##")
num_of_classes = 1000
leaf_example_multiplier = 4 # 8
shots = 100
lr = 0.001
bits = 29
alpha = 0.1 # 0.3
passes = 3 # 3 #5
use_oas = False
dream_at_update = 0
learn_at_leaf = True # turn o... |
download_model.py | AnnLyma/gpt-2 | 105 | 12627007 | import os
import sys
import requests
import argparse
from tqdm import tqdm
parser = argparse.ArgumentParser(
description='Pre-encode text files into tokenized training set.',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--vocab', action='store_true', help='Download only encoder.... |
examples/fun.py | rparini/numdifftools | 181 | 12627008 | <gh_stars>100-1000
import numdifftools as nd
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(-2, 2, 100)
for i in range(0, 10):
df = nd.Derivative(np.tanh, n=i)
y = df(x)
plt.plot(x, y/np.abs(y).max())
plt.axis('off')
plt.axis('tight')
plt.savefig("fun.png")
plt.clf()
|
geopyspark/geotrellis/union.py | geotrellis/geotrellis-python | 182 | 12627015 | <filename>geopyspark/geotrellis/union.py
from geopyspark import get_spark_context
from geopyspark.geotrellis import LayerType, check_layers
from geopyspark.geotrellis.layer import RasterLayer, TiledRasterLayer
__all__ = ['union']
def union(layers):
"""Unions togther two or more ``RasterLayer``\s or ``TiledRaste... |
h2o-py/tests/testdir_jira/pyunit_hexdev_29_import_types.py | ahmedengu/h2o-3 | 6,098 | 12627019 | <filename>h2o-py/tests/testdir_jira/pyunit_hexdev_29_import_types.py
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
################################################################################
##
## Verifying that Python can define features as categorical or continuous on import
##... |
detect_secrets_server/core/usage/common/options.py | zynga-jpetersen/detect-secrets-server | 110 | 12627020 | <reponame>zynga-jpetersen/detect-secrets-server<gh_stars>100-1000
import os
from abc import ABCMeta
from .. import s3
from .storage import get_storage_options
class CommonOptions(object):
"""There are some common flags between the various different subparsers, that
we don't want to display in the main help s... |
alipay/aop/api/domain/MiniEntityBindVO.py | antopen/alipay-sdk-python-all | 213 | 12627051 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.MiniContentProperty import MiniContentProperty
class MiniEntityBindVO(object):
def __init__(self):
self._entity_id = None
self._principal_id = None
se... |
src/models/sequence/ss/linear_system_recurrence.py | dumpmemory/state-spaces | 513 | 12627071 | """ Earlier version of LSSL module that uses pure recurrence (with variable step sizes) """
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
device = torch.device("cuda")
class LinearSystem(nn.Module):
def __init__(
self,
N,
transition,
C,
... |
hyppo/ksample/_utils.py | zdbzdb1212/hyppo | 116 | 12627072 | import numpy as np
from ..tools import contains_nan
class _CheckInputs:
def __init__(self, inputs, indep_test=None, reps=None):
self.inputs = inputs
self.reps = reps
self.indep_test = indep_test
def __call__(self):
self._check_ndarray_inputs()
for i in self.inputs:
... |
demos/vis/streamlit/covid19starterkit.py | carlboudreau007/ecosys | 245 | 12627076 | <reponame>carlboudreau007/ecosys
import pyTigerGraph as tg
import streamlit as st
import pandas as pd
import flat_table
import altair as alt
import plotly.figure_factory as ff
from bokeh.plotting import figure
import plotly.express as px
import plotly.graph_objects as go
st.title('Dynamically Visualize South Korea CO... |
lib/datasets/test_utils.py | rainwangphy/AutoDL-Projects | 385 | 12627083 | ##################################################
# Copyright (c) <NAME> [GitHub D-X-Y], 2019 #
##################################################
import os
def test_imagenet_data(imagenet):
total_length = len(imagenet)
assert total_length == 1281166 or total_length == 50000, 'The length of ImageNet is wrong : {... |
doc/sphinxext/gallery_generator.py | zaxtax/arviz | 1,159 | 12627098 | """
Sphinx plugin to run example scripts and create a gallery page.
Modified from the seaborn project, which modified the mpld3 project.
Also inspired in bokeh's bokeh_gallery sphinxext.
"""
import glob
import os
import os.path as op
import re
import shutil
import token
import tokenize
from typing import Optional
i... |
sina/spider/Ajax_weibo.py | rua-aaa/awesome-python-login-model | 5,857 | 12627117 | # -*- coding: utf-8 -*-
from urllib.parse import urlencode
import requests, pymysql
from pyquery import PyQuery as pq
from selenium import webdriver
from time import sleep
# 连接数据库
connection = pymysql.connect(host='localhost',
port=3306,
user='root',
... |
src/demo.py | championway/pygoturn | 132 | 12627122 | import os
import argparse
import torch
import cv2
from test import GOTURN
args = None
parser = argparse.ArgumentParser(description='GOTURN Testing')
parser.add_argument('-w', '--model-weights',
type=str, help='path to pretrained model')
parser.add_argument('-d', '--data-directory',
... |
utest/run/test_process.py | adrianyorke/RIDE | 775 | 12627146 | <reponame>adrianyorke/RIDE<gh_stars>100-1000
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework 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
#
# ... |
demos/cnn_function_caller.py | bancopoppa/adds | 135 | 12627165 | """
Function caller for the CNN experiments.
-- <EMAIL>
"""
# pylint: disable=arguments-differ
import os
from time import sleep
# Local
from opt.nn_function_caller import NNFunctionCaller
from cg.cifar import run_tensorflow_cifar
import traceback
_MAX_TRIES = 3
_SLEEP_BETWEEN_TRIES_SECS = 3
def get_default_cnn_... |
tests/terraform/checks/resource/gcp/test_GoogleKMSKeyRotationPeriod.py | cclauss/checkov | 4,013 | 12627183 | import unittest
import hcl2
from checkov.terraform.checks.resource.gcp.GoogleKMSRotationPeriod import check
from checkov.common.models.enums import CheckResult
class TestGoogleKMSKeyRotationPeriod(unittest.TestCase):
def test_failure(self):
hcl_res = hcl2.loads("""
resource "google_kms_cryp... |
livelossplot/outputs/bokeh_plot.py | Bartolo1024/livelossplot | 1,239 | 12627201 | from typing import List, Dict, Tuple
from livelossplot.main_logger import MainLogger, LogItem
from livelossplot.outputs.base_output import BaseOutput
class BokehPlot(BaseOutput):
"""Simple plugin for a bokeh framework"""
def __init__(
self,
max_cols: int = 2,
skip_first: int = 2,
... |
scripts/readme_example_human_microbiome.py | ptallada/pysparkling | 260 | 12627209 | from pysparkling import Context
by_subject_rdd = Context().textFile(
's3n://human-microbiome-project/DEMO/HM16STR/46333/by_subject/*'
)
print(by_subject_rdd.takeSample(True, 1))
|
src/python/pants/option/options_bootstrapper_test.py | yoav-orca/pants | 1,806 | 12627229 | <reponame>yoav-orca/pants<gh_stars>1000+
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import os
from functools import partial
from pathlib import Path
from textwrap import dedent
from pants.base.b... |
src/tfi/doc/example_code_generators/__init__.py | ajbouh/tfi | 160 | 12627246 | from tfi.doc.example_code_generators.json import Json as _Json
from tfi.doc.example_code_generators.tensorflow_grpc import TensorFlowGrpc as _TensorFlowGrpc
_EXAMPLE_CODE_GENERATORS = {}
def example_code_generator(name):
return _EXAMPLE_CODE_GENERATORS[name]
def _register_code_generator(ex):
_EXAMPLE_CODE_GEN... |
external/mesh-fusion/librender/test.py | FooVizDevs/occupancy_networks | 801 | 12627261 | import pyrender
import numpy as np
from matplotlib import pyplot
import math
# render settings
img_h = 480
img_w = 480
fx = 480.
fy = 480.
cx = 240
cy = 240
def model():
# note that xx is height here!
xx = -0.2
yy = -0.2
zz = -0.2
v000 = (xx, yy, zz) # 0
v001 = (xx, yy, zz + 0.4) # 1
v... |
TouTiao/toutiao.py | wangbl11/ECommerceCrawlers | 3,469 | 12627267 | import requests
from requests.exceptions import ConnectionError
from lxml import etree
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import csv
import pandas as pd
from urllib.parse import quote
import re
from fake_useragent import UserAgent
import random
base_url =... |
demo3/wiki/__init__.py | DerekDick/CrawlerDemos | 1,061 | 12627272 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright (c) 2013 <NAME> <<EMAIL>>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required... |
docs/the_guide/first.2.py | asnt/moderngl | 916 | 12627371 | import moderngl
ctx = moderngl.create_standalone_context()
prog = ctx.program(
vertex_shader='''
#version 330
in vec2 in_vert;
in vec3 in_color;
out vec3 v_color;
void main() {
v_color = in_color;
gl_Position = vec4(in_vert, 0.0, 1.0);
}
... |
tests/test_04_dxf_high_level_structs/test_420_load_dxf_file.py | jkjt/ezdxf | 515 | 12627372 | # Copyright (c) 2019-2020 <NAME>
# License: MIT License
import pytest
import ezdxf
@pytest.fixture(scope="module", params=["R12", "R2000"])
def dxf(request, tmpdir_factory):
doc = ezdxf.new()
msp = doc.modelspace()
msp.add_line((0, 0), (1, 0))
psp = doc.layout()
psp.add_circle((0, 0), 1)
filen... |
testPyCallJs.py | icarito/guy | 194 | 12627379 | #!/usr/bin/python3 -u
# -*- coding: utf-8 -*-
import guy
class TestPyCallJs(guy.Guy):
"""
<script>
function myjsmethod(a,b) {
document.body.innerHTML+= `sync call (${a},${b})<br>`;
return Math.random();
}
async function myLONGjsmethodAsync(a,b) {
document.body.innerHTML... |
ubteacher/data/dataset_mapper.py | Feobi1999/unbiased-teacher | 306 | 12627397 | <reponame>Feobi1999/unbiased-teacher
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import copy
import logging
import numpy as np
from PIL import Image
import torch
import detectron2.data.detection_utils as utils
import detectron2.data.transforms as T
from detectron2.data.dataset_mapper import ... |
env/Lib/site-packages/plotly/express/data/__init__.py | andresgreen-byte/Laboratorio-1--Inversion-de-Capital | 11,750 | 12627425 | <reponame>andresgreen-byte/Laboratorio-1--Inversion-de-Capital
"""Built-in datasets for demonstration, educational and test purposes.
"""
from __future__ import absolute_import
from plotly.data import *
__all__ = [
"carshare",
"election",
"election_geojson",
"experiment",
"gapminder",
"iris",
... |
rpython/jit/backend/ppc/test/test_loop_unroll.py | nanjekyejoannah/pypy | 381 | 12627430 | <filename>rpython/jit/backend/ppc/test/test_loop_unroll.py
import py
from rpython.jit.backend.ppc.test.support import JitPPCMixin
from rpython.jit.metainterp.test import test_loop_unroll
class TestLoopSpec(JitPPCMixin, test_loop_unroll.LoopUnrollTest):
# for the individual tests see
# ====> ../../../metainterp... |
example/tests/unit/test_pagination.py | anehx/django-rest-framework-json-api | 1,011 | 12627438 | <reponame>anehx/django-rest-framework-json-api
from collections import OrderedDict
from rest_framework.request import Request
from rest_framework.test import APIRequestFactory
from rest_framework.utils.urls import replace_query_param
from rest_framework_json_api import pagination
factory = APIRequestFactory()
clas... |
pytorch/wrapper/bilateralfilter/setup.py | Pandinosaurus/rloss | 185 | 12627451 | #File: setup.py
#!/usr/bin/python
from distutils.core import setup, Extension
# Third-party modules - we depend on numpy for everything
import numpy
# Obtain the numpy include directory. This logic works across numpy versions.
try:
numpy_include = numpy.get_include()
except AttributeError:
numpy_include = nu... |
srcs/python/kungfu/tensorflow/optimizers/sma_sgd.py | Pandinosaurus/KungFu | 291 | 12627471 | import tensorflow as tf
from kungfu.tensorflow.compat import _tf_assign
from kungfu.tensorflow.ops import current_cluster_size, group_all_reduce
from .core import (_create_kungfu_keras_optimizer, _create_kungfu_optimizer,
_KungFuAlgorithm)
def SynchronousAveragingOptimizer(optimizer,
... |
search_relax/dataset.py | latstars/DADA | 160 | 12627497 | <reponame>latstars/DADA
import torch
import torchvision
from operation import apply_augment
from torch.utils.data import SubsetRandomSampler, Sampler, Subset, ConcatDataset
from sklearn.model_selection import StratifiedShuffleSplit
from primitives import sub_policies
import torch.nn.functional as F
import torchvision.d... |
shop/cascade/extensions.py | 2000-ion/TIDPP-Lab3 | 2,160 | 12627506 | from django.utils.translation import gettext_lazy as _
from cms.plugin_pool import plugin_pool
from cmsplugin_cascade.plugin_base import TransparentContainer
from shop.cascade.plugin_base import ShopPluginBase
class ShopExtendableMixin:
"""
Add this mixin class to the list of ``model_mixins``, in the plugin c... |
rasa/graph_components/providers/nlu_training_data_provider.py | fintzd/rasa | 9,701 | 12627514 | from __future__ import annotations
from typing import Dict, Text, Any
from rasa.engine.graph import GraphComponent, ExecutionContext
from rasa.engine.storage.resource import Resource
from rasa.engine.storage.storage import ModelStorage
from rasa.shared.importers.importer import TrainingDataImporter
from rasa.shared.nlu... |
tests/acceptance/test_decorators.py | rspadim/aiocache | 213 | 12627516 | <filename>tests/acceptance/test_decorators.py
import asyncio
import pytest
import random
from unittest import mock
from aiocache import cached, cached_stampede, multi_cached
async def return_dict(keys=None):
ret = {}
for value, key in enumerate(keys or [pytest.KEY, pytest.KEY_1]):
ret[key] = str(val... |
bro-scripts/adversaries/hurricane-panda/rogue-dns/dynamic/scrape-alexa.py | kingtuna/cs-bro | 131 | 12627519 | <gh_stars>100-1000
# Rudimentary script to collect domains in the Alexa top 500
# This script can be run as often as needed to refresh the list of domains
# CrowdStrike 2015
# <EMAIL>
import requests
import bs4
# File containing Alexa top 500 domains
# This file name and path is referenced in the Bro script and can b... |
tests/test_variable_visitor.py | thejcannon/darglint | 405 | 12627523 | import ast
from unittest import (
TestCase,
)
from darglint.analysis.variable_visitor import (
VariableVisitor,
)
from .utils import (
reindent,
)
class VariableVisitorTests(TestCase):
def assertFound(self, program, *variables):
"""Assert that the return was found.
Args:
... |
py4web/server_adapters.py | macneiln/py4web | 133 | 12627532 | import logging
from ombott.server_adapters import ServerAdapter
try:
from .utils.wsservers import *
except ImportError:
wsservers_list = []
__all__ = [
"geventWebSocketServer",
"wsgirefThreadingServer",
"rocketServer",
] + wsservers_list
def geventWebSocketServer():
from gevent import pywsgi... |
dataset/kitti.py | lebionick/stereo-transformer | 410 | 12627578 | # Authors: <NAME>, <NAME>, <NAME>, <NAME>, and <NAME>
#
# Copyright (c) 2020. Johns Hopkins University - All rights reserved.
import os
import numpy as np
import torch.utils.data as data
from PIL import Image
from albumentations import Compose
from natsort import natsorted
from dataset.preprocess import augment, n... |
tests/RunTests/PythonTests/test2011_033.py | maurizioabba/rose | 488 | 12627579 | <reponame>maurizioabba/rose
# test if stmts and exps
if 1:
print "one"
if 2:
print "two"
else:
print "three"
if 0:
print "four"
else:
print "five"
if 1:
print "six"
elif 2:
print "seven"
if 0:
print "eight"
elif 2:
print "nine"
if 0+0:
print "ten"
elif 0*0:
print "eleve... |
src/metrics/size.py | MohammedAljahdali/shrinkbench | 345 | 12627598 | """Model size metrics
"""
import numpy as np
from . import nonzero, dtype2bits
def model_size(model, as_bits=False):
"""Returns absolute and nonzero model size
Arguments:
model {torch.nn.Module} -- Network to compute model size over
Keyword Arguments:
as_bits {bool} -- Whether to accoun... |
utest/test/keywords/test_webdrivercreator_service_log_path.py | hugovk/SeleniumLibrary | 792 | 12627603 | <filename>utest/test/keywords/test_webdrivercreator_service_log_path.py
import os
from collections import namedtuple
import pytest
from mockito import mock, when, unstub, ANY
from selenium import webdriver
from SeleniumLibrary.keywords import WebDriverCreator
from SeleniumLibrary.utils import WINDOWS
@pytest.fixtu... |
notebooks-text-format/flax_intro.py | arpitvaghela/probml-notebooks | 166 | 12627610 | <reponame>arpitvaghela/probml-notebooks<gh_stars>100-1000
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.3
# kernelspec:
# display_name: Python 3
# name: python3
# ---
# + [markdown] id="... |
python/oneflow/compatible/single_client/test/ops/test_broadcast_to_compatible_with.py | wangyuyue/oneflow | 3,285 | 12627619 | """
Copyright 2020 The OneFlow 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 agr... |
key.py | Chasbob/TwitchPlaysX | 256 | 12627635 | <reponame>Chasbob/TwitchPlaysX
# For Windows
# http://stackoverflow.com/questions/1823762/sendkeys-for-python-3-1-on-windows
# https://stackoverflow.com/a/38888131
import win32api
import win32con
import win32gui
import time, sys
keyDelay = 0.1
# https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-code... |
example_problems/tutorial/bit_edit_to_zero/old/gen/valida.py | DottaPaperella/TALight | 409 | 12627653 | <reponame>DottaPaperella/TALight
#!/usr/bin/env python2
|
examples/Backup.py | compose-x/troposphere | 4,573 | 12627654 | <gh_stars>1000+
from troposphere import Template, backup
from troposphere.iam import Role
template = Template("AWS Backup")
template.set_version()
backup_vault = template.add_resource(
backup.BackupVault(
"Vault",
BackupVaultName="my-backup-vault",
BackupVaultTags=dict(
Project... |
data_management/databases/make_detection_db_for_viewing.py | dnarqq/WildHack | 402 | 12627669 | #
# make_detection_db_for_viewing.py
#
# Given a .json file with ground truth bounding boxes, and a .p file containing detections for the same images,
# creates a new .json file with separate classes for ground truth and detection, suitable for viewing in the Visipedia
# annotation tool.
#
#%% Imports and constants
... |
loaner/web_app/backend/api/auth.py | gng-demo/travisfix | 175 | 12627687 | <filename>loaner/web_app/backend/api/auth.py
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... |
napari/utils/events/containers/_set.py | MaksHess/napari | 1,345 | 12627689 | <filename>napari/utils/events/containers/_set.py
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Iterable, Iterator, MutableSet, TypeVar
from ....utils.events import EmitterGroup
from ....utils.translations import trans
_T = TypeVar("_T")
if TYPE_CHECKING:
from pydantic.fields import M... |
neptune/new/internal/utils/runningmode.py | Raalsky/neptune-client | 254 | 12627696 | #
# Copyright (c) 2021, Neptune Labs Sp. z o.o.
#
# 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 agr... |
homeassistant/components/netgear/button.py | MrDelik/core | 30,023 | 12627713 | """Support for Netgear Button."""
from collections.abc import Callable, Coroutine
from dataclasses import dataclass
from typing import Any
from homeassistant.components.button import (
ButtonDeviceClass,
ButtonEntity,
ButtonEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from home... |
notebooks-text-format/flow_2d_mlp.py | arpitvaghela/probml-notebooks | 166 | 12627722 | <reponame>arpitvaghela/probml-notebooks
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.3
# kernelspec:
# display_name: Python 3
# name: python3
# ---
# + [markdown] id="view-in-github" co... |
wrapcache/adapter/MemcachedAdapter.py | Max1993Liu/wrapcache | 117 | 12627742 | #-*-coding: utf-8 -*-
'''
Memcached Adapter object.
'''
from wrapcache.adapter.BaseAdapter import BaseAdapter
from wrapcache.adapter.CacheException import CacheExpiredException, DBNotSetException
class MemcachedAdapter(BaseAdapter):
'''
use for memcached cache
'''
def __init__(self, timeout = -1):
... |
plugins/modules/oci_resource_manager_job.py | slmjy/oci-ansible-collection | 108 | 12627746 | <reponame>slmjy/oci-ansible-collection<filename>plugins/modules/oci_resource_manager_job.py
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYIN... |
python/jittor/test/test_conv_tuner.py | Exusial/jittor | 2,571 | 12627774 | <reponame>Exusial/jittor<filename>python/jittor/test/test_conv_tuner.py<gh_stars>1000+
# ***************************************************************
# Copyright (c) 2021 Jittor. All Rights Reserved.
# Maintainers:
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>.
#
# This file is subject to the terms and condition... |
myia/operations/macro_resolve.py | strint/myia | 222 | 12627781 | """Implementation of the 'resolve' operation."""
from ..lib import Constant, MyiaNameError, MyiaTypeError, Namespace, macro
@macro
async def resolve(info, r_data, r_item):
"""Perform static name resolution on a Namespace."""
data_v, item_v = await info.build_all(r_data, r_item)
if not isinstance(data_v, ... |
lingvo/core/gshard_layers_test.py | allenwang28/lingvo | 2,611 | 12627787 | # Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.