max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
python/basalt/metric.py | kwang-12/basalt-mirror | 445 | 3253515 | <reponame>kwang-12/basalt-mirror
#
# BSD 3-Clause License
#
# This file is part of the Basalt project.
# https://gitlab.com/VladyslavUsenko/basalt.git
#
# Copyright (c) 2019-2021, <NAME> and <NAME>.
# All rights reserved.
#
import copy
import numpy as np
class ExperimentSpec:
def __init__(self, string):
... | 0 | 0 | 0 | 0 | 0 | 0 |
growler/middleware/renderer.py | pyGrowler/Growler | 806 | 3253517 | #
# growler/middleware/renderer.py
#
from __future__ import annotations
import logging
from pathlib import Path
log = logging.getLogger(__name__)
class Renderer:
"""
Renderer is a helper class designed to provide a common interface for
rendering html (or potentially any file format) from templates files... | 2 | 4 | 2 | 1 | 9 | 0 |
sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models_py3.py | rsdoherty/azure-sdk-for-python | 2,728 | 3253525 | # coding=utf-8
# --------------------------------------------------------------------------
# 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 Code Generator.
# Changes may ... | 70 | 0 | 40 | 27 | 137 | 0 |
tests/tsa/test_tsa.py | iklasky/timemachines | 253 | 3253528 | <filename>tests/tsa/test_tsa.py
from timemachines.inclusion.statsmodelsinclusion import using_statsmodels
if using_statsmodels:
from timemachines.skaters.tsa.tsaconstant import tsa_p1_d0_q0, tsa_aggressive_ensemble
from timemachines.skaters.tsa.tsahypocratic import tsa_quickly_hypocratic_d0_ensemble
from t... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_unicode.py | MapleCCC/inflect | 174 | 3253602 | import unittest
import inflect
class TestUnicode(unittest.TestCase):
""" Unicode compatibility test cases """
def test_unicode_plural(self):
""" Unicode compatibility test cases for plural """
engine = inflect.engine()
unicode_test_cases = {"cliché": "clichés", "ångström": "ångströms"... | 0 | 0 | 0 | 0 | 0 | 0 |
02NetworkProgramming/day02/file_server.py | HaoZhang95/PythonAndMachineLearning | 937 | 3253627 | <gh_stars>100-1000
"""
文件下载的服务器端
Python中如果函数中没有return的话,默认的是返回return None
"""
import socket, os
def read_file_data(file_name):
"""获取指定的文件数据"""
try:
file = open(file_name, "rb")
except Exception as e:
print("文件不存在.")
return None
else:
# 如果文件过大,会有隐患
file_d... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/578692_QGstartscript_Change_display/recipe-578692.py | tdiprima/code | 2,023 | 3253628 | # -*- coding: utf-8; -*-
''' CoordsConf: Configure QGIS coordinate display
Store this script as .qgis2/python/startup.py
Redoute, 19.10.2013 '''
from __future__ import unicode_literals, division
import qgis
QgsPoint = qgis.core.QgsPoint
CoordinateReferenceSystem = qgis.core.QgsCoordinateReferenceSystem
CoordinateTr... | 0 | 1 | 0 | 0 | 1 | 0 |
src/collector/wechat/data258_ruia_start.py | showthesunli/liuli | 139 | 3253686 | """
Created by howie.hu at 2022-05-12.
Description: 基于Ruia爬虫框架的微信公众号爬虫
原始数据来源于:https://mp.data258.com/mp/search?type=category&key=老胡的储物柜&sort=
! 注意,该目标网站有比较严厉的反爬措施,单IP只能访问15次,此功能需要代理池
- 运行: 根目录执行,其中环境文件pro.env根据实际情况选择即可
- 命令: PIPENV_DOTENV_LOCATION=./dev.env pipenv run python src... | 0 | 0 | 0 | 0 | 0 | 1 |
src/python/pants/backend/docker/registries_test.py | yoav-orca/pants | 1,806 | 3253736 | # Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import pytest
from pants.backend.docker.registries import (
DockerRegistries,
DockerRegistryOptions,
DockerRegistryOptionsNotFoundError,
)
def test_docker_registries() -> No... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/test_swagger_version_3.py | NishkarshRaj/aptos | 167 | 3253746 | <gh_stars>100-1000
import json
import os
import unittest
from aptos.swagger.v3 import model
from aptos.swagger.v3.parser import OpenAPIParser
BASE_DIR = os.path.dirname(__file__)
class OpenAPIVersion3TestCase(unittest.TestCase):
def runTest(self):
with open(os.path.join(BASE_DIR, 'schema', 'petstore'))... | 0 | 0 | 0 | 0 | 0 | 0 |
python/ql/test/library-tests/dependencies/c.py | vadi2/codeql | 4,036 | 3253754 | import b
class C(object):
def foo(self):
b = B()
| 0 | 0 | 0 | 0 | 0 | 0 |
python/paddle/fluid/tests/unittests/test_uniform_random_bf16_op.py | zmxdream/Paddle | 17,085 | 3253761 | <reponame>zmxdream/Paddle
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | 0 | 0 | 0 | 0 | 0 | 0 |
textless/data/quantized_datasets.py | an918tw/textlesslib | 198 | 3253785 | # 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.
"""
A `textless` wrapper around datasets (Quantize dataset) and a set of pre-wrapped standard torchaudio datasets
(https://pytorch.org/audio/st... | 35 | 12 | 0 | 3 | 50 | 0 |
generate_images.py | SachinKumar105/Implicit-Competitive-Regularization | 107 | 3253790 | import os
from train_utils import get_data
import torchvision.utils as vutils
from torch.utils.data import DataLoader
def generate(dataname, path, save_path, batch_size: int=64, device: str='cpu'):
dataset = get_data(dataname=dataname, path='../datas/%s' % path)
real_loader = DataLoader(dataset=dataset, batch... | 2 | 0 | 0 | 0 | 2 | 0 |
src/naarad/metrics/cluster_metric.py | richardhsu/naarad | 180 | 3253797 | <filename>src/naarad/metrics/cluster_metric.py<gh_stars>100-1000
# coding=utf-8
"""
Copyright 2013 LinkedIn Corp. 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... | 0 | 0 | 0 | 0 | 0 | 0 |
nbdt/data/cifar.py | XAVILLA/nbdt | 536 | 3253801 | <reponame>XAVILLA/nbdt
"""Wrappers around CIFAR datasets"""
from torchvision import datasets, transforms
from . import transforms as transforms_custom
__all__ = names = ("CIFAR10", "CIFAR100")
class CIFAR:
@staticmethod
def transform_train():
return transforms.Compose(
[
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/ResNet/CASIA_WEB_FACE.PyTorch/data_loader.py | willyspinner/High-Performance-Face-Recognition | 300 | 3253829 | <reponame>willyspinner/High-Performance-Face-Recognition<filename>src/ResNet/CASIA_WEB_FACE.PyTorch/data_loader.py
import collections
import os.path as osp
# from __future__ import division
import numpy as np
import PIL.Image
import scipy.io
import skimage
import skimage.color as color
from skimage.transform import re... | 0 | 0 | 0 | 0 | 0 | 0 |
Bit Manipulation/1835. Find XOR Sum of All Pairs Bitwise AND.py | beckswu/Leetcode | 138 | 3253837 | class Solution:
def getXORSum(self, arr1: List[int], arr2: List[int]) -> int:
a0 = b0 = 0
for i in arr1:
a0 = a0 ^ i
for j in arr2:
b0 = b0 ^ j
return a0 & b0 | 2 | 1 | 0 | 0 | 3 | 0 |
src/azure-cli/azure/cli/command_modules/signalr/_actions.py | YuanyuanNi/azure-cli | 3,287 | 3253852 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 1 | 0 | 0 | 0 | 1 | 0 |
cnn_text_trainer/core/multichannel/__init__.py | flipkart-incubator/optimus | 123 | 3253867 | <filename>cnn_text_trainer/core/multichannel/__init__.py
__author__ = 'devashish.shankar'
| 0 | 0 | 0 | 0 | 0 | 0 |
Chapter 6/buffer.py | Tuantrung/DeepReinforcementLearningInAction | 474 | 3253871 | import random
class ExperienceReplay():
def __init__(self):
self.buffer: list[object] = []
self.buffer_size: int = 1000
def add(self, data):
self.buffer.extend(data)
if len(self.buffer) > self.buffer_size: self.buffer = self.buffer[-self.buffer_size:]
def sample(self, size... | 0 | 2 | 0 | 2 | 4 | 0 |
guppy/etc/xterm.py | odidev/guppy3 | 251 | 3253889 | <reponame>odidev/guppy3
# Run an xterm on current process or a forked process
# Adapted from pty.py in Python 1.5.2 distribution.
# The pty.fork() couldnt be used because it didn't return
# the pty name needed by xterm
# I couldnt import pty.py to use master_open because it didn't find termios.
import os
import sys
i... | 0 | 0 | 0 | 0 | 0 | 0 |
tutorials/ros_unity_integration/ros2_packages/unity_robotics_demo/setup.py | peted70/Unity-Robotics-Hub | 1,022 | 3253901 | <gh_stars>1000+
import glob
import os
from setuptools import setup
package_name = 'unity_robotics_demo'
setup(
name=package_name,
version='0.0.1',
packages=[package_name],
data_files=[
('share/ament_index/resource_index/packages', ['resource/' + package_name]),
('share/' + package_nam... | 0 | 0 | 0 | 0 | 0 | 0 |
dd_1/Part 1/Section 09 - Modules, Packages and Namespaces/02 - How Python Imports Modules/example2/main.py | Rebell-Leader/bg | 3,266 | 3253929 | <gh_stars>1000+
# main.py
import module1
# even though test was added to sys.modules
# in module1, we can still access it from here
import test
print(test())
# don't do this! It's a bad hack to illustrate how import looks
# in sys.modules for the symbol we are importing
| 0 | 0 | 0 | 0 | 0 | 0 |
py/manipulation/props/mesh_object.py | wx-b/dm_robotics | 128 | 3253935 | # Copyright 2020 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 13 | 6 | 0 | 0 | 19 | 0 |
djorm_pgfulltext/utils.py | w0rp/djorm-ext-pgfulltext | 142 | 3253965 | <reponame>w0rp/djorm-ext-pgfulltext<filename>djorm_pgfulltext/utils.py
import psycopg2
from django.db import connection
from django.utils.text import force_text
def adapt(text):
a = psycopg2.extensions.adapt(force_text(text))
a.prepare(connection.connection)
return a
| 0 | 0 | 0 | 0 | 0 | 0 |
heudiconv/tests/test_queue.py | neurorepro/heudiconv | 167 | 3253971 | <filename>heudiconv/tests/test_queue.py
import os
import sys
import subprocess
from heudiconv.cli.run import main as runner
from heudiconv.queue import clean_args, which
from .utils import TESTS_DATA_PATH
import pytest
@pytest.mark.skipif(bool(which("sbatch")), reason="skip a real slurm call")
@pytest.mark.parametriz... | 0 | 0 | 0 | 0 | 0 | 0 |
docs_src/tutorial/asyncify/tutorial001.py | sanders41/asyncer | 596 | 3253975 | <gh_stars>100-1000
import time
import anyio
def do_sync_work(name: str):
time.sleep(1)
return f"Hello, {name}"
async def main():
message = do_sync_work(name="World")
print(message)
anyio.run(main)
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/mnli_example/matches.py | fangd123/TextBrewer | 1,121 | 3254013 | <reponame>fangd123/TextBrewer<gh_stars>1000+
L3_attention_mse=[{"layer_T":4, "layer_S":1, "feature":"attention", "loss":"attention_mse", "weight":1},
{"layer_T":8, "layer_S":2, "feature":"attention", "loss":"attention_mse", "weight":1},
{"layer_T":12, "layer_S":3, "feature":"attent... | 0 | 0 | 0 | 0 | 0 | 0 |
wifi_password/__init__.py | topdefaultuser/wifi-password | 2,552 | 3254014 | <gh_stars>1000+
from .wifi_password import main
| 0 | 0 | 0 | 0 | 0 | 0 |
day21/Python/PairSumN_Dipto.py | Grace0Hud/dailycodebase | 249 | 3254019 | <filename>day21/Python/PairSumN_Dipto.py
'''
Name:<NAME>
Date:17/01/2019
Day 21
Question:Pair Sum N
'''
def pairSumN(l,n):
t=[]
k=len(l)
l.sort()
print(l)
#sorting the list (incase list is unsorted)
for i in range(k-1):
#using nested list to loop through elements
for j in range(... | 0 | 0 | 0 | 0 | 0 | 0 |
wagtail/admin/views/bulk_action/registry.py | melisayu/wagtail | 8,851 | 3254023 | <reponame>melisayu/wagtail
from wagtail.admin.views.bulk_action import BulkAction
from wagtail.core import hooks
class BulkActionRegistry:
def __init__(self):
self.actions = dict() # {app_name: {model_name: {action_name: action_class]}}
self.has_scanned_for_bulk_actions = False
def _scan_for... | 0 | 0 | 0 | 0 | 0 | 0 |
hypertunity/scheduling/tests/test_scheduler.py | LaudateCorpus1/hypertunity | 130 | 3254058 | <gh_stars>100-1000
import os
import tempfile
import pytest
from hypertunity.domain import Domain, Sample
from hypertunity.optimisation import base
from ..jobs import Job, SlurmJob
from ..scheduler import Scheduler
from . import script
@pytest.fixture(scope="module")
def shared_slurm_tmp_dir():
return "/tmp"
... | 0 | 0 | 0 | 0 | 0 | 0 |
galileo/framework/pytorch/python/layers/feature_encoder.py | YaoPu2021/galileo | 115 | 3254078 | <gh_stars>100-1000
# Copyright 2020 JD.com, Inc. Galileo 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
#
# U... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/package/pages/training_analysis/views/test_performance_curve_view.py | slamer59/awesome-panel | 179 | 3254099 | <reponame>slamer59/awesome-panel<filename>tests/package/pages/training_analysis/views/test_performance_curve_view.py
"""In this module we test the views in the performance_view module"""
import awesome_panel.express as pnx
import panel as pn
from awesome_panel.express.testing import TestApp
from application.pag... | 0 | 0 | 0 | 0 | 0 | 0 |
extraPackages/matplotlib-3.0.3/examples/userdemo/colormap_normalizations_lognorm.py | dolboBobo/python3_ios | 130 | 3254171 | <filename>extraPackages/matplotlib-3.0.3/examples/userdemo/colormap_normalizations_lognorm.py
"""
===============================
Colormap Normalizations Lognorm
===============================
Demonstration of using norm to map colormaps onto data in non-linear ways.
"""
import numpy as np
import matplotlib.pyplot a... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/benchmark-tcp.py | farisachugthai/pyuv | 826 | 3254179 |
from __future__ import print_function
import sys
sys.path.insert(0, '../')
import signal
import threading
import pyuv
RESPONSE = b"HTTP/1.1 200 OK\r\n" \
"Content-Type: text/plain\r\n" \
"Content-Length: 12\r\n" \
"\r\n" \
"hello world\n"
def on_client_shutdown(client, ... | 0 | 0 | 0 | 0 | 0 | 0 |
test/run/t461.py | timmartin/skulpt | 2,671 | 3254221 | <filename>test/run/t461.py
import re
print re.findall("^\s*$", "")
print re.findall("\s*|a", " a b")
print re.findall("a|\s*", " a b")
print re.findall("\s*|a", " ba b")
print re.findall("a|\s*", " ba b")
| 0 | 0 | 0 | 0 | 0 | 0 |
lib/turkish_stemmer/TurkishStemmer/__init__.py | myasiny/wordembed | 205 | 3254252 | #-*- coding: utf-8 -*-
from __future__ import annotations
from __future__ import print_function
from .states import NounState, DerivationalState, NominalVerbState
from _collections import deque
from io import open
import functools
import sys, os
__all__ = ["TurkishStemmer"]
# The turkish characters. They are used for... | 0 | 16 | 0 | 0 | 16 | 0 |
hubspot/conversations/visitor_identification/api/__init__.py | fakepop/hubspot-api-python | 117 | 3254270 | <reponame>fakepop/hubspot-api-python<gh_stars>100-1000
from __future__ import absolute_import
# flake8: noqa
# import apis into api package
from hubspot.conversations.visitor_identification.api.generate_api import GenerateApi
| 0 | 0 | 0 | 0 | 0 | 0 |
jaxrl/agents/redq/critic.py | dibyaghosh/jaxrl | 113 | 3254295 | <filename>jaxrl/agents/redq/critic.py<gh_stars>100-1000
from typing import Tuple
import jax
import jax.numpy as jnp
from jaxrl.datasets import Batch
from jaxrl.networks.common import InfoDict, Model, Params, PRNGKey
def target_update(critic: Model, target_critic: Model, tau: float) -> Model:
new_target_params =... | 0 | 0 | 0 | 0 | 0 | 0 |
src/modeling/_gcnn.py | microsoft/MeshGraphormer | 135 | 3254303 | <filename>src/modeling/_gcnn.py
from __future__ import division
import torch
import torch.nn.functional as F
import numpy as np
import scipy.sparse
import math
class SparseMM(torch.autograd.Function):
"""Redefine sparse @ dense matrix multiplication to enable backpropagation.
The builtin matrix multiplication ... | 0 | 0 | 0 | 0 | 0 | 0 |
commandment/alembics/versions/ba4849d8c8ad_create_device_group_devices_table.py | pythonModule/commandment | 138 | 3254333 | <reponame>pythonModule/commandment
"""Create device_group_devices table
Revision ID: ba4849d8c8ad
Revises: <PASSWORD>
Create Date: 2017-05-19 19:44:37.403554
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ba4849d8c8ad'
down_revision = '<PASSWORD>'
branch_labe... | 0 | 0 | 0 | 0 | 0 | 0 |
pyNastran/dev/solver/utils.py | ACea15/pyNastran | 293 | 3254350 | <gh_stars>100-1000
from __future__ import annotations
from typing import Dict, Tuple, Any, TYPE_CHECKING
import numpy as np
if TYPE_CHECKING: # pragma: no cover
from pyNastran.bdf.bdf import BDF
DOF_MAP = Dict[Tuple[int, int], int]
def get_ieids_eids(model: BDF, etype: str, eids_str,
idtype... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/pyright-internal/src/tests/samples/genericTypes49.py | sasano8/pyright | 4,391 | 3254385 | # This sample tests the handling of a bound TypeVar that is used
# in a Type[X] statement.
from typing import Callable, Generic, TypeVar, Type, Union
class Base:
...
T = TypeVar("T", bound=Base)
def register(state_name: str, state: Type[T]):
...
def register_state(state_name: str) -> Callable[[Type[T]]... | 8 | 4 | 1 | 0 | 13 | 0 |
rlgraph/tests/components/test_v_trace_function.py | RLGraph/RLGraph | 290 | 3254400 | # Copyright 2018/2019 The RLgraph 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 appli... | 0 | 0 | 0 | 0 | 0 | 0 |
txdav/caldav/datastore/scheduling/addressmapping.py | backwardn/ccs-calendarserver | 462 | 3254405 | ##
# Copyright (c) 2005-2017 Apple 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 l... | 0 | 2 | 0 | 0 | 2 | 0 |
tljh/migrator.py | budgester/the-littlest-jupyterhub | 741 | 3254410 | <reponame>budgester/the-littlest-jupyterhub
"""Migration utilities for upgrading tljh"""
import os
from datetime import date
import logging
import shutil
from tljh.config import (
CONFIG_DIR,
CONFIG_FILE,
INSTALL_PREFIX,
)
logger = logging.getLogger("tljh")
def migrate_file(old_path, new_path):
""... | 0 | 0 | 0 | 0 | 0 | 0 |
pyzoo/zoo/pipeline/api/onnx/mapper/reshape.py | abdolence/analytics-zoo | 2,970 | 3254411 | <filename>pyzoo/zoo/pipeline/api/onnx/mapper/reshape.py
#
# Copyright 2018 Analytics Zoo 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/LICENS... | 0 | 0 | 0 | 0 | 0 | 0 |
resources/lib/image.py | metbosch/script.kodi.http.ambilight | 172 | 3254430 | import colorsys
class HSVRatio:
cyan_min = float(4.5 / 12.0)
cyan_max = float(7.75 / 12.0)
def __init__(self, hue: float=0.0, saturation: float=0.0, value: float=0.0, ratio: float=0.0):
self.h = hue
self.s = saturation
self.v = value
self.ratio = ratio
def average(se... | 5 | 6 | 0 | 0 | 11 | 0 |
kge/model/transformer.py | LukasDegitz/kge | 516 | 3254478 | from __future__ import annotations
import torch
import torch.nn
from torch import Tensor
import math
from kge import Config, Dataset
from kge.model.kge_model import RelationalScorer, KgeModel
class TransformerScorer(RelationalScorer):
r"""Scorer that uses a plain Transformer encoder.
Concatenates (1) CLS em... | 12 | 2 | 0 | 0 | 14 | 0 |
torchvision/prototype/transforms/_geometry.py | yoshitomo-matsubara/vision | 12,063 | 3254498 | from typing import Any, Dict, Tuple, Union
import torch
from torch.nn.functional import interpolate
from torchvision.prototype.datasets.utils import SampleQuery
from torchvision.prototype.features import BoundingBox, Image, Label
from torchvision.prototype.transforms import Transform
class HorizontalFlip(Transform):... | 22 | 19 | 3 | 0 | 44 | 0 |
bark/benchmark/benchmark_runner_mp.py | xmyqsh/bark | 174 | 3254508 | # Copyright (c) 2020 fortiss GmbH
#
# Authors: <NAME>, <NAME>, <NAME> and
# <NAME>
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
import pickle
import ray
import logging
import psutil
import os
logging.getLogger().setLevel(logging.INFO)
from ba... | 0 | 0 | 0 | 0 | 0 | 0 |
deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/INTEL/performance_query.py | ShujaKhalid/deep-rl | 210 | 3254518 | '''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... | 0 | 1 | 0 | 0 | 1 | 0 |
notebooks/_solutions/pandas_07_reshaping_data22.py | rprops/Python_DS-WS | 183 | 3254526 | <filename>notebooks/_solutions/pandas_07_reshaping_data22.py
df['Underaged'] = df['Age'] <= 18 | 0 | 0 | 0 | 0 | 0 | 0 |
search/search_service/api/healthcheck.py | defendercrypt/amundsen | 2,072 | 3254541 | # Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from typing import Dict, Tuple
from flasgger import swag_from
from flask_restful import Resource
from search_service.proxy import get_proxy_client
class HealthcheckAPI(Resource):
"""
Healthcheck API
"""
def __i... | 0 | 2 | 0 | 0 | 2 | 0 |
utils/migrations/0009_auto_20210721_1414.py | maznu/peering-manager | 173 | 3254542 | # Generated by Django 3.2.5 on 2021-07-21 12:14
from django.db import migrations
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [("utils", "0008_auto_20210420_2144")]
operations: list[object] = [
migrations.RenameField(
model_name="objectchange", old_name="a... | 0 | 0 | 2 | 0 | 2 | 0 |
tests/test_utils.py | alimohammad1995/python-hdwallet | 188 | 3254553 | <reponame>alimohammad1995/python-hdwallet<filename>tests/test_utils.py<gh_stars>100-1000
#!/usr/bin/env python3
import json
import unicodedata
import os
from hdwallet.utils import (
get_bytes, generate_mnemonic, generate_entropy, is_entropy, get_mnemonic_strength,
get_entropy_strength, is_mnemonic, get_mnemon... | 0 | 0 | 0 | 0 | 0 | 0 |
redash/handlers/organization.py | zero1number/redash | 20,680 | 3254557 | from __future__ import annotations
from flask_login import current_user, login_required
from redash import models
from redash.handlers import routes
from redash.handlers.base import json_response, org_scoped_rule
from redash.authentication import current_org
@routes.route(org_scoped_rule("/api/organization/status"),... | 1 | 1 | 0 | 0 | 2 | 0 |
alphapy/utilities.py | aborodya/AlphaPy | 559 | 3254558 | ################################################################################
#
# Package : AlphaPy
# Module : utilities
# Created : July 11, 2013
#
# Copyright 2017 ScottFree Analytics LLC
# <NAME> & <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except... | 0 | 6 | 0 | 0 | 6 | 0 |
neurst/layers/attentions/light_convolution_layer.py | ishine/neurst | 208 | 3254593 | # Copyright 2020 ByteDance 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 to in writin... | 18 | 4 | 0 | 0 | 22 | 0 |
DQM/SiStripMonitorHardware/python/SiStripSpyEventSummaryProducer_cfi.py | ckamtsikis/cmssw | 852 | 3254596 | import FWCore.ParameterSet.Config as cms
SiStripSpyEventSummary = cms.EDProducer('SiStripSpyEventSummaryProducer',
RawDataTag = cms.InputTag('source'),
RunType = cms.uint32(2) #Pedestals, see DataFormats/SiStripCommon/interface/ConstantsForRunType.h
)
| 0 | 0 | 0 | 0 | 0 | 0 |
meerk40t/gui/rotarysettings.py | apbarratt/meerk40t | 118 | 3254599 | <reponame>apbarratt/meerk40t
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# generated by wxGlade 0.9.3 on Mon Dec 30 01:30:50 2019
#
import wx
from .icons import icons8_roll_50
from .mwindow import MWindow
_ = wx.GetTranslation
class RotarySettingsPanel(wx.Panel):
def __init__(self, *args, context=None, **k... | 0 | 0 | 0 | 0 | 0 | 0 |
cyphercat/train.py | arafin-lab/model_inversion_experiments | 101 | 3254604 | <filename>cyphercat/train.py
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as fcnal
from sklearn.pipeline import Pipeline
from .metrics import eval_target_model
# Determine device to run network on (runs on gpu if available)
device = torch.device("cuda:0" if torch.cuda.is_availabl... | 0 | 0 | 0 | 0 | 0 | 0 |
twitter/auth.py | snail-coupe/twitter | 1,707 | 3254616 | try:
import urllib.parse as urllib_parse
from base64 import encodebytes
except ImportError:
import urllib as urllib_parse
from base64 import encodestring as encodebytes
class Auth(object):
"""
ABC for Authenticator objects.
"""
def encode_params(self, base_url, method, params):
... | 0 | 4 | 0 | 0 | 4 | 0 |
tests/opytimizer/optimizers/swarm/test_cs.py | anukaal/opytimizer | 528 | 3254617 | <reponame>anukaal/opytimizer<gh_stars>100-1000
import numpy as np
from opytimizer.optimizers.swarm import cs
from opytimizer.spaces import search
def test_cs_params():
params = {
'alpha': 1.0,
'beta': 1.5,
'p': 0.2
}
new_cs = cs.CS(params=params)
assert new_cs.alpha == 1.0
... | 0 | 0 | 0 | 0 | 0 | 0 |
yotta/unpublish.py | microbit-foundation/yotta | 176 | 3254619 | # Copyright 2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
import logging
# validate, , validate things, internal
from yotta.lib import validate
def addOptions(parser):
pass
def execCommand(args, following_args) -> int:
p =... | 0 | 1 | 0 | 0 | 1 | 0 |
projects/Python/examples/create.py | kokizzu/FastBinaryEncoding | 563 | 3254632 | import fbe
import proto
from proto import proto
def main():
# Create a new account using FBE model
account = proto.AccountModel(fbe.WriteBuffer())
model_begin = account.create_begin()
account_begin = account.model.set_begin()
account.model.id.set(1)
account.model.name.set("Test")
account.m... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/exclude_heading.py | naokazuterada/MarkdownTOC | 299 | 3254662 | # coding:utf-8
from base import TestBase
class TestExcludeHeading(TestBase):
"""Ignore exclude heading"""
# for debug
# def tearDown(self):
# pass
text_1: str = """
<!-- MarkdownTOC -->
<!-- /MarkdownTOC -->
# heading 1
<!-- MarkdownTOC:excluded -->
# heading 2
# heading 3
"""
de... | 0 | 0 | 2 | 0 | 2 | 0 |
tests/test_pattern_core.py | rvega/isobar | 241 | 3254665 | import pytest
import isobar as iso
def test_pref():
a = iso.PSequence([1, 2, 3], 1)
b = iso.PSequence([4, 5, 6], 1)
c = iso.PRef(a)
assert next(c) == 1
assert next(c) == 2
c.pattern = b
assert next(c) == 4
assert next(c) == 5
assert next(c) == 6
with pytest.raises(StopIteration)... | 0 | 0 | 0 | 0 | 0 | 0 |
golden/demo-page-assets/index.bzl | isabella232/skia-buildbot | 119 | 3254684 | """This module defines the GOLD_DEMO_PAGE_ASSETS constant."""
# Any Gold demo pages that require the below static assets should pass this constant to their
# sk_demo_page_server rules via the static_assets argument.
GOLD_DEMO_PAGE_ASSETS = {
"/img/diffs": [
"//golden/demo-page-assets:2fa58aa430e9c815755624... | 0 | 0 | 0 | 0 | 0 | 0 |
experiments/DiscreteBayes1D.py | VladPodilnyk/Kalman-and-Bayesian-Filters-in-Python | 12,315 | 3254720 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""
Created on Fri May 2 11:48:55 2014
@author: rlabbe
"""
from __future__ import division
from __future__ import print_function
import copy
import numpy as np
import numpy.random as random
import matplotlib.pyplot as plt
''' should this be a class? seems l... | 4 | 0 | 0 | 0 | 4 | 0 |
tests/host_man_test.py | elsmorian/cassandra-medusa | 187 | 3254732 | <reponame>elsmorian/cassandra-medusa
# -*- coding: utf-8 -*-
# Copyright 2021- Datastax, 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/li... | 0 | 0 | 0 | 0 | 0 | 0 |
limits/__init__.py | mymedia2/limits | 140 | 3254738 | <reponame>mymedia2/limits
"""
Rate limiting utilities
"""
from ._version import get_versions
from .limits import (
RateLimitItem, RateLimitItemPerYear, RateLimitItemPerMonth,
RateLimitItemPerDay, RateLimitItemPerHour, RateLimitItemPerMinute,
RateLimitItemPerSecond
)
from .util import parse, parse_many
__v... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/python/batch_sim/parameter_tables.py | leozz37/makani | 1,178 | 3254761 | <filename>lib/python/batch_sim/parameter_tables.py
# Copyright 2020 Makani Technologies LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | 0 | 0 | 0 | 0 | 0 | 0 |
third_party/webrtc/src/chromium/src/third_party/webdriver/pylib/test/selenium/common/utils.py | bopopescu/webrtc-streaming-node | 2,151 | 3254834 | <filename>third_party/webrtc/src/chromium/src/third_party/webdriver/pylib/test/selenium/common/utils.py<gh_stars>1000+
import os
import socket
import time
import urllib
import subprocess
import signal
SERVER_ADDR = "localhost"
DEFAULT_PORT = 4444
SERVER_PATH = "build/java/server/src/org/openqa/grid/selenium/selenium... | 0 | 0 | 0 | 0 | 0 | 0 |
applications/DamApplication/python_scripts/dam_mapping_variables_utility.py | lkusch/Kratos | 778 | 3254839 | from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7
# Import applications
import KratosMultiphysics.DamApplication as KratosDam
class MappingVariablesUtility:
def __init__(self,domain_size):
# Construct the utility... | 0 | 3 | 0 | 0 | 3 | 0 |
python/paddle_fl/mobile/trainer/trainer_base.py | barrierye/PaddleFL | 379 | 3254841 | <gh_stars>100-1000
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | 0 | 0 | 0 | 0 | 0 | 0 |
PyObjCTest/test_cfdateformatter.py | Khan/pyobjc-framework-Cocoa | 132 | 3254844 | <filename>PyObjCTest/test_cfdateformatter.py<gh_stars>100-1000
from PyObjCTools.TestSupport import *
from CoreFoundation import *
try:
unicode
except NameError:
unicode = str
try:
long
except NameError:
long = int
class TestDateFormatter (TestCase):
def testTypeID(self):
self.assertIsIn... | 0 | 0 | 0 | 0 | 0 | 0 |
Ryven/packages/auto_generated/io/nodes.py | tfroehlich82/Ryven | 2,872 | 3254950 | <reponame>tfroehlich82/Ryven<filename>Ryven/packages/auto_generated/io/nodes.py
from NENV import *
import io
class NodeBase(Node):
pass
class Openwrapper_Node(NodeBase):
"""
Open file and return a stream. Raise OSError upon failure.
file is either a text or byte string giving the name (and the path
... | 0 | 0 | 0 | 0 | 0 | 0 |
etc/Text/translate.py | pafri/DJV | 456 | 3254958 | # \todo Remove translations from the output file that are no longer in the input file
#
# References:
# - https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/translate/cloud-client/quickstart.py
import sys
import json
from collections import OrderedDict
from google.cloud import translate_v2
def ge... | 0 | 1 | 0 | 0 | 1 | 0 |
data-processing/common/commands/store_results.py | hhchi13/scholarphi | 285 | 3254994 | <reponame>hhchi13/scholarphi
import glob
import logging
import os
import shutil
import subprocess
from argparse import ArgumentParser
from dataclasses import dataclass
from tempfile import TemporaryDirectory
from typing import Iterator, List
from common import directories
from common.commands.base import ArxivBatchCom... | 0 | 0 | 0 | 0 | 0 | 0 |
python/graphscope/nx/tests/algorithms/forward/approximation/test_steinertree.py | LI-Mingyu/GraphScope-MY | 1,521 | 3255009 | <gh_stars>1000+
import networkx.algorithms.approximation.tests.test_steinertree
import pytest
from graphscope.nx.utils.compat import import_as_graphscope_nx
from graphscope.nx.utils.compat import with_graphscope_nx_context
import_as_graphscope_nx(networkx.algorithms.approximation.tests.test_steinertree,
... | 0 | 0 | 0 | 0 | 0 | 0 |
test/functional/p2p_dandelion.py | zejii/digibyte | 431 | 3255021 | <reponame>zejii/digibyte
#!/usr/bin/env python3
# Copyright (c) 2018 <NAME>
# Distributed under the MIT software license. See the accompanying file COPYING
# or http://www.opensource.org/licenses/mit-license.php.
"""Test transaction behaviors under the Dandelion spreading policy
Tests:
1. Resistance to active pr... | 0 | 0 | 0 | 0 | 0 | 0 |
ppgan/faceutils/face_detection/detection/blazeface/blazeface_detector.py | pcwuyu/PaddleGAN | 6,852 | 3255032 | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# 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 appl... | 5 | 5 | 0 | 0 | 10 | 0 |
habu/lib/certclone2.py | optimustoaster/habu | 461 | 3255046 | #!/usr/bin/env python3
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import ec, rsa
from cryptography.x509 import Extensions
from pprint import pprint
def certclon... | 1 | 0 | 0 | 0 | 1 | 0 |
examples/dcm_to_bigquery_example.py | Ressmann/starthinker | 138 | 3255078 | ###########################################################################
#
# 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/l... | 0 | 0 | 0 | 0 | 0 | 0 |
src/rl/genotypes.py | paul-ang/nas-segm-pytorch | 155 | 3255079 | """List of operations"""
from collections import namedtuple
Genotype = namedtuple("Genotype", "encoder decoder")
# CVPR 2019
OP_NAMES = [
"conv1x1",
"conv3x3",
"sep_conv_3x3",
"sep_conv_5x5",
"global_average_pool",
"conv3x3_dil3",
"conv3x3_dil12",
"sep_conv_3x3_dil3",
"sep_conv_5x... | 0 | 0 | 0 | 0 | 0 | 0 |
polyfile/kaitaimatcher.py | trailofbits/polyfile | 190 | 3255081 | <reponame>trailofbits/polyfile
import base64
from typing import Dict, Iterator, List, Tuple, Type
from kaitaistruct import KaitaiStruct, KaitaiStructError
from .kaitai.parser import ASTNode, KaitaiParser, RootNode
from .kaitai.parsers.gif import Gif
from .kaitai.parsers.jpeg import Jpeg
from .kaitai.parsers.png impor... | 0 | 0 | 0 | 0 | 0 | 0 |
awacs/health.py | alanjjenkins/awacs | 358 | 3255086 | <reponame>alanjjenkins/awacs<filename>awacs/health.py
# Copyright (c) 2012-2021, <NAME> <<EMAIL>>
# All rights reserved.
#
# See LICENSE file for full license.
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "AWS Health APIs and Notifications"
prefix = "health"
class Action(BaseAction)... | 0 | 0 | 0 | 0 | 0 | 0 |
robogym/envs/dactyl/goals/fixed_fair_scramble.py | 0xflotus/robogym | 288 | 3255137 | <filename>robogym/envs/dactyl/goals/fixed_fair_scramble.py<gh_stars>100-1000
import logging
from robogym.envs.dactyl.goals.face_cube_solver import FaceCubeSolverGoal
logger = logging.getLogger(__name__)
class FixedFairScrambleGoal(FaceCubeSolverGoal):
"""
Generates a series of goals to apply a "fair scrambl... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/Lib/site-packages/emoji/unicode_codes/__init__.py | matthewvanderson/MagicBot | 1,471 | 3255156 | <filename>venv/Lib/site-packages/emoji/unicode_codes/__init__.py
# -*- coding: utf-8 -*-
from emoji.unicode_codes.data_dict import *
__all__ = [
'EMOJI_UNICODE', 'UNICODE_EMOJI',
'EMOJI_UNICODE_ENGLISH', 'UNICODE_EMOJI_ENGLISH',
'EMOJI_ALIAS_UNICODE_ENGLISH', 'UNICODE_EMOJI_ALIAS_ENGLISH',
'EMOJI_UNI... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/integration/s3/test_cors.py | Yurzs/boto | 5,079 | 3255255 | <filename>tests/integration/s3/test_cors.py
# Copyright (c) 2010 <NAME> http://garnaat.org/
# Copyright (c) 2010, Eucalyptus Systems, Inc.
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to ... | 0 | 0 | 0 | 0 | 0 | 0 |
crypto/ECC/test.py | yingjingyang/Dapp-Learning | 987 | 3255315 | import unittest
from binascii import hexlify, unhexlify
from fastecdsa import keys, curve
from fastecdsa.encoding.sec1 import InvalidSEC1PublicKey, SEC1Encoder
from ecc_secp256k1 import ECC256k1
PRIV_KEY = 0x92c0302c1fff4679f4c98684ff368fdbe04da815e6de24d246793f5812577016
pub_key = keys.get_public_key(PRIV_KEY, curve... | 0 | 0 | 0 | 0 | 0 | 0 |
notebook/pandas_time_series_resample_agg.py | vhn0912/python-snippets | 174 | 3255331 | <filename>notebook/pandas_time_series_resample_agg.py<gh_stars>100-1000
import pandas as pd
df = pd.read_csv('data/src/sample_date.csv', index_col=0, parse_dates=True)
print(df)
# val_1 val_2
# date
# 2017-11-01 65 76
# 2017-11-07 26 66
# 2017-11-18 47 47
# 2017... | 0 | 0 | 0 | 0 | 0 | 0 |
jobfunnel/resources/resources.py | NishanBanga/JobFunnel | 1,652 | 3255343 | """String-like resouces and other constants are initialized here.
"""
import datetime
import os
import string
# CSV header for output CSV. do not remove anything or you'll break usr's CSV's
# TODO: need to add short and long descriptions (breaking change)
CSV_HEADER = [
'status', 'title', 'company', 'location', 'd... | 0 | 0 | 0 | 0 | 0 | 0 |
watchmen/console_space/storage/last_snapshot_storage.py | Insurance-Metrics-Measure-Advisory/watchman-data-connector | 125 | 3255369 | <filename>watchmen/console_space/storage/last_snapshot_storage.py
from model.model.console_space.last_snapshot import LastSnapshot
# from watchmen.database.storage.storage_template import insert_one, find_one, update_one
from watchmen.database.find_storage_template import find_storage_template
LAST_SNAPSHOT = "consol... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/rbm/test_Feature_Binarizer_From_Trees.py | floidgilbert/AIX360 | 491 | 3255384 | from unittest import TestCase
import numpy as np
from numpy import ndarray
from pandas import DataFrame
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import OneHotEncoder, StandardScaler
from aix360.algorithms.rbm import FeatureBinarize... | 0 | 1 | 6 | 1 | 8 | 0 |
src/test/python/test_invoke.py | seletz/jep | 698 | 3255400 | <reponame>seletz/jep<gh_stars>100-1000
import unittest
import sys
from jep_pipe import jep_pipe
from jep_pipe import build_java_process_cmd
class TestInvokes(unittest.TestCase):
def test_inits(self):
jep_pipe(build_java_process_cmd('jep.test.TestInvoke'))
| 0 | 0 | 0 | 0 | 0 | 0 |
tick/robust/tests/model_linreg_with_intercepts_test.py | sumau/tick | 411 | 3255405 | <reponame>sumau/tick<gh_stars>100-1000
# License: BSD 3 clause
import unittest
import numpy as np
from scipy.sparse import csr_matrix
from tick.linear_model import SimuLinReg
from tick.base_model.tests.generalized_linear_model import TestGLM
from tick.robust import ModelLinRegWithIntercepts
from tick.simulation impo... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.