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 |
|---|---|---|---|---|---|---|---|---|---|---|
scripts/geodata/statistics/tf_idf.py | Fillr/libpostal | 3,489 | 167501 | from __future__ import annotations
import math
from collections import defaultdict
class IDFIndex(object):
finalized: bool = False
def __init__(self):
self.idf_counts = defaultdict(int)
self.N: int = 0
def update(self, doc) -> None:
if self.finalized or not doc:
retur... | 1 | 4 | 1 | 1 | 7 | 0 |
recipes/Python/577713_Midpoint_of_two_GPS_points/recipe-577713.py | tdiprima/code | 2,023 | 167510 | <filename>recipes/Python/577713_Midpoint_of_two_GPS_points/recipe-577713.py
import math
def midpoint(x1, y1, x2, y2):
#Input values as degrees
#Convert to radians
lat1 = math.radians(x1)
lon1 = math.radians(x2)
lat2 = math.radians(y1)
lon2 = math.radians(y2)
bx = math.cos(lat2) * math.cos(lon2 -... | 0 | 0 | 0 | 0 | 0 | 0 |
grammar/python/input.py | Grommish/colm | 269 | 167537 | <filename>grammar/python/input.py
# dude, this is a comment
# some more
hello
def dude():
yes
awesome;
# Here we have a comment
def realy_awesome(): # hi there
in_more
same_level
def one_liner(): first; second # both inside one_liner
back_down
last_statement
# dude, this is ... | 0 | 0 | 0 | 0 | 0 | 0 |
fastweb/task.py | BSlience/fastweb | 123 | 167549 | # coding:utf8
"""消费者模块"""
import os
import sys
import json
from multiprocessing import Process
from fastweb import app
from fastweb.manager import Manager
from fastweb.util.tool import timing
from fastweb.exception import TaskError
from fastweb.component.task import Task
from fastweb.util.python import load_object
f... | 0 | 4 | 2 | 2 | 8 | 0 |
python/python-pyodbc/pyodbc Pandas.py | josephobonyo/sigma_coding_youtube | 893 | 167569 | import pyodbc
import pandas
# Define our Query to create the table.
create_table_query = """
-- Create the Table if it Does not exist.
IF Object_ID('youtube_videos') IS NULL
CREATE TABLE [sigma-coding].[dbo].[youtube_videos]
(
[video_id] NVARCHAR(MAX) NOT NULL,
[published_at] DATETIME NULL,
[channel_id] N... | 0 | 0 | 3 | 0 | 3 | 0 |
boto3_type_annotations_with_docs/boto3_type_annotations/redshift/waiter.py | cowboygneox/boto3_type_annotations | 119 | 167589 | <filename>boto3_type_annotations_with_docs/boto3_type_annotations/redshift/waiter.py
from typing import Dict
from datetime import datetime
from typing import List
from botocore.waiter import Waiter
class ClusterAvailable(Waiter):
def wait(self, ClusterIdentifier: str = None, MaxRecords: int = None, Marker: str = ... | 0 | 0 | 0 | 0 | 0 | 0 |
nautobot/virtualization/graphql/types.py | psmware-ltd/nautobot | 384 | 167596 | <gh_stars>100-1000
import graphene
import graphene_django_optimizer as gql_optimizer
from nautobot.virtualization.models import VirtualMachine, VMInterface
from nautobot.virtualization.filters import VirtualMachineFilterSet, VMInterfaceFilterSet
class VirtualMachineType(gql_optimizer.OptimizedDjangoObjectType):
... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_q_learner.py | nikdnaik/metaqnn | 136 | 167607 | <gh_stars>100-1000
from libs.grammar.q_learner import QLearner, QValues
from libs.grammar import state_enumerator as se
import needed_for_testing.hyper_parameters as hp
import needed_for_testing.state_space_parameters as ssp
from test_base import Test
import pandas as pd
import numpy as np
class TestQLearner(Test):
... | 0 | 0 | 0 | 0 | 0 | 0 |
tacotron/prepro.py | KanapaZombie/css10 | 369 | 167611 | # -*- coding: utf-8 -*-
#/usr/bin/python2
'''
By <NAME> and <NAME>. <EMAIL>. <EMAIL>.
https://www.github.com/kyubyong/tacotron
'''
from __future__ import print_function
from multiprocessing import Process, Pool
from utils import load_spectrograms
import os
from data_load import load_data
import numpy as np
import tqd... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/unit/types/message/test_message.py | Rohitpandit021/jina | 15,179 | 167620 | <reponame>Rohitpandit021/jina
import sys
import pytest
from jina import Document
from jina.clients.request import request_generator
from jina.proto import jina_pb2
from jina.types.message import Message
from jina.types.request import _trigger_fields, Request
from jina.enums import CompressAlgo
from tests import rando... | 0 | 0 | 0 | 0 | 0 | 0 |
src/scripts/python_unittests.py | clayne/botan | 1,988 | 167625 | #!/usr/bin/env python3
"""
Unittests for Botan Python scripts.
Requires Python 3.
(C) 2017 <NAME> (Kullo GmbH)
Botan is released under the Simplified BSD License (see license.txt)
"""
import sys
import unittest
sys.path.append("../..") # Botan repo root
from configure import AmalgamationHelper # pylint: disable=w... | 0 | 0 | 0 | 0 | 0 | 0 |
minidump/minidumpfile.py | mrexodia/minidump | 215 | 167664 | <filename>minidump/minidumpfile.py<gh_stars>100-1000
#!/usr/bin/env python3
#
# Author:
# <NAME> (@skelsec)
#
import io
import sys
import enum
import struct
import logging
from minidump.header import MinidumpHeader
from minidump.minidumpreader import MinidumpFileReader
from minidump.streams import *
from minidump.co... | 0 | 0 | 0 | 0 | 0 | 0 |
convokit/forecaster/__init__.py | sophieball/Cornell-Conversational-Analysis-Toolkit | 371 | 167675 | from .forecaster import *
from .forecasterModel import *
from .cumulativeBoW import *
import sys
if 'torch' in sys.modules:
from .CRAFTModel import *
from .CRAFT import *
| 0 | 0 | 0 | 0 | 0 | 0 |
test/feature_relevant.py | loongson-zn/build | 215 | 167682 | #!/usr/bin/python
# Copyright 2018 <NAME>
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or copy at
# https://www.bfgroup.xyz/b2/LICENSE.txt)
# Tests the <relevant> feature
import BoostBuild
t = BoostBuild.Tester(use_test_config=False)
t.write("xxx.jam", """
impor... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/580795_bind_all_tkinter_bug/recipe-580795.py | tdiprima/code | 2,023 | 167700 | <gh_stars>1000+
from __future__ import print_function
import sys
import collections
import functools
_handlers = collections.defaultdict(list)
def _run_handlers(list_of_handlers, event):
exc_info = None
for func in list_of_handlers:
try:
func(event)
except SystemExit:
... | 0 | 0 | 0 | 0 | 0 | 0 |
easyreg/compare_sym.py | ebrahimebrahim/easyreg | 107 | 167702 | <reponame>ebrahimebrahim/easyreg
import torch
import numpy as np
import sys,os
import SimpleITK as sitk
from easyreg.net_utils import Bilinear
import ants
from .nifty_reg_utils import nifty_reg_resample
import subprocess
import nibabel as nib
from mermaid.utils import identity_map_multiN
# record_path ='/playpen/zys... | 0 | 0 | 0 | 0 | 0 | 0 |
fabfile/copyright.py | weimens/seahub | 420 | 167722 | # Copyright (c) 2012-2016 Seafile Ltd.
import os
from fabric.api import task
@task
def update(path):
"""Add copyright stuff to the begining of files.
"""
for filename in path_to_pyfile_list(path):
do_update(filename)
@task
def check(path):
"""Check copyright stuff for files.
"""
for f... | 0 | 3 | 0 | 0 | 3 | 0 |
python/pycarbon/tests/mnist/dataset_with_unischema/tests/test_tf_mnist_carbon.py | shunlean/carbondata | 1,083 | 167740 | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | 0 | 0 | 0 | 0 | 0 | 0 |
mmedit/core/export/wrappers.py | Jian137/mmediting-1 | 1,884 | 167780 | # Copyright (c) OpenMMLab. All rights reserved.
from __future__ import annotations
import os.path as osp
import warnings
import numpy as np
import onnxruntime as ort
import torch
from torch import nn
from mmedit.models import BaseMattor, BasicRestorer, build_model
def inference_with_session(sess, io_binding, output... | 6 | 5 | 0 | 0 | 11 | 0 |
assignment1/q2_neural.py | bogatyy/cs224d | 254 | 167787 | import numpy as np
import random
from q1_softmax import softmax
from q2_sigmoid import sigmoid, sigmoid_grad
from q2_gradcheck import gradcheck_naive
def forward_backward_prop(data, labels, params, dimensions):
"""
Forward and backward propagation for a two-layer sigmoidal network
Compute the forwa... | 0 | 0 | 0 | 0 | 0 | 0 |
ci/check_changed_files.py | mb0rt/OpenCue | 334 | 167806 | <gh_stars>100-1000
#!/usr/bin/env python
"""Script that checks if files were changed which should not be.
This script is meant to be run in the context or GitHub Actions, and expects all changed files
to be passed via commandline, like:
$ ci/check_changed_files.py file/that/was/changed.txt other/file/changed.py
""... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow/security/fuzzing/raggedCountSparseOutput_fuzz.py | EricRemmerswaal/tensorflow | 190,993 | 167813 | # 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 required by applica... | 0 | 0 | 0 | 0 | 0 | 0 |
testing/test_threadexception.py | markshao/pytest | 9,225 | 167825 | <gh_stars>1000+
import sys
import pytest
from _pytest.pytester import Pytester
if sys.version_info < (3, 8):
pytest.skip("threadexception plugin needs Python>=3.8", allow_module_level=True)
@pytest.mark.filterwarnings("default::pytest.PytestUnhandledThreadExceptionWarning")
def test_unhandled_thread_exception(... | 0 | 0 | 0 | 0 | 0 | 0 |
rtests/test_dataset.py | cameronchoi/r3det-docker | 176 | 167841 | <reponame>cameronchoi/r3det-docker<gh_stars>100-1000
from mmcv import Config
import numpy as np
from mmdet.datasets import build_dataset, build_dataloader
import matplotlib
import matplotlib.pyplot as plt
import math
matplotlib.use('Qt5Agg')
def draw(fig, img, boxes, ignore_bboxes):
ax = fig.add_subplot(111)
... | 0 | 0 | 0 | 0 | 0 | 0 |
aliyun/log/etl_core/restrict_config_parser.py | topdown618/aliyun-log-python-sdk | 130 | 167864 | import ast
import logging
import six
import sys
TRUST_AST_TYPES = (ast.Call, ast.Module, ast.List, ast.Tuple, ast.Dict, ast.Name, ast.Num, ast.Str,
ast.Assign, ast.Load)
if sys.version_info[:2] == (3, 3):
TRUST_AST_TYPES = TRUST_AST_TYPES + (ast.Bytes,)
elif six.PY3:
TRUST_AST_TYPES = TRUS... | 0 | 0 | 0 | 0 | 0 | 0 |
bmtk/simulator/filternet/lgnmodel/kernel.py | aaberbach/bmtk | 216 | 167887 | <reponame>aaberbach/bmtk
import matplotlib as mpl
from matplotlib import cm
import numpy as np
import matplotlib.pyplot as plt
def find_l_r_in_t_range(t_range, t):
for tl in range(len(t_range)-1):
tr = tl+1
test_val = (t_range[tl]-t)*(t_range[tr]-t)
if np.abs(test_val) < 1e-16:
... | 0 | 0 | 0 | 0 | 0 | 0 |
vedastr/models/bodies/sequences/transformer/__init__.py | csmasters/vedastr | 475 | 167900 | from .encoder import TransformerEncoder
from .decoder import TransformerDecoder
| 0 | 0 | 0 | 0 | 0 | 0 |
torchbenchmark/models/Background_Matting/Data_adobe/compose.py | Chillee/benchmark | 384 | 167916 | <gh_stars>100-1000
##Copyright 2017 Adobe Systems 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 app... | 0 | 0 | 0 | 0 | 0 | 0 |
external/anomaly/ote_anomalib/exportable_code/__init__.py | bes-dev/training_extensions | 775 | 167925 | <reponame>bes-dev/training_extensions
"""Exportable code for Anomaly tasks."""
# Copyright (C) 2021-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
from .anomaly_classification import AnomalyClassification
from .anomaly_detection import AnomalyDetection
from .anomaly_segmentation import AnomalySegmenta... | 0 | 0 | 0 | 0 | 0 | 0 |
account/urls.py | Moniter123/saltshaker | 343 | 167966 | """saltshaker URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... | 0 | 0 | 0 | 0 | 0 | 0 |
src/koalarization/evaluate.py | baldassarreFe/deep-koalarization | 413 | 168007 | import argparse
from pathlib import Path
import tensorflow as tf
from keras import backend as K
from .network_definition import Colorization
from .training_utils import (
evaluation_pipeline,
checkpointing_system,
plot_evaluation,
metrics_system,
)
parser = argparse.ArgumentParser(description="Eval")... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/print_cur_tb.py | cclauss/traceback_with_variables | 550 | 168031 | from traceback_with_variables import print_cur_tb # , format_cur_tb, iter_cur_tb_lines
def f(n) -> object:
print_cur_tb()
# cur_tb_str = format_cur_tb()
# cur_tb_lines = list(iter_cur_tb_lines())
return n + 1
def main():
f(10)
main()
| 0 | 1 | 0 | 0 | 1 | 0 |
examples/paper_generation_code/2020-03-2-cluster-single_ephys_inferrence_full_file.py | CoMind-Technologies/deepinterpolation | 178 | 168079 | import os
import sys
from pbstools import PythonJob
from shutil import copyfile
import datetime
import numpy as np
python_file = r"/home/jeromel/Documents/Projects/Deep2P/repos/deepinterpolation/examples/cluster_lib/generic_ephys_process_sync.py"
output_folder = "/allen/programs/braintv/workgroups/neuralcoding/Neurop... | 0 | 0 | 0 | 0 | 0 | 0 |
colour/examples/plotting/examples_corresponding.py | rift-labs-developer/colour | 1,380 | 168084 | # -*- coding: utf-8 -*-
"""
Showcases corresponding chromaticities prediction plotting examples.
"""
from colour.plotting import (colour_style,
plot_corresponding_chromaticities_prediction)
from colour.utilities import message_box
message_box('Corresponding Chromaticities Prediction Plots... | 0 | 0 | 0 | 0 | 0 | 0 |
crabageprediction/venv/Lib/site-packages/numpy/typing/tests/data/pass/lib_version.py | 13rianlucero/CrabAgePrediction | 20,453 | 168118 | <filename>crabageprediction/venv/Lib/site-packages/numpy/typing/tests/data/pass/lib_version.py
from numpy.lib import NumpyVersion
version = NumpyVersion("1.8.0")
version.vstring
version.version
version.major
version.minor
version.bugfix
version.pre_release
version.is_devversion
version == version
version != version
... | 0 | 0 | 0 | 0 | 0 | 0 |
etcd3/members.py | blockspacer/python-etcd3 | 362 | 168129 | <filename>etcd3/members.py
class Member(object):
"""
A member of the etcd cluster.
:ivar id: ID of the member
:ivar name: human-readable name of the member
:ivar peer_urls: list of URLs the member exposes to the cluster for
communication
:ivar client_urls: list of URLs the ... | 0 | 0 | 0 | 0 | 0 | 0 |
bin/api_connector_splunk/solnlib/packages/schematics/models.py | CyberGRX/api-connector-splunk | 106 | 168133 | <reponame>CyberGRX/api-connector-splunk<filename>bin/api_connector_splunk/solnlib/packages/schematics/models.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from copy import deepcopy
import inspect
import itertools
from types import FunctionType
from .common import * # pylint: dis... | 0 | 0 | 0 | 0 | 0 | 0 |
JetMETCorrections/Modules/python/JetResolutionESProducer_cfi.py | ckamtsikis/cmssw | 852 | 168180 | import FWCore.ParameterSet.Config as cms
JetResolutionESProducer_AK4PFchs = cms.ESProducer("JetResolutionESProducer",
label = cms.string('AK4PFchs')
)
JetResolutionESProducer_SF_AK4PFchs = cms.ESProducer("JetResolutionScaleFactorESProducer",
label = cms.string('AK4PFchs')
)
| 0 | 0 | 0 | 0 | 0 | 0 |
package/kedro_viz/data_access/repositories/graph.py | deepyaman/kedro-viz | 125 | 168187 | """`kedro_viz.data_access.repositories.graph` defines interface to
centralise access to graph objects."""
# pylint: disable=missing-class-docstring,missing-function-docstring
from typing import Dict, Generator, List, Optional, Set
from kedro_viz.models.graph import GraphEdge, GraphNode
class GraphNodesRepository:
... | 7 | 9 | 0 | 3 | 19 | 0 |
src/lib/models/networks/config/__init__.py | MLDSAI/FairMOT | 3,473 | 168209 | from .default import _C as cfg
from .default import update_config | 0 | 0 | 0 | 0 | 0 | 0 |
demo/infer_demo.py | mrlooi/maskrcnn-benchmark | 344 | 168231 | <filename>demo/infer_demo.py
from maskrcnn_benchmark.config import cfg
from predictor import COCODemo, LOVDemo
import numpy as np
import torch
import torch.nn.functional as F
import glob
import cv2
def expand_boxes(boxes, scale):
w_half = (boxes[:, 2] - boxes[:, 0]) * .5
h_half = (boxes[:, 3] - boxes[:, 1])... | 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/home_connect/__init__.py | liangleslie/core | 30,023 | 168270 | <gh_stars>1000+
"""Support for BSH Home Connect appliances."""
from datetime import timedelta
import logging
from requests import HTTPError
import voluptuous as vol
from homeassistant.components.application_credentials import (
ClientCredential,
async_import_client_credential,
)
from homeassistant.config_ent... | 0 | 0 | 0 | 0 | 0 | 0 |
chainer_chemistry/dataset/networkx_preprocessors/base_networkx.py | pfnet/chainerchem | 184 | 168322 | import networkx
import numpy
import chainer
from chainer_chemistry.dataset.graph_dataset.base_graph_dataset import PaddingGraphDataset, SparseGraphDataset # NOQA
from chainer_chemistry.dataset.graph_dataset.base_graph_data import PaddingGraphData, SparseGraphData # NOQA
from chainer_chemistry.dataset.graph_dataset.f... | 1 | 7 | 0 | 0 | 8 | 0 |
py_backwards/conf.py | graingert/py-backwards | 338 | 168334 | <reponame>graingert/py-backwards<gh_stars>100-1000
from argparse import Namespace
class Settings:
def __init__(self) -> None:
self.debug = False
settings = Settings()
def init_settings(args: Namespace) -> None:
if args.debug:
settings.debug = True
| 0 | 0 | 0 | 0 | 0 | 0 |
rx/core/operators/materialize.py | mmpio/RxPY | 4,342 | 168398 | <filename>rx/core/operators/materialize.py
from typing import Callable
from rx.core import Observable
from rx.core.notification import OnNext, OnError, OnCompleted
def _materialize() -> Callable[[Observable], Observable]:
def materialize(source: Observable) -> Observable:
"""Partially applied materialize ... | 0 | 0 | 0 | 0 | 0 | 0 |
arelle/plugin/loadFromOIM-2018.py | hamscher/Arelle | 292 | 168439 | from __future__ import annotations
'''
loadFromExcel.py is an example of a plug-in that will load an extension taxonomy from Excel
input and optionally save an (extension) DTS.
(c) Copyright 2016 Mark V Systems Limited, All rights reserved.
Example to run from web server:
1) POSTing excel in a zip, getting instance ... | 1 | 10 | 0 | 2 | 13 | 0 |
packaging/setup/ovirt_engine_setup/firewall_manager_base.py | hbraha/ovirt-engine | 347 | 168468 | <reponame>hbraha/ovirt-engine<gh_stars>100-1000
#
# ovirt-engine-setup -- ovirt engine setup
#
# Copyright oVirt Authors
# SPDX-License-Identifier: Apache-2.0
#
#
"""
Firewall manager base
"""
from otopi import base
from otopi import util
@util.export
class FirewallManagerBase(base.Base):
def __init__(self, ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/r/test_minard_troops.py | hajime9652/observations | 199 | 168480 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.minard_troops import minard_troops
def test_minard_troops():
"""Test module minard_troops.py by downloading
minard_troops.csv and testing sha... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/578454_Puzzle_Four_cubes_different_colors_their/recipe-578454.py | tdiprima/code | 2,023 | 168502 | <reponame>tdiprima/code
"""
@author <NAME>
@file four_cubes_problem.py
There are four cubes with concrete colors on their sides and the goal
is to place each cube in one row that way, that along the row each side
presents four different colors:
- - - -
|W| |R| |G| |B| (front v... | 0 | 0 | 0 | 0 | 0 | 0 |
z3/seseman.py | Wikunia/hakank | 279 | 168509 | <filename>z3/seseman.py
#!/usr/bin/python -u
# -*- coding: latin-1 -*-
#
# Seseman Convent problem in Z3
#
# n is the length of a border
# There are (n-2)^2 "holes", i.e.
# there are n^2 - (n-2)^2 variables to find out.
#
# The simplest problem, n = 3 (n x n matrix)
# which is represented by the following matrix:
#
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_papermill.py | karthik20122001/docker-python | 2,030 | 168535 | import unittest
import subprocess
class TestPapermill(unittest.TestCase):
def test_papermill(self):
result = subprocess.run([
'papermill',
'/input/tests/data/notebook.ipynb',
'-',
], stdout=subprocess.PIPE)
self.assertEqual(0, result.returncode)
... | 0 | 0 | 0 | 0 | 0 | 0 |
scvelo/preprocessing/__init__.py | WeilerP/scvelo | 272 | 168538 | <filename>scvelo/preprocessing/__init__.py
from .moments import moments
from .neighbors import neighbors, pca, remove_duplicate_cells
from .utils import (
cleanup,
filter_and_normalize,
filter_genes,
filter_genes_dispersion,
log1p,
normalize_per_cell,
recipe_velocity,
show_proportions,
)... | 0 | 0 | 0 | 0 | 0 | 0 |
codigo/Live36/functions.py | cassiasamp/live-de-python | 572 | 168539 | <reponame>cassiasamp/live-de-python<filename>codigo/Live36/functions.py<gh_stars>100-1000
from json import dump
from re import sub
from bs4 import BeautifulSoup as bs
from requests import get
def pretty_format(bs_list):
return ''.join(map(lambda x: sub(r'</?(br|p)/?>', ' ', str(x)),
bs_list... | 0 | 0 | 0 | 0 | 0 | 0 |
datar/forcats/__init__.py | pdwaggoner/datar | 110 | 168554 | <reponame>pdwaggoner/datar
"""Port of forcats"""
from .lvl_order import (
as_factor,
fct_relevel,
fct_inorder,
fct_infreq,
fct_inseq,
fct_reorder,
fct_reorder2,
fct_rev,
fct_shift,
fct_shuffle,
first2,
last2,
)
from .lvl_value import (
fct_anon,
fct_collapse,
... | 0 | 0 | 0 | 0 | 0 | 0 |
test/integration/__init__.py | KernelErr/b2-sdk-python | 128 | 168569 | ######################################################################
#
# File: test/integration/__init__.py
#
# Copyright 2020 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
import os
def get_b2_au... | 0 | 1 | 0 | 0 | 1 | 0 |
Greedy/861. Score After Flipping Matrix.py | beckswu/Leetcode | 138 | 168591 | <gh_stars>100-1000
class Solution:
def matrixScore(self, A):
"""
:type A: List[List[int]]
:rtype: int
"""
if not A or not A[0]: return 0
n, m = len(A), len(A[0])
tot = n*2**(m-1)
for i in range(1, m):
zero = sum(A[j][0]^A[j][i] fo... | 0 | 0 | 0 | 0 | 0 | 0 |
desktop/core/ext-py/pyu2f-0.1.4/pyu2f/tests/apdu_test.py | yetsun/hue | 5,079 | 168594 | # Copyright 2016 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 ag... | 0 | 0 | 0 | 0 | 0 | 0 |
theo/version.py | dandycheung/theo | 233 | 168599 | __version__ = "v0.8.2"
| 0 | 0 | 0 | 0 | 0 | 0 |
test/example.py | FrancescoSaverioZuppichini/mirror | 234 | 168606 | <filename>test/example.py
from mirror.visualisations.core import Visualisation
from mirror.visualisations.web import WebInterface
from functools import partial
class RepeatInput(Visualisation):
def __call__(self, inputs, layer, repeat=1, *args, **kwargs):
return inputs.repeat(repeat, 1, 1, 1), None
par... | 0 | 0 | 0 | 0 | 0 | 0 |
mdutils/tools/MDList.py | Alexmod/mdutils | 110 | 168623 | <filename>mdutils/tools/MDList.py
# Python
#
# This module implements tests for Header class.
#
# This file is part of mdutils. https://github.com/didix21/mdutils
#
# MIT License: (C) 2020 <NAME>
import re
class MDListHelper:
def __init__(self):
self.n_tabs = 0
def _get_unordered_markdown_list(self, ... | 0 | 0 | 0 | 0 | 0 | 0 |
OpenAttack/metric/selectors/semantic.py | e-tornike/OpenAttack | 444 | 168634 | from .base import MetricSelector
class SemanticSimilarity(MetricSelector):
"""
:English: :py:class:`.UniversalSentenceEncoder`
"""
def _select(self, lang) -> object:
if lang.name == "english":
from ..algorithms.usencoder import UniversalSentenceEncoder
return UniversalSe... | 0 | 1 | 0 | 0 | 1 | 0 |
model-optimizer/extensions/front/onnx/clip_ext.py | monroid/openvino | 2,406 | 168636 | <reponame>monroid/openvino
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import logging as log
import numpy as np
from mo.front.extractor import FrontExtractorOp
from mo.front.onnx.extractors.utils import onnx_attr, get_onnx_opset_version, onnx_node_has_attr
from mo.ops.clamp impo... | 0 | 0 | 0 | 0 | 0 | 0 |
DQMOffline/Trigger/python/SoftMuHardJetMETSUSYMonitor_cff.py | ckamtsikis/cmssw | 852 | 168640 | # Offline DQM for HLT_Mu3er1p5_PFJet100er2p5_PFMETX_PFMHTX_IDTight (X = 70, 80, 90)
# <NAME> 2018
import FWCore.ParameterSet.Config as cms
from DQMOffline.Trigger.SusyMonitor_cfi import hltSUSYmonitoring
SoftMuHardJetMETSUSYmonitoring = hltSUSYmonitoring.clone()
SoftMuHardJetMETSUSYmonitoring.FolderName = cms.string... | 0 | 0 | 0 | 0 | 0 | 0 |
python/ql/test/library-tests/frameworks/fastapi/router.py | angie1148/codeql | 643 | 168648 | <filename>python/ql/test/library-tests/frameworks/fastapi/router.py
# like blueprints in Flask
# see https://fastapi.tiangolo.com/tutorial/bigger-applications/
# see basic.py for instructions for how to run this code.
from fastapi import APIRouter, FastAPI
inner_router = APIRouter()
@inner_router.get("/foo") # $ ro... | 0 | 0 | 0 | 0 | 0 | 0 |
aliyun/log/es_migration/migration_response.py | topdown618/aliyun-log-python-sdk | 130 | 168659 | #!/usr/bin/env python
# encoding: utf-8
# Copyright (C) Alibaba Cloud Computing
# All rights reserved.
from __future__ import annotations
from ..logresponse import LogResponse
class MigrationResponse(LogResponse):
def __init__(self, headers: object | None=None, resp: str=""):
LogResponse.__init__(self,... | 2 | 0 | 0 | 0 | 2 | 0 |
docs/src/test/python/test_save_load.py | rs992214/keanu | 153 | 168681 | from keanu.vertex import Gamma
from keanu import BayesNet
from keanu.network_io import ProtobufLoader, JsonLoader, ProtobufSaver, DotSaver, JsonSaver
def test_can_save_and_load(tmpdir) -> None:
PROTO_FILE_NAME = str(tmpdir.join("test.proto"))
JSON_FILE_NAME = str(tmpdir.join("test.json"))
DOT_FILE_NAME = s... | 0 | 1 | 0 | 0 | 1 | 0 |
packages/jet_bridge_base/jet_bridge_base/utils/exceptions.py | bokal2/jet-bridge | 1,247 | 168688 | from __future__ import annotations
import re
import six
from sqlalchemy import inspect
from jet_bridge_base.exceptions.validation_error import ValidationError
def serialize_validation_error(exc) -> dict[object,object] | dict[str,list[object]] | list[object] | object:
def process(e, root: bool=False) -> dict[obj... | 1 | 3 | 0 | 0 | 4 | 0 |
chapter5_operations/prediction_monitoring_pattern/src/db/schemas.py | sudabon/ml-system-in-actions | 133 | 168709 | <reponame>sudabon/ml-system-in-actions
import datetime
from typing import Dict
from pydantic import BaseModel
class PredictionLogBase(BaseModel):
log_id: str
log: Dict
class PredictionLog(PredictionLogBase):
created_datetime: datetime.datetime
class Config:
orm_mode = True
class OutlierL... | 0 | 0 | 0 | 0 | 0 | 0 |
bcs-ui/backend/templatesets/legacy_apps/configuration/yaml_mode/deployer.py | laodiu/bk-bcs | 599 | 168778 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in complianc... | 1 | 1 | 0 | 0 | 2 | 0 |
pydata-chicago/shallow.py | Danielli-Itai/TfFizzBuzz | 900 | 168800 | <reponame>Danielli-Itai/TfFizzBuzz<gh_stars>100-1000
from keras.models import Sequential
from keras.layers import Dense, Activation
from plots import *
import numpy as np
def fizz_buzz_encode(i):
"""encodes the desired fizz-buzz output as a one-hot array of length 4:
[number, "fizz", "buzz", "fizzbuzz"]"""
... | 0 | 0 | 0 | 0 | 0 | 0 |
kaggle_humpback/models/model_factory.py | maxjeblick/kaggle-humpback | 167 | 168830 | <reponame>maxjeblick/kaggle-humpback
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch.nn as nn
import torch.nn.functional as F
import pretrainedmodels
def get_pretrainedmodels(model_name='resnet18', num_outputs=None, pretrained=True, **_):
... | 0 | 0 | 0 | 0 | 0 | 0 |
learn-decimal.py | ramoslin02/51bitqunt | 201 | 168922 | # 如何利用decimal库来处理小数点问题
# 学习如何使用decimal库来处理小数点
# 文档地址: https://docs.python.org/zh-cn/3/library/decimal.html
value1 = 0.0000223233
print(value1)
value2 =str("0.0000223233")
print(value2)
## 四则运算
from decimal import Decimal, ROUND_UP, ROUND_DOWN
a = Decimal(10)
print(a, type(a))
b = Decimal(10.12) # 二进制方式存储的
prin... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_nested_issue55.py | alekseyl1992/pyrobuf | 578 | 168924 | import unittest
M = None
MN = None
MN2 = None
class NestedTest(unittest.TestCase):
"""
Verifies we can create instance from nested proto file.
https://github.com/appnexus/pyrobuf/issues/55
"""
@classmethod
def setUpClass(cls):
global M
global MN
global MN2
fro... | 0 | 0 | 0 | 0 | 0 | 0 |
maskrcnn_benchmark/modeling/rroi_heads/mask_head/roi_mask_classifiers.py | mrlooi/maskrcnn-benchmark | 344 | 168936 | <reponame>mrlooi/maskrcnn-benchmark
from torch import nn
from torch.nn import functional as F
from maskrcnn_benchmark.layers import Conv2d
from maskrcnn_benchmark.layers import ConvTranspose2d
# from maskrcnn_benchmark.modeling import registry
# @registry.ROI_MASK_PREDICTOR.register("MaskRCNNC4Classifier")
class Mas... | 0 | 0 | 0 | 0 | 0 | 0 |
corehq/apps/smsbillables/migrations/0011_date_to_datetime.py | dimagilg/commcare-hq | 471 | 168951 | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('smsbillables', '0010_gateway_fee_amount_null'),
]
operations: list[object] = [
migrations.AlterField(
model_name='smsbillable',
name='date_cre... | 0 | 0 | 2 | 0 | 2 | 0 |
tests/test_get_dnskey.py | rborden-appsec/yawast | 200 | 168991 | # Copyright (c) 2013 - 2019 <NAME> and Contributors.
# This file is part of YAWAST which is released under the MIT license.
# See the LICENSE file or go to https://yawast.org/license/ for full license details.
from unittest import TestCase
from tests import utils
from yawast.scanner.plugins.dns import dnssec
from ... | 0 | 0 | 0 | 0 | 0 | 0 |
maskrcnn_benchmark/modeling/rrpn/anchor_generator.py | mrlooi/maskrcnn-benchmark | 344 | 169040 | <filename>maskrcnn_benchmark/modeling/rrpn/anchor_generator.py
import numpy as np
import cv2
import torch
from maskrcnn_benchmark.structures.bounding_box import BoxList
from maskrcnn_benchmark.structures.segmentation_mask import SegmentationMask
class AnchorGenerator(torch.nn.Module):
"""
For a set of image s... | 0 | 0 | 0 | 0 | 0 | 0 |
rls/nn/represents/vectors.py | StepNeverStop/RLs | 371 | 169043 | import math
import torch.nn as nn
from rls.nn.activations import Act_REGISTER, default_act
Vec_REGISTER = {}
class VectorIdentityNetwork(nn.Sequential):
def __init__(self, in_dim, *args, **kwargs):
super().__init__()
self.h_dim = self.in_dim = in_dim
self.add_module(f'identity', nn.Ide... | 1 | 0 | 0 | 0 | 1 | 0 |
h5Nastran/h5Nastran/h5/nastran/input/dynamic.py | ACea15/pyNastran | 293 | 169099 | <filename>h5Nastran/h5Nastran/h5/nastran/input/dynamic.py
from __future__ import print_function, absolute_import
from collections import defaultdict
from six.moves import range
from six import iteritems
from h5Nastran.defaults import Defaults
from h5Nastran.h5nastrannode import H5NastranNode
from .input_table import... | 0 | 0 | 0 | 0 | 0 | 0 |
nativedroid/nativedroid/analyses/resolver/annotation/jfield_id_annotation.py | CherishAZ/Argus-SAF | 152 | 169104 | <filename>nativedroid/nativedroid/analyses/resolver/annotation/jfield_id_annotation.py
from claripy import Annotation
__author__ = "<NAME>, <NAME>"
__copyright__ = "Copyright 2018, The Argus-SAF Project"
__license__ = "Apache v2.0"
class JfieldIDAnnotation(Annotation):
"""
This annotation is used to store jf... | 0 | 0 | 0 | 0 | 0 | 0 |
test-integration/test_integration/fixtures/failing-project/predict.py | VictorXLR/cog | 354 | 169128 | <filename>test-integration/test_integration/fixtures/failing-project/predict.py
import cog
class Predictor(cog.Predictor):
def setup(self):
pass
@cog.input("text", type=str)
def predict(self, text):
raise Exception("over budget")
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/__init__.py | valleyin-jarvis/get_suggest_word_API | 245 | 169142 | <filename>tests/__init__.py<gh_stars>100-1000
"""Test module for tornado_json"""
| 0 | 0 | 0 | 0 | 0 | 0 |
benchmarks/logs/microbenchmarks/single_regex/runtuplex.py | rahulyesantharao/tuplex | 778 | 169172 | <reponame>rahulyesantharao/tuplex
import time
import argparse
import json
import os
import glob
import sys
parser = argparse.ArgumentParser(description="Apache data cleaning + join")
parser.add_argument(
"--path",
type=str,
dest="data_path",
default="../../test/resources/2000.01.01.txt",
help="path... | 0 | 0 | 0 | 0 | 0 | 0 |
cantools/database/diagnostics/data.py | malneni/cantools | 117 | 169175 | # DID data.
from typing import Optional
from cantools.typechecking import ByteOrder, Choices
class Data(object):
"""A data data with position, size, unit and other information. A data
is part of a DID.
"""
def __init__(self,
name: str,
start: int,
... | 11 | 3 | 0 | 10 | 24 | 0 |
tests/st/ops/cpu/test_argminwithvalue_op.py | GuoSuiming/mindspore | 3,200 | 169176 | <reponame>GuoSuiming/mindspore
# Copyright 2019 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
bin/bench/fake-commit-gen.py | Priya-100/repoxplorer | 107 | 169177 | #!/usr/bin/python
# Copyright 2016, <NAME>
#
# 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 ... | 2 | 4 | 0 | 0 | 6 | 0 |
git_code_debt/util/iter.py | boidolr/git-code-debt | 213 | 169183 | <filename>git_code_debt/util/iter.py
import itertools
from typing import Generator
from typing import Iterable
from typing import Tuple
from typing import TypeVar
T = TypeVar('T')
def chunk_iter(
iterable: Iterable[T],
n: int,
) -> Generator[Tuple[T, ...], None, None]:
"""Yields an iterator in ch... | 0 | 0 | 0 | 0 | 0 | 0 |
at16k/core/segment.py | epignatelli/at16k | 147 | 169188 | """
Audio segment
"""
class Segment():
"""
Audio segment
"""
def __init__(self, waveform, boundaries, sample_rate, channel):
self._waveform = waveform
self._boundaries = boundaries
self._sample_rate = sample_rate
self._channel = channel
@property
def waveform(... | 0 | 4 | 0 | 0 | 4 | 0 |
plugins/module_utils/oci_monitoring_custom_helpers.py | hanielburton/oci-ansible-collection | 108 | 169236 | # 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 COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for details.
from __fu... | 1 | 4 | 1 | 0 | 6 | 0 |
tg/predicates.py | sergiobrr/tg2 | 812 | 169246 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""
Built-in predicate checkers.
This is mostly took from repoze.what.precidates
This is module provides the predicate checkers that were present in the
original "identity" framework of TurboGears 1, plus others.
"""
from __future__ import unicode_literals
... | 2 | 7 | 9 | 0 | 18 | 0 |
soccer3d/soccerdepth/train.py | ngerstle/soccerontable | 465 | 169250 | from soccerdepth.data.dataset_loader import get_set
import numpy as np
import utils.files as file_utils
from os.path import join
import argparse
from soccerdepth.models.hourglass import hg8
from soccerdepth.models.utils import weights_init
from soccerdepth.data.data_utils import image_logger_converter_visdom
import to... | 0 | 2 | 0 | 0 | 2 | 0 |
tests/test_datasets/test_persistent_worker.py | plutoyuxie/mmgeneration | 718 | 169266 | <reponame>plutoyuxie/mmgeneration
import os.path as osp
from mmgen.datasets.builder import build_dataloader, build_dataset
class TestPersistentWorker(object):
@classmethod
def setup_class(cls):
imgs_root = osp.join(osp.dirname(__file__), '..', 'data/image')
train_pipeline = [
dic... | 0 | 0 | 0 | 0 | 0 | 0 |
nonebot/experimental/permission.py | EVAyo/nonebot | 676 | 169279 | """
版本: 1.8.0+
"""
from datetime import datetime, time
from typing import Any, Container
from nonebot.permission import SenderRoles
from nonebot.typing import PermissionPolicy_T
def simple_allow_list(*, user_ids: Container[int] = ...,
group_ids: Container[int] = ...,
rever... | 9 | 4 | 0 | 0 | 13 | 0 |
tools/lib-alert-tree/metalk8s/network.py | SaintLoong/metalk8s | 255 | 169300 | <gh_stars>100-1000
"""Network-related alerts."""
from lib_alert_tree.models import (
DerivedAlert as Derived,
ExistingAlert as Existing,
Relationship,
)
NETWORK_WARNING = Derived.warning(
name="NetworkDegraded",
relationship=Relationship.ANY,
children=[
Existing.warning("NodeNetworkRec... | 0 | 0 | 0 | 0 | 0 | 0 |
Algo and DSA/LeetCode-Solutions-master/Python/maximum-population-year.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 169313 | # Time: O(n)
# Space: O(1)
class Solution(object):
def maximumPopulation(self, logs) -> object:
"""
:type logs: List[List[int]]
:rtype: int
"""
MIN_YEAR, MAX_YEAR = 1950, 2050
years = [0]*(MAX_YEAR-MIN_YEAR+1)
for s, e in logs:
years[s-MIN_YEAR] ... | 0 | 1 | 0 | 0 | 1 | 0 |
myia/operations/prim_make_kwarg.py | strint/myia | 222 | 169325 | """Definitions for the primitive `make_kwarg`."""
from ..lib import AbstractKeywordArgument, standard_prim
from . import primitives as P
@standard_prim(P.make_kwarg)
async def infer_make_kwarg(self, engine, key, value) -> object:
"""Infer the return type of primitive `make_kwarg`."""
k = key.xvalue()
ass... | 0 | 1 | 0 | 0 | 1 | 0 |
airmozilla/manage/tests/views/test_taskstester.py | mozilla/airmozilla | 115 | 169330 | from nose.tools import eq_, ok_
from django.core.urlresolvers import reverse
from .base import ManageTestCase
class TestTasksTester(ManageTestCase):
def test_dashboard(self):
url = reverse('manage:tasks_tester')
response = self.client.get(url)
eq_(response.status_code, 200)
res... | 0 | 0 | 0 | 0 | 0 | 0 |
vpype_viewer/_painters.py | tatarize/vpype | 453 | 169356 | import math
from typing import TYPE_CHECKING, Any, List, Optional, Tuple, Union
import moderngl as mgl
import numpy as np
import vpype as vp
from ._utils import ColorType, load_program, load_texture_array
if TYPE_CHECKING: # pragma: no cover
from .engine import Engine
ResourceType = Union[mgl.Buffer, mgl.Text... | 54 | 18 | 2 | 4 | 78 | 0 |
social_rl/multiagent_tfagents/joint_attention/attention_networks.py | DionysisChristopoulos/google-research | 23,901 | 169360 | # coding=utf-8
# Copyright 2021 The Google Research 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 applicab... | 0 | 0 | 0 | 0 | 0 | 1 |
src/tf_transformers/layers/mlm_layer.py | legacyai/tf-transformers | 116 | 169412 | # coding=utf-8
# Copyright 2021 TF-Transformers 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 r... | 4 | 3 | 0 | 0 | 7 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.