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 |
|---|---|---|---|---|---|---|---|---|---|---|
CameraGeometry/reference/SFMedu2/matchSIFT/vlfeat/docsrc/webdoc.py | faipaz/Algorithms | 113 | 3359659 | #!/usr/bin/python
# file: webdoc.py
# author: <NAME>
# description: Implementation of webdoc.
# Copyright (C) 2007-12 <NAME> and <NAME>.
# All rights reserved.
#
# This file is part of the VLFeat library and is made available under
# the terms of the BSD license (see the COPYING file).
import types
import... | 0 | 0 | 0 | 0 | 0 | 0 |
solutions/vijendra/assignment1/cs231n/classifiers/softmax.py | kvn219/stanford-cs231 | 282 | 3359685 | import numpy as np
from random import shuffle
def softmax_loss_naive(W, X, y, reg) -> tuple[object, object]:
"""
Softmax loss function, naive implementation (with loops)
Inputs have dimension D, there are C classes, and we operate on minibatches
of N examples.
Inputs:
- W: A numpy array of shape (D, C) c... | 0 | 2 | 0 | 0 | 2 | 0 |
crabageprediction/venv/Lib/site-packages/numpy/fft/tests/test_helper.py | 13rianlucero/CrabAgePrediction | 20,453 | 3359688 | <reponame>13rianlucero/CrabAgePrediction
"""Test functions for fftpack.helper module
Copied from fftpack.helper by <NAME>, October 2005
"""
import numpy as np
from numpy.testing import assert_array_almost_equal
from numpy import fft, pi
class TestFFTShift:
def test_definition(self):
x = [0, 1, 2, 3, 4,... | 0 | 0 | 0 | 0 | 0 | 0 |
pyfr/solvers/baseadvecdiff/inters.py | JakeL77/PyFR | 126 | 3359706 | <reponame>JakeL77/PyFR<gh_stars>100-1000
# -*- coding: utf-8 -*-
from pyfr.backends.base import NullComputeKernel, NullMPIKernel
from pyfr.solvers.baseadvec import (BaseAdvectionIntInters,
BaseAdvectionMPIInters,
BaseAdvectionBCInters)
class Bas... | 0 | 0 | 0 | 0 | 0 | 0 |
env/lib/python3.5/site-packages/passlib/tests/test_utils.py | Udolf15/recommedMeMovies | 172 | 3359707 | <gh_stars>100-1000
"""tests for passlib.util"""
#=============================================================================
# imports
#=============================================================================
from __future__ import with_statement
# core
from functools import partial
import warnings
# site
# pkg
... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/Encrypt credentials/Encryption sample/services/getdatasource.py | AdamRiddick/PowerBI-Developer-Samples | 611 | 3359713 | <filename>Python/Encrypt credentials/Encryption sample/services/getdatasource.py
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import requests
class GetDatasourceService:
headers = None
def get_datasources_in_group(self, access_token, group_id, dataset_id):
''' Returns al... | 0 | 0 | 0 | 0 | 0 | 0 |
src/tools/nuscenes-devkit/map_expansion/arcline_path_utils.py | jie311/TraDeS | 475 | 3359720 | <filename>src/tools/nuscenes-devkit/map_expansion/arcline_path_utils.py
# nuScenes dev-kit.
# Code written by <NAME>, 2020.
import math
from typing import Dict, Any, Tuple, List
import numpy as np
# (x, y, yaw) in global frame
Pose = Tuple[float, float, float]
ArcLinePath = Dict[str, Any]
def principal_value(angl... | 0 | 0 | 0 | 0 | 0 | 0 |
etc/pending_ugens/XFadeRotate.py | butayama/supriya | 191 | 3359727 | <reponame>butayama/supriya
import collections
from supriya.enums import CalculationRate
from supriya.synthdefs import MultiOutUGen
class XFadeRotate(MultiOutUGen):
"""
::
>>> source = supriya.ugens.In.ar(bus=0)
>>> xfade_rotate = supriya.ugens.XFadeRotate.ar(
... n=0,
...... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/pytorch/rgcn-hetero/model.py | lfchener/dgl | 9,516 | 3359731 | <reponame>lfchener/dgl
"""RGCN layer implementation"""
from collections import defaultdict
import torch as th
import torch.nn as nn
import torch.nn.functional as F
import dgl
import dgl.function as fn
import dgl.nn as dglnn
import tqdm
class RelGraphConvLayer(nn.Module):
r"""Relational graph convolution layer.
... | 0 | 0 | 0 | 0 | 0 | 0 |
app/tests/serving_tests/test_views.py | nlessmann/grand-challenge.org | 101 | 3359760 | <reponame>nlessmann/grand-challenge.org
import json
import pytest
from django.core.files.base import ContentFile
from guardian.shortcuts import assign_perm
from grandchallenge.components.models import (
ComponentInterface,
ComponentInterfaceValue,
)
from tests.algorithms_tests.factories import AlgorithmJobFac... | 0 | 0 | 0 | 0 | 0 | 0 |
keras_bert/keras_pos_embd/__init__.py | DanielWeidinger/DocNet | 421 | 3359773 | from .pos_embd import PositionEmbedding
from .trig_pos_embd import TrigPosEmbedding
| 0 | 0 | 0 | 0 | 0 | 0 |
robustness_metrics/models/rescaling_test.py | goncaloperes/robustness_metrics | 383 | 3359784 | <gh_stars>100-1000
# coding=utf-8
# Copyright 2021 The Robustness Metrics 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
#
# Unles... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_buttongroup.py | aajshaw/guizero | 320 | 3359792 | from threading import Event
from guizero import App, ButtonGroup
from common_test import (
schedule_after_test,
schedule_repeat_test,
destroy_test,
enable_test,
display_test,
text_test,
color_test,
size_text_test,
size_fill_test,
events_test,
cascaded_properties_test,
inh... | 0 | 0 | 0 | 0 | 0 | 0 |
plugins/public/cinq-auditor-required-tags/cinq_auditor_required_tags/views.py | gibbsie/cloud-inquisitor | 462 | 3359798 | import json
from base64 import b64encode
from collections import OrderedDict
from io import BytesIO
from flask import Response
from pyexcel_xlsx import save_data
from cloud_inquisitor.config import dbconfig
from cloud_inquisitor.constants import ROLE_USER, HTTP, NS_AUDITOR_REQUIRED_TAGS
from cloud_inquisitor.json_uti... | 0 | 2 | 3 | 0 | 5 | 0 |
testdata/completion/bash_oracle.py | Schweinepriester/oil | 2,209 | 3359805 | <filename>testdata/completion/bash_oracle.py
#
# DO NOT EDIT -- Generated by testdata/completion/bash_oracle.sh
#
# bash --version:
# GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
# Copyright (C) 2013 Free Software Foundation, Inc.
# License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.... | 0 | 0 | 0 | 0 | 0 | 0 |
test_pipetools/test_main.py | CrazyLionHeart/pipetools | 164 | 3359813 | <reponame>CrazyLionHeart/pipetools
# encoding: utf-8
import pytest
from pipetools import pipe, X, maybe, xpartial
from pipetools.main import StringFormatter
from pipetools.compat import range
class Bunch:
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
class TestPipe(object):
pipe = pro... | 0 | 0 | 0 | 0 | 0 | 0 |
test/support/regressors.py | nasa42/prophet | 220 | 3359820 | <filename>test/support/regressors.py
import pandas as pd
from fbprophet import Prophet
# float_precision='high' required for pd.read_csv to match precision of Rover.read_csv
df = pd.read_csv('examples/example_wp_log_peyton_manning.csv', float_precision='high')
def nfl_sunday(ds):
date = pd.to_datetime(ds)
if ... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/Algorithms/Sorting-Algorithms/counting_sort.py | ThunderZ007/Data-Structures-and-Algorithms | 245 | 3359829 | def counting_sort(A, max_val) -> object:
"""
This sorting algorithm will only work with array length n consist of
elements from 0 to k for integer k < n.
"""
k = max_val + 1
count = [0]*k
result = [None]*len(A)
print("Array A = ", A)
# counting the number of i (1 < i < k) in A and ... | 0 | 1 | 0 | 0 | 1 | 0 |
h2o-py/tests/testdir_jira/pyunit_pubdev_6686_concurrent_drf.py | kernelrich/h2o-3 | 6,098 | 3359852 | <reponame>kernelrich/h2o-3
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.random_forest import H2ORandomForestEstimator
def test_pubdev_6686():
train = h2o.import_file(path="http://h2o-public-test-data.s3.amazonaws.com/smalldata/jira/pubdev_6686.csv")
... | 0 | 0 | 0 | 0 | 0 | 0 |
pymtl3/dsl/errors.py | kevinyuan/pymtl3 | 152 | 3359860 | from __future__ import annotations
"""
========================================================================
errors.py
========================================================================
Errors thrown by other files in this folder.
Author : <NAME>
Date : Dec 27, 2018
"""
import inspect
class FieldReassignE... | 6 | 14 | 0 | 0 | 20 | 0 |
layers.py | longnguyen2/face-antispoofing-using-mobileNet | 150 | 3359863 | from __future__ import annotations
import tensorflow as tf
import numpy as np
############################################################################################################
# Convolution layer Methods
def __conv2d_p(name, x, w: object | None=None, num_filters: int=16, kernel_size: tuple[int, int]=(3, 3)... | 62 | 18 | 0 | 0 | 80 | 0 |
arduino/portable/sketchbook/libraries/IRremoteESP8266/tools/raw_to_pronto_code_test.py | devshop2019/mixlyTest | 118 | 3359902 | <filename>arduino/portable/sketchbook/libraries/IRremoteESP8266/tools/raw_to_pronto_code_test.py<gh_stars>100-1000
#!/usr/bin/python3
"""Unit tests for raw_to_pronto_code.py"""
from io import StringIO
import unittest
import raw_to_pronto_code as pronto
class TestRawToPronto(unittest.TestCase):
"""Unit tests for the ... | 0 | 0 | 0 | 0 | 0 | 0 |
redo/cmd_targets.py | moonglum/redo | 1,002 | 3360002 | """redo-targets: list the known targets (not sources)."""
from __future__ import print_function
import sys, os
from . import env, logs, state
def main():
if len(sys.argv[1:]) != 0:
sys.stderr.write('%s: no arguments expected.\n' % sys.argv[0])
sys.exit(1)
state.init([])
logs.setup(
... | 0 | 0 | 0 | 0 | 0 | 0 |
Drake-Z/0006/0006.py | saurabh896/python-1 | 3,976 | 3360006 | <gh_stars>1000+
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'第 0004 题:任一个英文的纯文本文件,统计其中的单词出现的个数。'
__author__ = 'Drake-Z'
import os
import re
import glob
from collections import OrderedDict
def get_num(key_word, filename):
'''获得词汇出现次数'''
f = open(filename, 'r', encoding='utf-8').read()
re_zhengze = re.... | 0 | 0 | 0 | 0 | 0 | 0 |
rpython/rlib/parsing/deterministic.py | nanjekyejoannah/pypy | 333 | 3360031 | from __future__ import with_statement
import py
try:
set
except NameError:
from sets import Set as set, ImmutableSet as frozenset
def compress_char_set(chars):
"""Take the character list and compress runs of adjacent
characters; the result is a list of the first character in
a run and the number o... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/render_to_lightmap.py | szabolcsdombi/zengl | 116 | 3360033 | import numpy as np
import zengl
from objloader import Obj
from PIL import Image
from progress.bar import Bar
import assets
from window import Window
samples = 64
size = 1024
window = Window(1280, 720)
ctx = zengl.context()
ctx.includes['samples'] = f'const int samples = {samples};'
image = ctx.image(window.size, '... | 0 | 0 | 0 | 0 | 0 | 0 |
eth/vm/logic/duplication.py | ggs134/py-evm | 1,641 | 3360070 | import functools
from eth.vm.computation import BaseComputation
def dup_XX(computation: BaseComputation, position: int) -> None:
"""
Stack item duplication.
"""
computation.stack_dup(position)
dup1 = functools.partial(dup_XX, position=1)
dup2 = functools.partial(dup_XX, position=2)
dup3 = functools... | 2 | 1 | 0 | 0 | 3 | 0 |
backdoors/template.py | mehrdad-shokri/backdoorme | 796 | 3360089 | <gh_stars>100-1000
#This is the template to create backdoors. Please copy your backdoor into the suggested spots. Places you need to input are shown by ~tildes~.
from .backdoor import *
#Remember extra imports.
class ~NAME~(Backdoor):
prompt = Fore.RED + "~NAME~" + Fore.BLUE + ">> " + Fore.RESET
def __init__(... | 0 | 0 | 0 | 0 | 0 | 0 |
code/data/videodata.py | Etienne66/CDVD-TSP | 232 | 3360095 | <filename>code/data/videodata.py<gh_stars>100-1000
import os
import glob
import numpy as np
import imageio
import torch
import torch.utils.data as data
import utils.utils as utils
class VIDEODATA(data.Dataset):
def __init__(self, args, name='', train=True):
self.args = args
self.name = name
... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/pot/openvino/tools/pot/algorithms/quantization/channel_alignment/algorithm.py | chccc1994/openvino | 2,406 | 3360106 | <gh_stars>1000+
# Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from copy import deepcopy
import numpy as np
from ...algorithm import Algorithm
from ...algorithm_selector import COMPRESSION_ALGORITHMS
from ....graph import model_utils as mu
from ....graph import node_utils as nu
fro... | 0 | 0 | 0 | 0 | 0 | 0 |
poium/common/assert_des.py | yaoJeffer/poium | 174 | 3360120 | from poium.settings import Setting
def insert_assert(describe, result):
"""
Insert assertion data
describe(str): Assertion description information
result(bool): Assertion results
"""
result = [describe, bool(result)]
Setting.assert_result.append(result)
| 0 | 0 | 0 | 0 | 0 | 0 |
tfx/orchestration/python_execution_binary/entrypoint.py | avelez93/tfx | 1,813 | 3360124 | <filename>tfx/orchestration/python_execution_binary/entrypoint.py
# Copyright 2020 Google LLC. 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.o... | 0 | 0 | 0 | 0 | 0 | 0 |
networks/encoders/swin/build.py | yoxu515/aot-benchmark | 105 | 3360131 | <reponame>yoxu515/aot-benchmark
# --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>
# --------------------------------------------------------
from .swin_transformer import SwinTransf... | 0 | 0 | 0 | 0 | 0 | 0 |
jlivetrader.py | mczero80/japonicus | 229 | 3360140 | #!/bin/python
import os
import optparse
import json
import livetrader.exchangeMonitor
import livetrader.gekkoTrigger
import livetrader.gekkoChecker
try:
import livetrader.strategyRanker
except Exception:
pass
parser = optparse.OptionParser()
parser.add_option('-b', '--balance',
dest='balan... | 0 | 0 | 0 | 0 | 0 | 0 |
panoramix/core/arithmetic.py | git-github-com-warren1990-Github-git/panoramix | 259 | 3360150 | <gh_stars>100-1000
#
# Originally taken from py-evm/eth/vm/logic/arithmetic.py
#
# Then, comments removed to make it more in line with the rest of the codebase.
#
# And then modified to do things it was never designed to do.
#
# Now it's a part of the Panoramix code base.
# It was assimilated, resistance was futil... | 0 | 0 | 0 | 0 | 0 | 0 |
testfixtures/mock.py | bnavigator/testfixtures | 184 | 3360166 | <reponame>bnavigator/testfixtures
"""
A facade for either :mod:`unittest.mock` or its `rolling backport`__, if it is
installed, with a preference for the latter as it may well have newer functionality
and bugfixes.
The facade also contains any bugfixes that are critical to the operation of
functionality provided by te... | 0 | 0 | 0 | 0 | 0 | 0 |
mindspore_serving/server/worker/init_mindspore.py | mindspore-ai/serving | 157 | 3360182 | # Copyright 2020 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 0 | 4 | 0 | 0 | 4 | 0 |
simulation/algo_none.py | Barala/doorman | 1,831 | 3360202 | # Copyright 2016 Google, 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 writing... | 0 | 0 | 0 | 0 | 0 | 0 |
osf/migrations/0078_add_banner_permissions.py | gaybro8777/osf.io | 628 | 3360207 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-07-17 20:11
from __future__ import unicode_literals
from django.db import migrations
def noop(*args):
# This migration used to add permissions,
# which is now handled by the post_migrate signal
pass
class Migration(migrations.Migration):
dep... | 0 | 0 | 2 | 0 | 2 | 0 |
__scraping__/ikea.com/main.py | whitmans-max/python-examples | 140 | 3360224 | <filename>__scraping__/ikea.com/main.py
#
# https://stackoverflow.com/a/47741611/1832058
#
import scrapy
class MySpider(scrapy.Spider):
name = 'myspider'
#allowed_domains = ['http://www.ikea.com']
start_urls = ['http://www.ikea.com/ae/en/catalog/categories/departments/childrens_ikea/31772/']
def ... | 0 | 0 | 0 | 0 | 0 | 0 |
paper_experiments/utils/tracking_utils.py | noskill/JRMOT_ROS | 112 | 3360225 | from __future__ import annotations
import torch, sys, os, pdb
import numpy as np
from PIL import Image
from scipy.spatial import Delaunay
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
from .aligned_reid_utils import load_state_dict
from models.yolo_models import Darknet
from ... | 6 | 8 | 0 | 0 | 14 | 0 |
nscl/models/utils.py | bergen/NSCL-PyTorch-Release | 343 | 3360239 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : utils.py
# Author : <NAME>
# Email : <EMAIL>
# Date : 10/06/2018
#
# This file is part of NSCL-PyTorch.
# Distributed under terms of the MIT license.
import torch
__all__ = ['canonize_monitors', 'update_from_loss_module']
def canonize_monitors(monitors):... | 0 | 0 | 0 | 0 | 0 | 0 |
oct2py/tests/test_misc.py | adityaapte/oct2py | 195 | 3360246 | <reponame>adityaapte/oct2py<filename>oct2py/tests/test_misc.py
from __future__ import absolute_import, print_function
import glob
import logging
import os
import shutil
import tempfile
import pytest
try:
import thread
except ImportError:
import _thread as thread
import numpy as np
import panda... | 0 | 0 | 0 | 0 | 0 | 0 |
load_LIDC_data.py | DeNeutoy/Probabilistic-Unet-Pytorch | 193 | 3360276 | <gh_stars>100-1000
import torch
from torch.utils.data.dataset import Dataset
from torch.utils.data import DataLoader
import numpy as np
import os
import random
import pickle
class LIDC_IDRI(Dataset):
images = []
labels = []
series_uid = []
def __init__(self, dataset_location, transform=None):
... | 0 | 0 | 0 | 0 | 0 | 0 |
neuralcompression/layers/_analysis_transformation_2d.py | tallamjr/NeuralCompression | 233 | 3360300 | <gh_stars>100-1000
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from torch import Tensor
from torch.nn import Conv2d, Module, Sequential
from ._generalized_divisive_normalization impor... | 0 | 0 | 0 | 0 | 0 | 0 |
emukit/test_functions/multi_fidelity/__init__.py | ndalchau/emukit | 272 | 3360303 | from .borehole import multi_fidelity_borehole_function # noqa: F401
from .branin import multi_fidelity_branin_function # noqa: F401
from .currin import multi_fidelity_currin_function # noqa: F401
from .hartmann import multi_fidelity_hartmann_3d # noqa: F401
from .park import multi_fidelity_park_function # noqa: F4... | 0 | 0 | 0 | 0 | 0 | 0 |
src/tests/simian/settings_datastore_test.py | tristansgray/simian | 326 | 3360312 | <reponame>tristansgray/simian
#!/usr/bin/env python
#
# 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/... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/system/dag_pretty_print.py | jjzhang166/minerva | 561 | 3360313 | <reponame>jjzhang166/minerva
import sys
import Queue
from dag_utils import Dag
fname = sys.argv[1]
dag = Dag(fname)
dag.load()
name_to_comp = {n : '' for n in dag.node_attr}
remains = set(dag.node_attr.keys())
def get_device_id(n):
n_ty = dag.node_attr[n]['type']
if n_ty == 'd':
return dag.node_attr[... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_kinematic_chain.py | ali493/pybotics | 244 | 3360328 | """Test."""
import numpy as np
from pytest import raises
from pybotics.errors import PyboticsError
from pybotics.kinematic_chain import MDHKinematicChain
from pybotics.link import MDHLink, RevoluteMDHLink
def test_init():
"""Test."""
# test error
with raises(PyboticsError):
MDHKinematicChain(np.e... | 0 | 0 | 0 | 0 | 0 | 0 |
desktop/core/ext-py/pyasn1-modules-0.2.6/pyasn1_modules/rfc4073.py | e11it/hue-1 | 5,079 | 3360348 | <filename>desktop/core/ext-py/pyasn1-modules-0.2.6/pyasn1_modules/rfc4073.py<gh_stars>1000+
#
# This file is part of pyasn1-modules software.
#
# Created by <NAME> with some assistance from asn1ate v.0.6.0.
# Modified by <NAME> to add a map for use with opentypes.
#
# Copyright (c) 2019, Vigil Security, LLC
# License: ... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/adafruit_hid/consumer_control_code.py | jacoblb64/pico_rgb_keypad_hid | 180 | 3360424 | # SPDX-FileCopyrightText: 2018 <NAME> for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`adafruit_hid.consumer_control_code.ConsumerControlCode`
========================================================
* Author(s): <NAME>
"""
class ConsumerControlCode:
"""USB HID Consumer Control Device constants.
... | 0 | 0 | 11 | 0 | 11 | 0 |
mesonbuild/interpreterbase/helpers.py | iinuwa/meson | 4,047 | 3360428 | <gh_stars>1000+
# Copyright 2013-2021 The Meson development 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 applica... | 0 | 0 | 0 | 0 | 0 | 0 |
mongomock/codec_options.py | kpk-pl/mongomock | 574 | 3360450 | <gh_stars>100-1000
"""Tools for specifying BSON codec options."""
import collections
from packaging import version
try:
from bson import codec_options
import pymongo
_PYMONGO_VERSION = version.parse(pymongo.version)
except ImportError:
codec_options = None
_PYMONGO_VERSION = version.parse('0.0')
... | 0 | 0 | 0 | 0 | 0 | 0 |
tornadis/pipeline.py | JumpingYang001/tornadis | 138 | 3360455 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of tornadis library released under the MIT license.
# See the LICENSE file for more information.
class Pipeline(object):
"""Pipeline class to stack redis commands.
A pipeline object is just a kind of stack. You stack complete redis
comma... | 0 | 0 | 0 | 2 | 2 | 0 |
slack_sdk/http_retry/state.py | priya1puresoftware/python-slack-sdk | 2,486 | 3360458 | <reponame>priya1puresoftware/python-slack-sdk
from typing import Optional, Any, Dict
class RetryState:
next_attempt_requested: bool
current_attempt: int # zero-origin
custom_values: Optional[Dict[str, Any]]
def __init__(
self,
*,
current_attempt: int = 0,
custom_value... | 0 | 0 | 0 | 0 | 0 | 0 |
examples-master/python_examples/qmc_walk_sho.py | JungHoonJung/2021MD | 186 | 3360462 | <reponame>JungHoonJung/2021MD<gh_stars>100-1000
#!/usr/bin/env python3
# qmc_walk_sho.py
#------------------------------------------------------------------------------------------------#
# This software was written in 2016/17 #
# by <NAME> <<EMAIL>>/<<EMAIL>> ... | 0 | 0 | 0 | 0 | 0 | 0 |
Hashing DS/anagram_indices.py | techsavvyy/coding-problems | 2,647 | 3360463 | '''
Anagram Indices
Given a word and a string S, find all starting indices in S which are anagrams of word.
(An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once)
Input: s='abxaba' word='ab'
Output: [0, 3, 4]
Output expla... | 0 | 2 | 0 | 1 | 3 | 0 |
egal/egal.py | kayceesrk/egal | 264 | 3360472 | <gh_stars>100-1000
from IPython.core.display import HTML
import uuid
def edit_svg(filename, height="400"):
svg_id = str(uuid.uuid1())
# load the file
# populate svg element on page
# javascript code that edits svg
# trigger that stores current svg element in original file
html = """
<div... | 0 | 0 | 0 | 0 | 0 | 0 |
vcspull/__init__.py | Segaja/vcspull | 169 | 3360478 | #!/usr/bin/env python
"""Manage multiple git, mercurial, svn repositories from a YAML / JSON file.
vcspull
~~~~~~~
:copyright: Copyright 2013-2018 <NAME>.
:license: MIT, see LICENSE for details
"""
# Set default logging handler to avoid "No handler found" warnings.
import logging
from logging import NullHandler
fro... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/imports-from.py | mikelolasagasti/bandit | 4,016 | 3360485 | <gh_stars>1000+
from subprocess import Popen
from ..foo import sys
from . import sys
from .. import sys
from .. import subprocess
from ..subprocess import Popen
| 0 | 0 | 0 | 0 | 0 | 0 |
cloudfn/hooks/hooks-django.middleware.py | MartinSahlen/python-cloud-fn | 230 | 3360515 | from PyInstaller.utils.hooks import collect_submodules
hiddenimports = collect_submodules('django.middleware')
| 0 | 0 | 0 | 0 | 0 | 0 |
solutions/LeetCode/Python3/1091.py | timxor/leetcode-journal | 854 | 3360523 | <gh_stars>100-1000
__________________________________________________________________________________________________
class Solution:
def shortestPathBinaryMatrix(self, A: List[List[int]]) -> int:
if A[0][0]: return -1
dq = collections.deque([(0, 0)])
seen = {(0, 0)}
step = 1
... | 0 | 0 | 0 | 0 | 0 | 0 |
ztag/annotations/redhat.py | justinbastress/ztag | 107 | 3360536 | <reponame>justinbastress/ztag
from ztag.annotation import *
class RedHatSatelite(Annotation):
protocol = protocols.HTTP
subprotocol = protocols.HTTP.GET
port = None
def process(self, obj, meta):
if obj["title"].strip() == "Red Hat Satellite\n \n \n - Sign In":
me... | 0 | 0 | 0 | 0 | 0 | 0 |
src/whylogs/core/statistics/thetasketch.py | cswarth/whylogs | 603 | 3360557 | <gh_stars>100-1000
import datasketches
from whylogs.proto import UniqueCountSummary
def _copy_union(union):
new_union = datasketches.theta_union()
new_union.update(union.get_result())
return new_union
class ThetaSketch:
"""
A sketch for approximate cardinality tracking.
A wrapper class for... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/exog/random/random_exog_75_80.py | shaido987/pyaf | 377 | 3360566 | <gh_stars>100-1000
import tests.exog.test_random_exogenous as testrandexog
testrandexog.test_random_exogenous( 75,80); | 0 | 0 | 0 | 0 | 0 | 0 |
pypxe/nbd/writes.py | Goblenus/PyPXE | 133 | 3360568 | <reponame>Goblenus/PyPXE<filename>pypxe/nbd/writes.py<gh_stars>100-1000
import io
from .. import helpers
class COW:
def basepages(self, offset, length):
# basepages is (page base addr, inter page offset, length of data in page)
# it's unlikely we'll ever need sub 4096 reads, but just in case
... | 0 | 0 | 0 | 0 | 0 | 0 |
firefly/version.py | fuzzygroup/firefly | 207 | 3360580 |
__version__ = "0.1.15"
| 0 | 0 | 0 | 0 | 0 | 0 |
lib/files/__init__.py | oslo254804746/AutoMationTest | 198 | 3360590 | import csv
import json
import os
from typing import Iterable, Any
import yaml
from openpyxl import load_workbook
class ReadFileData(object):
def __init__(self, path, **kwargs) -> None:
if not os.path.exists(path):
return
self.path = path
self.data: None = None
self.ex... | 0 | 5 | 0 | 1 | 6 | 0 |
test/examples/simple/reporting/test_reporting.py | rodrigomelo9/uvm-python | 140 | 3360602 | <gh_stars>100-1000
#
#//----------------------------------------------------------------------
#// Copyright 2007-2010 Mentor Graphics Corporation
#// Copyright 2007-2010 Cadence Design Systems, Inc.
#// Copyright 2010-2011 Synopsys, Inc.
#// Copyright 2019-2020 <NAME> (tpoikela)
#// All Rights Reserved World... | 0 | 0 | 0 | 0 | 0 | 0 |
desktop/dialog.py | overlord/sublimetext-markdown-preview | 1,563 | 3360604 | #!/usr/bin/env python
from __future__ import annotations
"""
Simple desktop dialogue box support for Python.
Copyright (C) 2007, 2009 <NAME> <<EMAIL>>
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Fou... | 17 | 16 | 30 | 1 | 64 | 0 |
arm/arm-sim.py | kevinyuan/pydgin | 159 | 3360609 | #=========================================================================
# arm-sim.py
#=========================================================================
import sys
# need to add parent directory to get access to pydgin package
# TODO: cleaner way to do this?
sys.path.append('..')
from pydgin.sim import... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/integration/test_sequence_viewer.py | omnombio/dash-bio | 430 | 3360639 | <filename>tests/integration/test_sequence_viewer.py
import json
import re
import dash
import dash_bio
import dash_html_components as html
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from commo... | 0 | 0 | 0 | 0 | 0 | 0 |
demos/temp_file.py | cuongptnk/imutils | 3,984 | 3360646 | # author: <NAME>
# website: http://www.pyimagesearch.com
# USAGE
# BE SURE TO INSTALL 'imutils' PRIOR TO EXECUTING THIS COMMAND
# python temp_file.py --image ../demo_images/bridge.jpg
# import the necessary packages
from __future__ import print_function
from imutils.io import TempFile
import argparse
import cv2... | 0 | 0 | 0 | 0 | 0 | 0 |
market_gym/lob/translator.py | quanttrade/rl_trading | 247 | 3360647 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Translate messages from files and from agents to the matching engine
@author: ucaiado
Created on 10/24/2016
"""
import pprint
import numpy as np
def translate_trades_to_agent(row, my_book):
'''
Translate the instruction passed by an agent into trades messages t... | 0 | 0 | 0 | 0 | 0 | 0 |
nnutils/train_utils.py | facebookresearch/banmo | 201 | 3360674 | # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
from __future__ import annotations
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import os
import os.path as osp
import sys
sys.path.insert(0,'third_... | 15 | 13 | 0 | 0 | 28 | 0 |
events/forms.py | Akash1S/meethub | 428 | 3360681 | from django import forms
from tinymce import TinyMCE
from .models import Event
class TinyMCEWidget(TinyMCE):
def use_required_attribute(self, *args) -> bool:
return False
class EventForm(forms.ModelForm):
details = forms.CharField(
widget=TinyMCEWidget(
attrs={'required':False,... | 0 | 1 | 1 | 0 | 2 | 0 |
WebMirror/management/rss_parser_funcs/feed_parse_extractNotsofriendlytranslationsWordpressCom.py | fake-name/ReadableWebProxy | 193 | 3360682 | <filename>WebMirror/management/rss_parser_funcs/feed_parse_extractNotsofriendlytranslationsWordpressCom.py
def extractNotsofriendlytranslationsWordpressCom(item):
'''
Parser for 'notsofriendlytranslations.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or v... | 0 | 0 | 0 | 0 | 0 | 0 |
typescript/commands/references.py | bertilnilsson/TypeScript-Sublime-Plugin | 1,688 | 3360703 | import sublime_plugin
from ..libs import *
from ..libs.view_helpers import *
from ..libs.reference import *
from .base_command import TypeScriptBaseTextCommand
class TypescriptFindReferencesCommand(TypeScriptBaseTextCommand):
"""Find references command"""
def run(self, text):
check_update_view(self.v... | 0 | 4 | 0 | 0 | 4 | 0 |
tryalgo/knapsack.py | fuez/tryalgo | 351 | 3360715 | <reponame>fuez/tryalgo
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""\
Knapsack
<NAME> et <NAME> - 2015-2019
"""
# snip{
def knapsack(p, v, cmax):
"""Knapsack problem: select maximum value set of items if total size not
more than capacity
:param p: table with size of items
:param v: table with va... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/spack/external/py2/functools32/functools32.py | player1537-forks/spack | 2,360 | 3360717 | <reponame>player1537-forks/spack
"""functools.py - Tools for working with functions and callable objects
"""
# Python module wrapper for _functools C module
# to allow utilities written in Python to be added
# to the functools module.
# Written by <NAME> <ncoghlan at g<EMAIL>>
# and <NAME> <python at rcn.com>
# Copyr... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/get_glslang.py | panthavma/Malt | 371 | 3360768 | import os, stat, platform, shutil, zipfile
current_dir = os.path.dirname(os.path.realpath(__file__))
gl_folder = os.path.join(current_dir, '..', 'Malt', 'GL')
zip_file = os.path.join(current_dir, 'glslang.zip')
glslang_url = {
'Windows' : "https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/577128_working_with_an_emails_headers/recipe-577128.py | tdiprima/code | 2,023 | 3360807 | <filename>recipes/Python/577128_working_with_an_emails_headers/recipe-577128.py
from __future__ import unicode_literals
import email, email.header, email.utils
def decode_header(value):
l = email.header.decode_header(value)
l2 = []
for value, charset in l:
if charset:
value = value.dec... | 0 | 0 | 0 | 0 | 0 | 0 |
data_gen/merl/make_dataset.py | libingzeng/nerfactor | 183 | 3360817 | <gh_stars>100-1000
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | 0 | 0 | 0 | 0 | 0 | 0 |
repokid/filters/age/__init__.py | followanalytics/repokid | 999 | 3360831 | <filename>repokid/filters/age/__init__.py<gh_stars>100-1000
# Copyright 2020 Netflix, 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-... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_regression_185.py | davimenezesoli/python-jsonschema-objects | 329 | 3360843 | import pytest
import python_jsonschema_objects as pjs
import jsonschema
import json
import copy
import pprint
pp = pprint.PrettyPrinter(indent=2)
lpid_class_schema = {
"$id": "https://example.com/schema-repository/lpid",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title":... | 0 | 0 | 1 | 0 | 1 | 0 |
test/sql/test_lateral.py | petit87/sqlalchemy | 5,383 | 3360863 | from sqlalchemy import Column
from sqlalchemy import column
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import join
from sqlalchemy import lateral
from sqlalchemy import String
from sqlalchemy import Table
from sqlalchemy import table
from sqlalchemy import testing
from sqlalchemy i... | 0 | 0 | 3 | 0 | 3 | 0 |
tests/conftest.py | lyz-code/pydantic-factories | 163 | 3360937 | import pytest
from motor.motor_asyncio import AsyncIOMotorClient
# mongo can be ran locally or using the docker-compose file at the repository's root
mongo_dsn = "mongodb://localhost:27017"
postgres_dsn = "postgresql+asyncpg://pydantic-factories:pydantic-factories@postgres:5432/pydantic-factories"
@pytest.fixture(s... | 0 | 1 | 0 | 0 | 1 | 0 |
PhysicsTools/PatAlgos/python/recoLayer0/duplicatedPhotons_cfi.py | ckamtsikis/cmssw | 852 | 3360946 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
# Remove duplicates from the photon list
photonsNoDuplicates = cms.EDFilter("DuplicatedPhotonCleaner",
## reco photon input source
photonSource = cms.InputTag("photons"),
## Algorithm used to clean.
## bySeed = using super... | 0 | 0 | 0 | 0 | 0 | 0 |
pastepwn/analyzers/databasedumpanalyzer.py | kiyanmair/pastepwn | 113 | 3360970 | <filename>pastepwn/analyzers/databasedumpanalyzer.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
from .regexanalyzer import RegexAnalyzer
class DatabaseDumpAnalyzer(RegexAnalyzer):
"""Analyzer to match database dump"""
name = "DatabaseDumpAnalyzer"
def __init__(self, actions):
"""
Analyzer ... | 0 | 0 | 0 | 0 | 0 | 0 |
app/grandchallenge/components/form_fields.py | kaczmarj/grand-challenge.org | 101 | 3360974 | from typing import Dict
from django import forms
from guardian.shortcuts import get_objects_for_user
from grandchallenge.cases.forms import IMAGE_UPLOAD_HELP_TEXT
from grandchallenge.components.models import InterfaceKind
from grandchallenge.components.schemas import INTERFACE_VALUE_SCHEMA
from grandchallenge.core.va... | 0 | 0 | 0 | 0 | 0 | 1 |
riemann/tests/tx/test_tx_builder.py | sturmianseq/riemann | 118 | 3360977 | import unittest
import riemann
from unittest import mock
from riemann.tests import helpers
from riemann.tx import tx_builder as tb
class TestTxBuilder(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
riemann.select_network('bitcoin_main')
def test_make_sh_output_script(self... | 0 | 0 | 0 | 0 | 0 | 0 |
mysqloperator/controller/kubeutils.py | sjmudd/mysql-operator | 206 | 3360989 | # Copyright (c) 2020, 2021, Oracle and/or its affiliates.
#
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
#
from typing import Callable, Optional, TypeVar
from kubernetes.client.rest import ApiException
from kubernetes import client, config
try:
# outside... | 1 | 1 | 5 | 0 | 7 | 0 |
pycraft/window.py | xeddmc/pycraft | 1,232 | 3361017 | <filename>pycraft/window.py
# 3rd party imports
import pyglet.clock
import pyglet.window
from pyglet.window import key, mouse
from pycraft.configuration import ConfigurationLoader
from pycraft.gamestate import GameStateManager, States
from pycraft.gs_running import GameStateRunning
class Window(pyglet.window.Window)... | 0 | 0 | 0 | 0 | 0 | 0 |
src/app/fixtures/factory.py | denkasyanov/education-backend | 151 | 3361040 | import pytest
from app.test.factory import FixtureFactory
from app.test.mixer import mixer as _mixer
@pytest.fixture
def mixer() -> object:
return _mixer
@pytest.fixture
def factory() -> object:
return FixtureFactory()
| 0 | 2 | 0 | 0 | 2 | 0 |
applications/admin/models/buttons.py | jessicadelrio/HandyHouse | 1,573 | 3361064 | # Template helpers
import os
def A_button(*a, **b) -> object:
b['_data-role'] = 'button'
b['_data-inline'] = 'true'
return A(*a, **b)
def button(href, label) -> object:
if is_mobile:
ret = A_button(SPAN(label), _href=href)
else:
ret = A(SPAN(label), _class='button btn', _href=hre... | 0 | 6 | 0 | 0 | 6 | 0 |
zentral/contrib/jamf/forms.py | sierra-hotel/zentral | 634 | 3361065 | <gh_stars>100-1000
import re
from django import forms
from django.utils.crypto import get_random_string
from zentral.contrib.inventory.models import BusinessUnit
from .models import JamfInstance, TagConfig
class JamfInstanceForm(forms.ModelForm):
password = forms.CharField(max_length=256, widget=forms.PasswordInp... | 0 | 0 | 0 | 0 | 0 | 0 |
cle/backends/xbe.py | Atipriya/cle | 317 | 3361070 | <filename>cle/backends/xbe.py
import logging
try:
from xbe import Xbe
except ImportError:
Xbe = None
import archinfo
from ..errors import CLEError
from . import Backend, register_backend
from .region import Segment, Section
l = logging.getLogger(name=__name__)
class XBESection(Section):
def __init__(se... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/performance/perf_load/perf_req_gen.py | Rob-S/indy-node | 627 | 3361103 | <reponame>Rob-S/indy-node
import logging
from abc import ABCMeta, abstractmethod
import json
import random
from indy import ledger
from perf_load.perf_clientstaistic import ClientStatistic
from perf_load.perf_utils import check_fs, random_string, get_type_field
class NoReqDataAvailableException(Exception):
pass
... | 0 | 0 | 0 | 0 | 0 | 0 |
segmentation_models/common/blocks.py | marcojoao/UNetPlusPlus | 1,621 | 3361112 | <filename>segmentation_models/common/blocks.py
from keras.layers import Conv2D
from keras.layers import Activation
from keras.layers import BatchNormalization
def Conv2DBlock(n_filters, kernel_size,
activation='relu',
use_batchnorm=True,
name='conv_block',
... | 0 | 0 | 0 | 0 | 0 | 0 |
reclist/metrics/standard_metrics.py | jacopotagliabue/reclist | 183 | 3361120 | from __future__ import annotations
import random
import itertools
import numpy as np
import collections
def statistics(x_train, y_train, x_test, y_test, y_pred) -> dict[str,object]:
train_size = len(x_train)
test_size = len(x_test)
# num non-zero preds
num_preds = len([p for p in y_pred if p])
ret... | 14 | 11 | 0 | 0 | 25 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.